SCSI.pas 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. {
  2. File: OSServices/SCSI.h
  3. Contains: SCSI Family Interfaces.
  4. Version: OSServices-352~2
  5. Copyright: © 1986-2008 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://bugs.freepascal.org
  9. }
  10. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 308
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  17. {$mode macpas}
  18. {$packenum 1}
  19. {$macro on}
  20. {$inline on}
  21. {$calling mwpascal}
  22. unit SCSI;
  23. interface
  24. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  25. {$setc GAP_INTERFACES_VERSION := $0308}
  26. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  27. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  28. {$endc}
  29. {$ifc defined CPUPOWERPC and defined CPUI386}
  30. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  31. {$endc}
  32. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  33. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  34. {$endc}
  35. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  36. {$setc __ppc__ := 1}
  37. {$elsec}
  38. {$setc __ppc__ := 0}
  39. {$endc}
  40. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  41. {$setc __ppc64__ := 1}
  42. {$elsec}
  43. {$setc __ppc64__ := 0}
  44. {$endc}
  45. {$ifc not defined __i386__ and defined CPUI386}
  46. {$setc __i386__ := 1}
  47. {$elsec}
  48. {$setc __i386__ := 0}
  49. {$endc}
  50. {$ifc not defined __x86_64__ and defined CPUX86_64}
  51. {$setc __x86_64__ := 1}
  52. {$elsec}
  53. {$setc __x86_64__ := 0}
  54. {$endc}
  55. {$ifc not defined __arm__ and defined CPUARM}
  56. {$setc __arm__ := 1}
  57. {$elsec}
  58. {$setc __arm__ := 0}
  59. {$endc}
  60. {$ifc not defined __arm64__ and defined CPUAARCH64}
  61. {$setc __arm64__ := 1}
  62. {$elsec}
  63. {$setc __arm64__ := 0}
  64. {$endc}
  65. {$ifc defined cpu64}
  66. {$setc __LP64__ := 1}
  67. {$elsec}
  68. {$setc __LP64__ := 0}
  69. {$endc}
  70. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  71. {$error Conflicting definitions for __ppc__ and __i386__}
  72. {$endc}
  73. {$ifc defined __ppc__ and __ppc__}
  74. {$setc TARGET_CPU_PPC := TRUE}
  75. {$setc TARGET_CPU_PPC64 := FALSE}
  76. {$setc TARGET_CPU_X86 := FALSE}
  77. {$setc TARGET_CPU_X86_64 := FALSE}
  78. {$setc TARGET_CPU_ARM := FALSE}
  79. {$setc TARGET_CPU_ARM64 := FALSE}
  80. {$setc TARGET_OS_MAC := TRUE}
  81. {$setc TARGET_OS_IPHONE := FALSE}
  82. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  83. {$setc TARGET_OS_EMBEDDED := FALSE}
  84. {$elifc defined __ppc64__ and __ppc64__}
  85. {$setc TARGET_CPU_PPC := FALSE}
  86. {$setc TARGET_CPU_PPC64 := TRUE}
  87. {$setc TARGET_CPU_X86 := FALSE}
  88. {$setc TARGET_CPU_X86_64 := FALSE}
  89. {$setc TARGET_CPU_ARM := FALSE}
  90. {$setc TARGET_CPU_ARM64 := FALSE}
  91. {$setc TARGET_OS_MAC := TRUE}
  92. {$setc TARGET_OS_IPHONE := FALSE}
  93. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  94. {$setc TARGET_OS_EMBEDDED := FALSE}
  95. {$elifc defined __i386__ and __i386__}
  96. {$setc TARGET_CPU_PPC := FALSE}
  97. {$setc TARGET_CPU_PPC64 := FALSE}
  98. {$setc TARGET_CPU_X86 := TRUE}
  99. {$setc TARGET_CPU_X86_64 := FALSE}
  100. {$setc TARGET_CPU_ARM := FALSE}
  101. {$setc TARGET_CPU_ARM64 := FALSE}
  102. {$ifc defined(iphonesim)}
  103. {$setc TARGET_OS_MAC := FALSE}
  104. {$setc TARGET_OS_IPHONE := TRUE}
  105. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  106. {$elsec}
  107. {$setc TARGET_OS_MAC := TRUE}
  108. {$setc TARGET_OS_IPHONE := FALSE}
  109. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  110. {$endc}
  111. {$setc TARGET_OS_EMBEDDED := FALSE}
  112. {$elifc defined __x86_64__ and __x86_64__}
  113. {$setc TARGET_CPU_PPC := FALSE}
  114. {$setc TARGET_CPU_PPC64 := FALSE}
  115. {$setc TARGET_CPU_X86 := FALSE}
  116. {$setc TARGET_CPU_X86_64 := TRUE}
  117. {$setc TARGET_CPU_ARM := FALSE}
  118. {$setc TARGET_CPU_ARM64 := FALSE}
  119. {$ifc defined(iphonesim)}
  120. {$setc TARGET_OS_MAC := FALSE}
  121. {$setc TARGET_OS_IPHONE := TRUE}
  122. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  123. {$elsec}
  124. {$setc TARGET_OS_MAC := TRUE}
  125. {$setc TARGET_OS_IPHONE := FALSE}
  126. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  127. {$endc}
  128. {$setc TARGET_OS_EMBEDDED := FALSE}
  129. {$elifc defined __arm__ and __arm__}
  130. {$setc TARGET_CPU_PPC := FALSE}
  131. {$setc TARGET_CPU_PPC64 := FALSE}
  132. {$setc TARGET_CPU_X86 := FALSE}
  133. {$setc TARGET_CPU_X86_64 := FALSE}
  134. {$setc TARGET_CPU_ARM := TRUE}
  135. {$setc TARGET_CPU_ARM64 := FALSE}
  136. { will require compiler define when/if other Apple devices with ARM cpus ship }
  137. {$setc TARGET_OS_MAC := FALSE}
  138. {$setc TARGET_OS_IPHONE := TRUE}
  139. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  140. {$setc TARGET_OS_EMBEDDED := TRUE}
  141. {$elifc defined __arm64__ and __arm64__}
  142. {$setc TARGET_CPU_PPC := FALSE}
  143. {$setc TARGET_CPU_PPC64 := FALSE}
  144. {$setc TARGET_CPU_X86 := FALSE}
  145. {$setc TARGET_CPU_X86_64 := FALSE}
  146. {$setc TARGET_CPU_ARM := FALSE}
  147. {$setc TARGET_CPU_ARM64 := TRUE}
  148. { will require compiler define when/if other Apple devices with ARM cpus ship }
  149. {$setc TARGET_OS_MAC := FALSE}
  150. {$setc TARGET_OS_IPHONE := TRUE}
  151. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  152. {$setc TARGET_OS_EMBEDDED := TRUE}
  153. {$elsec}
  154. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  155. {$endc}
  156. {$ifc defined __LP64__ and __LP64__ }
  157. {$setc TARGET_CPU_64 := TRUE}
  158. {$elsec}
  159. {$setc TARGET_CPU_64 := FALSE}
  160. {$endc}
  161. {$ifc defined FPC_BIG_ENDIAN}
  162. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  163. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  164. {$elifc defined FPC_LITTLE_ENDIAN}
  165. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  166. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  167. {$elsec}
  168. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  169. {$endc}
  170. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  171. {$setc CALL_NOT_IN_CARBON := FALSE}
  172. {$setc OLDROUTINENAMES := FALSE}
  173. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  174. {$setc OPAQUE_UPP_TYPES := TRUE}
  175. {$setc OTCARBONAPPLICATION := TRUE}
  176. {$setc OTKERNEL := FALSE}
  177. {$setc PM_USE_SESSION_APIS := TRUE}
  178. {$setc TARGET_API_MAC_CARBON := TRUE}
  179. {$setc TARGET_API_MAC_OS8 := FALSE}
  180. {$setc TARGET_API_MAC_OSX := TRUE}
  181. {$setc TARGET_CARBON := TRUE}
  182. {$setc TARGET_CPU_68K := FALSE}
  183. {$setc TARGET_CPU_MIPS := FALSE}
  184. {$setc TARGET_CPU_SPARC := FALSE}
  185. {$setc TARGET_OS_UNIX := FALSE}
  186. {$setc TARGET_OS_WIN32 := FALSE}
  187. {$setc TARGET_RT_MAC_68881 := FALSE}
  188. {$setc TARGET_RT_MAC_CFM := FALSE}
  189. {$setc TARGET_RT_MAC_MACHO := TRUE}
  190. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  191. {$setc TYPE_BOOL := FALSE}
  192. {$setc TYPE_EXTENDED := FALSE}
  193. {$setc TYPE_LONGLONG := TRUE}
  194. uses MacTypes,MixedMode,AppleDiskPartitions;
  195. {$endc} {not MACOSALLINCLUDE}
  196. {$ifc TARGET_OS_MAC and not TARGET_CPU_64}
  197. {$ALIGN MAC68K}
  198. { TIB opcodes }
  199. const
  200. scInc = 1;
  201. scNoInc = 2;
  202. scAdd = 3;
  203. scMove = 4;
  204. scLoop = 5;
  205. scNop = 6;
  206. scStop = 7;
  207. scComp = 8;
  208. { TIB instruction }
  209. type
  210. SCSIInstrPtr = ^SCSIInstr;
  211. SCSIInstr = record
  212. scOpcode: UInt16;
  213. scParam1: SIGNEDLONG;
  214. scParam2: SIGNEDLONG;
  215. end;
  216. {
  217. * SCSIReset()
  218. *
  219. * Availability:
  220. * Mac OS X: not available
  221. * CarbonLib: not available
  222. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  223. }
  224. {
  225. * SCSIGet()
  226. *
  227. * Availability:
  228. * Mac OS X: not available
  229. * CarbonLib: not available
  230. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  231. }
  232. {
  233. * SCSISelect()
  234. *
  235. * Availability:
  236. * Mac OS X: not available
  237. * CarbonLib: not available
  238. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  239. }
  240. {
  241. * SCSICmd()
  242. *
  243. * Availability:
  244. * Mac OS X: not available
  245. * CarbonLib: not available
  246. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  247. }
  248. {
  249. * SCSIRead()
  250. *
  251. * Availability:
  252. * Mac OS X: not available
  253. * CarbonLib: not available
  254. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  255. }
  256. {
  257. * SCSIRBlind()
  258. *
  259. * Availability:
  260. * Mac OS X: not available
  261. * CarbonLib: not available
  262. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  263. }
  264. {
  265. * SCSIWrite()
  266. *
  267. * Availability:
  268. * Mac OS X: not available
  269. * CarbonLib: not available
  270. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  271. }
  272. {
  273. * SCSIWBlind()
  274. *
  275. * Availability:
  276. * Mac OS X: not available
  277. * CarbonLib: not available
  278. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  279. }
  280. {
  281. * SCSIComplete()
  282. *
  283. * Availability:
  284. * Mac OS X: not available
  285. * CarbonLib: not available
  286. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  287. }
  288. {
  289. * SCSIStat()
  290. *
  291. * Availability:
  292. * Mac OS X: not available
  293. * CarbonLib: not available
  294. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  295. }
  296. {
  297. * SCSISelAtn()
  298. *
  299. * Availability:
  300. * Mac OS X: not available
  301. * CarbonLib: not available
  302. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  303. }
  304. {
  305. * SCSIMsgIn()
  306. *
  307. * Availability:
  308. * Mac OS X: not available
  309. * CarbonLib: not available
  310. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  311. }
  312. {
  313. * SCSIMsgOut()
  314. *
  315. * Availability:
  316. * Mac OS X: not available
  317. * CarbonLib: not available
  318. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  319. }
  320. const
  321. scsiVERSION = 43;
  322. {
  323. * SCSI Completion routine callback for SCSIAction.
  324. }
  325. type
  326. SCSICallbackProcPtr = procedure( scsiPB: UnivPtr );
  327. SCSICallbackUPP = SCSICallbackProcPtr;
  328. {
  329. * NewSCSICallbackUPP()
  330. *
  331. * Availability:
  332. * Mac OS X: in version 10.0 and later in CoreServices.framework
  333. * CarbonLib: in CarbonLib 1.3 and later
  334. * Non-Carbon CFM: available as macro/inline
  335. }
  336. function NewSCSICallbackUPP( userRoutine: SCSICallbackProcPtr ): SCSICallbackUPP; external name '_NewSCSICallbackUPP';
  337. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2 *)
  338. {
  339. * DisposeSCSICallbackUPP()
  340. *
  341. * Availability:
  342. * Mac OS X: in version 10.0 and later in CoreServices.framework
  343. * CarbonLib: in CarbonLib 1.3 and later
  344. * Non-Carbon CFM: available as macro/inline
  345. }
  346. procedure DisposeSCSICallbackUPP( userUPP: SCSICallbackUPP ); external name '_DisposeSCSICallbackUPP';
  347. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2 *)
  348. {
  349. * InvokeSCSICallbackUPP()
  350. *
  351. * Availability:
  352. * Mac OS X: in version 10.0 and later in CoreServices.framework
  353. * CarbonLib: in CarbonLib 1.3 and later
  354. * Non-Carbon CFM: available as macro/inline
  355. }
  356. procedure InvokeSCSICallbackUPP( scsiPB: UnivPtr; userUPP: SCSICallbackUPP ); external name '_InvokeSCSICallbackUPP';
  357. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2 *)
  358. {
  359. SCSI Manager 4.3 function codes
  360. }
  361. const
  362. SCSINop = $00; { Execute nothing }
  363. SCSIExecIO = $01; { Execute the specified IO }
  364. SCSIBusInquiry = $03; { Get parameters for entire path of HBAs }
  365. SCSIReleaseQ = $04; { Release the frozen SIM queue for particular LUN }
  366. SCSIAbortCommand = $10; { Abort the selected Control Block }
  367. SCSIResetBus = $11; { Reset the SCSI bus }
  368. SCSIResetDevice = $12; { Reset the SCSI device }
  369. SCSITerminateIO = $13; { Terminate any pending IO }
  370. const
  371. vendorUnique = $C0; { 0xC0 thru 0xFF }
  372. { Allocation length defines for some of the fields }
  373. const
  374. handshakeDataLength = 8; { Handshake data length }
  375. maxCDBLength = 16; { Space for the CDB bytes/pointer }
  376. vendorIDLength = 16; { ASCII string len for Vendor ID }
  377. { Define DeviceIdent structure }
  378. type
  379. DeviceIdentPtr = ^DeviceIdent;
  380. DeviceIdent = record
  381. diReserved: UInt8; { reserved }
  382. bus: UInt8; { SCSI - Bus Number }
  383. targetID: UInt8; { SCSI - Target SCSI ID }
  384. LUN: UInt8; { SCSI - LUN }
  385. end;
  386. { Constants for the diReserved field of DeviceIdent }
  387. { used to distinguish whether the DeviceIdent holds }
  388. { information about a SCSI device (kBusTypeSCSI) }
  389. { or an ATA device (kBusTypeATA). The other }
  390. { constants are pretty much deprecated. Let me }
  391. { know if you see any. }
  392. const
  393. kBusTypeSCSI = 0;
  394. kBusTypeATA = 1;
  395. kBusTypePCMCIA = 2;
  396. kBusTypeMediaBay = 3;
  397. { If diReserved indicates that a DeviceIdent is }
  398. { really for ATA, you can cast it to DeviceIdentATA }
  399. { to get at the important fields. }
  400. type
  401. DeviceIdentATAPtr = ^DeviceIdentATA;
  402. DeviceIdentATA = record
  403. diReserved: UInt8;
  404. busNum: UInt8;
  405. devNum: UInt8;
  406. diReserved2: UInt8;
  407. end;
  408. { Command Descriptor Block structure }
  409. type
  410. CDBPtr = ^CDB;
  411. CDB = record
  412. case SInt16 of
  413. 0: (
  414. cdbPtr: BytePtr; { pointer to the CDB, or }
  415. );
  416. 1: (
  417. cdbBytes: packed array [0..15] of UInt8; { the actual CDB to send }
  418. );
  419. end;
  420. { Scatter/gather list element (Deprecated for MacOS8) }
  421. type
  422. SGRecordPtr = ^SGRecord;
  423. SGRecord = record
  424. SGAddr: Ptr;
  425. SGCount: UInt32;
  426. end;
  427. SCSIHdrPtr = ^SCSIHdr;
  428. SCSIHdr = record
  429. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  430. scsiReserved1: SInt16; { -> reserved for input }
  431. scsiPBLength: UInt16; { -> Length of the entire PB }
  432. scsiFunctionCode: UInt8; { -> function selector }
  433. scsiReserved2: UInt8; { <- reserved for output }
  434. scsiResult: {volatile} OSErr; { <- Returned result }
  435. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  436. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  437. scsiFlags: UInt32; { -> assorted flags }
  438. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  439. scsiXPTprivate: Ptr; { private field for use in XPT }
  440. scsiReserved3: SIGNEDLONG; { reserved }
  441. end;
  442. type
  443. SCSI_PBPtr = ^SCSI_PB;
  444. SCSI_PB = record
  445. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  446. scsiReserved1: SInt16; { -> reserved for input }
  447. scsiPBLength: UInt16; { -> Length of the entire PB }
  448. scsiFunctionCode: UInt8; { -> function selector }
  449. scsiReserved2: UInt8; { <- reserved for output }
  450. scsiResult: {volatile} OSErr; { <- Returned result }
  451. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  452. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  453. scsiFlags: UInt32; { -> assorted flags }
  454. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  455. scsiXPTprivate: Ptr; { private field for use in XPT }
  456. scsiReserved3: SIGNEDLONG; { reserved }
  457. end;
  458. type
  459. SCSI_IOPtr = ^SCSI_IO;
  460. SCSI_IO = record
  461. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  462. scsiReserved1: SInt16; { -> reserved for input }
  463. scsiPBLength: UInt16; { -> Length of the entire PB }
  464. scsiFunctionCode: UInt8; { -> function selector }
  465. scsiReserved2: UInt8; { <- reserved for output }
  466. scsiResult: {volatile} OSErr; { <- Returned result }
  467. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  468. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  469. scsiFlags: UInt32; { -> assorted flags }
  470. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  471. scsiXPTprivate: Ptr; { private field for use in XPT }
  472. scsiReserved3: SIGNEDLONG; { reserved }
  473. scsiResultFlags: UInt16; { <- Flags which modify the scsiResult field }
  474. scsiReserved3pt5: UInt16; { -> Reserved }
  475. scsiDataPtr: BytePtr; { -> Pointer to the data buffer or the S/G list }
  476. scsiDataLength: UInt32; { -> Data transfer length }
  477. scsiSensePtr: BytePtr; { -> Ptr to autosense data buffer }
  478. scsiSenseLength: UInt8; { -> size of the autosense buffer }
  479. scsiCDBLength: UInt8; { -> Number of bytes for the CDB }
  480. scsiSGListCount: UInt16; { -> num of scatter gather list entries }
  481. scsiReserved4: UInt32; { <- reserved for output }
  482. scsiSCSIstatus: UInt8; { <- Returned scsi device status }
  483. scsiSenseResidual: SInt8; { <- Autosense residual length }
  484. scsiReserved5: UInt16; { <- reserved for output }
  485. scsiDataResidual: SIGNEDLONG; { <- Returned Transfer residual length }
  486. scsiCDB: CDB; { -> Actual CDB or pointer to CDB }
  487. scsiTimeout: SIGNEDLONG; { -> Timeout value (Time Mgr format) (CAM timeout) }
  488. scsiReserved5pt5: BytePtr; { -> Reserved }
  489. scsiReserved5pt6: UInt16; { -> Reserved }
  490. scsiIOFlags: UInt16; { -> additional I/O flags }
  491. scsiTagAction: UInt8; { -> What to do for tag queuing }
  492. scsiReserved6: UInt8; { -> reserved for input }
  493. scsiReserved7: UInt16; { -> reserved for input }
  494. scsiSelectTimeout: UInt16; { -> Select timeout value }
  495. scsiDataType: UInt8; { -> Data description type (i.e. buffer, TIB, S/G) }
  496. scsiTransferType: UInt8; { -> Transfer type (i.e. Blind vs Polled) }
  497. scsiReserved8: UInt32; { -> reserved for input }
  498. scsiReserved9: UInt32; { -> reserved for input }
  499. scsiHandshake: array [0..7] of UInt16; { -> handshaking points (null term'd) }
  500. scsiReserved10: UInt32; { -> reserved for input }
  501. scsiReserved11: UInt32; { -> reserved for input }
  502. scsiCommandLink: SCSI_IOPtr; { -> Ptr to the next PB in linked cmd chain }
  503. scsiSIMpublics: packed array [0..7] of UInt8; { -> reserved for input to 3rd-party SIMs }
  504. scsiAppleReserved6: packed array [0..7] of UInt8; { -> reserved for input }
  505. { XPT layer privates (for old-API emulation) }
  506. scsiCurrentPhase: UInt16; { <- phase upon completing old call }
  507. scsiSelector: SInt16; { -> selector specified in old calls }
  508. scsiOldCallResult: OSErr; { <- result of old call }
  509. scsiSCSImessage: UInt8; { <- Returned scsi device message (for SCSIComplete)}
  510. XPTprivateFlags: UInt8; { <> various flags }
  511. XPTextras: packed array [0..11] of UInt8; { }
  512. end;
  513. SCSIExecIOPB = SCSI_IO;
  514. SCSIExecIOPBPtr = ^SCSIExecIOPB;
  515. { Bus inquiry PB }
  516. SCSIBusInquiryPBPtr = ^SCSIBusInquiryPB;
  517. SCSIBusInquiryPB = record
  518. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  519. scsiReserved1: SInt16; { -> reserved for input }
  520. scsiPBLength: UInt16; { -> Length of the entire PB }
  521. scsiFunctionCode: UInt8; { -> function selector }
  522. scsiReserved2: UInt8; { <- reserved for output }
  523. scsiResult: {volatile} OSErr; { <- Returned result }
  524. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  525. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  526. scsiFlags: UInt32; { -> assorted flags }
  527. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  528. scsiXPTprivate: Ptr; { private field for use in XPT }
  529. scsiReserved3: SIGNEDLONG; { reserved }
  530. scsiEngineCount: UInt16; { <- Number of engines on HBA }
  531. scsiMaxTransferType: UInt16; { <- Number of transfer types for this HBA }
  532. scsiDataTypes: UInt32; { <- which data types are supported by this SIM }
  533. scsiIOpbSize: UInt16; { <- Size of SCSI_IO PB for this SIM/HBA }
  534. scsiMaxIOpbSize: UInt16; { <- Size of max SCSI_IO PB for all SIM/HBAs }
  535. scsiFeatureFlags: UInt32; { <- Supported features flags field }
  536. scsiVersionNumber: UInt8; { <- Version number for the SIM/HBA }
  537. scsiHBAInquiry: UInt8; { <- Mimic of INQ byte 7 for the HBA }
  538. scsiTargetModeFlags: UInt8; { <- Flags for target mode support }
  539. scsiScanFlags: UInt8; { <- Scan related feature flags }
  540. scsiSIMPrivatesPtr: UInt32; { <- Ptr to SIM private data area }
  541. scsiSIMPrivatesSize: UInt32; { <- Size of SIM private data area }
  542. scsiAsyncFlags: UInt32; { <- Event cap. for Async Callback }
  543. scsiHiBusID: UInt8; { <- Highest path ID in the subsystem }
  544. scsiInitiatorID: UInt8; { <- ID of the HBA on the SCSI bus }
  545. scsiBIReserved0: UInt16; { }
  546. scsiBIReserved1: UInt32; { <- }
  547. scsiFlagsSupported: UInt32; { <- which scsiFlags are supported }
  548. scsiIOFlagsSupported: UInt16; { <- which scsiIOFlags are supported }
  549. scsiWeirdStuff: UInt16; { <- }
  550. scsiMaxTarget: UInt16; { <- maximum Target number supported }
  551. scsiMaxLUN: UInt16; { <- maximum Logical Unit number supported }
  552. scsiSIMVendor: packed array [0..15] of char; { <- Vendor ID of SIM (or XPT if bus<FF) }
  553. scsiHBAVendor: packed array [0..15] of char; { <- Vendor ID of the HBA }
  554. scsiControllerFamily: packed array [0..15] of char; { <- Family of SCSI Controller }
  555. scsiControllerType: packed array [0..15] of char; { <- Specific Model of SCSI Controller used }
  556. scsiXPTversion: packed array [0..3] of char; { <- version number of XPT }
  557. scsiSIMversion: packed array [0..3] of char; { <- version number of SIM }
  558. scsiHBAversion: packed array [0..3] of char; { <- version number of HBA }
  559. scsiHBAslotType: UInt8; { <- type of "slot" that this HBA is in }
  560. scsiHBAslotNumber: UInt8; { <- slot number of this HBA }
  561. scsiSIMsRsrcID: UInt16; { <- resource ID of this SIM }
  562. scsiBIReserved3: UInt16; { <- }
  563. scsiAdditionalLength: UInt16; { <- additional BusInquiry PB len }
  564. end;
  565. { Abort SIM Request PB }
  566. type
  567. SCSIAbortCommandPBPtr = ^SCSIAbortCommandPB;
  568. SCSIAbortCommandPB = record
  569. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  570. scsiReserved1: SInt16; { -> reserved for input }
  571. scsiPBLength: UInt16; { -> Length of the entire PB }
  572. scsiFunctionCode: UInt8; { -> function selector }
  573. scsiReserved2: UInt8; { <- reserved for output }
  574. scsiResult: {volatile} OSErr; { <- Returned result }
  575. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  576. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  577. scsiFlags: UInt32; { -> assorted flags }
  578. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  579. scsiXPTprivate: Ptr; { private field for use in XPT }
  580. scsiReserved3: SIGNEDLONG; { reserved }
  581. scsiIOptr: SCSI_IOPtr; { Pointer to the PB to abort }
  582. end;
  583. { Terminate I/O Process Request PB }
  584. type
  585. SCSITerminateIOPBPtr = ^SCSITerminateIOPB;
  586. SCSITerminateIOPB = record
  587. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  588. scsiReserved1: SInt16; { -> reserved for input }
  589. scsiPBLength: UInt16; { -> Length of the entire PB }
  590. scsiFunctionCode: UInt8; { -> function selector }
  591. scsiReserved2: UInt8; { <- reserved for output }
  592. scsiResult: {volatile} OSErr; { <- Returned result }
  593. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  594. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  595. scsiFlags: UInt32; { -> assorted flags }
  596. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  597. scsiXPTprivate: Ptr; { private field for use in XPT }
  598. scsiReserved3: SIGNEDLONG; { reserved }
  599. scsiIOptr: SCSI_IOPtr; { Pointer to the PB to terminate }
  600. end;
  601. { Reset SCSI Bus PB }
  602. type
  603. SCSIResetBusPBPtr = ^SCSIResetBusPB;
  604. SCSIResetBusPB = record
  605. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  606. scsiReserved1: SInt16; { -> reserved for input }
  607. scsiPBLength: UInt16; { -> Length of the entire PB }
  608. scsiFunctionCode: UInt8; { -> function selector }
  609. scsiReserved2: UInt8; { <- reserved for output }
  610. scsiResult: {volatile} OSErr; { <- Returned result }
  611. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  612. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  613. scsiFlags: UInt32; { -> assorted flags }
  614. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  615. scsiXPTprivate: Ptr; { private field for use in XPT }
  616. scsiReserved3: SIGNEDLONG; { reserved }
  617. end;
  618. { Reset SCSI Device PB }
  619. type
  620. SCSIResetDevicePBPtr = ^SCSIResetDevicePB;
  621. SCSIResetDevicePB = record
  622. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  623. scsiReserved1: SInt16; { -> reserved for input }
  624. scsiPBLength: UInt16; { -> Length of the entire PB }
  625. scsiFunctionCode: UInt8; { -> function selector }
  626. scsiReserved2: UInt8; { <- reserved for output }
  627. scsiResult: {volatile} OSErr; { <- Returned result }
  628. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  629. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  630. scsiFlags: UInt32; { -> assorted flags }
  631. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  632. scsiXPTprivate: Ptr; { private field for use in XPT }
  633. scsiReserved3: SIGNEDLONG; { reserved }
  634. end;
  635. { Release SIM Queue PB }
  636. type
  637. SCSIReleaseQPBPtr = ^SCSIReleaseQPB;
  638. SCSIReleaseQPB = record
  639. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  640. scsiReserved1: SInt16; { -> reserved for input }
  641. scsiPBLength: UInt16; { -> Length of the entire PB }
  642. scsiFunctionCode: UInt8; { -> function selector }
  643. scsiReserved2: UInt8; { <- reserved for output }
  644. scsiResult: {volatile} OSErr; { <- Returned result }
  645. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  646. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  647. scsiFlags: UInt32; { -> assorted flags }
  648. scsiDriverStorage: BytePtr; { <> Ptr for driver private use }
  649. scsiXPTprivate: Ptr; { private field for use in XPT }
  650. scsiReserved3: SIGNEDLONG; { reserved }
  651. end;
  652. { SCSI Get Virtual ID Info PB }
  653. type
  654. SCSIGetVirtualIDInfoPBPtr = ^SCSIGetVirtualIDInfoPB;
  655. SCSIGetVirtualIDInfoPB = record
  656. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  657. scsiReserved1: SInt16; { -> reserved for input }
  658. scsiPBLength: UInt16; { -> Length of the entire PB }
  659. scsiFunctionCode: UInt8; { -> function selector }
  660. scsiReserved2: UInt8; { <- reserved for output }
  661. scsiResult: {volatile} OSErr; { <- Returned result }
  662. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  663. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  664. scsiFlags: UInt32; { -> assorted flags }
  665. scsiDriverStorage: Ptr; { <> Ptr for driver private use }
  666. scsiXPTprivate: Ptr; { private field for use in XPT }
  667. scsiReserved3: SIGNEDLONG; { reserved }
  668. scsiOldCallID: UInt16; { -> SCSI ID of device in question }
  669. scsiExists: Boolean; { <- true if device exists }
  670. filler: SInt8;
  671. end;
  672. { Create/Lookup/Remove RefNum for Device PB }
  673. type
  674. SCSIDriverPBPtr = ^SCSIDriverPB;
  675. SCSIDriverPB = record
  676. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  677. scsiReserved1: SInt16; { -> reserved for input }
  678. scsiPBLength: UInt16; { -> Length of the entire PB }
  679. scsiFunctionCode: UInt8; { -> function selector }
  680. scsiReserved2: UInt8; { <- reserved for output }
  681. scsiResult: {volatile} OSErr; { <- Returned result }
  682. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  683. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  684. scsiFlags: UInt32; { -> assorted flags }
  685. scsiDriverStorage: Ptr; { <> Ptr for driver private use }
  686. scsiXPTprivate: Ptr; { private field for use in XPT }
  687. scsiReserved3: SIGNEDLONG; { reserved }
  688. scsiDriver: SInt16; { -> DriverRefNum, For SetDriver, <- For GetNextDriver }
  689. scsiDriverFlags: UInt16; { <> Details of driver/device }
  690. scsiNextDevice: DeviceIdent; { <- DeviceIdent of the NEXT Item in the list }
  691. end;
  692. { Load Driver PB }
  693. type
  694. SCSILoadDriverPBPtr = ^SCSILoadDriverPB;
  695. SCSILoadDriverPB = record
  696. qLink: SCSIHdrPtr; { (internal use, must be nil on entry) }
  697. scsiReserved1: SInt16; { -> reserved for input }
  698. scsiPBLength: UInt16; { -> Length of the entire PB }
  699. scsiFunctionCode: UInt8; { -> function selector }
  700. scsiReserved2: UInt8; { <- reserved for output }
  701. scsiResult: {volatile} OSErr; { <- Returned result }
  702. scsiDevice: DeviceIdent; { -> Device Identifier (bus+target+lun)}
  703. scsiCompletion: SCSICallbackUPP; { -> Callback on completion function }
  704. scsiFlags: UInt32; { -> assorted flags }
  705. scsiDriverStorage: Ptr; { <> Ptr for driver private use }
  706. scsiXPTprivate: Ptr; { private field for use in XPT }
  707. scsiReserved3: SIGNEDLONG; { reserved }
  708. scsiLoadedRefNum: SInt16; { <- SIM returns refnum of driver }
  709. scsiDiskLoadFailed: Boolean; { -> if true, indicates call after failure to load }
  710. filler: SInt8;
  711. end;
  712. { Defines for the scsiTransferType field }
  713. const
  714. scsiTransferBlind = 0;
  715. scsiTransferPolled = 1;
  716. const
  717. scsiErrorBase = -7936;
  718. const
  719. scsiRequestInProgress = 1; { 1 = PB request is in progress }
  720. { Execution failed 00-2F }
  721. scsiRequestAborted = scsiErrorBase + 2; { -7934 = PB request aborted by the host }
  722. scsiUnableToAbort = scsiErrorBase + 3; { -7933 = Unable to Abort PB request }
  723. scsiNonZeroStatus = scsiErrorBase + 4; { -7932 = PB request completed with an err }
  724. scsiUnused05 = scsiErrorBase + 5; { -7931 = }
  725. scsiUnused06 = scsiErrorBase + 6; { -7930 = }
  726. scsiUnused07 = scsiErrorBase + 7; { -7929 = }
  727. scsiUnused08 = scsiErrorBase + 8; { -7928 = }
  728. scsiUnableToTerminate = scsiErrorBase + 9; { -7927 = Unable to Terminate I/O PB req }
  729. scsiSelectTimeout = scsiErrorBase + 10; { -7926 = Target selection timeout }
  730. scsiCommandTimeout = scsiErrorBase + 11; { -7925 = Command timeout }
  731. scsiIdentifyMessageRejected = scsiErrorBase + 12; { -7924 = }
  732. scsiMessageRejectReceived = scsiErrorBase + 13; { -7923 = Message reject received }
  733. scsiSCSIBusReset = scsiErrorBase + 14; { -7922 = SCSI bus reset sent/received }
  734. scsiParityError = scsiErrorBase + 15; { -7921 = Uncorrectable parity error occured }
  735. scsiAutosenseFailed = scsiErrorBase + 16; { -7920 = Autosense: Request sense cmd fail }
  736. scsiUnused11 = scsiErrorBase + 17; { -7919 = }
  737. scsiDataRunError = scsiErrorBase + 18; { -7918 = Data overrun/underrun error }
  738. scsiUnexpectedBusFree = scsiErrorBase + 19; { -7917 = Unexpected BUS free }
  739. scsiSequenceFailed = scsiErrorBase + 20; { -7916 = Target bus phase sequence failure }
  740. scsiWrongDirection = scsiErrorBase + 21; { -7915 = Data phase was in wrong direction }
  741. scsiUnused16 = scsiErrorBase + 22; { -7914 = }
  742. scsiBDRsent = scsiErrorBase + 23; { -7913 = A SCSI BDR msg was sent to target }
  743. scsiTerminated = scsiErrorBase + 24; { -7912 = PB request terminated by the host }
  744. scsiNoNexus = scsiErrorBase + 25; { -7911 = Nexus is not established }
  745. scsiCDBReceived = scsiErrorBase + 26; { -7910 = The SCSI CDB has been received }
  746. { Couldn't begin execution 30-3F }
  747. scsiTooManyBuses = scsiErrorBase + 48; { -7888 = Register failed because we're full }
  748. scsiBusy = scsiErrorBase + 49; { -7887 = SCSI subsystem is busy }
  749. scsiProvideFail = scsiErrorBase + 50; { -7886 = Unable to provide requ. capability }
  750. scsiDeviceNotThere = scsiErrorBase + 51; { -7885 = SCSI device not installed/there }
  751. scsiNoHBA = scsiErrorBase + 52; { -7884 = No HBA detected Error }
  752. scsiDeviceConflict = scsiErrorBase + 53; { -7883 = sorry, max 1 refNum per DeviceIdent }
  753. scsiNoSuchXref = scsiErrorBase + 54; { -7882 = no such RefNum xref }
  754. scsiQLinkInvalid = scsiErrorBase + 55; { -7881 = pre-linked PBs not supported }
  755. { (The QLink field was nonzero) }
  756. { Parameter errors 40-7F }
  757. scsiPBLengthError = scsiErrorBase + 64; { -7872 = (scsiPBLength is insuf'ct/invalid }
  758. scsiFunctionNotAvailable = scsiErrorBase + 65; { -7871 = The requ. func is not available }
  759. scsiRequestInvalid = scsiErrorBase + 66; { -7870 = PB request is invalid }
  760. scsiBusInvalid = scsiErrorBase + 67; { -7869 = Bus ID supplied is invalid }
  761. scsiTIDInvalid = scsiErrorBase + 68; { -7868 = Target ID supplied is invalid }
  762. scsiLUNInvalid = scsiErrorBase + 69; { -7867 = LUN supplied is invalid }
  763. scsiIDInvalid = scsiErrorBase + 70; { -7866 = The initiator ID is invalid }
  764. scsiDataTypeInvalid = scsiErrorBase + 71; { -7865 = scsiDataType requested not supported }
  765. scsiTransferTypeInvalid = scsiErrorBase + 72; { -7864 = scsiTransferType field is too high }
  766. scsiCDBLengthInvalid = scsiErrorBase + 73; { -7863 = scsiCDBLength field is too big }
  767. { New errors for SCSI Family }
  768. const
  769. scsiUnused74 = scsiErrorBase + 74; { -7862 = }
  770. scsiUnused75 = scsiErrorBase + 75; { -7861 = }
  771. scsiBadDataLength = scsiErrorBase + 76; { -7860 = a zero data length in PB }
  772. scsiPartialPrepared = scsiErrorBase + 77; { -7859 = could not do full prepare mem for I/O}
  773. scsiInvalidMsgType = scsiErrorBase + 78; { -7858 = Invalid message type (internal) }
  774. scsiUnused79 = scsiErrorBase + 79; { -7857 = }
  775. scsiBadConnID = scsiErrorBase + 80; { -7856 = Bad Connection ID }
  776. scsiUnused81 = scsiErrorBase + 81; { -7855 = }
  777. scsiIOInProgress = scsiErrorBase + 82; { -7854 = Can't close conn, IO in prog }
  778. scsiTargetReserved = scsiErrorBase + 83; { -7853 = Target already reserved }
  779. scsiUnused84 = scsiErrorBase + 84; { -7852 = }
  780. scsiUnused85 = scsiErrorBase + 85; { -7851 = }
  781. scsiBadConnType = scsiErrorBase + 86; { -7850 = Bad connection type }
  782. scsiCannotLoadPlugin = scsiErrorBase + 87; { -7849 = No matching service category }
  783. { +++ }
  784. {
  785. * scsiFamilyInternalError and scsiPluginInternalError are intended to handle consistency check failures.
  786. * For example, if the family stores a record on a lookaside queue, but does not find that record
  787. * it can use this error to report this failure. SCSI Manager 4.3 uses dsIOCoreErr in a few places,
  788. * but this is probably not the best error. In general, internal errors should be reported as bugs.
  789. *
  790. * The following range of errors is provided for third-party (non-Apple) SCSI SIM and device driver vendors.
  791. * In general, they would be used for error conditions that are not covered by the standardized errors.
  792. * They should not normally be conveyed to normal applications, but might be used for communication between
  793. * a plug-in and a vendor-provided device driver (for example, to manage RAID hot-swapping).
  794. *
  795. * Note: I don't know how many SCSI errors are reserved in the error code architecture. Don't assume that
  796. * we'll actually get sixteen, but we should reserve at least one.
  797. }
  798. const
  799. scsiFamilyInternalError = scsiErrorBase + 87; { -7849 = Internal consistency check failed }
  800. scsiPluginInternalError = scsiErrorBase + 88; { -7848 = Internal consistency check failed }
  801. scsiVendorSpecificErrorBase = scsiErrorBase + 128; { ?? = Start of third-party error range }
  802. scsiVendorSpecificErrorCount = 16; { Number of third-party errors }
  803. { --- }
  804. const
  805. scsiExecutionErrors = scsiErrorBase;
  806. scsiNotExecutedErrors = scsiTooManyBuses;
  807. scsiParameterErrors = scsiPBLengthError;
  808. { Defines for the scsiResultFlags field }
  809. const
  810. scsiSIMQFrozen = $0001; { The SIM queue is frozen w/this err }
  811. scsiAutosenseValid = $0002; { Autosense data valid for target }
  812. scsiBusNotFree = $0004; { At time of callback, SCSI bus is not free }
  813. { Defines for the bit numbers of the scsiFlags field in the PB header for the SCSIExecIO function }
  814. const
  815. kbSCSIDisableAutosense = 29; { Disable auto sense feature }
  816. kbSCSIFlagReservedA = 28; { }
  817. kbSCSIFlagReserved0 = 27; { }
  818. kbSCSICDBLinked = 26; { The PB contains a linked CDB }
  819. kbSCSIQEnable = 25; { Target queue actions are enabled }
  820. kbSCSICDBIsPointer = 24; { The CDB field contains a pointer }
  821. kbSCSIFlagReserved1 = 23; { }
  822. kbSCSIInitiateSyncData = 22; { Attempt Sync data xfer and SDTR }
  823. kbSCSIDisableSyncData = 21; { Disable sync, go to async }
  824. kbSCSISIMQHead = 20; { Place PB at the head of SIM Q }
  825. kbSCSISIMQFreeze = 19; { Return the SIM Q to frozen state }
  826. kbSCSISIMQNoFreeze = 18; { Disallow SIM Q freezing }
  827. kbSCSIDoDisconnect = 17; { Definitely do disconnect }
  828. kbSCSIDontDisconnect = 16; { Definitely don't disconnect }
  829. kbSCSIDataReadyForDMA = 15; { Data buffer(s) are ready for DMA }
  830. kbSCSIFlagReserved3 = 14; { }
  831. kbSCSIDataPhysical = 13; { SG/Buffer data ptrs are physical }
  832. kbSCSISensePhysical = 12; { Autosense buffer ptr is physical }
  833. kbSCSIFlagReserved5 = 11; { }
  834. kbSCSIFlagReserved6 = 10; { }
  835. kbSCSIFlagReserved7 = 9; { }
  836. kbSCSIFlagReserved8 = 8; { }
  837. kbSCSIDataBufferValid = 7; { Data buffer valid }
  838. kbSCSIStatusBufferValid = 6; { Status buffer valid }
  839. kbSCSIMessageBufferValid = 5; { Message buffer valid }
  840. kbSCSIFlagReserved9 = 4; { }
  841. { Defines for the bit masks of the scsiFlags field }
  842. const
  843. scsiDirectionMask = $C0000000; { Data direction mask }
  844. scsiDirectionNone = $C0000000; { Data direction (11: no data) }
  845. scsiDirectionReserved = $00000000; { Data direction (00: reserved) }
  846. scsiDirectionOut = $80000000; { Data direction (10: DATA OUT) }
  847. scsiDirectionIn = $40000000; { Data direction (01: DATA IN) }
  848. scsiDisableAutosense = $20000000; { Disable auto sense feature }
  849. scsiFlagReservedA = $10000000; { }
  850. scsiFlagReserved0 = $08000000; { }
  851. scsiCDBLinked = $04000000; { The PB contains a linked CDB }
  852. scsiQEnable = $02000000; { Target queue actions are enabled }
  853. scsiCDBIsPointer = $01000000; { The CDB field contains a pointer }
  854. scsiFlagReserved1 = $00800000; { }
  855. scsiInitiateSyncData = $00400000; { Attempt Sync data xfer and SDTR }
  856. scsiDisableSyncData = $00200000; { Disable sync, go to async }
  857. scsiSIMQHead = $00100000; { Place PB at the head of SIM Q }
  858. scsiSIMQFreeze = $00080000; { Return the SIM Q to frozen state }
  859. scsiSIMQNoFreeze = $00040000; { Disallow SIM Q freezing }
  860. scsiDoDisconnect = $00020000; { Definitely do disconnect }
  861. scsiDontDisconnect = $00010000; { Definitely don't disconnect }
  862. scsiDataReadyForDMA = $00008000; { Data buffer(s) are ready for DMA }
  863. scsiFlagReserved3 = $00004000; { }
  864. scsiDataPhysical = $00002000; { SG/Buffer data ptrs are physical }
  865. scsiSensePhysical = $00001000; { Autosense buffer ptr is physical }
  866. scsiFlagReserved5 = $00000800; { }
  867. scsiFlagReserved6 = $00000400; { }
  868. scsiFlagReserved7 = $00000200; { }
  869. scsiFlagReserved8 = $00000100; { }
  870. { bit masks for the scsiIOFlags field in SCSIExecIOPB }
  871. const
  872. scsiNoParityCheck = $0002; { disable parity checking }
  873. scsiDisableSelectWAtn = $0004; { disable select w/Atn }
  874. scsiSavePtrOnDisconnect = $0008; { do SaveDataPointer upon Disconnect msg }
  875. scsiNoBucketIn = $0010; { donÕt bit bucket in during this I/O }
  876. scsiNoBucketOut = $0020; { donÕt bit bucket out during this I/O }
  877. scsiDisableWide = $0040; { disable wide transfer negotiation }
  878. scsiInitiateWide = $0080; { initiate wide transfer negotiation }
  879. scsiRenegotiateSense = $0100; { renegotiate sync/wide before issuing autosense }
  880. scsiDisableDiscipline = $0200; { disable parameter checking on SCSIExecIO calls }
  881. scsiIOFlagReserved0080 = $0080; { }
  882. scsiIOFlagReserved8000 = $8000; { }
  883. { Defines for the Bus Inquiry PB fields. }
  884. { scsiHBAInquiry field bits }
  885. const
  886. scsiBusMDP = $80; { Supports Modify Data Pointer message }
  887. scsiBusWide32 = $40; { Supports 32 bit wide SCSI }
  888. scsiBusWide16 = $20; { Supports 16 bit wide SCSI }
  889. scsiBusSDTR = $10; { Supports Sync Data Transfer Req message }
  890. scsiBusLinkedCDB = $08; { Supports linked CDBs }
  891. scsiBusTagQ = $02; { Supports tag queue message }
  892. scsiBusSoftReset = $01; { Supports soft reset }
  893. { Defines for the scsiDataType field }
  894. const
  895. scsiDataBuffer = 0; { single contiguous buffer supplied }
  896. scsiDataTIB = 1; { TIB supplied (ptr in scsiDataPtr) }
  897. scsiDataSG = 2; { scatter/gather list supplied }
  898. scsiDataIOTable = 3; {#(7/11/95) Prepared by Block Storage }
  899. { scsiDataTypes field bits }
  900. { bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved }
  901. const
  902. scsiBusDataTIB = 1 shl scsiDataTIB; { TIB supplied (ptr in scsiDataPtr) }
  903. scsiBusDataBuffer = 1 shl scsiDataBuffer; { single contiguous buffer supplied }
  904. scsiBusDataSG = 1 shl scsiDataSG; { scatter/gather list supplied }
  905. scsiBusDataIOTable = 1 shl scsiDataIOTable; { (2/6/95) Prepare Memory for IO}
  906. scsiBusDataReserved = $80000000; { }
  907. { scsiScanFlags field bits }
  908. const
  909. scsiBusScansDevices = $80; { Bus scans for and maintains device list }
  910. scsiBusScansOnInit = $40; { Bus scans performed at power-up/reboot }
  911. scsiBusLoadsROMDrivers = $20; { may load ROM drivers to support targets }
  912. { scsiFeatureFlags field bits }
  913. const
  914. scsiBusLVD = $00000400; { HBA is Low Voltage Differential Bus }
  915. scsiBusUltra3SCSI = $00000200; { HBA supports Ultra3 SCSI }
  916. scsiBusUltra2SCSI = $00000100; { HBA supports Ultra2 SCSI }
  917. scsiBusInternalExternalMask = $000000C0; { bus internal/external mask }
  918. scsiBusInternalExternalUnknown = $00000000; { not known whether bus is inside or outside }
  919. scsiBusInternalExternal = $000000C0; { bus goes inside and outside the box }
  920. scsiBusInternal = $00000080; { bus goes inside the box }
  921. scsiBusExternal = $00000040; { bus goes outside the box }
  922. scsiBusCacheCoherentDMA = $00000020; { DMA is cache coherent }
  923. scsiBusOldCallCapable = $00000010; { SIM is old call capable }
  924. scsiBusUltraSCSI = $00000008; { HBA supports Ultra SCSI }
  925. scsiBusDifferential = $00000004; { Single Ended (0) or Differential (1) }
  926. scsiBusFastSCSI = $00000002; { HBA supports fast SCSI }
  927. scsiBusDMAavailable = $00000001; { DMA is available }
  928. { scsiWeirdStuff field bits }
  929. const
  930. scsiOddDisconnectUnsafeRead1 = $0001; { Disconnects on odd byte boundries are unsafe with DMA and/or blind reads }
  931. scsiOddDisconnectUnsafeWrite1 = $0002; { Disconnects on odd byte boundries are unsafe with DMA and/or blind writes }
  932. scsiBusErrorsUnsafe = $0004; { Non-handshaked delays or disconnects during blind transfers may cause a crash }
  933. scsiRequiresHandshake = $0008; { Non-handshaked delays or disconnects during blind transfers may cause data corruption }
  934. scsiTargetDrivenSDTRSafe = $0010; { Targets which initiate synchronous negotiations are supported }
  935. scsiOddCountForPhysicalUnsafe = $0020; { If using physical addrs all counts must be even, and disconnects must be on even boundries }
  936. scsiAbortCmdFixed = $0040; { Set if abort command is fixed to properly make callbacks }
  937. scsiMeshACKTimingFixed = $0080; { Set if bug allowing Mesh to release ACK prematurely is fixed }
  938. { scsiHBAslotType values }
  939. const
  940. scsiMotherboardBus = $00; { A built in Apple supplied bus }
  941. scsiNuBus = $01; { A SIM on a NuBus card }
  942. scsiPDSBus = $03; { " on a PDS card }
  943. scsiPCIBus = $04; { " on a PCI bus card }
  944. scsiPCMCIABus = $05; { " on a PCMCIA card }
  945. scsiFireWireBridgeBus = $06; { " connected through a FireWire bridge }
  946. scsiUSBBus = $07; { " connected on a USB bus }
  947. { Defines for the scsiDriverFlags field (in SCSIDriverPB) }
  948. const
  949. scsiDeviceSensitive = $0001; { Only driver should access this device }
  950. scsiDeviceNoOldCallAccess = $0002; { no old call access to this device }
  951. {
  952. * SCSI bus status. These values are returned by the SCSI target in the status phase.
  953. * They are not related to Macintosh status values (except that values other than
  954. * scsiStatusGood will result in scsiResult set to scsiNonZeroStatus).
  955. }
  956. const
  957. scsiStatGood = $00; { Good Status}
  958. scsiStatCheckCondition = $02; { Check Condition}
  959. scsiStatConditionMet = $04; { Condition Met}
  960. scsiStatBusy = $08; { Busy}
  961. scsiStatIntermediate = $10; { Intermediate}
  962. scsiStatIntermedMet = $14; { Intermediate - Condition Met}
  963. scsiStatResvConflict = $18; { Reservation conflict}
  964. scsiStatTerminated = $22; { Command terminated}
  965. scsiStatQFull = $28; { Queue full}
  966. { SCSI messages}
  967. const
  968. kCmdCompleteMsg = 0;
  969. kExtendedMsg = 1; { 0x01}
  970. kSaveDataPointerMsg = 2; { 0x02}
  971. kRestorePointersMsg = 3; { 0x03}
  972. kDisconnectMsg = 4; { 0x04}
  973. kInitiatorDetectedErrorMsg = 5; { 0x05}
  974. kAbortMsg = 6; { 0x06}
  975. kMsgRejectMsg = 7; { 0x07}
  976. kNoOperationMsg = 8; { 0x08}
  977. kMsgParityErrorMsg = 9; { 0x09}
  978. kLinkedCmdCompleteMsg = 10; { 0x0a}
  979. kLinkedCmdCompleteWithFlagMsg = 11; { 0x0b}
  980. kBusDeviceResetMsg = 12; { 0x0c}
  981. kAbortTagMsg = 13; { 0x0d}
  982. kClearQueueMsg = 14; { 0x0e}
  983. kInitiateRecoveryMsg = 15; { 0x0f}
  984. kReleaseRecoveryMsg = 16; { 0x10}
  985. kTerminateIOProcessMsg = 17; { 0x11}
  986. kSimpleQueueTag = $20; { 0x20}
  987. kHeadOfQueueTagMsg = $21; { 0x21}
  988. kOrderedQueueTagMsg = $22; { 0x22}
  989. kIgnoreWideResidueMsg = $23; { 0x23}
  990. {$ifc not TARGET_CPU_64}
  991. {
  992. * SCSIAction() *** DEPRECATED ***
  993. *
  994. * Deprecated:
  995. * Use the SCSITaskUserClient API instead.
  996. *
  997. * Discussion:
  998. * This routine is deprecated. It is exported and callable, but it
  999. * is no longer being maintained.
  1000. *
  1001. * Availability:
  1002. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.2
  1003. * CarbonLib: in CarbonLib 1.0 and later
  1004. * Non-Carbon CFM: in InterfaceLib 7.5 and later
  1005. }
  1006. function SCSIAction( var parameterBlock: SCSI_PB ): OSErr; external name '_SCSIAction';
  1007. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2 *)
  1008. {$endc} {not TARGET_CPU_64}
  1009. {
  1010. * SCSIRegisterBus()
  1011. *
  1012. * Availability:
  1013. * Mac OS X: not available
  1014. * CarbonLib: not available
  1015. * Non-Carbon CFM: in InterfaceLib 7.5 and later
  1016. }
  1017. {
  1018. * SCSIDeregisterBus()
  1019. *
  1020. * Availability:
  1021. * Mac OS X: not available
  1022. * CarbonLib: not available
  1023. * Non-Carbon CFM: in InterfaceLib 7.5 and later
  1024. }
  1025. {
  1026. * SCSIReregisterBus()
  1027. *
  1028. * Availability:
  1029. * Mac OS X: not available
  1030. * CarbonLib: not available
  1031. * Non-Carbon CFM: in InterfaceLib 7.5 and later
  1032. }
  1033. {
  1034. * SCSIKillXPT()
  1035. *
  1036. * Availability:
  1037. * Mac OS X: not available
  1038. * CarbonLib: not available
  1039. * Non-Carbon CFM: in InterfaceLib 7.5 and later
  1040. }
  1041. {$endc} {TARGET_OS_MAC and not TARGET_CPU_64}
  1042. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1043. end.
  1044. {$endc} {not MACOSALLINCLUDE}