home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / gtak212b.zip / SOURCE.ZIP / OS2-ADD / iorb.h < prev    next >
Text File  |  1992-09-02  |  28KB  |  599 lines

  1. /*****************************************************************************
  2.  * $Id: iorb.h,v 1.1.1.1 1992/09/02 18:57:35 ak Exp $
  3.  *****************************************************************************
  4.  * $Log: iorb.h,v $
  5.  * Revision 1.1.1.1  1992/09/02  18:57:35  ak
  6.  * Initial checkin of OS/2 ADD based SCSI tape device driver.
  7.  *
  8.  * Revision 1.1  1992/09/02  18:57:32  ak
  9.  * Initial revision
  10.  *
  11.  *****************************************************************************/
  12.  
  13. /*static char *SCCSID = "@(#)iorb.h     6.1 92/02/07";*/
  14. /*static char *SCCSID = "@(#)iorb.h     6.4 92/01/16";*/
  15. /**********************************************************************/
  16. /* I/O Request Block (IORB) Structures                                */
  17. /**********************************************************************/
  18.  
  19. /* ASM
  20. ;
  21. ;       Resolve H2INC references for .INC version of file
  22. ;
  23.         include  iorbtype.inc
  24. */
  25.  
  26. /* Typedefs to resolve forward references */
  27. typedef struct _IORBH         IORBH;
  28. typedef struct _IORBH         FAR *PIORBH;
  29. typedef struct _IORBH         *NPIORBH;
  30. typedef struct _IORBH         FAR *PIORB;
  31. typedef struct _IORBH         *NPIORB;
  32.  
  33. typedef struct _DEVICETABLE   DEVICETABLE;
  34. typedef struct _DEVICETABLE   FAR *PDEVICETABLE;
  35. typedef struct _DEVICETABLE   *NPDEVICETABLE;
  36.  
  37. typedef struct _UNITINFO      UNITINFO;
  38. typedef struct _UNITINFO      FAR *PUNITINFO;
  39. typedef struct _UNITINFO      *NPUNITINFO;
  40.  
  41. typedef struct _ADAPTERINFO   ADAPTERINFO;
  42. typedef struct _ADAPTERINFO   FAR *PADAPTERINFO;
  43. typedef struct _ADAPTERINFO   *NPADAPTERINFO;
  44.  
  45. typedef struct _GEOMETRY      GEOMETRY;
  46. typedef struct _GEOMETRY      FAR *PGEOMETRY;
  47. typedef struct _GEOMETRY      *NPGEOMETRY;
  48.  
  49. typedef struct _SCATGATENTRY  SCATGATENTRY;
  50. typedef struct _SCATGATENTRY  FAR *PSCATGATENTRY;
  51. typedef struct _SCATGATENTRY  *NPSCATGATENTRY;
  52.  
  53. /*-----------------------------------------*/
  54. /* Interface for calling ADD entry point   */
  55. /*-----------------------------------------*/
  56. /* VOID FAR *(ADDEP) (PIORBH); */
  57.  
  58. /*-------------------------*/
  59. /* IORB Header             */
  60. /*-------------------------*/
  61.  
  62. #define DM_WORKSPACE_SIZE       20
  63. #define ADD_WORKSPACE_SIZE      16
  64.  
  65. typedef struct _IORBH   {               /* IOH */
  66.  
  67.   USHORT        Length;                 /* IORB Length                */
  68.   USHORT        UnitHandle;             /* Unit Identifier            */
  69.   USHORT        CommandCode;            /* Command Code               */
  70.   USHORT        CommandModifier;        /* Command Modifier           */
  71.   USHORT        RequestControl;         /* Request Control Flags      */
  72.   USHORT        Status;                 /* Status                     */
  73.   USHORT        ErrorCode;              /* Error Code                 */
  74.   ULONG         Timeout;                /* Cmd completion timeout (s) */
  75.   USHORT        StatusBlockLen;         /* Status block length        */
  76.   NPBYTE        pStatusBlock;           /* Status block               */
  77.   USHORT        Reserved_1;             /* Reserved, MBZ              */
  78.   PIORB         pNxtIORB;               /* Pointer to next IORB       */
  79.   PIORB         (FAR *NotifyAddress)(PIORB); /* Notification Address  */
  80.   UCHAR         DMWorkSpace[DM_WORKSPACE_SIZE];   /* For use by DM    */
  81.   UCHAR         ADDWorkSpace[ADD_WORKSPACE_SIZE]; /* For use by ADD   */
  82.  
  83. } IORBH;
  84.  
  85. /*---------------------------------------------------------------------*/
  86. /* IORB CommandCode and CommandModifier Codes.                         */
  87. /*      CommandCode prefixed by IOCC and CommandModifier by IOCM.      */
  88. /*---------------------------------------------------------------------*/
  89.                                           /*---------------------------*/
  90.                                           /* +----M=Manditory Support  */
  91.                                           /* |    O=Optional Support   */
  92.                                           /* |                         */
  93.                                           /* V     Notes               */
  94.                                           /*---------------------------*/
  95. #define IOCC_CONFIGURATION        0x0001  /*                           */
  96. #define IOCM_GET_DEVICE_TABLE     0x0001  /* M                         */
  97. #define IOCM_COMPLETE_INIT        0x0002  /* O                         */
  98.                                           /*---------------------------*/
  99. #define IOCC_UNIT_CONTROL         0x0002  /*                           */
  100. #define IOCM_ALLOCATE_UNIT        0x0001  /* M                         */
  101. #define IOCM_DEALLOCATE_UNIT      0x0002  /* M                         */
  102. #define IOCM_CHANGE_UNITINFO      0x0003  /* M                         */
  103.                                           /*---------------------------*/
  104. #define IOCC_GEOMETRY             0x0003  /*                           */
  105. #define IOCM_GET_MEDIA_GEOMETRY   0x0001  /* M                         */
  106. #define IOCM_SET_MEDIA_GEOMETRY   0x0002  /* O (M) >1 Media type       */
  107. #define IOCM_GET_DEVICE_GEOMETRY  0x0003  /* M                         */
  108. #define IOCM_SET_LOGICAL_GEOMETRY 0x0004  /* O (M) CHS Addressable     */
  109.                                           /*---------------------------*/
  110. #define IOCC_EXECUTE_IO           0x0004  /*                           */
  111. #define IOCM_READ                 0x0001  /* M                         */
  112. #define IOCM_READ_VERIFY          0x0002  /* M                         */
  113. #define IOCM_READ_PREFETCH        0x0003  /* O                         */
  114. #define IOCM_WRITE                0x0004  /* M                         */
  115. #define IOCM_WRITE_VERIFY         0x0005  /* M                         */
  116.                                           /*---------------------------*/
  117. #define IOCC_FORMAT               0x0005  /*                           */
  118. #define IOCM_FORMAT_MEDIA         0x0001  /* O (M) If HW requires      */
  119. #define IOCM_FORMAT_TRACK         0x0002  /* O (M) If HW requires      */
  120. #define IOCM_FORMAT_PROGRESS      0x0003  /* O                         */
  121.                                           /*---------------------------*/
  122. #define IOCC_UNIT_STATUS          0x0006  /*                           */
  123. #define IOCM_GET_UNIT_STATUS      0x0001  /* M                         */
  124. #define IOCM_GET_CHANGELINE_STATE 0x0002  /* M (O) Fixed Media Only    */
  125. #define IOCM_GET_MEDIA_SENSE      0x0003  /* M                         */
  126.                                           /*---------------------------*/
  127. #define IOCC_DEVICE_CONTROL       0x0007  /*                           */
  128. #define IOCM_ABORT                0x0001  /* O (M) SCSI                */
  129. #define IOCM_RESET                0x0002  /* O (M) SCSI                */
  130. #define IOCM_SUSPEND              0x0003  /* O (M) Floppy Driver       */
  131. #define IOCM_RESUME               0x0004  /* O (M) Floppy Driver       */
  132. #define IOCM_LOCK_MEDIA           0x0005  /* M (O) Fixed Media Only    */
  133. #define IOCM_UNLOCK_MEDIA         0x0006  /* M (O) Fixed Media Only    */
  134.                                           /*---------------------------*/
  135. #define IOCC_ADAPTER_PASSTHRU     0x0008  /*                           */
  136. #define IOCM_EXECUTE_SCB          0x0001  /* O                         */
  137. #define IOCM_EXECUTE_CDB          0x0002  /* O (M) SCSI Adapters       */
  138.                                           /*---------------------------*/
  139.  
  140. #define MAX_IOCC_COMMAND  IOCC_ADAPTER_PASSTHRU
  141.  
  142. /*--------------------------------------------------*/
  143. /* Status flags returned in IORBH->Status           */
  144. /*--------------------------------------------------*/
  145. #define IORB_DONE                0x0001  /* 1=Done,  0=In progress     */
  146. #define IORB_ERROR               0x0002  /* 1=Error, 0=No error        */
  147. #define IORB_RECOV_ERROR         0x0004  /* Recovered error            */
  148. #define IORB_STATUSBLOCK_AVAIL   0x0008  /* Status Block available     */
  149.  
  150. /*----------------------------------------------*/
  151. /* Error Codes returned in IORBH->ErrorCode     */
  152. /*----------------------------------------------*/
  153.  
  154. #define IOERR_RETRY                     0x8000
  155.  
  156. #define IOERR_CMD                       0x0100
  157. #define IOERR_CMD_NOT_SUPPORTED         IOERR_CMD+1
  158. #define IOERR_CMD_SYNTAX                IOERR_CMD+2
  159. #define IOERR_CMD_SGLIST_BAD            IOERR_CMD+3
  160. #define IOERR_CMD_SW_RESOURCE           IOERR_CMD+IOERR_RETRY+4
  161. #define IOERR_CMD_ABORTED               IOERR_CMD+5
  162. #define IOERR_CMD_ADD_SOFTWARE_FAILURE  IOERR_CMD+6
  163. #define IOERR_CMD_OS_SOFTWARE_FAILURE   IOERR_CMD+7
  164.  
  165. #define IOERR_UNIT                      0x0200
  166. #define IOERR_UNIT_NOT_ALLOCATED        IOERR_UNIT+1
  167. #define IOERR_UNIT_ALLOCATED            IOERR_UNIT+2
  168. #define IOERR_UNIT_NOT_READY            IOERR_UNIT+3
  169. #define IOERR_UNIT_PWR_OFF              IOERR_UNIT+4
  170.  
  171. #define IOERR_RBA                       0x0300
  172. #define IOERR_RBA_ADDRESSING_ERROR      IOERR_RBA+IOERR_RETRY+1
  173. #define IOERR_RBA_LIMIT                 IOERR_RBA+2
  174. #define IOERR_RBA_CRC_ERROR             IOERR_RBA+IOERR_RETRY+3
  175.  
  176. #define IOERR_MEDIA                     0x0400
  177. #define IOERR_MEDIA_NOT_FORMATTED       IOERR_MEDIA+1
  178. #define IOERR_MEDIA_NOT_SUPPORTED       IOERR_MEDIA+2
  179. #define IOERR_MEDIA_WRITE_PROTECT       IOERR_MEDIA+3
  180. #define IOERR_MEDIA_CHANGED             IOERR_MEDIA+4
  181. #define IOERR_MEDIA_NOT_PRESENT         IOERR_MEDIA+5
  182.  
  183. #define IOERR_ADAPTER                   0x0500
  184. #define IOERR_ADAPTER_HOSTBUSCHECK      IOERR_ADAPTER+1
  185. #define IOERR_ADAPTER_DEVICEBUSCHECK    IOERR_ADAPTER+IOERR_RETRY+2
  186. #define IOERR_ADAPTER_OVERRUN           IOERR_ADAPTER+IOERR_RETRY+3
  187. #define IOERR_ADAPTER_UNDERRUN          IOERR_ADAPTER+IOERR_RETRY+4
  188. #define IOERR_ADAPTER_DIAGFAIL          IOERR_ADAPTER+5
  189. #define IOERR_ADAPTER_TIMEOUT           IOERR_ADAPTER+IOERR_RETRY+6
  190. #define IOERR_ADAPTER_DEVICE_TIMEOUT    IOERR_ADAPTER+IOERR_RETRY+7
  191. #define IOERR_ADAPTER_REQ_NOT_SUPPORTED IOERR_ADAPTER+8
  192. #define IOERR_ADAPTER_REFER_TO_STATUS   IOERR_ADAPTER+9
  193. #define IOERR_ADAPTER_NONSPECIFIC       IOERR_ADAPTER+10
  194.  
  195.  
  196. #define IOERR_DEVICE                    0x0600
  197. #define IOERR_DEVICE_DEVICEBUSCHECK     IOERR_DEVICE+IOERR_RETRY+1
  198. #define IOERR_DEVICE_REQ_NOT_SUPPORTED  IOERR_DEVICE+2
  199. #define IOERR_DEVICE_DIAGFAIL           IOERR_DEVICE+3
  200. #define IOERR_DEVICE_BUSY               IOERR_DEVICE+IOERR_RETRY+4
  201. #define IOERR_DEVICE_OVERRUN            IOERR_DEVICE+IOERR_RETRY+5
  202. #define IOERR_DEVICE_UNDERRUN           IOERR_DEVICE+IOERR_RETRY+6
  203. #define IOERR_DEVICE_RESET              IOERR_DEVICE+7
  204. #define IOERR_DEVICE_NONSPECIFIC        IOERR_DEVICE+8
  205.  
  206.  
  207.  
  208. /*---------------------------------------------------*/
  209. /* Request Control flags in IORBH->RequestControl    */
  210. /*---------------------------------------------------*/
  211.  
  212. #define  IORB_ASYNC_POST        0x0001   /* Asynchronous post enabled  */
  213. #define  IORB_CHAIN             0x0002   /* IORB Chain Link enabled    */
  214. #define  IORB_CHS_ADDRESSING    0x0004   /* CHS fmt addr in RBA Field  */
  215. #define  IORB_REQ_STATUSBLOCK   0x0008   /* Obtain Status Block Data   */
  216. #define  IORB_DISABLE_RETRY     0x0010   /* Disable retries in ADD     */
  217.  
  218.  
  219. /***********************************************************************/
  220. /* ADAPTER CONFIGURNATION IORB         (for IOCC_CONFIGURATION)        */
  221. /***********************************************************************/
  222. typedef struct _IORB_CONFIGURATION   {  /* IOCFG */
  223.  
  224.   IORBH            iorbh;               /* IORB Header                  */
  225.   DEVICETABLE far *pDeviceTable;        /* far ptr to adapter dev table */
  226.   USHORT           DeviceTableLen;      /* Length of adapter dev table  */
  227.  
  228. } IORB_CONFIGURATION, FAR *PIORB_CONFIGURATION, *NPIORB_CONFIGURATION;
  229.  
  230. /* Adapter device table returned by GET_DEVICE_TABLE                      */
  231. typedef struct _DEVICETABLE  {            /* IODT */
  232.  
  233.   UCHAR         ADDLevelMajor;            /* ADD Major Support Level       */
  234.   UCHAR         ADDLevelMinor;            /* ADD Minor Support Level       */
  235.   USHORT        ADDHandle;                /* ADD Handle                    */
  236.   USHORT        TotalAdapters;            /* Number of adapters supported  */
  237.   NPADAPTERINFO pAdapter[1];              /* Array of adapter info pointers*/
  238.  
  239. } DEVICETABLE, FAR *PDEVICETABLE;
  240.  
  241. /*-----------------------------------------------------------------*/
  242. /* Current ADD Level for DEVICETABLE->AddLevelMajor, AddLevelMinor */
  243. /*-----------------------------------------------------------------*/
  244.  
  245. #define ADD_LEVEL_MAJOR         0x01
  246. #define ADD_LEVEL_MINOR         0x00
  247.  
  248.  
  249. typedef struct _UNITINFO   {           /* IOUI */
  250.  
  251.   USHORT    AdapterIndex;              /* nth Adapter this driver     */
  252.   USHORT    UnitIndex;                 /* nth Unit on this card       */
  253.   USHORT    UnitFlags;                 /* Unit Flags                  */
  254.   USHORT    Reserved;                  /* Reserved                    */
  255.   USHORT    UnitHandle;                /* Assigned by ADD or Filter   */
  256.   USHORT    FilterADDHandle;           /* Handle of Filter ADD  0=None*/
  257.   USHORT    UnitType;                  /* Unit type                   */
  258.   USHORT    QueuingCount;              /* Recommended number to queue */
  259.   UCHAR     UnitSCSITargetID;          /* SCSI Target ID  (SCSI Only) */
  260.   UCHAR     UnitSCSILUN;               /* SCSI Log.  Unit (SCSI Only) */
  261.  
  262. } UNITINFO;
  263.  
  264.  
  265. /*------------------------------------------*/
  266. /* Unit Flags for UNITINFO->UnitFlags       */
  267. /*------------------------------------------*/
  268.  
  269. #define UF_REMOVABLE     0x0001         /* Media can be removed            */
  270. #define UF_CHANGELINE    0x0002         /* ChangeLine Supported            */
  271. #define UF_PREFETCH      0x0004         /* Supports prefetch reads         */
  272. #define UF_A_DRIVE       0x0008         /* Manages A:                      */
  273. #define UF_B_DRIVE       0x0010         /* Manages B:                      */
  274. #define UF_NODASD_SUPT   0x0020         /* Suppress DASD Mgr support       */
  275. #define UF_NOSCSI_SUPT   0x0040         /* Suppress SCSI Mgr support       */
  276. #define UF_DEFECTIVE     0x0080         /* Device is defective             */
  277.  
  278.  
  279. /*------------------------------------------*/
  280. /* Unit Types for UNITINFO->UnitType        */
  281. /*------------------------------------------*/
  282.  
  283. #define  UIB_TYPE_DISK      0x0000     /* All Direct Access Devices        */
  284. #define  UIB_TYPE_TAPE      0x0001     /* Sequencial Access Devices        */
  285. #define  UIB_TYPE_PRINTER   0x0002     /* Printer Device                   */
  286. #define  UIB_TYPE_PROCESSOR 0x0003     /* Processor type device            */
  287. #define  UIB_TYPE_WORM      0x0004     /* Write Once Read Many Device      */
  288. #define  UIB_TYPE_CDROM     0x0005     /* CD ROM Device                    */
  289. #define  UIB_TYPE_SCANNER   0x0006     /* Scanner Device                   */
  290. #define  UIB_TYPE_OPTICAL_MEMORY 0x0007 /* some Optical disk               */
  291. #define  UIB_TYPE_CHANGER   0x0008     /* Changer device e.g. juke box     */
  292. #define  UIB_TYPE_COMM      0x0009     /* Communication devices            */
  293.  
  294.  
  295. typedef struct _ADAPTERINFO   {           /* IOAI */
  296.  
  297.   UCHAR            AdapterName[17];       /* Adapter Name ASCIIZ string    */
  298.   UCHAR            Reserved;              /*                               */
  299.   USHORT           AdapterUnits;          /* Number of units this adapter  */
  300.   USHORT           AdapterDevBus;         /* Bus Type - Adapter to Device  */
  301.   UCHAR            AdapterIOAccess;       /* I/O Type - Adapter to Host    */
  302.   UCHAR            AdapterHostBus;        /* Bus Type - Adapter to Host    */
  303.   UCHAR            AdapterSCSITargetID;   /* Adapter SCSI Target ID        */
  304.   UCHAR            AdapterSCSILUN;        /* Adapter SCSI LUN              */
  305.   USHORT           AdapterFlags;
  306.   USHORT           MaxHWSGList;           /* Max HW S/G List Entries       */
  307.   ULONG            MaxCDBTransferLength;  /* Max data length for CDBs      */
  308.   UNITINFO         UnitInfo[1];           /* Unit info for each unit       */
  309.  
  310. } ADAPTERINFO;
  311.  
  312.  
  313. /*---------------------------------------------------*/
  314. /* Adapter Flags for ADAPTERINFO->AdapterFlags       */
  315. /*---------------------------------------------------*/
  316.  
  317. #define AF_16M            0x0001         /* Supports >16M addresses        */
  318. #define AF_IBM_SCB        0x0002         /* Supports IBM SCB commands      */
  319. #define AF_HW_SCATGAT     0x0004         /* Supports scatter/gather in HW  */
  320. #define AF_CHS_ADDRESSING 0x0008         /* Supports CHS addressing in HW  */
  321.  
  322.  
  323. /*-----------------------------------------------------------------*/
  324. /* Adapter-to-Device protocol for ADAPTERINFO->AdapterDevBus       */
  325. /*-----------------------------------------------------------------*/
  326.  
  327. #define  AI_DEVBUS_OTHER        0x0000
  328. #define  AI_DEVBUS_ST506        0x0001 /* ST-506 CAM-I                     */
  329. #define  AI_DEVBUS_ST506_II     0x0002 /* ST-506 CAM-II                    */
  330. #define  AI_DEVBUS_ESDI         0x0003 /* ESDI                             */
  331. #define  AI_DEVBUS_FLOPPY       0x0004 /* Diskette                         */
  332. #define  AI_DEVBUS_SCSI_1       0x0005
  333. #define  AI_DEVBUS_SCSI_2       0x0006
  334. #define  AI_DEVBUS_SCSI_3       0x0007
  335.  
  336. /*-------------------------------------------------------------*/
  337. /* Note: A one of the following BUS WIDTH indicators should be */
  338. /*       or'd with the above field.                            */
  339. /*-------------------------------------------------------------*/
  340.  
  341. #define  AI_DEVBUS_FAST_SCSI    0x0100
  342. #define  AI_DEVBUS_8BIT         0x0200
  343. #define  AI_DEVBUS_16BIT        0x0400
  344. #define  AI_DEVBUS_32BIT        0x0800
  345.  
  346.  
  347. /*-----------------------------------------------------------------*/
  348. /* Adapter-to-Device protocol for ADAPTERINFO->AdapterIOAccess     */
  349. /*-----------------------------------------------------------------*/
  350.  
  351. #define  AI_IOACCESS_OTHER      0x00
  352. #define  AI_IOACCESS_BUS_MASTER 0x01
  353. #define  AI_IOACCESS_PIO        0x02
  354. #define  AI_IOACCESS_DMA_SLAVE  0x04
  355. #define  AI_IOACCESS_MEMORY_MAP 0x08
  356.  
  357.  
  358. /*-----------------------------------------------------------------*/
  359. /* Adapter-to-Host bus type for ADAPTERINFO->AdapterHostBus        */
  360. /*-----------------------------------------------------------------*/
  361.  
  362. #define  AI_HOSTBUS_OTHER       0x00
  363. #define  AI_HOSTBUS_ISA         0x01
  364. #define  AI_HOSTBUS_EISA        0x02
  365. #define  AI_HOSTBUS_uCHNL       0x03
  366. #define  AI_HOSTBUS_UNKNOWN     0x0f
  367.  
  368. /*-------------------------------------------------------------*/
  369. /* Note: A one of the following BUS WIDTH indicators should be */
  370. /*       or'd with the above field.                            */
  371. /*-------------------------------------------------------------*/
  372.  
  373. #define  AI_BUSWIDTH_8BIT       0x10
  374. #define  AI_BUSWIDTH_16BIT      0x20
  375. #define  AI_BUSWIDTH_32BIT      0x30
  376. #define  AI_BUSWIDTH_64BIT      0x40
  377. #define  AI_BUSWIDTH_UNKNOWN    0xf0
  378.  
  379.  
  380. /***********************************************************************/
  381. /* UNIT CONTROL IORB                  (for IOCC_UNIT_CONTROL)          */
  382. /***********************************************************************/
  383.  
  384. typedef struct _IORB_UNIT_CONTROL  {     /* IOUC */
  385.  
  386.   IORBH            iorbh;                /* IORB Header                  */
  387.   USHORT           Flags;                /*                              */
  388.   PUNITINFO        pUnitInfo;            /* For: IOCM_CHANGE_UNITINFO    */
  389.   USHORT           UnitInfoLen;          /* Length of UnitInfo structure */
  390.  
  391. } IORB_UNIT_CONTROL, FAR *PIORB_UNIT_CONTROL, *NPIORB_UNIT_CONTROL;
  392.  
  393. /***********************************************************************/
  394. /* DASD GEOMETRY IORB                      (for IOCC_GEOMETRY)         */
  395. /***********************************************************************/
  396.  
  397. typedef struct _IORB_GEOMETRY  {         /* IOGG */
  398.  
  399.   IORBH            iorbh;                /* IORB Header                  */
  400.   PGEOMETRY        pGeometry;            /* far ptr to GEOMETRY block    */
  401.   USHORT           GeometryLen;          /* Length of GEOMETRY block     */
  402.  
  403. } IORB_GEOMETRY, FAR *PIORB_GEOMETRY, *NPIORB_GEOMETRY;
  404.  
  405. typedef struct _GEOMETRY  {              /* IOG */
  406.  
  407.   ULONG    TotalSectors;
  408.   USHORT   BytesPerSector;
  409.   USHORT   Reserved;
  410.   USHORT   NumHeads;
  411.   ULONG    TotalCylinders;
  412.   USHORT   SectorsPerTrack;
  413.  
  414. } GEOMETRY, FAR *PGEOMETRY, *NPGEOMETRY;
  415.  
  416.  
  417.  
  418. /*****************************/
  419. /* Scatter/Gather List Entry */
  420. /*****************************/
  421.  
  422. typedef struct _SCATGATENTRY  {      /* IOSG */
  423.  
  424.   ULONG         ppXferBuf;           /* Physical pointer to transfer buffer */
  425.   ULONG         XferBufLen;          /* Length of transfer buffer           */
  426.  
  427. } SCATGATENTRY, FAR *PSCATGATENTRY, *NPSCATGATENTRY;
  428.  
  429. #define MAXSGLISTSIZE   (sizeof(SCATGATENTRY)) * 16
  430.  
  431. /***********************************************************************/
  432. /* EXECUTE_IO IORB                    (for IOCC_EXECUTE_IO)            */
  433. /***********************************************************************/
  434.  
  435. typedef struct _IORB_EXECUTEIO  {            /* IOXIO */
  436.  
  437.   IORBH         iorbh;                       /* IORB Header                */
  438.   USHORT        cSGList;                     /* Count of S/G list elements */
  439.   PSCATGATENTRY pSGList;                     /* far ptr to S/G List        */
  440.   ULONG         ppSGList;                    /* physical addr of  S/G List */
  441.   ULONG         RBA;                         /* RBA Starting Address       */
  442.   USHORT        BlockCount;                  /* Block Count                */
  443.   USHORT        BlocksXferred;               /* Block Done Count           */
  444.   USHORT        BlockSize;                   /* Size of a block in bytes   */
  445.   USHORT        Flags;
  446.  
  447. } IORB_EXECUTEIO, FAR *PIORB_EXECUTEIO, *NPIORB_EXECUTEIO;
  448.  
  449.  
  450. /**********************************************/
  451. /* CHS Direct Addressing (Overlays RBA field) */
  452. /**********************************************/
  453.  
  454. typedef struct _CHS_ADDR  {                  /* IOCHS */
  455.  
  456.   USHORT        Cylinder;
  457.   UCHAR         Head;
  458.   UCHAR         Sector;
  459.  
  460. } CHS_ADDR, FAR *PCHS_ADDR, *NPCHS_ADDR;
  461.  
  462.  
  463. /*------------------------------------------------*/
  464. /* IORB specific flags for IORB_EXECUTE_IO->Flags */
  465. /*------------------------------------------------*/
  466.  
  467. #define  XIO_DISABLE_HW_WRITE_CACHE      0x0001
  468. #define  XIO_DISABLE_HW_READ_CACHE       0x0002
  469.  
  470.  
  471. /***********************************************************************/
  472. /* FORMAT IORB                        (for IOCC_FORMAT)                */
  473. /***********************************************************************/
  474.  
  475.  
  476. typedef struct _IORB_FORMAT  {               /* IOFMT */
  477.  
  478.   IORBH         iorbh;                       /* IORB Header                */
  479.   USHORT        cSGList;                     /* Count of S/G list elements */
  480.   PSCATGATENTRY pSGList;                     /* far ptr to S/G List        */
  481.   ULONG         ppSGList;                    /* physical addr of  S/G List */
  482.   USHORT        FormatCmdLen;                /*                            */
  483.   PBYTE         pFormatCmd;                  /* SCSI CDB or Track Fmt Cmd  */
  484.   UCHAR         Reserved_1[8];               /* Reserved, must not be modified*/
  485.  
  486. } IORB_FORMAT, FAR *PIORB_FORMAT, *NPIORB_FORMAT;
  487.  
  488.  
  489. typedef struct _FORMAT_CMD_TRACK {           /* FMCT  */
  490.  
  491.   USHORT        Flags;
  492.   ULONG         RBA;
  493.   USHORT        cTrackEntries;
  494.  
  495. } FORMAT_CMD_TRACK, FAR *PFORMAT_CMD_TRACK, *NPFORMAT_CMD_TRACK;
  496.  
  497. /*--------------------------------------*/
  498. /* Flags for FORMAT_CMD_TRACK->Flags    */
  499. /*--------------------------------------*/
  500.  
  501. #define FF_VERIFY       0x0001          /* Verify sectors after formatting */
  502.  
  503.  
  504. /***********************************************************************/
  505. /* ADAPTER PASS THROUGH IORB           (for IOCC_ADAPTER_PASSTHRU)     */
  506. /***********************************************************************/
  507.  
  508. typedef struct _IORB_ADAPTER_PASSTHRU  {  /* IOPT */
  509.  
  510.   IORBH         iorbh;                       /* IORB Header                */
  511.   USHORT        cSGList;                     /* Count of S/G list elements */
  512.   PSCATGATENTRY pSGList;                     /* far ptr to S/G List        */
  513.   ULONG         ppSGList;                    /* physical addr of  S/G List */
  514.   USHORT        ControllerCmdLen;
  515.   PBYTE         pControllerCmd;
  516.   ULONG         ppSCB;              /* phys ptr to SCB for SCB_PASSTHRU    */
  517.   USHORT        Flags;
  518.  
  519. } IORB_ADAPTER_PASSTHRU, FAR *PIORB_ADAPTER_PASSTHRU, *NPIORB_ADAPTER_PASSTHRU;
  520.  
  521. /*------------------------------------------------------*/
  522. /* IORB specific flags for IORB_ADAPTER_PASSTHRU->Flags */
  523. /*                                                      */
  524. /* Note: These flags apply to IOCM_EXECUTE_CDB          */
  525. /*------------------------------------------------------*/
  526.  
  527. #define PT_DIRECTION_IN     0x0001           /* Data xfer to host adapter  */
  528.  
  529.  
  530. /***********************************************************************/
  531. /* UNIT STATUS IORB                   (for IOCC_UNIT_STATUS)           */
  532. /***********************************************************************/
  533.  
  534. typedef struct _IORB_UNIT_STATUS  {        /* IOUS */
  535.  
  536.   IORBH      iorbh;
  537.   USHORT     UnitStatus;
  538.  
  539. } IORB_UNIT_STATUS, FAR *PIORB_UNIT_STATUS, *NPIORB_UNIT_STATUS;
  540.  
  541.  
  542. /*------------------------------------------------------*/
  543. /* Unit Status for IORB_UNIT_STATUS->UnitStatus         */
  544. /*                                                      */
  545. /* Note: These flags apply to IOCM_GET_UNIT_STATUS      */
  546. /*------------------------------------------------------*/
  547.  
  548. #define US_READY                0x0001          /* Unit ready          */
  549. #define US_POWER                0x0002          /* Unit powered on     */
  550. #define US_DEFECTIVE            0x0004          /* Unit operational    */
  551.  
  552.  
  553. /*------------------------------------------------------*/
  554. /* Unit Status for IORB_UNIT_STATUS->UnitStatus         */
  555. /*                                                      */
  556. /* Note: These flags apply to IOCM_GET_CHANGELINE_STATE */
  557. /*------------------------------------------------------*/
  558.  
  559. #define US_CHANGELINE_ACTIVE    0x0001          /* ChangeLine State    */
  560.  
  561.  
  562. /*------------------------------------------------------*/
  563. /* Unit Status for IORB_UNIT_STATUS->UnitStatus         */
  564. /*                                                      */
  565. /* Note: These flags apply to IOCM_GET_MEDIA_SENSE      */
  566. /*------------------------------------------------------*/
  567.  
  568. #define US_MEDIA_UNKNOWN        0x0000          /* Unable to determine media */
  569. #define US_MEDIA_720KB          0x0001          /* 720KB in 3.5" drive       */
  570. #define US_MEDIA_144MB          0x0002          /* 1.44MB in 3.5" drive      */
  571. #define US_MEDIA_288MB          0x0003          /* 2.88MB in 3.5" drive      */
  572.  
  573.  
  574. /***********************************************************************/
  575. /* DEVICE CONTROL IORB                (for IOCC_DEVICE_CONTROL         */
  576. /***********************************************************************/
  577.  
  578.  
  579. typedef struct _IORB_DEVICE_CONTROL   {   /* IODC */
  580.  
  581.   IORBH      iorbh;                       /* IORB Header                */
  582.   USHORT     Flags;
  583.   USHORT     Reserved;
  584.  
  585. } IORB_DEVICE_CONTROL, FAR *PIORB_DEVICE_CONTROL, *NPIORB_DEVICE_CONTROL;
  586.  
  587.  
  588. /*------------------------------------------------------*/
  589. /* IORB specific flags for IORB_DEVICE_CONTROL->Flags   */
  590. /*                                                      */
  591. /* Note: These flags apply to IOCM_SUSPEND              */
  592. /*------------------------------------------------------*/
  593.  
  594. #define DC_SUSPEND_DEFERRED     0x0000          /* Suspend after device idle */
  595. #define DC_SUSPEND_IMMEDIATE    0x0001          /* Suspend after current req */
  596.  
  597.  
  598. #define MAX_IORB_SIZE   128
  599.