Step1 Check Device在哪一个AHCI port上
Example code:
PxSSTS寄存器
PortData = ReadMmioDword(Abar+Port*0x80+100+HBA_PORTS_SSTS);
if((PortData&0x0f)==3) //Device on this port!
Step2 Get Device Type
PxSIG寄存器
PortData = ReadMmioDword(Abar+Port*0x80+0x100+HBA_PORTS_SIG);
if((PortData&0xffff0000) = 0xeb140000)
DeviceType ATAPI
else
Device Type ATA
Step3 Build command table 之CFIS
Type = 0x27 C = 1
Command = 0xec //ATA device identify
Sector Number = 1
Step4 Build command table之PRDT table
DBC = Identify data count
DW3 BIT0 BIT1 置1
DBA = Identify data buffer address
Step5 Build Command List Structure
CFL=CFIS长度 = 5
PRDTL = PRDT entry number,对于Identify command PRDTL = 1
CTBA = command table base address
Step6: Start Command
Register PxCI port command issue
选择command list中的某个command例如:
PxCI Bit0 = 1 ,选择command 0
Register PxCMD
Set Bit0 to 1,执行命令
页面更新:2024-05-24
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号