Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Oct 2004 00:43:53 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        mobile@freebsd.org
Subject:   Please test fix for bad Vcc errors
Message-ID:  <20041006.004353.08394386.imp@bsdimp.com>

next in thread | raw e-mail | index | archive | help
----Next_Part(Wed_Oct__6_00:43:53_2004_716)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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

----Next_Part(Wed_Oct__6_00:43:53_2004_716)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="legacy.diff"

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),

----Next_Part(Wed_Oct__6_00:43:53_2004_716)----



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