get rid of the last #ifdef macppc and use PCI_MAGIC_IO_RANGE to select

at which offset we mmap PCI IO space
This commit is contained in:
macallan 2008-02-27 23:59:37 +00:00
parent 3195ef8f6f
commit ee03e6b4fb
4 changed files with 30 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: chipsfb.c,v 1.12 2007/08/19 15:57:24 he Exp $ */
/* $NetBSD: chipsfb.c,v 1.13 2008/02/27 23:59:37 macallan Exp $ */
/*
* Copyright (c) 2006 Michael Lorenz
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.12 2007/08/19 15:57:24 he Exp $");
__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.13 2008/02/27 23:59:37 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -898,11 +898,12 @@ chipsfb_mmap(void *v, void *vs, off_t offset, int prot)
return pa;
}
#ifdef macppc
#ifdef PCI_MAGIC_IO_RANGE
/* allow mapping of IO space */
if ((offset >= 0xf2000000) && (offset < 0xf2800000)) {
pa = bus_space_mmap(sc->sc_iot, offset - 0xf2000000, 0, prot,
BUS_SPACE_MAP_LINEAR);
if ((offset >= PCI_MAGIC_IO_RANGE) &&
(offset < PCI_MAGIC_IO_RANGE + 0x10000)) {
pa = bus_space_mmap(sc->sc_iot, offset - PCI_MAGIC_IO_RANGE,
0, prot, BUS_SPACE_MAP_LINEAR);
return pa;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfb_pci.c,v 1.5 2007/12/21 05:32:09 macallan Exp $ */
/* $NetBSD: genfb_pci.c,v 1.6 2008/02/27 23:59:37 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.5 2007/12/21 05:32:09 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.6 2008/02/27 23:59:37 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -266,11 +266,12 @@ pci_genfb_mmap(void *v, void *vs, off_t offset, int prot)
* somewhere in a MD header and compile this code only if all are
* present
*/
#ifdef macppc
#ifdef PCI_MAGIC_IO_RANGE
/* allow to map our IO space */
if ((offset >= 0xf2000000) && (offset < 0xf2800000)) {
return bus_space_mmap(sc->sc_iot, offset-0xf2000000, 0, prot,
BUS_SPACE_MAP_LINEAR);
if ((offset >= PCI_MAGIC_IO_RANGE) &&
(offset < PCI_MAGIC_IO_RANGE + 0x10000)) {
return bus_space_mmap(sc->sc_iot, offset - PCI_MAGIC_IO_RANGE,
0, prot, BUS_SPACE_MAP_LINEAR);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: r128fb.c,v 1.2 2007/11/23 20:12:54 macallan Exp $ */
/* $NetBSD: r128fb.c,v 1.3 2008/02/27 23:59:37 macallan Exp $ */
/*
* Copyright (c) 2007 Michael Lorenz
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.2 2007/11/23 20:12:54 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.3 2008/02/27 23:59:37 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -411,11 +411,12 @@ r128fb_mmap(void *v, void *vs, off_t offset, int prot)
return pa;
}
#ifdef macppc
#ifdef PCI_MAGIC_IO_RANGE
/* allow mapping of IO space */
if ((offset >= 0xf2000000) && (offset < 0xf2800000)) {
pa = bus_space_mmap(sc->sc_iot, offset - 0xf2000000, 0, prot,
BUS_SPACE_MAP_LINEAR);
if ((offset >= PCI_MAGIC_IO_RANGE) &&
(offset < PCI_MAGIC_IO_RANGE + 0x10000)) {
pa = bus_space_mmap(sc->sc_iot, offset - PCI_MAGIC_IO_RANGE,
0, prot, BUS_SPACE_MAP_LINEAR);
return pa;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: voodoofb.c,v 1.12 2007/12/01 17:00:41 ad Exp $ */
/* $NetBSD: voodoofb.c,v 1.13 2008/02/27 23:59:37 macallan Exp $ */
/*
* Copyright (c) 2005, 2006 Michael Lorenz
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.12 2007/12/01 17:00:41 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.13 2008/02/27 23:59:37 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1017,12 +1017,16 @@ voodoofb_mmap(void *v, void *vs, off_t offset, int prot)
return pa;
}
#ifdef PCI_MAGIC_IO_RANGE
/* allow mapping of IO space */
if ((offset >= 0xf2000000) && (offset < 0xf2800000)) {
pa = bus_space_mmap(sc->sc_iot, offset-0xf2000000, 0, prot,
BUS_SPACE_MAP_LINEAR);
if ((offset >= PCI_MAGIC_IO_RANGE) &&\
(offset < PCI_MAGIC_IO_RANGE + 0x10000)) {
pa = bus_space_mmap(sc->sc_iot, offset - PCI_MAGIC_IO_RANGE,
0, prot, BUS_SPACE_MAP_LINEAR);
return pa;
}
#endif
#ifdef OFB_ALLOW_OTHERS
if (offset >= 0x80000000) {
pa = bus_space_mmap(sc->sc_memt, offset, 0, prot,