12#define __STDC_FORMAT_MACROS 1
37 " 0 General configuration",
38 ". 15 Device identifier: 0 = ATA, 1 = ATAPI",
39 ". 14:8 ATA: Vendor specific [RET-3]",
40 ". 14 ATAPI: Must be set to 0",
41 ". 13 ATAPI: Reserved",
42 ". 12:8 ATAPI: Command set: 0x05 = CD/DVD",
43 ". 7 Removable media device [OBS-8]",
44 ". 6 ATA: Not removable controller and/or device [OBS-6]",
45 ". 5:3 ATA: Vendor specific [RET-3]",
46 ". 6:5 ATAPI: DRQ after PACKET cmd: 0x0 = 3ms, 0x2 = 50us",
47 ". 4:3 ATAPI: Reserved",
48 ". 2 Response incomplete",
49 ". 1 ATA: Vendor specific [RET-3]",
51 ". 1:0 ATAPI: Packet size: 0x0 = 12 byte, 0x1 = 16 byte",
53 " 1 Cylinders [OBS-6]",
54 " 2 Specific configuration (0x37c8/738c/8c73/c837)",
56 " 4 Vendor specific [RET-3]",
57 " 5 Vendor specific [RET-3]",
58 " 6 Sectors per track [OBS-6]",
59 " 7-8 Reserved for CFA (Sectors per card)",
60 " 9 Vendor specific [RET-4]",
61 " 10-19 Serial number (String)",
62 " 20 Vendor specific [RET-3]",
63 " 21 Vendor specific [RET-3]",
64 " 22 Vendor specific bytes on READ/WRITE LONG [OBS-4]",
65 " 23-26 Firmware revision (String)",
66 " 27-46 Model number (String)",
68 " 47 READ/WRITE MULTIPLE support [OBS-ACS-4]",
69 ". 15:8 Must be set to 0x80",
70 ". 7:0 Max sectors per DRQ on READ/WRITE MULTIPLE [OBS-ACS-4]",
72 " 48 Trusted Computing feature set options",
73 ". 15:14 Must be set to 0x1",
74 ". 13:1 Reserved for the Trusted Computing Group",
75 ". 0 Trusted Computing feature set supported",
78 ". 15:14 ATA: Reserved for IDENTIFY PACKET DEVICE",
79 ". 15 ATAPI: Interleaved DMA supported [OBS-8]",
80 ". 14 ATAPI: Command queuing supported [OBS-8]",
81 ". 13 ATA: Standard standby timer values supported",
82 ". 13 ATAPI: Overlap operation supported [OBS-8]",
83 ". 12 ATA: Reserved for IDENTIFY PACKET DEVICE",
84 ". 12 ATAPI: ATA software reset required [OBS-5]",
85 ". 11 IORDY supported",
86 ". 10 IORDY may be disabled",
90 ". 1:0 Long Phy Sector Alignment Error reporting",
93 ". 15:14 Must be set to 0x1",
95 ". 1 Reserved [OBS-6]",
96 ". 0 Vendor specific minimum standby timer value",
98 " 51 PIO data transfer mode [OBS-5]",
99 " 52 Single Word DMA data transfer mode [OBS-3]",
101 " 53 Field validity / Free-fall Control",
102 ". 15:8 Free-fall Control sensitivity",
104 ". 2 Word 88 (Ultra DMA modes) is valid",
105 ". 1 Words 64-70 (PIO modes) are valid",
106 ". 0 Words 54-58 (CHS) are valid [OBS-6]",
108 " 54 Current cylinders [OBS-6]",
109 " 55 Current heads [OBS-6]",
110 " 56 Current sectors per track [OBS-6]",
111 " 57-58 Current capacity in sectors (DWord) [OBS-6]",
113 " 59 Sanitize Device - READ/WRITE MULTIPLE support",
114 ". 15 BLOCK ERASE EXT supported",
115 ". 14 OVERWRITE EXT supported",
116 ". 13 CRYPTO SCRAMBLE EXT supported",
117 ". 12 Sanitize Device feature set supported",
118 ". 11 Cmds during sanitize are as specified by ACS-3",
119 ". 10 SANITIZE ANTIFREEZE LOCK EXT supported",
121 ". 8 Bits 7:0 are valid [OBS-ACS-4]",
122 ". 7:0 Current number of sectors per DRQ [OBS-ACS-4]",
124 " 60-61 User addressable sectors for 28-bit commands (DWord)",
125 " 62 Single Word DMA modes [OBS-3]",
127 " 63 Multiword DMA modes",
129 ". 10 Multiword DMA mode 2 selected",
130 ". 9 Multiword DMA mode 1 selected",
131 ". 8 Multiword DMA mode 0 selected",
133 ". 2 Multiword DMA mode 2 and below supported",
134 ". 1 Multiword DMA mode 1 and below supported",
135 ". 0 Multiword DMA mode 0 supported",
139 ". 1 PIO mode 4 supported",
140 ". 0 PIO mode 3 supported",
142 " 65 Minimum Multiword DMA cycle time per word in ns",
143 " 66 Recommended Multiword DMA cycle time in ns",
144 " 67 Minimum PIO cycle time without flow control in ns",
145 " 68 Minimum PIO cycle time with IORDY flow control in ns",
147 " 69 Additional support",
148 ". 15 CFast specification supported",
149 ". 14 Deterministic data after trim supported",
150 ". 13 LPS Alignment Error Reporting Control supported",
151 ". 12 DCO IDENTIFY/SET DMA supported [OBS-ACS-3]",
152 ". 11 READ BUFFER DMA supported",
153 ". 10 WRITE BUFFER DMA supported",
154 ". 9 SET MAX SET PASSWORD/UNLOCK DMA supported [OBS-ACS-3]",
155 ". 8 DOWNLOAD MICROCODE DMA supported",
156 ". 7 Reserved for IEEE 1667",
157 ". 6 Optional ATA device 28-bit commands supported",
158 ". 5 Trimmed LBA range(s) returning zeroed data supported",
159 ". 4 Device encrypts all user data",
160 ". 3 Extended number of user addressable sectors supported",
161 ". 2 All write cache is non-volatile",
162 ". 1:0 Zoned Capabilities [OBS-ACS-5]",
165 " 71-74 ATA: Reserved for IDENTIFY PACKET DEVICE",
166 " 71 ATAPI: Time in ns from PACKET to bus release [OBS-8]",
167 " 72 ATAPI: Time in ns from SERVICE to BSY cleared [OBS-8]",
168 " 73-74 ATAPI: Reserved",
172 ". 4:0 Maximum queue depth - 1",
174 " 76 Serial ATA capabilities",
175 ". 15 READ LOG DMA EXT as equiv to READ LOG EXT supported",
176 ". 14 Device Auto Partial to Slumber transitions supported",
177 ". 13 Host Auto Partial to Slumber transitions supported",
178 ". 12 NCQ priority information supported",
179 ". 11 Unload while NCQ commands are outstanding supported",
180 ". 10 Phy Event Counters supported",
181 ". 9 Receipt of host initiated PM requests supported",
182 ". 8 NCQ feature set supported",
183 ". 7:4 Reserved for Serial ATA",
184 ". 3 SATA Gen3 signaling speed (6.0 Gb/s) supported",
185 ". 2 SATA Gen2 signaling speed (3.0 Gb/s) supported",
186 ". 1 SATA Gen1 signaling speed (1.5 Gb/s) supported",
187 ". 0 Must be set to 0",
189 " 77 Serial ATA additional capabilities",
190 ". 15:10 Reserved for Serial ATA",
191 ". 9 Out Of Band Management supported",
192 ". 8 Power Disable feature always enabled",
193 ". 7 DevSleep to ReducedPwrState supported",
194 ". 6 RECEIVE/SEND FPDMA QUEUED supported",
195 ". 5 NCQ Queue Management supported",
196 ". 4 NCQ Streaming supported",
197 ". 3:1 Current Serial ATA signal speed",
198 ". 0 Must be set to 0",
200 " 78 Serial ATA features supported",
201 ". 15:13 Reserved for Serial ATA",
202 ". 12 Power Disable feature supported",
203 ". 11 Rebuild Assist feature set supported",
204 ". 10 Reserved for Serial ATA",
205 ". 9 Hybrid Information supported",
206 ". 8 Device Sleep feature supported",
207 ". 7 NCQ Autosense supported",
208 ". 6 Software Settings Preservation supported",
209 ". 5 Hardware Feature Control supported",
210 ". 4 In-order data delivery supported",
211 ". 3 Device initiated power management supported",
212 ". 2 DMA Setup auto-activation supported",
213 ". 1 Non-zero buffer offsets supported",
214 ". 0 Must be set to 0",
216 " 79 Serial ATA features enabled",
217 ". 15:12 Reserved for Serial ATA",
218 ". 11 Rebuild Assist feature set enabled",
219 ". 10 Power Disable feature enabled",
220 ". 9 Hybrid Information enabled",
221 ". 8 Device Sleep feature enabled",
222 ". 7 Automatic Partial to Slumber transitions enabled",
223 ". 6 Software Settings Preservation enabled",
224 ". 5 Hardware Feature Control enabled",
225 ". 4 In-order data delivery enabled",
226 ". 3 Device initiated power management enabled",
227 ". 2 DMA Setup auto-activation enabled",
228 ". 1 Non-zero buffer offsets enabled",
229 ". 0 Must be set to 0",
231 " 80 Major version number",
233 ". 12 ACS-5 supported",
234 ". 11 ACS-4 supported",
235 ". 10 ACS-3 supported",
236 ". 9 ACS-2 supported",
237 ". 8 ATA8-ACS supported",
238 ". 7 ATA/ATAPI-7 supported [OBS-ACS-4]",
239 ". 6 ATA/ATAPI-6 supported [OBS-ACS-4]",
240 ". 5 ATA/ATAPI-5 supported [OBS-ACS-4]",
241 ". 4 ATA/ATAPI-4 supported [OBS-8]",
242 ". 3 ATA-3 supported [OBS-7]",
243 ". 2 ATA-2 supported [OBS-6]",
244 ". 1 ATA-1 supported [OBS-5]",
247 " 81 Minor version number",
249 " 82 Commands and feature sets supported",
250 ". 15 IDENTIFY DEVICE DMA supported [OBS-4]",
251 ". 14 NOP supported",
252 ". 13 READ BUFFER supported",
253 ". 12 WRITE BUFFER supported",
254 ". 11 WRITE VERIFY supported [OBS-4]",
255 ". 10 HPA feature set supported [OBS-ACS-3]",
256 ". 9 DEVICE RESET supported",
257 ". 8 SERVICE interrupt supported [OBS-ACS-2]",
258 ". 7 Release interrupt supported [OBS-ACS-2]",
259 ". 6 Read look-ahead supported",
260 ". 5 Volatile write cache supported",
261 ". 4 PACKET feature set supported",
262 ". 3 Power Management feature set supported",
263 ". 2 Removable Media feature set supported [OBS-8]",
264 ". 1 Security feature set supported",
265 ". 0 SMART feature set supported",
267 " 83 Commands and feature sets supported",
268 ". 15:14 Must be set to 0x1",
269 ". 13 FLUSH CACHE EXT supported",
270 ". 12 FLUSH CACHE supported",
271 ". 11 DCO feature set supported [OBS-ACS-3]",
272 ". 10 48-bit Address feature set supported",
273 ". 9 AAM feature set supported [OBS-ACS-2]",
274 ". 8 SET MAX security extension supported [OBS-ACS-3]",
275 ". 7 Reserved for Addr Offset Resvd Area Boot [OBS-ACS-3]",
276 ". 6 SET FEATURES subcommand required to spin-up",
277 ". 5 PUIS feature set supported",
278 ". 4 Removable Media Status Notification supported [OBS-8]",
279 ". 3 APM feature set supported",
280 ". 2 CFA feature set supported",
281 ". 1 TCQ feature set supported [OBS-ACS-2]",
282 ". 0 DOWNLOAD MICROCODE supported",
284 " 84 Commands and feature sets supported",
285 ". 15:14 Must be set to 0x1",
286 ". 13 IDLE IMMEDIATE with UNLOAD feature supported",
287 ". 12:11 Reserved for TLC [OBS-ACS-3]",
288 ". 10 URG bit for WRITE STREAM (DMA) EXT supported [OBS-8]",
289 ". 9 URG bit for READ STREAM (DMA) EXT supported [OBS-8]",
290 ". 8 64-bit World Wide Name supported",
291 ". 7 WRITE DMA QUEUED FUA EXT supported [OBS-ACS-2]",
292 ". 6 WRITE DMA/MULTIPLE FUA EXT supported",
293 ". 5 GPL feature set supported",
294 ". 4 Streaming feature set supported",
295 ". 3 Media Card Pass Through Command supported [OBS-ACS-2]",
296 ". 2 Media serial number supported [RES-ACS-3]",
297 ". 1 SMART self-test supported",
298 ". 0 SMART error logging supported",
300 " 85 Commands and feature sets supported or enabled",
301 ". 15 IDENTIFY DEVICE DMA supported [OBS-4]",
302 ". 14 NOP supported",
303 ". 13 READ BUFFER supported",
304 ". 12 WRITE BUFFER supported",
305 ". 11 WRITE VERIFY supported [OBS-4]",
306 ". 10 HPA feature set supported [OBS-ACS-3]",
307 ". 9 DEVICE RESET supported",
308 ". 8 SERVICE interrupt enabled [OBS-ACS-2]",
309 ". 7 Release interrupt enabled [OBS-ACS-2]",
310 ". 6 Read look-ahead enabled",
311 ". 5 Write cache enabled",
312 ". 4 PACKET feature set supported",
313 ". 3 Power Management feature set supported",
314 ". 2 Removable Media feature set supported [OBS-8]",
315 ". 1 Security feature set enabled",
316 ". 0 SMART feature set enabled",
318 " 86 Commands and feature sets supported or enabled",
319 ". 15 Words 119-120 are valid",
321 ". 13 FLUSH CACHE EXT supported",
322 ". 12 FLUSH CACHE supported",
323 ". 11 DCO feature set supported [OBS-ACS-3]",
324 ". 10 48-bit Address features set supported",
325 ". 9 AAM feature set enabled [OBS-ACS-2]",
326 ". 8 SET MAX security extension enabled [OBS-ACS-3]",
327 ". 7 Reserved for Addr Offset Resvd Area Boot [OBS-ACS-3]",
328 ". 6 SET FEATURES subcommand required to spin-up",
329 ". 5 PUIS feature set enabled",
330 ". 4 Removable Media Status Notification enabled [OBS-8]",
331 ". 3 APM feature set enabled",
332 ". 2 CFA feature set supported",
333 ". 1 TCQ feature set supported [OBS-ACS-2]",
334 ". 0 DOWNLOAD MICROCODE supported",
336 " 87 Commands and feature sets supported or enabled",
337 ". 15:14 Must be set to 0x1",
338 ". 13 IDLE IMMEDIATE with UNLOAD FEATURE supported",
339 ". 12:11 Reserved for TLC [OBS-ACS-3]",
340 ". 10 URG bit for WRITE STREAM (DMA) EXT supported [OBS-8]",
341 ". 9 URG bit for READ STREAM (DMA) EXT supported [OBS-8]",
342 ". 8 64-bit World Wide Name supported",
343 ". 7 WRITE DMA QUEUED FUA EXT supported [OBS-ACS-2]",
344 ". 6 WRITE DMA/MULTIPLE FUA EXT supported",
345 ". 5 GPL feature set supported",
346 ". 4 Valid CONFIGURE STREAM has been executed [OBS-8]",
347 ". 3 Media Card Pass Through Command supported [OBS-ACS-2]",
348 ". 2 Media serial number is valid",
349 ". 1 SMART self-test supported",
350 ". 0 SMART error logging supported",
352 " 88 Ultra DMA modes",
354 ". 14 Ultra DMA mode 6 selected",
355 ". 13 Ultra DMA mode 5 selected",
356 ". 12 Ultra DMA mode 4 selected",
357 ". 11 Ultra DMA mode 3 selected",
358 ". 10 Ultra DMA mode 2 selected",
359 ". 9 Ultra DMA mode 1 selected",
360 ". 8 Ultra DMA mode 0 selected",
362 ". 6 Ultra DMA mode 6 and below supported",
363 ". 5 Ultra DMA mode 5 and below supported",
364 ". 4 Ultra DMA mode 4 and below supported",
365 ". 3 Ultra DMA mode 3 and below supported",
366 ". 2 Ultra DMA mode 2 and below supported",
367 ". 1 Ultra DMA mode 1 and below supported",
368 ". 0 Ultra DMA mode 0 supported",
370 " 89 SECURITY ERASE UNIT time",
371 ". 15 Bits 14:8 of value are valid",
372 ". 14:0 SECURITY ERASE UNIT time value",
374 " 90 ENHANCED SECURITY ERASE UNIT time",
375 ". 15 Bits 14:8 of value are valid",
376 ". 14:0 ENHANCED SECURITY ERASE UNIT time value",
378 " 91 Current APM level",
380 ". 7:0 Current APM level value",
382 " 92 Master Password Identifier",
384 " 93 Hardware reset result (PATA)",
385 ". 15:14 Must be set to 0x1",
386 ". 13 Device detected CBLID- above(1)/below(0) ViHB",
388 ". 11 Device 1 asserted PDIAG-",
389 ". 10:9 Device 1 detection method: -, Jumper, CSEL, other",
390 ". 8 Must be set to 1",
392 ". 6 Device 0 responds when device 1 selected",
393 ". 5 Device 0 detected the assertion of DASP-",
394 ". 4 Device 0 detected the assertion of PDIAG-",
395 ". 3 Device 0 passed diagnostics",
396 ". 2:1 Device 0 detection method: -, Jumper, CSEL, other",
397 ". 0 Must be set to 1 for PATA devices",
399 " 94 AAM level [OBS-ACS-2]",
400 ". 15:8 Recommended AAM level [OBS-ACS-2]",
401 ". 7:0 Current AAM level [OBS-ACS-2]",
403 " 95 Stream Minimum Request Size",
404 " 96 Streaming Transfer Time - DMA",
405 " 97 Streaming Access Latency - DMA and PIO",
406 " 98-99 Streaming Performance Granularity (DWord)",
407 "100-103 User addressable sectors for 48-bit commands (QWord)",
408 "104 Streaming Transfer Time - PIO",
409 "105 Max blocks of LBA Range Entries per DS MANAGEMENT cmd",
411 "106 Physical sector size / logical sector size",
412 ". 15:14 Must be set to 0x1",
413 ". 13 Multiple logical sectors per physical sector",
414 ". 12 Logical Sector longer than 256 words",
416 ". 3:0 2^X logical sectors per physical sector",
418 "107 Inter-seek delay for ISO 7779 acoustic testing",
419 "108-111 World Wide Name",
421 "116 Reserved for TLC [OBS-ACS-3]",
422 "117-118 Logical sector size (DWord)",
424 "119 Commands and feature sets supported",
425 ". 15:14 Must be set to 0x1",
427 ". 9 DSN feature set supported",
428 ". 8 Accessible Max Address Config feature set supported",
429 ". 7 Extended Power Conditions feature set supported",
430 ". 6 Sense Data Reporting feature set supported",
431 ". 5 Free-fall Control feature set supported",
432 ". 4 DOWNLOAD MICROCODE with mode 3 supported",
433 ". 3 READ/WRITE LOG DMA EXT supported",
434 ". 2 WRITE UNCORRECTABLE EXT supported",
435 ". 1 Write-Read-Verify feature set supported",
436 ". 0 Reserved for DDT [OBS-ACS-3]",
438 "120 Commands and feature sets supported or enabled",
439 ". 15:14 Must be set to 0x1",
441 ". 9 DSN feature set enabled",
443 ". 7 Extended Power Conditions feature set enabled",
444 ". 6 Sense Data Reporting feature set enabled",
445 ". 5 Free-fall Control feature set enabled",
446 ". 4 DOWNLOAD MICROCODE with mode 3 supported",
447 ". 3 READ/WRITE LOG DMA EXT supported",
448 ". 2 WRITE UNCORRECTABLE EXT supported",
449 ". 1 Write-Read-Verify feature set enabled",
450 ". 0 Reserved for DDT [OBS-ACS-3]",
452 "121-126 ATA: Reserved",
453 "121-124 ATAPI: Reserved",
454 "125 ATAPI: Byte count = 0 behavior",
455 "126 ATAPI: Byte count = 0 behavior [OBS-6]",
457 "127 Removable Media Status Notification [OBS-8]",
459 ". 0 Removable Media Status Notification supported [OBS-8]",
461 "128 Security status",
463 ". 8 Master password capability: 0 = High, 1 = Maximum",
465 ". 5 Enhanced security erase supported",
466 ". 4 Security count expired",
467 ". 3 Security frozen",
468 ". 2 Security locked",
469 ". 1 Security enabled",
470 ". 0 Security supported",
472 "129-159 Vendor specific",
474 "160 CFA power mode",
480 "161-167 Reserved for CFA",
484 ". 3:0 Nominal form factor: -, 5.25, 3.5, 2.5, 1.8, ...",
486 "169 DATA SET MANAGEMENT command support",
488 ". 0 Trim bit in DATA SET MANAGEMENT command supported",
490 "170-173 Additional product identifier (String)",
492 "176-205 Current media serial number (String)",
494 "206 SCT Command Transport",
495 ". 15:12 Vendor specific",
497 ". 7 Reserved for Serial ATA",
499 ". 5 SCT Data Tables supported",
500 ". 4 SCT Feature Control supported",
501 ". 3 SCT Error Recovery Control supported",
502 ". 2 SCT Write Same supported",
503 ". 1 SCT Read/Write Long supported [OBS-ACS-2]",
504 ". 0 SCT Command Transport supported",
508 "209 Alignment of logical sectors",
509 ". 15:14 Must be set to 0x1",
510 ". 13:0 Logical sector offset",
512 "210-211 Write-Read-Verify sector count mode 3 (DWord)",
513 "212-213 Write-Read-Verify sector count mode 2 (DWord)",
515 "214 NV Cache capabilities [OBS-ACS-3]",
516 ". 15:12 NV Cache feature set version [OBS-ACS-3]",
517 ". 11:8 NV Cache Power Mode feature set version [OBS-ACS-3]",
518 ". 7:5 Reserved [OBS-ACS-3]",
519 ". 4 NV Cache feature set enabled [OBS-ACS-3]",
521 ". 1 NV Cache Power Mode feature set enabled [OBS-ACS-3]",
522 ". 0 NV Cache Power Mode feature set supported [OBS-ACS-3]",
524 "215-216 NV Cache size in logical blocks (DWord) [OBS-ACS-3]",
525 "217 Nominal media rotation rate",
528 "219 NV Cache options [OBS-ACS-3]",
529 ". 15:8 Reserved [OBS-ACS-3]",
530 ". 7:0 Estimated time to spin up in seconds [OBS-ACS-3]",
532 "220 Write-Read-Verify mode",
534 ". 7:0 Write-Read-Verify feature set current mode",
538 "222 Transport major version number",
539 ". 15:12 Type: 0x1 = Serial | 0x0 = Parallel | 0xe = PCIe",
549 ". 2 SATA II: Extensions",
550 ". 1 SATA 1.0a | ATA/ATAPI-7 [OBS-ACS-5]",
551 ". 0 ATA8-AST | ATA8-APT [OBS-ACS-5]",
553 "223 Transport minor version number",
555 "230-233 Extended number of user addressable sectors (QWord)",
556 "234 Minimum blocks per DOWNLOAD MICROCODE mode 3 command",
557 "235 Maximum blocks per DOWNLOAD MICROCODE mode 3 command",
560 "255 Integrity word",
567static inline unsigned short get_word(
const void *
id,
int word)
569 const unsigned char * p = ((
const unsigned char *)
id) + 2 * word;
570 return p[0] + (p[1] << 8);
577 bool is_atapi = ((
w & 0x8000) && (
w != 0x848a));
579 int prev_word = -1, prev_bit = -1;
580 pout(
"Word %s Value Description\n", (bit_level >= 0 ?
"Bit " :
" "));
586 int word = prev_word, word2 = -1;
587 int bit = -1, bit2 = -1;
591 if (word >= 0 && sscanf(desc,
". %u:%u %n", &v1, &v2, (nc=-1, &nc)) == 2 && nc > 0 && 16 > v1 && v1 > v2) {
594 else if (word >= 0 && sscanf(desc,
". %u %n", &v1, (nc=-1, &nc)) == 1 && nc > 0 && v1 < 16) {
597 else if (sscanf(desc,
"%u-%u %n", &v1, &v2, (nc=-1, &nc)) == 2 && nc > 0 && v1 < v2 && v2 < 256) {
598 word = v1, word2 = v2;
600 else if (sscanf(desc,
"%u %n", &v1, (nc=-1, &nc)) == 1 && nc > 0 && v1 < 256) {
604 pout(
"Error: #%d: Syntax\n", i);
613 desc +=
sizeof(
"ATA: ")-1;
622 if (word != prev_word+1) {
623 pout(
"Error: #%d: Missing word %d\n", i, prev_word+1);
626 else if (prev_bit > 0) {
627 pout(
"Error: #%d: Missing bit 0 from word %d\n", i, prev_word);
631 else if (!((prev_bit < 0 && bit == 15) || bit == prev_bit-1)) {
632 pout(
"Error: #%d: Missing bit %d from word %d\n", i, bit+1, word);
637 bool w_is_set = (
w != 0x0000 &&
w != 0xffff);
642 b = (
w >> bit2) & ~(~0U << (bit-bit2+1));
646 if ( (bit_level >= 0 &&
b)
647 || (bit_level >= 1 && w_is_set)
648 || (bit_level >= 2 && all_words)) {
652 snprintf(valstr,
sizeof(valstr),
"0x%0*x", (bit - bit2 + 4) >> 2,
b);
653 pout(
"%4d %2d:%-2d %6s %s\n", word, bit, bit2, valstr, desc);
657 pout(
"%4d %2d %u %s\n", word, bit,
b, desc);
661 prev_bit = (bit2 >= 0 ? bit2 : bit);
665 for (
int j = word+1; !w_is_set && j <= word2; j++) {
671 if (all_words || w_is_set) {
672 pout(
"%s%4d-%-3d %s",
673 (bit_level >= 0 ?
"\n" :
""), word, word2,
674 (bit_level >= 0 ?
"- " :
""));
677 pout(
"0x%02x... %s\n",
w & 0xff, desc);
680 bool is_str = !!strstr(desc,
"(String)");
683 for (
int j = word; j <= word2; j += 4) {
684 if (j + 2*4 < word2 && !
nonempty((
const unsigned char *)
id + 2*j, 2*(word2-j+1))) {
686 pout(
"\n%4d-%-3d %s0x0000:0000:0000:00...", j, word2,
687 (bit_level >= 0 ?
". " :
""));
691 pout(
"\n%4d-%-3d %s0x", j, (j+3 <= word2 ? j+3 : word2),
692 (bit_level >= 0 ?
". " :
""));
694 for (k = 0; k < 4 && j+k <= word2; k++)
699 pout(
"%*s \"", 20 - 5 * k,
"");
700 for (k = 0; k < 4 && j+k <= word2; k++) {
701 char c2 = ((
const char *)
id)[2*(j+k) ];
702 char c1 = ((
const char *)
id)[2*(j+k) + 1];
703 pout(
"%c%c", (
' ' <= c1 && c1 <=
'~' ? c1 :
'.'),
704 (
' ' <= c2 && c2 <=
'~' ? c2 :
'.') );
711 if (word + 1 == word2 && strstr(desc,
"(DWord)"))
713 else if (word + 3 == word2 && strstr(desc,
"(QWord)"))
714 pout(
" (%" PRIu64
")\n", ((uint64_t)
get_word(
id, word + 3) << 48)
715 | ((uint64_t)
get_word(
id, word + 2) << 32)
716 | ((
unsigned)
get_word(
id, word + 1) << 16) | (
unsigned)
w);
724 if (all_words || w_is_set)
725 pout(
"%s%4d %s0x%04x %s\n",
726 (bit_level >= 0 ?
"\n" :
""), word,
727 (bit_level >= 0 ?
"- " :
""),
w, desc);
730 prev_word = (word2 >= 0 ? word2 : word);
static unsigned short get_word(const void *id, int word)
void ata_print_identify_data(const void *id, bool all_words, int bit_level)
const char * ataidentify_cpp_cvsid
const char *const identify_descriptions[]
const int num_identify_descriptions
#define ATAIDENTIFY_H_CVSID
void pout(const char *fmt,...)
bool nonempty(const void *data, int size)
bool str_starts_with(const char *str, const char *prefix)