hdsmart.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. #ifndef _LINUX_HDSMART_H
  17. #define _LINUX_HDSMART_H
  18. #ifndef __KERNEL__
  19. #define OFFLINE_FULL_SCAN 0
  20. #define SHORT_SELF_TEST 1
  21. #define EXTEND_SELF_TEST 2
  22. #define SHORT_CAPTIVE_SELF_TEST 129
  23. #define EXTEND_CAPTIVE_SELF_TEST 130
  24. /* smart_attribute is the vendor specific in SFF-8035 spec */
  25. typedef struct ata_smart_attribute_s {
  26. unsigned char id;
  27. unsigned short status_flag;
  28. unsigned char normalized;
  29. unsigned char worse_normal;
  30. unsigned char raw[6];
  31. unsigned char reserv;
  32. } __attribute__ ((packed)) ata_smart_attribute_t;
  33. /* smart_values is format of the read drive Atrribute command */
  34. typedef struct ata_smart_values_s {
  35. unsigned short revnumber;
  36. ata_smart_attribute_t vendor_attributes [30];
  37. unsigned char offline_data_collection_status;
  38. unsigned char self_test_exec_status;
  39. unsigned short total_time_to_complete_off_line;
  40. unsigned char vendor_specific_366;
  41. unsigned char offline_data_collection_capability;
  42. unsigned short smart_capability;
  43. unsigned char errorlog_capability;
  44. unsigned char vendor_specific_371;
  45. unsigned char short_test_completion_time;
  46. unsigned char extend_test_completion_time;
  47. unsigned char reserved_374_385 [12];
  48. unsigned char vendor_specific_386_509 [125];
  49. unsigned char chksum;
  50. } __attribute__ ((packed)) ata_smart_values_t;
  51. /* Smart Threshold data structures */
  52. /* Vendor attribute of SMART Threshold */
  53. typedef struct ata_smart_threshold_entry_s {
  54. unsigned char id;
  55. unsigned char normalized_threshold;
  56. unsigned char reserved[10];
  57. } __attribute__ ((packed)) ata_smart_threshold_entry_t;
  58. /* Format of Read SMART THreshold Command */
  59. typedef struct ata_smart_thresholds_s {
  60. unsigned short revnumber;
  61. ata_smart_threshold_entry_t thres_entries[30];
  62. unsigned char reserved[149];
  63. unsigned char chksum;
  64. } __attribute__ ((packed)) ata_smart_thresholds_t;
  65. typedef struct ata_smart_errorlog_command_struct_s {
  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)) ata_smart_errorlog_command_struct_t;
  76. typedef struct ata_smart_errorlog_error_struct_s {
  77. unsigned char error_condition;
  78. unsigned char extended_error[14];
  79. unsigned char state;
  80. unsigned short timestamp;
  81. } __attribute__ ((packed)) ata_smart_errorlog_error_struct_t;
  82. typedef struct ata_smart_errorlog_struct_s {
  83. ata_smart_errorlog_command_struct_t commands[6];
  84. ata_smart_errorlog_error_struct_t error_struct;
  85. } __attribute__ ((packed)) ata_smart_errorlog_struct_t;
  86. typedef struct ata_smart_errorlog_s {
  87. unsigned char revnumber;
  88. unsigned char error_log_pointer;
  89. ata_smart_errorlog_struct_t errorlog_struct[5];
  90. unsigned short ata_error_count;
  91. unsigned short non_fatal_count;
  92. unsigned short drive_timeout_count;
  93. unsigned char reserved[53];
  94. unsigned char chksum;
  95. } __attribute__ ((packed)) ata_smart_errorlog_t;
  96. typedef struct ata_smart_selftestlog_struct_s {
  97. unsigned char selftestnumber;
  98. unsigned char selfteststatus;
  99. unsigned short timestamp;
  100. unsigned char selftestfailurecheckpoint;
  101. unsigned int lbafirstfailure;
  102. unsigned char vendorspecific[15];
  103. } __attribute__ ((packed)) ata_smart_selftestlog_struct_t;
  104. typedef struct ata_smart_selftestlog_s {
  105. unsigned short revnumber;
  106. ata_smart_selftestlog_struct_t selftest_struct[21];
  107. unsigned char vendorspecific[2];
  108. unsigned char mostrecenttest;
  109. unsigned char resevered[2];
  110. unsigned char chksum;
  111. } __attribute__ ((packed)) ata_smart_selftestlog_t;
  112. #endif /* __KERNEL__ */
  113. #endif /* _LINUX_HDSMART_H */