Commit fad84c43 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[AGP] Use compatability mode of KT400 if detected

parent f938e97d
...@@ -291,6 +291,9 @@ struct agp_bridge_data { ...@@ -291,6 +291,9 @@ struct agp_bridge_data {
#define VIA_APSIZE 0x84 #define VIA_APSIZE 0x84
#define VIA_ATTBASE 0x88 #define VIA_ATTBASE 0x88
/* VIA KT400 */
#define VIA_AGPSEL 0xfd
/* SiS registers */ /* SiS registers */
#define SIS_APBASE 0x10 #define SIS_APBASE 0x10
#define SIS_ATTBASE 0x90 #define SIS_ATTBASE 0x90
......
...@@ -125,14 +125,23 @@ static int __init via_generic_setup (struct pci_dev *pdev) ...@@ -125,14 +125,23 @@ static int __init via_generic_setup (struct pci_dev *pdev)
} }
/*
* The KT400 does magick to put the AGP bridge compliant with the same
* standards version as the graphics card. If we haven't fallen into
* 2.0 compatability mode, we run the normal 3.0 code, and fall back
* if something nasty happens.
*/
static void via_kt400_enable(u32 mode) static void via_kt400_enable(u32 mode)
{ {
if ((agp_generic_agp_3_0_enable)==FALSE) if ((agp_generic_agp_3_0_enable(mode))==FALSE)
/* Something weird happened, fall back to 2.0 */
agp_generic_agp_enable(mode); agp_generic_agp_enable(mode);
} }
static int __init via_kt400_setup(struct pci_dev *pdev) static int __init via_kt400_setup(struct pci_dev *pdev)
{ {
u8 reg;
agp_bridge.masks = via_generic_masks; agp_bridge.masks = via_generic_masks;
agp_bridge.num_of_masks = 1; agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) via_generic_sizes; agp_bridge.aperture_sizes = (void *) via_generic_sizes;
...@@ -145,7 +154,6 @@ static int __init via_kt400_setup(struct pci_dev *pdev) ...@@ -145,7 +154,6 @@ static int __init via_kt400_setup(struct pci_dev *pdev)
agp_bridge.cleanup = via_cleanup; agp_bridge.cleanup = via_cleanup;
agp_bridge.tlb_flush = via_tlbflush; agp_bridge.tlb_flush = via_tlbflush;
agp_bridge.mask_memory = via_mask_memory; agp_bridge.mask_memory = via_mask_memory;
agp_bridge.agp_enable = agp_generic_agp_enable;
agp_bridge.cache_flush = global_cache_flush; agp_bridge.cache_flush = global_cache_flush;
agp_bridge.create_gatt_table = agp_generic_create_gatt_table; agp_bridge.create_gatt_table = agp_generic_create_gatt_table;
agp_bridge.free_gatt_table = agp_generic_free_gatt_table; agp_bridge.free_gatt_table = agp_generic_free_gatt_table;
...@@ -158,16 +166,22 @@ static int __init via_kt400_setup(struct pci_dev *pdev) ...@@ -158,16 +166,22 @@ static int __init via_kt400_setup(struct pci_dev *pdev)
agp_bridge.suspend = agp_generic_suspend; agp_bridge.suspend = agp_generic_suspend;
agp_bridge.resume = agp_generic_resume; agp_bridge.resume = agp_generic_resume;
agp_bridge.cant_use_aperture = 0; agp_bridge.cant_use_aperture = 0;
pci_read_config_byte(agp_bridge.dev, VIA_AGPSEL, &reg);
if ((reg & (1<<1))==1) {
/* AGP 2.0 compatability mode. */
agp_bridge.agp_enable = agp_generic_agp_enable;
} else {
/* AGP 3.0 mode */
agp_bridge.agp_enable = via_kt400_enable;
}
return 0; return 0;
} }
static struct agp_device_ids via_agp_device_ids[] __initdata = static struct agp_device_ids via_agp_device_ids[] __initdata =
{ {
{
.device_id = PCI_DEVICE_ID_VIA_8501_0,
.chipset = VIA_MVP4,
.chipset_name = "MVP4",
},
{ {
.device_id = PCI_DEVICE_ID_VIA_82C597_0, .device_id = PCI_DEVICE_ID_VIA_82C597_0,
.chipset = VIA_VP3, .chipset = VIA_VP3,
...@@ -178,6 +192,11 @@ static struct agp_device_ids via_agp_device_ids[] __initdata = ...@@ -178,6 +192,11 @@ static struct agp_device_ids via_agp_device_ids[] __initdata =
.chipset = VIA_MVP3, .chipset = VIA_MVP3,
.chipset_name = "MVP3", .chipset_name = "MVP3",
}, },
{
.device_id = PCI_DEVICE_ID_VIA_8501_0,
.chipset = VIA_MVP4,
.chipset_name = "MVP4",
},
{ {
.device_id = PCI_DEVICE_ID_VIA_82C691, .device_id = PCI_DEVICE_ID_VIA_82C691,
.chipset = VIA_APOLLO_PRO, .chipset = VIA_APOLLO_PRO,
...@@ -203,6 +222,11 @@ static struct agp_device_ids via_agp_device_ids[] __initdata = ...@@ -203,6 +222,11 @@ static struct agp_device_ids via_agp_device_ids[] __initdata =
.chipset = VIA_APOLLO_KT133, .chipset = VIA_APOLLO_KT133,
.chipset_name = "Apollo Pro KT266", .chipset_name = "Apollo Pro KT266",
}, },
{
.device_id = PCI_DEVICE_ID_VIA_8653_0,
.chipset = VIA_APOLLO_PRO,
.chipset_name = "Apollo Pro 266T",
},
{ {
.device_id = PCI_DEVICE_ID_VIA_8377_0, .device_id = PCI_DEVICE_ID_VIA_8377_0,
.chipset = VIA_APOLLO_KT400, .chipset = VIA_APOLLO_KT400,
...@@ -210,14 +234,10 @@ static struct agp_device_ids via_agp_device_ids[] __initdata = ...@@ -210,14 +234,10 @@ static struct agp_device_ids via_agp_device_ids[] __initdata =
.chipset_setup = via_kt400_setup, .chipset_setup = via_kt400_setup,
}, },
{ {
.device_id = PCI_DEVICE_ID_VIA_8653_0, /* VIA ProSavage PM133 (Apollo Pro133A chipset with S3 Savage4) */
.chipset = VIA_APOLLO_PRO,
.chipset_name = "Apollo Pro266T",
},
{
.device_id = PCI_DEVICE_ID_VIA_82C694X_0, .device_id = PCI_DEVICE_ID_VIA_82C694X_0,
.chipset = VIA_VT8605, .chipset = VIA_VT8605,
.chipset_name = "PM133" .chipset_name = "Apollo ProSavage PM133"
}, },
{ }, /* dummy final entry, always present */ { }, /* dummy final entry, always present */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment