4
* Home page of code is: http://smartmontools.sourceforge.net
6
* Copyright (C) 2006 Douglas Gilbert <dougg@torque.net>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2, or (at your option)
13
* You should have received a copy of the GNU General Public License
14
* (for example COPYING); if not, write to the Free
15
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
#define SCSIATA_H_CVSID "$Id: scsiata.h,v 1.2 2006/07/01 21:29:31 dpgilbert Exp $\n"
32
#define SAT_ATA_PASSTHROUGH_12LEN 12
33
#define SAT_ATA_PASSTHROUGH_16LEN 16
35
extern int sat_command_interface(int device, smart_command_set command,
36
int select, char *data);
38
/* Attempt an IDENTIFY DEVICE ATA command via SATL when packet_interface
39
is 0 otherwise attempt IDENTIFY PACKET DEVICE. If successful
41
extern int has_sat_pass_through(int device, int packet_interface);
43
/* This is a slightly stretched SCSI sense "descriptor" format header.
44
The addition is to allow the 0x70 and 0x71 response codes. The idea
45
is to place the salient data of both "fixed" and "descriptor" sense
46
format into one structure to ease application processing.
47
The original sense buffer should be kept around for those cases
48
in which more information is required (e.g. the LBA of a MEDIUM ERROR). */
49
struct sg_scsi_sense_hdr {
50
unsigned char response_code; /* permit: 0x0, 0x70, 0x71, 0x72, 0x73 */
51
unsigned char sense_key;
57
unsigned char additional_length;
60
/* Maps the salient data from a sense buffer which is in either fixed or
61
descriptor format into a structure mimicking a descriptor format
62
header (i.e. the first 8 bytes of sense descriptor format).
63
If zero response code returns 0. Otherwise returns 1 and if 'sshp' is
64
non-NULL then zero all fields and then set the appropriate fields in
65
that structure. sshp::additional_length is always 0 for response
66
codes 0x70 and 0x71 (fixed format). */
67
extern int sg_scsi_normalize_sense(const unsigned char * sensep,
69
struct sg_scsi_sense_hdr * sshp);
71
/* Attempt to find the first SCSI sense data descriptor that matches the
72
given 'desc_type'. If found return pointer to start of sense data
73
descriptor; otherwise (including fixed format sense data) returns NULL. */
74
extern const unsigned char * sg_scsi_sense_desc_find(
75
const unsigned char * sensep, int sense_len, int desc_type);