A blind carbon copy

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Wed, 06 Oct 2004 00:43:53 -0600 (MDT)
This is a blind carbon copy.

attached mail follows:


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

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
_at__at_ -45,6 +45,7 _at__at_
 #endif
 #include <machine/legacyvar.h>
 #include <machine/pci_cfgreg.h>
+#include <machine/resource.h>
 
 #include "pcib_if.h"
 
_at__at_ -77,11 +78,11 _at__at_
 
 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;
 
_at__at_ -468,6 +469,24 _at__at_
 	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 */
_at__at_ -482,7 +501,7 _at__at_
 	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),
Received on Wed Oct 06 2004 - 04:43:45 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:15 UTC