queue.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef MMC_QUEUE_H
  2. #define MMC_QUEUE_H
  3. #define MMC_REQ_SPECIAL_MASK (REQ_DISCARD | REQ_FLUSH)
  4. struct request;
  5. struct task_struct;
  6. struct mmc_blk_request {
  7. struct mmc_request mrq;
  8. struct mmc_command sbc;
  9. struct mmc_command cmd;
  10. struct mmc_command stop;
  11. struct mmc_data data;
  12. };
  13. enum mmc_packed_type {
  14. MMC_PACKED_NONE = 0,
  15. MMC_PACKED_WRITE,
  16. };
  17. #define mmc_packed_cmd(type) ((type) != MMC_PACKED_NONE)
  18. #define mmc_packed_wr(type) ((type) == MMC_PACKED_WRITE)
  19. struct mmc_packed {
  20. struct list_head list;
  21. u32 cmd_hdr[1024];
  22. unsigned int blocks;
  23. u8 nr_entries;
  24. u8 retries;
  25. s16 idx_failure;
  26. };
  27. struct mmc_queue_req {
  28. struct request *req;
  29. struct mmc_blk_request brq;
  30. struct scatterlist *sg;
  31. char *bounce_buf;
  32. struct scatterlist *bounce_sg;
  33. unsigned int bounce_sg_len;
  34. struct mmc_async_req mmc_active;
  35. enum mmc_packed_type cmd_type;
  36. struct mmc_packed *packed;
  37. };
  38. struct mmc_queue {
  39. struct mmc_card *card;
  40. struct task_struct *thread;
  41. struct semaphore thread_sem;
  42. unsigned int flags;
  43. #define MMC_QUEUE_SUSPENDED (1 << 0)
  44. #define MMC_QUEUE_NEW_REQUEST (1 << 1)
  45. int (*issue_fn)(struct mmc_queue *, struct request *);
  46. void *data;
  47. struct request_queue *queue;
  48. struct mmc_queue_req mqrq[2];
  49. struct mmc_queue_req *mqrq_cur;
  50. struct mmc_queue_req *mqrq_prev;
  51. };
  52. extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
  53. const char *);
  54. extern void mmc_cleanup_queue(struct mmc_queue *);
  55. extern void mmc_queue_suspend(struct mmc_queue *);
  56. extern void mmc_queue_resume(struct mmc_queue *);
  57. extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
  58. struct mmc_queue_req *);
  59. extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
  60. extern void mmc_queue_bounce_post(struct mmc_queue_req *);
  61. extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
  62. extern void mmc_packed_clean(struct mmc_queue *);
  63. #endif