SCSI.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:79k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       SCSI.h
  3.  
  4.      Contains:   SCSI Family Interfaces.
  5.  
  6.      Version:    Technology: SCSI 4.3
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1986-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __SCSI__
  18. #define __SCSI__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. /* SCSI Manager errors. These are generated by Inside Mac IV calls only. */
  42. enum {
  43.     scCommErr                   = 2,                            /* communications error, operation timeout */
  44.     scArbNBErr                  = 3,                            /* arbitration timeout waiting for not BSY */
  45.     scBadParmsErr               = 4,                            /* bad parameter or TIB opcode */
  46.     scPhaseErr                  = 5,                            /* SCSI bus not in correct phase for attempted operation */
  47.     scCompareErr                = 6,                            /* data compare error */
  48.     scMgrBusyErr                = 7,                            /* SCSI Manager busy  */
  49.     scSequenceErr               = 8,                            /* attempted operation is out of sequence */
  50.     scBusTOErr                  = 9,                            /* CPU bus timeout */
  51.     scComplPhaseErr             = 10                            /* SCSI bus wasn't in Status phase */
  52. };
  53. /* TIB opcodes */
  54. enum {
  55.     scInc                       = 1,
  56.     scNoInc                     = 2,
  57.     scAdd                       = 3,
  58.     scMove                      = 4,
  59.     scLoop                      = 5,
  60.     scNop                       = 6,
  61.     scStop                      = 7,
  62.     scComp                      = 8
  63. };
  64. /* Signatures */
  65. enum {
  66.     sbSIGWord                   = 0x4552,                       /* signature word for Block 0 ('ER') */
  67.     sbMac                       = 1,                            /* system type for Mac */
  68.     pMapSIG                     = 0x504D,                       /* partition map signature ('PM') */
  69.     pdSigWord                   = 0x5453
  70. };
  71. enum {
  72.     oldPMSigWord                = pdSigWord,
  73.     newPMSigWord                = pMapSIG
  74. };
  75. /* Driver Descriptor Map */
  76. struct Block0 {
  77.     unsigned short                  sbSig;                      /* unique value for SCSI block 0 */
  78.     unsigned short                  sbBlkSize;                  /* block size of device */
  79.     unsigned long                   sbBlkCount;                 /* number of blocks on device */
  80.     unsigned short                  sbDevType;                  /* device type */
  81.     unsigned short                  sbDevId;                    /* device id */
  82.     unsigned long                   sbData;                     /* not used */
  83.     unsigned short                  sbDrvrCount;                /* driver descriptor count */
  84.     unsigned long                   ddBlock;                    /* 1st driver's starting block */
  85.     unsigned short                  ddSize;                     /* size of 1st driver (512-byte blks) */
  86.     unsigned short                  ddType;                     /* system type (1 for Mac+) */
  87.     unsigned short                  ddPad[243];                 /* ARRAY[0..242] OF INTEGER; not used */
  88. };
  89. typedef struct Block0                   Block0;
  90. /* Driver descriptor */
  91. struct DDMap {
  92.     unsigned long                   ddBlock;                    /* 1st driver's starting block */
  93.     unsigned short                  ddSize;                     /* size of 1st driver (512-byte blks) */
  94.     unsigned short                  ddType;                     /* system type (1 for Mac+) */
  95. };
  96. typedef struct DDMap                    DDMap;
  97. /* Partition Map Entry */
  98. struct Partition {
  99.     unsigned short                  pmSig;                      /* unique value for map entry blk */
  100.     unsigned short                  pmSigPad;                   /* currently unused */
  101.     unsigned long                   pmMapBlkCnt;                /* # of blks in partition map */
  102.     unsigned long                   pmPyPartStart;              /* physical start blk of partition */
  103.     unsigned long                   pmPartBlkCnt;               /* # of blks in this partition */
  104.     unsigned char                   pmPartName[32];             /* ASCII partition name */
  105.     unsigned char                   pmParType[32];              /* ASCII partition type */
  106.     unsigned long                   pmLgDataStart;              /* log. # of partition's 1st data blk */
  107.     unsigned long                   pmDataCnt;                  /* # of blks in partition's data area */
  108.     unsigned long                   pmPartStatus;               /* bit field for partition status */
  109.     unsigned long                   pmLgBootStart;              /* log. blk of partition's boot code */
  110.     unsigned long                   pmBootSize;                 /* number of bytes in boot code */
  111.     unsigned long                   pmBootAddr;                 /* memory load address of boot code */
  112.     unsigned long                   pmBootAddr2;                /* currently unused */
  113.     unsigned long                   pmBootEntry;                /* entry point of boot code */
  114.     unsigned long                   pmBootEntry2;               /* currently unused */
  115.     unsigned long                   pmBootCksum;                /* checksum of boot code */
  116.     unsigned char                   pmProcessor[16];            /* ASCII for the processor type */
  117.     unsigned short                  pmPad[188];                 /* ARRAY[0..187] OF INTEGER; not used */
  118. };
  119. typedef struct Partition                Partition;
  120. /* TIB instruction */
  121. struct SCSIInstr {
  122.     unsigned short                  scOpcode;
  123.     long                            scParam1;
  124.     long                            scParam2;
  125. };
  126. typedef struct SCSIInstr                SCSIInstr;
  127. /* SCSI Phases (used by SIMs to support the Original SCSI Manager */
  128. enum {
  129.     kDataOutPhase               = 0,                            /* Encoded MSG, C/D, I/O bits */
  130.     kDataInPhase                = 1,
  131.     kCommandPhase               = 2,
  132.     kStatusPhase                = 3,
  133.     kPhaseIllegal0              = 4,
  134.     kPhaseIllegal1              = 5,
  135.     kMessageOutPhase            = 6,
  136.     kMessageInPhase             = 7,
  137.     kBusFreePhase               = 8,                            /* Additional Phases */
  138.     kArbitratePhase             = 9,
  139.     kSelectPhase                = 10,
  140.     kMessageInPhaseNACK         = 11                            /* Message In Phase with ACK hanging on the bus */
  141. };
  142. #if CALL_NOT_IN_CARBON
  143. EXTERN_API( OSErr )
  144. SCSIReset                       (void)                                                      TWOWORDINLINE(0x4267, 0xA815);
  145. EXTERN_API( OSErr )
  146. SCSIGet                         (void)                                                      THREEWORDINLINE(0x3F3C, 0x0001, 0xA815);
  147. EXTERN_API( OSErr )
  148. SCSISelect                      (short                  targetID)                           THREEWORDINLINE(0x3F3C, 0x0002, 0xA815);
  149. EXTERN_API( OSErr )
  150. SCSICmd                         (Ptr                    buffer,
  151.                                  short                  count)                              THREEWORDINLINE(0x3F3C, 0x0003, 0xA815);
  152. EXTERN_API( OSErr )
  153. SCSIRead                        (Ptr                    tibPtr)                             THREEWORDINLINE(0x3F3C, 0x0005, 0xA815);
  154. EXTERN_API( OSErr )
  155. SCSIRBlind                      (Ptr                    tibPtr)                             THREEWORDINLINE(0x3F3C, 0x0008, 0xA815);
  156. EXTERN_API( OSErr )
  157. SCSIWrite                       (Ptr                    tibPtr)                             THREEWORDINLINE(0x3F3C, 0x0006, 0xA815);
  158. EXTERN_API( OSErr )
  159. SCSIWBlind                      (Ptr                    tibPtr)                             THREEWORDINLINE(0x3F3C, 0x0009, 0xA815);
  160. EXTERN_API( OSErr )
  161. SCSIComplete                    (short *                stat,
  162.                                  short *                message,
  163.                                  unsigned long          wait)                               THREEWORDINLINE(0x3F3C, 0x0004, 0xA815);
  164. EXTERN_API( short )
  165. SCSIStat                        (void)                                                      THREEWORDINLINE(0x3F3C, 0x000A, 0xA815);
  166. EXTERN_API( OSErr )
  167. SCSISelAtn                      (short                  targetID)                           THREEWORDINLINE(0x3F3C, 0x000B, 0xA815);
  168. EXTERN_API( OSErr )
  169. SCSIMsgIn                       (short *                message)                            THREEWORDINLINE(0x3F3C, 0x000C, 0xA815);
  170. EXTERN_API( OSErr )
  171. SCSIMsgOut                      (short                  message)                            THREEWORDINLINE(0x3F3C, 0x000D, 0xA815);
  172. #endif  /* CALL_NOT_IN_CARBON */
  173. enum {
  174.     scsiVERSION                 = 43
  175. };
  176. /*
  177.  * SCSI Callback Procedure Prototypes. Several of these are only callable
  178.  * from SCSI Manager 4.3 SIM and XPT contexts. 
  179.  */
  180. typedef CALLBACK_API_C( void , AENCallbackProcPtr )(void );
  181. typedef CALLBACK_API_C( OSErr , SIMInitProcPtr )(Ptr SIMinfoPtr);
  182. typedef CALLBACK_API_C( void , SIMActionProcPtr )(void *scsiPB, Ptr SIMGlobals);
  183. typedef CALLBACK_API_C( void , SCSIProcPtr )(void );
  184. typedef CALLBACK_API_C( void , SCSIMakeCallbackProcPtr )(void *scsiPB);
  185. /* SCSIInterruptPollProcPtr is obsolete (use SCSIInterruptProcPtr) but still here for compatibility */
  186. typedef CALLBACK_API_C( long , SCSIInterruptPollProcPtr )(Ptr SIMGlobals);
  187. typedef CALLBACK_API_C( long , SCSIInterruptProcPtr )(Ptr SIMGlobals);
  188. typedef STACK_UPP_TYPE(AENCallbackProcPtr)                      AENCallbackUPP;
  189. typedef STACK_UPP_TYPE(SIMInitProcPtr)                          SIMInitUPP;
  190. typedef STACK_UPP_TYPE(SIMActionProcPtr)                        SIMActionUPP;
  191. typedef STACK_UPP_TYPE(SCSIProcPtr)                             SCSIUPP;
  192. typedef STACK_UPP_TYPE(SCSIMakeCallbackProcPtr)                 SCSIMakeCallbackUPP;
  193. typedef STACK_UPP_TYPE(SCSIInterruptPollProcPtr)                SCSIInterruptPollUPP;
  194. typedef STACK_UPP_TYPE(SCSIInterruptProcPtr)                    SCSIInterruptUPP;
  195. typedef CALLBACK_API( void , SCSICallbackProcPtr )(void *scsiPB);
  196. typedef STACK_UPP_TYPE(SCSICallbackProcPtr)                     SCSICallbackUPP;
  197. #if OPAQUE_UPP_TYPES
  198. #if CALL_NOT_IN_CARBON
  199.     EXTERN_API(AENCallbackUPP)
  200.     NewAENCallbackUPP              (AENCallbackProcPtr      userRoutine);
  201.     EXTERN_API(SIMInitUPP)
  202.     NewSIMInitUPP                  (SIMInitProcPtr          userRoutine);
  203.     EXTERN_API(SIMActionUPP)
  204.     NewSIMActionUPP                (SIMActionProcPtr        userRoutine);
  205.     EXTERN_API(SCSIUPP)
  206.     NewSCSIUPP                     (SCSIProcPtr             userRoutine);
  207.     EXTERN_API(SCSIMakeCallbackUPP)
  208.     NewSCSIMakeCallbackUPP         (SCSIMakeCallbackProcPtr userRoutine);
  209.     EXTERN_API(SCSIInterruptPollUPP)
  210.     NewSCSIInterruptPollUPP        (SCSIInterruptPollProcPtr userRoutine);
  211.     EXTERN_API(SCSIInterruptUPP)
  212.     NewSCSIInterruptUPP            (SCSIInterruptProcPtr    userRoutine);
  213.     EXTERN_API(SCSICallbackUPP)
  214.     NewSCSICallbackUPP             (SCSICallbackProcPtr     userRoutine);
  215.     EXTERN_API(void)
  216.     DisposeAENCallbackUPP          (AENCallbackUPP          userUPP);
  217.     EXTERN_API(void)
  218.     DisposeSIMInitUPP              (SIMInitUPP              userUPP);
  219.     EXTERN_API(void)
  220.     DisposeSIMActionUPP            (SIMActionUPP            userUPP);
  221.     EXTERN_API(void)
  222.     DisposeSCSIUPP                 (SCSIUPP                 userUPP);
  223.     EXTERN_API(void)
  224.     DisposeSCSIMakeCallbackUPP     (SCSIMakeCallbackUPP     userUPP);
  225.     EXTERN_API(void)
  226.     DisposeSCSIInterruptPollUPP    (SCSIInterruptPollUPP    userUPP);
  227.     EXTERN_API(void)
  228.     DisposeSCSIInterruptUPP        (SCSIInterruptUPP        userUPP);
  229.     EXTERN_API(void)
  230.     DisposeSCSICallbackUPP         (SCSICallbackUPP         userUPP);
  231.     EXTERN_API(void)
  232.     InvokeAENCallbackUPP           (AENCallbackUPP          userUPP);
  233.     EXTERN_API(OSErr)
  234.     InvokeSIMInitUPP               (Ptr                     SIMinfoPtr,
  235.                                     SIMInitUPP              userUPP);
  236.     EXTERN_API(void)
  237.     InvokeSIMActionUPP             (void *                  scsiPB,
  238.                                     Ptr                     SIMGlobals,
  239.                                     SIMActionUPP            userUPP);
  240.     EXTERN_API(void)
  241.     InvokeSCSIUPP                  (SCSIUPP                 userUPP);
  242.     EXTERN_API(void)
  243.     InvokeSCSIMakeCallbackUPP      (void *                  scsiPB,
  244.                                     SCSIMakeCallbackUPP     userUPP);
  245.     EXTERN_API(long)
  246.     InvokeSCSIInterruptPollUPP     (Ptr                     SIMGlobals,
  247.                                     SCSIInterruptPollUPP    userUPP);
  248.     EXTERN_API(long)
  249.     InvokeSCSIInterruptUPP         (Ptr                     SIMGlobals,
  250.                                     SCSIInterruptUPP        userUPP);
  251.     EXTERN_API(void)
  252.     InvokeSCSICallbackUPP          (void *                  scsiPB,
  253.                                     SCSICallbackUPP         userUPP);
  254. #endif  /* CALL_NOT_IN_CARBON */
  255. #else
  256.     enum { uppAENCallbackProcInfo = 0x00000001 };                   /* no_return_value Func() */
  257.     enum { uppSIMInitProcInfo = 0x000000E1 };                       /* 2_bytes Func(4_bytes) */
  258.     enum { uppSIMActionProcInfo = 0x000003C1 };                     /* no_return_value Func(4_bytes, 4_bytes) */
  259.     enum { uppSCSIProcInfo = 0x00000001 };                          /* no_return_value Func() */
  260.     enum { uppSCSIMakeCallbackProcInfo = 0x000000C1 };              /* no_return_value Func(4_bytes) */
  261.     enum { uppSCSIInterruptPollProcInfo = 0x000000F1 };             /* 4_bytes Func(4_bytes) */
  262.     enum { uppSCSIInterruptProcInfo = 0x000000F1 };                 /* 4_bytes Func(4_bytes) */
  263.     enum { uppSCSICallbackProcInfo = 0x000000C0 };                  /* pascal no_return_value Func(4_bytes) */
  264.     #define NewAENCallbackUPP(userRoutine)                          (AENCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAENCallbackProcInfo, GetCurrentArchitecture())
  265.     #define NewSIMInitUPP(userRoutine)                              (SIMInitUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMInitProcInfo, GetCurrentArchitecture())
  266.     #define NewSIMActionUPP(userRoutine)                            (SIMActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMActionProcInfo, GetCurrentArchitecture())
  267.     #define NewSCSIUPP(userRoutine)                                 (SCSIUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIProcInfo, GetCurrentArchitecture())
  268.     #define NewSCSIMakeCallbackUPP(userRoutine)                     (SCSIMakeCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIMakeCallbackProcInfo, GetCurrentArchitecture())
  269.     #define NewSCSIInterruptPollUPP(userRoutine)                    (SCSIInterruptPollUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptPollProcInfo, GetCurrentArchitecture())
  270.     #define NewSCSIInterruptUPP(userRoutine)                        (SCSIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptProcInfo, GetCurrentArchitecture())
  271.     #define NewSCSICallbackUPP(userRoutine)                         (SCSICallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSICallbackProcInfo, GetCurrentArchitecture())
  272.     #define DisposeAENCallbackUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  273.     #define DisposeSIMInitUPP(userUPP)                              DisposeRoutineDescriptor(userUPP)
  274.     #define DisposeSIMActionUPP(userUPP)                            DisposeRoutineDescriptor(userUPP)
  275.     #define DisposeSCSIUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  276.     #define DisposeSCSIMakeCallbackUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  277.     #define DisposeSCSIInterruptPollUPP(userUPP)                    DisposeRoutineDescriptor(userUPP)
  278.     #define DisposeSCSIInterruptUPP(userUPP)                        DisposeRoutineDescriptor(userUPP)
  279.     #define DisposeSCSICallbackUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  280.     #define InvokeAENCallbackUPP(userUPP)                           CALL_ZERO_PARAMETER_UPP((userUPP), uppAENCallbackProcInfo)
  281.     #define InvokeSIMInitUPP(SIMinfoPtr, userUPP)                   (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppSIMInitProcInfo, (SIMinfoPtr))
  282.     #define InvokeSIMActionUPP(scsiPB, SIMGlobals, userUPP)         CALL_TWO_PARAMETER_UPP((userUPP), uppSIMActionProcInfo, (scsiPB), (SIMGlobals))
  283.     #define InvokeSCSIUPP(userUPP)                                  CALL_ZERO_PARAMETER_UPP((userUPP), uppSCSIProcInfo)
  284.     #define InvokeSCSIMakeCallbackUPP(scsiPB, userUPP)              CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIMakeCallbackProcInfo, (scsiPB))
  285.     #define InvokeSCSIInterruptPollUPP(SIMGlobals, userUPP)         (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptPollProcInfo, (SIMGlobals))
  286.     #define InvokeSCSIInterruptUPP(SIMGlobals, userUPP)             (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptProcInfo, (SIMGlobals))
  287.     #define InvokeSCSICallbackUPP(scsiPB, userUPP)                  CALL_ONE_PARAMETER_UPP((userUPP), uppSCSICallbackProcInfo, (scsiPB))
  288. #endif
  289. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  290. #define NewAENCallbackProc(userRoutine)                         NewAENCallbackUPP(userRoutine)
  291. #define NewSIMInitProc(userRoutine)                             NewSIMInitUPP(userRoutine)
  292. #define NewSIMActionProc(userRoutine)                           NewSIMActionUPP(userRoutine)
  293. #define NewSCSIProc(userRoutine)                                NewSCSIUPP(userRoutine)
  294. #define NewSCSIMakeCallbackProc(userRoutine)                    NewSCSIMakeCallbackUPP(userRoutine)
  295. #define NewSCSIInterruptPollProc(userRoutine)                   NewSCSIInterruptPollUPP(userRoutine)
  296. #define NewSCSIInterruptProc(userRoutine)                       NewSCSIInterruptUPP(userRoutine)
  297. #define NewSCSICallbackProc(userRoutine)                        NewSCSICallbackUPP(userRoutine)
  298. #define CallAENCallbackProc(userRoutine)                        InvokeAENCallbackUPP(userRoutine)
  299. #define CallSIMInitProc(userRoutine, SIMinfoPtr)                InvokeSIMInitUPP(SIMinfoPtr, userRoutine)
  300. #define CallSIMActionProc(userRoutine, scsiPB, SIMGlobals)      InvokeSIMActionUPP(scsiPB, SIMGlobals, userRoutine)
  301. #define CallSCSIProc(userRoutine)                               InvokeSCSIUPP(userRoutine)
  302. #define CallSCSIMakeCallbackProc(userRoutine, scsiPB)           InvokeSCSIMakeCallbackUPP(scsiPB, userRoutine)
  303. #define CallSCSIInterruptPollProc(userRoutine, SIMGlobals)      InvokeSCSIInterruptPollUPP(SIMGlobals, userRoutine)
  304. #define CallSCSIInterruptProc(userRoutine, SIMGlobals)          InvokeSCSIInterruptUPP(SIMGlobals, userRoutine)
  305. #define CallSCSICallbackProc(userRoutine, scsiPB)               InvokeSCSICallbackUPP(scsiPB, userRoutine)
  306. /* SCSI Manager 4.3 function codes */
  307. enum {
  308.     SCSINop                     = 0x00,                         /* Execute nothing                          */
  309.     SCSIExecIO                  = 0x01,                         /* Execute the specified IO                  */
  310.     SCSIBusInquiry              = 0x03,                         /* Get parameters for entire path of HBAs           */
  311.     SCSIReleaseQ                = 0x04,                         /* Release the frozen SIM queue for particular LUN      */
  312.     SCSIAbortCommand            = 0x10,                         /* Abort the selected Control Block             */
  313.     SCSIResetBus                = 0x11,                         /* Reset the SCSI bus                         */
  314.     SCSIResetDevice             = 0x12,                         /* Reset the SCSI device                      */
  315.     SCSITerminateIO             = 0x13,                         /* Terminate any pending IO                    */
  316.     SCSIGetVirtualIDInfo        = 0x80,                         /* Find out which bus old ID is on                */
  317.     SCSILoadDriver              = 0x82,                         /* Load a driver for a device ident             */
  318.     SCSIOldCall                 = 0x84,                         /* XPT->SIM private call for old-API            */
  319.     SCSICreateRefNumXref        = 0x85,                         /* Register a DeviceIdent to drvr RefNum xref          */
  320.     SCSILookupRefNumXref        = 0x86,                         /* Get DeviceIdent to drvr RefNum xref              */
  321.     SCSIRemoveRefNumXref        = 0x87,                         /* Remove a DeviceIdent to drvr RefNum xref        */
  322.     SCSIRegisterWithNewXPT      = 0x88,                         /* XPT has changed - SIM needs to re-register itself  */
  323.     vendorUnique                = 0xC0                          /* 0xC0 thru 0xFF */
  324. };
  325. /* Allocation length defines for some of the fields */
  326. enum {
  327.     handshakeDataLength         = 8,                            /* Handshake data length */
  328.     maxCDBLength                = 16,                           /* Space for the CDB bytes/pointer */
  329.     vendorIDLength              = 16                            /* ASCII string len for Vendor ID  */
  330. };
  331. /* Define DeviceIdent structure */
  332. struct DeviceIdent {
  333.     UInt8                           diReserved;                 /* reserved           */
  334.     UInt8                           bus;                        /* SCSI - Bus Number   */
  335.     UInt8                           targetID;                   /* SCSI - Target SCSI ID  */
  336.     UInt8                           LUN;                        /* SCSI - LUN            */
  337. };
  338. typedef struct DeviceIdent              DeviceIdent;
  339. /* Command Descriptor Block structure */
  340. union CDB {
  341.     BytePtr                         cdbPtr;                     /* pointer to the CDB, or */
  342.     UInt8                           cdbBytes[16];               /* the actual CDB to send */
  343. };
  344. typedef union CDB                       CDB;
  345. typedef CDB *                           CDBPtr;
  346. /* Scatter/gather list element (Deprecated for MacOS8) */
  347. struct SGRecord {
  348.     Ptr                             SGAddr;
  349.     UInt32                          SGCount;
  350. };
  351. typedef struct SGRecord                 SGRecord;
  352. #define SCSIPBHdr                      
  353.   struct SCSIHdr* qLink;              
  354.   short           scsiReserved1;      
  355.   UInt16          scsiPBLength;       
  356.   UInt8           scsiFunctionCode;   
  357.   UInt8           scsiReserved2;      
  358.   volatile OSErr  scsiResult;         
  359.   DeviceIdent     scsiDevice;         
  360.   SCSICallbackUPP scsiCompletion;     
  361.   UInt32          scsiFlags;          
  362.   UInt8 *         scsiDriverStorage;  
  363.   Ptr             scsiXPTprivate;     
  364.   long            scsiReserved3;
  365. struct SCSIHdr {
  366.     struct SCSIHdr *                qLink;                      /* (internal use, must be nil on entry)   */
  367.     short                           scsiReserved1;              /* ->     reserved for input          */
  368.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  369.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  370.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  371.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  372.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  373.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  374.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  375.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  376.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  377.     long                            scsiReserved3;              /* reserved                    */
  378. };
  379. typedef struct SCSIHdr                  SCSIHdr;
  380. struct SCSI_PB {
  381.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  382.     short                           scsiReserved1;              /* ->     reserved for input          */
  383.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  384.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  385.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  386.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  387.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  388.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  389.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  390.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  391.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  392.     long                            scsiReserved3;              /* reserved                    */
  393. };
  394. typedef struct SCSI_PB                  SCSI_PB;
  395. struct SCSI_IO {
  396.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  397.     short                           scsiReserved1;              /* ->     reserved for input          */
  398.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  399.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  400.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  401.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  402.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  403.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  404.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  405.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  406.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  407.     long                            scsiReserved3;              /* reserved                    */
  408.     UInt16                          scsiResultFlags;            /* <- Flags which modify the scsiResult field     */
  409.     UInt16                          scsiReserved3pt5;           /* -> Reserved                           */
  410.     BytePtr                         scsiDataPtr;                /* -> Pointer to the data buffer or the S/G list      */
  411.     UInt32                          scsiDataLength;             /* -> Data transfer length                   */
  412.     BytePtr                         scsiSensePtr;               /* -> Ptr to autosense data buffer            */
  413.     UInt8                           scsiSenseLength;            /* -> size of the autosense buffer              */
  414.     UInt8                           scsiCDBLength;              /* -> Number of bytes for the CDB               */
  415.     UInt16                          scsiSGListCount;            /* -> num of scatter gather list entries           */
  416.     UInt32                          scsiReserved4;              /* <-     reserved for output                   */
  417.     UInt8                           scsiSCSIstatus;             /* <- Returned scsi device status               */
  418.     SInt8                           scsiSenseResidual;          /* <- Autosense residual length             */
  419.     UInt16                          scsiReserved5;              /* <-     reserved for output                 */
  420.     long                            scsiDataResidual;           /* <- Returned Transfer residual length          */
  421.     CDB                             scsiCDB;                    /* -> Actual CDB or pointer to CDB            */
  422.     long                            scsiTimeout;                /* -> Timeout value (Time Mgr format) (CAM timeout) */
  423.     BytePtr                         scsiReserved5pt5;           /* -> Reserved                           */
  424.     UInt16                          scsiReserved5pt6;           /* -> Reserved                           */
  425.     UInt16                          scsiIOFlags;                /* -> additional I/O flags                      */
  426.     UInt8                           scsiTagAction;              /* -> What to do for tag queuing                */
  427.     UInt8                           scsiReserved6;              /* ->     reserved for input                   */
  428.     UInt16                          scsiReserved7;              /* ->     reserved for input                   */
  429.     UInt16                          scsiSelectTimeout;          /* -> Select timeout value                 */
  430.     UInt8                           scsiDataType;               /* -> Data description type (i.e. buffer, TIB, S/G)   */
  431.     UInt8                           scsiTransferType;           /* -> Transfer type (i.e. Blind vs Polled)       */
  432.     UInt32                          scsiReserved8;              /* ->     reserved for input                  */
  433.     UInt32                          scsiReserved9;              /* ->     reserved for input                  */
  434.     UInt16                          scsiHandshake[8];           /* -> handshaking points (null term'd)    */
  435.     UInt32                          scsiReserved10;             /* ->     reserved for input                  */
  436.     UInt32                          scsiReserved11;             /* ->   reserved for input                   */
  437.     struct SCSI_IO *                scsiCommandLink;            /* -> Ptr to the next PB in linked cmd chain      */
  438.     UInt8                           scsiSIMpublics[8];          /* ->     reserved for input to 3rd-party SIMs     */
  439.     UInt8                           scsiAppleReserved6[8];      /* -> reserved for input                     */
  440.                                                                 /* XPT layer privates (for old-API emulation) */
  441.     UInt16                          scsiCurrentPhase;           /* <- phase upon completing old call            */
  442.     short                           scsiSelector;               /* -> selector specified in old calls            */
  443.     OSErr                           scsiOldCallResult;          /* <- result of old call                     */
  444.     UInt8                           scsiSCSImessage;            /* <- Returned scsi device message (for SCSIComplete)*/
  445.     UInt8                           XPTprivateFlags;            /* <> various flags                       */
  446.     UInt8                           XPTextras[12];              /*                              */
  447. };
  448. typedef struct SCSI_IO                  SCSI_IO;
  449. typedef SCSI_IO                         SCSIExecIOPB;
  450. /* Bus inquiry PB */
  451. struct SCSIBusInquiryPB {
  452.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  453.     short                           scsiReserved1;              /* ->     reserved for input          */
  454.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  455.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  456.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  457.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  458.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  459.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  460.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  461.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  462.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  463.     long                            scsiReserved3;              /* reserved                    */
  464.     UInt16                          scsiEngineCount;            /* <- Number of engines on HBA                */
  465.     UInt16                          scsiMaxTransferType;        /* <- Number of transfer types for this HBA      */
  466.     UInt32                          scsiDataTypes;              /* <- which data types are supported by this SIM  */
  467.     UInt16                          scsiIOpbSize;               /* <- Size of SCSI_IO PB for this SIM/HBA          */
  468.     UInt16                          scsiMaxIOpbSize;            /* <- Size of max SCSI_IO PB for all SIM/HBAs        */
  469.     UInt32                          scsiFeatureFlags;           /* <- Supported features flags field           */
  470.     UInt8                           scsiVersionNumber;          /* <- Version number for the SIM/HBA           */
  471.     UInt8                           scsiHBAInquiry;             /* <- Mimic of INQ byte 7 for the HBA           */
  472.     UInt8                           scsiTargetModeFlags;        /* <- Flags for target mode support           */
  473.     UInt8                           scsiScanFlags;              /* <- Scan related feature flags            */
  474.     UInt32                          scsiSIMPrivatesPtr;         /* <- Ptr to SIM private data area              */
  475.     UInt32                          scsiSIMPrivatesSize;        /* <- Size of SIM private data area           */
  476.     UInt32                          scsiAsyncFlags;             /* <- Event cap. for Async Callback           */
  477.     UInt8                           scsiHiBusID;                /* <- Highest path ID in the subsystem         */
  478.     UInt8                           scsiInitiatorID;            /* <- ID of the HBA on the SCSI bus           */
  479.     UInt16                          scsiBIReserved0;            /*                                  */
  480.     UInt32                          scsiBIReserved1;            /* <-                                */
  481.     UInt32                          scsiFlagsSupported;         /* <- which scsiFlags are supported           */
  482.     UInt16                          scsiIOFlagsSupported;       /* <- which scsiIOFlags are supported           */
  483.     UInt16                          scsiWeirdStuff;             /* <-                               */
  484.     UInt16                          scsiMaxTarget;              /* <- maximum Target number supported           */
  485.     UInt16                          scsiMaxLUN;                 /* <- maximum Logical Unit number supported    */
  486.     char                            scsiSIMVendor[16];          /* <- Vendor ID of SIM (or XPT if bus<FF)        */
  487.     char                            scsiHBAVendor[16];          /* <- Vendor ID of the HBA                */
  488.     char                            scsiControllerFamily[16];   /* <- Family of SCSI Controller           */
  489.     char                            scsiControllerType[16];     /* <- Specific Model of SCSI Controller used  */
  490.     char                            scsiXPTversion[4];          /* <- version number of XPT              */
  491.     char                            scsiSIMversion[4];          /* <- version number of SIM              */
  492.     char                            scsiHBAversion[4];          /* <- version number of HBA              */
  493.     UInt8                           scsiHBAslotType;            /* <- type of "slot" that this HBA is in       */
  494.     UInt8                           scsiHBAslotNumber;          /* <- slot number of this HBA                  */
  495.     UInt16                          scsiSIMsRsrcID;             /* <- resource ID of this SIM                  */
  496.     UInt16                          scsiBIReserved3;            /* <-                               */
  497.     UInt16                          scsiAdditionalLength;       /* <- additional BusInquiry PB len              */
  498. };
  499. typedef struct SCSIBusInquiryPB         SCSIBusInquiryPB;
  500. /* Abort SIM Request PB */
  501. struct SCSIAbortCommandPB {
  502.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  503.     short                           scsiReserved1;              /* ->     reserved for input          */
  504.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  505.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  506.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  507.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  508.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  509.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  510.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  511.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  512.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  513.     long                            scsiReserved3;              /* reserved                    */
  514.     SCSI_IO *                       scsiIOptr;                  /* Pointer to the PB to abort        */
  515. };
  516. typedef struct SCSIAbortCommandPB       SCSIAbortCommandPB;
  517. /* Terminate I/O Process Request PB */
  518. struct SCSITerminateIOPB {
  519.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  520.     short                           scsiReserved1;              /* ->     reserved for input          */
  521.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  522.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  523.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  524.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  525.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  526.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  527.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  528.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  529.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  530.     long                            scsiReserved3;              /* reserved                    */
  531.     SCSI_IO *                       scsiIOptr;                  /* Pointer to the PB to terminate        */
  532. };
  533. typedef struct SCSITerminateIOPB        SCSITerminateIOPB;
  534. /* Reset SCSI Bus PB */
  535. struct SCSIResetBusPB {
  536.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  537.     short                           scsiReserved1;              /* ->     reserved for input          */
  538.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  539.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  540.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  541.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  542.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  543.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  544.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  545.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  546.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  547.     long                            scsiReserved3;              /* reserved                    */
  548. };
  549. typedef struct SCSIResetBusPB           SCSIResetBusPB;
  550. /* Reset SCSI Device PB */
  551. struct SCSIResetDevicePB {
  552.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  553.     short                           scsiReserved1;              /* ->     reserved for input          */
  554.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  555.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  556.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  557.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  558.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  559.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  560.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  561.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  562.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  563.     long                            scsiReserved3;              /* reserved                    */
  564. };
  565. typedef struct SCSIResetDevicePB        SCSIResetDevicePB;
  566. /* Release SIM Queue PB */
  567. struct SCSIReleaseQPB {
  568.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  569.     short                           scsiReserved1;              /* ->     reserved for input          */
  570.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  571.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  572.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  573.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  574.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  575.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  576.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  577.     BytePtr                         scsiDriverStorage;          /* <> Ptr for driver private use   */
  578.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  579.     long                            scsiReserved3;              /* reserved                    */
  580. };
  581. typedef struct SCSIReleaseQPB           SCSIReleaseQPB;
  582. /* SCSI Get Virtual ID Info PB */
  583. struct SCSIGetVirtualIDInfoPB {
  584.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  585.     short                           scsiReserved1;              /* ->     reserved for input          */
  586.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  587.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  588.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  589.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  590.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  591.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  592.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  593.     Ptr                             scsiDriverStorage;          /* <> Ptr for driver private use   */
  594.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  595.     long                            scsiReserved3;              /* reserved                    */
  596.     UInt16                          scsiOldCallID;              /* -> SCSI ID of device in question   */
  597.     Boolean                         scsiExists;                 /* <- true if device exists        */
  598.     SInt8                           filler;
  599. };
  600. typedef struct SCSIGetVirtualIDInfoPB   SCSIGetVirtualIDInfoPB;
  601. /* Create/Lookup/Remove RefNum for Device PB */
  602. struct SCSIDriverPB {
  603.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  604.     short                           scsiReserved1;              /* ->     reserved for input          */
  605.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  606.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  607.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  608.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  609.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  610.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  611.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  612.     Ptr                             scsiDriverStorage;          /* <> Ptr for driver private use   */
  613.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  614.     long                            scsiReserved3;              /* reserved                    */
  615.     short                           scsiDriver;                 /* -> DriverRefNum, For SetDriver, <- For GetNextDriver */
  616.     UInt16                          scsiDriverFlags;            /* <> Details of driver/device       */
  617.     DeviceIdent                     scsiNextDevice;             /* <- DeviceIdent of the NEXT Item in the list  */
  618. };
  619. typedef struct SCSIDriverPB             SCSIDriverPB;
  620. /* Load Driver PB */
  621. struct SCSILoadDriverPB {
  622.     SCSIHdr *                       qLink;                      /* (internal use, must be nil on entry)   */
  623.     short                           scsiReserved1;              /* ->     reserved for input          */
  624.     UInt16                          scsiPBLength;               /* -> Length of the entire PB        */
  625.     UInt8                           scsiFunctionCode;           /* -> function selector           */
  626.     UInt8                           scsiReserved2;              /* <-     reserved for output          */
  627.     volatile OSErr                  scsiResult;                 /* <- Returned result               */
  628.     DeviceIdent                     scsiDevice;                 /* -> Device Identifier (bus+target+lun)*/
  629.     SCSICallbackUPP                 scsiCompletion;             /* -> Callback on completion function     */
  630.     UInt32                          scsiFlags;                  /* -> assorted flags            */
  631.     Ptr                             scsiDriverStorage;          /* <> Ptr for driver private use   */
  632.     Ptr                             scsiXPTprivate;             /* private field for use in XPT      */
  633.     long                            scsiReserved3;              /* reserved                    */
  634.     short                           scsiLoadedRefNum;           /* <- SIM returns refnum of driver      */
  635.     Boolean                         scsiDiskLoadFailed;         /* -> if true, indicates call after failure to load */
  636.     SInt8                           filler;
  637. };
  638. typedef struct SCSILoadDriverPB         SCSILoadDriverPB;
  639. /* Defines for the scsiTransferType field */
  640. enum {
  641.     scsiTransferBlind           = 0,
  642.     scsiTransferPolled          = 1
  643. };
  644. enum {
  645.     scsiErrorBase               = -7936
  646. };
  647. enum {
  648.     scsiRequestInProgress       = 1,                            /* 1   = PB request is in progress          */
  649.                                                                 /* Execution failed  00-2F */
  650.     scsiRequestAborted          = scsiErrorBase + 2,            /* -7934 = PB request aborted by the host        */
  651.     scsiUnableToAbort           = scsiErrorBase + 3,            /* -7933 = Unable to Abort PB request          */
  652.     scsiNonZeroStatus           = scsiErrorBase + 4,            /* -7932 = PB request completed with an err   */
  653.     scsiUnused05                = scsiErrorBase + 5,            /* -7931 =                        */
  654.     scsiUnused06                = scsiErrorBase + 6,            /* -7930 =                        */
  655.     scsiUnused07                = scsiErrorBase + 7,            /* -7929 =                        */
  656.     scsiUnused08                = scsiErrorBase + 8,            /* -7928 =                        */
  657.     scsiUnableToTerminate       = scsiErrorBase + 9,            /* -7927 = Unable to Terminate I/O PB req        */
  658.     scsiSelectTimeout           = scsiErrorBase + 10,           /* -7926 = Target selection timeout        */
  659.     scsiCommandTimeout          = scsiErrorBase + 11,           /* -7925 = Command timeout              */
  660.     scsiIdentifyMessageRejected = scsiErrorBase + 12,           /* -7924 =                        */
  661.     scsiMessageRejectReceived   = scsiErrorBase + 13,           /* -7923 = Message reject received           */
  662.     scsiSCSIBusReset            = scsiErrorBase + 14,           /* -7922 = SCSI bus reset sent/received    */
  663.     scsiParityError             = scsiErrorBase + 15,           /* -7921 = Uncorrectable parity error occured     */
  664.     scsiAutosenseFailed         = scsiErrorBase + 16,           /* -7920 = Autosense: Request sense cmd fail  */
  665.     scsiUnused11                = scsiErrorBase + 17,           /* -7919 =                        */
  666.     scsiDataRunError            = scsiErrorBase + 18,           /* -7918 = Data overrun/underrun error     */
  667.     scsiUnexpectedBusFree       = scsiErrorBase + 19,           /* -7917 = Unexpected BUS free              */
  668.     scsiSequenceFailed          = scsiErrorBase + 20,           /* -7916 = Target bus phase sequence failure  */
  669.     scsiWrongDirection          = scsiErrorBase + 21,           /* -7915 = Data phase was in wrong direction  */
  670.     scsiUnused16                = scsiErrorBase + 22,           /* -7914 =                        */
  671.     scsiBDRsent                 = scsiErrorBase + 23,           /* -7913 = A SCSI BDR msg was sent to target  */
  672.     scsiTerminated              = scsiErrorBase + 24,           /* -7912 = PB request terminated by the host  */
  673.     scsiNoNexus                 = scsiErrorBase + 25,           /* -7911 = Nexus is not established        */
  674.     scsiCDBReceived             = scsiErrorBase + 26,           /* -7910 = The SCSI CDB has been received        */
  675.                                                                 /* Couldn't begin execution  30-3F */
  676.     scsiTooManyBuses            = scsiErrorBase + 48,           /* -7888 = Register failed because we're full */
  677.     scsiBusy                    = scsiErrorBase + 49,           /* -7887 = SCSI subsystem is busy           */
  678.     scsiProvideFail             = scsiErrorBase + 50,           /* -7886 = Unable to provide requ. capability */
  679.     scsiDeviceNotThere          = scsiErrorBase + 51,           /* -7885 = SCSI device not installed/there    */
  680.     scsiNoHBA                   = scsiErrorBase + 52,           /* -7884 = No HBA detected Error           */
  681.     scsiDeviceConflict          = scsiErrorBase + 53,           /* -7883 = sorry, max 1 refNum per DeviceIdent    */
  682.     scsiNoSuchXref              = scsiErrorBase + 54,           /* -7882 = no such RefNum xref              */
  683.     scsiQLinkInvalid            = scsiErrorBase + 55,           /* -7881 = pre-linked PBs not supported      */
  684.                                                                 /*   (The QLink field was nonzero)          */
  685.                                                                 /* Parameter errors  40-7F */
  686.     scsiPBLengthError           = scsiErrorBase + 64,           /* -7872 = (scsiPBLength is insuf'ct/invalid  */
  687.     scsiFunctionNotAvailable    = scsiErrorBase + 65,           /* -7871 = The requ. func is not available    */
  688.     scsiRequestInvalid          = scsiErrorBase + 66,           /* -7870 = PB request is invalid           */
  689.     scsiBusInvalid              = scsiErrorBase + 67,           /* -7869 = Bus ID supplied is invalid        */
  690.     scsiTIDInvalid              = scsiErrorBase + 68,           /* -7868 = Target ID supplied is invalid      */
  691.     scsiLUNInvalid              = scsiErrorBase + 69,           /* -7867 = LUN supplied is invalid         */
  692.     scsiIDInvalid               = scsiErrorBase + 70,           /* -7866 = The initiator ID is invalid     */
  693.     scsiDataTypeInvalid         = scsiErrorBase + 71,           /* -7865 = scsiDataType requested not supported */
  694.     scsiTransferTypeInvalid     = scsiErrorBase + 72,           /* -7864 = scsiTransferType field is too high     */
  695.     scsiCDBLengthInvalid        = scsiErrorBase + 73            /* -7863 = scsiCDBLength field is too big        */
  696. };
  697. /* New errors for SCSI Family         */
  698. enum {
  699.     scsiUnused74                = scsiErrorBase + 74,           /* -7862 =                          */
  700.     scsiUnused75                = scsiErrorBase + 75,           /* -7861 =                          */
  701.     scsiBadDataLength           = scsiErrorBase + 76,           /* -7860 = a zero data length in PB        */
  702.     scsiPartialPrepared         = scsiErrorBase + 77,           /* -7859 = could not do full prepare mem for I/O*/
  703.     scsiInvalidMsgType          = scsiErrorBase + 78,           /* -7858 = Invalid message type (internal)       */
  704.     scsiUnused79                = scsiErrorBase + 79,           /* -7857 =                              */
  705.     scsiBadConnID               = scsiErrorBase + 80,           /* -7856 = Bad Connection ID                */
  706.     scsiUnused81                = scsiErrorBase + 81,           /* -7855 =                          */
  707.     scsiIOInProgress            = scsiErrorBase + 82,           /* -7854 = Can't close conn, IO in prog      */
  708.     scsiTargetReserved          = scsiErrorBase + 83,           /* -7853 = Target already reserved          */
  709.     scsiUnused84                = scsiErrorBase + 84,           /* -7852 =                          */
  710.     scsiUnused85                = scsiErrorBase + 85,           /* -7851 =                          */
  711.     scsiBadConnType             = scsiErrorBase + 86,           /* -7850 = Bad connection type              */
  712.     scsiCannotLoadPlugin        = scsiErrorBase + 87            /* -7849 = No matching service category      */
  713. };
  714. /* +++ */
  715. /*
  716.  * scsiFamilyInternalError and scsiPluginInternalError are intended to handle consistency check failures.
  717.  * For example, if the family stores a record on a lookaside queue, but does not find that record
  718.  * it can use this error to report this failure. SCSI Manager 4.3 uses dsIOCoreErr in a few places,
  719.  * but this is probably not the best error. In general, internal errors should be reported as bugs.
  720.  *
  721.  * The following range of errors is provided for third-party (non-Apple) SCSI SIM and device driver vendors.
  722.  * In general, they would be used for error conditions that are not covered by the standardized errors.
  723.  * They should not normally be conveyed to normal applications, but might be used for communication between
  724.  * a plug-in and a vendor-provided device driver (for example, to manage RAID hot-swapping).
  725.  *
  726.  * Note: I don't know how many SCSI errors are reserved in the error code architecture. Don't assume that
  727.  * we'll actually get sixteen, but we should reserve at least one.
  728.  */
  729. enum {
  730.     scsiFamilyInternalError     = scsiErrorBase + 87,           /* -7849 = Internal consistency check failed  */
  731.     scsiPluginInternalError     = scsiErrorBase + 88,           /* -7848 = Internal consistency check failed  */
  732.     scsiVendorSpecificErrorBase = scsiErrorBase + 128,          /* ??    = Start of third-party error range     */
  733.     scsiVendorSpecificErrorCount = 16                           /* Number of third-party errors             */
  734. };
  735. /* --- */
  736. enum {
  737.     scsiExecutionErrors         = scsiErrorBase,
  738.     scsiNotExecutedErrors       = scsiTooManyBuses,
  739.     scsiParameterErrors         = scsiPBLengthError
  740. };
  741. /* Defines for the scsiResultFlags field */
  742. enum {
  743.     scsiSIMQFrozen              = 0x0001,                       /* The SIM queue is frozen w/this err        */
  744.     scsiAutosenseValid          = 0x0002,                       /* Autosense data valid for target         */
  745.     scsiBusNotFree              = 0x0004                        /* At time of callback, SCSI bus is not free  */
  746. };
  747. /* Defines for the bit numbers of the scsiFlags field in the PB header for the SCSIExecIO function */
  748. enum {
  749.     kbSCSIDisableAutosense      = 29,                           /* Disable auto sense feature               */
  750.     kbSCSIFlagReservedA         = 28,                           /*                             */
  751.     kbSCSIFlagReserved0         = 27,                           /*                             */
  752.     kbSCSICDBLinked             = 26,                           /* The PB contains a linked CDB             */
  753.     kbSCSIQEnable               = 25,                           /* Target queue actions are enabled          */
  754.     kbSCSICDBIsPointer          = 24,                           /* The CDB field contains a pointer          */
  755.     kbSCSIFlagReserved1         = 23,                           /*                               */
  756.     kbSCSIInitiateSyncData      = 22,                           /* Attempt Sync data xfer and SDTR          */
  757.     kbSCSIDisableSyncData       = 21,                           /* Disable sync, go to async            */
  758.     kbSCSISIMQHead              = 20,                           /* Place PB at the head of SIM Q          */
  759.     kbSCSISIMQFreeze            = 19,                           /* Return the SIM Q to frozen state          */
  760.     kbSCSISIMQNoFreeze          = 18,                           /* Disallow SIM Q freezing                 */
  761.     kbSCSIDoDisconnect          = 17,                           /* Definitely do disconnect               */
  762.     kbSCSIDontDisconnect        = 16,                           /* Definitely don't disconnect              */
  763.     kbSCSIDataReadyForDMA       = 15,                           /* Data buffer(s) are ready for DMA          */
  764.     kbSCSIFlagReserved3         = 14,                           /*                               */
  765.     kbSCSIDataPhysical          = 13,                           /* SG/Buffer data ptrs are physical          */
  766.     kbSCSISensePhysical         = 12,                           /* Autosense buffer ptr is physical          */
  767.     kbSCSIFlagReserved5         = 11,                           /*                               */
  768.     kbSCSIFlagReserved6         = 10,                           /*                               */
  769.     kbSCSIFlagReserved7         = 9,                            /*                               */
  770.     kbSCSIFlagReserved8         = 8,                            /*                               */
  771.     kbSCSIDataBufferValid       = 7,                            /* Data buffer valid                 */
  772.     kbSCSIStatusBufferValid     = 6,                            /* Status buffer valid                 */
  773.     kbSCSIMessageBufferValid    = 5,                            /* Message buffer valid                */
  774.     kbSCSIFlagReserved9         = 4                             /*                             */
  775. };
  776. /* Defines for the bit masks of the scsiFlags field */
  777. enum {
  778.     scsiDirectionMask           = (long)0xC0000000,             /* Data direction mask                 */
  779.     scsiDirectionNone           = (long)0xC0000000,             /* Data direction (11: no data)          */
  780.     scsiDirectionReserved       = 0x00000000,                   /* Data direction (00: reserved)       */
  781.     scsiDirectionOut            = (long)0x80000000,             /* Data direction (10: DATA OUT)       */
  782.     scsiDirectionIn             = 0x40000000,                   /* Data direction (01: DATA IN)          */
  783.     scsiDisableAutosense        = 0x20000000,                   /* Disable auto sense feature          */
  784.     scsiFlagReservedA           = 0x10000000,                   /*                           */
  785.     scsiFlagReserved0           = 0x08000000,                   /*                           */
  786.     scsiCDBLinked               = 0x04000000,                   /* The PB contains a linked CDB          */
  787.     scsiQEnable                 = 0x02000000,                   /* Target queue actions are enabled      */
  788.     scsiCDBIsPointer            = 0x01000000,                   /* The CDB field contains a pointer      */
  789.     scsiFlagReserved1           = 0x00800000,                   /*                           */
  790.     scsiInitiateSyncData        = 0x00400000,                   /* Attempt Sync data xfer and SDTR         */
  791.     scsiDisableSyncData         = 0x00200000,                   /* Disable sync, go to async          */
  792.     scsiSIMQHead                = 0x00100000,                   /* Place PB at the head of SIM Q       */
  793.     scsiSIMQFreeze              = 0x00080000,                   /* Return the SIM Q to frozen state      */
  794.     scsiSIMQNoFreeze            = 0x00040000,                   /* Disallow SIM Q freezing              */
  795.     scsiDoDisconnect            = 0x00020000,                   /* Definitely do disconnect             */
  796.     scsiDontDisconnect          = 0x00010000,                   /* Definitely don't disconnect          */
  797.     scsiDataReadyForDMA         = 0x00008000,                   /* Data buffer(s) are ready for DMA      */
  798.     scsiFlagReserved3           = 0x00004000,                   /*  */
  799.     scsiDataPhysical            = 0x00002000,                   /* SG/Buffer data ptrs are physical      */
  800.     scsiSensePhysical           = 0x00001000,                   /* Autosense buffer ptr is physical      */
  801.     scsiFlagReserved5           = 0x00000800,                   /*                         */
  802.     scsiFlagReserved6           = 0x00000400,                   /*                           */
  803.     scsiFlagReserved7           = 0x00000200,                   /*                           */
  804.     scsiFlagReserved8           = 0x00000100                    /*                           */
  805. };
  806. /* bit masks for the scsiIOFlags field in SCSIExecIOPB */
  807. enum {
  808.     scsiNoParityCheck           = 0x0002,                       /* disable parity checking                 */
  809.     scsiDisableSelectWAtn       = 0x0004,                       /* disable select w/Atn                    */
  810.     scsiSavePtrOnDisconnect     = 0x0008,                       /* do SaveDataPointer upon Disconnect msg          */
  811.     scsiNoBucketIn              = 0x0010,                       /* don't bit bucket in during this I/O           */
  812.     scsiNoBucketOut             = 0x0020,                       /* don't bit bucket out during this I/O        */
  813.     scsiDisableWide             = 0x0040,                       /* disable wide transfer negotiation           */
  814.     scsiInitiateWide            = 0x0080,                       /* initiate wide transfer negotiation           */
  815.     scsiRenegotiateSense        = 0x0100,                       /* renegotiate sync/wide before issuing autosense     */
  816.     scsiDisableDiscipline       = 0x0200,                       /* disable parameter checking on SCSIExecIO calls */
  817.     scsiIOFlagReserved0080      = 0x0080,                       /*                                */
  818.     scsiIOFlagReserved8000      = 0x8000                        /*                                  */
  819. };
  820. /* Defines for the Bus Inquiry PB fields. */
  821. /* scsiHBAInquiry field bits */
  822. enum {
  823.     scsiBusMDP                  = 0x80,                         /* Supports Modify Data Pointer message               */
  824.     scsiBusWide32               = 0x40,                         /* Supports 32 bit wide SCSI                    */
  825.     scsiBusWide16               = 0x20,                         /* Supports 16 bit wide SCSI                    */
  826.     scsiBusSDTR                 = 0x10,                         /* Supports Sync Data Transfer Req message              */
  827.     scsiBusLinkedCDB            = 0x08,                         /* Supports linked CDBs                         */
  828.     scsiBusTagQ                 = 0x02,                         /* Supports tag queue message                    */
  829.     scsiBusSoftReset            = 0x01                          /* Supports soft reset                           */
  830. };
  831. /* Defines for the scsiDataType field */
  832. enum {
  833.     scsiDataBuffer              = 0,                            /* single contiguous buffer supplied            */
  834.     scsiDataTIB                 = 1,                            /* TIB supplied (ptr in scsiDataPtr)           */
  835.     scsiDataSG                  = 2,                            /* scatter/gather list supplied             */
  836.     scsiDataIOTable             = 3                             /*#(7/11/95) Prepared by Block Storage         */
  837. };
  838. /* scsiDataTypes field bits  */
  839. /*  bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved */
  840. enum {
  841.     scsiBusDataTIB              = (1 << scsiDataTIB),           /* TIB supplied (ptr in scsiDataPtr)   */
  842.     scsiBusDataBuffer           = (1 << scsiDataBuffer),        /* single contiguous buffer supplied      */
  843.     scsiBusDataSG               = (1 << scsiDataSG),            /* scatter/gather list supplied        */
  844.     scsiBusDataIOTable          = (1 << scsiDataIOTable),       /* (2/6/95) Prepare Memory for IO*/
  845.     scsiBusDataReserved         = (long)0x80000000              /*                            */
  846. };
  847. /* scsiScanFlags field bits */
  848. enum {
  849.     scsiBusScansDevices         = 0x80,                         /* Bus scans for and maintains device list         */
  850.     scsiBusScansOnInit          = 0x40,                         /* Bus scans performed at power-up/reboot        */
  851.     scsiBusLoadsROMDrivers      = 0x20                          /* may load ROM drivers to support targets       */
  852. };
  853. /* scsiFeatureFlags field bits */
  854. enum {
  855.     scsiBusLVD                  = 0x00000400,                   /* HBA is Low Voltage Differential Bus         */
  856.     scsiBusUltra3SCSI           = 0x00000200,                   /* HBA supports Ultra3 SCSI               */
  857.     scsiBusUltra2SCSI           = 0x00000100,                   /* HBA supports Ultra2 SCSI               */
  858.     scsiBusInternalExternalMask = 0x000000C0,                   /* bus internal/external mask           */
  859.     scsiBusInternalExternalUnknown = 0x00000000,                /* not known whether bus is inside or outside     */
  860.     scsiBusInternalExternal     = 0x000000C0,                   /* bus goes inside and outside the box       */
  861.     scsiBusInternal             = 0x00000080,                   /* bus goes inside the box                */
  862.     scsiBusExternal             = 0x00000040,                   /* bus goes outside the box             */
  863.     scsiBusCacheCoherentDMA     = 0x00000020,                   /* DMA is cache coherent                */
  864.     scsiBusOldCallCapable       = 0x00000010,                   /* SIM is old call capable                */
  865.     scsiBusUltraSCSI            = 0x00000008,                   /* HBA supports Ultra SCSI                 */
  866.     scsiBusDifferential         = 0x00000004,                   /* Single Ended (0) or Differential (1)    */
  867.     scsiBusFastSCSI             = 0x00000002,                   /* HBA supports fast SCSI                  */
  868.     scsiBusDMAavailable         = 0x00000001                    /* DMA is available                  */
  869. };
  870. /* scsiWeirdStuff field bits */
  871. enum {
  872.     scsiOddDisconnectUnsafeRead1 = 0x0001,                      /* Disconnects on odd byte boundries are unsafe with DMA and/or blind reads */
  873.     scsiOddDisconnectUnsafeWrite1 = 0x0002,                     /* Disconnects on odd byte boundries are unsafe with DMA and/or blind writes */
  874.     scsiBusErrorsUnsafe         = 0x0004,                       /* Non-handshaked delays or disconnects during blind transfers may cause a crash */
  875.     scsiRequiresHandshake       = 0x0008,                       /* Non-handshaked delays or disconnects during blind transfers may cause data corruption */
  876.     scsiTargetDrivenSDTRSafe    = 0x0010,                       /* Targets which initiate synchronous negotiations are supported */
  877.     scsiOddCountForPhysicalUnsafe = 0x0020,                     /* If using physical addrs all counts must be even, and disconnects must be on even boundries */
  878.     scsiAbortCmdFixed           = 0x0040,                       /* Set if abort command is fixed to properly make callbacks */
  879.     scsiMeshACKTimingFixed      = 0x0080                        /* Set if bug allowing Mesh to release ACK prematurely is fixed */
  880. };
  881. /* scsiHBAslotType values */
  882. enum {
  883.     scsiMotherboardBus          = 0x00,                         /* A built in Apple supplied bus            */
  884.     scsiNuBus                   = 0x01,                         /* A SIM on a NuBus card                   */
  885.     scsiPDSBus                  = 0x03,                         /*    "  on a PDS card                    */
  886.     scsiPCIBus                  = 0x04,                         /*    "  on a PCI bus card                   */
  887.     scsiPCMCIABus               = 0x05,                         /*    "  on a PCMCIA card                  */
  888.     scsiFireWireBridgeBus       = 0x06                          /*    "  connected through a FireWire bridge   */
  889. };
  890. /* Defines for the scsiDriverFlags field (in SCSIDriverPB) */
  891. enum {
  892.     scsiDeviceSensitive         = 0x0001,                       /* Only driver should access this device          */
  893.     scsiDeviceNoOldCallAccess   = 0x0002                        /* no old call access to this device            */
  894. };
  895. /*  SIMInitInfo PB */
  896. /* directions are for SCSIRegisterBus call ( -> parm, <- result)            */
  897. struct SIMInitInfo {
  898.     Ptr                             SIMstaticPtr;               /* <- alloc. ptr to the SIM's static vars           */
  899.     long                            staticSize;                 /* -> num bytes SIM needs for static vars           */
  900.     SIMInitUPP                      SIMInit;                    /* -> pointer to the SIM init routine               */
  901.     SIMActionUPP                    SIMAction;                  /* -> pointer to the SIM action routine           */
  902.     SCSIInterruptUPP                SIM_ISR;                    /*      reserved                           */
  903.     SCSIInterruptUPP                SIMInterruptPoll;           /* -> pointer to the SIM interrupt poll routine      */
  904.     SIMActionUPP                    NewOldCall;                 /* -> pointer to the SIM NewOldCall routine          */
  905.     UInt16                          ioPBSize;                   /* -> size of SCSI_IO_PBs required for this SIM      */
  906.     Boolean                         oldCallCapable;             /* -> true if this SIM can handle old-API calls      */
  907.     UInt8                           simInfoUnused1;             /*      reserved                             */
  908.     long                            simInternalUse;             /* xx not affected or viewed by XPT               */
  909.     SCSIUPP                         XPT_ISR;                    /*    reserved                             */
  910.     SCSIUPP                         EnteringSIM;                /* <- ptr to the EnteringSIM routine            */
  911.     SCSIUPP                         ExitingSIM;                 /* <- ptr to the ExitingSIM routine               */
  912.     SCSIMakeCallbackUPP             MakeCallback;               /* <- the XPT layer's SCSIMakeCallback routine            */
  913.     UInt16                          busID;                      /* <- bus number for the registered bus             */
  914.     UInt8                           simSlotNumber;              /* <- Magic cookie to place in scsiHBASlotNumber (PCI)    */
  915.     UInt8                           simSRsrcID;                 /* <- Magic cookie to place in scsiSIMsRsrcID  (PCI)  */
  916.     Ptr                             simRegEntry;                /* -> The SIM's RegEntryIDPtr            (PCI)  */
  917. };
  918. typedef struct SIMInitInfo              SIMInitInfo;
  919. /* Glue between SCSI calls and SCSITrap format */
  920. enum {
  921.     xptSCSIAction               = 0x0001,
  922.     xptSCSIRegisterBus          = 0x0002,
  923.     xptSCSIDeregisterBus        = 0x0003,
  924.     xptSCSIReregisterBus        = 0x0004,
  925.     xptSCSIKillXPT              = 0x0005,                       /* kills Mini-XPT after transition */
  926.     xptSCSIInitialize           = 0x000A                        /* Initialize the SCSI manager */
  927. };
  928. /*
  929.  * SCSI bus status. These values are returned by the SCSI target in the status phase.
  930.  * They are not related to Macintosh status values (except that values other than
  931.  * scsiStatusGood will result in scsiResult set to scsiNonZeroStatus).
  932.  */
  933. enum {
  934.     scsiStatGood                = 0x00,                         /* Good Status*/
  935.     scsiStatCheckCondition      = 0x02,                         /* Check Condition*/
  936.     scsiStatConditionMet        = 0x04,                         /* Condition Met*/
  937.     scsiStatBusy                = 0x08,                         /* Busy*/
  938.     scsiStatIntermediate        = 0x10,                         /* Intermediate*/
  939.     scsiStatIntermedMet         = 0x14,                         /* Intermediate - Condition Met*/
  940.     scsiStatResvConflict        = 0x18,                         /* Reservation conflict*/
  941.     scsiStatTerminated          = 0x22,                         /* Command terminated*/
  942.     scsiStatQFull               = 0x28                          /* Queue full*/
  943. };
  944. /* SCSI messages*/
  945. enum {
  946.     kCmdCompleteMsg             = 0,
  947.     kExtendedMsg                = 1,                            /* 0x01*/
  948.     kSaveDataPointerMsg         = 2,                            /* 0x02*/
  949.     kRestorePointersMsg         = 3,                            /* 0x03*/
  950.     kDisconnectMsg              = 4,                            /* 0x04*/
  951.     kInitiatorDetectedErrorMsg  = 5,                            /* 0x05*/
  952.     kAbortMsg                   = 6,                            /* 0x06*/
  953.     kMsgRejectMsg               = 7,                            /* 0x07*/
  954.     kNoOperationMsg             = 8,                            /* 0x08*/
  955.     kMsgParityErrorMsg          = 9,                            /* 0x09*/
  956.     kLinkedCmdCompleteMsg       = 10,                           /* 0x0a*/
  957.     kLinkedCmdCompleteWithFlagMsg = 11,                         /* 0x0b*/
  958.     kBusDeviceResetMsg          = 12,                           /* 0x0c*/
  959.     kAbortTagMsg                = 13,                           /* 0x0d*/
  960.     kClearQueueMsg              = 14,                           /* 0x0e*/
  961.     kInitiateRecoveryMsg        = 15,                           /* 0x0f*/
  962.     kReleaseRecoveryMsg         = 16,                           /* 0x10*/
  963.     kTerminateIOProcessMsg      = 17,                           /* 0x11*/
  964.     kSimpleQueueTag             = 0x20,                         /* 0x20*/
  965.     kHeadOfQueueTagMsg          = 0x21,                         /* 0x21*/
  966.     kOrderedQueueTagMsg         = 0x22,                         /* 0x22*/
  967.     kIgnoreWideResidueMsg       = 0x23                          /* 0x23*/
  968. };
  969. /* moveq #kSCSIx, D0;  _SCSIAtomic */
  970.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  971.                                                                                             #pragma parameter __D0 SCSIAction(__A0)
  972.                                                                                             #endif
  973. EXTERN_API( OSErr )
  974. SCSIAction                      (SCSI_PB *              parameterBlock)                     TWOWORDINLINE(0x7001, 0xA089);
  975. #if CALL_NOT_IN_CARBON
  976.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  977.                                                                                             #pragma parameter __D0 SCSIRegisterBus(__A0)
  978.                                                                                             #endif
  979. EXTERN_API( OSErr )
  980. SCSIRegisterBus                 (SIMInitInfo *          parameterBlock)                     TWOWORDINLINE(0x7002, 0xA089);
  981.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  982.                                                                                             #pragma parameter __D0 SCSIDeregisterBus(__A0)
  983.                                                                                             #endif
  984. EXTERN_API( OSErr )
  985. SCSIDeregisterBus               (SCSI_PB *              parameterBlock)                     TWOWORDINLINE(0x7003, 0xA089);
  986.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  987.                                                                                             #pragma parameter __D0 SCSIReregisterBus(__A0)
  988.                                                                                             #endif
  989. EXTERN_API( OSErr )
  990. SCSIReregisterBus               (SIMInitInfo *          parameterBlock)                     TWOWORDINLINE(0x7004, 0xA089);
  991.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  992.                                                                                             #pragma parameter __D0 SCSIKillXPT(__A0)
  993.                                                                                             #endif
  994. EXTERN_API( OSErr )
  995. SCSIKillXPT                     (SIMInitInfo *          parameterBlock)                     TWOWORDINLINE(0x7005, 0xA089);
  996. #endif  /* CALL_NOT_IN_CARBON */
  997. #if PRAGMA_STRUCT_ALIGN
  998.     #pragma options align=reset
  999. #elif PRAGMA_STRUCT_PACKPUSH
  1000.     #pragma pack(pop)
  1001. #elif PRAGMA_STRUCT_PACK
  1002.     #pragma pack()
  1003. #endif
  1004. #ifdef PRAGMA_IMPORT_OFF
  1005. #pragma import off
  1006. #elif PRAGMA_IMPORT
  1007. #pragma import reset
  1008. #endif
  1009. #ifdef __cplusplus
  1010. }
  1011. #endif
  1012. #endif /* __SCSI__ */