fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard/* Copyright 2010 QLogic Corporation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard#pragma ident "Copyright 2010 QLogic Corporation; ql_hba_fru.c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver source file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * NOTICE **
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * ALL RIGHTS RESERVED **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Determine HBA FRU card information for T11 FC-HBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ql_apps.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ql_api.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ql_debug.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ql_ioctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ql_xioctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Temporary define until LV headers are updated
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef FC_HBA_PORTSPEED_8GBIT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FC_HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Local prototypes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t ql_get_basedev_len(ql_adapter_state_t *, uint32_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ql_adapter_state_t *ql_search_basedev(ql_adapter_state_t *, uint32_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Local structures */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct ql_known_models {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t ssid; /* Subsystem ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t ssvid; /* Subsystem Vendor ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char model[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char model_description[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} models[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x2, 0x1077, "QLA2200", "QLogic PCI to 1Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x9, 0x1077, "QLA2300", "QLogic PCI to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2200, SUN2200 Amber */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x4082, 0x1077, "375-3019-xx", "X6799A"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2212, SUN2212 Crystal+ */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x4083, 0x1077, "375-3030-xx", "X6727A"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QCP2202, SUNQCP2202 Diamond */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x4084, 0x1077, "375-0118-xx", "X6748A"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA2202FS, SUN2202FS Ivory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x4085, 0x1077, "375-3048-xx", "X6757A"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x100, 0x1077, "QLA2340",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x101, 0x1077, "QLA2342",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x102, 0x1077, "QLA2344",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Quad Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x103, 0x1077, "QCP2342", "QLogic cPCI to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x104, 0x1077, "QSB2340", "QLogic SBUS to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x105, 0x1077, "QSB2342", "QLogic SBUS to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
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 }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x109, 0x1077, "QCP2340", "QLogic cPCI to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
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 }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x115, 0x1077, "QLA2360",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x116, 0x1077, "QLA2362",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x117, 0x1077, "QLE2360",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic PCI-Express to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x118, 0x1077, "QLE2362",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic PCI Express to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x119, 0x1077, "QLA200",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x11c, 0x1077, "QLA200P",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x12f, 0x1077, "QLA210",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x130, 0x1077, "EMC250-051-900",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLA210, SUN-133MHz PCI-X to 2Gb FC, Single Channel, Prism */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x132, 0x1077, "375-32X3-01", "SG-PCI1FC-QLC"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x13e, 0x1077, "QLE210",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "QLogic PCI Express 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sun */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x149, 0x1077, "QLA2340",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "SUN - 133MHz PCI-X to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x100, 0x0e11, "QLA2340-HP", "PCIX to 2Gb FC, Single Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x101, 0x0e11, "QLA2342-HP", "PCIX to 2Gb FC, Dual Channel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x103, 0x0e11, "QLA2312-HP",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HP Bladed Server Balcony Card - HP BalcnL"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x104, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP MezzF"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x105, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP BalcnL"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x106, 0x0e11, "QLA2312-HP", "HP Bladed Server - HP BalcnF"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x107, 0x0e11, "QLA2312-HP", "HP Bladed Server"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* HP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x108, 0x0e11, "QLA2312-HP", "HP Bladed Server"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* IBM FCEC */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x27d, 0x1014, "IBM-FCEC",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IBM eServer Blade Center FC Expansion Card"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* IBM FCEC */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x2fb, 0x1014, "IBM-FCEC",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "IBM eServer Blade Center FC SFF Expansion Card"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Intel */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x34ba, 0x8086, "Intel SBFCM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Intel Server FC Expansion Card SBFCM"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Intel */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x34a0, 0x8086, "Intel SBEFCM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Intel Server SFF FC Expansion Card SBFCM"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* FCI/O */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x1051, 0x1734, "FCI/O-CARD2Gb/s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "FSC-Quanta FC I/O-Card 2GBit/s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Dell */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0x18a, 0x1028, "FCI/O-CARD2Gb/s", "Dell Glacier Blade Server"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }, {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* end of list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, 0, 0, 0, 0, 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * port_info = ptr to LV port strcture.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Context:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_populate_hba_fru_details(ql_adapter_state_t *ha,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_fca_port_info_t *port_info)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fca_port_attrs_t *attrs = &port_info->pi_attrs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t chip = ha->device_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t model = ha->subsys_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t ssdevid = ha->subven_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t vlen;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs = &port_info->pi_attrs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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 "%s", QL_NAME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->driver_version, FCHBA_DRIVER_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s", ha->adapter_stats->revlvl.qlddv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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 attrs->serial_number[0] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hardware_version[0] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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 ha->fw_subminor_version);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CACHE_LOCK(ha);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Report FCode / BIOS / EFI version(s). */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->fcache != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t types = FTYPE_BIOS|FTYPE_FCODE|FTYPE_EFI;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_fcache_t *fptr = ha->fcache;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int8_t *orv = &*attrs->option_rom_version;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((fptr != NULL) && (types != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the next image */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fptr = ql_get_fbuf(ha->fcache, types)) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (fptr->type) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FTYPE_FCODE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(orv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_OPTION_ROM_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s fcode: %s;", orv, fptr->verstr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FTYPE_BIOS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(orv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_OPTION_ROM_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s BIOS: %s;", orv, fptr->verstr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FTYPE_EFI:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(orv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_OPTION_ROM_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s EFI: %s;", orv, fptr->verstr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "ignoring ftype: %xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fptr->type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte types &= ~(fptr->type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CACHE_UNLOCK(ha);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(attrs->option_rom_version) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rval = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t i = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t fcode_ver_buf = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (CFG_IST(ha, CFG_CTRL_2200)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*LINTED [Solaris DDI_DEV_T_ANY Lint warning]*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ddi_getlongprop(DDI_DEV_T_ANY, ha->dip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, "version",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (caddr_t)&fcode_ver_buf, (int32_t *)&i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->option_rom_version,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_OPTION_ROM_VERSION_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (rval == DDI_PROP_SUCCESS ? fcode_ver_buf :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "No boot image detected"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fcode_ver_buf != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmem_free(fcode_ver_buf, (size_t)i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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 ha->init_ctrl_blk.cb24.max_frame_length[0]) :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ha->init_ctrl_blk.cb.max_frame_length[1] << 8 |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->init_ctrl_blk.cb.max_frame_length[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_cos = 0x10000000; /* Class 3 only */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (chip & 0xFF00) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2200:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_2GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_HBA_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x8400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_4GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FC_HBA_PORTSPEED_2GBIT | FC_HBA_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard case 0x8000:
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard attrs->supported_speed = FC_HBA_PORTSPEED_10GBIT;
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard break;
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 FC_HBA_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Correct supported speeds based on type of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sfp that is present
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (ha->sfp_stat) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 2:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 4:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 4GB sfp */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed &= ~FC_HBA_PORTSPEED_8GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 3:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 5:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 8GB sfp */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed &= ~FC_HBA_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "sfp_stat: %xh\n", ha->sfp_stat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x5400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (model == 0x13e) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* QLE210 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_2GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_4GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x6300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_2GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->supported_speed = FC_HBA_PORTSPEED_UNKNOWN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Use parent dip as adapter identifier */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.low = 0x514C6F6769630000; /* QLogic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->fru_hba_index == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "unable to generate high_fru details from "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "device path: %s\n", ha->devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.low = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.high = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.port_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.high = ha->fru_hba_index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attrs->hba_fru_details.port_index = ha->fru_port_index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
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 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (chip & 0xFF00) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2200:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x6300:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Table based data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; models[i].ssid; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((model == models[i].ssid) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ssdevid == models[i].ssvid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (models[i].ssid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model, FCHBA_MODEL_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte models[i].model);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model_description,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_MODEL_DESCRIPTION_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte models[i].model_description);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model, FCHBA_MODEL_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%x", chip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model_description,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_MODEL_DESCRIPTION_LEN, "%x", chip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Special model handling for RoHS version of the HBA */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (models[i].ssid == 0x10a && ha->adapInfo[10] ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t)0x36) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model, FCHBA_MODEL_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "375-3363-xx");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model_description,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_MODEL_DESCRIPTION_LEN, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "SG-XPCI2FC-QF2-Z");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x2500:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x5400:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 0x8400:
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard case 0x8000:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
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 (uint8_t *)attrs->model_description,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_MODEL_DESCRIPTION_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model, FCHBA_MODEL_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%x", chip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(attrs->model_description,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_MODEL_DESCRIPTION_LEN, "%x", chip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Populate the LV symbolic node and port name strings
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Symbolic node name format is:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * <hostname>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Symbolic port name format is:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * <driver_name>(<instance>,<vp index>)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vlen = (strlen(utsname.nodename) > FCHBA_SYMB_NAME_LEN ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_SYMB_NAME_LEN : strlen(utsname.nodename));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf((int8_t *)attrs->sym_node_name, vlen, "%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte utsname.nodename);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vlen = (strlen(QL_NAME) + 9 > FCHBA_SYMB_NAME_LEN ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FCHBA_SYMB_NAME_LEN : strlen(QL_NAME) + 9);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf((int8_t *)attrs->sym_port_name, vlen,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s(%d,%d)", QL_NAME, ha->instance, ha->vp_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_setup_fruinfo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Generates common id's for instances on the same
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * physical HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Context:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_setup_fruinfo(ql_adapter_state_t *ha)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t mybasedev_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_adapter_state_t *base_ha = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
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 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get this ha's basedev path and its port index
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_basedev_len(ha, &mybasedev_len, &ha->fru_port_index) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GLOBAL_STATE_LOCK();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
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 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte base_ha = ql_search_basedev(ha, mybasedev_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (base_ha != NULL && base_ha->fru_hba_index != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->fru_hba_index = base_ha->fru_hba_index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->fru_hba_index = ql_gfru_hba_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard if (CFG_IST(ha, CFG_CTRL_8081)) {
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard /*
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.
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ha->fru_port_index = ha->flags & FUNCTION_1 ? 1 : 0;
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard }
4f8b8adc54496e548e2d73094de038a131d9cd45Daniel Beauregard
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GLOBAL_STATE_UNLOCK();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->fru_hba_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->fru_port_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_basedev_len
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the length of the base device name in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * devpath of the current instance.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input:
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 * Returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 if successfully parsed, -1 otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Context:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_basedev_len(ql_adapter_state_t *ha, uint32_t *basedev_len,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *port_index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t dev_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t port_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int8_t *devstr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->devpath == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ((uint32_t)-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_off = (int32_t)(strlen(ha->devpath) - 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_off = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->devpath[dev_off] == ',') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_off = dev_off + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_off--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_off < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "Invalid device path '%s'. Cannot get basedev\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ((uint32_t)-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_off == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *port_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *basedev_len = (uint32_t)strlen(ha->devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the port index */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devstr = ha->devpath + port_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *port_index = stoi(&devstr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*port_index == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "Invalid device path '%s'. Cannot get "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "port_index\n", ha->devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ((uint32_t)-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *basedev_len = (uint32_t)(port_off - 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input:
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If match = ptr to matching ha structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If no match = NULL ptr.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Context:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ql_adapter_state_t *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_search_basedev(ql_adapter_state_t *myha, uint32_t mybasedev_len)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_link_t *link;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_adapter_state_t *ha;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t basedev_len, port_index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", myha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (link = ql_hba.first; link != NULL; link = link->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha = link->base_address;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(myha, "null ha link detected!\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha == myha) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_basedev_len(ha, &basedev_len, &port_index) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->devpath == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(myha, "Device path NULL. Unable to get "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the basedev\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(myha, "Invalid device path '%s'. Cannot "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "get the hba index and port index\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->devpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
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 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((basedev_len == mybasedev_len) && (strncmp(myha->devpath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->devpath, basedev_len) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We found the ha with same basedev */
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): found, done\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte myha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ha);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregard QL_PRINT_3(CE_CONT, "(%d): not found, done\n", myha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}