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