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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       ATA.h
  3.  
  4.      Contains:   ATA (PC/AT Attachment) Interfaces
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1995-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ATA__
  18. #define __ATA__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. /* This is the structure used for the AT Interface core routines below */
  42. enum {
  43.     kATATrap                    = 0xAAF1,                       /* Manager trap number <This should be defined in Traps.h>*/
  44.     kATAPBVers1                 = 0x01,                         /* parameter block version number 1*/
  45.     kATAPBVers2                 = 0x02,                         /* parameter block version number for structures*/
  46.     kATAPBVers3                 = 0x03,                         /* parameter block version for ATA times*/
  47.     kATADefaultBlockSize        = 512                           /* default block size*/
  48. };
  49. /* Used to determine the presence of traps*/
  50. enum {
  51.     kFSMTrap                    = 0xAC,
  52.     mDQEChanged                 = 1                             /* DQE has changed */
  53. };
  54. /* Task file definition ooo Error Register ooo*/
  55. enum {
  56.     bATABadBlock                = 7,                            /* bit number of bad block error bit*/
  57.     bATAUncorrectable           = 6,                            /* bit number of uncorrectable error bit*/
  58.     bATAMediaChanged            = 5,                            /* bit number of media changed indicator*/
  59.     bATAIDNotFound              = 4,                            /* bit number of ID not found error bit*/
  60.     bATAMediaChangeReq          = 3,                            /* bit number of media changed request*/
  61.     bATACommandAborted          = 2,                            /* bit number of command abort bit*/
  62.     bATATrack0NotFound          = 1,                            /* bit number of track not found*/
  63.     bATAAddressNotFound         = 0,                            /* bit number of address mark not found*/
  64.     mATABadBlock                = 1 << bATABadBlock,            /* Bad Block Detected*/
  65.     mATAUncorrectable           = 1 << bATAUncorrectable,       /* Uncorrectable Data Error*/
  66.     mATAMediaChanged            = 1 << bATAMediaChanged,        /* Media Changed Indicator (for removable)*/
  67.     mATAIDNotFound              = 1 << bATAIDNotFound,          /* ID Not Found*/
  68.     mATAMediaChangeReq          = 1 << bATAMediaChangeReq,      /* Media Change Requested (NOT IMPLEMENTED)*/
  69.     mATACommandAborted          = 1 << bATACommandAborted,      /* Aborted Command*/
  70.     mATATrack0NotFound          = 1 << bATATrack0NotFound,      /* Track 0 Not Found*/
  71.     mATAAddressNotFound         = 1 << bATAAddressNotFound      /* Address Mark Not Found*/
  72. };
  73. /* Task file definition ooo Features register ooo*/
  74. enum {
  75.     bATAPIuseDMA                = 0,                            /* bit number of useDMA bit (ATAPI)*/
  76.     mATAPIuseDMA                = 1 << bATAPIuseDMA
  77. };
  78. /* Task file definition ooo ataTFSDH Register ooo*/
  79. enum {
  80.     mATAHeadNumber              = 0x0F,                         /* Head Number (bits 0-3) */
  81.     mATASectorSize              = 0xA0,                         /* bit 7=1; bit 5 = 01 (512 sector size) <DP4>*/
  82.     mATADriveSelect             = 0x10,                         /* Drive (0 = master, 1 = slave) */
  83.     mATALBASelect               = 0x40                          /* LBA mode bit (0 = chs, 1 = LBA)*/
  84. };
  85. /* Task file definition ooo Status Register ooo*/
  86. enum {
  87.     bATABusy                    = 7,                            /* bit number of BSY bit*/
  88.     bATADriveReady              = 6,                            /* bit number of drive ready bit*/
  89.     bATAWriteFault              = 5,                            /* bit number of write fault bit*/
  90.     bATASeekComplete            = 4,                            /* bit number of seek complete bit*/
  91.     bATADataRequest             = 3,                            /* bit number of data request bit*/
  92.     bATADataCorrected           = 2,                            /* bit number of data corrected bit*/
  93.     bATAIndex                   = 1,                            /* bit number of index mark*/
  94.     bATAError                   = 0,                            /* bit number of error bit*/
  95.     mATABusy                    = 1 << bATABusy,                /* Unit is busy*/
  96.     mATADriveReady              = 1 << bATADriveReady,          /* Unit is ready*/
  97.     mATAWriteFault              = 1 << bATAWriteFault,          /* Unit has a write fault condition*/
  98.     mATASeekComplete            = 1 << bATASeekComplete,        /* Unit seek complete*/
  99.     mATADataRequest             = 1 << bATADataRequest,         /* Unit data request*/
  100.     mATADataCorrected           = 1 << bATADataCorrected,       /* Data corrected*/
  101.     mATAIndex                   = 1 << bATAIndex,               /* Index mark - NOT USED*/
  102.     mATAError                   = 1 << bATAError                /* Error condition - see error register*/
  103. };
  104. /* Task file definition ooo Device Control Register ooo*/
  105. enum {
  106.     bATADCROne                  = 3,                            /* bit number of always one bit*/
  107.     bATADCRReset                = 2,                            /* bit number of reset bit*/
  108.     bATADCRnIntEnable           = 1,                            /* bit number of interrupt disable*/
  109.     mATADCROne                  = 1 << bATADCROne,              /* always one bit*/
  110.     mATADCRReset                = 1 << bATADCRReset,            /* Reset (1 = reset)*/
  111.     mATADCRnIntEnable           = 1 << bATADCRnIntEnable        /* Interrupt Disable(0 = enabled)*/
  112. };
  113. /* ATA Command Opcode definition*/
  114. enum {
  115.     kATAcmdWORetry              = 0x01,                         /* Without I/O retry option*/
  116.     kATAcmdNOP                  = 0x0000,                       /* NOP operation - media detect*/
  117.     kATAcmdRecal                = 0x0010,                       /* Recalibrate command */
  118.     kATAcmdRead                 = 0x0020,                       /* Read command */
  119.     kATAcmdReadLong             = 0x0022,                       /* Read Long command*/
  120.     kATAcmdWrite                = 0x0030,                       /* Write command */
  121.     kATAcmdWriteLong            = 0x0032,                       /* Write Long*/
  122.     kATAcmdWriteVerify          = 0x003C,                       /* Write verify*/
  123.     kATAcmdReadVerify           = 0x0040,                       /* Read Verify command */
  124.     kATAcmdFormatTrack          = 0x0050,                       /* Format Track command */
  125.     kATAcmdSeek                 = 0x0070,                       /* Seek command */
  126.     kATAcmdDiagnostic           = 0x0090,                       /* Drive Diagnostic command */
  127.     kATAcmdInitDrive            = 0x0091,                       /* Init drive parameters command */
  128.     kATAcmdReadMultiple         = 0x00C4,                       /* Read multiple*/
  129.     kATAcmdWriteMultiple        = 0x00C5,                       /* Write multiple*/
  130.     kATAcmdSetRWMultiple        = 0x00C6,                       /* Set Multiple for Read/Write Multiple*/
  131.     kATAcmdReadDMA              = 0x00C8,                       /* Read DMA (with retries)*/
  132.     kATAcmdWriteDMA             = 0x00CA,                       /* Write DMA (with retries)*/
  133.     kATAcmdMCAcknowledge        = 0x00DB,                       /* Acknowledge media change - removable*/
  134.     kATAcmdDoorLock             = 0x00DE,                       /* Door lock*/
  135.     kATAcmdDoorUnlock           = 0x00DF,                       /* Door unlock*/
  136.     kATAcmdStandbyImmed         = 0x00E0,                       /* Standby Immediate*/
  137.     kATAcmdIdleImmed            = 0x00E1,                       /* Idle Immediate*/
  138.     kATAcmdStandby              = 0x00E2,                       /* Standby*/
  139.     kATAcmdIdle                 = 0x00E3,                       /* Idle*/
  140.     kATAcmdReadBuffer           = 0x00E4,                       /* Read sector buffer command */
  141.     kATAcmdCheckPowerMode       = 0x00E5,                       /* Check power mode command   <04/04/94>*/
  142.     kATAcmdSleep                = 0x00E6,                       /* Sleep*/
  143.     kATAcmdWriteBuffer          = 0x00E8,                       /* Write sector buffer command */
  144.     kATAcmdWriteSame            = 0x00E9,                       /* Write same data to multiple sectors*/
  145.     kATAcmdDriveIdentify        = 0x00EC,                       /* Identify Drive command */
  146.     kATAcmdMediaEject           = 0x00ED,                       /* Media Eject*/
  147.     kATAcmdSetFeatures          = 0x00EF                        /* Set Features*/
  148. };
  149. /* Set feature command opcodes*/
  150. enum {
  151.     kATAEnableWriteCache        = 0x02,                         /*       Enable write cache*/
  152.     kATASetTransferMode         = 0x03,                         /*       Set transfer mode*/
  153.     kATASetPIOMode              = 0x08,                         /*       PIO Flow Control Tx Mode bit*/
  154.     kATAEnableECC               = 0x88,                         /*       ECC enable*/
  155.     kATAEnableRetry             = 0x99,                         /*       Retry enable*/
  156.     kATAEnableReadAhead         = 0xAA                          /*       Read look-ahead enable*/
  157. };
  158. /*
  159.   --------------------------------------------------------------------------------
  160.    enums for dealing with device IDs
  161. */
  162. enum {
  163.     kATABusIDMask               = 0x000000FF,
  164.     kATADeviceIDMask            = 0x0000FF00,
  165.     kATADeviceIDClippingMask    = 0x0000FFFF,
  166.     kMinBusID                   = 0x00000000,
  167.     kMaxBusID                   = 0x000000FE
  168. };
  169. enum {
  170.     kATAStartIterateDeviceID    = 0xFFFF,
  171.     kATAEndIterateDeviceID      = 0xFF
  172. };
  173. /*--------------------------------------------------------------------------------*/
  174. /* Device Register Images  (8 bytes) */
  175. struct ataTaskFile {
  176.     UInt8                           ataTFFeatures;              /* <-> Error(R) or ataTFFeatures(W) register image */
  177.     UInt8                           ataTFCount;                 /* <-> Sector count/remaining */
  178.     UInt8                           ataTFSector;                /* <-> Sector start/finish */
  179.     UInt8                           ataTFReserved;              /* reserved             */
  180.     UInt16                          ataTFCylinder;              /* <-> ataTFCylinder (Big endian) */
  181.     UInt8                           ataTFSDH;                   /* <-> ataTFSDH register image*/
  182.     UInt8                           ataTFCommand;               /* <-> Status(R) or Command(W) register image */
  183. };
  184. typedef struct ataTaskFile              ataTaskFile;
  185. /* ATA Manager Function Code Definition*/
  186. enum {
  187.     kATAMgrNOP                  = 0x00,                         /* No Operation*/
  188.     kATAMgrExecIO               = 0x01,                         /* Execute ATA I/O*/
  189.     kATAMgrBusInquiry           = 0x03,                         /* Bus Inquiry*/
  190.     kATAMgrQRelease             = 0x04,                         /* I/O Queue Release*/
  191.     kATAMgrAbort                = 0x10,                         /* Abort command*/
  192.     kATAMgrBusReset             = 0x11,                         /* Reset ATA bus*/
  193.     kATAMgrRegAccess            = 0x12,                         /* Register Access*/
  194.     kATAMgrDriveIdentify        = 0x13,                         /* Drive Identify        <DP03/10/94>*/
  195.     kATAMgrDriverLoad           = 0x82,                         /* Load driver from either Media, ROM, etc.*/
  196.     kATAMgrDriveRegister        = 0x85,                         /* Register a driver   <4/18/94>*/
  197.     kATAMgrFindDriverRefnum     = 0x86,                         /* lookup a driver refnum <4/18/94>*/
  198.     kATAMgrRemoveDriverRefnum   = 0x87,                         /* De-register a driver   <4/18/94>*/
  199.     kATAMgrModifyEventMask      = 0x88,                         /* Modify driver event mask*/
  200.     kATAMgrDriveEject           = 0x89,                         /* Eject the drive       <8/1/94>*/
  201.     kATAMgrGetDrvConfiguration  = 0x8A,                         /* Get device configuration   <8/6/94>*/
  202.     kATAMgrSetDrvConfiguration  = 0x8B,                         /* Set device configuration <8/6/94>*/
  203.     kATAMgrGetLocationIcon      = 0x8C,                         /* Get card location icon <SM4>*/
  204.     kATAMgrManagerInquiry       = 0x90,                         /* Manager Inquiry*/
  205.     kATAMgrManagerInit          = 0x91,                         /* Manager initialization*/
  206.     kATAMgrManagerShutdown      = 0x92,                         /* Manager ShutDown*/
  207.                                                                 /* note: functions 0x93 to 0x97 are reserved*/
  208.     kATAMgrFindSpecialDriverRefnum = 0x98,                      /* lookup a driver refnum; driverloader,notify-all or ROM driver.*/
  209.     kATAMgrNextAvailable        = 0x99
  210. };
  211. /* used in the ataDrvrFlags field for kATAMgrDriveRegister,kATAMgrRemoveDriverRefnum & kATAMgrFindSpecialDriverRefnum*/
  212. enum {
  213.     kATANotifyAllDriver         = 0,                            /* Notify-All driver*/
  214.     kATADriverLoader            = 1,                            /* Driver loader driver     */
  215.     kATAROMDriver               = 2                             /* ROM driver*/
  216. };
  217. /* 'ATAFlags' field of the PB header definition*/
  218. enum {
  219.     bATAFlagUseConfigSpeed      = 15,                           /* bit number of use default speed flag*/
  220.     bATAFlagByteSwap            = 14,                           /* bit number of byte swap flag*/
  221.     bATAFlagIORead              = 13,                           /* bit number of I/O read flag*/
  222.     bATAFlagIOWrite             = 12,                           /* bit number of I/O write flag*/
  223.     bATAFlagImmediate           = 11,                           /* bit number of immediate flag*/
  224.     bATAFlagQLock               = 10,                           /* bit number of que lock on error*/
  225.     bATAFlagReserved1           = 9,                            /* reserved*/
  226.     bATAFlagUseScatterGather    = 8,                            /* bit numbers of scatter gather*/
  227.     bATAFlagUseDMA              = 7,                            /* bit number of use DMA flag*/
  228.     bATAFlagProtocolATAPI       = 5,                            /* bit number of ATAPI protocol*/
  229.     bATAFlagReserved2           = 4,                            /* reserved*/
  230.     bATAFlagTFRead              = 3,                            /* bit number of register update*/
  231.     bATAFlagLEDEnable           = 0,                            /* bit number of LED enable*/
  232.     mATAFlagUseConfigSpeed      = 1 << bATAFlagUseConfigSpeed,
  233.     mATAFlagByteSwap            = 1 << bATAFlagByteSwap,        /* Swap data bytes (read - after; write - before)*/
  234.     mATAFlagIORead              = 1 << bATAFlagIORead,          /* Read (in) operation*/
  235.     mATAFlagIOWrite             = 1 << bATAFlagIOWrite,         /* Write (out) operation*/
  236.     mATAFlagImmediate           = 1 << bATAFlagImmediate,       /* Head of Que; Immediate operation*/
  237.     mATAFlagQLock               = 1 << bATAFlagQLock,           /* Manager queue lock on error (freeze the queue)*/
  238.     mATAFlagUseScatterGather    = 1 << bATAFlagUseScatterGather, /* Scatter gather enable*/
  239.     mATAFlagUseDMA              = 1 << bATAFlagUseDMA,
  240.     mATAFlagProtocolATAPI       = 1 << bATAFlagProtocolATAPI,   /* ATAPI protocol indicator*/
  241.     mATAFlagTFRead              = 1 << bATAFlagTFRead,          /* update reg block request upon detection of an error*/
  242.     mATAFlagLEDEnable           = 1 << bATAFlagLEDEnable        /* socket LED enable*/
  243. };
  244. /* These are legacy ATAFlags definitions, which will go away in the future*/
  245. enum {
  246.     bATAFlagScatterGather1      = bATAFlagReserved1,            /* 9*/
  247.     bATAFlagScatterGather0      = bATAFlagUseScatterGather,     /* 8*/
  248.     bATAFlagProtocol1           = bATAFlagProtocolATAPI,        /* 5*/
  249.     bATAFlagProtocol0           = bATAFlagReserved2,            /* 4*/
  250.     mATAFlagScatterGather1      = 1 << bATAFlagScatterGather1,
  251.     mATAFlagScatterGather0      = mATAFlagUseScatterGather,
  252.     mATAFlagScatterGathers      = mATAFlagScatterGather1 + mATAFlagScatterGather0,
  253.     mATAFlagProtocol1           = mATAFlagProtocolATAPI,
  254.     mATAFlagProtocol0           = 1 << bATAFlagProtocol0,
  255.     mATAFlagProtocols           = mATAFlagProtocol1 + mATAFlagProtocol0
  256. };
  257. typedef CALLBACK_API( void , ATACallbackProcPtr )(void *ataPB);
  258. typedef STACK_UPP_TYPE(ATACallbackProcPtr)                      ATACallbackUPP;
  259. #if OPAQUE_UPP_TYPES
  260. #if CALL_NOT_IN_CARBON
  261.     EXTERN_API(ATACallbackUPP)
  262.     NewATACallbackUPP              (ATACallbackProcPtr      userRoutine);
  263.     EXTERN_API(void)
  264.     DisposeATACallbackUPP          (ATACallbackUPP          userUPP);
  265.     EXTERN_API(void)
  266.     InvokeATACallbackUPP           (void *                  ataPB,
  267.                                     ATACallbackUPP          userUPP);
  268. #endif  /* CALL_NOT_IN_CARBON */
  269. #else
  270.     enum { uppATACallbackProcInfo = 0x000000C0 };                   /* pascal no_return_value Func(4_bytes) */
  271.     #define NewATACallbackUPP(userRoutine)                          (ATACallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATACallbackProcInfo, GetCurrentArchitecture())
  272.     #define DisposeATACallbackUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  273.     #define InvokeATACallbackUPP(ataPB, userUPP)                    CALL_ONE_PARAMETER_UPP((userUPP), uppATACallbackProcInfo, (ataPB))
  274. #endif
  275. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  276. #define NewATACallbackProc(userRoutine)                         NewATACallbackUPP(userRoutine)
  277. #define CallATACallbackProc(userRoutine, ataPB)                 InvokeATACallbackUPP(ataPB, userRoutine)
  278. /*
  279.    
  280.    structure which defines the ATA bus/device ID, part of the Device 0/1 Software Guide
  281.    see <http://developer.apple.com/techpubs/hardware/Developer_Notes/System_Software/ATA_Device_Zero_One.pdf>
  282.    p 19 :   Although ataPBDeviceID remains defined as a 32-bit number, drivers and applications
  283.             can typecast it to the ataDeviceID structure to determine the bus number and device number
  284.             for a specific ATA or ATAPI device
  285. */
  286. struct ataDeviceID {
  287.     UInt16                          Reserved;                   /* The upperword is reserved (0)*/
  288.     UInt8                           devNum;                     /* device number (0 or 1)*/
  289.     UInt8                           busNum;                     /* bus number*/
  290. };
  291. typedef struct ataDeviceID              ataDeviceID;
  292. struct ataPBHeader {
  293.                                                                 /* Start of cloned common header ataPBHdr */
  294.     struct ataPBHeader *            ataPBLink;                  /* a pointer to the next entry in the queue   */
  295.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  296.     UInt8                           ataPBVers;                  /* -->: parameter block version number*/
  297.     UInt8                           ataPBReserved;              /* Reserved                         */
  298.     Ptr                             ataPBReserved2;             /* Reserved                         */
  299.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  300.     OSErr                           ataPBResult;                /* <--: Returned result          */
  301.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  302.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  303.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  304.     SInt16                          ataPBReserved3;             /* Reserved                         */
  305.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  306.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  307.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  308.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  309.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  310.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  311.     SInt32                          ataPBReserved4;             /* Reserved                         */
  312.                                                                 /* End of cloned common header ataPBHdr*/
  313. };
  314. typedef struct ataPBHeader              ataPBHeader;
  315. /* data request entry structure (16 bytes)*/
  316. struct IOBlock {
  317.     UInt8 *                         ataPBBuffer;                /* -->: Data buffer pointer*/
  318.     UInt32                          ataPBByteCount;             /* -->: Data transfer length in bytes*/
  319. };
  320. typedef struct IOBlock                  IOBlock;
  321. /*
  322.    For ATAPI devices the ExtendedPB field is a pointer to the Command Packet
  323.    record which exists of an array of words structured as follows...  <06/15/94>
  324. */
  325. struct ATAPICmdPacket {
  326.     SInt16                          atapiPacketSize;            /* Size of command packet in bytes    <06/15/94>*/
  327.     SInt16                          atapiCommandByte[8];        /* The command packet itself  <06/15/94>*/
  328. };
  329. typedef struct ATAPICmdPacket           ATAPICmdPacket;
  330. /* Manager parameter block structure (96 bytes)*/
  331. struct ataIOPB {
  332.                                                                 /* Start of cloned common header ataPBHdr*/
  333.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  334.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  335.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  336.     UInt8                           ataPBReserved;              /* Reserved                         */
  337.     Ptr                             ataPBReserved2;             /* Reserved                         */
  338.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  339.     OSErr                           ataPBResult;                /* <--: Returned result          */
  340.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  341.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  342.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  343.     SInt16                          ataPBReserved3;             /* Reserved                         */
  344.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  345.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  346.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  347.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  348.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  349.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  350.     SInt32                          ataPBReserved4;             /* Reserved                         */
  351.                                                                 /* End of cloned common header ataPBHdr*/
  352.     SInt8                           ataPBStatusRegister;        /* <--: Last ATA status image*/
  353.     SInt8                           ataPBErrorRegister;         /* <--: Last ATA error image-valid if lsb of Status set*/
  354.     SInt16                          ataPBReserved5;             /* Reserved*/
  355.     UInt32                          ataPBLogicalBlockSize;      /* -->: Blind transfer size per interrupt (Logical block size)*/
  356.     UInt8 *                         ataPBBuffer;                /* -->: Data buffer pointer*/
  357.     UInt32                          ataPBByteCount;             /* -->: Data transfer length in bytes*/
  358.     UInt32                          ataPBActualTxCount;         /* <--: Actual transfer count*/
  359.     UInt32                          ataPBReserved6;             /* Reserved*/
  360.     ataTaskFile                     ataPBTaskFile;              /* <->:   Device register images*/
  361.     ATAPICmdPacket *                ataPBPacketPtr;             /* -->: ATAPI packet command block pointer (valid with ATAPI bit set)*/
  362.     SInt16                          ataPBReserved7[6];          /* Reserved for future expansion*/
  363. };
  364. typedef struct ataIOPB                  ataIOPB;
  365. /* Parameter block structure for bus and Manager inquiry command*/
  366. /* Manager parameter block structure*/
  367. struct ataBusInquiry {
  368.                                                                 /* Start of cloned common header ataPBHdr*/
  369.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  370.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  371.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  372.     UInt8                           ataPBReserved;              /* Reserved                         */
  373.     Ptr                             ataPBReserved2;             /* Reserved                         */
  374.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  375.     OSErr                           ataPBResult;                /* <--: Returned result          */
  376.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  377.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  378.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  379.     SInt16                          ataPBReserved3;             /* Reserved                         */
  380.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  381.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  382.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  383.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  384.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  385.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  386.     SInt32                          ataPBReserved4;             /* Reserved                         */
  387.                                                                 /* End of cloned common header ataPBHdr*/
  388.     UInt16                          ataEngineCount;             /* <--: TBD; zero for now*/
  389.     UInt16                          ataReserved1;               /* Reserved*/
  390.     UInt32                          ataDataTypes;               /* <--: TBD; zero for now*/
  391.     UInt16                          ataIOpbSize;                /* <--: Size of ATA IO PB*/
  392.     UInt16                          ataMaxIOpbSize;             /* <--: TBD; zero for now*/
  393.     UInt32                          ataFeatureFlags;            /* <--: TBD*/
  394.     UInt8                           ataVersionNum;              /* <--: Version number for the HBA*/
  395.     UInt8                           ataHBAInquiry;              /* <--: TBD; zero for now*/
  396.     UInt16                          ataReserved2;               /* Reserved*/
  397.     UInt32                          ataHBAPrivPtr;              /* <--: Ptr to HBA private data area*/
  398.     UInt32                          ataHBAPrivSize;             /* <--: Size of HBA private data area*/
  399.     UInt32                          ataAsyncFlags;              /* <--: Event capability for callback*/
  400.     UInt8                           ataPIOModes;                /* <--: PIO modes supported (bit-significant)*/
  401.     UInt8                           ataUltraDMAModes;           /* <--: Ultra DMA modes supported (b-sig)*/
  402.     UInt8                           ataSingleDMAModes;          /* <--: Single Word DMA modes supported (b-sig)   */
  403.     UInt8                           ataMultiDMAModes;           /* <--: Multiword DMA modes supported (b-sig)*/
  404.     UInt32                          ataReserved4[4];            /* Reserved*/
  405.     SInt8                           ataReserved5[16];           /* TBD*/
  406.     SInt8                           ataHBAVendor[16];           /* <--: Vendor ID of the HBA*/
  407.     SInt8                           ataContrlFamily[16];        /* <--: Family of ATA Controller*/
  408.     SInt8                           ataContrlType[16];          /* <--: Model number of controller*/
  409.     SInt8                           ataXPTversion[4];           /* <--: version number of XPT*/
  410.     SInt8                           ataReserved6[4];            /* Reserved*/
  411.     NumVersion                      ataHBAversion;              /* <--: version number of HBA*/
  412.     UInt8                           ataHBAslotType;             /* <--: type of slot*/
  413.     UInt8                           ataHBAslotNum;              /* <--: slot number of the HBA*/
  414.     UInt16                          ataReserved7;               /* Reserved*/
  415.     UInt32                          ataReserved8;               /* Reserved*/
  416. };
  417. typedef struct ataBusInquiry            ataBusInquiry;
  418. /* Manager parameter block structure*/
  419. struct ataMgrInquiry {
  420.                                                                 /* Start of cloned common header ataPBHdr*/
  421.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  422.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  423.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  424.     UInt8                           ataPBReserved;              /* Reserved                         */
  425.     Ptr                             ataPBReserved2;             /* Reserved                         */
  426.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  427.     OSErr                           ataPBResult;                /* <--: Returned result          */
  428.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  429.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  430.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  431.     SInt16                          ataPBReserved3;             /* Reserved                         */
  432.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  433.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  434.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  435.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  436.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  437.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  438.     SInt32                          ataPBReserved4;             /* Reserved                         */
  439.                                                                 /* End of cloned common header ataPBHdr*/
  440.     NumVersion                      ataMgrVersion;              /* Manager Version information*/
  441.     UInt8                           ataMgrPBVers;               /* <--: Manager PB version number supported*/
  442.     UInt8                           Reserved1;                  /* Reserved*/
  443.     UInt16                          ataBusCnt;                  /* <--: Number of ATA buses in the system*/
  444.     UInt16                          ataDevCnt;                  /* <--: Total number of ATA devices detected*/
  445.     UInt8                           ataPioModes;                /* <--: Maximum Programmed I/O speed mode supported*/
  446.     UInt8                           Reserved2;                  /* Reserved*/
  447.     UInt16                          ataIOClkResolution;         /* <--: IO Clock resolution in nsec (Not supported)*/
  448.     UInt8                           ataSingleDMAModes;          /* <--: Single Word DMA modes supported   */
  449.     UInt8                           ataMultiDMAModes;           /* <--: Multiword DMA modes supported*/
  450.     SInt16                          Reserved[16];               /* Reserved for future expansion*/
  451. };
  452. typedef struct ataMgrInquiry            ataMgrInquiry;
  453. /* Parameter block structure for Abort command*/
  454. /* Manager parameter block structure*/
  455. struct ataAbort {
  456.                                                                 /* Start of cloned common header ataPBHdr*/
  457.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  458.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  459.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  460.     UInt8                           ataPBReserved;              /* Reserved                         */
  461.     Ptr                             ataPBReserved2;             /* Reserved                         */
  462.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  463.     OSErr                           ataPBResult;                /* <--: Returned result          */
  464.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  465.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  466.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  467.     SInt16                          ataPBReserved3;             /* Reserved                         */
  468.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  469.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  470.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  471.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  472.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  473.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  474.     SInt32                          ataPBReserved4;             /* Reserved                         */
  475.                                                                 /* End of cloned common header ataPBHdr*/
  476.     ataIOPB *                       ataAbortPB;                 /* -->: Parameter block to be aborted*/
  477.     SInt16                          Reserved[22];               /* Reserved for future expansion*/
  478. };
  479. typedef struct ataAbort                 ataAbort;
  480. /* Manager parameter block structure*/
  481. struct ATAEventRec {
  482.     UInt16                          ataEventCode;               /* --> ATA event code*/
  483.     UInt16                          ataPhysicalID;              /* --> Physical drive reference*/
  484.     SInt32                          ataDrvrContext;             /* Context pointer saved by driver*/
  485.     UInt32                          ataMarker;                  /* Always 'LOAD'*/
  486.     UInt32                          ataEventRecVersion;         /* Version number of this data structure*/
  487.     UInt32                          ataDeviceType;              /* Device type on bus (valid for load driver only)*/
  488.     UInt16                          ataRefNum;                  /* RefNum of driver (valid for remove driver only)*/
  489. };
  490. typedef struct ATAEventRec              ATAEventRec;
  491. typedef ATAEventRec *                   ATAEventRecPtr;
  492. typedef CALLBACK_API( SInt16 , ATAClientProcPtr )(ATAEventRecPtr ataERPtr);
  493. typedef STACK_UPP_TYPE(ATAClientProcPtr)                        ATAClientUPP;
  494. #if OPAQUE_UPP_TYPES
  495. #if CALL_NOT_IN_CARBON
  496.     EXTERN_API(ATAClientUPP)
  497.     NewATAClientUPP                (ATAClientProcPtr        userRoutine);
  498.     EXTERN_API(void)
  499.     DisposeATAClientUPP            (ATAClientUPP            userUPP);
  500.     EXTERN_API(SInt16)
  501.     InvokeATAClientUPP             (ATAEventRecPtr          ataERPtr,
  502.                                     ATAClientUPP            userUPP);
  503. #endif  /* CALL_NOT_IN_CARBON */
  504. #else
  505.     enum { uppATAClientProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  506.     #define NewATAClientUPP(userRoutine)                            (ATAClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture())
  507.     #define DisposeATAClientUPP(userUPP)                            DisposeRoutineDescriptor(userUPP)
  508.     #define InvokeATAClientUPP(ataERPtr, userUPP)                   (SInt16)CALL_ONE_PARAMETER_UPP((userUPP), uppATAClientProcInfo, (ataERPtr))
  509. #endif
  510. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  511. #define NewATAClientProc(userRoutine)                           NewATAClientUPP(userRoutine)
  512. #define CallATAClientProc(userRoutine, ataERPtr)                InvokeATAClientUPP(ataERPtr, userRoutine)
  513. /* Parameter block structure for Driver Register command*/
  514. /* Manager parameter block structure*/
  515. struct ataDrvrRegister {
  516.                                                                 /* Start of cloned common header ataPBHdr*/
  517.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  518.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  519.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  520.     UInt8                           ataPBReserved;              /* Reserved                         */
  521.     Ptr                             ataPBReserved2;             /* Reserved                         */
  522.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  523.     OSErr                           ataPBResult;                /* <--: Returned result          */
  524.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  525.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  526.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  527.     SInt16                          ataPBReserved3;             /* Reserved                         */
  528.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  529.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  530.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  531.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  532.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  533.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  534.     SInt32                          ataPBReserved4;             /* Reserved                         */
  535.                                                                 /* End of cloned common header ataPBHdr*/
  536.     SInt16                          ataDrvrRefNum;              /* <->: Driver reference number*/
  537.     UInt16                          ataDrvrFlags;               /* -->: 1 = loader driver if ataPBDeviceID = -1 {PB2}*/
  538.     UInt16                          ataDeviceNextID;            /* <--: used to specified the next drive ID*/
  539.     SInt16                          ataDrvrLoadPriv;            /* Driver loader private storage*/
  540.     ATAClientUPP                    ataEventHandler;            /* <->: Pointer to ATA event callback routine {PB2}*/
  541.     SInt32                          ataDrvrContext;             /* <->: Context data saved by driver {PB2}*/
  542.     SInt32                          ataEventMask;               /* <->: Set to 1 for notification of event {PB2}*/
  543.     SInt16                          Reserved[14];               /* Reserved for future expansion - from [21] {PB2}*/
  544. };
  545. typedef struct ataDrvrRegister          ataDrvrRegister;
  546. /* Parameter block structure for Modify driver event mask command*/
  547. struct ataModifyEventMask {
  548.                                                                 /* Start of cloned common header ataPBHdr*/
  549.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  550.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  551.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  552.     UInt8                           ataPBReserved;              /* Reserved                         */
  553.     Ptr                             ataPBReserved2;             /* Reserved                         */
  554.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  555.     OSErr                           ataPBResult;                /* <--: Returned result          */
  556.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  557.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  558.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  559.     SInt16                          ataPBReserved3;             /* Reserved                         */
  560.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  561.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  562.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  563.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  564.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  565.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  566.     SInt32                          ataPBReserved4;             /* Reserved                         */
  567.                                                                 /* End of cloned common header ataPBHdr*/
  568.     SInt32                          ataModifiedEventMask;       /* -->: new event mask value*/
  569.     SInt16                          Reserved[22];               /* Reserved for future expansion*/
  570. };
  571. typedef struct ataModifyEventMask       ataModifyEventMask;
  572. /* 'ataRegMask' field of the ataRegAccess definition*/
  573. enum {
  574.     bATAAltSDevCValid           = 14,                           /* bit number of alternate status/device cntrl valid bit*/
  575.     bATAStatusCmdValid          = 7,                            /* bit number of status/command valid bit*/
  576.     bATASDHValid                = 6,                            /* bit number of ataTFSDH valid bit*/
  577.     bATACylinderHiValid         = 5,                            /* bit number of cylinder high valid bit*/
  578.     bATACylinderLoValid         = 4,                            /* bit number of cylinder low valid bit*/
  579.     bATASectorNumValid          = 3,                            /* bit number of sector number valid bit*/
  580.     bATASectorCntValid          = 2,                            /* bit number of sector count valid bit*/
  581.     bATAErrFeaturesValid        = 1,                            /* bit number of error/features valid bit*/
  582.     bATADataValid               = 0,                            /* bit number of data valid bit*/
  583.     mATAAltSDevCValid           = 1 << bATAAltSDevCValid,       /* alternate status/device control valid*/
  584.     mATAStatusCmdValid          = 1 << bATAStatusCmdValid,      /* status/command valid*/
  585.     mATASDHValid                = 1 << bATASDHValid,            /* ataTFSDH valid*/
  586.     mATACylinderHiValid         = 1 << bATACylinderHiValid,     /* cylinder high valid*/
  587.     mATACylinderLoValid         = 1 << bATACylinderLoValid,     /* cylinder low valid*/
  588.     mATASectorNumValid          = 1 << bATASectorNumValid,      /* sector number valid*/
  589.     mATASectorCntValid          = 1 << bATASectorCntValid,      /* sector count valid*/
  590.     mATAErrFeaturesValid        = 1 << bATAErrFeaturesValid,    /* error/features valid*/
  591.     mATADataValid               = 1 << bATADataValid            /* data valid*/
  592. };
  593. /* Parameter block structure for device register access command*/
  594. union ataRegValueUnion {
  595.     UInt8                           ataByteRegValue;            /* <->: Byte register value read or to be written*/
  596.     UInt16                          ataWordRegValue;            /* <->: Word register value read or to be written*/
  597. };
  598. typedef union ataRegValueUnion          ataRegValueUnion;
  599. /* Manager parameter block structure*/
  600. struct ataRegAccess {
  601.                                                                 /* Start of cloned common header ataPBHdr*/
  602.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  603.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  604.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  605.     UInt8                           ataPBReserved;              /* Reserved                         */
  606.     Ptr                             ataPBReserved2;             /* Reserved                         */
  607.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  608.     OSErr                           ataPBResult;                /* <--: Returned result          */
  609.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  610.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  611.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  612.     SInt16                          ataPBReserved3;             /* Reserved                         */
  613.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  614.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  615.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  616.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  617.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  618.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  619.     SInt32                          ataPBReserved4;             /* Reserved                         */
  620.                                                                 /* End of cloned common header ataPBHdr*/
  621.     UInt16                          ataRegSelect;               /* -->: Device Register Selector*/
  622.                                                                 /*         DataReg       0  */
  623.                                                                 /*         ErrorReg(R) or FeaturesReg(W)    1*/
  624.                                                                 /*         SecCntReg       2*/
  625.                                                                 /*         SecNumReg       3*/
  626.                                                                 /*         CylLoReg     4*/
  627.                                                                 /*         CylHiReg     5*/
  628.                                                                 /*         SDHReg      6*/
  629.                                                                 /*         StatusReg(R) or CmdReg(W)       7*/
  630.                                                                 /*         AltStatus(R) or DevCntr(W)   0E*/
  631.     ataRegValueUnion                ataRegValue;
  632.                                                                 /* Following fields are valid only if ataRegSelect = 0xFFFF*/
  633.     UInt16                          ataRegMask;                 /* -->: mask for register(s) to update*/
  634.                                                                 /*       bit 0 : data register valid*/
  635.                                                                 /*       bit 1 : error/feaures register valid*/
  636.                                                                 /*       bit 2 : sector count register valid*/
  637.                                                                 /*       bit 3 : sector number register valid*/
  638.                                                                 /*       bit 4 : cylinder low register valid*/
  639.                                                                 /*       bit 5 : cylinder high register valid*/
  640.                                                                 /*       bit 6 : ataTFSDH register valid*/
  641.                                                                 /*       bit 7 : status/command register valid*/
  642.                                                                 /*       bits 8 - 13 : reserved (set to 0)*/
  643.                                                                 /*       bit 14: alternate status / device control reg valid*/
  644.                                                                 /*      bit 15: reserved (set to 0)*/
  645.     ataTaskFile                     ataRegisterImage;           /* <->: register images*/
  646.     UInt8                           ataAltSDevCReg;             /* <->: Alternate status(R) or Device Control(W) register image*/
  647.     UInt8                           Reserved3;                  /* Reserved*/
  648.     SInt16                          Reserved[16];               /* Reserved for future expansion*/
  649. };
  650. typedef struct ataRegAccess             ataRegAccess;
  651. /* Manager parameter block structure    <DP03/10/94>*/
  652. struct ataIdentify {
  653.                                                                 /* Start of cloned common header ataPBHdr*/
  654.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  655.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  656.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  657.     UInt8                           ataPBReserved;              /* Reserved                         */
  658.     Ptr                             ataPBReserved2;             /* Reserved                         */
  659.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  660.     OSErr                           ataPBResult;                /* <--: Returned result          */
  661.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  662.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  663.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  664.     SInt16                          ataPBReserved3;             /* Reserved                         */
  665.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  666.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  667.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  668.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  669.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  670.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  671.     SInt32                          ataPBReserved4;             /* Reserved                         */
  672.                                                                 /* End of cloned common header ataPBHdr*/
  673.     UInt16                          Reserved1[4];               /* Reserved.  These are used internally by the Manager*/
  674.     UInt8 *                         ataPBBuffer;                /* Buffer for the identify data (512 bytes)*/
  675.     UInt16                          Reserved2[12];              /* Used internally by the ATA Manager*/
  676.     SInt16                          Reserved3[6];               /* Reserved for future expansion*/
  677. };
  678. typedef struct ataIdentify              ataIdentify;
  679. /* 'ataConfigSetting' field of the Get/Set Device Configuration definition <8/6/94>*/
  680. enum {
  681.     ATAPIpacketDRQ_bit          = 6,                            /* bit number of ATAPI command packet DRQ option*/
  682.     ATAPIpacketDRQ              = 1 << ATAPIpacketDRQ_bit       /* ATAPI command packet DRQ option*/
  683. };
  684. /* atapcValid field definition*/
  685. enum {
  686.     bATApcAccessMode            = 0,
  687.     bATApcVcc                   = 1,
  688.     bATApcVpp1                  = 2,
  689.     bATApcVpp2                  = 3,
  690.     bATApcStatus                = 4,
  691.     bATApcPin                   = 5,
  692.     bATApcCopy                  = 6,
  693.     bATApcConfigIndex           = 7,
  694.     bATApcLockUnlock            = 15,
  695.     mATApcAccessMode            = 1 << bATApcAccessMode,
  696.     mATApcVcc                   = 1 << bATApcVcc,
  697.     mATApcVpp1                  = 1 << bATApcVpp1,
  698.     mATApcVpp2                  = 1 << bATApcVpp2,
  699.     mATApcStatus                = 1 << bATApcStatus,
  700.     mATApcPin                   = 1 << bATApcPin,
  701.     mATApcCopy                  = 1 << bATApcCopy,
  702.     mATApcConfigIndex           = 1 << bATApcConfigIndex,
  703.     mATApcLockUnlock            = 1 << bATApcLockUnlock
  704. };
  705. /* Device physical type & socket type indicator definition*/
  706. enum {
  707.     kATADeviceUnknown           = 0x00,                         /* no device or type undetermined*/
  708.     kATADeviceATA               = 0x01,                         /* traditional ATA protocol device <7/29/94>*/
  709.     kATADeviceATAPI             = 0x02,                         /* ATAPI protocol device  <7/29/94>*/
  710.     kATADeviceReserved          = 0x03                          /* reserved by Apple (was PCMCIA)*/
  711. };
  712. enum {
  713.     kATASocketInternal          = 0x01,                         /* Internal ATA socket*/
  714.     kATASocketMB                = 0x02,                         /* Media Bay socket*/
  715.     kATASocketPCMCIA            = 0x03                          /* PCMCIA socket*/
  716. };
  717. /* reserved words at the end of the devConfig structure*/
  718. enum {
  719.     kATAConfigReserved          = 5                             /* number of reserved words at the end*/
  720. };
  721. /*
  722.    Get/Set Device Configuration parameter block structure <8/6/94>
  723.    Manager parameter block structure
  724. */
  725. struct ataDevConfiguration {
  726.                                                                 /* Start of cloned common header ataPBHdr*/
  727.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  728.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  729.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  730.     UInt8                           ataPBReserved;              /* Reserved                         */
  731.     Ptr                             ataPBReserved2;             /* Reserved                         */
  732.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  733.     OSErr                           ataPBResult;                /* <--: Returned result          */
  734.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  735.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  736.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  737.     SInt16                          ataPBReserved3;             /* Reserved                         */
  738.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  739.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  740.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  741.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  742.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  743.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  744.     SInt32                          ataPBReserved4;             /* Reserved                         */
  745.                                                                 /* End of cloned common header ataPBHdr*/
  746.     SInt32                          ataConfigSetting;           /* <->: Configuration setting*/
  747.                                                                 /*      Bits 3 - 0: Reserved*/
  748.                                                                 /*      Bit 4: Reserved (allowLBAAccess)*/
  749.                                                                 /*      Bit 5: Reserved (allowRWMultiple)*/
  750.                                                                 /*      Bit 6: ATAPIpacketDRQ*/
  751.                                                                 /*       1 = Check for Interrupt DRQ on ATAPI command packet DRQ*/
  752.                                                                 /*       0 = Default: Check only for the assertion of command packet DRQ*/
  753.                                                                 /*      Bits 31 - 7: Reserved*/
  754.     UInt8                           ataPIOSpeedMode;            /* <->: Device access speed in PIO Mode*/
  755.     UInt8                           Reserved3;                  /* Reserved to force word alignment*/
  756.     UInt16                          atapcValid;                 /* <->: Set when pcXXX fields are valid (atapcAccessMode - atapcConfigIndex)*/
  757.                                                                 /*       bit 0 - atapcAccessMode field valid, when set*/
  758.                                                                 /*       bit 1 - atapcVcc field valid, when set*/
  759.                                                                 /*       bit 2 - atapcVpp1 field valid, when set*/
  760.                                                                 /*       bit 3 - atapcVpp2 field valid, when set*/
  761.                                                                 /*       bit 4 - atapcStatus field valid, when set*/
  762.                                                                 /*       bit 5 - atapcPin field valid, when set*/
  763.                                                                 /*       bit 6 - atapcCopy field valid, when set*/
  764.                                                                 /*       bit 7 - atapcConfigIndex field valid, when set*/
  765.                                                                 /*       bits 14-8 - Reserved*/
  766.                                                                 /*       bit 15 - device lock/unlock request (write only)*/
  767.     UInt16                          ataRWMultipleCount;         /* Reserved for future (not supported yet)*/
  768.     UInt16                          ataSectorsPerCylinder;      /* Reserved for future (not supported yet)*/
  769.     UInt16                          ataHeads;                   /* Reserved for future (not supported yet)*/
  770.     UInt16                          ataSectorsPerTrack;         /* Reserved for future (not supported yet)*/
  771.     UInt16                          ataSocketNumber;            /* <--: Socket number used by the CardServices*/
  772.                                                                 /*       0xFF = socket number invalid (Not a CardServices device)*/
  773.                                                                 /*       other = socket number of the device*/
  774.     UInt8                           ataSocketType;              /* <--: Specifies the socket type (get config only)*/
  775.                                                                 /*       00 = Unknown socket*/
  776.                                                                 /*      01 = Internal ATA bus*/
  777.                                                                 /*       02 = Media Bay*/
  778.                                                                 /*       03 = PCMCIA*/
  779.     UInt8                           ataDeviceType;              /* <--: Specifies the device type (get config only)*/
  780.                                                                 /*       00 = Unknown device*/
  781.                                                                 /*       01 = standard ATA device (HD)*/
  782.                                                                 /*       02 = ATAPI device*/
  783.                                                                 /*       03 = PCMCIA ATA device*/
  784.     UInt8                           atapcAccessMode;            /* <->: Access mode: Memory vs. I/O (PCMCIA only)*/
  785.     UInt8                           atapcVcc;                   /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  786.     UInt8                           atapcVpp1;                  /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  787.     UInt8                           atapcVpp2;                  /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  788.     UInt8                           atapcStatus;                /* <->: Card Status register setting (PCMCIA only)*/
  789.     UInt8                           atapcPin;                   /* <->: Card Pin register setting (PCMCIA only)*/
  790.     UInt8                           atapcCopy;                  /* <->: Card Socket/Copy register setting (PCMCIA only)*/
  791.     UInt8                           atapcConfigIndex;           /* <->: Card Option register setting (PCMCIA only)*/
  792.     UInt8                           ataSingleDMASpeed;          /* <->: Single Word DMA Timing Class*/
  793.     UInt8                           ataMultiDMASpeed;           /* <->: Multiple Word DMA Timing Class*/
  794.     UInt16                          ataPIOCycleTime;            /* <->:Cycle time for PIO mode*/
  795.     UInt16                          ataMultiCycleTime;          /* <->:Cycle time for Multiword DMA mode*/
  796.     UInt8                           ataUltraDMASpeed;           /* <-> Ultra DMA timing class*/
  797.     UInt8                           reserved2;                  /* reserved*/
  798.     UInt16                          ataUltraCycleTime;          /* <-> Cycle time for Ultra DMA mode*/
  799.     UInt16                          Reserved1[5];               /* Reserved for future*/
  800. };
  801. typedef struct ataDevConfiguration      ataDevConfiguration;
  802. /* Get Card Location Icon/Text  <SM4>*/
  803. enum {
  804.     kATALargeIconHFS            = 0x0001,                       /* Large B&W icon with mask (HFS)*/
  805.     kATALargeIconProDOS         = 0x0081                        /* Large B&W icon with mask (ProDOS)*/
  806. };
  807. /* Manager parameter block structure*/
  808. struct ataLocationData {
  809.                                                                 /* Start of cloned common header ataPBHdr*/
  810.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  811.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  812.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  813.     UInt8                           ataPBReserved;              /* Reserved                         */
  814.     Ptr                             ataPBReserved2;             /* Reserved                         */
  815.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  816.     OSErr                           ataPBResult;                /* <--: Returned result          */
  817.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  818.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  819.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  820.     SInt16                          ataPBReserved3;             /* Reserved                         */
  821.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  822.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  823.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  824.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  825.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  826.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  827.     SInt32                          ataPBReserved4;             /* Reserved                         */
  828.                                                                 /* End of cloned common header ataPBHdr*/
  829.     SInt16                          ataIconType;                /* -->: icon type specifier*/
  830.                                                                 /*      1 = Large B&W icon with mask (256 bytes)*/
  831.                                                                 /*       0x81 = Same as 1, but ProDOS icon*/
  832.     SInt16                          ataIconReserved;            /* Reserved to be longword aligned*/
  833.     SInt8 *                         ataLocationIconPtr;         /* -->: Icon Data buffer pointer*/
  834.     SInt8 *                         ataLocationStringPtr;       /* -->: Icon String buffer pointer*/
  835.     UInt16                          Reserved1[18];              /* Reserved for future*/
  836. };
  837. typedef struct ataLocationData          ataLocationData;
  838. /* ataOSType available*/
  839. enum {
  840.     kATAddTypeMacOS             = 0x0001                        /* Blue Mac O/S ddType value*/
  841. };
  842. /* The parameter block definition for all other ATA Manager functions.*/
  843. struct ataGeneric {
  844.                                                                 /* Start of cloned common header ataPBHdr*/
  845.     ataPBHeader *                   ataPBLink;                  /* a pointer to the next entry in the queue   */
  846.     UInt16                          ataPBQType;                 /* type byte for safety check*/
  847.     UInt8                           ataPBVers;                  /* -->: parameter block version number; Must be 0x01*/
  848.     UInt8                           ataPBReserved;              /* Reserved                         */
  849.     Ptr                             ataPBReserved2;             /* Reserved                         */
  850.     ATACallbackUPP                  ataPBCallbackPtr;           /* -->: Completion Routine Pointer*/
  851.     OSErr                           ataPBResult;                /* <--: Returned result          */
  852.     UInt8                           ataPBFunctionCode;          /* -->: Manager Function Code */
  853.     UInt8                           ataPBIOSpeed;               /* -->: I/O Timing Class       */
  854.     UInt16                          ataPBFlags;                 /* -->: Various control options   */
  855.     SInt16                          ataPBReserved3;             /* Reserved                         */
  856.     UInt32                          ataPBDeviceID;              /* -->: Device identifier (see ataDeviceID)      */
  857.     UInt32                          ataPBTimeOut;               /* -->: Transaction timeout value in msec */
  858.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  859.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  860.     UInt16                          ataPBState;                 /* Reserved for Manager; Initialize to 0 */
  861.     UInt16                          ataPBSemaphores;            /* Used internally by the manager*/
  862.     SInt32                          ataPBReserved4;             /* Reserved                         */
  863.                                                                 /* End of cloned common header ataPBHdr*/
  864.     UInt16                          Reserved[24];               /* Reserved for future*/
  865. };
  866. typedef struct ataGeneric               ataGeneric;
  867. union ataPB {
  868.     ataIOPB                         ataIOParamBlock;            /* parameter block for I/O*/
  869.     ataBusInquiry                   ataBIParamBlock;            /* parameter block for bus inquiry*/
  870.     ataMgrInquiry                   ataMIParamBlock;            /* parameter block for Manager inquiry*/
  871.     ataAbort                        ataAbortParamBlock;         /* parameter block for abort*/
  872.     ataDrvrRegister                 ataDRParamBlock;            /* parameter block for driver register*/
  873.     ataModifyEventMask              ataMEParamBlock;            /* parameter block for event mask modify*/
  874.     ataRegAccess                    ataRAParamBlock;            /* parameter block for register access*/
  875.     ataIdentify                     ataDIParamBlock;            /* parameter block for drive identify*/
  876.     ataDevConfiguration             ataDCParamBlock;            /* parameter block for device configuration*/
  877.     ataLocationData                 ataLDParamBlock;            /* parameter block for location icon data*/
  878.                                                                 /*ataManagerInit  ataInitParamBlock;     // parameter block for Manager initialization*/
  879.                                                                 /*ataManagerShutDn    ataSDParamBlock;     // parameter block for Manager shutdown*/
  880.                                                                 /*ataDrvrLoad     ataDLParamBlock;     // parameter block for Driver loading*/
  881.     ataGeneric                      ataGenericParamBlock;       /* parameter block for all other functions*/
  882. };
  883. typedef union ataPB                     ataPB;
  884. /* The ATA Event codes...*/
  885. enum {
  886.     kATANullEvent               = 0x00,                         /* Just kidding -- nothing happened*/
  887.     kATAOnlineEvent             = 0x01,                         /* An ATA device has come online*/
  888.     kATAOfflineEvent            = 0x02,                         /* An ATA device has gone offline*/
  889.     kATARemovedEvent            = 0x03,                         /* An ATA device has been removed from the bus*/
  890.     kATAResetEvent              = 0x04,                         /* Someone gave a hard reset to the drive*/
  891.     kATAOfflineRequest          = 0x05,                         /* Someone requesting to offline the drive*/
  892.     kATAEjectRequest            = 0x06,                         /* Someone requesting to eject the drive*/
  893.     kATAUpdateEvent             = 0x07,                         /* Potential configuration change reported by CardServices <SM4>*/
  894.     kATATaskTimeRequest         = 0x08,                         /* The manager is requesting to be called at Task Time*/
  895.     kATALoadDriverNow           = 0x09,                         /* Load the driver for the given bus immediately*/
  896.     kATAPIResetEvent            = 0x0A,                         /* Someone gave a ATAPI reset to the drive*/
  897.                                                                 /* The following describes bit definitions in the eventMask field of ataDrvrRegister*/
  898.     bATANullEvent               = 1 << kATANullEvent,           /* null event bit*/
  899.     bATAOnlineEvent             = 1 << kATAOnlineEvent,         /* online event bit*/
  900.     bATAOfflineEvent            = 1 << kATAOfflineEvent,        /* offline event bit*/
  901.     bATARemovedEvent            = 1 << kATARemovedEvent,        /* removed event bit*/
  902.     bATAResetEvent              = 1 << kATAResetEvent,          /* ATA reset event bit*/
  903.     bATAOfflineRequest          = 1 << kATAOfflineRequest,      /* offline request event bit*/
  904.     bATAEjectRequest            = 1 << kATAEjectRequest,        /* eject request event bit*/
  905.     bATAUpdateEvent             = 1 << kATAUpdateEvent,         /* configuration update event bit*/
  906.     bATAPIResetEvent            = 1 << kATAPIResetEvent         /* ATAPI reset event bit*/
  907. };
  908. enum {
  909.     kATAEventMarker             = FOUR_CHAR_CODE('LOAD'),       /* Marker for the event data structure*/
  910.     kATAEventVersion1           = 0x00000001                    /* Version 1 of the event structure*/
  911. };
  912. typedef CALLBACK_API( OSErr , ATADispatchProcPtr )(ataPB *pb);
  913. typedef STACK_UPP_TYPE(ATADispatchProcPtr)                      ATADispatchUPP;
  914. #if OPAQUE_UPP_TYPES
  915. #if CALL_NOT_IN_CARBON
  916.     EXTERN_API(ATADispatchUPP)
  917.     NewATADispatchUPP              (ATADispatchProcPtr      userRoutine);
  918.     EXTERN_API(void)
  919.     DisposeATADispatchUPP          (ATADispatchUPP          userUPP);
  920.     EXTERN_API(OSErr)
  921.     InvokeATADispatchUPP           (ataPB *                 pb,
  922.                                     ATADispatchUPP          userUPP);
  923. #endif  /* CALL_NOT_IN_CARBON */
  924. #else
  925.     enum { uppATADispatchProcInfo = 0x000000E0 };                   /* pascal 2_bytes Func(4_bytes) */
  926.     #define NewATADispatchUPP(userRoutine)                          (ATADispatchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATADispatchProcInfo, GetCurrentArchitecture())
  927.     #define DisposeATADispatchUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  928.     #define InvokeATADispatchUPP(pb, userUPP)                       (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppATADispatchProcInfo, (pb))
  929. #endif
  930. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  931. #define NewATADispatchProc(userRoutine)                         NewATADispatchUPP(userRoutine)
  932. #define CallATADispatchProc(userRoutine, pb)                    InvokeATADispatchUPP(pb, userRoutine)
  933. #if CALL_NOT_IN_CARBON
  934. EXTERN_API( SInt16 )
  935. ataManager                      (ataPB *                pb)                                 ONEWORDINLINE(0xAAF1);
  936. /* Device Error codes: 0xDB42 - 0xDB5F  */
  937. #endif  /* CALL_NOT_IN_CARBON */
  938. enum {
  939.     ATABaseErrCode              = -9406,                        /* Base error code - 0xDB42   */
  940.     ioPending                   = 1,                            /* Asynch I/O in progress status*/
  941.     AT_NRdyErr                  = ATABaseErrCode + 0x01,        /* 0xDB43: Drive not Ready */
  942.     AT_IDNFErr                  = ATABaseErrCode + 0x02,        /* 0xDB44: ID not found */
  943.     AT_DMarkErr                 = ATABaseErrCode + 0x03,        /* 0xDB45: Data mark not found */
  944.     AT_BadBlkErr                = ATABaseErrCode + 0x04,        /* 0xDB46: Bad Block */
  945.     AT_CorDataErr               = ATABaseErrCode + 0x05,        /* 0xDB47: Data was corrected */
  946.     AT_UncDataErr               = ATABaseErrCode + 0x06,        /* 0xDB48: Data was not corrected */
  947.     AT_SeekErr                  = ATABaseErrCode + 0x07,        /* 0xDB49: Seek error */
  948.     AT_WrFltErr                 = ATABaseErrCode + 0x08,        /* 0xDB4A: Write fault */
  949.     AT_RecalErr                 = ATABaseErrCode + 0x09,        /* 0xDB4B: Recalibrate failed */
  950.     AT_AbortErr                 = ATABaseErrCode + 0x0A,        /* 0xDB4C: Command aborted by drive */
  951.     AT_MCErr                    = ATABaseErrCode + 0x0C,        /* 0xDB4E: Media Changed error*/
  952.     ATAPICheckErr               = ATABaseErrCode + 0x0D,        /* 0xDB4F: ATAPI Check condition <06/15/94>*/
  953.     AT_UltraDMAiCRCErr          = ATABaseErrCode + 0x0E,        /* 0xDB50: CRC error during Ultra DMA xfer */
  954.                                                                 /* System error codes...Custom Driver Error Codes 0xDB60 - 0xDB6F*/
  955.     DRVRCantAllocate            = ATABaseErrCode + 0x1E,        /* 0xDB60: Allocation error during initialization*/
  956.     NoATAMgr                    = ATABaseErrCode + 0x1F,        /* 0xDB61: MgrInquiry failed => No ATA Manager*/
  957.     ATAInitFail                 = ATABaseErrCode + 0x20,        /* 0xDB62: Mgr Initialization failed*/
  958.     ATABufFail                  = ATABaseErrCode + 0x21,        /* 0xDB63: Device buffer test failure*/
  959.     ATADevUnsupported           = ATABaseErrCode + 0x22,        /* 0xDB64: Device type not supported*/
  960.     ATAEjectDrvErr              = ATABaseErrCode + 0x23,        /* 0xDB65: Could not eject the drive*/
  961.                                                                 /* Manager Error Codes 0xDB70 - 0xDB8F*/
  962.     ATAMgrNotInitialized        = ATABaseErrCode + 0x2E,        /* 0xDB70: Mgr has not been initialized*/
  963.     ATAPBInvalid                = ATABaseErrCode + 0x2F,        /* 0xDB71: The bus base address couldn't be found*/
  964.     ATAFuncNotSupported         = ATABaseErrCode + 0x30,        /* 0xDB72: An unknown function code specified*/
  965.     ATABusy                     = ATABaseErrCode + 0x31,        /* 0xDB73: Selected device is busy*/
  966.     ATATransTimeOut             = ATABaseErrCode + 0x32,        /* 0xDB74: Transaction timeout detected*/
  967.     ATAReqInProg                = ATABaseErrCode + 0x33,        /* 0xDB75: Channel busy; channel is processing another cmd*/
  968.     ATAUnknownState             = ATABaseErrCode + 0x34,        /* 0xDB76: Device status register reflects an unknown state*/
  969.     ATAQLocked                  = ATABaseErrCode + 0x35,        /* 0xDB77: I/O Queue is locked due to previous I/O error.*/
  970.     ATAReqAborted               = ATABaseErrCode + 0x36,        /* 0xDB78: The I/O queue entry was aborted due to an abort req.*/
  971.                                                                 /*         or due to Manager shutdown.*/
  972.     ATAUnableToAbort            = ATABaseErrCode + 0x37,        /* 0xDB79: The I/O queue entry could not be aborted.*/
  973.     ATAAbortedDueToRst          = ATABaseErrCode + 0x38,        /* 0xDB7A: Request aborted due to a device reset command.*/
  974.     ATAPIPhaseErr               = ATABaseErrCode + 0x39,        /* 0xDB7B: Unexpected phase - oooIS THIS VALID ERROR??? <06/15/94>*/
  975.     ATAPITxCntErr               = ATABaseErrCode + 0x3A,        /* 0xDB7C: Overrun/Underrun condition detected*/
  976.     ATANoClientErr              = ATABaseErrCode + 0x3B,        /* 0xDB7D: No client present to handle the event*/
  977.     ATAInternalErr              = ATABaseErrCode + 0x3C,        /* 0xDB7E: MagnumOpus returned an error*/
  978.     ATABusErr                   = ATABaseErrCode + 0x3D,        /* 0xDB7F: Bus error detected on I/O  */
  979.     AT_NoAddrErr                = ATABaseErrCode + 0x3E,        /* 0xDB80: Invalid AT base adress */
  980.     DriverLocked                = ATABaseErrCode + 0x3F,        /* 0xDB81: Current driver must be removed before adding another*/
  981.     CantHandleEvent             = ATABaseErrCode + 0x40,        /* 0xDB82: Particular event couldn't be handled (call others)*/
  982.     ATAMgrMemoryErr             = ATABaseErrCode + 0x41,        /* 0xDB83: Manager memory allocation error    */
  983.     ATASDFailErr                = ATABaseErrCode + 0x42,        /* 0xDB84: Shutdown failure          */
  984.     ATAXferParamErr             = ATABaseErrCode + 0x43,        /* 0xDB85: I/O xfer parameters inconsistent */
  985.     ATAXferModeErr              = ATABaseErrCode + 0x44,        /* 0xDB86: I/O xfer mode not supported */
  986.     ATAMgrConsistencyErr        = ATABaseErrCode + 0x45,        /* 0XDB87: Manager detected internal inconsistency. */
  987.     ATADmaXferErr               = ATABaseErrCode + 0x46,        /* 0XDB88: fatal error in DMA side of transfer */
  988.                                                                 /* Driver loader error Codes 0xDB90 - 0xDBA5*/
  989.     ATAInvalidDrvNum            = ATABaseErrCode + 0x4E,        /* 0xDB90: Invalid drive number from event*/
  990.     ATAMemoryErr                = ATABaseErrCode + 0x4F,        /* 0xDB91: Memory allocation error*/
  991.     ATANoDDMErr                 = ATABaseErrCode + 0x50,        /* 0xDB92: No DDM found on media  */
  992.     ATANoDriverErr              = ATABaseErrCode + 0x51         /* 0xDB93: No driver found on the media   */
  993. };
  994. /* ------------------------ Version 1 definition -------------------------------    */
  995. enum {
  996.     v1ATABaseErrCode            = 0x0700,                       /* This needs a home somewhere*/
  997.     v1AT_NRdyErr                = 0x01 - v1ATABaseErrCode,      /* 0xF901: -0x1DBE */
  998.     v1AT_IDNFErr                = 0x04 - v1ATABaseErrCode,      /* 0xF904: -0x1DC0 */
  999.     v1AT_DMarkErr               = 0x05 - v1ATABaseErrCode,      /* 0xF905: -0x1DC0 */
  1000.     v1AT_BadBlkErr              = 0x06 - v1ATABaseErrCode,      /* 0xF906: -0x1DC0 */
  1001.     v1AT_CorDataErr             = 0x07 - v1ATABaseErrCode,      /* 0xF907: -0x1DC0 */
  1002.     v1AT_UncDataErr             = 0x08 - v1ATABaseErrCode,      /* 0xF908: -0x1DC0 */
  1003.     v1AT_SeekErr                = 0x09 - v1ATABaseErrCode,      /* 0xF909: -0x1DC0 */
  1004.     v1AT_WrFltErr               = 0x0A - v1ATABaseErrCode,      /* 0xF90A: -0x1DC0 */
  1005.     v1AT_RecalErr               = 0x0B - v1ATABaseErrCode,      /* 0xF90B: -0x1DC0 */
  1006.     v1AT_AbortErr               = 0x0C - v1ATABaseErrCode,      /* 0xF90C: -0x1DC0 */
  1007.     v1AT_NoAddrErr              = 0x0D - v1ATABaseErrCode,      /* 0xF90D: -0x1D8D */
  1008.     v1AT_MCErr                  = 0x0E - v1ATABaseErrCode,      /* 0xF90E: -0x1DC0*/
  1009.                                                                 /* System error codes...Custom Driver Error Codes*/
  1010.     v1DRVRCantAllocate          = -(v1ATABaseErrCode + 1),      /* 0xF8FF: -0x1D9F*/
  1011.     v1NoATAMgr                  = -(v1ATABaseErrCode + 2),      /* 0xF8FE: -0x1D9D*/
  1012.     v1ATAInitFail               = -(v1ATABaseErrCode + 3),      /* 0xF8FD: -0x1D9B*/
  1013.     v1ATABufFail                = -(v1ATABaseErrCode + 4),      /* 0xF8FC: -0x1D99*/
  1014.     v1ATADevUnsupported         = -(v1ATABaseErrCode + 5),      /* 0xF8FB: -0x1c97*/
  1015.                                                                 /* Manager Error Codes*/
  1016.     v1ATAMgrNotInitialized      = -(v1ATABaseErrCode + 10),     /* 0xF8F6: -0x1D86*/
  1017.     v1ATAPBInvalid              = -(v1ATABaseErrCode + 11),     /* 0xF8F5: -0x1D84*/
  1018.     v1ATAFuncNotSupported       = -(v1ATABaseErrCode + 12),     /* 0xF8F4: -0x1D82*/
  1019.     v1ATABusy                   = -(v1ATABaseErrCode + 13),     /* 0xF8F3: -0x1D80*/
  1020.     v1ATATransTimeOut           = -(v1ATABaseErrCode + 14),     /* 0xF8F2: -0x1D7E*/
  1021.     v1ATAReqInProg              = -(v1ATABaseErrCode + 15),     /* 0xF8F1: -0x1D7C*/
  1022.     v1ATAUnknownState           = -(v1ATABaseErrCode + 16),     /* 0xF8F0: -0x1D7A*/
  1023.     v1ATAQLocked                = -(v1ATABaseErrCode + 17),     /* 0xF8EF: -0x1D78*/
  1024.     v1ATAReqAborted             = -(v1ATABaseErrCode + 18),     /* 0xF8EE: -0x1D76*/
  1025.     v1ATAUnableToAbort          = -(v1ATABaseErrCode + 19),     /* 0xF8ED: -0x1D74*/
  1026.     v1ATAAbortedDueToRst        = -(v1ATABaseErrCode + 20)      /* 0xF8EC: -0x1D72*/
  1027. };
  1028. #if PRAGMA_STRUCT_ALIGN
  1029.     #pragma options align=reset
  1030. #elif PRAGMA_STRUCT_PACKPUSH
  1031.     #pragma pack(pop)
  1032. #elif PRAGMA_STRUCT_PACK
  1033.     #pragma pack()
  1034. #endif
  1035. #ifdef PRAGMA_IMPORT_OFF
  1036. #pragma import off
  1037. #elif PRAGMA_IMPORT
  1038. #pragma import reset
  1039. #endif
  1040. #ifdef __cplusplus
  1041. }
  1042. #endif
  1043. #endif /* __ATA__ */