home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / Chip_2003-01_cd2.bin / others / support / aspi / aspi_v471.exe / include / srbcmn.h < prev   
C/C++ Source or Header  |  2001-11-27  |  14KB  |  291 lines

  1. /**!!SDK_COMMON!!**/
  2. /**++SDK_PRIVATE++**/
  3. /**++SDK_COMMON++**/
  4. /******************************************************************************
  5. **
  6. ** Copyright 1992-98 Adaptec, Inc.,  All Rights Reserved.
  7. **
  8. ** This software contains the valuable trade secrets of Adaptec.  The
  9. ** software is protected under copyright laws as an unpublished work of
  10. ** Adaptec.  Notice is for informational purposes only and does not imply
  11. ** publication.  The user of this software may make copies of the software
  12. ** for use with parts manufactured by Adaptec or under license from Adaptec
  13. ** and for no other use.
  14. **
  15. ******************************************************************************/
  16.  
  17. /******************************************************************************
  18. ** THIS FILE IS FOR INTERNAL ADAPTEC USE ONLY!  THIS FILE IS NOT FOR INCLUSION
  19. ** IN THE ASPI SOFTWARE DEVELOPMENT KIT AND IT SHOULD NOT BE MAILED OR POSTED!
  20. ******************************************************************************/
  21.  
  22. /**++SDK_EXCLUDE++**/
  23. /******************************************************************************
  24. **
  25. **  Module Name:    srbcmn.h
  26. **
  27. **  Description:    SRB definitions common to both ASPI for Win16 and ASPI for
  28. **                  Win32.  Look in srb16.h and srb32.h for ASPI for Win 16/32
  29. **                  specific structures and definitions.
  30. **
  31. **                  This file should be combined with srb16.h and cleaned
  32. **                  up to produce the winaspi.h for the SDK.  Similarly, this
  33. **                  file should be combined with srb32.h and cleaned up to
  34. **                  produce wnaspi32.h for the SDK.
  35. **
  36. **  Programmers:    Daniel Polfer (dap)
  37. **
  38. **  History:        11/09/95 (dap)  Initial creation.
  39. **                  12/18/95 (dap)  Added max timeout value.
  40. **                  02/20/96 (dap)  Added SRB_NO_ERROR_POSTING.
  41. **                  09/03/96 (dap)  Renamed and modified to be shared between
  42. **                                  ring-0 and ring-3 code bases.
  43. **                  09/13/96 (dap)  Added queue management structures, etc.
  44. **                  06/24/98 (dap)  Modified to use allow auto-SDK generation.
  45. **                  11-27-01 (jck)  Correct spelling of TOO_BIG.
  46. **
  47. **  Notes:          This file created using 4 spaces per tab.
  48. **
  49. **                  This file is NOT a customer deliverable to be included
  50. **                  with the ASPI SDK.  It is specific to our ASPI
  51. **                  implementation and contains definitions of private
  52. **                  Adpatec structures.
  53. **
  54. ******************************************************************************/
  55.  
  56. #ifndef __SRBCMN_H__
  57. #define __SRBMCN_H__
  58.  
  59. /**++SDK_PUBLIC++**/
  60. /**++SDK_32ONLY++**/
  61. /******************************************************************************
  62. **
  63. **  Module Name:    wnaspi32.h
  64. **
  65. **  Description:    Header file for ASPI for Win32.  This header includes
  66. **                  macro and type declarations, and can be included without
  67. **                  modification when using Borland C++ or Microsoft Visual
  68. **                  C++ with 32-bit compilation.  If you are using a different
  69. **                  compiler then you MUST ensure that structures are packed
  70. **                  onto byte alignments, and that C++ name mangling is turned
  71. **                  off.
  72. **
  73. **  Notes:          This file created using 4 spaces per tab.
  74. **
  75. ******************************************************************************/
  76. /**++SDK_32ONLY:++**/
  77. /**++SDK_32ONLY:#ifndef __WNASPI32_H__++**/
  78. /**++SDK_32ONLY:#define __WNASPI32_H__++**/
  79. /**++SDK_16ONLY++**/
  80. /******************************************************************************
  81. **
  82. **  Module Name:    winaspi.h
  83. **
  84. **  Description:    Header file for ASPI for Win16.  This header includes
  85. **                  macro and type declarations, and can be included without
  86. **                  modification when Microsoft Visual C++ with 16-bit
  87. **                  compilation.  If you are using a different compiler then
  88. **                  you MUST ensure that structures are packed onto byte
  89. **                  alignments, and that C++ name mangling is turned off.
  90. **
  91. **  Notes:          This file created using 4 spaces per tab.
  92. **
  93. ******************************************************************************/
  94. /**++SDK_16ONLY:++**/
  95. /**++SDK_16ONLY:#ifndef __WINASPI_H__++**/
  96. /**++SDK_16ONLY:#define __WINASPI_H__++**/
  97. /**++SDK_COMMON++**/
  98.  
  99. /*
  100. ** Make sure structures are packed and undecorated.
  101. */
  102.  
  103. /**++SDK_32ONLY++**/
  104. #ifdef __BORLANDC__
  105. #pragma option -a1
  106. #endif //__BORLANDC__
  107.  
  108. /**++SDK_COMMON++**/
  109. #ifdef _MSC_VER
  110. #pragma pack(1)
  111. #endif //__MSC_VER
  112.  
  113. #ifdef __cplusplus
  114. extern "C" {
  115. #endif //__cplusplus
  116.  
  117. //*****************************************************************************
  118. //      %%% SCSI MISCELLANEOUS EQUATES %%%
  119. //*****************************************************************************
  120.  
  121. #define SENSE_LEN                   14          // Default sense buffer length
  122. #define SRB_DIR_SCSI                0x00        // Direction determined by SCSI
  123. #define SRB_POSTING                 0x01        // Enable ASPI posting
  124. #define SRB_ENABLE_RESIDUAL_COUNT   0x04        // Enable residual byte count reporting
  125. #define SRB_DIR_IN                  0x08        // Transfer from SCSI target to host
  126. #define SRB_DIR_OUT                 0x10        // Transfer from host to SCSI target
  127. /**++SDK_32ONLY++**/
  128. #define SRB_EVENT_NOTIFY            0x40        // Enable ASPI event notification
  129.  
  130. #define RESIDUAL_COUNT_SUPPORTED    0x02        // Extended buffer flag
  131. #define MAX_SRB_TIMEOUT             108000lu    // 30 hour maximum timeout in s
  132. #define DEFAULT_SRB_TIMEOUT         108000lu    // Max timeout by default
  133.  
  134. /**++SDK_EXCLUDE++**/
  135. #define SRB_NO_ERROR_POSTING        0x02        // Do not post completion on error
  136. #define SRB_HEAD_OF_QUEUE           0x20        // Insert SRB at queue head
  137. #define SRB_BYPASS_QUEUE            0x80        // Bypass queue management
  138.  
  139. /**++SDK_PRIVATE++**/
  140. /**++SDK_32ONLY++**/
  141. #define SRBQ_ENABLE_QUEUEING        0x01        // Enable queueing for a target
  142. #define SRBQ_FREEZE_QUEUE           0x02        // Freeze a target queue
  143. #define SRBQ_UNFREEZE_QUEUE         0x03        // Unfreeze a target queue
  144. #define SRBQ_CLEAR_QUEUE            0x04        // Clear a frozen target queue
  145. #define SRBQ_QUERY_QUEUE            0x05        // Return queue status
  146. #define SRBQ_SET_CDB_DELAY          0x06        // Set delay on a select CDB
  147. #define SRBQ_DISABLE_QUEUEING       0x00        // Disable queueing for a target
  148.  
  149. /**++SDK_PUBLIC++**/
  150. /**++SDK_COMMON++**/
  151.  
  152. //*****************************************************************************
  153. //      %%% ASPI Command Definitions %%%
  154. //*****************************************************************************
  155.  
  156. #define SC_HA_INQUIRY               0x00        // Host adapter inquiry
  157. #define SC_GET_DEV_TYPE             0x01        // Get device type
  158. #define SC_EXEC_SCSI_CMD            0x02        // Execute SCSI command
  159. #define SC_ABORT_SRB                0x03        // Abort an SRB
  160. #define SC_RESET_DEV                0x04        // SCSI bus device reset
  161. #define SC_SET_HA_PARMS             0x05        // Set HA parameters
  162. #define SC_GET_DISK_INFO            0x06        // Get Disk information
  163. #define SC_SEEPROM                    0xe1        // Get SEEPROM Contents
  164. #define SC_EEPROM                    0xe2        // Get EEPROM Contents
  165. #define SC_PCIINFO                    0xe3        // Get SEEPROM Contents
  166. #define SC_NEGO_XFER_RATE            0xe4        // Get SEEPROM Contents
  167. #define OC_SEEPROM_READ                0xa1        // Read SEEPROM Contents
  168. #define OC_SEEPROM_WRITE            0xa2        // Write SEEPROM Contents
  169. #define OC_SEEPROM_DETECT            0xa3        // Detect SEEPROM
  170. #define OC_SEEPROM_ERASE            0xa4        // Erase SEEPROM
  171. #define OC_EEPROM_READ                0xb1        // Read SEEPROM Contents
  172. #define OC_EEPROM_WRITE                0xb2        // Write SEEPROM Contents
  173. #define OC_PCIINFO_READ                0xc1
  174. #define OC_PCIINFO_WRITE            0xc2
  175. #define OC_NEGO_XFER_RATE_READ        0xd1
  176.  
  177. #define    MAX_SCSI_DEVS            16
  178.  
  179.     /**++SDK_32ONLY++**/
  180. #define SC_RESCAN_SCSI_BUS          0x07        // ReBuild SCSI device map
  181. #define SC_GETSET_TIMEOUTS          0x08        // Get/Set target timeouts
  182. /**++SDK_PRIVATE++**/
  183. #define SC_MANAGE_QUEUE             0xC8        // Manage per-target SRB queues
  184. /**++SDK_PUBLIC++**/
  185. /**++SDK_COMMON++**/
  186.  
  187. //*****************************************************************************
  188. //      %%% SRB Status %%%
  189. //*****************************************************************************
  190.  
  191. #define SS_PENDING                  0x00        // SRB being processed
  192. #define SS_COMP                     0x01        // SRB completed without error
  193. #define SS_ABORTED                  0x02        // SRB aborted
  194. #define SS_ABORT_FAIL               0x03        // Unable to abort SRB
  195. #define SS_ERR                      0x04        // SRB completed with error
  196.  
  197. /**++SDK_PRIVATE++**/
  198. #define SS_ABORTED_QUEUE_FROZEN     0x42        // SRB aborted, target queue frozen
  199. #define SS_ERR_QUEUE_FROZEN         0x44        // SRB completed with error, target queue frozen
  200. #define SS_BUFFTOBIG_QUEUE_FROZEN   0x4F        // SRB buffer too big, target queue frozen
  201.  
  202. /**++SDK_PUBLIC++**/
  203. #define SS_INVALID_CMD              0x80        // Invalid ASPI command
  204. #define SS_INVALID_HA               0x81        // Invalid host adapter number
  205. #define SS_NO_DEVICE                0x82        // SCSI device not installed
  206.  
  207. #define SS_INVALID_SRB              0xE0        // Invalid parameter set in SRB
  208. #define SS_OLD_MANAGER              0xE1        // ASPI manager doesn't support Windows
  209. #define SS_BUFFER_ALIGN             0xE1        // Buffer not aligned (replaces OLD_MANAGER in Win32)
  210. #define SS_ILLEGAL_MODE             0xE2        // Unsupported Windows mode
  211. #define SS_NO_ASPI                  0xE3        // No ASPI managers resident
  212. #define SS_FAILED_INIT              0xE4        // ASPI for windows failed init
  213. #define SS_ASPI_IS_BUSY             0xE5        // No resources available to execute cmd
  214. #define SS_BUFFER_TO_BIG            0xE6        // Buffer size to big to handle!
  215. #define SS_BUFFER_TOO_BIG           0xE6        // Buffer size toobig to handle!
  216. #define SS_MISMATCHED_COMPONENTS    0xE7        // The DLLs/EXEs of ASPI don't version check
  217. #define SS_NO_ADAPTERS              0xE8        // No host adapters to manage
  218. #define SS_INSUFFICIENT_RESOURCES   0xE9        // Couldn't allocate resources needed to init
  219. #define SS_ASPI_IS_SHUTDOWN         0xEA        // Call came to ASPI after PROCESS_DETACH
  220. #define SS_BAD_INSTALL              0xEB        // The DLL or other components are installed wrong
  221.  
  222. //*****************************************************************************
  223. //      %%% Host Adapter Status %%%
  224. //*****************************************************************************
  225.  
  226. #define HASTAT_OK                   0x00        // Host adapter did not detect an                                                                                                                       // error
  227. #define HASTAT_SEL_TO               0x11        // Selection Timeout
  228. #define HASTAT_DO_DU                0x12        // Data overrun data underrun
  229. #define HASTAT_BUS_FREE             0x13        // Unexpected bus free
  230. #define HASTAT_PHASE_ERR            0x14        // Target bus phase sequence                                                                                                                            // failure
  231. #define HASTAT_TIMEOUT              0x09        // Timed out while SRB was                                                                                                                                      waiting to beprocessed.
  232. #define HASTAT_COMMAND_TIMEOUT      0x0B        // Adapter timed out processing SRB.
  233. #define HASTAT_MESSAGE_REJECT       0x0D        // While processing SRB, the                                                                                                                            // adapter received a MESSAGE
  234. #define HASTAT_BUS_RESET            0x0E        // A bus reset was detected.
  235. #define HASTAT_PARITY_ERROR         0x0F        // A parity error was detected.
  236. #define HASTAT_REQUEST_SENSE_FAILED 0x10        // The adapter failed in issuing
  237.  
  238. /**++SDK_EXCLUDE++**/
  239. //*****************************************************************************
  240. //          %%% SRB - HEADER %%%
  241. //*****************************************************************************
  242.  
  243. typedef struct                                  // Offset
  244. {                                               // HX/DEC
  245.     BYTE        SRB_Cmd;                        // 00/000
  246.     BYTE        SRB_Status;                     // 01/001
  247.     BYTE        SRB_HaId;                       // 02/002
  248.     BYTE        SRB_Flags;                      // 03/003
  249.     DWORD       SRB_Hdr_Rsvd;                   // 04/004
  250. }
  251. SRB_Header, *PSRB_Header, FAR *LPSRB_Header;
  252.  
  253. /*
  254. ** SCSI address of a target.  Just a convenient way to group the HA/ID/LUN
  255. ** together and be able to use them individually or as a DWORD path variable.
  256. */
  257.  
  258. typedef union
  259. {
  260.     struct
  261.     {
  262.         BYTE    Lun;
  263.         BYTE    TargetId;
  264.         BYTE    HaId;
  265.         BYTE    Flag;
  266.     } by;
  267.     struct
  268.     {
  269.         DWORD   Path;
  270.     } dw;
  271. }
  272. SCSIADDR, *PSCSIADDR;
  273.  
  274. /*
  275. ** Restore compiler default packing and close off the C declarations.
  276. */
  277.  
  278. #ifdef __BORLANDC__
  279. #pragma option -a.
  280. #endif //__BORLANDC__
  281.  
  282. #ifdef _MSC_VER
  283. #pragma pack()
  284. #endif //_MSC_VER
  285.  
  286. #ifdef __cplusplus
  287. }
  288. #endif //__cplusplus
  289.  
  290. #endif //__SRBCMN_H__
  291.