Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
9.2 KiB

  1. #ifndef __WNASPI32_H__
  2. #define __WNASPI32_H__
  3. /****************************************************************************
  4. * *
  5. * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
  6. * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
  7. * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR *
  8. * PURPOSE. *
  9. * *
  10. * Copyright (C) 1993-95 Microsoft Corporation. All Rights Reserved. *
  11. * *
  12. ****************************************************************************/
  13. //***************************************************************************
  14. //
  15. // Name: WNASPI32.H
  16. //
  17. // Description: ASPI for Win32 definitions ('C' Language)
  18. //
  19. //***************************************************************************
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. typedef void *LPSRB;
  24. typedef void (*PFNPOST)();
  25. DWORD __cdecl SendASPI32Command (LPSRB);
  26. DWORD __cdecl GetASPI32SupportInfo (VOID);
  27. #define SENSE_LEN 14 // Default sense buffer length
  28. #define SRB_DIR_SCSI 0x00 // Direction determined by SCSI // command
  29. #define SRB_DIR_IN 0x08 // Transfer from SCSI target to // host
  30. #define SRB_DIR_OUT 0x10 // Transfer from host to SCSI // target
  31. #define SRB_POSTING 0x01 // Enable ASPI posting
  32. #define SRB_EVENT_NOTIFY 0x40 // Enable ASPI event notification
  33. #define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count // reporting
  34. #define SRB_DATA_SG_LIST 0x02 // Data buffer points to // scatter-gather list
  35. #define WM_ASPIPOST 0x4D42 // ASPI Post message
  36. //***************************************************************************
  37. // %%% ASPI Command Definitions %%%
  38. //***************************************************************************
  39. #define SC_HA_INQUIRY 0x00 // Host adapter inquiry
  40. #define SC_GET_DEV_TYPE 0x01 // Get device type
  41. #define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command
  42. #define SC_ABORT_SRB 0x03 // Abort an SRB
  43. #define SC_RESET_DEV 0x04 // SCSI bus device reset
  44. #define SC_GET_DISK_INFO 0x06 // Get Disk information
  45. //***************************************************************************
  46. // %%% SRB Status %%%
  47. //***************************************************************************
  48. #define SS_PENDING 0x00 // SRB being processed
  49. #define SS_COMP 0x01 // SRB completed without error
  50. #define SS_ABORTED 0x02 // SRB aborted
  51. #define SS_ABORT_FAIL 0x03 // Unable to abort SRB
  52. #define SS_ERR 0x04 // SRB completed with error
  53. #define SS_INVALID_CMD 0x80 // Invalid ASPI command
  54. #define SS_INVALID_HA 0x81 // Invalid host adapter number
  55. #define SS_NO_DEVICE 0x82 // SCSI device not installed
  56. #define SS_INVALID_SRB 0xE0 // Invalid parameter set in SRB
  57. #define SS_FAILED_INIT 0xE4 // ASPI for windows failed init
  58. #define SS_ASPI_IS_BUSY 0xE5 // No resources available to execute cmd
  59. #define SS_BUFFER_TO_BIG 0xE6 // Buffer size to big to handle!
  60. //***************************************************************************
  61. // %%% Host Adapter Status %%%
  62. //***************************************************************************
  63. #define HASTAT_OK 0x00 // Host adapter did not detect an // error
  64. #define HASTAT_SEL_TO 0x11 // Selection Timeout
  65. #define HASTAT_DO_DU 0x12 // Data overrun data underrun
  66. #define HASTAT_BUS_FREE 0x13 // Unexpected bus free
  67. #define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure
  68. #define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed.
  69. #define HASTAT_COMMAND_TIMEOUT 0x0B // While processing the SRB, the
  70. // adapter timed out.
  71. #define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE // REJECT.
  72. #define HASTAT_BUS_RESET 0x0E // A bus reset was detected.
  73. #define HASTAT_PARITY_ERROR 0x0F // A parity error was detected.
  74. #define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing
  75. // REQUEST SENSE.
  76. //***************************************************************************
  77. // %%% SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY %%%
  78. //***************************************************************************
  79. typedef struct {
  80. BYTE SRB_Cmd; // ASPI command code = SC_HA_INQUIRY
  81. BYTE SRB_Status; // ASPI command status byte
  82. BYTE SRB_HaId; // ASPI host adapter number
  83. BYTE SRB_Flags; // ASPI request flags
  84. DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0
  85. BYTE HA_Count; // Number of host adapters present
  86. BYTE HA_SCSI_ID; // SCSI ID of host adapter
  87. BYTE HA_ManagerId[16]; // String describing the manager
  88. BYTE HA_Identifier[16]; // String describing the host adapter
  89. BYTE HA_Unique[16]; // Host Adapter Unique parameters
  90. WORD HA_Rsvd1;
  91. } SRB_HAInquiry, *PSRB_HAInquiry;
  92. //***************************************************************************
  93. // %%% SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE %%%
  94. //***************************************************************************
  95. typedef struct {
  96. BYTE SRB_Cmd; // ASPI command code = SC_GET_DEV_TYPE
  97. BYTE SRB_Status; // ASPI command status byte
  98. BYTE SRB_HaId; // ASPI host adapter number
  99. BYTE SRB_Flags; // Reserved
  100. DWORD SRB_Hdr_Rsvd; // Reserved
  101. BYTE SRB_Target; // Target's SCSI ID
  102. BYTE SRB_Lun; // Target's LUN number
  103. BYTE SRB_DeviceType; // Target's peripheral device type
  104. BYTE SRB_Rsvd1;
  105. } SRB_GDEVBlock, *PSRB_GDEVBlock;
  106. //***************************************************************************
  107. // %%% SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD %%%
  108. //***************************************************************************
  109. typedef struct {
  110. BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD
  111. BYTE SRB_Status; // ASPI command status byte
  112. BYTE SRB_HaId; // ASPI host adapter number
  113. BYTE SRB_Flags; // ASPI request flags
  114. DWORD SRB_Hdr_Rsvd; // Reserved
  115. BYTE SRB_Target; // Target's SCSI ID
  116. BYTE SRB_Lun; // Target's LUN number
  117. WORD SRB_Rsvd1; // Reserved for Alignment
  118. DWORD SRB_BufLen; // Data Allocation Length
  119. BYTE *SRB_BufPointer; // Data Buffer Pointer
  120. BYTE SRB_SenseLen; // Sense Allocation Length
  121. BYTE SRB_CDBLen; // CDB Length
  122. BYTE SRB_HaStat; // Host Adapter Status
  123. BYTE SRB_TargStat; // Target Status
  124. void *SRB_PostProc; // Post routine
  125. void *SRB_Rsvd2; // Reserved
  126. BYTE SRB_Rsvd3[16]; // Reserved for alignment
  127. BYTE CDBByte[16]; // SCSI CDB
  128. BYTE SenseArea[SENSE_LEN+2]; // Request Sense buffer
  129. } SRB_ExecSCSICmd, *PSRB_ExecSCSICmd;
  130. //***************************************************************************
  131. // %%% SRB - ABORT AN SRB - SC_ABORT_SRB %%%
  132. //***************************************************************************
  133. typedef struct {
  134. BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD
  135. BYTE SRB_Status; // ASPI command status byte
  136. BYTE SRB_HaId; // ASPI host adapter number
  137. BYTE SRB_Flags; // Reserved
  138. DWORD SRB_Hdr_Rsvd; // Reserved
  139. void *SRB_ToAbort; // Pointer to SRB to abort
  140. } SRB_Abort, *PSRB_Abort;
  141. //***************************************************************************
  142. // %%% SRB - BUS DEVICE RESET - SC_RESET_DEV %%%
  143. //***************************************************************************
  144. typedef struct {
  145. BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD
  146. BYTE SRB_Status; // ASPI command status byte
  147. BYTE SRB_HaId; // ASPI host adapter number
  148. BYTE SRB_Flags; // Reserved
  149. DWORD SRB_Hdr_Rsvd; // Reserved
  150. BYTE SRB_Target; // Target's SCSI ID
  151. BYTE SRB_Lun; // Target's LUN number
  152. BYTE SRB_Rsvd1[12]; // Reserved for Alignment
  153. BYTE SRB_HaStat; // Host Adapter Status
  154. BYTE SRB_TargStat; // Target Status
  155. void *SRB_PostProc; // Post routine
  156. void *SRB_Rsvd2; // Reserved
  157. BYTE SRB_Rsvd3[16]; // Reserved
  158. BYTE CDBByte[16]; // SCSI CDB
  159. } SRB_BusDeviceReset, *PSRB_BusDeviceReset;
  160. //***************************************************************************
  161. // %%% SRB - GET DISK INFORMATION - SC_GET_DISK_INFO %%%
  162. //***************************************************************************
  163. typedef struct {
  164. BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD
  165. BYTE SRB_Status; // ASPI command status byte
  166. BYTE SRB_HaId; // ASPI host adapter number
  167. BYTE SRB_Flags; // Reserved
  168. DWORD SRB_Hdr_Rsvd; // Reserved
  169. BYTE SRB_Target; // Target's SCSI ID
  170. BYTE SRB_Lun; // Target's LUN number
  171. BYTE SRB_DriveFlags; // Driver flags
  172. BYTE SRB_Int13HDriveInfo; // Host Adapter Status
  173. BYTE SRB_Heads; // Preferred number of heads translation
  174. BYTE SRB_Sectors; // Preferred number of sectors translation
  175. BYTE SRB_Rsvd1[10]; // Reserved
  176. } SRB_GetDiskInfo, *PSRB_GetDiskInfo;
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180. #endif