Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 May 2011 19:51:54 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 192548 for review
Message-ID:  <201105031951.p43Jpsfv006272@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@192548?ac=10

Change 192548 by jhb@jhb_jhbbsd on 2011/05/03 19:50:58

	At least one BIOS enumerates all I/O ports as being decoded by
	the Host-PCI bridge (which is actually correct), but we can't
	handle that since we have ACPI devices that aren't treated as
	children of pcib0.  Add a hack for this case to punt on using
	the I/O ports at all in that case.

Affected files ...

.. //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#13 edit

Differences ...

==== //depot/projects/pci/sys/dev/acpica/acpi_pcib_acpi.c#13 (text+ko) ====

@@ -64,6 +64,7 @@
     ACPI_BUFFER		ap_prt;		/* interrupt routing table */
 #ifdef NEW_PCIB
     struct pcib_host_resources ap_host_res;
+    int			ap_ignore_ioports;
 #endif
 };
 
@@ -230,6 +231,16 @@
 			return (AE_OK);
 		}
 
+		if (type == SYS_RES_IOPORT) {
+			if (min == 0) {
+				device_printf(sc->ap_dev,
+				    "Ignoring I/O port ranges\n");
+				sc->ap_ignore_ioports = 1;
+			}
+			if (sc->ap_ignore_ioports)
+				break;
+		}
+
 		/* XXX: Not sure this is correct? */
 		if (res->Data.Address.Decode != ACPI_POS_DECODE) {
 			device_printf(sc->ap_dev,
@@ -538,32 +549,27 @@
     struct acpi_hpcib_softc *sc;
     struct resource *r;
     int error;
+#endif
+
+    /*
+     * If this is not a request for a specific resource range,
+     * exclude low resource ranges that are not generally suitable
+     * for PCI BARs, etc.
+     */
+    if (start + count - 1 != end) {
+	    if (type == SYS_RES_MEMORY && start < acpi_host_mem_start)
+		    start = acpi_host_mem_start;
+	    if (type == SYS_RES_IOPORT && start < 0x1000)
+		    start = 0x1000;
+    }
 
+#ifdef NEW_PCIB
     sc = device_get_softc(dev);
     error = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end,
 	count, flags, &r);
     if (error == 0)
 	    return (r);
 #endif
-    /*
-     * If no memory preference is given, use upper 32MB slot most
-     * bioses use for their memory window.  Typically other bridges
-     * before us get in the way to assert their preferences on memory.
-     * Hardcoding like this sucks, so a more MD/MI way needs to be
-     * found to do it.  This is typically only used on older laptops
-     * that don't have pci busses behind pci bridge, so assuming > 32MB
-     * is likely OK.
-     *
-     * PCI-PCI bridges may allocate smaller ranges for their windows,
-     * but the heuristics here should apply to those, so we allow
-     * several different end addresses.
-     */
-    if (type == SYS_RES_MEMORY && start == 0UL && (end == ~0UL ||
-	end == 0xffffffff))
-	start = acpi_host_mem_start;
-    if (type == SYS_RES_IOPORT && start == 0UL && (end == ~0UL ||
-	end == 0xffff || end == 0xffffffff))
-	start = 0x1000;
     return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
 	count, flags));
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105031951.p43Jpsfv006272>