xref: /onnv-gate/usr/src/cmd/sasinfo/printAttrs.c (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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*10652SHyon.Kim@Sun.COM  * Use is subject to license terms.
24*10652SHyon.Kim@Sun.COM  */
25*10652SHyon.Kim@Sun.COM 
26*10652SHyon.Kim@Sun.COM #include <ctype.h>
27*10652SHyon.Kim@Sun.COM #include <printAttrs.h>
28*10652SHyon.Kim@Sun.COM 
29*10652SHyon.Kim@Sun.COM static SAS_STATE hbastatus_string[] = {
30*10652SHyon.Kim@Sun.COM 	HBA_STATUS_OK,				"Okay",
31*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR,			"Error",
32*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_NOT_SUPPORTED,		"Not Supported",
33*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_INVALID_HANDLE,	"Invalid Handle",
34*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_ARG,			"Argument Error",
35*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_ILLEGAL_WWN,		"Illegal WWN",
36*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_ILLEGAL_INDEX,		"Illegal Index",
37*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_MORE_DATA,		"Not Enough Buffer for Data",
38*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_STALE_DATA,		"Stale Data",
39*10652SHyon.Kim@Sun.COM 	HBA_STATUS_SCSI_CHECK_CONDITION,	"SCSI Check Condition",
40*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_BUSY,			"Busy",
41*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TRY_AGAIN,		"Try Again",
42*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_UNAVAILABLE,		"Unavailable",
43*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_ELS_REJECT,		"ELS Reject",
44*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_INVALID_LUN,		"Invalid LUN",
45*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_INCOMPATIBLE,		"Request Incompatible",
46*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_AMBIGUOUS_WWN,		"Ambiguous WWN",
47*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_LOCAL_BUS,		"Local Bus Error",
48*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_LOCAL_TARGET,		"Local Target Error",
49*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_LOCAL_LUN,		"Local LUN Error",
50*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_LOCAL_SCSIID_BOUND,	"Local SCSIID Bound",
51*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TARGET_FCID,		"Target FCID Error",
52*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TARGET_NODE_WWN,	"Target Node WWN Error",
53*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TARGET_PORT_WWN,	"Target Port WWN Error",
54*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TARGET_LUN,		"Target LUN Error",
55*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TARGET_LUID,		"Target LUID Error",
56*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_NO_SUCH_BINDING,	"No Such Binding",
57*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_NOT_A_TARGET,		"Not a Target",
58*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_UNSUPPORTED_FC4,	"Unsupported FC4",
59*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_INCAPABLE,		"Incapable",
60*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_TARGET_BUSY,		"Target Busy",
61*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_NOT_LOADED,		"Not Loaded",
62*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_ALREADY_LOADED,	"Alreday Loaded",
63*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_ILLEGAL_FCID,		"Illegal FCID",
64*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_NOT_ASCSIDEVICE,	"Not a SCSI Device",
65*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_INVALID_PROTOCOL_TYPE,	"Invalid Protocol Type",
66*10652SHyon.Kim@Sun.COM 	HBA_STATUS_ERROR_BAD_EVENT_TYPE,	"Bad Event Type",
67*10652SHyon.Kim@Sun.COM 	-1,					NULL
68*10652SHyon.Kim@Sun.COM };
69*10652SHyon.Kim@Sun.COM 
70*10652SHyon.Kim@Sun.COM SAS_STATE porttype_string[] = {
71*10652SHyon.Kim@Sun.COM 	HBA_PORTTYPE_UNKNOWN,		"UNKNOWN",
72*10652SHyon.Kim@Sun.COM 	HBA_PORTTYPE_OTHER,		"OTHER",
73*10652SHyon.Kim@Sun.COM 	HBA_PORTTYPE_NOTPRESENT,	"NOT Present",
74*10652SHyon.Kim@Sun.COM 	HBA_PORTTYPE_SASDEVICE,		"SAS Device",
75*10652SHyon.Kim@Sun.COM 	HBA_PORTTYPE_SATADEVICE,	"SATA Device",
76*10652SHyon.Kim@Sun.COM 	HBA_PORTTYPE_SASEXPANDER, 	"SAS Expander",
77*10652SHyon.Kim@Sun.COM 	-1,				NULL,
78*10652SHyon.Kim@Sun.COM };
79*10652SHyon.Kim@Sun.COM 
80*10652SHyon.Kim@Sun.COM SAS_STATE portstate_string[] = {
81*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_UNKNOWN,		"unknown",
82*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_ONLINE,		"online",
83*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_OFFLINE,		"offline",
84*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_BYPASSED,		"bypassed",
85*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_DIAGNOSTICS,	"diagnostics",
86*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_LINKDOWN,		"link Down",
87*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_ERROR,		"port Error",
88*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_LOOPBACK,		"loopback",
89*10652SHyon.Kim@Sun.COM 	HBA_PORTSTATE_DEGRADED,		"degraded",
90*10652SHyon.Kim@Sun.COM 	-1,				NULL,
91*10652SHyon.Kim@Sun.COM };
92*10652SHyon.Kim@Sun.COM 
93*10652SHyon.Kim@Sun.COM static SAS_STATE phystate_string[] = {
94*10652SHyon.Kim@Sun.COM 	HBA_SASSTATE_UNKNOWN,		"unknown",
95*10652SHyon.Kim@Sun.COM 	HBA_SASSTATE_DISABLED,		"disabled",
96*10652SHyon.Kim@Sun.COM 	HBA_SASSTATE_FAILED,		"failed",
97*10652SHyon.Kim@Sun.COM 	HBA_SASSTATE_SATASPINUP,	"sata-spinup",
98*10652SHyon.Kim@Sun.COM 	HBA_SASSTATE_SATAPORTSEL,	"sata-portselector",
99*10652SHyon.Kim@Sun.COM 	HBA_SASSPEED_1_5GBIT,		"1.5Gbit",
100*10652SHyon.Kim@Sun.COM 	HBA_SASSPEED_3GBIT,		"3Gbit",
101*10652SHyon.Kim@Sun.COM 	HBA_SASSPEED_6GBIT,		"6Gbit",
102*10652SHyon.Kim@Sun.COM 	-1,				NULL,
103*10652SHyon.Kim@Sun.COM };
104*10652SHyon.Kim@Sun.COM 
105*10652SHyon.Kim@Sun.COM static SAS_STATE dtype_string[] = {
106*10652SHyon.Kim@Sun.COM 	DTYPE_DIRECT,			"Disk Device",
107*10652SHyon.Kim@Sun.COM 	DTYPE_SEQUENTIAL,		"Tape Device",
108*10652SHyon.Kim@Sun.COM 	DTYPE_PRINTER,			"Printer Device",
109*10652SHyon.Kim@Sun.COM 	DTYPE_PROCESSOR,		"Processor Device",
110*10652SHyon.Kim@Sun.COM 	DTYPE_WORM,			"WORM Device",
111*10652SHyon.Kim@Sun.COM 	DTYPE_RODIRECT,			"CD/DVD Device",
112*10652SHyon.Kim@Sun.COM 	DTYPE_SCANNER,			"Scanner Device",
113*10652SHyon.Kim@Sun.COM 	DTYPE_OPTICAL,			"Optical Memory Device",
114*10652SHyon.Kim@Sun.COM 	DTYPE_CHANGER,			"Medium Changer Device",
115*10652SHyon.Kim@Sun.COM 	DTYPE_COMM,			"Communications Device",
116*10652SHyon.Kim@Sun.COM 	DTYPE_ARRAY_CTRL,		"Storage Array Controller Device",
117*10652SHyon.Kim@Sun.COM 	DTYPE_ESI,			"Enclosure Services Device",
118*10652SHyon.Kim@Sun.COM 	DTYPE_RBC,			"Simplified Direct-access Device",
119*10652SHyon.Kim@Sun.COM 	DTYPE_OCRW,			"Optical Card Reader/Writer Device",
120*10652SHyon.Kim@Sun.COM 	DTYPE_BCC,			"Bridge Controller Commands",
121*10652SHyon.Kim@Sun.COM 	DTYPE_OSD,			"Object-based Storage Device",
122*10652SHyon.Kim@Sun.COM 	DTYPE_ADC,			"Automation/Drive Interface",
123*10652SHyon.Kim@Sun.COM 	DTYPE_WELLKNOWN,		"Well Known Logical Unit",
124*10652SHyon.Kim@Sun.COM 	DTYPE_UNKNOWN,			"Unknown Device",
125*10652SHyon.Kim@Sun.COM 	-1,				NULL
126*10652SHyon.Kim@Sun.COM };
127*10652SHyon.Kim@Sun.COM 
128*10652SHyon.Kim@Sun.COM static char *getPhyStateString(HBA_UINT32 key, phystat_type phyt);
129*10652SHyon.Kim@Sun.COM 
130*10652SHyon.Kim@Sun.COM char *
getIndentSpaces(int number)131*10652SHyon.Kim@Sun.COM getIndentSpaces(int number)
132*10652SHyon.Kim@Sun.COM {
133*10652SHyon.Kim@Sun.COM 	int 		i = 0;
134*10652SHyon.Kim@Sun.COM 	/* the maximum indent with terminator '\0' */
135*10652SHyon.Kim@Sun.COM 	static char	ret[MAXINDENT+1];
136*10652SHyon.Kim@Sun.COM 
137*10652SHyon.Kim@Sun.COM 	if (number > MAXINDENT)
138*10652SHyon.Kim@Sun.COM 		number = MAXINDENT;
139*10652SHyon.Kim@Sun.COM 
140*10652SHyon.Kim@Sun.COM 	for (i = 0; i < number; i++) {
141*10652SHyon.Kim@Sun.COM 		ret[i] = ' ';
142*10652SHyon.Kim@Sun.COM 	}
143*10652SHyon.Kim@Sun.COM 	ret[i] = '\0';
144*10652SHyon.Kim@Sun.COM 	return (ret);
145*10652SHyon.Kim@Sun.COM }
146*10652SHyon.Kim@Sun.COM 
147*10652SHyon.Kim@Sun.COM char *
getStateString(HBA_UINT32 key,SAS_STATE * stat_string)148*10652SHyon.Kim@Sun.COM getStateString(HBA_UINT32 key, SAS_STATE *stat_string)
149*10652SHyon.Kim@Sun.COM {
150*10652SHyon.Kim@Sun.COM 	static char ret[64];
151*10652SHyon.Kim@Sun.COM 	while (stat_string->key != -1) {
152*10652SHyon.Kim@Sun.COM 		if (stat_string->key == key) {
153*10652SHyon.Kim@Sun.COM 			return ((char *)stat_string->value);
154*10652SHyon.Kim@Sun.COM 		}
155*10652SHyon.Kim@Sun.COM 		stat_string++;
156*10652SHyon.Kim@Sun.COM 	}
157*10652SHyon.Kim@Sun.COM 	(void *) sprintf(ret, "Undefined value (%d)", key);
158*10652SHyon.Kim@Sun.COM 	return (ret);
159*10652SHyon.Kim@Sun.COM }
160*10652SHyon.Kim@Sun.COM 
161*10652SHyon.Kim@Sun.COM static char *
getPhyStateString(HBA_UINT32 key,phystat_type phyt)162*10652SHyon.Kim@Sun.COM getPhyStateString(HBA_UINT32 key, phystat_type phyt)
163*10652SHyon.Kim@Sun.COM {
164*10652SHyon.Kim@Sun.COM 	int i = 0, len = 0, match = 0;
165*10652SHyon.Kim@Sun.COM 	HBA_UINT32 physpeed[] = {
166*10652SHyon.Kim@Sun.COM 		HBA_SASSPEED_1_5GBIT,
167*10652SHyon.Kim@Sun.COM 		HBA_SASSPEED_3GBIT,
168*10652SHyon.Kim@Sun.COM 		HBA_SASSPEED_6GBIT
169*10652SHyon.Kim@Sun.COM 	};
170*10652SHyon.Kim@Sun.COM 
171*10652SHyon.Kim@Sun.COM 	len = sizeof (physpeed) / sizeof (HBA_UINT32);
172*10652SHyon.Kim@Sun.COM 	for (i = 0; i < len; i++) {
173*10652SHyon.Kim@Sun.COM 		if (key == physpeed[i]) {
174*10652SHyon.Kim@Sun.COM 			match = 1;
175*10652SHyon.Kim@Sun.COM 			break;
176*10652SHyon.Kim@Sun.COM 		}
177*10652SHyon.Kim@Sun.COM 	}
178*10652SHyon.Kim@Sun.COM 
179*10652SHyon.Kim@Sun.COM 	if (match == 1) {
180*10652SHyon.Kim@Sun.COM 		if (phyt == PHY_STATE)
181*10652SHyon.Kim@Sun.COM 			return ("enabled");
182*10652SHyon.Kim@Sun.COM 		else
183*10652SHyon.Kim@Sun.COM 			return (getStateString(key, phystate_string));
184*10652SHyon.Kim@Sun.COM 	} else {
185*10652SHyon.Kim@Sun.COM 		if (phyt == PHY_STATE)
186*10652SHyon.Kim@Sun.COM 			return (getStateString(key, phystate_string));
187*10652SHyon.Kim@Sun.COM 		else
188*10652SHyon.Kim@Sun.COM 			return ("not available");
189*10652SHyon.Kim@Sun.COM 	}
190*10652SHyon.Kim@Sun.COM }
191*10652SHyon.Kim@Sun.COM 
192*10652SHyon.Kim@Sun.COM char *
getHBAStatus(HBA_STATUS key)193*10652SHyon.Kim@Sun.COM getHBAStatus(HBA_STATUS key)
194*10652SHyon.Kim@Sun.COM {
195*10652SHyon.Kim@Sun.COM 	return (getStateString(key, hbastatus_string));
196*10652SHyon.Kim@Sun.COM }
197*10652SHyon.Kim@Sun.COM 
198*10652SHyon.Kim@Sun.COM /*
199*10652SHyon.Kim@Sun.COM  * return device type description
200*10652SHyon.Kim@Sun.COM  *
201*10652SHyon.Kim@Sun.COM  * Arguments:
202*10652SHyon.Kim@Sun.COM  *	dType - Device type returned from Standard INQUIRY
203*10652SHyon.Kim@Sun.COM  * Returns:
204*10652SHyon.Kim@Sun.COM  *	char string description for device type
205*10652SHyon.Kim@Sun.COM  */
206*10652SHyon.Kim@Sun.COM char *
getDTypeString(uchar_t dType)207*10652SHyon.Kim@Sun.COM getDTypeString(uchar_t dType)
208*10652SHyon.Kim@Sun.COM {
209*10652SHyon.Kim@Sun.COM 	return (getStateString((dType & DTYPE_MASK), dtype_string));
210*10652SHyon.Kim@Sun.COM }
211*10652SHyon.Kim@Sun.COM 
212*10652SHyon.Kim@Sun.COM uint64_t
wwnConversion(uchar_t * wwn)213*10652SHyon.Kim@Sun.COM wwnConversion(uchar_t *wwn)
214*10652SHyon.Kim@Sun.COM {
215*10652SHyon.Kim@Sun.COM 	uint64_t tmp;
216*10652SHyon.Kim@Sun.COM 	(void *) memcpy(&tmp, wwn, sizeof (uint64_t));
217*10652SHyon.Kim@Sun.COM 	return (ntohll(tmp));
218*10652SHyon.Kim@Sun.COM }
219*10652SHyon.Kim@Sun.COM 
220*10652SHyon.Kim@Sun.COM /*
221*10652SHyon.Kim@Sun.COM  * prints out HBA information
222*10652SHyon.Kim@Sun.COM  */
223*10652SHyon.Kim@Sun.COM void
printHBAInfo(SMHBA_ADAPTERATTRIBUTES * attrs,int pflag,int numberOfPorts,const char * adapterName)224*10652SHyon.Kim@Sun.COM printHBAInfo(SMHBA_ADAPTERATTRIBUTES *attrs, int pflag, int numberOfPorts,
225*10652SHyon.Kim@Sun.COM     const char *adapterName)
226*10652SHyon.Kim@Sun.COM {
227*10652SHyon.Kim@Sun.COM 
228*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s %s\n", "HBA Name:", adapterName);
229*10652SHyon.Kim@Sun.COM 
230*10652SHyon.Kim@Sun.COM 	if (pflag & PRINT_VERBOSE) {
231*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
232*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4), "Manufacturer:",
233*10652SHyon.Kim@Sun.COM 		    attrs->Manufacturer[0] == 0?
234*10652SHyon.Kim@Sun.COM 		    "not available":attrs->Manufacturer);
235*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
236*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4), "Model: ",
237*10652SHyon.Kim@Sun.COM 		    attrs->Model[0] == 0? "not available":attrs->Model);
238*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
239*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4),
240*10652SHyon.Kim@Sun.COM 		    "Firmware Version:",
241*10652SHyon.Kim@Sun.COM 		    attrs->FirmwareVersion[0] == 0? "not available":
242*10652SHyon.Kim@Sun.COM 		    attrs->FirmwareVersion);
243*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
244*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4),
245*10652SHyon.Kim@Sun.COM 		    "FCode/BIOS Version:",
246*10652SHyon.Kim@Sun.COM 		    attrs->OptionROMVersion[0] == 0? "not available":
247*10652SHyon.Kim@Sun.COM 		    attrs->OptionROMVersion);
248*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
249*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4),
250*10652SHyon.Kim@Sun.COM 		    "Serial Number:",
251*10652SHyon.Kim@Sun.COM 		    attrs->SerialNumber[0] == 0? "not available":
252*10652SHyon.Kim@Sun.COM 		    attrs->SerialNumber);
253*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
254*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4),
255*10652SHyon.Kim@Sun.COM 		    "Driver Name:",
256*10652SHyon.Kim@Sun.COM 		    attrs->DriverName[0] == 0? "not available":
257*10652SHyon.Kim@Sun.COM 		    attrs->DriverName);
258*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %s\n",
259*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4),
260*10652SHyon.Kim@Sun.COM 		    "Driver Version:",
261*10652SHyon.Kim@Sun.COM 		    attrs->DriverVersion[0] == 0? "not available":
262*10652SHyon.Kim@Sun.COM 		    attrs->DriverVersion);
263*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%s%s %d\n",
264*10652SHyon.Kim@Sun.COM 		    getIndentSpaces(4),
265*10652SHyon.Kim@Sun.COM 		    "Number of HBA Ports:",
266*10652SHyon.Kim@Sun.COM 		    numberOfPorts);
267*10652SHyon.Kim@Sun.COM 	}
268*10652SHyon.Kim@Sun.COM }
269*10652SHyon.Kim@Sun.COM 
270*10652SHyon.Kim@Sun.COM /*
271*10652SHyon.Kim@Sun.COM  * prints out all the HBA port information
272*10652SHyon.Kim@Sun.COM  */
273*10652SHyon.Kim@Sun.COM void
printHBAPortInfo(SMHBA_PORTATTRIBUTES * port,SMHBA_ADAPTERATTRIBUTES * attrs,int pflag)274*10652SHyon.Kim@Sun.COM printHBAPortInfo(SMHBA_PORTATTRIBUTES *port,
275*10652SHyon.Kim@Sun.COM     SMHBA_ADAPTERATTRIBUTES *attrs, int pflag) {
276*10652SHyon.Kim@Sun.COM 
277*10652SHyon.Kim@Sun.COM 	if ((port == NULL) || (attrs == NULL)) {
278*10652SHyon.Kim@Sun.COM 		return;
279*10652SHyon.Kim@Sun.COM 	}
280*10652SHyon.Kim@Sun.COM 
281*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s\n",
282*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(2),
283*10652SHyon.Kim@Sun.COM 	    "HBA Port Name:",
284*10652SHyon.Kim@Sun.COM 	    port->OSDeviceName);
285*10652SHyon.Kim@Sun.COM 
286*10652SHyon.Kim@Sun.COM 	if (!(pflag & PRINT_VERBOSE)) {
287*10652SHyon.Kim@Sun.COM 		return;
288*10652SHyon.Kim@Sun.COM 	}
289*10652SHyon.Kim@Sun.COM 
290*10652SHyon.Kim@Sun.COM 	if (port->PortType != HBA_PORTTYPE_SASDEVICE)
291*10652SHyon.Kim@Sun.COM 		return;
292*10652SHyon.Kim@Sun.COM 
293*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s\n",
294*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(4),
295*10652SHyon.Kim@Sun.COM 	    "Type:",
296*10652SHyon.Kim@Sun.COM 	    getStateString(port->PortType, porttype_string));
297*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s\n",
298*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(4),
299*10652SHyon.Kim@Sun.COM 	    "State:",
300*10652SHyon.Kim@Sun.COM 	    getStateString(port->PortState, portstate_string));
301*10652SHyon.Kim@Sun.COM 
302*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %016llx\n",
303*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(4),
304*10652SHyon.Kim@Sun.COM 	    "Local SAS Address:",
305*10652SHyon.Kim@Sun.COM 	    wwnConversion(port->PortSpecificAttribute.SASPort->\
306*10652SHyon.Kim@Sun.COM 	    LocalSASAddress.wwn));
307*10652SHyon.Kim@Sun.COM 
308*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %016llx\n",
309*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(4),
310*10652SHyon.Kim@Sun.COM 	    "Attached SAS Address:",
311*10652SHyon.Kim@Sun.COM 	    wwnConversion(port->PortSpecificAttribute.SASPort->\
312*10652SHyon.Kim@Sun.COM 	    AttachedSASAddress.wwn));
313*10652SHyon.Kim@Sun.COM 
314*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %d\n",
315*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(4),
316*10652SHyon.Kim@Sun.COM 	    "Number of Phys:",
317*10652SHyon.Kim@Sun.COM 	    port->PortSpecificAttribute.SASPort->NumberofPhys);
318*10652SHyon.Kim@Sun.COM }
319*10652SHyon.Kim@Sun.COM 
320*10652SHyon.Kim@Sun.COM void
printHBAPortPhyInfo(SMHBA_SAS_PHY * phyinfo)321*10652SHyon.Kim@Sun.COM printHBAPortPhyInfo(SMHBA_SAS_PHY *phyinfo)
322*10652SHyon.Kim@Sun.COM {
323*10652SHyon.Kim@Sun.COM 	if (phyinfo == NULL)
324*10652SHyon.Kim@Sun.COM 		return;
325*10652SHyon.Kim@Sun.COM 
326*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %u\n",
327*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(6),
328*10652SHyon.Kim@Sun.COM 	    "Identifier:",
329*10652SHyon.Kim@Sun.COM 	    phyinfo->PhyIdentifier);
330*10652SHyon.Kim@Sun.COM 
331*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s\n",
332*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(8),
333*10652SHyon.Kim@Sun.COM 	    "State: ",
334*10652SHyon.Kim@Sun.COM 	    getPhyStateString(phyinfo->NegotiatedLinkRate, PHY_STATE));
335*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s/%s\n",
336*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(8),
337*10652SHyon.Kim@Sun.COM 	    "HardwareLinkRate(Min/Max):",
338*10652SHyon.Kim@Sun.COM 	    getPhyStateString(phyinfo->HardwareMinLinkRate, PHY_SPEED),
339*10652SHyon.Kim@Sun.COM 	    getPhyStateString(phyinfo->HardwareMaxLinkRate, PHY_SPEED));
340*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s/%s\n",
341*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(8),
342*10652SHyon.Kim@Sun.COM 	    "ProgrammedLinkRate(Min/Max):",
343*10652SHyon.Kim@Sun.COM 	    getPhyStateString(phyinfo->ProgrammedMinLinkRate, PHY_SPEED),
344*10652SHyon.Kim@Sun.COM 	    getPhyStateString(phyinfo->ProgrammedMaxLinkRate, PHY_SPEED));
345*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %s\n",
346*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(8),
347*10652SHyon.Kim@Sun.COM 	    "NegotiatedLinkRate:",
348*10652SHyon.Kim@Sun.COM 	    getPhyStateString(phyinfo->NegotiatedLinkRate, PHY_SPEED));
349*10652SHyon.Kim@Sun.COM }
350*10652SHyon.Kim@Sun.COM 
351*10652SHyon.Kim@Sun.COM void
printHBAPortPhyStatistics(SMHBA_SASPHYSTATISTICS * phystat)352*10652SHyon.Kim@Sun.COM printHBAPortPhyStatistics(SMHBA_SASPHYSTATISTICS *phystat)
353*10652SHyon.Kim@Sun.COM {
354*10652SHyon.Kim@Sun.COM 	if (phystat == NULL)
355*10652SHyon.Kim@Sun.COM 		return;
356*10652SHyon.Kim@Sun.COM 
357*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s\n",
358*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(8),
359*10652SHyon.Kim@Sun.COM 	    "Link Error Statistics:");
360*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %llu\n",
361*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(12),
362*10652SHyon.Kim@Sun.COM 	    "Invalid Dword:",
363*10652SHyon.Kim@Sun.COM 	    phystat->InvalidDwordCount);
364*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %llu\n",
365*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(12),
366*10652SHyon.Kim@Sun.COM 	    "Running Disparity Error:",
367*10652SHyon.Kim@Sun.COM 	    phystat->RunningDisparityErrorCount);
368*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %llu\n",
369*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(12),
370*10652SHyon.Kim@Sun.COM 	    "Loss of Dword Sync:",
371*10652SHyon.Kim@Sun.COM 	    phystat->LossofDwordSyncCount);
372*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "%s%s %llu\n",
373*10652SHyon.Kim@Sun.COM 	    getIndentSpaces(12),
374*10652SHyon.Kim@Sun.COM 	    "Reset Problem:",
375*10652SHyon.Kim@Sun.COM 	    phystat->PhyResetProblemCount);
376*10652SHyon.Kim@Sun.COM }
377*10652SHyon.Kim@Sun.COM 
378*10652SHyon.Kim@Sun.COM /*
379*10652SHyon.Kim@Sun.COM  * print the OS device name for the logical-unit object
380*10652SHyon.Kim@Sun.COM  *
381*10652SHyon.Kim@Sun.COM  * Arguments:
382*10652SHyon.Kim@Sun.COM  *	devListWalk - OS device path info
383*10652SHyon.Kim@Sun.COM  *	verbose - boolean indicating whether to display additional info
384*10652SHyon.Kim@Sun.COM  *
385*10652SHyon.Kim@Sun.COM  * returns:
386*10652SHyon.Kim@Sun.COM  * 	0 - we're good.
387*10652SHyon.Kim@Sun.COM  * 	>0 - we met issues.
388*10652SHyon.Kim@Sun.COM  */
389*10652SHyon.Kim@Sun.COM int
printTargetPortInfo(targetPortList_t * TPListWalk,int pflag)390*10652SHyon.Kim@Sun.COM printTargetPortInfo(targetPortList_t *TPListWalk, int pflag)
391*10652SHyon.Kim@Sun.COM {
392*10652SHyon.Kim@Sun.COM 	targetPortConfig_t	*configList;
393*10652SHyon.Kim@Sun.COM 	targetPortMappingData_t	*mapList;
394*10652SHyon.Kim@Sun.COM 	int			count, i;
395*10652SHyon.Kim@Sun.COM 	int			ret = 0;
396*10652SHyon.Kim@Sun.COM 
397*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "Target Port SAS Address: %016llx\n",
398*10652SHyon.Kim@Sun.COM 	    wwnConversion(TPListWalk->sasattr.LocalSASAddress.wwn));
399*10652SHyon.Kim@Sun.COM 	if ((pflag & PRINT_VERBOSE) || (pflag & PRINT_TARGET_SCSI)) {
400*10652SHyon.Kim@Sun.COM 		(void *) fprintf(stdout, "%sType: %s\n", getIndentSpaces(4),
401*10652SHyon.Kim@Sun.COM 		    getStateString(TPListWalk->targetattr.PortType,
402*10652SHyon.Kim@Sun.COM 		    porttype_string));
403*10652SHyon.Kim@Sun.COM 		for (configList = TPListWalk->configEntry;
404*10652SHyon.Kim@Sun.COM 		    configList != NULL; configList = configList->next) {
405*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%sHBA Port Name: %s\n",
406*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(4), configList->hbaPortName);
407*10652SHyon.Kim@Sun.COM 			if (wwnConversion(configList->expanderSASAddr.wwn) !=
408*10652SHyon.Kim@Sun.COM 			    0) {
409*10652SHyon.Kim@Sun.COM 				if (configList->expanderValid) {
410*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout,
411*10652SHyon.Kim@Sun.COM 					    "%sExpander Device SAS Address:"
412*10652SHyon.Kim@Sun.COM 					    " %016llx",
413*10652SHyon.Kim@Sun.COM 					    getIndentSpaces(8),
414*10652SHyon.Kim@Sun.COM 					    wwnConversion(configList->
415*10652SHyon.Kim@Sun.COM 					    expanderSASAddr.wwn));
416*10652SHyon.Kim@Sun.COM 				} else {
417*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout,
418*10652SHyon.Kim@Sun.COM 					    "%sExpander Device SAS Address:"
419*10652SHyon.Kim@Sun.COM 					    " %016llx (Failed to Validate"
420*10652SHyon.Kim@Sun.COM 					    " Attached Port.)",
421*10652SHyon.Kim@Sun.COM 					    getIndentSpaces(8),
422*10652SHyon.Kim@Sun.COM 					    wwnConversion(configList->
423*10652SHyon.Kim@Sun.COM 					    expanderSASAddr.wwn));
424*10652SHyon.Kim@Sun.COM 					ret++;
425*10652SHyon.Kim@Sun.COM 				}
426*10652SHyon.Kim@Sun.COM 			} else {
427*10652SHyon.Kim@Sun.COM 				if (configList->expanderValid) {
428*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout,
429*10652SHyon.Kim@Sun.COM 					    "%sExpander Device SAS Address: %s",
430*10652SHyon.Kim@Sun.COM 					    getIndentSpaces(8),
431*10652SHyon.Kim@Sun.COM 					    "None (direct attached)");
432*10652SHyon.Kim@Sun.COM 				} else {
433*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout,
434*10652SHyon.Kim@Sun.COM 					    "%sExpander Device SAS Address: %s",
435*10652SHyon.Kim@Sun.COM 					    getIndentSpaces(8),
436*10652SHyon.Kim@Sun.COM 					    "None (Failed to Get"
437*10652SHyon.Kim@Sun.COM 					    " Attached Port)");
438*10652SHyon.Kim@Sun.COM 				}
439*10652SHyon.Kim@Sun.COM 			}
440*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "\n");
441*10652SHyon.Kim@Sun.COM 			if (pflag & PRINT_TARGET_SCSI) {
442*10652SHyon.Kim@Sun.COM 
443*10652SHyon.Kim@Sun.COM 				if (configList->reportLUNsFailed) {
444*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout,
445*10652SHyon.Kim@Sun.COM 					    "%s %016llx\n",
446*10652SHyon.Kim@Sun.COM 					    gettext("Error: Failed to get "
447*10652SHyon.Kim@Sun.COM 					    "ReportLun Data on"),
448*10652SHyon.Kim@Sun.COM 					    wwnConversion(TPListWalk->
449*10652SHyon.Kim@Sun.COM 					    sasattr.LocalSASAddress.wwn));
450*10652SHyon.Kim@Sun.COM 					ret++;
451*10652SHyon.Kim@Sun.COM 					continue;
452*10652SHyon.Kim@Sun.COM 				}
453*10652SHyon.Kim@Sun.COM 
454*10652SHyon.Kim@Sun.COM 				for (mapList = configList->map;
455*10652SHyon.Kim@Sun.COM 				    mapList != NULL; mapList = mapList->next) {
456*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout, "%sLUN : %d\n",
457*10652SHyon.Kim@Sun.COM 					    getIndentSpaces(12),
458*10652SHyon.Kim@Sun.COM 					    mapList->osLUN);
459*10652SHyon.Kim@Sun.COM 					if (mapList->mappingExist) {
460*10652SHyon.Kim@Sun.COM 						(void *) fprintf(stdout,
461*10652SHyon.Kim@Sun.COM 						    "%sOS Device Name : %s\n",
462*10652SHyon.Kim@Sun.COM 						    getIndentSpaces(14),
463*10652SHyon.Kim@Sun.COM 						    (mapList->osDeviceName[0] ==
464*10652SHyon.Kim@Sun.COM 						    '\0') ?  "Not avaialble" :
465*10652SHyon.Kim@Sun.COM 						    mapList->osDeviceName);
466*10652SHyon.Kim@Sun.COM 					} else {
467*10652SHyon.Kim@Sun.COM 						(void *) fprintf(stdout,
468*10652SHyon.Kim@Sun.COM 						    "%sOS Device Name : %s\n",
469*10652SHyon.Kim@Sun.COM 						    getIndentSpaces(14), "No "
470*10652SHyon.Kim@Sun.COM 						    "matching OS Device "
471*10652SHyon.Kim@Sun.COM 						    "found.");
472*10652SHyon.Kim@Sun.COM 						ret++;
473*10652SHyon.Kim@Sun.COM 					}
474*10652SHyon.Kim@Sun.COM 		/* indentation changed here */
475*10652SHyon.Kim@Sun.COM 		if (mapList->inquiryFailed) {
476*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%s %s LUN %d\n",
477*10652SHyon.Kim@Sun.COM 			    gettext("Error: Failed to get Inquiry Data on"),
478*10652SHyon.Kim@Sun.COM 			    mapList->osDeviceName, mapList->osLUN);
479*10652SHyon.Kim@Sun.COM 			ret++;
480*10652SHyon.Kim@Sun.COM 		} else {
481*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%sVendor: ",
482*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(14));
483*10652SHyon.Kim@Sun.COM 			for (count = sizeof (mapList->inq_vid), i = 0;
484*10652SHyon.Kim@Sun.COM 			    i < count; i++) {
485*10652SHyon.Kim@Sun.COM 				if (isprint(mapList->inq_vid[i]))
486*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout, "%c",
487*10652SHyon.Kim@Sun.COM 					    mapList->inq_vid[i]);
488*10652SHyon.Kim@Sun.COM 			}
489*10652SHyon.Kim@Sun.COM 
490*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "\n%sProduct: ",
491*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(14));
492*10652SHyon.Kim@Sun.COM 			for (count = sizeof (mapList->inq_pid), i = 0;
493*10652SHyon.Kim@Sun.COM 			    i < count; i++) {
494*10652SHyon.Kim@Sun.COM 				if (isprint(mapList->inq_pid[i]))
495*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout, "%c",
496*10652SHyon.Kim@Sun.COM 					    mapList->inq_pid[i]);
497*10652SHyon.Kim@Sun.COM 			}
498*10652SHyon.Kim@Sun.COM 
499*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "\n%sDevice Type: %s\n",
500*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(14),
501*10652SHyon.Kim@Sun.COM 			    getDTypeString(mapList->inq_dtype));
502*10652SHyon.Kim@Sun.COM 		}
503*10652SHyon.Kim@Sun.COM 		/* indentation changed back */
504*10652SHyon.Kim@Sun.COM 				}
505*10652SHyon.Kim@Sun.COM 			}
506*10652SHyon.Kim@Sun.COM 		}
507*10652SHyon.Kim@Sun.COM 	}
508*10652SHyon.Kim@Sun.COM 	return (ret);
509*10652SHyon.Kim@Sun.COM }
510*10652SHyon.Kim@Sun.COM 
511*10652SHyon.Kim@Sun.COM /*
512*10652SHyon.Kim@Sun.COM  * print the OS device name for the logical-unit object
513*10652SHyon.Kim@Sun.COM  *
514*10652SHyon.Kim@Sun.COM  * Arguments:
515*10652SHyon.Kim@Sun.COM  *	devListWalk - OS device path info
516*10652SHyon.Kim@Sun.COM  *	verbose - boolean indicating whether to display additional info
517*10652SHyon.Kim@Sun.COM  *
518*10652SHyon.Kim@Sun.COM  * returns:
519*10652SHyon.Kim@Sun.COM  * 	0 - we're good.
520*10652SHyon.Kim@Sun.COM  * 	>0 - we met issues.
521*10652SHyon.Kim@Sun.COM  */
522*10652SHyon.Kim@Sun.COM int
printOSDeviceNameInfo(discoveredDevice * devListWalk,boolean_t verbose)523*10652SHyon.Kim@Sun.COM printOSDeviceNameInfo(discoveredDevice *devListWalk, boolean_t verbose)
524*10652SHyon.Kim@Sun.COM {
525*10652SHyon.Kim@Sun.COM 	portList		*portElem;
526*10652SHyon.Kim@Sun.COM 	tgtPortWWNList		*tgtWWNList;
527*10652SHyon.Kim@Sun.COM 	int			i, count;
528*10652SHyon.Kim@Sun.COM 	int			ret = 0;
529*10652SHyon.Kim@Sun.COM 
530*10652SHyon.Kim@Sun.COM 	(void *) fprintf(stdout, "OS Device Name: %s\n",
531*10652SHyon.Kim@Sun.COM 	    devListWalk->OSDeviceName);
532*10652SHyon.Kim@Sun.COM 	if (verbose == B_TRUE) {
533*10652SHyon.Kim@Sun.COM 		for (portElem = devListWalk->HBAPortList;
534*10652SHyon.Kim@Sun.COM 		    portElem != NULL; portElem = portElem->next) {
535*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%sHBA Port Name: ",
536*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(4));
537*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%s", portElem->portName);
538*10652SHyon.Kim@Sun.COM 			for (tgtWWNList = portElem->tgtPortWWN;
539*10652SHyon.Kim@Sun.COM 			    tgtWWNList != NULL; tgtWWNList = tgtWWNList->next) {
540*10652SHyon.Kim@Sun.COM 				(void *) fprintf(stdout,
541*10652SHyon.Kim@Sun.COM 				    "\n%sTarget Port SAS Address: ",
542*10652SHyon.Kim@Sun.COM 				    getIndentSpaces(8));
543*10652SHyon.Kim@Sun.COM 				(void *) fprintf(stdout, "%016llx",
544*10652SHyon.Kim@Sun.COM 				    wwnConversion(tgtWWNList->portWWN.wwn));
545*10652SHyon.Kim@Sun.COM 				(void *) fprintf(stdout, "\n%sLUN: %u",
546*10652SHyon.Kim@Sun.COM 				    getIndentSpaces(12),
547*10652SHyon.Kim@Sun.COM 				    tgtWWNList->scsiOSLun);
548*10652SHyon.Kim@Sun.COM 			}
549*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "\n");
550*10652SHyon.Kim@Sun.COM 		}
551*10652SHyon.Kim@Sun.COM 
552*10652SHyon.Kim@Sun.COM 		if (devListWalk->inquiryFailed) {
553*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%s %s\n",
554*10652SHyon.Kim@Sun.COM 			    gettext("Error: Failed to get Inquiry data "
555*10652SHyon.Kim@Sun.COM 			    "on device"), devListWalk->OSDeviceName);
556*10652SHyon.Kim@Sun.COM 			ret++;
557*10652SHyon.Kim@Sun.COM 		} else {
558*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "%sVendor: ",
559*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(4));
560*10652SHyon.Kim@Sun.COM 			for (count = sizeof (devListWalk->VID), i = 0;
561*10652SHyon.Kim@Sun.COM 			    i < count; i++) {
562*10652SHyon.Kim@Sun.COM 				if (isprint(devListWalk->VID[i]))
563*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout, "%c",
564*10652SHyon.Kim@Sun.COM 					    devListWalk->VID[i]);
565*10652SHyon.Kim@Sun.COM 			}
566*10652SHyon.Kim@Sun.COM 
567*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "\n%sProduct: ",
568*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(4));
569*10652SHyon.Kim@Sun.COM 			for (count = sizeof (devListWalk->PID), i = 0;
570*10652SHyon.Kim@Sun.COM 			    i < count; i++) {
571*10652SHyon.Kim@Sun.COM 				if (isprint(devListWalk->PID[i]))
572*10652SHyon.Kim@Sun.COM 					(void *) fprintf(stdout, "%c",
573*10652SHyon.Kim@Sun.COM 					    devListWalk->PID[i]);
574*10652SHyon.Kim@Sun.COM 			}
575*10652SHyon.Kim@Sun.COM 
576*10652SHyon.Kim@Sun.COM 			(void *) fprintf(stdout, "\n%sDevice Type: %s\n",
577*10652SHyon.Kim@Sun.COM 			    getIndentSpaces(4),
578*10652SHyon.Kim@Sun.COM 			    getDTypeString(devListWalk->dType));
579*10652SHyon.Kim@Sun.COM 		}
580*10652SHyon.Kim@Sun.COM 	}
581*10652SHyon.Kim@Sun.COM 	return (ret);
582*10652SHyon.Kim@Sun.COM }
583