mmc_hsq.h 1014 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef LINUX_MMC_HSQ_H
  3. #define LINUX_MMC_HSQ_H
  4. #define HSQ_NUM_SLOTS 64
  5. #define HSQ_INVALID_TAG HSQ_NUM_SLOTS
  6. /*
  7. * For MMC host software queue, we only allow 2 requests in
  8. * flight to avoid a long latency.
  9. */
  10. #define HSQ_NORMAL_DEPTH 2
  11. /*
  12. * For 4k random writes, we allow hsq_depth to increase to 5
  13. * for better performance.
  14. */
  15. #define HSQ_PERFORMANCE_DEPTH 5
  16. struct hsq_slot {
  17. struct mmc_request *mrq;
  18. };
  19. struct mmc_hsq {
  20. struct mmc_host *mmc;
  21. struct mmc_request *mrq;
  22. wait_queue_head_t wait_queue;
  23. struct hsq_slot *slot;
  24. spinlock_t lock;
  25. struct work_struct retry_work;
  26. int next_tag;
  27. int num_slots;
  28. int qcnt;
  29. int tail_tag;
  30. int tag_slot[HSQ_NUM_SLOTS];
  31. bool enabled;
  32. bool waiting_for_idle;
  33. bool recovery_halt;
  34. };
  35. int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc);
  36. void mmc_hsq_suspend(struct mmc_host *mmc);
  37. int mmc_hsq_resume(struct mmc_host *mmc);
  38. bool mmc_hsq_finalize_request(struct mmc_host *mmc, struct mmc_request *mrq);
  39. #endif