From 7095ee912b8713f2cff3b588999d4723e4743c73 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sun, 8 Nov 1998 12:39:07 +0000 Subject: [PATCH] * Fix a couple of places in the device pager where an address was truncated to 32 bits. * Change the calling convention of the device mmap entry point to pass a vm_offset_t instead of an int for the offset allowing devices with a larger memory map than (1<<32) to be supported on the alpha (/dev/mem is one such). These changes are required to allow the X server to mmap the various I/O regions used for device port and memory access on the alpha. --- sys/alpha/alpha/mem.c | 4 ++-- sys/amd64/amd64/mem.c | 4 ++-- sys/dev/bktr/bktr_core.c | 4 ++-- sys/dev/syscons/syscons.c | 4 ++-- sys/i386/i386/mem.c | 4 ++-- sys/i386/isa/pcvt/pcvt_drv.c | 2 +- sys/i386/isa/snd/sound.c | 2 +- sys/i386/isa/spigot.c | 2 +- sys/i386/isa/syscons.c | 4 ++-- sys/isa/syscons.c | 4 ++-- sys/kern/subr_xxx.c | 4 ++-- sys/pc98/pc98/syscons.c | 4 ++-- sys/pci/brooktree848.c | 4 ++-- sys/pci/meteor.c | 2 +- sys/pci/xrpu.c | 4 ++-- sys/sys/conf.h | 4 ++-- sys/sys/linedisc.h | 4 ++-- sys/vm/device_pager.c | 7 ++++--- 18 files changed, 34 insertions(+), 33 deletions(-) diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index f08e7d5b2fc5..499972672960 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.1 1998/06/10 10:52:54 dfr Exp $ + * $Id: mem.c,v 1.2 1998/07/29 18:36:29 dfr Exp $ */ /* @@ -271,7 +271,7 @@ mmrw(dev, uio, flags) * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, int offset, int prot) +memmmap(dev_t dev, vm_offset_t offset, int prot) { /* * /dev/mem is the only one that makes sense through this diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index d26b9ee5ebf5..1994f12ce538 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.51 1998/06/07 17:10:02 dfr Exp $ + * $Id: mem.c,v 1.52 1998/06/21 11:33:29 bde Exp $ */ /* @@ -381,7 +381,7 @@ mmrw(dev, uio, flags) * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, int offset, int nprot) +memmmap(dev_t dev, vm_offset_t offset, int nprot) { switch (minor(dev)) { diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index 30a9dabc7aed..677303ee16c1 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -1,4 +1,4 @@ -/* $Id: brooktree848.c,v 1.57 1998/10/31 11:26:38 nsouch Exp $ */ +/* $Id: brooktree848.c,v 1.58 1998/11/07 14:30:48 nsouch Exp $ */ /* BT848 Driver for Brooktree's Bt848 based cards. The Brooktree BT848 Driver driver is based upon Mark Tinguely and Jim Lowe's driver for the Matrox Meteor PCI card . The @@ -3000,7 +3000,7 @@ common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) * */ int -bktr_mmap( dev_t dev, int offset, int nprot ) +bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) { int unit; bktr_ptr_t bktr; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index d4178e88306d..a9c6fc9994ac 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.285 1998/10/22 05:58:40 bde Exp $ + * $Id: syscons.c,v 1.286 1998/11/03 02:37:46 yokota Exp $ */ #include "sc.h" @@ -3855,7 +3855,7 @@ scgetc(u_int flags) } int -scmmap(dev_t dev, int offset, int nprot) +scmmap(dev_t dev, vm_offset_t offset, int nprot) { if (offset > 0x20000 - PAGE_SIZE) return -1; diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index d26b9ee5ebf5..1994f12ce538 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.51 1998/06/07 17:10:02 dfr Exp $ + * $Id: mem.c,v 1.52 1998/06/21 11:33:29 bde Exp $ */ /* @@ -381,7 +381,7 @@ mmrw(dev, uio, flags) * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, int offset, int nprot) +memmmap(dev_t dev, vm_offset_t offset, int nprot) { switch (minor(dev)) { diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 0fd7e84d5fde..99217c06a3f2 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -770,7 +770,7 @@ pcioctl(Dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) } int -pcmmap(Dev_t dev, int offset, int nprot) +pcmmap(Dev_t dev, vm_offset_t offset, int nprot) { if (offset > 0x20000 - PAGE_SIZE) return -1; diff --git a/sys/i386/isa/snd/sound.c b/sys/i386/isa/snd/sound.c index 58b4b084e1e4..6a26c073010d 100644 --- a/sys/i386/isa/snd/sound.c +++ b/sys/i386/isa/snd/sound.c @@ -1226,7 +1226,7 @@ sndselect(dev_t i_dev, int rw, struct proc * p) #include static int -sndmmap(dev_t dev, int offset, int nprot) +sndmmap(dev_t dev, vm_offset_t offset, int nprot) { snddev_info *d = get_snddev_info(dev, NULL); diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 2f7c4ab0afd2..e0f33a79f665 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -259,7 +259,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[unit]; } static int -spigot_mmap(dev_t dev, int offset, int nprot) +spigot_mmap(dev_t dev, vm_offset_t offset, int nprot) { struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0]; diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index d4178e88306d..a9c6fc9994ac 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.285 1998/10/22 05:58:40 bde Exp $ + * $Id: syscons.c,v 1.286 1998/11/03 02:37:46 yokota Exp $ */ #include "sc.h" @@ -3855,7 +3855,7 @@ scgetc(u_int flags) } int -scmmap(dev_t dev, int offset, int nprot) +scmmap(dev_t dev, vm_offset_t offset, int nprot) { if (offset > 0x20000 - PAGE_SIZE) return -1; diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index 3c3bf5ecd6fd..65a51537b4b7 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.274 1998/09/17 09:38:35 dfr Exp $ + * $Id: syscons.c,v 1.275 1998/10/31 10:35:23 dfr Exp $ * from: i386/isa syscons.c,v 1.278 */ @@ -3936,7 +3936,7 @@ scgetc(u_int flags) } int -scmmap(dev_t dev, int offset, int nprot) +scmmap(dev_t dev, vm_offset_t offset, int nprot) { if (offset > 0x20000 - PAGE_SIZE) return -1; diff --git a/sys/kern/subr_xxx.c b/sys/kern/subr_xxx.c index e803032bdae7..7ff33668c2a9 100644 --- a/sys/kern/subr_xxx.c +++ b/sys/kern/subr_xxx.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93 - * $Id: subr_xxx.c,v 1.10 1998/06/07 17:11:38 dfr Exp $ + * $Id: subr_xxx.c,v 1.11 1998/08/20 06:10:40 bde Exp $ */ /* @@ -161,7 +161,7 @@ nodevtotty(dev) int nommap(dev, offset, nprot) dev_t dev; - int offset; + vm_offset_t offset; int nprot; { diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 2352434e1c9c..18e6515fe4cd 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.101 1998/09/14 11:37:58 kato Exp $ + * $Id: syscons.c,v 1.102 1998/10/22 05:58:45 bde Exp $ */ #include "sc.h" @@ -5232,7 +5232,7 @@ scgetc(u_int flags) } int -scmmap(dev_t dev, int offset, int nprot) +scmmap(dev_t dev, vm_offset_t offset, int nprot) { #ifdef PC98 if (offset > 0x48000 - PAGE_SIZE) diff --git a/sys/pci/brooktree848.c b/sys/pci/brooktree848.c index 30a9dabc7aed..677303ee16c1 100644 --- a/sys/pci/brooktree848.c +++ b/sys/pci/brooktree848.c @@ -1,4 +1,4 @@ -/* $Id: brooktree848.c,v 1.57 1998/10/31 11:26:38 nsouch Exp $ */ +/* $Id: brooktree848.c,v 1.58 1998/11/07 14:30:48 nsouch Exp $ */ /* BT848 Driver for Brooktree's Bt848 based cards. The Brooktree BT848 Driver driver is based upon Mark Tinguely and Jim Lowe's driver for the Matrox Meteor PCI card . The @@ -3000,7 +3000,7 @@ common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) * */ int -bktr_mmap( dev_t dev, int offset, int nprot ) +bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) { int unit; bktr_ptr_t bktr; diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c index c65860beb084..96d6b21b7c6b 100644 --- a/sys/pci/meteor.c +++ b/sys/pci/meteor.c @@ -2054,7 +2054,7 @@ meteor_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *pr) } int -meteor_mmap(dev_t dev, int offset, int nprot) +meteor_mmap(dev_t dev, vm_offset_t offset, int nprot) { int unit; diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index c34a73d04175..6603315604ec 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: xrpu.c,v 1.2 1998/08/18 00:32:48 bde Exp $ + * $Id: xrpu.c,v 1.3 1998/10/24 19:47:42 phk Exp $ * * A very simple device driver for PCI cards based on Xilinx 6200 series * FPGA/RPU devices. Current Functionality is to allow you to open and @@ -146,7 +146,7 @@ xrpu_close(dev_t dev, int flag, int mode, struct proc *p) } static int -xrpu_mmap(dev_t dev, int offset, int nprot) +xrpu_mmap(dev_t dev, vm_offset_t offset, int nprot) { struct softc *sc = softc[dev2unit(dev)]; if (offset >= 0x1000000) diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 80e4e3684974..9c0bc1b66c37 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.5 (Berkeley) 1/9/95 - * $Id: conf.h,v 1.44 1998/08/20 06:10:42 bde Exp $ + * $Id: conf.h,v 1.45 1998/09/05 14:13:12 phk Exp $ */ #ifndef _SYS_CONF_H_ @@ -66,7 +66,7 @@ typedef void d_stop_t __P((struct tty *tp, int rw)); typedef int d_reset_t __P((dev_t dev)); typedef struct tty *d_devtotty_t __P((dev_t dev)); typedef int d_poll_t __P((dev_t dev, int events, struct proc *p)); -typedef int d_mmap_t __P((dev_t dev, int offset, int nprot)); +typedef int d_mmap_t __P((dev_t dev, vm_offset_t offset, int nprot)); typedef int l_open_t __P((dev_t dev, struct tty *tp)); typedef int l_close_t __P((struct tty *tp, int flag)); diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index 80e4e3684974..9c0bc1b66c37 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.5 (Berkeley) 1/9/95 - * $Id: conf.h,v 1.44 1998/08/20 06:10:42 bde Exp $ + * $Id: conf.h,v 1.45 1998/09/05 14:13:12 phk Exp $ */ #ifndef _SYS_CONF_H_ @@ -66,7 +66,7 @@ typedef void d_stop_t __P((struct tty *tp, int rw)); typedef int d_reset_t __P((dev_t dev)); typedef struct tty *d_devtotty_t __P((dev_t dev)); typedef int d_poll_t __P((dev_t dev, int events, struct proc *p)); -typedef int d_mmap_t __P((dev_t dev, int offset, int nprot)); +typedef int d_mmap_t __P((dev_t dev, vm_offset_t offset, int nprot)); typedef int l_open_t __P((dev_t dev, struct tty *tp)); typedef int l_close_t __P((struct tty *tp, int flag)); diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 655af9882bb3..fe796fb36272 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)device_pager.c 8.1 (Berkeley) 6/11/93 - * $Id: device_pager.c,v 1.33 1998/10/21 23:06:50 dg Exp $ + * $Id: device_pager.c,v 1.34 1998/10/22 01:45:29 dg Exp $ */ #include @@ -97,7 +97,8 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo dev_t dev; d_mmap_t *mapfunc; vm_object_t object; - unsigned int npages, off; + unsigned int npages; + vm_offset_t off; /* * Make sure this device can be mapped. @@ -206,7 +207,7 @@ dev_pager_getpages(object, m, count, reqpage) if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop) panic("dev_pager_getpage: no map function"); - paddr = pmap_phys_address((*mapfunc) ((dev_t) dev, (int) offset << PAGE_SHIFT, prot)); + paddr = pmap_phys_address((*mapfunc) ((dev_t) dev, (vm_offset_t) offset << PAGE_SHIFT, prot)); #ifdef DIAGNOSTIC if (paddr == -1) panic("dev_pager_getpage: map function returns error");