]> Pileus Git - ~andy/linux/blob - drivers/mmc/card/queue.h
Merge tag 'for_linux-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel...
[~andy/linux] / drivers / mmc / card / queue.h
1 #ifndef MMC_QUEUE_H
2 #define MMC_QUEUE_H
3
4 struct request;
5 struct task_struct;
6
7 struct 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
15 enum mmc_packed_type {
16         MMC_PACKED_NONE = 0,
17         MMC_PACKED_WRITE,
18 };
19
20 #define mmc_packed_cmd(type)    ((type) != MMC_PACKED_NONE)
21 #define mmc_packed_wr(type)     ((type) == MMC_PACKED_WRITE)
22
23 struct mmc_packed {
24         struct list_head        list;
25         u32                     cmd_hdr[1024];
26         unsigned int            blocks;
27         u8                      nr_entries;
28         u8                      retries;
29         s16                     idx_failure;
30 };
31
32 struct mmc_queue_req {
33         struct request          *req;
34         struct mmc_blk_request  brq;
35         struct scatterlist      *sg;
36         char                    *bounce_buf;
37         struct scatterlist      *bounce_sg;
38         unsigned int            bounce_sg_len;
39         struct mmc_async_req    mmc_active;
40         enum mmc_packed_type    cmd_type;
41         struct mmc_packed       *packed;
42 };
43
44 struct mmc_queue {
45         struct mmc_card         *card;
46         struct task_struct      *thread;
47         struct semaphore        thread_sem;
48         unsigned int            flags;
49 #define MMC_QUEUE_SUSPENDED     (1 << 0)
50 #define MMC_QUEUE_NEW_REQUEST   (1 << 1)
51
52         int                     (*issue_fn)(struct mmc_queue *, struct request *);
53         void                    *data;
54         struct request_queue    *queue;
55         struct mmc_queue_req    mqrq[2];
56         struct mmc_queue_req    *mqrq_cur;
57         struct mmc_queue_req    *mqrq_prev;
58 };
59
60 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
61                           const char *);
62 extern void mmc_cleanup_queue(struct mmc_queue *);
63 extern void mmc_queue_suspend(struct mmc_queue *);
64 extern void mmc_queue_resume(struct mmc_queue *);
65
66 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
67                                      struct mmc_queue_req *);
68 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
69 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
70
71 extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
72 extern void mmc_packed_clean(struct mmc_queue *);
73
74 #endif