queue.h 2.0 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_cmd {
  14. MMC_PACKED_NONE = 0,
  15. MMC_PACKED_WRITE,
  16. };
  17. struct mmc_queue_req {
  18. struct request *req;
  19. struct mmc_blk_request brq;
  20. struct scatterlist *sg;
  21. char *bounce_buf;
  22. struct scatterlist *bounce_sg;
  23. unsigned int bounce_sg_len;
  24. struct mmc_async_req mmc_active;
  25. struct list_head packed_list;
  26. u32 packed_cmd_hdr[128];
  27. unsigned int packed_blocks;
  28. enum mmc_packed_cmd packed_cmd;
  29. int packed_retries;
  30. int packed_fail_idx;
  31. u8 packed_num;
  32. };
  33. struct mmc_queue {
  34. struct mmc_card *card;
  35. struct task_struct *thread;
  36. struct semaphore thread_sem;
  37. unsigned long flags;
  38. #define MMC_QUEUE_SUSPENDED 0
  39. #define MMC_QUEUE_NEW_REQUEST 1
  40. #define MMC_QUEUE_URGENT_REQUEST 2
  41. int (*issue_fn)(struct mmc_queue *, struct request *);
  42. void *data;
  43. struct request_queue *queue;
  44. struct mmc_queue_req mqrq[2];
  45. struct mmc_queue_req *mqrq_cur;
  46. struct mmc_queue_req *mqrq_prev;
  47. bool wr_packing_enabled;
  48. int num_of_potential_packed_wr_reqs;
  49. int num_wr_reqs_to_start_packing;
  50. bool no_pack_for_random;
  51. int (*err_check_fn) (struct mmc_card *, struct mmc_async_req *);
  52. void (*packed_test_fn) (struct request_queue *, struct mmc_queue_req *);
  53. };
  54. extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
  55. const char *);
  56. extern void mmc_cleanup_queue(struct mmc_queue *);
  57. extern int mmc_queue_suspend(struct mmc_queue *, int);
  58. extern void mmc_queue_resume(struct mmc_queue *);
  59. extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
  60. struct mmc_queue_req *);
  61. extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
  62. extern void mmc_queue_bounce_post(struct mmc_queue_req *);
  63. extern void print_mmc_packing_stats(struct mmc_card *card);
  64. #endif