From cb5aaa89871c051098ae8067d0e386840b7bdc59 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 6 Nov 2004 23:02:07 +0000 Subject: 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. --- shared-core/drm_pciids.txt | 4 ++-- shared-core/i915_dma.c | 39 +++++++++++++++++++++------------------ shared-core/mach64_state.c | 19 +++++++++++++++++++ shared-core/mga_state.c | 15 +++++++++++++++ shared-core/sis_mm.c | 11 +++++++++++ 5 files changed, 68 insertions(+), 20 deletions(-) (limited to 'shared-core') diff --git a/shared-core/drm_pciids.txt b/shared-core/drm_pciids.txt index 0ec9e7ee..11fcb39a 100644 --- a/shared-core/drm_pciids.txt +++ b/shared-core/drm_pciids.txt @@ -19,7 +19,7 @@ 0x1002 0x4C65 CHIP_R250|CHIP_IS_MOBILITY "ATI Radeon Le R250 Mobility 9000 M9" 0x1002 0x4C66 CHIP_R250|CHIP_IS_MOBILITY "ATI Radeon Lf R250 Mobility 9000 M9" 0x1002 0x4C67 CHIP_R250|CHIP_IS_MOBILITY "ATI Radeon Lg R250 Mobility 9000 M9" -0x1002 0x4E50 CHIP_RV350 | CHIP_IS_MOBILITY "ATI Radeon RV300 Mobility 9600 M10" +0x1002 0x4E50 CHIP_RV350|CHIP_IS_MOBILITY "ATI Radeon RV300 Mobility 9600 M10" 0x1002 0x5144 CHIP_R100|CHIP_SINGLE_CRTC "ATI Radeon QD R100" 0x1002 0x5145 CHIP_R100|CHIP_SINGLE_CRTC "ATI Radeon QE R100" 0x1002 0x5146 CHIP_R100|CHIP_SINGLE_CRTC "ATI Radeon QF R100" @@ -125,7 +125,7 @@ 0x1002 0x4c4d 0 "Rage Mobility P/M AGP 2X" 0x1002 0x4c4e 0 "Rage Mobility L AGP 2X" -[sisdrv] +[sis] 0x1039 0x0300 0 "SiS 300/305" 0x1039 0x5300 0 "SiS 540" 0x1039 0x6300 0 "SiS 630" 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; diff --git a/shared-core/mach64_state.c b/shared-core/mach64_state.c index 2d3c4f61..dbd38c87 100644 --- a/shared-core/mach64_state.c +++ b/shared-core/mach64_state.c @@ -34,6 +34,25 @@ #include "mach64_drm.h" #include "mach64_drv.h" +/* Interface history: + * + * 1.0 - Initial mach64 DRM + * + */ +drm_ioctl_desc_t mach64_ioctls[] = { + [DRM_IOCTL_NR(DRM_MACH64_INIT)] = {mach64_dma_init, 1, 1}, + [DRM_IOCTL_NR(DRM_MACH64_CLEAR)] = {mach64_dma_clear, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_SWAP)] = {mach64_dma_swap, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_IDLE)] = {mach64_dma_idle, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_RESET)] = {mach64_engine_reset, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_VERTEX)] = {mach64_dma_vertex, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_BLIT)] = {mach64_dma_blit, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_FLUSH)] = {mach64_dma_flush, 1, 0}, + [DRM_IOCTL_NR(DRM_MACH64_GETPARAM)] = {mach64_get_param, 1, 0}, +}; + +int mach64_max_ioctl = DRM_ARRAY_SIZE(mach64_ioctls); + /* ================================================================ * DMA hardware state programming functions */ diff --git a/shared-core/mga_state.c b/shared-core/mga_state.c index 558beed1..b529f6ce 100644 --- a/shared-core/mga_state.c +++ b/shared-core/mga_state.c @@ -37,6 +37,21 @@ #include "mga_drm.h" #include "mga_drv.h" +drm_ioctl_desc_t mga_ioctls[] = { + [DRM_IOCTL_NR(DRM_MGA_INIT)] = {mga_dma_init, 1, 1}, + [DRM_IOCTL_NR(DRM_MGA_FLUSH)] = {mga_dma_flush, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_RESET)] = {mga_dma_reset, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_SWAP)] = {mga_dma_swap, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_CLEAR)] = {mga_dma_clear, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_VERTEX)] = {mga_dma_vertex, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_INDICES)] = {mga_dma_indices, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_ILOAD)] = {mga_dma_iload, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_BLIT)] = {mga_dma_blit, 1, 0}, + [DRM_IOCTL_NR(DRM_MGA_GETPARAM)] = {mga_getparam, 1, 0}, +}; + +int mga_max_ioctl = DRM_ARRAY_SIZE(mga_ioctls); + /* ================================================================ * DMA hardware state programming functions */ diff --git a/shared-core/sis_mm.c b/shared-core/sis_mm.c index 7b0a2a43..497f2026 100644 --- a/shared-core/sis_mm.c +++ b/shared-core/sis_mm.c @@ -40,6 +40,17 @@ #include "sis_drv.h" #include "sis_ds.h" +drm_ioctl_desc_t sis_ioctls[] = { + [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = {sis_fb_alloc, 1, 0}, + [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = {sis_fb_free, 1, 0}, + [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = {sis_ioctl_agp_init, 1, 1}, + [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = {sis_ioctl_agp_alloc, 1, 0}, + [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = {sis_ioctl_agp_free, 1, 0}, + [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = {sis_fb_init, 1, 1} +}; + +int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls); + #define MAX_CONTEXT 100 #define VIDEO_TYPE 0 #define AGP_TYPE 1 -- cgit v1.2.3