Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / drivers / mmc / core / queue.h
1 #ifndef MMC_QUEUE_H
2 #define MMC_QUEUE_H
3
4 #include <linux/types.h>
5 #include <linux/blkdev.h>
6 #include <linux/mmc/core.h>
7 #include <linux/mmc/host.h>
8
9 static inline bool mmc_req_is_special(struct request *req)
10 {
11         return req &&
12                 (req_op(req) == REQ_OP_FLUSH ||
13                  req_op(req) == REQ_OP_DISCARD ||
14                  req_op(req) == REQ_OP_SECURE_ERASE);
15 }
16
17 struct task_struct;
18 struct mmc_blk_data;
19
20 struct mmc_blk_request {
21         struct mmc_request      mrq;
22         struct mmc_command      sbc;
23         struct mmc_command      cmd;
24         struct mmc_command      stop;
25         struct mmc_data         data;
26         int                     retune_retry_done;
27 };
28
29 struct mmc_queue_req {
30         struct request          *req;
31         struct mmc_blk_request  brq;
32         struct scatterlist      *sg;
33         char                    *bounce_buf;
34         struct scatterlist      *bounce_sg;
35         unsigned int            bounce_sg_len;
36         struct mmc_async_req    areq;
37 };
38
39 struct mmc_queue {
40         struct mmc_card         *card;
41         struct task_struct      *thread;
42         struct semaphore        thread_sem;
43         bool                    new_request;
44         bool                    suspended;
45         bool                    asleep;
46         struct mmc_blk_data     *blkdata;
47         struct request_queue    *queue;
48         struct mmc_queue_req    *mqrq;
49         struct mmc_queue_req    *mqrq_cur;
50         struct mmc_queue_req    *mqrq_prev;
51         int                     qdepth;
52 };
53
54 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
55                           const char *);
56 extern void mmc_cleanup_queue(struct mmc_queue *);
57 extern void mmc_queue_suspend(struct mmc_queue *);
58 extern void mmc_queue_resume(struct mmc_queue *);
59
60 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
61                                      struct mmc_queue_req *);
62 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
63 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
64
65 extern int mmc_access_rpmb(struct mmc_queue *);
66
67 #endif