diff options
author | imp <imp@FreeBSD.org> | 2006-10-30 19:18:46 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2006-10-30 19:18:46 +0000 |
commit | 4bea281f9ade627bae92397e800c3f3b5a307283 (patch) | |
tree | 4fd056502338d70664fa352221552819df190c2c /sys/dev/pci/pci_pci.c | |
parent | 95289e010fb3674d4ab102b64dcae134233b1b1c (diff) | |
download | FreeBSD-src-4bea281f9ade627bae92397e800c3f3b5a307283.zip FreeBSD-src-4bea281f9ade627bae92397e800c3f3b5a307283.tar.gz |
More fully support 64-bit bars. Prior to this commit, we supported
only those bars that had addresses assigned by the BIOS and where the
bridges were properly programmed. Now even unprogrammed ones work.
This was needed for sun4v. We still only implement up to 2GB memory
ranges, even for 64-bit bars. PCI standards at least through 2.2 say
that this is the max (or 1GB is, I only know it is < 32bits).
o Always define pci_addr_t as uint64_t. A pci address is always 64-bits,
but some hosts can't address all of them.
o Preserve the upper half of the 64-bit word during resource probing.
o Test to make sure that 64-bit values can fit in a u_long (true on some
platforms, but not others). Don't use those that can't.
o minor pedantry about data sizes.
o Better bridge resource reporting in bootverbose case.
o Minor formatting changes to cope with different data types on different
platforms.
Submitted by: jmg, with many changes by me to fully support 64-bit
addresses.
Diffstat (limited to 'sys/dev/pci/pci_pci.c')
-rw-r--r-- | sys/dev/pci/pci_pci.c | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index b883e2c..50b64f7 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -89,6 +89,33 @@ DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)); DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0); /* + * Is the prefetch window open (eg, can we allocate memory in it?) + */ +static int +pcib_is_prefetch_open(struct pcib_softc *sc) +{ + return (sc->pmembase > 0 && sc->pmembase < sc->pmemlimit); +} + +/* + * Is the nonprefetch window open (eg, can we allocate memory in it?) + */ +static int +pcib_is_nonprefetch_open(struct pcib_softc *sc) +{ + return (sc->membase > 0 && sc->membase < sc->memlimit); +} + +/* + * Is the io window open (eg, can we allocate ports in it?) + */ +static int +pcib_is_io_open(struct pcib_softc *sc) +{ + return (sc->iobase > 0 && sc->iobase < sc->iolimit); +} + +/* * Generic device interface */ static int @@ -225,8 +252,14 @@ pcib_attach_common(device_t dev) device_printf(dev, " secondary bus %d\n", sc->secbus); device_printf(dev, " subordinate bus %d\n", sc->subbus); device_printf(dev, " I/O decode 0x%x-0x%x\n", sc->iobase, sc->iolimit); - device_printf(dev, " memory decode 0x%x-0x%x\n", sc->membase, sc->memlimit); - device_printf(dev, " prefetched decode 0x%x-0x%x\n", sc->pmembase, sc->pmemlimit); + if (pcib_is_nonprefetch_open(sc)) + device_printf(dev, " memory decode 0x%jx-0x%jx\n", + (uintmax_t)sc->membase, (uintmax_t)sc->memlimit); + if (pcib_is_prefetch_open(sc)) + device_printf(dev, " prefetched decode 0x%jx-0x%jx\n", + (uintmax_t)sc->pmembase, (uintmax_t)sc->pmemlimit); + else + device_printf(dev, " no prefetched decode\n"); if (sc->flags & PCIB_SUBTRACTIVE) device_printf(dev, " Subtractively decoded bridge.\n"); } @@ -289,33 +322,6 @@ pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) } /* - * Is the prefetch window open (eg, can we allocate memory in it?) - */ -static int -pcib_is_prefetch_open(struct pcib_softc *sc) -{ - return (sc->pmembase > 0 && sc->pmembase < sc->pmemlimit); -} - -/* - * Is the nonprefetch window open (eg, can we allocate memory in it?) - */ -static int -pcib_is_nonprefetch_open(struct pcib_softc *sc) -{ - return (sc->membase > 0 && sc->membase < sc->memlimit); -} - -/* - * Is the io window open (eg, can we allocate ports in it?) - */ -static int -pcib_is_io_open(struct pcib_softc *sc) -{ - return (sc->iobase > 0 && sc->iobase < sc->iolimit); -} - -/* * We have to trap resource allocation requests and ensure that the bridge * is set up to, or capable of handling them. */ @@ -444,11 +450,11 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, } if (!ok && bootverbose) device_printf(dev, - "%s requested unsupported memory range " - "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n", + "%s requested unsupported memory range %#lx-%#lx " + "(decoding %#jx-%#jx, %#jx-%#jx)\n", device_get_nameunit(child), start, end, - sc->membase, sc->memlimit, sc->pmembase, - sc->pmemlimit); + (uintmax_t)sc->membase, (uintmax_t)sc->memlimit, + (uintmax_t)sc->pmembase, (uintmax_t)sc->pmemlimit); if (!ok) return (NULL); if (bootverbose) |