summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2008-04-15 12:43:57 +0200
committerIngo Molnar <mingo@elte.hu>2008-05-12 21:28:10 +0200
commit3bb6fbf9969a8bbe4892968659239273d092e78a (patch)
tree26ede22e0622abfbb585cd83199b2615b4b4542d /arch/x86
parent330fce23dab6e6a3d1979e55f27aba4c0c301331 (diff)
x86 gart: factor out common code
Cleanup gart handling on amd64 a bit: move common code into enable_gart_translation , and use symbolic register names where appropriate. Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/pci-gart_64.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index bffcf455c857..1f99b62ff616 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -533,8 +533,8 @@ static __init unsigned read_aperture(struct pci_dev *dev, u32 *size)
unsigned aper_size = 0, aper_base_32, aper_order;
u64 aper_base;
- pci_read_config_dword(dev, 0x94, &aper_base_32);
- pci_read_config_dword(dev, 0x90, &aper_order);
+ pci_read_config_dword(dev, AMD64_GARTAPERTUREBASE, &aper_base_32);
+ pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &aper_order);
aper_order = (aper_order >> 1) & 7;
aper_base = aper_base_32 & 0x7fff;
@@ -592,19 +592,8 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
agp_gatt_table = gatt;
for (i = 0; i < num_k8_northbridges; i++) {
- u32 gatt_reg;
- u32 ctl;
-
dev = k8_northbridges[i];
- gatt_reg = __pa(gatt) >> 12;
- gatt_reg <<= 4;
- pci_write_config_dword(dev, AMD64_GARTTABLEBASE, gatt_reg);
- pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
-
- ctl |= GARTEN;
- ctl &= ~(DISGARTCPU | DISGARTIO);
-
- pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
+ enable_gart_translation(dev, __pa(gatt));
}
flush_gart();
@@ -648,11 +637,11 @@ void gart_iommu_shutdown(void)
u32 ctl;
dev = k8_northbridges[i];
- pci_read_config_dword(dev, 0x90, &ctl);
+ pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
- ctl &= ~1;
+ ctl &= ~GARTEN;
- pci_write_config_dword(dev, 0x90, ctl);
+ pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
}
}