Updates for current NetBSD. With this, mga and tdfx compile (radeon, r128

are close). This particular version hasn't been tested yet.
Submitted by: Erik Reid
This commit is contained in:
Eric Anholt 2003-01-28 20:53:22 +00:00
parent 9e4f21f170
commit a49668a280
22 changed files with 222 additions and 88 deletions

View file

@ -458,9 +458,9 @@ struct drm_device {
drm_device_dma_t *dma; /* Optional pointer for DMA support */
/* Context support */
#ifdef __FreeBSD__
int irq; /* Interrupt used by board */
int irqrid; /* Interrupt used by board */
#ifdef __FreeBSD__
struct resource *irqr; /* Resource for interrupt used by board */
#elif defined(__NetBSD__)
struct pci_attach_args pa;

View file

@ -130,10 +130,8 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
mtrrmap.base = map->offset;
mtrrmap.len = map->size;
mtrrmap.type = MTRR_TYPE_WC;
mtrrmap.flags = MTRR_PRIVATE | MTRR_VALID;
mtrrmap.owner = p->p_pid;
/* USER? KERNEL? XXX */
map->mtrr = mtrr_get( &mtrrmap, &one, p, MTRR_GETSET_KERNEL );
mtrrmap.flags = MTRR_VALID;
map->mtrr = mtrr_set( &mtrrmap, &one, p, MTRR_GETSET_KERNEL );
#endif
}
#endif /* __REALLY_HAVE_MTRR */

View file

@ -529,9 +529,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
/* Install handler */
dev->irqrid = 0;
#ifdef __FreeBSD__
dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
if (!dev->irqr) {
#elif defined(__NetBSD__)
if (pci_intr_map(&dev->pa, &dev->ih) != 0) {
#endif
DRM_LOCK;
dev->irq = 0;
dev->irqrid = 0;
@ -539,11 +543,19 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
return ENOENT;
}
#ifdef __FreeBSD__
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
if ( retcode ) {
#elif defined(__NetBSD__)
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
(int (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
if ( !dev->irqh ) {
#endif
DRM_LOCK;
#ifdef __FreeBSD__
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
#endif
dev->irq = 0;
dev->irqrid = 0;
DRM_UNLOCK;
@ -575,9 +587,13 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
#ifdef __FreeBSD__
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
#elif defined(__NetBSD__)
pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh);
#endif
return 0;
}

View file

@ -147,10 +147,7 @@ MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
#ifdef __NetBSD__
#define DRIVER_SOFTC(unit) \
(DRM(devs)[(unit)])
drm_device_t *DRM(devs)[16];
((drm_device_t *) device_lookup(&DRM(cd), unit))
#endif /* __NetBSD__ */
static drm_ioctl_desc_t DRM(ioctls)[] = {
@ -229,21 +226,15 @@ static drm_ioctl_desc_t DRM(ioctls)[] = {
const char *DRM(find_description)(int vendor, int device);
#ifdef __FreeBSD__
static struct cdevsw DRM(cdevsw) = {
/* open */ DRM( open ),
/* close */ DRM( close ),
/* read */ DRM( read ),
/* write */ DRM( write ),
/* ioctl */ DRM( ioctl ),
#ifdef __NetBSD__
/* stop */ NULL,
/* tty */ NULL,
#endif /* __NetBSD__ */
/* poll */ DRM( poll ),
/* mmap */ DRM( mmap ),
#ifdef __NetBSD__
/* type */ NULL
#elif defined(__FreeBSD__)
/* strategy */ nostrategy,
/* name */ DRIVER_NAME,
/* maj */ CDEV_MAJOR,
@ -255,10 +246,8 @@ static struct cdevsw DRM(cdevsw) = {
#else
/* bmaj */ -1
#endif
#endif /* __FreeBSD__ */
};
#ifdef __FreeBSD__
static int DRM(probe)(device_t dev)
{
const char *s = NULL;
@ -304,29 +293,58 @@ static driver_t DRM(driver) = {
static devclass_t DRM(devclass);
#elif defined(__NetBSD__)
static struct cdevsw DRM(cdevsw) = {
DRM(open),
DRM(close),
DRM(read),
DRM(write),
DRM(ioctl),
nostop,
notty,
DRM(poll),
DRM(mmap),
nokqfilter,
D_TTY
};
int DRM(refcnt) = 0;
#if __NetBSD_Version__ >= 106080000
MOD_DEV( DRIVER_NAME, DRIVER_NAME, NULL, -1, &DRM(cdevsw), CDEV_MAJOR);
#else
MOD_DEV( DRIVER_NAME, LM_DT_CHAR, CDEV_MAJOR, &DRM(cdevsw) );
#endif
int DRM(lkmentry)(struct lkm_table *lkmtp, int cmd, int ver);
static int DRM(lkmhandle)(struct lkm_table *lkmtp, int cmd);
int DRM(modprobe)();
int DRM(probe)(struct pci_attach_args *pa);
void DRM(attach)(struct pci_attach_args *pa);
void DRM(attach)(struct pci_attach_args *pa, dev_t kdev);
int DRM(lkmentry)(struct lkm_table *lkmtp, int cmd, int ver)
int DRM(lkmentry)(struct lkm_table *lkmtp, int cmd, int ver) {
DISPATCH(lkmtp, cmd, ver, DRM(lkmhandle), DRM(lkmhandle), DRM(lkmhandle));
}
static int DRM(lkmhandle)(struct lkm_table *lkmtp, int cmd)
{
int j, error = 0;
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
struct lkm_dev *args = lkmtp->private.lkm_dev;
#endif
switch(cmd) {
case LKM_E_LOAD:
if (lkmexists(lkmtp))
return EEXIST;
if(DRM(modprobe)())
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
error = devsw_attach(args->lkm_devname,
args->lkm_bdev, &args->lkm_bdevmaj,
args->lkm_cdev, &args->lkm_cdevmaj);
if(error != 0)
return error;
#endif
if(DRM(modprobe)())
return 0;
return 1;
@ -334,10 +352,11 @@ static int DRM(lkmhandle)(struct lkm_table *lkmtp, int cmd)
case LKM_E_UNLOAD:
if (DRM(refcnt) > 0)
return (EBUSY);
/* for (j = 0; j <= sc->sc_maxvm; j++)
DRM(destroy)(j); */
break;
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
devsw_detach(args->lkm_bdev, args->lkm_cdev);
#endif
break;
case LKM_E_STAT:
break;
@ -352,7 +371,7 @@ int DRM(modprobe)() {
struct pci_attach_args pa;
int error = 0;
if((error = pci_find_device(&pa, DRM(probe))) != 0)
DRM(attach)(&pa);
DRM(attach)(&pa, 0);
return error;
}
@ -368,21 +387,38 @@ int DRM(probe)(struct pci_attach_args *pa)
return 0;
}
void DRM(attach)(struct pci_attach_args *pa)
void DRM(attach)(struct pci_attach_args *pa, dev_t kdev)
{
int i;
drm_device_t *dev = malloc(sizeof(drm_device_t), M_DEVBUF, M_WAITOK);
DRM_DEVICE;
memset(dev, 0, sizeof(drm_device_t));
memcpy(&dev->pa, pa, sizeof(dev->pa));
DRM(devs)[0] = dev;
DRM_INFO("%s", DRM(find_description)(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id)));
DRM(init)(dev);
}
#endif
int DRM(detach)(struct device *self, int flags)
{
DRM(cleanup)((drm_device_t *)self);
return 0;
}
int DRM(activate)(struct device *self, enum devact act)
{
switch (act) {
case DVACT_ACTIVATE:
return (EOPNOTSUPP);
break;
case DVACT_DEACTIVATE:
/* FIXME */
break;
}
return (0);
}
#endif /* __NetBSD__ */
const char *DRM(find_description)(int vendor, int device) {
const char *s = NULL;
@ -617,8 +653,6 @@ static int DRM(takedown)( drm_device_t *dev )
mtrrmap.len = map->size;
mtrrmap.type = MTRR_TYPE_WC;
mtrrmap.flags = 0;
/*mtrrmap.owner = p->p_pid;*/
/* XXX: Use curproc here? */
retcode = mtrr_set( &mtrrmap, &one,
DRM_CURPROC, MTRR_GETSET_KERNEL);
#endif
@ -834,7 +868,7 @@ static void DRM(cleanup)(drm_device_t *dev)
mtrrmap.len = dev->agp->info.ai_aperture_size;
mtrrmap.type = 0;
mtrrmap.flags = 0;
retval = mtrr_set( &mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
mtrr_set( &mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
#endif
}
#endif

View file

@ -253,7 +253,7 @@ void *DRM(ioremap)( drm_device_t *dev, drm_local_map_t *map )
if (!(pt = pmap_mapdev(map->offset, map->size))) {
#elif defined(__NetBSD__)
if (bus_space_map(map->iot, map->offset, map->size,
BUS_SPACE_MAP_LINEAR, &ioh)) {
BUS_SPACE_MAP_LINEAR, &map->ioh)) {
#endif
DRM_SPINLOCK(&DRM(mem_lock));
++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count;

View file

@ -209,7 +209,7 @@ typedef struct drm_chipinfo
char *name;
} drm_chipinfo_t;
#define cpu_to_le32(x) (x)
#define cpu_to_le32(x) (x) /* FIXME */
typedef u_int32_t dma_addr_t;
typedef u_int32_t atomic_t;

View file

@ -34,7 +34,7 @@
#define __REALLY_HAVE_AGP __HAVE_AGP
#define __REALLY_HAVE_MTRR 0
#define __REALLY_HAVE_MTRR 1
#define __REALLY_HAVE_SG 0
#if __REALLY_HAVE_AGP
@ -44,7 +44,7 @@
typedef drm_device_t *device_t;
extern drm_device_t *DRM(devs)[16];
extern struct cfdriver DRM(cd);
#if DRM_DEBUG
#undef DRM_DEBUG_CODE
@ -73,11 +73,11 @@ extern drm_device_t *DRM(devs)[16];
#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, NULL)
#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag)
#define DRM_TASKQUEUE_ARGS void *dev, int pending
#define DRM_IRQ_ARGS void *device
#define DRM_DEVICE drm_device_t *dev = \
(DRM(devs)[minor(kdev)])
#define DRM_IRQ_ARGS void *arg
#define DRM_DEVICE drm_device_t *dev = device_lookup(&DRM(cd), minor(kdev))
#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT )
#define DRM_FREE(pt) free( pt, DRM(M_DRM) )
/* XXX Get netbsd to add a M_DRM malloc type. */
#define DRM_FREE(pt) free( pt, M_AGP )
#define DRM_VTOPHYS(addr) vtophys(addr)
#define DRM_READ8(map, offset) bus_space_read_1( (map)->iot, (map)->ioh, (offset) )
@ -117,6 +117,15 @@ do { \
} \
} while (0)
#define DRM_HZ hz
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
while (!condition) { \
ret = tsleep( (void *)&(queue), PZERO | PCATCH, "drmwtq", (timeout) ); \
if ( ret ) \
return ret; \
}
#define DRM_ERR(v) v
#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \
@ -133,7 +142,7 @@ do { \
#define DRM_READMEMORYBARRIER( map ) \
bus_space_barrier((map)->iot, (map)->ioh, 0, (map)->size, BUS_SPACE_BARRIER_READ);
#define DRM_WAKEUP(w) wakeup(w)
#define DRM_WAKEUP(w) wakeup((void *)w)
#define DRM_WAKEUP_INT(w) wakeup(w)
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
@ -146,6 +155,8 @@ typedef struct drm_chipinfo
char *name;
} drm_chipinfo_t;
#define cpu_to_le32(x) (x) /* FIXME */
typedef u_int32_t dma_addr_t;
typedef volatile long atomic_t;
typedef u_int32_t cycles_t;
@ -173,7 +184,7 @@ typedef vaddr_t vm_offset_t;
/* Fake this */
static __inline int
atomic_cmpset_int(int *dst, int old, int new)
atomic_cmpset_int(__volatile__ int *dst, int old, int new)
{
int s = splhigh();
if (*dst==old) {

View file

@ -63,4 +63,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(mga, DV_TTY, NULL);
#endif

View file

@ -82,4 +82,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(r128, DV_TTY, NULL);
#endif /* __FreeBSD__ */

View file

@ -93,4 +93,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(DRIVER_NAME, pci, DRM(driver), DRM(devclass), 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(radeon, DV_TTY, NULL);
#endif /* __FreeBSD__ */

View file

@ -93,4 +93,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(tdfx, DV_TTY, NULL);
#endif /* __FreeBSD__ */

View file

@ -458,9 +458,9 @@ struct drm_device {
drm_device_dma_t *dma; /* Optional pointer for DMA support */
/* Context support */
#ifdef __FreeBSD__
int irq; /* Interrupt used by board */
int irqrid; /* Interrupt used by board */
#ifdef __FreeBSD__
struct resource *irqr; /* Resource for interrupt used by board */
#elif defined(__NetBSD__)
struct pci_attach_args pa;

View file

@ -130,10 +130,8 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
mtrrmap.base = map->offset;
mtrrmap.len = map->size;
mtrrmap.type = MTRR_TYPE_WC;
mtrrmap.flags = MTRR_PRIVATE | MTRR_VALID;
mtrrmap.owner = p->p_pid;
/* USER? KERNEL? XXX */
map->mtrr = mtrr_get( &mtrrmap, &one, p, MTRR_GETSET_KERNEL );
mtrrmap.flags = MTRR_VALID;
map->mtrr = mtrr_set( &mtrrmap, &one, p, MTRR_GETSET_KERNEL );
#endif
}
#endif /* __REALLY_HAVE_MTRR */

View file

@ -529,9 +529,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
/* Install handler */
dev->irqrid = 0;
#ifdef __FreeBSD__
dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
if (!dev->irqr) {
#elif defined(__NetBSD__)
if (pci_intr_map(&dev->pa, &dev->ih) != 0) {
#endif
DRM_LOCK;
dev->irq = 0;
dev->irqrid = 0;
@ -539,11 +543,19 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
return ENOENT;
}
#ifdef __FreeBSD__
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
if ( retcode ) {
#elif defined(__NetBSD__)
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
(int (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
if ( !dev->irqh ) {
#endif
DRM_LOCK;
#ifdef __FreeBSD__
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
#endif
dev->irq = 0;
dev->irqrid = 0;
DRM_UNLOCK;
@ -575,9 +587,13 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
#ifdef __FreeBSD__
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
#elif defined(__NetBSD__)
pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh);
#endif
return 0;
}

View file

@ -147,10 +147,7 @@ MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
#ifdef __NetBSD__
#define DRIVER_SOFTC(unit) \
(DRM(devs)[(unit)])
drm_device_t *DRM(devs)[16];
((drm_device_t *) device_lookup(&DRM(cd), unit))
#endif /* __NetBSD__ */
static drm_ioctl_desc_t DRM(ioctls)[] = {
@ -229,21 +226,15 @@ static drm_ioctl_desc_t DRM(ioctls)[] = {
const char *DRM(find_description)(int vendor, int device);
#ifdef __FreeBSD__
static struct cdevsw DRM(cdevsw) = {
/* open */ DRM( open ),
/* close */ DRM( close ),
/* read */ DRM( read ),
/* write */ DRM( write ),
/* ioctl */ DRM( ioctl ),
#ifdef __NetBSD__
/* stop */ NULL,
/* tty */ NULL,
#endif /* __NetBSD__ */
/* poll */ DRM( poll ),
/* mmap */ DRM( mmap ),
#ifdef __NetBSD__
/* type */ NULL
#elif defined(__FreeBSD__)
/* strategy */ nostrategy,
/* name */ DRIVER_NAME,
/* maj */ CDEV_MAJOR,
@ -255,10 +246,8 @@ static struct cdevsw DRM(cdevsw) = {
#else
/* bmaj */ -1
#endif
#endif /* __FreeBSD__ */
};
#ifdef __FreeBSD__
static int DRM(probe)(device_t dev)
{
const char *s = NULL;
@ -304,29 +293,58 @@ static driver_t DRM(driver) = {
static devclass_t DRM(devclass);
#elif defined(__NetBSD__)
static struct cdevsw DRM(cdevsw) = {
DRM(open),
DRM(close),
DRM(read),
DRM(write),
DRM(ioctl),
nostop,
notty,
DRM(poll),
DRM(mmap),
nokqfilter,
D_TTY
};
int DRM(refcnt) = 0;
#if __NetBSD_Version__ >= 106080000
MOD_DEV( DRIVER_NAME, DRIVER_NAME, NULL, -1, &DRM(cdevsw), CDEV_MAJOR);
#else
MOD_DEV( DRIVER_NAME, LM_DT_CHAR, CDEV_MAJOR, &DRM(cdevsw) );
#endif
int DRM(lkmentry)(struct lkm_table *lkmtp, int cmd, int ver);
static int DRM(lkmhandle)(struct lkm_table *lkmtp, int cmd);
int DRM(modprobe)();
int DRM(probe)(struct pci_attach_args *pa);
void DRM(attach)(struct pci_attach_args *pa);
void DRM(attach)(struct pci_attach_args *pa, dev_t kdev);
int DRM(lkmentry)(struct lkm_table *lkmtp, int cmd, int ver)
int DRM(lkmentry)(struct lkm_table *lkmtp, int cmd, int ver) {
DISPATCH(lkmtp, cmd, ver, DRM(lkmhandle), DRM(lkmhandle), DRM(lkmhandle));
}
static int DRM(lkmhandle)(struct lkm_table *lkmtp, int cmd)
{
int j, error = 0;
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
struct lkm_dev *args = lkmtp->private.lkm_dev;
#endif
switch(cmd) {
case LKM_E_LOAD:
if (lkmexists(lkmtp))
return EEXIST;
if(DRM(modprobe)())
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
error = devsw_attach(args->lkm_devname,
args->lkm_bdev, &args->lkm_bdevmaj,
args->lkm_cdev, &args->lkm_cdevmaj);
if(error != 0)
return error;
#endif
if(DRM(modprobe)())
return 0;
return 1;
@ -334,10 +352,11 @@ static int DRM(lkmhandle)(struct lkm_table *lkmtp, int cmd)
case LKM_E_UNLOAD:
if (DRM(refcnt) > 0)
return (EBUSY);
/* for (j = 0; j <= sc->sc_maxvm; j++)
DRM(destroy)(j); */
break;
#if defined(__NetBSD__) && (__NetBSD_Version__ > 106080000)
devsw_detach(args->lkm_bdev, args->lkm_cdev);
#endif
break;
case LKM_E_STAT:
break;
@ -352,7 +371,7 @@ int DRM(modprobe)() {
struct pci_attach_args pa;
int error = 0;
if((error = pci_find_device(&pa, DRM(probe))) != 0)
DRM(attach)(&pa);
DRM(attach)(&pa, 0);
return error;
}
@ -368,21 +387,38 @@ int DRM(probe)(struct pci_attach_args *pa)
return 0;
}
void DRM(attach)(struct pci_attach_args *pa)
void DRM(attach)(struct pci_attach_args *pa, dev_t kdev)
{
int i;
drm_device_t *dev = malloc(sizeof(drm_device_t), M_DEVBUF, M_WAITOK);
DRM_DEVICE;
memset(dev, 0, sizeof(drm_device_t));
memcpy(&dev->pa, pa, sizeof(dev->pa));
DRM(devs)[0] = dev;
DRM_INFO("%s", DRM(find_description)(PCI_VENDOR(pa->pa_id), PCI_PRODUCT(pa->pa_id)));
DRM(init)(dev);
}
#endif
int DRM(detach)(struct device *self, int flags)
{
DRM(cleanup)((drm_device_t *)self);
return 0;
}
int DRM(activate)(struct device *self, enum devact act)
{
switch (act) {
case DVACT_ACTIVATE:
return (EOPNOTSUPP);
break;
case DVACT_DEACTIVATE:
/* FIXME */
break;
}
return (0);
}
#endif /* __NetBSD__ */
const char *DRM(find_description)(int vendor, int device) {
const char *s = NULL;
@ -617,8 +653,6 @@ static int DRM(takedown)( drm_device_t *dev )
mtrrmap.len = map->size;
mtrrmap.type = MTRR_TYPE_WC;
mtrrmap.flags = 0;
/*mtrrmap.owner = p->p_pid;*/
/* XXX: Use curproc here? */
retcode = mtrr_set( &mtrrmap, &one,
DRM_CURPROC, MTRR_GETSET_KERNEL);
#endif
@ -834,7 +868,7 @@ static void DRM(cleanup)(drm_device_t *dev)
mtrrmap.len = dev->agp->info.ai_aperture_size;
mtrrmap.type = 0;
mtrrmap.flags = 0;
retval = mtrr_set( &mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
mtrr_set( &mtrrmap, &one, NULL, MTRR_GETSET_KERNEL);
#endif
}
#endif

View file

@ -253,7 +253,7 @@ void *DRM(ioremap)( drm_device_t *dev, drm_local_map_t *map )
if (!(pt = pmap_mapdev(map->offset, map->size))) {
#elif defined(__NetBSD__)
if (bus_space_map(map->iot, map->offset, map->size,
BUS_SPACE_MAP_LINEAR, &ioh)) {
BUS_SPACE_MAP_LINEAR, &map->ioh)) {
#endif
DRM_SPINLOCK(&DRM(mem_lock));
++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count;

View file

@ -209,7 +209,7 @@ typedef struct drm_chipinfo
char *name;
} drm_chipinfo_t;
#define cpu_to_le32(x) (x)
#define cpu_to_le32(x) (x) /* FIXME */
typedef u_int32_t dma_addr_t;
typedef u_int32_t atomic_t;

View file

@ -34,7 +34,7 @@
#define __REALLY_HAVE_AGP __HAVE_AGP
#define __REALLY_HAVE_MTRR 0
#define __REALLY_HAVE_MTRR 1
#define __REALLY_HAVE_SG 0
#if __REALLY_HAVE_AGP
@ -44,7 +44,7 @@
typedef drm_device_t *device_t;
extern drm_device_t *DRM(devs)[16];
extern struct cfdriver DRM(cd);
#if DRM_DEBUG
#undef DRM_DEBUG_CODE
@ -73,11 +73,11 @@ extern drm_device_t *DRM(devs)[16];
#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, NULL)
#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag)
#define DRM_TASKQUEUE_ARGS void *dev, int pending
#define DRM_IRQ_ARGS void *device
#define DRM_DEVICE drm_device_t *dev = \
(DRM(devs)[minor(kdev)])
#define DRM_IRQ_ARGS void *arg
#define DRM_DEVICE drm_device_t *dev = device_lookup(&DRM(cd), minor(kdev))
#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT )
#define DRM_FREE(pt) free( pt, DRM(M_DRM) )
/* XXX Get netbsd to add a M_DRM malloc type. */
#define DRM_FREE(pt) free( pt, M_AGP )
#define DRM_VTOPHYS(addr) vtophys(addr)
#define DRM_READ8(map, offset) bus_space_read_1( (map)->iot, (map)->ioh, (offset) )
@ -117,6 +117,15 @@ do { \
} \
} while (0)
#define DRM_HZ hz
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
while (!condition) { \
ret = tsleep( (void *)&(queue), PZERO | PCATCH, "drmwtq", (timeout) ); \
if ( ret ) \
return ret; \
}
#define DRM_ERR(v) v
#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \
@ -133,7 +142,7 @@ do { \
#define DRM_READMEMORYBARRIER( map ) \
bus_space_barrier((map)->iot, (map)->ioh, 0, (map)->size, BUS_SPACE_BARRIER_READ);
#define DRM_WAKEUP(w) wakeup(w)
#define DRM_WAKEUP(w) wakeup((void *)w)
#define DRM_WAKEUP_INT(w) wakeup(w)
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
@ -146,6 +155,8 @@ typedef struct drm_chipinfo
char *name;
} drm_chipinfo_t;
#define cpu_to_le32(x) (x) /* FIXME */
typedef u_int32_t dma_addr_t;
typedef volatile long atomic_t;
typedef u_int32_t cycles_t;
@ -173,7 +184,7 @@ typedef vaddr_t vm_offset_t;
/* Fake this */
static __inline int
atomic_cmpset_int(int *dst, int old, int new)
atomic_cmpset_int(__volatile__ int *dst, int old, int new)
{
int s = splhigh();
if (*dst==old) {

View file

@ -63,4 +63,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(mga, DV_TTY, NULL);
#endif

View file

@ -82,4 +82,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(r128, DV_TTY, NULL);
#endif /* __FreeBSD__ */

View file

@ -93,4 +93,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(DRIVER_NAME, pci, DRM(driver), DRM(devclass), 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(radeon, DV_TTY, NULL);
#endif /* __FreeBSD__ */

View file

@ -93,4 +93,6 @@ drm_chipinfo_t DRM(devicelist)[] = {
#ifdef __FreeBSD__
DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0);
#elif defined(__NetBSD__)
CFDRIVER_DECL(tdfx, DV_TTY, NULL);
#endif /* __FreeBSD__ */