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)
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 /* smart_attribute is the vendor specific in SFF-8035 spec */
21 struct ata_smart_attribute
{
23 unsigned short status_flag
;
24 unsigned char normalized
;
25 unsigned char worse_normal
;
28 } __attribute__ ((packed
));
30 /* smart_values is format of the read drive Atrribute command */
31 struct ata_smart_values
{
32 unsigned short revnumber
;
33 struct ata_smart_attribute vendor_attributes
[30];
34 unsigned char offline_data_collection_status
;
35 unsigned char self_test_exec_status
;
36 unsigned short total_time_to_complete_off_line
;
37 unsigned char vendor_specific_366
;
38 unsigned char offline_data_collection_capability
;
39 unsigned short smart_capability
;
40 unsigned char errorlog_capability
;
41 unsigned char vendor_specific_371
;
42 unsigned char short_test_completion_time
;
43 unsigned char extend_test_completion_time
;
44 unsigned char reserved_374_385
[12];
45 unsigned char vendor_specific_386_509
[125];
47 } __attribute__ ((packed
));
49 /* Smart Threshold data structures */
50 /* Vendor attribute of SMART Threshold */
51 struct ata_smart_threshold_entry
{
53 unsigned char normalized_threshold
;
54 unsigned char reserved
[10];
55 } __attribute__ ((packed
));
57 /* Format of Read SMART THreshold Command */
58 struct ata_smart_thresholds
{
59 unsigned short revnumber
;
60 struct ata_smart_threshold_entry thres_entries
[30];
61 unsigned char reserved
[149];
63 } __attribute__ ((packed
));
65 struct ata_smart_errorlog_command_struct
{
66 unsigned char devicecontrolreg
;
67 unsigned char featuresreg
;
68 unsigned char sector_count
;
69 unsigned char sector_number
;
70 unsigned char cylinder_low
;
71 unsigned char cylinder_high
;
72 unsigned char drive_head
;
73 unsigned char commandreg
;
74 unsigned int timestamp
;
75 } __attribute__ ((packed
));
77 struct ata_smart_errorlog_error_struct
{
78 unsigned char error_condition
;
79 unsigned char extended_error
[14];
81 unsigned short timestamp
;
82 } __attribute__ ((packed
));
84 struct ata_smart_errorlog_struct
{
85 struct ata_smart_errorlog_command_struct commands
[6];
86 struct ata_smart_errorlog_error_struct error_struct
;
87 } __attribute__ ((packed
));
89 struct ata_smart_errorlog
{
90 unsigned char revnumber
;
91 unsigned char error_log_pointer
;
92 struct ata_smart_errorlog_struct errorlog_struct
[5];
93 unsigned short ata_error_count
;
94 unsigned short non_fatal_count
;
95 unsigned short drive_timeout_count
;
96 unsigned char reserved
[53];
97 } __attribute__ ((packed
));
99 struct ata_smart_selftestlog_struct
{
100 unsigned char selftestnumber
;
101 unsigned char selfteststatus
;
102 unsigned short timestamp
;
103 unsigned char selftestfailurecheckpoint
;
104 unsigned int lbafirstfailure
;
105 unsigned char vendorspecific
[15];
106 } __attribute__ ((packed
));
108 struct ata_smart_selftestlog
{
109 unsigned short revnumber
;
110 struct ata_smart_selftestlog_struct selftest_struct
[21];
111 unsigned char vendorspecific
[2];
112 unsigned char mostrecenttest
;
113 unsigned char resevered
[2];
114 unsigned char chksum
;
115 } __attribute__ ((packed
));
117 #if !defined(__KERNEL__) || defined(_IDE_DISK_C)
118 /* smartctl version number */
119 #define VERSION_MAJOR 1
120 #define VERSION_MINOR 2
122 /* Number of ata device to scan */
125 /* how often SMART is checks in seconds */
126 int checktime
= 1800;
128 typedef struct atadevices_s
{
132 struct hd_driveid drive
;
133 struct ata_smart_values smartval
;
134 struct ata_smart_thresholds smartthres
;
137 #endif /* !defined(__KERNEL__) || defined(_IDE_DISK_C) */
139 #endif /* _LINUX_HDSMART_H */