Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm/dist - normalize netbsd drm_mtrr_del() ...
details: https://anonhg.NetBSD.org/src/rev/c99fa3e11e6c
branches: trunk
changeset: 747092:c99fa3e11e6c
user: mrg <mrg%NetBSD.org@localhost>
date: Wed Sep 02 01:36:41 2009 +0000
description:
- normalize netbsd drm_mtrr_del() with freebsd, removing a few #if's
- make the mtrr code do nothing on non-x86
diffstat:
sys/external/bsd/drm/dist/bsd-core/drmP.h | 13 ++++++++-----
sys/external/bsd/drm/dist/bsd-core/drm_bufs.c | 5 -----
sys/external/bsd/drm/dist/bsd-core/drm_drv.c | 7 ++-----
sys/external/bsd/drm/dist/bsd-core/drm_memory.c | 10 +++++++++-
sys/external/bsd/drm/dist/shared-core/savage_bci.c | 5 -----
5 files changed, 19 insertions(+), 21 deletions(-)
diffs (146 lines):
diff -r 01fd40886d6d -r c99fa3e11e6c sys/external/bsd/drm/dist/bsd-core/drmP.h
--- a/sys/external/bsd/drm/dist/bsd-core/drmP.h Wed Sep 02 01:34:34 2009 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drmP.h Wed Sep 02 01:36:41 2009 +0000
@@ -75,8 +75,10 @@
#endif
#include <machine/pmap.h>
#include <machine/bus.h>
+#if defined(__i386__) || defined(__x86_64__)
#include <machine/specialreg.h>
#include <machine/sysarch.h>
+#endif
#include <sys/endian.h>
#include <sys/mman.h>
#if defined( __FreeBSD__)
@@ -94,7 +96,9 @@
#include <sys/selinfo.h>
#include <sys/bus.h>
#elif defined(__NetBSD__)
+#if defined(__i386__) || defined(__x86_64__)
#include <machine/mtrr.h>
+#endif
#include <sys/vnode.h>
#include <sys/select.h>
#include <sys/device.h>
@@ -293,7 +297,11 @@
#define PAGE_ALIGN(addr) ALIGN(addr)
#define DRM_SUSER(p) (kauth_cred_getsvuid((p)->p_cred) == 0)
#define DRM_AGP_FIND_DEVICE() agp_find_device(0)
+#ifdef MTRR_TYPE_WC
#define DRM_MTRR_WC MTRR_TYPE_WC
+#else
+#define DRM_MTRR_WC 0
+#endif
#define jiffies hardclock_ticks
#define DRM_MAXUNITS 128
@@ -968,13 +976,8 @@
void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map);
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
void drm_ioremapfree(drm_local_map_t *map);
-#if defined(__FreeBSD__)
int drm_mtrr_add(unsigned long offset, size_t size, int flags);
int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
-#elif defined(__NetBSD__)
-int drm_mtrr_add(unsigned long offset, size_t size, int flags);
-int drm_mtrr_del(unsigned long offset, size_t size, int flags);
-#endif
int drm_context_switch(struct drm_device *dev, int old, int new);
int drm_context_switch_complete(struct drm_device *dev, int new);
diff -r 01fd40886d6d -r c99fa3e11e6c sys/external/bsd/drm/dist/bsd-core/drm_bufs.c
--- a/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Wed Sep 02 01:34:34 2009 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Wed Sep 02 01:36:41 2009 +0000
@@ -323,13 +323,8 @@
case _DRM_FRAME_BUFFER:
if (map->mtrr) {
int __unused retcode;
-#if defined(__FreeBSD__)
retcode = drm_mtrr_del(0, map->offset, map->size,
DRM_MTRR_WC);
-#elif defined(__NetBSD__)
- retcode = drm_mtrr_del(map->offset, map->size,
- DRM_MTRR_WC);
-#endif
DRM_DEBUG("mtrr_del = %d\n", retcode);
}
break;
diff -r 01fd40886d6d -r c99fa3e11e6c sys/external/bsd/drm/dist/bsd-core/drm_drv.c
--- a/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Wed Sep 02 01:34:34 2009 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_drv.c Wed Sep 02 01:36:41 2009 +0000
@@ -385,7 +385,7 @@
dev->pci_map_data[unit].flags |= BUS_SPACE_MAP_LINEAR;
DRM_DEBUG("pci resource %d: type=%d, base=%lx, size=%zx, flags=%x\n",
unit, dev->pci_map_data[unit].maptype,
- dev->pci_map_data[unit].base,
+ (unsigned long)dev->pci_map_data[unit].base,
dev->pci_map_data[unit].size,
dev->pci_map_data[unit].flags);
}
@@ -710,10 +710,7 @@
if (dev->agp && dev->agp->mtrr) {
int __unused retcode;
- retcode = drm_mtrr_del(
-#if defined(__FreeBSD__)
- 0,
-#endif
+ retcode = drm_mtrr_del(0,
dev->agp->info.ai_aperture_base,
dev->agp->info.ai_aperture_size, DRM_MTRR_WC);
DRM_DEBUG("mtrr_del = %d", retcode);
diff -r 01fd40886d6d -r c99fa3e11e6c sys/external/bsd/drm/dist/bsd-core/drm_memory.c
--- a/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Wed Sep 02 01:34:34 2009 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_memory.c Wed Sep 02 01:36:41 2009 +0000
@@ -245,6 +245,7 @@
int
drm_mtrr_add(unsigned long offset, size_t size, int flags)
{
+#ifdef MTRR_GETSET_KERNEL
struct mtrr mtrrmap;
int one = 1;
@@ -253,11 +254,15 @@
mtrrmap.type = flags;
mtrrmap.flags = MTRR_VALID;
return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
+#else
+ return 0;
+#endif
}
int
-drm_mtrr_del(unsigned long offset, size_t size, int flags)
+drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
{
+#ifdef MTRR_GETSET_KERNEL
struct mtrr mtrrmap;
int one = 1;
@@ -266,5 +271,8 @@
mtrrmap.type = flags;
mtrrmap.flags = 0;
return mtrr_set(&mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
+#else
+ return 0;
+#endif
}
#endif
diff -r 01fd40886d6d -r c99fa3e11e6c sys/external/bsd/drm/dist/shared-core/savage_bci.c
--- a/sys/external/bsd/drm/dist/shared-core/savage_bci.c Wed Sep 02 01:34:34 2009 +0000
+++ b/sys/external/bsd/drm/dist/shared-core/savage_bci.c Wed Sep 02 01:36:41 2009 +0000
@@ -661,14 +661,9 @@
for (i = 0; i < 3; ++i)
if (dev_priv->mtrr[i].handle >= 0)
-#if defined(__FreeBSD__)
drm_mtrr_del(dev_priv->mtrr[i].handle,
dev_priv->mtrr[i].base,
dev_priv->mtrr[i].size, DRM_MTRR_WC);
-#elif defined(__NetBSD__)
- drm_mtrr_del(dev_priv->mtrr[i].base,
- dev_priv->mtrr[i].size, DRM_MTRR_WC);
-#endif
}
int savage_driver_unload(struct drm_device *dev)
Home |
Main Index |
Thread Index |
Old Index