Please test fix for bad Vcc errors

"M. Warner Losh" <[email protected]>
Newsgroups gmane.os.freebsd.devel.mobile
Message-ID <[email protected]>
If you have an older laptop that's getting bad Vcc errors, please test
this patch.  There's a number of laptops with resource issues.  If you
are using ACPI, this won't change anything (I have a separate patch
for that).

Warner

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-mobile
To unsubscribe, send any mail to "[email protected]"
legacy.diff (text/plain, 2.2 KB)
Index: pci_bus.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/i386/pci/pci_bus.c,v
retrieving revision 1.112
diff -u -r1.112 pci_bus.c
--- pci_bus.c	1 Jun 2004 19:51:29 -0000	1.112
+++ pci_bus.c	6 Oct 2004 06:35:12 -0000
@@ -45,6 +45,7 @@
 #endif
 #include <machine/legacyvar.h>
 #include <machine/pci_cfgreg.h>
+#include <machine/resource.h>
 
 #include "pcib_if.h"
 
@@ -77,11 +78,11 @@
 
 static const char *
 legacy_pcib_is_host_bridge(int bus, int slot, int func,
-			  u_int32_t id, u_int8_t class, u_int8_t subclass,
-			  u_int8_t *busnum)
+			  uint32_t id, uint8_t class, uint8_t subclass,
+			  uint8_t *busnum)
 {
 	const char *s = NULL;
-	static u_int8_t pxb[4];	/* hack for 450nx */
+	static uint8_t pxb[4];	/* hack for 450nx */
 
 	*busnum = 0;
 
@@ -468,6 +469,24 @@
 	return ENOENT;
 }
 
+static struct resource *
+legacy_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
+    u_long start, u_long end, u_long count, u_int flags)
+{
+    /*
+     * 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 liekly OK.
+     */
+    if (type == SYS_RES_MEMORY && start == 0UL && end == ~0UL)
+	start = 0xfe000000;
+    return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
+	count, flags));
+}
 
 static device_method_t legacy_pcib_methods[] = {
 	/* Device interface */
@@ -482,7 +501,7 @@
 	DEVMETHOD(bus_print_child,	bus_generic_print_child),
 	DEVMETHOD(bus_read_ivar,	legacy_pcib_read_ivar),
 	DEVMETHOD(bus_write_ivar,	legacy_pcib_write_ivar),
-	DEVMETHOD(bus_alloc_resource,	bus_generic_alloc_resource),
+	DEVMETHOD(bus_alloc_resource,	legacy_pcib_alloc_resource),
 	DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
 	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
 	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.