Step 1 : 由Intel® 6 Series Chipset and Intel® C200 Series Chipset找出在PCI interface的Bus 0、Device 1F、Function 2的ABAR與所有的PxPCR。
| 
Port Registers | 
Value | 
| 
ABAR | 
0xB0417000 | 
| 
Port0 Offset(ABAR + 0*80h + 100h) | 
0xB0417100 | 
| 
Port1 Offset(ABAR + 1*80h + 100h) | 
0xB0417180 | 
| 
Port2 Offset(ABAR + 2*80h + 100h) | 
0xB0417200 | 
| 
Port3 Offset(ABAR + 3*80h + 100h) | 
0xB0417280 | 
| 
Port4 Offset(ABAR + 4*80h + 100h) | 
0xB0417300 | 
| 
Port5 Offset(ABAR + 5*80h + 100h) | 
0xB0417380 | 
| 
Port6 Offset(ABAR + 6*80h + 100h) | 
0xB0417400 | 
| 
Port7 Offset(ABAR + 7*80h + 100h) | 
0xB0417480 | 
Step 2 : Serial ATA AHCI 1.3 Specification用RU抓出系統中有關下圖Port Registers。
| 
Port Registers | 
Value | 
| 
ABAR | 
0xB0417000 | 
| 
Port0 Offset(ABAR + Port*80h + 100h) | 
0xB0417100 | 
| 
P0CLB(P0PCR + Offset 00h) | 
0x91DE9000 | 
| 
P0CLBU(P0PCR + Offset 04h) | 
0x00000000 | 
| 
P0FB(P0PCR + Offset 08h) | 
0x91DE7000 | 
| 
P0FBU(P0PCR + Offset 0Ch) | 
0x00000000 | 
| 
P0IS(P0PCR + Offset 10h) | 
0x00000021 | 
| 
P0IE(P0PCR + Offset 14h) | 
0x00000000 | 
| 
P0CMD(P0PCR + Offset 18h) | 
0x00000006 | 
| 
P0TFD(P0PCR + Offset 20h) | 
0x00000050 | 
| 
P0SIG(P0PCR + Offset 24h) | 
0x00000101 | 
| 
P0SSTS(P0PCR + Offset 28h) | 
0x00000133 | 
| 
P0SCTL(P0PCR + Offset 2Ch) | 
0x00000300 | 
| 
P0SERR(P0PCR + Offset 30h) | 
0x00000000 | 
| 
P0SACT(P0PCR + Offset 34h) | 
0x00000000 | 
| 
P0CI(P0PCR + Offset 38h) | 
0x00000000 | 
| 
P0SNTF(P0PCR + Offset 3Ch) | 
0x00000000 | 
| 
P0FBS(P0PCR + Offset 40h) | 
0x00000000 | 
| 
P0VS(P0PCR + Offset 70h) | 
0x00000000 | 
Step 3 : 判斷裝置所在位置與裝置類型。
若PxSIG&0x0000FFFF為0x00000101,則裝置存在於該Port上,反之則否。由P0SIG判斷裝置存在於Port0的位置上
若PxSSTS&0xFFFF0000為0xEB140000,則裝置類型為ATAPI裝置,如CD、DVD,反之則為ATA裝置。由P0SSTS判斷裝置類型為ATA裝置,如HDD、SSD。
Step 4 : P0CLB由找出FIS Base Address
Step 5 : 使用上一篇用RU在DOS或UEFI下,對SATA Controller下ATA Command取得HDD與ODD資訊(1)文章整理的ATA Command,抓取Identify Data就是HDD的資訊。
| 
Identify
  Data HDD | 
Identify
  Data ODD | 
Attribute
  Values | 
Attribute
  Thresholds | 
Enable
  SMART | 
Disable
  SMART | 
SMART STATUS | ||
| Input | 
Feature | 
XX | 
XX | 
D0h | 
D1h | 
D8h | 
D9h | 
DAh | 
| 
Sector
  Count | 
01h | 
01h | 
01h | 
01h | 
XX | 
XX | 
XX | |
| 
Sector
  Number | 
XX | 
XX | 
XX | 
XX | 
01h | 
01h | 
XX | |
| 
LBA
  Low | 
XX | 
XX | 
4Fh | 
4Fh | 
4Fh | 
4Fh | 
4Fh | |
| 
LBA
  High | 
XX | 
XX | 
C2h | 
C2h | 
C2h | 
C2h | 
C2h | |
| 
Device/Head | 
XX | 
XX | 
A0h | 
A0h | 
XX | 
XX | 
XX | |
| 
Command | 
ECh | 
A1h | 
B0h | 
B0h | 
B0h | 
B0h | 
B0h | |
| 
Output | 
Return
  Byte | 
512 | 
512 | 
512 | 
512 | 
0 | 
0 | 
0 | 
Step 6 : 建立PRDT (Physical Region Descriptor Table)。
各位址的意義
確認DW3 BIT0 (Data Byte Count),是否為 1,如果 BIT0為 0,將其設為1。
確認DW3 BIT31(Interrupt On Completion),是否為 1,如果 BIT0為 0,將其設為1。
Step 7 : 建立Command List結構。
各位址的意義
設定以下參數
CFL= 5 (CFIS length)
PRDTL = 1 (PRDT entry number. For Identify command)
Step 8 : 開始執行。
原始狀態
設定執行Command,切忌順序要對。
- 將P0CMD(P0PCR + Offset 18h) Bit4設為1。
- 將P0CI(P0PCR + Offset 38h) Bit0設為1。
- 將P0CMD(P0PCR + Offset 18h) Bit0設為1。
- 等待P0CI(P0PCR + Offset 38h) 由01變為00 或在上一步執行後等待0.3~0.5秒即可。
Step 9 : 取得HDD資訊
該硬碟的資訊如下






沒有留言:
張貼留言