changeset 9731:a1c591f64e05

6649689 bge private properties for interrupt coalescing should check for negative input values 6828220 mismatch device IDs between Broadcom bcm5703 copper and serdes 6793252 IBM eServer fma incorrectly shows fault.io.pciex.device-interr
author yong tan - Sun Microsystems - Beijing China <Yong.Tan@Sun.COM>
date Wed, 27 May 2009 10:29:49 +0800
parents ed2b214bdbd0
children 256da057a700
files usr/src/uts/common/io/bge/bge_chip2.c usr/src/uts/common/io/bge/bge_hw.h usr/src/uts/common/io/bge/bge_impl.h usr/src/uts/common/io/bge/bge_main2.c usr/src/uts/common/io/bge/bge_mii.c
diffstat 5 files changed, 65 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/bge/bge_chip2.c	Tue May 26 19:21:24 2009 -0700
+++ b/usr/src/uts/common/io/bge/bge_chip2.c	Wed May 27 10:29:49 2009 +0800
@@ -1965,6 +1965,8 @@
 	cidp->mbuf_hi_water = bge_mbuf_hi_water;
 	cidp->rx_ticks_norm = bge_rx_ticks_norm;
 	cidp->rx_count_norm = bge_rx_count_norm;
+	cidp->tx_ticks_norm = bge_tx_ticks_norm;
+	cidp->tx_count_norm = bge_tx_count_norm;
 
 	if (cidp->rx_rings == 0 || cidp->rx_rings > BGE_RECV_RINGS_MAX)
 		cidp->rx_rings = BGE_RECV_RINGS_DEFAULT;
@@ -3567,6 +3569,19 @@
 int bge_chip_start(bge_t *bgep, boolean_t reset_phys);
 #pragma	no_inline(bge_chip_start)
 
+void
+bge_chip_coalesce_update(bge_t *bgep)
+{
+	bge_reg_put32(bgep, SEND_COALESCE_MAX_BD_REG,
+	    bgep->chipid.tx_count_norm);
+	bge_reg_put32(bgep, SEND_COALESCE_TICKS_REG,
+	    bgep->chipid.tx_ticks_norm);
+	bge_reg_put32(bgep, RCV_COALESCE_MAX_BD_REG,
+	    bgep->chipid.rx_count_norm);
+	bge_reg_put32(bgep, RCV_COALESCE_TICKS_REG,
+	    bgep->chipid.rx_ticks_norm);
+}
+
 int
 bge_chip_start(bge_t *bgep, boolean_t reset_phys)
 {
@@ -3828,10 +3843,7 @@
 	/*
 	 * Steps 59-62: initialise Host Coalescing parameters
 	 */
-	bge_reg_put32(bgep, SEND_COALESCE_MAX_BD_REG, bge_tx_count_norm);
-	bge_reg_put32(bgep, SEND_COALESCE_TICKS_REG, bge_tx_ticks_norm);
-	bge_reg_put32(bgep, RCV_COALESCE_MAX_BD_REG, bge_rx_count_norm);
-	bge_reg_put32(bgep, RCV_COALESCE_TICKS_REG, bge_rx_ticks_norm);
+	bge_chip_coalesce_update(bgep);
 	if (DEVICE_5704_SERIES_CHIPSETS(bgep)) {
 		bge_reg_put32(bgep, SEND_COALESCE_INT_BD_REG,
 		    bge_tx_count_intr);
--- a/usr/src/uts/common/io/bge/bge_hw.h	Tue May 26 19:21:24 2009 -0700
+++ b/usr/src/uts/common/io/bge/bge_hw.h	Wed May 27 10:29:49 2009 +0800
@@ -56,8 +56,8 @@
 #define	DEVICE_ID_5701			0x1645
 #define	DEVICE_ID_5702			0x16a6
 #define	DEVICE_ID_5702fe		0x164d
-#define	DEVICE_ID_5703C			0x1647
-#define	DEVICE_ID_5703S			0x16a7
+#define	DEVICE_ID_5703C			0x16a7
+#define	DEVICE_ID_5703S			0x1647
 #define	DEVICE_ID_5703			0x16c7
 #define	DEVICE_ID_5704C			0x1648
 #define	DEVICE_ID_5704S			0x16a8
--- a/usr/src/uts/common/io/bge/bge_impl.h	Tue May 26 19:21:24 2009 -0700
+++ b/usr/src/uts/common/io/bge/bge_impl.h	Wed May 27 10:29:49 2009 +0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -632,6 +632,8 @@
 
 	uint32_t		rx_ticks_norm;
 	uint32_t		rx_count_norm;
+	uint32_t		tx_ticks_norm;
+	uint32_t		tx_count_norm;
 } chip_id_t;
 
 #define	CHIP_FLAG_SUPPORTED	0x80
@@ -1147,6 +1149,7 @@
 void bge_mbx_put(bge_t *bgep, bge_regno_t regno, uint64_t value);
 void bge_chip_cfg_init(bge_t *bgep, chip_id_t *cidp, boolean_t enable_dma);
 int bge_chip_id_init(bge_t *bgep);
+void bge_chip_coalesce_update(bge_t *bgep);
 int bge_chip_start(bge_t *bgep, boolean_t reset_phy);
 void bge_chip_stop(bge_t *bgep, boolean_t fault);
 #ifndef __sparc
--- a/usr/src/uts/common/io/bge/bge_main2.c	Tue May 26 19:21:24 2009 -0700
+++ b/usr/src/uts/common/io/bge/bge_main2.c	Wed May 27 10:29:49 2009 +0800
@@ -37,7 +37,7 @@
 /*
  * Make sure you keep the version ID up to date!
  */
-static char bge_version[] = "Broadcom Gb Ethernet v1.06";
+static char bge_version[] = "Broadcom Gb Ethernet v1.07";
 
 /*
  * Property names
@@ -1183,20 +1183,53 @@
 		}
 		return (err);
 	}
-	if (strcmp(pr_name, "_intr_coalesce_blank_time") == 0) {
+	if (strcmp(pr_name, "_rx_intr_coalesce_blank_time") == 0) {
+		if (ddi_strtol(pr_val, (char **)NULL, 0, &result) != 0)
+			return (EINVAL);
+		if (result < 0)
+			err = EINVAL;
+		else {
+			bgep->chipid.rx_ticks_norm = (uint32_t)result;
+			bge_chip_coalesce_update(bgep);
+		}
+		return (err);
+	}
+
+	if (strcmp(pr_name, "_rx_intr_coalesce_pkt_cnt") == 0) {
 		if (ddi_strtol(pr_val, (char **)NULL, 0, &result) != 0)
 			return (EINVAL);
 
-		bgep->chipid.rx_ticks_norm = (uint32_t)result;
-		return (0);
+		if (result < 0)
+			err = EINVAL;
+		else {
+			bgep->chipid.rx_count_norm = (uint32_t)result;
+			bge_chip_coalesce_update(bgep);
+		}
+		return (err);
 	}
-
-	if (strcmp(pr_name, "_intr_coalesce_pkt_cnt") == 0) {
+	if (strcmp(pr_name, "_tx_intr_coalesce_blank_time") == 0) {
 		if (ddi_strtol(pr_val, (char **)NULL, 0, &result) != 0)
 			return (EINVAL);
-
-		bgep->chipid.rx_count_norm = (uint32_t)result;
-		return (0);
+		if (result < 0)
+			err = EINVAL;
+		else {
+			bgep->chipid.tx_ticks_norm = (uint32_t)result;
+			bge_chip_coalesce_update(bgep);
+		}
+		return (err);
+	}
+
+	if (strcmp(pr_name, "_tx_intr_coalesce_pkt_cnt") == 0) {
+		if (ddi_strtol(pr_val, (char **)NULL, 0, &result) != 0)
+			return (EINVAL);
+
+		if (result < 0)
+			err = EINVAL;
+		else {
+			bgep->chipid.tx_count_norm = (uint32_t)result;
+			bge_chip_coalesce_update(bgep);
+		}
+		return (err);
 	}
 	return (ENOTSUP);
 }
--- a/usr/src/uts/common/io/bge/bge_mii.c	Tue May 26 19:21:24 2009 -0700
+++ b/usr/src/uts/common/io/bge/bge_mii.c	Wed May 27 10:29:49 2009 +0800
@@ -545,7 +545,6 @@
 	case MHCR_CHIP_ASIC_REV_5703:
 	case MHCR_CHIP_ASIC_REV_5704:
 	case MHCR_CHIP_ASIC_REV_5705:
-	case MHCR_CHIP_ASIC_REV_5721_5751:
 	case MHCR_CHIP_ASIC_REV_5752:
 	case MHCR_CHIP_ASIC_REV_5714:
 	case MHCR_CHIP_ASIC_REV_5715:
@@ -556,6 +555,7 @@
 	case MHCR_CHIP_ASIC_REV_5700:
 	case MHCR_CHIP_ASIC_REV_5701:
 	case MHCR_CHIP_ASIC_REV_5723:
+	case MHCR_CHIP_ASIC_REV_5721_5751:
 		/*
 		 * Just a plain reset; the "check" code breaks these chips
 		 */