aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-30 00:44:20 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-30 00:44:20 -0400
commit4282b01e0075ac4495ab2e1cd012cbc43e764c51 (patch)
tree76f8776a0aee3a51490b0d0650a8baa8a5864fea
parent9301899be75b464ef097f0b5af7af6d9bd8f68a7 (diff)
parentaa69432a68fb0aec49551fd69fe920a6df572573 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86: x86 boot: document for 32 bit boot protocol remove the dead X86_REMOTE_DEBUG option x86: merge EARLY_PRINTK options x86: mm/discontig_32.c: make code static x86: kernel/setup_32.c: unexport machine_id x86 gart: rename symbols only used for the GART implementation x86 gart: make some variables and functions static x86 gart: rename CONFIG_IOMMU to CONFIG_GART_IOMMU x86 gart: rename iommu.h to gart.h x86: additional CPUID strings; fix strings for AMD-ecx
-rw-r--r--Documentation/i386/boot.txt38
-rw-r--r--Documentation/i386/zero-page.txt122
-rw-r--r--arch/x86/Kconfig.debug8
-rw-r--r--arch/x86/Kconfig.x86_6410
-rw-r--r--arch/x86/configs/x86_64_defconfig2
-rw-r--r--arch/x86/kernel/Makefile_642
-rw-r--r--arch/x86/kernel/aperture_64.c15
-rw-r--r--arch/x86/kernel/cpu/proc.c10
-rw-r--r--arch/x86/kernel/early-quirks.c10
-rw-r--r--arch/x86/kernel/pci-calgary_64.c2
-rw-r--r--arch/x86/kernel/pci-dma_64.c10
-rw-r--r--arch/x86/kernel/pci-gart_64.c18
-rw-r--r--arch/x86/kernel/pci-nommu_64.c2
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--arch/x86/kernel/reboot_64.c2
-rw-r--r--arch/x86/kernel/setup_32.c3
-rw-r--r--arch/x86/kernel/setup_64.c10
-rw-r--r--arch/x86/mm/discontig_32.c4
-rw-r--r--drivers/char/agp/Kconfig4
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/pci/intel-iommu.c2
-rw-r--r--drivers/usb/core/message.c2
-rw-r--r--include/asm-x86/gart.h29
-rw-r--r--include/asm-x86/iommu.h4
-rw-r--r--include/asm-x86/pci_64.h2
25 files changed, 152 insertions, 163 deletions
diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt
index 2f75e750e4f5..fc49b79bc1ab 100644
--- a/Documentation/i386/boot.txt
+++ b/Documentation/i386/boot.txt
@@ -785,3 +785,41 @@ IMPORTANT: All the hooks are required to preserve %esp, %ebp, %esi and
785 After completing your hook, you should jump to the address 785 After completing your hook, you should jump to the address
786 that was in this field before your boot loader overwrote it 786 that was in this field before your boot loader overwrote it
787 (relocated, if appropriate.) 787 (relocated, if appropriate.)
788
789
790**** 32-bit BOOT PROTOCOL
791
792For machine with some new BIOS other than legacy BIOS, such as EFI,
793LinuxBIOS, etc, and kexec, the 16-bit real mode setup code in kernel
794based on legacy BIOS can not be used, so a 32-bit boot protocol needs
795to be defined.
796
797In 32-bit boot protocol, the first step in loading a Linux kernel
798should be to setup the boot parameters (struct boot_params,
799traditionally known as "zero page"). The memory for struct boot_params
800should be allocated and initialized to all zero. Then the setup header
801from offset 0x01f1 of kernel image on should be loaded into struct
802boot_params and examined. The end of setup header can be calculated as
803follow:
804
805 0x0202 + byte value at offset 0x0201
806
807In addition to read/modify/write the setup header of the struct
808boot_params as that of 16-bit boot protocol, the boot loader should
809also fill the additional fields of the struct boot_params as that
810described in zero-page.txt.
811
812After setupping the struct boot_params, the boot loader can load the
81332/64-bit kernel in the same way as that of 16-bit boot protocol.
814
815In 32-bit boot protocol, the kernel is started by jumping to the
81632-bit kernel entry point, which is the start address of loaded
81732/64-bit kernel.
818
819At entry, the CPU must be in 32-bit protected mode with paging
820disabled; a GDT must be loaded with the descriptors for selectors
821__BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G flat
822segment; __BOOS_CS must have execute/read permission, and __BOOT_DS
823must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
824must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
825address of the struct boot_params; %ebp, %edi and %ebx must be zero.
diff --git a/Documentation/i386/zero-page.txt b/Documentation/i386/zero-page.txt
index 6c0817c45683..169ad423a3d1 100644
--- a/Documentation/i386/zero-page.txt
+++ b/Documentation/i386/zero-page.txt
@@ -1,99 +1,31 @@
1--------------------------------------------------------------------------- 1The additional fields in struct boot_params as a part of 32-bit boot
2!!!!!!!!!!!!!!!WARNING!!!!!!!! 2protocol of kernel. These should be filled by bootloader or 16-bit
3The zero page is a kernel internal data structure, not a stable ABI. It might change 3real-mode setup code of the kernel. References/settings to it mainly
4without warning and the kernel has no way to detect old version of it. 4are in:
5If you're writing some external code like a boot loader you should only use
6the stable versioned real mode boot protocol described in boot.txt. Otherwise the kernel
7might break you at any time.
8!!!!!!!!!!!!!WARNING!!!!!!!!!!!
9----------------------------------------------------------------------------
10 5
11Summary of boot_params layout (kernel point of view) 6 include/asm-x86/bootparam.h
12 ( collected by Hans Lermen and Martin Mares )
13
14The contents of boot_params are used to pass parameters from the
1516-bit realmode code of the kernel to the 32-bit part. References/settings
16to it mainly are in:
17 7
18 arch/i386/boot/setup.S
19 arch/i386/boot/video.S
20 arch/i386/kernel/head.S
21 arch/i386/kernel/setup.c
22
23 8
24Offset Type Description 9Offset Proto Name Meaning
25------ ---- ----------- 10/Size
26 0 32 bytes struct screen_info, SCREEN_INFO
27 ATTENTION, overlaps the following !!!
28 2 unsigned short EXT_MEM_K, extended memory size in Kb (from int 0x15)
29 0x20 unsigned short CL_MAGIC, commandline magic number (=0xA33F)
30 0x22 unsigned short CL_OFFSET, commandline offset
31 Address of commandline is calculated:
32 0x90000 + contents of CL_OFFSET
33 (only taken, when CL_MAGIC = 0xA33F)
34 0x40 20 bytes struct apm_bios_info, APM_BIOS_INFO
35 0x60 16 bytes Intel SpeedStep (IST) BIOS support information
36 0x80 16 bytes hd0-disk-parameter from intvector 0x41
37 0x90 16 bytes hd1-disk-parameter from intvector 0x46
38 11
39 0xa0 16 bytes System description table truncated to 16 bytes. 12000/040 ALL screen_info Text mode or frame buffer information
40 ( struct sys_desc_table_struct ) 13 (struct screen_info)
41 0xb0 - 0x13f Free. Add more parameters here if you really need them. 14040/014 ALL apm_bios_info APM BIOS information (struct apm_bios_info)
42 0x140- 0x1be EDID_INFO Video mode setup 15060/010 ALL ist_info Intel SpeedStep (IST) BIOS support information
43 16 (struct ist_info)
440x1c4 unsigned long EFI system table pointer 17080/010 ALL hd0_info hd0 disk parameter, OBSOLETE!!
450x1c8 unsigned long EFI memory descriptor size 18090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!!
460x1cc unsigned long EFI memory descriptor version 190A0/010 ALL sys_desc_table System description table (struct sys_desc_table)
470x1d0 unsigned long EFI memory descriptor map pointer 20140/080 ALL edid_info Video mode setup (struct edid_info)
480x1d4 unsigned long EFI memory descriptor map size 211C0/020 ALL efi_info EFI 32 information (struct efi_info)
490x1e0 unsigned long ALT_MEM_K, alternative mem check, in Kb 221E0/004 ALL alk_mem_k Alternative mem check, in KB
500x1e4 unsigned long Scratch field for the kernel setup code 231E4/004 ALL scratch Scratch field for the kernel setup code
510x1e8 char number of entries in E820MAP (below) 241E8/001 ALL e820_entries Number of entries in e820_map (below)
520x1e9 unsigned char number of entries in EDDBUF (below) 251E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
530x1ea unsigned char number of entries in EDD_MBR_SIG_BUFFER (below) 261EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer
540x1f1 char size of setup.S, number of sectors 27 (below)
550x1f2 unsigned short MOUNT_ROOT_RDONLY (if !=0) 28290/040 ALL edd_mbr_sig_buffer EDD MBR signatures
560x1f4 unsigned short size of compressed kernel-part in the 292D0/A00 ALL e820_map E820 memory map table
57 (b)zImage-file (in 16 byte units, rounded up) 30 (array of struct e820entry)
580x1f6 unsigned short swap_dev (unused AFAIK) 31D00/1EC ALL eddbuf EDD data (array of struct edd_info)
590x1f8 unsigned short RAMDISK_FLAGS
600x1fa unsigned short VGA-Mode (old one)
610x1fc unsigned short ORIG_ROOT_DEV (high=Major, low=minor)
620x1ff char AUX_DEVICE_INFO
63
640x200 short jump to start of setup code aka "reserved" field.
650x202 4 bytes Signature for SETUP-header, ="HdrS"
660x206 unsigned short Version number of header format
67 Current version is 0x0201...
680x208 8 bytes (used by setup.S for communication with boot loaders,
69 look there)
700x210 char LOADER_TYPE, = 0, old one
71 else it is set by the loader:
72 0xTV: T=0 for LILO
73 1 for Loadlin
74 2 for bootsect-loader
75 3 for SYSLINUX
76 4 for ETHERBOOT
77 5 for ELILO
78 7 for GRuB
79 8 for U-BOOT
80 9 for Xen
81 V = version
820x211 char loadflags:
83 bit0 = 1: kernel is loaded high (bzImage)
84 bit7 = 1: Heap and pointer (see below) set by boot
85 loader.
860x212 unsigned short (setup.S)
870x214 unsigned long KERNEL_START, where the loader started the kernel
880x218 unsigned long INITRD_START, address of loaded ramdisk image
890x21c unsigned long INITRD_SIZE, size in bytes of ramdisk image
900x220 4 bytes (setup.S)
910x224 unsigned short setup.S heap end pointer
920x226 unsigned short zero_pad
930x228 unsigned long cmd_line_ptr
940x22c unsigned long ramdisk_max
950x230 16 bytes trampoline
960x290 - 0x2cf EDD_MBR_SIG_BUFFER (edd.S)
970x2d0 - 0xd00 E820MAP
980xd00 - 0xeff EDDBUF (edd.S) for disk signature read sector
990xd00 - 0xeeb EDDBUF (edd.S) for edd data
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 970b2defe7df..761ca7b5f120 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -6,9 +6,8 @@ config TRACE_IRQFLAGS_SUPPORT
6source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
7 7
8config EARLY_PRINTK 8config EARLY_PRINTK
9 bool "Early printk" if EMBEDDED && DEBUG_KERNEL 9 bool "Early printk" if EMBEDDED && DEBUG_KERNEL && X86_32
10 default y 10 default y
11 depends on X86_32
12 help 11 help
13 Write kernel log output directly into the VGA buffer or to a serial 12 Write kernel log output directly into the VGA buffer or to a serial
14 port. 13 port.
@@ -91,7 +90,7 @@ config DOUBLEFAULT
91 90
92config IOMMU_DEBUG 91config IOMMU_DEBUG
93 bool "Enable IOMMU debugging" 92 bool "Enable IOMMU debugging"
94 depends on IOMMU && DEBUG_KERNEL 93 depends on GART_IOMMU && DEBUG_KERNEL
95 depends on X86_64 94 depends on X86_64
96 help 95 help
97 Force the IOMMU to on even when you have less than 4GB of 96 Force the IOMMU to on even when you have less than 4GB of
@@ -113,7 +112,4 @@ config IOMMU_LEAK
113 Add a simple leak tracer to the IOMMU code. This is useful when you 112 Add a simple leak tracer to the IOMMU code. This is useful when you
114 are debugging a buggy device driver that leaks IOMMU mappings. 113 are debugging a buggy device driver that leaks IOMMU mappings.
115 114
116#config X86_REMOTE_DEBUG
117# bool "kgdb debugging stub"
118
119endmenu 115endmenu
diff --git a/arch/x86/Kconfig.x86_64 b/arch/x86/Kconfig.x86_64
index e2542e5b536c..b45855c368a9 100644
--- a/arch/x86/Kconfig.x86_64
+++ b/arch/x86/Kconfig.x86_64
@@ -97,10 +97,6 @@ config X86_CMPXCHG
97 bool 97 bool
98 default y 98 default y
99 99
100config EARLY_PRINTK
101 bool
102 default y
103
104config GENERIC_ISA_DMA 100config GENERIC_ISA_DMA
105 bool 101 bool
106 default y 102 default y
@@ -479,8 +475,8 @@ config HPET_EMULATE_RTC
479 475
480# Mark as embedded because too many people got it wrong. 476# Mark as embedded because too many people got it wrong.
481# The code disables itself when not needed. 477# The code disables itself when not needed.
482config IOMMU 478config GART_IOMMU
483 bool "IOMMU support" if EMBEDDED 479 bool "GART IOMMU support" if EMBEDDED
484 default y 480 default y
485 select SWIOTLB 481 select SWIOTLB
486 select AGP 482 select AGP
@@ -687,7 +683,7 @@ source kernel/Kconfig.hz
687 683
688config K8_NB 684config K8_NB
689 def_bool y 685 def_bool y
690 depends on AGP_AMD64 || IOMMU || (PCI && NUMA) 686 depends on AGP_AMD64 || GART_IOMMU || (PCI && NUMA)
691 687
692endmenu 688endmenu
693 689
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index b091c5e35558..38a83f9c966f 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -170,7 +170,7 @@ CONFIG_HOTPLUG_CPU=y
170CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 170CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
171CONFIG_HPET_TIMER=y 171CONFIG_HPET_TIMER=y
172CONFIG_HPET_EMULATE_RTC=y 172CONFIG_HPET_EMULATE_RTC=y
173CONFIG_IOMMU=y 173CONFIG_GART_IOMMU=y
174# CONFIG_CALGARY_IOMMU is not set 174# CONFIG_CALGARY_IOMMU is not set
175CONFIG_SWIOTLB=y 175CONFIG_SWIOTLB=y
176CONFIG_X86_MCE=y 176CONFIG_X86_MCE=y
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 466337ae9a1e..24671c3838b3 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -25,7 +25,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump_64.o
25obj-$(CONFIG_PM) += suspend_64.o 25obj-$(CONFIG_PM) += suspend_64.o
26obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o 26obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o
27obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 27obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
28obj-$(CONFIG_IOMMU) += pci-gart_64.o aperture_64.o 28obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
29obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 29obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
30obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o 30obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
31obj-$(CONFIG_KPROBES) += kprobes_64.o 31obj-$(CONFIG_KPROBES) += kprobes_64.o
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 8f681cae7bf7..5b6992799c9d 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -20,14 +20,14 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <asm/e820.h> 21#include <asm/e820.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/iommu.h> 23#include <asm/gart.h>
24#include <asm/pci-direct.h> 24#include <asm/pci-direct.h>
25#include <asm/dma.h> 25#include <asm/dma.h>
26#include <asm/k8.h> 26#include <asm/k8.h>
27 27
28int iommu_aperture; 28int gart_iommu_aperture;
29int iommu_aperture_disabled __initdata = 0; 29int gart_iommu_aperture_disabled __initdata = 0;
30int iommu_aperture_allowed __initdata = 0; 30int gart_iommu_aperture_allowed __initdata = 0;
31 31
32int fallback_aper_order __initdata = 1; /* 64MB */ 32int fallback_aper_order __initdata = 1; /* 64MB */
33int fallback_aper_force __initdata = 0; 33int fallback_aper_force __initdata = 0;
@@ -204,14 +204,15 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp)
204 return 0; 204 return 0;
205} 205}
206 206
207void __init iommu_hole_init(void) 207void __init gart_iommu_hole_init(void)
208{ 208{
209 int fix, num; 209 int fix, num;
210 u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0; 210 u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0;
211 u64 aper_base, last_aper_base = 0; 211 u64 aper_base, last_aper_base = 0;
212 int valid_agp = 0; 212 int valid_agp = 0;
213 213
214 if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed()) 214 if (gart_iommu_aperture_disabled || !fix_aperture ||
215 !early_pci_allowed())
215 return; 216 return;
216 217
217 printk(KERN_INFO "Checking aperture...\n"); 218 printk(KERN_INFO "Checking aperture...\n");
@@ -222,7 +223,7 @@ void __init iommu_hole_init(void)
222 continue; 223 continue;
223 224
224 iommu_detected = 1; 225 iommu_detected = 1;
225 iommu_aperture = 1; 226 gart_iommu_aperture = 1;
226 227
227 aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7; 228 aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7;
228 aper_size = (32 * 1024 * 1024) << aper_order; 229 aper_size = (32 * 1024 * 1024) << aper_order;
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 2d42b414b777..066f8c6af4df 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -49,7 +49,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
49 /* Intel-defined (#2) */ 49 /* Intel-defined (#2) */
50 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 50 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
51 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 51 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
52 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", 52 NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt",
53 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 53 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
54 54
55 /* VIA/Cyrix/Centaur-defined */ 55 /* VIA/Cyrix/Centaur-defined */
@@ -59,10 +59,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
59 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 59 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
60 60
61 /* AMD-defined (#2) */ 61 /* AMD-defined (#2) */
62 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", 62 "lahf_lm", "cmp_legacy", "svm", "extapic",
63 "altmovcr8", "abm", "sse4a", 63 "cr8_legacy", "abm", "sse4a", "misalignsse",
64 "misalignsse", "3dnowprefetch", 64 "3dnowprefetch", "osvw", "ibs", "sse5",
65 "osvw", "ibs", NULL, NULL, NULL, NULL, 65 "skinit", "wdt", NULL, NULL,
66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
68 68
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 639e6320518e..88bb83ec895f 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -17,19 +17,19 @@
17#include <asm/io_apic.h> 17#include <asm/io_apic.h>
18#include <asm/apic.h> 18#include <asm/apic.h>
19 19
20#ifdef CONFIG_IOMMU 20#ifdef CONFIG_GART_IOMMU
21#include <asm/iommu.h> 21#include <asm/gart.h>
22#endif 22#endif
23 23
24static void __init via_bugs(void) 24static void __init via_bugs(void)
25{ 25{
26#ifdef CONFIG_IOMMU 26#ifdef CONFIG_GART_IOMMU
27 if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 27 if ((end_pfn > MAX_DMA32_PFN || force_iommu) &&
28 !iommu_aperture_allowed) { 28 !gart_iommu_aperture_allowed) {
29 printk(KERN_INFO 29 printk(KERN_INFO
30 "Looks like a VIA chipset. Disabling IOMMU." 30 "Looks like a VIA chipset. Disabling IOMMU."
31 " Override with iommu=allowed\n"); 31 " Override with iommu=allowed\n");
32 iommu_aperture_disabled = 1; 32 gart_iommu_aperture_disabled = 1;
33 } 33 }
34#endif 34#endif
35} 35}
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 1a20fe31338b..6bf1f716909d 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -36,7 +36,7 @@
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/scatterlist.h> 38#include <linux/scatterlist.h>
39#include <asm/iommu.h> 39#include <asm/gart.h>
40#include <asm/calgary.h> 40#include <asm/calgary.h>
41#include <asm/tce.h> 41#include <asm/tce.h>
42#include <asm/pci-direct.h> 42#include <asm/pci-direct.h>
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index 393e2725a6e3..aa805b11b24f 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/dmar.h> 10#include <linux/dmar.h>
11#include <asm/io.h> 11#include <asm/io.h>
12#include <asm/iommu.h> 12#include <asm/gart.h>
13#include <asm/calgary.h> 13#include <asm/calgary.h>
14 14
15int iommu_merge __read_mostly = 1; 15int iommu_merge __read_mostly = 1;
@@ -275,7 +275,7 @@ __init int iommu_setup(char *p)
275 swiotlb = 1; 275 swiotlb = 1;
276#endif 276#endif
277 277
278#ifdef CONFIG_IOMMU 278#ifdef CONFIG_GART_IOMMU
279 gart_parse_options(p); 279 gart_parse_options(p);
280#endif 280#endif
281 281
@@ -298,8 +298,8 @@ void __init pci_iommu_alloc(void)
298 * The order of these functions is important for 298 * The order of these functions is important for
299 * fall-back/fail-over reasons 299 * fall-back/fail-over reasons
300 */ 300 */
301#ifdef CONFIG_IOMMU 301#ifdef CONFIG_GART_IOMMU
302 iommu_hole_init(); 302 gart_iommu_hole_init();
303#endif 303#endif
304 304
305#ifdef CONFIG_CALGARY_IOMMU 305#ifdef CONFIG_CALGARY_IOMMU
@@ -321,7 +321,7 @@ static int __init pci_iommu_init(void)
321 321
322 intel_iommu_init(); 322 intel_iommu_init();
323 323
324#ifdef CONFIG_IOMMU 324#ifdef CONFIG_GART_IOMMU
325 gart_iommu_init(); 325 gart_iommu_init();
326#endif 326#endif
327 327
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 79b514b381b1..06bcba536045 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -30,17 +30,17 @@
30#include <asm/mtrr.h> 30#include <asm/mtrr.h>
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/proto.h> 32#include <asm/proto.h>
33#include <asm/iommu.h> 33#include <asm/gart.h>
34#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
35#include <asm/swiotlb.h> 35#include <asm/swiotlb.h>
36#include <asm/dma.h> 36#include <asm/dma.h>
37#include <asm/k8.h> 37#include <asm/k8.h>
38 38
39unsigned long iommu_bus_base; /* GART remapping area (physical) */ 39static unsigned long iommu_bus_base; /* GART remapping area (physical) */
40static unsigned long iommu_size; /* size of remapping area bytes */ 40static unsigned long iommu_size; /* size of remapping area bytes */
41static unsigned long iommu_pages; /* .. and in pages */ 41static unsigned long iommu_pages; /* .. and in pages */
42 42
43u32 *iommu_gatt_base; /* Remapping table */ 43static u32 *iommu_gatt_base; /* Remapping table */
44 44
45/* If this is disabled the IOMMU will use an optimized flushing strategy 45/* If this is disabled the IOMMU will use an optimized flushing strategy
46 of only flushing when an mapping is reused. With it true the GART is flushed 46 of only flushing when an mapping is reused. With it true the GART is flushed
@@ -135,8 +135,8 @@ static void flush_gart(void)
135/* Debugging aid for drivers that don't free their IOMMU tables */ 135/* Debugging aid for drivers that don't free their IOMMU tables */
136static void **iommu_leak_tab; 136static void **iommu_leak_tab;
137static int leak_trace; 137static int leak_trace;
138int iommu_leak_pages = 20; 138static int iommu_leak_pages = 20;
139void dump_leak(void) 139static void dump_leak(void)
140{ 140{
141 int i; 141 int i;
142 static int dump; 142 static int dump;
@@ -627,12 +627,12 @@ void __init gart_iommu_init(void)
627 return; 627 return;
628 628
629 /* Did we detect a different HW IOMMU? */ 629 /* Did we detect a different HW IOMMU? */
630 if (iommu_detected && !iommu_aperture) 630 if (iommu_detected && !gart_iommu_aperture)
631 return; 631 return;
632 632
633 if (no_iommu || 633 if (no_iommu ||
634 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 634 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
635 !iommu_aperture || 635 !gart_iommu_aperture ||
636 (no_agp && init_k8_gatt(&info) < 0)) { 636 (no_agp && init_k8_gatt(&info) < 0)) {
637 if (end_pfn > MAX_DMA32_PFN) { 637 if (end_pfn > MAX_DMA32_PFN) {
638 printk(KERN_ERR "WARNING more than 4GB of memory " 638 printk(KERN_ERR "WARNING more than 4GB of memory "
@@ -733,9 +733,9 @@ void __init gart_parse_options(char *p)
733 fix_aperture = 0; 733 fix_aperture = 0;
734 /* duplicated from pci-dma.c */ 734 /* duplicated from pci-dma.c */
735 if (!strncmp(p,"force",5)) 735 if (!strncmp(p,"force",5))
736 iommu_aperture_allowed = 1; 736 gart_iommu_aperture_allowed = 1;
737 if (!strncmp(p,"allowed",7)) 737 if (!strncmp(p,"allowed",7))
738 iommu_aperture_allowed = 1; 738 gart_iommu_aperture_allowed = 1;
739 if (!strncmp(p, "memaper", 7)) { 739 if (!strncmp(p, "memaper", 7)) {
740 fallback_aper_force = 1; 740 fallback_aper_force = 1;
741 p += 7; 741 p += 7;
diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index faf70bdca335..ab08e1832228 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
@@ -7,7 +7,7 @@
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8#include <linux/scatterlist.h> 8#include <linux/scatterlist.h>
9 9
10#include <asm/iommu.h> 10#include <asm/gart.h>
11#include <asm/processor.h> 11#include <asm/processor.h>
12#include <asm/dma.h> 12#include <asm/dma.h>
13 13
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index b2f405ea7c85..102866d729a5 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -5,7 +5,7 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/dma-mapping.h> 6#include <linux/dma-mapping.h>
7 7
8#include <asm/iommu.h> 8#include <asm/gart.h>
9#include <asm/swiotlb.h> 9#include <asm/swiotlb.h>
10#include <asm/dma.h> 10#include <asm/dma.h>
11 11
diff --git a/arch/x86/kernel/reboot_64.c b/arch/x86/kernel/reboot_64.c
index 776eb06b6512..71b13c5f5817 100644
--- a/arch/x86/kernel/reboot_64.c
+++ b/arch/x86/kernel/reboot_64.c
@@ -17,7 +17,7 @@
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include <asm/apic.h> 19#include <asm/apic.h>
20#include <asm/iommu.h> 20#include <asm/gart.h>
21 21
22/* 22/*
23 * Power off function, if any 23 * Power off function, if any
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index cc0e91447b76..e1e18c34c821 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -86,9 +86,6 @@ unsigned long mmu_cr4_features;
86 86
87/* for MCA, but anyone else can use it if they want */ 87/* for MCA, but anyone else can use it if they want */
88unsigned int machine_id; 88unsigned int machine_id;
89#ifdef CONFIG_MCA
90EXPORT_SYMBOL(machine_id);
91#endif
92unsigned int machine_submodel_id; 89unsigned int machine_submodel_id;
93unsigned int BIOS_revision; 90unsigned int BIOS_revision;
94unsigned int mca_pentium_flag; 91unsigned int mca_pentium_flag;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index e7a9e36bd52d..238633d3d09a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -1040,7 +1040,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1040 /* Intel-defined (#2) */ 1040 /* Intel-defined (#2) */
1041 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 1041 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
1042 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 1042 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
1043 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", 1043 NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt",
1044 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1044 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1045 1045
1046 /* VIA/Cyrix/Centaur-defined */ 1046 /* VIA/Cyrix/Centaur-defined */
@@ -1050,10 +1050,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1050 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1050 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1051 1051
1052 /* AMD-defined (#2) */ 1052 /* AMD-defined (#2) */
1053 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", 1053 "lahf_lm", "cmp_legacy", "svm", "extapic",
1054 "altmovcr8", "abm", "sse4a", 1054 "cr8_legacy", "abm", "sse4a", "misalignsse",
1055 "misalignsse", "3dnowprefetch", 1055 "3dnowprefetch", "osvw", "ibs", "sse5",
1056 "osvw", "ibs", NULL, NULL, NULL, NULL, 1056 "skinit", "wdt", NULL, NULL,
1057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1058 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1058 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1059 1059
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index fe608a45ffb6..13a474d3c6e9 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -40,7 +40,7 @@
40 40
41struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 41struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
42EXPORT_SYMBOL(node_data); 42EXPORT_SYMBOL(node_data);
43bootmem_data_t node0_bdata; 43static bootmem_data_t node0_bdata;
44 44
45/* 45/*
46 * numa interface - we expect the numa architecture specific code to have 46 * numa interface - we expect the numa architecture specific code to have
@@ -404,7 +404,7 @@ void __init set_highmem_pages_init(int bad_ppro)
404} 404}
405 405
406#ifdef CONFIG_MEMORY_HOTPLUG 406#ifdef CONFIG_MEMORY_HOTPLUG
407int paddr_to_nid(u64 addr) 407static int paddr_to_nid(u64 addr)
408{ 408{
409 int nid; 409 int nid;
410 unsigned long pfn = PFN_DOWN(addr); 410 unsigned long pfn = PFN_DOWN(addr);
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index f22c253bc09f..ccb1fa89de29 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -56,9 +56,9 @@ config AGP_AMD
56 X on AMD Irongate, 761, and 762 chipsets. 56 X on AMD Irongate, 761, and 762 chipsets.
57 57
58config AGP_AMD64 58config AGP_AMD64
59 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !IOMMU 59 tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU
60 depends on AGP && X86 60 depends on AGP && X86
61 default y if IOMMU 61 default y if GART_IOMMU
62 help 62 help
63 This option gives you AGP support for the GLX component of 63 This option gives you AGP support for the GLX component of
64 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. 64 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index d95662e96326..d8200ac8f8cb 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -787,7 +787,7 @@ static void __exit agp_amd64_cleanup(void)
787 787
788/* On AMD64 the PCI driver needs to initialize this driver early 788/* On AMD64 the PCI driver needs to initialize this driver early
789 for the IOMMU, so it has to be called via a backdoor. */ 789 for the IOMMU, so it has to be called via a backdoor. */
790#ifndef CONFIG_IOMMU 790#ifndef CONFIG_GART_IOMMU
791module_init(agp_amd64_init); 791module_init(agp_amd64_init);
792module_exit(agp_amd64_cleanup); 792module_exit(agp_amd64_cleanup);
793#endif 793#endif
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 9b35259eecfa..8af1d9a261e5 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -34,7 +34,7 @@
34#include "intel-iommu.h" 34#include "intel-iommu.h"
35#include <asm/proto.h> /* force_iommu in this header in x86-64*/ 35#include <asm/proto.h> /* force_iommu in this header in x86-64*/
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/iommu.h> 37#include <asm/gart.h>
38#include "pci.h" 38#include "pci.h"
39 39
40#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) 40#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index eb4ac47612a5..316a746e0080 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -434,7 +434,7 @@ int usb_sg_init (
434 if (dma) { 434 if (dma) {
435 io->urbs [i]->transfer_dma = sg_dma_address (sg + i); 435 io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
436 len = sg_dma_len (sg + i); 436 len = sg_dma_len (sg + i);
437#if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU) 437#if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU)
438 io->urbs[i]->transfer_buffer = NULL; 438 io->urbs[i]->transfer_buffer = NULL;
439#else 439#else
440 io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); 440 io->urbs[i]->transfer_buffer = sg_virt(&sg[i]);
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h
new file mode 100644
index 000000000000..f704c50519b8
--- /dev/null
+++ b/include/asm-x86/gart.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_X8664_IOMMU_H
2#define _ASM_X8664_IOMMU_H 1
3
4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void);
6extern int force_iommu, no_iommu;
7extern int iommu_detected;
8#ifdef CONFIG_GART_IOMMU
9extern void gart_iommu_init(void);
10extern void gart_iommu_shutdown(void);
11extern void __init gart_parse_options(char *);
12extern void gart_iommu_hole_init(void);
13extern int fallback_aper_order;
14extern int fallback_aper_force;
15extern int gart_iommu_aperture;
16extern int gart_iommu_aperture_allowed;
17extern int gart_iommu_aperture_disabled;
18extern int fix_aperture;
19#else
20#define gart_iommu_aperture 0
21#define gart_iommu_aperture_allowed 0
22
23static inline void gart_iommu_shutdown(void)
24{
25}
26
27#endif
28
29#endif
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index 5af471f228ee..07862fdd23c0 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_X8664_IOMMU_H 1#ifndef _ASM_X8664_GART_H
2#define _ASM_X8664_IOMMU_H 1 2#define _ASM_X8664_GART_H 1
3 3
4extern void pci_iommu_shutdown(void); 4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void); 5extern void no_iommu_init(void);
diff --git a/include/asm-x86/pci_64.h b/include/asm-x86/pci_64.h
index 9baa46d9f594..ef54226a9325 100644
--- a/include/asm-x86/pci_64.h
+++ b/include/asm-x86/pci_64.h
@@ -37,7 +37,7 @@ extern int iommu_setup(char *opt);
37 */ 37 */
38#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) 38#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
39 39
40#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU) 40#if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
41 41
42#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 42#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
43 dma_addr_t ADDR_NAME; 43 dma_addr_t ADDR_NAME;