blob: 93e4b59f119b022b61171928be3ce8d5cd7968b9 [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 Jeon53f8f572012-09-27 15:00:26 +020015enum 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 Jeon53f8f572012-09-27 15:00:26 +020028 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_retries;
33 int packed_fail_idx;
34 u8 packed_num;
Per Forlincb86e7b2011-07-09 17:12:36 -040035};
36
Linus Torvalds1da177e2005-04-16 15:20:36 -070037struct mmc_queue {
38 struct mmc_card *card;
Christoph Hellwig87598a22006-11-13 20:23:52 +010039 struct task_struct *thread;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 struct semaphore thread_sem;
41 unsigned int flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 int (*issue_fn)(struct mmc_queue *, struct request *);
43 void *data;
44 struct request_queue *queue;
Per Forlind07424b2011-07-01 18:55:31 +020045 struct mmc_queue_req mqrq[2];
Per Forlincb86e7b2011-07-09 17:12:36 -040046 struct mmc_queue_req *mqrq_cur;
Per Forlind07424b2011-07-01 18:55:31 +020047 struct mmc_queue_req *mqrq_prev;
Tatyana Brokhman0cc76402012-10-07 09:52:16 +020048 bool wr_packing_enabled;
49 int num_of_potential_packed_wr_reqs;
50 int num_wr_reqs_to_start_packing;
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
Adrian Hunterd09408a2011-06-23 13:40:28 +030053extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
54 const char *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055extern void mmc_cleanup_queue(struct mmc_queue *);
56extern void mmc_queue_suspend(struct mmc_queue *);
57extern void mmc_queue_resume(struct mmc_queue *);
58
Per Forlincb86e7b2011-07-09 17:12:36 -040059extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
60 struct mmc_queue_req *);
61extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
62extern void mmc_queue_bounce_post(struct mmc_queue_req *);
Pierre Ossman98ccf142007-05-12 00:26:16 +020063
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#endif