summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/asm-x86/gart.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h
index 248e5778e928..6f22786d2f0c 100644
--- a/include/asm-x86/gart.h
+++ b/include/asm-x86/gart.h
@@ -52,4 +52,21 @@ static inline void gart_iommu_shutdown(void)
#define AMD64_GARTCACHECTL 0x9c
#define AMD64_GARTEN (1<<0)
+static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
+{
+ u32 tmp, ctl;
+
+ /* address of the mappings table */
+ addr >>= 12;
+ tmp = (u32) addr<<4;
+ tmp &= ~0xf;
+ pci_write_config_dword(dev, AMD64_GARTTABLEBASE, tmp);
+
+ /* Enable GART translation for this hammer. */
+ pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
+ ctl |= GARTEN;
+ ctl &= ~(DISGARTCPU | DISGARTIO);
+ pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
+}
+
#endif