queue.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef MMC_QUEUE_H
  2. #define MMC_QUEUE_H
  3. #include <linux/types.h>
  4. #include <linux/blkdev.h>
  5. #include <linux/mmc/core.h>
  6. #include <linux/mmc/host.h>
  7. static inline bool mmc_req_is_special(struct request *req)
  8. {
  9. return req &&
  10. (req_op(req) == REQ_OP_FLUSH ||
  11. req_op(req) == REQ_OP_DISCARD ||
  12. req_op(req) == REQ_OP_SECURE_ERASE);
  13. }
  14. struct task_struct;
  15. struct mmc_blk_data;
  16. struct mmc_blk_request {
  17. struct mmc_request mrq;
  18. struct mmc_command sbc;
  19. struct mmc_command cmd;
  20. struct mmc_command stop;
  21. struct mmc_data data;
  22. int retune_retry_done;
  23. };
  24. struct mmc_queue_req {
  25. struct request *req;
  26. struct mmc_blk_request brq;
  27. struct scatterlist *sg;
  28. char *bounce_buf;
  29. struct scatterlist *bounce_sg;
  30. unsigned int bounce_sg_len;
  31. struct mmc_async_req mmc_active;
  32. };
  33. struct mmc_queue {
  34. struct mmc_card *card;
  35. struct task_struct *thread;
  36. struct semaphore thread_sem;
  37. unsigned int flags;
  38. #define MMC_QUEUE_SUSPENDED (1 << 0)
  39. #define MMC_QUEUE_NEW_REQUEST (1 << 1)
  40. bool asleep;
  41. struct mmc_blk_data *blkdata;
  42. struct request_queue *queue;
  43. struct mmc_queue_req *mqrq;
  44. struct mmc_queue_req *mqrq_cur;
  45. struct mmc_queue_req *mqrq_prev;
  46. int qdepth;
  47. };
  48. extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
  49. const char *);
  50. extern void mmc_cleanup_queue(struct mmc_queue *);
  51. extern void mmc_queue_suspend(struct mmc_queue *);
  52. extern void mmc_queue_resume(struct mmc_queue *);
  53. extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
  54. struct mmc_queue_req *);
  55. extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
  56. extern void mmc_queue_bounce_post(struct mmc_queue_req *);
  57. extern int mmc_access_rpmb(struct mmc_queue *);
  58. #endif