summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-17 12:55:00 +0000
committerDave Airlie <airlied@linux.ie>2004-08-17 12:55:00 +0000
commitd6e89af5ee3bad5273071f183e62a7c9daf4ccbc (patch)
tree125e3fdd9ce88aacc3df35f238bd5ecdc972ce99
parent57946a9541217d54dbbadd75d981c33d0e85c201 (diff)
fix up BSD on fntbl branch
-rw-r--r--bsd-core/drmP.h10
-rw-r--r--bsd-core/drm_bufs.c23
-rw-r--r--bsd-core/drm_drv.c14
-rw-r--r--bsd/drmP.h10
-rw-r--r--bsd/drm_bufs.h23
-rw-r--r--bsd/drm_drv.h14
6 files changed, 44 insertions, 50 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 4618cc7b..c67592f6 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -589,23 +589,23 @@ extern void DRM(pci_free)(drm_device_t *dev, size_t size,
void *vaddr, dma_addr_t busaddr);
/* Inline replacements for DRM_IOREMAP macros */
-static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev)
+static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
{
map->handle = DRM(ioremap)( dev, map );
}
-
+#if 0
static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev)
{
map->handle = DRM(ioremap_nocache)(dev, map);
}
-
-static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev)
+#endif
+static __inline__ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
{
if ( map->handle && map->size )
DRM(ioremapfree)( map );
}
-static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
+static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
{
drm_map_list_entry_t *listentry;
TAILQ_FOREACH(listentry, dev->maplist, link) {
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index d5beb3be..d27254c2 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -40,17 +40,6 @@
#define __HAVE_SG 0
#endif
-#ifndef DRIVER_BUF_PRIV_T
-#define DRIVER_BUF_PRIV_T u32
-#endif
-#ifndef DRIVER_AGP_BUFFERS_MAP
-#if __HAVE_AGP && __HAVE_DMA
-#error "You must define DRIVER_AGP_BUFFERS_MAP()"
-#else
-#define DRIVER_AGP_BUFFERS_MAP( dev ) NULL
-#endif
-#endif
-
/*
* Compute order. Can be made faster.
*/
@@ -111,7 +100,7 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
switch ( map->type ) {
case _DRM_REGISTERS:
- DRM_IOREMAP(map, dev);
+ drm_core_ioremap(map, dev);
if (!(map->flags & _DRM_WRITE_COMBINING))
break;
/* FALLTHROUGH */
@@ -353,7 +342,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
+ buf->dev_priv_size = dev->dev_priv_size;
buf->dev_private = DRM(calloc)(1, buf->dev_priv_size,
DRM_MEM_BUFS);
if (buf->dev_private == NULL) {
@@ -512,8 +501,8 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
- buf->dev_private = DRM(alloc)(sizeof(DRIVER_BUF_PRIV_T),
+ buf->dev_priv_size = dev->dev_priv_size;
+ buf->dev_private = DRM(alloc)(buf->dev_priv_size,
DRM_MEM_BUFS);
if (buf->dev_private == NULL) {
/* Set count correctly so we free the proper amount. */
@@ -636,7 +625,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
+ buf->dev_priv_size = dev->dev_priv_size;
buf->dev_private = DRM(calloc)(1, buf->dev_priv_size,
DRM_MEM_BUFS);
if (buf->dev_private == NULL) {
@@ -907,7 +896,7 @@ int DRM(mapbufs)( DRM_IOCTL_ARGS )
if ((__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) ||
(__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG))) {
- drm_local_map_t *map = DRIVER_AGP_BUFFERS_MAP(dev);
+ drm_local_map_t *map = dev->agp_buffer_map;
if (map == NULL) {
retcode = EINVAL;
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 865bcde6..4e82ef81 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -631,8 +631,12 @@ static int DRM(init)( device_t nbdev )
else
dev->device = nbdev;
+ /* dev_priv_size can be changed by a driver in driver_register_fns */
+ dev->dev_priv_size = sizeof(u32);
+ DRM(driver_register_fns)(dev);
+
if (dev->fn_tbl.preinit)
- dev->fn_tbl.preinit(dev);
+ dev->fn_tbl.preinit(dev, 0);
dev->devnode = make_dev( &DRM(cdevsw),
unit,
@@ -646,8 +650,12 @@ static int DRM(init)( device_t nbdev )
#elif defined(__NetBSD__)
unit = minor(dev->device.dv_unit);
+ /* dev_priv_size can be changed by a driver in driver_register_fns */
+ dev->dev_priv_size = sizeof(u32);
+ DRM(driver_register_fns)(dev);
+
if (dev->fn_tbl.preinit)
- dev->fn_tbl.preinit(dev);
+ dev->fn_tbl.preinit(dev, 0);
#endif
@@ -705,7 +713,7 @@ static int DRM(init)( device_t nbdev )
unit );
if (dev->fn_tbl.postinit)
- dev->fn_tbl.postinit(dev);
+ dev->fn_tbl.postinit(dev, 0);
return 0;
diff --git a/bsd/drmP.h b/bsd/drmP.h
index 4618cc7b..c67592f6 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -589,23 +589,23 @@ extern void DRM(pci_free)(drm_device_t *dev, size_t size,
void *vaddr, dma_addr_t busaddr);
/* Inline replacements for DRM_IOREMAP macros */
-static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev)
+static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
{
map->handle = DRM(ioremap)( dev, map );
}
-
+#if 0
static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev)
{
map->handle = DRM(ioremap_nocache)(dev, map);
}
-
-static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev)
+#endif
+static __inline__ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
{
if ( map->handle && map->size )
DRM(ioremapfree)( map );
}
-static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
+static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
{
drm_map_list_entry_t *listentry;
TAILQ_FOREACH(listentry, dev->maplist, link) {
diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h
index d5beb3be..d27254c2 100644
--- a/bsd/drm_bufs.h
+++ b/bsd/drm_bufs.h
@@ -40,17 +40,6 @@
#define __HAVE_SG 0
#endif
-#ifndef DRIVER_BUF_PRIV_T
-#define DRIVER_BUF_PRIV_T u32
-#endif
-#ifndef DRIVER_AGP_BUFFERS_MAP
-#if __HAVE_AGP && __HAVE_DMA
-#error "You must define DRIVER_AGP_BUFFERS_MAP()"
-#else
-#define DRIVER_AGP_BUFFERS_MAP( dev ) NULL
-#endif
-#endif
-
/*
* Compute order. Can be made faster.
*/
@@ -111,7 +100,7 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
switch ( map->type ) {
case _DRM_REGISTERS:
- DRM_IOREMAP(map, dev);
+ drm_core_ioremap(map, dev);
if (!(map->flags & _DRM_WRITE_COMBINING))
break;
/* FALLTHROUGH */
@@ -353,7 +342,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
+ buf->dev_priv_size = dev->dev_priv_size;
buf->dev_private = DRM(calloc)(1, buf->dev_priv_size,
DRM_MEM_BUFS);
if (buf->dev_private == NULL) {
@@ -512,8 +501,8 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
- buf->dev_private = DRM(alloc)(sizeof(DRIVER_BUF_PRIV_T),
+ buf->dev_priv_size = dev->dev_priv_size;
+ buf->dev_private = DRM(alloc)(buf->dev_priv_size,
DRM_MEM_BUFS);
if (buf->dev_private == NULL) {
/* Set count correctly so we free the proper amount. */
@@ -636,7 +625,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
buf->pending = 0;
buf->filp = NULL;
- buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
+ buf->dev_priv_size = dev->dev_priv_size;
buf->dev_private = DRM(calloc)(1, buf->dev_priv_size,
DRM_MEM_BUFS);
if (buf->dev_private == NULL) {
@@ -907,7 +896,7 @@ int DRM(mapbufs)( DRM_IOCTL_ARGS )
if ((__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) ||
(__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG))) {
- drm_local_map_t *map = DRIVER_AGP_BUFFERS_MAP(dev);
+ drm_local_map_t *map = dev->agp_buffer_map;
if (map == NULL) {
retcode = EINVAL;
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 865bcde6..4e82ef81 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -631,8 +631,12 @@ static int DRM(init)( device_t nbdev )
else
dev->device = nbdev;
+ /* dev_priv_size can be changed by a driver in driver_register_fns */
+ dev->dev_priv_size = sizeof(u32);
+ DRM(driver_register_fns)(dev);
+
if (dev->fn_tbl.preinit)
- dev->fn_tbl.preinit(dev);
+ dev->fn_tbl.preinit(dev, 0);
dev->devnode = make_dev( &DRM(cdevsw),
unit,
@@ -646,8 +650,12 @@ static int DRM(init)( device_t nbdev )
#elif defined(__NetBSD__)
unit = minor(dev->device.dv_unit);
+ /* dev_priv_size can be changed by a driver in driver_register_fns */
+ dev->dev_priv_size = sizeof(u32);
+ DRM(driver_register_fns)(dev);
+
if (dev->fn_tbl.preinit)
- dev->fn_tbl.preinit(dev);
+ dev->fn_tbl.preinit(dev, 0);
#endif
@@ -705,7 +713,7 @@ static int DRM(init)( device_t nbdev )
unit );
if (dev->fn_tbl.postinit)
- dev->fn_tbl.postinit(dev);
+ dev->fn_tbl.postinit(dev, 0);
return 0;