最近有很多读者朋友对validthru有疑问。有网友整理了相关内容,希望能回答你的疑惑。这个网站已经为你找到了关于validthru翻译成中文的问题的答案,希望对你有所帮助。
固件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和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.通常使用阻塞传输模式。
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字营”
主题测试文章,只做测试使用。发布者:艾迪号,转转请注明出处:https://www.cqaedi.cn/fenxiang/48725.html