Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/include/linux/hdsmart.h | |
3 | * | |
4 | * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> | |
5 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2, or (at your option) | |
10 | * any later version. | |
11 | * | |
12 | * You should have received a copy of the GNU General Public License | |
13 | * (for example /usr/src/linux/COPYING); if not, write to the Free | |
14 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
15 | */ | |
16 | ||
17 | #ifndef _LINUX_HDSMART_H | |
18 | #define _LINUX_HDSMART_H | |
19 | ||
20 | #define OFFLINE_FULL_SCAN 0 | |
21 | #define SHORT_SELF_TEST 1 | |
22 | #define EXTEND_SELF_TEST 2 | |
23 | #define SHORT_CAPTIVE_SELF_TEST 129 | |
24 | #define EXTEND_CAPTIVE_SELF_TEST 130 | |
25 | ||
26 | /* smart_attribute is the vendor specific in SFF-8035 spec */ | |
27 | typedef struct ata_smart_attribute_s { | |
28 | unsigned char id; | |
29 | unsigned short status_flag; | |
30 | unsigned char normalized; | |
31 | unsigned char worse_normal; | |
32 | unsigned char raw[6]; | |
33 | unsigned char reserv; | |
34 | } __attribute__ ((packed)) ata_smart_attribute_t; | |
35 | ||
36 | /* smart_values is format of the read drive Atrribute command */ | |
37 | typedef struct ata_smart_values_s { | |
38 | unsigned short revnumber; | |
39 | ata_smart_attribute_t vendor_attributes [30]; | |
40 | unsigned char offline_data_collection_status; | |
41 | unsigned char self_test_exec_status; | |
42 | unsigned short total_time_to_complete_off_line; | |
43 | unsigned char vendor_specific_366; | |
44 | unsigned char offline_data_collection_capability; | |
45 | unsigned short smart_capability; | |
46 | unsigned char errorlog_capability; | |
47 | unsigned char vendor_specific_371; | |
48 | unsigned char short_test_completion_time; | |
49 | unsigned char extend_test_completion_time; | |
50 | unsigned char reserved_374_385 [12]; | |
51 | unsigned char vendor_specific_386_509 [125]; | |
52 | unsigned char chksum; | |
53 | } __attribute__ ((packed)) ata_smart_values_t; | |
54 | ||
55 | /* Smart Threshold data structures */ | |
56 | /* Vendor attribute of SMART Threshold */ | |
57 | typedef struct ata_smart_threshold_entry_s { | |
58 | unsigned char id; | |
59 | unsigned char normalized_threshold; | |
60 | unsigned char reserved[10]; | |
61 | } __attribute__ ((packed)) ata_smart_threshold_entry_t; | |
62 | ||
63 | /* Format of Read SMART THreshold Command */ | |
64 | typedef struct ata_smart_thresholds_s { | |
65 | unsigned short revnumber; | |
66 | ata_smart_threshold_entry_t thres_entries[30]; | |
67 | unsigned char reserved[149]; | |
68 | unsigned char chksum; | |
69 | } __attribute__ ((packed)) ata_smart_thresholds_t; | |
70 | ||
71 | typedef struct ata_smart_errorlog_command_struct_s { | |
72 | unsigned char devicecontrolreg; | |
73 | unsigned char featuresreg; | |
74 | unsigned char sector_count; | |
75 | unsigned char sector_number; | |
76 | unsigned char cylinder_low; | |
77 | unsigned char cylinder_high; | |
78 | unsigned char drive_head; | |
79 | unsigned char commandreg; | |
80 | unsigned int timestamp; | |
81 | } __attribute__ ((packed)) ata_smart_errorlog_command_struct_t; | |
82 | ||
83 | typedef struct ata_smart_errorlog_error_struct_s { | |
84 | unsigned char error_condition; | |
85 | unsigned char extended_error[14]; | |
86 | unsigned char state; | |
87 | unsigned short timestamp; | |
88 | } __attribute__ ((packed)) ata_smart_errorlog_error_struct_t; | |
89 | ||
90 | typedef struct ata_smart_errorlog_struct_s { | |
91 | ata_smart_errorlog_command_struct_t commands[6]; | |
92 | ata_smart_errorlog_error_struct_t error_struct; | |
93 | } __attribute__ ((packed)) ata_smart_errorlog_struct_t; | |
94 | ||
95 | typedef struct ata_smart_errorlog_s { | |
96 | unsigned char revnumber; | |
97 | unsigned char error_log_pointer; | |
98 | ata_smart_errorlog_struct_t errorlog_struct[5]; | |
99 | unsigned short ata_error_count; | |
100 | unsigned short non_fatal_count; | |
101 | unsigned short drive_timeout_count; | |
102 | unsigned char reserved[53]; | |
103 | unsigned char chksum; | |
104 | } __attribute__ ((packed)) ata_smart_errorlog_t; | |
105 | ||
106 | typedef struct ata_smart_selftestlog_struct_s { | |
107 | unsigned char selftestnumber; | |
108 | unsigned char selfteststatus; | |
109 | unsigned short timestamp; | |
110 | unsigned char selftestfailurecheckpoint; | |
111 | unsigned int lbafirstfailure; | |
112 | unsigned char vendorspecific[15]; | |
113 | } __attribute__ ((packed)) ata_smart_selftestlog_struct_t; | |
114 | ||
115 | typedef struct ata_smart_selftestlog_s { | |
116 | unsigned short revnumber; | |
117 | ata_smart_selftestlog_struct_t selftest_struct[21]; | |
118 | unsigned char vendorspecific[2]; | |
119 | unsigned char mostrecenttest; | |
120 | unsigned char resevered[2]; | |
121 | unsigned char chksum; | |
122 | } __attribute__ ((packed)) ata_smart_selftestlog_t; | |
123 | ||
124 | #endif /* _LINUX_HDSMART_H */ |