linux/drivers/mmc/card/queue.h
<<
>>
Prefs
   1#ifndef MMC_QUEUE_H
   2#define MMC_QUEUE_H
   3
   4static inline bool mmc_req_is_special(struct request *req)
   5{
   6        return req &&
   7                (req_op(req) == REQ_OP_FLUSH ||
   8                 req_op(req) == REQ_OP_DISCARD ||
   9                 req_op(req) == REQ_OP_SECURE_ERASE);
  10}
  11
  12struct request;
  13struct task_struct;
  14
  15struct mmc_blk_request {
  16        struct mmc_request      mrq;
  17        struct mmc_command      sbc;
  18        struct mmc_command      cmd;
  19        struct mmc_command      stop;
  20        struct mmc_data         data;
  21        int                     retune_retry_done;
  22};
  23
  24enum mmc_packed_type {
  25        MMC_PACKED_NONE = 0,
  26        MMC_PACKED_WRITE,
  27};
  28
  29#define mmc_packed_cmd(type)    ((type) != MMC_PACKED_NONE)
  30#define mmc_packed_wr(type)     ((type) == MMC_PACKED_WRITE)
  31
  32struct mmc_packed {
  33        struct list_head        list;
  34        __le32                  cmd_hdr[1024];
  35        unsigned int            blocks;
  36        u8                      nr_entries;
  37        u8                      retries;
  38        s16                     idx_failure;
  39};
  40
  41struct mmc_queue_req {
  42        struct request          *req;
  43        struct mmc_blk_request  brq;
  44        struct scatterlist      *sg;
  45        char                    *bounce_buf;
  46        struct scatterlist      *bounce_sg;
  47        unsigned int            bounce_sg_len;
  48        struct mmc_async_req    mmc_active;
  49        enum mmc_packed_type    cmd_type;
  50        struct mmc_packed       *packed;
  51};
  52
  53struct mmc_queue {
  54        struct mmc_card         *card;
  55        struct task_struct      *thread;
  56        struct semaphore        thread_sem;
  57        unsigned int            flags;
  58#define MMC_QUEUE_SUSPENDED     (1 << 0)
  59#define MMC_QUEUE_NEW_REQUEST   (1 << 1)
  60        void                    *data;
  61        struct request_queue    *queue;
  62        struct mmc_queue_req    mqrq[2];
  63        struct mmc_queue_req    *mqrq_cur;
  64        struct mmc_queue_req    *mqrq_prev;
  65};
  66
  67extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
  68                          const char *);
  69extern void mmc_cleanup_queue(struct mmc_queue *);
  70extern void mmc_queue_suspend(struct mmc_queue *);
  71extern void mmc_queue_resume(struct mmc_queue *);
  72
  73extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
  74                                     struct mmc_queue_req *);
  75extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
  76extern void mmc_queue_bounce_post(struct mmc_queue_req *);
  77
  78extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
  79extern void mmc_packed_clean(struct mmc_queue *);
  80
  81extern int mmc_access_rpmb(struct mmc_queue *);
  82
  83#endif
  84