1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM *
4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM *
8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM * and limitations under the License.
12*7836SJohn.Forte@Sun.COM *
13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM *
19*7836SJohn.Forte@Sun.COM * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23*7836SJohn.Forte@Sun.COM * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM */
25*7836SJohn.Forte@Sun.COM
26*7836SJohn.Forte@Sun.COM #ifndef _SUN_FC_H
27*7836SJohn.Forte@Sun.COM #define _SUN_FC_H
28*7836SJohn.Forte@Sun.COM
29*7836SJohn.Forte@Sun.COM
30*7836SJohn.Forte@Sun.COM
31*7836SJohn.Forte@Sun.COM #include <hbaapi.h>
32*7836SJohn.Forte@Sun.COM #include <vendorhbaapi.h>
33*7836SJohn.Forte@Sun.COM
34*7836SJohn.Forte@Sun.COM #define HR_SECOND 1000000000
35*7836SJohn.Forte@Sun.COM
36*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
37*7836SJohn.Forte@Sun.COM extern "C" {
38*7836SJohn.Forte@Sun.COM #endif
39*7836SJohn.Forte@Sun.COM
40*7836SJohn.Forte@Sun.COM
41*7836SJohn.Forte@Sun.COM // Public External routines
42*7836SJohn.Forte@Sun.COM extern HBA_STATUS HBA_RegisterLibrary(PHBA_ENTRYPOINTS);
43*7836SJohn.Forte@Sun.COM extern HBA_UINT32 Sun_fcGetVersion();
44*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcLoadLibrary();
45*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcFreeLibrary();
46*7836SJohn.Forte@Sun.COM extern HBA_UINT32 Sun_fcGetNumberOfAdapters();
47*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetAdapterName(HBA_UINT32, char *);
48*7836SJohn.Forte@Sun.COM extern HBA_HANDLE Sun_fcOpenAdapter(char *);
49*7836SJohn.Forte@Sun.COM extern void Sun_fcCloseAdapter(HBA_HANDLE);
50*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetAdapterAttributes(HBA_HANDLE,
51*7836SJohn.Forte@Sun.COM PHBA_ADAPTERATTRIBUTES);
52*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetAdapterPortAttributes(HBA_HANDLE, HBA_UINT32,
53*7836SJohn.Forte@Sun.COM PHBA_PORTATTRIBUTES);
54*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetPortStatistics(HBA_HANDLE, HBA_UINT32,
55*7836SJohn.Forte@Sun.COM PHBA_PORTSTATISTICS);
56*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetDiscoveredPortAttributes(HBA_HANDLE, HBA_UINT32,
57*7836SJohn.Forte@Sun.COM HBA_UINT32, PHBA_PORTATTRIBUTES);
58*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetPortAttributesByWWN(HBA_HANDLE, HBA_WWN,
59*7836SJohn.Forte@Sun.COM PHBA_PORTATTRIBUTES);
60*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendCTPassThru(HBA_HANDLE, void *, HBA_UINT32, void *,
61*7836SJohn.Forte@Sun.COM HBA_UINT32);
62*7836SJohn.Forte@Sun.COM extern void Sun_fcRefreshInformation(HBA_HANDLE);
63*7836SJohn.Forte@Sun.COM extern void Sun_fcResetStatistics(HBA_HANDLE handle, HBA_UINT32 port);
64*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetFcpTargetMapping(HBA_HANDLE, PHBA_FCPTARGETMAPPING);
65*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetFcpPersistentBinding(HBA_HANDLE, PHBA_FCPBINDING);
66*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetEventBuffer(HBA_HANDLE, PHBA_EVENTINFO,
67*7836SJohn.Forte@Sun.COM HBA_UINT32 *);
68*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSetRNIDMgmtInfo(HBA_HANDLE, HBA_MGMTINFO);
69*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetRNIDMgmtInfo(HBA_HANDLE, PHBA_MGMTINFO);
70*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendRNID(HBA_HANDLE, HBA_WWN, HBA_WWNTYPE,
71*7836SJohn.Forte@Sun.COM void *, HBA_UINT32 *);
72*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendScsiInquiry(HBA_HANDLE, HBA_WWN, HBA_UINT64,
73*7836SJohn.Forte@Sun.COM HBA_UINT8, HBA_UINT32, void *, HBA_UINT32, void *, HBA_UINT32);
74*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendReportLUNs(HBA_HANDLE, HBA_WWN, void *, HBA_UINT32,
75*7836SJohn.Forte@Sun.COM void *, HBA_UINT32);
76*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendReadCapacity(HBA_HANDLE, HBA_WWN, HBA_UINT64,
77*7836SJohn.Forte@Sun.COM void *, HBA_UINT32, void *, HBA_UINT32);
78*7836SJohn.Forte@Sun.COM
79*7836SJohn.Forte@Sun.COM // V2 external routines
80*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcOpenAdapterByWWN(HBA_HANDLE *, HBA_WWN);
81*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetFcpTargetMappingV2(HBA_HANDLE, HBA_WWN,
82*7836SJohn.Forte@Sun.COM HBA_FCPTARGETMAPPINGV2 *);
83*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendCTPassThruV2(HBA_HANDLE, HBA_WWN, void *,
84*7836SJohn.Forte@Sun.COM HBA_UINT32, void *, HBA_UINT32 *);
85*7836SJohn.Forte@Sun.COM extern void Sun_fcRefreshAdapterConfiguration(void);
86*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetBindingCapability(HBA_HANDLE, HBA_WWN,
87*7836SJohn.Forte@Sun.COM HBA_BIND_CAPABILITY *);
88*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetBindingSupport(HBA_HANDLE, HBA_WWN,
89*7836SJohn.Forte@Sun.COM HBA_BIND_CAPABILITY *);
90*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSetBindingSupport(HBA_HANDLE, HBA_WWN,
91*7836SJohn.Forte@Sun.COM HBA_BIND_CAPABILITY);
92*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSetPersistentBindingV2(HBA_HANDLE, HBA_WWN,
93*7836SJohn.Forte@Sun.COM const HBA_FCPBINDING2 *);
94*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetPersistentBindingV2(HBA_HANDLE, HBA_WWN,
95*7836SJohn.Forte@Sun.COM HBA_FCPBINDING2 *);
96*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRemovePersistentBinding(HBA_HANDLE, HBA_WWN,
97*7836SJohn.Forte@Sun.COM const HBA_FCPBINDING2 *);
98*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRemoveAllPersistentBindings(HBA_HANDLE, HBA_WWN);
99*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendRNIDV2(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32,
100*7836SJohn.Forte@Sun.COM HBA_UINT32, void *, HBA_UINT32*);
101*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcScsiInquiryV2(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT64,
102*7836SJohn.Forte@Sun.COM HBA_UINT8, HBA_UINT8, void *, HBA_UINT32 *, HBA_UINT8 *, void *,
103*7836SJohn.Forte@Sun.COM HBA_UINT32 *);
104*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcScsiReportLUNsV2(HBA_HANDLE, HBA_WWN, HBA_WWN, void *,
105*7836SJohn.Forte@Sun.COM HBA_UINT32 *, HBA_UINT8 *, void *, HBA_UINT32 *);
106*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcScsiReadCapacityV2(HBA_HANDLE, HBA_WWN, HBA_WWN,
107*7836SJohn.Forte@Sun.COM HBA_UINT64, void *, HBA_UINT32 *, HBA_UINT8 *, void *, HBA_UINT32 *);
108*7836SJohn.Forte@Sun.COM extern HBA_UINT32 Sun_fcGetVendorLibraryAttributes(HBA_LIBRARYATTRIBUTES *);
109*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRemoveCallback(HBA_CALLBACKHANDLE);
110*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRegisterForAdapterAddEvents(void (*)(void *, HBA_WWN,
111*7836SJohn.Forte@Sun.COM HBA_UINT32), void *, HBA_CALLBACKHANDLE *);
112*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRegisterForAdapterEvents(void (*)(void *, HBA_WWN,
113*7836SJohn.Forte@Sun.COM HBA_UINT32), void *, HBA_HANDLE, HBA_CALLBACKHANDLE *);
114*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRegisterForAdapterPortEvents(void (*)(void *, HBA_WWN,
115*7836SJohn.Forte@Sun.COM HBA_UINT32, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN, HBA_CALLBACKHANDLE *);
116*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRegisterForAdapterPortStatEvents(void (*)(void *,
117*7836SJohn.Forte@Sun.COM HBA_WWN, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN,
118*7836SJohn.Forte@Sun.COM HBA_PORTSTATISTICS, HBA_UINT32, HBA_CALLBACKHANDLE *);
119*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRegisterForTargetEvents(void (*)(void *, HBA_WWN,
120*7836SJohn.Forte@Sun.COM HBA_WWN, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN, HBA_WWN,
121*7836SJohn.Forte@Sun.COM HBA_CALLBACKHANDLE *, HBA_UINT32);
122*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcRegisterForLinkEvents(void (*)(void *, HBA_WWN,
123*7836SJohn.Forte@Sun.COM HBA_UINT32, void *, HBA_UINT32), void *, void *, HBA_UINT32, HBA_HANDLE,
124*7836SJohn.Forte@Sun.COM HBA_CALLBACKHANDLE *);
125*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendRLS(HBA_HANDLE, HBA_WWN, HBA_WWN,
126*7836SJohn.Forte@Sun.COM void *, HBA_UINT32 *);
127*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendRPL(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32,
128*7836SJohn.Forte@Sun.COM HBA_UINT32, void *, HBA_UINT32 *);
129*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendRPS(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32,
130*7836SJohn.Forte@Sun.COM HBA_WWN, HBA_UINT32, void *, HBA_UINT32 *);
131*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendSRL(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT32,
132*7836SJohn.Forte@Sun.COM void *, HBA_UINT32 *);
133*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcSendLIRR(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_UINT8,
134*7836SJohn.Forte@Sun.COM HBA_UINT8, void *, HBA_UINT32 *);
135*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetFC4Statistics(HBA_HANDLE, HBA_WWN, HBA_UINT8,
136*7836SJohn.Forte@Sun.COM HBA_FC4STATISTICS *);
137*7836SJohn.Forte@Sun.COM extern HBA_STATUS Sun_fcGetFCPStatistics(HBA_HANDLE, const HBA_SCSIID *,
138*7836SJohn.Forte@Sun.COM HBA_FC4STATISTICS *);
139*7836SJohn.Forte@Sun.COM
140*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
141*7836SJohn.Forte@Sun.COM }
142*7836SJohn.Forte@Sun.COM #endif
143*7836SJohn.Forte@Sun.COM
144*7836SJohn.Forte@Sun.COM #include <sys/types.h>
145*7836SJohn.Forte@Sun.COM #include <netinet/in.h>
146*7836SJohn.Forte@Sun.COM #include <inttypes.h>
147*7836SJohn.Forte@Sun.COM #ifdef _BIG_ENDIAN
148*7836SJohn.Forte@Sun.COM #define htonll(x) (x)
149*7836SJohn.Forte@Sun.COM #define ntohll(x) (x)
150*7836SJohn.Forte@Sun.COM #else
151*7836SJohn.Forte@Sun.COM #define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl(x >> 32))
152*7836SJohn.Forte@Sun.COM #define ntohll(x) ((((uint64_t)ntohl(x)) << 32) + ntohl(x >> 32))
153*7836SJohn.Forte@Sun.COM #endif
154*7836SJohn.Forte@Sun.COM
155*7836SJohn.Forte@Sun.COM
156*7836SJohn.Forte@Sun.COM
157*7836SJohn.Forte@Sun.COM #include <string.h>
158*7836SJohn.Forte@Sun.COM inline u_longlong_t
wwnConversion(uchar_t * wwn)159*7836SJohn.Forte@Sun.COM wwnConversion(uchar_t *wwn) {
160*7836SJohn.Forte@Sun.COM u_longlong_t tmp;
161*7836SJohn.Forte@Sun.COM memcpy(&tmp, wwn, sizeof (u_longlong_t));
162*7836SJohn.Forte@Sun.COM return (ntohll(tmp));
163*7836SJohn.Forte@Sun.COM }
164*7836SJohn.Forte@Sun.COM
165*7836SJohn.Forte@Sun.COM #ifndef SCMD_REPORT_LUNS
166*7836SJohn.Forte@Sun.COM #define SCMD_REPORT_LUNS 0xA0
167*7836SJohn.Forte@Sun.COM #endif
168*7836SJohn.Forte@Sun.COM
169*7836SJohn.Forte@Sun.COM
170*7836SJohn.Forte@Sun.COM
171*7836SJohn.Forte@Sun.COM #endif /* _SUN_FC_H */
172