From 0242f24caa812b9648c4e61e63f5e03b5931aa2a Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 30 May 2001 13:08:27 +0000 Subject: [PATCH] fix up linux compilation fix r128 driver - now works on FreeBSD --- bsd-core/Makefile | 2 +- bsd-core/drm_os_freebsd.h | 1 + bsd/Makefile | 2 +- bsd/Makefile.bsd | 2 +- bsd/drm_os_freebsd.h | 1 + linux-core/drm_bufs.c | 6 +++--- linux-core/drm_drv.c | 9 +++------ linux-core/drm_os_linux.h | 1 + linux/drm_bufs.h | 6 +++--- linux/drm_drv.h | 9 +++------ linux/drm_os_linux.h | 1 + linux/r128_cce.c | 2 +- 12 files changed, 20 insertions(+), 22 deletions(-) diff --git a/bsd-core/Makefile b/bsd-core/Makefile index bc19b0f9..2c01eba4 100644 --- a/bsd-core/Makefile +++ b/bsd-core/Makefile @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = tdfx mga # radeon gamma r128 radeon i810 sis +SUBDIR = tdfx mga r128 # radeon gamma radeon i810 sis .include diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h index b289ce0b..05f5d8a9 100644 --- a/bsd-core/drm_os_freebsd.h +++ b/bsd-core/drm_os_freebsd.h @@ -32,6 +32,7 @@ #endif #define __REALLY_HAVE_MTRR 0 +#define __REALLY_HAVE_SG 0 #if __REALLY_HAVE_AGP #include diff --git a/bsd/Makefile b/bsd/Makefile index bc19b0f9..2c01eba4 100644 --- a/bsd/Makefile +++ b/bsd/Makefile @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = tdfx mga # radeon gamma r128 radeon i810 sis +SUBDIR = tdfx mga r128 # radeon gamma radeon i810 sis .include diff --git a/bsd/Makefile.bsd b/bsd/Makefile.bsd index bc19b0f9..2c01eba4 100644 --- a/bsd/Makefile.bsd +++ b/bsd/Makefile.bsd @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = tdfx mga # radeon gamma r128 radeon i810 sis +SUBDIR = tdfx mga r128 # radeon gamma radeon i810 sis .include diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h index b289ce0b..05f5d8a9 100644 --- a/bsd/drm_os_freebsd.h +++ b/bsd/drm_os_freebsd.h @@ -32,6 +32,7 @@ #endif #define __REALLY_HAVE_MTRR 0 +#define __REALLY_HAVE_SG 0 #if __REALLY_HAVE_AGP #include diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c index ea39a2fb..0bf894ad 100644 --- a/linux-core/drm_bufs.c +++ b/linux-core/drm_bufs.c @@ -690,7 +690,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL ) } #endif /* __HAVE_PCI_DMA */ -#ifdef __HAVE_SG +#if __REALLY_HAVE_SG int DRM(addbufs_sg)( DRM_OS_IOCTL ) { DRM_OS_DEVICE; @@ -848,7 +848,7 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL ) atomic_dec( &dev->buf_alloc ); return 0; } -#endif /* __HAVE_SG */ +#endif /* __REALLY_HAVE_SG */ int DRM(addbufs)( DRM_OS_IOCTL ) { @@ -866,7 +866,7 @@ int DRM(addbufs)( DRM_OS_IOCTL ) #endif else #endif -#if __HAVE_SG +#if __REALLY_HAVE_SG if ( request.flags & _DRM_SG_BUFFER ) #ifdef __linux__ return DRM(addbufs_sg)( inode, filp, cmd, data ); diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index e3d843dd..0fc8236e 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -81,9 +81,6 @@ #ifndef __HAVE_COUNTERS #define __HAVE_COUNTERS 0 #endif -#ifndef __HAVE_SG -#define __HAVE_SG 0 -#endif #ifndef DRIVER_PREINIT #define DRIVER_PREINIT() @@ -208,7 +205,7 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, #endif -#if __HAVE_SG +#if __REALLY_HAVE_SG [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = { DRM(sg_alloc), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { DRM(sg_free), 1, 1 }, #endif @@ -561,10 +558,10 @@ static int DRM(takedown)( drm_device_t *dev ) */ break; case _DRM_SCATTER_GATHER: - /* Handle it, but do nothing, if HAVE_SG + /* Handle it, but do nothing, if REALLY_HAVE_SG * isn't defined. */ -#if __HAVE_SG +#if __REALLY_HAVE_SG if(dev->sg) { DRM(sg_cleanup)(dev->sg); dev->sg = NULL; diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h index 5dfc1517..38abefc4 100644 --- a/linux-core/drm_os_linux.h +++ b/linux-core/drm_os_linux.h @@ -257,6 +257,7 @@ do { \ #define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ defined(CONFIG_AGP_MODULE))) +#define __REALLY_HAVE_SG (__HAVE_SG) #define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR)) #define DRM_OS_LOCK up(&dev->struct_sem) diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h index ea39a2fb..0bf894ad 100644 --- a/linux/drm_bufs.h +++ b/linux/drm_bufs.h @@ -690,7 +690,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL ) } #endif /* __HAVE_PCI_DMA */ -#ifdef __HAVE_SG +#if __REALLY_HAVE_SG int DRM(addbufs_sg)( DRM_OS_IOCTL ) { DRM_OS_DEVICE; @@ -848,7 +848,7 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL ) atomic_dec( &dev->buf_alloc ); return 0; } -#endif /* __HAVE_SG */ +#endif /* __REALLY_HAVE_SG */ int DRM(addbufs)( DRM_OS_IOCTL ) { @@ -866,7 +866,7 @@ int DRM(addbufs)( DRM_OS_IOCTL ) #endif else #endif -#if __HAVE_SG +#if __REALLY_HAVE_SG if ( request.flags & _DRM_SG_BUFFER ) #ifdef __linux__ return DRM(addbufs_sg)( inode, filp, cmd, data ); diff --git a/linux/drm_drv.h b/linux/drm_drv.h index e3d843dd..0fc8236e 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -81,9 +81,6 @@ #ifndef __HAVE_COUNTERS #define __HAVE_COUNTERS 0 #endif -#ifndef __HAVE_SG -#define __HAVE_SG 0 -#endif #ifndef DRIVER_PREINIT #define DRIVER_PREINIT() @@ -208,7 +205,7 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, #endif -#if __HAVE_SG +#if __REALLY_HAVE_SG [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = { DRM(sg_alloc), 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { DRM(sg_free), 1, 1 }, #endif @@ -561,10 +558,10 @@ static int DRM(takedown)( drm_device_t *dev ) */ break; case _DRM_SCATTER_GATHER: - /* Handle it, but do nothing, if HAVE_SG + /* Handle it, but do nothing, if REALLY_HAVE_SG * isn't defined. */ -#if __HAVE_SG +#if __REALLY_HAVE_SG if(dev->sg) { DRM(sg_cleanup)(dev->sg); dev->sg = NULL; diff --git a/linux/drm_os_linux.h b/linux/drm_os_linux.h index 5dfc1517..38abefc4 100644 --- a/linux/drm_os_linux.h +++ b/linux/drm_os_linux.h @@ -257,6 +257,7 @@ do { \ #define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ defined(CONFIG_AGP_MODULE))) +#define __REALLY_HAVE_SG (__HAVE_SG) #define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR)) #define DRM_OS_LOCK up(&dev->struct_sem) diff --git a/linux/r128_cce.c b/linux/r128_cce.c index 452ac5c9..6b3be2a3 100644 --- a/linux/r128_cce.c +++ b/linux/r128_cce.c @@ -338,7 +338,7 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev ) SET_RING_HEAD( &dev_priv->ring, 0 ); #if __REALLY_HAVE_SG -#define DRM_OS_VTOPHYS(x) vtophys(x) +/* #define DRM_OS_VTOPHYS(x) vtophys(x) */ #define DRM_OS_VTOPHYS(x) virt_to_bus(x) if ( !dev_priv->is_pci ) {