Remove #ifdef __OpSys__ sections to make this readable. Add RCS tags.
Nothing done in header files, nor in dev/pci/drm (we might not want to touch this for the sake of merging) yet. Compile tested; please let me know if this broke anything.
This commit is contained in:
parent
45f44fab6d
commit
27bbf3c565
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm.h,v 1.2 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/**
|
||||
* \file drm.h
|
||||
* Header for the Direct Rendering Manager
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drmP.h,v 1.10 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
|
||||
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
|
||||
*/
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_agpsupport.c,v 1.3 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*-
|
||||
* Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com
|
||||
*/
|
||||
@ -38,57 +40,12 @@ __FBSDID("$FreeBSD: src/sys/dev/drm/drm_agpsupport.c,v 1.5 2006/04/09 20:45:44 a
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <pci/agpreg.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#endif
|
||||
|
||||
/* Returns 1 if AGP or 0 if not. */
|
||||
static int
|
||||
drm_device_find_capability(drm_device_t *dev, int cap)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
#if __FreeBSD_version >= 700010
|
||||
|
||||
return (pci_find_extcap(dev->device, cap, NULL) == 0);
|
||||
#else
|
||||
/* Code taken from agp.c. IWBNI that was a public interface. */
|
||||
u_int32_t status;
|
||||
u_int8_t ptr, next;
|
||||
|
||||
/*
|
||||
* Check the CAP_LIST bit of the PCI status register first.
|
||||
*/
|
||||
status = pci_read_config(dev->device, PCIR_STATUS, 2);
|
||||
if (!(status & 0x10))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Traverse the capabilities list.
|
||||
*/
|
||||
for (ptr = pci_read_config(dev->device, AGP_CAPPTR, 1);
|
||||
ptr != 0;
|
||||
ptr = next) {
|
||||
u_int32_t capid = pci_read_config(dev->device, ptr, 4);
|
||||
next = AGP_CAPID_GET_NEXT_PTR(capid);
|
||||
|
||||
/*
|
||||
* If this capability entry ID is cap, then we are done.
|
||||
*/
|
||||
if (AGP_CAPID_GET_CAP_ID(capid) == cap)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
#ifdef __NetBSD__
|
||||
return pci_get_capability(dev->pa.pa_pc, dev->pa.pa_tag, cap,
|
||||
NULL, NULL);
|
||||
#endif
|
||||
/* XXX: fill me in for non-FreeBSD */
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int drm_device_is_agp(drm_device_t *dev)
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_atomic.h,v 1.2 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/**
|
||||
* \file drm_atomic.h
|
||||
* Atomic operations used in the DRM which may or may not be provided by the OS.
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_auth.c,v 1.3 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*-
|
||||
* Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
|
||||
*/
|
||||
@ -129,11 +131,7 @@ int drm_getmagic(DRM_IOCTL_ARGS)
|
||||
drm_file_t *priv;
|
||||
|
||||
DRM_LOCK();
|
||||
#ifdef __FreeBSD__
|
||||
priv = drm_find_file_by_proc(dev, p);
|
||||
#elif defined(__NetBSD__)
|
||||
priv = drm_find_file_by_proc(dev, p->l_proc);
|
||||
#endif
|
||||
DRM_UNLOCK();
|
||||
if (priv == NULL) {
|
||||
DRM_ERROR("can't find authenticator\n");
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_bufs.c,v 1.5 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_bufs.h -- Generic buffer template -*- linux-c -*-
|
||||
* Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
|
||||
*/
|
||||
@ -62,28 +64,9 @@ int drm_order(unsigned long size)
|
||||
*/
|
||||
static int drm_alloc_resource(drm_device_t *dev, int resource)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
if (resource >= DRM_MAX_PCI_RESOURCE) {
|
||||
DRM_ERROR("Resource %d too large\n", resource);
|
||||
return 1;
|
||||
}
|
||||
|
||||
DRM_UNLOCK();
|
||||
if (dev->pcir[resource] != NULL) {
|
||||
DRM_LOCK();
|
||||
return 0;
|
||||
}
|
||||
/* XXX This space _not_ intentionally left blank! */
|
||||
|
||||
dev->pcirid[resource] = PCIR_BAR(resource);
|
||||
dev->pcir[resource] = bus_alloc_resource_any(dev->device,
|
||||
SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE);
|
||||
DRM_LOCK();
|
||||
|
||||
if (dev->pcir[resource] == NULL) {
|
||||
DRM_ERROR("Couldn't find resource 0x%x\n", resource);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,11 +75,8 @@ unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource)
|
||||
if (drm_alloc_resource(dev, resource) != 0)
|
||||
return 0;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
return rman_get_start(dev->pcir[resource]);
|
||||
#elif defined(__NetBSD__)
|
||||
|
||||
return dev->pci_map_data[resource].base;
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource)
|
||||
@ -104,11 +84,7 @@ unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource)
|
||||
if (drm_alloc_resource(dev, resource) != 0)
|
||||
return 0;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
return rman_get_size(dev->pcir[resource]);
|
||||
#elif defined(__NetBSD__)
|
||||
return dev->pci_map_data[resource].size;
|
||||
#endif
|
||||
}
|
||||
|
||||
int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||
@ -169,10 +145,8 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||
map->size = size;
|
||||
map->type = type;
|
||||
map->flags = flags;
|
||||
#ifdef __NetBSD__
|
||||
map->cnt = NULL;
|
||||
map->cnt = NULL; /* cnt, mapsize added for NetBSD port */
|
||||
map->mapsize = 0;
|
||||
#endif
|
||||
|
||||
switch ( map->type ) {
|
||||
case _DRM_REGISTERS:
|
||||
@ -282,11 +256,7 @@ int drm_addmap_ioctl(DRM_IOCTL_ARGS)
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(request, (drm_map_t *)data, sizeof(drm_map_t));
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
if (!DRM_SUSER(p) && request.type != _DRM_AGP)
|
||||
#elif defined(__NetBSD__)
|
||||
if (!DRM_SUSER(p->l_proc) && request.type != _DRM_AGP)
|
||||
#endif
|
||||
return DRM_ERR(EACCES);
|
||||
|
||||
DRM_LOCK();
|
||||
@ -317,9 +287,6 @@ void drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
|
||||
|
||||
switch (map->type) {
|
||||
case _DRM_REGISTERS:
|
||||
#ifdef __FreeBSD__
|
||||
if (map->bsr == NULL)
|
||||
#endif
|
||||
drm_ioremapfree(map);
|
||||
/* FALLTHROUGH */
|
||||
case _DRM_FRAME_BUFFER:
|
||||
@ -344,13 +311,6 @@ void drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
if (map->bsr != NULL) {
|
||||
bus_release_resource(dev->device, SYS_RES_MEMORY, map->rid,
|
||||
map->bsr);
|
||||
}
|
||||
#endif
|
||||
|
||||
TAILQ_REMOVE(&dev->maplist, map, link);
|
||||
free(map, M_DRM);
|
||||
}
|
||||
@ -1059,32 +1019,20 @@ int drm_mapbufs(DRM_IOCTL_ARGS)
|
||||
const int zero = 0;
|
||||
vm_offset_t address;
|
||||
struct vmspace *vms;
|
||||
#ifdef __FreeBSD__
|
||||
vm_ooffset_t foff;
|
||||
vm_size_t size;
|
||||
vm_offset_t vaddr;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
struct vnode *vn;
|
||||
voff_t foff;
|
||||
vsize_t size, rsize;
|
||||
vaddr_t vaddr;
|
||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
drm_buf_map_t request;
|
||||
int i;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL( request, (drm_buf_map_t *)data, sizeof(request) );
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if (!vfinddev(kdev, VCHR, &vn))
|
||||
return 0; /* FIXME: Shouldn't this be EINVAL or something? */
|
||||
#endif /* __NetBSD__ || __OpenBSD */
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
|
||||
vms = p->td_proc->p_vmspace;
|
||||
#else
|
||||
vms = p->l_proc->p_vmspace;
|
||||
#endif
|
||||
|
||||
|
||||
DRM_SPINLOCK(&dev->dma_lock);
|
||||
dev->buf_use++; /* Can't allocate more after this call */
|
||||
@ -1108,16 +1056,6 @@ int drm_mapbufs(DRM_IOCTL_ARGS)
|
||||
foff = 0;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
vaddr = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ);
|
||||
#if __FreeBSD_version >= 600023
|
||||
retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE,
|
||||
VM_PROT_ALL, MAP_SHARED, OBJT_DEVICE, kdev, foff );
|
||||
#else
|
||||
retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE,
|
||||
VM_PROT_ALL, MAP_SHARED, SLIST_FIRST(&kdev->si_hlist), foff );
|
||||
#endif
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
vaddr = p->l_proc->p_emul->e_vm_default_addr(p->l_proc,
|
||||
(vaddr_t)vms->vm_daddr, size);
|
||||
rsize = round_page(size);
|
||||
@ -1125,7 +1063,7 @@ int drm_mapbufs(DRM_IOCTL_ARGS)
|
||||
retcode = uvm_mmap(&vms->vm_map, &vaddr, rsize,
|
||||
UVM_PROT_READ | UVM_PROT_WRITE, UVM_PROT_ALL, MAP_SHARED,
|
||||
&vn->v_uobj, foff, p->l_proc->p_rlimit[RLIMIT_MEMLOCK].rlim_cur);
|
||||
#endif /* __NetBSD__ || __OpenBSD */
|
||||
|
||||
if (retcode)
|
||||
goto done;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_context.c,v 1.2 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_context.h -- IOCTLs for generic contexts -*- linux-c -*-
|
||||
* Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com
|
||||
*/
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_dma.c,v 1.4 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_dma.c -- DMA IOCTL and function support -*- linux-c -*-
|
||||
* Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com
|
||||
*/
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_drawable.c,v 1.2 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*-
|
||||
* Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
|
||||
*/
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_drv.c,v 1.7 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_drv.h -- Generic driver template -*- linux-c -*-
|
||||
* Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
|
||||
*/
|
||||
@ -51,22 +53,9 @@ static void drm_unload(drm_device_t *dev);
|
||||
static drm_pci_id_list_t *drm_find_description(int vendor, int device,
|
||||
drm_pci_id_list_t *idlist);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define DRIVER_SOFTC(unit) \
|
||||
((drm_device_t *)devclass_get_softc(drm_devclass, unit))
|
||||
|
||||
MODULE_VERSION(drm, 1);
|
||||
MODULE_DEPEND(drm, agp, 1, 1, 1);
|
||||
MODULE_DEPEND(drm, pci, 1, 1, 1);
|
||||
#if __FreeBSD_version > 502127
|
||||
MODULE_DEPEND(drm, mem, 1, 1, 1);
|
||||
#endif
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define DRIVER_SOFTC(unit) \
|
||||
(((unit)<DRM_MAXUNITS) ? drm_units[(unit)] : NULL)
|
||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
static drm_ioctl_desc_t drm_ioctls[256] = {
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { drm_version, 0 },
|
||||
@ -128,104 +117,6 @@ static drm_ioctl_desc_t drm_ioctls[256] = {
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = { drm_wait_vblank, 0 },
|
||||
};
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static struct cdevsw drm_cdevsw = {
|
||||
#if __FreeBSD_version >= 502103
|
||||
.d_version = D_VERSION,
|
||||
#endif
|
||||
.d_open = drm_open,
|
||||
.d_close = drm_close,
|
||||
.d_read = drm_read,
|
||||
.d_ioctl = drm_ioctl,
|
||||
.d_poll = drm_poll,
|
||||
.d_mmap = drm_mmap,
|
||||
.d_name = "drm",
|
||||
#if __FreeBSD_version >= 502103
|
||||
.d_flags = D_TRACKCLOSE | D_NEEDGIANT,
|
||||
#else
|
||||
.d_maj = 145,
|
||||
.d_flags = D_TRACKCLOSE,
|
||||
#endif
|
||||
#if __FreeBSD_version < 500000
|
||||
.d_bmaj = -1
|
||||
#endif
|
||||
};
|
||||
|
||||
int drm_probe(device_t dev, drm_pci_id_list_t *idlist)
|
||||
{
|
||||
drm_pci_id_list_t *id_entry;
|
||||
int vendor, device;
|
||||
#if __FreeBSD_version < 700010
|
||||
device_t realdev;
|
||||
|
||||
if (!strcmp(device_get_name(dev), "drmsub"))
|
||||
realdev = device_get_parent(dev);
|
||||
else
|
||||
realdev = dev;
|
||||
vendor = pci_get_vendor(realdev);
|
||||
device = pci_get_device(realdev);
|
||||
#else
|
||||
vendor = pci_get_vendor(dev);
|
||||
device = pci_get_device(dev);
|
||||
#endif
|
||||
|
||||
id_entry = drm_find_description(vendor, device, idlist);
|
||||
if (id_entry != NULL) {
|
||||
device_set_desc(dev, id_entry->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist)
|
||||
{
|
||||
drm_device_t *dev;
|
||||
drm_pci_id_list_t *id_entry;
|
||||
int unit;
|
||||
|
||||
unit = device_get_unit(nbdev);
|
||||
dev = device_get_softc(nbdev);
|
||||
|
||||
#if __FreeBSD_version < 700010
|
||||
if (!strcmp(device_get_name(nbdev), "drmsub"))
|
||||
dev->device = device_get_parent(nbdev);
|
||||
else
|
||||
dev->device = nbdev;
|
||||
#else
|
||||
dev->device = nbdev;
|
||||
#endif
|
||||
dev->devnode = make_dev(&drm_cdevsw,
|
||||
unit,
|
||||
DRM_DEV_UID,
|
||||
DRM_DEV_GID,
|
||||
DRM_DEV_MODE,
|
||||
"dri/card%d", unit);
|
||||
#if __FreeBSD_version >= 500000
|
||||
mtx_init(&dev->dev_lock, "drm device", NULL, MTX_DEF);
|
||||
#endif
|
||||
|
||||
id_entry = drm_find_description(pci_get_vendor(dev->device),
|
||||
pci_get_device(dev->device), idlist);
|
||||
dev->id_entry = id_entry;
|
||||
|
||||
return drm_load(dev);
|
||||
}
|
||||
|
||||
int drm_detach(device_t dev)
|
||||
{
|
||||
drm_unload(device_get_softc(dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef DRM_DEV_NAME
|
||||
#define DRM_DEV_NAME "drm"
|
||||
#endif
|
||||
|
||||
devclass_t drm_devclass;
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
const struct cdevsw drm_cdevsw = {
|
||||
drm_open,
|
||||
drm_close,
|
||||
@ -379,8 +270,6 @@ int drm_activate(struct device *self, enum devact act)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
drm_pci_id_list_t *drm_find_description(int vendor, int device,
|
||||
drm_pci_id_list_t *idlist)
|
||||
{
|
||||
@ -440,12 +329,7 @@ static int drm_firstopen(drm_device_t *dev)
|
||||
dev->context_flag = 0;
|
||||
dev->last_context = 0;
|
||||
dev->if_version = 0;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
dev->buf_sigio = NULL;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
dev->buf_pgid = 0;
|
||||
#endif
|
||||
|
||||
DRM_DEBUG( "\n" );
|
||||
|
||||
@ -456,12 +340,7 @@ static int drm_lastclose(drm_device_t *dev)
|
||||
{
|
||||
drm_magic_entry_t *pt, *next;
|
||||
drm_local_map_t *map;
|
||||
#ifdef __FreeBSD__
|
||||
drm_local_map_t *mapsave;
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
struct drm_file *filep;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
|
||||
@ -516,11 +395,6 @@ static int drm_lastclose(drm_device_t *dev)
|
||||
dev->sg = NULL;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
TAILQ_FOREACH_SAFE(map, &dev->maplist, link, mapsave) {
|
||||
drm_rmmap(dev, map);
|
||||
}
|
||||
#elif defined(__NetBSD__)
|
||||
while ((map = TAILQ_FIRST(&dev->maplist)) != NULL) {
|
||||
drm_rmmap(dev, map);
|
||||
}
|
||||
@ -534,7 +408,6 @@ static int drm_lastclose(drm_device_t *dev)
|
||||
DRM_DEBUG("WARNING: had to unmap resource %d\n", i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
drm_dma_takedown(dev);
|
||||
DRM_DEBUG( "\n" );
|
||||
@ -544,14 +417,12 @@ static int drm_lastclose(drm_device_t *dev)
|
||||
DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
|
||||
}
|
||||
|
||||
#ifdef __NetBSD__
|
||||
while ((filep = TAILQ_FIRST(&dev->files)) != NULL) {
|
||||
DRM_INFO("had to remove pid %d still in file list\n",
|
||||
(int) filep->pid);
|
||||
TAILQ_REMOVE(&dev->files, filep, link);
|
||||
free(filep, M_DRM);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -562,17 +433,6 @@ static int drm_load(drm_device_t *dev)
|
||||
|
||||
DRM_DEBUG( "\n" );
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
dev->irq = pci_get_irq(dev->device);
|
||||
/* XXX Fix domain number (alpha hoses) */
|
||||
dev->pci_domain = 0;
|
||||
dev->pci_bus = pci_get_bus(dev->device);
|
||||
dev->pci_slot = pci_get_slot(dev->device);
|
||||
dev->pci_func = pci_get_function(dev->device);
|
||||
|
||||
dev->pci_vendor = pci_get_vendor(dev->device);
|
||||
dev->pci_device = pci_get_device(dev->device);
|
||||
#elif defined(__NetBSD__)
|
||||
dev->irq = dev->pa.pa_intrline;
|
||||
dev->pci_domain = 0;
|
||||
dev->pci_bus = dev->pa.pa_bus;
|
||||
@ -581,7 +441,6 @@ static int drm_load(drm_device_t *dev)
|
||||
|
||||
dev->pci_vendor = PCI_VENDOR(dev->pa.pa_id);
|
||||
dev->pci_device = PCI_PRODUCT(dev->pa.pa_id);
|
||||
#endif
|
||||
|
||||
TAILQ_INIT(&dev->maplist);
|
||||
|
||||
@ -635,15 +494,7 @@ error:
|
||||
DRM_LOCK();
|
||||
drm_lastclose(dev);
|
||||
DRM_UNLOCK();
|
||||
#ifdef __FreeBSD__
|
||||
destroy_dev(dev->devnode);
|
||||
#if __FreeBSD_version >= 500000
|
||||
mtx_destroy(&dev->dev_lock);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
DRM_SPINUNINIT(&dev->dev_lock);
|
||||
#endif
|
||||
return retcode;
|
||||
}
|
||||
|
||||
@ -654,10 +505,6 @@ static void drm_unload(drm_device_t *dev)
|
||||
DRM_DEBUG( "\n" );
|
||||
|
||||
drm_sysctl_cleanup(dev);
|
||||
#ifdef __FreeBSD__
|
||||
destroy_dev(dev->devnode);
|
||||
#endif
|
||||
|
||||
drm_ctxbitmap_cleanup(dev);
|
||||
|
||||
#if !defined(DRM_NO_MTRR) && !defined(DRM_NO_AGP)
|
||||
@ -679,15 +526,6 @@ static void drm_unload(drm_device_t *dev)
|
||||
* lastclose and firstopen or unload) because these aren't actually
|
||||
* taking up KVA, just keeping the PCI resource allocated.
|
||||
*/
|
||||
#ifdef __FreeBSD__
|
||||
for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
|
||||
if (dev->pcir[i] == NULL)
|
||||
continue;
|
||||
bus_release_resource(dev->device, SYS_RES_MEMORY,
|
||||
dev->pcirid[i], dev->pcir[i]);
|
||||
dev->pcir[i] = NULL;
|
||||
}
|
||||
#elif defined(__NetBSD__)
|
||||
i = 0;
|
||||
|
||||
for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++)
|
||||
@ -698,7 +536,6 @@ static void drm_unload(drm_device_t *dev)
|
||||
dev->pci_map_data[i].size);
|
||||
dev->pci_map_data[i].mapped = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( dev->agp ) {
|
||||
free(dev->agp, M_DRM);
|
||||
@ -709,12 +546,7 @@ static void drm_unload(drm_device_t *dev)
|
||||
dev->driver.unload(dev);
|
||||
|
||||
drm_mem_uninit();
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
|
||||
mtx_destroy(&dev->dev_lock);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
DRM_SPINUNINIT(&dev->dev_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -757,18 +589,11 @@ int drm_open(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTCDEVPROC *p)
|
||||
|
||||
DRM_DEBUG( "open_count = %d\n", dev->open_count );
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
retcode = drm_open_helper(kdev, flags, fmt, p, dev);
|
||||
#elif defined(__NetBSD__)
|
||||
retcode = drm_open_helper(kdev, flags, fmt, p->l_proc, dev);
|
||||
#endif
|
||||
|
||||
if ( !retcode ) {
|
||||
atomic_inc( &dev->counts[_DRM_STAT_OPENS] );
|
||||
DRM_LOCK();
|
||||
#ifdef __FreeBSD__
|
||||
device_busy(dev->device);
|
||||
#endif
|
||||
if ( !dev->open_count++ )
|
||||
retcode = drm_firstopen(dev);
|
||||
DRM_UNLOCK();
|
||||
@ -789,13 +614,8 @@ int drm_close_pid(drm_device_t *dev, drm_file_t *priv, pid_t pid)
|
||||
* Begin inline drm_release
|
||||
*/
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
|
||||
DRM_CURRENTPID, (long)dev->device, dev->open_count );
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
|
||||
DRM_CURRENTPID, (long)&dev->device, dev->open_count);
|
||||
#endif
|
||||
|
||||
if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
|
||||
&& dev->lock.filp == filp) {
|
||||
@ -829,13 +649,8 @@ int drm_close_pid(drm_device_t *dev, drm_file_t *priv, pid_t pid)
|
||||
break; /* Got lock */
|
||||
}
|
||||
/* Contention */
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
|
||||
retcode = msleep((void *)&dev->lock.lock_queue,
|
||||
&dev->dev_lock, PZERO | PCATCH, "drmlk2", 0);
|
||||
#else
|
||||
retcode = mtsleep((void *)&dev->lock.lock_queue,
|
||||
PZERO | PCATCH, "drmlk2", 0, &dev->dev_lock);
|
||||
#endif
|
||||
if (retcode)
|
||||
break;
|
||||
}
|
||||
@ -869,39 +684,26 @@ int drm_close(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTCDEVPROC *p)
|
||||
|
||||
DRM_LOCK();
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
priv = drm_find_file_by_proc(dev, p);
|
||||
#elif defined(__NetBSD__)
|
||||
priv = drm_find_file_by_proc(dev, p->l_proc);
|
||||
#endif
|
||||
|
||||
if (!priv) {
|
||||
DRM_UNLOCK();
|
||||
DRM_ERROR("can't find authenticator\n");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* On NetBSD, close will only be called once */
|
||||
/* On NetBSD, close will only be called once (?) */
|
||||
DRM_DEBUG("setting priv->refs %d to 1\n", (int)priv->refs);
|
||||
priv->refs = 1;
|
||||
DRM_DEBUG("setting open_count %d to 1\n", (int)dev->open_count);
|
||||
dev->open_count = 1;
|
||||
#endif
|
||||
|
||||
retcode = drm_close_pid(dev, priv, DRM_CURRENTPID);
|
||||
|
||||
#if defined (__FreeBSD__) && (__FreeBSD_version >= 500000)
|
||||
funsetown(&dev->buf_sigio);
|
||||
#elif defined(__FreeBSD__)
|
||||
funsetown(dev->buf_sigio);
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
dev->buf_pgid = 0;
|
||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
|
||||
#ifdef __FreeBSD__
|
||||
device_unbusy(dev->device);
|
||||
#endif
|
||||
|
||||
if (--dev->open_count == 0) {
|
||||
retcode = drm_lastclose(dev);
|
||||
}
|
||||
@ -926,12 +728,9 @@ int drm_ioctl(DRM_CDEV kdev, u_long cmd, void *data, int flags,
|
||||
DRMFILE filp = (DRMFILE)(uintptr_t)DRM_CURRENTPID;
|
||||
|
||||
DRM_LOCK();
|
||||
#ifdef __FreeBSD__
|
||||
priv = drm_find_file_by_proc(dev, p);
|
||||
#elif defined(__NetBSD__)
|
||||
priv = drm_find_file_by_proc(dev, p->l_proc);
|
||||
#endif
|
||||
DRM_UNLOCK();
|
||||
|
||||
if (priv == NULL) {
|
||||
DRM_ERROR("can't find authenticator\n");
|
||||
return EINVAL;
|
||||
@ -940,32 +739,14 @@ int drm_ioctl(DRM_CDEV kdev, u_long cmd, void *data, int flags,
|
||||
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
|
||||
++priv->ioctl_count;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
|
||||
DRM_CURRENTPID, cmd, nr, (long)dev->device, priv->authenticated );
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
|
||||
DRM_CURRENTPID, cmd, nr, (long)&dev->device, priv->authenticated );
|
||||
#endif
|
||||
|
||||
switch (cmd) {
|
||||
case FIONBIO:
|
||||
case FIOASYNC:
|
||||
return 0;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
case FIOSETOWN:
|
||||
return fsetown(*(int *)data, &dev->buf_sigio);
|
||||
|
||||
case FIOGETOWN:
|
||||
#if (__FreeBSD_version >= 500000)
|
||||
*(int *) data = fgetown(&dev->buf_sigio);
|
||||
#else
|
||||
*(int *) data = fgetown(dev->buf_sigio);
|
||||
#endif
|
||||
return 0;
|
||||
#endif /* __FreeBSD__ */
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
case SIOCSPGRP:
|
||||
case TIOCSPGRP:
|
||||
case FIOSETOWN:
|
||||
@ -975,7 +756,6 @@ int drm_ioctl(DRM_CDEV kdev, u_long cmd, void *data, int flags,
|
||||
case TIOCGPGRP:
|
||||
case FIOGETOWN:
|
||||
return fgetown(p->l_proc, dev->buf_pgid, cmd, data);
|
||||
#endif /* __NetBSD__ */
|
||||
}
|
||||
|
||||
if (IOCGROUP(cmd) != DRM_IOCTL_BASE) {
|
||||
@ -1005,11 +785,7 @@ int drm_ioctl(DRM_CDEV kdev, u_long cmd, void *data, int flags,
|
||||
/* ioctl->master check should be against something in the filp set up
|
||||
* for the first opener, but it doesn't matter yet.
|
||||
*/
|
||||
#ifdef __FreeBSD__
|
||||
if (((ioctl->flags & DRM_ROOT_ONLY) && !DRM_SUSER(p)) ||
|
||||
#elif defined(__NetBSD__)
|
||||
if (((ioctl->flags & DRM_ROOT_ONLY) && !DRM_SUSER(p->l_proc)) ||
|
||||
#endif
|
||||
((ioctl->flags & DRM_AUTH) && !priv->authenticated) ||
|
||||
((ioctl->flags & DRM_MASTER) && !priv->master))
|
||||
return EACCES;
|
||||
@ -1025,44 +801,3 @@ int drm_ioctl(DRM_CDEV kdev, u_long cmd, void *data, int flags,
|
||||
|
||||
return DRM_ERR(retcode);
|
||||
}
|
||||
|
||||
|
||||
#if DRM_LINUX
|
||||
|
||||
#include <sys/sysproto.h>
|
||||
|
||||
MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
|
||||
|
||||
#define LINUX_IOCTL_DRM_MIN 0x6400
|
||||
#define LINUX_IOCTL_DRM_MAX 0x64ff
|
||||
|
||||
static linux_ioctl_function_t drm_linux_ioctl;
|
||||
static struct linux_ioctl_handler drm_handler = {drm_linux_ioctl,
|
||||
LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX};
|
||||
|
||||
SYSINIT(drm_register, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
linux_ioctl_register_handler, &drm_handler);
|
||||
SYSUNINIT(drm_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
linux_ioctl_unregister_handler, &drm_handler);
|
||||
|
||||
/* The bits for in/out are switched on Linux */
|
||||
#define LINUX_IOC_IN IOC_OUT
|
||||
#define LINUX_IOC_OUT IOC_IN
|
||||
|
||||
static int
|
||||
drm_linux_ioctl(DRM_STRUCTPROC *p, struct linux_ioctl_args* args)
|
||||
{
|
||||
int error;
|
||||
int cmd = args->cmd;
|
||||
|
||||
args->cmd &= ~(LINUX_IOC_IN | LINUX_IOC_OUT);
|
||||
if (cmd & LINUX_IOC_IN)
|
||||
args->cmd |= IOC_IN;
|
||||
if (cmd & LINUX_IOC_OUT)
|
||||
args->cmd |= IOC_OUT;
|
||||
|
||||
error = ioctl(p, (struct ioctl_args *)args);
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif /* DRM_LINUX */
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_fops.c,v 1.3 2007/11/21 19:22:12 bjs Exp $ */
|
||||
|
||||
/* drm_fops.h -- File operations for DRM -*- linux-c -*-
|
||||
* Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com
|
||||
*/
|
||||
@ -42,16 +44,8 @@ __FBSDID("$FreeBSD: src/sys/dev/drm/drm_fops.c,v 1.2 2005/11/28 23:13:52 anholt
|
||||
drm_file_t *drm_find_file_by_proc(drm_device_t *dev, DRM_STRUCTPROC *p)
|
||||
{
|
||||
int restart = 1;
|
||||
#if __FreeBSD_version >= 500021
|
||||
uid_t uid = p->td_ucred->cr_svuid;
|
||||
pid_t pid = p->td_proc->p_pid;
|
||||
#elif defined(__NetBSD__)
|
||||
uid_t uid = kauth_cred_getsvuid(p->p_cred);
|
||||
pid_t pid = p->p_pid;
|
||||
#else
|
||||
uid_t uid = p->p_cred->p_svuid;
|
||||
pid_t pid = p->p_pid;
|
||||
#endif
|
||||
drm_file_t *priv;
|
||||
|
||||
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
|
||||
@ -59,7 +53,7 @@ drm_file_t *drm_find_file_by_proc(drm_device_t *dev, DRM_STRUCTPROC *p)
|
||||
while (restart) {
|
||||
restart = 0;
|
||||
TAILQ_FOREACH(priv, &dev->files, link) {
|
||||
#ifdef __NetBSD__
|
||||
|
||||
/* if the process disappeared, free the resources
|
||||
* NetBSD only calls drm_close once, so this frees
|
||||
* resources earlier.
|
||||
@ -70,7 +64,6 @@ drm_file_t *drm_find_file_by_proc(drm_device_t *dev, DRM_STRUCTPROC *p)
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (priv->pid == pid && priv->uid == uid)
|
||||
return priv;
|
||||
}
|
||||
@ -102,17 +95,8 @@ int drm_open_helper(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
#if __FreeBSD_version >= 500000
|
||||
priv->uid = p->td_ucred->cr_svuid;
|
||||
priv->pid = p->td_proc->p_pid;
|
||||
#elif defined(__NetBSD__)
|
||||
priv->uid = kauth_cred_getsvuid(p->p_cred);
|
||||
priv->pid = p->p_pid;
|
||||
#else
|
||||
priv->uid = p->p_cred->p_svuid;
|
||||
priv->pid = p->p_pid;
|
||||
#endif
|
||||
|
||||
priv->refs = 1;
|
||||
priv->minor = m;
|
||||
priv->ioctl_count = 0;
|
||||
@ -135,9 +119,6 @@ int drm_open_helper(DRM_CDEV kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||
TAILQ_INSERT_TAIL(&dev->files, priv, link);
|
||||
}
|
||||
DRM_UNLOCK();
|
||||
#ifdef __FreeBSD__
|
||||
kdev->si_drv1 = dev;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_ioctl.c,v 1.2 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/* drm_ioctl.h -- IOCTL processing for DRM -*- linux-c -*-
|
||||
* Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com
|
||||
*/
|
||||
@ -71,9 +73,7 @@ int drm_setunique(DRM_IOCTL_ARGS)
|
||||
drm_unique_t u;
|
||||
int domain = 0, bus = 0, slot = 0, func = 0, ret = 0;
|
||||
char *busid;
|
||||
#ifdef __NetBSD__
|
||||
return EOPNOTSUPP;
|
||||
#endif
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL( u, (drm_unique_t *)data, sizeof(u) );
|
||||
|
||||
@ -94,9 +94,7 @@ int drm_setunique(DRM_IOCTL_ARGS)
|
||||
/* Return error if the busid submitted doesn't match the device's actual
|
||||
* busid.
|
||||
*/
|
||||
#ifdef __FreeBSD__
|
||||
ret = sscanf(busid, "PCI:%d:%d:%d", &bus, &slot, &func);
|
||||
#endif
|
||||
|
||||
if (ret != 3) {
|
||||
free(busid, M_DRM);
|
||||
return DRM_ERR(EINVAL);
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_irq.c,v 1.5 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/* drm_irq.c -- IRQ IOCTL and function support
|
||||
* Created: Fri Oct 18 2003 by anholt@FreeBSD.org
|
||||
*/
|
||||
@ -59,19 +61,6 @@ int drm_irq_by_busid(DRM_IOCTL_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
|
||||
static irqreturn_t
|
||||
drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
||||
{
|
||||
drm_device_t *dev = (drm_device_t *)arg;
|
||||
|
||||
DRM_SPINLOCK(&dev->irq_lock);
|
||||
dev->driver.irq_handler(arg);
|
||||
DRM_SPINUNLOCK(&dev->irq_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
static irqreturn_t
|
||||
drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
||||
{
|
||||
@ -83,15 +72,12 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
||||
DRM_SPINUNLOCK(&dev->irq_lock);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int drm_irq_install(drm_device_t *dev)
|
||||
{
|
||||
int retcode;
|
||||
#ifdef __NetBSD__
|
||||
pci_intr_handle_t ih;
|
||||
const char *istr;
|
||||
#endif
|
||||
|
||||
if (dev->irq == 0 || dev->dev_private == NULL)
|
||||
return DRM_ERR(EINVAL);
|
||||
@ -110,28 +96,11 @@ int drm_irq_install(drm_device_t *dev)
|
||||
DRM_SPININIT(&dev->irq_lock, "DRM IRQ lock");
|
||||
|
||||
/* Before installing handler */
|
||||
|
||||
dev->driver.irq_preinstall(dev);
|
||||
DRM_UNLOCK();
|
||||
|
||||
/* Install handler */
|
||||
#ifdef __FreeBSD__
|
||||
dev->irqrid = 0;
|
||||
dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ,
|
||||
&dev->irqrid, RF_SHAREABLE);
|
||||
if (!dev->irqr) {
|
||||
retcode = ENOENT;
|
||||
goto err;
|
||||
}
|
||||
#if __FreeBSD_version < 500000
|
||||
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
|
||||
dev->irq_handler, dev, &dev->irqh);
|
||||
#else
|
||||
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY | INTR_MPSAFE,
|
||||
drm_irq_handler_wrap, dev, &dev->irqh);
|
||||
#endif
|
||||
if (retcode != 0)
|
||||
goto err;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if (pci_intr_map(&dev->pa, &ih) != 0) {
|
||||
retcode = ENOENT;
|
||||
goto err;
|
||||
@ -144,7 +113,6 @@ int drm_irq_install(drm_device_t *dev)
|
||||
goto err;
|
||||
}
|
||||
aprint_normal("%s: interrupting at %s\n", dev->device.dv_xname, istr);
|
||||
#endif
|
||||
|
||||
/* After installing handler */
|
||||
DRM_LOCK();
|
||||
@ -155,13 +123,6 @@ int drm_irq_install(drm_device_t *dev)
|
||||
err:
|
||||
DRM_LOCK();
|
||||
dev->irq_enabled = 0;
|
||||
#ifdef ___FreeBSD__
|
||||
if (dev->irqrid != 0) {
|
||||
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid,
|
||||
dev->irqr);
|
||||
dev->irqrid = 0;
|
||||
}
|
||||
#endif
|
||||
DRM_SPINUNINIT(&dev->irq_lock);
|
||||
DRM_UNLOCK();
|
||||
return retcode;
|
||||
@ -169,31 +130,16 @@ err:
|
||||
|
||||
int drm_irq_uninstall(drm_device_t *dev)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
int irqrid;
|
||||
#endif
|
||||
|
||||
if (!dev->irq_enabled)
|
||||
return DRM_ERR(EINVAL);
|
||||
|
||||
dev->irq_enabled = 0;
|
||||
#ifdef __FreeBSD__
|
||||
irqrid = dev->irqrid;
|
||||
dev->irqrid = 0;
|
||||
#endif
|
||||
|
||||
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
|
||||
|
||||
dev->driver.irq_uninstall(dev);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRM_UNLOCK();
|
||||
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
|
||||
bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
|
||||
DRM_LOCK();
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
pci_intr_disestablish(dev->pa.pa_pc, dev->irqh);
|
||||
#endif
|
||||
DRM_SPINUNINIT(&dev->irq_lock);
|
||||
|
||||
return 0;
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_linux_list.h,v 1.2 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/* drm_linux_list.h -- linux list functions for the BSDs.
|
||||
* Created: Mon Apr 7 14:30:16 1999 by anholt@FreeBSD.org
|
||||
*/
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_lock.c,v 1.3 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/* lock.c -- IOCTLs for locking -*- linux-c -*-
|
||||
* Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
|
||||
*/
|
||||
@ -130,13 +132,8 @@ int drm_lock(DRM_IOCTL_ARGS)
|
||||
}
|
||||
|
||||
/* Contention */
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
|
||||
ret = msleep((void *)&dev->lock.lock_queue, &dev->dev_lock,
|
||||
PZERO | PCATCH, "drmlk2", 0);
|
||||
#else
|
||||
ret = mtsleep((void *)&dev->lock.lock_queue, PZERO | PCATCH,
|
||||
"drmlk2", 0, &dev->dev_lock);
|
||||
#endif
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_memory.c,v 1.4 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*-
|
||||
* Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com
|
||||
*/
|
||||
@ -42,11 +44,9 @@ MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures");
|
||||
|
||||
void drm_mem_init(void)
|
||||
{
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/*
|
||||
malloc_type_attach(M_DRM);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
void drm_mem_uninit(void)
|
||||
@ -84,9 +84,6 @@ void drm_free(void *pt, size_t size, int area)
|
||||
|
||||
void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
return pmap_mapdev(map->offset, map->size);
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int i, reg, reason;
|
||||
for(i = 0; i<DRM_MAX_PCI_RESOURCE; i++) {
|
||||
reg = PCI_MAPREG_START + i*4;
|
||||
@ -164,14 +161,10 @@ void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map)
|
||||
DRM_DEBUG("drm_ioremap failed: offset=%lx size=%lu\n",
|
||||
map->offset, map->size);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void drm_ioremapfree(drm_local_map_t *map)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
pmap_unmapdev((vm_offset_t) map->handle, map->size);
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if (map->cnt == NULL) {
|
||||
DRM_INFO("drm_ioremapfree called for unknown map\n");
|
||||
return;
|
||||
@ -181,38 +174,8 @@ void drm_ioremapfree(drm_local_map_t *map)
|
||||
if(*(map->cnt) == 0)
|
||||
bus_space_unmap(map->bst, map->bsh, map->mapsize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
int
|
||||
drm_mtrr_add(unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
int act;
|
||||
struct mem_range_desc mrdesc;
|
||||
|
||||
mrdesc.mr_base = offset;
|
||||
mrdesc.mr_len = size;
|
||||
mrdesc.mr_flags = flags;
|
||||
act = MEMRANGE_SET_UPDATE;
|
||||
strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
|
||||
return mem_range_attr_set(&mrdesc, &act);
|
||||
}
|
||||
|
||||
int
|
||||
drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
int act;
|
||||
struct mem_range_desc mrdesc;
|
||||
|
||||
mrdesc.mr_base = offset;
|
||||
mrdesc.mr_len = size;
|
||||
mrdesc.mr_flags = flags;
|
||||
act = MEMRANGE_SET_REMOVE;
|
||||
strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
|
||||
return mem_range_attr_set(&mrdesc, &act);
|
||||
}
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int
|
||||
drm_mtrr_add(unsigned long offset, size_t size, int flags)
|
||||
{
|
||||
@ -248,4 +211,3 @@ drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1,11 +1,6 @@
|
||||
/**
|
||||
* \file drm_pci.h
|
||||
* \brief PCI consistent, DMA-accessible memory functions.
|
||||
*
|
||||
* \author Eric Anholt <anholt@FreeBSD.org>
|
||||
*/
|
||||
/* $NetBSD: drm_pci.c,v 1.5 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/*-
|
||||
/*
|
||||
* Copyright 2003 Eric Anholt.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
@ -35,36 +30,25 @@ __FBSDID("$FreeBSD: src/sys/dev/drm/drm_pci.c,v 1.2 2005/11/28 23:13:52 anholt E
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name PCI memory */
|
||||
/*@{*/
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static void
|
||||
drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
|
||||
{
|
||||
drm_dma_handle_t *dmah = arg;
|
||||
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
KASSERT(nsegs == 1, ("drm_pci_busdma_callback: bad dma segment count"));
|
||||
dmah->busaddr = segs[0].ds_addr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Allocate a physically contiguous DMA-accessible consistent
|
||||
/* What might happen in age of Aquarius:
|
||||
*
|
||||
*
|
||||
* Allocate a physically contiguous DMA-accessible consistent
|
||||
* memory block.
|
||||
*/
|
||||
|
||||
/* NetBSD reality:
|
||||
*
|
||||
* XXX We must fix this mess! This is a horrible misuse of bus_dma(9),
|
||||
* and I am surprised it works at all.
|
||||
*/
|
||||
|
||||
drm_dma_handle_t *
|
||||
drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
|
||||
{
|
||||
drm_dma_handle_t *dmah;
|
||||
int ret;
|
||||
#ifdef __NetBSD__
|
||||
int nsegs;
|
||||
#endif
|
||||
|
||||
/* Need power-of-two alignment, so fail the allocation if it isn't. */
|
||||
if ((align & (align - 1)) != 0) {
|
||||
@ -77,35 +61,6 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
|
||||
if (dmah == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
ret = bus_dma_tag_create(NULL, align, 0, /* tag, align, boundary */
|
||||
maxaddr, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
|
||||
NULL, NULL, /* filtfunc, filtfuncargs */
|
||||
size, 1, size, /* maxsize, nsegs, maxsegsize */
|
||||
BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */
|
||||
&dmah->tag);
|
||||
if (ret != 0) {
|
||||
free(dmah, M_DRM);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, BUS_DMA_NOWAIT,
|
||||
&dmah->map);
|
||||
if (ret != 0) {
|
||||
bus_dma_tag_destroy(dmah->tag);
|
||||
free(dmah, M_DRM);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, size,
|
||||
drm_pci_busdma_callback, dmah, 0);
|
||||
if (ret != 0) {
|
||||
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
|
||||
bus_dma_tag_destroy(dmah->tag);
|
||||
free(dmah, M_DRM);
|
||||
return NULL;
|
||||
}
|
||||
#elif defined(__NetBSD__)
|
||||
ret = bus_dmamem_alloc(dev->pa.pa_dmat, size, align, 0,
|
||||
&dmah->seg, 1, &nsegs, BUS_DMA_NOWAIT);
|
||||
if (ret != 0) {
|
||||
@ -134,28 +89,21 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
|
||||
|
||||
dmah->busaddr = dmah->seg.ds_addr;
|
||||
dmah->vaddr = dmah->addr;
|
||||
#endif
|
||||
|
||||
return dmah;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Free a DMA-accessible consistent memory block.
|
||||
/*
|
||||
* Free a DMA-accessible consistent memory block.
|
||||
*/
|
||||
|
||||
void
|
||||
drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah)
|
||||
{
|
||||
if (dmah == NULL)
|
||||
return;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
|
||||
bus_dma_tag_destroy(dmah->tag);
|
||||
#elif defined(__NetBSD__)
|
||||
bus_dmamem_free(dev->pa.pa_dmat, &dmah->seg, 1);
|
||||
#endif
|
||||
|
||||
free(dmah, M_DRM);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_sarea.h,v 1.2 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/**
|
||||
* \file drm_sarea.h
|
||||
* \brief SAREA definitions
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_scatter.c,v 1.2 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/* drm_scatter.h -- IOCTLs to manage scatter/gather memory -*- linux-c -*-
|
||||
* Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com */
|
||||
/*-
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_sysctl.c,v 1.2 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright 2003 Eric Anholt
|
||||
* All Rights Reserved.
|
||||
@ -48,69 +50,22 @@ struct drm_sysctl_list {
|
||||
#define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0]))
|
||||
|
||||
struct drm_sysctl_info {
|
||||
#ifdef __FreeBSD__
|
||||
struct sysctl_ctx_list ctx;
|
||||
#elif defined __NetBSD__
|
||||
const struct sysctlnode *dri, *dri_card, *dri_debug;
|
||||
const struct sysctlnode *dri_rest[DRM_SYSCTL_ENTRIES];
|
||||
#endif
|
||||
char name[7];
|
||||
};
|
||||
|
||||
int drm_sysctl_init(drm_device_t *dev)
|
||||
{
|
||||
struct drm_sysctl_info *info;
|
||||
#ifdef __FreeBSD__
|
||||
struct sysctl_oid *oid;
|
||||
struct sysctl_oid *top, *drioid;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
info = malloc(sizeof *info, M_DRM, M_WAITOK | M_ZERO);
|
||||
if ( !info )
|
||||
return 1;
|
||||
|
||||
dev->sysctl = info;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/* Add the sysctl node for DRI if it doesn't already exist */
|
||||
drioid = SYSCTL_ADD_NODE( &info->ctx, &sysctl__hw_children, OID_AUTO, "dri", CTLFLAG_RW, NULL, "DRI Graphics");
|
||||
if (!drioid)
|
||||
return 1;
|
||||
|
||||
/* Find the next free slot under hw.dri */
|
||||
i = 0;
|
||||
SLIST_FOREACH(oid, SYSCTL_CHILDREN(drioid), oid_link) {
|
||||
if (i <= oid->oid_arg2)
|
||||
i = oid->oid_arg2 + 1;
|
||||
}
|
||||
if (i>9)
|
||||
return 1;
|
||||
|
||||
/* Add the hw.dri.x for our device */
|
||||
info->name[0] = '0' + i;
|
||||
info->name[1] = 0;
|
||||
top = SYSCTL_ADD_NODE( &info->ctx, SYSCTL_CHILDREN(drioid), OID_AUTO, info->name, CTLFLAG_RW, NULL, NULL);
|
||||
if (!top)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) {
|
||||
oid = SYSCTL_ADD_OID(&info->ctx,
|
||||
SYSCTL_CHILDREN(top),
|
||||
OID_AUTO,
|
||||
drm_sysctl_list[i].name,
|
||||
CTLTYPE_INT | CTLFLAG_RD,
|
||||
dev,
|
||||
0,
|
||||
drm_sysctl_list[i].f,
|
||||
"A",
|
||||
NULL);
|
||||
if (!oid)
|
||||
return 1;
|
||||
}
|
||||
SYSCTL_ADD_INT(&info->ctx, SYSCTL_CHILDREN(top), OID_AUTO, "debug",
|
||||
CTLFLAG_RW, &drm_debug_flag, sizeof(drm_debug_flag),
|
||||
"Enable debugging output");
|
||||
#elif defined(__NetBSD__)
|
||||
sysctl_createv(NULL, 0, NULL, &info->dri,
|
||||
CTLFLAG_READWRITE, CTLTYPE_NODE,
|
||||
"dri", SYSCTL_DESCR("DRI Graphics"), NULL, 0, NULL, 0,
|
||||
@ -135,17 +90,11 @@ int drm_sysctl_init(drm_device_t *dev)
|
||||
NULL, 0,
|
||||
&drm_debug_flag, sizeof(drm_debug_flag),
|
||||
CTL_HW, info->dri->sysctl_num, CTL_CREATE);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drm_sysctl_cleanup(drm_device_t *dev)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
int error;
|
||||
error = sysctl_ctx_free( &dev->sysctl->ctx );
|
||||
#elif defined(__NetBSD__)
|
||||
int i, error = 0;
|
||||
|
||||
sysctl_destroyv(NULL, CTL_HW, dev->sysctl->dri->sysctl_num,
|
||||
@ -160,7 +109,6 @@ int drm_sysctl_cleanup(drm_device_t *dev)
|
||||
dev->sysctl->dri_card->sysctl_num,
|
||||
CTL_DESTROY);
|
||||
sysctl_destroyv(NULL, CTL_HW, dev->sysctl->dri->sysctl_num, CTL_DESTROY);
|
||||
#endif
|
||||
|
||||
free(dev->sysctl, M_DRM);
|
||||
dev->sysctl = NULL;
|
||||
@ -168,10 +116,8 @@ int drm_sysctl_cleanup(drm_device_t *dev)
|
||||
return error;
|
||||
}
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define SYSCTL_OUT(x, y, z) \
|
||||
(len+=z,(len<*oldlenp)?(strcat((char*)oldp, y),0):EOVERFLOW)
|
||||
#endif
|
||||
|
||||
#define DRM_SYSCTL_PRINT(fmt, arg...) \
|
||||
do { \
|
||||
@ -183,26 +129,16 @@ do { \
|
||||
|
||||
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
drm_device_t *dev = arg1;
|
||||
#elif defined(__NetBSD__)
|
||||
int len = 0;
|
||||
drm_device_t *dev = rnode->sysctl_data;
|
||||
#endif
|
||||
char buf[128];
|
||||
int retcode;
|
||||
int hasunique = 0;
|
||||
|
||||
#ifdef __NetBSD__
|
||||
if(oldp == NULL) return EINVAL;
|
||||
*((char*)oldp) = '\0';
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRM_SYSCTL_PRINT("%s 0x%x", dev->driver.name, dev2udev(dev->devnode));
|
||||
#elif defined(__NetBSD__)
|
||||
DRM_SYSCTL_PRINT("%s", dev->driver.name);
|
||||
#endif
|
||||
|
||||
DRM_LOCK();
|
||||
if (dev->unique) {
|
||||
@ -222,12 +158,8 @@ done:
|
||||
|
||||
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
drm_device_t *dev = arg1;
|
||||
#elif defined(__NetBSD__)
|
||||
int len = 0;
|
||||
drm_device_t *dev = rnode->sysctl_data;
|
||||
#endif
|
||||
drm_local_map_t *map, *tempmaps;
|
||||
const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
|
||||
const char *type, *yesno;
|
||||
@ -235,10 +167,8 @@ static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
|
||||
char buf[128];
|
||||
int retcode;
|
||||
|
||||
#ifdef __NetBSD__
|
||||
if(oldp == NULL) return EINVAL;
|
||||
*((char*)oldp) = '\0';
|
||||
#endif
|
||||
|
||||
/* We can't hold the lock while doing SYSCTL_OUTs, so allocate a
|
||||
* temporary copy of all the map entries and then SYSCTL_OUT that.
|
||||
@ -291,12 +221,8 @@ done:
|
||||
|
||||
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
drm_device_t *dev = arg1;
|
||||
#elif defined(__NetBSD__)
|
||||
int len = 0;
|
||||
drm_device_t *dev = rnode->sysctl_data;
|
||||
#endif
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_device_dma_t tempdma;
|
||||
int *templists;
|
||||
@ -304,10 +230,8 @@ static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
|
||||
char buf[128];
|
||||
int retcode;
|
||||
|
||||
#ifdef __NetBSD__
|
||||
if(oldp == NULL) return EINVAL;
|
||||
*((char*)oldp) = '\0';
|
||||
#endif
|
||||
|
||||
/* We can't hold the locks around DRM_SYSCTL_PRINT, so make a temporary
|
||||
* copy of the whole structure and the relevant data from buflist.
|
||||
@ -357,21 +281,15 @@ done:
|
||||
|
||||
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
drm_device_t *dev = arg1;
|
||||
#elif defined(__NetBSD__)
|
||||
int len = 0;
|
||||
drm_device_t *dev = rnode->sysctl_data;
|
||||
#endif
|
||||
drm_file_t *priv, *tempprivs;
|
||||
char buf[128];
|
||||
int retcode;
|
||||
int privcount, i;
|
||||
|
||||
#ifdef __NetBSD__
|
||||
if(oldp == NULL) return EINVAL;
|
||||
*((char*)oldp) = '\0';
|
||||
#endif
|
||||
|
||||
DRM_LOCK();
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: drm_vm.c,v 1.5 2007/11/21 19:22:13 bjs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright 2003 Eric Anholt
|
||||
* All Rights Reserved.
|
||||
@ -29,24 +31,15 @@ __FBSDID("$FreeBSD: src/sys/dev/drm/drm_vm.c,v 1.2 2005/11/28 23:13:53 anholt Ex
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||
int drm_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr,
|
||||
int prot)
|
||||
#elif defined(__FreeBSD__)
|
||||
int drm_mmap(dev_t kdev, vm_offset_t offset, int prot)
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/* WARNING: pure, unadulterated EVIL ahead! */
|
||||
|
||||
paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||
#endif
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_local_map_t *map;
|
||||
drm_file_t *priv;
|
||||
drm_map_type_t type;
|
||||
#ifdef __FreeBSD__
|
||||
vm_paddr_t phys;
|
||||
#else
|
||||
paddr_t phys;
|
||||
#endif
|
||||
|
||||
DRM_LOCK();
|
||||
priv = drm_find_file_by_proc(dev, DRM_CURPROC);
|
||||
@ -68,16 +61,10 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||
unsigned long page = offset >> PAGE_SHIFT;
|
||||
unsigned long pphys = dma->pagelist[page];
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||
*paddr = phys;
|
||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||
return 0;
|
||||
#else
|
||||
#ifdef macppc
|
||||
return pphys;
|
||||
#else
|
||||
return atop(pphys);
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||
@ -119,11 +106,7 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||
phys = offset;
|
||||
break;
|
||||
case _DRM_CONSISTENT:
|
||||
#ifdef __FreeBSD__
|
||||
phys = vtophys((char *)map->handle + (offset - map->offset));
|
||||
#else
|
||||
phys = vtophys((paddr_t)map->handle + (offset - map->offset));
|
||||
#endif
|
||||
break;
|
||||
case _DRM_SCATTER_GATHER:
|
||||
case _DRM_SHM:
|
||||
@ -134,15 +117,10 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||
return -1; /* This should never happen. */
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||
*paddr = phys;
|
||||
return 0;
|
||||
#else
|
||||
#ifdef macppc
|
||||
return phys;
|
||||
#else
|
||||
return atop(phys);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user