xref: /onnv-gate/usr/src/lib/sun_sas/common/sun_sas.h (revision 10652:9d0aff74d6fd)
1*10652SHyon.Kim@Sun.COM /*
2*10652SHyon.Kim@Sun.COM  * CDDL HEADER START
3*10652SHyon.Kim@Sun.COM  *
4*10652SHyon.Kim@Sun.COM  * The contents of this file are subject to the terms of the
5*10652SHyon.Kim@Sun.COM  * Common Development and Distribution License (the "License").
6*10652SHyon.Kim@Sun.COM  * You may not use this file except in compliance with the License.
7*10652SHyon.Kim@Sun.COM  *
8*10652SHyon.Kim@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*10652SHyon.Kim@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*10652SHyon.Kim@Sun.COM  * See the License for the specific language governing permissions
11*10652SHyon.Kim@Sun.COM  * and limitations under the License.
12*10652SHyon.Kim@Sun.COM  *
13*10652SHyon.Kim@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*10652SHyon.Kim@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*10652SHyon.Kim@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*10652SHyon.Kim@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*10652SHyon.Kim@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*10652SHyon.Kim@Sun.COM  *
19*10652SHyon.Kim@Sun.COM  * CDDL HEADER END
20*10652SHyon.Kim@Sun.COM  */
21*10652SHyon.Kim@Sun.COM 
22*10652SHyon.Kim@Sun.COM /*
23*10652SHyon.Kim@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*10652SHyon.Kim@Sun.COM  * Use is subject to license terms.
25*10652SHyon.Kim@Sun.COM  */
26*10652SHyon.Kim@Sun.COM 
27*10652SHyon.Kim@Sun.COM 
28*10652SHyon.Kim@Sun.COM #ifndef	_SUN_SAS_H
29*10652SHyon.Kim@Sun.COM #define	_SUN_SAS_H
30*10652SHyon.Kim@Sun.COM 
31*10652SHyon.Kim@Sun.COM #ifdef	__cplusplus
32*10652SHyon.Kim@Sun.COM extern "C" {
33*10652SHyon.Kim@Sun.COM #endif
34*10652SHyon.Kim@Sun.COM 
35*10652SHyon.Kim@Sun.COM #include <smhbaapi.h>
36*10652SHyon.Kim@Sun.COM #include <vendorsmhbaapi.h>
37*10652SHyon.Kim@Sun.COM #include <sys/types.h>
38*10652SHyon.Kim@Sun.COM #include <sys/stat.h>
39*10652SHyon.Kim@Sun.COM #include <sys/param.h>
40*10652SHyon.Kim@Sun.COM #include <dirent.h>
41*10652SHyon.Kim@Sun.COM #include <fcntl.h>
42*10652SHyon.Kim@Sun.COM #include <stdio.h>
43*10652SHyon.Kim@Sun.COM #include <stdlib.h>
44*10652SHyon.Kim@Sun.COM #include <strings.h>
45*10652SHyon.Kim@Sun.COM #include <string.h>
46*10652SHyon.Kim@Sun.COM #include <limits.h>
47*10652SHyon.Kim@Sun.COM #include <syslog.h>
48*10652SHyon.Kim@Sun.COM #include <thread.h>
49*10652SHyon.Kim@Sun.COM #include <synch.h>
50*10652SHyon.Kim@Sun.COM #include <unistd.h>
51*10652SHyon.Kim@Sun.COM #include <stropts.h>
52*10652SHyon.Kim@Sun.COM #include <libdevinfo.h>
53*10652SHyon.Kim@Sun.COM #include <sys/time.h>
54*10652SHyon.Kim@Sun.COM #include <sys/scsi/generic/commands.h>
55*10652SHyon.Kim@Sun.COM #include <sys/scsi/impl/commands.h>
56*10652SHyon.Kim@Sun.COM #include <sys/scsi/impl/sense.h>
57*10652SHyon.Kim@Sun.COM #include <sys/scsi/generic/inquiry.h>
58*10652SHyon.Kim@Sun.COM #include <sys/scsi/impl/uscsi.h>
59*10652SHyon.Kim@Sun.COM #include <sys/varargs.h>
60*10652SHyon.Kim@Sun.COM #include <sys/varargs.h>
61*10652SHyon.Kim@Sun.COM #include <libsysevent.h>
62*10652SHyon.Kim@Sun.COM 
63*10652SHyon.Kim@Sun.COM #ifdef	__cplusplus
64*10652SHyon.Kim@Sun.COM extern "C" {
65*10652SHyon.Kim@Sun.COM #endif
66*10652SHyon.Kim@Sun.COM 
67*10652SHyon.Kim@Sun.COM #define	VSL_NUMERIC_VERSION	1
68*10652SHyon.Kim@Sun.COM #define	VSL_STRING_VERSION	"Version 1"
69*10652SHyon.Kim@Sun.COM #define	VSL_NAME		"Sun T11 SM-HBA Vendor Library for SAS HBAs"
70*10652SHyon.Kim@Sun.COM #define	SMHBA_LIBRARY_VERSION1	VSL_NUMERIC_VERSION
71*10652SHyon.Kim@Sun.COM 
72*10652SHyon.Kim@Sun.COM /* The /dev links we expose */
73*10652SHyon.Kim@Sun.COM #define	DEV_DISK_DIR		"/dev/rdsk"
74*10652SHyon.Kim@Sun.COM #define	DEV_TAPE_DIR		"/dev/rmt"
75*10652SHyon.Kim@Sun.COM #define	DEV_ES_DIR		"/dev/es"
76*10652SHyon.Kim@Sun.COM #define	DEV_CFG_DIR		"/dev/cfg"
77*10652SHyon.Kim@Sun.COM #define	DEVICES_DIR		"/devices"
78*10652SHyon.Kim@Sun.COM #define	DEVCTL_SUFFIX		":devctl"
79*10652SHyon.Kim@Sun.COM #define	SCSI_SUFFIX		":scsi"
80*10652SHyon.Kim@Sun.COM 
81*10652SHyon.Kim@Sun.COM /* To be consistent, when out of memory call this macro routine */
82*10652SHyon.Kim@Sun.COM #define	OUT_OF_MEMORY(routine)  \
83*10652SHyon.Kim@Sun.COM     log(LOG_DEBUG, routine, "Out of memory.")
84*10652SHyon.Kim@Sun.COM 
85*10652SHyon.Kim@Sun.COM #define	S_FREE(x)   (((x) != NULL) ? (free(x), (x) = NULL) : (void *)0)
86*10652SHyon.Kim@Sun.COM 
87*10652SHyon.Kim@Sun.COM #define	IS_STUB_NODE(s) (di_instance(s) == -1 && \
88*10652SHyon.Kim@Sun.COM 	di_nodeid(s) == (DI_PROM_NODEID))
89*10652SHyon.Kim@Sun.COM 
90*10652SHyon.Kim@Sun.COM /* manf+model+10(char length of UINTMAX)+6(for 2 -'s, NULL & extra 3bytes */
91*10652SHyon.Kim@Sun.COM #define	HANDLE_NAME_LENGTH  (64 + 256 + 10 + 6)
92*10652SHyon.Kim@Sun.COM #define	HANDLE_ERROR	0 /* This is an error condition */
93*10652SHyon.Kim@Sun.COM 
94*10652SHyon.Kim@Sun.COM /* Some timing values */
95*10652SHyon.Kim@Sun.COM #define	LOCK_SLEEP	    1
96*10652SHyon.Kim@Sun.COM #define	BUSY_SLEEP	    10000 /* 1/100 second */
97*10652SHyon.Kim@Sun.COM #define	BUSY_RETRY_TIMER    5000000000 /* Retry for 5 seconds */
98*10652SHyon.Kim@Sun.COM #define	STATE_RETRY_TIMER   10000000000 /* Retry for 10 seconds */
99*10652SHyon.Kim@Sun.COM #define	HR_SECOND	    1000000000
100*10652SHyon.Kim@Sun.COM /* How many times to silently retry, before starting to print warnings */
101*10652SHyon.Kim@Sun.COM #define	DEADLOCK_WARNING    10
102*10652SHyon.Kim@Sun.COM 
103*10652SHyon.Kim@Sun.COM #define	MAX_LUN		4096
104*10652SHyon.Kim@Sun.COM #define	REP_LUNS_RSP_SIZE   sizeof (rep_luns_rsp_t)+  \
105*10652SHyon.Kim@Sun.COM 				(sizeof (lun_list_element_t)*(MAX_LUN - 1))
106*10652SHyon.Kim@Sun.COM 
107*10652SHyon.Kim@Sun.COM /* misc */
108*10652SHyon.Kim@Sun.COM #define	SUN_MICROSYSTEMS	"Sun Microsystems, Inc."
109*10652SHyon.Kim@Sun.COM 
110*10652SHyon.Kim@Sun.COM mutex_t		all_hbas_lock;
111*10652SHyon.Kim@Sun.COM mutex_t		open_handles_lock;
112*10652SHyon.Kim@Sun.COM mutex_t		log_file_lock;
113*10652SHyon.Kim@Sun.COM HBA_UINT32	hba_count;
114*10652SHyon.Kim@Sun.COM HBA_UINT16	open_handle_index;
115*10652SHyon.Kim@Sun.COM 
116*10652SHyon.Kim@Sun.COM 
117*10652SHyon.Kim@Sun.COM /* Internal structures that aren't exposed to clients */
118*10652SHyon.Kim@Sun.COM struct open_handle {
119*10652SHyon.Kim@Sun.COM 	int			adapterIndex;
120*10652SHyon.Kim@Sun.COM 	HBA_UINT32		handle;
121*10652SHyon.Kim@Sun.COM 	struct open_handle	*next;
122*10652SHyon.Kim@Sun.COM };
123*10652SHyon.Kim@Sun.COM 
124*10652SHyon.Kim@Sun.COM struct sun_sas_hba {
125*10652SHyon.Kim@Sun.COM 	HBA_UINT32		index;  /* Can be sparse */
126*10652SHyon.Kim@Sun.COM 	struct open_handle	*open_handles;
127*10652SHyon.Kim@Sun.COM 	int			fd;	    /* when open, the FD */
128*10652SHyon.Kim@Sun.COM 	/* The libdevinfo HBA path (lacking /devices) */
129*10652SHyon.Kim@Sun.COM 	char			device_path[MAXPATHLEN];
130*10652SHyon.Kim@Sun.COM 	char			handle_name[HANDLE_NAME_LENGTH];
131*10652SHyon.Kim@Sun.COM 	SMHBA_ADAPTERATTRIBUTES	adapter_attributes;
132*10652SHyon.Kim@Sun.COM 
133*10652SHyon.Kim@Sun.COM 	/* State tracking */
134*10652SHyon.Kim@Sun.COM 	boolean_t		invalid;
135*10652SHyon.Kim@Sun.COM 	struct sun_sas_hba	*next;
136*10652SHyon.Kim@Sun.COM 	struct sun_sas_port	*first_port;
137*10652SHyon.Kim@Sun.COM };
138*10652SHyon.Kim@Sun.COM 
139*10652SHyon.Kim@Sun.COM struct sun_sas_hba *global_hba_head;
140*10652SHyon.Kim@Sun.COM 
141*10652SHyon.Kim@Sun.COM struct ScsiEntryList {
142*10652SHyon.Kim@Sun.COM 	SMHBA_SCSIENTRY		entry;
143*10652SHyon.Kim@Sun.COM 	struct ScsiEntryList	*next;
144*10652SHyon.Kim@Sun.COM };
145*10652SHyon.Kim@Sun.COM 
146*10652SHyon.Kim@Sun.COM struct phy_info {
147*10652SHyon.Kim@Sun.COM 	HBA_UINT32		index;
148*10652SHyon.Kim@Sun.COM 	boolean_t		invalid;
149*10652SHyon.Kim@Sun.COM 	SMHBA_SAS_PHY		phy;
150*10652SHyon.Kim@Sun.COM 	struct phy_info		*next;
151*10652SHyon.Kim@Sun.COM };
152*10652SHyon.Kim@Sun.COM 
153*10652SHyon.Kim@Sun.COM struct sun_sas_port {
154*10652SHyon.Kim@Sun.COM 	HBA_UINT32		index;
155*10652SHyon.Kim@Sun.COM 	boolean_t		invalid;
156*10652SHyon.Kim@Sun.COM 
157*10652SHyon.Kim@Sun.COM 	/* The libdevinfo HBA path (lacking /devices) */
158*10652SHyon.Kim@Sun.COM 	char			device_path[MAXPATHLEN];
159*10652SHyon.Kim@Sun.COM 	SMHBA_PORTATTRIBUTES	port_attributes;
160*10652SHyon.Kim@Sun.COM 	struct ScsiEntryList	*scsiInfo;
161*10652SHyon.Kim@Sun.COM 	int			cntlNumber;
162*10652SHyon.Kim@Sun.COM 
163*10652SHyon.Kim@Sun.COM 	/* The following are used to track the device map */
164*10652SHyon.Kim@Sun.COM 	int			num_devices;
165*10652SHyon.Kim@Sun.COM 	struct sun_sas_port	*first_attached_port; /* Only for HBA port */
166*10652SHyon.Kim@Sun.COM 	struct phy_info		*first_phy;	/* Only for HBA port */
167*10652SHyon.Kim@Sun.COM 	struct sun_sas_port	*next;
168*10652SHyon.Kim@Sun.COM };
169*10652SHyon.Kim@Sun.COM 
170*10652SHyon.Kim@Sun.COM typedef struct walkarg {
171*10652SHyon.Kim@Sun.COM 	char *devpath;
172*10652SHyon.Kim@Sun.COM 	boolean_t *flag;
173*10652SHyon.Kim@Sun.COM } walkarg_t;
174*10652SHyon.Kim@Sun.COM 
175*10652SHyon.Kim@Sun.COM extern int	loadCount;
176*10652SHyon.Kim@Sun.COM 
177*10652SHyon.Kim@Sun.COM extern sysevent_handle_t *gSysEventHandle;
178*10652SHyon.Kim@Sun.COM 
179*10652SHyon.Kim@Sun.COM /* External routines */
180*10652SHyon.Kim@Sun.COM extern HBA_STATUS SMHBA_RegisterLibrary(PSMHBA_ENTRYPOINTS);
181*10652SHyon.Kim@Sun.COM extern HBA_UINT32 Sun_sasGetVendorLibraryAttributes(SMHBA_LIBRARYATTRIBUTES *);
182*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetAdapterAttributes(HBA_HANDLE,
183*10652SHyon.Kim@Sun.COM     SMHBA_ADAPTERATTRIBUTES *);
184*10652SHyon.Kim@Sun.COM extern HBA_UINT32 Sun_sasGetNumberOfAdapters();
185*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetAdapterName(HBA_UINT32, char *);
186*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetPortType(HBA_HANDLE, HBA_UINT32, HBA_PORTTYPE *);
187*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetAdapterPortAttributes(HBA_HANDLE, HBA_UINT32,
188*10652SHyon.Kim@Sun.COM     SMHBA_PORTATTRIBUTES *);
189*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetPortAttributesByWWN(HBA_HANDLE, HBA_WWN, HBA_WWN,
190*10652SHyon.Kim@Sun.COM     SMHBA_PORTATTRIBUTES *);
191*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetFCPhyAttributes(HBA_HANDLE, HBA_UINT32, HBA_UINT32,
192*10652SHyon.Kim@Sun.COM     SMHBA_FC_PHY *);
193*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetSASPhyAttributes(HBA_HANDLE, HBA_UINT32,
194*10652SHyon.Kim@Sun.COM     HBA_UINT32, SMHBA_SAS_PHY *);
195*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetProtocolStatistics(HBA_HANDLE, HBA_UINT32,
196*10652SHyon.Kim@Sun.COM     HBA_UINT32, SMHBA_PROTOCOLSTATISTICS *);
197*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetPhyStatistics(HBA_HANDLE, HBA_UINT32,
198*10652SHyon.Kim@Sun.COM     HBA_UINT32, SMHBA_PHYSTATISTICS *);
199*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasSendSMPPassThru(HBA_HANDLE, HBA_WWN,  HBA_WWN, HBA_WWN,
200*10652SHyon.Kim@Sun.COM     void *, HBA_UINT32, void *, HBA_UINT32 *);
201*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetBindingCapability(HBA_HANDLE, HBA_WWN, HBA_WWN,
202*10652SHyon.Kim@Sun.COM     SMHBA_BIND_CAPABILITY *);
203*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetBindingSupport(HBA_HANDLE, HBA_WWN, HBA_WWN,
204*10652SHyon.Kim@Sun.COM     SMHBA_BIND_CAPABILITY *);
205*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasSetBindingSupport(HBA_HANDLE, HBA_WWN, HBA_WWN,
206*10652SHyon.Kim@Sun.COM     SMHBA_BIND_CAPABILITY);
207*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetTargetMapping(HBA_HANDLE, HBA_WWN, HBA_WWN,
208*10652SHyon.Kim@Sun.COM     SMHBA_TARGETMAPPING *);
209*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetPersistentBinding(HBA_HANDLE, HBA_WWN, HBA_WWN,
210*10652SHyon.Kim@Sun.COM     SMHBA_BINDING *);
211*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasSetPersistentBinding(HBA_HANDLE, HBA_WWN, HBA_WWN,
212*10652SHyon.Kim@Sun.COM     const SMHBA_BINDING *);
213*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRemovePersistentBinding(HBA_HANDLE, HBA_WWN, HBA_WWN,
214*10652SHyon.Kim@Sun.COM     const SMHBA_BINDING *);
215*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRemoveAllPersistentBindings(HBA_HANDLE, HBA_WWN,
216*10652SHyon.Kim@Sun.COM     HBA_WWN);
217*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetLUNStatistics(HBA_HANDLE, const HBA_SCSIID *,
218*10652SHyon.Kim@Sun.COM     SMHBA_PROTOCOLSTATISTICS *);
219*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRegisterForAdapterAddEvents(void (*)(void *, HBA_WWN,
220*10652SHyon.Kim@Sun.COM     HBA_UINT32), void *, HBA_CALLBACKHANDLE *);
221*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRegisterForAdapterEvents(void (*)(void *, HBA_WWN,
222*10652SHyon.Kim@Sun.COM     HBA_UINT32), void *, HBA_HANDLE, HBA_CALLBACKHANDLE *);
223*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRegisterForAdapterPortEvents(void (*)(void *, HBA_WWN,
224*10652SHyon.Kim@Sun.COM     HBA_UINT32, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN, HBA_UINT32,
225*10652SHyon.Kim@Sun.COM     HBA_CALLBACKHANDLE *);
226*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRegisterForAdapterPortStatEvents(void (*)(void *,
227*10652SHyon.Kim@Sun.COM     HBA_WWN, HBA_UINT32, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN, HBA_UINT32,
228*10652SHyon.Kim@Sun.COM     SMHBA_PROTOCOLSTATISTICS, HBA_UINT32, HBA_CALLBACKHANDLE *);
229*10652SHyon.Kim@Sun.COM extern HBA_STATUS    Sun_sasRegisterForAdapterPhyStatEvents(void (*)(void *,
230*10652SHyon.Kim@Sun.COM     HBA_WWN, HBA_UINT32, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN, HBA_UINT32,
231*10652SHyon.Kim@Sun.COM     SMHBA_PHYSTATISTICS, HBA_UINT32, HBA_CALLBACKHANDLE *);
232*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRegisterForTargetEvents(void (*)(void *, HBA_WWN,
233*10652SHyon.Kim@Sun.COM     HBA_WWN, HBA_WWN, HBA_UINT32), void *, HBA_HANDLE, HBA_WWN, HBA_WWN,
234*10652SHyon.Kim@Sun.COM     HBA_WWN, HBA_CALLBACKHANDLE *, HBA_UINT32);
235*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRegisterForLinkEvents(void (*)(void *, HBA_WWN,
236*10652SHyon.Kim@Sun.COM     HBA_UINT32, void *, HBA_UINT32), void *, void *, HBA_UINT32, HBA_HANDLE,
237*10652SHyon.Kim@Sun.COM     HBA_CALLBACKHANDLE *);
238*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasScsiInquiry(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_WWN,
239*10652SHyon.Kim@Sun.COM     SMHBA_SCSILUN, HBA_UINT8, HBA_UINT8, void *, HBA_UINT32 *, HBA_UINT8 *,
240*10652SHyon.Kim@Sun.COM     void *, HBA_UINT32 *);
241*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasScsiReportLUNs(HBA_HANDLE, HBA_WWN, HBA_WWN,
242*10652SHyon.Kim@Sun.COM     HBA_WWN, void *, HBA_UINT32 *, HBA_UINT8 *, void *, HBA_UINT32 *);
243*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasScsiReadCapacity(HBA_HANDLE, HBA_WWN, HBA_WWN, HBA_WWN,
244*10652SHyon.Kim@Sun.COM     SMHBA_SCSILUN, void *, HBA_UINT32 *, HBA_UINT8 *, void *, HBA_UINT32 *);
245*10652SHyon.Kim@Sun.COM extern HBA_UINT32 Sun_sasGetVersion();
246*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasLoadLibrary();
247*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasFreeLibrary();
248*10652SHyon.Kim@Sun.COM extern HBA_UINT32 Sun_sasGetNumberOfAdapters();
249*10652SHyon.Kim@Sun.COM extern HBA_UINT32 Sun_sasGetNumberOfPorts(HBA_HANDLE, HBA_UINT32 *);
250*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetAdapterName(HBA_UINT32, char *);
251*10652SHyon.Kim@Sun.COM extern HBA_HANDLE Sun_sasOpenAdapter(char *);
252*10652SHyon.Kim@Sun.COM extern void Sun_sasCloseAdapter(HBA_HANDLE);
253*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetDiscoveredPortAttributes(HBA_HANDLE, HBA_UINT32,
254*10652SHyon.Kim@Sun.COM     HBA_UINT32, SMHBA_PORTATTRIBUTES *);
255*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasGetPortAttributesByWWN(HBA_HANDLE, HBA_WWN, HBA_WWN,
256*10652SHyon.Kim@Sun.COM     SMHBA_PORTATTRIBUTES *);
257*10652SHyon.Kim@Sun.COM extern void Sun_sasRefreshInformation(HBA_HANDLE);
258*10652SHyon.Kim@Sun.COM extern void Sun_sasRefreshAdapterConfiguration(void);
259*10652SHyon.Kim@Sun.COM extern HBA_STATUS Sun_sasRemoveCallback(HBA_CALLBACKHANDLE);
260*10652SHyon.Kim@Sun.COM 
261*10652SHyon.Kim@Sun.COM 
262*10652SHyon.Kim@Sun.COM /* Internal routines */
263*10652SHyon.Kim@Sun.COM extern void log(int, const char *, char *, ...);
264*10652SHyon.Kim@Sun.COM extern u_longlong_t wwnConversion(uchar_t *wwn);
265*10652SHyon.Kim@Sun.COM extern HBA_STATUS devtree_attached_devices(di_node_t, struct sun_sas_port *);
266*10652SHyon.Kim@Sun.COM extern HBA_HANDLE CreateHandle(int);
267*10652SHyon.Kim@Sun.COM extern int RetrieveIndex(HBA_HANDLE);
268*10652SHyon.Kim@Sun.COM extern struct open_handle *RetrieveOpenHandle(HBA_HANDLE);
269*10652SHyon.Kim@Sun.COM extern struct sun_sas_hba *RetrieveHandle(int);
270*10652SHyon.Kim@Sun.COM extern struct sun_sas_hba *ExtractHandle(int);
271*10652SHyon.Kim@Sun.COM extern struct sun_sas_hba *Retrieve_Sun_sasHandle(HBA_HANDLE);
272*10652SHyon.Kim@Sun.COM extern void lock(mutex_t *mp);
273*10652SHyon.Kim@Sun.COM extern void unlock(mutex_t *mp);
274*10652SHyon.Kim@Sun.COM extern void reportSense(struct scsi_extended_sense *, const char *);
275*10652SHyon.Kim@Sun.COM extern HBA_STATUS verifyAdapter(struct sun_sas_hba *hba_ptr);
276*10652SHyon.Kim@Sun.COM extern HBA_STATUS devtree_get_all_hbas(di_node_t root);
277*10652SHyon.Kim@Sun.COM extern HBA_STATUS devtree_get_one_hba(di_node_t node);
278*10652SHyon.Kim@Sun.COM extern HBA_STATUS FreeHBA(struct sun_sas_hba *hba);
279*10652SHyon.Kim@Sun.COM extern HBA_WWN getFirstAdapterPortWWN(HBA_HANDLE handle);
280*10652SHyon.Kim@Sun.COM extern HBA_STATUS getPortStateCounter(char *fpPath, HBA_UINT32 *stateCount);
281*10652SHyon.Kim@Sun.COM extern HBA_STATUS lookupControllerLink(char *path, char *link);
282*10652SHyon.Kim@Sun.COM extern HBA_STATUS lookupSMPLink(char *path, char *link);
283*10652SHyon.Kim@Sun.COM extern void convertDevpathToDevlink(PSMHBA_TARGETMAPPING mappings);
284*10652SHyon.Kim@Sun.COM extern void fillDomainPortWWN(struct sun_sas_port *);
285*10652SHyon.Kim@Sun.COM extern HBA_STATUS get_phy_info(di_node_t, struct sun_sas_port *);
286*10652SHyon.Kim@Sun.COM extern HBA_STATUS send_uscsi_cmd(const char *devpath, struct uscsi_cmd *ucmd);
287*10652SHyon.Kim@Sun.COM extern HBA_STATUS registerSysevent();
288*10652SHyon.Kim@Sun.COM extern HBA_STATUS validateDomainAddress(struct sun_sas_port *, HBA_WWN);
289*10652SHyon.Kim@Sun.COM 
290*10652SHyon.Kim@Sun.COM #ifdef	__cplusplus
291*10652SHyon.Kim@Sun.COM }
292*10652SHyon.Kim@Sun.COM #endif
293*10652SHyon.Kim@Sun.COM 
294*10652SHyon.Kim@Sun.COM #endif /* _SUN_SAS_H */
295