tft每日頭條

 > 生活

 > uefi4.1更新的實驗室在哪裡

uefi4.1更新的實驗室在哪裡

生活 更新时间:2024-07-19 22:24:27

固件C字營·版權所有

敬請關注“固件C字營”

敬請關注今日頭條号:”固件C字營“

------------------------------------------------------------------------

SATA是我們最常見的硬盤接口,因為傳輸速度較慢現在絕大部分SATA接口隻用在機械硬盤上。除了SATA之外常見的還SCSI、PCIE(NVME)接口也做為硬盤接口。為了與SATA接口硬盤進行數據傳送必須使用ATA driver,它分成幾個層次如下:

ATA host controller driver:

一般的SATA控制器都是挂在PCI總線下,所以ATA host controller driver一般是消費host controller handle上的PCI I/O Protocol,生産ATA Pass Thru Protocol 來訪問硬盤設備,

Ext SCSI Pass Thru Protocol來訪問CD/DVD。

ATA bus driver:

消費ATA Pass Thru Protocol,為控制器下挂的設備生産出child handle,并為其install Device Path Protocol,Block I/O Protocol, Block I/O 2 Protocol以及Storage Security Command Protocol.

ATA Host Controller Driver的實現:

host controller driver的實現和硬件平台息息相關的,不同的平台有不同的硬件配置,host controller數量也不一樣,通常一個host controller driver需要控制多個控制器,所以我們需要确保driver的實現是可重入的,并為每一個控制器分配獨立是私有的數據結構空間。實現步驟如下:

1.為每一個ATA host controller handle Install the ATA Pass Thru Protocol

2.為每一個SCSI host controller handle Install Extended SCSI Pass Thru Protocol

ATA Host Controller Driver :Supported()

和PCI driver一樣先locate并open EFI_DEVICE_PATH_PROTOCOL、EFI_PCI_IO_PROTOCOL然後使用PCI IO Protocol 提供的服務去檢測設備的VID、DID、Subclass Code。

ATA Host Controller Driver :Start()

初始化ATA host controller,一般有以下的步驟,他們和其他的driver基本一樣:

1.Enable the PCI device.

2.Allocate resources.

3.Construct data structures for the driver to use.

4. Install the ATA Pass Thru Protocol instance on the same handle that has the PCI I/O Protocol.

5. Install the Extended SCSI Pass Thru Protocol instance on the same handle that has the PCI I/O Protocol.

ATA Host Controller Driver :Stop()

完成和start相反的動作:

1.Disable the ATA controller.

2. Release all resources that were allocated for this driver.

3. Close the protocol instances that were opened in the Start()function.

4. Uninstall the protocol interfaces that were attached on the host controller handle.

EFI_ATA_PASS_THRU_PROTOCOL 數據結構:

EFI_ATA_PASS_THRU_PROTOCOL會被用來獲取挂在ATA host controller上的設備的各種信息和傳遞ATA數據請求包給設備,即使是這個設備不是可啟動設備,這個通常可以用來作為一個診斷外設的手段。它還可以為那些需要作為啟動設備device handle的block I/O driver提供底層訪問的軟件抽象和封裝。

EFI_ATA_PASS_THRU_PROTOCOL.Mode:通常來獲取和設定各種參

EFI_ATA_PASS_THRU_PROTOCOL.GetNextPort():

EFI_ATA_PASS_THRU_PROTOCOL.GetNextDevice():用來掃描所有的ATA設備。

EFI_ATA_PASS_THRU_PROTOCOL.BuildDevicePath():建立設備路徑.

EFI_ATA_PASS_THRU_PROTOCOL.PassThru():這個是主角,有以下的功能,

1.Initialize the internal register for command/data transfer.

2.Put valid ATA commands into hardware-specific memory or register locations.

3.Start the transfer.

4.Optionally wait for completion of the execution.通常使用阻塞的傳輸模式。

uefi4.1更新的實驗室在哪裡(UEFI内核導讀ATADriverStack)1

ATA bus driver的實現:

使用 ATA Pass Thru Protocol去掃描挂在ATA host controller下面的設備并且生産出 child handles,然後完成以下步驟,通常來說bus driver是通用driver我們一般不需要修改,porting到新平台的時候我們隻需要修改和硬件平台相關的ATA Host Controller Driver就可以了:

1.Install Device Path Protocol to each child handle.

2.Install Block I/O Protocol on each child handle.

3.Install Block I/O 2 Protocol on each child handle.

4.If the hard drive supports the SPC-4 or ATA8-ACS command set, then install the Storage Security Command Protocol the child handle.

以上是對 ATA driver有一個簡單介紹,細節可以參考相關的Spec。

敬請關注“固件C字營”

敬請關注今日頭條号:”固件C字營“

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关生活资讯推荐

热门生活资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved