1 #ifndef _ASM_X8664_GART_H
2 #define _ASM_X8664_GART_H 1
7 extern void set_up_gart_resume(u32, u32);
9 extern int fallback_aper_order;
10 extern int fallback_aper_force;
11 extern int fix_aperture;
15 #define GPTE_COHERENT 2
17 /* Aperture control register bits. */
19 #define DISGARTCPU (1<<4)
20 #define DISGARTIO (1<<5)
22 /* GART cache control register bits. */
23 #define INVGART (1<<0)
24 #define GARTPTEERR (1<<1)
26 /* K8 On-cpu GART registers */
27 #define AMD64_GARTAPERTURECTL 0x90
28 #define AMD64_GARTAPERTUREBASE 0x94
29 #define AMD64_GARTTABLEBASE 0x98
30 #define AMD64_GARTCACHECTL 0x9c
31 #define AMD64_GARTEN (1<<0)
33 static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
37 /* address of the mappings table */
41 pci_write_config_dword(dev, AMD64_GARTTABLEBASE, tmp);
43 /* Enable GART translation for this hammer. */
44 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
46 ctl &= ~(DISGARTCPU | DISGARTIO);
47 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
50 static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
55 if (aper_base + aper_size > 0x100000000ULL) {
56 printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n");
59 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
60 printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n");
63 if (aper_size < min_size) {
64 printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n",
65 aper_size>>20, min_size>>20);