2

I have a question regarding the AHCI spec:

Is the variable pDmaXferCnt in the port used when the transfer is a DMA write or read?

The description in the spec seems to indicate that it isn't, but the PRDs are used instead. But how does the HBA know how much data is to be sent or received to/from a SATA device? This information will be available in the sector count of a H2D FIS, but unless I have overlooked it there doesn't seem to be a register of variable that holds this value. The DX:transmit state also seems to indicate that pDmaXferCnt will have a set value, yet I can’t see where it would be set for a DMA read/write operation.

Thanks

4

1 回答 1

0

来自规范:“实现说明:HBA 状态变量用于描述所需的外部可见行为。实现不需要具有直接对应于这些变量的内部状态值。” - 意味着您(也许)不会在外部寄存器中找到 pDmaXferCnt。

不过,还有另一种方法可以跟踪计数。

在AHCI规范的HBA Memory Space Usage部分下,有命令列表(命令头列表)和命令表(命令头指向,每个命令表是一个要发送的命令)的数据结构。HBA 都可以访问这些内容。

在 DW0 的命令头中是 PRDTL - 它是在传输中使用多少 PRD 的计数。

现在在命令头指向的实际命令表中,包含实际的 PRD,在每个 PRD 中是它们自己的 DBC 或数据字节数(在 DBA 中指定的位置要 DMA 的数据量,以字节为单位)。因此,如果您将每个 PRD * 都有自己的 DBC 并将它们相加,您将获得要传输的数据量。

或者在命令头 DW1 中是 PRDBC,它是传输的字节数,因此您可以在命令之后检查它。

HBA - 主机总线适配器

PRDTL - 物理区域描述符表长度

PRD - 物理区域描述符(跟踪物理内存中的位置和要传输的字节数)

DBC - 数据字节数(在 PRD 内)

DBA - 数据库基地址(PRD 内的物理地址)

PRDBC - 物理区域描述符字节数

DMA - 直接内存访问

更多阅读: http: //www.intel.com/content/www/us/en/io/serial-ata/serial-ata-ahci-spec-rev1-3-1.html

在此处输入图像描述

在此处输入图像描述

于 2016-10-14T16:47:07.860 回答