Print this page
NEX-5717 import QLogic 16G FC drivers
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
@@ -17,25 +17,25 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
-/* Copyright 2010 QLogic Corporation */
+/* Copyright 2015 QLogic Corporation */
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "Copyright 2010 QLogic Corporation; ql_hba_fru.c"
+#pragma ident "Copyright 2015 QLogic Corporation; ql_hba_fru.c"
/*
* ISP2xxx Solaris Fibre Channel Adapter (FCA) driver source file.
*
* ***********************************************************************
* * **
* * NOTICE **
- * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
+ * * COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION **
* * ALL RIGHTS RESERVED **
* * **
* ***********************************************************************
*
*/
@@ -237,11 +237,11 @@
uint16_t model = ha->subsys_id;
uint16_t ssdevid = ha->subven_id;
size_t vlen;
int32_t i;
- QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
+ QL_PRINT_3(ha, "started\n");
attrs = &port_info->pi_attrs;
/* Constants */
(void) snprintf(attrs->manufacturer, FCHBA_MANUFACTURER_LEN,
@@ -260,12 +260,10 @@
/* Dynamic data */
(void) snprintf(attrs->firmware_version, FCHBA_FIRMWARE_VERSION_LEN,
"%02d.%02d.%02d", ha->fw_major_version, ha->fw_minor_version,
ha->fw_subminor_version);
- CACHE_LOCK(ha);
-
/* Report FCode / BIOS / EFI version(s). */
if (ha->fcache != NULL) {
uint32_t types = FTYPE_BIOS|FTYPE_FCODE|FTYPE_EFI;
ql_fcache_t *fptr = ha->fcache;
int8_t *orv = &*attrs->option_rom_version;
@@ -298,18 +296,16 @@
types &= ~(fptr->type);
}
}
}
- CACHE_UNLOCK(ha);
-
if (strlen(attrs->option_rom_version) == 0) {
int rval = -1;
uint32_t i = 0;
caddr_t fcode_ver_buf = NULL;
- if (CFG_IST(ha, CFG_CTRL_2200)) {
+ if (CFG_IST(ha, CFG_CTRL_22XX)) {
/*LINTED [Solaris DDI_DEV_T_ANY Lint warning]*/
rval = ddi_getlongprop(DDI_DEV_T_ANY, ha->dip,
DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, "version",
(caddr_t)&fcode_ver_buf, (int32_t *)&i);
}
@@ -324,20 +320,21 @@
}
}
attrs->vendor_specific_id = ha->adapter_features;
- attrs->max_frame_size = CFG_IST(ha, CFG_CTRL_24258081) ?
- (ha->init_ctrl_blk.cb24.max_frame_length[1] << 8 |
- ha->init_ctrl_blk.cb24.max_frame_length[0]) :
- (ha->init_ctrl_blk.cb.max_frame_length[1] << 8 |
- ha->init_ctrl_blk.cb.max_frame_length[0]);
+ attrs->max_frame_size = ha->loginparams.common_service.rx_bufsize;
attrs->supported_cos = 0x10000000; /* Class 3 only */
switch (chip & 0xFF00) {
+ case 0x2000:
+ attrs->supported_speed = chip == 0x2071 ?
+ FC_HBA_PORTSPEED_32GBIT : FC_HBA_PORTSPEED_16GBIT;
+ break;
case 0x2200:
- attrs->supported_speed = FC_HBA_PORTSPEED_1GBIT;
+ attrs->supported_speed = chip == 0x2261 ?
+ FC_HBA_PORTSPEED_16GBIT : FC_HBA_PORTSPEED_1GBIT;
break;
case 0x2300:
attrs->supported_speed = FC_HBA_PORTSPEED_2GBIT |
FC_HBA_PORTSPEED_1GBIT;
break;
@@ -486,11 +483,11 @@
vlen = (strlen(QL_NAME) + 9 > FCHBA_SYMB_NAME_LEN ?
FCHBA_SYMB_NAME_LEN : strlen(QL_NAME) + 9);
(void) snprintf((int8_t *)attrs->sym_port_name, vlen,
"%s(%d,%d)", QL_NAME, ha->instance, ha->vp_index);
- QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
+ QL_PRINT_3(ha, "done\n");
}
/*
* ql_setup_fruinfo
* Generates common id's for instances on the same
@@ -508,11 +505,11 @@
ql_setup_fruinfo(ql_adapter_state_t *ha)
{
uint32_t mybasedev_len;
ql_adapter_state_t *base_ha = NULL;
- QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
+ QL_PRINT_3(ha, "started\n");
/*
* 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
@@ -523,12 +520,10 @@
/*
* Get this ha's basedev path and its port index
*/
if (ql_get_basedev_len(ha, &mybasedev_len, &ha->fru_port_index) == 0) {
- GLOBAL_STATE_LOCK();
-
/*
* 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.
@@ -535,31 +530,21 @@
* If not create a new one from the global hba index.
*/
base_ha = ql_search_basedev(ha, mybasedev_len);
if (base_ha != NULL && base_ha->fru_hba_index != 0) {
ha->fru_hba_index = base_ha->fru_hba_index;
+ ha->fru_port_index = base_ha->fru_port_index + 1;
} else {
ha->fru_hba_index = ql_gfru_hba_index++;
+ ha->fru_port_index = 0;
}
-
- if (CFG_IST(ha, CFG_CTRL_8081)) {
- /*
- * 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.
- */
- ha->fru_port_index = ha->flags & FUNCTION_1 ? 1 : 0;
- }
-
- GLOBAL_STATE_UNLOCK();
-
} else {
ha->fru_hba_index = 0;
ha->fru_port_index = 0;
}
- QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
+ QL_PRINT_3(ha, "done\n");
}
/*
* ql_get_basedev_len
*
@@ -585,11 +570,11 @@
{
int32_t dev_off;
int32_t port_off;
int8_t *devstr;
- QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
+ QL_PRINT_3(ha, "started\n");
if (ha->devpath == NULL) {
return ((uint32_t)-1);
}
@@ -626,11 +611,11 @@
}
*basedev_len = (uint32_t)(port_off - 1);
}
- QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
+ QL_PRINT_3(ha, "done\n");
return (0);
}
/*
@@ -655,11 +640,11 @@
{
ql_link_t *link;
ql_adapter_state_t *ha;
uint32_t basedev_len, port_index;
- QL_PRINT_3(CE_CONT, "(%d): started\n", myha->instance);
+ QL_PRINT_3(myha, "started\n", myha->instance);
for (link = ql_hba.first; link != NULL; link = link->next) {
ha = link->base_address;
@@ -691,15 +676,15 @@
*/
if ((basedev_len == mybasedev_len) && (strncmp(myha->devpath,
ha->devpath, basedev_len) == 0)) {
/* We found the ha with same basedev */
- QL_PRINT_3(CE_CONT, "(%d): found, done\n",
+ QL_PRINT_3(myha, "found, done\n",
myha->instance);
return (ha);
}
}
- QL_PRINT_3(CE_CONT, "(%d): not found, done\n", myha->instance);
+ QL_PRINT_3(myha, "not found, done\n", myha->instance);
return (NULL);
}