summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-10-06 07:22:58 +0000
committerimp <imp@FreeBSD.org>2004-10-06 07:22:58 +0000
commitdc2b0adf745acb8c0b72887899719e52edc96631 (patch)
tree7205928799e6c8026a60c0c11728550b2b7d99dd /sys
parent0f55bc1d4550e3abc0817c1b963dd66bebcbb74f (diff)
downloadFreeBSD-src-dc2b0adf745acb8c0b72887899719e52edc96631.zip
FreeBSD-src-dc2b0adf745acb8c0b72887899719e52edc96631.tar.gz
For legacy PCI bridges, limit memory allocation to the top 32MB of
RAM. Many older, legacy bridges only allow allocation from this range. This only appies to devices who don't have their memory assigned by the BIOS (since we allocate the ranges so assigned exactly), so should have minimal impact. Hoewver, for CardBus bridges (cbb), they rarely get the resources allocated by the BIOS, and this patch helps them greatly. Typically the 'bad Vcc' messages are caused by this problem.
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/pci/pci_bus.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c
index 892c173..aa3e4cd 100644
--- a/sys/i386/pci/pci_bus.c
+++ b/sys/i386/pci/pci_bus.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#endif
#include <machine/legacyvar.h>
#include <machine/pci_cfgreg.h>
+#include <machine/resource.h>
#include "pcib_if.h"
@@ -77,11 +78,11 @@ legacy_pcib_write_config(device_t dev, int bus, int slot, int func,
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;
@@ -469,6 +470,25 @@ legacy_pcib_write_ivar(device_t dev, device_t child, int which,
}
+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 */
DEVMETHOD(device_identify, legacy_pcib_identify),
@@ -482,7 +502,7 @@ static device_method_t legacy_pcib_methods[] = {
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),
OpenPOWER on IntegriCloud