queue.h 1.7 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
#ifndef MMC_QUEUE_H
#define MMC_QUEUE_H

4 5 6 7 8
#include <linux/types.h>
#include <linux/blkdev.h>
#include <linux/mmc/core.h>
#include <linux/mmc/host.h>

M
Mike Christie 已提交
9 10
static inline bool mmc_req_is_special(struct request *req)
{
11
	return req &&
A
Adrian Hunter 已提交
12 13 14
		(req_op(req) == REQ_OP_FLUSH ||
		 req_op(req) == REQ_OP_DISCARD ||
		 req_op(req) == REQ_OP_SECURE_ERASE);
M
Mike Christie 已提交
15
}
16

L
Linus Torvalds 已提交
17
struct task_struct;
L
Linus Walleij 已提交
18
struct mmc_blk_data;
L
Linus Torvalds 已提交
19

20 21 22 23 24 25
struct mmc_blk_request {
	struct mmc_request	mrq;
	struct mmc_command	sbc;
	struct mmc_command	cmd;
	struct mmc_command	stop;
	struct mmc_data		data;
26
	int			retune_retry_done;
27 28 29 30 31 32 33 34 35
};

struct mmc_queue_req {
	struct request		*req;
	struct mmc_blk_request	brq;
	struct scatterlist	*sg;
	char			*bounce_buf;
	struct scatterlist	*bounce_sg;
	unsigned int		bounce_sg_len;
36
	struct mmc_async_req	mmc_active;
37 38
};

L
Linus Torvalds 已提交
39 40
struct mmc_queue {
	struct mmc_card		*card;
C
Christoph Hellwig 已提交
41
	struct task_struct	*thread;
L
Linus Torvalds 已提交
42 43
	struct semaphore	thread_sem;
	unsigned int		flags;
44 45
#define MMC_QUEUE_SUSPENDED	(1 << 0)
#define MMC_QUEUE_NEW_REQUEST	(1 << 1)
46
	bool			asleep;
L
Linus Walleij 已提交
47
	struct mmc_blk_data	*blkdata;
L
Linus Torvalds 已提交
48
	struct request_queue	*queue;
49
	struct mmc_queue_req	*mqrq;
50
	struct mmc_queue_req	*mqrq_cur;
51
	struct mmc_queue_req	*mqrq_prev;
52
	int			qdepth;
L
Linus Torvalds 已提交
53 54
};

55 56
extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
			  const char *);
L
Linus Torvalds 已提交
57 58 59 60
extern void mmc_cleanup_queue(struct mmc_queue *);
extern void mmc_queue_suspend(struct mmc_queue *);
extern void mmc_queue_resume(struct mmc_queue *);

61 62 63 64
extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
				     struct mmc_queue_req *);
extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
extern void mmc_queue_bounce_post(struct mmc_queue_req *);
65

66 67
extern int mmc_access_rpmb(struct mmc_queue *);

L
Linus Torvalds 已提交
68
#endif