1.前言
本文主要介紹card下queue組件的主要流程,在介紹的過程當中,將詳細說明和queue相關的流程,涉及到其它組件的詳細流程再在相關文章中說明。linux
2.主要數據結構和API
2.1 struct mmc_queue
Elemete Name |
struct mmc_queue |
Path |
include/linux/mmc/queue.h |
Responsiblities |
mmc device的請求隊列,用於處理mmc device請求數據結構 |
Attributions |
- card:struct mmc_card *類型,此請求隊列所對應的mmc device
- thread:struct task_struct *類型,用於循環處理mmc queue中的request
- thread_sem:struct semaphore類型,用於控制mmc queue的信號量
- flags:MMC_QUEUE_SUSPENDED or MMC_QUEUE_NEW_REQUEST
- issue_fn:request的處理函數
- data:指向mmc_block_data
- queue:struct request_queue *類型,與mmc_queue關聯的request_queue
- mqrq[2]:struct mmc_queue_req類型,存放當前的mmc request和prev request
- mqrq_cur:struct mmc_queue_req *類型,表明當前的mmc request
- mqrq_prev:struct mmc_queue_req *類型,表明前一個mmc request
|
Operations |
- int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock, const char *subname)
初始化mmc request queue,建立請求隊列,並啓動線程對queue中的request進行處理async
- void mmc_cleanup_queue(struct mmc_queue *mq)
中止處理request queue中的請求,並釋放相關資源函數
- void mmc_queue_suspend(struct mmc_queue *mq)
掛起請求隊列,可是會等待未處理完的請求處理完畢線程
- void mmc_queue_resume(struct mmc_queue *mq)
恢復以前掛起的請求隊列 隊列 unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq)資源 |
2.2 struct mmc_queue_req
Elemete Name |
struct mmc_queue_req |
Path |
include/linux/mmc/queue.h |
Responsiblities |
mmc device的請求cmd |
Attributions |
- req:struct request *類型
- brq:struct mmc_blk_request類型
- sg:struct scatterlist *類型
- bounce_buf:
- bounce_sg:struct scatterlist *類型
- bounce_sg_len:
- mmc_active:struct mmc_async_req類型
- cmd_type:enum mmc_packed_type類型
- packed:struct mmc_packed *類型
|
Operations |
|
TODOit