1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
|
/*
File: SCSI.h
Contains: SCSI Family Interfaces.
Version: QuickTime 7.3
Copyright: (c) 2007 (c) 1986-2001 by Apple Computer, Inc., all rights reserved
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
*/
#ifndef __SCSI__
#define __SCSI__
#ifndef __MACTYPES__
#include <MacTypes.h>
#endif
#ifndef __MIXEDMODE__
#include <MixedMode.h>
#endif
#ifndef __APPLEDISKPARTITIONS__
#include <AppleDiskPartitions.h>
#endif
#if PRAGMA_ONCE
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT
#pragma import on
#endif
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif
/* SCSI Manager errors. These are generated by Inside Mac IV calls only. */
enum {
scCommErr = 2, /* communications error, operation timeout */
scArbNBErr = 3, /* arbitration timeout waiting for not BSY */
scBadParmsErr = 4, /* bad parameter or TIB opcode */
scPhaseErr = 5, /* SCSI bus not in correct phase for attempted operation */
scCompareErr = 6, /* data compare error */
scMgrBusyErr = 7, /* SCSI Manager busy */
scSequenceErr = 8, /* attempted operation is out of sequence */
scBusTOErr = 9, /* CPU bus timeout */
scComplPhaseErr = 10 /* SCSI bus wasn't in Status phase */
};
/* TIB opcodes */
enum {
scInc = 1,
scNoInc = 2,
scAdd = 3,
scMove = 4,
scLoop = 5,
scNop = 6,
scStop = 7,
scComp = 8
};
/*
* All disk partition structures and definitions are now in the
* AppleDiskPartitions.h/p/a files.
*/
/* TIB instruction */
struct SCSIInstr {
unsigned short scOpcode;
long scParam1;
long scParam2;
};
typedef struct SCSIInstr SCSIInstr;
/* SCSI Phases (used by SIMs to support the Original SCSI Manager */
enum {
kDataOutPhase = 0, /* Encoded MSG, C/D, I/O bits */
kDataInPhase = 1,
kCommandPhase = 2,
kStatusPhase = 3,
kPhaseIllegal0 = 4,
kPhaseIllegal1 = 5,
kMessageOutPhase = 6,
kMessageInPhase = 7,
kBusFreePhase = 8, /* Additional Phases */
kArbitratePhase = 9,
kSelectPhase = 10,
kMessageInPhaseNACK = 11 /* Message In Phase with ACK hanging on the bus */
};
#if CALL_NOT_IN_CARBON
/*
* SCSIReset()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIReset(void) TWOWORDINLINE(0x4267, 0xA815);
/*
* SCSIGet()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIGet(void) THREEWORDINLINE(0x3F3C, 0x0001, 0xA815);
/*
* SCSISelect()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSISelect(short targetID) THREEWORDINLINE(0x3F3C, 0x0002, 0xA815);
/*
* SCSICmd()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSICmd(
Ptr buffer,
short count) THREEWORDINLINE(0x3F3C, 0x0003, 0xA815);
/*
* SCSIRead()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIRead(Ptr tibPtr) THREEWORDINLINE(0x3F3C, 0x0005, 0xA815);
/*
* SCSIRBlind()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIRBlind(Ptr tibPtr) THREEWORDINLINE(0x3F3C, 0x0008, 0xA815);
/*
* SCSIWrite()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIWrite(Ptr tibPtr) THREEWORDINLINE(0x3F3C, 0x0006, 0xA815);
/*
* SCSIWBlind()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIWBlind(Ptr tibPtr) THREEWORDINLINE(0x3F3C, 0x0009, 0xA815);
/*
* SCSIComplete()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIComplete(
short * stat,
short * message,
unsigned long wait) THREEWORDINLINE(0x3F3C, 0x0004, 0xA815);
/*
* SCSIStat()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( short )
SCSIStat(void) THREEWORDINLINE(0x3F3C, 0x000A, 0xA815);
/*
* SCSISelAtn()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSISelAtn(short targetID) THREEWORDINLINE(0x3F3C, 0x000B, 0xA815);
/*
* SCSIMsgIn()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIMsgIn(short * message) THREEWORDINLINE(0x3F3C, 0x000C, 0xA815);
/*
* SCSIMsgOut()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.1 and later
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API( OSErr )
SCSIMsgOut(short message) THREEWORDINLINE(0x3F3C, 0x000D, 0xA815);
#endif /* CALL_NOT_IN_CARBON */
enum {
scsiVERSION = 43
};
/*
* SCSI Callback Procedure Prototypes. Several of these are only callable
* from SCSI Manager 4.3 SIM and XPT contexts.
*/
typedef CALLBACK_API_C( void , AENCallbackProcPtr )(void);
typedef CALLBACK_API_C( OSErr , SIMInitProcPtr )(Ptr SIMinfoPtr);
typedef CALLBACK_API_C( void , SIMActionProcPtr )(void *scsiPB, Ptr SIMGlobals);
typedef CALLBACK_API_C( void , SCSIProcPtr )(void);
typedef CALLBACK_API_C( void , SCSIMakeCallbackProcPtr )(void * scsiPB);
/* SCSIInterruptPollProcPtr is obsolete (use SCSIInterruptProcPtr) but still here for compatibility */
typedef CALLBACK_API_C( long , SCSIInterruptPollProcPtr )(Ptr SIMGlobals);
typedef CALLBACK_API_C( long , SCSIInterruptProcPtr )(Ptr SIMGlobals);
typedef STACK_UPP_TYPE(AENCallbackProcPtr) AENCallbackUPP;
typedef STACK_UPP_TYPE(SIMInitProcPtr) SIMInitUPP;
typedef STACK_UPP_TYPE(SIMActionProcPtr) SIMActionUPP;
typedef STACK_UPP_TYPE(SCSIProcPtr) SCSIUPP;
typedef STACK_UPP_TYPE(SCSIMakeCallbackProcPtr) SCSIMakeCallbackUPP;
typedef STACK_UPP_TYPE(SCSIInterruptPollProcPtr) SCSIInterruptPollUPP;
typedef STACK_UPP_TYPE(SCSIInterruptProcPtr) SCSIInterruptUPP;
#if CALL_NOT_IN_CARBON
/*
* NewAENCallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( AENCallbackUPP )
NewAENCallbackUPP(AENCallbackProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppAENCallbackProcInfo = 0x00000001 }; /* no_return_value Func() */
#ifdef __cplusplus
inline DEFINE_API_C(AENCallbackUPP) NewAENCallbackUPP(AENCallbackProcPtr userRoutine) { return (AENCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAENCallbackProcInfo, GetCurrentArchitecture()); }
#else
#define NewAENCallbackUPP(userRoutine) (AENCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAENCallbackProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewSIMInitUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SIMInitUPP )
NewSIMInitUPP(SIMInitProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSIMInitProcInfo = 0x000000E1 }; /* 2_bytes Func(4_bytes) */
#ifdef __cplusplus
inline DEFINE_API_C(SIMInitUPP) NewSIMInitUPP(SIMInitProcPtr userRoutine) { return (SIMInitUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMInitProcInfo, GetCurrentArchitecture()); }
#else
#define NewSIMInitUPP(userRoutine) (SIMInitUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMInitProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewSIMActionUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SIMActionUPP )
NewSIMActionUPP(SIMActionProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSIMActionProcInfo = 0x000003C1 }; /* no_return_value Func(4_bytes, 4_bytes) */
#ifdef __cplusplus
inline DEFINE_API_C(SIMActionUPP) NewSIMActionUPP(SIMActionProcPtr userRoutine) { return (SIMActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMActionProcInfo, GetCurrentArchitecture()); }
#else
#define NewSIMActionUPP(userRoutine) (SIMActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMActionProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewSCSIUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SCSIUPP )
NewSCSIUPP(SCSIProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSCSIProcInfo = 0x00000001 }; /* no_return_value Func() */
#ifdef __cplusplus
inline DEFINE_API_C(SCSIUPP) NewSCSIUPP(SCSIProcPtr userRoutine) { return (SCSIUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIProcInfo, GetCurrentArchitecture()); }
#else
#define NewSCSIUPP(userRoutine) (SCSIUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewSCSIMakeCallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SCSIMakeCallbackUPP )
NewSCSIMakeCallbackUPP(SCSIMakeCallbackProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSCSIMakeCallbackProcInfo = 0x000000C1 }; /* no_return_value Func(4_bytes) */
#ifdef __cplusplus
inline DEFINE_API_C(SCSIMakeCallbackUPP) NewSCSIMakeCallbackUPP(SCSIMakeCallbackProcPtr userRoutine) { return (SCSIMakeCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIMakeCallbackProcInfo, GetCurrentArchitecture()); }
#else
#define NewSCSIMakeCallbackUPP(userRoutine) (SCSIMakeCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIMakeCallbackProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewSCSIInterruptPollUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SCSIInterruptPollUPP )
NewSCSIInterruptPollUPP(SCSIInterruptPollProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSCSIInterruptPollProcInfo = 0x000000F1 }; /* 4_bytes Func(4_bytes) */
#ifdef __cplusplus
inline DEFINE_API_C(SCSIInterruptPollUPP) NewSCSIInterruptPollUPP(SCSIInterruptPollProcPtr userRoutine) { return (SCSIInterruptPollUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptPollProcInfo, GetCurrentArchitecture()); }
#else
#define NewSCSIInterruptPollUPP(userRoutine) (SCSIInterruptPollUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptPollProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewSCSIInterruptUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SCSIInterruptUPP )
NewSCSIInterruptUPP(SCSIInterruptProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSCSIInterruptProcInfo = 0x000000F1 }; /* 4_bytes Func(4_bytes) */
#ifdef __cplusplus
inline DEFINE_API_C(SCSIInterruptUPP) NewSCSIInterruptUPP(SCSIInterruptProcPtr userRoutine) { return (SCSIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptProcInfo, GetCurrentArchitecture()); }
#else
#define NewSCSIInterruptUPP(userRoutine) (SCSIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeAENCallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeAENCallbackUPP(AENCallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeAENCallbackUPP(AENCallbackUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeAENCallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeSIMInitUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeSIMInitUPP(SIMInitUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSIMInitUPP(SIMInitUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSIMInitUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeSIMActionUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeSIMActionUPP(SIMActionUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSIMActionUPP(SIMActionUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSIMActionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeSCSIUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeSCSIUPP(SCSIUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSCSIUPP(SCSIUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSCSIUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeSCSIMakeCallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeSCSIMakeCallbackUPP(SCSIMakeCallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSCSIMakeCallbackUPP(SCSIMakeCallbackUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSCSIMakeCallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeSCSIInterruptPollUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeSCSIInterruptPollUPP(SCSIInterruptPollUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSCSIInterruptPollUPP(SCSIInterruptPollUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSCSIInterruptPollUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeSCSIInterruptUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeSCSIInterruptUPP(SCSIInterruptUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSCSIInterruptUPP(SCSIInterruptUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSCSIInterruptUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeAENCallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
InvokeAENCallbackUPP(AENCallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) InvokeAENCallbackUPP(AENCallbackUPP userUPP) { CALL_ZERO_PARAMETER_UPP(userUPP, uppAENCallbackProcInfo); }
#else
#define InvokeAENCallbackUPP(userUPP) CALL_ZERO_PARAMETER_UPP((userUPP), uppAENCallbackProcInfo)
#endif
#endif
/*
* InvokeSIMInitUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( OSErr )
InvokeSIMInitUPP(
Ptr SIMinfoPtr,
SIMInitUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(OSErr) InvokeSIMInitUPP(Ptr SIMinfoPtr, SIMInitUPP userUPP) { return (OSErr)CALL_ONE_PARAMETER_UPP(userUPP, uppSIMInitProcInfo, SIMinfoPtr); }
#else
#define InvokeSIMInitUPP(SIMinfoPtr, userUPP) (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppSIMInitProcInfo, (SIMinfoPtr))
#endif
#endif
/*
* InvokeSIMActionUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
InvokeSIMActionUPP(
void * scsiPB,
Ptr SIMGlobals,
SIMActionUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) InvokeSIMActionUPP(void * scsiPB, Ptr SIMGlobals, SIMActionUPP userUPP) { CALL_TWO_PARAMETER_UPP(userUPP, uppSIMActionProcInfo, scsiPB, SIMGlobals); }
#else
#define InvokeSIMActionUPP(scsiPB, SIMGlobals, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppSIMActionProcInfo, (scsiPB), (SIMGlobals))
#endif
#endif
/*
* InvokeSCSIUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
InvokeSCSIUPP(SCSIUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) InvokeSCSIUPP(SCSIUPP userUPP) { CALL_ZERO_PARAMETER_UPP(userUPP, uppSCSIProcInfo); }
#else
#define InvokeSCSIUPP(userUPP) CALL_ZERO_PARAMETER_UPP((userUPP), uppSCSIProcInfo)
#endif
#endif
/*
* InvokeSCSIMakeCallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
InvokeSCSIMakeCallbackUPP(
void * scsiPB,
SCSIMakeCallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) InvokeSCSIMakeCallbackUPP(void * scsiPB, SCSIMakeCallbackUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppSCSIMakeCallbackProcInfo, scsiPB); }
#else
#define InvokeSCSIMakeCallbackUPP(scsiPB, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIMakeCallbackProcInfo, (scsiPB))
#endif
#endif
/*
* InvokeSCSIInterruptPollUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( long )
InvokeSCSIInterruptPollUPP(
Ptr SIMGlobals,
SCSIInterruptPollUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(long) InvokeSCSIInterruptPollUPP(Ptr SIMGlobals, SCSIInterruptPollUPP userUPP) { return (long)CALL_ONE_PARAMETER_UPP(userUPP, uppSCSIInterruptPollProcInfo, SIMGlobals); }
#else
#define InvokeSCSIInterruptPollUPP(SIMGlobals, userUPP) (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptPollProcInfo, (SIMGlobals))
#endif
#endif
/*
* InvokeSCSIInterruptUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( long )
InvokeSCSIInterruptUPP(
Ptr SIMGlobals,
SCSIInterruptUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(long) InvokeSCSIInterruptUPP(Ptr SIMGlobals, SCSIInterruptUPP userUPP) { return (long)CALL_ONE_PARAMETER_UPP(userUPP, uppSCSIInterruptProcInfo, SIMGlobals); }
#else
#define InvokeSCSIInterruptUPP(SIMGlobals, userUPP) (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptProcInfo, (SIMGlobals))
#endif
#endif
#endif /* CALL_NOT_IN_CARBON */
#if CALL_NOT_IN_CARBON || OLDROUTINENAMES
/* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
#define NewAENCallbackProc(userRoutine) NewAENCallbackUPP(userRoutine)
#define NewSIMInitProc(userRoutine) NewSIMInitUPP(userRoutine)
#define NewSIMActionProc(userRoutine) NewSIMActionUPP(userRoutine)
#define NewSCSIProc(userRoutine) NewSCSIUPP(userRoutine)
#define NewSCSIMakeCallbackProc(userRoutine) NewSCSIMakeCallbackUPP(userRoutine)
#define NewSCSIInterruptPollProc(userRoutine) NewSCSIInterruptPollUPP(userRoutine)
#define NewSCSIInterruptProc(userRoutine) NewSCSIInterruptUPP(userRoutine)
#define CallAENCallbackProc(userRoutine) InvokeAENCallbackUPP(userRoutine)
#define CallSIMInitProc(userRoutine, SIMinfoPtr) InvokeSIMInitUPP(SIMinfoPtr, userRoutine)
#define CallSIMActionProc(userRoutine, scsiPB, SIMGlobals) InvokeSIMActionUPP(scsiPB, SIMGlobals, userRoutine)
#define CallSCSIProc(userRoutine) InvokeSCSIUPP(userRoutine)
#define CallSCSIMakeCallbackProc(userRoutine, scsiPB) InvokeSCSIMakeCallbackUPP(scsiPB, userRoutine)
#define CallSCSIInterruptPollProc(userRoutine, SIMGlobals) InvokeSCSIInterruptPollUPP(SIMGlobals, userRoutine)
#define CallSCSIInterruptProc(userRoutine, SIMGlobals) InvokeSCSIInterruptUPP(SIMGlobals, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
/*
* SCSI Completion routine callback for SCSIAction.
*/
typedef CALLBACK_API( void , SCSICallbackProcPtr )(void * scsiPB);
typedef STACK_UPP_TYPE(SCSICallbackProcPtr) SCSICallbackUPP;
/*
* NewSCSICallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.3 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( SCSICallbackUPP )
NewSCSICallbackUPP(SCSICallbackProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppSCSICallbackProcInfo = 0x000000C0 }; /* pascal no_return_value Func(4_bytes) */
#ifdef __cplusplus
inline DEFINE_API_C(SCSICallbackUPP) NewSCSICallbackUPP(SCSICallbackProcPtr userRoutine) { return (SCSICallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSICallbackProcInfo, GetCurrentArchitecture()); }
#else
#define NewSCSICallbackUPP(userRoutine) (SCSICallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSICallbackProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeSCSICallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.3 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( void )
DisposeSCSICallbackUPP(SCSICallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) DisposeSCSICallbackUPP(SCSICallbackUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeSCSICallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeSCSICallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: in CarbonLib 1.3 and later
* Mac OS X: in version 10.0 and later
*/
EXTERN_API_C( void )
InvokeSCSICallbackUPP(
void * scsiPB,
SCSICallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline DEFINE_API_C(void) InvokeSCSICallbackUPP(void * scsiPB, SCSICallbackUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppSCSICallbackProcInfo, scsiPB); }
#else
#define InvokeSCSICallbackUPP(scsiPB, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppSCSICallbackProcInfo, (scsiPB))
#endif
#endif
#if CALL_NOT_IN_CARBON || OLDROUTINENAMES
/* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
#define NewSCSICallbackProc(userRoutine) NewSCSICallbackUPP(userRoutine)
#define CallSCSICallbackProc(userRoutine, scsiPB) InvokeSCSICallbackUPP(scsiPB, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
/*
SCSI Manager 4.3 function codes
*/
enum {
SCSINop = 0x00, /* Execute nothing */
SCSIExecIO = 0x01, /* Execute the specified IO */
SCSIBusInquiry = 0x03, /* Get parameters for entire path of HBAs */
SCSIReleaseQ = 0x04, /* Release the frozen SIM queue for particular LUN */
SCSIAbortCommand = 0x10, /* Abort the selected Control Block */
SCSIResetBus = 0x11, /* Reset the SCSI bus */
SCSIResetDevice = 0x12, /* Reset the SCSI device */
SCSITerminateIO = 0x13 /* Terminate any pending IO */
};
/* Not available in Carbon on X */
enum {
SCSIGetVirtualIDInfo = 0x80, /* Find out which bus old ID is on */
SCSILoadDriver = 0x82, /* Load a driver for a device ident */
SCSIOldCall = 0x84, /* XPT->SIM private call for old-API */
SCSICreateRefNumXref = 0x85, /* Register a DeviceIdent to drvr RefNum xref */
SCSILookupRefNumXref = 0x86, /* Get DeviceIdent to drvr RefNum xref */
SCSIRemoveRefNumXref = 0x87, /* Remove a DeviceIdent to drvr RefNum xref */
SCSIRegisterWithNewXPT = 0x88 /* XPT has changed - SIM needs to re-register itself */
};
enum {
vendorUnique = 0xC0 /* 0xC0 thru 0xFF */
};
/* Allocation length defines for some of the fields */
enum {
handshakeDataLength = 8, /* Handshake data length */
maxCDBLength = 16, /* Space for the CDB bytes/pointer */
vendorIDLength = 16 /* ASCII string len for Vendor ID */
};
/* Define DeviceIdent structure */
struct DeviceIdent {
UInt8 diReserved; /* reserved */
UInt8 bus; /* SCSI - Bus Number */
UInt8 targetID; /* SCSI - Target SCSI ID */
UInt8 LUN; /* SCSI - LUN */
};
typedef struct DeviceIdent DeviceIdent;
/* Constants for the diReserved field of DeviceIdent */
/* used to distinguish whether the DeviceIdent holds */
/* information about a SCSI device (kBusTypeSCSI) */
/* or an ATA device (kBusTypeATA). The other */
/* constants are pretty much deprecated. Let me */
/* know if you see any. */
enum {
kBusTypeSCSI = 0,
kBusTypeATA = 1,
kBusTypePCMCIA = 2,
kBusTypeMediaBay = 3
};
/* If diReserved indicates that a DeviceIdent is */
/* really for ATA, you can cast it to DeviceIdentATA */
/* to get at the important fields. */
struct DeviceIdentATA {
UInt8 diReserved;
UInt8 busNum;
UInt8 devNum;
UInt8 diReserved2;
};
typedef struct DeviceIdentATA DeviceIdentATA;
/* for use with Apple Patch Driver used during booting*/
struct PatchDescriptor {
OSType patchSig; /* The patches signature */
UInt16 majorVers; /* The major version number of the */
/* patch */
UInt16 minorVers; /* The minor version number of the */
/* patch */
UInt32 flags; /* Reqired/Optional, etc. */
UInt32 patchOffset; /* Block offset to the beginning of */
/* the patch */
UInt32 patchSize; /* Actual size of the patch in bytes */
UInt32 patchCRC; /* As calculated by the SCSI drivers */
/* CRC code */
UInt32 patchDescriptorLen; /* Total length of the descriptor */
/* (must be >= 61 bytes) */
Str32 patchName; /* Pascal string with a short */
/* description of the patch */
UInt8 patchVendor[1]; /* The first byte of a pascal string */
/* for the patch Vendor. Any amount */
/* of data may follow the string. */
};
typedef struct PatchDescriptor PatchDescriptor;
/* Constants for the flags field of PatchDescriptor. */
enum {
kRequiredPatch = 0x00000001 /* Patch must succeed to continue booting. */
};
struct PatchList {
UInt16 numPatchBlocks; /* The number of disk blocks */
/* to hold patch descriptions */
UInt16 numPatches; /* The number of patches */
PatchDescriptor thePatch[1]; /* An array with one patch */
/* per element */
};
typedef struct PatchList PatchList;
/* signature of a Patch entry point*/
typedef CALLBACK_API( OSErr , PatchEntryPoint )(PatchDescriptor *myPatch, DeviceIdent myDevID);
/* Command Descriptor Block structure */
union CDB {
BytePtr cdbPtr; /* pointer to the CDB, or */
UInt8 cdbBytes[16]; /* the actual CDB to send */
};
typedef union CDB CDB;
typedef CDB * CDBPtr;
/* Scatter/gather list element (Deprecated for MacOS8) */
struct SGRecord {
Ptr SGAddr;
UInt32 SGCount;
};
typedef struct SGRecord SGRecord;
#define SCSIPBHdr \
struct SCSIHdr* qLink; \
short scsiReserved1; \
UInt16 scsiPBLength; \
UInt8 scsiFunctionCode; \
UInt8 scsiReserved2; \
volatile OSErr scsiResult; \
DeviceIdent scsiDevice; \
SCSICallbackUPP scsiCompletion; \
UInt32 scsiFlags; \
UInt8 * scsiDriverStorage; \
Ptr scsiXPTprivate; \
long scsiReserved3;
struct SCSIHdr {
struct SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
};
typedef struct SCSIHdr SCSIHdr;
struct SCSI_PB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
};
typedef struct SCSI_PB SCSI_PB;
struct SCSI_IO {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
UInt16 scsiResultFlags; /* <- Flags which modify the scsiResult field */
UInt16 scsiReserved3pt5; /* -> Reserved */
BytePtr scsiDataPtr; /* -> Pointer to the data buffer or the S/G list */
UInt32 scsiDataLength; /* -> Data transfer length */
BytePtr scsiSensePtr; /* -> Ptr to autosense data buffer */
UInt8 scsiSenseLength; /* -> size of the autosense buffer */
UInt8 scsiCDBLength; /* -> Number of bytes for the CDB */
UInt16 scsiSGListCount; /* -> num of scatter gather list entries */
UInt32 scsiReserved4; /* <- reserved for output */
UInt8 scsiSCSIstatus; /* <- Returned scsi device status */
SInt8 scsiSenseResidual; /* <- Autosense residual length */
UInt16 scsiReserved5; /* <- reserved for output */
long scsiDataResidual; /* <- Returned Transfer residual length */
CDB scsiCDB; /* -> Actual CDB or pointer to CDB */
long scsiTimeout; /* -> Timeout value (Time Mgr format) (CAM timeout) */
BytePtr scsiReserved5pt5; /* -> Reserved */
UInt16 scsiReserved5pt6; /* -> Reserved */
UInt16 scsiIOFlags; /* -> additional I/O flags */
UInt8 scsiTagAction; /* -> What to do for tag queuing */
UInt8 scsiReserved6; /* -> reserved for input */
UInt16 scsiReserved7; /* -> reserved for input */
UInt16 scsiSelectTimeout; /* -> Select timeout value */
UInt8 scsiDataType; /* -> Data description type (i.e. buffer, TIB, S/G) */
UInt8 scsiTransferType; /* -> Transfer type (i.e. Blind vs Polled) */
UInt32 scsiReserved8; /* -> reserved for input */
UInt32 scsiReserved9; /* -> reserved for input */
UInt16 scsiHandshake[8]; /* -> handshaking points (null term'd) */
UInt32 scsiReserved10; /* -> reserved for input */
UInt32 scsiReserved11; /* -> reserved for input */
struct SCSI_IO * scsiCommandLink; /* -> Ptr to the next PB in linked cmd chain */
UInt8 scsiSIMpublics[8]; /* -> reserved for input to 3rd-party SIMs */
UInt8 scsiAppleReserved6[8]; /* -> reserved for input */
/* XPT layer privates (for old-API emulation) */
UInt16 scsiCurrentPhase; /* <- phase upon completing old call */
short scsiSelector; /* -> selector specified in old calls */
OSErr scsiOldCallResult; /* <- result of old call */
UInt8 scsiSCSImessage; /* <- Returned scsi device message (for SCSIComplete)*/
UInt8 XPTprivateFlags; /* <> various flags */
UInt8 XPTextras[12]; /* */
};
typedef struct SCSI_IO SCSI_IO;
typedef SCSI_IO SCSIExecIOPB;
/* Bus inquiry PB */
struct SCSIBusInquiryPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
UInt16 scsiEngineCount; /* <- Number of engines on HBA */
UInt16 scsiMaxTransferType; /* <- Number of transfer types for this HBA */
UInt32 scsiDataTypes; /* <- which data types are supported by this SIM */
UInt16 scsiIOpbSize; /* <- Size of SCSI_IO PB for this SIM/HBA */
UInt16 scsiMaxIOpbSize; /* <- Size of max SCSI_IO PB for all SIM/HBAs */
UInt32 scsiFeatureFlags; /* <- Supported features flags field */
UInt8 scsiVersionNumber; /* <- Version number for the SIM/HBA */
UInt8 scsiHBAInquiry; /* <- Mimic of INQ byte 7 for the HBA */
UInt8 scsiTargetModeFlags; /* <- Flags for target mode support */
UInt8 scsiScanFlags; /* <- Scan related feature flags */
UInt32 scsiSIMPrivatesPtr; /* <- Ptr to SIM private data area */
UInt32 scsiSIMPrivatesSize; /* <- Size of SIM private data area */
UInt32 scsiAsyncFlags; /* <- Event cap. for Async Callback */
UInt8 scsiHiBusID; /* <- Highest path ID in the subsystem */
UInt8 scsiInitiatorID; /* <- ID of the HBA on the SCSI bus */
UInt16 scsiBIReserved0; /* */
UInt32 scsiBIReserved1; /* <- */
UInt32 scsiFlagsSupported; /* <- which scsiFlags are supported */
UInt16 scsiIOFlagsSupported; /* <- which scsiIOFlags are supported */
UInt16 scsiWeirdStuff; /* <- */
UInt16 scsiMaxTarget; /* <- maximum Target number supported */
UInt16 scsiMaxLUN; /* <- maximum Logical Unit number supported */
char scsiSIMVendor[16]; /* <- Vendor ID of SIM (or XPT if bus<FF) */
char scsiHBAVendor[16]; /* <- Vendor ID of the HBA */
char scsiControllerFamily[16]; /* <- Family of SCSI Controller */
char scsiControllerType[16]; /* <- Specific Model of SCSI Controller used */
char scsiXPTversion[4]; /* <- version number of XPT */
char scsiSIMversion[4]; /* <- version number of SIM */
char scsiHBAversion[4]; /* <- version number of HBA */
UInt8 scsiHBAslotType; /* <- type of "slot" that this HBA is in */
UInt8 scsiHBAslotNumber; /* <- slot number of this HBA */
UInt16 scsiSIMsRsrcID; /* <- resource ID of this SIM */
UInt16 scsiBIReserved3; /* <- */
UInt16 scsiAdditionalLength; /* <- additional BusInquiry PB len */
};
typedef struct SCSIBusInquiryPB SCSIBusInquiryPB;
/* Abort SIM Request PB */
struct SCSIAbortCommandPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
SCSI_IO * scsiIOptr; /* Pointer to the PB to abort */
};
typedef struct SCSIAbortCommandPB SCSIAbortCommandPB;
/* Terminate I/O Process Request PB */
struct SCSITerminateIOPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
SCSI_IO * scsiIOptr; /* Pointer to the PB to terminate */
};
typedef struct SCSITerminateIOPB SCSITerminateIOPB;
/* Reset SCSI Bus PB */
struct SCSIResetBusPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
};
typedef struct SCSIResetBusPB SCSIResetBusPB;
/* Reset SCSI Device PB */
struct SCSIResetDevicePB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
};
typedef struct SCSIResetDevicePB SCSIResetDevicePB;
/* Release SIM Queue PB */
struct SCSIReleaseQPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
BytePtr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
};
typedef struct SCSIReleaseQPB SCSIReleaseQPB;
/* SCSI Get Virtual ID Info PB */
struct SCSIGetVirtualIDInfoPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
Ptr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
UInt16 scsiOldCallID; /* -> SCSI ID of device in question */
Boolean scsiExists; /* <- true if device exists */
SInt8 filler;
};
typedef struct SCSIGetVirtualIDInfoPB SCSIGetVirtualIDInfoPB;
/* Create/Lookup/Remove RefNum for Device PB */
struct SCSIDriverPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
Ptr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
short scsiDriver; /* -> DriverRefNum, For SetDriver, <- For GetNextDriver */
UInt16 scsiDriverFlags; /* <> Details of driver/device */
DeviceIdent scsiNextDevice; /* <- DeviceIdent of the NEXT Item in the list */
};
typedef struct SCSIDriverPB SCSIDriverPB;
/* Load Driver PB */
struct SCSILoadDriverPB {
SCSIHdr * qLink; /* (internal use, must be nil on entry) */
short scsiReserved1; /* -> reserved for input */
UInt16 scsiPBLength; /* -> Length of the entire PB */
UInt8 scsiFunctionCode; /* -> function selector */
UInt8 scsiReserved2; /* <- reserved for output */
volatile OSErr scsiResult; /* <- Returned result */
DeviceIdent scsiDevice; /* -> Device Identifier (bus+target+lun)*/
SCSICallbackUPP scsiCompletion; /* -> Callback on completion function */
UInt32 scsiFlags; /* -> assorted flags */
Ptr scsiDriverStorage; /* <> Ptr for driver private use */
Ptr scsiXPTprivate; /* private field for use in XPT */
long scsiReserved3; /* reserved */
short scsiLoadedRefNum; /* <- SIM returns refnum of driver */
Boolean scsiDiskLoadFailed; /* -> if true, indicates call after failure to load */
SInt8 filler;
};
typedef struct SCSILoadDriverPB SCSILoadDriverPB;
/* Defines for the scsiTransferType field */
enum {
scsiTransferBlind = 0,
scsiTransferPolled = 1
};
enum {
scsiErrorBase = -7936
};
enum {
scsiRequestInProgress = 1, /* 1 = PB request is in progress */
/* Execution failed 00-2F */
scsiRequestAborted = scsiErrorBase + 2, /* -7934 = PB request aborted by the host */
scsiUnableToAbort = scsiErrorBase + 3, /* -7933 = Unable to Abort PB request */
scsiNonZeroStatus = scsiErrorBase + 4, /* -7932 = PB request completed with an err */
scsiUnused05 = scsiErrorBase + 5, /* -7931 = */
scsiUnused06 = scsiErrorBase + 6, /* -7930 = */
scsiUnused07 = scsiErrorBase + 7, /* -7929 = */
scsiUnused08 = scsiErrorBase + 8, /* -7928 = */
scsiUnableToTerminate = scsiErrorBase + 9, /* -7927 = Unable to Terminate I/O PB req */
scsiSelectTimeout = scsiErrorBase + 10, /* -7926 = Target selection timeout */
scsiCommandTimeout = scsiErrorBase + 11, /* -7925 = Command timeout */
scsiIdentifyMessageRejected = scsiErrorBase + 12, /* -7924 = */
scsiMessageRejectReceived = scsiErrorBase + 13, /* -7923 = Message reject received */
scsiSCSIBusReset = scsiErrorBase + 14, /* -7922 = SCSI bus reset sent/received */
scsiParityError = scsiErrorBase + 15, /* -7921 = Uncorrectable parity error occured */
scsiAutosenseFailed = scsiErrorBase + 16, /* -7920 = Autosense: Request sense cmd fail */
scsiUnused11 = scsiErrorBase + 17, /* -7919 = */
scsiDataRunError = scsiErrorBase + 18, /* -7918 = Data overrun/underrun error */
scsiUnexpectedBusFree = scsiErrorBase + 19, /* -7917 = Unexpected BUS free */
scsiSequenceFailed = scsiErrorBase + 20, /* -7916 = Target bus phase sequence failure */
scsiWrongDirection = scsiErrorBase + 21, /* -7915 = Data phase was in wrong direction */
scsiUnused16 = scsiErrorBase + 22, /* -7914 = */
scsiBDRsent = scsiErrorBase + 23, /* -7913 = A SCSI BDR msg was sent to target */
scsiTerminated = scsiErrorBase + 24, /* -7912 = PB request terminated by the host */
scsiNoNexus = scsiErrorBase + 25, /* -7911 = Nexus is not established */
scsiCDBReceived = scsiErrorBase + 26, /* -7910 = The SCSI CDB has been received */
/* Couldn't begin execution 30-3F */
scsiTooManyBuses = scsiErrorBase + 48, /* -7888 = Register failed because we're full */
scsiBusy = scsiErrorBase + 49, /* -7887 = SCSI subsystem is busy */
scsiProvideFail = scsiErrorBase + 50, /* -7886 = Unable to provide requ. capability */
scsiDeviceNotThere = scsiErrorBase + 51, /* -7885 = SCSI device not installed/there */
scsiNoHBA = scsiErrorBase + 52, /* -7884 = No HBA detected Error */
scsiDeviceConflict = scsiErrorBase + 53, /* -7883 = sorry, max 1 refNum per DeviceIdent */
scsiNoSuchXref = scsiErrorBase + 54, /* -7882 = no such RefNum xref */
scsiQLinkInvalid = scsiErrorBase + 55, /* -7881 = pre-linked PBs not supported */
/* (The QLink field was nonzero) */
/* Parameter errors 40-7F */
scsiPBLengthError = scsiErrorBase + 64, /* -7872 = (scsiPBLength is insuf'ct/invalid */
scsiFunctionNotAvailable = scsiErrorBase + 65, /* -7871 = The requ. func is not available */
scsiRequestInvalid = scsiErrorBase + 66, /* -7870 = PB request is invalid */
scsiBusInvalid = scsiErrorBase + 67, /* -7869 = Bus ID supplied is invalid */
scsiTIDInvalid = scsiErrorBase + 68, /* -7868 = Target ID supplied is invalid */
scsiLUNInvalid = scsiErrorBase + 69, /* -7867 = LUN supplied is invalid */
scsiIDInvalid = scsiErrorBase + 70, /* -7866 = The initiator ID is invalid */
scsiDataTypeInvalid = scsiErrorBase + 71, /* -7865 = scsiDataType requested not supported */
scsiTransferTypeInvalid = scsiErrorBase + 72, /* -7864 = scsiTransferType field is too high */
scsiCDBLengthInvalid = scsiErrorBase + 73 /* -7863 = scsiCDBLength field is too big */
};
/* New errors for SCSI Family */
enum {
scsiUnused74 = scsiErrorBase + 74, /* -7862 = */
scsiUnused75 = scsiErrorBase + 75, /* -7861 = */
scsiBadDataLength = scsiErrorBase + 76, /* -7860 = a zero data length in PB */
scsiPartialPrepared = scsiErrorBase + 77, /* -7859 = could not do full prepare mem for I/O*/
scsiInvalidMsgType = scsiErrorBase + 78, /* -7858 = Invalid message type (internal) */
scsiUnused79 = scsiErrorBase + 79, /* -7857 = */
scsiBadConnID = scsiErrorBase + 80, /* -7856 = Bad Connection ID */
scsiUnused81 = scsiErrorBase + 81, /* -7855 = */
scsiIOInProgress = scsiErrorBase + 82, /* -7854 = Can't close conn, IO in prog */
scsiTargetReserved = scsiErrorBase + 83, /* -7853 = Target already reserved */
scsiUnused84 = scsiErrorBase + 84, /* -7852 = */
scsiUnused85 = scsiErrorBase + 85, /* -7851 = */
scsiBadConnType = scsiErrorBase + 86, /* -7850 = Bad connection type */
scsiCannotLoadPlugin = scsiErrorBase + 87 /* -7849 = No matching service category */
};
/* +++ */
/*
* scsiFamilyInternalError and scsiPluginInternalError are intended to handle consistency check failures.
* For example, if the family stores a record on a lookaside queue, but does not find that record
* it can use this error to report this failure. SCSI Manager 4.3 uses dsIOCoreErr in a few places,
* but this is probably not the best error. In general, internal errors should be reported as bugs.
*
* The following range of errors is provided for third-party (non-Apple) SCSI SIM and device driver vendors.
* In general, they would be used for error conditions that are not covered by the standardized errors.
* They should not normally be conveyed to normal applications, but might be used for communication between
* a plug-in and a vendor-provided device driver (for example, to manage RAID hot-swapping).
*
* Note: I don't know how many SCSI errors are reserved in the error code architecture. Don't assume that
* we'll actually get sixteen, but we should reserve at least one.
*/
enum {
scsiFamilyInternalError = scsiErrorBase + 87, /* -7849 = Internal consistency check failed */
scsiPluginInternalError = scsiErrorBase + 88, /* -7848 = Internal consistency check failed */
scsiVendorSpecificErrorBase = scsiErrorBase + 128, /* ?? = Start of third-party error range */
scsiVendorSpecificErrorCount = 16 /* Number of third-party errors */
};
/* --- */
enum {
scsiExecutionErrors = scsiErrorBase,
scsiNotExecutedErrors = scsiTooManyBuses,
scsiParameterErrors = scsiPBLengthError
};
/* Defines for the scsiResultFlags field */
enum {
scsiSIMQFrozen = 0x0001, /* The SIM queue is frozen w/this err */
scsiAutosenseValid = 0x0002, /* Autosense data valid for target */
scsiBusNotFree = 0x0004 /* At time of callback, SCSI bus is not free */
};
/* Defines for the bit numbers of the scsiFlags field in the PB header for the SCSIExecIO function */
enum {
kbSCSIDisableAutosense = 29, /* Disable auto sense feature */
kbSCSIFlagReservedA = 28, /* */
kbSCSIFlagReserved0 = 27, /* */
kbSCSICDBLinked = 26, /* The PB contains a linked CDB */
kbSCSIQEnable = 25, /* Target queue actions are enabled */
kbSCSICDBIsPointer = 24, /* The CDB field contains a pointer */
kbSCSIFlagReserved1 = 23, /* */
kbSCSIInitiateSyncData = 22, /* Attempt Sync data xfer and SDTR */
kbSCSIDisableSyncData = 21, /* Disable sync, go to async */
kbSCSISIMQHead = 20, /* Place PB at the head of SIM Q */
kbSCSISIMQFreeze = 19, /* Return the SIM Q to frozen state */
kbSCSISIMQNoFreeze = 18, /* Disallow SIM Q freezing */
kbSCSIDoDisconnect = 17, /* Definitely do disconnect */
kbSCSIDontDisconnect = 16, /* Definitely don't disconnect */
kbSCSIDataReadyForDMA = 15, /* Data buffer(s) are ready for DMA */
kbSCSIFlagReserved3 = 14, /* */
kbSCSIDataPhysical = 13, /* SG/Buffer data ptrs are physical */
kbSCSISensePhysical = 12, /* Autosense buffer ptr is physical */
kbSCSIFlagReserved5 = 11, /* */
kbSCSIFlagReserved6 = 10, /* */
kbSCSIFlagReserved7 = 9, /* */
kbSCSIFlagReserved8 = 8, /* */
kbSCSIDataBufferValid = 7, /* Data buffer valid */
kbSCSIStatusBufferValid = 6, /* Status buffer valid */
kbSCSIMessageBufferValid = 5, /* Message buffer valid */
kbSCSIFlagReserved9 = 4 /* */
};
/* Defines for the bit masks of the scsiFlags field */
enum {
scsiDirectionMask = (long)0xC0000000, /* Data direction mask */
scsiDirectionNone = (long)0xC0000000, /* Data direction (11: no data) */
scsiDirectionReserved = 0x00000000, /* Data direction (00: reserved) */
scsiDirectionOut = (long)0x80000000, /* Data direction (10: DATA OUT) */
scsiDirectionIn = 0x40000000, /* Data direction (01: DATA IN) */
scsiDisableAutosense = 0x20000000, /* Disable auto sense feature */
scsiFlagReservedA = 0x10000000, /* */
scsiFlagReserved0 = 0x08000000, /* */
scsiCDBLinked = 0x04000000, /* The PB contains a linked CDB */
scsiQEnable = 0x02000000, /* Target queue actions are enabled */
scsiCDBIsPointer = 0x01000000, /* The CDB field contains a pointer */
scsiFlagReserved1 = 0x00800000, /* */
scsiInitiateSyncData = 0x00400000, /* Attempt Sync data xfer and SDTR */
scsiDisableSyncData = 0x00200000, /* Disable sync, go to async */
scsiSIMQHead = 0x00100000, /* Place PB at the head of SIM Q */
scsiSIMQFreeze = 0x00080000, /* Return the SIM Q to frozen state */
scsiSIMQNoFreeze = 0x00040000, /* Disallow SIM Q freezing */
scsiDoDisconnect = 0x00020000, /* Definitely do disconnect */
scsiDontDisconnect = 0x00010000, /* Definitely don't disconnect */
scsiDataReadyForDMA = 0x00008000, /* Data buffer(s) are ready for DMA */
scsiFlagReserved3 = 0x00004000, /* */
scsiDataPhysical = 0x00002000, /* SG/Buffer data ptrs are physical */
scsiSensePhysical = 0x00001000, /* Autosense buffer ptr is physical */
scsiFlagReserved5 = 0x00000800, /* */
scsiFlagReserved6 = 0x00000400, /* */
scsiFlagReserved7 = 0x00000200, /* */
scsiFlagReserved8 = 0x00000100 /* */
};
/* bit masks for the scsiIOFlags field in SCSIExecIOPB */
enum {
scsiNoParityCheck = 0x0002, /* disable parity checking */
scsiDisableSelectWAtn = 0x0004, /* disable select w/Atn */
scsiSavePtrOnDisconnect = 0x0008, /* do SaveDataPointer upon Disconnect msg */
scsiNoBucketIn = 0x0010, /* don't bit bucket in during this I/O */
scsiNoBucketOut = 0x0020, /* don't bit bucket out during this I/O */
scsiDisableWide = 0x0040, /* disable wide transfer negotiation */
scsiInitiateWide = 0x0080, /* initiate wide transfer negotiation */
scsiRenegotiateSense = 0x0100, /* renegotiate sync/wide before issuing autosense */
scsiDisableDiscipline = 0x0200, /* disable parameter checking on SCSIExecIO calls */
scsiIOFlagReserved0080 = 0x0080, /* */
scsiIOFlagReserved8000 = 0x8000 /* */
};
/* Defines for the Bus Inquiry PB fields. */
/* scsiHBAInquiry field bits */
enum {
scsiBusMDP = 0x80, /* Supports Modify Data Pointer message */
scsiBusWide32 = 0x40, /* Supports 32 bit wide SCSI */
scsiBusWide16 = 0x20, /* Supports 16 bit wide SCSI */
scsiBusSDTR = 0x10, /* Supports Sync Data Transfer Req message */
scsiBusLinkedCDB = 0x08, /* Supports linked CDBs */
scsiBusTagQ = 0x02, /* Supports tag queue message */
scsiBusSoftReset = 0x01 /* Supports soft reset */
};
/* Defines for the scsiDataType field */
enum {
scsiDataBuffer = 0, /* single contiguous buffer supplied */
scsiDataTIB = 1, /* TIB supplied (ptr in scsiDataPtr) */
scsiDataSG = 2, /* scatter/gather list supplied */
scsiDataIOTable = 3 /*#(7/11/95) Prepared by Block Storage */
};
/* scsiDataTypes field bits */
/* bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved */
enum {
scsiBusDataTIB = (1 << scsiDataTIB), /* TIB supplied (ptr in scsiDataPtr) */
scsiBusDataBuffer = (1 << scsiDataBuffer), /* single contiguous buffer supplied */
scsiBusDataSG = (1 << scsiDataSG), /* scatter/gather list supplied */
scsiBusDataIOTable = (1 << scsiDataIOTable), /* (2/6/95) Prepare Memory for IO*/
scsiBusDataReserved = (long)0x80000000 /* */
};
/* scsiScanFlags field bits */
enum {
scsiBusScansDevices = 0x80, /* Bus scans for and maintains device list */
scsiBusScansOnInit = 0x40, /* Bus scans performed at power-up/reboot */
scsiBusLoadsROMDrivers = 0x20 /* may load ROM drivers to support targets */
};
/* scsiFeatureFlags field bits */
enum {
scsiBusLVD = 0x00000400, /* HBA is Low Voltage Differential Bus */
scsiBusUltra3SCSI = 0x00000200, /* HBA supports Ultra3 SCSI */
scsiBusUltra2SCSI = 0x00000100, /* HBA supports Ultra2 SCSI */
scsiBusInternalExternalMask = 0x000000C0, /* bus internal/external mask */
scsiBusInternalExternalUnknown = 0x00000000, /* not known whether bus is inside or outside */
scsiBusInternalExternal = 0x000000C0, /* bus goes inside and outside the box */
scsiBusInternal = 0x00000080, /* bus goes inside the box */
scsiBusExternal = 0x00000040, /* bus goes outside the box */
scsiBusCacheCoherentDMA = 0x00000020, /* DMA is cache coherent */
scsiBusOldCallCapable = 0x00000010, /* SIM is old call capable */
scsiBusUltraSCSI = 0x00000008, /* HBA supports Ultra SCSI */
scsiBusDifferential = 0x00000004, /* Single Ended (0) or Differential (1) */
scsiBusFastSCSI = 0x00000002, /* HBA supports fast SCSI */
scsiBusDMAavailable = 0x00000001 /* DMA is available */
};
/* scsiWeirdStuff field bits */
enum {
scsiOddDisconnectUnsafeRead1 = 0x0001, /* Disconnects on odd byte boundries are unsafe with DMA and/or blind reads */
scsiOddDisconnectUnsafeWrite1 = 0x0002, /* Disconnects on odd byte boundries are unsafe with DMA and/or blind writes */
scsiBusErrorsUnsafe = 0x0004, /* Non-handshaked delays or disconnects during blind transfers may cause a crash */
scsiRequiresHandshake = 0x0008, /* Non-handshaked delays or disconnects during blind transfers may cause data corruption */
scsiTargetDrivenSDTRSafe = 0x0010, /* Targets which initiate synchronous negotiations are supported */
scsiOddCountForPhysicalUnsafe = 0x0020, /* If using physical addrs all counts must be even, and disconnects must be on even boundries */
scsiAbortCmdFixed = 0x0040, /* Set if abort command is fixed to properly make callbacks */
scsiMeshACKTimingFixed = 0x0080 /* Set if bug allowing Mesh to release ACK prematurely is fixed */
};
/* scsiHBAslotType values */
enum {
scsiMotherboardBus = 0x00, /* A built in Apple supplied bus */
scsiNuBus = 0x01, /* A SIM on a NuBus card */
scsiPDSBus = 0x03, /* " on a PDS card */
scsiPCIBus = 0x04, /* " on a PCI bus card */
scsiPCMCIABus = 0x05, /* " on a PCMCIA card */
scsiFireWireBridgeBus = 0x06, /* " connected through a FireWire bridge */
scsiUSBBus = 0x07 /* " connected on a USB bus */
};
/* Defines for the scsiDriverFlags field (in SCSIDriverPB) */
enum {
scsiDeviceSensitive = 0x0001, /* Only driver should access this device */
scsiDeviceNoOldCallAccess = 0x0002 /* no old call access to this device */
};
/* SIMInitInfo PB */
/* directions are for SCSIRegisterBus call ( -> parm, <- result) */
struct SIMInitInfo {
Ptr SIMstaticPtr; /* <- alloc. ptr to the SIM's static vars */
long staticSize; /* -> num bytes SIM needs for static vars */
SIMInitUPP SIMInit; /* -> pointer to the SIM init routine */
SIMActionUPP SIMAction; /* -> pointer to the SIM action routine */
SCSIInterruptUPP SIM_ISR; /* reserved */
SCSIInterruptUPP SIMInterruptPoll; /* -> pointer to the SIM interrupt poll routine */
SIMActionUPP NewOldCall; /* -> pointer to the SIM NewOldCall routine */
UInt16 ioPBSize; /* -> size of SCSI_IO_PBs required for this SIM */
Boolean oldCallCapable; /* -> true if this SIM can handle old-API calls */
UInt8 simInfoUnused1; /* reserved */
long simInternalUse; /* xx not affected or viewed by XPT */
SCSIUPP XPT_ISR; /* reserved */
SCSIUPP EnteringSIM; /* <- ptr to the EnteringSIM routine */
SCSIUPP ExitingSIM; /* <- ptr to the ExitingSIM routine */
SCSIMakeCallbackUPP MakeCallback; /* <- the XPT layer's SCSIMakeCallback routine */
UInt16 busID; /* <- bus number for the registered bus */
UInt8 simSlotNumber; /* <- Magic cookie to place in scsiHBASlotNumber (PCI) */
UInt8 simSRsrcID; /* <- Magic cookie to place in scsiSIMsRsrcID (PCI) */
Ptr simRegEntry; /* -> The SIM's RegEntryIDPtr (PCI) */
};
typedef struct SIMInitInfo SIMInitInfo;
/* Glue between SCSI calls and SCSITrap format */
enum {
xptSCSIAction = 0x0001,
xptSCSIRegisterBus = 0x0002,
xptSCSIDeregisterBus = 0x0003,
xptSCSIReregisterBus = 0x0004,
xptSCSIKillXPT = 0x0005, /* kills Mini-XPT after transition */
xptSCSIInitialize = 0x000A /* Initialize the SCSI manager */
};
/*
* SCSI bus status. These values are returned by the SCSI target in the status phase.
* They are not related to Macintosh status values (except that values other than
* scsiStatusGood will result in scsiResult set to scsiNonZeroStatus).
*/
enum {
scsiStatGood = 0x00, /* Good Status*/
scsiStatCheckCondition = 0x02, /* Check Condition*/
scsiStatConditionMet = 0x04, /* Condition Met*/
scsiStatBusy = 0x08, /* Busy*/
scsiStatIntermediate = 0x10, /* Intermediate*/
scsiStatIntermedMet = 0x14, /* Intermediate - Condition Met*/
scsiStatResvConflict = 0x18, /* Reservation conflict*/
scsiStatTerminated = 0x22, /* Command terminated*/
scsiStatQFull = 0x28 /* Queue full*/
};
/* SCSI messages*/
enum {
kCmdCompleteMsg = 0,
kExtendedMsg = 1, /* 0x01*/
kSaveDataPointerMsg = 2, /* 0x02*/
kRestorePointersMsg = 3, /* 0x03*/
kDisconnectMsg = 4, /* 0x04*/
kInitiatorDetectedErrorMsg = 5, /* 0x05*/
kAbortMsg = 6, /* 0x06*/
kMsgRejectMsg = 7, /* 0x07*/
kNoOperationMsg = 8, /* 0x08*/
kMsgParityErrorMsg = 9, /* 0x09*/
kLinkedCmdCompleteMsg = 10, /* 0x0a*/
kLinkedCmdCompleteWithFlagMsg = 11, /* 0x0b*/
kBusDeviceResetMsg = 12, /* 0x0c*/
kAbortTagMsg = 13, /* 0x0d*/
kClearQueueMsg = 14, /* 0x0e*/
kInitiateRecoveryMsg = 15, /* 0x0f*/
kReleaseRecoveryMsg = 16, /* 0x10*/
kTerminateIOProcessMsg = 17, /* 0x11*/
kSimpleQueueTag = 0x20, /* 0x20*/
kHeadOfQueueTagMsg = 0x21, /* 0x21*/
kOrderedQueueTagMsg = 0x22, /* 0x22*/
kIgnoreWideResidueMsg = 0x23 /* 0x23*/
};
/*
* SCSIAction()
*
* Discussion:
* This routine is deprecated. It is exported and callable, but it
* is no longer being maintained. Please use SCSITaskUserClient
* instead.
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.5 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter __D0 SCSIAction(__A0)
#endif
EXTERN_API( OSErr )
SCSIAction(SCSI_PB * parameterBlock) TWOWORDINLINE(0x7001, 0xA089);
#if CALL_NOT_IN_CARBON
/*
* SCSIRegisterBus()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.5 and later
* CarbonLib: not available
* Mac OS X: not available
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter __D0 SCSIRegisterBus(__A0)
#endif
EXTERN_API( OSErr )
SCSIRegisterBus(SIMInitInfo * parameterBlock) TWOWORDINLINE(0x7002, 0xA089);
/*
* SCSIDeregisterBus()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.5 and later
* CarbonLib: not available
* Mac OS X: not available
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter __D0 SCSIDeregisterBus(__A0)
#endif
EXTERN_API( OSErr )
SCSIDeregisterBus(SCSI_PB * parameterBlock) TWOWORDINLINE(0x7003, 0xA089);
/*
* SCSIReregisterBus()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.5 and later
* CarbonLib: not available
* Mac OS X: not available
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter __D0 SCSIReregisterBus(__A0)
#endif
EXTERN_API( OSErr )
SCSIReregisterBus(SIMInitInfo * parameterBlock) TWOWORDINLINE(0x7004, 0xA089);
/*
* SCSIKillXPT()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 7.5 and later
* CarbonLib: not available
* Mac OS X: not available
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter __D0 SCSIKillXPT(__A0)
#endif
EXTERN_API( OSErr )
SCSIKillXPT(SIMInitInfo * parameterBlock) TWOWORDINLINE(0x7005, 0xA089);
#endif /* CALL_NOT_IN_CARBON */
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
#ifdef __cplusplus
}
#endif
#endif /* __SCSI__ */
|