Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux-2.6/verdex.git] / include / linux / hdsmart.h
blob4f4faf9d4238ee217443f9f0b1037f9c306c3ba3
1 /*
2 * linux/include/linux/hdsmart.h
4 * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
5 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
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.
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.
17 #ifndef _LINUX_HDSMART_H
18 #define _LINUX_HDSMART_H
20 #ifndef __KERNEL__
21 #define OFFLINE_FULL_SCAN 0
22 #define SHORT_SELF_TEST 1
23 #define EXTEND_SELF_TEST 2
24 #define SHORT_CAPTIVE_SELF_TEST 129
25 #define EXTEND_CAPTIVE_SELF_TEST 130
27 /* smart_attribute is the vendor specific in SFF-8035 spec */
28 typedef struct ata_smart_attribute_s {
29 unsigned char id;
30 unsigned short status_flag;
31 unsigned char normalized;
32 unsigned char worse_normal;
33 unsigned char raw[6];
34 unsigned char reserv;
35 } __attribute__ ((packed)) ata_smart_attribute_t;
37 /* smart_values is format of the read drive Atrribute command */
38 typedef struct ata_smart_values_s {
39 unsigned short revnumber;
40 ata_smart_attribute_t vendor_attributes [30];
41 unsigned char offline_data_collection_status;
42 unsigned char self_test_exec_status;
43 unsigned short total_time_to_complete_off_line;
44 unsigned char vendor_specific_366;
45 unsigned char offline_data_collection_capability;
46 unsigned short smart_capability;
47 unsigned char errorlog_capability;
48 unsigned char vendor_specific_371;
49 unsigned char short_test_completion_time;
50 unsigned char extend_test_completion_time;
51 unsigned char reserved_374_385 [12];
52 unsigned char vendor_specific_386_509 [125];
53 unsigned char chksum;
54 } __attribute__ ((packed)) ata_smart_values_t;
56 /* Smart Threshold data structures */
57 /* Vendor attribute of SMART Threshold */
58 typedef struct ata_smart_threshold_entry_s {
59 unsigned char id;
60 unsigned char normalized_threshold;
61 unsigned char reserved[10];
62 } __attribute__ ((packed)) ata_smart_threshold_entry_t;
64 /* Format of Read SMART THreshold Command */
65 typedef struct ata_smart_thresholds_s {
66 unsigned short revnumber;
67 ata_smart_threshold_entry_t thres_entries[30];
68 unsigned char reserved[149];
69 unsigned char chksum;
70 } __attribute__ ((packed)) ata_smart_thresholds_t;
72 typedef struct ata_smart_errorlog_command_struct_s {
73 unsigned char devicecontrolreg;
74 unsigned char featuresreg;
75 unsigned char sector_count;
76 unsigned char sector_number;
77 unsigned char cylinder_low;
78 unsigned char cylinder_high;
79 unsigned char drive_head;
80 unsigned char commandreg;
81 unsigned int timestamp;
82 } __attribute__ ((packed)) ata_smart_errorlog_command_struct_t;
84 typedef struct ata_smart_errorlog_error_struct_s {
85 unsigned char error_condition;
86 unsigned char extended_error[14];
87 unsigned char state;
88 unsigned short timestamp;
89 } __attribute__ ((packed)) ata_smart_errorlog_error_struct_t;
91 typedef struct ata_smart_errorlog_struct_s {
92 ata_smart_errorlog_command_struct_t commands[6];
93 ata_smart_errorlog_error_struct_t error_struct;
94 } __attribute__ ((packed)) ata_smart_errorlog_struct_t;
96 typedef struct ata_smart_errorlog_s {
97 unsigned char revnumber;
98 unsigned char error_log_pointer;
99 ata_smart_errorlog_struct_t errorlog_struct[5];
100 unsigned short ata_error_count;
101 unsigned short non_fatal_count;
102 unsigned short drive_timeout_count;
103 unsigned char reserved[53];
104 unsigned char chksum;
105 } __attribute__ ((packed)) ata_smart_errorlog_t;
107 typedef struct ata_smart_selftestlog_struct_s {
108 unsigned char selftestnumber;
109 unsigned char selfteststatus;
110 unsigned short timestamp;
111 unsigned char selftestfailurecheckpoint;
112 unsigned int lbafirstfailure;
113 unsigned char vendorspecific[15];
114 } __attribute__ ((packed)) ata_smart_selftestlog_struct_t;
116 typedef struct ata_smart_selftestlog_s {
117 unsigned short revnumber;
118 ata_smart_selftestlog_struct_t selftest_struct[21];
119 unsigned char vendorspecific[2];
120 unsigned char mostrecenttest;
121 unsigned char resevered[2];
122 unsigned char chksum;
123 } __attribute__ ((packed)) ata_smart_selftestlog_t;
124 #endif /* __KERNEL__ */
126 #endif /* _LINUX_HDSMART_H */