diff options
| author | Randy Dunlap <rddunlap@osdl.org> | 2005-03-28 04:01:12 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-28 04:01:12 -0800 |
| commit | 2fd200244636c19389ded891665d8abb8d96d440 (patch) | |
| tree | 88fc9e76513ec4aeacbac2a29d4ecb30a71eb15f /include/asm-mips | |
| parent | 58aceba09b4f67abd309d199de8f2da375f45e88 (diff) | |
[PATCH] io_remap_pfn_range: add for all arch-es
This patch introduces a new interface function for mapping bus/device memory:
io_remap_pfn_range. This accepts the same parameters as remap_pfn_range and
io_remap_page_range but should be used in any situation where the caller is
not simply remapping ordinary RAM. For example, when mapping device registers
the new function should be used.
The distinction between remapping device memory and ordinary RAM is critical
for the Xen hypervisor.
This patch series also cleans up the remaining users of io_remap_page_range
(in particular, the several sparc-specific sections in various drivers that
use a special form of io_remap_page_range: an extra <iospace> argument for
SPARC arch.) by converting them to use io_remap_pfn_range(), where
io_remap_pfn_range() supports passing <iospace> as part of the pfn argument.
The sparc32 & sparc64 code needs live testing.
(from Keir:)
I have audited the drivers/ and sound/ directories. Most uses of
remap_pfn_range are okay, but there are a small handful that are remapping
device memory (mostly AGP and DRM drivers).
Of particular driver is the HPET driver, whose mmap function is broken even
for native (non-Xen) builds. If nothing else, vmalloc_to_phys should be used
instead of __pa to convert an ioremapped virtual address to a valid physical
address. The fix in this patch is to remember the original bus address as
probed at boot time and to pass this to io_remap_pfn_range.
io_remap_pfn_range():
add io_remap_pfn_range() for all arches;
add MK_IOSPACE_PFN(), GET_IOSPACE(), and GET_PFN()
for all arches but primarily for sparc32/64's extended IO space,
sparc: kill the hack of using low bit of <offset> to mean
write_combine or set side-effect (_PAGE_E) bit;
(DaveM suggested that I kill it;)
future: convert remaining callers of io_remap_page_range() to
io_remap_pfn_range() and deprecate io_remap_page_range();
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-mips')
| -rw-r--r-- | include/asm-mips/pgtable.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 61983c3fc9c3..878843203d67 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h @@ -367,11 +367,27 @@ static inline int io_remap_page_range(struct vm_area_struct *vma, phys_t phys_addr_high = fixup_bigphys_addr(paddr, size); return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot); } + +static inline int io_remap_pfn_range(struct vm_area_struct *vma, + unsigned long vaddr, + unsigned long pfn, + unsigned long size, + pgprot_t prot) +{ + phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); + return remap_pfn_range(vma, vaddr, pfn, size, prot); +} #else #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ - remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) + remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) +#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ + remap_pfn_range(vma, vaddr, pfn, size, prot) #endif +#define MK_IOSPACE_PFN(space, pfn) (pfn) +#define GET_IOSPACE(pfn) 0 +#define GET_PFN(pfn) (pfn) + #include <asm-generic/pgtable.h> /* |
