blob: d761bf1bbf60b832ca9a00a5c41825c8bec1ba6c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef MMC_QUEUE_H
2#define MMC_QUEUE_H
3
4struct request;
5struct task_struct;
6
Per Forlincb86e7b2011-07-09 17:12:36 -04007struct mmc_blk_request {
8 struct mmc_request mrq;
9 struct mmc_command sbc;
10 struct mmc_command cmd;
11 struct mmc_command stop;
12 struct mmc_data data;
13};
14
Seungwon Jeon968c7742012-05-31 11:54:47 +030015enum mmc_packed_cmd {
16 MMC_PACKED_NONE = 0,
17 MMC_PACKED_WRITE,
18};
19
Per Forlincb86e7b2011-07-09 17:12:36 -040020struct mmc_queue_req {
21 struct request *req;
22 struct mmc_blk_request brq;
23 struct scatterlist *sg;
24 char *bounce_buf;
25 struct scatterlist *bounce_sg;
26 unsigned int bounce_sg_len;
Per Forlin91fd00b2011-07-01 18:55:33 +020027 struct mmc_async_req mmc_active;
Seungwon Jeon968c7742012-05-31 11:54:47 +030028 struct list_head packed_list;
29 u32 packed_cmd_hdr[128];
30 unsigned int packed_blocks;
31 enum mmc_packed_cmd packed_cmd;
32 int packed_fail_idx;
33 u8 packed_num;
Per Forlincb86e7b2011-07-09 17:12:36 -040034};
35
Linus Torvalds1da177e2005-04-16 15:20:36 -070036struct mmc_queue {
37 struct mmc_card *card;
Christoph Hellwig87598a22006-11-13 20:23:52 +010038 struct task_struct *thread;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 struct semaphore thread_sem;
40 unsigned int flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 int (*issue_fn)(struct mmc_queue *, struct request *);
42 void *data;
43 struct request_queue *queue;
Per Forlind07424b2011-07-01 18:55:31 +020044 struct mmc_queue_req mqrq[2];
Per Forlincb86e7b2011-07-09 17:12:36 -040045 struct mmc_queue_req *mqrq_cur;
Per Forlind07424b2011-07-01 18:55:31 +020046 struct mmc_queue_req *mqrq_prev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070047};
48
Adrian Hunterd09408a2011-06-23 13:40:28 +030049extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
50 const char *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051extern void mmc_cleanup_queue(struct mmc_queue *);
52extern void mmc_queue_suspend(struct mmc_queue *);
53extern void mmc_queue_resume(struct mmc_queue *);
54
Per Forlincb86e7b2011-07-09 17:12:36 -040055extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
56 struct mmc_queue_req *);
57extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
58extern void mmc_queue_bounce_post(struct mmc_queue_req *);
Pierre Ossman98ccf142007-05-12 00:26:16 +020059
Linus Torvalds1da177e2005-04-16 15:20:36 -070060#endif