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.

254 lines
5.5 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1999
  3. Module Name:
  4. sbp2.h
  5. Abstract:
  6. Definitions for SBP2 protocol
  7. Author:
  8. georgioc 22-Jan-97
  9. Environment:
  10. Kernel mode only
  11. Revision History:
  12. --*/
  13. #ifndef _SBP2_
  14. #define _SBP2_
  15. #ifndef SBP2KDX
  16. #include "wdm.h"
  17. #endif
  18. #include "1394.h"
  19. #include "rbc.h"
  20. #include "scsi.h"
  21. #include "ntddstor.h"
  22. typedef union _QUADLET {
  23. ULONG QuadPart;
  24. struct {
  25. USHORT LowPart;
  26. USHORT HighPart;
  27. } u;
  28. } QUADLET, *PQUADLET;
  29. typedef struct _B1394_ADDRESS {
  30. USHORT Off_High; // little endian ordering within an octlet
  31. NODE_ADDRESS NodeId;
  32. ULONG Off_Low;
  33. } B1394_ADDRESS, *PB1394_ADDRESS;
  34. typedef union _OCTLET {
  35. LONGLONG OctletPart;
  36. B1394_ADDRESS BusAddress;
  37. struct {
  38. QUADLET HighQuad;
  39. QUADLET LowQuad;
  40. } u;
  41. struct {
  42. UCHAR Byte0;
  43. UCHAR Byte1;
  44. UCHAR Byte2;
  45. UCHAR Byte3;
  46. UCHAR Byte4;
  47. UCHAR Byte5;
  48. UCHAR Byte6;
  49. UCHAR Byte7;
  50. } ByteArray;
  51. } OCTLET, *POCTLET;
  52. //
  53. // Various ORB and block definitions
  54. //
  55. typedef struct _ORB_NORMAL_CMD {
  56. OCTLET NextOrbAddress;
  57. OCTLET DataDescriptor;
  58. QUADLET OrbInfo;
  59. UCHAR Cdb[12];
  60. } ORB_NORMAL_CMD, *PORB_NORMAL_CMD;
  61. #define CMD_ORB_HEADER_SIZE 0x14
  62. typedef struct _ORB_LOGIN {
  63. OCTLET Password;
  64. OCTLET LoginResponseAddress;
  65. QUADLET OrbInfo;
  66. QUADLET LengthInfo;
  67. OCTLET StatusBlockAddress;
  68. } ORB_LOGIN, *PORB_LOGIN;
  69. typedef struct _ORB_QUERY_LOGIN {
  70. OCTLET Reserved;
  71. OCTLET QueryResponseAddress;
  72. QUADLET OrbInfo;
  73. QUADLET LengthInfo;
  74. OCTLET StatusBlockAddress;
  75. } ORB_QUERY_LOGIN, *PORB_QUERY_LOGIN;
  76. typedef struct _ORB_SET_PASSWORD {
  77. OCTLET Password;
  78. OCTLET Reserved;
  79. QUADLET OrbInfo;
  80. QUADLET LengthInfo;
  81. OCTLET StatusBlockAddress;
  82. } ORB_SET_PASSWORD, *PORB_SET_PASSWORD;
  83. typedef struct _ORB_MNG {
  84. OCTLET Reserved[2];
  85. QUADLET OrbInfo;
  86. QUADLET Reserved1;
  87. OCTLET StatusBlockAddress;
  88. } ORB_MNG, *PORB_MNG;
  89. typedef struct _ORB_TASK_MNG {
  90. OCTLET OrbAddress;
  91. OCTLET Reserved;
  92. QUADLET OrbInfo;
  93. QUADLET Reserved1;
  94. OCTLET StatusBlockAddress;
  95. } ORB_TASK_MNG, *PORB_TASK_MNG;
  96. typedef struct _ORB_DUMMY {
  97. OCTLET NextOrbAddress;
  98. OCTLET NotUsed;
  99. QUADLET OrbInfo;
  100. OCTLET Unused[3];
  101. } ORB_DUMMY, *PORB_DUMMY;
  102. typedef struct _LOGIN_RESPONSE {
  103. QUADLET LengthAndLoginId;
  104. QUADLET Csr_Off_High;
  105. QUADLET Csr_Off_Low;
  106. QUADLET Reserved;
  107. } LOGIN_RESPONSE, *PLOGIN_RESPONSE;
  108. typedef struct _QUERY_RESPONSE_ELEMENT {
  109. QUADLET NodeAndLoginId;
  110. OCTLET EUI64;
  111. } QUERY_RESPONSE_ELEMENT, *PQUERY_RESPONSE_ELEMENT;
  112. typedef struct _QUERY_LOGIN_RESPONSE {
  113. QUADLET LengthAndNumLogins;
  114. QUERY_RESPONSE_ELEMENT Elements[4];
  115. } QUERY_LOGIN_RESPONSE, *PQUERY_LOGIN_RESPONSE;
  116. typedef struct _STATUS_FIFO_BLOCK {
  117. OCTLET AddressAndStatus;
  118. OCTLET Contents[3];
  119. } STATUS_FIFO_BLOCK, *PSTATUS_FIFO_BLOCK;
  120. #define SBP2_MIN_ORB_SIZE 32
  121. #define SBP2_ORB_CDB_SIZE 12
  122. #define SBP2_MAX_DIRECT_BUFFER_SIZE (ULONG) (65536) // (64K - 1) max size for direct addressing buffer
  123. #define SBP2_MAX_PAGE_SIZE SBP2_MAX_DIRECT_BUFFER_SIZE
  124. //
  125. // MANAGEMENT Transactions
  126. //
  127. #define TRANSACTION_LOGIN 0x00
  128. #define TRANSACTION_QUERY_LOGINS 0x01
  129. #define TRANSACTION_ISOCHRONOUS_LOGIN 0x02
  130. #define TRANSACTION_RECONNECT 0x03
  131. #define TRANSACTION_SET_PASSWORD 0x04
  132. #define TRANSACTION_LOGOUT 0x07
  133. #define TRANSACTION_TERMINATE_TASK 0x0b
  134. #define TRANSACTION_ABORT_TASK 0x0b
  135. #define TRANSACTION_ABORT_TASK_SET 0x0c
  136. #define TRANSACTION_CLEAR_TASK_SET 0x0D
  137. #define TRANSACTION_LOGICAL_UNIT_RESET 0x0E
  138. #define TRANSACTION_TARGET_RESET 0x0F
  139. #define MANAGEMENT_AGENT_REG_ADDRESS_LOW 0xF0010000
  140. #define CSR_REG_ADDRESS_LOW 0xF0010000
  141. //
  142. // Register Names
  143. //
  144. #define MANAGEMENT_AGENT_REG 0x0000
  145. #define AGENT_STATE_REG 0x0001
  146. #define AGENT_RESET_REG 0x0002
  147. #define ORB_POINTER_REG 0x0004
  148. #define DOORBELL_REG 0x0008
  149. #define UNSOLICITED_STATUS_REG 0x0010
  150. #define CORE_RESET_REG 0x0020
  151. #define CORE_BUSY_TIMEOUT_REG 0x0040
  152. #define TEST_REG 0x0080
  153. //
  154. // register access type
  155. //
  156. #define REG_WRITE_SYNC 0x0100
  157. #define REG_READ_SYNC 0x0200
  158. #define REG_WRITE_ASYNC 0x0400
  159. #define REG_TYPE_MASK 0x00FF
  160. //
  161. // Relative offsets from base of Target's CSR
  162. //
  163. #define AGENT_STATE_REG_OFFSET 0x00
  164. #define AGENT_RESET_REG_OFFSET 0x04
  165. #define ORB_POINTER_REG_OFFSET 0x08
  166. #define DOORBELL_REG_OFFSET 0x10
  167. #define UNSOLICITED_STATUS_REG_OFFSET 0x14
  168. #define TEST_REG_OFFSET 0x10020
  169. //
  170. // config rom stuff
  171. //
  172. #define CR_BASE_ADDRESS_LOW 0xF0000400
  173. #define CR_MODULE_ID_OFFSET (0x06 * sizeof(QUADLET))
  174. #define CSR_OFFSET_KEY_SIGNATURE 0x54
  175. #define LUN_CHARACTERISTICS_KEY_SIGNATURE 0x3A
  176. #define FIRMWARE_REVISION_KEY_SIGNATURE 0x3C
  177. #define LUN_KEY_SIGNATURE 0x14
  178. #define LU_DIRECTORY_KEY_SIGNATURE 0xD4
  179. #define SW_VERSION_KEY_SIGNATURE 0x13
  180. #define CMD_SET_ID_KEY_SIGNATURE 0x39
  181. #define CMD_SET_SPEC_ID_KEY_SIGNATURE 0x38
  182. #define SBP2_LUN_DEVICE_TYPE_MASK 0x00FF0000
  183. #define SBP2_PHY_RESET_SETTLING_TIME (-10000000 * 1) // 1 sec in units of 100 nsecs
  184. #define SCSI_COMMAND_SET_ID 0x0104D8
  185. //
  186. // vendor hacks
  187. //
  188. #define LSI_VENDOR_ID 0x0000A0B8
  189. #endif