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 | |
| 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.
| -rw-r--r-- | linux-core/savage_dma.c | 50 | ||||
| -rw-r--r-- | linux-core/savage_drv.h | 45 | ||||
| -rw-r--r-- | linux/savage_dma.c | 50 | ||||
| -rw-r--r-- | linux/savage_drv.h | 45 | ||||
| -rw-r--r-- | shared-core/drm_pciids.txt | 45 | ||||
| -rw-r--r-- | shared/drm_pciids.txt | 45 | 
6 files changed, 234 insertions, 46 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;  } diff --git a/linux-core/savage_drv.h b/linux-core/savage_drv.h index 4cb59fea..755ed2e9 100644 --- a/linux-core/savage_drv.h +++ b/linux-core/savage_drv.h @@ -24,4 +24,49 @@  #ifndef __SAVAGE_DRV_H__  #define __SAVAGE_DRV_H__ +/* these chip tags should match the ones in the 2D driver in savage_regs.h. */ +enum savage_family { +    S3_UNKNOWN = 0, +    S3_SAVAGE3D, +    S3_SAVAGE_MX, +    S3_SAVAGE4, +    S3_PROSAVAGE, +    S3_TWISTER, +    S3_PROSAVAGEDDR, +    S3_SUPERSAVAGE, +    S3_SAVAGE2000, +    S3_LAST +}; + +#define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) + +#define S3_SAVAGE4_SERIES(chip)  ((chip==S3_SAVAGE4)            \ +                                  || (chip==S3_PROSAVAGE)       \ +                                  || (chip==S3_TWISTER)         \ +                                  || (chip==S3_PROSAVAGEDDR)) + +#define	S3_SAVAGE_MOBILE_SERIES(chip)	((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE)) + +#define S3_SAVAGE_SERIES(chip)    ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000)) + +#define S3_MOBILE_TWISTER_SERIES(chip)   ((chip==S3_TWISTER)    \ +                                          ||(chip==S3_PROSAVAGEDDR)) + +/* flags */ +#define SAVAGE_IS_AGP 1 + +typedef struct drm_savage_private { +	drm_savage_sarea_t *sarea_priv; + +	enum savage_family chipset; +	unsigned flags; +	 +} drm_savage_private_t; + +#define SAVAGE_FB_SIZE_S3	0x01000000  /*  16MB */ +#define SAVAGE_FB_SIZE_S4	0x02000000  /*  32MB */ +#define SAVAGE_MMIO_SIZE        0x00080000  /* 512kB */ +#define SAVAGE_APERTURE_OFFSET  0x02000000  /*  32MB */ +#define SAVAGE_APERTURE_SIZE    0x05000000  /* 5 tiled surfaces, 16MB each */ +  #endif /* end #ifndef __SAVAGE_DRV_ */ diff --git a/linux/savage_dma.c b/linux/savage_dma.c index b012e1ba..581d4302 100644 --- a/linux/savage_dma.c +++ b/linux/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;  } diff --git a/linux/savage_drv.h b/linux/savage_drv.h index 4cb59fea..755ed2e9 100644 --- a/linux/savage_drv.h +++ b/linux/savage_drv.h @@ -24,4 +24,49 @@  #ifndef __SAVAGE_DRV_H__  #define __SAVAGE_DRV_H__ +/* these chip tags should match the ones in the 2D driver in savage_regs.h. */ +enum savage_family { +    S3_UNKNOWN = 0, +    S3_SAVAGE3D, +    S3_SAVAGE_MX, +    S3_SAVAGE4, +    S3_PROSAVAGE, +    S3_TWISTER, +    S3_PROSAVAGEDDR, +    S3_SUPERSAVAGE, +    S3_SAVAGE2000, +    S3_LAST +}; + +#define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) + +#define S3_SAVAGE4_SERIES(chip)  ((chip==S3_SAVAGE4)            \ +                                  || (chip==S3_PROSAVAGE)       \ +                                  || (chip==S3_TWISTER)         \ +                                  || (chip==S3_PROSAVAGEDDR)) + +#define	S3_SAVAGE_MOBILE_SERIES(chip)	((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE)) + +#define S3_SAVAGE_SERIES(chip)    ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000)) + +#define S3_MOBILE_TWISTER_SERIES(chip)   ((chip==S3_TWISTER)    \ +                                          ||(chip==S3_PROSAVAGEDDR)) + +/* flags */ +#define SAVAGE_IS_AGP 1 + +typedef struct drm_savage_private { +	drm_savage_sarea_t *sarea_priv; + +	enum savage_family chipset; +	unsigned flags; +	 +} drm_savage_private_t; + +#define SAVAGE_FB_SIZE_S3	0x01000000  /*  16MB */ +#define SAVAGE_FB_SIZE_S4	0x02000000  /*  32MB */ +#define SAVAGE_MMIO_SIZE        0x00080000  /* 512kB */ +#define SAVAGE_APERTURE_OFFSET  0x02000000  /*  32MB */ +#define SAVAGE_APERTURE_SIZE    0x05000000  /* 5 tiled surfaces, 16MB each */ +  #endif /* end #ifndef __SAVAGE_DRV_ */ diff --git a/shared-core/drm_pciids.txt b/shared-core/drm_pciids.txt index 41df7481..626d5a7a 100644 --- a/shared-core/drm_pciids.txt +++ b/shared-core/drm_pciids.txt @@ -161,28 +161,29 @@  0x3d3d 0x0008 0 "3DLabs GLINT Gamma G1"  [savage] -0x5333 0x8a22 0 "Savage4" -0x5333 0x8a23 0 "Savage4" -0x5333 0x8c10 0 "Savage/MX-MV" -0x5333 0x8c11 0 "Savage/MX" -0x5333 0x8c12 0 "Savage/IX-MV" -0x5333 0x8c13 0 "Savage/IX" -0x5333 0x8c20 0 "Savage 3D" -0x5333 0x8c21 0 "Savage 3D/MV" -0x5333 0x8c22 0 "SuperSavage MX/128" -0x5333 0x8c24 0 "SuperSavage MX/64" -0x5333 0x8c26 0 "SuperSavage MX/64C" -0x5333 0x8c2a 0 "SuperSavage IX/128 SDR" -0x5333 0x8c2b 0 "SuperSavage IX/128 DDR" -0x5333 0x8c2c 0 "SuperSavage IX/64 SDR" -0x5333 0x8c2d 0 "SuperSavage IX/64 DDR" -0x5333 0x8c2e 0 "SuperSavage IX/C SDR" -0x5333 0x8c2f 0 "SuperSavage IX/C DDR" -0x5333 0x8a25 0 "ProSavage PM133" -0x5333 0x8a26 0 "ProSavage KM133" -0x5333 0x8d01 0 "ProSavage PN133" -0x5333 0x8d02 0 "ProSavage KN133" -0x5333 0x8d04 0 "ProSavage DDR" +0x5333 0x8a22 S3_SAVAGE4 "Savage4" +0x5333 0x8a23 S3_SAVAGE4 "Savage4" +0x5333 0x8c10 S3_SAVAGE_MX "Savage/MX-MV" +0x5333 0x8c11 S3_SAVAGE_MX "Savage/MX" +0x5333 0x8c12 S3_SAVAGE_MX "Savage/IX-MV" +0x5333 0x8c13 S3_SAVAGE_MX "Savage/IX" +0x5333 0x8c20 S3_SAVAGE3D "Savage 3D" +0x5333 0x8c21 S3_SAVAGE3D "Savage 3D/MV" +0x5333 0x8c22 S3_SUPERSAVAGE "SuperSavage MX/128" +0x5333 0x8c24 S3_SUPERSAVAGE "SuperSavage MX/64" +0x5333 0x8c26 S3_SUPERSAVAGE "SuperSavage MX/64C" +0x5333 0x8c2a S3_SUPERSAVAGE "SuperSavage IX/128 SDR" +0x5333 0x8c2b S3_SUPERSAVAGE "SuperSavage IX/128 DDR" +0x5333 0x8c2c S3_SUPERSAVAGE "SuperSavage IX/64 SDR" +0x5333 0x8c2d S3_SUPERSAVAGE "SuperSavage IX/64 DDR" +0x5333 0x8c2e S3_SUPERSAVAGE "SuperSavage IX/C SDR" +0x5333 0x8c2f S3_SUPERSAVAGE "SuperSavage IX/C DDR" +0x5333 0x8a25 S3_PROSAVAGE "ProSavage PM133" +0x5333 0x8a26 S3_PROSAVAGE "ProSavage KM133" +0x5333 0x8d01 S3_TWISTER "ProSavage Twister PN133" +0x5333 0x8d02 S3_TWISTER "ProSavage Twister KN133" +0x5333 0x8d03 S3_PROSAVAGEDDR "ProSavage DDR" +0x5333 0x8d04 S3_PROSAVAGEDDR "ProSavage DDR-K"  [ffb] diff --git a/shared/drm_pciids.txt b/shared/drm_pciids.txt index 41df7481..626d5a7a 100644 --- a/shared/drm_pciids.txt +++ b/shared/drm_pciids.txt @@ -161,28 +161,29 @@  0x3d3d 0x0008 0 "3DLabs GLINT Gamma G1"  [savage] -0x5333 0x8a22 0 "Savage4" -0x5333 0x8a23 0 "Savage4" -0x5333 0x8c10 0 "Savage/MX-MV" -0x5333 0x8c11 0 "Savage/MX" -0x5333 0x8c12 0 "Savage/IX-MV" -0x5333 0x8c13 0 "Savage/IX" -0x5333 0x8c20 0 "Savage 3D" -0x5333 0x8c21 0 "Savage 3D/MV" -0x5333 0x8c22 0 "SuperSavage MX/128" -0x5333 0x8c24 0 "SuperSavage MX/64" -0x5333 0x8c26 0 "SuperSavage MX/64C" -0x5333 0x8c2a 0 "SuperSavage IX/128 SDR" -0x5333 0x8c2b 0 "SuperSavage IX/128 DDR" -0x5333 0x8c2c 0 "SuperSavage IX/64 SDR" -0x5333 0x8c2d 0 "SuperSavage IX/64 DDR" -0x5333 0x8c2e 0 "SuperSavage IX/C SDR" -0x5333 0x8c2f 0 "SuperSavage IX/C DDR" -0x5333 0x8a25 0 "ProSavage PM133" -0x5333 0x8a26 0 "ProSavage KM133" -0x5333 0x8d01 0 "ProSavage PN133" -0x5333 0x8d02 0 "ProSavage KN133" -0x5333 0x8d04 0 "ProSavage DDR" +0x5333 0x8a22 S3_SAVAGE4 "Savage4" +0x5333 0x8a23 S3_SAVAGE4 "Savage4" +0x5333 0x8c10 S3_SAVAGE_MX "Savage/MX-MV" +0x5333 0x8c11 S3_SAVAGE_MX "Savage/MX" +0x5333 0x8c12 S3_SAVAGE_MX "Savage/IX-MV" +0x5333 0x8c13 S3_SAVAGE_MX "Savage/IX" +0x5333 0x8c20 S3_SAVAGE3D "Savage 3D" +0x5333 0x8c21 S3_SAVAGE3D "Savage 3D/MV" +0x5333 0x8c22 S3_SUPERSAVAGE "SuperSavage MX/128" +0x5333 0x8c24 S3_SUPERSAVAGE "SuperSavage MX/64" +0x5333 0x8c26 S3_SUPERSAVAGE "SuperSavage MX/64C" +0x5333 0x8c2a S3_SUPERSAVAGE "SuperSavage IX/128 SDR" +0x5333 0x8c2b S3_SUPERSAVAGE "SuperSavage IX/128 DDR" +0x5333 0x8c2c S3_SUPERSAVAGE "SuperSavage IX/64 SDR" +0x5333 0x8c2d S3_SUPERSAVAGE "SuperSavage IX/64 DDR" +0x5333 0x8c2e S3_SUPERSAVAGE "SuperSavage IX/C SDR" +0x5333 0x8c2f S3_SUPERSAVAGE "SuperSavage IX/C DDR" +0x5333 0x8a25 S3_PROSAVAGE "ProSavage PM133" +0x5333 0x8a26 S3_PROSAVAGE "ProSavage KM133" +0x5333 0x8d01 S3_TWISTER "ProSavage Twister PN133" +0x5333 0x8d02 S3_TWISTER "ProSavage Twister KN133" +0x5333 0x8d03 S3_PROSAVAGEDDR "ProSavage DDR" +0x5333 0x8d04 S3_PROSAVAGEDDR "ProSavage DDR-K"  [ffb] | 
