2 * Copyright (c) 2009, ETH Zurich. All rights reserved.
4 * This file is distributed under the terms in the attached LICENSE file.
5 * If you do not find this file, copies can be found by writing to:
6 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
12 * DESCRIPTION: AHCI (SATA) Host bus adaptor, per-port registers
14 * Section numbers refer to the Serial ATA Advanced Host Controller
15 * Interface (AHCI) specification 1.3, June 2008
18 device ahci_port msbfirst (addr b) "AHCI port" {
22 register clb rw addr(b,0x00) "Command list base address" type(uint64);
26 register fb rw addr(b,0x08) "FIS base address" type(uint64);
29 register is addr(b,0x10) "Interrupt status" {
30 cpds 1 rw1c "Cold port detect";
31 tfes 1 rw1c "Task file error";
32 hbfs 1 rw1c "Host bus fatal error";
33 hbds 1 rw1c "Host bus data error";
34 ifs 1 rw1c "Interface fatal error";
35 infs 1 rw1c "Interface non-fatal error";
37 ofs 1 rw1c "Overflow status";
38 ipms 1 rw1c "Incorrect port multiplier status";
39 prcs 1 ro "PhyRdy change status";
41 dmps 1 rw1c "Device mechanical presence";
42 pcs 1 ro "Port connect change";
43 dps 1 rw1c "Descriptor processed";
44 ufs 1 ro "Unknown FIS interrupt";
45 sdbs 1 rw1c "Set device bits interrupt";
46 dss 1 rw1c "DMA setup FIS interrupt";
47 pss 1 rw1c "PIO setup FIS interrupt";
48 dhrs 1 rw1c "Device to host register FIS interrupt";
52 register ie addr(b,0x14) "Interrupt enable" {
53 cpde 1 rw "Cold port detect";
54 tfee 1 rw "Task file error";
55 hbfe 1 rw "Host bus fatal error";
56 hbde 1 rw "Host bus data error";
57 ife 1 rw "Interface fatal error";
58 infe 1 rw "Interface non-fatal error";
60 ofe 1 rw "Overflow enable";
61 ipme 1 rw "Incorrect port multiplier status";
62 prce 1 ro "PhyRdy change status";
64 dmpe 1 rw "Device mechanical presence";
65 pce 1 ro "Port connect change";
66 dpe 1 rw "Descriptor processed";
67 ufe 1 ro "Unknown FIS interrupt";
68 sdbe 1 rw "Set device bits interrupt";
69 dse 1 rw "DMA setup FIS interrupt";
70 pse 1 rw "PIO setup FIS interrupt";
71 dhre 1 rw "Device to host register FIS interrupt";
75 constants icct "Interface communication control" {
76 slumber = 0x6 "Slumber";
77 partial = 0x2 "Partial";
78 active = 0x1 "Active";
79 idle = 0x0 "No-Op / Idle";
81 register cmd addr(b,0x18) "Command and status" {
82 icc 4 rw type(icct) "Interface communication control";
83 asp 1 rw "Aggressive slumber / partial";
84 alpe 1 rw "Aggressive link power management enable";
85 dlae 1 rw "Drive LED on ATAPI enable";
86 atapi 1 rw "Device is ATAPI";
87 apste 1 rw "Automatic partial to slumber transitions enabled";
88 fbscp 1 ro "FIS-based switching capable port";
89 esp 1 ro "External SATA port";
90 cpd 1 ro "Cold presence detection";
91 mpsp 1 ro "Mechanical presence switch";
92 hpcp 1 ro "Hot plug capable port";
93 pma 1 rw "Port multiplier attached";
94 cps 1 ro "Cold presence state";
95 cr 1 ro "Command list running";
96 fr 1 ro "FIS receive running";
97 mpss 1 ro "Mechanical presence switch state";
98 ccs 5 ro "Current command slot";
100 fre 1 rw "FIS receive enable";
101 clo 1 rw "Command list override";
102 pod 1 rw "Power on device";
103 sud 1 rw "Spin-up device";
108 register tfd ro addr(b,0x20) "Task file data" {
111 bsy 1 ro "Indicates the interface is busy";
112 cs2 3 ro "Command specific";
113 drq 1 ro "Indicates a data transfer is requested";
114 cs1 2 ro "Command specific";
115 serr 1 ro "Indicates an error during the transfer.";
119 register sig ro addr(b,0x24) "Signature" {
123 sectors 8 "Sector count";
127 constants speed "Interface speed" {
128 gen1 = 0b0001 "Gen 1 (1.5 Gbps)";
129 gen2 = 0b0010 "Gen 2 (3 Gbps)";
130 gen3 = 0b0011 "Gen 3 (6 Gbps)";
132 constants dets "Device detection state" {
133 nodev = 0x0 "No device, no PHY";
134 nophy = 0x1 "Device detected, no PHY comm. established";
135 detect = 0x3 "Device detected and PHY comm. established";
136 offline = 0x4 "PHY in offline mode or loopback";
138 register ssts ro addr(b,0x28) "Serial ATA status" {
140 ipm 4 type(icct) "Interface power management";
141 spd 4 type(speed) "Current interface speed";
142 det 4 type(dets) "Device detection";
146 constants ipmall "Interface transitions" {
147 noipm = 0x0 "No interface restrictions";
148 noprtl = 0x1 "Transitions to Partial state disabled";
149 noslmb = 0x2 "Transitions to Slumber state disabled";
150 noboth = 0x3 "Transitions to both Partial and Slumber disabled";
152 register sctl addr(b,0x2c) "Serial ATA control" {
154 _ 4 rsvd "Port multiplier port (unused)";
155 _ 4 rsvd "Select power mgmt (unused)";
156 ipm 4 rw type(ipmall) "Interface power mgmt transitions allowed";
157 spd 4 rw type(speed) "Speed allowed";
158 det 4 rw type(dets) "Device detection initialization";
162 register serr rw1c addr(b,0x30) "Serial ATA error" {
165 df 1 "Unknown FIS type";
166 dt 1 "Transport state transition error";
167 ds 1 "Link sequence error";
168 dh 1 "Handshake error";
170 dd 1 "Disparity error";
171 db 1 "10b to 8b decode error";
173 di 1 "Phy internal error";
174 dn 1 "PhyRdy change";
176 ee 1 "Internal error";
177 ep 1 "Protocol error";
178 ec 1 "Persistent communication or data integrity error";
179 et 1 "Transient data integrity error";
181 em 1 "Recovered communications error";
182 ei 1 "Recovered data integrity error";
186 register sact rw addr(b,0x34) "Serial ATA active" type(uint32);
189 register ci rw addr(b,0x38) "Command issue" type(uint32);
192 register sntf addr(b,0x3c) "Serial ATA notification" {
194 pmn 16 rw1c "PMN notify";
198 register fbs addr(b,0x40) "FIS-based switching control" {
200 dwe 4 ro "Device with error";
201 ado 4 ro "Active device optimization";
202 dev 4 rw "Device to issue";
204 sde 1 ro "Single device error";
205 dec 1 rw1c "Device error clear";
209 // 4.2.2 Command List Structure, elements are Command Headers
210 datatype chdr msbfirst(32) "Command Header" {
211 prdtl 16 "Physical region descriptor table length";
212 pmp 4 "Port multiplier port";
214 c 1 "Clear busy upon R_OK";
220 cfl 5 "Command FIS length";
222 prdbc 32 "Physical region descriptor byte count";
224 ctba 64 "Command table descriptor base address";
232 // 4.2.3.3 Physical Region Descriptor Table
233 datatype prd msbfirst(32) "Physical region descriptor" {
234 dba 32 "Data base address";
235 dbau 32 "Data base address upper";
237 i 1 "Interrupt on completion";
239 dbc 22 "Data byte count";
243 constants emtype "Enclosure message type" {
245 saf_te = 0x1 "SAF-TE";
247 sgpio = 0x3 "SGPOI (register-based interface";
249 datatype encmsg "Enclosure management message" {
251 mtype 4 type(emtype) "Message type";
253 msize 8 "Message size";
258 constants emledstate "Enclosure LED state" {
259 off = 0b000 "LED shall be off";
260 solid = 0b001 "LED shall be solid on";
261 vs1 = 0b100 "Vendor specific 1";
262 vs2 = 0b101 "Vendor specific 2";
263 vs3 = 0b110 "Vendor specific 3";
264 vs4 = 0b111 "Vendor specific 4";
266 datatype emledmsg "Enclosure LED message" {
268 fault 3 type(emledstate) "Vendor-specific LED (e.g. fault)";
269 locate 3 type(emledstate) "Vendor-specific LED (e.g. locate)";
270 activity 3 type(emledstate) "Activity LED";
272 pmi 4 "Port multiplier information";
274 vsm 1 "Vendor-specific enclosure message";
275 hbapn 5 "HBA port number for update";