48 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef LINUX_MMC_HSQ_H3#define LINUX_MMC_HSQ_H4 5#define HSQ_NUM_SLOTS 646#define HSQ_INVALID_TAG HSQ_NUM_SLOTS7 8/*9 * For MMC host software queue, we only allow 2 requests in10 * flight to avoid a long latency.11 */12#define HSQ_NORMAL_DEPTH 213/*14 * For 4k random writes, we allow hsq_depth to increase to 515 * for better performance.16 */17#define HSQ_PERFORMANCE_DEPTH 518 19struct hsq_slot {20 struct mmc_request *mrq;21};22 23struct mmc_hsq {24 struct mmc_host *mmc;25 struct mmc_request *mrq;26 wait_queue_head_t wait_queue;27 struct hsq_slot *slot;28 spinlock_t lock;29 struct work_struct retry_work;30 31 int next_tag;32 int num_slots;33 int qcnt;34 int tail_tag;35 int tag_slot[HSQ_NUM_SLOTS];36 37 bool enabled;38 bool waiting_for_idle;39 bool recovery_halt;40};41 42int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc);43void mmc_hsq_suspend(struct mmc_host *mmc);44int mmc_hsq_resume(struct mmc_host *mmc);45bool mmc_hsq_finalize_request(struct mmc_host *mmc, struct mmc_request *mrq);46 47#endif48