M7350/kernel/drivers/mmc/card/queue.h

102 lines
2.8 KiB
C
Raw Normal View History

2024-09-09 08:52:07 +00:00
#ifndef MMC_QUEUE_H
#define MMC_QUEUE_H
2024-09-09 08:57:42 +00:00
#define MMC_REQ_SPECIAL_MASK (REQ_DISCARD | REQ_FLUSH)
2024-09-09 08:52:07 +00:00
struct request;
struct task_struct;
struct mmc_blk_request {
struct mmc_request mrq;
struct mmc_command sbc;
struct mmc_command cmd;
struct mmc_command stop;
struct mmc_data data;
};
2024-09-09 08:57:42 +00:00
enum mmc_packed_type {
2024-09-09 08:52:07 +00:00
MMC_PACKED_NONE = 0,
MMC_PACKED_WRITE,
};
2024-09-09 08:57:42 +00:00
#define mmc_packed_cmd(type) ((type) != MMC_PACKED_NONE)
#define mmc_packed_wr(type) ((type) == MMC_PACKED_WRITE)
struct mmc_packed {
struct list_head list;
u32 cmd_hdr[1024];
unsigned int blocks;
u8 nr_entries;
u8 retries;
s16 idx_failure;
};
2024-09-09 08:52:07 +00:00
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;
struct mmc_async_req mmc_active;
2024-09-09 08:57:42 +00:00
enum mmc_packed_type cmd_type;
struct mmc_packed *packed;
struct mmc_cmdq_req cmdq_req;
2024-09-09 08:52:07 +00:00
};
struct mmc_queue {
struct mmc_card *card;
struct task_struct *thread;
struct semaphore thread_sem;
2024-09-09 08:57:42 +00:00
unsigned long flags;
#define MMC_QUEUE_SUSPENDED 0
#define MMC_QUEUE_NEW_REQUEST 1
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
int (*issue_fn)(struct mmc_queue *, struct request *);
int (*cmdq_issue_fn)(struct mmc_queue *,
struct request *);
void (*cmdq_complete_fn)(struct request *);
void (*cmdq_error_fn)(struct mmc_queue *);
enum blk_eh_timer_return (*cmdq_req_timed_out)(struct request *);
2024-09-09 08:52:07 +00:00
void *data;
struct request_queue *queue;
struct mmc_queue_req mqrq[2];
struct mmc_queue_req *mqrq_cur;
struct mmc_queue_req *mqrq_prev;
2024-09-09 08:57:42 +00:00
struct mmc_queue_req *mqrq_cmdq;
2024-09-09 08:52:07 +00:00
bool wr_packing_enabled;
int num_of_potential_packed_wr_reqs;
int num_wr_reqs_to_start_packing;
bool no_pack_for_random;
2024-09-09 08:57:42 +00:00
struct work_struct cmdq_err_work;
struct completion cmdq_pending_req_done;
struct request *cmdq_req_peeked;
2024-09-09 08:52:07 +00:00
int (*err_check_fn) (struct mmc_card *, struct mmc_async_req *);
void (*packed_test_fn) (struct request_queue *, struct mmc_queue_req *);
2024-09-09 08:57:42 +00:00
void (*cmdq_shutdown)(struct mmc_queue *);
2024-09-09 08:52:07 +00:00
};
extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
2024-09-09 08:57:42 +00:00
const char *, int);
2024-09-09 08:52:07 +00:00
extern void mmc_cleanup_queue(struct mmc_queue *);
2024-09-09 08:57:42 +00:00
extern int mmc_queue_suspend(struct mmc_queue *, int);
2024-09-09 08:52:07 +00:00
extern void mmc_queue_resume(struct mmc_queue *);
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 *);
2024-09-09 08:57:42 +00:00
extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
extern void mmc_packed_clean(struct mmc_queue *);
extern int mmc_access_rpmb(struct mmc_queue *);
2024-09-09 08:52:07 +00:00
extern void print_mmc_packing_stats(struct mmc_card *card);
2024-09-09 08:57:42 +00:00
extern int mmc_cmdq_init(struct mmc_queue *mq, struct mmc_card *card);
extern void mmc_cmdq_clean(struct mmc_queue *mq, struct mmc_card *card);
2024-09-09 08:52:07 +00:00
#endif