xref: /openbmc/linux/drivers/mmc/core/queue.h (revision 8730046c)
1 #ifndef MMC_QUEUE_H
2 #define MMC_QUEUE_H
3 
4 static inline bool mmc_req_is_special(struct request *req)
5 {
6 	return req &&
7 		(req_op(req) == REQ_OP_FLUSH ||
8 		 req_op(req) == REQ_OP_DISCARD ||
9 		 req_op(req) == REQ_OP_SECURE_ERASE);
10 }
11 
12 struct request;
13 struct task_struct;
14 struct mmc_blk_data;
15 
16 struct mmc_blk_request {
17 	struct mmc_request	mrq;
18 	struct mmc_command	sbc;
19 	struct mmc_command	cmd;
20 	struct mmc_command	stop;
21 	struct mmc_data		data;
22 	int			retune_retry_done;
23 };
24 
25 struct mmc_queue_req {
26 	struct request		*req;
27 	struct mmc_blk_request	brq;
28 	struct scatterlist	*sg;
29 	char			*bounce_buf;
30 	struct scatterlist	*bounce_sg;
31 	unsigned int		bounce_sg_len;
32 	struct mmc_async_req	mmc_active;
33 };
34 
35 struct mmc_queue {
36 	struct mmc_card		*card;
37 	struct task_struct	*thread;
38 	struct semaphore	thread_sem;
39 	unsigned int		flags;
40 #define MMC_QUEUE_SUSPENDED	(1 << 0)
41 #define MMC_QUEUE_NEW_REQUEST	(1 << 1)
42 	bool			asleep;
43 	struct mmc_blk_data	*blkdata;
44 	struct request_queue	*queue;
45 	struct mmc_queue_req	*mqrq;
46 	struct mmc_queue_req	*mqrq_cur;
47 	struct mmc_queue_req	*mqrq_prev;
48 	int			qdepth;
49 };
50 
51 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
52 			  const char *);
53 extern void mmc_cleanup_queue(struct mmc_queue *);
54 extern void mmc_queue_suspend(struct mmc_queue *);
55 extern void mmc_queue_resume(struct mmc_queue *);
56 
57 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
58 				     struct mmc_queue_req *);
59 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
60 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
61 
62 extern int mmc_access_rpmb(struct mmc_queue *);
63 
64 #endif
65