Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef MMC_QUEUE_H |
| 2 | #define MMC_QUEUE_H |
| 3 | |
Ulf Hansson | 066185d | 2017-01-13 14:14:07 +0100 | [diff] [blame] | 4 | #include <linux/types.h> |
| 5 | #include <linux/blkdev.h> |
| 6 | #include <linux/mmc/core.h> |
| 7 | #include <linux/mmc/host.h> |
| 8 | |
Mike Christie | c2df40d | 2016-06-05 14:32:17 -0500 | [diff] [blame] | 9 | static inline bool mmc_req_is_special(struct request *req) |
| 10 | { |
Mike Christie | 3a5e02c | 2016-06-05 14:32:23 -0500 | [diff] [blame] | 11 | return req && |
Adrian Hunter | 7afafc8 | 2016-08-16 10:59:35 +0300 | [diff] [blame] | 12 | (req_op(req) == REQ_OP_FLUSH || |
| 13 | req_op(req) == REQ_OP_DISCARD || |
| 14 | req_op(req) == REQ_OP_SECURE_ERASE); |
Mike Christie | c2df40d | 2016-06-05 14:32:17 -0500 | [diff] [blame] | 15 | } |
Seungwon Jeon | ef3a69c7 | 2013-03-14 15:17:13 +0900 | [diff] [blame] | 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | struct task_struct; |
Linus Walleij | 7db3028 | 2016-11-18 13:36:15 +0100 | [diff] [blame] | 18 | struct mmc_blk_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Per Forlin | 97868a2 | 2011-07-09 17:12:36 -0400 | [diff] [blame] | 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; |
Adrian Hunter | b8360a4 | 2015-05-07 13:10:24 +0300 | [diff] [blame] | 26 | int retune_retry_done; |
Per Forlin | 97868a2 | 2011-07-09 17:12:36 -0400 | [diff] [blame] | 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; |
Linus Walleij | 74f5ba3 | 2017-02-01 13:47:55 +0100 | [diff] [blame] | 36 | struct mmc_async_req areq; |
Per Forlin | 97868a2 | 2011-07-09 17:12:36 -0400 | [diff] [blame] | 37 | }; |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | struct mmc_queue { |
| 40 | struct mmc_card *card; |
Christoph Hellwig | 87598a2 | 2006-11-13 20:23:52 +0100 | [diff] [blame] | 41 | struct task_struct *thread; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | struct semaphore thread_sem; |
Linus Walleij | 9491be5 | 2017-02-01 13:47:56 +0100 | [diff] [blame^] | 43 | bool new_request; |
| 44 | bool suspended; |
Adrian Hunter | e0097cf | 2016-11-29 12:09:10 +0200 | [diff] [blame] | 45 | bool asleep; |
Linus Walleij | 7db3028 | 2016-11-18 13:36:15 +0100 | [diff] [blame] | 46 | struct mmc_blk_data *blkdata; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | struct request_queue *queue; |
Adrian Hunter | c5bda0c | 2016-11-29 12:09:15 +0200 | [diff] [blame] | 48 | struct mmc_queue_req *mqrq; |
Per Forlin | 97868a2 | 2011-07-09 17:12:36 -0400 | [diff] [blame] | 49 | struct mmc_queue_req *mqrq_cur; |
Per Forlin | 04296b7 | 2011-07-01 18:55:31 +0200 | [diff] [blame] | 50 | struct mmc_queue_req *mqrq_prev; |
Adrian Hunter | c5bda0c | 2016-11-29 12:09:15 +0200 | [diff] [blame] | 51 | int qdepth; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
Adrian Hunter | d09408a | 2011-06-23 13:40:28 +0300 | [diff] [blame] | 54 | extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *, |
| 55 | const char *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | extern void mmc_cleanup_queue(struct mmc_queue *); |
| 57 | extern void mmc_queue_suspend(struct mmc_queue *); |
| 58 | extern void mmc_queue_resume(struct mmc_queue *); |
| 59 | |
Per Forlin | 97868a2 | 2011-07-09 17:12:36 -0400 | [diff] [blame] | 60 | extern unsigned int mmc_queue_map_sg(struct mmc_queue *, |
| 61 | struct mmc_queue_req *); |
| 62 | extern void mmc_queue_bounce_pre(struct mmc_queue_req *); |
| 63 | extern void mmc_queue_bounce_post(struct mmc_queue_req *); |
Pierre Ossman | 98ccf14 | 2007-05-12 00:26:16 +0200 | [diff] [blame] | 64 | |
Chuanxiao Dong | 4e93b9a | 2014-08-12 12:01:30 +0800 | [diff] [blame] | 65 | extern int mmc_access_rpmb(struct mmc_queue *); |
| 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #endif |