diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2002-07-05 08:31:11 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2002-07-05 08:31:11 +0000 |
commit | 74ef13fd009b9e37956e4207d0a5ed92f4b5e39a (patch) | |
tree | d4fa32d8f9b23872218ca5283cbd9b5fe02f6600 /bsd-core/drm_vm.c | |
parent | 24025ca5f78c15ced14490532b4410730353d2c1 (diff) |
merged bsd-3-0-0-branch
Diffstat (limited to 'bsd-core/drm_vm.c')
-rw-r--r-- | bsd-core/drm_vm.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/bsd-core/drm_vm.c b/bsd-core/drm_vm.c index a06fb448..70a5b0e6 100644 --- a/bsd-core/drm_vm.c +++ b/bsd-core/drm_vm.c @@ -1,9 +1,11 @@ -#include <vm/vm.h> -#include <vm/pmap.h> +#ifdef __FreeBSD__ static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) +#elif defined(__NetBSD__) +static paddr_t DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) +#endif { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_device_dma_t *dma = dev->dma; unsigned long physical; unsigned long page; @@ -14,27 +16,30 @@ static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) page = offset >> PAGE_SHIFT; physical = dma->pagelist[page]; - DRM_DEBUG("0x%08x (page %lu) => 0x%08lx\n", offset, page, physical); + DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", (long)offset, page, physical); return atop(physical); } +#ifdef __FreeBSD__ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) +#elif defined(__NetBSD__) +paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot) +#endif { - drm_device_t *dev = kdev->si_drv1; + DRM_DEVICE; drm_map_t *map = NULL; drm_map_list_entry_t *listentry=NULL; - /*drm_file_t *priv;*/ + drm_file_t *priv; /* DRM_DEBUG("offset = 0x%x\n", offset);*/ - /*XXX Fixme */ - /*priv = DRM(find_file_by_proc)(dev, p); + priv = DRM(find_file_by_proc)(dev, DRM_CURPROC); if (!priv) { DRM_DEBUG("can't find authenticator\n"); return EINVAL; } - if (!priv->authenticated) DRM_OS_RETURN(EACCES);*/ + if (!priv->authenticated) return DRM_ERR(EACCES); if (dev->dma && offset >= 0 @@ -59,7 +64,7 @@ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) DRM_DEBUG("can't find map\n"); return -1; } - if (((map->flags&_DRM_RESTRICTED) && suser(curproc))) { + if (((map->flags&_DRM_RESTRICTED) && DRM_SUSER(DRM_CURPROC))) { DRM_DEBUG("restricted map\n"); return -1; } @@ -69,6 +74,7 @@ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) case _DRM_REGISTERS: case _DRM_AGP: return atop(offset); + case _DRM_SCATTER_GATHER: case _DRM_SHM: return atop(vtophys(offset)); default: |