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.

738 lines
23 KiB

  1. //***************************************************************************
  2. //
  3. // hbaapi.h
  4. //
  5. // Module: Windows HBA API implmentation
  6. //
  7. // This header is consistent with HBA_API_Rev_2-14_2001NOV13.doc
  8. // version of the HBAAPI 2.0 spec.
  9. //
  10. // Purpose: Contains HBA api header
  11. //
  12. // Copyright (c) 2001 Microsoft Corporation
  13. //
  14. //***************************************************************************
  15. #ifndef HBAAPI_H
  16. #define HBAAPI_H
  17. #include <time.h>
  18. #ifdef _HBAAPIP_
  19. #define HBA_API __cdecl
  20. #else
  21. #define HBA_API DECLSPEC_IMPORT __cdecl
  22. #endif
  23. #define HBA_VERSION 2
  24. typedef ULONGLONG HBA_UINT64;
  25. typedef LONGLONG HBA_INT64;
  26. typedef ULONG HBA_UINT32;
  27. typedef USHORT HBA_UINT16;
  28. typedef UCHAR HBA_UINT8;
  29. typedef SCHAR HBA_INT8;
  30. typedef HBA_UINT32 HBA_HANDLE;
  31. typedef HBA_UINT32 HBA_STATUS;
  32. #define HBA_STATUS_OK 0
  33. #define HBA_STATUS_ERROR 1 /* Error */
  34. #define HBA_STATUS_ERROR_NOT_SUPPORTED 2 /* Function not supported.*/
  35. #define HBA_STATUS_ERROR_INVALID_HANDLE 3 /* invalid handle */
  36. #define HBA_STATUS_ERROR_ARG 4 /* Bad argument */
  37. #define HBA_STATUS_ERROR_ILLEGAL_WWN 5 /* WWN not recognized */
  38. #define HBA_STATUS_ERROR_ILLEGAL_INDEX 6 /* Index not recognized */
  39. #define HBA_STATUS_ERROR_MORE_DATA 7 /* Larger buffer required */
  40. #define HBA_STATUS_ERROR_STALE_DATA 8 /* Information has changed since the last call to HBA_RefreshInformation */
  41. #define HBA_STATUS_SCSI_CHECK_CONDITION 9 /* SCSI Check Condition reported*/
  42. #define HBA_STATUS_ERROR_BUSY 10 /* Adapter busy or reserved, retry may be effective*/
  43. #define HBA_STATUS_ERROR_TRY_AGAIN 11 /* Request timed out, retry may be effective */
  44. #define HBA_STATUS_ERROR_UNAVAILABLE 12 /* Referenced HBA has been removed or deactivated */
  45. #define HBA_STATUS_ERROR_ELS_REJECT 13 /* The requested ELS was rejected */
  46. /* by the local adapter */
  47. #define HBA_STATUS_ERROR_INVALID_LUN 14 /* The specified LUN is not provided */
  48. /* by the specified adapter */
  49. #define HBA_STATUS_ERROR_INCOMPATIBLE 15 /* An incompatibility has been detected*/
  50. /* among the library and driver modules invoked */
  51. /* which will cause one or more functions in the highest version that all support */
  52. /* to operate incorrectly. */
  53. /* The differing function sets of software modules implementing different versions */
  54. /* of the HBA API specification does not in itself constitute an incompatibility. */
  55. /* Known interoperability bugs among supposedly compatible versions */
  56. /* should be reported as incompatibilities, */
  57. /* but not all such interoperability bugs may be known. */
  58. /* This value may be returned by any function which calls a Vendor Specific Library, */
  59. /* and by HBA_LoadLibrary and HBA_GetAdapterName. */
  60. #define HBA_STATUS_ERROR_AMBIGUOUS_WWN 16 /* Multiple adapters have */
  61. /* a matching WWN.
  62. * This could occur if the NodeWWN of multiple adapters is identical. */
  63. #define HBA_STATUS_ERROR_LOCAL_BUS 17 /* A persistent binding request included a bad local SCSI bus number */
  64. #define HBA_STATUS_ERROR_LOCAL_TARGET 18 /* A persistent binding request included a bad local SCSI target number */
  65. #define HBA_STATUS_ERROR_LOCAL_LUN 19 /* A persistent binding request included a bad local SCSI logical unit number */
  66. #define HBA_STATUS_ERROR_LOCAL_SCSIID_BOUND 20 /* A persistent binding set request included */
  67. /* a local SCSI ID that was already bound */
  68. #define HBA_STATUS_ERROR_TARGET_FCID 21 /* A persistent binding request included a bad or unlocatable FCP Target FCID */
  69. #define HBA_STATUS_ERROR_TARGET_NODE_WWN 22 /* A persistent binding request included a bad FCP Target Node WWN */
  70. #define HBA_STATUS_ERROR_TARGET_PORT_WWN 23 /* A persistent binding request included a bad FCP Target Port WWN */
  71. #define HBA_STATUS_ERROR_TARGET_LUN 24 /* A persistent binding request included */
  72. /* an FCP Logical Unit Number not defined by the identified Target*/
  73. #define HBA_STATUS_ERROR_TARGET_LUID 25 /* A persistent binding request included */
  74. /* an undefined or otherwise inaccessible Logical Unit Unique Identifier */
  75. #define HBA_STATUS_ERROR_NO_SUCH_BINDING 26 /* A persistent binding remove request included */
  76. /* a binding which did not match a binding established by the specified port */
  77. #define HBA_STATUS_ERROR_NOT_A_TARGET 27 /* A SCSI command was requested to an Nx_Port that was not a SCSI Target Port */
  78. #define HBA_STATUS_ERROR_UNSUPPORTED_FC4 28 /* A request was made concerning an unsupported FC-4 protocol */
  79. #define HBA_STATUS_ERROR_INCAPABLE 29 /* A request was made to enable unimplemented capabilities for a port */
  80. typedef HBA_UINT8 HBA_BOOLEAN; /* Use this for a single true/false flag */
  81. typedef HBA_UINT32 HBA_PORTTYPE;
  82. #define HBA_PORTTYPE_UNKNOWN 1 /* Unknown */
  83. #define HBA_PORTTYPE_OTHER 2 /* Other */
  84. #define HBA_PORTTYPE_NOTPRESENT 3 /* Not present */
  85. #define HBA_PORTTYPE_NPORT 5 /* Fabric */
  86. #define HBA_PORTTYPE_NLPORT 6 /* Public Loop */
  87. #define HBA_PORTTYPE_FLPORT 7 /* Fabric on a Loop */
  88. #define HBA_PORTTYPE_FPORT 8 /* Fabric Port */
  89. #define HBA_PORTTYPE_EPORT 9 /* Fabric expansion port */
  90. #define HBA_PORTTYPE_GPORT 10 /* Generic Fabric Port */
  91. #define HBA_PORTTYPE_LPORT 20 /* Private Loop */
  92. #define HBA_PORTTYPE_PTP 21 /* Point to Point */
  93. typedef HBA_UINT32 HBA_PORTSTATE;
  94. #define HBA_PORTSTATE_UNKNOWN 1 /* Unknown */
  95. #define HBA_PORTSTATE_ONLINE 2 /* Operational */
  96. #define HBA_PORTSTATE_OFFLINE 3 /* User Offline */
  97. #define HBA_PORTSTATE_BYPASSED 4 /* Bypassed */
  98. #define HBA_PORTSTATE_DIAGNOSTICS 5 /* In diagnostics mode */
  99. #define HBA_PORTSTATE_LINKDOWN 6 /* Link Down */
  100. #define HBA_PORTSTATE_ERROR 7 /* Port Error */
  101. #define HBA_PORTSTATE_LOOPBACK 8 /* Loopback */
  102. typedef HBA_UINT32 HBA_PORTSPEED;
  103. #define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver incapable of reporting */
  104. #define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */
  105. #define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */
  106. #define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */
  107. #define HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */
  108. #define HBA_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
  109. typedef HBA_UINT32 HBA_COS;
  110. typedef struct HBA_fc4types {
  111. HBA_UINT8 bits[32]; /* 32 bytes of FC-4 per GS-2 */
  112. } HBA_FC4TYPES, *PHBA_FC4TYPES;
  113. typedef struct HBA_wwn {
  114. HBA_UINT8 wwn[8];
  115. } HBA_WWN, *PHBA_WWN;
  116. typedef struct HBA_ipaddress {
  117. int ipversion; // see enumerations in RNID
  118. union
  119. {
  120. unsigned char ipv4address[4];
  121. unsigned char ipv6address[16];
  122. } ipaddress;
  123. } HBA_IPADDRESS, *PHBA_IPADDRESS;
  124. typedef struct HBA_AdapterAttributes {
  125. char Manufacturer[64]; /*Emulex */
  126. char SerialNumber[64]; /* A12345 */
  127. char Model[256]; /* QLA2200 */
  128. char ModelDescription[256]; /* Agilent TachLite */
  129. HBA_WWN NodeWWN;
  130. char NodeSymbolicName[256]; /* From GS-2 */
  131. char HardwareVersion[256]; /* Vendor use */
  132. char DriverVersion[256]; /* Vendor use */
  133. char OptionROMVersion[256]; /* Vendor use - i.e. hardware boot ROM*/
  134. char FirmwareVersion[256]; /* Vendor use */
  135. HBA_UINT32 VendorSpecificID; /* Vendor specific */
  136. HBA_UINT32 NumberOfPorts;
  137. char DriverName[256]; /* Binary path and/or name of driver file. */
  138. } HBA_ADAPTERATTRIBUTES, *PHBA_ADAPTERATTRIBUTES;
  139. typedef struct HBA_PortAttributes {
  140. HBA_WWN NodeWWN;
  141. HBA_WWN PortWWN;
  142. HBA_UINT32 PortFcId;
  143. HBA_PORTTYPE PortType; /*PTP, Fabric, etc. */
  144. HBA_PORTSTATE PortState;
  145. HBA_COS PortSupportedClassofService;
  146. HBA_FC4TYPES PortSupportedFc4Types;
  147. HBA_FC4TYPES PortActiveFc4Types;
  148. char PortSymbolicName[256];
  149. char OSDeviceName[256]; /* \device\ScsiPort3 */
  150. HBA_PORTSPEED PortSupportedSpeed;
  151. HBA_PORTSPEED PortSpeed;
  152. HBA_UINT32 PortMaxFrameSize;
  153. HBA_WWN FabricName;
  154. HBA_UINT32 NumberofDiscoveredPorts;
  155. } HBA_PORTATTRIBUTES, *PHBA_PORTATTRIBUTES;
  156. typedef struct HBA_PortStatistics {
  157. HBA_INT64 SecondsSinceLastReset;
  158. HBA_INT64 TxFrames;
  159. HBA_INT64 TxWords;
  160. HBA_INT64 RxFrames;
  161. HBA_INT64 RxWords;
  162. HBA_INT64 LIPCount;
  163. HBA_INT64 NOSCount;
  164. HBA_INT64 ErrorFrames;
  165. HBA_INT64 DumpedFrames;
  166. HBA_INT64 LinkFailureCount;
  167. HBA_INT64 LossOfSyncCount;
  168. HBA_INT64 LossOfSignalCount;
  169. HBA_INT64 PrimitiveSeqProtocolErrCount;
  170. HBA_INT64 InvalidTxWordCount;
  171. HBA_INT64 InvalidCRCCount;
  172. } HBA_PORTSTATISTICS, *PHBA_PORTSTATISTICS;
  173. /* HBA_FCPBINDINGTYPE was used in Rev 1.0. Add TO_OTHER for older calls to
  174. indicate other binding types for HBA_GetPersistentBinding. To support
  175. multiple types a new flag has been created to allow for multiple bindings
  176. supported */
  177. typedef enum HBA_fcpbindingtype { TO_D_ID, TO_WWN, TO_OTHER } HBA_FCPBINDINGTYPE;
  178. /* A bit mask of Rev 2.0 persistent binding capabilities */
  179. typedef HBA_UINT32 HBA_BIND_CAPABILITY;
  180. /* The following are bit flags indicating persistent binding capabilities */
  181. #define HBA_CAN_BIND_TO_D_ID 0x0001
  182. #define HBA_CAN_BIND_TO_WWPN 0x0002
  183. #define HBA_CAN_BIND_TO_WWNN 0x0004
  184. #define HBA_CAN_BIND_TO_LUID 0x0008
  185. #define HBA_CAN_BIND_ANY_LUNS 0x0400
  186. #define HBA_CAN_BIND_TARGETS 0x0800
  187. #define HBA_CAN_BIND_AUTOMAP 0x1000
  188. #define HBA_CAN_BIND_CONFIGURED 0x2000
  189. /* A bit mask of Rev 2.0 persistent binding setting types */
  190. typedef HBA_UINT32 HBA_BIND_TYPE;
  191. /* The following are bit flags indicating persistent binding setting types */
  192. #define HBA_BIND_TO_D_ID 0x0001
  193. #define HBA_BIND_TO_WWPN 0x0002
  194. #define HBA_BIND_TO_WWNN 0x0004
  195. #define HBA_BIND_TO_LUID 0x0008
  196. #define HBA_BIND_TARGETS 0x0800
  197. typedef struct HBA_LUID {
  198. char buffer[256];
  199. } HBA_LUID, *PHBA_LUID;
  200. typedef struct HBA_ScsiId {
  201. char OSDeviceName[256]; /* \device\ScsiPort3 */
  202. HBA_UINT32 ScsiBusNumber; /* Bus on the HBA */
  203. HBA_UINT32 ScsiTargetNumber; /* SCSI Target ID to OS */
  204. HBA_UINT32 ScsiOSLun;
  205. } HBA_SCSIID, *PHBA_SCSIID;
  206. typedef struct HBA_FcpId {
  207. HBA_UINT32 FcId;
  208. HBA_WWN NodeWWN;
  209. HBA_WWN PortWWN;
  210. HBA_UINT64 FcpLun;
  211. } HBA_FCPID, *PHBA_FCPID;
  212. typedef struct HBA_FcpScsiEntry {
  213. HBA_SCSIID ScsiId;
  214. HBA_FCPID FcpId;
  215. } HBA_FCPSCSIENTRY, *PHBA_FCPSCSIENTRY;
  216. typedef struct HBA_FcpScsiEntry2 {
  217. HBA_SCSIID ScsiId;
  218. HBA_FCPID FcpId;
  219. HBA_LUID Luid;
  220. } HBA_FCPSCSIENTRY2, *PHBA_FCPSCSIENTRY2;
  221. typedef struct HBA_FCPTargetMapping {
  222. HBA_UINT32 NumberOfEntries;
  223. HBA_FCPSCSIENTRY entry[1]; /* Variable length array containing mappings*/
  224. } HBA_FCPTARGETMAPPING, *PHBA_FCPTARGETMAPPING;
  225. typedef struct HBA_FCPTargetMapping2 {
  226. HBA_UINT32 NumberOfEntries;
  227. HBA_FCPSCSIENTRY2 entry[1]; /* Variable length array containing mappings*/
  228. } HBA_FCPTARGETMAPPING2, *PHBA_FCPTARGETMAPPING2;
  229. typedef struct HBA_FCPBindingEntry {
  230. HBA_FCPBINDINGTYPE type;
  231. HBA_SCSIID ScsiId;
  232. HBA_FCPID FcpId;
  233. HBA_UINT32 FcId;
  234. } HBA_FCPBINDINGENTRY, *PHBA_FCPBINDINGENTRY;
  235. typedef struct HBA_FCPBinding {
  236. HBA_UINT32 NumberOfEntries;
  237. HBA_FCPBINDINGENTRY entry[1]; /* Variable length array */
  238. } HBA_FCPBINDING, *PHBA_FCPBINDING;
  239. typedef struct HBA_FCPBindingEntry2 {
  240. HBA_BIND_TYPE type;
  241. HBA_SCSIID ScsiId;
  242. HBA_FCPID FcpId;
  243. HBA_LUID Luid;
  244. HBA_STATUS Status;
  245. } HBA_FCPBINDINGENTRY2, *PHBA_FCPBINDINGENTRY2;
  246. typedef struct HBA_FCPBinding2 {
  247. HBA_UINT32 NumberOfEntries;
  248. HBA_FCPBINDINGENTRY2 entry[1]; /* Variable length array */
  249. } HBA_FCPBINDING2, *PHBA_FCPBINDING2;
  250. typedef enum HBA_wwntype { NODE_WWN, PORT_WWN } HBA_WWNTYPE;
  251. typedef struct HBA_MgmtInfo {
  252. HBA_WWN wwn;
  253. HBA_UINT32 unittype;
  254. HBA_UINT32 PortId;
  255. HBA_UINT32 NumberOfAttachedNodes;
  256. HBA_UINT16 IPVersion;
  257. HBA_UINT16 UDPPort;
  258. HBA_UINT8 IPAddress[16];
  259. HBA_UINT16 reserved;
  260. HBA_UINT16 TopologyDiscoveryFlags;
  261. } HBA_MGMTINFO, *PHBA_MGMTINFO;
  262. #define HBA_EVENT_LIP_OCCURRED 1
  263. #define HBA_EVENT_LINK_UP 2
  264. #define HBA_EVENT_LINK_DOWN 3
  265. #define HBA_EVENT_LIP_RESET_OCCURRED 4
  266. #define HBA_EVENT_RSCN 5
  267. #define HBA_EVENT_PROPRIETARY 0xFFFF
  268. typedef struct HBA_Link_EventInfo {
  269. HBA_UINT32 PortFcId; /* Port which this event occurred */
  270. HBA_UINT32 Reserved[3];
  271. } HBA_LINK_EVENTINFO, *PHBA_LINK_EVENTINFO;
  272. typedef struct HBA_RSCN_EventInfo {
  273. HBA_UINT32 PortFcId; /* Port which this event occurred */
  274. HBA_UINT32 NPortPage; /* Reference FC-FS for RSCN ELS "Affected N-Port Pages"*/
  275. HBA_UINT32 Reserved[2];
  276. } HBA_RSCN_EVENTINFO, *PHBA_RSCN_EVENTINFO;
  277. typedef struct HBA_Pty_EventInfo {
  278. HBA_UINT32 PtyData[4]; /* Proprietary data */
  279. } HBA_PTY_EVENTINFO, *PHBA_PTY_EVENTINFO;
  280. typedef struct HBA_EventInfo {
  281. HBA_UINT32 EventCode;
  282. union {
  283. HBA_LINK_EVENTINFO Link_EventInfo;
  284. HBA_RSCN_EVENTINFO RSCN_EventInfo;
  285. HBA_PTY_EVENTINFO Pty_EventInfo;
  286. } Event;
  287. } HBA_EVENTINFO, *PHBA_EVENTINFO;
  288. typedef PVOID PHBA_ENTRYPOINTS;
  289. typedef PVOID PHBA_ENTRYPOINTSV2;
  290. HBA_STATUS HBA_API HBA_RegisterLibrary(PHBA_ENTRYPOINTS entrypoints);
  291. HBA_STATUS HBA_API HBA_RegisterLibraryV2(PHBA_ENTRYPOINTSV2 entrypoints);
  292. HBA_UINT32 HBA_API HBA_GetVersion();
  293. HBA_STATUS HBA_API HBA_LoadLibrary();
  294. HBA_STATUS HBA_API HBA_FreeLibrary();
  295. HBA_UINT32 HBA_API HBA_GetNumberOfAdapters();
  296. HBA_STATUS HBA_API
  297. HBA_GetAdapterName(
  298. IN HBA_UINT32 adapterindex,
  299. OUT char *adaptername
  300. );
  301. HBA_HANDLE HBA_API
  302. HBA_OpenAdapter(
  303. IN char* adaptername
  304. );
  305. void HBA_API HBA_CloseAdapter(
  306. IN HBA_HANDLE handle
  307. );
  308. HBA_STATUS HBA_API
  309. HBA_GetAdapterAttributes(
  310. IN HBA_HANDLE handle,
  311. OUT HBA_ADAPTERATTRIBUTES *hbaattributes
  312. );
  313. HBA_STATUS HBA_API HBA_GetAdapterPortAttributes(
  314. IN HBA_HANDLE handle,
  315. IN HBA_UINT32 portindex,
  316. OUT HBA_PORTATTRIBUTES *portattributes
  317. );
  318. HBA_STATUS HBA_API HBA_GetPortStatistics(
  319. HBA_HANDLE handle,
  320. HBA_UINT32 portindex,
  321. HBA_PORTSTATISTICS *portstatistics
  322. );
  323. HBA_STATUS HBA_API HBA_GetDiscoveredPortAttributes(
  324. HBA_HANDLE handle,
  325. HBA_UINT32 portindex,
  326. HBA_UINT32 discoveredportindex,
  327. HBA_PORTATTRIBUTES *portattributes
  328. );
  329. HBA_STATUS HBA_API HBA_GetPortAttributesByWWN(
  330. HBA_HANDLE handle,
  331. HBA_WWN PortWWN,
  332. HBA_PORTATTRIBUTES *portattributes
  333. );
  334. HBA_STATUS HBA_API HBA_SendCTPassThru(
  335. HBA_HANDLE handle,
  336. void * pReqBuffer,
  337. HBA_UINT32 ReqBufferSize,
  338. void * pRspBuffer,
  339. HBA_UINT32 RspBufferSize
  340. );
  341. HBA_STATUS HBA_API HBA_GetEventBuffer(
  342. HBA_HANDLE handle,
  343. PHBA_EVENTINFO EventBuffer,
  344. HBA_UINT32 *EventCount);
  345. HBA_STATUS HBA_API HBA_SetRNIDMgmtInfo(
  346. HBA_HANDLE handle,
  347. HBA_MGMTINFO *pInfo);
  348. HBA_STATUS HBA_API HBA_GetRNIDMgmtInfo(
  349. HBA_HANDLE handle,
  350. HBA_MGMTINFO *pInfo);
  351. HBA_STATUS HBA_API HBA_SendRNID(
  352. HBA_HANDLE handle,
  353. HBA_WWN wwn,
  354. HBA_WWNTYPE wnntype,
  355. void * pRspBuffer,
  356. HBA_UINT32 *RspBufferSize
  357. );
  358. HBA_STATUS HBA_API HBA_GetFcpTargetMapping (
  359. HBA_HANDLE handle,
  360. PHBA_FCPTARGETMAPPING mapping
  361. );
  362. HBA_STATUS HBA_API HBA_GetFcpPersistentBinding (
  363. HBA_HANDLE handle,
  364. PHBA_FCPBINDING binding
  365. );
  366. HBA_STATUS HBA_API HBA_SendScsiInquiry (
  367. HBA_HANDLE handle,
  368. HBA_WWN PortWWN,
  369. HBA_UINT64 fcLUN,
  370. HBA_UINT8 EVPD,
  371. HBA_UINT32 PageCode,
  372. void * pRspBuffer,
  373. HBA_UINT32 RspBufferSize,
  374. void * pSenseBuffer,
  375. HBA_UINT32 SenseBufferSize);
  376. HBA_STATUS HBA_API HBA_SendReportLUNs (
  377. HBA_HANDLE handle,
  378. HBA_WWN portWWN,
  379. void * pRspBuffer,
  380. HBA_UINT32 RspBufferSize,
  381. void * pSenseBuffer,
  382. HBA_UINT32 SenseBufferSize
  383. );
  384. HBA_STATUS HBA_API HBA_SendReadCapacity (
  385. HBA_HANDLE handle,
  386. HBA_WWN portWWN,
  387. HBA_UINT64 fcLUN,
  388. void * pRspBuffer,
  389. HBA_UINT32 RspBufferSize,
  390. void * pSenseBuffer,
  391. HBA_UINT32 SenseBufferSize
  392. );
  393. void HBA_API HBA_RefreshInformation(HBA_HANDLE handle);
  394. void HBA_API HBA_ResetStatistics(HBA_HANDLE handle, HBA_UINT32 portindex);
  395. typedef void *HBA_CALLBACKHANDLE;
  396. typedef HBA_CALLBACKHANDLE *PHBA_CALLBACKHANDLE;
  397. /* Adapter Level Events */
  398. #define HBA_EVENT_ADAPTER_UNKNOWN 0x100
  399. #define HBA_EVENT_ADAPTER_ADD 0x101
  400. #define HBA_EVENT_ADAPTER_REMOVE 0x102
  401. #define HBA_EVENT_ADAPTER_CHANGE 0x103
  402. /* Port Level Events */
  403. #define HBA_EVENT_PORT_UNKNOWN 0x200
  404. #define HBA_EVENT_PORT_OFFLINE 0x201
  405. #define HBA_EVENT_PORT_ONLINE 0x202
  406. #define HBA_EVENT_PORT_NEW_TARGETS 0x203
  407. #define HBA_EVENT_PORT_FABRIC 0x204
  408. /* Port Statistics Events */
  409. #define HBA_EVENT_PORT_STAT_THRESHOLD 0x301
  410. #define HBA_EVENT_PORT_STAT_GROWTH 0x302
  411. /* Target Level Events */
  412. #define HBA_EVENT_TARGET_UNKNOWN 0x400
  413. #define HBA_EVENT_TARGET_OFFLINE 0x401
  414. #define HBA_EVENT_TARGET_ONLINE 0x402
  415. #define HBA_EVENT_TARGET_REMOVED 0x403
  416. /* Fabric Link Events */
  417. #define HBA_EVENT_LINK_UNKNOWN 0x500
  418. #define HBA_EVENT_LINK_INCIDENT 0x501
  419. HBA_STATUS HBA_API HBA_RemoveCallback(
  420. HBA_CALLBACKHANDLE callbackHandle
  421. );
  422. HBA_STATUS HBA_API HBA_RegisterForAdapterAddEvents(
  423. void (*callback) (void *data, HBA_WWN PortWWN, HBA_UINT32 eventType),
  424. void *userData,
  425. HBA_CALLBACKHANDLE *callbackHandle
  426. );
  427. HBA_STATUS HBA_API HBA_RegisterForAdapterEvents(
  428. void (*callback) (void *data, HBA_WWN PortWWN, HBA_UINT32 eventType),
  429. void *userData,
  430. HBA_HANDLE handle,
  431. HBA_CALLBACKHANDLE *callbackHandle
  432. );
  433. HBA_STATUS HBA_API HBA_RegisterForAdapterPortEvents(
  434. void (*callback) (void *data, HBA_WWN PortWWN,
  435. HBA_UINT32 eventType, HBA_UINT32 fabricPortID),
  436. void *userData,
  437. HBA_HANDLE handle,
  438. HBA_WWN PortWWN,
  439. HBA_CALLBACKHANDLE *callbackHandle
  440. );
  441. HBA_STATUS HBA_API HBA_RegisterForAdapterPortStatEvents(
  442. void (*callback)(void *data, HBA_WWN PortWWN,
  443. HBA_UINT32 eventType),
  444. void *userData,
  445. HBA_HANDLE handle,
  446. HBA_WWN PortWWN,
  447. HBA_PORTSTATISTICS *stats,
  448. HBA_UINT32 statType,
  449. HBA_CALLBACKHANDLE *callbackHandle
  450. );
  451. HBA_STATUS HBA_API HBA_RegisterForTargetEvents(
  452. void (*callback)(void *data, HBA_WWN hbaPortWWN,
  453. HBA_WWN discoveredPortWWN, HBA_UINT32 eventType),
  454. void *userData,
  455. HBA_HANDLE handle,
  456. HBA_WWN hbaPortWWN,
  457. HBA_WWN discoveredPortWWN,
  458. HBA_CALLBACKHANDLE *callbackHandle,
  459. HBA_UINT32 allTargets
  460. );
  461. HBA_STATUS HBA_API HBA_RegisterForLinkEvents(
  462. void (*callback)(void *data, HBA_WWN adapterWWN, HBA_UINT32 eventType,
  463. void *pRLIRBuffer, HBA_UINT32 RLIRBufferSize),
  464. void *userData,
  465. void *pRLIRBuffer,
  466. HBA_UINT32 RLIRBufferSize,
  467. HBA_HANDLE handle,
  468. HBA_CALLBACKHANDLE *callbackHandle
  469. );
  470. HBA_STATUS HBA_API
  471. HBA_OpenAdapterByWWN(
  472. OUT HBA_HANDLE *HbaHandle,
  473. IN HBA_WWN Wwn
  474. );
  475. void HBA_API
  476. HBA_RefreshAdapterConfiguration(
  477. );
  478. HBA_STATUS HBA_API HBA_SendCTPassThruV2(
  479. HBA_HANDLE handle,
  480. HBA_WWN hbaPortWWN,
  481. void * pReqBuffer,
  482. HBA_UINT32 ReqBufferSize,
  483. void * pRspBuffer,
  484. HBA_UINT32 * pRspBufferSize
  485. );
  486. HBA_STATUS HBA_API
  487. HBA_SendRNIDV2(
  488. HBA_HANDLE handle,
  489. HBA_WWN hbaPortWWN,
  490. HBA_WWN destWWN,
  491. HBA_UINT32 destFCID,
  492. HBA_UINT32 NodeIdDataFormat,
  493. void *pRspBuffer,
  494. HBA_UINT32 *pRspBufferSize
  495. );
  496. HBA_STATUS HBA_API HBA_SendRPL(
  497. HBA_HANDLE handle,
  498. HBA_WWN hbaPortWWN,
  499. HBA_WWN agent_wwn,
  500. HBA_UINT32 agent_domain,
  501. HBA_UINT32 portIndex,
  502. void *pRspBuffer,
  503. HBA_UINT32 *RspBufferSize
  504. );
  505. HBA_STATUS HBA_API HBA_SendRPS(
  506. HBA_HANDLE handle,
  507. HBA_WWN hbaPortWWN,
  508. HBA_WWN agent_wwn,
  509. HBA_UINT32 agent_domain,
  510. HBA_WWN object_wwn,
  511. HBA_UINT32 object_port_number,
  512. void *pRspBuffer,
  513. HBA_UINT32 *RspBufferSize
  514. );
  515. HBA_STATUS HBA_API HBA_SendSRL(
  516. HBA_HANDLE handle,
  517. HBA_WWN hbaPortWWN,
  518. HBA_WWN wwn,
  519. HBA_UINT32 domain,
  520. void *pRspBuffer,
  521. HBA_UINT32 *RspBufferSize
  522. );
  523. HBA_STATUS HBA_API HBA_SendLIRR(
  524. HBA_HANDLE handle,
  525. HBA_WWN sourceWWN,
  526. HBA_WWN destWWN,
  527. HBA_UINT8 function,
  528. HBA_UINT8 type,
  529. void *pRspBuffer,
  530. HBA_UINT32 *RspBufferSize
  531. );
  532. typedef struct HBA_FC4Statistics {
  533. HBA_INT64 InputRequests;
  534. HBA_INT64 OutputRequests;
  535. HBA_INT64 ControlRequests;
  536. HBA_INT64 InputMegabytes;
  537. HBA_INT64 OutputMegabytes;
  538. } HBA_FC4STATISTICS, *PHBA_FC4STATISTICS;
  539. HBA_STATUS HBA_API HBA_GetFC4Statistics(
  540. HBA_HANDLE handle,
  541. HBA_WWN portWWN,
  542. HBA_UINT8 FC4type,
  543. HBA_FC4STATISTICS *statistics
  544. );
  545. HBA_STATUS HBA_API HBA_GetFCPStatistics(
  546. HBA_HANDLE handle,
  547. const HBA_SCSIID *lunit,
  548. HBA_FC4STATISTICS *statistics
  549. );
  550. typedef struct HBA_LibraryAttributes {
  551. HBA_BOOLEAN final;
  552. char LibPath[256];
  553. char VName[256];
  554. char VVersion[256];
  555. struct tm build_date;
  556. } HBA_LIBRARYATTRIBUTES, *PHBA_LIBRARYATTRIBUTES;
  557. HBA_UINT32 HBA_API
  558. HBA_GetWrapperLibraryAttributes(
  559. OUT HBA_LIBRARYATTRIBUTES *attributes
  560. );
  561. HBA_UINT32 HBA_API HBA_GetVendorLibraryAttributes(
  562. IN HBA_UINT32 adapter_index,
  563. OUT HBA_LIBRARYATTRIBUTES *attributes
  564. );
  565. HBA_STATUS HBA_API
  566. HBA_ScsiReadCapacityV2(
  567. HBA_HANDLE HbaHandle,
  568. HBA_WWN hbaPortWWN,
  569. HBA_WWN discoveredPortWWN,
  570. HBA_UINT64 fcLUN,
  571. void *pRespBuffer,
  572. HBA_UINT32 *pRespBufferSize,
  573. HBA_UINT8 *pScsiStatus,
  574. void *pSenseBuffer,
  575. HBA_UINT32 *pSenseBufferSize
  576. );
  577. HBA_STATUS HBA_API
  578. HBA_ScsiReportLUNsV2(
  579. HBA_HANDLE Hbahandle,
  580. HBA_WWN hbaPortWWN,
  581. HBA_WWN discoveredPortWWN,
  582. void *pRespBuffer,
  583. HBA_UINT32 *pRespBufferSize,
  584. HBA_UINT8 *pScsiStatus,
  585. void *pSenseBuffer,
  586. HBA_UINT32 *pSenseBufferSize
  587. );
  588. HBA_STATUS HBA_API
  589. HBA_ScsiInquiryV2 (
  590. HBA_HANDLE HbaHandle,
  591. HBA_WWN hbaPortWWN,
  592. HBA_WWN discoveredPortWWN,
  593. HBA_UINT64 fcLUN,
  594. HBA_UINT8 CDB_Byte1,
  595. HBA_UINT8 CDB_Byte2,
  596. void *pRespBuffer,
  597. HBA_UINT32 *pRespBufferSize,
  598. HBA_UINT8 *pScsiStatus,
  599. void *pSenseBuffer,
  600. HBA_UINT32 *pSenseBufferSize
  601. );
  602. HBA_STATUS HBA_API
  603. HBA_GetFcpTargetMappingV2 (
  604. HBA_HANDLE HbaHandle,
  605. HBA_WWN hbaPortWWN,
  606. PHBA_FCPTARGETMAPPING2 Mapping
  607. );
  608. #endif HBAAPI_H