queue.h 1.8 KB

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