aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/gart.h
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2008-05-20 10:27:17 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-22 05:35:14 -0400
commit0abbc78a0137fee60ef092f0b20a3d3d7e7e0cc2 (patch)
tree861c8de86a39a9c3235f949dcad01ba96cfb18c6 /include/asm-x86/gart.h
parent538f0fd0f210c2ce5c585799f18d0e5c7cf6155e (diff)
x86, aperture_64: use symbolic constants
Factor-out common aperture_valid code. 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/asm-x86/gart.h')
-rw-r--r--include/asm-x86/gart.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h
index 6f22786d2f0c..c818b96f936b 100644
--- a/include/asm-x86/gart.h
+++ b/include/asm-x86/gart.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_X8664_IOMMU_H 1#ifndef _ASM_X8664_IOMMU_H
2#define _ASM_X8664_IOMMU_H 1 2#define _ASM_X8664_IOMMU_H 1
3 3
4#include <asm/e820.h>
5
4extern void pci_iommu_shutdown(void); 6extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void); 7extern void no_iommu_init(void);
6extern int force_iommu, no_iommu; 8extern int force_iommu, no_iommu;
@@ -69,4 +71,26 @@ static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
69 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl); 71 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
70} 72}
71 73
74static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
75{
76 if (!aper_base)
77 return 0;
78
79 if (aper_base + aper_size > 0x100000000ULL) {
80 printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n");
81 return 0;
82 }
83 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
84 printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n");
85 return 0;
86 }
87 if (aper_size < min_size) {
88 printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n",
89 aper_size>>20, min_size>>20);
90 return 0;
91 }
92
93 return 1;
94}
95
72#endif 96#endif