version 1.1, 2012/02/21 16:32:16
|
version 1.1.1.2, 2012/10/09 09:36:45
|
Line 4
|
Line 4
|
* Home page of code is: http://smartmontools.sourceforge.net |
* Home page of code is: http://smartmontools.sourceforge.net |
* |
* |
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> |
* Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net> |
* Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net> | * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net> |
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> |
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> |
* |
* |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
Line 77 enum {
|
Line 77 enum {
|
}; |
}; |
|
|
// ATA Specification Command Register Values (Commands) |
// ATA Specification Command Register Values (Commands) |
|
#define ATA_CHECK_POWER_MODE 0xe5 |
#define ATA_IDENTIFY_DEVICE 0xec |
#define ATA_IDENTIFY_DEVICE 0xec |
#define ATA_IDENTIFY_PACKET_DEVICE 0xa1 |
#define ATA_IDENTIFY_PACKET_DEVICE 0xa1 |
|
#define ATA_IDLE 0xe3 |
#define ATA_SMART_CMD 0xb0 |
#define ATA_SMART_CMD 0xb0 |
#define ATA_CHECK_POWER_MODE 0xe5 | #define ATA_SECURITY_FREEZE_LOCK 0xf5 |
| #define ATA_SET_FEATURES 0xef |
| #define ATA_STANDBY_IMMEDIATE 0xe0 |
| |
| // SET_FEATURES subcommands |
| #define ATA_DISABLE_AAM 0xc2 |
| #define ATA_DISABLE_APM 0x85 |
| #define ATA_DISABLE_WRITE_CACHE 0x82 |
| #define ATA_DISABLE_READ_LOOK_AHEAD 0x55 |
| #define ATA_ENABLE_AAM 0x42 |
| #define ATA_ENABLE_APM 0x05 |
| #define ATA_ENABLE_WRITE_CACHE 0x02 |
| #define ATA_ENABLE_READ_LOOK_AHEAD 0xaa |
| |
// 48-bit commands |
// 48-bit commands |
#define ATA_READ_LOG_EXT 0x2F |
#define ATA_READ_LOG_EXT 0x2F |
|
|
Line 200 ASSERT_SIZEOF_STRUCT(ata_smart_attribute, 12);
|
Line 215 ASSERT_SIZEOF_STRUCT(ata_smart_attribute, 12);
|
#define ATTRIBUTE_FLAGS_OTHER(x) ((x) & 0xffc0) |
#define ATTRIBUTE_FLAGS_OTHER(x) ((x) & 0xffc0) |
|
|
|
|
/* ata_smart_values is format of the read drive Attribute command */ | // Format of data returned by SMART READ DATA |
/* see Table 34 of T13/1321D Rev 1 spec (Device SMART data structure) for *some* info */ | // Table 62 of T13/1699-D (ATA8-ACS) Revision 6a, September 2008 |
#pragma pack(1) |
#pragma pack(1) |
struct ata_smart_values { |
struct ata_smart_values { |
unsigned short int revnumber; |
unsigned short int revnumber; |
Line 215 struct ata_smart_values {
|
Line 230 struct ata_smart_values {
|
unsigned char errorlog_capability; |
unsigned char errorlog_capability; |
unsigned char vendor_specific_371; // Maxtor, IBM: self-test failure checkpoint see below! |
unsigned char vendor_specific_371; // Maxtor, IBM: self-test failure checkpoint see below! |
unsigned char short_test_completion_time; |
unsigned char short_test_completion_time; |
unsigned char extend_test_completion_time; | unsigned char extend_test_completion_time_b; // If 0xff, use 16-bit value below |
unsigned char conveyance_test_completion_time; |
unsigned char conveyance_test_completion_time; |
unsigned char reserved_375_385[11]; | unsigned short extend_test_completion_time_w; // e04130r2, added to T13/1699-D Revision 1c, April 2005 |
| unsigned char reserved_377_385[9]; |
unsigned char vendor_specific_386_510[125]; // Maxtor bytes 508-509 Attribute/Threshold Revision # |
unsigned char vendor_specific_386_510[125]; // Maxtor bytes 508-509 Attribute/Threshold Revision # |
unsigned char chksum; |
unsigned char chksum; |
} ATTR_PACKED; |
} ATTR_PACKED; |
Line 657 enum ata_attr_raw_format
|
Line 673 enum ata_attr_raw_format
|
RAWFMT_RAW16, |
RAWFMT_RAW16, |
RAWFMT_RAW48, |
RAWFMT_RAW48, |
RAWFMT_HEX48, |
RAWFMT_HEX48, |
|
RAWFMT_RAW56, |
|
RAWFMT_HEX56, |
RAWFMT_RAW64, |
RAWFMT_RAW64, |
RAWFMT_HEX64, |
RAWFMT_HEX64, |
RAWFMT_RAW16_OPT_RAW16, |
RAWFMT_RAW16_OPT_RAW16, |
RAWFMT_RAW16_OPT_AVG16, |
RAWFMT_RAW16_OPT_AVG16, |
|
RAWFMT_RAW24_OPT_RAW8, |
RAWFMT_RAW24_DIV_RAW24, |
RAWFMT_RAW24_DIV_RAW24, |
RAWFMT_RAW24_DIV_RAW32, |
RAWFMT_RAW24_DIV_RAW32, |
RAWFMT_SEC2HOUR, |
RAWFMT_SEC2HOUR, |
Line 718 extern bool dont_print_serial_number;
|
Line 737 extern bool dont_print_serial_number;
|
int ata_read_identity(ata_device * device, ata_identify_device * buf, bool fix_swapped_id); |
int ata_read_identity(ata_device * device, ata_identify_device * buf, bool fix_swapped_id); |
int ataCheckPowerMode(ata_device * device); |
int ataCheckPowerMode(ata_device * device); |
|
|
|
// Issue a no-data ATA command with optional sector count register value |
|
bool ata_nodata_command(ata_device * device, unsigned char command, int sector_count = -1); |
|
|
|
// Issue SET FEATURES command with optional sector count register value |
|
bool ata_set_features(ata_device * device, unsigned char features, int sector_count = -1); |
|
|
/* Read S.M.A.R.T information from drive */ |
/* Read S.M.A.R.T information from drive */ |
int ataReadSmartValues(ata_device * device,struct ata_smart_values *); |
int ataReadSmartValues(ata_device * device,struct ata_smart_values *); |
int ataReadSmartThresholds(ata_device * device, struct ata_smart_thresholds_pvt *); |
int ataReadSmartThresholds(ata_device * device, struct ata_smart_thresholds_pvt *); |
Line 766 int ataEnableAutoOffline (ata_device * device);
|
Line 791 int ataEnableAutoOffline (ata_device * device);
|
int ataDisableAutoOffline (ata_device * device); |
int ataDisableAutoOffline (ata_device * device); |
|
|
/* S.M.A.R.T. test commands */ |
/* S.M.A.R.T. test commands */ |
int ataSmartOfflineTest (ata_device * device); | int ataSmartTest(ata_device * device, int testtype, bool force, |
int ataSmartExtendSelfTest (ata_device * device); | const ata_selective_selftest_args & args, |
int ataSmartShortSelfTest (ata_device * device); | const ata_smart_values * sv, uint64_t num_sectors); |
int ataSmartShortCapSelfTest (ata_device * device); | |
int ataSmartExtendCapSelfTest (ata_device * device); | |
int ataSmartSelfTestAbort (ata_device * device); | |
int ataWriteSelectiveSelfTestLog(ata_device * device, ata_selective_selftest_args & args, |
int ataWriteSelectiveSelfTestLog(ata_device * device, ata_selective_selftest_args & args, |
const ata_smart_values * sv, uint64_t num_sectors, |
const ata_smart_values * sv, uint64_t num_sectors, |
const ata_selective_selftest_args * prev_spans = 0); |
const ata_selective_selftest_args * prev_spans = 0); |
Line 829 inline bool isSCTFeatureControlCapable(const ata_ident
|
Line 852 inline bool isSCTFeatureControlCapable(const ata_ident
|
|
|
inline bool isSCTDataTableCapable(const ata_identify_device *drive) |
inline bool isSCTDataTableCapable(const ata_identify_device *drive) |
{ return ((drive->words088_255[206-88] & 0x21) == 0x21); } // 0x20 = SCT Data Table support |
{ return ((drive->words088_255[206-88] & 0x21) == 0x21); } // 0x20 = SCT Data Table support |
|
|
int ataSmartTest(ata_device * device, int testtype, const ata_selective_selftest_args & args, |
|
const ata_smart_values * sv, uint64_t num_sectors); |
|
|
|
int TestTime(const ata_smart_values * data, int testtype); |
int TestTime(const ata_smart_values * data, int testtype); |
|
|