diff options
author | Eric Anholt <anholt@freebsd.org> | 2004-11-06 23:02:07 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2004-11-06 23:02:07 +0000 |
commit | cb5aaa89871c051098ae8067d0e386840b7bdc59 (patch) | |
tree | 240423a7c804efe8c9d4c6fdde2b40b9e7eb15fa /shared-core/i915_dma.c | |
parent | 7ddbd38dde5dc5566ba14f2b1c449611a6d0224f (diff) |
Convert more drivers for bsd-core, moving the ioctl definitions to shared
code. Remove the "drv" from sisdrv, as it's unnecessary. Use the
drm_pci functions in i915 instead of per-os implementations of the
same. Avoid whitespace within fields in drm_pciids.txt (one of the r300
definitions), since it breaks the bsd pciids script. Tested on sis,
mga, r128. i915 needs more work.
Diffstat (limited to 'shared-core/i915_dma.c')
-rw-r--r-- | shared-core/i915_dma.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index 1c524968..c46ef9d6 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -12,6 +12,23 @@ #include "i915_drm.h" #include "i915_drv.h" +drm_ioctl_desc_t i915_ioctls[] = { + [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1}, + [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1}, + [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0}, + [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1}, + [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0} +}; + +int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); + static inline void i915_print_status_page(drm_device_t * dev) { drm_i915_private_t *dev_priv = dev->dev_private; @@ -94,15 +111,8 @@ int i915_dma_cleanup(drm_device_t * dev) } if (dev_priv->hw_status_page) { -#ifdef __FreeBSD__ -#if __FreeBSD_version > 500000 - contigfree(dev_priv->hw_status_page, PAGE_SIZE, M_DRM); -#endif -#else - pci_free_consistent(dev->pdev, PAGE_SIZE, - dev_priv->hw_status_page, - dev_priv->dma_status_page); -#endif + drm_pci_free(dev, PAGE_SIZE, dev_priv->hw_status_page, + dev_priv->dma_status_page); /* Need to rewrite hardware status page */ I915_WRITE(0x02080, 0x1ffff000); } @@ -179,15 +189,8 @@ static int i915_initialize(drm_device_t * dev, dev_priv->allow_batchbuffer = 1; /* Program Hardware Status Page */ -#ifdef __FreeBSD__ - dev_priv->hw_status_page = - contigmalloc(PAGE_SIZE, M_DRM, M_NOWAIT, 0ul, 0, 0, 0); - dev_priv->dma_status_page = vtophys(dev_priv->hw_status_page); -#else - dev_priv->hw_status_page = - pci_alloc_consistent(dev->pdev, PAGE_SIZE, - &dev_priv->dma_status_page); -#endif + dev_priv->hw_status_page = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, + 0xffffffff, &dev_priv->dma_status_page); if (!dev_priv->hw_status_page) { dev->dev_private = (void *)dev_priv; |