at v4.12 1.9 kB view raw
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 9static 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 17struct task_struct; 18struct mmc_blk_data; 19 20struct 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 29struct 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 int task_id; 38}; 39 40struct mmc_queue { 41 struct mmc_card *card; 42 struct task_struct *thread; 43 struct semaphore thread_sem; 44 bool suspended; 45 bool asleep; 46 struct mmc_blk_data *blkdata; 47 struct request_queue *queue; 48 struct mmc_queue_req *mqrq; 49 int qdepth; 50 int qcnt; 51 unsigned long qslots; 52}; 53 54extern int mmc_queue_alloc_shared_queue(struct mmc_card *card); 55extern void mmc_queue_free_shared_queue(struct mmc_card *card); 56extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *, 57 const char *); 58extern void mmc_cleanup_queue(struct mmc_queue *); 59extern void mmc_queue_suspend(struct mmc_queue *); 60extern void mmc_queue_resume(struct mmc_queue *); 61 62extern unsigned int mmc_queue_map_sg(struct mmc_queue *, 63 struct mmc_queue_req *); 64extern void mmc_queue_bounce_pre(struct mmc_queue_req *); 65extern void mmc_queue_bounce_post(struct mmc_queue_req *); 66 67extern int mmc_access_rpmb(struct mmc_queue *); 68 69extern struct mmc_queue_req *mmc_queue_req_find(struct mmc_queue *, 70 struct request *); 71extern void mmc_queue_req_free(struct mmc_queue *, struct mmc_queue_req *); 72 73#endif