-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATA.h
1597 lines (1500 loc) · 91.9 KB
/
ATA.h
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
/*
File: ATA.h
Contains: ATA (PC/AT Attachment) Interfaces
Version: Technology: System 7.5
Release: Universal Interfaces 3.4
Copyright: © 1995-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 __ATA__
#define __ATA__
#ifndef __NAMEREGISTRY__
#include <NameRegistry.h>
#endif
#ifndef __CODEFRAGMENTS__
#include <CodeFragments.h>
#endif
#ifndef __MACTYPES__
#include <MacTypes.h>
#endif
#ifndef __MIXEDMODE__
#include <MixedMode.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
/* This is the structure used for the AT Interface core routines below */
enum {
kATATrap = 0xAAF1, /* Manager trap number <This should be defined in Traps.h>*/
kATAPBVers1 = 0x01, /* parameter block version number 1*/
kATAPBVers2 = 0x02, /* parameter block version number for structures*/
kATAPBVers3 = 0x03, /* parameter block version for ATA times*/
kATADefaultBlockSize = 512 /* default block size*/
};
/* Used to determine the presence of traps*/
enum {
kFSMTrap = 0xAC,
mDQEChanged = 1 /* DQE has changed */
};
/* Task file definition ¥¥¥ Error Register ¥¥¥*/
enum {
bATABadBlock = 7, /* bit number of bad block error bit*/
bATAUncorrectable = 6, /* bit number of uncorrectable error bit*/
bATAMediaChanged = 5, /* bit number of media changed indicator*/
bATAIDNotFound = 4, /* bit number of ID not found error bit*/
bATAMediaChangeReq = 3, /* bit number of media changed request*/
bATACommandAborted = 2, /* bit number of command abort bit*/
bATATrack0NotFound = 1, /* bit number of track not found*/
bATAAddressNotFound = 0, /* bit number of address mark not found*/
mATABadBlock = 1 << bATABadBlock, /* Bad Block Detected*/
mATAUncorrectable = 1 << bATAUncorrectable, /* Uncorrectable Data Error*/
mATAMediaChanged = 1 << bATAMediaChanged, /* Media Changed Indicator (for removable)*/
mATAIDNotFound = 1 << bATAIDNotFound, /* ID Not Found*/
mATAMediaChangeReq = 1 << bATAMediaChangeReq, /* Media Change Requested (NOT IMPLEMENTED)*/
mATACommandAborted = 1 << bATACommandAborted, /* Aborted Command*/
mATATrack0NotFound = 1 << bATATrack0NotFound, /* Track 0 Not Found*/
mATAAddressNotFound = 1 << bATAAddressNotFound /* Address Mark Not Found*/
};
/* Task file definition ¥¥¥ Features register ¥¥¥*/
enum {
bATAPIuseDMA = 0, /* bit number of useDMA bit (ATAPI)*/
mATAPIuseDMA = 1 << bATAPIuseDMA
};
/* Task file definition ¥¥¥ ataTFSDH Register ¥¥¥*/
enum {
mATAHeadNumber = 0x0F, /* Head Number (bits 0-3) */
mATASectorSize = 0xA0, /* bit 7=1; bit 5 = 01 (512 sector size) <DP4>*/
mATADriveSelect = 0x10, /* Drive (0 = master, 1 = slave) */
mATALBASelect = 0x40 /* LBA mode bit (0 = chs, 1 = LBA)*/
};
/* Task file definition ¥¥¥ Status Register ¥¥¥*/
enum {
bATABusy = 7, /* bit number of BSY bit*/
bATADriveReady = 6, /* bit number of drive ready bit*/
bATAWriteFault = 5, /* bit number of write fault bit*/
bATASeekComplete = 4, /* bit number of seek complete bit*/
bATADataRequest = 3, /* bit number of data request bit*/
bATADataCorrected = 2, /* bit number of data corrected bit*/
bATAIndex = 1, /* bit number of index mark*/
bATAError = 0, /* bit number of error bit*/
mATABusy = 1 << bATABusy, /* Unit is busy*/
mATADriveReady = 1 << bATADriveReady, /* Unit is ready*/
mATAWriteFault = 1 << bATAWriteFault, /* Unit has a write fault condition*/
mATASeekComplete = 1 << bATASeekComplete, /* Unit seek complete*/
mATADataRequest = 1 << bATADataRequest, /* Unit data request*/
mATADataCorrected = 1 << bATADataCorrected, /* Data corrected*/
mATAIndex = 1 << bATAIndex, /* Index mark - NOT USED*/
mATAError = 1 << bATAError /* Error condition - see error register*/
};
/* Task file definition ¥¥¥ Device Control Register ¥¥¥*/
enum {
bATADCROne = 3, /* bit number of always one bit*/
bATADCRReset = 2, /* bit number of reset bit*/
bATADCRnIntEnable = 1, /* bit number of interrupt disable*/
mATADCROne = 1 << bATADCROne, /* always one bit*/
mATADCRReset = 1 << bATADCRReset, /* Reset (1 = reset)*/
mATADCRnIntEnable = 1 << bATADCRnIntEnable /* Interrupt Disable(0 = enabled)*/
};
/* ATA Command Opcode definition*/
enum {
kATAcmdWORetry = 0x01, /* Without I/O retry option*/
kATAcmdNOP = 0x0000, /* NOP operation - media detect*/
kATAcmdRecal = 0x0010, /* Recalibrate command */
kATAcmdRead = 0x0020, /* Read command */
kATAcmdReadLong = 0x0022, /* Read Long command*/
kATAcmdWrite = 0x0030, /* Write command */
kATAcmdWriteLong = 0x0032, /* Write Long*/
kATAcmdWriteVerify = 0x003C, /* Write verify*/
kATAcmdReadVerify = 0x0040, /* Read Verify command */
kATAcmdFormatTrack = 0x0050, /* Format Track command */
kATAcmdSeek = 0x0070, /* Seek command */
kATAcmdDiagnostic = 0x0090, /* Drive Diagnostic command */
kATAcmdInitDrive = 0x0091, /* Init drive parameters command */
kATAcmdReadMultiple = 0x00C4, /* Read multiple*/
kATAcmdWriteMultiple = 0x00C5, /* Write multiple*/
kATAcmdSetRWMultiple = 0x00C6, /* Set Multiple for Read/Write Multiple*/
kATAcmdReadDMA = 0x00C8, /* Read DMA (with retries)*/
kATAcmdWriteDMA = 0x00CA, /* Write DMA (with retries)*/
kATAcmdMCAcknowledge = 0x00DB, /* Acknowledge media change - removable*/
kATAcmdDoorLock = 0x00DE, /* Door lock*/
kATAcmdDoorUnlock = 0x00DF, /* Door unlock*/
kATAcmdStandbyImmed = 0x00E0, /* Standby Immediate*/
kATAcmdIdleImmed = 0x00E1, /* Idle Immediate*/
kATAcmdStandby = 0x00E2, /* Standby*/
kATAcmdIdle = 0x00E3, /* Idle*/
kATAcmdReadBuffer = 0x00E4, /* Read sector buffer command */
kATAcmdCheckPowerMode = 0x00E5, /* Check power mode command <04/04/94>*/
kATAcmdSleep = 0x00E6, /* Sleep*/
kATAcmdWriteBuffer = 0x00E8, /* Write sector buffer command */
kATAcmdWriteSame = 0x00E9, /* Write same data to multiple sectors*/
kATAcmdDriveIdentify = 0x00EC, /* Identify Drive command */
kATAcmdMediaEject = 0x00ED, /* Media Eject*/
kATAcmdSetFeatures = 0x00EF /* Set Features*/
};
/* Set feature command opcodes*/
enum {
kATAEnableWriteCache = 0x02, /* Enable write cache*/
kATASetTransferMode = 0x03, /* Set transfer mode*/
kATASetPIOMode = 0x08, /* PIO Flow Control Tx Mode bit*/
kATAEnableECC = 0x88, /* ECC enable*/
kATAEnableRetry = 0x99, /* Retry enable*/
kATAEnableReadAhead = 0xAA /* Read look-ahead enable*/
};
/*
--------------------------------------------------------------------------------
enums for dealing with device IDs
*/
enum {
kATABusIDMask = 0x000000FF,
kATADeviceIDMask = 0x0000FF00,
kATADeviceIDClippingMask = 0x0000FFFF,
kMinBusID = 0x00000000,
kMaxBusID = 0x000000FE
};
enum {
kATAStartIterateDeviceID = 0xFFFF,
kATAEndIterateDeviceID = 0xFF
};
/*--------------------------------------------------------------------------------*/
/* Device Register Images (8 bytes) */
struct ataTaskFile {
UInt8 ataTFFeatures; /* <-> Error(R) or ataTFFeatures(W) register image */
UInt8 ataTFCount; /* <-> Sector count/remaining */
UInt8 ataTFSector; /* <-> Sector start/finish */
UInt8 ataTFReserved; /* reserved */
UInt16 ataTFCylinder; /* <-> ataTFCylinder (Big endian) */
UInt8 ataTFSDH; /* <-> ataTFSDH register image*/
UInt8 ataTFCommand; /* <-> Status(R) or Command(W) register image */
};
typedef struct ataTaskFile ataTaskFile;
/* ATA Manager Function Code Definition*/
enum {
kATAMgrNOP = 0x00, /* No Operation*/
kATAMgrExecIO = 0x01, /* Execute ATA I/O*/
kATAMgrBusInquiry = 0x03, /* Bus Inquiry*/
kATAMgrQRelease = 0x04, /* I/O Queue Release*/
kATAMgrAbort = 0x10, /* Abort command*/
kATAMgrBusReset = 0x11, /* Reset ATA bus*/
kATAMgrRegAccess = 0x12, /* Register Access*/
kATAMgrDriveIdentify = 0x13, /* Drive Identify <DP03/10/94>*/
kATAMgrDriverLoad = 0x82, /* Load driver from either Media, ROM, etc.*/
kATAMgrDriveRegister = 0x85, /* Register a driver <4/18/94>*/
kATAMgrFindDriverRefnum = 0x86, /* lookup a driver refnum <4/18/94>*/
kATAMgrRemoveDriverRefnum = 0x87, /* De-register a driver <4/18/94>*/
kATAMgrModifyEventMask = 0x88, /* Modify driver event mask*/
kATAMgrDriveEject = 0x89, /* Eject the drive <8/1/94>*/
kATAMgrGetDrvConfiguration = 0x8A, /* Get device configuration <8/6/94>*/
kATAMgrSetDrvConfiguration = 0x8B, /* Set device configuration <8/6/94>*/
kATAMgrGetLocationIcon = 0x8C, /* Get card location icon <SM4>*/
kATAMgrManagerInquiry = 0x90, /* Manager Inquiry*/
kATAMgrManagerInit = 0x91, /* Manager initialization*/
kATAMgrManagerShutdown = 0x92, /* Manager ShutDown*/
kATAMgrAddATABus = 0x93, /* Add an AIM to ATA Manager <3/1/2000>*/
kATAMgrRemoveATABus = 0x94, /* Remove an AIM from ATA Manager <3/1/2000>*/
/* note: functions 0x95 to 0x97 are reserved*/
kATAMgrFindSpecialDriverRefnum = 0x98, /* lookup a driver refnum; driverloader,notify-all or ROM driver.*/
kATAMgrNextAvailable = 0x99
};
/* used in the ataDrvrFlags field for kATAMgrDriveRegister,kATAMgrRemoveDriverRefnum & kATAMgrFindSpecialDriverRefnum*/
enum {
kATANotifyAllDriver = 0, /* Notify-All driver*/
kATADriverLoader = 1, /* Driver loader driver */
kATAROMDriver = 2 /* ROM driver*/
};
/* 'ATAFlags' field of the PB header definition*/
enum {
bATAFlagUseConfigSpeed = 15, /* bit number of use default speed flag*/
bATAFlagByteSwap = 14, /* bit number of byte swap flag*/
bATAFlagIORead = 13, /* bit number of I/O read flag*/
bATAFlagIOWrite = 12, /* bit number of I/O write flag*/
bATAFlagImmediate = 11, /* bit number of immediate flag*/
bATAFlagQLock = 10, /* bit number of que lock on error*/
bATAFlagReserved1 = 9, /* reserved*/
bATAFlagUseScatterGather = 8, /* bit numbers of scatter gather*/
bATAFlagUseDMA = 7, /* bit number of use DMA flag*/
bATAFlagProtocolATAPI = 5, /* bit number of ATAPI protocol*/
bATAFlagReserved2 = 4, /* reserved*/
bATAFlagTFRead = 3, /* bit number of register update*/
bATAFlagLEDEnable = 0, /* bit number of LED enable*/
mATAFlagUseConfigSpeed = 1 << bATAFlagUseConfigSpeed,
mATAFlagByteSwap = 1 << bATAFlagByteSwap, /* Swap data bytes (read - after; write - before)*/
mATAFlagIORead = 1 << bATAFlagIORead, /* Read (in) operation*/
mATAFlagIOWrite = 1 << bATAFlagIOWrite, /* Write (out) operation*/
mATAFlagImmediate = 1 << bATAFlagImmediate, /* Head of Que; Immediate operation*/
mATAFlagQLock = 1 << bATAFlagQLock, /* Manager queue lock on error (freeze the queue)*/
mATAFlagUseScatterGather = 1 << bATAFlagUseScatterGather, /* Scatter gather enable*/
mATAFlagUseDMA = 1 << bATAFlagUseDMA,
mATAFlagProtocolATAPI = 1 << bATAFlagProtocolATAPI, /* ATAPI protocol indicator*/
mATAFlagTFRead = 1 << bATAFlagTFRead, /* update reg block request upon detection of an error*/
mATAFlagLEDEnable = 1 << bATAFlagLEDEnable /* socket LED enable*/
};
/* These are legacy ATAFlags definitions, which will go away in the future */
enum {
bATAFlagScatterGather1 = bATAFlagReserved1, /* 9*/
bATAFlagScatterGather0 = bATAFlagUseScatterGather, /* 8*/
bATAFlagProtocol1 = bATAFlagProtocolATAPI, /* 5*/
bATAFlagProtocol0 = bATAFlagReserved2, /* 4*/
mATAFlagScatterGather1 = 1 << bATAFlagScatterGather1,
mATAFlagScatterGather0 = mATAFlagUseScatterGather,
mATAFlagScatterGathers = mATAFlagScatterGather1 + mATAFlagScatterGather0,
mATAFlagProtocol1 = mATAFlagProtocolATAPI,
mATAFlagProtocol0 = 1 << bATAFlagProtocol0,
mATAFlagProtocols = mATAFlagProtocol1 + mATAFlagProtocol0
};
/* The Function codes passed by ATA Manager to the AIM plug-in */
enum {
kATAFnNOP = 0x00, /* No Operation */
kATAFnExecIO = 0x01, /* Execute ATA I/O */
kATAFnBusInquiry = 0x02, /* Bus Inquiry */
kATAFnQRelease = 0x03, /* I/O Queue Release */
kATAFnCmd = 0x04, /* ATA Command */
kATAFnAbort = 0x05, /* Abort command */
kATAFnBusReset = 0x06, /* Reset ATA bus */
kATAFnRegAccess = 0x07, /* Register Access */
kATAFnDriveIdentify = 0x08, /* Drive Identify */
kATAPIFnExecIO = 0x09, /* ATAPI I/O */
kATAPIFnCmd = 0x0A, /* ATAPI Command */
kATAFnGetDriveConfig = 0x0B, /* Get Drive specific bus configuration */
kATAFnSetDriveConfig = 0x0C, /* Set Drive specific bus configuration */
kATAFnKillIO = 0x0D /* Kill any current interaction with bus */
};
/* The state to put the device light in used in DeviceLight AIM plugin export */
enum {
kATADeviceLightOff = 0x00, /* Turn light off */
kATADeviceLightOn = 0x01 /* Turn light on */
};
/* The state to put the device lock in used in DeviceLock AIM plugin export */
enum {
kATADeviceUnlock = 0x00, /* unlock */
kATADeviceLock = 0x01 /* lock */
};
/* add bus flags */
/* ¥¥ Applies to the ataAddBus structure ¥¥ */
enum {
mATANoDMAOnBus = 0x80
};
typedef CALLBACK_API( void , ATACallbackProcPtr )(void * ataPB);
typedef STACK_UPP_TYPE(ATACallbackProcPtr) ATACallbackUPP;
#if CALL_NOT_IN_CARBON
/*
* NewATACallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( ATACallbackUPP )
NewATACallbackUPP(ATACallbackProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppATACallbackProcInfo = 0x000000C0 }; /* pascal no_return_value Func(4_bytes) */
#ifdef __cplusplus
inline ATACallbackUPP NewATACallbackUPP(ATACallbackProcPtr userRoutine) { return (ATACallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATACallbackProcInfo, GetCurrentArchitecture()); }
#else
#define NewATACallbackUPP(userRoutine) (ATACallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATACallbackProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeATACallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeATACallbackUPP(ATACallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeATACallbackUPP(ATACallbackUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeATACallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeATACallbackUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
InvokeATACallbackUPP(
void * ataPB,
ATACallbackUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void InvokeATACallbackUPP(void * ataPB, ATACallbackUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppATACallbackProcInfo, ataPB); }
#else
#define InvokeATACallbackUPP(ataPB, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppATACallbackProcInfo, (ataPB))
#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 NewATACallbackProc(userRoutine) NewATACallbackUPP(userRoutine)
#define CallATACallbackProc(userRoutine, ataPB) InvokeATACallbackUPP(ataPB, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
/*
structure which defines the ATA bus/device ID, part of the Device 0/1 Software Guide
see <http://developer.apple.com/techpubs/hardware/Developer_Notes/System_Software/ATA_Device_Zero_One.pdf>
p 19 : Although ataPBDeviceID remains defined as a 32-bit number, drivers and applications
can typecast it to the ataDeviceID structure to determine the bus number and device number
for a specific ATA or ATAPI device
*/
struct ataDeviceID {
UInt16 Reserved; /* The upperword is reserved (0)*/
UInt8 devNum; /* device number (0 or 1)*/
UInt8 busNum; /* bus number*/
};
typedef struct ataDeviceID ataDeviceID;
/*
The kATADevIDProperty property will be inserted by the AIM when creating name registry entries for each
drive found on the bus. The 4-byte data shall be the ataDeviceID structure used by ATA Manager. <3/14/2000>
*/
#define kATADevIDProperty "device_id"
enum {
kATADevIDPropertyNameLength = 10, /* Number of characters in kATADevIDProperty including the terminating null.*/
kATADevIDPropertySize = 4 /* Size of the data*/
};
struct ATADataObject {
UInt8 * ioBuf; /* if SG flag enabled then this points to the head of the list else it is the buffer */
UInt32 Count; /* if SG flag enabled then count of SG Lists else the size */
};
typedef struct ATADataObject ATADataObject;
struct ATAResult {
OSStatus ataResult; /* the final result see Error Codes */
SInt8 ataStatusRegister; /* the status register */
SInt8 ataErrorRegister; /* the error register */
UInt32 actualXferCount; /* in case of I/O the actual size of Xfer */
ataTaskFile * TaskFile; /* if "mATAFlagTFRead" enabled */
};
typedef struct ATAResult ATAResult;
/*
For ATAPI devices the ExtendedPB field is a pointer to the Command Packet
record which exists of an array of words structured as followsÉ <06/15/94>
*/
struct ATAPICmdPacket {
SInt16 atapiPacketSize; /* Size of command packet in bytes <06/15/94>*/
SInt16 atapiCommandByte[8]; /* The command packet itself <06/15/94>*/
};
typedef struct ATAPICmdPacket ATAPICmdPacket;
struct ATADevInfo {
UInt8 devType;
SInt8 devID;
};
typedef struct ATADevInfo ATADevInfo;
/* ATA Device ID codes to be used with devID field of the ATADevInfo structure */
enum {
kATAInvalidDeviceID = -1,
kATADevice0DeviceID = 0, /* aka, Master. Device 0 is the correct terminology */
kATADevice1DeviceID = 1 /* aka, Slave. Device 1 is the correct terminology */
};
/* AIM initialization */
struct ATAInitInfo {
UInt32 busID; /* --> busID assigned by the Manager */
ATADevInfo FirstDevice; /* <-- Type and ID of first device */
ATADevInfo SecondDevice; /* <-- Type and ID of second device */
RegEntryIDPtr aimRegEntry; /* --> Name Registry entry for this controller */
UInt32 refCon; /* <-- refCon to be associated with this instantiation of the AIM */
};
typedef struct ATAInitInfo ATAInitInfo;
/* AIM Diag result */
struct ATADiagResult {
UInt16 ataRegMask; /* the registers to access */
OSStatus ataResult; /* the final result see Error Codes */
UInt16 ataDataReg; /* 16 bit access only */
UInt8 ataTFFeatures; /* Error(R) or Feature(W) register */
UInt8 ataTFCount; /* Sector Count register */
UInt8 ataTFSector; /* Sector number register */
UInt8 ataTFCylinderLo; /* Cylinder low bytes */
UInt8 ataTFCylinderHi; /* Cylinder High bytes */
UInt8 ataTFSDH; /* SDH register */
UInt8 ataTFCommand; /* status(R) or command(W) register */
UInt8 ataAltStatDevCnt; /* AltStatus(R) or Dev Cntrl(W) register */
};
typedef struct ATADiagResult ATADiagResult;
/* AIM Bus Info */
struct ATABusInfo {
UInt8 ataPIOModes; /* PIO modes supported (bit-significant) */
UInt8 ataSingleDMAModes; /* <--: Single Word DMA modes supported (b-sig) */
UInt8 ataMultiDMAModes; /* <--: Multiword DMA modes supported (b-sig) */
UInt8 ataUltraDMAModes; /* <--: Ultra DMA modes supported (b-sig) */
UInt32 ataIOPBsize0; /* the current size of the Transfer for device 0 */
UInt32 ataIOPBsize1; /* the current size of the Transfer for device 1 */
SInt8 ataContrlType[16]; /* the controller signature */
NumVersion ataHBAversion; /* version number of the AIM */
UInt32 reserved3;
};
typedef struct ATABusInfo ATABusInfo;
/* reserved words at the end of the devConfig structure*/
enum {
kATAConfigReserved = 5 /* number of reserved words at the end*/
};
/* Bus timing config info passed between ATA Mgr and the AIM */
struct ATADevConfig {
SInt32 ataConfigSetting; /* <->: Configuration setting */
/* Bits 3 - 0: Reserved */
/* Bit 4: Reserved */
/* Bit 5: Reserved */
/* Bit 6: ATAPIpacketDRQ */
/* 1 = Check for Interrupt DRQ on ATAPI command packet DRQ */
/* 0 = Default: Check only for the assertion of command packet DRQ */
/* Bits 31 - 7: Reserved */
UInt8 ataPIOSpeedMode; /* <->: Device access speed in PIO Mode */
UInt8 reserved; /* ¥ do not modify, use or rely on reserved fields */
UInt16 atapcValid; /* reserved */
UInt16 ataRWMultipleCount; /* AIM's must return 0 */
UInt16 ataSectorsPerCylinder; /* AIM's must return 0 */
UInt16 ataHeads; /* AIM's must return 0 */
UInt16 ataSectorsPerTrack; /* AIM's must return 0 */
UInt16 ataSocketNumber; /* Reserved */
UInt8 ataSocketType; /* <--: Specifies the socket type (get config only) */
/* 00 = Unknown socket */
/* 01 = Internal ATA bus */
/* 02 = Media Bay */
/* 03 = PCMCIA */
UInt8 ataDeviceType; /* <--: Specifies the device type (get config only) */
/* 00 = Unknown device */
/* 01 = standard ATA device (HD) */
/* 02 = ATAPI device */
/* 03 = PCMCIA ATA device */
UInt8 atapcAccessMode; /* Reserved */
UInt8 atapcVcc; /* Reserved */
UInt8 atapcVpp1; /* Reserved */
UInt8 atapcVpp2; /* Reserved */
UInt8 atapcStatus; /* Reserved */
UInt8 atapcPin; /* Reserved */
UInt8 atapcCopy; /* Reserved */
UInt8 atapcConfigIndex; /* Reserved */
UInt8 ataSingleDMASpeed; /* <->: Single Word DMA Timing Class */
UInt8 ataMultiDMASpeed; /* <->: Multiple Word DMA Timing Class */
UInt16 ataPIOCycleTime; /* <->:Cycle time in ms for PIO mode */
UInt16 ataMultiCycleTime; /* <->:Cycle time in ms for Multiword DMA mode */
UInt8 ataUltraDMASpeed; /* <-> Ultra DMA timing class bit-significant */
UInt8 reserved2; /* reserved */
UInt16 ataUltraCycleTime; /* <-> Cycle time in ms for Ultra DMA mode */
UInt16 Reserved1[5]; /* Reserved for future */
};
typedef struct ATADevConfig ATADevConfig;
/* The Request block passed by the manager to the AIM */
struct ATAReqBlock {
/* Filled in by ATA Mgr v4.0*/
UInt32 connectionID; /* the connection ID of the req block */
UInt32 MsgID; /* the ioTag value of this request */
ATAResult * result; /* result of this operation */
ATADiagResult * DiagResult; /* for diagnostics i.e. R(W) registers */
ATABusInfo * busInfo; /* for bus info requests */
ATADevConfig * devConfig; /* for device config requests */
ATADataObject ioObject; /* The actual transfer data */
ataTaskFile ataPBTaskFile; /* the task file */
ATAPICmdPacket packetCBD; /* For the ATAPI cmd packets */
Duration Timeout; /* timeout for this request */
UInt32 BusID; /* family assigned bus ID */
SInt8 DevID; /* device ID, -1(bus), 0(master), 1(slave) */
UInt8 ataFunctionCode;
UInt32 AbortID;
UInt32 ataPBLogicalBlockSize;
UInt32 ataPBFlags;
UInt32 reserved;
/* Used internally by the AIM*/
struct ATAReqBlock * nextREQ; /* the next req on this list */
OSStatus ataPBResult;
UInt8 ataPBErrorRegister;
UInt8 ataPBStatusRegister;
UInt32 ataPBactualXferCount;
UInt32 ataPBState;
UInt32 ataPBSemaphores;
UInt8 XferType;
UInt8 ataModeType; /* tracks old ataPBVers, to do absolute or bitmap modes */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt8 reserved2;
UInt16 reserved3;
};
typedef struct ATAReqBlock ATAReqBlock;
/* enum for modeType in ATAReqBlock, aligned with ataPBVers*/
enum {
kATAModeAbsolute = 2,
kATAModeBitmap = 3 /* actually three or above*/
};
enum {
kATAPluginVersion = 0x00000001,
kATAPluginCurrentVersion = kATAPluginVersion
};
enum {
kServiceCategoryATA = FOUR_CHAR_CODE('ata-') /* ata*/
};
struct ataPBHeader {
/* Start of cloned common header ataPBHdr */
struct ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
};
typedef struct ataPBHeader ataPBHeader;
/* data request entry structure (16 bytes)*/
struct IOBlock {
UInt8 * ataPBBuffer; /* -->: Data buffer pointer*/
UInt32 ataPBByteCount; /* -->: Data transfer length in bytes*/
};
typedef struct IOBlock IOBlock;
/* Manager parameter block structure (96 bytes)*/
struct ataIOPB {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
SInt8 ataPBStatusRegister; /* <--: Last ATA status image*/
SInt8 ataPBErrorRegister; /* <--: Last ATA error image-valid if lsb of Status set*/
SInt16 ataPBReserved5; /* Reserved*/
UInt32 ataPBLogicalBlockSize; /* -->: Blind transfer size per interrupt (Logical block size)*/
UInt8 * ataPBBuffer; /* -->: Data buffer pointer*/
UInt32 ataPBByteCount; /* -->: Data transfer length in bytes*/
UInt32 ataPBActualTxCount; /* <--: Actual transfer count*/
UInt32 ataPBReserved6; /* Reserved*/
ataTaskFile ataPBTaskFile; /* <->: Device register images*/
ATAPICmdPacket * ataPBPacketPtr; /* -->: ATAPI packet command block pointer (valid with ATAPI bit set)*/
SInt16 ataPBReserved7[6]; /* Reserved for future expansion*/
};
typedef struct ataIOPB ataIOPB;
/* Parameter block structure for bus and Manager inquiry command*/
/* Manager parameter block structure*/
struct ataBusInquiry {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
UInt16 ataEngineCount; /* <--: TBD; zero for now*/
UInt16 ataReserved1; /* Reserved*/
UInt32 ataDataTypes; /* <--: TBD; zero for now*/
UInt16 ataIOpbSize; /* <--: Size of ATA IO PB*/
UInt16 ataMaxIOpbSize; /* <--: TBD; zero for now*/
UInt32 ataFeatureFlags; /* <--: TBD*/
UInt8 ataVersionNum; /* <--: Version number for the HBA*/
UInt8 ataHBAInquiry; /* <--: TBD; zero for now*/
UInt16 ataReserved2; /* Reserved*/
UInt32 ataHBAPrivPtr; /* <--: Ptr to HBA private data area*/
UInt32 ataHBAPrivSize; /* <--: Size of HBA private data area*/
UInt32 ataAsyncFlags; /* <--: Event capability for callback*/
UInt8 ataPIOModes; /* <--: PIO modes supported (bit-significant)*/
UInt8 ataUltraDMAModes; /* <--: Ultra DMA modes supported (b-sig)*/
UInt8 ataSingleDMAModes; /* <--: Single Word DMA modes supported (b-sig) */
UInt8 ataMultiDMAModes; /* <--: Multiword DMA modes supported (b-sig)*/
UInt32 ataReserved4[4]; /* Reserved*/
SInt8 ataReserved5[16]; /* TBD*/
SInt8 ataHBAVendor[16]; /* <--: Vendor ID of the HBA*/
SInt8 ataContrlFamily[16]; /* <--: Family of ATA Controller*/
SInt8 ataContrlType[16]; /* <--: Model number of controller*/
SInt8 ataXPTversion[4]; /* <--: version number of XPT*/
SInt8 ataReserved6[4]; /* Reserved*/
NumVersion ataHBAversion; /* <--: version number of HBA*/
UInt8 ataHBAslotType; /* <--: type of slot*/
UInt8 ataHBAslotNum; /* <--: slot number of the HBA*/
UInt16 ataReserved7; /* Reserved*/
UInt32 ataReserved8; /* Reserved*/
};
typedef struct ataBusInquiry ataBusInquiry;
/* Manager parameter block structure*/
struct ataMgrInquiry {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
NumVersion ataMgrVersion; /* Manager Version information*/
UInt8 ataMgrPBVers; /* <--: Manager PB version number supported*/
UInt8 Reserved1; /* Reserved*/
UInt16 ataBusCnt; /* <--: Number of ATA buses in the system*/
UInt16 ataDevCnt; /* <--: Total number of ATA devices detected*/
UInt8 ataPioModes; /* <--: Maximum Programmed I/O speed mode supported*/
UInt8 Reserved2; /* Reserved*/
UInt16 ataIOClkResolution; /* <--: IO Clock resolution in nsec (Not supported)*/
UInt8 ataSingleDMAModes; /* <--: Single Word DMA modes supported */
UInt8 ataMultiDMAModes; /* <--: Multiword DMA modes supported*/
SInt16 Reserved[16]; /* Reserved for future expansion*/
};
typedef struct ataMgrInquiry ataMgrInquiry;
/* Parameter block structure for Abort command*/
/* Manager parameter block structure*/
struct ataAbort {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
ataIOPB * ataAbortPB; /* -->: Parameter block to be aborted*/
SInt16 Reserved[22]; /* Reserved for future expansion*/
};
typedef struct ataAbort ataAbort;
/* Manager parameter block structure*/
struct ATAEventRec {
UInt16 ataEventCode; /* --> ATA event code*/
UInt16 ataPhysicalID; /* --> Physical drive reference*/
SInt32 ataDrvrContext; /* Context pointer saved by driver*/
UInt32 ataMarker; /* Always 'LOAD'*/
UInt32 ataEventRecVersion; /* Version number of this data structure*/
UInt32 ataDeviceType; /* Device type on bus (valid for load driver only)*/
UInt16 ataRefNum; /* RefNum of driver (valid for remove driver only)*/
};
typedef struct ATAEventRec ATAEventRec;
typedef ATAEventRec * ATAEventRecPtr;
typedef CALLBACK_API( SInt16 , ATAClientProcPtr )(ATAEventRecPtr ataERPtr);
typedef STACK_UPP_TYPE(ATAClientProcPtr) ATAClientUPP;
#if CALL_NOT_IN_CARBON
/*
* NewATAClientUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( ATAClientUPP )
NewATAClientUPP(ATAClientProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppATAClientProcInfo = 0x000000E0 }; /* pascal 2_bytes Func(4_bytes) */
#ifdef __cplusplus
inline ATAClientUPP NewATAClientUPP(ATAClientProcPtr userRoutine) { return (ATAClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture()); }
#else
#define NewATAClientUPP(userRoutine) (ATAClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeATAClientUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeATAClientUPP(ATAClientUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeATAClientUPP(ATAClientUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeATAClientUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeATAClientUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( SInt16 )
InvokeATAClientUPP(
ATAEventRecPtr ataERPtr,
ATAClientUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline SInt16 InvokeATAClientUPP(ATAEventRecPtr ataERPtr, ATAClientUPP userUPP) { return (SInt16)CALL_ONE_PARAMETER_UPP(userUPP, uppATAClientProcInfo, ataERPtr); }
#else
#define InvokeATAClientUPP(ataERPtr, userUPP) (SInt16)CALL_ONE_PARAMETER_UPP((userUPP), uppATAClientProcInfo, (ataERPtr))
#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 NewATAClientProc(userRoutine) NewATAClientUPP(userRoutine)
#define CallATAClientProc(userRoutine, ataERPtr) InvokeATAClientUPP(ataERPtr, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
/* Parameter block structure for Driver Register command*/
/* Manager parameter block structure*/
struct ataDrvrRegister {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
SInt16 ataDrvrRefNum; /* <->: Driver reference number*/
UInt16 ataDrvrFlags; /* -->: 1 = loader driver if ataPBDeviceID = -1 {PB2}*/
UInt16 ataDeviceNextID; /* <--: used to specified the next drive ID*/
SInt16 ataDrvrLoadPriv; /* Driver loader private storage*/
ATAClientUPP ataEventHandler; /* <->: Pointer to ATA event callback routine {PB2}*/
SInt32 ataDrvrContext; /* <->: Context data saved by driver {PB2}*/
SInt32 ataEventMask; /* <->: Set to 1 for notification of event {PB2}*/
SInt16 Reserved[14]; /* Reserved for future expansion - from [21] {PB2}*/
};
typedef struct ataDrvrRegister ataDrvrRegister;
/* Parameter block structure for Modify driver event mask command*/
struct ataModifyEventMask {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
SInt32 ataModifiedEventMask; /* -->: new event mask value*/
SInt16 Reserved[22]; /* Reserved for future expansion*/
};
typedef struct ataModifyEventMask ataModifyEventMask;
/* 'ataRegMask' field of the ataRegAccess definition*/
enum {
bATAAltSDevCValid = 14, /* bit number of alternate status/device cntrl valid bit*/
bATAStatusCmdValid = 7, /* bit number of status/command valid bit*/
bATASDHValid = 6, /* bit number of ataTFSDH valid bit*/
bATACylinderHiValid = 5, /* bit number of cylinder high valid bit*/
bATACylinderLoValid = 4, /* bit number of cylinder low valid bit*/
bATASectorNumValid = 3, /* bit number of sector number valid bit*/
bATASectorCntValid = 2, /* bit number of sector count valid bit*/
bATAErrFeaturesValid = 1, /* bit number of error/features valid bit*/
bATADataValid = 0, /* bit number of data valid bit*/
mATAAltSDevCValid = 1 << bATAAltSDevCValid, /* alternate status/device control valid*/
mATAStatusCmdValid = 1 << bATAStatusCmdValid, /* status/command valid*/
mATASDHValid = 1 << bATASDHValid, /* ataTFSDH valid*/
mATACylinderHiValid = 1 << bATACylinderHiValid, /* cylinder high valid*/
mATACylinderLoValid = 1 << bATACylinderLoValid, /* cylinder low valid*/
mATASectorNumValid = 1 << bATASectorNumValid, /* sector number valid*/
mATASectorCntValid = 1 << bATASectorCntValid, /* sector count valid*/
mATAErrFeaturesValid = 1 << bATAErrFeaturesValid, /* error/features valid*/
mATADataValid = 1 << bATADataValid /* data valid*/
};
/* Parameter block structure for device register access command*/
union ataRegValueUnion {
UInt8 ataByteRegValue; /* <->: Byte register value read or to be written*/
UInt16 ataWordRegValue; /* <->: Word register value read or to be written*/
};
typedef union ataRegValueUnion ataRegValueUnion;
/* Manager parameter block structure*/
struct ataRegAccess {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/
UInt8 ataPBReserved; /* Reserved */
Ptr ataPBReserved2; /* Reserved */
ATACallbackUPP ataPBCallbackPtr; /* -->: Completion Routine Pointer*/
OSErr ataPBResult; /* <--: Returned result */
UInt8 ataPBFunctionCode; /* -->: Manager Function Code */
UInt8 ataPBIOSpeed; /* -->: I/O Timing Class */
UInt16 ataPBFlags; /* -->: Various control options */
SInt16 ataPBReserved3; /* Reserved */
UInt32 ataPBDeviceID; /* -->: Device identifier (see ataDeviceID) */
UInt32 ataPBTimeOut; /* -->: Transaction timeout value in msec */
Ptr ataPBClientPtr1; /* Client's storage Ptr 1 */
Ptr ataPBClientPtr2; /* Client's storage Ptr 2 */
UInt16 ataPBState; /* Reserved for Manager; Initialize to 0 */
UInt16 ataPBSemaphores; /* Used internally by the manager*/
SInt32 ataPBReserved4; /* Reserved */
/* End of cloned common header ataPBHdr*/
UInt16 ataRegSelect; /* -->: Device Register Selector*/
/* DataReg 0 */
/* ErrorReg(R) or FeaturesReg(W) 1*/
/* SecCntReg 2*/
/* SecNumReg 3*/
/* CylLoReg 4*/
/* CylHiReg 5*/
/* SDHReg 6*/
/* StatusReg(R) or CmdReg(W) 7*/
/* AltStatus(R) or DevCntr(W) 0E*/
ataRegValueUnion ataRegValue;
/* Following fields are valid only if ataRegSelect = 0xFFFF*/
UInt16 ataRegMask; /* -->: mask for register(s) to update*/
/* bit 0 : data register valid*/
/* bit 1 : error/feaures register valid*/
/* bit 2 : sector count register valid*/
/* bit 3 : sector number register valid*/
/* bit 4 : cylinder low register valid*/
/* bit 5 : cylinder high register valid*/
/* bit 6 : ataTFSDH register valid*/
/* bit 7 : status/command register valid*/
/* bits 8 - 13 : reserved (set to 0)*/
/* bit 14: alternate status / device control reg valid*/
/* bit 15: reserved (set to 0)*/
ataTaskFile ataRegisterImage; /* <->: register images*/
UInt8 ataAltSDevCReg; /* <->: Alternate status(R) or Device Control(W) register image*/
UInt8 Reserved3; /* Reserved*/
SInt16 Reserved[16]; /* Reserved for future expansion*/
};
typedef struct ataRegAccess ataRegAccess;
/* Manager parameter block structure <DP03/10/94>*/
struct ataIdentify {
/* Start of cloned common header ataPBHdr*/
ataPBHeader * ataPBLink; /* a pointer to the next entry in the queue */
UInt16 ataPBQType; /* type byte for safety check*/
UInt8 ataPBVers; /* -->: parameter block version number; Must be 0x01*/