Summary of SCSI Manager 4.3
C Summary
Constants
enum {
scsiVERSION = 43
};
/* SCSI Manager function codes */
enum {
SCSINop = 0x00, /* no operation */
SCSIExecIO = 0x01, /* execute a SCSI IO transaction */
SCSIBusInquiry = 0x03, /* bus inquiry */
SCSIReleaseQ = 0x04, /* release a frozen SIM queue */
SCSIAbortCommand = 0x10, /* abort a SCSI command */
SCSIResetBus = 0x11, /* reset the SCSI bus */
SCSIResetDevice = 0x12, /* reset a SCSI device */
SCSITerminateIO = 0x13, /* terminate I/O transaction */
SCSIGetVirtualIDInfo = 0x80, /* return DeviceIdent of virtual ID */
SCSILoadDriver = 0x82, /* load a driver from a SCSI device */
SCSIOldCall = 0x84, /* begin old-API emulation */
SCSICreateRefNumXref = 0x85, /* register a device driver */
SCSILookupRefNumXref = 0x86, /* find a driver reference number */
SCSIRemoveRefNumXref = 0x87, /* deregister a device driver */
SCSIRegisterWithNewXPT = 0x88, /* XPT replaced; SIM must reregister */
vendorUnique = 0xC0 /* 0xC0 through 0xFF */
};
/* allocation lengths for parameter block fields */
enum {
handshakeDataLength = 8, /* handshake data length */
maxCDBLength = 16, /* space for the CDB bytes/pointer */
vendorIDLength = 16 /* ASCII string length for vendor ID */
};
/* types for the scsiTransferType field */
enum {
scsiTransferBlind = 0, /* DMA if available, otherwise blind */
scsiTransferPolled /* polled */
};
/* types for the scsiDataType field */
enum {
scsiDataBuffer = 0, /* single contiguous buffer supplied */
scsiDataTIB = 1, /* TIB supplied (ptr in scsiDataPtr) */
scsiDataSG = 2 /* scatter/gather list supplied */
};
/* flags for the scsiResultFlags field */
enum {
scsiSIMQFrozen = 0x0001, /* the SIM queue is frozen */
scsiAutosenseValid = 0x0002, /* autosense data valid for target */
scsiBusNotFree = 0x0004 /* SCSI bus is not free */
};
/* bit numbers of the scsiFlags field */
enum {
kbSCSIDisableAutosense = 29, /* disable autosense feature */
kbSCSIFlagReservedA = 28,
kbSCSIFlagReserved0 = 27,
kbSCSICDBLinked = 26, /* the PB contains a linked CDB */
kbSCSIQEnable = 25, /* target queue actions are enabled */
kbSCSICDBIsPointer = 24, /* the CDB field contains a pointer */
kbSCSIFlagReserved1 = 23,
kbSCSIInitiateSyncData = 22, /* attempt sync data transfer and SDTR */
kbSCSIDisableSyncData = 21, /* disable sync, go to async */
kbSCSISIMQHead = 20, /* place PB at the head of SIM queue */
kbSCSISIMQFreeze = 19, /* freeze the SIM queue */
kbSCSISIMQNoFreeze = 18, /* disable SIM queue freezing */
kbSCSIDoDisconnect = 17, /* definitely do disconnect */
kbSCSIDontDisconnect = 16, /* definitely don't disconnect */
kbSCSIDataReadyForDMA = 15, /* data buffer(s) are ready for DMA */
kbSCSIFlagReserved3 = 14,
kbSCSIDataPhysical = 13, /* S/G buffer data ptrs are physical */
kbSCSISensePhysical = 12, /* autosense buffer ptr is physical */
kbSCSIFlagReserved5 = 11,
kbSCSIFlagReserved6 = 10,
kbSCSIFlagReserved7 = 9,
kbSCSIFlagReserved8 = 8,
kbSCSIDataBufferValid = 7, /* data buffer valid */
kbSCSIStatusBufferValid = 6, /* status buffer valid */
kbSCSIMessageBufferValid= 5, /* message buffer valid */
kbSCSIFlagReserved9 = 4
};
/* bit masks for the scsiFlags field */
enum {
scsiDirectionMask = 0xC0000000, /* data direction mask */
scsiDirectionNone = 0xC0000000, /* data direction (11: no data) */
scsiDirectionReserved = 0x00000000, /* data direction (00: reserved) */
scsiDirectionOut = 0x80000000, /* data direction (10: DATA OUT) */
scsiDirectionIn = 0x40000000, /* data direction (01: DATA IN) */
scsiDisableAutosense = 0x20000000, /* disable auto sense feature */
scsiFlagReservedA = 0x10000000,
scsiFlagReserved0 = 0x08000000,
scsiCDBLinked = 0x04000000, /* the PB contains a linked CDB */
scsiQEnable = 0x02000000, /* target queue actions enabled */
scsiCDBIsPointer = 0x01000000, /* the CDB field is a pointer */
scsiFlagReserved1 = 0x00800000,
scsiInitiateSyncData = 0x00400000, /* attempt sync data xfer & SDTR */
scsiDisableSyncData = 0x00200000, /* disable sync, go to async */
scsiSIMQHead = 0x00100000, /* place PB at the head of queue */
scsiSIMQFreeze = 0x00080000, /* freeze the SIM queue */
scsiSIMQNoFreeze = 0x00040000, /* disallow SIM Q freezing */
scsiDoDisconnect = 0x00020000, /* definitely do disconnect */
scsiDontDisconnect = 0x00010000, /* definitely don't disconnect */
scsiDataReadyForDMA = 0x00008000, /* buffer(s) are ready for DMA */
scsiFlagReserved3 = 0x00004000,
scsiDataPhysical = 0x00002000, /* S/G buffer ptrs are physical */
scsiSensePhysical = 0x00001000, /* autosense ptr is physical */
scsiFlagReserved5 = 0x00000800,
scsiFlagReserved6 = 0x00000400,
scsiFlagReserved7 = 0x00000200,
scsiFlagReserved8 = 0x00000100
};
/* bit masks for the scsiIOFlags field */
enum {
scsiNoParityCheck = 0x0002, /* disable parity checking */
scsiDisableSelectWAtn = 0x0004, /* disable select w/Atn */
scsiSavePtrOnDisconnect = 0x0008, /* SaveDataPointer on disconnect */
scsiNoBucketIn = 0x0010, /* don't bit-bucket on input */
scsiNoBucketOut = 0x0020, /* don't bit-bucket on output */
scsiDisableWide = 0x0040, /* disable wide negotiation */
scsiInitiateWide = 0x0080, /* initiate wide negotiation */
scsiRenegotiateSense = 0x0100, /* renegotiate sync/wide */
scsiIOFlagReserved0080 = 0x0080,
scsiIOFlagReserved8000 = 0x8000
};
/* SIM queue actions. */
enum {
scsiSimpleQTag = 0x20, /* tag for a simple queue */
scsiHeadQTag = 0x21, /* tag for head of queue */
scsiOrderedQTag = 0x22 /* tag for ordered queue */
};
/* scsiHBAInquiry field bits */
enum {
scsiBusMDP = 0x80, /* supports Modify Data Pointer message */
scsiBusWide32 = 0x40, /* supports 32-bit wide SCSI */
scsiBusWide16 = 0x20, /* supports 16-bit wide SCSI */
scsiBusSDTR = 0x10, /* supports SDTR message */
scsiBusLinkedCDB = 0x08, /* supports linked CDBs */
scsiBusTagQ = 0x02, /* supports tag queue message */
scsiBusSoftReset = 0x01 /* supports soft reset */
};
/* scsiDataTypes field bits */
/* bits 0-15 Apple-defined, 16-30 vendor unique, 31 = reserved */
enum {
scsiBusDataBuffer = (1<<scsiDataBuffer), /* single buffer */
scsiBusDataTIB = (1<<scsiDataTIB), /* TIB (ptr in scsiDataPtr) */
scsiBusDataSG = (1<<scsiDataSG), /* scatter/gather list */
scsiBusDataReserved = 0x80000000
};
/* scsiScanFlags field bits */
enum {
scsiBusScansDevices = 0x80, /* bus scans and maintains device list */
scsiBusScansOnInit = 0x40, /* bus scans at startup */
scsiBusLoadsROMDrivers = 0x20/* may load ROM drivers for targets */
};
/* scsiFeatureFlags field bits */
enum {
scsiBusInternalExternalMask = 0x000000C0, /* internal/external mask*/
scsiBusInternalExternalUnknown = 0x00000000, /* unknown if in or out */
scsiBusInternalExternal = 0x000000C0, /* both inside and outside */
scsiBusInternal = 0x00000080, /* bus goes inside the box */
scsiBusExternal = 0x00000040, /* bus goes outside the box */
scsiBusCacheCoherentDMA = 0x00000020, /* DMA is cache coherent */
scsiBusOldCallCapable = 0x00000010, /* SIM supports old API */
scsiBusDifferential = 0x00000004, /* uses differential bus */
scsiBusFastSCSI = 0x00000002, /* HBA supports fast SCSI */
scsiBusDMAavailable = 0x00000001/* DMA is available */
};
/* scsiWeirdStuff field bits */
enum {
/* disconnects on odd byte boundries are unsafe with DMA or blind reads */
scsiOddDisconnectUnsafeRead1 = 0x0001,
/* disconnects on odd byte boundries unsafe with DMA or blind writes */
scsiOddDisconnectUnsafeWrite1 = 0x0002,
/* non-handshaked delays or disconnects on blind transfer may hang */
scsiBusErrorsUnsafe = 0x0004,
/* non-handshaked delays or disconnects on blind transfer may corrupt */
scsiRequiresHandshake = 0x0008,
/* targets that initiate synchronous negotiations are supported */
scsiTargetDrivenSDTRSafe = 0x0010
};
/* scsiHBAslotType values */
enum {
scsiMotherboardBus = 0x01, /* a built-in Apple bus */
scsiNuBus = 0x02, /* a SIM on a NuBus card */
scsiPDSBus = 0x03 /* a SIM on a PDS card */
};
/* flags for the scsiDriverFlags field */
enum {
scsiDeviceSensitive = 0x0001, /* only driver should access this device */
scsiDeviceNoOldCallAccess = 0x0002 /* device does not support old API */
};
/* SCSI Phases (used by SIMs that support the original SCSI Manager) */
enum {
kDataOutPhase, /* encoded MSG, C/D, I/O bits */
kDataInPhase,
kCommandPhase,
kStatusPhase,
kPhaseIllegal0,
kPhaseIllegal1,
kMessageOutPhase,
kMessageInPhase,
kBusFreePhase, /* additional phases */
kArbitratePhase,
kSelectPhase
};
Data Types
/* SCSI callback function prototypes */
typedef pascal void (*CallbackProc) (void * scsiPB);
typedef void (*AENCallbackProc) (void);
typedef OSErr (*SIMInitProc) (Ptr SIMinfoPtr);
typedef void (*SIMActionProc) (void * scsiPB, Ptr SIMGlobals);
typedef void (*SCSIProc) (void );
typedef void (*MakeCallbackProc) (void * scsiPB);
typedef SInt32 (*InterruptPollProc) (Ptr SIMGlobals);
struct DeviceIdent
{
UInt8 diReserved; /* reserved */
UInt8 bus; /* SCSI - bus number */
UInt8 targetID; /* SCSI - target SCSI ID */
UInt8 LUN; /* SCSI - logical unit number */
};
typedef struct DeviceIdent DeviceIdent;
union CDB
{
UInt8 *cdbPtr; /* pointer to the CDB, or */
UInt8 cdbBytes[maxCDBLength]; /* the actual CDB to send */
};
typedef union CDB CDB, *CDBPtr;
struct SGRecord
{
Ptr SGAddr; /* scatter/gather buffer address */
UInt32 SGCount; /* buffer size */
};
typedef struct SGRecord SGRecord;
#define SCSIPBHdr \
struct SCSIHdr *qLink; /*internal use, must be nil */ \
SInt16 scsiReserved1; /* -> reserved for input */ \
UInt16 scsiPBLength; /* -> length of the entire PB */ \
UInt8 scsiFunctionCode; /* -> function selector */ \
UInt8 scsiReserved2; /* <- reserved for output*/ \
OSErr scsiResult; /* <- returned result */ \
DeviceIdentscsiDevice; /* -> device ID (bus+target+LUN) */ \
CallbackProcscsiCompletion; /* -> completion routine pointer */ \
UInt32 scsiFlags; /* -> assorted flags */ \
UInt8 *scsiDriverStorage; /* <> pointer for driver private use */ \
Ptr scsiXPTprivate; /*private field for XPT */ \
SInt32 scsiReserved3; /*reserved */
struct SCSI_PB
{
SCSIPBHdr
};
typedef struct SCSI_PB SCSI_PB;
#define SCSI_IO_Macro \
SCSIPBHdr /*header information fields */ \
UInt16 scsiResultFlags; /* <- flags that modify scsiResult */ \
UInt16 scsiReserved12; /* -> reserved */ \
UInt8 *scsiDataPtr; /* -> data pointer */ \
UInt32 scsiDataLength; /* -> data transfer length */ \
UInt8 *scsiSensePtr; /* -> autosense data buffer pointer */ \
UInt8 scsiSenseLength; /* -> size of the autosense buffer */ \
UInt8 scsiCDBLength; /* -> number of bytes for the CDB */ \
UInt16 scsiSGListCount; /* -> number of S/G list entries */ \
UInt32 scsiReserved4; /* <- reserved for output */ \
UInt8 scsiSCSIstatus; /* <- returned SCSI device status */ \
SInt8 scsiSenseResidual; /* <- autosense residual length */ \
UInt16 scsiReserved5; /* <- reserved for output */ \
SInt32 scsiDataResidual; /* <- data residual length */ \
CDB scsiCDB; /* -> actual CDB or pointer to CDB */ \
SInt32 scsiTimeout; /* -> timeout value */ \
UInt8 *scsiReserved13; /* -> reserved */ \
UInt16 scsiReserved14; /* -> reserved */ \
UInt16 scsiIOFlags; /* -> additional I/O flags */ \
UInt8 scsiTagAction; /* -> what to do for tag queuing */ \
UInt8 scsiReserved6; /* -> reserved for input */ \
UInt16 scsiReserved7; /* -> reserved for input */ \
UInt16 scsiSelectTimeout; /* -> select timeout value */ \
UInt8 scsiDataType; /* -> data description type */ \
UInt8 scsiTransferType; /* -> transfer type (blind/polled) */ \
UInt32 scsiReserved8; /* -> reserved for input */ \
UInt32 scsiReserved9; /* -> reserved for input */ \
UInt16 scsiHandshake[handshakeDataLength]; /* -> handshake info */ \
UInt32 scsiReserved10; /* -> reserved for input */ \
UInt32 scsiReserved11; /* -> reserved for input */ \
struct SCSI_IO *scsiCommandLink; /* -> linked command pointer */ \
UInt8 scsiSIMpublics[8]; /* -> reserved for SIM input */ \
UInt8 scsiAppleReserved6[8];/* -> reserved for input */ \
/* XPT private fields for original SCSI Manager emulation */ \
UInt16 scsiCurrentPhase; /* <- bus phase after old call */ \
SInt16 scsiSelector; /* -> selector for old call */ \
OSErr scsiOldCallResult; /* <- result of old call */ \
UInt8 scsiSCSImessage; /* <- SCSIComplete message byte */ \
UInt8 XPTprivateFlags; /* <> XPT private flags */ \
UInt8 XPTextras[12]; /*reserved */
struct SCSI_IO
{
SCSI_IO_Macro
};
typedef struct SCSI_IO SCSI_IO;
typedef SCSI_IO SCSIExecIOPB;
struct SCSIBusInquiryPB
{
SCSIPBHdr /* header information fields */
UInt16 scsiEngineCount; /* <- number of engines on HBA */
UInt16 scsiMaxTransferType; /* <- number of xfer types supported */
UInt32 scsiDataTypes; /* <- data types supported by this SIM */
UInt16 scsiIOpbSize; /* <- size of SCSI_IO PB for this SIM */
UInt16 scsiMaxIOpbSize; /* <- largest SCSI_IO PB for all SIMs */
UInt32 scsiFeatureFlags; /* <- supported features flags field */
UInt8 scsiVersionNumber; /* <- version number for the SIM/HBA */
UInt8 scsiHBAInquiry; /* <- mimic of INQ byte 7 for the HBA */
UInt8 scsiTargetModeFlags; /* <- flags for target mode support */
UInt8 scsiScanFlags; /* <- scan related feature flags */
UInt32 scsiSIMPrivatesPtr; /* <- pointer to SIM private data */
UInt32 scsiSIMPrivatesSize; /* <- size of SIM private data */
UInt32 scsiAsyncFlags; /* <- reserved for input */
UInt8 scsiHiBusID; /* <- highest path ID in the subsystem */
UInt8 scsiInitiatorID; /* <- ID of the HBA on the SCSI bus */
UInt16 scsiBIReserved0; /* reserved */
UInt32 scsiBIReserved1; /* reserved */
UInt32 scsiFlagsSupported; /* <- which scsiFlags are supported */
UInt16 scsiIOFlagsSupported; /* <- which scsiIOFlags are supported */
UInt16 scsiWeirdStuff; /* <- flags for strange behavior */
UInt16 scsiMaxTarget; /* <- maximum target ID supported */
UInt16 scsiMaxLUN; /* <- maximum LUN supported */
SInt8 scsiSIMVendor[vendorIDLength]; /* <- vendor ID of the SIM */
SInt8 scsiHBAVendor[vendorIDLength]; /* <- vendor ID of the HBA */
SInt8 scsiControllerFamily[vendorIDLength]; /* <- controller family */
SInt8 scsiControllerType[vendorIDLength]; /* <- controller model */
SInt8 scsiXPTversion[4]; /* <- version number of XPT */
SInt8 scsiSIMversion[4]; /* <- version number of SIM */
SInt8 scsiHBAversion[4]; /* <- version number of HBA */
UInt8 scsiHBAslotType; /* <- type of slot this HBA is in */
UInt8 scsiHBAslotNumber; /* <- slot number of this HBA */
UInt16 scsiSIMsRsrcID; /* <- sResource ID of this SIM */
UInt16 scsiBIReserved3; /* <- reserved for input */
UInt16 scsiAdditionalLength; /* <- additional length of PB */
};
typedef struct SCSIBusInquiryPB SCSIBusInquiryPB;
struct SCSIAbortCommandPB
{
SCSIPBHdr /* header information fields */
SCSI_IO *scsiIOptr; /* -> pointer to the PB to abort */
};
typedef struct SCSIAbortCommandPB SCSIAbortCommandPB;
struct SCSITerminateIOPB
{
SCSIPBHdr /* header information fields */
SCSI_IO *scsiIOptr; /* -> pointer to the PB to terminate */
};
typedef struct SCSITerminateIOPB SCSITerminateIOPB;
struct SCSIGetVirtualIDInfoPB
{
SCSIPBHdr /* header information fields */
UInt16 scsiOldCallID; /* -> SCSI ID of device in question */
Boolean scsiExists; /* <- true if device exists */
};
typedef struct SCSIGetVirtualIDInfoPB SCSIGetVirtualIDInfoPB;
struct SCSIDriverPB
{
SCSIPBHdr /* header information fields */
SInt16 scsiDriver; /* -> driver refNum, for CreateRefNumXref */
/* <- for LookupRefNumXref */
UInt16 scsiDriverFlags; /* <> details of driver/device */
DeviceIdent scsiNextDevice; /* <- DeviceIdent of the next driver */
};
typedef struct SCSIDriverPB SCSIDriverPB;
struct SCSILoadDriverPB
{
SCSIPBHdr /* header information fields */
SInt16 scsiLoadedRefNum; /* <- SIM returns driver reference number */
Boolean scsiDiskLoadFailed; /* -> if true, previous call failed */
};
typedef struct SCSILoadDriverPB SCSILoadDriverPB;
struct SIMInitInfo
{
UInt8 *SIMstaticPtr; /* <- pointer to the SIM's static data */
SInt32 staticSize; /* -> size requested for SIM static data */
SIMInitProc SIMInit; /* -> pointer to the SIMInit function */
SIMActionProc SIMAction; /* -> pointer to the SIMAction function */
SCSIProc SIM_ISR; /* reserved */
InterruptPollProc SIMInterruptPoll; /* -> pointer to SIMInterruptPoll */
SIMActionProc NewOldCall; /* -> pointer to NewOldCall function */
UInt16 ioPBSize; /* -> size of SCSI_IO PB for this SIM */
Boolean oldCallCapable; /* -> true if SIM handles old-API calls */
UInt8 simInfoUnused1; /* reserved */
SInt32 simInternalUse; /* not affected or viewed by XPT */
SCSIProc XPT_ISR; /* reserved */
SCSIProc EnteringSIM; /* <- pointer to EnteringSIM function */
SCSIProc ExitingSIM; /* <- pointer to ExitingSIM function */
MakeCallbackProc MakeCallback; /* <- pointer to MakeCallback function */
UInt16 busID; /* <- bus number for the registered bus */
UInt16 simInfoUnused3; /* <- reserved */
SInt32 simInfoUnused4; /* <- reserved */
};
typedef struct SIMInitInfo SIMInitInfo;
Functions
OSErr SCSIAction (SCSI_PB *scsiPB);
OSErr SCSIRegisterBus (SIMInitInfo *SIMinfoPtr);
OSErr SCSIDeregisterBus (SCSI_PB *scsiPB);
OSErr SCSIReregisterBus (SIMInitInfo *SIMinfoPtr);
OSErr SCSIKillXPT (void *);
Pascal Summary
Constants
CONST
scsiVERSION = 43;
{SCSI Manager function codes}
SCSINop = $00; {no operation}
SCSIExecIO = $01; {execute a SCSI IO transaction}
SCSIBusInquiry = $03; {bus inquiry}
SCSIReleaseQ = $04; {release a frozen SIM queue}
SCSIAbortCommand = $10; {abort a SCSI command}
SCSIResetBus = $11; {reset the SCSI bus}
SCSIResetDevice = $12; {reset a SCSI device}
SCSITerminateIO = $13; {terminate I/O transaction}
SCSIGetVirtualIDInfo = $80; {return DeviceIdent of virtual ID}
SCSILoadDriver = $82; {load a driver from a SCSI device}
SCSIOldCall = $84; {begin old-API emulation}
SCSICreateRefNumXref = $85; {register a device driver}
SCSILookupRefNumXref = $86; {find a driver reference number}
SCSIRemoveRefNumXref = $87; {deregister a device driver}
SCSIRegisterWithNewXPT = $88; {XPT replaced; SIM must reregister}
vendorUnique = $C0; {$C0 through $FF}
{allocation lengths for parameter block fields}
handshakeDataLength = 8; {handshake data length}
maxCDBLength = 16; {space for the CDB bytes/pointer}
vendorIDLength = 16; {ASCII string length for Vendor ID}
{types for the scsiTransferType field}
scsiTransferBlind = 0; {DMA if available, otherwise blind}
scsiTransferPolled = 1; {polled}
{types for the scsiDataType field}
scsiDataBuffer = 0; {single contiguous buffer supplied}
scsiDataTIB = 1; {TIB supplied (ptr in scsiDataPtr)}
scsiDataSG = 2; {scatter/gather list supplied}
{flags for the scsiResultFlags field}
scsiSIMQFrozen = $0001; {the SIM queue is frozen}
scsiAutosenseValid = $0002; {autosense data valid for target}
scsiBusNotFree = $0004; {SCSI bus is not free}
{bit numbers in the scsiFlags field}
kbSCSIDisableAutosense = 29; {disable auto sense feature}
kbSCSIFlagReservedA = 28;
kbSCSIFlagReserved0 = 27;
kbSCSICDBLinked = 26; {the PB contains a linked CDB}
kbSCSIQEnable = 25; {target queue actions are enabled}
kbSCSICDBIsPointer = 24; {the CDB field contains a pointer}
kbSCSIFlagReserved1 = 23;
kbSCSIInitiateSyncData = 22; {attempt sync data transfer and SDTR}
kbSCSIDisableSyncData = 21; {disable sync, go to async}
kbSCSISIMQHead = 20; {place PB at the head of SIM queue}
kbSCSISIMQFreeze = 19; {freeze the SIM queue}
kbSCSISIMQNoFreeze = 18; {disable SIM queue freezing}
kbSCSIDoDisconnect = 17; {definitely do disconnect}
kbSCSIDontDisconnect = 16; {definitely don't disconnect}
kbSCSIDataReadyForDMA = 15; {data buffer(s) are ready for DMA}
kbSCSIFlagReserved3 = 14;
kbSCSIDataPhysical = 13; {S/G buffer data ptrs are physical}
kbSCSISensePhysical = 12; {autosense buffer ptr is physical}
kbSCSIFlagReserved5 = 11;
kbSCSIFlagReserved6 = 10;
kbSCSIFlagReserved7 = 9;
kbSCSIFlagReserved8 = 8;
kbSCSIDataBufferValid = 7; {data buffer valid}
kbSCSIStatusBufferValid = 6; {status buffer valid}
kbSCSIMessageBufferValid = 5; {message buffer valid}
kbSCSIFlagReserved9 = 4;
{bit masks for the scsiFlags field}
scsiDirectionMask = $C0000000; {data direction mask}
scsiDirectionNone = $C0000000; {data direction (11: no data)}
scsiDirectionReserved = $00000000; {data direction (00: reserved)}
scsiDirectionOut = $80000000; {data direction (10: DATA OUT)}
scsiDirectionIn = $40000000; {data direction (01: DATA IN)}
scsiDisableAutosense = $20000000; {disable auto sense feature}
scsiFlagReservedA = $10000000;
scsiFlagReserved0 = $08000000;
scsiCDBLinked = $04000000; {the PB contains a linked CDB}
scsiQEnable = $02000000; {target queue actions enabled}
scsiCDBIsPointer = $01000000; {the CDB field is a pointer}
scsiFlagReserved1 = $00800000;
scsiInitiateSyncData = $00400000; {attempt sync data xfer & SDTR}
scsiDisableSyncData = $00200000; {disable sync; go to async}
scsiSIMQHead = $00100000; {place PB at the head of queue}
scsiSIMQFreeze = $00080000; {freeze the SIM queue}
scsiSIMQNoFreeze = $00040000; {disallow SIM Q freezing}
scsiDoDisconnect = $00020000; {definitely do disconnect}
scsiDontDisconnect = $00010000; {definitely don't disconnect}
scsiDataReadyForDMA = $00008000; {buffer(s) are ready for DMA}
scsiFlagReserved3 = $00004000;
scsiDataPhysical = $00002000; {S/G buffer ptrs are physical}
scsiSensePhysical = $00001000; {autosense ptr is physical}
scsiFlagReserved5 = $00000800;
scsiFlagReserved6 = $00000400;
scsiFlagReserved7 = $00000200;
scsiFlagReserved8 = $00000100;
{bit masks for the scsiIOFlags field}
scsiNoParityCheck = $0002; {disable parity checking}
scsiDisableSelectWAtn = $0004; {disable select w/Atn}
scsiSavePtrOnDisconnect = $0008; {SaveDataPointer on disconnect}
scsiNoBucketIn = $0010; {don't bit-bucket on input}
scsiNoBucketOut = $0020; {don't bit-bucket on output}
scsiDisableWide = $0040; {disable wide negotiation}
scsiInitiateWide = $0080; {initiate wide negotiation}
scsiRenegotiateSense = $0100; {renegotiate sync/wide}
scsiIOFlagReserved0080 = $0080;
scsiIOFlagReserved8000 = $8000;
{SIM queue actions}
scsiSimpleQTag = $20; {tag for a simple queue}
scsiHeadQTag = $21; {tag for head of queue}
scsiOrderedQTag = $22; {tag for ordered queue}
{scsiHBAInquiry field bits}
scsiBusMDP = $80; {supports Modify Data Pointer message}
scsiBusWide32 = $40; {supports 32-bit wide SCSI}
scsiBusWide16 = $20; {supports 16-bit wide SCSI}
scsiBusSDTR = $10; {supports SDTR message}
scsiBusLinkedCDB = $08; {supports linked CDBs}
scsiBusTagQ = $02; {supports tag queue message}
scsiBusSoftReset = $01; {supports soft reset}
{scsiDataTypes field bits}
{bits 0-15 Apple-defined, 16-30 vendor unique, 31 = reserved}
scsiBusDataBuffer = $00000001; {single buffer}
scsiBusDataTIB = $00000002; {TIB (pointer in scsiDataPtr)}
scsiBusDataSG = $00000004; {scatter/gather list}
scsiBusDataReserved = $80000000;
{scsiScanFlags field bits}
scsiBusScansDevices = $80; {bus scans and maintains device list}
scsiBusScansOnInit = $40; {bus scans at startup}
scsiBusLoadsROMDrivers = $20; {may load ROM drivers for targets}
{scsiFeatureFlags field bits}
scsiBusInternalExternalMask = $000000C0; {internal/external mask}
scsiBusInternalExternalUnknown = $00000000; {unknown if in or out}
scsiBusInternalExternal = $000000C0; {both inside and outside}
scsiBusInternal = $00000080; {bus goes inside the box}
scsiBusExternal = $00000040; {bus goes outside the box}
scsiBusCacheCoherentDMA = $00000020; {DMA is cache coherent}
scsiBusOldCallCapable = $00000010; {SIM supports old-API}
scsiBusDifferential = $00000004; {uses differential bus}
scsiBusFastSCSI = $00000002; {HBA supports fast SCSI}
scsiBusDMAavailable = $00000001; {DMA is available}
{scsiWeirdStuff field bits}
scsiOddDisconnectUnsafeRead1 = $0001; {odd byte disconnects unsafe}
scsiOddDisconnectUnsafeWrite1 = $0002; {odd byte disconnects unsafe}
scsiBusErrorsUnsafe = $0004; {delays or disconnects may hang}
scsiRequiresHandshake = $0008; {delays/disconnects may corrupt}
scsiTargetDrivenSDTRSafe = $0010; {target-driven STDR supported}
{scsiHBAslotType values}
scsiMotherboardBus = $01; {a built-in Apple bus}
scsiNuBus = $02; {a SIM on a NuBus card}
scsiPDSBus = $03; {a SIM on a PDS card}
{flags for the scsiDriverFlags field}
scsiDeviceSensitive = $0001; {only driver should access the device}
scsiDeviceNoOldCallAccess = $0002; {device does not support old API}
{SCSI Phases (used by SIMs that support the original SCSI Manager)}
kDataOutPhase = $00; {encoded MSG, C/D, I/O bits}
kDataInPhase = $01;
kCommandPhase = $02;
kStatusPhase = $03;
kPhaseIllegal0 = $04;
kPhaseIllegal1 = $05;
kMessageOutPhase = $06;
kMessageInPhase = $07;
kBusFreePhase = $08; {additional phases}
kArbitratePhase = $09;
kSelectPhase = $0A;
Data Types
TYPE
{SCSI callback function prototypes}
CallbackProc = ProcPtr;
AENCallbackProc = ProcPtr;
SIMInitProc = ProcPtr;
SIMActionProc = ProcPtr;
SCSIProc = ProcPtr;
MakeCallbackProc = ProcPtr;
InterruptPollProc = ProcPtr;
TYPE
DI =
PACKED RECORD
diReserved: Byte; {reserved}
bus: Byte; {SCSI - bus number}
targetID: Byte; {SCSI - target SCSI ID}
LUN: Byte; {SCSI - logical unit number}
END;
DeviceIdent = DI;
CDBRec =
PACKED RECORD
CASE Integer OF
0: cdbPtr: ^Byte; {pointer to the CDB, or}
1: cdbBytes: ARRAY [0..15] OF Byte; {the actual CDB to send}
END;
CDB = CDBRec;
CDBPtr = ^CDBRec;
SGR =
PACKED RECORD
SGAddr: Ptr; {scatter/gather buffer address}
SGCount: LongInt; {buffer size}
END;
SGRecord = SGR;
SCSIHdr =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
END;
SCSI_PB = SCSIHdr;
SCSI_IO =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiResultFlags: Integer; {<- flags that modify scsiResult}
scsiReserved12: Integer; {-> reserved}
scsiDataPtr: ^Byte; {-> data pointer}
scsiDataLength: LongInt; {-> data transfer length}
scsiSensePtr: ^Byte; {-> autosense data buffer pointer}
scsiSenseLength: Byte; {-> size of the autosense buffer}
scsiCDBLength: Byte; {-> number of bytes for the CDB}
scsiSGListCount: Integer; {-> number of S/G list entries}
scsiReserved4: LongInt; {<- reserved for output}
scsiSCSIstatus: Byte; {<- returned SCSI device status}
scsiSenseResidual: Char; {<- autosense residual length}
scsiReserved5: Integer; {<- reserved for output}
scsiDataResidual: LongInt; {<- data residual length}
scsiCDB: CDB; {-> actual CDB or pointer to CDB}
scsiTimeout: LongInt; {-> timeout value}
scsiReserved13: ^Byte; {-> reserved}
scsiReserved14: Integer; {-> reserved}
scsiIOFlags: Integer; {-> additional I/O flags}
scsiTagAction: Byte; {-> what to do for tag queuing}
scsiReserved6: Byte; {-> reserved for input}
scsiReserved7: Integer; {-> reserved for input}
scsiSelectTimeout: Integer; {-> select timeout value}
scsiDataType: Byte; {-> data description type}
scsiTransferType: Byte; {-> transfer type (blind/polled)}
scsiReserved8: LongInt; {-> reserved for input}
scsiReserved9: LongInt; {-> reserved for input}
scsiHandshake: ARRAY [0..7] OF Integer; {-> handshake info}
scsiReserved10: LongInt; {-> reserved for input}
scsiReserved11: LongInt; {-> reserved for input}
scsiCommandLink: ^SCSI_IO; {-> linked command pointer}
scsiSIMpublics: ARRAY [0..7] OF Byte; {-> reserved for SIM input}
scsiAppleReserved6: ARRAY [0..7] OF Byte; {-> reserved for input}
scsiCurrentPhase: Integer; {<- bus phase after old call}
scsiSelector: Integer; {-> selector for old call}
scsiOldCallResult: OSErr; {<- result of old call}
scsiSCSImessage: Byte; {<- SCSIComplete message byte}
XPTprivateFlags: Byte; {<> XPT private flags}
XPTextras: ARRAY [0..11] OF Byte; {reserved}
END;
SCSIExecIOPB = SCSI_IO;
SCSIBusInquiryPB =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiEngineCount: Integer; {<- number of engines on HBA}
scsiMaxTransferType: Integer; {<- number of xfer types supported}
scsiDataTypes: LongInt; {<- data types supported by SIM}
scsiIOpbSize: Integer; {<- size of SCSI_IO PB for SIM}
scsiMaxIOpbSize: Integer; {<- largest SCSI_IO PB registered}
scsiFeatureFlags: LongInt; {<- supported features flags field}
scsiVersionNumber: Byte; {<- version number for the SIM/HBA}
scsiHBAInquiry: Byte; {<- mimic of INQ byte 7 for HBA}
scsiTargetModeFlags: Byte; {<- flags for target mode support}
scsiScanFlags: Byte; {<- scan related feature flags}
scsiSIMPrivatesPtr: LongInt; {<- pointer to SIM private data}
scsiSIMPrivatesSize: LongInt; {<- size of SIM private data}
scsiAsyncFlags: LongInt; {<- reserved for input}
scsiHiBusID: Byte; {<- highest bus ID registered}
scsiInitiatorID: Byte; {<- ID of the HBA on the SCSI bus}
scsiBIReserved0: Integer; {reserved}
scsiBIReserved1: LongInt; {reserved}
scsiFlagsSupported: LongInt; {<- which scsiFlags are supported}
scsiIOFlagsSupported: Integer; {<- which scsiIOFlags supported}
scsiWeirdStuff: Integer; {<- flags for strange behavior}
scsiMaxTarget: Integer; {<- maximum target ID supported}
scsiMaxLUN: Integer; {<- maximum LUN supported}
scsiSIMVendor: ARRAY [0..15] OF Char; {<- vendor ID of the SIM}
scsiHBAVendor: ARRAY [0..15] OF Char; {<- vendor ID of the HBA}
scsiControllerFamily: ARRAY [0..15] OF Char; {<- controller family}
scsiControllerType: ARRAY [0..15] OF Char; {<- controller model}
scsiXPTversion: ARRAY [0..3] OF Char; {<- version number of XPT}
scsiSIMversion: ARRAY [0..3] OF Char; {<- version number of SIM}
scsiHBAversion: ARRAY [0..3] OF Char; {<- version number of HBA}
scsiHBAslotType: Byte; {<- type of slot this HBA is in}
scsiHBAslotNumber: Byte; {<- slot number of this HBA}
scsiSIMsRsrcID: Integer; {<- sResource ID of this SIM}
scsiBIReserved3: Integer; {<- reserved for input}
scsiAdditionalLength: Integer; {<- additional length of PB}
END;
SCSIAbortCommandPB =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiIOptr: ^SCSI_IO; {-> pointer to the PB to abort}
END;
SCSITerminateIOPB =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiIOptr: ^SCSI_IO; {-> pointer to the PB to terminate}
END;
SCSIGetVirtualIDInfoPB =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiOldCallID: Integer; {-> SCSI ID of device in question}
scsiExists: Boolean; {<- true if device exists}
END;
SCSIDriverPB =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiDriver: Integer; {<> driver reference number}
scsiDriverFlags: Integer; {<> details of driver/device}
scsiNextDevice: DeviceIdent; {<- DeviceIdent of the next driver}
END;
SCSILoadDriverPB =
PACKED RECORD
qLink: ^SCSIHdr; {internal use, must be NIL}
scsiReserved1: Integer; {-> reserved for input}
scsiPBLength: Integer; {-> length of the entire PB}
scsiFunctionCode: Byte; {-> function selector}
scsiReserved2: Byte; {<- reserved for output}
scsiResult: OSErr; {<- returned result}
scsiDevice: DeviceIdent; {-> device ID (bus+target+LUN)}
scsiCompletion: CallbackProc; {-> completion routine pointer}
scsiFlags: LongInt; {-> assorted flags}
scsiDriverStorage: ^Byte; {<> pointer for driver private use}
scsiXPTprivate: Ptr; {private field for XPT}
scsiReserved3: LongInt; {reserved}
scsiLoadedRefNum: Integer; {<- SIM returns driver refNum}
scsiDiskLoadFailed: Boolean; {-> if true, previous call failed}
END;
SIMInitInfo =
PACKED RECORD
SIMstaticPtr: ^Byte; {<- pointer to SIM's static data}
staticSize: LongInt; {-> requested SIM static data size}
SIMInit: SIMInitProc; {-> SIMInit function pointer}
SIMAction: SIMActionProc; {-> SIMAction function pointer}
SIM_ISR: SCSIProc; {reserved}
SIMInterruptPoll: InterruptPollProc;{-> SIMInterruptPoll function}
NewOldCall: SIMActionProc; {-> NewOldCall function pointer}
ioPBSize: Integer; {-> size of SCSI_IO PB for SIM}
oldCallCapable: Boolean; {-> true if SIM supports old-API}
simInfoUnused1: Byte; {reserved}
simInternalUse: LongInt; { not affected or viewed by XPT}
XPT_ISR: SCSIProc; {reserved}
EnteringSIM: SCSIProc; {<- EnteringSIM function pointer}
ExitingSIM: SCSIProc; {<- ExitingSIM function pointer}
MakeCallback: MakeCallbackProc;{<- MakeCallback function ptr}
busID: Integer; {<- bus number assigned by XPT}
simInfoUnused3: Integer; {<- reserved}
simInfoUnused4: LongInt; {<- reserved}
END;
Routines
FUNCTION SCSIAction (VAR ioPtr: SCSI_PB): OSErr;
FUNCTION SCSIRegisterBus (VAR ioPtr: SIMInitInfo): OSErr;
FUNCTION SCSIDeregisterBus (VAR ioPtr: SIMInitInfo): OSErr;
FUNCTION SCSIReregisterBus (VAR ioPtr: SIMInitInfo): OSErr;
FUNCTION SCSIKillXPT (VAR ioPtr: SIMInitInfo): OSErr;
Assembly-Language Summary
Data Structures
The Device Identification Record
0 | diReserved | byte | reserved |
1 | bus | byte | bus number |
2 | targetID | byte | target SCSI ID |
3 | LUN | byte | logical unit number |
The Command Descriptor Block Record
0 | cdbPtr | long | CDB buffer pointer |
4 | cdbBytes | 16 bytes | CDB buffer |
The Scatter/Gather List Element
0 | SGAddr | long | buffer pointer |
4 | SGCount | long | buffer size |
The SCSI Manager Parameter Block Header
0 | qLink | long | used internally by the SCSI Manager |
4 | scsiReserved | word | reserved |
6 | scsiPBLength | word | parameter block size |
8 | scsiFunctionCode | byte | function selector code |
9 | scsiReserved2 | byte | reserved |
10 | scsiResult | word | result code |
12 | scsiDevice | 4 bytes | device ID (bus number, target ID, LUN) |
16 | scsiCompletion | long | completion routine |
20 | scsiFlags | long | flags |
24 | scsiDriverStorage | long | driver private data |
28 | scsiXPTprivate | long | reserved |
32 | scsiReserved3 | long | reserved |
The SCSI I/O Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiResultFlags | word | I/O result flags |
38 | scsiReserved12 | word | reserved |
40 | scsiDataPtr | long | data buffer pointer |
44 | scsiDataLength | long | data buffer size |
48 | scsiSensePtr | long | autosense buffer pointer |
52 | scsiSenseLength | byte | autosense buffer size |
53 | scsiCDBLength | byte | CDB size |
54 | scsiSGListCount | word | number of scatter/gather list entries |
56 | scsiReserved4 | long | reserved |
60 | scsiSCSIstatus | byte | SCSI device status |
61 | scsiSenseResidual | byte | autosense residual length |
62 | scsiReserved5 | word | reserved |
64 | scsiDataResidual | long | data transfer residual length |
68 | scsiCDB | 16 bytes | command descriptor block record |
84 | scsiTimeout | long | timeout value, in Time Manager format |
88 | scsiReserved13 | long | reserved |
92 | scsiReserved14 | long | reserved |
94 | scsiIOFlags | word | I/O flags |
96 | scsiTagAction | byte | reserved |
97 | scsiReserved6 | byte | reserved |
98 | scsiReserved7 | word | reserved |
100 | scsiSelectTimeout | word | selection timeout value, in milliseconds |
102 | scsiDataType | byte | data type of scsiDataPtr |
103 | scsiTransferType | byte | transfer mode (polled or blind) |
104 | scsiReserved8 | long | reserved |
108 | scsiReserved9 | long | reserved |
112 | scsiHandshake | 16 bytes | handshaking instructions |
128 | scsiReserved10 | long | reserved |
132 | scsiReserved1 | long | reserved |
136 | scsiCommandLink | long | linked parameter block pointer |
140 | scsiSIMpublics | 8 bytes | additional input to SIM |
148 | scsiAppleReserved6 | 8 bytes | reserved |
156 | scsiCurrentPhase | word | bus phase after original SCSI Manager function |
158 | scsiSelector | word | _SCSIDispatch selector for original function |
160 | scsiOldCallResult | word | result code of original function |
162 | scsiSCSImessage | byte | SCSIComplete message byte |
163 | XPTprivateFlags | byte | reserved |
164 | XPTextras | 12 bytes | reserved |
| | | |
The SCSI Bus Inquiry Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiEngineCount | word | number of engines on the HBA |
38 | scsiMaxTransferType | word | number of data transfer types supported |
40 | scsiDataTypes | long | bit map of supported data types |
44 | scsiIOpbSize | word | SCSI I/O parameter block size for this SIM |
46 | scsiMaxIOpbSize | word | largest parameter block for any registered SIM |
48 | scsiFeatureFlags | long | bus feature flags |
52 | scsiVersionNumber | byte | SIM/HBA version number |
53 | scsiHBAInquiry | byte | bus capability flags |
54 | scsiTargetModeFlags | byte | reserved |
55 | scsiScanFlags | byte | scan feature flags |
56 | scsiSIMPrivatesPtr | long | SIM private data pointer |
60 | scsiSIMPrivatesSize | long | SIM private data size |
64 | scsiAsyncFlags | long | reserved |
68 | scsiHiBusID | byte | highest registered bus number |
69 | scsiInitiatorID | byte | SCSI ID of the HBA |
70 | scsiBIReserved0 | word | reserved |
72 | scsiBIReserved1 | long | reserved |
76 | scsiFlagsSupported | long | bit map of supported scsiFlags |
80 | scsiIOFlagsSupported | word | bit map of supported scsiIOFlags |
82 | scsiWeirdStuff | word | miscellaneous flags |
84 | scsiMaxTarget | word | highest SCSI ID supported by the HBA |
86 | scsiMaxLUN | word | highest LUN supported by the HBA |
88 | scsiSIMVendor | 16 bytes | SIM vendor string |
104 | scsiHBAVendor | 16 bytes | HBA vendor string |
120 | scsiControllerFamily | 16 bytes | SCSI controller family string |
136 | scsiControllerType | 16 bytes | SCSI controller type string |
152 | scsiXPTversion | 4 bytes | XPT version string |
156 | scsiSIMversion | 4 bytes | SIM version string |
160 | scsiHBAversion | 4 bytes | HBA version string |
164 | scsiHBAslotType | byte | HBA slot type |
165 | scsiHBAslotNumber | byte | HBA slot number |
166 | scsiSIMsRsrcID | word | SIM sResource ID |
168 | scsiBIReserved3 | word | reserved |
170 | scsiAdditionalLength | word | additional size of the parameter block |
The SCSI Abort Command Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiIOptr | long | SCSI I/O parameter block pointer |
The SCSI Terminate I/O Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiIOptr | long | SCSI I/O parameter block pointer |
The SCSI Virtual ID Information Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiOldCallID | word | virtual SCSI ID of the device to search for |
38 | scsiExists | byte | Boolean (true if the device was found) |
The SCSI Load Driver Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiLoadedRefNum | word | driver reference number |
38 | scsiDiskLoadFailed | byte | Boolean (true if a driver could not be loaded) |
The SCSI Driver Identification Parameter Block
0 | SCSIPBHdr | 36 bytes | parameter block header |
36 | scsiDriver | word | driver reference number |
38 | scsiDriverFlags | word | driver flags |
40 | scsiNextDevice | 4 bytes | device ID of the next device in the list |
The SIM Initialization Record
0 | SIMstaticPtr | long | SIM private data pointer |
4 | staticSize | long | SIM private data size |
8 | SIMInit | long | SIMInit function pointer |
12 | SIMAction | long | SIMAction function pointer |
16 | SIM_ISR | long | reserved |
20 | SIMInterruptPoll | long | SIMInterruptPoll function pointer |
24 | NewOldCall | long | NewOldCall function pointer |
28 | ioPBSize | word | SCSI I/O parameter block size for this SIM |
30 | oldCallCapable | byte | Boolean (true if SIM accepts original functions) |
31 | simInfoUnused1 | byte | reserved |
32 | simInternalUse | long | SIM private data |
36 | XPT_ISR | long | reserved |
40 | EnteringSIM | long | EnteringSIM function pointer |
44 | ExitingSIM | long | ExitingSIM function pointer |
48 | MakeCallback | long | MakeCallback function pointer |
52 | busID | word | bus number |
54 | simInfoUnused3 | word | reserved |
56 | simInfoUnused4 | long | reserved |
Trap Macros
Trap Macros Requiring Routine Selectors
_SCSIAtomic
Selector | Routine |
$0001 | SCSIAction |
$0002 | SCSIRegisterBus |
$0003 | SCSIDeregisterBus |
$0004 | SCSIReregisterBus |
$0005 | SCSIKillXPT |
Result Codes
noErr | 0 | No error |
scsiRequestInProgress | 1 | Parameter block request is in progress |
scsiCDBLengthInvalid | -7863 | The CDB length supplied is not supported by this SIM; typically this means it was too big |
scsiTransferTypeInvalid | -7864 | The scsiTransferType is not supported by this SIM |
scsiDataTypeInvalid | -7865 | SIM does not support the requested scsiDataType |
scsiIDInvalid | -7866 | The initiator ID is invalid |
scsiLUNInvalid | -7867 | The logical unit number is invalid |
scsiTIDInvalid | -7868 | The target ID is invalid |
scsiBusInvalid | -7869 | The bus ID is invalid |
scsiRequestInvalid | -7870 | The parameter block request is invalid |
scsiFunctionNotAvailable | -7871 | The requested function is not supported by this SIM |
scsiPBLengthError | -7872 | The parameter block length is too small for this SIM |
scsiQLinkInvalid | -7881 | The qLink field was not 0 |
scsiNoSuchXref | -7882 | No driver has been cross-referenced with this device |
scsiDeviceConflict | -7883 | Attempt to register more than one driver to a device |
scsiNoHBA | -7884 | No HBA detected |
scsiDeviceNotThere | -7885 | SCSI device not installed or available |
scsiProvideFail | -7886 | Unable to provide the requested service |
scsiBusy | -7887 | SCSI subsystem is busy |
scsiTooManyBuses | -7888 | SIM registration failed because the XPT registry is full |
scsiCDBReceived | -7910 | The SCSI CDB was received |
scsiNoNexus | -7911 | Nexus is not established |
scsiTerminated | -7912 | Parameter block request terminated by the host |
scsiBDRsent | -7913 | A SCSI bus device reset (BDR) message was sent to the target |
scsiWrongDirection | -7915 | Data phase was in an unexpected direction |
scsiSequenceFail | -7916 | Target bus phase sequence failure |
scsiUnexpectedBusFree | -7917 | Unexpected bus free phase |
scsiDataRunError | -7918 | Data overrun/underrun error |
scsiAutosenseFailed | -7920 | Automatic REQUEST SENSE command failed |
scsiParityError | -7921 | An uncorrectable parity error occurred |
scsiSCSIBusReset | -7922 | Execution of this parameter block was halted because of a SCSI bus reset |
scsiMessageRejectReceived | -7923 | REJECT message received |
scsiIdentifyMessageRejected | -7924 | The target issued a REJECT message in response to the IDENTIFY message; the LUN probably does not exist |
scsiCommandTimeout | -7925 | The timeout value for this parameter block was exceeded and the parameter block was aborted |
scsiSelectTimeout | -7926 | Target selection timeout |
scsiUnableToTerminate | -7927 | Unable to terminate I/O parameter block request |
scsiNonZeroStatus | -7932 | The target returned non-zero status upon completion of the request |
scsiUnableToAbort | -7933 | Unable to abort parameter block request |
scsiRequestAborted | -7934 | Parameter block request aborted by the host |