/*
* Copyright 1995, 1997 by Apple Computer, Inc.
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation.
*
* APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
* NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This bit may be set in SCSI_Inquiry_Data.devTypeMod
*/
enum {
kScsiInquiryRMB = 0x80 /* Removable medium if set */
};
/*
* These bits may be set in SCSI_Inquiry_Data.flags
*/
enum {
kScsiInquiryRelAdr = 0x80, /* Has relative addressing */
kScsiInquiryWBus32 = 0x40, /* Wide (32-bit) transfers */
kScsiInquiryWBus16 = 0x20, /* Wide (16-bit) transfers */
kScsiInquirySync = 0x10, /* Synchronous transfers */
kScsiInquiryLinked = 0x08, /* Linked commands ok */
kScsiInquiryReserved = 0x04,
kScsiInquiryCmdQue = 0x02, /* Tagged cmd queuing ok */
kScsiInquirySftRe = 0x01 /* Soft reset alternative */
};
/*
* These bits may be set in SCSI_Inquiry_Data.devType
*/
enum {
kScsiDevTypeDirect = 0,
kScsiDevTypeSequential,
kScsiDevTypePrinter,
kScsiDevTypeProcessor,
kScsiDevTypeWorm, /* Write-once, read mult */
kScsiDevTypeCDROM,
kScsiDevTypeScanner,
kScsiDevTypeOptical,
kScsiDevTypeChanger,
kScsiDevTypeComm,
kScsiDevTypeGraphicArts0A,
kScsiDevTypeGraphicArts0B,
kScsiDevTypeFirstReserved, /* Reserved sequence start */
kScsiDevTypeUnknownOrMissing = 0x1F,
kScsiDevTypeMask = 0x1F
};
/*
* These are device type qualifiers. We need them to distinguish between "unknown"
* and "missing" devices.
*/
enum {
kScsiDevTypeQualifierConnected = 0x00, /* Exists and is connected */
kScsiDevTypeQualifierNotConnected = 0x20, /* Logical unit exists */
kScsiDevTypeQualifierReserved = 0x40,
kScsiDevTypeQualifierMissing = 0x60, /* No such logical unit */
kScsiDevTypeQualifierVendorSpecific = 0x80, /* Other bits are unspecified */
kScsiDevTypeQualifierMask = 0xE0
};
#define kScsiDevTypeMissing \
(kScsiDevTypeUnknownOrMissing | kScsiDevTypeQualifierMissing)
/*
* This is the data that is returned after a GetExtendedStatus
* request. The errorCode gives a general indication of the error,
* which may be qualified by the additionalSenseCode and
* additionalSenseQualifier fields. These may be device (vendor)
* specific values, however. The info[] field contains additional
* information. For a media error, it contains the failing
* logical block number (most-significant byte first).
*/
struct SCSI_Sense_Data { /* Request Sense result */
uint8_t errorCode; /* 0 Class code, valid lbn */
uint8_t segmentNumber; /* 1 Segment number */
uint8_t senseKey; /* 2 Sense key and flags */
uint8_t info[4];
uint8_t additionalSenseLength;
uint8_t reservedForCopy[4];
uint8_t additionalSenseCode;
uint8_t additionalSenseQualifier;
uint8_t fruCode; /* Field replacable unit code */
uint8_t senseKeySpecific[2];
uint8_t additional[101];
};
typedef struct SCSI_Sense_Data SCSI_Sense_Data;
/*
* The high-bit of errorCode signals whether there is a logical
* block. The low value signals whether there is a valid sense
*/
#define kScsiSenseHasLBN 0x80 /* Logical block number set */
#define kScsiSenseInfoValid 0x70 /* Is sense key valid? */
#define kScsiSenseInfoMask 0x70 /* Mask for sense info */
/*
* These bits may be set in the sense key
*/
#define kScsiSenseKeyMask 0x0F
#define kScsiSenseILI 0x20 /* Illegal logical Length */
#define kScsiSenseEOM 0x40 /* End of media */
#define kScsiSenseFileMark 0x80 /* End of file mark */
/*
* Default timeout times for SCSI commands (times are in Msec).
*/
#define kScsiNormalCompletionTime (500L) /* 1/2 second */
/*
* Dratted DAT tape.
*/
#define kScsiDATCompletionTime (60L * 1000L); /* One minute */
/*
* Yes, we do allow 90 seconds for spin-up of those dratted tape drives.
*/
#define kScsiSpinUpCompletionTime (90L * 1000L)