2013年5月1日 星期三

用RU在DOS或UEFI下,對SATA Controller下ATA Command取得HDD與ODD資訊(3)

有了前面用RU在DOS或UEFI下,對SATA Controller下ATA Command取得HDD與ODD資訊(1)說明、用RU在DOS或UEFI下,對SATA Controller下ATA Command取得HDD與ODD資訊(2)操作,可能還是會有很多人早不清楚到底怎麼做,這裡做一個總結。
Step 1 : 找出幾個比較主要的Base Address
BAR1:AHCI Base Address (ABAR)
BAR2:Port Number Offset Base Address
BAR3:Command List Base Address (CLBAR)
BAR4:Command Frame Information Structure Base Address (FISBAR)
BAR5:Physical Region Descriptor Table Base Address (PRDTBAR)
BAR1 => BAR2 (BAR1 + Port Number * 80h + 100h) => BAR3 => BAR4(BAR3+08h) => BAR5(BAR4 + 80h)

Step 2 :找出Port Number是否有接上裝置,並判別裝置類型ATA(HDD)或ATAPI(ODD)
Device on this port:BAR2 + 24h
Device Type:BAR2 + 28h

Step 3 :填入ATA Command
(1)BAR4

(2)BAR5 + 0Ch Bit4設1、BAR5 + 0Fh Bit0設1

(3)BAR3 + 00h 設5(FIS表格共5個Double Word)、BAR3 + 02h Bit0設1(共1個PRDT表格)


Step 4 :驅動SATA controller執行Command
BAR2 + 18h Bit4設1
BAR2 + 38h Bit0設1
BAR2 + 18h Bit0設1
BAR2 + 38h 00h變為01h

Step 5 :最後在BAR5取得資訊

沒有留言:

張貼留言