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.
This commit is contained in:
parent
0f55bc1d45
commit
dc2b0adf74
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user