Module Name:    src
Committed By:   hannken
Date:           Tue Jul 12 09:29:32 UTC 2016

Modified Files:
        src/sys/dev/acpi: acpi_mcfg.c

Log Message:
On an Intel E7520 temporarily disable Enhanced Config Access error
detection and reporting during bus scan.

Fixes PR kern/51251: ACPI device probe raises NMI


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/acpi_mcfg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_mcfg.c
diff -u src/sys/dev/acpi/acpi_mcfg.c:1.2 src/sys/dev/acpi/acpi_mcfg.c:1.3
--- src/sys/dev/acpi/acpi_mcfg.c:1.2	Sun Oct 11 21:49:22 2015
+++ src/sys/dev/acpi/acpi_mcfg.c	Tue Jul 12 09:29:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_mcfg.c,v 1.2 2015/10/11 21:49:22 christos Exp $	*/
+/*	$NetBSD: acpi_mcfg.c,v 1.3 2016/07/12 09:29:32 hannken Exp $	*/
 
 /*-
  * Copyright (C) 2015 NONAKA Kimihiro <[email protected]>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.2 2015/10/11 21:49:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.3 2016/07/12 09:29:32 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -526,6 +526,9 @@ acpimcfg_map_bus(device_t self, pci_chip
 	struct mcfg_bus *mb;
 	bus_space_handle_t bsh;
 	bus_addr_t baddr;
+	pcitag_t tag;
+	pcireg_t reg;
+	bool is_e7520_mch;
 	int boff;
 	int last_dev, last_func;
 	int i, j;
@@ -569,8 +572,29 @@ acpimcfg_map_bus(device_t self, pci_chip
 	mb->valid_ndevs = 0;
 	mb->last_probed = pci_make_tag(pc, bus, 0, 0);
 
+	/*
+	 * On an Intel E7520 we have to temporarily disable
+	 * Enhanced Config Access error detection and reporting
+	 * by setting the appropriate error mask in HI_ERRMASK register.
+	 *
+	 * See "Intel E7520 Memory Controller Hub (MCH) Datasheet",
+	 * Document 303006-002, pg. 82
+	 */
+	tag = pci_make_tag(pc, 0, 0, 1);
+	reg = pci_conf_read(pc, tag, PCI_ID_REG);
+	is_e7520_mch = (reg ==
+	    PCI_ID_CODE(PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_E7525_MCHER));
+	if (is_e7520_mch) {
+		reg = pci_conf_read(pc, tag, 0x54);
+		pci_conf_write(pc, tag, 0x54, reg | 0x20);
+	}
+
 	acpimcfg_scan_bus(sc, pc, bus);
 
+	if (is_e7520_mch) {
+		pci_conf_write(pc, tag, 0x54, reg);
+	}
+
 	/* Unmap extended configration space of all dev/func. */
 	bus_space_unmap(seg->ms_bst, bsh, ACPIMCFG_SIZE_PER_BUS);
 	memset(mb->bsh, 0, sizeof(mb->bsh));

Reply via email to