1 /*
2  * *****************************************************************************
3  *
4  * Description
5  *	hbaapi.h - header file for Sun extension for target mode adaptor
6  * 		 support.
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  *******************************************************************************
21  */
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 
28 #ifndef _HBA_API_SUN_H
29 #define _HBA_API_SUN_H
30 
31 #include    <hbaapi.h>
32 
33 #define	HBA_CREATE_WWN_RANDOM		1
34 #define	HBA_CREATE_WWN_FACTORY		2
35 
36 typedef struct HBA_NPIVPortList {
37 	uint32_t	numPorts;
38 	char		hbaPaths[1][1024];
39 } HBA_NPIVPORTLIST, *PHBA_NPIVPORTLIST;
40 
41 typedef struct HBA_PortNPIVAttributes {
42 	HBA_INT32	npivflag;
43 	HBA_WWN		NodeWWN;
44 	HBA_WWN		PortWWN;
45 	HBA_UINT32	MaxNumberOfNPIVPorts;
46 	HBA_UINT32	NumberOfNPIVPorts;
47 } HBA_PORTNPIVATTRIBUTES, *PHBA_PORTNPIVATTRIBUTES;
48 
49 typedef struct HBA_NPIVAttributes {
50 	HBA_WWN		NodeWWN;
51 	HBA_WWN		PortWWN;
52 } HBA_NPIVATTRIBUTES, *PHBA_NPIVATTRIBUTES;
53 
54 typedef struct HBA_NPIVCreateEntry {
55 	HBA_WWN		VNodeWWN;
56 	HBA_WWN		VPortWWN;
57 	uint32_t	vindex;
58 } HBA_NPIVCREATEENTRY, *PHBA_NPIVCREATEENTRY;
59 
60 /* Device Level Events */
61 #define	HBA_EVENT_DEVICE_UNKNOWN	0x600
62 #define	HBA_EVENT_DEVICE_OFFLINE	0x601
63 #define	HBA_EVENT_DEVICE_ONLINE		0x602
64 
65 HBA_API HBA_UINT32 Sun_HBA_GetNumberOfTgtAdapters();
66 
67 HBA_API HBA_STATUS Sun_HBA_GetTgtAdapterName(
68     HBA_UINT32		adapterindex,
69     char		*adaptername
70     );
71 
72 HBA_API HBA_HANDLE Sun_HBA_OpenTgtAdapter(
73     char*		adaptername
74     );
75 
76 HBA_API HBA_STATUS Sun_HBA_OpenTgtAdapterByWWN(
77     HBA_HANDLE		*handle,
78     HBA_WWN		wwn
79     );
80 
81 HBA_API HBA_STATUS Sun_HBA_NPIVGetAdapterAttributes(
82     HBA_HANDLE		handle,
83     HBA_ADAPTERATTRIBUTES
84 			*hbaattributes
85     );
86 HBA_API HBA_STATUS Sun_HBA_GetNPIVPortInfo(
87     HBA_HANDLE		handle,
88     HBA_UINT32		portindex,
89     HBA_UINT32		vportindex,
90     HBA_NPIVATTRIBUTES	*attributes
91     );
92 HBA_API HBA_STATUS Sun_HBA_DeleteNPIVPort(
93     HBA_HANDLE		handle,
94     HBA_UINT32		portindex,
95     HBA_WWN		vportWWN
96     );
97 HBA_API HBA_STATUS Sun_HBA_CreateNPIVPort(
98     HBA_HANDLE		handle,
99     HBA_UINT32		portindex,
100     HBA_WWN		vnodeWWN,
101     HBA_WWN		vportWWN,
102     HBA_UINT32		*npivportindex
103     );
104 HBA_API HBA_STATUS Sun_HBA_GetPortNPIVAttributes(
105     HBA_HANDLE		handle,
106     HBA_UINT32		portindex,
107     HBA_PORTNPIVATTRIBUTES	*portnpivattributes
108     );
109 
110 HBA_STATUS Sun_HBA_AdapterCreateWWN(
111     HBA_HANDLE		handle,
112     HBA_UINT32		portindex,
113     HBA_WWN		*nwwn,
114     HBA_WWN		*pwwn,
115     HBA_WWN		*OUI,
116     HBA_INT32		method
117 );
118 
119 HBA_STATUS Sun_HBA_AdapterReturnWWN(
120     HBA_HANDLE		handle,
121     HBA_UINT32		portindex,
122     HBA_WWN		*nwwn,
123     HBA_WWN		*pwwn
124 );
125 
126 HBA_API HBA_STATUS Sun_HBA_RegisterForAdapterDeviceEvents(
127     void		(*callback)(
128 	void		*data,
129 	HBA_WWN		PortWWN,
130 	HBA_UINT32	eventType,
131 	HBA_UINT32	fabricPortID
132 	),
133     void		*userData,
134     HBA_HANDLE		handle,
135     HBA_WWN		PortWWN,
136     HBA_CALLBACKHANDLE	*callbackHandle
137     );
138 
139 
140 #endif /* HBA_API_SUN_H */
141 
142 #ifdef __cplusplus
143 }
144 #endif /* _HBA_API_SUN_H */
145