hdsmart.h 4.2 KB

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