summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2008-05-30 18:23:59 -0700
committerIan Romanick <idr@us.ibm.com>2008-05-30 18:23:59 -0700
commit074a4aa1985219910a96b022368067e3ed5641e6 (patch)
tree9cc73b9822d9c05dc4ea8f9d197417cb07d97541 /src
parent9ee7b04b1fe57834a541ef27b4e25acffd3ac1c5 (diff)
Initialize default BIOS values from a data table instead of from code
Diffstat (limited to 'src')
-rw-r--r--src/mga.h3
-rw-r--r--src/mga_bios.c123
-rw-r--r--src/mga_driver.c229
3 files changed, 196 insertions, 159 deletions
diff --git a/src/mga.h b/src/mga.h
index f1f4714..798f412 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -428,6 +428,9 @@ struct mga_device_attributes {
} BARs:2;
uint32_t accel_flags;
+
+ /** Default BIOS values. */
+ struct mga_bios_values default_bios_values;
};
typedef struct {
diff --git a/src/mga_bios.c b/src/mga_bios.c
index 63c7b5e..b78890e 100644
--- a/src/mga_bios.c
+++ b/src/mga_bios.c
@@ -96,125 +96,6 @@ static __inline__ CARD32 get_u32( const CARD8 * data )
/**
- * Initialize reasonable defaults for values that normally come form the BIOS.
- *
- * For each generation of hardware, provide reasonable default values, based
- * on the type of hardware and chipset revision, for various values that are
- * normally read from the PInS structure in the BIOS. This provides a backup
- * in case the PInS structure cannot be found.
- *
- * \param pMga Pointer to the MGA-private data.
- * \param bios Pointer to the structure that holds values read from the BIOS.
- *
- * \todo
- * Determine if different default values should be used for G400 and G450
- * cards. These cards have the same PCI ID, but can be identified by a
- * different chip revision. The G450 cards have a revision of 3 or higher.
- */
-
-static void mga_initialize_bios_values( MGAPtr pMga,
- struct mga_bios_values * bios )
-{
- (void) memset( bios, 0, sizeof( *bios ) );
-
- bios->pixel.min_freq = 50000;
-
- switch( pMga->Chipset ) {
- case PCI_CHIP_MGA2064:
- case PCI_CHIP_MGA2164:
- case PCI_CHIP_MGA2164_AGP:
- bios->pixel.max_freq = 220000;
-
- bios->pll_ref_freq = 14318;
- bios->mem_clock = 50000;
-
- bios->host_interface = (pMga->Chipset == PCI_CHIP_MGA2164_AGP)
- ? MGA_HOST_AGP_1x : MGA_HOST_PCI;
- break;
-
- case PCI_CHIP_MGA1064:
- /* There used to be code in MGARamdacInit (mga_dacG.c) that would
- * set this to 170000 if the chip revision was less than 3. Is that
- * needed here?
- */
-
- bios->system.max_freq = 230000;
- bios->pixel.max_freq = 230000;
-
- bios->pll_ref_freq = 14318;
- bios->mem_clock = 50000;
- bios->host_interface = MGA_HOST_PCI;
- break;
-
- case PCI_CHIP_MGAG200_SE_A_PCI:
- bios->system.max_freq = 230000;
- bios->system.min_freq = 50000;
- bios->pixel.max_freq = 230000;
- bios->pll_ref_freq = 27050;
- bios->mem_clock = 50000;
- bios->host_interface = MGA_HOST_PCI;
- break;
-
- case PCI_CHIP_MGAG200_SE_B_PCI:
- bios->system.max_freq = 114000;
- bios->system.min_freq = 50000;
- bios->pixel.max_freq = 114000;
- bios->pll_ref_freq = 27050;
- bios->mem_clock = 45000;
- bios->host_interface = MGA_HOST_PCI;
- break;
-
- case PCI_CHIP_MGAG100_PCI:
- case PCI_CHIP_MGAG100:
- case PCI_CHIP_MGAG200_PCI:
- case PCI_CHIP_MGAG200:
- bios->system.max_freq = 230000;
- bios->pixel.max_freq = 230000;
-
- bios->system.min_freq = 50000;
-
- bios->pll_ref_freq = 27050;
- bios->mem_clock = 50000;
-
- if ( pMga->Chipset == PCI_CHIP_MGAG100 ) {
- bios->host_interface = MGA_HOST_AGP_1x;
- }
- else if ( pMga->Chipset == PCI_CHIP_MGAG200 ) {
- bios->host_interface = MGA_HOST_AGP_2x;
- }
- else {
- bios->host_interface = MGA_HOST_PCI;
- }
- break;
-
- case PCI_CHIP_MGAG400:
- bios->system.max_freq = 252000;
- bios->pixel.max_freq = 252000;
-
- bios->system.min_freq = 50000;
-
- bios->pll_ref_freq = 27050;
- bios->mem_clock = 200000;
- bios->host_interface = MGA_HOST_AGP_4x;
- break;
-
- case PCI_CHIP_MGAG550:
- bios->system.min_freq = 256000;
- bios->pixel.min_freq = 256000;
- bios->video.min_freq = 256000;
- bios->system.max_freq = 600000;
- bios->pixel.max_freq = 600000;
- bios->video.max_freq = 600000;
-
- bios->pll_ref_freq = 27050;
- bios->mem_clock = 284000;
- bios->host_interface = MGA_HOST_AGP_4x;
- break;
- }
-}
-
-
-/**
* Parse version 0x01XX of the BIOS PInS structure.
*
* Version 0x01XX of the BIOS PInS structure is only found in Millenium cards.
@@ -445,8 +326,8 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
* isn't found or can't be read we'll still have some reasonable values
* to use.
*/
-
- mga_initialize_bios_values( pMga, & pMga->bios );
+ (void) memcpy(& pMga->bios, & pMga->chip_attribs->default_bios_values,
+ sizeof(struct mga_bios_values));
/* If the BIOS address was probed, it was found from the PCI config space
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 3f89248..593da44 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -155,39 +155,180 @@ static int MGAEntityIndex = -1;
#include "mga_merge.h"
-static const struct mga_device_attributes attribs[8] = {
+static const struct mga_device_attributes attribs[] = {
/* 2064 */
[0] = { 1, 0, 0, 1, 0, 0, 0, 0, old_BARs,
- (BLK_OPAQUE_EXPANSION | FASTBLT_BUG | USE_LINEAR_EXPANSION) },
+ (BLK_OPAQUE_EXPANSION | FASTBLT_BUG | USE_LINEAR_EXPANSION),
+ {
+ { 0, 0 }, /* System VCO frequencies */
+ { 50000, 220000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 14318, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
/* 1064 */
[1] = { 0, 1, 0, 0, 1, 0, 0, 0, probe_BARs,
- (USE_LINEAR_EXPANSION) },
+ (USE_LINEAR_EXPANSION),
+ {
+ /* There used to be code in MGARamdacInit (mga_dacG.c) that would
+ * set this to 170000 if the chip revision was less than 3. Is
+ * that needed here?
+ */
+ { 50000, 230000 }, /* System VCO frequencies */
+ { 50000, 230000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 14318, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
- /* 2164, 2164 AGP */
+ /* 2164 */
[2] = { 1, 0, 0, 1, 0, 0, 0, 0, new_BARs,
(BLK_OPAQUE_EXPANSION | TRANSC_SOLID_FILL | USE_RECTS_FOR_LINES
- | USE_LINEAR_EXPANSION) },
-
- /* G100 */
- [3] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
- (MGA_NO_PLANEMASK | USE_LINEAR_EXPANSION) },
+ | USE_LINEAR_EXPANSION),
+ {
+ { 0, 0 }, /* System VCO frequencies */
+ { 50000, 220000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 14318, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
+
+ /* 2164 AGP */
+ [3] = { 1, 0, 0, 1, 0, 0, 0, 0, new_BARs,
+ (BLK_OPAQUE_EXPANSION | TRANSC_SOLID_FILL | USE_RECTS_FOR_LINES
+ | USE_LINEAR_EXPANSION),
+ {
+ { 0, 0 }, /* System VCO frequencies */
+ { 50000, 220000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 14318, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_AGP_1x /* Host interface */
+ }
+ },
+
+ /* G100 PCI */
+ [4] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
+ (MGA_NO_PLANEMASK | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 230000 }, /* System VCO frequencies */
+ { 50000, 230000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
- /* G200 */
- [4] = { 0, 1, 0, 0, 1, 1, 1, 1, new_BARs,
- (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION) },
+ /* G100 AGP */
+ [5] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
+ (MGA_NO_PLANEMASK | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 230000 }, /* System VCO frequencies */
+ { 50000, 230000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_AGP_1x /* Host interface */
+ }
+ },
+
+ /* G200 PCI */
+ [6] = { 0, 1, 0, 0, 1, 1, 1, 1, new_BARs,
+ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 230000 }, /* System VCO frequencies */
+ { 50000, 230000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
+
+ /* G200 AGP */
+ [7] = { 0, 1, 0, 0, 1, 1, 1, 1, new_BARs,
+ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 230000 }, /* System VCO frequencies */
+ { 50000, 230000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_AGP_2x /* Host interface */
+ }
+ },
/* G400 / G450 */
- [5] = { 0, 1, 1, 0, 1, 1, 2, 1, new_BARs,
- (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION) },
+ [8] = { 0, 1, 1, 0, 1, 1, 2, 1, new_BARs,
+ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 252000 }, /* System VCO frequencies */
+ { 50000, 252000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 200000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_AGP_4x /* Host interface */
+ }
+ },
/* G550 */
- [6] = { 0, 1, 1, 0, 1, 1, 2, 1, new_BARs,
- (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION) },
+ [9] = { 0, 1, 1, 0, 1, 1, 2, 1, new_BARs,
+ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+ {
+ { 256000, 600000 }, /* System VCO frequencies */
+ { 256000, 600000 }, /* Pixel VCO frequencies */
+ { 256000, 600000 }, /* Video VCO frequencies */
+ 284000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_AGP_4x /* Host interface */
+ }
+ },
+
+ /* G200SE A PCI */
+ [10] = { 0, 1, 0, 0, 1, 0, 0, 1, new_BARs,
+ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 230000 }, /* System VCO frequencies */
+ { 50000, 230000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 50000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
- /* G200SE */
- [7] = { 0, 1, 0, 0, 1, 0, 0, 1, new_BARs,
- (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION) },
+ /* G200SE B PCI */
+ [11] = { 0, 1, 0, 0, 1, 0, 0, 1, new_BARs,
+ (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+ {
+ { 50000, 114000 }, /* System VCO frequencies */
+ { 50000, 114000 }, /* Pixel VCO frequencies */
+ { 0, 0 }, /* Video VCO frequencies */
+ 45000, /* Memory clock */
+ 27050, /* PLL reference frequency */
+ 0, /* Supports fast bitblt? */
+ MGA_HOST_PCI /* Host interface */
+ }
+ },
};
#ifdef XSERVER_LIBPCIACCESS
@@ -197,19 +338,19 @@ static const struct mga_device_attributes attribs[8] = {
{ 0x102B, (d), 0x102B, (s), 0, 0, (i) }
static const struct pci_id_match mga_device_match[] = {
- MGA_DEVICE_MATCH( PCI_CHIP_MGA2064, 0 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGA1064, 1 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGA2164, 2 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGA2164_AGP, 2 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG100, 3 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG100_PCI, 3 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG200, 4 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_PCI, 4 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG400, 5 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG550, 6 ),
-
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_SE_A_PCI, 7 ),
- MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_SE_B_PCI, 7 ),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGA2064, 0),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGA1064, 1),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGA2164, 2),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGA2164_AGP, 3),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG100, 4),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG100_PCI, 5),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG200, 6),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_PCI, 7),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG400, 8),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG550, 9),
+
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_SE_A_PCI, 10),
+ MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_SE_B_PCI, 11),
{ 0, 0, 0 },
};
@@ -844,31 +985,43 @@ MGAProbe(DriverPtr drv, int flags)
break;
case PCI_CHIP_MGA2164:
- case PCI_CHIP_MGA2164_AGP:
attrib_no = 2;
break;
+
+ case PCI_CHIP_MGA2164_AGP:
+ attrib_no = 3;
+ break;
case PCI_CHIP_MGAG100:
+ attrib_no = 4;
+ break;
+
case PCI_CHIP_MGAG100_PCI:
- attrib_no = 3;
+ attrib_no = 5;
break;
case PCI_CHIP_MGAG200:
+ attrib_no = 6;
+ break;
+
case PCI_CHIP_MGAG200_PCI:
- attrib_no = 4;
+ attrib_no = 7;
break;
case PCI_CHIP_MGAG400:
- attrib_no = 5;
+ attrib_no = 8;
break;
case PCI_CHIP_MGAG550:
- attrib_no = 6;
+ attrib_no = 9;
break;
case PCI_CHIP_MGAG200_SE_A_PCI:
+ attrib_no = 10;
+ break;
+
case PCI_CHIP_MGAG200_SE_B_PCI:
- attrib_no = 7;
+ attrib_no = 11;
break;
default: