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