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 int task_id; 38 }; 39 40 struct 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 54 extern int mmc_queue_alloc_shared_queue(struct mmc_card *card); 55 extern void mmc_queue_free_shared_queue(struct mmc_card *card); 56 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *, 57 const char *); 58 extern void mmc_cleanup_queue(struct mmc_queue *); 59 extern void mmc_queue_suspend(struct mmc_queue *); 60 extern void mmc_queue_resume(struct mmc_queue *); 61 62 extern unsigned int mmc_queue_map_sg(struct mmc_queue *, 63 struct mmc_queue_req *); 64 extern void mmc_queue_bounce_pre(struct mmc_queue_req *); 65 extern void mmc_queue_bounce_post(struct mmc_queue_req *); 66 67 extern int mmc_access_rpmb(struct mmc_queue *); 68 69 extern struct mmc_queue_req *mmc_queue_req_find(struct mmc_queue *, 70 struct request *); 71 extern void mmc_queue_req_free(struct mmc_queue *, struct mmc_queue_req *); 72 73 #endif 74