xref: /titanic_52/usr/src/lib/hbaapi/common/vendorhbaapi.h (revision bfed486ad8de8b8ebc6345a8e10accae08bf2f45)
1 /******************************************************************************
2  *
3  * Description
4  *	vendorhbaapi.h - incombination with hbaapi.h, defines interface to
5  *		vendor specific API
6  *
7  * License:
8  *	The contents of this file are subject to the SNIA Public License
9  *	Version 1.0 (the "License"); you may not use this file except in
10  *	compliance with the License. You may obtain a copy of the License at
11  *
12  *	/http://www.snia.org/English/Resources/Code/OpenSource.html
13  *
14  *	Software distributed under the License is distributed on an "AS IS"
15  *	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16  *	the License for the specific language governing rights and limitations
17  *	under the License.
18  *
19  * The Original Code is  SNIA HBA API general header file
20  *
21  * The Initial Developer of the Original Code is:
22  *	Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com)
23  *
24  * Contributor(s):
25  *	Tuan Lam, QLogic Corp. (t_lam@qlc.com)
26  *	Dan Willie, Emulex Corp. (Dan.Willie@emulex.com)
27  *	Dixon Hutchinson, Legato Systems, Inc. (dhutchin@legato.com)
28  *	David Dillard, VERITAS Software Corp. (david.dillard@veritas.com)
29  *
30  *******************************************************************************
31  *
32  *   Changes:
33  *	12/12/2001 Original revision, code split out of hbaapi.h
34  *	(for other changes... see the CVS logs)
35  ******************************************************************************/
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 
42 #ifndef VENDOR_HBA_API_H
43 #define VENDOR_HBA_API_H
44 
45 
46 /* 4.2.12 HBA Library Function Table */
47 typedef HBA_UINT32	(* HBAGetVersionFunc)();
48 typedef HBA_STATUS	(* HBALoadLibraryFunc)();
49 typedef HBA_STATUS	(* HBAFreeLibraryFunc)();
50 typedef HBA_UINT32	(* HBAGetNumberOfAdaptersFunc)();
51 typedef HBA_STATUS	(* HBAGetAdapterNameFunc)(HBA_UINT32, char *);
52 /*
53  * Open Adapter.... the vendor function is limmited to 16 bits,
54  * the wrapper library will mask off the upper 16.
55  * Maybe typedef should be:
56  * typedef HBA_UINT16	(* HBAOpenAdapterFunc)(char *);
57  */
58 typedef HBA_HANDLE	(* HBAOpenAdapterFunc)(char *);
59 typedef HBA_STATUS	(* HBAOpenAdapterByWWNFunc)
60     (HBA_HANDLE *, HBA_WWN);
61 typedef void		(* HBACloseAdapterFunc)(HBA_HANDLE);
62 typedef HBA_STATUS	(* HBAGetAdapterAttributesFunc)
63     (HBA_HANDLE, HBA_ADAPTERATTRIBUTES *);
64 typedef HBA_STATUS	(* HBAGetAdapterPortAttributesFunc)
65     (HBA_HANDLE, HBA_UINT32, HBA_PORTATTRIBUTES *);
66 typedef HBA_STATUS	(* HBAGetPortStatisticsFunc)
67     (HBA_HANDLE, HBA_UINT32, HBA_PORTSTATISTICS *);
68 typedef HBA_STATUS	(* HBAGetDiscoveredPortAttributesFunc)
69     (HBA_HANDLE, HBA_UINT32, HBA_UINT32, HBA_PORTATTRIBUTES *);
70 typedef HBA_STATUS	(* HBAGetPortAttributesByWWNFunc)
71     (HBA_HANDLE, HBA_WWN, HBA_PORTATTRIBUTES *);
72 typedef HBA_STATUS	(* HBASendCTPassThruV2Func)
73     (HBA_HANDLE, HBA_WWN, void *, HBA_UINT32, void *, HBA_UINT32 *);
74 typedef void		(* HBARefreshInformationFunc)(HBA_HANDLE);
75 typedef void		(* HBARefreshAdapterConfigurationFunc) ();
76 typedef void		(* HBAResetStatisticsFunc)(HBA_HANDLE, HBA_UINT32);
77 typedef HBA_STATUS	(* HBAGetFcpTargetMappingV2Func)
78     (HBA_HANDLE, HBA_WWN, HBA_FCPTARGETMAPPINGV2 *);
79 typedef HBA_STATUS	(* HBAGetBindingCapabilityFunc)
80     (HBA_HANDLE, HBA_WWN, HBA_BIND_CAPABILITY *);
81 typedef HBA_STATUS	(* HBAGetBindingSupportFunc)
82     (HBA_HANDLE, HBA_WWN, HBA_BIND_CAPABILITY *);
83 typedef HBA_STATUS	(* HBASetBindingSupportFunc)
84     (HBA_HANDLE, HBA_WWN, HBA_BIND_CAPABILITY);
85 typedef HBA_STATUS	(* HBASetPersistentBindingV2Func)
86     (HBA_HANDLE, HBA_WWN, const HBA_FCPBINDING2 *);
87 typedef HBA_STATUS	(* HBAGetPersistentBindingV2Func)
88     (HBA_HANDLE, HBA_WWN, HBA_FCPBINDING2 *);
89 typedef HBA_STATUS	(* HBARemovePersistentBindingFunc)
90     (HBA_HANDLE, HBA_WWN, const HBA_FCPBINDING2 *);
91 typedef HBA_STATUS	(* HBARemoveAllPersistentBindingsFunc)
92     (HBA_HANDLE, HBA_WWN);
93 typedef HBA_STATUS	(* HBAGetEventBufferFunc)
94     (HBA_HANDLE, HBA_EVENTINFO *, HBA_UINT32 *);
95 typedef HBA_STATUS	(* HBASetRNIDMgmtInfoFunc)
96     (HBA_HANDLE, HBA_MGMTINFO);
97 typedef HBA_STATUS	(* HBAGetRNIDMgmtInfoFunc)
98     (HBA_HANDLE, HBA_MGMTINFO *);
99 typedef HBA_STATUS	(* HBASendRNIDV2Func)
100     (HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32, HBA_UINT32, void *, HBA_UINT32*);
101 typedef HBA_STATUS	(* HBAScsiInquiryV2Func)
102     (HBA_HANDLE,HBA_WWN,HBA_WWN, HBA_UINT64, HBA_UINT8, HBA_UINT8,
103      void *, HBA_UINT32 *, HBA_UINT8 *, void *, HBA_UINT32 *);
104 typedef HBA_STATUS	(* HBAScsiReportLUNsV2Func)
105     (HBA_HANDLE, HBA_WWN, HBA_WWN, void *, HBA_UINT32 *, HBA_UINT8 *,
106      void *, HBA_UINT32 *);
107 typedef HBA_STATUS	(* HBAScsiReadCapacityV2Func)
108     (HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT64, void *, HBA_UINT32 *,
109      HBA_UINT8 *, void *, HBA_UINT32 *);
110 typedef HBA_UINT32	(* HBAGetVendorLibraryAttributesFunc)
111     (HBA_LIBRARYATTRIBUTES *);
112 typedef HBA_STATUS	(* HBARemoveCallbackFunc) (HBA_CALLBACKHANDLE);
113 typedef HBA_STATUS	(* HBARegisterForAdapterAddEventsFunc)
114     (void (*)(void *, HBA_WWN, HBA_UINT32), void *, HBA_CALLBACKHANDLE *);
115 typedef HBA_STATUS	(* HBARegisterForAdapterEventsFunc)
116     (void (*)(void *, HBA_WWN, HBA_UINT32), void *, HBA_HANDLE,
117      HBA_CALLBACKHANDLE *);
118 typedef HBA_STATUS	(* HBARegisterForAdapterPortEventsFunc)
119     (void (*)(void *, HBA_WWN, HBA_UINT32, HBA_UINT32), void *, HBA_HANDLE,
120      HBA_WWN, HBA_CALLBACKHANDLE *);
121 typedef HBA_STATUS	(* HBARegisterForAdapterPortStatEventsFunc)
122     (void (*)(void *, HBA_WWN, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN,
123      HBA_PORTSTATISTICS, HBA_UINT32, HBA_CALLBACKHANDLE *);
124 typedef HBA_STATUS	(* HBARegisterForTargetEventsFunc)
125     (void (*)(void *, HBA_WWN, HBA_WWN, HBA_UINT32), void *, HBA_HANDLE,
126      HBA_WWN, HBA_WWN, HBA_CALLBACKHANDLE *,
127      HBA_UINT32 );
128 typedef HBA_STATUS	(* HBARegisterForLinkEventsFunc)
129     (void (*)(void *, HBA_WWN, HBA_UINT32, void *, HBA_UINT32), void *, void *,
130      HBA_UINT32, HBA_HANDLE, HBA_CALLBACKHANDLE *);
131 typedef HBA_STATUS	(* HBASendRPLFunc)
132     (HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32, HBA_UINT32, void *, HBA_UINT32 *);
133 typedef HBA_STATUS	(* HBASendRPSFunc)
134     (HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32, HBA_WWN, HBA_UINT32, void *,
135      HBA_UINT32 *);
136 typedef HBA_STATUS	(* HBASendSRLFunc)
137     (HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32, void *, HBA_UINT32 *);
138 typedef HBA_STATUS	(* HBASendLIRRFunc)
139     (HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT8, HBA_UINT8, void *, HBA_UINT32 *);
140 typedef HBA_STATUS	(* HBAGetFC4StatisticsFunc)
141     (HBA_HANDLE, HBA_WWN, HBA_UINT8, HBA_FC4STATISTICS *);
142 typedef HBA_STATUS	(* HBAGetFCPStatisticsFunc)
143     (HBA_HANDLE, const HBA_SCSIID *, HBA_FC4STATISTICS *);
144 typedef HBA_STATUS	(* HBASendRLSFunc)
145     (HBA_HANDLE, HBA_WWN, HBA_WWN, void *, HBA_UINT32 *);
146 
147 
148 /* Deprecated, but still supported functions */
149 typedef HBA_STATUS	(* HBAGetFcpTargetMappingFunc)
150     (HBA_HANDLE, HBA_FCPTARGETMAPPING *);
151 typedef HBA_STATUS	(* HBAGetFcpPersistentBindingFunc)
152     (HBA_HANDLE, HBA_FCPBINDING *);
153 typedef HBA_STATUS	(* HBASendCTPassThruFunc)
154     (HBA_HANDLE, void *, HBA_UINT32, void *, HBA_UINT32);
155 typedef HBA_STATUS	(* HBASendScsiInquiryFunc)
156     (HBA_HANDLE, HBA_WWN,HBA_UINT64, HBA_UINT8, HBA_UINT32, void *,
157      HBA_UINT32, void *, HBA_UINT32);
158 typedef HBA_STATUS	(* HBASendReportLUNsFunc)
159     (HBA_HANDLE, HBA_WWN, void *, HBA_UINT32, void *, HBA_UINT32);
160 typedef HBA_STATUS	(* HBASendReadCapacityFunc)
161     (HBA_HANDLE, HBA_WWN, HBA_UINT64, void *, HBA_UINT32, void *,
162      HBA_UINT32);
163 typedef HBA_STATUS	(* HBASendRNIDFunc)
164     (HBA_HANDLE, HBA_WWN, HBA_WWNTYPE, void *, HBA_UINT32 *);
165 
166 /*
167  * This structure is needed since a Rev2 vendor library must still implement the
168  * Rev1 Register function in case it is called by a Rev1 wapper library.  Still
169  * not STRICTLY neccesary, it provides clarity and keeps compilers happier
170  */
171 typedef struct HBA_EntryPoints {
172     HBAGetVersionFunc			GetVersionHandler;
173     HBALoadLibraryFunc			LoadLibraryHandler;
174     HBAFreeLibraryFunc			FreeLibraryHandler;
175     HBAGetNumberOfAdaptersFunc		GetNumberOfAdaptersHandler;
176     HBAGetAdapterNameFunc		GetAdapterNameHandler;
177     HBAOpenAdapterFunc			OpenAdapterHandler;
178     HBACloseAdapterFunc			CloseAdapterHandler;
179     HBAGetAdapterAttributesFunc		GetAdapterAttributesHandler;
180     HBAGetAdapterPortAttributesFunc	GetAdapterPortAttributesHandler;
181     HBAGetPortStatisticsFunc		GetPortStatisticsHandler;
182     HBAGetDiscoveredPortAttributesFunc	GetDiscoveredPortAttributesHandler;
183     HBAGetPortAttributesByWWNFunc	GetPortAttributesByWWNHandler;
184     HBASendCTPassThruFunc		SendCTPassThruHandler;
185     HBARefreshInformationFunc		RefreshInformationHandler;
186     HBAResetStatisticsFunc		ResetStatisticsHandler;
187     HBAGetFcpTargetMappingFunc		GetFcpTargetMappingHandler;
188     HBAGetFcpPersistentBindingFunc	GetFcpPersistentBindingHandler;
189     HBAGetEventBufferFunc		GetEventBufferHandler;
190     HBASetRNIDMgmtInfoFunc		SetRNIDMgmtInfoHandler;
191     HBAGetRNIDMgmtInfoFunc		GetRNIDMgmtInfoHandler;
192     HBASendRNIDFunc			SendRNIDHandler;
193     HBASendScsiInquiryFunc		ScsiInquiryHandler;
194     HBASendReportLUNsFunc		ReportLUNsHandler;
195     HBASendReadCapacityFunc		ReadCapacityHandler;
196 } HBA_ENTRYPOINTS, *PHBA_ENTRYPOINTS;
197 
198 typedef struct HBA_EntryPointsV2 {
199     /* These first elements MUST MUST MUST match HBA_ENTRYPOINTS */
200     HBAGetVersionFunc			GetVersionHandler;
201     HBALoadLibraryFunc			LoadLibraryHandler;
202     HBAFreeLibraryFunc			FreeLibraryHandler;
203     HBAGetNumberOfAdaptersFunc		GetNumberOfAdaptersHandler;
204     HBAGetAdapterNameFunc		GetAdapterNameHandler;
205     HBAOpenAdapterFunc			OpenAdapterHandler;
206     HBACloseAdapterFunc			CloseAdapterHandler;
207     HBAGetAdapterAttributesFunc		GetAdapterAttributesHandler;
208     HBAGetAdapterPortAttributesFunc	GetAdapterPortAttributesHandler;
209     HBAGetPortStatisticsFunc		GetPortStatisticsHandler;
210     HBAGetDiscoveredPortAttributesFunc	GetDiscoveredPortAttributesHandler;
211     HBAGetPortAttributesByWWNFunc	GetPortAttributesByWWNHandler;
212     /* Next function depricated but still supported */
213     HBASendCTPassThruFunc		SendCTPassThruHandler;
214     HBARefreshInformationFunc		RefreshInformationHandler;
215     HBAResetStatisticsFunc		ResetStatisticsHandler;
216     /* Next function depricated but still supported */
217     HBAGetFcpTargetMappingFunc		GetFcpTargetMappingHandler;
218     /* Next function depricated but still supported */
219     HBAGetFcpPersistentBindingFunc	GetFcpPersistentBindingHandler;
220     HBAGetEventBufferFunc		GetEventBufferHandler;
221     HBASetRNIDMgmtInfoFunc		SetRNIDMgmtInfoHandler;
222     HBAGetRNIDMgmtInfoFunc		GetRNIDMgmtInfoHandler;
223     /* Next function depricated but still supported */
224     HBASendRNIDFunc			SendRNIDHandler;
225     /* Next function depricated but still supported */
226     HBASendScsiInquiryFunc		ScsiInquiryHandler;
227     /* Next function depricated but still supported */
228     HBASendReportLUNsFunc		ReportLUNsHandler;
229     /* Next function depricated but still supported */
230     HBASendReadCapacityFunc		ReadCapacityHandler;
231 
232     /* Rev 2 Functions */
233     HBAOpenAdapterByWWNFunc		OpenAdapterByWWNHandler;
234     HBAGetFcpTargetMappingV2Func	GetFcpTargetMappingV2Handler;
235     HBASendCTPassThruV2Func		SendCTPassThruV2Handler;
236     HBARefreshAdapterConfigurationFunc	RefreshAdapterConfigurationHandler;
237     HBAGetBindingCapabilityFunc		GetBindingCapabilityHandler;
238     HBAGetBindingSupportFunc		GetBindingSupportHandler;
239     HBASetBindingSupportFunc		SetBindingSupportHandler;
240     HBASetPersistentBindingV2Func	SetPersistentBindingV2Handler;
241     HBAGetPersistentBindingV2Func	GetPersistentBindingV2Handler;
242     HBARemovePersistentBindingFunc	RemovePersistentBindingHandler;
243     HBARemoveAllPersistentBindingsFunc	RemoveAllPersistentBindingsHandler;
244     HBASendRNIDV2Func			SendRNIDV2Handler;
245     HBAScsiInquiryV2Func		ScsiInquiryV2Handler;
246     HBAScsiReportLUNsV2Func		ScsiReportLUNsV2Handler;
247     HBAScsiReadCapacityV2Func		ScsiReadCapacityV2Handler;
248     HBAGetVendorLibraryAttributesFunc	GetVendorLibraryAttributesHandler;
249     HBARemoveCallbackFunc		RemoveCallbackHandler;
250     HBARegisterForAdapterAddEventsFunc	RegisterForAdapterAddEventsHandler;
251     HBARegisterForAdapterEventsFunc	RegisterForAdapterEventsHandler;
252     HBARegisterForAdapterPortEventsFunc RegisterForAdapterPortEventsHandler;
253     HBARegisterForAdapterPortStatEventsFunc
254 					RegisterForAdapterPortStatEventsHandler;
255     HBARegisterForTargetEventsFunc	RegisterForTargetEventsHandler;
256     HBARegisterForLinkEventsFunc	RegisterForLinkEventsHandler;
257     HBASendRPLFunc			SendRPLHandler;
258     HBASendRPSFunc			SendRPSHandler;
259     HBASendSRLFunc			SendSRLHandler;
260     HBASendLIRRFunc			SendLIRRHandler;
261     HBAGetFC4StatisticsFunc		GetFC4StatisticsHandler;
262     HBAGetFCPStatisticsFunc		GetFCPStatisticsHandler;
263     HBASendRLSFunc			SendRLSHandler;
264 } HBA_ENTRYPOINTSV2, *PHBA_ENTRYPOINTSV2;
265 
266 typedef HBA_STATUS	(* HBARegisterLibraryFunc)(HBA_ENTRYPOINTS *);
267 typedef HBA_STATUS	(* HBARegisterLibraryV2Func)(HBA_ENTRYPOINTSV2 *);
268 
269 /* Function Prototypes */
270 HBA_API HBA_STATUS HBA_RegisterLibrary(
271     HBA_ENTRYPOINTS	*functionTable
272     );
273 
274 HBA_API HBA_STATUS HBA_RegisterLibraryV2(
275     HBA_ENTRYPOINTSV2	*functionTable
276     );
277 
278 #endif /* VENDOR_HBA_API_H */
279 
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 
285