xref: /illumos-gate/usr/src/lib/hbaapi/common/hbaapi.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
1 /*
2  * *****************************************************************************
3  *
4  * Description
5  *	hbaapi.h - general header file for client
6  * 		 and library developers
7  *
8  * License:
9  *	The contents of this file are subject to the SNIA Public License
10  *	Version 1.0 (the "License"); you may not use this file except in
11  *	compliance with the License. You may obtain a copy of the License at
12  *
13  *	/http://www.snia.org/English/Resources/Code/OpenSource.html
14  *
15  *	Software distributed under the License is distributed on an "AS IS"
16  *	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  *	the License for the specific language governing rights and limitations
18  *	under the License.
19  *
20  * The Original Code is  SNIA HBA API general header file
21  *
22  * The Initial Developer of the Original Code is:
23  *	Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com)
24  *
25  * Contributor(s):
26  *	Tuan Lam, QLogic Corp. (t_lam@qlc.com)
27  *	Dan Willie, Emulex Corp. (Dan.Willie@emulex.com)
28  *	Dixon Hutchinson, Legato Systems, Inc. (dhutchin@legato.com)
29  *	David Dillard, VERITAS Software Corp. (david.dillard@veritas.com)
30  *
31  *******************************************************************************
32  *
33  *   Changes:
34  *	03/09/2000 Initial Draft
35  *	(for other changes... see the CVS logs)
36  *******************************************************************************
37  */
38 
39 /*
40  * Copyright 2020 RackTop Systems, Inc.
41  */
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 
48 #ifndef HBA_API_H
49 #define HBA_API_H
50 
51 /* Library version string */
52 #define HBA_LIBVERSION 2
53 
54 /* DLL imports for WIN32 operation */
55 #ifdef WIN32
56 #ifdef HBAAPI_EXPORTS
57 #define HBA_API __declspec(dllexport)
58 #else
59 #define HBA_API __declspec(dllimport)
60 #endif
61 #else
62 #define HBA_API
63 #endif
64 
65 /* OS specific definitions */
66 
67 #ifdef WIN32
68 typedef unsigned char	HBA_UINT8;	// Unsigned  8 bits
69 typedef		 char	HBA_INT8;	// Signed    8 bits
70 typedef unsigned short	HBA_UINT16;	// Unsigned 16 bits
71 typedef		 short	HBA_INT16;	// Signed   16 bits
72 typedef unsigned int	HBA_UINT32;	// Unsigned 32 bits
73 typedef		 int	HBA_INT32;	// Signed   32 bits
74 typedef void*		HBA_PVOID;	// Pointer  to void
75 typedef HBA_UINT32	HBA_VOID32;	// Opaque   32 bits
76 
77 
78 /* Don't confuse, _WIN32 with WIN32... OK, how do you accompish that */
79 #ifdef _WIN32
80 typedef			_int64		HBA_INT64;
81 typedef			unsigned _int64	HBA_UINT64;
82 #else
83 typedef struct {
84 	TN_UINT32	lo_val;
85 	TN_UINT32	hi_val;
86 } HBA_INT64;
87 
88 typedef struct {
89 	TN_UINT32	lo_val;
90 	TN_UINT32	hi_val;
91 } HBA_UINT64;
92 #endif	/*	#ifdef _WIN32	*/
93 
94 
95 #else
96 #include <time.h> /* Needed for struct tm */
97 
98 /* Note this section needs to be cleaned up for various Unix platforms */
99 typedef unsigned char	HBA_UINT8;	/* Unsigned  8 bits */
100 typedef		 char	HBA_INT8;	/* Signed    8 bits */
101 typedef unsigned short	HBA_UINT16;	/* Unsigned 16 bits */
102 typedef		 short	HBA_INT16;	/* Signed   16 bits */
103 typedef unsigned int	HBA_UINT32;	/* Unsigned 32 bits */
104 typedef		 int	HBA_INT32;	/* Signed   32 bits */
105 typedef void*		HBA_PVOID;	/* Pointer  to void */
106 typedef HBA_UINT32	HBA_VOID32;	/* Opaque   32 bits */
107 typedef long long	HBA_INT64;
108 typedef long long	HBA_UINT64;
109 
110 #endif  /*  #ifdef WIN32 */
111 
112 
113 /* 4.2.1	Handle to Device */
114 typedef HBA_UINT32	HBA_HANDLE;
115 
116 #define HBA_HANDLE_INVALID		0
117 
118 /* 4.2.2	Status Return Values */
119 typedef HBA_UINT32	HBA_STATUS;
120 
121 #define HBA_STATUS_OK			0
122 #define HBA_STATUS_ERROR		1   /* Error */
123 #define HBA_STATUS_ERROR_NOT_SUPPORTED	2   /* Function not supported.*/
124 #define HBA_STATUS_ERROR_INVALID_HANDLE	3   /* invalid handle */
125 #define HBA_STATUS_ERROR_ARG		4   /* Bad argument */
126 #define HBA_STATUS_ERROR_ILLEGAL_WWN	5   /* WWN not recognized */
127 #define HBA_STATUS_ERROR_ILLEGAL_INDEX	6   /* Index not recognized */
128 #define HBA_STATUS_ERROR_MORE_DATA	7   /* Larger buffer required */
129 #define HBA_STATUS_ERROR_STALE_DATA	8   /* Information has changed since
130 					     * last call to
131 					     * HBA_Refreshinformation */
132 #define HBA_STATUS_SCSI_CHECK_CONDITION	9   /* Obvious */
133 #define HBA_STATUS_ERROR_BUSY		10  /* Adapter busy or reserved,
134 					     * retry may be effective */
135 #define HBA_STATUS_ERROR_TRY_AGAIN	11  /* Request timedout,
136 					     * retry may be effective */
137 #define HBA_STATUS_ERROR_UNAVAILABLE	12  /* Referenced HBA has been removed
138 					     * or deactivated */
139 #define HBA_STATUS_ERROR_ELS_REJECT	13  /* The requested ELS was rejected by
140 					     * the local adapter */
141 #define HBA_STATUS_ERROR_INVALID_LUN	14  /* The specified LUN is not provided
142 					     *  the specified adapter */
143 #define HBA_STATUS_ERROR_INCOMPATIBLE	15  /* An incompatibility has been
144 				* detected among the library and driver modules
145 				* invoked which will cause one or more functions
146 				* in the highest version that all support to
147 				* operate incorrectly.  The differing function
148 				* sets of software modules implementing different
149 				* versions of the HBA API specification does not
150 				* in itself constitute an incompatibility.  Known
151 				* interoperability bugs among supposedly
152 				* compatible versions should be reported as
153 				* incompatibilities, but not all such
154 				* interoperability bugs may be known.  This value
155 				* may be returned by any function that calls a
156 				* Vendor Specific Library and returns an
157 				* HBA_STATUS, and by HBA_LoadLibrary and
158 				* HBA_GetAdapterName. */
159 
160 #define HBA_STATUS_ERROR_AMBIGUOUS_WWN	16  /* Multiple adapters have a matching
161 					     * WWN. This could occur if the
162 					     * NodeWWN of multiple adapters is
163 					     * identical */
164 #define HBA_STATUS_ERROR_LOCAL_BUS	17  /* A persistent binding request
165 					     * included a bad local SCSI bus
166 					     * number */
167 #define HBA_STATUS_ERROR_LOCAL_TARGET	18  /* A persistent binding request
168 					     * included a bad local SCSI target
169 					     * number */
170 #define HBA_STATUS_ERROR_LOCAL_LUN	19  /* A persistent binding request
171 					     * included a bad local SCSI logical
172 					     * unit number */
173 #define HBA_STATUS_ERROR_LOCAL_SCSIID_BOUND 20
174 					    /* A persistent binding set request
175 					     * included a local SCSI ID that was
176 					     * already bound */
177 #define HBA_STATUS_ERROR_TARGET_FCID	21  /* A persistent binding request
178 					     * included a bad or unlocatable FCP
179 					     * Target FCID */
180 #define HBA_STATUS_ERROR_TARGET_NODE_WWN 22 /* A persistent binding request
181 					     * included a bad FCP Target Node
182 					     * WWN */
183 #define HBA_STATUS_ERROR_TARGET_PORT_WWN 23 /* A persistent binding request
184 					     * included a bad FCP Target Port
185 					     * WWN */
186 #define HBA_STATUS_ERROR_TARGET_LUN	24  /* A persistent binding request
187 					     * included an FCP Logical Unit Number
188 					     * not defined by the identified
189 					     * Target*/
190 #define HBA_STATUS_ERROR_TARGET_LUID	25  /* A persistent binding request
191 					     * included an undefined or otherwise
192 					     * inaccessible Logical Unit Unique
193 					     * Identifier */
194 #define HBA_STATUS_ERROR_NO_SUCH_BINDING 26 /* A persistent binding remove request
195 					     * included a binding which did not
196 					     * match a binding established by the
197 					     * specified port */
198 #define HBA_STATUS_ERROR_NOT_A_TARGET	27  /* A SCSI command was requested to an
199 					     * Nx_Port that was not a SCSI
200 					     * Target Port */
201 #define HBA_STATUS_ERROR_UNSUPPORTED_FC4 28 /* A request was made concerning an
202 					     * unsupported FC-4 protocol */
203 
204 
205 #define HBA_STATUS_ERROR_INCAPABLE	29  /* A request was made to enable
206 					     * unimplemented capabilities for a
207 					     * port */
208 
209 /* 4.2.3	Port Operational Modes Values */
210 typedef HBA_UINT32 HBA_PORTTYPE;
211 
212 #define HBA_PORTTYPE_UNKNOWN		1   /* Unknown */
213 #define HBA_PORTTYPE_OTHER		2   /* Other */
214 #define HBA_PORTTYPE_NOTPRESENT		3   /* Not present */
215 #define HBA_PORTTYPE_NPORT		5   /* Fabric  */
216 #define HBA_PORTTYPE_NLPORT		6   /* Public Loop */
217 #define HBA_PORTTYPE_FLPORT		7
218 #define HBA_PORTTYPE_FPORT		8   /* Fabric Port */
219 #define HBA_PORTTYPE_EPORT		9   /* Fabric expansion port */
220 #define HBA_PORTTYPE_GPORT		10  /* Generic Fabric Port */
221 #define HBA_PORTTYPE_LPORT		20  /* Private Loop */
222 #define HBA_PORTTYPE_PTP		21  /* Point to Point */
223 
224 
225 typedef HBA_UINT32 HBA_PORTSTATE;
226 #define HBA_PORTSTATE_UNKNOWN		1   /* Unknown */
227 #define HBA_PORTSTATE_ONLINE		2   /* Operational */
228 #define HBA_PORTSTATE_OFFLINE		3   /* User Offline */
229 #define HBA_PORTSTATE_BYPASSED		4   /* Bypassed */
230 #define HBA_PORTSTATE_DIAGNOSTICS	5   /* In diagnostics mode */
231 #define HBA_PORTSTATE_LINKDOWN		6   /* Link Down */
232 #define HBA_PORTSTATE_ERROR		7   /* Port Error */
233 #define HBA_PORTSTATE_LOOPBACK		8   /* Loopback */
234 
235 
236 typedef HBA_UINT32 HBA_PORTSPEED;
237 #define HBA_PORTSPEED_UNKNOWN		0   /* Unknown - transceiver incable
238 					     * of reporting */
239 #define HBA_PORTSPEED_1GBIT		1   /* 1 GBit/sec */
240 #define HBA_PORTSPEED_2GBIT		2   /* 2 GBit/sec */
241 #define HBA_PORTSPEED_10GBIT		4   /* 10 GBit/sec */
242 #define HBA_PORTSPEED_4GBIT		8   /* 4 GBit/sec */
243 #define HBA_PORTSPEED_8GBIT		16  /* 8 GBit/sec */
244 #define HBA_PORTSPEED_16GBIT		32  /* 16 GBit/sec */
245 #define HBA_PORTSPEED_32GBIT		64  /* 32 GBit/sec */
246 #define HBA_PORTSPEED_NOT_NEGOTIATED	(1<<15)   /* Speed not established */
247 
248 
249 
250 /* 4.2.4	Class of Service Values - See GS-2 Spec.*/
251 
252 typedef HBA_UINT32 HBA_COS;
253 
254 
255 /* 4.2.5	Fc4Types Values */
256 
257 typedef struct HBA_fc4types {
258     HBA_UINT8 bits[32];		/* 32 bytes of FC-4 per GS-2 */
259 } HBA_FC4TYPES, *PHBA_FC4TYPES;
260 
261 /* 4.2.6	Basic Types */
262 
263 typedef struct HBA_wwn {
264     HBA_UINT8 wwn[8];
265 } HBA_WWN, *PHBA_WWN;
266 
267 typedef struct HBA_ipaddress {
268     int	ipversion;		/* see enumerations in RNID */
269     union
270     {
271 	unsigned char ipv4address[4];
272 	unsigned char ipv6address[16];
273     } ipaddress;
274 } HBA_IPADDRESS, *PHBA_IPADDRESS;
275 
276 typedef HBA_INT8	HBA_BOOLEAN;
277 
278 /* 4.2.7	Adapter Attributes */
279 typedef struct hba_AdapterAttributes {
280     char	Manufacturer[64];	/*Emulex */
281     char	SerialNumber[64];	/* A12345 */
282     char	Model[256];		/* QLA2200 */
283     char	ModelDescription[256];	/* Agilent TachLite */
284     HBA_WWN	NodeWWN;
285     char	NodeSymbolicName[256];	/* From GS-3 */
286     char	HardwareVersion[256];	/* Vendor use */
287     char	DriverVersion[256];	/* Vendor use */
288     char	OptionROMVersion[256];	/* Vendor use  - i.e. hardware boot ROM*/
289     char	FirmwareVersion[256];	/* Vendor use */
290     HBA_UINT32	VendorSpecificID;	/* Vendor specific */
291     HBA_UINT32	NumberOfPorts;
292     char	DriverName[256];	/* Binary path and/or name of driver
293 					 *file */
294 } HBA_ADAPTERATTRIBUTES, *PHBA_ADAPTERATTRIBUTES;
295 
296 /* 4.2.8	Port Attributes */
297 typedef struct HBA_PortAttributes {
298     HBA_WWN		NodeWWN;
299     HBA_WWN		PortWWN;
300     HBA_UINT32		PortFcId;
301     HBA_PORTTYPE	PortType;		/*PTP, Fabric, etc. */
302     HBA_PORTSTATE	PortState;
303     HBA_COS		PortSupportedClassofService;
304     HBA_FC4TYPES	PortSupportedFc4Types;
305     HBA_FC4TYPES	PortActiveFc4Types;
306     char		PortSymbolicName[256];
307     char		OSDeviceName[256];	/* \device\ScsiPort3  */
308     HBA_PORTSPEED	PortSupportedSpeed;
309     HBA_PORTSPEED	PortSpeed;
310     HBA_UINT32		PortMaxFrameSize;
311     HBA_WWN		FabricName;
312     HBA_UINT32		NumberofDiscoveredPorts;
313 } HBA_PORTATTRIBUTES, *PHBA_PORTATTRIBUTES;
314 
315 
316 
317 /* 4.2.9	Port Statistics */
318 
319 typedef struct HBA_PortStatistics {
320     HBA_INT64		SecondsSinceLastReset;
321     HBA_INT64		TxFrames;
322     HBA_INT64		TxWords;
323     HBA_INT64		RxFrames;
324     HBA_INT64		RxWords;
325     HBA_INT64		LIPCount;
326     HBA_INT64		NOSCount;
327     HBA_INT64		ErrorFrames;
328     HBA_INT64		DumpedFrames;
329     HBA_INT64		LinkFailureCount;
330     HBA_INT64		LossOfSyncCount;
331     HBA_INT64		LossOfSignalCount;
332     HBA_INT64		PrimitiveSeqProtocolErrCount;
333     HBA_INT64		InvalidTxWordCount;
334     HBA_INT64		InvalidCRCCount;
335 } HBA_PORTSTATISTICS, *PHBA_PORTSTATISTICS;
336 
337 
338 
339 /* 4.2.10		FCP Attributes */
340 
341 typedef enum HBA_fcpbindingtype { TO_D_ID, TO_WWN, TO_OTHER } HBA_FCPBINDINGTYPE;
342 
343 typedef struct HBA_ScsiId {
344     char		OSDeviceName[256];	/* \device\ScsiPort3  */
345     HBA_UINT32		ScsiBusNumber;		/* Bus on the HBA */
346     HBA_UINT32		ScsiTargetNumber;	/* SCSI Target ID to OS */
347     HBA_UINT32		ScsiOSLun;
348 } HBA_SCSIID, *PHBA_SCSIID;
349 
350 typedef struct HBA_FcpId {
351     HBA_UINT32		FcId;
352     HBA_WWN		NodeWWN;
353     HBA_WWN		PortWWN;
354     HBA_UINT64		FcpLun;
355 } HBA_FCPID, *PHBA_FCPID;
356 
357 typedef struct HBA_LUID {
358     char		buffer[256];	/* Unique Device Identifier */
359 } HBA_LUID, *PHBA_LUID;
360 
361 typedef struct HBA_FcpScsiEntry {
362     HBA_SCSIID		ScsiId;
363     HBA_FCPID		FcpId;
364 } HBA_FCPSCSIENTRY, *PHBA_FCPSCSIENTRY;
365 
366 typedef struct HBA_FcpScsiEntryV2 {
367     HBA_SCSIID		ScsiId;
368     HBA_FCPID		FcpId;
369     HBA_LUID		LUID;
370 } HBA_FCPSCSIENTRYV2, *PHBA_FCPSCSIENTRYV2;
371 
372 typedef struct HBA_FCPTargetMapping {
373     HBA_UINT32		NumberOfEntries;
374     HBA_FCPSCSIENTRY	entry[1];		/* Variable length array
375 						 * containing mappings */
376 } HBA_FCPTARGETMAPPING, *PHBA_FCPTARGETMAPPING;
377 
378 typedef struct HBA_FCPTargetMappingV2 {
379     HBA_UINT32		NumberOfEntries;
380     HBA_FCPSCSIENTRYV2	entry[1];		/* Variable length array
381 						 * containing mappings */
382 } HBA_FCPTARGETMAPPINGV2, *PHBA_FCPTARGETMAPPINGV2;
383 
384 typedef struct HBA_FCPBindingEntry {
385     HBA_FCPBINDINGTYPE	type;
386     HBA_SCSIID		ScsiId;
387     HBA_FCPID		FcpId;			/* WWN valid only if type is
388 						 * to WWN, FcpLun always valid */
389     HBA_UINT32		FcId;
390 } HBA_FCPBINDINGENTRY, *PHBA_FCPBINDINGENTRY;
391 
392 typedef struct HBA_FCPBinding {
393     HBA_UINT32		NumberOfEntries;
394     HBA_FCPBINDINGENTRY	entry[1];		/* Variable length array */
395 } HBA_FCPBINDING, *PHBA_FCPBINDING;
396 
397 /* 4.2.11	FC-3 Management Atrributes */
398 
399 typedef enum HBA_wwntype { NODE_WWN, PORT_WWN } HBA_WWNTYPE;
400 
401 typedef struct HBA_MgmtInfo {
402     HBA_WWN		wwn;
403     HBA_UINT32		unittype;
404     HBA_UINT32		PortId;
405     HBA_UINT32		NumberOfAttachedNodes;
406     HBA_UINT16		IPVersion;
407     HBA_UINT16		UDPPort;
408     HBA_UINT8		IPAddress[16];
409     HBA_UINT16		reserved;
410     HBA_UINT16		TopologyDiscoveryFlags;
411 } HBA_MGMTINFO, *PHBA_MGMTINFO;
412 
413 /* Event Codes */
414 #define HBA_EVENT_LIP_OCCURRED		1
415 #define HBA_EVENT_LINK_UP		2
416 #define HBA_EVENT_LINK_DOWN		3
417 #define HBA_EVENT_LIP_RESET_OCCURRED	4
418 #define HBA_EVENT_RSCN			5
419 #define HBA_EVENT_PROPRIETARY		0xFFFF
420 
421 typedef struct HBA_Link_EventInfo {
422     HBA_UINT32		PortFcId;		/* Port where event occurred */
423     HBA_UINT32		Reserved[3];
424 } HBA_LINK_EVENTINFO, *PHBA_LINK_EVENTINFO;
425 
426 typedef struct HBA_RSCN_EventInfo {
427     HBA_UINT32		PortFcId;		/* Port where event occurred */
428     HBA_UINT32		NPortPage;		/* Reference FC-FS for RSCN ELS
429 						 * "Affected N-Port Pages"*/
430     HBA_UINT32		Reserved[2];
431 } HBA_RSCN_EVENTINFO, *PHBA_RSCN_EVENTINFO;
432 
433 typedef struct HBA_Pty_EventInfo {
434     HBA_UINT32 PtyData[4];			/* Proprietary data */
435 } HBA_PTY_EVENTINFO, *PHBA_PTY_EVENTINFO;
436 
437 typedef struct HBA_EventInfo {
438     HBA_UINT32		EventCode;
439     union {
440 	HBA_LINK_EVENTINFO	Link_EventInfo;
441 	HBA_RSCN_EVENTINFO	RSCN_EventInfo;
442 	HBA_PTY_EVENTINFO	Pty_EventInfo;
443     }			Event;
444 } HBA_EVENTINFO, *PHBA_EVENTINFO;
445 
446 typedef struct HBA_LibraryAttributes {
447     HBA_BOOLEAN		final;
448     char		LibPath[256];
449     char		VName[256];
450     char		VVersion[256];
451     struct tm		build_date;
452 } HBA_LIBRARYATTRIBUTES, *PHBA_LIBRARYATTRIBUTES;
453 
454 /* Persistant Binding... */
455 typedef HBA_UINT32 HBA_BIND_TYPE;
456 #define HBA_BIND_TO_D_ID		0x0001
457 #define HBA_BIND_TO_WWPN		0x0002
458 #define HBA_BIND_TO_WWNN		0x0004
459 #define HBA_BIND_TO_LUID		0x0008
460 #define HBA_BIND_TARGETS		0x0800
461 
462 /* A bit mask of Rev 2.0 persistent binding capabilities */
463 typedef HBA_UINT32 HBA_BIND_CAPABILITY;
464 /* The following are bit flags indicating persistent binding capabilities */
465 #define HBA_CAN_BIND_TO_D_ID		0x0001
466 #define HBA_CAN_BIND_TO_WWPN		0x0002
467 #define HBA_CAN_BIND_TO_WWNN		0x0004
468 #define HBA_CAN_BIND_TO_LUID		0x0008
469 #define HBA_CAN_BIND_ANY_LUNS		0x0400
470 #define HBA_CAN_BIND_TARGETS		0x0800
471 #define HBA_CAN_BIND_AUTOMAP		0x1000
472 #define HBA_CAN_BIND_CONFIGURED		0x2000
473 
474 #define HBA_BIND_STATUS_DISABLED	0x00
475 #define HBA_BIND_STATUS_ENABLED		0x01
476 
477 typedef HBA_UINT32 HBA_BIND_STATUS;
478 
479 #define HBA_BIND_EFFECTIVE_AT_REBOOT	0x00
480 #define HBA_BIND_EFFECTIVE_IMMEDIATE	0x01
481 
482 typedef HBA_UINT32 HBA_BIND_EFFECTIVE;
483 
484 typedef struct HBA_FCPBindingEntry2 {
485     HBA_BIND_TYPE	type;
486     HBA_SCSIID		ScsiId;
487     HBA_FCPID		FcpId;
488     HBA_LUID		LUID;
489     HBA_STATUS		status;
490 } HBA_FCPBINDINGENTRY2, *PHBA_FCPBINDINGENTRY2;
491 
492 typedef struct HBA_FcpBinding2 {
493     HBA_UINT32		NumberOfEntries;
494     HBA_FCPBINDINGENTRY2
495 			entry[1];	/* Variable length array */
496 } HBA_FCPBINDING2, *PHBA_FCPBINDING2;
497 
498 /* FC-4 Instrumentation */
499 typedef struct HBA_FC4Statistics {
500     HBA_INT64		InputRequests;
501     HBA_INT64		OutputRequests;
502     HBA_INT64		ControlRequests;
503     HBA_INT64		InputMegabytes;
504     HBA_INT64		OutputMegabytes;
505 } HBA_FC4STATISTICS, *PHBA_FC4STATISTICS;
506 
507 
508 typedef void *	HBA_CALLBACKHANDLE;
509 /* Adapter Level Events */
510 #define HBA_EVENT_ADAPTER_UNKNOWN	0x100
511 #define HBA_EVENT_ADAPTER_ADD		0x101
512 #define HBA_EVENT_ADAPTER_REMOVE	0x102
513 #define HBA_EVENT_ADAPTER_CHANGE	0x103
514 
515 /* Port Level Events */
516 #define HBA_EVENT_PORT_UNKNOWN		0x200
517 #define HBA_EVENT_PORT_OFFLINE		0x201
518 #define HBA_EVENT_PORT_ONLINE		0x202
519 #define HBA_EVENT_PORT_NEW_TARGETS	0x203
520 #define HBA_EVENT_PORT_FABRIC		0x204
521 
522 /* Port Statistics Events */
523 #define HBA_EVENT_PORT_STAT_THRESHOLD	0x301
524 #define HBA_EVENT_PORT_STAT_GROWTH	0x302
525 
526 /* Target Level Events */
527 #define HBA_EVENT_TARGET_UNKNOWN	0x400
528 #define HBA_EVENT_TARGET_OFFLINE	0x401
529 #define HBA_EVENT_TARGET_ONLINE		0x402
530 #define HBA_EVENT_TARGET_REMOVED	0x403
531 
532 /* Fabric Link  Events */
533 #define HBA_EVENT_LINK_UNKNOWN		0x500
534 #define HBA_EVENT_LINK_INCIDENT		0x501
535 
536 HBA_API HBA_UINT32 HBA_GetVersion();
537 
538 /*
539  * Make sure HBA_LoadLibrary returns before any other threads
540  * make calls to the library
541  */
542 HBA_API HBA_STATUS HBA_LoadLibrary(void);
543 
544 HBA_API HBA_STATUS HBA_FreeLibrary(void);
545 
546 HBA_API HBA_UINT32 HBA_GetNumberOfAdapters(void);
547 
548 HBA_API HBA_STATUS HBA_GetAdapterName(
549     HBA_UINT32		adapterindex,
550     char		*adaptername
551     );
552 
553 HBA_API HBA_HANDLE HBA_OpenAdapter(
554     char*		adaptername
555     );
556 
557 HBA_API HBA_STATUS HBA_OpenAdapterByWWN(
558     HBA_HANDLE		*handle,
559     HBA_WWN		wwn
560     );
561 
562 HBA_API void HBA_CloseAdapter(
563     HBA_HANDLE		handle
564     );
565 
566 HBA_API HBA_STATUS HBA_GetAdapterAttributes(
567     HBA_HANDLE		handle,
568     HBA_ADAPTERATTRIBUTES
569 			*hbaattributes
570     );
571 
572 HBA_API HBA_STATUS HBA_GetAdapterPortAttributes(
573     HBA_HANDLE		handle,
574     HBA_UINT32		portindex,
575     HBA_PORTATTRIBUTES	*portattributes
576     );
577 
578 HBA_API HBA_STATUS HBA_GetPortStatistics(
579     HBA_HANDLE		handle,
580     HBA_UINT32		portindex,
581     HBA_PORTSTATISTICS	*portstatistics
582     );
583 
584 HBA_API HBA_STATUS HBA_GetDiscoveredPortAttributes(
585     HBA_HANDLE		handle,
586     HBA_UINT32		portindex,
587     HBA_UINT32		discoveredportindex,
588     HBA_PORTATTRIBUTES	*portattributes
589     );
590 
591 HBA_API HBA_STATUS HBA_GetPortAttributesByWWN(
592     HBA_HANDLE		handle,
593     HBA_WWN		PortWWN,
594     HBA_PORTATTRIBUTES	*portattributes
595     );
596 
597 HBA_API HBA_STATUS HBA_SendCTPassThruV2(
598     HBA_HANDLE		handle,
599     HBA_WWN		hbaPortWWN,
600     void		*pReqBuffer,
601     HBA_UINT32		ReqBufferSize,
602     void		*pRspBuffer,
603     HBA_UINT32		*pRspBufferSize
604     );
605 
606 /* Depricated, but supported */
607 HBA_API HBA_STATUS HBA_SendCTPassThru(
608     HBA_HANDLE		handle,
609     void		*pReqBuffer,
610     HBA_UINT32		ReqBufferSize,
611     void		*pRspBuffer,
612     HBA_UINT32		RspBufferSize
613     );
614 
615 HBA_API void HBA_RefreshAdapterConfiguration();
616 
617 HBA_API HBA_STATUS HBA_GetEventBuffer(
618     HBA_HANDLE		handle,
619     HBA_EVENTINFO	*EventBuffer,
620     HBA_UINT32		*EventBufferCount
621     );
622 
623 HBA_API HBA_STATUS HBA_SetRNIDMgmtInfo(
624     HBA_HANDLE		handle,
625     HBA_MGMTINFO	Info
626     );
627 
628 HBA_API HBA_STATUS HBA_GetRNIDMgmtInfo(
629     HBA_HANDLE		handle,
630     HBA_MGMTINFO	*pInfo
631     );
632 
633 HBA_API HBA_STATUS HBA_SendRNIDV2(
634     HBA_HANDLE		handle,
635     HBA_WWN		hbaPortWWN,
636     HBA_WWN		destWWN,
637     HBA_UINT32		destFCID,
638     HBA_UINT32		NodeIdDataFormat,
639     void		*pRspBuffer,
640     HBA_UINT32		*pRspBufferSize
641     );
642 
643 /* Depricated, but supported */
644 HBA_API HBA_STATUS HBA_SendRNID(
645     HBA_HANDLE		handle,
646     HBA_WWN		wwn,
647     HBA_WWNTYPE		wwntype,
648     void		*pRspBuffer,
649     HBA_UINT32		*pRspBufferSize
650     );
651 
652 HBA_API HBA_STATUS HBA_SendRLS (
653     HBA_HANDLE		handle,
654     HBA_WWN		hbaPortWWN,
655     HBA_WWN		destWWN,
656     void		*pRspBuffer,
657     HBA_UINT32		*pRspBufferSize
658     );
659 
660 HBA_API HBA_STATUS HBA_SendRPL (
661     HBA_HANDLE		handle,
662     HBA_WWN		hbaPortWWN,
663     HBA_WWN		agent_wwn,
664     HBA_UINT32		agent_domain,
665     HBA_UINT32		portindex,
666     void		*pRspBuffer,
667     HBA_UINT32		*pRspBufferSize
668     );
669 
670 HBA_API HBA_STATUS HBA_SendRPS (
671     HBA_HANDLE		handle,
672     HBA_WWN		hbaPortWWN,
673     HBA_WWN		agent_wwn,
674     HBA_UINT32		agent_domain,
675     HBA_WWN		object_wwn,
676     HBA_UINT32		object_port_number,
677     void		*pRspBuffer,
678     HBA_UINT32		*pRspBufferSize
679     );
680 
681 HBA_API HBA_STATUS HBA_SendSRL (
682     HBA_HANDLE		handle,
683     HBA_WWN		hbaPortWWN,
684     HBA_WWN		wwn,
685     HBA_UINT32		domain,
686     void		*pRspBuffer,
687     HBA_UINT32		*pRspBufferSize
688     );
689 
690 HBA_API HBA_STATUS HBA_SendLIRR (
691     HBA_HANDLE		handle,
692     HBA_WWN		sourceWWN,
693     HBA_WWN		destWWN,
694     HBA_UINT8		function,
695     HBA_UINT8		type,
696     void		*pRspBuffer,
697     HBA_UINT32		*pRspBufferSize
698     );
699 
700 
701 HBA_API HBA_STATUS HBA_GetFC4Statistics (
702     HBA_HANDLE		handle,
703     HBA_WWN		portWWN,
704     HBA_UINT8		FC4type,
705     HBA_FC4STATISTICS	*pstatistics
706     );
707 
708 HBA_API HBA_STATUS HBA_GetFCPStatistics (
709     HBA_HANDLE		handle,
710     const HBA_SCSIID	*lunit,
711     HBA_FC4STATISTICS	*pstatistics);
712 
713 HBA_API void HBA_RefreshInformation(
714     HBA_HANDLE		handle
715     );
716 
717 HBA_API void HBA_ResetStatistics(
718     HBA_HANDLE		handle,
719     HBA_UINT32		portindex
720     );
721 
722 HBA_API HBA_STATUS HBA_GetFcpTargetMapping(
723     HBA_HANDLE		handle,
724     HBA_FCPTARGETMAPPING
725 			*pmapping
726     );
727 
728 HBA_API HBA_STATUS HBA_GetFcpTargetMappingV2(
729     HBA_HANDLE		handle,
730     HBA_WWN		hbaPortWWN,
731     HBA_FCPTARGETMAPPINGV2
732 			*pmapping
733     );
734 
735 HBA_API HBA_STATUS HBA_GetBindingCapability(
736     HBA_HANDLE		handle,
737     HBA_WWN		hbaPortWWN,
738     HBA_BIND_CAPABILITY *pcapability
739     );
740 
741 HBA_API HBA_STATUS HBA_GetBindingSupport(
742     HBA_HANDLE		handle,
743     HBA_WWN		hbaPortWWN,
744     HBA_BIND_CAPABILITY *pcapability
745     );
746 
747 HBA_API HBA_STATUS HBA_SetBindingSupport(
748     HBA_HANDLE		handle,
749     HBA_WWN		hbaPortWWN,
750     HBA_BIND_CAPABILITY capability
751     );
752 
753 HBA_API HBA_STATUS HBA_SetPersistentBindingV2(
754     HBA_HANDLE		handle,
755     HBA_WWN		hbaPortWWN,
756     const HBA_FCPBINDING2
757 			*pbinding
758     );
759 
760 HBA_API HBA_STATUS HBA_GetPersistentBindingV2(
761     HBA_HANDLE		handle,
762     HBA_WWN		hbaPortWWN,
763     HBA_FCPBINDING2	*binding
764     );
765 
766 HBA_API HBA_STATUS HBA_RemovePersistentBinding(
767     HBA_HANDLE		handle,
768     HBA_WWN		hbaPortWWN,
769     const HBA_FCPBINDING2
770 			*pbinding
771     );
772 
773 /* Depricated, but supported */
774 HBA_API HBA_STATUS HBA_GetFcpPersistentBinding(
775     HBA_HANDLE		handle,
776     HBA_FCPBINDING	*binding
777     );
778 
779 HBA_API HBA_STATUS HBA_RemoveAllPersistentBindings(
780     HBA_HANDLE		handle,
781     HBA_WWN		hbaPortWWN
782     );
783 
784 HBA_STATUS HBA_ScsiInquiryV2 (
785     HBA_HANDLE		handle,
786     HBA_WWN		hbaPortWWN,
787     HBA_WWN		discoveredPortWWN,
788     HBA_UINT64		fcLUN,
789     HBA_UINT8		CDB_Byte1,
790     HBA_UINT8		CDB_BYte2,
791     void		*pRspBuffer,
792     HBA_UINT32		*pRspBufferSize,
793     HBA_UINT8		*pScsiStatus,
794     void		*pSenseBuffer,
795     HBA_UINT32		*pSenseBufferSize
796     );
797 
798 /* Depricated, but supported */
799 HBA_API HBA_STATUS HBA_SendScsiInquiry (
800     HBA_HANDLE		handle,
801     HBA_WWN		PortWWN,
802     HBA_UINT64		fcLUN,
803     HBA_UINT8		EVPD,
804     HBA_UINT32		PageCode,
805     void		*pRspBuffer,
806     HBA_UINT32		RspBufferSize,
807     void		*pSenseBuffer,
808     HBA_UINT32		SenseBufferSize
809     );
810 
811 HBA_API HBA_STATUS HBA_ScsiReportLUNsV2(
812     HBA_HANDLE		handle,
813     HBA_WWN		hbaPortWWN,
814     HBA_WWN		discoveredPortWWN,
815     void		*pRespBuffer,
816     HBA_UINT32		*pRespBufferSize,
817     HBA_UINT8		*pScsiStatus,
818     void		*pSenseBuffer,
819     HBA_UINT32		*pSenseBufferSize
820     );
821 
822 /* Depricated, but supported */
823 HBA_API HBA_STATUS HBA_SendReportLUNs (
824     HBA_HANDLE		handle,
825     HBA_WWN		portWWN,
826     void		*pRspBuffer,
827     HBA_UINT32		RspBufferSize,
828     void		*pSenseBuffer,
829     HBA_UINT32		SenseBufferSize
830     );
831 
832 HBA_API HBA_STATUS HBA_ScsiReadCapacityV2(
833     HBA_HANDLE		handle,
834     HBA_WWN		hbaPortWWN,
835     HBA_WWN		discoveredPortWWN,
836     HBA_UINT64		fcLUN,
837     void		*pRspBuffer,
838     HBA_UINT32		*pRspBufferSize,
839     HBA_UINT8		*pScsiStatus,
840     void		*pSenseBuffer,
841     HBA_UINT32		*SenseBufferSize
842     );
843 
844 /* Depricated, but supported */
845 HBA_API HBA_STATUS HBA_SendReadCapacity (
846     HBA_HANDLE		handle,
847     HBA_WWN		portWWN,
848     HBA_UINT64		fcLUN,
849     void		*pRspBuffer,
850     HBA_UINT32		RspBufferSize,
851     void		*pSenseBuffer,
852     HBA_UINT32		SenseBufferSize
853     );
854 
855 HBA_API HBA_UINT32 HBA_GetVendorLibraryAttributes (
856     HBA_UINT32		adapter_index,
857     HBA_LIBRARYATTRIBUTES
858 			*attributes
859     );
860 
861 HBA_API HBA_STATUS HBA_RemoveCallback(
862     HBA_CALLBACKHANDLE	callbackHandle
863     );
864 
865 HBA_API HBA_STATUS HBA_RegisterForAdapterAddEvents(
866     void		(*callback) (
867 	void		*data,
868 	HBA_WWN		PortWWN,
869 	HBA_UINT32	eventType
870 	),
871     void		*userData,
872     HBA_CALLBACKHANDLE *callbackHandle
873     );
874 
875 HBA_API HBA_STATUS HBA_RegisterForAdapterEvents(
876     void		(*callback)(
877 	void		*data,
878 	HBA_WWN		PortWWN,
879 	HBA_UINT32	eventType
880 	),
881     void		*userData,
882     HBA_HANDLE		handle,
883     HBA_CALLBACKHANDLE	*callbackHandle
884     );
885 
886 HBA_API HBA_STATUS HBA_RegisterForAdapterPortEvents(
887     void		(*callback)(
888 	void		*data,
889 	HBA_WWN		PortWWN,
890 	HBA_UINT32	eventType,
891 	HBA_UINT32	fabricPortID
892 	),
893     void		*userData,
894     HBA_HANDLE		handle,
895     HBA_WWN		PortWWN,
896     HBA_CALLBACKHANDLE *callbackHandle
897     );
898 
899 HBA_API HBA_STATUS HBA_RegisterForAdapterPortStatEvents(
900     void		(*callback)(
901 	void		*data,
902 	HBA_WWN		PortWWN,
903 	HBA_UINT32	eventType
904 	),
905     void		*userData,
906     HBA_HANDLE		handle,
907     HBA_WWN		PortWWN,
908     HBA_PORTSTATISTICS	stats,
909     HBA_UINT32		statType,
910     HBA_CALLBACKHANDLE	*callbackHandle
911     );
912 
913 
914 HBA_API HBA_STATUS HBA_RegisterForTargetEvents(
915     void		(*callback)(
916 	void		*data,
917 	HBA_WWN		hbaPortWWN,
918 	HBA_WWN		discoveredPortWWN,
919 	HBA_UINT32	eventType
920 	),
921     void		*userData,
922     HBA_HANDLE		handle,
923     HBA_WWN		hbaPortWWN,
924     HBA_WWN		discoveredPortWWN,
925     HBA_CALLBACKHANDLE	*callbackHandle,
926     HBA_UINT32		allTargets
927     );
928 
929 HBA_API HBA_STATUS HBA_RegisterForLinkEvents(
930     void		(*callback)
931     (
932 	void		*data,
933 	HBA_WWN		adapterWWN,
934 	HBA_UINT32	eventType,
935 	void		*pRLIRBuffer,
936 	HBA_UINT32	RLIRBufferSize
937 	),
938     void		*userData,
939     void		*pRLIRBuffer,
940     HBA_UINT32		RLIRBufferSize,
941     HBA_HANDLE		handle,
942     HBA_CALLBACKHANDLE	*callbackHandle
943 );
944 
945 /* Wrapper library specific entry points */
946 
947 HBA_API HBA_UINT32 HBA_GetWrapperLibraryAttributes (
948     HBA_LIBRARYATTRIBUTES
949 			*attributes
950 );
951 
952 #endif /* HBA_API_H */
953 
954 #ifdef __cplusplus
955 }
956 #endif
957 
958 
959