changeset 11947:e9d33e5d3842

6850096 Error reports should include identification for x8 ECC Symbolsize in syndrome-type Contributed by Hans.Rosenfeld@amd.com
author Srihari Venkatesan <srihari.venkatesan@oracle.com>
date Wed, 17 Mar 2010 18:14:07 -0700
parents fbfb89676033
children 350aa79a756e
files usr/src/cmd/fm/eversholt/files/i386/i86pc/amd64.esc usr/src/uts/i86pc/cpu/amd_opteron/ao_mca.c usr/src/uts/i86pc/cpu/authenticamd/authamd.h usr/src/uts/i86pc/cpu/authenticamd/authamd_main.c usr/src/uts/i86pc/os/cmi_hw.c usr/src/uts/intel/sys/mc_amd.h
diffstat 6 files changed, 78 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/fm/eversholt/files/i386/i86pc/amd64.esc	Wed Mar 17 16:45:18 2010 -0700
+++ b/usr/src/cmd/fm/eversholt/files/i386/i86pc/amd64.esc	Wed Mar 17 18:14:07 2010 -0700
@@ -20,7 +20,7 @@
  */
 
 /* 
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. 
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved. 
  * Use is subject to license terms. 
  */ 
  
@@ -83,11 +83,11 @@
 
 #define	SINGLE_BIT_CE							\
 	(payloadprop("syndrome-type") == "E" ||				\
-	(payloadprop("syndrome-type") == "C" &&				\
+	(payloadprop("syndrome-type") == "C4" &&			\
 	CKSINGLE(payloadprop("syndrome"))))
 
 #define	MULTI_BIT_CE							\
-	(payloadprop("syndrome-type") == "C" &&				\
+	(payloadprop("syndrome-type") == "C4" &&			\
 	!CKSINGLE(payloadprop("syndrome")))
 
 /*								#PAGE#
--- a/usr/src/uts/i86pc/cpu/amd_opteron/ao_mca.c	Wed Mar 17 16:45:18 2010 -0700
+++ b/usr/src/uts/i86pc/cpu/amd_opteron/ao_mca.c	Wed Mar 17 18:14:07 2010 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -724,7 +724,7 @@
 	if (members & FM_EREPORT_PAYLOAD_FLAG_SYND_TYPE) {
 		fm_payload_set(ereport, FM_EREPORT_PAYLOAD_NAME_SYND_TYPE,
 		    DATA_TYPE_STRING, (syndtype == AMD_SYNDTYPE_CHIPKILL ?
-		    "C" : "E"), NULL);
+		    "C4" : "E"), NULL);
 	}
 
 	if (members & FM_EREPORT_PAYLOAD_FLAG_RESOURCE) {
--- a/usr/src/uts/i86pc/cpu/authenticamd/authamd.h	Wed Mar 17 16:45:18 2010 -0700
+++ b/usr/src/uts/i86pc/cpu/authenticamd/authamd.h	Wed Mar 17 18:14:07 2010 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -67,13 +67,14 @@
  * Per node shared state
  */
 struct authamd_nodeshared {
-	uint_t acs_chipid;
-	uint_t acs_procnodeid;
-	uint_t acs_family;		/* family number */
-	uint32_t acs_rev;		/* revision per cpuid_getchiprev */
-	volatile ulong_t acs_cfgonce;	/* Config performed once per chip */
-	hrtime_t acs_poll_timestamp;	/* Checks poll owner is alive */
-	cmi_hdl_t acs_pollowner;	/* poller of shared resources */
+	uint_t ans_chipid;
+	uint_t ans_procnodeid;
+	uint_t ans_family;		/* family number */
+	uint32_t ans_rev;		/* revision per cpuid_getchiprev */
+	volatile ulong_t ans_cfgonce;	/* Config performed once per chip */
+	hrtime_t ans_poll_timestamp;	/* Checks poll owner is alive */
+	cmi_hdl_t ans_pollowner;	/* poller of shared resources */
+	char *ans_eccsymsz;		/* DRAM ChipKill ECC Symbol Size */
 };
 
 enum authamd_cfgonce_bitnum {
@@ -81,7 +82,8 @@
 	AUTHAMD_CFGONCE_NBTHRESH,
 	AUTHAMD_CFGONCE_NBMCACFG,
 	AUTHAMD_CFGONCE_CACHESCRUB,
-	AUTHAMD_CFGONCE_NBMCA
+	AUTHAMD_CFGONCE_NBMCA,
+	AUTHAMD_CFGONCE_ECCSYMSZ
 };
 
 /*
--- a/usr/src/uts/i86pc/cpu/authenticamd/authamd_main.c	Wed Mar 17 16:45:18 2010 -0700
+++ b/usr/src/uts/i86pc/cpu/authenticamd/authamd_main.c	Wed Mar 17 18:14:07 2010 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -135,6 +135,12 @@
 	(X86_CHIPREV_ATLEAST(rev, X86_CHIPREV_AMD_10_REV_A))
 
 /*
+ * Families/revisions that support x8 ChipKill ECC
+ */
+#define	AUTHAMD_SUPPORTS_X8ECC(rev) \
+	(X86_CHIPREV_ATLEAST(rev, X86_CHIPREV_AMD_10_REV_D))
+
+/*
  * We recognise main memory ECC errors for AUTHAMD_MEMECC_RECOGNISED
  * revisions as:
  *
@@ -214,7 +220,7 @@
 static int
 authamd_chip_once(authamd_data_t *authamd, enum authamd_cfgonce_bitnum what)
 {
-	return (atomic_set_long_excl(&authamd->amd_shared->acs_cfgonce,
+	return (atomic_set_long_excl(&authamd->amd_shared->ans_cfgonce,
 	    what) == 0 ?  B_TRUE : B_FALSE);
 }
 
@@ -223,7 +229,7 @@
 {
 	ASSERT(procnodeid + 24 <= 31);
 	ASSERT((func & 7) == func);
-	ASSERT((reg & 3) == 0 && reg < 256);
+	ASSERT((reg & 3) == 0 && reg < 4096);
 
 	cmi_pci_putl(0, procnodeid + 24, func, reg, 0, val);
 }
@@ -233,7 +239,7 @@
 {
 	ASSERT(procnodeid + 24 <= 31);
 	ASSERT((func & 7) == func);
-	ASSERT((reg & 3) == 0 && reg < 256);
+	ASSERT((reg & 3) == 0 && reg < 4096);
 
 	return (cmi_pci_getl(0, procnodeid + 24, func, reg, 0, 0));
 }
@@ -283,9 +289,9 @@
 authamd_read_ecccnt(authamd_data_t *authamd, struct authamd_logout *msl)
 {
 	union mcreg_sparectl sparectl;
-	uint_t procnodeid = authamd->amd_shared->acs_procnodeid;
-	uint_t family = authamd->amd_shared->acs_family;
-	uint32_t rev = authamd->amd_shared->acs_rev;
+	uint_t procnodeid = authamd->amd_shared->ans_procnodeid;
+	uint_t family = authamd->amd_shared->ans_family;
+	uint32_t rev = authamd->amd_shared->ans_rev;
 	int chan, cs;
 
 	/*
@@ -375,9 +381,9 @@
 authamd_clear_ecccnt(authamd_data_t *authamd, boolean_t clrint)
 {
 	union mcreg_sparectl sparectl;
-	uint_t procnodeid = authamd->amd_shared->acs_procnodeid;
-	uint_t family = authamd->amd_shared->acs_family;
-	uint32_t rev = authamd->amd_shared->acs_rev;
+	uint_t procnodeid = authamd->amd_shared->ans_procnodeid;
+	uint_t family = authamd->amd_shared->ans_family;
+	uint32_t rev = authamd->amd_shared->ans_rev;
 	int chan, cs;
 
 	if (!AUTHAMD_HAS_ONLINESPARECTL(rev))
@@ -502,10 +508,10 @@
 
 	if ((sp = authamd_shared[procnodeid]) == NULL) {
 		sp = kmem_zalloc(sizeof (struct authamd_nodeshared), KM_SLEEP);
-		sp->acs_chipid = chipid;
-		sp->acs_procnodeid = procnodeid;
-		sp->acs_family = family;
-		sp->acs_rev = rev;
+		sp->ans_chipid = chipid;
+		sp->ans_procnodeid = procnodeid;
+		sp->ans_family = family;
+		sp->ans_rev = rev;
 		membar_producer();
 
 		osp = atomic_cas_ptr(&authamd_shared[procnodeid], NULL, sp);
@@ -555,9 +561,9 @@
 authamd_bankctl_skipinit(cmi_hdl_t hdl, int bank)
 {
 	authamd_data_t *authamd = cms_hdl_getcmsdata(hdl);
-	uint32_t rev = authamd->amd_shared->acs_rev;
+	uint32_t rev = authamd->amd_shared->ans_rev;
 
-	if (authamd->amd_shared->acs_family == AUTHAMD_FAMILY_6)
+	if (authamd->amd_shared->ans_family == AUTHAMD_FAMILY_6)
 		return (bank == 0 ?  B_TRUE : B_FALSE);
 
 	if (AUTHAMD_NBONCHIP(rev) && bank == AMD_MCA_BANK_NB) {
@@ -575,7 +581,7 @@
 authamd_bankctl_val(cmi_hdl_t hdl, int bank, uint64_t proposed)
 {
 	authamd_data_t *authamd = cms_hdl_getcmsdata(hdl);
-	uint32_t rev = authamd->amd_shared->acs_rev;
+	uint32_t rev = authamd->amd_shared->ans_rev;
 	uint64_t val = proposed;
 
 	/*
@@ -672,8 +678,8 @@
 authamd_mca_init(cmi_hdl_t hdl, int nbanks)
 {
 	authamd_data_t *authamd = cms_hdl_getcmsdata(hdl);
-	uint32_t rev = authamd->amd_shared->acs_rev;
-	uint_t procnodeid = authamd->amd_shared->acs_procnodeid;
+	uint32_t rev = authamd->amd_shared->ans_rev;
+	uint_t procnodeid = authamd->amd_shared->ans_procnodeid;
 
 	/*
 	 * On chips with a NB online spare control register take control
@@ -809,6 +815,17 @@
 		    MC_CTL_REG_SCRUBCTL, val);
 	}
 
+	/*
+	 * ECC symbol size. Defaults to 4.
+	 * Set to 8 on systems that support x8 ECC and have it enabled.
+	 */
+	if (authamd_chip_once(authamd, AUTHAMD_CFGONCE_ECCSYMSZ)) {
+		authamd->amd_shared->ans_eccsymsz = "C4";
+		if (AUTHAMD_SUPPORTS_X8ECC(rev) &&
+		    (authamd_pcicfg_read(procnodeid, MC_FUNC_MISCCTL,
+		    MC_CTL_REG_EXTNBCFG) & MC_EXTNBCFG_ECCSYMSZ))
+			authamd->amd_shared->ans_eccsymsz = "C8";
+	}
 }
 
 /*
@@ -818,20 +835,20 @@
 authamd_poll_ownermask(cmi_hdl_t hdl, hrtime_t pintvl)
 {
 	authamd_data_t *authamd = cms_hdl_getcmsdata(hdl);
-	struct authamd_nodeshared *acsp = authamd->amd_shared;
+	struct authamd_nodeshared *ansp = authamd->amd_shared;
 	hrtime_t now = gethrtime_waitfree();
-	hrtime_t last = acsp->acs_poll_timestamp;
+	hrtime_t last = ansp->ans_poll_timestamp;
 	int dopoll = 0;
 
 	if (now - last > 2 * pintvl || last == 0) {
-		acsp->acs_pollowner = hdl;
+		ansp->ans_pollowner = hdl;
 		dopoll = 1;
-	} else if (acsp->acs_pollowner == hdl) {
+	} else if (ansp->ans_pollowner == hdl) {
 		dopoll = 1;
 	}
 
 	if (dopoll)
-		acsp->acs_poll_timestamp = now;
+		ansp->ans_poll_timestamp = now;
 
 	return (dopoll ? -1ULL : ~(1 << AMD_MCA_BANK_NB));
 
@@ -847,7 +864,7 @@
 {
 	authamd_data_t *authamd = cms_hdl_getcmsdata(hdl);
 	struct authamd_logout *msl = mslogout;
-	uint32_t rev = authamd->amd_shared->acs_rev;
+	uint32_t rev = authamd->amd_shared->ans_rev;
 
 	if (msl == NULL)
 		return;
@@ -923,7 +940,7 @@
 	authamd_data_t *authamd = cms_hdl_getcmsdata(hdl);
 	/* uint16_t errcode = MCAX86_ERRCODE(status); */
 	uint16_t exterrcode = AMD_EXT_ERRCODE(status);
-	uint32_t rev = authamd->amd_shared->acs_rev;
+	uint32_t rev = authamd->amd_shared->ans_rev;
 
 	/*
 	 * Recognise main memory ECC errors
@@ -984,7 +1001,7 @@
 		return;
 
 	/* Assume all processors have the same number of nodes */
-	mc = authamd->amd_shared->acs_procnodeid %
+	mc = authamd->amd_shared->ans_procnodeid %
 	    cpuid_get_procnodes_per_pkg(CPU);
 
 	for (chan = 0; chan < AUTHAMD_DRAM_NCHANNEL; chan++) {
@@ -1012,7 +1029,7 @@
 				fm_fmri_hc_set(nvl, FM_HC_SCHEME_VERSION,
 				    NULL, NULL, 5,
 				    "motherboard", 0,
-				    "chip", authamd->amd_shared->acs_chipid,
+				    "chip", authamd->amd_shared->ans_chipid,
 				    "memory-controller", mc,
 				    "dram-channel", chan,
 				    "chip-select", cs);
@@ -1074,7 +1091,7 @@
 		if (members & FM_EREPORT_GENAMD_PAYLOAD_FLAG_SYNDTYPE) {
 			fm_payload_set(ereport,
 			    FM_EREPORT_GENAMD_PAYLOAD_NAME_SYNDTYPE,
-			    DATA_TYPE_STRING, "C",
+			    DATA_TYPE_STRING, authamd->amd_shared->ans_eccsymsz,
 			    NULL);
 		}
 	}
--- a/usr/src/uts/i86pc/os/cmi_hw.c	Wed Mar 17 16:45:18 2010 -0700
+++ b/usr/src/uts/i86pc/os/cmi_hw.c	Wed Mar 17 18:14:07 2010 -0700
@@ -40,6 +40,7 @@
 #include <sys/ksynch.h>
 #include <sys/x_call.h>
 #include <sys/pghw.h>
+#include <sys/pci_cfgacc.h>
 #include <sys/pci_cfgspace.h>
 #include <sys/archsystm.h>
 #include <sys/ontrap.h>
@@ -1763,19 +1764,22 @@
 		if (hdl)
 			val = pci_config_get8(hdl, (off_t)reg);
 		else
-			val = (*pci_getb_func)(bus, dev, func, reg);
+			val = pci_cfgacc_get8(NULL, PCI_GETBDF(bus, dev, func),
+			    reg);
 		break;
 	case 2:
 		if (hdl)
 			val = pci_config_get16(hdl, (off_t)reg);
 		else
-			val = (*pci_getw_func)(bus, dev, func, reg);
+			val = pci_cfgacc_get16(NULL, PCI_GETBDF(bus, dev, func),
+			    reg);
 		break;
 	case 4:
 		if (hdl)
 			val = pci_config_get32(hdl, (off_t)reg);
 		else
-			val = (*pci_getl_func)(bus, dev, func, reg);
+			val = pci_cfgacc_get32(NULL, PCI_GETBDF(bus, dev, func),
+			    reg);
 		break;
 	default:
 		val = 0;
@@ -1841,21 +1845,24 @@
 		if (hdl)
 			pci_config_put8(hdl, (off_t)reg, (uint8_t)val);
 		else
-			(*pci_putb_func)(bus, dev, func, reg, (uint8_t)val);
+			pci_cfgacc_put8(NULL, PCI_GETBDF(bus, dev, func), reg,
+			    (uint8_t)val);
 		break;
 
 	case 2:
 		if (hdl)
 			pci_config_put16(hdl, (off_t)reg, (uint16_t)val);
 		else
-			(*pci_putw_func)(bus, dev, func, reg, (uint16_t)val);
+			pci_cfgacc_put16(NULL, PCI_GETBDF(bus, dev, func), reg,
+			    (uint16_t)val);
 		break;
 
 	case 4:
 		if (hdl)
 			pci_config_put32(hdl, (off_t)reg, val);
 		else
-			(*pci_putl_func)(bus, dev, func, reg, val);
+			pci_cfgacc_put32(NULL, PCI_GETBDF(bus, dev, func), reg,
+			    val);
 		break;
 
 	default:
--- a/usr/src/uts/intel/sys/mc_amd.h	Wed Mar 17 16:45:18 2010 -0700
+++ b/usr/src/uts/intel/sys/mc_amd.h	Wed Mar 17 18:14:07 2010 -0700
@@ -18,7 +18,7 @@
  *
  * CDDL HEADER END
  *
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -198,9 +198,11 @@
 #define	MC_CTL_REG_SCRUBADDR_HI	0x60	/* DRAM Scrub Address High */
 #define	MC_CTL_REG_SPARECTL	0xb0	/* On-line spare control register */
 #define	MC_CTL_REG_NBCAP	0xe8	/* NB Capabilities */
+#define	MC_CTL_REG_EXTNBCFG	0x180	/* Ext. MCA NB configuration register */
 
 #define	MC_NBCAP_L3CAPABLE	(1U << 25)
 #define	MC_NBCAP_MULTINODECPU	(1U << 29)
+#define	MC_EXTNBCFG_ECCSYMSZ	(1U << 25)
 
 /*
  * MC4_MISC MSR and MC4_MISCj MSRs