~ubuntu-branches/ubuntu/raring/smartmontools/raring

« back to all changes in this revision

Viewing changes to atacmds.h

  • Committer: Package Import Robot
  • Author(s): Giuseppe Iuculano
  • Date: 2012-05-12 13:02:49 UTC
  • mfrom: (2.2.17 sid)
  • Revision ID: package-import@ubuntu.com-20120512130249-x4vmqc2uu3bynss1
Tags: 5.42+svn3539-1
* [e165493] Imported Upstream version 5.42+svn3539
  (Closes: #668391, #608953)
* [9fcd449] Refreshed patches
* [65c801f] Do not install upstream init (Closes: #631075)
* [9a19418] Fixed check for /usr/bin/mail.
  Thanks to Martin von Gagern (Closes: #649515)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Home page of code is: http://smartmontools.sourceforge.net
5
5
 *
6
6
 * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
7
 
 * Copyright (C) 2008-11 Christian Franke <smartmontools-support@lists.sourceforge.net>
 
7
 * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
8
8
 * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
9
9
 *
10
10
 * This program is free software; you can redistribute it and/or modify
26
26
#ifndef ATACMDS_H_
27
27
#define ATACMDS_H_
28
28
 
29
 
#define ATACMDS_H_CVSID "$Id: atacmds.h 3316 2011-04-19 19:34:57Z chrfranke $"
 
29
#define ATACMDS_H_CVSID "$Id: atacmds.h 3528 2012-03-25 17:13:47Z chrfranke $"
30
30
 
31
31
#include "dev_interface.h" // ata_device
32
32
 
77
77
};
78
78
 
79
79
// ATA Specification Command Register Values (Commands)
 
80
#define ATA_CHECK_POWER_MODE            0xe5
80
81
#define ATA_IDENTIFY_DEVICE             0xec
81
82
#define ATA_IDENTIFY_PACKET_DEVICE      0xa1
 
83
#define ATA_IDLE                        0xe3
82
84
#define ATA_SMART_CMD                   0xb0
83
 
#define ATA_CHECK_POWER_MODE            0xe5
 
85
#define ATA_SECURITY_FREEZE_LOCK        0xf5
 
86
#define ATA_SET_FEATURES                0xef
 
87
#define ATA_STANDBY_IMMEDIATE           0xe0
 
88
 
 
89
// SET_FEATURES subcommands
 
90
#define ATA_DISABLE_AAM                 0xc2
 
91
#define ATA_DISABLE_APM                 0x85
 
92
#define ATA_DISABLE_WRITE_CACHE         0x82
 
93
#define ATA_DISABLE_READ_LOOK_AHEAD     0x55
 
94
#define ATA_ENABLE_AAM                  0x42
 
95
#define ATA_ENABLE_APM                  0x05
 
96
#define ATA_ENABLE_WRITE_CACHE          0x02
 
97
#define ATA_ENABLE_READ_LOOK_AHEAD      0xaa
 
98
 
84
99
// 48-bit commands
85
100
#define ATA_READ_LOG_EXT                0x2F
86
101
 
198
213
#define ATTRIBUTE_FLAGS_OTHER(x) ((x) & 0xffc0)
199
214
 
200
215
 
201
 
/* ata_smart_values is format of the read drive Attribute command */
202
 
/* see Table 34 of T13/1321D Rev 1 spec (Device SMART data structure) for *some* info */
 
216
// Format of data returned by SMART READ DATA
 
217
// Table 62 of T13/1699-D (ATA8-ACS) Revision 6a, September 2008
203
218
struct ata_smart_values {
204
219
  unsigned short int revnumber;
205
220
  struct ata_smart_attribute vendor_attributes [NUMBER_ATA_SMART_ATTRIBUTES];
212
227
  unsigned char errorlog_capability;
213
228
  unsigned char vendor_specific_371;  // Maxtor, IBM: self-test failure checkpoint see below!
214
229
  unsigned char short_test_completion_time;
215
 
  unsigned char extend_test_completion_time;
 
230
  unsigned char extend_test_completion_time_b; // If 0xff, use 16-bit value below
216
231
  unsigned char conveyance_test_completion_time;
217
 
  unsigned char reserved_375_385[11];
 
232
  unsigned short extend_test_completion_time_w; // e04130r2, added to T13/1699-D Revision 1c, April 2005
 
233
  unsigned char reserved_377_385[9];
218
234
  unsigned char vendor_specific_386_510[125]; // Maxtor bytes 508-509 Attribute/Threshold Revision #
219
235
  unsigned char chksum;
220
236
} ATTR_PACKED;
642
658
  RAWFMT_RAW16,
643
659
  RAWFMT_RAW48,
644
660
  RAWFMT_HEX48,
 
661
  RAWFMT_RAW56,
 
662
  RAWFMT_HEX56,
645
663
  RAWFMT_RAW64,
646
664
  RAWFMT_HEX64,
647
665
  RAWFMT_RAW16_OPT_RAW16,
648
666
  RAWFMT_RAW16_OPT_AVG16,
 
667
  RAWFMT_RAW24_OPT_RAW8,
649
668
  RAWFMT_RAW24_DIV_RAW24,
650
669
  RAWFMT_RAW24_DIV_RAW32,
651
670
  RAWFMT_SEC2HOUR,
703
722
int ata_read_identity(ata_device * device, ata_identify_device * buf, bool fix_swapped_id);
704
723
int ataCheckPowerMode(ata_device * device);
705
724
 
 
725
// Issue a no-data ATA command with optional sector count register value
 
726
bool ata_nodata_command(ata_device * device, unsigned char command, int sector_count = -1);
 
727
 
 
728
// Issue SET FEATURES command with optional sector count register value
 
729
bool ata_set_features(ata_device * device, unsigned char features, int sector_count = -1);
 
730
 
706
731
/* Read S.M.A.R.T information from drive */
707
732
int ataReadSmartValues(ata_device * device,struct ata_smart_values *);
708
733
int ataReadSmartThresholds(ata_device * device, struct ata_smart_thresholds_pvt *);
751
776
int ataDisableAutoOffline (ata_device * device);
752
777
 
753
778
/* S.M.A.R.T. test commands */
754
 
int ataSmartOfflineTest (ata_device * device);
755
 
int ataSmartExtendSelfTest (ata_device * device);
756
 
int ataSmartShortSelfTest (ata_device * device);
757
 
int ataSmartShortCapSelfTest (ata_device * device);
758
 
int ataSmartExtendCapSelfTest (ata_device * device);
759
 
int ataSmartSelfTestAbort (ata_device * device);
 
779
int ataSmartTest(ata_device * device, int testtype, bool force,
 
780
                 const ata_selective_selftest_args & args,
 
781
                 const ata_smart_values * sv, uint64_t num_sectors);
 
782
 
760
783
int ataWriteSelectiveSelfTestLog(ata_device * device, ata_selective_selftest_args & args,
761
784
                                 const ata_smart_values * sv, uint64_t num_sectors,
762
785
                                 const ata_selective_selftest_args * prev_spans = 0);
815
838
inline bool isSCTDataTableCapable(const ata_identify_device *drive)
816
839
  { return ((drive->words088_255[206-88] & 0x21) == 0x21); } // 0x20 = SCT Data Table support
817
840
 
818
 
int ataSmartTest(ata_device * device, int testtype, const ata_selective_selftest_args & args,
819
 
                 const ata_smart_values * sv, uint64_t num_sectors);
820
 
 
821
841
int TestTime(const ata_smart_values * data, int testtype);
822
842
 
823
843
// Attribute state