summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/pkg/manifests/driver-network-hermon.mf3
-rw-r--r--usr/src/uts/common/io/ib/adapters/hermon/hermon.c62
-rw-r--r--usr/src/uts/common/io/ib/adapters/hermon/hermon_ioctl.c6
-rw-r--r--usr/src/uts/common/sys/ib/adapters/hermon/hermon.h32
-rw-r--r--usr/src/uts/common/sys/ib/adapters/hermon/hermon_hw.h1
5 files changed, 57 insertions, 47 deletions
diff --git a/usr/src/pkg/manifests/driver-network-hermon.mf b/usr/src/pkg/manifests/driver-network-hermon.mf
index ecf56f70f7..d0f2cda141 100644
--- a/usr/src/pkg/manifests/driver-network-hermon.mf
+++ b/usr/src/pkg/manifests/driver-network-hermon.mf
@@ -42,7 +42,8 @@ driver name=hermon perms="* 0666 root sys" \
alias=pciex15b3,6340 \
alias=pciex15b3,634a \
alias=pciex15b3,6732 \
- alias=pciex15b3,673c
+ alias=pciex15b3,673c \
+ alias=pciex15b3,6746
file path=kernel/drv/$(ARCH64)/hermon group=sys
$(i386_ONLY)file path=kernel/drv/hermon group=sys
file path=kernel/drv/hermon.conf group=sys
diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon.c
index cfe77cdb35..f8950b4000 100644
--- a/usr/src/uts/common/io/ib/adapters/hermon/hermon.c
+++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon.c
@@ -20,8 +20,7 @@
*/
/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -146,7 +145,7 @@ static struct cb_ops hermon_cb_ops = {
ddi_prop_op, /* prop_op */
NULL, /* streams */
D_NEW | D_MP |
- D_64BIT | /* D_HOTPLUG | */
+ D_64BIT | D_HOTPLUG |
D_DEVMAP, /* flags */
CB_REV /* rev */
};
@@ -1150,6 +1149,38 @@ hermon_icm_free(hermon_state_t *state, hermon_rsrc_type_t type,
}
}
+
+/*
+ * hermon_device_mode()
+ * Context: Can be called from base or interrupt context.
+ *
+ * Return HERMON_HCA_MODE for operational mode
+ * Return HERMON_MAINTENANCE_MODE for maintenance mode
+ * Return 0 otherwise
+ *
+ * A non-zero return for either operational or maintenance mode simplifies
+ * one of the 2 uses of this function.
+ */
+int
+hermon_device_mode(hermon_state_t *state)
+{
+ if (state->hs_vendor_id != PCI_VENID_MLX)
+ return (0);
+
+ switch (state->hs_device_id) {
+ case PCI_DEVID_HERMON_SDR:
+ case PCI_DEVID_HERMON_DDR:
+ case PCI_DEVID_HERMON_DDRG2:
+ case PCI_DEVID_HERMON_QDRG2:
+ case PCI_DEVID_HERMON_QDRG2V:
+ return (HERMON_HCA_MODE);
+ case PCI_DEVID_HERMON_MAINT:
+ return (HERMON_MAINTENANCE_MODE);
+ default:
+ return (0);
+ }
+}
+
/*
* hermon_drv_init()
* Context: Only called from attach() path context
@@ -1160,6 +1191,11 @@ hermon_drv_init(hermon_state_t *state, dev_info_t *dip, int instance)
{
int status;
+ /* Retrieve PCI device, vendor and rev IDs */
+ state->hs_vendor_id = HERMON_GET_VENDOR_ID(state->hs_dip);
+ state->hs_device_id = HERMON_GET_DEVICE_ID(state->hs_dip);
+ state->hs_revision_id = HERMON_GET_REVISION_ID(state->hs_dip);
+
/*
* Check and set the operational mode of the device. If the driver is
* bound to the Hermon device in "maintenance mode", then this generally
@@ -1168,18 +1204,16 @@ hermon_drv_init(hermon_state_t *state, dev_info_t *dip, int instance)
* successfully load either the primary or the secondary firmware
* image.
*/
- if (HERMON_IS_HCA_MODE(state->hs_dip)) {
- state->hs_operational_mode = HERMON_HCA_MODE;
+ state->hs_operational_mode = hermon_device_mode(state);
+ switch (state->hs_operational_mode) {
+ case HERMON_HCA_MODE:
state->hs_cfg_profile_setting = HERMON_CFG_MEMFREE;
-
- } else if (HERMON_IS_MAINTENANCE_MODE(state->hs_dip)) {
+ break;
+ case HERMON_MAINTENANCE_MODE:
HERMON_FMANOTE(state, HERMON_FMA_MAINT);
- state->hs_operational_mode = HERMON_MAINTENANCE_MODE;
state->hs_fm_degraded_reason = HCA_FW_MISC; /* not fw reason */
return (DDI_FAILURE);
-
- } else {
- state->hs_operational_mode = 0; /* invalid operational mode */
+ default:
HERMON_FMANOTE(state, HERMON_FMA_PCIID);
HERMON_WARNING(state, "unexpected device type detected");
return (DDI_FAILURE);
@@ -1556,11 +1590,6 @@ hermon_hw_init(hermon_state_t *state)
((uintptr_t)state->hs_reg_cmd_baseaddr +
HERMON_CMD_SW_SEMAPHORE_OFFSET);
- /* Retrieve PCI device, vendor and rev IDs */
- state->hs_vendor_id = HERMON_GET_VENDOR_ID(state->hs_dip);
- state->hs_device_id = HERMON_GET_DEVICE_ID(state->hs_dip);
- state->hs_revision_id = HERMON_GET_REVISION_ID(state->hs_dip);
-
/* make sure init'd before we start filling things in */
bzero(&state->hs_hcaparams, sizeof (struct hermon_hw_initqueryhca_s));
@@ -4538,6 +4567,7 @@ hermon_set_msix_info(hermon_state_t *state)
}
ASSERT(rnumber != 0);
state->hs_msix_pba_rnumber = rnumber;
+ ddi_prop_free(regs_list);
/* Map in the MSI-X Pending Bit Array */
if (hermon_regs_map_setup(state, state->hs_msix_pba_rnumber,
diff --git a/usr/src/uts/common/io/ib/adapters/hermon/hermon_ioctl.c b/usr/src/uts/common/io/ib/adapters/hermon/hermon_ioctl.c
index 2fc4ecd793..f372d7b008 100644
--- a/usr/src/uts/common/io/ib/adapters/hermon/hermon_ioctl.c
+++ b/usr/src/uts/common/io/ib/adapters/hermon/hermon_ioctl.c
@@ -20,8 +20,7 @@
*/
/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -2482,8 +2481,7 @@ hermon_flash_cfi_init(hermon_state_t *state, uint32_t *cfi_info,
int status;
/* Right now, all hermon cards use SPI. */
- if (HERMON_IS_MAINTENANCE_MODE(state->hs_dip) ||
- HERMON_IS_HCA_MODE(state->hs_dip)) {
+ if (hermon_device_mode(state)) {
/*
* Don't use CFI for SPI part. Just fill in what we need
* and return.
diff --git a/usr/src/uts/common/sys/ib/adapters/hermon/hermon.h b/usr/src/uts/common/sys/ib/adapters/hermon/hermon.h
index 1f9dd4545b..7ffef9b05f 100644
--- a/usr/src/uts/common/sys/ib/adapters/hermon/hermon.h
+++ b/usr/src/uts/common/sys/ib/adapters/hermon/hermon.h
@@ -20,8 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#ifndef _SYS_IB_ADAPTERS_HERMON_H
@@ -229,37 +228,17 @@ extern "C" {
#define HERMON_GET_DEVICE_ID(dip) HERMON_DDI_PROP_GET(dip, "device-id")
#define HERMON_GET_REVISION_ID(dip) HERMON_DDI_PROP_GET(dip, "revision-id")
-
-
/*
- * Define used to determine the device mode to which Hermon driver has been
- * attached. HERMON_IS_MAINTENANCE_MODE() returns true when the device has
+ * Defines used to record the device mode to which Hermon driver has been
+ * attached. HERMON_MAINTENANCE_MODE is used when the device has
* come up in the "maintenance mode". In this mode, no InfiniBand interfaces
* are enabled, but the device's firmware can be updated/flashed (and
* test/debug interfaces should be useable).
- * HERMON_IS_HCA_MODE() returns true when the device has come up in the
+ * HERMON_HCA_MODE isused when the device has come up in the
* normal HCA mode. In this mode, all necessary InfiniBand interfaces are
* enabled (and, if necessary, HERMON firmware can be updated/flashed).
*/
-#define HERMON_IS_MAINTENANCE_MODE(dip) \
- ((ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "device-id", -1) == PCI_DEVID_HERMON_MAINT) && \
- (ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "vendor-id", -1) == PCI_VENID_MLX))
-
-#define HERMON_IS_HCA_MODE(dip) \
- (((ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "device-id", -1) == PCI_DEVID_HERMON_SDR) || \
- (ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "device-id", -1) == PCI_DEVID_HERMON_DDR) || \
- (ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "device-id", -1) == PCI_DEVID_HERMON_DDRG2) || \
- (ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "device-id", -1) == PCI_DEVID_HERMON_QDRG2)) && \
- (ddi_prop_get_int(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
- "vendor-id", -1) == PCI_VENID_MLX))
-
-#define HERMON_MAINTENANCE_MODE 1
+#define HERMON_MAINTENANCE_MODE 1
#define HERMON_HCA_MODE 2
/*
@@ -980,6 +959,7 @@ int hermon_icm_alloc(hermon_state_t *state, hermon_rsrc_type_t type,
uint32_t icm_index1, uint32_t icm_index2);
void hermon_icm_free(hermon_state_t *state, hermon_rsrc_type_t type,
uint32_t icm_index1, uint32_t icm_index2);
+int hermon_device_mode(hermon_state_t *state);
/* Defined in hermon_umap.c */
int hermon_devmap(dev_t dev, devmap_cookie_t dhp, offset_t off, size_t len,
diff --git a/usr/src/uts/common/sys/ib/adapters/hermon/hermon_hw.h b/usr/src/uts/common/sys/ib/adapters/hermon/hermon_hw.h
index 92bac128ff..0845906238 100644
--- a/usr/src/uts/common/sys/ib/adapters/hermon/hermon_hw.h
+++ b/usr/src/uts/common/sys/ib/adapters/hermon/hermon_hw.h
@@ -52,6 +52,7 @@ extern "C" {
#define PCI_DEVID_HERMON_DDR 0x634A /* Mellanox MT25208-DDR PCIe Gen1 */
#define PCI_DEVID_HERMON_DDRG2 0x6732 /* Mellanox MT25208-DDR PCIe Gen2 */
#define PCI_DEVID_HERMON_QDRG2 0x673C /* Mellanox MT25208-QDR PCIe Gen2 */
+#define PCI_DEVID_HERMON_QDRG2V 0x6746 /* Mellanox MT25208-QDR PCIe Gen2 */
#define PCI_DEVID_HERMON_MAINT 0x0191 /* Maintenance/Mem Controller Mode */
/*