fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define htonll(x) ((((unsigned long long)htonl(x)) << 32) + htonl(x >> 32))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ntohll(x) ((((unsigned long long)ntohl(x)) << 32) + ntohl(x >> 32))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Fc4 Types Format */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC4_TYPE_WORD_POS(x) ((uint_t)((uint_t)(x) >> 5))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int fc4_map_is_set(uint32_t *map, uchar_t ulp_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *getPortState(HBA_PORTSTATE portState);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void printPortSpeed(HBA_PORTSPEED portSpeed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("unknown");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("other");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("not present");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("N-port");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("NL-port");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("FL-port");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("F-port");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("L-port");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("point-to-point");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("unrecognized type");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("unknown");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("online");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("offline");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("bypassed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("diagnostics");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("link down");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("error");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("loopback");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("unrecognized state");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portSpeed & HBA_PORTSPEED_1GBIT) == HBA_PORTSPEED_1GBIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portSpeed & HBA_PORTSPEED_2GBIT) == HBA_PORTSPEED_2GBIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portSpeed & HBA_PORTSPEED_4GBIT) == HBA_PORTSPEED_4GBIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portSpeed & HBA_PORTSPEED_8GBIT) == HBA_PORTSPEED_8GBIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portSpeed & HBA_PORTSPEED_10GBIT) == HBA_PORTSPEED_10GBIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((portSpeed & HBA_PORTSPEED_16GBIT) == HBA_PORTSPEED_16GBIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteprintDiscoPortInfo(HBA_PORTATTRIBUTES *discoPort, int scsiTargetType) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("Remote Port WWN: %016llx\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tActive FC4 Types: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* print out scsi target type information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (scsiTargetType == SCSI_TARGET_TYPE_NO) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tPort Symbolic Name: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tNode WWN: %016llx\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * scan the bitmap array for the specifed ULP type. The bit map array
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is 32 bytes long
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ntohl((*(uint32_t *)map)) & (1 << FC4_TYPE_BIT_POS(ulp_type))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * prints out all the HBA port information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("HBA Port WWN: %016llx\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (mode == INITIATOR_MODE) ? "Initiator" : "Target");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tOS Device Name: %s\n"), port->OSDeviceName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tModel: %s\n"), attrs->Model);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tFirmware Version: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tFCode/BIOS Version: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tSerial Number: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->SerialNumber[0] == 0? "not available":attrs->SerialNumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->DriverName[0] == 0? "not available":attrs->DriverName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tDriver Version: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->DriverVersion[0] == 0? "not available":attrs->DriverVersion);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tSupported Speeds: "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tNode WWN: %016llx\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, gettext("SCSI CHECK CONDITION"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteprintLUNInfo(struct scsi_inquiry *inq, HBA_UINT32 scsiLUN, char *devpath) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "\t Product: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t OS Device Name: %s\n"), devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\tLink Error Statistics:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t\tLink Failure Count: %u\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t\tLoss of Sync Count: %u\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t\tLoss of Signal Count: %u\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t\tPrimitive Seq Protocol Error Count: %u\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t\tInvalid Tx Word Count: %u\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, gettext("\t\tInvalid CRC Count: %u\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return device type description
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Arguments:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dType - Device type returned from Standard INQUIRY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * char string description for device type
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Disk Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Tape Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Printer Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Processor Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("WORM Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("CD/DVD Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Scanner Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Optical Memory Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Medium Changer Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Communications Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Storage Array Controller Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Enclosure Services Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Simplified Direct-access Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Optical Card Reader/Writer Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Bridge Controller Commands");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Object-based Storage Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Automation/Drive Interface");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Well Known Logical Unit");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Unknown Device");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Undefined");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * print the OS device name for the logical-unit object
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Arguments:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * devListWalk - OS device path info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verbose - boolean indicating whether to display additional info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteprintOSDeviceNameInfo(discoveredDevice *devListWalk, boolean_t verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stdout, "OS Device Name: %s\n", devListWalk->OSDeviceName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tgtWWNList != NULL; tgtWWNList = tgtWWNList->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (count = sizeof (devListWalk->VID), i = 0; i < count; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (count = sizeof (devListWalk->PID), i = 0; i < count; i++) {