diff options
author | rnoland <rnoland@FreeBSD.org> | 2009-12-29 21:51:28 +0000 |
---|---|---|
committer | rnoland <rnoland@FreeBSD.org> | 2009-12-29 21:51:28 +0000 |
commit | 3dc3ad8568aae78c6c3ebad44e859a0feac05c38 (patch) | |
tree | ffed01a3f1f97aa245caf60848edab318a53aef9 /sys | |
parent | b8a003ef1beea7446e2328791d40c81ee37e8bb0 (diff) | |
download | FreeBSD-src-3dc3ad8568aae78c6c3ebad44e859a0feac05c38.zip FreeBSD-src-3dc3ad8568aae78c6c3ebad44e859a0feac05c38.tar.gz |
Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.
Purge d_mmap2().
All driver modules will need to be rebuilt since D_VERSION is also
bumped.
Reviewed by: jhb@
MFC after: Not in this lifetime...
Diffstat (limited to 'sys')
36 files changed, 109 insertions, 112 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 7cac98d..3a968bb 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -144,8 +144,8 @@ kmemphys: */ /* ARGSUSED */ int -memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, - int prot __unused) +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot __unused, vm_memattr_t *memattr __unused) { if (dev2unit(dev) == CDEV_MINOR_MEM) *paddr = offset; diff --git a/sys/arm/arm/mem.c b/sys/arm/arm/mem.c index abad8ae..a77ad90 100644 --- a/sys/arm/arm/mem.c +++ b/sys/arm/arm/mem.c @@ -153,8 +153,8 @@ memrw(struct cdev *dev, struct uio *uio, int flags) /* ARGSUSED */ int -memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, - int prot __unused) +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot __unused, vm_memattr_t *memattr __unused) { if (dev2unit(dev) == CDEV_MINOR_MEM) *paddr = offset; diff --git a/sys/dev/adlink/adlink.c b/sys/dev/adlink/adlink.c index 3568e8f..2d98f89 100644 --- a/sys/dev/adlink/adlink.c +++ b/sys/dev/adlink/adlink.c @@ -161,7 +161,8 @@ adlink_intr(void *arg) } static int -adlink_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +adlink_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { struct softc *sc; vm_offset_t o; diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index db78561..53399e2 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -868,7 +868,8 @@ agp_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int fflag, struct thread } static int -agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +agp_mmap(struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { device_t dev = kdev->si_drv1; struct agp_softc *sc = device_get_softc(dev); diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index 327c4bb..b667700 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -794,7 +794,8 @@ bktr_ioctl( struct cdev *dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thr * */ static int -bktr_mmap( struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot ) +bktr_mmap( struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr ) { int unit; bktr_ptr_t bktr; diff --git a/sys/dev/drm/drm_vm.c b/sys/dev/drm/drm_vm.c index 7d5cd8d..8f260fd 100644 --- a/sys/dev/drm/drm_vm.c +++ b/sys/dev/drm/drm_vm.c @@ -31,8 +31,8 @@ __FBSDID("$FreeBSD$"); #include "dev/drm/drmP.h" #include "dev/drm/drm.h" -int drm_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +int drm_mmap(struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { struct drm_device *dev = drm_get_device_from_kdev(kdev); struct drm_file *file_priv = NULL; diff --git a/sys/dev/fb/creator.c b/sys/dev/fb/creator.c index 3abaa1d..135fd3d 100644 --- a/sys/dev/fb/creator.c +++ b/sys/dev/fb/creator.c @@ -692,8 +692,8 @@ creator_blank_display(video_adapter_t *adp, int mode) } static int -creator_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +creator_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { return (EINVAL); @@ -1048,8 +1048,8 @@ creator_fb_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, } static int -creator_fb_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +creator_fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { struct creator_softc *sc; int i; diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 21871f6..09fcebc 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -511,10 +511,10 @@ int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, return error; } -int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_offset_t offset, - vm_offset_t *paddr, int prot) +int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_ooffset_t offset, + vm_offset_t *paddr, int prot, vm_memattr_t *memattr) { - return vidd_mmap(adp, offset, paddr, prot); + return vidd_mmap(adp, offset, paddr, prot, memattr); } #endif /* FB_INSTALL_CDEV */ diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index 0be91d3..aabe3e3 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -131,8 +131,8 @@ typedef int vi_blank_display_t(video_adapter_t *adp, int mode); #define V_DISPLAY_STAND_BY 2 #define V_DISPLAY_SUSPEND 3 */ -typedef int vi_mmap_t(video_adapter_t *adp, vm_offset_t offset, - vm_paddr_t *paddr, int prot); +typedef int vi_mmap_t(video_adapter_t *adp, vm_ooffset_t offset, + vm_paddr_t *paddr, int prot, vm_memattr_t *memattr); typedef int vi_ioctl_t(video_adapter_t *adp, u_long cmd, caddr_t data); typedef int vi_clear_t(video_adapter_t *adp); typedef int vi_fill_rect_t(video_adapter_t *adp, int val, int x, int y, @@ -228,8 +228,9 @@ typedef struct video_switch { (height), (celsize), (blink)) #define vidd_blank_display(adp, mode) \ (*vidsw[(adp)->va_index]->blank_display)((adp), (mode)) -#define vidd_mmap(adp, offset, paddr, prot) \ - (*vidsw[(adp)->va_index]->mmap)((adp), (offset), (paddr), (prot)) +#define vidd_mmap(adp, offset, paddr, prot, memattr) \ + (*vidsw[(adp)->va_index]->mmap)((adp), (offset), (paddr), \ + (prot), (memattr)) #define vidd_ioctl(adp, cmd, data) \ (*vidsw[(adp)->va_index]->ioctl)((adp), (cmd), (data)) #define vidd_clear(adp) \ @@ -317,7 +318,8 @@ int genfbwrite(genfb_softc_t *sc, video_adapter_t *adp, int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, caddr_t arg, int flag, struct thread *td); int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, - vm_offset_t offset, vm_offset_t *paddr, int prot); + vm_ooffset_t offset, vm_offset_t *paddr, + int prot, vm_memattr_t *memattr); #endif /* FB_INSTALL_CDEV */ diff --git a/sys/dev/fb/machfb.c b/sys/dev/fb/machfb.c index a9574f3..dad41d8 100644 --- a/sys/dev/fb/machfb.c +++ b/sys/dev/fb/machfb.c @@ -837,8 +837,8 @@ machfb_blank_display(video_adapter_t *adp, int mode) } static int -machfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +machfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { struct machfb_softc *sc; video_info_t *vi; diff --git a/sys/dev/fb/s3_pci.c b/sys/dev/fb/s3_pci.c index cfddf30..cd70774 100644 --- a/sys/dev/fb/s3_pci.c +++ b/sys/dev/fb/s3_pci.c @@ -388,10 +388,10 @@ s3lfb_blank_display(video_adapter_t *adp, int mode) } static int -s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +s3lfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { - return (*prevvidsw->mmap)(adp, offset, paddr, prot); + return (*prevvidsw->mmap)(adp, offset, paddr, prot, memattr); } static int diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index 13f03f7..96b9943 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -1528,12 +1528,12 @@ vesa_blank_display(video_adapter_t *adp, int mode) } static int -vesa_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +vesa_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { #if VESA_DEBUG > 0 - printf("vesa_mmap(): window:0x%tx, buffer:0x%tx, offset:0x%tx\n", + printf("vesa_mmap(): window:0x%tx, buffer:0x%tx, offset:0x%jx\n", adp->va_info.vi_window, adp->va_info.vi_buffer, offset); #endif @@ -1546,7 +1546,7 @@ vesa_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, *paddr = adp->va_info.vi_buffer + offset; return (0); } - return ((*prevvidsw->mmap)(adp, offset, paddr, prot)); + return ((*prevvidsw->mmap)(adp, offset, paddr, prot, memattr)); } static int diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 0cae0ae..7d702ad 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -144,10 +144,10 @@ vga_ioctl(struct cdev *dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, } int -vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_offset_t offset, vm_offset_t *paddr, - int prot) +vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_ooffset_t offset, + vm_offset_t *paddr, int prot, vm_memattr_t *memattr) { - return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); + return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot, memattr); } #endif /* FB_INSTALL_CDEV */ @@ -2465,8 +2465,8 @@ vga_blank_display(video_adapter_t *adp, int mode) * all adapters */ static int -vga_mmap_buf(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +vga_mmap_buf(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { if (adp->va_info.vi_flags & V_INFO_LINEAR) return -1; diff --git a/sys/dev/fb/vgareg.h b/sys/dev/fb/vgareg.h index fa9d44e..249d32c 100644 --- a/sys/dev/fb/vgareg.h +++ b/sys/dev/fb/vgareg.h @@ -88,8 +88,8 @@ int vga_read(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag); int vga_write(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag); int vga_ioctl(struct cdev *dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, struct thread *td); -int vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_offset_t offset, - vm_offset_t *paddr, int prot); +int vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_ooffset_t offset, + vm_offset_t *paddr, int prot, vm_memattr_t *memattr); #endif extern int (*vga_sub_configure)(int flags); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 0facb6e..1475d00 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -884,7 +884,8 @@ static int #if defined(__DragonFly__) || __FreeBSD_version < 500102 fw_mmap (struct cdev *dev, vm_offset_t offset, int nproto) #else -fw_mmap (struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) +fw_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nproto, vm_memattr_t *memattr) #endif { @@ -892,7 +893,7 @@ fw_mmap (struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) #if defined(__DragonFly__) || __FreeBSD_version < 500102 return fwmem_mmap(dev, offset, nproto); #else - return fwmem_mmap(dev, offset, paddr, nproto); + return fwmem_mmap(dev, offset, paddr, nproto, memattr); #endif return EINVAL; diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index f0aa7ae..1799682 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -445,7 +445,8 @@ int #if defined(__DragonFly__) || __FreeBSD_version < 500102 fwmem_mmap (struct cdev *dev, vm_offset_t offset, int nproto) #else -fwmem_mmap (struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) +fwmem_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nproto, vm_memattr_t *memattr) #endif { return EINVAL; diff --git a/sys/dev/hifn/hifn7751.c b/sys/dev/hifn/hifn7751.c index c227f77..bd1173e 100644 --- a/sys/dev/hifn/hifn7751.c +++ b/sys/dev/hifn/hifn7751.c @@ -2929,8 +2929,8 @@ hifn_write_reg_1(struct hifn_softc *sc, bus_size_t reg, u_int32_t val) * */ static int -vulcanpk_mmap(struct cdev *dev, vm_offset_t offset, - vm_paddr_t *paddr, int nprot) +vulcanpk_mmap(struct cdev *dev, vm_ooffset_t offset, + vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) { struct hifn_softc *sc; vm_paddr_t pd; @@ -2942,7 +2942,8 @@ vulcanpk_mmap(struct cdev *dev, vm_offset_t offset, b = rman_get_virtual(sc->sc_bar1res); #if 0 - printf("vpk mmap: %p(%08x) offset=%d\n", b, pd, offset); + printf("vpk mmap: %p(%016llx) offset=%lld\n", b, + (unsigned long long)pd, offset); hexdump(b, HIFN_1_PUB_MEMEND, "vpk", 0); #endif diff --git a/sys/dev/ksyms/ksyms.c b/sys/dev/ksyms/ksyms.c index bca6448..3a1adca 100644 --- a/sys/dev/ksyms/ksyms.c +++ b/sys/dev/ksyms/ksyms.c @@ -589,8 +589,8 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag __unused, /* ARGUSED */ static int -ksyms_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, - int prot __unused) +ksyms_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot __unused, vm_memattr_t *memattr __unused) { struct ksyms_softc *sc; int error; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 66faef1..c78b190 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2179,7 +2179,8 @@ dsp_poll(struct cdev *i_dev, int events, struct thread *td) } static int -dsp_mmap(struct cdev *i_dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +dsp_mmap(struct cdev *i_dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { struct snddev_info *d; struct pcm_channel *wrch, *rdch, *c; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 99d4246..f50d686 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -3431,14 +3431,15 @@ next_code: } static int -sctty_mmap(struct tty *tp, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +sctty_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { scr_stat *scp; scp = sc_get_stat(tp); if (scp != scp->sc->cur_scp) return -1; - return vidd_mmap(scp->sc->adp, offset, paddr, nprot); + return vidd_mmap(scp->sc->adp, offset, paddr, nprot, memattr); } static int diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 08db085..7ed00ac 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -421,7 +421,8 @@ tdfx_close(struct cdev *dev, int fflag, int devtype, struct thread *td) } static int -tdfx_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +tdfx_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { /* * mmap(2) is called by a user process to request that an area of memory diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index 45f7c3a..b184237 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -416,7 +416,8 @@ elan_watchdog(void *foo __unused, u_int spec, int *error) } static int -elan_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +elan_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { if (offset >= 0x1000) diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index b2deab2..11bfc37 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -163,8 +163,8 @@ memrw(struct cdev *dev, struct uio *uio, int flags) */ /* ARGSUSED */ int -memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, - int prot __unused) +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot __unused, vm_memattr_t *memattr __unused) { if (dev2unit(dev) == CDEV_MINOR_MEM) *paddr = offset; diff --git a/sys/i386/xbox/xboxfb.c b/sys/i386/xbox/xboxfb.c index 906ced5..5d83d12 100644 --- a/sys/i386/xbox/xboxfb.c +++ b/sys/i386/xbox/xboxfb.c @@ -521,8 +521,8 @@ xboxfb_blank_display(video_adapter_t *adp, int mode) } static int -xboxfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +xboxfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { return (EINVAL); } diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index ab213d7..53b8687 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -148,7 +148,8 @@ kmemphys: * instead of going through read/write */ int -memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { /* * /dev/mem is the only one that makes sense through this diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index f9b2630..093e555 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -278,9 +278,11 @@ isavga_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread } static int -isavga_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +isavga_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { - return (vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot)); + return (vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot, + memattr)); } #endif /* FB_INSTALL_CDEV */ diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index e570fdd..f4510ac 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -302,7 +302,7 @@ static struct cdevsw dead_cdevsw = { #define no_read (d_read_t *)enodev #define no_write (d_write_t *)enodev #define no_ioctl (d_ioctl_t *)enodev -#define no_mmap (d_mmap2_t *)enodev +#define no_mmap (d_mmap_t *)enodev #define no_kqfilter (d_kqfilter_t *)enodev #define no_mmap_single (d_mmap_single_t *)enodev @@ -469,7 +469,7 @@ giant_kqfilter(struct cdev *dev, struct knote *kn) } static int -giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot, +giant_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) { struct cdevsw *dsw; @@ -479,11 +479,8 @@ giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot, if (dsw == NULL) return (ENXIO); mtx_lock(&Giant); - if (dsw->d_gianttrick->d_flags & D_MMAP2) - retval = dsw->d_gianttrick->d_mmap2(dev, offset, paddr, nprot, - memattr); - else - retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot); + retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot, + memattr); mtx_unlock(&Giant); dev_relthread(dev); return (retval); @@ -595,8 +592,7 @@ prep_cdevsw(struct cdevsw *devsw) return; } - if (devsw->d_version != D_VERSION_01 && - devsw->d_version != D_VERSION_02) { + if (devsw->d_version != D_VERSION_03) { printf( "WARNING: Device driver \"%s\" has wrong version %s\n", devsw->d_name == NULL ? "???" : devsw->d_name, @@ -608,18 +604,16 @@ prep_cdevsw(struct cdevsw *devsw) devsw->d_ioctl = dead_ioctl; devsw->d_poll = dead_poll; devsw->d_mmap = dead_mmap; + devsw->d_mmap_single = dead_mmap_single; devsw->d_strategy = dead_strategy; devsw->d_dump = dead_dump; devsw->d_kqfilter = dead_kqfilter; } - if (devsw->d_version == D_VERSION_01) - devsw->d_mmap_single = NULL; if (devsw->d_flags & D_NEEDGIANT) { if (devsw->d_gianttrick == NULL) { memcpy(dsw2, devsw, sizeof *dsw2); devsw->d_gianttrick = dsw2; - devsw->d_flags |= D_MMAP2; dsw2 = NULL; } } @@ -640,7 +634,7 @@ prep_cdevsw(struct cdevsw *devsw) FIXUP(d_write, no_write, giant_write); FIXUP(d_ioctl, no_ioctl, giant_ioctl); FIXUP(d_poll, no_poll, giant_poll); - FIXUP(d_mmap2, no_mmap, giant_mmap); + FIXUP(d_mmap, no_mmap, giant_mmap); FIXUP(d_strategy, no_strategy, giant_strategy); FIXUP(d_kqfilter, no_kqfilter, giant_kqfilter); FIXUP(d_mmap_single, no_mmap_single, giant_mmap_single); diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index e90df59..a214bf6 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -449,7 +449,8 @@ static TAILQ_HEAD(, statspage) pagelist = TAILQ_HEAD_INITIALIZER(pagelist); static MALLOC_DEFINE(M_DEVSTAT, "devstat", "Device statistics"); static int -devstat_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +devstat_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { struct statspage *spp; diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 9ef095c..05b8a37 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -603,7 +603,8 @@ ttydev_poll(struct cdev *dev, int events, struct thread *td) } static int -ttydev_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +ttydev_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { struct tty *tp = dev->si_drv1; int error; @@ -613,7 +614,7 @@ ttydev_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) error = ttydev_enter(tp); if (error) return (-1); - error = ttydevsw_mmap(tp, offset, paddr, nprot); + error = ttydevsw_mmap(tp, offset, paddr, nprot, memattr); tty_unlock(tp); return (error); @@ -905,8 +906,8 @@ ttydevsw_defmodem(struct tty *tp, int sigon, int sigoff) } static int -ttydevsw_defmmap(struct tty *tp, vm_offset_t offset, vm_paddr_t *paddr, - int nprot) +ttydevsw_defmmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { return (-1); diff --git a/sys/mips/mips/mem.c b/sys/mips/mips/mem.c index 53fe634..bebeded 100644 --- a/sys/mips/mips/mem.c +++ b/sys/mips/mips/mem.c @@ -173,7 +173,8 @@ memrw(dev, uio, flags) /*ARGSUSED*/ int -memmmap(struct cdev *dev, vm_offset_t off, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_ooffset_t off, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { return (EOPNOTSUPP); diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 3fb6c82..b048dad 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -395,12 +395,13 @@ gdcioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +gdcmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { gdc_softc_t *sc; sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); + return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot, memattr); } #endif /* FB_INSTALL_CDEV */ @@ -1337,8 +1338,8 @@ gdc_blank_display(video_adapter_t *adp, int mode) * Mmap frame buffer. */ static int -gdc_mmap_buf(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, - int prot) +gdc_mmap_buf(video_adapter_t *adp, vm_ooffset_t offset, vm_offset_t *paddr, + int prot, vm_memattr_t *memattr) { /* FIXME: is this correct? XXX */ if (offset > VIDEO_BUF_SIZE - PAGE_SIZE) diff --git a/sys/powerpc/ofw/ofw_syscons.c b/sys/powerpc/ofw/ofw_syscons.c index 5ab5939..56d0ca8 100644 --- a/sys/powerpc/ofw/ofw_syscons.c +++ b/sys/powerpc/ofw/ofw_syscons.c @@ -624,8 +624,8 @@ ofwfb_blank_display(video_adapter_t *adp, int mode) } static int -ofwfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, - int prot) +ofwfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { struct ofwfb_softc *sc; int i; diff --git a/sys/powerpc/powerpc/mem.c b/sys/powerpc/powerpc/mem.c index 22d99c4..d56d634 100644 --- a/sys/powerpc/powerpc/mem.c +++ b/sys/powerpc/powerpc/mem.c @@ -161,7 +161,8 @@ kmem_direct_mapped: v = uio->uio_offset; * instead of going through read/write */ int -memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { /* * /dev/mem is the only one that makes sense through this diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 4d89070..a18d699 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -135,9 +135,7 @@ typedef int d_read_t(struct cdev *dev, struct uio *uio, int ioflag); typedef int d_write_t(struct cdev *dev, struct uio *uio, int ioflag); typedef int d_poll_t(struct cdev *dev, int events, struct thread *td); typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn); -typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, - int nprot); -typedef int d_mmap2_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, +typedef int d_mmap_t(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr); typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size, struct vm_object **object, int nprot); @@ -172,7 +170,6 @@ typedef int dumper_t( #define D_PSEUDO 0x00200000 /* make_dev() can return NULL */ #define D_NEEDGIANT 0x00400000 /* driver want Giant */ #define D_NEEDMINOR 0x00800000 /* driver uses clone_create() */ -#define D_MMAP2 0x01000000 /* driver uses d_mmap2() */ /* * Version numbers. @@ -180,7 +177,8 @@ typedef int dumper_t( #define D_VERSION_00 0x20011966 #define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */ #define D_VERSION_02 0x28042009 /* Add d_mmap_single */ -#define D_VERSION D_VERSION_02 +#define D_VERSION_03 0x17122009 /* d_mmap takes memattr,vm_ooffset_t */ +#define D_VERSION D_VERSION_03 /* * Flags used for internal housekeeping @@ -201,10 +199,7 @@ struct cdevsw { d_write_t *d_write; d_ioctl_t *d_ioctl; d_poll_t *d_poll; - union { - d_mmap_t *old; - d_mmap2_t *new; - } __d_mmap; + d_mmap_t *d_mmap; d_strategy_t *d_strategy; dumper_t *d_dump; d_kqfilter_t *d_kqfilter; @@ -222,8 +217,6 @@ struct cdevsw { SLIST_ENTRY(cdevsw) postfree_list; } __d_giant; }; -#define d_mmap __d_mmap.old -#define d_mmap2 __d_mmap.new #define d_gianttrick __d_giant.gianttrick #define d_postfree_list __d_giant.postfree_list diff --git a/sys/sys/ttydevsw.h b/sys/sys/ttydevsw.h index e2278c3..4506919 100644 --- a/sys/sys/ttydevsw.h +++ b/sys/sys/ttydevsw.h @@ -48,8 +48,8 @@ typedef int tsw_ioctl_t(struct tty *tp, u_long cmd, caddr_t data, struct thread *td); typedef int tsw_param_t(struct tty *tp, struct termios *t); typedef int tsw_modem_t(struct tty *tp, int sigon, int sigoff); -typedef int tsw_mmap_t(struct tty *tp, vm_offset_t offset, - vm_paddr_t * paddr, int nprot); +typedef int tsw_mmap_t(struct tty *tp, vm_ooffset_t offset, + vm_paddr_t * paddr, int nprot, vm_memattr_t *memattr); typedef void tsw_pktnotify_t(struct tty *tp, char event); typedef void tsw_free_t(void *softc); @@ -142,11 +142,12 @@ ttydevsw_modem(struct tty *tp, int sigon, int sigoff) } static __inline int -ttydevsw_mmap(struct tty *tp, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +ttydevsw_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { MPASS(!tty_gone(tp)); - return tp->t_devsw->tsw_mmap(tp, offset, paddr, nprot); + return tp->t_devsw->tsw_mmap(tp, offset, paddr, nprot, memattr); } static __inline void diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index c7f5593..9002e77 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -93,17 +93,6 @@ dev_pager_init() UMA_ZONE_NOFREE|UMA_ZONE_VM); } -static __inline int -dev_mmap(struct cdevsw *csw, struct cdev *dev, vm_offset_t offset, - vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) -{ - - if (csw->d_flags & D_MMAP2) - return (csw->d_mmap2(dev, offset, paddr, nprot, memattr)); - else - return (csw->d_mmap(dev, offset, paddr, nprot)); -} - /* * MPSAFE */ @@ -116,7 +105,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_pindex_t pindex; unsigned int npages; vm_paddr_t paddr; - vm_offset_t off; + vm_ooffset_t off; vm_memattr_t dummy; struct cdevsw *csw; @@ -145,7 +134,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, */ npages = OFF_TO_IDX(size); for (off = foff; npages--; off += PAGE_SIZE) - if (dev_mmap(csw, dev, off, &paddr, (int)prot, &dummy) != 0) { + if (csw->d_mmap(dev, off, &paddr, (int)prot, &dummy) != 0) { dev_relthread(dev); return (NULL); } @@ -242,7 +231,7 @@ dev_pager_getpages(object, m, count, reqpage) td = curthread; fpop = td->td_fpop; td->td_fpop = NULL; - ret = dev_mmap(csw, dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr, + ret = csw->d_mmap(dev, (vm_ooffset_t)offset << PAGE_SHIFT, &paddr, PROT_READ, &memattr); KASSERT(ret == 0, ("dev_pager_getpage: map function returns error")); td->td_fpop = fpop; |