queue.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 areq;
  32. int task_id;
  33. };
  34. struct mmc_queue {
  35. struct mmc_card *card;
  36. struct task_struct *thread;
  37. struct semaphore thread_sem;
  38. bool suspended;
  39. bool asleep;
  40. struct mmc_blk_data *blkdata;
  41. struct request_queue *queue;
  42. struct mmc_queue_req *mqrq;
  43. int qdepth;
  44. int qcnt;
  45. unsigned long qslots;
  46. };
  47. extern int mmc_queue_alloc_shared_queue(struct mmc_card *card);
  48. extern void mmc_queue_free_shared_queue(struct mmc_card *card);
  49. extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
  50. const char *);
  51. extern void mmc_cleanup_queue(struct mmc_queue *);
  52. extern void mmc_queue_suspend(struct mmc_queue *);
  53. extern void mmc_queue_resume(struct mmc_queue *);
  54. extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
  55. struct mmc_queue_req *);
  56. extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
  57. extern void mmc_queue_bounce_post(struct mmc_queue_req *);
  58. extern int mmc_access_rpmb(struct mmc_queue *);
  59. extern struct mmc_queue_req *mmc_queue_req_find(struct mmc_queue *,
  60. struct request *);
  61. extern void mmc_queue_req_free(struct mmc_queue *, struct mmc_queue_req *);
  62. #endif