ql_hba_fru.c revision eb82ff87b34e625264561b2d267577cf9821dab0
/*
* 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 2010 QLogic Corporation */
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "Copyright 2010 QLogic Corporation; ql_hba_fru.c"
/*
* ISP2xxx Solaris Fibre Channel Adapter (FCA) driver source file.
*
* ***********************************************************************
* * **
* * NOTICE **
* * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
* * ALL RIGHTS RESERVED **
* * **
* ***********************************************************************
*
*/
/*
* Determine HBA FRU card information for T11 FC-HBA
*/
#include <ql_apps.h>
#include <ql_api.h>
#include <ql_debug.h>
#include <ql_ioctl.h>
#include <ql_xioctl.h>
/*
* Temporary define until LV headers are updated
*/
#ifndef FC_HBA_PORTSPEED_8GBIT
#endif
/* Local prototypes */
uint32_t *);
/* Local structures */
static struct ql_known_models {
char model[256];
char model_description[256];
} models[] = {
{
/* QLogic */
0x2, 0x1077, "QLA2200", "QLogic PCI to 1Gb FC, Single Channel"
}, {
/* QLogic */
0x9, 0x1077, "QLA2300", "QLogic PCI to 2Gb FC, Single Channel"
}, {
/* QLA2200, SUN2200 Amber */
0x4082, 0x1077, "375-3019-xx", "X6799A"
}, {
/* QLA2212, SUN2212 Crystal+ */
0x4083, 0x1077, "375-3030-xx", "X6727A"
}, {
/* QCP2202, SUNQCP2202 Diamond */
0x4084, 0x1077, "375-0118-xx", "X6748A"
}, {
/* QLA2202FS, SUN2202FS Ivory */
0x4085, 0x1077, "375-3048-xx", "X6757A"
}, {
/* QLogic */
0x100, 0x1077, "QLA2340",
"QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x101, 0x1077, "QLA2342",
"QLogic 133MHz PCI-X to 2Gb FC, Dual Channel"
}, {
/* QLogic */
0x102, 0x1077, "QLA2344",
"QLogic 133MHz PCI-X to 2Gb FC, Quad Channel"
}, {
/* QLogic */
0x103, 0x1077, "QCP2342", "QLogic cPCI to 2Gb FC, Dual Channel"
}, {
/* QLogic */
0x104, 0x1077, "QSB2340", "QLogic SBUS to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x105, 0x1077, "QSB2342", "QLogic SBUS to 2Gb FC, Dual Channel"
}, {
/* QLA2310, SUN-66MHz PCI-X to 2Gb FC, Single Channel, Amber 2 */
0x0106, 0x1077, "375-3102-xx", "SG-XPCI1FC-QF2 (X6767A)"
}, {
/* QLogic */
0x109, 0x1077, "QCP2340", "QLogic cPCI to 2Gb FC, Single Channel"
}, {
/* QLA2342, SUN-133MHz PCI-X to 2Gb FC, Dualchannel, Crystal 2A */
0x010A, 0x1077, "375-3108-xx", "SG-XPCI2FC-QF2 (X6768A)"
}, {
/* QLogic */
0x115, 0x1077, "QLA2360",
"QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x116, 0x1077, "QLA2362",
"QLogic 133MHz PCI-X to 2Gb FC, Dual Channel"
}, {
/* QLogic */
0x117, 0x1077, "QLE2360",
"QLogic PCI-Express to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x118, 0x1077, "QLE2362",
"QLogic PCI Express to 2Gb FC, Dual Channel"
}, {
/* QLogic */
0x119, 0x1077, "QLA200",
"QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x11c, 0x1077, "QLA200P",
"QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x12f, 0x1077, "QLA210",
"QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* QLogic */
0x130, 0x1077, "EMC250-051-900",
"QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* QLA210, SUN-133MHz PCI-X to 2Gb FC, Single Channel, Prism */
0x132, 0x1077, "375-32X3-01", "SG-PCI1FC-QLC"
}, {
/* QLogic */
0x13e, 0x1077, "QLE210",
"QLogic PCI Express 2Gb FC, Single Channel"
}, {
/* Sun */
0x149, 0x1077, "QLA2340",
"SUN - 133MHz PCI-X to 2Gb FC, Single Channel"
}, {
/* HP */
0x100, 0x0e11, "QLA2340-HP", "PCIX to 2Gb FC, Single Channel"
}, {
/* HP */
0x101, 0x0e11, "QLA2342-HP", "PCIX to 2Gb FC, Dual Channel"
}, {
/* HP */
0x103, 0x0e11, "QLA2312-HP",
"HP Bladed Server Balcony Card - HP BalcnL"
}, {
/* HP */
0x104, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP MezzF"
}, {
/* HP */
0x105, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP BalcnL"
}, {
/* HP */
0x106, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP BalcnF"
}, {
/* HP */
0x107, 0x0e11, "QLA2312-HP", "HP Bladed Server"
}, {
/* HP */
0x108, 0x0e11, "QLA2312-HP", "HP Bladed Server"
}, {
/* IBM FCEC */
0x27d, 0x1014, "IBM-FCEC",
"IBM eServer Blade Center FC Expansion Card"
}, {
/* IBM FCEC */
0x2fb, 0x1014, "IBM-FCEC",
"IBM eServer Blade Center FC SFF Expansion Card"
}, {
/* Intel */
0x34ba, 0x8086, "Intel SBFCM",
"Intel Server FC Expansion Card SBFCM"
}, {
/* Intel */
0x34a0, 0x8086, "Intel SBEFCM",
"Intel Server SFF FC Expansion Card SBFCM"
}, {
/* FCI/O */
}, {
/* Dell */
}, {
/* end of list */
0, 0, 0, 0, 0, 0
} };
/*
* ql_populate_hba_fru_details
* Sets up HBA fru information for UL utilities
* (cfgadm, fcinfo, et. al.)
*
* Input:
* ha = adapter state structure
* port_info = ptr to LV port strcture.
*
* Returns:
*
* Context:
* Kernel context.
*/
void
{
int32_t i;
/* Constants */
"QLogic Corp.");
"%s", QL_NAME);
}
/* Dynamic data */
CACHE_LOCK(ha);
/* Report FCode / BIOS / EFI version(s). */
/* Get the next image */
case FTYPE_FCODE:
break;
case FTYPE_BIOS:
break;
case FTYPE_EFI:
break;
default:
break;
}
}
}
}
int rval = -1;
uint32_t i = 0;
/*LINTED [Solaris DDI_DEV_T_ANY Lint warning]*/
}
FCHBA_OPTION_ROM_VERSION_LEN, "%s",
"No boot image detected"));
if (fcode_ver_buf != NULL) {
}
}
switch (chip & 0xFF00) {
case 0x2200:
break;
case 0x2300:
break;
case 0x2400:
case 0x8400:
break;
case 0x8000:
break;
case 0x2500:
/*
* Correct supported speeds based on type of
* sfp that is present
*/
case 2:
case 4:
/* 4GB sfp */
break;
case 3:
case 5:
/* 8GB sfp */
break;
default:
break;
}
break;
case 0x5400:
if (model == 0x13e) {
/* QLE210 */
} else {
}
break;
case 0x6300:
break;
default:
break;
}
/* Use parent dip as adapter identifier */
if (ha->fru_hba_index == 0) {
} else {
}
/*
* Populate the model info. Legacy (22xx, 23xx, 63xx) do not
* have vpd info, so use the hard coded table. Anything else
* has VPD (or is suppose to have VPD), so use that. For both
* cases, if the model isn't found, use defaults.
*/
switch (chip & 0xFF00) {
case 0x2200:
case 0x2300:
case 0x6300:
/* Table based data */
break;
}
}
FCHBA_MODEL_DESCRIPTION_LEN, "%s",
models[i].model_description);
} else {
"%x", chip);
}
/* Special model handling for RoHS version of the HBA */
(uint8_t)0x36) {
"375-3363-xx");
FCHBA_MODEL_DESCRIPTION_LEN, "%s",
"SG-XPCI2FC-QF2-Z");
}
break;
case 0x2400:
case 0x2500:
case 0x5400:
case 0x8400:
case 0x8000:
default:
} else {
"%x", chip);
}
break;
}
/*
* Populate the LV symbolic node and port name strings
*
* Symbolic node name format is:
* <hostname>
*
* Symbolic port name format is:
* <driver_name>(<instance>,<vp index>)
*/
}
/*
* ql_setup_fruinfo
* Generates common id's for instances on the same
* physical HBA.
*
* Input:
* ha = adapter state structure
*
* Returns:
*
* Context:
* Kernel context.
*/
void
{
/*
* To generate common id for instances residing on the
* the same HBA, the devpath for each instance is parsed
* and those instances which have matching base devpaths are
* given same hba_index, and each port on the same hba are
* then assigned unique port_indexs based on the devpath.
*/
/*
* Get this ha's basedev path and its port index
*/
/*
* Search for this basedev against all of the
* ha in the ql_hba global list. If found one
* then we are part of other adapter in the
* ql_hba list and hence use that ha's hba_index.
* If not create a new one from the global hba index.
*/
} else {
}
/*
* The FC functions on 81xx hbas are functions 2 and 3
* while the Nic functions occupy 0 and 1. Adjust
* fru port index to be like previous FCAs.
*/
}
/*
* The FC functions on 80xx hbas are functions 6 and 7.
* Adjust fru port index to be like previous FCAs.
*/
}
} else {
ha->fru_hba_index = 0;
ha->fru_port_index = 0;
}
}
/*
* ql_get_basedev_len
*
* Gets the length of the base device name in the
* devpath of the current instance.
*
* Input:
* ha - adapter state pointer.
* basedev_len - pointer to the integer which
* holds the calculated length.
* port_index - pointer to the integer which
* contains the port index of
* for this device.
* Returns:
* 0 if successfully parsed, -1 otherwise.
*
* Context:
* Kernel context.
*/
static uint32_t
{
return ((uint32_t)-1);
}
port_off = -1;
/* Until we reach the first char or a '@' char in the path */
}
dev_off--;
}
if (dev_off < 0) {
return ((uint32_t)-1);
}
if (port_off == -1) {
*port_index = 0;
} else {
/* Get the port index */
if (*port_index == 0) {
return ((uint32_t)-1);
}
}
return (0);
}
/*
* ql_search_basedev
* Searches the list of ha instances to find which
* ha instance has same base device path as input's.
*
* Input:
* myha = current adapter state pointer.
* mybasedev_len = Length of the base device in the
* device path name.
*
* Returns:
* If match = ptr to matching ha structure.
* If no match = NULL ptr.
*
* Context:
* Kernel context.
*/
static ql_adapter_state_t *
{
return (NULL);
}
continue;
}
"the basedev\n");
} else {
"get the hba index and port index\n",
}
continue;
}
/*
* If both the basedev len do not match, then it
* is obvious that both are not pointing to the
* same base device.
*/
/* We found the ha with same basedev */
return (ha);
}
}
return (NULL);
}