xref: /illumos-gate/usr/src/cmd/luxadm/common.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1*fcf3ce44SJohn Forte /*
2*fcf3ce44SJohn Forte  * CDDL HEADER START
3*fcf3ce44SJohn Forte  *
4*fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5*fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6*fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7*fcf3ce44SJohn Forte  *
8*fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10*fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11*fcf3ce44SJohn Forte  * and limitations under the License.
12*fcf3ce44SJohn Forte  *
13*fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14*fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16*fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17*fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fcf3ce44SJohn Forte  *
19*fcf3ce44SJohn Forte  * CDDL HEADER END
20*fcf3ce44SJohn Forte  */
21*fcf3ce44SJohn Forte /*
22*fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*fcf3ce44SJohn Forte  * Use is subject to license terms.
24*fcf3ce44SJohn Forte  */
25*fcf3ce44SJohn Forte 
26*fcf3ce44SJohn Forte /*
27*fcf3ce44SJohn Forte  * PHOTON CONFIGURATION MANAGER
28*fcf3ce44SJohn Forte  * Common definitions
29*fcf3ce44SJohn Forte  */
30*fcf3ce44SJohn Forte 
31*fcf3ce44SJohn Forte /*
32*fcf3ce44SJohn Forte  * I18N message number ranges
33*fcf3ce44SJohn Forte  *  This file: 12500 - 12999
34*fcf3ce44SJohn Forte  *  Shared common messages: 1 - 1999
35*fcf3ce44SJohn Forte  */
36*fcf3ce44SJohn Forte 
37*fcf3ce44SJohn Forte #ifndef	_COMMON_H
38*fcf3ce44SJohn Forte #define	_COMMON_H
39*fcf3ce44SJohn Forte 
40*fcf3ce44SJohn Forte 
41*fcf3ce44SJohn Forte 
42*fcf3ce44SJohn Forte 
43*fcf3ce44SJohn Forte /*
44*fcf3ce44SJohn Forte  * Include any headers you depend on.
45*fcf3ce44SJohn Forte  */
46*fcf3ce44SJohn Forte #include <sys/types.h>
47*fcf3ce44SJohn Forte #include <sys/scsi/adapters/scsi_vhci.h>
48*fcf3ce44SJohn Forte 
49*fcf3ce44SJohn Forte #ifdef	__cplusplus
50*fcf3ce44SJohn Forte extern "C" {
51*fcf3ce44SJohn Forte #endif
52*fcf3ce44SJohn Forte 
53*fcf3ce44SJohn Forte /*#ifdef _BIG_ENDIAN
54*fcf3ce44SJohn Forte #define	htonll(x)   (x)
55*fcf3ce44SJohn Forte #define	ntohll(x)   (x)
56*fcf3ce44SJohn Forte #else
57*fcf3ce44SJohn Forte #define	htonll(x)   ((((unsigned long long)htonl(x)) << 32) + htonl(x >> 32))
58*fcf3ce44SJohn Forte #define	ntohll(x)   ((((unsigned long long)ntohl(x)) << 32) + ntohl(x >> 32))
59*fcf3ce44SJohn Forte #endif*/
60*fcf3ce44SJohn Forte 
61*fcf3ce44SJohn Forte 
62*fcf3ce44SJohn Forte extern	char	*p_error_msg_ptr;
63*fcf3ce44SJohn Forte 
64*fcf3ce44SJohn Forte #ifdef __x86
65*fcf3ce44SJohn Forte #include <nl_types.h>
66*fcf3ce44SJohn Forte extern nl_catd l_catd;
67*fcf3ce44SJohn Forte #define	L_SET1			1   /* catalog set number */
68*fcf3ce44SJohn Forte #define	MSGSTR(Num, Str)	catgets(l_catd, L_SET1, Num, Str)
69*fcf3ce44SJohn Forte #endif
70*fcf3ce44SJohn Forte 
71*fcf3ce44SJohn Forte 
72*fcf3ce44SJohn Forte /* Defines */
73*fcf3ce44SJohn Forte #define	USEAGE()	{(void) fprintf(stderr,  MSGSTR(12500, \
74*fcf3ce44SJohn Forte 			"Usage: %s [-v] subcommand [option...]" \
75*fcf3ce44SJohn Forte 			" {enclosure[,dev]... | pathname...}\n"), \
76*fcf3ce44SJohn Forte 			whoami); \
77*fcf3ce44SJohn Forte 			(void) fflush(stderr); }
78*fcf3ce44SJohn Forte 
79*fcf3ce44SJohn Forte #define	E_USEAGE()	{(void) fprintf(stderr,  MSGSTR(12501, \
80*fcf3ce44SJohn Forte 			"Usage: %s [-v] -e subcommand [option...]" \
81*fcf3ce44SJohn Forte 			" {enclosure[,dev]... | pathname...}\n"), \
82*fcf3ce44SJohn Forte 			whoami); \
83*fcf3ce44SJohn Forte 			(void) fflush(stderr); }
84*fcf3ce44SJohn Forte 
85*fcf3ce44SJohn Forte #define	VERBPRINT	 if (Options & PVERBOSE) (void) printf
86*fcf3ce44SJohn Forte 
87*fcf3ce44SJohn Forte #define	L_ERR_PRINT	\
88*fcf3ce44SJohn Forte 			if (p_error_msg_ptr == NULL) {  \
89*fcf3ce44SJohn Forte 				perror(MSGSTR(12502, "Error"));	 \
90*fcf3ce44SJohn Forte 			} else {	\
91*fcf3ce44SJohn Forte 	(void) fprintf(stderr, MSGSTR(12503, "Error: %s"), p_error_msg_ptr); \
92*fcf3ce44SJohn Forte 			} \
93*fcf3ce44SJohn Forte 			p_error_msg_ptr = NULL;
94*fcf3ce44SJohn Forte 
95*fcf3ce44SJohn Forte #define	P_ERR_PRINT	 if (p_error_msg_ptr == NULL) {  \
96*fcf3ce44SJohn Forte 					perror(whoami);	 \
97*fcf3ce44SJohn Forte 			} else {	\
98*fcf3ce44SJohn Forte 	(void) fprintf(stderr, MSGSTR(12504, "Error: %s"), p_error_msg_ptr); \
99*fcf3ce44SJohn Forte 			} \
100*fcf3ce44SJohn Forte 			p_error_msg_ptr = NULL;
101*fcf3ce44SJohn Forte 
102*fcf3ce44SJohn Forte 
103*fcf3ce44SJohn Forte /* Display extended mode page information. */
104*fcf3ce44SJohn Forte #ifndef	MODEPAGE_CACHING
105*fcf3ce44SJohn Forte #undef	MODEPAGE_CACHING
106*fcf3ce44SJohn Forte #define	MODEPAGE_CACHING	0x08
107*fcf3ce44SJohn Forte #endif
108*fcf3ce44SJohn Forte 
109*fcf3ce44SJohn Forte 
110*fcf3ce44SJohn Forte /* Primary commands */
111*fcf3ce44SJohn Forte #define	ENCLOSURE_NAMES 100
112*fcf3ce44SJohn Forte #define	DISPLAY	 101
113*fcf3ce44SJohn Forte #define	DOWNLOAD	102
114*fcf3ce44SJohn Forte #define	FAST_WRITE	400	 /* SSA */
115*fcf3ce44SJohn Forte #define	FAILOVER	500
116*fcf3ce44SJohn Forte #define	FC_UPDATE	401	 /* SSA */
117*fcf3ce44SJohn Forte #define	FCAL_UPDATE	103	 /* Update the Fcode on Sbus soc card */
118*fcf3ce44SJohn Forte #define	FCODE_UPDATE	117	 /* Update the Fcode on all cards */
119*fcf3ce44SJohn Forte #define	QLGC_UPDATE	116	 /* Update the Fcode on PCI card(s) */
120*fcf3ce44SJohn Forte #define	INQUIRY		105
121*fcf3ce44SJohn Forte #define	LED		107
122*fcf3ce44SJohn Forte #define	LED_ON		108
123*fcf3ce44SJohn Forte #define	LED_OFF		109
124*fcf3ce44SJohn Forte #define	LED_BLINK	110
125*fcf3ce44SJohn Forte #define	NVRAM_DATA	402	 /* SSA */
126*fcf3ce44SJohn Forte #define	POWER_OFF	403	 /* SSA */
127*fcf3ce44SJohn Forte #define	POWER_ON	111
128*fcf3ce44SJohn Forte #define	PASSWORD	112
129*fcf3ce44SJohn Forte #define	PURGE		404	 /* SSA */
130*fcf3ce44SJohn Forte #define	PERF_STATISTICS 405	 /* SSA */
131*fcf3ce44SJohn Forte #define	PROBE		113
132*fcf3ce44SJohn Forte #define	RELEASE		210
133*fcf3ce44SJohn Forte #define	RESERVE		211
134*fcf3ce44SJohn Forte #define	START		213
135*fcf3ce44SJohn Forte #define	STOP		214
136*fcf3ce44SJohn Forte #define	SYNC_CACHE	406	 /* SSA */
137*fcf3ce44SJohn Forte #define	SET_BOOT_DEV	115	 /* Set the boot-device variable in nvram */
138*fcf3ce44SJohn Forte #define	INSERT_DEVICE	106	/* Hot plug */
139*fcf3ce44SJohn Forte #define	REMOVE_DEVICE	114	/* hot plug */
140*fcf3ce44SJohn Forte 
141*fcf3ce44SJohn Forte /* Device hotplugging */
142*fcf3ce44SJohn Forte #define	REPLACE_DEVICE	150
143*fcf3ce44SJohn Forte #define	DEV_ONLINE	155
144*fcf3ce44SJohn Forte #define	DEV_OFFLINE	156
145*fcf3ce44SJohn Forte #define	DEV_GETSTATE	157
146*fcf3ce44SJohn Forte #define	DEV_RESET	158
147*fcf3ce44SJohn Forte #define	BUS_QUIESCE	160
148*fcf3ce44SJohn Forte #define	BUS_UNQUIESCE	161
149*fcf3ce44SJohn Forte #define	BUS_GETSTATE	162
150*fcf3ce44SJohn Forte #define	BUS_RESET	163
151*fcf3ce44SJohn Forte #define	BUS_RESETALL	164
152*fcf3ce44SJohn Forte 
153*fcf3ce44SJohn Forte #define	SKIP		111
154*fcf3ce44SJohn Forte #define	QUIT		222
155*fcf3ce44SJohn Forte 
156*fcf3ce44SJohn Forte #define	L_LED_STATUS	0x00
157*fcf3ce44SJohn Forte #define	L_LED_RQST_IDENTIFY	0x01
158*fcf3ce44SJohn Forte #define	L_LED_ON	0x02
159*fcf3ce44SJohn Forte #define	L_LED_OFF	0x04
160*fcf3ce44SJohn Forte 
161*fcf3ce44SJohn Forte 
162*fcf3ce44SJohn Forte /* Enclosure Specific */
163*fcf3ce44SJohn Forte #define	ALARM		407	 /* SSA */
164*fcf3ce44SJohn Forte #define	ALARM_OFF	408	 /* SSA */
165*fcf3ce44SJohn Forte #define	ALARM_ON	409	 /* SSA */
166*fcf3ce44SJohn Forte #define	ALARM_SET	410	 /* SSA */
167*fcf3ce44SJohn Forte #define	ENV_DISPLAY	411	 /* SSA */
168*fcf3ce44SJohn Forte 
169*fcf3ce44SJohn Forte /* Expert commands */
170*fcf3ce44SJohn Forte #define	RDLS		215
171*fcf3ce44SJohn Forte #define	P_BYPASS	218
172*fcf3ce44SJohn Forte #define	P_ENABLE	219
173*fcf3ce44SJohn Forte #define	BYPASS		220
174*fcf3ce44SJohn Forte #define	ENABLE		221
175*fcf3ce44SJohn Forte #define	FORCELIP	222
176*fcf3ce44SJohn Forte #define	LUX_P_OFFLINE	223
177*fcf3ce44SJohn Forte #define	LUX_P_ONLINE	224
178*fcf3ce44SJohn Forte #define	EXT_LOOPBACK	225
179*fcf3ce44SJohn Forte #define	INT_LOOPBACK	226
180*fcf3ce44SJohn Forte #define	NO_LOOPBACK	227
181*fcf3ce44SJohn Forte #define	CREATE_FAB	228
182*fcf3ce44SJohn Forte 
183*fcf3ce44SJohn Forte /* Undocumented commands */
184*fcf3ce44SJohn Forte #define	DUMP		300
185*fcf3ce44SJohn Forte #define	CHECK_FILE	301	/* Undocumented - Check download file */
186*fcf3ce44SJohn Forte #define	DUMP_MAP	302	/* Dump map of loop */
187*fcf3ce44SJohn Forte #define	VERSION		303	/* undocumented */
188*fcf3ce44SJohn Forte #define	AU		304	/* undocumented */
189*fcf3ce44SJohn Forte #define	PORT		305	/* undocumented */
190*fcf3ce44SJohn Forte 
191*fcf3ce44SJohn Forte /* Undocumented diagnostic subcommands */
192*fcf3ce44SJohn Forte #define	SYSDUMP	 350
193*fcf3ce44SJohn Forte 
194*fcf3ce44SJohn Forte 
195*fcf3ce44SJohn Forte /* SSA - for adm_download */
196*fcf3ce44SJohn Forte /* #define	SSAFIRMWARE_FILE	"/usr/lib/firmware/ssa/ssafirmware" */
197*fcf3ce44SJohn Forte 
198*fcf3ce44SJohn Forte /*	Global variables	*/
199*fcf3ce44SJohn Forte extern char	*whoami;
200*fcf3ce44SJohn Forte extern int	Options;
201*fcf3ce44SJohn Forte extern const	int OPTION_A;
202*fcf3ce44SJohn Forte extern const	int OPTION_B;
203*fcf3ce44SJohn Forte extern const	int OPTION_C;
204*fcf3ce44SJohn Forte extern const	int OPTION_D;
205*fcf3ce44SJohn Forte extern const	int OPTION_E;
206*fcf3ce44SJohn Forte extern const	int OPTION_F;
207*fcf3ce44SJohn Forte extern const	int OPTION_L;
208*fcf3ce44SJohn Forte extern const	int OPTION_P;
209*fcf3ce44SJohn Forte extern const	int OPTION_R;
210*fcf3ce44SJohn Forte extern const	int OPTION_T;
211*fcf3ce44SJohn Forte extern const	int OPTION_V;
212*fcf3ce44SJohn Forte extern const	int OPTION_Z;
213*fcf3ce44SJohn Forte extern const	int OPTION_Y;
214*fcf3ce44SJohn Forte extern const	int OPTION_CAPF;
215*fcf3ce44SJohn Forte extern const	int PVERBOSE;
216*fcf3ce44SJohn Forte extern const	int SAVE;
217*fcf3ce44SJohn Forte extern const	int EXPERT;
218*fcf3ce44SJohn Forte 
219*fcf3ce44SJohn Forte #define		TARGET_ID(box_id, f_r, slot)	\
220*fcf3ce44SJohn Forte 		((box_id | ((f_r == 'f' ? 0 : 1) << 4)) | (slot + 2))
221*fcf3ce44SJohn Forte 
222*fcf3ce44SJohn Forte #define		NEWER(time1, time2) 	(time1.tv_sec > time2.tv_sec)
223*fcf3ce44SJohn Forte 
224*fcf3ce44SJohn Forte /* used to set the behavior of get_slash_devices_from_osDevName. */
225*fcf3ce44SJohn Forte #define		STANDARD_DEVNAME_HANDLING	1
226*fcf3ce44SJohn Forte #define		NOT_IGNORE_DANGLING_LINK	2
227*fcf3ce44SJohn Forte 
228*fcf3ce44SJohn Forte #include <hbaapi.h>
229*fcf3ce44SJohn Forte #ifndef __x86
230*fcf3ce44SJohn Forte #include <sys/scsi/generic/mode.h>
231*fcf3ce44SJohn Forte #include <sys/scsi/generic/sense.h>
232*fcf3ce44SJohn Forte #include <sys/scsi/impl/uscsi.h>
233*fcf3ce44SJohn Forte #include <g_state.h>
234*fcf3ce44SJohn Forte #include <stgcom.h>
235*fcf3ce44SJohn Forte #include <l_common.h>
236*fcf3ce44SJohn Forte #else
237*fcf3ce44SJohn Forte typedef struct l_inquiry_inq_2 {
238*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_HTOL)
239*fcf3ce44SJohn Forte 	uchar_t inq_2_reladdr	: 1,	/* relative addressing */
240*fcf3ce44SJohn Forte 		inq_wbus32	: 1,	/* 32 bit wide data xfers */
241*fcf3ce44SJohn Forte 		inq_wbus16	: 1,	/* 16 bit wide data xfers */
242*fcf3ce44SJohn Forte 		inq_sync	: 1,	/* synchronous data xfers */
243*fcf3ce44SJohn Forte 		inq_linked	: 1,	/* linked commands */
244*fcf3ce44SJohn Forte 		inq_res1	: 1,	/* reserved */
245*fcf3ce44SJohn Forte 		inq_cmdque	: 1,	/* command queueing */
246*fcf3ce44SJohn Forte 		inq_sftre	: 1;	/* Soft Reset option */
247*fcf3ce44SJohn Forte #else
248*fcf3ce44SJohn Forte 	uchar_t inq_sftre	: 1,	/* Soft Reset option */
249*fcf3ce44SJohn Forte 		inq_cmdque	: 1,	/* command queueing */
250*fcf3ce44SJohn Forte 		inq_res1	: 1,	/* reserved */
251*fcf3ce44SJohn Forte 		inq_linked	: 1,	/* linked commands */
252*fcf3ce44SJohn Forte 		inq_sync	: 1,	/* synchronous data xfers */
253*fcf3ce44SJohn Forte 		inq_wbus16	: 1,	/* 16 bit wide data xfers */
254*fcf3ce44SJohn Forte 		inq_wbus32	: 1,	/* 32 bit wide data xfers */
255*fcf3ce44SJohn Forte 		inq_2_reladdr	: 1;	/* relative addressing */
256*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_HTOL */
257*fcf3ce44SJohn Forte } L_inq_2;
258*fcf3ce44SJohn Forte 
259*fcf3ce44SJohn Forte typedef struct l_inquiry_inq_3 {
260*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_HTOL)
261*fcf3ce44SJohn Forte 	uchar_t inq_3_reladdr	: 1,	/* relative addressing */
262*fcf3ce44SJohn Forte 		inq_SIP_2	: 3,	/* Interlocked Protocol */
263*fcf3ce44SJohn Forte 		inq_3_linked	: 1,	/* linked commands */
264*fcf3ce44SJohn Forte 		inq_trandis	: 1,	/* Transfer Disable */
265*fcf3ce44SJohn Forte 		inq_3_cmdque	: 1,	/* command queueing */
266*fcf3ce44SJohn Forte 		inq_SIP_3	: 1;	/* Interlocked Protocol */
267*fcf3ce44SJohn Forte #else
268*fcf3ce44SJohn Forte 	uchar_t inq_SIP_3	: 1,	/* Interlocked Protocol */
269*fcf3ce44SJohn Forte 		inq_3_cmdque	: 1,	/* command queueing */
270*fcf3ce44SJohn Forte 		inq_trandis	: 1,	/* Transfer Disable */
271*fcf3ce44SJohn Forte 		inq_3_linked	: 1,	/* linked commands */
272*fcf3ce44SJohn Forte 		inq_SIP_2	: 3,	/* Interlocked Protocol */
273*fcf3ce44SJohn Forte 		inq_3_reladdr	: 1;	/* relative addressing */
274*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_HTOL */
275*fcf3ce44SJohn Forte } L_inq_3;
276*fcf3ce44SJohn Forte 
277*fcf3ce44SJohn Forte typedef struct l_inquiry_struct {
278*fcf3ce44SJohn Forte 	/*
279*fcf3ce44SJohn Forte 	 * byte 0
280*fcf3ce44SJohn Forte 	 *
281*fcf3ce44SJohn Forte 	 * Bits 7-5 are the Peripheral Device Qualifier
282*fcf3ce44SJohn Forte 	 * Bits 4-0 are the Peripheral Device Type
283*fcf3ce44SJohn Forte 	 *
284*fcf3ce44SJohn Forte 	 */
285*fcf3ce44SJohn Forte 	uchar_t	inq_dtype;
286*fcf3ce44SJohn Forte 	/* byte 1 */
287*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_HTOL)
288*fcf3ce44SJohn Forte 	uchar_t	inq_rmb		: 1,	/* removable media */
289*fcf3ce44SJohn Forte 		inq_qual	: 7;	/* device type qualifier */
290*fcf3ce44SJohn Forte #else
291*fcf3ce44SJohn Forte 	uchar_t	inq_qual	: 7,	/* device type qualifier */
292*fcf3ce44SJohn Forte 		inq_rmb		: 1; 	/* removable media */
293*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_HTOL */
294*fcf3ce44SJohn Forte 
295*fcf3ce44SJohn Forte 	/* byte 2 */
296*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_HTOL)
297*fcf3ce44SJohn Forte 	uchar_t	inq_iso		: 2,	/* ISO version */
298*fcf3ce44SJohn Forte 		inq_ecma	: 3,	/* ECMA version */
299*fcf3ce44SJohn Forte 		inq_ansi	: 3;	/* ANSI version */
300*fcf3ce44SJohn Forte #else
301*fcf3ce44SJohn Forte 	uchar_t	inq_ansi	: 3,	/* ANSI version */
302*fcf3ce44SJohn Forte 		inq_ecma	: 3,	/* ECMA version */
303*fcf3ce44SJohn Forte 		inq_iso		: 2;	/* ISO version */
304*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_HTOL */
305*fcf3ce44SJohn Forte 
306*fcf3ce44SJohn Forte 	/* byte 3 */
307*fcf3ce44SJohn Forte #define	inq_aerc inq_aenc	/* SCSI-3 */
308*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_HTOL)
309*fcf3ce44SJohn Forte 	uchar_t	inq_aenc	: 1,	/* async event notification cap. */
310*fcf3ce44SJohn Forte 		inq_trmiop	: 1,	/* supports TERMINATE I/O PROC msg */
311*fcf3ce44SJohn Forte 		inq_normaca	: 1,	/* Normal ACA Supported */
312*fcf3ce44SJohn Forte 				: 1,	/* reserved */
313*fcf3ce44SJohn Forte 		inq_rdf		: 4;	/* response data format */
314*fcf3ce44SJohn Forte #else
315*fcf3ce44SJohn Forte 	uchar_t	inq_rdf		: 4,	/* response data format */
316*fcf3ce44SJohn Forte 				: 1,	/* reserved */
317*fcf3ce44SJohn Forte 		inq_normaca	: 1,	/* Normal ACA Supported */
318*fcf3ce44SJohn Forte 		inq_trmiop	: 1,	/* supports TERMINATE I/O PROC msg */
319*fcf3ce44SJohn Forte 		inq_aenc	: 1;	/* async event notification cap. */
320*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_HTOL */
321*fcf3ce44SJohn Forte 
322*fcf3ce44SJohn Forte 	/* bytes 4-7 */
323*fcf3ce44SJohn Forte 	uchar_t	inq_len;		/* additional length */
324*fcf3ce44SJohn Forte 	uchar_t			: 8;	/* reserved */
325*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_HTOL)
326*fcf3ce44SJohn Forte 	uchar_t			: 2,	/* reserved */
327*fcf3ce44SJohn Forte 		inq_port	: 1,	/* Only defined when dual_p set */
328*fcf3ce44SJohn Forte 		inq_dual_p	: 1,	/* Dual Port */
329*fcf3ce44SJohn Forte 		inq_mchngr	: 1,	/* Medium Changer */
330*fcf3ce44SJohn Forte 		inq_SIP_1	: 3;	/* Interlocked Protocol */
331*fcf3ce44SJohn Forte #else
332*fcf3ce44SJohn Forte 	uchar_t	inq_SIP_1	: 3,	/* Interlocked Protocol */
333*fcf3ce44SJohn Forte 		inq_mchngr	: 1,	/* Medium Changer */
334*fcf3ce44SJohn Forte 		inq_dual_p	: 1,	/* Dual Port */
335*fcf3ce44SJohn Forte 		inq_port	: 1,	/* Only defined when dual_p set */
336*fcf3ce44SJohn Forte 				: 2;	/* reserved */
337*fcf3ce44SJohn Forte #endif /* _BIT_FIELDS_HTOL */
338*fcf3ce44SJohn Forte 
339*fcf3ce44SJohn Forte 	union {
340*fcf3ce44SJohn Forte 		L_inq_2 inq_2;
341*fcf3ce44SJohn Forte 		L_inq_3 inq_3;
342*fcf3ce44SJohn Forte 	} ui;
343*fcf3ce44SJohn Forte 
344*fcf3ce44SJohn Forte 
345*fcf3ce44SJohn Forte 	/* bytes 8-35 */
346*fcf3ce44SJohn Forte 
347*fcf3ce44SJohn Forte 	uchar_t	inq_vid[8];		/* vendor ID */
348*fcf3ce44SJohn Forte 
349*fcf3ce44SJohn Forte 	uchar_t	inq_pid[16];		/* product ID */
350*fcf3ce44SJohn Forte 
351*fcf3ce44SJohn Forte 	uchar_t	inq_revision[4];	/* product revision level */
352*fcf3ce44SJohn Forte 
353*fcf3ce44SJohn Forte 	/*
354*fcf3ce44SJohn Forte 	 * Bytes 36-55 are vendor-specific parameter bytes
355*fcf3ce44SJohn Forte 	 */
356*fcf3ce44SJohn Forte 
357*fcf3ce44SJohn Forte 	/* SSA specific definitions */
358*fcf3ce44SJohn Forte 	/* bytes 36 - 39 */
359*fcf3ce44SJohn Forte #define	inq_ven_specific_1 inq_firmware_rev
360*fcf3ce44SJohn Forte 	uchar_t	inq_firmware_rev[4];	/* firmware revision level */
361*fcf3ce44SJohn Forte 
362*fcf3ce44SJohn Forte 	/* bytes 40 - 51 */
363*fcf3ce44SJohn Forte 	uchar_t	inq_serial[12];		/* serial number, not used any more */
364*fcf3ce44SJohn Forte 
365*fcf3ce44SJohn Forte 	/* bytes 52-53 */
366*fcf3ce44SJohn Forte 	uchar_t	inq_res2[2];
367*fcf3ce44SJohn Forte 
368*fcf3ce44SJohn Forte 	/* byte 54, 55 */
369*fcf3ce44SJohn Forte 	uchar_t	inq_ssa_ports;		/* number of ports */
370*fcf3ce44SJohn Forte 	uchar_t	inq_ssa_tgts;		/* number of targets */
371*fcf3ce44SJohn Forte 
372*fcf3ce44SJohn Forte 	/*
373*fcf3ce44SJohn Forte 	 * Bytes 56-95 are reserved.
374*fcf3ce44SJohn Forte 	 */
375*fcf3ce44SJohn Forte 	uchar_t	inq_res3[40];
376*fcf3ce44SJohn Forte 	/*
377*fcf3ce44SJohn Forte 	 * 96 to 'n' are vendor-specific parameter bytes
378*fcf3ce44SJohn Forte 	 */
379*fcf3ce44SJohn Forte 	uchar_t	inq_box_name[32];
380*fcf3ce44SJohn Forte 	uchar_t	inq_avu[256];
381*fcf3ce44SJohn Forte } L_inquiry;
382*fcf3ce44SJohn Forte #define	HEX_ONLY	0	/* Print Hex only */
383*fcf3ce44SJohn Forte #define	HEX_ASCII	1	/* Print Hex and Ascii */
384*fcf3ce44SJohn Forte #define	WWN_SIZE	8	/* # of bytes to dump per line */
385*fcf3ce44SJohn Forte 
386*fcf3ce44SJohn Forte /* NOTE: These command op codes are not defined in commands.h */
387*fcf3ce44SJohn Forte #define	SCMD_SYNC_CACHE		    0x35
388*fcf3ce44SJohn Forte #define	SCMD_LOG_SENSE		    0x4d
389*fcf3ce44SJohn Forte #define	SCMD_PERS_RESERV_IN	    0x5e
390*fcf3ce44SJohn Forte #define	SCMD_PERS_RESERV_OUT	    0x5f
391*fcf3ce44SJohn Forte 
392*fcf3ce44SJohn Forte typedef struct rls_payload {
393*fcf3ce44SJohn Forte 	uint_t  rls_portno;
394*fcf3ce44SJohn Forte 	uint_t  rls_linkfail;
395*fcf3ce44SJohn Forte 	uint_t  rls_syncfail;
396*fcf3ce44SJohn Forte 	uint_t  rls_sigfail;
397*fcf3ce44SJohn Forte 	uint_t  rls_primitiverr;
398*fcf3ce44SJohn Forte 	uint_t  rls_invalidword;
399*fcf3ce44SJohn Forte 	uint_t  rls_invalidcrc;
400*fcf3ce44SJohn Forte } rls_payload_t;
401*fcf3ce44SJohn Forte 
402*fcf3ce44SJohn Forte typedef struct l_inquiry00_struct {
403*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH)
404*fcf3ce44SJohn Forte uchar_t		qual    :3,
405*fcf3ce44SJohn Forte 		dtype   :5;
406*fcf3ce44SJohn Forte #else
407*fcf3ce44SJohn Forte uchar_t		dtype	:5,
408*fcf3ce44SJohn Forte 		qual	:3;
409*fcf3ce44SJohn Forte #endif	/* _BIT_FIELDS_LTOH */
410*fcf3ce44SJohn Forte uchar_t		page_code;
411*fcf3ce44SJohn Forte uchar_t		reserved;
412*fcf3ce44SJohn Forte uchar_t		len;
413*fcf3ce44SJohn Forte uchar_t		page_list[251];
414*fcf3ce44SJohn Forte } L_inquiry00;
415*fcf3ce44SJohn Forte 
416*fcf3ce44SJohn Forte #define	MIN(a, b) (a < b ? a : b)
417*fcf3ce44SJohn Forte #define	ER_DPRINTF	if (getenv("_LUX_ER_DEBUG") != NULL) (void) printf
418*fcf3ce44SJohn Forte #define	O_DPRINTF	if (getenv("_LUX_O_DEBUG") != NULL) (void) printf
419*fcf3ce44SJohn Forte #define	P_DPRINTF	if (getenv("_LUX_P_DEBUG") != NULL) (void) printf
420*fcf3ce44SJohn Forte #define	R_DPRINTF	if (getenv("_LUX_R_DEBUG") != NULL) (void) printf
421*fcf3ce44SJohn Forte #define	I_DPRINTF	if (getenv("_LUX_I_DEBUG") != NULL) (void) printf
422*fcf3ce44SJohn Forte #define	S_DPRINTF	if (getenv("_LUX_S_DEBUG") != NULL) (void) printf
423*fcf3ce44SJohn Forte #define	RETRY_FCIO_IOCTL    360
424*fcf3ce44SJohn Forte #define	WAIT_FCIO_IOCTL	    250000 /* 1/4 of a second */
425*fcf3ce44SJohn Forte 
426*fcf3ce44SJohn Forte #endif /* __x86 */
427*fcf3ce44SJohn Forte 
428*fcf3ce44SJohn Forte 
429*fcf3ce44SJohn Forte int adm_display_config(char **argv);
430*fcf3ce44SJohn Forte void adm_download(char **argv, char *file_name);
431*fcf3ce44SJohn Forte void up_encl_name(char **argv, int argc);
432*fcf3ce44SJohn Forte void adm_failover(char **argv);
433*fcf3ce44SJohn Forte void pho_probe();
434*fcf3ce44SJohn Forte void non_encl_probe();
435*fcf3ce44SJohn Forte void adm_led(char **argv, int led_action);
436*fcf3ce44SJohn Forte void up_password(char **argv);
437*fcf3ce44SJohn Forte int adm_start(char **argv);
438*fcf3ce44SJohn Forte int adm_stop(char **argv);
439*fcf3ce44SJohn Forte int adm_power_off(char **argv, int off_flag);
440*fcf3ce44SJohn Forte int adm_forcelip(char **argv);
441*fcf3ce44SJohn Forte void adm_bypass_enable(char **argv, int bypass_flag);
442*fcf3ce44SJohn Forte int adm_port_offline_online(char *argv[], int flag);
443*fcf3ce44SJohn Forte void display_link_status(char **argv);
444*fcf3ce44SJohn Forte int read_repos_file(char *repos_filename);
445*fcf3ce44SJohn Forte int adm_check_file(char **argv, int flag);
446*fcf3ce44SJohn Forte void dump(char **argv);
447*fcf3ce44SJohn Forte void dump_map(char **argv);
448*fcf3ce44SJohn Forte int adm_port_loopback(char *portpath, int flag);
449*fcf3ce44SJohn Forte int adm_inquiry(char **argv);
450*fcf3ce44SJohn Forte int adm_display_port(int verbose);
451*fcf3ce44SJohn Forte 
452*fcf3ce44SJohn Forte int adm_reserve(char *path);
453*fcf3ce44SJohn Forte int adm_release(char *path);
454*fcf3ce44SJohn Forte void i18n_catopen();
455*fcf3ce44SJohn Forte void dump_hex_data(char *, uchar_t *, int, int);
456*fcf3ce44SJohn Forte void print_errString(int, char *);
457*fcf3ce44SJohn Forte void	print_chars(uchar_t *, int, int);
458*fcf3ce44SJohn Forte void	print_inq_data(char *, char *, L_inquiry, uchar_t *, size_t);
459*fcf3ce44SJohn Forte void print_fabric_dtype_prop(uchar_t *hba_port_wwn, uchar_t *port_wwn,
460*fcf3ce44SJohn Forte 	uchar_t dtype_prop);
461*fcf3ce44SJohn Forte void print_private_loop_dtype_prop(uchar_t *hba_port_wwn, uchar_t *port_wwn,
462*fcf3ce44SJohn Forte 	uchar_t dtype_prop);
463*fcf3ce44SJohn Forte char *get_errString(int errornum);
464*fcf3ce44SJohn Forte int cmp_raw_wwn(uchar_t *wwn_1, uchar_t *wwn_2);
465*fcf3ce44SJohn Forte 
466*fcf3ce44SJohn Forte /* routines in fchba*.c files */
467*fcf3ce44SJohn Forte int fchba_display_port(int verbose);
468*fcf3ce44SJohn Forte int fchba_display_config(char **argv, int option_t_input, int argc);
469*fcf3ce44SJohn Forte char *get_slash_devices_from_osDevName(char *osDevName, int flag);
470*fcf3ce44SJohn Forte int get_scsi_vhci_pathinfo(char *dev_path, sv_iocdata_t *ioc,
471*fcf3ce44SJohn Forte 		int *path_count);
472*fcf3ce44SJohn Forte int get_mode_page(char *path, uchar_t **pg_buf);
473*fcf3ce44SJohn Forte int scsi_mode_sense_cmd(int fd, uchar_t *buf_ptr, int buf_len, uchar_t pc,
474*fcf3ce44SJohn Forte 	uchar_t page_code);
475*fcf3ce44SJohn Forte int scsi_release(char *path);
476*fcf3ce44SJohn Forte int scsi_reserve(char *path);
477*fcf3ce44SJohn Forte int is_path(char *arg);
478*fcf3ce44SJohn Forte int is_wwn(char *arg);
479*fcf3ce44SJohn Forte int loadLibrary();
480*fcf3ce44SJohn Forte uint32_t getNumberOfAdapters();
481*fcf3ce44SJohn Forte int getAdapterAttrs(HBA_HANDLE handle,
482*fcf3ce44SJohn Forte 	char *name, HBA_ADAPTERATTRIBUTES *attrs);
483*fcf3ce44SJohn Forte int getAdapterPortAttrs(HBA_HANDLE handle, char *name, int portIndex,
484*fcf3ce44SJohn Forte 	HBA_PORTATTRIBUTES *attrs);
485*fcf3ce44SJohn Forte HBA_STATUS fetch_mappings(HBA_HANDLE handle, HBA_WWN pwwn,
486*fcf3ce44SJohn Forte     HBA_FCPTARGETMAPPINGV2 **map);
487*fcf3ce44SJohn Forte int match_mappings(char *compare, HBA_FCPTARGETMAPPINGV2 *map);
488*fcf3ce44SJohn Forte uint64_t wwnConversion(uchar_t *wwn);
489*fcf3ce44SJohn Forte 
490*fcf3ce44SJohn Forte 
491*fcf3ce44SJohn Forte #ifdef	__cplusplus
492*fcf3ce44SJohn Forte }
493*fcf3ce44SJohn Forte #endif
494*fcf3ce44SJohn Forte 
495*fcf3ce44SJohn Forte #endif	/* _COMMON_H */
496