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
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard/* Copyright 2010 QLogic Corporation */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard#pragma ident "Copyright 2010 QLogic Corporation; ql_hba_fru.c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver source file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * NOTICE **
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * ALL RIGHTS RESERVED **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Determine HBA FRU card information for T11 FC-HBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Temporary define until LV headers are updated
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Local prototypes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t ql_get_basedev_len(ql_adapter_state_t *, uint32_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ql_adapter_state_t *ql_search_basedev(ql_adapter_state_t *, uint32_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Local structures */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x2, 0x1077, "QLA2200", "QLogic PCI to 1Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x9, 0x1077, "QLA2300", "QLogic PCI to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2200, SUN2200 Amber */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2212, SUN2212 Crystal+ */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QCP2202, SUNQCP2202 Diamond */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2202FS, SUN2202FS Ivory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Quad Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x103, 0x1077, "QCP2342", "QLogic cPCI to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x104, 0x1077, "QSB2340", "QLogic SBUS to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x105, 0x1077, "QSB2342", "QLogic SBUS to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2310, SUN-66MHz PCI-X to 2Gb FC, Single Channel, Amber 2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x0106, 0x1077, "375-3102-xx", "SG-XPCI1FC-QF2 (X6767A)"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x109, 0x1077, "QCP2340", "QLogic cPCI to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2342, SUN-133MHz PCI-X to 2Gb FC, Dualchannel, Crystal 2A */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x010A, 0x1077, "375-3108-xx", "SG-XPCI2FC-QF2 (X6768A)"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic PCI-Express to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic PCI Express to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA210, SUN-133MHz PCI-X to 2Gb FC, Single Channel, Prism */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic PCI Express 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "SUN - 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x100, 0x0e11, "QLA2340-HP", "PCIX to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x101, 0x0e11, "QLA2342-HP", "PCIX to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HP Bladed Server Balcony Card - HP BalcnL"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x104, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP MezzF"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x105, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP BalcnL"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x106, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP BalcnF"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* IBM FCEC */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IBM eServer Blade Center FC Expansion Card"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* IBM FCEC */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IBM eServer Blade Center FC SFF Expansion Card"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Intel Server FC Expansion Card SBFCM"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Intel Server SFF FC Expansion Card SBFCM"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "FSC-Quanta FC I/O-Card 2GBit/s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x18a, 0x1028, "FCI/O-CARD2Gb/s", "Dell Glacier Blade Server"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* end of list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, 0, 0, 0, 0, 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_populate_hba_fru_details
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sets up HBA fru information for UL utilities
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (cfgadm, fcinfo, et. al.)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port_info = ptr to LV port strcture.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_populate_hba_fru_details(ql_adapter_state_t *ha,
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Constants */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->manufacturer, FCHBA_MANUFACTURER_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic Corp.");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->driver_name, FCHBA_DRIVER_NAME_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->driver_version, FCHBA_DRIVER_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((i = ql_vpd_lookup(ha, (uint8_t *)VPD_TAG_SN, (uint8_t *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->serial_number, FCHBA_SERIAL_NUMBER_LEN)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Dynamic data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->firmware_version, FCHBA_FIRMWARE_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%02d.%02d.%02d", ha->fw_major_version, ha->fw_minor_version,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Report FCode / BIOS / EFI version(s). */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t types = FTYPE_BIOS|FTYPE_FCODE|FTYPE_EFI;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the next image */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fptr = ql_get_fbuf(ha->fcache, types)) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*LINTED [Solaris DDI_DEV_T_ANY Lint warning]*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, "version",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "No boot image detected"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->vendor_specific_id = ha->adapter_features;
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard attrs->max_frame_size = CFG_IST(ha, CFG_CTRL_24258081) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ha->init_ctrl_blk.cb24.max_frame_length[1] << 8 |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_cos = 0x10000000; /* Class 3 only */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2200:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_2GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x8400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_4GBIT |
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard attrs->supported_speed = FC_HBA_PORTSPEED_10GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2500:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_8GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_HBA_PORTSPEED_4GBIT | FC_HBA_PORTSPEED_2GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Correct supported speeds based on type of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sfp that is present
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 4GB sfp */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed &= ~FC_HBA_PORTSPEED_8GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 8GB sfp */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed &= ~FC_HBA_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x5400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLE210 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x6300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_UNKNOWN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Use parent dip as adapter identifier */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.low = 0x514C6F6769630000; /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "unable to generate high_fru details from "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.port_index = ha->fru_port_index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Populate the model info. Legacy (22xx, 23xx, 63xx) do not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * have vpd info, so use the hard coded table. Anything else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * has VPD (or is suppose to have VPD), so use that. For both
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cases, if the model isn't found, use defaults.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2200:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x6300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Table based data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model, FCHBA_MODEL_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Special model handling for RoHS version of the HBA */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (models[i].ssid == 0x10a && ha->adapInfo[10] ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model, FCHBA_MODEL_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "375-3363-xx");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "SG-XPCI2FC-QF2-Z");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2500:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x5400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x8400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((i = ql_vpd_lookup(ha, (uint8_t *)VPD_TAG_PN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t *)attrs->model, FCHBA_MODEL_LEN)) >= 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ql_vpd_lookup(ha, (uint8_t *)VPD_TAG_PRODID,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Populate the LV symbolic node and port name strings
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Symbolic node name format is:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * <hostname>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Symbolic port name format is:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * <driver_name>(<instance>,<vp index>)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vlen = (strlen(utsname.nodename) > FCHBA_SYMB_NAME_LEN ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf((int8_t *)attrs->sym_node_name, vlen, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vlen = (strlen(QL_NAME) + 9 > FCHBA_SYMB_NAME_LEN ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf((int8_t *)attrs->sym_port_name, vlen,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s(%d,%d)", QL_NAME, ha->instance, ha->vp_index);
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_setup_fruinfo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Generates common id's for instances on the same
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * physical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * To generate common id for instances residing on the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the same HBA, the devpath for each instance is parsed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and those instances which have matching base devpaths are
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * given same hba_index, and each port on the same hba are
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * then assigned unique port_indexs based on the devpath.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get this ha's basedev path and its port index
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_basedev_len(ha, &mybasedev_len, &ha->fru_port_index) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Search for this basedev against all of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha in the ql_hba global list. If found one
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * then we are part of other adapter in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_hba list and hence use that ha's hba_index.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If not create a new one from the global hba index.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (base_ha != NULL && base_ha->fru_hba_index != 0) {
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard * The FC functions on 81xx hbas are functions 2 and 3
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard * while the Nic functions occupy 0 and 1. Adjust
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard * fru port index to be like previous FCAs.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ha->fru_port_index = ha->flags & FUNCTION_1 ? 1 : 0;
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_basedev_len
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the length of the base device name in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * devpath of the current instance.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha - adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * basedev_len - pointer to the integer which
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * holds the calculated length.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port_index - pointer to the integer which
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * contains the port index of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for this device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 if successfully parsed, -1 otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_basedev_len(ql_adapter_state_t *ha, uint32_t *basedev_len,
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Until we reach the first char or a '@' char in the path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((dev_off >= 0) && (ha->devpath[dev_off] != '@')) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "Invalid device path '%s'. Cannot get basedev\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the port index */
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_search_basedev
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Searches the list of ha instances to find which
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha instance has same base device path as input's.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * myha = current adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mybasedev_len = Length of the base device in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device path name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If match = ptr to matching ha structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If no match = NULL ptr.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_search_basedev(ql_adapter_state_t *myha, uint32_t mybasedev_len)
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", myha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (link = ql_hba.first; link != NULL; link = link->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_basedev_len(ha, &basedev_len, &port_index) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the basedev\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "get the hba index and port index\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If both the basedev len do not match, then it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is obvious that both are not pointing to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * same base device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((basedev_len == mybasedev_len) && (strncmp(myha->devpath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We found the ha with same basedev */
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): found, done\n",
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): not found, done\n", myha->instance);