Merge tag 'riscv-for-linus-4.15-rc2_cleanups' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / drivers / mmc / core / queue.h
blob547b457c4251f5e8be71e33e7e9980d281ba6dd9
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef MMC_QUEUE_H
3 #define MMC_QUEUE_H
5 #include <linux/types.h>
6 #include <linux/blkdev.h>
7 #include <linux/blk-mq.h>
8 #include <linux/mmc/core.h>
9 #include <linux/mmc/host.h>
11 static inline struct mmc_queue_req *req_to_mmc_queue_req(struct request *rq)
13 return blk_mq_rq_to_pdu(rq);
16 struct mmc_queue_req;
18 static inline struct request *mmc_queue_req_to_req(struct mmc_queue_req *mqr)
20 return blk_mq_rq_from_pdu(mqr);
23 struct task_struct;
24 struct mmc_blk_data;
25 struct mmc_blk_ioc_data;
27 struct mmc_blk_request {
28 struct mmc_request mrq;
29 struct mmc_command sbc;
30 struct mmc_command cmd;
31 struct mmc_command stop;
32 struct mmc_data data;
33 int retune_retry_done;
36 /**
37 * enum mmc_drv_op - enumerates the operations in the mmc_queue_req
38 * @MMC_DRV_OP_IOCTL: ioctl operation
39 * @MMC_DRV_OP_IOCTL_RPMB: RPMB-oriented ioctl operation
40 * @MMC_DRV_OP_BOOT_WP: write protect boot partitions
41 * @MMC_DRV_OP_GET_CARD_STATUS: get card status
42 * @MMC_DRV_OP_GET_EXT_CSD: get the EXT CSD from an eMMC card
44 enum mmc_drv_op {
45 MMC_DRV_OP_IOCTL,
46 MMC_DRV_OP_IOCTL_RPMB,
47 MMC_DRV_OP_BOOT_WP,
48 MMC_DRV_OP_GET_CARD_STATUS,
49 MMC_DRV_OP_GET_EXT_CSD,
52 struct mmc_queue_req {
53 struct mmc_blk_request brq;
54 struct scatterlist *sg;
55 struct mmc_async_req areq;
56 enum mmc_drv_op drv_op;
57 int drv_op_result;
58 void *drv_op_data;
59 unsigned int ioc_count;
62 struct mmc_queue {
63 struct mmc_card *card;
64 struct task_struct *thread;
65 struct semaphore thread_sem;
66 bool suspended;
67 bool asleep;
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.
76 int qcnt;
79 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
80 const char *);
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 *);
84 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
85 struct mmc_queue_req *);
87 #endif