Date: 24 Oct 2000 18:08:45 -0400 From: David D Golombek <daveg@MIT.EDU> To: Mike Smith <msmith@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: PCI Device Remapping Message-ID: <rxdlmvdj3iq.fsf@contents-vnder-pressvre.mit.edu> In-Reply-To: Mike Smith's message of "Tue, 24 Oct 2000 14:18:33 -0700" References: <200010242118.e9OLIXh02243@mass.osd.bsdi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith <msmith@freebsd.org> writes:
> If you're working on a single, fixed platform, this should be pretty
> simple; they just lop the top bit off the base address they use for PCI
> address allocation.
>
> Here's an evil trick you can pull though, if you're *really* desperate
> and if you're *certain* that you're in control of your platform, and
> *certain* that you'll never have more than ~1.9GB of physical memory.
>
> In sys/pci/pci.c:pci_readmaps(), fix the loop that reads maps to knock the
> high bit off memory ranges and write them back:
>
> for (i = 0; i < maxmaps; i++) {
> int reg = PCIR_MAPS + i*4;
> u_int32_t base;
> u_int32_t ln2range;
>
> base = pci_cfgread(cfg, reg, 4);
> ln2range = pci_maprange(base);
>
> if (base == 0 || ln2range == 0 || base == 0xffffffff)
> continue; /* skip invalid entry */
> else {
> /* remap below 2GB */
> if (pci_maptype(base) == PCI_MAPMEM) {
> base &= ~0x80000000;
> pci_cfgwrite(cfg, reg, base, 4);
> ln2range = pci_maprange(base);
> }
> j++;
> if (ln2range > 32) {
> i++;
> j++;
> }
> }
> }
>
> This is, of course, only a solution if you have total control over the
> system as well; if you plan to ship the product for inclusion in general
> FreeBSD systems, you're prettymuch hosed.
This is actually only needed for an internal use project, and this
hack is exactly what I was looking for! It works wonderfully,
although I had to change the code slightly:
if ((pci_maptype(base) & PCI_MAPMEM) == PCI_MAPMEM) {
base &= ~0x80000000;
printf("0x%x)\n", base);
pci_cfgwrite(cfg, reg, base, 4);
ln2range = pci_maprange(base);
}
to handle prefetchable memory as well.
Thank you very much for the suggestion -- I'd read through that code,
but didn't think about the simple fix you've suggested!
DaveG o_, o, o_ o_ o'
Programmer )-' /|' ),` ) ' (\ ^o Gymnast
Dancer >\ / > >\ >^' >\ >>' Hiker
daveg@mit.edu www.mit.edu/~daveg/ (617)216-4705
dave.golombek@conexant.com www.conexant.com (508)621-0658
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?rxdlmvdj3iq.fsf>
