Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / mmc / card / queue.h
1 #ifndef MMC_QUEUE_H
2 #define MMC_QUEUE_H
3
4 #define MMC_REQ_SPECIAL_MASK    (REQ_DISCARD | REQ_FLUSH)
5
6 struct request;
7 struct task_struct;
8
9 struct mmc_blk_request {
10         struct mmc_request      mrq;
11         struct mmc_command      sbc;
12         struct mmc_command      cmd;
13         struct mmc_command      stop;
14         struct mmc_data         data;
15 };
16
17 enum mmc_packed_type {
18         MMC_PACKED_NONE = 0,
19         MMC_PACKED_WRITE,
20 };
21
22 #define mmc_packed_cmd(type)    ((type) != MMC_PACKED_NONE)
23 #define mmc_packed_wr(type)     ((type) == MMC_PACKED_WRITE)
24
25 struct mmc_packed {
26         struct list_head        list;
27         u32                     cmd_hdr[1024];
28         unsigned int            blocks;
29         u8                      nr_entries;
30         u8                      retries;
31         s16                     idx_failure;
32 };
33
34 struct mmc_queue_req {
35         struct request          *req;
36         struct mmc_blk_request  brq;
37         struct scatterlist      *sg;
38         char                    *bounce_buf;
39         struct scatterlist      *bounce_sg;
40         unsigned int            bounce_sg_len;
41         struct mmc_async_req    mmc_active;
42         enum mmc_packed_type    cmd_type;
43         struct mmc_packed       *packed;
44 };
45
46 struct mmc_queue {
47         struct mmc_card         *card;
48         struct task_struct      *thread;
49         struct semaphore        thread_sem;
50         unsigned int            flags;
51 #define MMC_QUEUE_SUSPENDED     (1 << 0)
52 #define MMC_QUEUE_NEW_REQUEST   (1 << 1)
53
54         int                     (*issue_fn)(struct mmc_queue *, struct request *);
55         void                    *data;
56         struct request_queue    *queue;
57         struct mmc_queue_req    mqrq[2];
58         struct mmc_queue_req    *mqrq_cur;
59         struct mmc_queue_req    *mqrq_prev;
60 };
61
62 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
63                           const char *);
64 extern void mmc_cleanup_queue(struct mmc_queue *);
65 extern void mmc_queue_suspend(struct mmc_queue *);
66 extern void mmc_queue_resume(struct mmc_queue *);
67
68 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
69                                      struct mmc_queue_req *);
70 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
71 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
72
73 extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
74 extern void mmc_packed_clean(struct mmc_queue *);
75
76 extern int mmc_access_rpmb(struct mmc_queue *);
77
78 #endif