/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <ctype.h>
#include <printAttrs.h>
HBA_STATUS_OK, "Okay",
HBA_STATUS_ERROR, "Error",
HBA_STATUS_ERROR_NOT_SUPPORTED, "Not Supported",
HBA_STATUS_ERROR_INVALID_HANDLE, "Invalid Handle",
HBA_STATUS_ERROR_ARG, "Argument Error",
HBA_STATUS_ERROR_ILLEGAL_WWN, "Illegal WWN",
HBA_STATUS_ERROR_ILLEGAL_INDEX, "Illegal Index",
HBA_STATUS_ERROR_MORE_DATA, "Not Enough Buffer for Data",
HBA_STATUS_ERROR_STALE_DATA, "Stale Data",
HBA_STATUS_SCSI_CHECK_CONDITION, "SCSI Check Condition",
HBA_STATUS_ERROR_BUSY, "Busy",
HBA_STATUS_ERROR_TRY_AGAIN, "Try Again",
HBA_STATUS_ERROR_UNAVAILABLE, "Unavailable",
HBA_STATUS_ERROR_ELS_REJECT, "ELS Reject",
HBA_STATUS_ERROR_INVALID_LUN, "Invalid LUN",
HBA_STATUS_ERROR_INCOMPATIBLE, "Request Incompatible",
HBA_STATUS_ERROR_AMBIGUOUS_WWN, "Ambiguous WWN",
HBA_STATUS_ERROR_LOCAL_BUS, "Local Bus Error",
HBA_STATUS_ERROR_LOCAL_TARGET, "Local Target Error",
HBA_STATUS_ERROR_LOCAL_LUN, "Local LUN Error",
HBA_STATUS_ERROR_LOCAL_SCSIID_BOUND, "Local SCSIID Bound",
HBA_STATUS_ERROR_TARGET_FCID, "Target FCID Error",
HBA_STATUS_ERROR_TARGET_NODE_WWN, "Target Node WWN Error",
HBA_STATUS_ERROR_TARGET_PORT_WWN, "Target Port WWN Error",
HBA_STATUS_ERROR_TARGET_LUN, "Target LUN Error",
HBA_STATUS_ERROR_TARGET_LUID, "Target LUID Error",
HBA_STATUS_ERROR_NO_SUCH_BINDING, "No Such Binding",
HBA_STATUS_ERROR_NOT_A_TARGET, "Not a Target",
HBA_STATUS_ERROR_UNSUPPORTED_FC4, "Unsupported FC4",
HBA_STATUS_ERROR_INCAPABLE, "Incapable",
HBA_STATUS_ERROR_TARGET_BUSY, "Target Busy",
HBA_STATUS_ERROR_NOT_LOADED, "Not Loaded",
HBA_STATUS_ERROR_ALREADY_LOADED, "Alreday Loaded",
HBA_STATUS_ERROR_ILLEGAL_FCID, "Illegal FCID",
HBA_STATUS_ERROR_NOT_ASCSIDEVICE, "Not a SCSI Device",
HBA_STATUS_ERROR_INVALID_PROTOCOL_TYPE, "Invalid Protocol Type",
HBA_STATUS_ERROR_BAD_EVENT_TYPE, "Bad Event Type",
-1, NULL
};
HBA_PORTTYPE_UNKNOWN, "UNKNOWN",
HBA_PORTTYPE_OTHER, "OTHER",
HBA_PORTTYPE_NOTPRESENT, "NOT Present",
HBA_PORTTYPE_SASDEVICE, "SAS Device",
HBA_PORTTYPE_SATADEVICE, "SATA Device",
HBA_PORTTYPE_SASEXPANDER, "SAS Expander",
-1, NULL,
};
HBA_PORTSTATE_UNKNOWN, "unknown",
HBA_PORTSTATE_ONLINE, "online",
HBA_PORTSTATE_OFFLINE, "offline",
HBA_PORTSTATE_BYPASSED, "bypassed",
HBA_PORTSTATE_DIAGNOSTICS, "diagnostics",
HBA_PORTSTATE_LINKDOWN, "link Down",
HBA_PORTSTATE_ERROR, "port Error",
HBA_PORTSTATE_LOOPBACK, "loopback",
HBA_PORTSTATE_DEGRADED, "degraded",
-1, NULL,
};
HBA_SASSTATE_UNKNOWN, "unknown",
HBA_SASSTATE_DISABLED, "disabled",
HBA_SASSTATE_FAILED, "failed",
HBA_SASSTATE_SATASPINUP, "sata-spinup",
HBA_SASSTATE_SATAPORTSEL, "sata-portselector",
HBA_SASSPEED_1_5GBIT, "1.5Gbit",
HBA_SASSPEED_3GBIT, "3Gbit",
HBA_SASSPEED_6GBIT, "6Gbit",
-1, NULL,
};
DTYPE_DIRECT, "Disk Device",
DTYPE_SEQUENTIAL, "Tape Device",
DTYPE_PRINTER, "Printer Device",
DTYPE_PROCESSOR, "Processor Device",
DTYPE_WORM, "WORM Device",
DTYPE_RODIRECT, "CD/DVD Device",
DTYPE_SCANNER, "Scanner Device",
DTYPE_OPTICAL, "Optical Memory Device",
DTYPE_CHANGER, "Medium Changer Device",
DTYPE_COMM, "Communications Device",
DTYPE_ARRAY_CTRL, "Storage Array Controller Device",
DTYPE_ESI, "Enclosure Services Device",
DTYPE_RBC, "Simplified Direct-access Device",
DTYPE_OCRW, "Optical Card Reader/Writer Device",
DTYPE_BCC, "Bridge Controller Commands",
DTYPE_OSD, "Object-based Storage Device",
DTYPE_ADC, "Automation/Drive Interface",
DTYPE_WELLKNOWN, "Well Known Logical Unit",
DTYPE_UNKNOWN, "Unknown Device",
-1, NULL
};
char *
{
int i = 0;
/* the maximum indent with terminator '\0' */
for (i = 0; i < number; i++) {
ret[i] = ' ';
}
ret[i] = '\0';
return (ret);
}
char *
{
return ((char *)stat_string->value);
}
stat_string++;
}
return (ret);
}
static char *
{
};
for (i = 0; i < len; i++) {
match = 1;
break;
}
}
if (match == 1) {
return ("enabled");
else
} else {
else
return ("not available");
}
}
char *
{
}
/*
* return device type description
*
* Arguments:
* dType - Device type returned from Standard INQUIRY
* Returns:
* char string description for device type
*/
char *
{
}
{
}
/*
* prints out HBA information
*/
void
const char *adapterName)
{
if (pflag & PRINT_VERBOSE) {
attrs->Manufacturer[0] == 0?
getIndentSpaces(4),
"Firmware Version:",
getIndentSpaces(4),
getIndentSpaces(4),
"Serial Number:",
getIndentSpaces(4),
"Driver Name:",
attrs->DriverName);
getIndentSpaces(4),
"Driver Version:",
getIndentSpaces(4),
"Number of HBA Ports:",
}
}
/*
* prints out all the HBA port information
*/
void
return;
}
getIndentSpaces(2),
"HBA Port Name:",
port->OSDeviceName);
if (!(pflag & PRINT_VERBOSE)) {
return;
}
return;
getIndentSpaces(4),
"Type:",
getIndentSpaces(4),
"State:",
getIndentSpaces(4),
"Local SAS Address:",
getIndentSpaces(4),
"Attached SAS Address:",
getIndentSpaces(4),
"Number of Phys:",
}
void
{
return;
getIndentSpaces(6),
"Identifier:",
getIndentSpaces(8),
"State: ",
getIndentSpaces(8),
getIndentSpaces(8),
getIndentSpaces(8),
"NegotiatedLinkRate:",
}
void
{
return;
getIndentSpaces(8),
"Link Error Statistics:");
getIndentSpaces(12),
"Invalid Dword:",
getIndentSpaces(12),
"Running Disparity Error:",
getIndentSpaces(12),
"Loss of Dword Sync:",
getIndentSpaces(12),
"Reset Problem:",
}
/*
* print the OS device name for the logical-unit object
*
* Arguments:
* devListWalk - OS device path info
* verbose - boolean indicating whether to display additional info
*
* returns:
* 0 - we're good.
* >0 - we met issues.
*/
int
{
int count, i;
int ret = 0;
0) {
if (configList->expanderValid) {
"%sExpander Device SAS Address:"
" %016llx",
getIndentSpaces(8),
} else {
"%sExpander Device SAS Address:"
" %016llx (Failed to Validate"
" Attached Port.)",
getIndentSpaces(8),
ret++;
}
} else {
if (configList->expanderValid) {
"%sExpander Device SAS Address: %s",
getIndentSpaces(8),
"None (direct attached)");
} else {
"%sExpander Device SAS Address: %s",
getIndentSpaces(8),
"None (Failed to Get"
" Attached Port)");
}
}
if (pflag & PRINT_TARGET_SCSI) {
if (configList->reportLUNsFailed) {
"%s %016llx\n",
gettext("Error: Failed to get "
"ReportLun Data on"),
ret++;
continue;
}
getIndentSpaces(12),
if (mapList->mappingExist) {
"%sOS Device Name : %s\n",
getIndentSpaces(14),
(mapList->osDeviceName[0] ==
'\0') ? "Not avaialble" :
} else {
"%sOS Device Name : %s\n",
"matching OS Device "
"found.");
ret++;
}
/* indentation changed here */
if (mapList->inquiryFailed) {
gettext("Error: Failed to get Inquiry Data on"),
ret++;
} else {
getIndentSpaces(14));
i < count; i++) {
}
getIndentSpaces(14));
i < count; i++) {
}
getIndentSpaces(14),
}
/* indentation changed back */
}
}
}
}
return (ret);
}
/*
* print the OS device name for the logical-unit object
*
* Arguments:
* devListWalk - OS device path info
* verbose - boolean indicating whether to display additional info
*
* returns:
* 0 - we're good.
* >0 - we met issues.
*/
int
{
int i, count;
int ret = 0;
getIndentSpaces(4));
"\n%sTarget Port SAS Address: ",
getIndentSpaces(8));
getIndentSpaces(12),
}
}
if (devListWalk->inquiryFailed) {
gettext("Error: Failed to get Inquiry data "
ret++;
} else {
getIndentSpaces(4));
i < count; i++) {
devListWalk->VID[i]);
}
getIndentSpaces(4));
i < count; i++) {
devListWalk->PID[i]);
}
getIndentSpaces(4),
}
}
return (ret);
}