queue.h 1.6 KB

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