Mac OS 9
SCSI.h
Go to the documentation of this file.
1 
19 #ifndef __SCSI__
20 #define __SCSI__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __MIXEDMODE__
27 #include <MixedMode.h>
28 #endif
29 
30 #ifndef __APPLEDISKPARTITIONS__
31 #include <AppleDiskPartitions.h>
32 #endif
33 
34 #if PRAGMA_ONCE
35 #pragma once
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
43 #if PRAGMA_IMPORT
44 #pragma import on
45 #endif
46 
47 #if PRAGMA_STRUCT_ALIGN
48 #pragma options align = mac68k
49 #elif PRAGMA_STRUCT_PACKPUSH
50 #pragma pack(push, 2)
51 #elif PRAGMA_STRUCT_PACK
52 #pragma pack(2)
53 #endif
54 
55  /* SCSI Manager errors. These are generated by Inside Mac IV calls only. */
56  enum
57  {
58  scCommErr = 2, /* communications error, operation timeout */
59  scArbNBErr = 3, /* arbitration timeout waiting for not BSY */
60  scBadParmsErr = 4, /* bad parameter or TIB opcode */
61  scPhaseErr = 5, /* SCSI bus not in correct phase for attempted operation */
62  scCompareErr = 6, /* data compare error */
63  scMgrBusyErr = 7, /* SCSI Manager busy */
64  scSequenceErr = 8, /* attempted operation is out of sequence */
65  scBusTOErr = 9, /* CPU bus timeout */
66  scComplPhaseErr = 10 /* SCSI bus wasn't in Status phase */
67  };
68 
69  /* TIB opcodes */
70  enum
71  {
72  scInc = 1,
73  scNoInc = 2,
74  scAdd = 3,
75  scMove = 4,
76  scLoop = 5,
77  scNop = 6,
78  scStop = 7,
79  scComp = 8
80  };
81 
86  /* TIB instruction */
87  struct SCSIInstr
88  {
89  unsigned short scOpcode;
90  long scParam1;
91  long scParam2;
92  };
93  typedef struct SCSIInstr SCSIInstr;
94  /* SCSI Phases (used by SIMs to support the Original SCSI Manager */
95  enum
96  {
97  kDataOutPhase = 0, /* Encoded MSG, C/D, I/O bits */
98  kDataInPhase = 1,
99  kCommandPhase = 2,
100  kStatusPhase = 3,
101  kPhaseIllegal0 = 4,
102  kPhaseIllegal1 = 5,
103  kMessageOutPhase = 6,
104  kMessageInPhase = 7,
105  kBusFreePhase = 8, /* Additional Phases */
106  kArbitratePhase = 9,
107  kSelectPhase = 10,
108  kMessageInPhaseNACK = 11 /* Message In Phase with ACK hanging on the bus */
109  };
110 
111 #if CALL_NOT_IN_CARBON
112 
134  OSErr
135  SCSIReset(void);
136 
158  OSErr
159  SCSIGet(void);
160 
182  OSErr
183  SCSISelect(short targetID);
184 
212  OSErr
213  SCSICmd(Ptr buffer, short count);
214 
249  OSErr
250  SCSIRead(Ptr tibPtr);
251 
295  OSErr
296  SCSIRBlind(Ptr tibPtr);
297 
330  OSErr
331  SCSIWrite(Ptr tibPtr);
332 
369  OSErr
370  SCSIWBlind(Ptr tibPtr);
371 
395  OSErr
396  SCSIComplete(short *stat, short *message, unsigned long wait);
397 
431  short
432  SCSIStat(void);
433 
456  OSErr
457  SCSISelAtn(short targetID);
458 
484  OSErr
485  SCSIMsgIn(short *message);
486 
512  OSErr
513  SCSIMsgOut(short message);
514 
515 #endif /* CALL_NOT_IN_CARBON */
516 
517  enum
518  {
519  scsiVERSION = 43
520  };
521 
526  typedef CALLBACK_API_C(void, AENCallbackProcPtr)(void);
527  typedef CALLBACK_API_C(OSErr, SIMInitProcPtr)(Ptr SIMinfoPtr);
528  typedef CALLBACK_API_C(void, SIMActionProcPtr)(void *scsiPB, Ptr SIMGlobals);
529  typedef CALLBACK_API_C(void, SCSIProcPtr)(void);
530  typedef CALLBACK_API_C(void, SCSIMakeCallbackProcPtr)(void *scsiPB);
531  /* SCSIInterruptPollProcPtr is obsolete (use SCSIInterruptProcPtr) but still
532  * here for compatibility */
533  typedef CALLBACK_API_C(long, SCSIInterruptPollProcPtr)(Ptr SIMGlobals);
534  typedef CALLBACK_API_C(long, SCSIInterruptProcPtr)(Ptr SIMGlobals);
535  typedef STACK_UPP_TYPE(AENCallbackProcPtr) AENCallbackUPP;
536  typedef STACK_UPP_TYPE(SIMInitProcPtr) SIMInitUPP;
537  typedef STACK_UPP_TYPE(SIMActionProcPtr) SIMActionUPP;
538  typedef STACK_UPP_TYPE(SCSIProcPtr) SCSIUPP;
539  typedef STACK_UPP_TYPE(SCSIMakeCallbackProcPtr) SCSIMakeCallbackUPP;
540  typedef STACK_UPP_TYPE(SCSIInterruptPollProcPtr) SCSIInterruptPollUPP;
541  typedef STACK_UPP_TYPE(SCSIInterruptProcPtr) SCSIInterruptUPP;
542 #if CALL_NOT_IN_CARBON
551  AENCallbackUPP
552  NewAENCallbackUPP(AENCallbackProcPtr userRoutine);
553 #if !OPAQUE_UPP_TYPES
554  enum
555  {
556  uppAENCallbackProcInfo = 0x00000001
557  }; /* no_return_value Func() */
558 #ifdef __cplusplus
559  inline AENCallbackUPP NewAENCallbackUPP(AENCallbackProcPtr userRoutine)
560  {
561  return (AENCallbackUPP)NewRoutineDescriptor(
562  (ProcPtr)(userRoutine), uppAENCallbackProcInfo, GetCurrentArchitecture());
563  }
564 #else
565 #define NewAENCallbackUPP(userRoutine) \
566  (AENCallbackUPP) \
567  NewRoutineDescriptor((ProcPtr)(userRoutine), uppAENCallbackProcInfo, \
568  GetCurrentArchitecture())
569 #endif
570 #endif
571 
580  SIMInitUPP
581  NewSIMInitUPP(SIMInitProcPtr userRoutine);
582 #if !OPAQUE_UPP_TYPES
583  enum
584  {
585  uppSIMInitProcInfo = 0x000000E1
586  }; /* 2_bytes Func(4_bytes) */
587 #ifdef __cplusplus
588  inline SIMInitUPP NewSIMInitUPP(SIMInitProcPtr userRoutine)
589  {
590  return (SIMInitUPP)NewRoutineDescriptor(
591  (ProcPtr)(userRoutine), uppSIMInitProcInfo, GetCurrentArchitecture());
592  }
593 #else
594 #define NewSIMInitUPP(userRoutine) \
595  (SIMInitUPP) NewRoutineDescriptor( \
596  (ProcPtr)(userRoutine), uppSIMInitProcInfo, GetCurrentArchitecture())
597 #endif
598 #endif
599 
608  SIMActionUPP
609  NewSIMActionUPP(SIMActionProcPtr userRoutine);
610 #if !OPAQUE_UPP_TYPES
611  enum
612  {
613  uppSIMActionProcInfo = 0x000003C1
614  }; /* no_return_value Func(4_bytes, 4_bytes) */
615 #ifdef __cplusplus
616  inline SIMActionUPP NewSIMActionUPP(SIMActionProcPtr userRoutine)
617  {
618  return (SIMActionUPP)NewRoutineDescriptor(
619  (ProcPtr)(userRoutine), uppSIMActionProcInfo, GetCurrentArchitecture());
620  }
621 #else
622 #define NewSIMActionUPP(userRoutine) \
623  (SIMActionUPP) NewRoutineDescriptor( \
624  (ProcPtr)(userRoutine), uppSIMActionProcInfo, GetCurrentArchitecture())
625 #endif
626 #endif
627 
636  SCSIUPP
637  NewSCSIUPP(SCSIProcPtr userRoutine);
638 #if !OPAQUE_UPP_TYPES
639  enum
640  {
641  uppSCSIProcInfo = 0x00000001
642  }; /* no_return_value Func() */
643 #ifdef __cplusplus
644  inline SCSIUPP NewSCSIUPP(SCSIProcPtr userRoutine)
645  {
646  return (SCSIUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIProcInfo,
647  GetCurrentArchitecture());
648  }
649 #else
650 #define NewSCSIUPP(userRoutine) \
651  (SCSIUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIProcInfo, \
652  GetCurrentArchitecture())
653 #endif
654 #endif
655 
664  SCSIMakeCallbackUPP
665  NewSCSIMakeCallbackUPP(SCSIMakeCallbackProcPtr userRoutine);
666 #if !OPAQUE_UPP_TYPES
667  enum
668  {
669  uppSCSIMakeCallbackProcInfo = 0x000000C1
670  }; /* no_return_value Func(4_bytes) */
671 #ifdef __cplusplus
672  inline SCSIMakeCallbackUPP
673  NewSCSIMakeCallbackUPP(SCSIMakeCallbackProcPtr userRoutine)
674  {
675  return (SCSIMakeCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
676  uppSCSIMakeCallbackProcInfo,
677  GetCurrentArchitecture());
678  }
679 #else
680 #define NewSCSIMakeCallbackUPP(userRoutine) \
681  (SCSIMakeCallbackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
682  uppSCSIMakeCallbackProcInfo, \
683  GetCurrentArchitecture())
684 #endif
685 #endif
686 
695  SCSIInterruptPollUPP
696  NewSCSIInterruptPollUPP(SCSIInterruptPollProcPtr userRoutine);
697 #if !OPAQUE_UPP_TYPES
698  enum
699  {
700  uppSCSIInterruptPollProcInfo = 0x000000F1
701  }; /* 4_bytes Func(4_bytes) */
702 #ifdef __cplusplus
703  inline SCSIInterruptPollUPP
704  NewSCSIInterruptPollUPP(SCSIInterruptPollProcPtr userRoutine)
705  {
706  return (SCSIInterruptPollUPP)NewRoutineDescriptor(
707  (ProcPtr)(userRoutine), uppSCSIInterruptPollProcInfo,
708  GetCurrentArchitecture());
709  }
710 #else
711 #define NewSCSIInterruptPollUPP(userRoutine) \
712  (SCSIInterruptPollUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
713  uppSCSIInterruptPollProcInfo, \
714  GetCurrentArchitecture())
715 #endif
716 #endif
717 
726  SCSIInterruptUPP
727  NewSCSIInterruptUPP(SCSIInterruptProcPtr userRoutine);
728 #if !OPAQUE_UPP_TYPES
729  enum
730  {
731  uppSCSIInterruptProcInfo = 0x000000F1
732  }; /* 4_bytes Func(4_bytes) */
733 #ifdef __cplusplus
734  inline SCSIInterruptUPP NewSCSIInterruptUPP(SCSIInterruptProcPtr userRoutine)
735  {
736  return (SCSIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
737  uppSCSIInterruptProcInfo,
738  GetCurrentArchitecture());
739  }
740 #else
741 #define NewSCSIInterruptUPP(userRoutine) \
742  (SCSIInterruptUPP) \
743  NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptProcInfo, \
744  GetCurrentArchitecture())
745 #endif
746 #endif
747 
756  void
757  DisposeAENCallbackUPP(AENCallbackUPP userUPP);
758 #if !OPAQUE_UPP_TYPES
759 #ifdef __cplusplus
760  inline void DisposeAENCallbackUPP(AENCallbackUPP userUPP)
761  {
762  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
763  }
764 #else
765 #define DisposeAENCallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
766 #endif
767 #endif
768 
777  void
778  DisposeSIMInitUPP(SIMInitUPP userUPP);
779 #if !OPAQUE_UPP_TYPES
780 #ifdef __cplusplus
781  inline void DisposeSIMInitUPP(SIMInitUPP userUPP)
782  {
783  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
784  }
785 #else
786 #define DisposeSIMInitUPP(userUPP) DisposeRoutineDescriptor(userUPP)
787 #endif
788 #endif
789 
798  void
799  DisposeSIMActionUPP(SIMActionUPP userUPP);
800 #if !OPAQUE_UPP_TYPES
801 #ifdef __cplusplus
802  inline void DisposeSIMActionUPP(SIMActionUPP userUPP)
803  {
804  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
805  }
806 #else
807 #define DisposeSIMActionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
808 #endif
809 #endif
810 
819  void
820  DisposeSCSIUPP(SCSIUPP userUPP);
821 #if !OPAQUE_UPP_TYPES
822 #ifdef __cplusplus
823  inline void DisposeSCSIUPP(SCSIUPP userUPP)
824  {
825  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
826  }
827 #else
828 #define DisposeSCSIUPP(userUPP) DisposeRoutineDescriptor(userUPP)
829 #endif
830 #endif
831 
840  void
841  DisposeSCSIMakeCallbackUPP(SCSIMakeCallbackUPP userUPP);
842 #if !OPAQUE_UPP_TYPES
843 #ifdef __cplusplus
844  inline void DisposeSCSIMakeCallbackUPP(SCSIMakeCallbackUPP userUPP)
845  {
846  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
847  }
848 #else
849 #define DisposeSCSIMakeCallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
850 #endif
851 #endif
852 
861  void
862  DisposeSCSIInterruptPollUPP(SCSIInterruptPollUPP userUPP);
863 #if !OPAQUE_UPP_TYPES
864 #ifdef __cplusplus
865  inline void DisposeSCSIInterruptPollUPP(SCSIInterruptPollUPP userUPP)
866  {
867  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
868  }
869 #else
870 #define DisposeSCSIInterruptPollUPP(userUPP) DisposeRoutineDescriptor(userUPP)
871 #endif
872 #endif
873 
882  void
883  DisposeSCSIInterruptUPP(SCSIInterruptUPP userUPP);
884 #if !OPAQUE_UPP_TYPES
885 #ifdef __cplusplus
886  inline void DisposeSCSIInterruptUPP(SCSIInterruptUPP userUPP)
887  {
888  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
889  }
890 #else
891 #define DisposeSCSIInterruptUPP(userUPP) DisposeRoutineDescriptor(userUPP)
892 #endif
893 #endif
894 
903  void
904  InvokeAENCallbackUPP(AENCallbackUPP userUPP);
905 #if !OPAQUE_UPP_TYPES
906 #ifdef __cplusplus
907  inline void InvokeAENCallbackUPP(AENCallbackUPP userUPP)
908  {
909  CALL_ZERO_PARAMETER_UPP(userUPP, uppAENCallbackProcInfo);
910  }
911 #else
912 #define InvokeAENCallbackUPP(userUPP) \
913  CALL_ZERO_PARAMETER_UPP((userUPP), uppAENCallbackProcInfo)
914 #endif
915 #endif
916 
925  OSErr
926  InvokeSIMInitUPP(Ptr SIMinfoPtr, SIMInitUPP userUPP);
927 #if !OPAQUE_UPP_TYPES
928 #ifdef __cplusplus
929  inline OSErr InvokeSIMInitUPP(Ptr SIMinfoPtr, SIMInitUPP userUPP)
930  {
931  return (OSErr)CALL_ONE_PARAMETER_UPP(userUPP, uppSIMInitProcInfo, SIMinfoPtr);
932  }
933 #else
934 #define InvokeSIMInitUPP(SIMinfoPtr, userUPP) \
935  (OSErr) CALL_ONE_PARAMETER_UPP((userUPP), uppSIMInitProcInfo, (SIMinfoPtr))
936 #endif
937 #endif
938 
947  void
948  InvokeSIMActionUPP(void *scsiPB, Ptr SIMGlobals, SIMActionUPP userUPP);
949 #if !OPAQUE_UPP_TYPES
950 #ifdef __cplusplus
951  inline void InvokeSIMActionUPP(void *scsiPB, Ptr SIMGlobals,
952  SIMActionUPP userUPP)
953  {
954  CALL_TWO_PARAMETER_UPP(userUPP, uppSIMActionProcInfo, scsiPB, SIMGlobals);
955  }
956 #else
957 #define InvokeSIMActionUPP(scsiPB, SIMGlobals, userUPP) \
958  CALL_TWO_PARAMETER_UPP((userUPP), uppSIMActionProcInfo, (scsiPB), \
959  (SIMGlobals))
960 #endif
961 #endif
962 
971  void
972  InvokeSCSIUPP(SCSIUPP userUPP);
973 #if !OPAQUE_UPP_TYPES
974 #ifdef __cplusplus
975  inline void InvokeSCSIUPP(SCSIUPP userUPP)
976  {
977  CALL_ZERO_PARAMETER_UPP(userUPP, uppSCSIProcInfo);
978  }
979 #else
980 #define InvokeSCSIUPP(userUPP) \
981  CALL_ZERO_PARAMETER_UPP((userUPP), uppSCSIProcInfo)
982 #endif
983 #endif
984 
993  void
994  InvokeSCSIMakeCallbackUPP(void *scsiPB, SCSIMakeCallbackUPP userUPP);
995 #if !OPAQUE_UPP_TYPES
996 #ifdef __cplusplus
997  inline void InvokeSCSIMakeCallbackUPP(void *scsiPB,
998  SCSIMakeCallbackUPP userUPP)
999  {
1000  CALL_ONE_PARAMETER_UPP(userUPP, uppSCSIMakeCallbackProcInfo, scsiPB);
1001  }
1002 #else
1003 #define InvokeSCSIMakeCallbackUPP(scsiPB, userUPP) \
1004  CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIMakeCallbackProcInfo, (scsiPB))
1005 #endif
1006 #endif
1007 
1016  long
1017  InvokeSCSIInterruptPollUPP(Ptr SIMGlobals, SCSIInterruptPollUPP userUPP);
1018 #if !OPAQUE_UPP_TYPES
1019 #ifdef __cplusplus
1020  inline long InvokeSCSIInterruptPollUPP(Ptr SIMGlobals,
1021  SCSIInterruptPollUPP userUPP)
1022  {
1023  return (long)CALL_ONE_PARAMETER_UPP(userUPP, uppSCSIInterruptPollProcInfo,
1024  SIMGlobals);
1025  }
1026 #else
1027 #define InvokeSCSIInterruptPollUPP(SIMGlobals, userUPP) \
1028  (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptPollProcInfo, \
1029  (SIMGlobals))
1030 #endif
1031 #endif
1032 
1041  long
1042  InvokeSCSIInterruptUPP(Ptr SIMGlobals, SCSIInterruptUPP userUPP);
1043 #if !OPAQUE_UPP_TYPES
1044 #ifdef __cplusplus
1045  inline long InvokeSCSIInterruptUPP(Ptr SIMGlobals, SCSIInterruptUPP userUPP)
1046  {
1047  return (long)CALL_ONE_PARAMETER_UPP(userUPP, uppSCSIInterruptProcInfo,
1048  SIMGlobals);
1049  }
1050 #else
1051 #define InvokeSCSIInterruptUPP(SIMGlobals, userUPP) \
1052  (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptProcInfo, \
1053  (SIMGlobals))
1054 #endif
1055 #endif
1056 
1057 #endif /* CALL_NOT_IN_CARBON */
1058 
1059 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
1060 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
1061 #define NewAENCallbackProc(userRoutine) NewAENCallbackUPP(userRoutine)
1062 #define NewSIMInitProc(userRoutine) NewSIMInitUPP(userRoutine)
1063 #define NewSIMActionProc(userRoutine) NewSIMActionUPP(userRoutine)
1064 #define NewSCSIProc(userRoutine) NewSCSIUPP(userRoutine)
1065 #define NewSCSIMakeCallbackProc(userRoutine) NewSCSIMakeCallbackUPP(userRoutine)
1066 #define NewSCSIInterruptPollProc(userRoutine) \
1067  NewSCSIInterruptPollUPP(userRoutine)
1068 #define NewSCSIInterruptProc(userRoutine) NewSCSIInterruptUPP(userRoutine)
1069 #define CallAENCallbackProc(userRoutine) InvokeAENCallbackUPP(userRoutine)
1070 #define CallSIMInitProc(userRoutine, SIMinfoPtr) \
1071  InvokeSIMInitUPP(SIMinfoPtr, userRoutine)
1072 #define CallSIMActionProc(userRoutine, scsiPB, SIMGlobals) \
1073  InvokeSIMActionUPP(scsiPB, SIMGlobals, userRoutine)
1074 #define CallSCSIProc(userRoutine) InvokeSCSIUPP(userRoutine)
1075 #define CallSCSIMakeCallbackProc(userRoutine, scsiPB) \
1076  InvokeSCSIMakeCallbackUPP(scsiPB, userRoutine)
1077 #define CallSCSIInterruptPollProc(userRoutine, SIMGlobals) \
1078  InvokeSCSIInterruptPollUPP(SIMGlobals, userRoutine)
1079 #define CallSCSIInterruptProc(userRoutine, SIMGlobals) \
1080  InvokeSCSIInterruptUPP(SIMGlobals, userRoutine)
1081 #endif /* CALL_NOT_IN_CARBON */
1082 
1086  typedef CALLBACK_API(void, SCSICallbackProcPtr)(void *scsiPB);
1087  typedef STACK_UPP_TYPE(SCSICallbackProcPtr) SCSICallbackUPP;
1096  SCSICallbackUPP
1097  NewSCSICallbackUPP(SCSICallbackProcPtr userRoutine);
1098 #if !OPAQUE_UPP_TYPES
1099  enum
1100  {
1101  uppSCSICallbackProcInfo = 0x000000C0
1102  }; /* pascal no_return_value Func(4_bytes) */
1103 #ifdef __cplusplus
1104  inline SCSICallbackUPP NewSCSICallbackUPP(SCSICallbackProcPtr userRoutine)
1105  {
1106  return (SCSICallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
1107  uppSCSICallbackProcInfo,
1108  GetCurrentArchitecture());
1109  }
1110 #else
1111 #define NewSCSICallbackUPP(userRoutine) \
1112  (SCSICallbackUPP) \
1113  NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSICallbackProcInfo, \
1114  GetCurrentArchitecture())
1115 #endif
1116 #endif
1117 
1126  void
1127  DisposeSCSICallbackUPP(SCSICallbackUPP userUPP);
1128 #if !OPAQUE_UPP_TYPES
1129 #ifdef __cplusplus
1130  inline void DisposeSCSICallbackUPP(SCSICallbackUPP userUPP)
1131  {
1132  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
1133  }
1134 #else
1135 #define DisposeSCSICallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
1136 #endif
1137 #endif
1138 
1147  void
1148  InvokeSCSICallbackUPP(void *scsiPB, SCSICallbackUPP userUPP);
1149 #if !OPAQUE_UPP_TYPES
1150 #ifdef __cplusplus
1151  inline void InvokeSCSICallbackUPP(void *scsiPB, SCSICallbackUPP userUPP)
1152  {
1153  CALL_ONE_PARAMETER_UPP(userUPP, uppSCSICallbackProcInfo, scsiPB);
1154  }
1155 #else
1156 #define InvokeSCSICallbackUPP(scsiPB, userUPP) \
1157  CALL_ONE_PARAMETER_UPP((userUPP), uppSCSICallbackProcInfo, (scsiPB))
1158 #endif
1159 #endif
1160 
1161 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
1162 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
1163 #define NewSCSICallbackProc(userRoutine) NewSCSICallbackUPP(userRoutine)
1164 #define CallSCSICallbackProc(userRoutine, scsiPB) \
1165  InvokeSCSICallbackUPP(scsiPB, userRoutine)
1166 #endif /* CALL_NOT_IN_CARBON */
1167 
1171  enum
1172  {
1173  SCSINop = 0x00, /* Execute nothing */
1174  SCSIExecIO = 0x01, /* Execute the specified IO */
1175  SCSIBusInquiry = 0x03, /* Get parameters for entire path of HBAs */
1176  SCSIReleaseQ = 0x04, /* Release the frozen SIM queue for particular LUN */
1177  SCSIAbortCommand = 0x10, /* Abort the selected Control Block */
1178  SCSIResetBus = 0x11, /* Reset the SCSI bus */
1179  SCSIResetDevice = 0x12, /* Reset the SCSI device */
1180  SCSITerminateIO = 0x13 /* Terminate any pending IO */
1181  };
1182 
1183  /* Not available in Carbon on X */
1184  enum
1185  {
1186  SCSIGetVirtualIDInfo = 0x80, /* Find out which bus old ID is on */
1187  SCSILoadDriver = 0x82, /* Load a driver for a device ident */
1188  SCSIOldCall = 0x84, /* XPT->SIM private call for old-API */
1189  SCSICreateRefNumXref = 0x85, /* Register a DeviceIdent to drvr RefNum xref */
1190  SCSILookupRefNumXref = 0x86, /* Get DeviceIdent to drvr RefNum xref */
1191  SCSIRemoveRefNumXref = 0x87, /* Remove a DeviceIdent to drvr RefNum xref */
1192  SCSIRegisterWithNewXPT =
1193  0x88 /* XPT has changed - SIM needs to re-register itself */
1194  };
1195 
1196  enum
1197  {
1198  vendorUnique = 0xC0 /* 0xC0 thru 0xFF */
1199  };
1200 
1201  /* Allocation length defines for some of the fields */
1202  enum
1203  {
1204  handshakeDataLength = 8, /* Handshake data length */
1205  maxCDBLength = 16, /* Space for the CDB bytes/pointer */
1206  vendorIDLength = 16 /* ASCII string len for Vendor ID */
1207  };
1208 
1209  /* Define DeviceIdent structure */
1211  {
1212  UInt8 diReserved; /* reserved */
1213  UInt8 bus; /* SCSI - Bus Number */
1214  UInt8 targetID; /* SCSI - Target SCSI ID */
1215  UInt8 LUN; /* SCSI - LUN */
1216  };
1217  typedef struct DeviceIdent DeviceIdent;
1218  /* Constants for the diReserved field of DeviceIdent */
1219  /* used to distinguish whether the DeviceIdent holds */
1220  /* information about a SCSI device (kBusTypeSCSI) */
1221  /* or an ATA device (kBusTypeATA). The other */
1222  /* constants are pretty much deprecated. Let me */
1223  /* know if you see any. */
1224  enum
1225  {
1226  kBusTypeSCSI = 0,
1227  kBusTypeATA = 1,
1228  kBusTypePCMCIA = 2,
1229  kBusTypeMediaBay = 3
1230  };
1231 
1232  /* If diReserved indicates that a DeviceIdent is */
1233  /* really for ATA, you can cast it to DeviceIdentATA */
1234  /* to get at the important fields. */
1236  {
1237  UInt8 diReserved;
1238  UInt8 busNum;
1239  UInt8 devNum;
1240  UInt8 diReserved2;
1241  };
1242  typedef struct DeviceIdentATA DeviceIdentATA;
1243  /* for use with Apple Patch Driver used during booting*/
1245  {
1246  OSType patchSig; /* The patches signature */
1247  UInt16 majorVers; /* The major version number of the */
1248  /* patch */
1249  UInt16 minorVers; /* The minor version number of the */
1250  /* patch */
1251  UInt32 flags; /* Reqired/Optional, etc. */
1252  UInt32 patchOffset; /* Block offset to the beginning of */
1253  /* the patch */
1254  UInt32 patchSize; /* Actual size of the patch in bytes */
1255  UInt32 patchCRC; /* As calculated by the SCSI drivers */
1256  /* CRC code */
1257  UInt32 patchDescriptorLen; /* Total length of the descriptor */
1258  /* (must be >= 61 bytes) */
1259  Str32 patchName; /* Pascal string with a short */
1260  /* description of the patch */
1261  UInt8 patchVendor[1]; /* The first byte of a pascal string */
1262  /* for the patch Vendor. Any amount */
1263  /* of data may follow the string. */
1264  };
1265  typedef struct PatchDescriptor PatchDescriptor;
1266  /* Constants for the flags field of PatchDescriptor. */
1267  enum
1268  {
1269  kRequiredPatch = 0x00000001 /* Patch must succeed to continue booting. */
1270  };
1271 
1272  struct PatchList
1273  {
1274  UInt16 numPatchBlocks; /* The number of disk blocks */
1275  /* to hold patch descriptions */
1276  UInt16 numPatches; /* The number of patches */
1277  PatchDescriptor thePatch[1]; /* An array with one patch */
1278  /* per element */
1279  };
1280  typedef struct PatchList PatchList;
1281  /* signature of a Patch entry point*/
1282  typedef CALLBACK_API(OSErr, PatchEntryPoint)(PatchDescriptor *myPatch,
1284 
1285  /* Command Descriptor Block structure */
1286  union CDB
1287  {
1288  BytePtr cdbPtr; /* pointer to the CDB, or */
1289  UInt8 cdbBytes[16]; /* the actual CDB to send */
1290  };
1291  typedef union CDB CDB;
1292  typedef CDB *CDBPtr;
1293  /* Scatter/gather list element (Deprecated for MacOS8) */
1294  struct SGRecord
1295  {
1296  Ptr SGAddr;
1297  UInt32 SGCount;
1298  };
1299  typedef struct SGRecord SGRecord;
1300 
1301 #define SCSIPBHdr \
1302  struct SCSIHdr *qLink; \
1303  short scsiReserved1; \
1304  UInt16 scsiPBLength; \
1305  UInt8 scsiFunctionCode; \
1306  UInt8 scsiReserved2; \
1307  volatile OSErr scsiResult; \
1308  DeviceIdent scsiDevice; \
1309  SCSICallbackUPP scsiCompletion; \
1310  UInt32 scsiFlags; \
1311  UInt8 *scsiDriverStorage; \
1312  Ptr scsiXPTprivate; \
1313  long scsiReserved3;
1314 
1315  struct SCSIHdr
1316  {
1317  struct SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1318  short scsiReserved1; /* -> reserved for input */
1319  UInt16 scsiPBLength; /* -> Length of the entire PB */
1320  UInt8 scsiFunctionCode; /* -> function selector */
1321  UInt8 scsiReserved2; /* <- reserved for output */
1322  volatile OSErr scsiResult; /* <- Returned result */
1323  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1324  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1325  UInt32 scsiFlags; /* -> assorted flags */
1326  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1327  Ptr scsiXPTprivate; /* private field for use in XPT */
1328  long scsiReserved3; /* reserved */
1329  };
1330  typedef struct SCSIHdr SCSIHdr;
1331  struct SCSI_PB
1332  {
1333  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1334  short scsiReserved1; /* -> reserved for input */
1335  UInt16 scsiPBLength; /* -> Length of the entire PB */
1336  UInt8 scsiFunctionCode; /* -> function selector */
1337  UInt8 scsiReserved2; /* <- reserved for output */
1338  volatile OSErr scsiResult; /* <- Returned result */
1339  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1340  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1341  UInt32 scsiFlags; /* -> assorted flags */
1342  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1343  Ptr scsiXPTprivate; /* private field for use in XPT */
1344  long scsiReserved3; /* reserved */
1345  };
1346  typedef struct SCSI_PB SCSI_PB;
1347  struct SCSI_IO
1348  {
1349  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1350  short scsiReserved1; /* -> reserved for input */
1351  UInt16 scsiPBLength; /* -> Length of the entire PB */
1352  UInt8 scsiFunctionCode; /* -> function selector */
1353  UInt8 scsiReserved2; /* <- reserved for output */
1354  volatile OSErr scsiResult; /* <- Returned result */
1355  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1356  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1357  UInt32 scsiFlags; /* -> assorted flags */
1358  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1359  Ptr scsiXPTprivate; /* private field for use in XPT */
1360  long scsiReserved3; /* reserved */
1361 
1362  UInt16 scsiResultFlags; /* <- Flags which modify the scsiResult field */
1363  UInt16 scsiReserved3pt5; /* -> Reserved */
1364  BytePtr scsiDataPtr; /* -> Pointer to the data buffer or the S/G list */
1365  UInt32 scsiDataLength; /* -> Data transfer length */
1366  BytePtr scsiSensePtr; /* -> Ptr to autosense data buffer */
1367  UInt8 scsiSenseLength; /* -> size of the autosense buffer */
1368  UInt8 scsiCDBLength; /* -> Number of bytes for the CDB */
1369  UInt16 scsiSGListCount; /* -> num of scatter gather list entries */
1370  UInt32 scsiReserved4; /* <- reserved for output */
1371  UInt8 scsiSCSIstatus; /* <- Returned scsi device status */
1372  SInt8 scsiSenseResidual; /* <- Autosense residual length */
1373  UInt16 scsiReserved5; /* <- reserved for output */
1374  long scsiDataResidual; /* <- Returned Transfer residual length */
1375  CDB scsiCDB; /* -> Actual CDB or pointer to CDB */
1376  long scsiTimeout; /* -> Timeout value (Time Mgr format) (CAM timeout) */
1377  BytePtr scsiReserved5pt5; /* -> Reserved */
1378  UInt16 scsiReserved5pt6; /* -> Reserved */
1379  UInt16 scsiIOFlags; /* -> additional I/O flags */
1380  UInt8 scsiTagAction; /* -> What to do for tag queuing */
1381  UInt8 scsiReserved6; /* -> reserved for input */
1382  UInt16 scsiReserved7; /* -> reserved for input */
1383  UInt16 scsiSelectTimeout; /* -> Select timeout value */
1384  UInt8 scsiDataType; /* -> Data description type (i.e. buffer, TIB, S/G) */
1385  UInt8 scsiTransferType; /* -> Transfer type (i.e. Blind vs Polled) */
1386  UInt32 scsiReserved8; /* -> reserved for input */
1387  UInt32 scsiReserved9; /* -> reserved for input */
1388  UInt16 scsiHandshake[8]; /* -> handshaking points (null term'd) */
1389  UInt32 scsiReserved10; /* -> reserved for input */
1390  UInt32 scsiReserved11; /* -> reserved for input */
1391  struct SCSI_IO
1392  *scsiCommandLink; /* -> Ptr to the next PB in linked cmd chain */
1393 
1394  UInt8 scsiSIMpublics[8]; /* -> reserved for input to 3rd-party SIMs */
1395  UInt8 scsiAppleReserved6[8]; /* -> reserved for input */
1396 
1397  /* XPT layer privates (for old-API emulation) */
1398 
1399  UInt16 scsiCurrentPhase; /* <- phase upon completing old call */
1400  short scsiSelector; /* -> selector specified in old calls */
1401  OSErr scsiOldCallResult; /* <- result of old call */
1402  UInt8 scsiSCSImessage; /* <- Returned scsi device message (for SCSIComplete)*/
1403  UInt8 XPTprivateFlags; /* <> various flags */
1404  UInt8 XPTextras[12]; /* */
1405  };
1406  typedef struct SCSI_IO SCSI_IO;
1407  typedef SCSI_IO SCSIExecIOPB;
1408  /* Bus inquiry PB */
1410  {
1411  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1412  short scsiReserved1; /* -> reserved for input */
1413  UInt16 scsiPBLength; /* -> Length of the entire PB */
1414  UInt8 scsiFunctionCode; /* -> function selector */
1415  UInt8 scsiReserved2; /* <- reserved for output */
1416  volatile OSErr scsiResult; /* <- Returned result */
1417  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1418  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1419  UInt32 scsiFlags; /* -> assorted flags */
1420  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1421  Ptr scsiXPTprivate; /* private field for use in XPT */
1422  long scsiReserved3; /* reserved */
1423 
1424  UInt16 scsiEngineCount; /* <- Number of engines on HBA */
1425  UInt16 scsiMaxTransferType; /* <- Number of transfer types for this HBA */
1426 
1427  UInt32 scsiDataTypes; /* <- which data types are supported by this SIM */
1428 
1429  UInt16 scsiIOpbSize; /* <- Size of SCSI_IO PB for this SIM/HBA */
1430  UInt16 scsiMaxIOpbSize; /* <- Size of max SCSI_IO PB for all SIM/HBAs */
1431 
1432  UInt32 scsiFeatureFlags; /* <- Supported features flags field */
1433 
1434  UInt8 scsiVersionNumber; /* <- Version number for the SIM/HBA */
1435  UInt8 scsiHBAInquiry; /* <- Mimic of INQ byte 7 for the HBA */
1436  UInt8 scsiTargetModeFlags; /* <- Flags for target mode support */
1437  UInt8 scsiScanFlags; /* <- Scan related feature flags */
1438 
1439  UInt32 scsiSIMPrivatesPtr; /* <- Ptr to SIM private data area */
1440  UInt32 scsiSIMPrivatesSize; /* <- Size of SIM private data area */
1441  UInt32 scsiAsyncFlags; /* <- Event cap. for Async Callback */
1442 
1443  UInt8 scsiHiBusID; /* <- Highest path ID in the subsystem */
1444  UInt8 scsiInitiatorID; /* <- ID of the HBA on the SCSI bus */
1445  UInt16 scsiBIReserved0; /* */
1446 
1447  UInt32 scsiBIReserved1; /* <- */
1448  UInt32 scsiFlagsSupported; /* <- which scsiFlags are supported */
1449 
1450  UInt16 scsiIOFlagsSupported; /* <- which scsiIOFlags are supported */
1451  UInt16 scsiWeirdStuff; /* <- */
1452  UInt16 scsiMaxTarget; /* <- maximum Target number supported */
1453  UInt16 scsiMaxLUN; /* <- maximum Logical Unit number supported */
1454 
1455  char scsiSIMVendor[16]; /* <- Vendor ID of SIM (or XPT if bus<FF) */
1456  char scsiHBAVendor[16]; /* <- Vendor ID of the HBA */
1457  char scsiControllerFamily[16]; /* <- Family of SCSI Controller */
1458  char scsiControllerType[16]; /* <- Specific Model of SCSI Controller used */
1459 
1460  char scsiXPTversion[4]; /* <- version number of XPT */
1461  char scsiSIMversion[4]; /* <- version number of SIM */
1462  char scsiHBAversion[4]; /* <- version number of HBA */
1463 
1464  UInt8 scsiHBAslotType; /* <- type of "slot" that this HBA is in */
1465  UInt8 scsiHBAslotNumber; /* <- slot number of this HBA */
1466  UInt16 scsiSIMsRsrcID; /* <- resource ID of this SIM */
1467 
1468  UInt16 scsiBIReserved3; /* <- */
1469  UInt16 scsiAdditionalLength; /* <- additional BusInquiry PB len */
1470  };
1471  typedef struct SCSIBusInquiryPB SCSIBusInquiryPB;
1472  /* Abort SIM Request PB */
1474  {
1475  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1476  short scsiReserved1; /* -> reserved for input */
1477  UInt16 scsiPBLength; /* -> Length of the entire PB */
1478  UInt8 scsiFunctionCode; /* -> function selector */
1479  UInt8 scsiReserved2; /* <- reserved for output */
1480  volatile OSErr scsiResult; /* <- Returned result */
1481  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1482  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1483  UInt32 scsiFlags; /* -> assorted flags */
1484  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1485  Ptr scsiXPTprivate; /* private field for use in XPT */
1486  long scsiReserved3; /* reserved */
1487  SCSI_IO *scsiIOptr; /* Pointer to the PB to abort */
1488  };
1489  typedef struct SCSIAbortCommandPB SCSIAbortCommandPB;
1490  /* Terminate I/O Process Request PB */
1492  {
1493  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1494  short scsiReserved1; /* -> reserved for input */
1495  UInt16 scsiPBLength; /* -> Length of the entire PB */
1496  UInt8 scsiFunctionCode; /* -> function selector */
1497  UInt8 scsiReserved2; /* <- reserved for output */
1498  volatile OSErr scsiResult; /* <- Returned result */
1499  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1500  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1501  UInt32 scsiFlags; /* -> assorted flags */
1502  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1503  Ptr scsiXPTprivate; /* private field for use in XPT */
1504  long scsiReserved3; /* reserved */
1505  SCSI_IO *scsiIOptr; /* Pointer to the PB to terminate */
1506  };
1507  typedef struct SCSITerminateIOPB SCSITerminateIOPB;
1508  /* Reset SCSI Bus PB */
1510  {
1511  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1512  short scsiReserved1; /* -> reserved for input */
1513  UInt16 scsiPBLength; /* -> Length of the entire PB */
1514  UInt8 scsiFunctionCode; /* -> function selector */
1515  UInt8 scsiReserved2; /* <- reserved for output */
1516  volatile OSErr scsiResult; /* <- Returned result */
1517  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1518  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1519  UInt32 scsiFlags; /* -> assorted flags */
1520  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1521  Ptr scsiXPTprivate; /* private field for use in XPT */
1522  long scsiReserved3; /* reserved */
1523  };
1524  typedef struct SCSIResetBusPB SCSIResetBusPB;
1525  /* Reset SCSI Device PB */
1527  {
1528  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1529  short scsiReserved1; /* -> reserved for input */
1530  UInt16 scsiPBLength; /* -> Length of the entire PB */
1531  UInt8 scsiFunctionCode; /* -> function selector */
1532  UInt8 scsiReserved2; /* <- reserved for output */
1533  volatile OSErr scsiResult; /* <- Returned result */
1534  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1535  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1536  UInt32 scsiFlags; /* -> assorted flags */
1537  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1538  Ptr scsiXPTprivate; /* private field for use in XPT */
1539  long scsiReserved3; /* reserved */
1540  };
1541  typedef struct SCSIResetDevicePB SCSIResetDevicePB;
1542  /* Release SIM Queue PB */
1544  {
1545  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1546  short scsiReserved1; /* -> reserved for input */
1547  UInt16 scsiPBLength; /* -> Length of the entire PB */
1548  UInt8 scsiFunctionCode; /* -> function selector */
1549  UInt8 scsiReserved2; /* <- reserved for output */
1550  volatile OSErr scsiResult; /* <- Returned result */
1551  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1552  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1553  UInt32 scsiFlags; /* -> assorted flags */
1554  BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
1555  Ptr scsiXPTprivate; /* private field for use in XPT */
1556  long scsiReserved3; /* reserved */
1557  };
1558  typedef struct SCSIReleaseQPB SCSIReleaseQPB;
1559  /* SCSI Get Virtual ID Info PB */
1561  {
1562  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1563  short scsiReserved1; /* -> reserved for input */
1564  UInt16 scsiPBLength; /* -> Length of the entire PB */
1565  UInt8 scsiFunctionCode; /* -> function selector */
1566  UInt8 scsiReserved2; /* <- reserved for output */
1567  volatile OSErr scsiResult; /* <- Returned result */
1568  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1569  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1570  UInt32 scsiFlags; /* -> assorted flags */
1571  Ptr scsiDriverStorage; /* <> Ptr for driver private use */
1572  Ptr scsiXPTprivate; /* private field for use in XPT */
1573  long scsiReserved3; /* reserved */
1574  UInt16 scsiOldCallID; /* -> SCSI ID of device in question */
1575  Boolean scsiExists; /* <- true if device exists */
1576  SInt8 filler;
1577  };
1579  /* Create/Lookup/Remove RefNum for Device PB */
1581  {
1582  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1583  short scsiReserved1; /* -> reserved for input */
1584  UInt16 scsiPBLength; /* -> Length of the entire PB */
1585  UInt8 scsiFunctionCode; /* -> function selector */
1586  UInt8 scsiReserved2; /* <- reserved for output */
1587  volatile OSErr scsiResult; /* <- Returned result */
1588  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1589  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1590  UInt32 scsiFlags; /* -> assorted flags */
1591  Ptr scsiDriverStorage; /* <> Ptr for driver private use */
1592  Ptr scsiXPTprivate; /* private field for use in XPT */
1593  long scsiReserved3; /* reserved */
1594  short scsiDriver; /* -> DriverRefNum, For SetDriver, <- For GetNextDriver */
1595  UInt16 scsiDriverFlags; /* <> Details of driver/device */
1596  DeviceIdent scsiNextDevice; /* <- DeviceIdent of the NEXT Item in the list */
1597  };
1598  typedef struct SCSIDriverPB SCSIDriverPB;
1599  /* Load Driver PB */
1601  {
1602  SCSIHdr *qLink; /* (internal use, must be nil on entry) */
1603  short scsiReserved1; /* -> reserved for input */
1604  UInt16 scsiPBLength; /* -> Length of the entire PB */
1605  UInt8 scsiFunctionCode; /* -> function selector */
1606  UInt8 scsiReserved2; /* <- reserved for output */
1607  volatile OSErr scsiResult; /* <- Returned result */
1608  DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
1609  SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
1610  UInt32 scsiFlags; /* -> assorted flags */
1611  Ptr scsiDriverStorage; /* <> Ptr for driver private use */
1612  Ptr scsiXPTprivate; /* private field for use in XPT */
1613  long scsiReserved3; /* reserved */
1614  short scsiLoadedRefNum; /* <- SIM returns refnum of driver */
1615  Boolean
1616  scsiDiskLoadFailed; /* -> if true, indicates call after failure to load */
1617  SInt8 filler;
1618  };
1619  typedef struct SCSILoadDriverPB SCSILoadDriverPB;
1620 
1621  /* Defines for the scsiTransferType field */
1622  enum
1623  {
1624  scsiTransferBlind = 0,
1625  scsiTransferPolled = 1
1626  };
1627 
1628  enum
1629  {
1630  scsiErrorBase = -7936
1631  };
1632 
1633  enum
1634  {
1635  scsiRequestInProgress = 1, /* 1 = PB request is in progress */
1636  /* Execution failed 00-2F */
1637  scsiRequestAborted =
1638  scsiErrorBase + 2, /* -7934 = PB request aborted by the host */
1639  scsiUnableToAbort =
1640  scsiErrorBase + 3, /* -7933 = Unable to Abort PB request */
1641  scsiNonZeroStatus =
1642  scsiErrorBase + 4, /* -7932 = PB request completed with an err */
1643  scsiUnused05 = scsiErrorBase + 5, /* -7931 = */
1644  scsiUnused06 = scsiErrorBase + 6, /* -7930 = */
1645  scsiUnused07 = scsiErrorBase + 7, /* -7929 = */
1646  scsiUnused08 = scsiErrorBase + 8, /* -7928 = */
1647  scsiUnableToTerminate =
1648  scsiErrorBase + 9, /* -7927 = Unable to Terminate I/O PB req */
1649  scsiSelectTimeout = scsiErrorBase + 10, /* -7926 = Target selection timeout */
1650  scsiCommandTimeout = scsiErrorBase + 11, /* -7925 = Command timeout */
1651  scsiIdentifyMessageRejected = scsiErrorBase + 12, /* -7924 = */
1652  scsiMessageRejectReceived =
1653  scsiErrorBase + 13, /* -7923 = Message reject received */
1654  scsiSCSIBusReset =
1655  scsiErrorBase + 14, /* -7922 = SCSI bus reset sent/received */
1656  scsiParityError =
1657  scsiErrorBase + 15, /* -7921 = Uncorrectable parity error occured */
1658  scsiAutosenseFailed =
1659  scsiErrorBase + 16, /* -7920 = Autosense: Request sense cmd fail */
1660  scsiUnused11 = scsiErrorBase + 17, /* -7919 = */
1661  scsiDataRunError =
1662  scsiErrorBase + 18, /* -7918 = Data overrun/underrun error */
1663  scsiUnexpectedBusFree = scsiErrorBase + 19, /* -7917 = Unexpected BUS free */
1664  scsiSequenceFailed =
1665  scsiErrorBase + 20, /* -7916 = Target bus phase sequence failure */
1666  scsiWrongDirection =
1667  scsiErrorBase + 21, /* -7915 = Data phase was in wrong direction */
1668  scsiUnused16 = scsiErrorBase + 22, /* -7914 = */
1669  scsiBDRsent =
1670  scsiErrorBase + 23, /* -7913 = A SCSI BDR msg was sent to target */
1671  scsiTerminated =
1672  scsiErrorBase + 24, /* -7912 = PB request terminated by the host */
1673  scsiNoNexus = scsiErrorBase + 25, /* -7911 = Nexus is not established */
1674  scsiCDBReceived =
1675  scsiErrorBase + 26, /* -7910 = The SCSI CDB has been received */
1676  /* Couldn't begin execution 30-3F */
1677  scsiTooManyBuses =
1678  scsiErrorBase + 48, /* -7888 = Register failed because we're full */
1679  scsiBusy = scsiErrorBase + 49, /* -7887 = SCSI subsystem is busy */
1680  scsiProvideFail =
1681  scsiErrorBase + 50, /* -7886 = Unable to provide requ. capability */
1682  scsiDeviceNotThere =
1683  scsiErrorBase + 51, /* -7885 = SCSI device not installed/there */
1684  scsiNoHBA = scsiErrorBase + 52, /* -7884 = No HBA detected Error */
1685  scsiDeviceConflict =
1686  scsiErrorBase + 53, /* -7883 = sorry, max 1 refNum per DeviceIdent */
1687  scsiNoSuchXref = scsiErrorBase + 54, /* -7882 = no such RefNum xref */
1688  scsiQLinkInvalid =
1689  scsiErrorBase + 55, /* -7881 = pre-linked PBs not supported */
1690  /* (The QLink field was nonzero) */
1691  /* Parameter errors 40-7F */
1692  scsiPBLengthError =
1693  scsiErrorBase + 64, /* -7872 = (scsiPBLength is insuf'ct/invalid */
1694  scsiFunctionNotAvailable =
1695  scsiErrorBase + 65, /* -7871 = The requ. func is not available */
1696  scsiRequestInvalid = scsiErrorBase + 66, /* -7870 = PB request is invalid */
1697  scsiBusInvalid = scsiErrorBase + 67, /* -7869 = Bus ID supplied is invalid */
1698  scsiTIDInvalid =
1699  scsiErrorBase + 68, /* -7868 = Target ID supplied is invalid */
1700  scsiLUNInvalid = scsiErrorBase + 69, /* -7867 = LUN supplied is invalid */
1701  scsiIDInvalid = scsiErrorBase + 70, /* -7866 = The initiator ID is invalid */
1702  scsiDataTypeInvalid =
1703  scsiErrorBase + 71, /* -7865 = scsiDataType requested not supported */
1704  scsiTransferTypeInvalid =
1705  scsiErrorBase + 72, /* -7864 = scsiTransferType field is too high */
1706  scsiCDBLengthInvalid =
1707  scsiErrorBase + 73 /* -7863 = scsiCDBLength field is too big */
1708  };
1709 
1710  /* New errors for SCSI Family */
1711  enum
1712  {
1713  scsiUnused74 = scsiErrorBase + 74, /* -7862 = */
1714  scsiUnused75 = scsiErrorBase + 75, /* -7861 = */
1715  scsiBadDataLength = scsiErrorBase + 76, /* -7860 = a zero data length in PB */
1716  scsiPartialPrepared =
1717  scsiErrorBase + 77, /* -7859 = could not do full prepare mem for I/O*/
1718  scsiInvalidMsgType =
1719  scsiErrorBase + 78, /* -7858 = Invalid message type (internal) */
1720  scsiUnused79 = scsiErrorBase + 79, /* -7857 = */
1721  scsiBadConnID = scsiErrorBase + 80, /* -7856 = Bad Connection ID */
1722  scsiUnused81 = scsiErrorBase + 81, /* -7855 = */
1723  scsiIOInProgress =
1724  scsiErrorBase + 82, /* -7854 = Can't close conn, IO in prog */
1725  scsiTargetReserved = scsiErrorBase + 83, /* -7853 = Target already reserved */
1726  scsiUnused84 = scsiErrorBase + 84, /* -7852 = */
1727  scsiUnused85 = scsiErrorBase + 85, /* -7851 = */
1728  scsiBadConnType = scsiErrorBase + 86, /* -7850 = Bad connection type */
1729  scsiCannotLoadPlugin =
1730  scsiErrorBase + 87 /* -7849 = No matching service category */
1731  };
1732 
1733  /* +++ */
1753  enum
1754  {
1755  scsiFamilyInternalError =
1756  scsiErrorBase + 87, /* -7849 = Internal consistency check failed */
1757  scsiPluginInternalError =
1758  scsiErrorBase + 88, /* -7848 = Internal consistency check failed */
1759  scsiVendorSpecificErrorBase =
1760  scsiErrorBase + 128, /* ?? = Start of third-party error range */
1761  scsiVendorSpecificErrorCount = 16 /* Number of third-party errors */
1762  };
1763 
1764  /* --- */
1765  enum
1766  {
1767  scsiExecutionErrors = scsiErrorBase,
1768  scsiNotExecutedErrors = scsiTooManyBuses,
1769  scsiParameterErrors = scsiPBLengthError
1770  };
1771 
1772  /* Defines for the scsiResultFlags field */
1773  enum
1774  {
1775  scsiSIMQFrozen = 0x0001, /* The SIM queue is frozen w/this err */
1776  scsiAutosenseValid = 0x0002, /* Autosense data valid for target */
1777  scsiBusNotFree = 0x0004 /* At time of callback, SCSI bus is not free */
1778  };
1779 
1780  /* Defines for the bit numbers of the scsiFlags field in the PB header for the
1781  * SCSIExecIO function */
1782  enum
1783  {
1784  kbSCSIDisableAutosense = 29, /* Disable auto sense feature */
1785  kbSCSIFlagReservedA = 28, /* */
1786  kbSCSIFlagReserved0 = 27, /* */
1787  kbSCSICDBLinked = 26, /* The PB contains a linked CDB */
1788  kbSCSIQEnable = 25, /* Target queue actions are enabled */
1789  kbSCSICDBIsPointer = 24, /* The CDB field contains a pointer */
1790  kbSCSIFlagReserved1 = 23, /* */
1791  kbSCSIInitiateSyncData = 22, /* Attempt Sync data xfer and SDTR */
1792  kbSCSIDisableSyncData = 21, /* Disable sync, go to async */
1793  kbSCSISIMQHead = 20, /* Place PB at the head of SIM Q */
1794  kbSCSISIMQFreeze = 19, /* Return the SIM Q to frozen state */
1795  kbSCSISIMQNoFreeze = 18, /* Disallow SIM Q freezing */
1796  kbSCSIDoDisconnect = 17, /* Definitely do disconnect */
1797  kbSCSIDontDisconnect = 16, /* Definitely don't disconnect */
1798  kbSCSIDataReadyForDMA = 15, /* Data buffer(s) are ready for DMA */
1799  kbSCSIFlagReserved3 = 14, /* */
1800  kbSCSIDataPhysical = 13, /* SG/Buffer data ptrs are physical */
1801  kbSCSISensePhysical = 12, /* Autosense buffer ptr is physical */
1802  kbSCSIFlagReserved5 = 11, /* */
1803  kbSCSIFlagReserved6 = 10, /* */
1804  kbSCSIFlagReserved7 = 9, /* */
1805  kbSCSIFlagReserved8 = 8, /* */
1806  kbSCSIDataBufferValid = 7, /* Data buffer valid */
1807  kbSCSIStatusBufferValid = 6, /* Status buffer valid */
1808  kbSCSIMessageBufferValid = 5, /* Message buffer valid */
1809  kbSCSIFlagReserved9 = 4 /* */
1810  };
1811 
1812  /* Defines for the bit masks of the scsiFlags field */
1813  enum
1814  {
1815  scsiDirectionMask = (long)0xC0000000, /* Data direction mask */
1816  scsiDirectionNone = (long)0xC0000000, /* Data direction (11: no data) */
1817  scsiDirectionReserved = 0x00000000, /* Data direction (00: reserved) */
1818  scsiDirectionOut = (long)0x80000000, /* Data direction (10: DATA OUT) */
1819  scsiDirectionIn = 0x40000000, /* Data direction (01: DATA IN) */
1820  scsiDisableAutosense = 0x20000000, /* Disable auto sense feature */
1821  scsiFlagReservedA = 0x10000000, /* */
1822  scsiFlagReserved0 = 0x08000000, /* */
1823  scsiCDBLinked = 0x04000000, /* The PB contains a linked CDB */
1824  scsiQEnable = 0x02000000, /* Target queue actions are enabled */
1825  scsiCDBIsPointer = 0x01000000, /* The CDB field contains a pointer */
1826  scsiFlagReserved1 = 0x00800000, /* */
1827  scsiInitiateSyncData = 0x00400000, /* Attempt Sync data xfer and SDTR */
1828  scsiDisableSyncData = 0x00200000, /* Disable sync, go to async */
1829  scsiSIMQHead = 0x00100000, /* Place PB at the head of SIM Q */
1830  scsiSIMQFreeze = 0x00080000, /* Return the SIM Q to frozen state */
1831  scsiSIMQNoFreeze = 0x00040000, /* Disallow SIM Q freezing */
1832  scsiDoDisconnect = 0x00020000, /* Definitely do disconnect */
1833  scsiDontDisconnect = 0x00010000, /* Definitely don't disconnect */
1834  scsiDataReadyForDMA = 0x00008000, /* Data buffer(s) are ready for DMA */
1835  scsiFlagReserved3 = 0x00004000, /* */
1836  scsiDataPhysical = 0x00002000, /* SG/Buffer data ptrs are physical */
1837  scsiSensePhysical = 0x00001000, /* Autosense buffer ptr is physical */
1838  scsiFlagReserved5 = 0x00000800, /* */
1839  scsiFlagReserved6 = 0x00000400, /* */
1840  scsiFlagReserved7 = 0x00000200, /* */
1841  scsiFlagReserved8 = 0x00000100 /* */
1842  };
1843 
1844  /* bit masks for the scsiIOFlags field in SCSIExecIOPB */
1845  enum
1846  {
1847  scsiNoParityCheck = 0x0002, /* disable parity checking */
1848  scsiDisableSelectWAtn = 0x0004, /* disable select w/Atn */
1849  scsiSavePtrOnDisconnect = 0x0008, /* do SaveDataPointer upon Disconnect msg */
1850  scsiNoBucketIn = 0x0010, /* don�t bit bucket in during this I/O */
1851  scsiNoBucketOut = 0x0020, /* don�t bit bucket out during this I/O */
1852  scsiDisableWide = 0x0040, /* disable wide transfer negotiation */
1853  scsiInitiateWide = 0x0080, /* initiate wide transfer negotiation */
1854  scsiRenegotiateSense =
1855  0x0100, /* renegotiate sync/wide before issuing autosense */
1856  scsiDisableDiscipline =
1857  0x0200, /* disable parameter checking on SCSIExecIO calls */
1858  scsiIOFlagReserved0080 = 0x0080, /* */
1859  scsiIOFlagReserved8000 = 0x8000 /* */
1860  };
1861 
1862  /* Defines for the Bus Inquiry PB fields. */
1863  /* scsiHBAInquiry field bits */
1864  enum
1865  {
1866  scsiBusMDP = 0x80, /* Supports Modify Data Pointer message */
1867  scsiBusWide32 = 0x40, /* Supports 32 bit wide SCSI */
1868  scsiBusWide16 = 0x20, /* Supports 16 bit wide SCSI */
1869  scsiBusSDTR = 0x10, /* Supports Sync Data Transfer Req message */
1870  scsiBusLinkedCDB = 0x08, /* Supports linked CDBs */
1871  scsiBusTagQ = 0x02, /* Supports tag queue message */
1872  scsiBusSoftReset = 0x01 /* Supports soft reset */
1873  };
1874 
1875  /* Defines for the scsiDataType field */
1876  enum
1877  {
1878  scsiDataBuffer = 0, /* single contiguous buffer supplied */
1879  scsiDataTIB = 1, /* TIB supplied (ptr in scsiDataPtr) */
1880  scsiDataSG = 2, /* scatter/gather list supplied */
1881  scsiDataIOTable = 3 /*#(7/11/95) Prepared by Block Storage */
1882  };
1883 
1884  /* scsiDataTypes field bits */
1885  /* bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved */
1886  enum
1887  {
1888  scsiBusDataTIB = (1 << scsiDataTIB), /* TIB supplied (ptr in scsiDataPtr) */
1889  scsiBusDataBuffer =
1890  (1 << scsiDataBuffer), /* single contiguous buffer supplied */
1891  scsiBusDataSG = (1 << scsiDataSG), /* scatter/gather list supplied */
1892  scsiBusDataIOTable =
1893  (1 << scsiDataIOTable), /* (2/6/95) Prepare Memory for IO*/
1894  scsiBusDataReserved = (long)0x80000000 /* */
1895  };
1896 
1897  /* scsiScanFlags field bits */
1898  enum
1899  {
1900  scsiBusScansDevices = 0x80, /* Bus scans for and maintains device list */
1901  scsiBusScansOnInit = 0x40, /* Bus scans performed at power-up/reboot */
1902  scsiBusLoadsROMDrivers = 0x20 /* may load ROM drivers to support targets */
1903  };
1904 
1905  /* scsiFeatureFlags field bits */
1906  enum
1907  {
1908  scsiBusUltra4SCSI = 0x00000800, /* HBA supports Ultra4(Ultra320) SCSI */
1909  scsiBusLVD = 0x00000400, /* HBA is Low Voltage Differential Bus */
1910  scsiBusUltra3SCSI = 0x00000200, /* HBA supports Ultra3 SCSI */
1911  scsiBusUltra2SCSI = 0x00000100, /* HBA supports Ultra2 SCSI */
1912  scsiBusInternalExternalMask = 0x000000C0, /* bus internal/external mask */
1913  scsiBusInternalExternalUnknown =
1914  0x00000000, /* not known whether bus is inside or outside */
1915  scsiBusInternalExternal =
1916  0x000000C0, /* bus goes inside and outside the box */
1917  scsiBusInternal = 0x00000080, /* bus goes inside the box */
1918  scsiBusExternal = 0x00000040, /* bus goes outside the box */
1919  scsiBusCacheCoherentDMA = 0x00000020, /* DMA is cache coherent */
1920  scsiBusOldCallCapable = 0x00000010, /* SIM is old call capable */
1921  scsiBusUltraSCSI = 0x00000008, /* HBA supports Ultra SCSI */
1922  scsiBusDifferential = 0x00000004, /* Single Ended (0) or Differential (1) */
1923  scsiBusFastSCSI = 0x00000002, /* HBA supports fast SCSI */
1924  scsiBusDMAavailable = 0x00000001 /* DMA is available */
1925  };
1926 
1927  /* scsiWeirdStuff field bits */
1928  enum
1929  {
1930  scsiOddDisconnectUnsafeRead1 =
1931  0x0001, /* Disconnects on odd byte boundries are unsafe with DMA and/or
1932  blind reads */
1933  scsiOddDisconnectUnsafeWrite1 =
1934  0x0002, /* Disconnects on odd byte boundries are unsafe with DMA and/or
1935  blind writes */
1936  scsiBusErrorsUnsafe = 0x0004, /* Non-handshaked delays or disconnects during
1937  blind transfers may cause a crash */
1938  scsiRequiresHandshake =
1939  0x0008, /* Non-handshaked delays or disconnects during blind transfers may
1940  cause data corruption */
1941  scsiTargetDrivenSDTRSafe = 0x0010, /* Targets which initiate synchronous
1942  negotiations are supported */
1943  scsiOddCountForPhysicalUnsafe =
1944  0x0020, /* If using physical addrs all counts must be even, and
1945  disconnects must be on even boundries */
1946  scsiAbortCmdFixed =
1947  0x0040, /* Set if abort command is fixed to properly make callbacks */
1948  scsiMeshACKTimingFixed =
1949  0x0080 /* Set if bug allowing Mesh to release ACK prematurely is fixed */
1950  };
1951 
1952  /* scsiHBAslotType values */
1953  enum
1954  {
1955  scsiMotherboardBus = 0x00, /* A built in Apple supplied bus */
1956  scsiNuBus = 0x01, /* A SIM on a NuBus card */
1957  scsiPDSBus = 0x03, /* " on a PDS card */
1958  scsiPCIBus = 0x04, /* " on a PCI bus card */
1959  scsiPCMCIABus = 0x05, /* " on a PCMCIA card */
1960  scsiFireWireBridgeBus = 0x06, /* " connected through a FireWire bridge */
1961  scsiUSBBus = 0x07 /* " connected on a USB bus */
1962  };
1963 
1964  /* Defines for the scsiDriverFlags field (in SCSIDriverPB) */
1965  enum
1966  {
1967  scsiDeviceSensitive = 0x0001, /* Only driver should access this device */
1968  scsiDeviceNoOldCallAccess = 0x0002 /* no old call access to this device */
1969  };
1970 
1971  /* SIMInitInfo PB */
1972  /* directions are for SCSIRegisterBus call ( -> parm, <- result) */
1974  {
1975  Ptr SIMstaticPtr; /* <- alloc. ptr to the SIM's static vars */
1976  long staticSize; /* -> num bytes SIM needs for static vars */
1977  SIMInitUPP SIMInit; /* -> pointer to the SIM init routine */
1978  SIMActionUPP SIMAction; /* -> pointer to the SIM action routine */
1979  SCSIInterruptUPP SIM_ISR; /* reserved */
1980  SCSIInterruptUPP
1981  SIMInterruptPoll; /* -> pointer to the SIM interrupt poll routine */
1982  SIMActionUPP NewOldCall; /* -> pointer to the SIM NewOldCall routine */
1983  UInt16 ioPBSize; /* -> size of SCSI_IO_PBs required for this SIM */
1984  Boolean oldCallCapable; /* -> true if this SIM can handle old-API calls */
1985  UInt8 simInfoUnused1; /* reserved */
1986  long simInternalUse; /* xx not affected or viewed by XPT */
1987  SCSIUPP XPT_ISR; /* reserved */
1988  SCSIUPP EnteringSIM; /* <- ptr to the EnteringSIM routine */
1989  SCSIUPP ExitingSIM; /* <- ptr to the ExitingSIM routine */
1990  SCSIMakeCallbackUPP
1991  MakeCallback; /* <- the XPT layer�s SCSIMakeCallback routine */
1992  UInt16 busID; /* <- bus number for the registered bus */
1993  UInt8 simSlotNumber; /* <- Magic cookie to place in scsiHBASlotNumber (PCI) */
1994  UInt8 simSRsrcID; /* <- Magic cookie to place in scsiSIMsRsrcID (PCI) */
1995  Ptr simRegEntry; /* -> The SIM's RegEntryIDPtr (PCI) */
1996  };
1997  typedef struct SIMInitInfo SIMInitInfo;
1998  /* Glue between SCSI calls and SCSITrap format */
1999  enum
2000  {
2001  xptSCSIAction = 0x0001,
2002  xptSCSIRegisterBus = 0x0002,
2003  xptSCSIDeregisterBus = 0x0003,
2004  xptSCSIReregisterBus = 0x0004,
2005  xptSCSIKillXPT = 0x0005, /* kills Mini-XPT after transition */
2006  xptSCSIInitialize = 0x000A /* Initialize the SCSI manager */
2007  };
2008 
2015  enum
2016  {
2017  scsiStatGood = 0x00, /* Good Status*/
2018  scsiStatCheckCondition = 0x02, /* Check Condition*/
2019  scsiStatConditionMet = 0x04, /* Condition Met*/
2020  scsiStatBusy = 0x08, /* Busy*/
2021  scsiStatIntermediate = 0x10, /* Intermediate*/
2022  scsiStatIntermedMet = 0x14, /* Intermediate - Condition Met*/
2023  scsiStatResvConflict = 0x18, /* Reservation conflict*/
2024  scsiStatTerminated = 0x22, /* Command terminated*/
2025  scsiStatQFull = 0x28 /* Queue full*/
2026  };
2027 
2028  /* SCSI messages*/
2029  enum
2030  {
2031  kCmdCompleteMsg = 0,
2032  kExtendedMsg = 1, /* 0x01*/
2033  kSaveDataPointerMsg = 2, /* 0x02*/
2034  kRestorePointersMsg = 3, /* 0x03*/
2035  kDisconnectMsg = 4, /* 0x04*/
2036  kInitiatorDetectedErrorMsg = 5, /* 0x05*/
2037  kAbortMsg = 6, /* 0x06*/
2038  kMsgRejectMsg = 7, /* 0x07*/
2039  kNoOperationMsg = 8, /* 0x08*/
2040  kMsgParityErrorMsg = 9, /* 0x09*/
2041  kLinkedCmdCompleteMsg = 10, /* 0x0a*/
2042  kLinkedCmdCompleteWithFlagMsg = 11, /* 0x0b*/
2043  kBusDeviceResetMsg = 12, /* 0x0c*/
2044  kAbortTagMsg = 13, /* 0x0d*/
2045  kClearQueueMsg = 14, /* 0x0e*/
2046  kInitiateRecoveryMsg = 15, /* 0x0f*/
2047  kReleaseRecoveryMsg = 16, /* 0x10*/
2048  kTerminateIOProcessMsg = 17, /* 0x11*/
2049  kSimpleQueueTag = 0x20, /* 0x20*/
2050  kHeadOfQueueTagMsg = 0x21, /* 0x21*/
2051  kOrderedQueueTagMsg = 0x22, /* 0x22*/
2052  kIgnoreWideResidueMsg = 0x23 /* 0x23*/
2053  };
2054 
2055 /* moveq #kSCSIx, D0; _SCSIAtomic */
2064 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
2065 #pragma parameter __D0 SCSIAction(__A0)
2066 #endif
2067  OSErr
2068  SCSIAction(SCSI_PB *parameterBlock);
2069 
2070 #if CALL_NOT_IN_CARBON
2079 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
2080 #pragma parameter __D0 SCSIRegisterBus(__A0)
2081 #endif
2082  OSErr
2083  SCSIRegisterBus(SIMInitInfo *parameterBlock);
2084 
2093 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
2094 #pragma parameter __D0 SCSIDeregisterBus(__A0)
2095 #endif
2096  OSErr
2097  SCSIDeregisterBus(SCSI_PB *parameterBlock);
2098 
2107 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
2108 #pragma parameter __D0 SCSIReregisterBus(__A0)
2109 #endif
2110  OSErr
2111  SCSIReregisterBus(SIMInitInfo *parameterBlock);
2112 
2121 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
2122 #pragma parameter __D0 SCSIKillXPT(__A0)
2123 #endif
2124  OSErr
2125  SCSIKillXPT(SIMInitInfo *parameterBlock);
2126 
2127 #endif /* CALL_NOT_IN_CARBON */
2128 
2129 #if PRAGMA_STRUCT_ALIGN
2130 #pragma options align = reset
2131 #elif PRAGMA_STRUCT_PACKPUSH
2132 #pragma pack(pop)
2133 #elif PRAGMA_STRUCT_PACK
2134 #pragma pack()
2135 #endif
2136 
2137 #ifdef PRAGMA_IMPORT_OFF
2138 #pragma import off
2139 #elif PRAGMA_IMPORT
2140 #pragma import reset
2141 #endif
2142 
2143 #ifdef __cplusplus
2144 }
2145 #endif
2146 
2147 #endif /* __SCSI__ */
The Apple disk partition scheme as defined in Inside Macintosh: Volume V.
Basic Macintosh data types.
unsigned char Boolean
Definition: MacTypes.h:318
Mixed Mode Manager Interfaces.
#define CALL_ZERO_PARAMETER_UPP(upp, procInfo)
Definition: MixedMode.h:790
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
short SCSIStat(void)
Get bit map of SCSI control and status bits.
OSErr SCSISelAtn(short targetID)
Select SCSI device and signal intention to send a message.
OSErr SCSIReregisterBus(SIMInitInfo *parameterBlock)
OSErr SCSIKillXPT(SIMInitInfo *parameterBlock)
long InvokeSCSIInterruptUPP(Ptr SIMGlobals, SCSIInterruptUPP userUPP)
SCSIUPP NewSCSIUPP(SCSIProcPtr userRoutine)
void DisposeSIMActionUPP(SIMActionUPP userUPP)
void DisposeSCSIUPP(SCSIUPP userUPP)
OSErr SCSIMsgOut(short message)
Send a message to the SCSI device.
OSErr SCSIAction(SCSI_PB *parameterBlock)
void InvokeSIMActionUPP(void *scsiPB, Ptr SIMGlobals, SIMActionUPP userUPP)
OSErr InvokeSIMInitUPP(Ptr SIMinfoPtr, SIMInitUPP userUPP)
typedef CALLBACK_API(void, SCSICallbackProcPtr)(void *scsiPB)
void DisposeSIMInitUPP(SIMInitUPP userUPP)
void DisposeSCSIMakeCallbackUPP(SCSIMakeCallbackUPP userUPP)
AENCallbackUPP NewAENCallbackUPP(AENCallbackProcPtr userRoutine)
OSErr SCSIComplete(short *stat, short *message, unsigned long wait)
Give current command specific number of ticks to complete.
OSErr SCSIWBlind(Ptr tibPtr)
Transfer data without polling and waiting for /REQ line.
OSErr SCSIDeregisterBus(SCSI_PB *parameterBlock)
SCSIInterruptPollUPP NewSCSIInterruptPollUPP(SCSIInterruptPollProcPtr userRoutine)
OSErr SCSIRegisterBus(SIMInitInfo *parameterBlock)
SIMInitUPP NewSIMInitUPP(SIMInitProcPtr userRoutine)
OSErr SCSIWrite(Ptr tibPtr)
Transfer data from the initiator to the target.
SIMActionUPP NewSIMActionUPP(SIMActionProcPtr userRoutine)
typedef CALLBACK_API_C(void, AENCallbackProcPtr)(void)
OSErr SCSISelect(short targetID)
Select a SCSI device with a specific ID.
OSErr SCSIMsgIn(short *message)
Get a message from the SCSI device.
void InvokeAENCallbackUPP(AENCallbackUPP userUPP)
OSErr SCSIRBlind(Ptr tibPtr)
Transfer data without polling and waiting for /REQ line.
OSErr SCSIReset(void)
Reset the SCSI bus.
OSErr SCSIGet(void)
Arbitrate for use of the SCSI bus.
void InvokeSCSICallbackUPP(void *scsiPB, SCSICallbackUPP userUPP)
SCSIInterruptUPP NewSCSIInterruptUPP(SCSIInterruptProcPtr userRoutine)
SCSICallbackUPP NewSCSICallbackUPP(SCSICallbackProcPtr userRoutine)
void InvokeSCSIUPP(SCSIUPP userUPP)
void DisposeSCSIInterruptPollUPP(SCSIInterruptPollUPP userUPP)
long InvokeSCSIInterruptPollUPP(Ptr SIMGlobals, SCSIInterruptPollUPP userUPP)
void DisposeAENCallbackUPP(AENCallbackUPP userUPP)
void DisposeSCSICallbackUPP(SCSICallbackUPP userUPP)
OSErr SCSIRead(Ptr tibPtr)
Transfer data from the target to the initiator.
void DisposeSCSIInterruptUPP(SCSIInterruptUPP userUPP)
OSErr SCSICmd(Ptr buffer, short count)
Send a command to the selected target device.
void InvokeSCSIMakeCallbackUPP(void *scsiPB, SCSIMakeCallbackUPP userUPP)
SCSIMakeCallbackUPP NewSCSIMakeCallbackUPP(SCSIMakeCallbackProcPtr userRoutine)
Definition: SCSI.h:1236
Definition: SCSI.h:1211
Definition: SCSI.h:1245
Definition: SCSI.h:1273
Definition: SCSI.h:1474
Definition: SCSI.h:1410
Definition: SCSI.h:1581
Definition: SCSI.h:1561
Definition: SCSI.h:1316
Definition: SCSI.h:88
Definition: SCSI.h:1601
Definition: SCSI.h:1544
Definition: SCSI.h:1510
Definition: SCSI.h:1527
Definition: SCSI.h:1492
Definition: SCSI.h:1348
Definition: SCSI.h:1332
Definition: SCSI.h:1295
Definition: SCSI.h:1974
Definition: SCSI.h:1287