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