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