[Midnightbsd-cvs] src [7297] trunk/sys/dev/acpica/acpi.c: start ignoring most resources for PCI root bridges.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Sep 5 07:31:57 EDT 2015


Revision: 7297
          http://svnweb.midnightbsd.org/src/?rev=7297
Author:   laffer1
Date:     2015-09-05 07:31:57 -0400 (Sat, 05 Sep 2015)
Log Message:
-----------
start ignoring most resources for PCI root bridges. Obtained from: FreeBSD

Modified Paths:
--------------
    trunk/sys/dev/acpica/acpi.c

Modified: trunk/sys/dev/acpica/acpi.c
===================================================================
--- trunk/sys/dev/acpica/acpi.c	2015-09-05 11:29:27 UTC (rev 7296)
+++ trunk/sys/dev/acpica/acpi.c	2015-09-05 11:31:57 UTC (rev 7297)
@@ -1189,6 +1189,7 @@
     struct acpi_softc *sc = device_get_softc(dev);
     struct acpi_device *ad = device_get_ivars(child);
     struct resource_list *rl = &ad->ad_rl;
+    ACPI_DEVICE_INFO *devinfo;
     u_long end;
     
     /* Ignore IRQ resources for PCI link devices. */
@@ -1195,6 +1196,30 @@
     if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL)
 	return (0);
 
+    /*
+     * Ignore most resources for PCI root bridges.  Some BIOSes
+     * incorrectly enumerate the memory ranges they decode as plain
+     * memory resources instead of as ResourceProducer ranges.  Other
+     * BIOSes incorrectly list system resource entries for I/O ranges
+     * under the PCI bridge.  Do allow the one known-correct case on
+     * x86 of a PCI bridge claiming the I/O ports used for PCI config
+     * access.
+     */
+    if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
+	if (ACPI_SUCCESS(AcpiGetObjectInfo(ad->ad_handle, &devinfo))) {
+	    if ((devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0) {
+#if defined(__i386__) || defined(__amd64__)
+		if (!(type == SYS_RES_IOPORT && start == CONF1_ADDR_PORT))
+#endif
+		{
+		    AcpiOsFree(devinfo);
+		    return (0);
+		}
+	    }
+	    AcpiOsFree(devinfo);
+	}
+    }
+
     /* If the resource is already allocated, fail. */
     if (resource_list_busy(rl, type, rid))
 	return (EBUSY);
@@ -3720,6 +3745,7 @@
     int		 error, *dbg;
     struct	 debugtag *tag;
     struct	 sbuf sb;
+    char	 temp[128];
 
     if (sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND) == NULL)
 	return (ENOMEM);
@@ -3743,15 +3769,15 @@
     }
     sbuf_trim(&sb);
     sbuf_finish(&sb);
-
-    /* Copy out the old values to the user. */
-    error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb));
+    strlcpy(temp, sbuf_data(&sb), sizeof(temp));
     sbuf_delete(&sb);
 
-    /* If the user is setting a string, parse it. */
+    error = sysctl_handle_string(oidp, temp, sizeof(temp), req);
+
+    /* Check for error or no change */
     if (error == 0 && req->newptr != NULL) {
 	*dbg = 0;
-	setenv((char *)oidp->oid_arg1, (char *)req->newptr);
+	setenv((char *)oidp->oid_arg1, temp);
 	acpi_set_debugging(NULL);
     }
     ACPI_SERIAL_END(acpi);



More information about the Midnightbsd-cvs mailing list