diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-01-05 09:36:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-06 08:06:50 -0500 |
commit | 4d9b977ca674dd40cfc1409a75cb73fca2cee423 (patch) | |
tree | 417f80889ab49c61c2258b157cfe993bdf8d8357 /arch/ia64/hp | |
parent | c82e4417ace9a3a4dddf3332379c771c41040040 (diff) |
set up dma_ops appropriately
This patch introduces a global pointer, dma_ops, which points to an
appropriate dma_mapping_ops that the kernel should use. This is a
common way to handle multiple dma_mapping_ops (X86, POWER, and SPARC).
dma_ops is set in platform_dma_init. We also set it by hand where
machvec_init is callev via subsys_initcall.
- IA64_DIG_VTD uses vtd_dma_ops.
- IA64_HP_ZX1 uses sba_dma_ops.
- IA64_HP_ZX1_SWIOTLB uses hwsw_dma_ops.
- IA64_SGI_SN2 uses sn_dma_ops.
- The rest use swiotlb_dma_ops.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/ia64/hp')
-rw-r--r-- | arch/ia64/hp/common/hwsw_iommu.c | 3 | ||||
-rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c index a40dcdd22eeb..22145ded58f6 100644 --- a/arch/ia64/hp/common/hwsw_iommu.c +++ b/arch/ia64/hp/common/hwsw_iommu.c | |||
@@ -56,9 +56,12 @@ use_swiotlb (struct device *dev) | |||
56 | return dev && dev->dma_mask && !hwiommu_dma_supported(dev, *dev->dma_mask); | 56 | return dev && dev->dma_mask && !hwiommu_dma_supported(dev, *dev->dma_mask); |
57 | } | 57 | } |
58 | 58 | ||
59 | struct dma_mapping_ops hwsw_dma_ops; | ||
60 | |||
59 | void __init | 61 | void __init |
60 | hwsw_init (void) | 62 | hwsw_init (void) |
61 | { | 63 | { |
64 | dma_ops = &hwsw_dma_ops; | ||
62 | /* default to a smallish 2MB sw I/O TLB */ | 65 | /* default to a smallish 2MB sw I/O TLB */ |
63 | if (swiotlb_late_init_with_default_size (2 * (1<<20)) != 0) { | 66 | if (swiotlb_late_init_with_default_size (2 * (1<<20)) != 0) { |
64 | #ifdef CONFIG_IA64_GENERIC | 67 | #ifdef CONFIG_IA64_GENERIC |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 655b9a17db93..e82870a76801 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -2065,6 +2065,8 @@ static struct acpi_driver acpi_sba_ioc_driver = { | |||
2065 | }, | 2065 | }, |
2066 | }; | 2066 | }; |
2067 | 2067 | ||
2068 | extern struct dma_mapping_ops swiotlb_dma_ops; | ||
2069 | |||
2068 | static int __init | 2070 | static int __init |
2069 | sba_init(void) | 2071 | sba_init(void) |
2070 | { | 2072 | { |
@@ -2078,6 +2080,7 @@ sba_init(void) | |||
2078 | * a successful kdump kernel boot is to use the swiotlb. | 2080 | * a successful kdump kernel boot is to use the swiotlb. |
2079 | */ | 2081 | */ |
2080 | if (is_kdump_kernel()) { | 2082 | if (is_kdump_kernel()) { |
2083 | dma_ops = &swiotlb_dma_ops; | ||
2081 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) | 2084 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) |
2082 | panic("Unable to initialize software I/O TLB:" | 2085 | panic("Unable to initialize software I/O TLB:" |
2083 | " Try machvec=dig boot option"); | 2086 | " Try machvec=dig boot option"); |
@@ -2093,6 +2096,7 @@ sba_init(void) | |||
2093 | * If we didn't find something sba_iommu can claim, we | 2096 | * If we didn't find something sba_iommu can claim, we |
2094 | * need to setup the swiotlb and switch to the dig machvec. | 2097 | * need to setup the swiotlb and switch to the dig machvec. |
2095 | */ | 2098 | */ |
2099 | dma_ops = &swiotlb_dma_ops; | ||
2096 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) | 2100 | if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0) |
2097 | panic("Unable to find SBA IOMMU or initialize " | 2101 | panic("Unable to find SBA IOMMU or initialize " |
2098 | "software I/O TLB: Try machvec=dig boot option"); | 2102 | "software I/O TLB: Try machvec=dig boot option"); |
@@ -2196,3 +2200,8 @@ struct dma_mapping_ops sba_dma_ops = { | |||
2196 | .dma_supported_op = sba_dma_supported, | 2200 | .dma_supported_op = sba_dma_supported, |
2197 | .mapping_error = sba_dma_mapping_error, | 2201 | .mapping_error = sba_dma_mapping_error, |
2198 | }; | 2202 | }; |
2203 | |||
2204 | void sba_dma_init(void) | ||
2205 | { | ||
2206 | dma_ops = &sba_dma_ops; | ||
2207 | } | ||