diff options
author | Felix Kuehling <fxkuehl@gmx.de> | 2004-09-22 22:51:18 +0000 |
---|---|---|
committer | Felix Kuehling <fxkuehl@gmx.de> | 2004-09-22 22:51:18 +0000 |
commit | af326f6f0c26191b4aef2183fb485e58495b29a5 (patch) | |
tree | 5f107ae2a9aa33ea5bc971618bf8e84824b89770 /linux-core/savage_dma.c | |
parent | 27fc998f7d16e7197f38b2d7d1ce65938e06423d (diff) |
Create permanent maps of framebuffer, aperture and MMIO registers. Added
chipset-type information in driver data field of Savage PCI-IDs. Added
missing PCI-ID 0x8d03 (ProSavageDDR on Pentium boards). Don't require
AGP.
Diffstat (limited to 'linux-core/savage_dma.c')
-rw-r--r-- | linux-core/savage_dma.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/linux-core/savage_dma.c b/linux-core/savage_dma.c index b012e1ba..581d4302 100644 --- a/linux-core/savage_dma.c +++ b/linux-core/savage_dma.c @@ -26,6 +26,7 @@ /*=========================================================*/ #include "savage.h" #include "drmP.h" +#include "savage_drm.h" #include "savage_drv.h" #include <linux/interrupt.h> /* For task queue support */ @@ -34,7 +35,54 @@ #define SAVAGE_DEFAULT_USEC_TIMEOUT 10000 #define SAVAGE_FREELIST_DEBUG 0 +static int savage_preinit( drm_device_t *dev, unsigned long chipset ) +{ + drm_savage_private_t *dev_priv; + unsigned mmioBase, fbBase, fbSize, apertureBase; + int ret = 0; + + dev_priv = DRM(alloc)( sizeof(drm_savage_private_t), DRM_MEM_DRIVER ); + if ( dev_priv == NULL ) + return DRM_ERR(ENOMEM); + + memset( dev_priv, 0, sizeof(drm_savage_private_t) ); + dev->dev_private = (void *)dev_priv; + dev_priv->chipset = (enum savage_family)chipset; + + if( S3_SAVAGE3D_SERIES(dev_priv->chipset) ) { + fbBase = pci_resource_start( dev->pdev, 0 ); + fbSize = SAVAGE_FB_SIZE_S3; + mmioBase = fbBase + fbSize; + apertureBase = fbBase + SAVAGE_APERTURE_OFFSET; + } else if( chipset != S3_SUPERSAVAGE ) { + mmioBase = pci_resource_start( dev->pdev, 0 ); + fbBase = pci_resource_start( dev->pdev, 1 ); + fbSize = SAVAGE_FB_SIZE_S4; + apertureBase = fbBase + SAVAGE_APERTURE_OFFSET; + } else { + mmioBase = pci_resource_start( dev->pdev, 0 ); + fbBase = pci_resource_start( dev->pdev, 1 ); + fbSize = pci_resource_len( dev->pdev, 1 ); + apertureBase = pci_resource_start( dev->pdev, 2 ); + } + + if( (ret = DRM(initmap)( dev, mmioBase, SAVAGE_MMIO_SIZE, + _DRM_REGISTERS, 0 ))) + return ret; + + if( (ret = DRM(initmap)( dev, fbBase, fbSize, + _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING ))) + return ret; + + if( (ret = DRM(initmap)( dev, apertureBase, SAVAGE_APERTURE_SIZE, + _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING ))) + return ret; + + return ret; +} + void DRM(driver_register_fns)(drm_device_t *dev) { - dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR; + dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR; + dev->fn_tbl.preinit = savage_preinit; } |