1 #ifndef DEVICES_SMART_H 2 #define DEVICES_SMART_H 3 4 /* 5 ** 6 ** $VER: smart.h 1.0 (01.01.2014) 7 ** 8 ** S.M.A.R.T. definitions (V1) 9 ** 10 ** Rupert Hausberger 11 ** 12 */ 13 14 15 #ifndef EXEC_IO_H 16 #include <exec/io.h> 17 #endif 18 19 #define HD_SMARTCMD (CMD_NONSTD + 22) 20 21 /* Commands (io_Offset) */ 22 #define SMARTC_READ_VALUES 0xD0 23 #define SMARTC_READ_THRESHOLDS 0xD1 24 #define SMARTC_AUTOSAVE 0xD2 25 #define SMARTC_SAVE 0xD3 26 #define SMARTC_IMMEDIATE_OFFLINE 0xD4 27 #define SMARTC_READ_LOG_SECTOR 0xD5 28 #define SMARTC_WRITE_LOG_SECTOR 0xD6 29 #define SMARTC_WRITE_THRESHOLDS 0xD7 30 #define SMARTC_ENABLE 0xD8 31 #define SMARTC_DISABLE 0xD9 32 #define SMARTC_STATUS 0xDA 33 #define SMARTC_AUTO_OFFLINE 0xDB 34 #define SMARTC_TEST_AVAIL 0x00 /* private */ 35 36 /* Legacy attributes */ 37 #define SMARTA_RAW_READ_ERROR_RATE 0x01 38 #define SMARTA_THROUGHPUT_PERFORMANCE 0x02 39 #define SMARTA_SPINUP_TIME 0x03 40 #define SMARTA_START_STOP_COUNT 0x04 41 #define SMARTA_REALLOCATED_SECTOR_COUNT 0x05 42 #define SMARTA_READ_CHANNEL_MARGIN 0x06 43 #define SMARTA_SEEK_ERROR_RATE 0x07 44 #define SMARTA_SEEK_TIMER_PERFORMANCE 0x08 45 #define SMARTA_POWERON_HOURS_COUNT 0x09 46 #define SMARTA_SPINUP_RETRY_COUNT 0x0A 47 #define SMARTA_CALIBRATION_RETRY_COUNT 0x0B 48 #define SMARTA_POWER_CYCLE_COUNT 0x0C 49 #define SMARTA_SOFT_READ_ERROR_RATE 0x0D 50 #define SMARTA_G_SENSE_ERROR_RATE 0xBF 51 #define SMARTA_POWEROFF_RETRACT_COUNT 0xC0 52 #define SMARTA_LOAD_UNLOAD_CYCLE_COUNT 0xC1 53 #define SMARTA_HDA_TEMPERATURE 0xC2 54 #define SMARTA_HARDWARE_ECC_RECOVERED 0xC3 55 #define SMARTA_REALLOCATION_COUNT 0xC4 56 #define SMARTA_CURRENT_PENDING_SECTOR_COUNT 0xC5 57 #define SMARTA_OFFLINE_SCAN_UNCORRECTABLE_COUNT 0xC6 58 #define SMARTA_UDMA_CRC_ERROR_RATE 0xC7 59 #define SMARTA_WRITE_ERROR_RATE 0xC8 60 #define SMARTA_SOFT_READ_ERROR_RATE_2 0xC9 61 #define SMARTA_DATA_ADDRESS_MARK_ERRORS 0xCa 62 #define SMARTA_RUN_OUT_CANCEL 0xCB 63 #define SMARTA_SOFT_ECC_CORRECTION 0xCC 64 #define SMARTA_THERMAL_ASPERITY_RATE 0xCD 65 #define SMARTA_FLYING_HEIGHT 0xCE 66 #define SMARTA_SPIN_HIGH_CURRENT 0xCF 67 #define SMARTA_SPIN_BUZZ 0xD0 68 #define SMARTA_OFFLINE_SEEK_PERFORMANCE 0xD1 69 #define SMARTA_DISK_SHIFT 0xDC 70 #define SMARTA_G_SENSE_ERROR_RATE_2 0xDD 71 #define SMARTA_LOADED_HOURS 0xDE 72 #define SMARTA_LOAD_UNLOAD_RETRY_COUNT 0xDF 73 #define SMARTA_LOAD_FRICTION 0xE0 74 #define SMARTA_LOAD_UNLOAD_CYCLE_COUNT_2 0xE1 75 #define SMARTA_LOAD_IN_TIME 0xE2 76 #define SMARTA_TORQUE_AMPLIFICATION_COUNT 0xE3 77 #define SMARTA_POWER_OFF_RETRACT_COUNT 0xE4 78 #define SMARTA_GMR_HEAD_AMPLITUDE 0xE6 79 #define SMARTA_TEMPERATURE 0xE7 80 #define SMARTA_HEAD_FLYING_HOURS 0xF0 81 #define SMARTA_READ_ERROR_RETRY_RATE 0xFA 82 83 /* Attribute flags */ 84 #define SMARTF_PREFAILURE 0x01 85 #define SMARTF_ONLINE 0x02 86 /* Vendor specific */ 87 #define SMARTF_PERFORMANCE 0x04 88 #define SMARTF_ERRORRATE 0x08 89 #define SMARTF_EVENTCOUNT 0x10 90 #define SMARTF_SELFPRESERVING 0x20 91 #define SMARTF_OTHER 0xffc0 92 93 /* struct SMARTAttributes and SMARTThresholds */ 94 #define SMART_DATA_LENGTH 512 95 96 /* Maximum entries in the table */ 97 #define SMART_MAX_ATTRIBUTES 30 98 99 /* Validate an attribute-id */ 100 #define SMART_ATTRIBUTE_ID_VALID(id) ((id)>0 && (id)<254) 101 102 /* Magic-ID for the TEST_AVAIL command */ 103 #define SMART_MAGIC_ID 0x534D5254 /* SMRT */ 104 105 106 #pragma pack(1) /* packed to 1 */ 107 108 struct SMARTAttributeEntry 109 { 110 UBYTE sae_ID; 111 UWORD sae_Flags; 112 UBYTE sae_Value; 113 UBYTE sae_Worst; 114 UBYTE sae_Raw[6]; 115 UBYTE sae_Reserved; 116 }; 117 118 struct SMARTAttributes /* 512 bytes */ 119 { 120 UWORD sa_Revision; 121 struct SMARTAttributeEntry sa_Attribute[SMART_MAX_ATTRIBUTES]; 122 UBYTE sa_Reserved[6]; 123 UWORD sa_Capability; 124 UBYTE sa_Reserved2[16]; 125 UBYTE sa_VendorSpecific[125]; 126 UBYTE sa_CheckSum; 127 }; 128 129 struct SMARTThresholdEntry 130 { 131 UBYTE ste_ID; 132 UBYTE ste_Value; 133 UBYTE ste_Reserved[10]; 134 }; 135 136 struct SMARTThresholds /* 512 bytes */ 137 { 138 UWORD st_Revision; 139 struct SMARTThresholdEntry st_Threshold[SMART_MAX_ATTRIBUTES]; 140 UBYTE st_Reserved[18]; 141 UBYTE st_VendorSpecific[131]; 142 UBYTE st_CheckSum; 143 }; 144 145 #pragma pack() 146 147 #endif /* DEVICES_SMART_H */ 148