4 #include <linux/types.h>
5 #include <linux/blkdev.h>
6 #include <linux/blk-mq.h>
7 #include <linux/mmc/core.h>
8 #include <linux/mmc/host.h>
10 static inline struct mmc_queue_req *req_to_mmc_queue_req(struct request *rq)
12 return blk_mq_rq_to_pdu(rq);
17 static inline struct request *mmc_queue_req_to_req(struct mmc_queue_req *mqr)
19 return blk_mq_rq_from_pdu(mqr);
24 struct mmc_blk_ioc_data;
26 struct mmc_blk_request {
27 struct mmc_request mrq;
28 struct mmc_command sbc;
29 struct mmc_command cmd;
30 struct mmc_command stop;
32 int retune_retry_done;
36 * enum mmc_drv_op - enumerates the operations in the mmc_queue_req
37 * @MMC_DRV_OP_IOCTL: ioctl operation
38 * @MMC_DRV_OP_BOOT_WP: write protect boot partitions
39 * @MMC_DRV_OP_GET_CARD_STATUS: get card status
40 * @MMC_DRV_OP_GET_EXT_CSD: get the EXT CSD from an eMMC card
45 MMC_DRV_OP_GET_CARD_STATUS,
46 MMC_DRV_OP_GET_EXT_CSD,
49 struct mmc_queue_req {
50 struct mmc_blk_request brq;
51 struct scatterlist *sg;
53 struct scatterlist *bounce_sg;
54 unsigned int bounce_sg_len;
55 struct mmc_async_req areq;
56 enum mmc_drv_op drv_op;
59 unsigned int ioc_count;
63 struct mmc_card *card;
64 struct task_struct *thread;
65 struct semaphore thread_sem;
68 struct mmc_blk_data *blkdata;
69 struct request_queue *queue;
71 * FIXME: this counter is not a very reliable way of keeping
72 * track of how many requests that are ongoing. Switch to just
73 * letting the block core keep track of requests and per-request
74 * associated mmc_queue_req data.
79 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
81 extern void mmc_cleanup_queue(struct mmc_queue *);
82 extern void mmc_queue_suspend(struct mmc_queue *);
83 extern void mmc_queue_resume(struct mmc_queue *);
85 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
86 struct mmc_queue_req *);
87 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
88 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
90 extern int mmc_access_rpmb(struct mmc_queue *);