Module Name: src Committed By: macallan Date: Thu Feb 25 21:09:00 UTC 2010
Modified Files: src/sys/dev/pci: genfb_pci.c Log Message: add a comment on PCI_MAGIC_IO_RANGE To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/genfb_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/genfb_pci.c diff -u src/sys/dev/pci/genfb_pci.c:1.23 src/sys/dev/pci/genfb_pci.c:1.24 --- src/sys/dev/pci/genfb_pci.c:1.23 Mon Aug 24 11:32:49 2009 +++ src/sys/dev/pci/genfb_pci.c Thu Feb 25 21:09:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb_pci.c,v 1.23 2009/08/24 11:32:49 jmcneill Exp $ */ +/* $NetBSD: genfb_pci.c,v 1.24 2010/02/25 21:09:00 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.23 2009/08/24 11:32:49 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.24 2010/02/25 21:09:00 macallan Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -97,6 +97,7 @@ struct pci_genfb_softc *sc = device_private(self); struct pci_attach_args *pa = aux; struct genfb_ops ops; + pcireg_t rom; int idx, bar, type; char devinfo[256]; @@ -136,7 +137,7 @@ /* mmap()able bus ranges */ idx = 0; bar = 0x10; - while (bar < 0x30) { + while (bar < 0x34) { type = pci_mapreg_type(sc->sc_pc, sc->sc_pcitag, bar); if ((type == PCI_MAPREG_TYPE_MEM) || @@ -148,10 +149,15 @@ &sc->sc_ranges[idx].flags); idx++; } - sc->sc_bars[(bar - 0x10) >> 2] = + sc->sc_bars[(bar - 0x10) >> 2] = rom = pci_conf_read(sc->sc_pc, sc->sc_pcitag, bar); + if ((bar == PCI_MAPREG_ROM) && (rom != 0)) { + pci_conf_write(sc->sc_pc, sc->sc_pcitag, bar, rom | + PCI_MAPREG_ROM_ENABLE); + } bar += 4; } + sc->sc_ranges_used = idx; ops.genfb_ioctl = pci_genfb_ioctl; @@ -258,6 +264,25 @@ * somewhere in a MD header and compile this code only if all are * present */ + /* + * no. + * PCI_IOAREA_PADDR would be completely, utterly wrong and completely + * useless for the following reasons: + * - it's a bus address, not a physical address + * - there's no guarantee it's the same for each host bridge + * - it's already taken care of by the IO tag + * PCI_IOAREA_OFFSET is the same as PCI_MAGIC_IO_RANGE + * PCI_IOAREA_SIZE is also useless: + * - many cards don't decode more than 16 bit IO anyway + * - even machines with more than 64kB IO space try to keep everything + * within 64kB for the reason above + * - IO ranges tend to be small so in most cases you can't cram enough + * cards into a single machine to exhaust 64kB IO space + * - machines which need this tend to prefer memory space anyway + * - the only use for this right now is to allow the Xserver to map + * VGA registers on macppc and a few other powerpc ports, shark uses + * a similar mechanism, and what they need is always within 64kB + */ #ifdef PCI_MAGIC_IO_RANGE /* allow to map our IO space */ if ((offset >= PCI_MAGIC_IO_RANGE) &&