aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-04-08 12:20:52 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:19:57 -0400
commitf9c258de3494a5249a61fe110ece2082e5927468 (patch)
tree53b6b8a031a1e99a76a579ab42d471356685fb86 /arch
parent85c246ee16fe00bf7bf9e7ff09a5d17d9a83cf71 (diff)
x86: unify pci-nommu
merge pci-base_32.c and pci-nommu_64.c into pci-nommu.c Their code were made the same, so now they can be merged. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/Makefile5
-rw-r--r--arch/x86/kernel/pci-base_32.c60
-rw-r--r--arch/x86/kernel/pci-dma.c8
-rw-r--r--arch/x86/kernel/pci-dma_64.c8
-rw-r--r--arch/x86/kernel/pci-nommu.c (renamed from arch/x86/kernel/pci-nommu_64.c)2
5 files changed, 11 insertions, 72 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 1799f76a6a9..307aee5e8c5 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -24,9 +24,8 @@ obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
24obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o setup64.o 24obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o setup64.o
25obj-y += pci-dma_$(BITS).o bootflag.o e820_$(BITS).o 25obj-y += pci-dma_$(BITS).o bootflag.o e820_$(BITS).o
26obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o 26obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o
27obj-y += alternative.o i8253.o 27obj-y += alternative.o i8253.o pci-nommu.o
28obj-$(CONFIG_X86_64) += pci-nommu_64.o bugs_64.o 28obj-$(CONFIG_X86_64) += bugs_64.o
29obj-$(CONFIG_X86_32) += pci-base_32.o
30obj-y += tsc_$(BITS).o io_delay.o rtc.o 29obj-y += tsc_$(BITS).o io_delay.o rtc.o
31 30
32obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o 31obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
diff --git a/arch/x86/kernel/pci-base_32.c b/arch/x86/kernel/pci-base_32.c
deleted file mode 100644
index b44ea517fcf..00000000000
--- a/arch/x86/kernel/pci-base_32.c
+++ /dev/null
@@ -1,60 +0,0 @@
1#include <linux/mm.h>
2#include <linux/kernel.h>
3#include <linux/module.h>
4#include <linux/dma-mapping.h>
5#include <asm/dma-mapping.h>
6
7static dma_addr_t pci32_map_single(struct device *dev, phys_addr_t ptr,
8 size_t size, int direction)
9{
10 WARN_ON(size == 0);
11 flush_write_buffers();
12 return ptr;
13}
14
15static int pci32_dma_map_sg(struct device *dev, struct scatterlist *sglist,
16 int nents, int direction)
17{
18 struct scatterlist *sg;
19 int i;
20
21 WARN_ON(nents == 0 || sglist[0].length == 0);
22
23 for_each_sg(sglist, sg, nents, i) {
24 BUG_ON(!sg_page(sg));
25
26 sg->dma_address = sg_phys(sg);
27 sg->dma_length = sg->length;
28 }
29
30 flush_write_buffers();
31 return nents;
32}
33
34/* Make sure we keep the same behaviour */
35static int pci32_map_error(dma_addr_t dma_addr)
36{
37 return 0;
38}
39
40const struct dma_mapping_ops pci32_dma_ops = {
41 .map_single = pci32_map_single,
42 .unmap_single = NULL,
43 .map_sg = pci32_dma_map_sg,
44 .unmap_sg = NULL,
45 .sync_single_for_cpu = NULL,
46 .sync_single_for_device = NULL,
47 .sync_single_range_for_cpu = NULL,
48 .sync_single_range_for_device = NULL,
49 .sync_sg_for_cpu = NULL,
50 .sync_sg_for_device = NULL,
51 .mapping_error = pci32_map_error,
52};
53
54/* this is temporary */
55int __init no_iommu_init(void)
56{
57 dma_ops = &pci32_dma_ops;
58 return 0;
59}
60fs_initcall(no_iommu_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 1323cd80387..37a558a9615 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -3,6 +3,14 @@
3const struct dma_mapping_ops *dma_ops; 3const struct dma_mapping_ops *dma_ops;
4EXPORT_SYMBOL(dma_ops); 4EXPORT_SYMBOL(dma_ops);
5 5
6#ifdef CONFIG_IOMMU_DEBUG
7int panic_on_overflow __read_mostly = 1;
8int force_iommu __read_mostly = 1;
9#else
10int panic_on_overflow __read_mostly = 0;
11int force_iommu __read_mostly = 0;
12#endif
13
6int dma_set_mask(struct device *dev, u64 mask) 14int dma_set_mask(struct device *dev, u64 mask)
7{ 15{
8 if (!dev->dma_mask || !dma_supported(dev, mask)) 16 if (!dev->dma_mask || !dma_supported(dev, mask))
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index e697b865c1a..9ef18bfad2a 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -27,14 +27,6 @@ EXPORT_SYMBOL(iommu_bio_merge);
27static int iommu_sac_force __read_mostly = 0; 27static int iommu_sac_force __read_mostly = 0;
28 28
29int no_iommu __read_mostly; 29int no_iommu __read_mostly;
30#ifdef CONFIG_IOMMU_DEBUG
31int panic_on_overflow __read_mostly = 1;
32int force_iommu __read_mostly = 1;
33#else
34int panic_on_overflow __read_mostly = 0;
35int force_iommu __read_mostly= 0;
36#endif
37
38/* Set this to 1 if there is a HW IOMMU in the system */ 30/* Set this to 1 if there is a HW IOMMU in the system */
39int iommu_detected __read_mostly = 0; 31int iommu_detected __read_mostly = 0;
40 32
diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu.c
index 8d036aee2a8..aec43d56f49 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu.c
@@ -14,7 +14,7 @@
14static int 14static int
15check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) 15check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
16{ 16{
17 if (hwdev && bus + size > *hwdev->dma_mask) { 17 if (hwdev && bus + size > *hwdev->dma_mask) {
18 if (*hwdev->dma_mask >= DMA_32BIT_MASK) 18 if (*hwdev->dma_mask >= DMA_32BIT_MASK)
19 printk(KERN_ERR 19 printk(KERN_ERR
20 "nommu_%s: overflow %Lx+%zu of device mask %Lx\n", 20 "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",