diff options
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 14 | ||||
-rw-r--r-- | arch/arm/include/asm/fixmap.h | 41 | ||||
-rw-r--r-- | arch/arm/include/asm/highmem.h | 31 | ||||
-rw-r--r-- | arch/arm/include/asm/kmap_types.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/memory.h | 14 |
5 files changed, 97 insertions, 4 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 22cb14ec3438..ff46dfa68a97 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -15,10 +15,20 @@ | |||
15 | * must not be used by drivers. | 15 | * must not be used by drivers. |
16 | */ | 16 | */ |
17 | #ifndef __arch_page_to_dma | 17 | #ifndef __arch_page_to_dma |
18 | |||
19 | #if !defined(CONFIG_HIGHMEM) | ||
18 | static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) | 20 | static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) |
19 | { | 21 | { |
20 | return (dma_addr_t)__virt_to_bus((unsigned long)page_address(page)); | 22 | return (dma_addr_t)__virt_to_bus((unsigned long)page_address(page)); |
21 | } | 23 | } |
24 | #elif defined(__pfn_to_bus) | ||
25 | static inline dma_addr_t page_to_dma(struct device *dev, struct page *page) | ||
26 | { | ||
27 | return (dma_addr_t)__pfn_to_bus(page_to_pfn(page)); | ||
28 | } | ||
29 | #else | ||
30 | #error "this machine class needs to define __arch_page_to_dma to use HIGHMEM" | ||
31 | #endif | ||
22 | 32 | ||
23 | static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) | 33 | static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) |
24 | { | 34 | { |
@@ -57,6 +67,8 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) | |||
57 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) | 67 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) |
58 | */ | 68 | */ |
59 | extern void dma_cache_maint(const void *kaddr, size_t size, int rw); | 69 | extern void dma_cache_maint(const void *kaddr, size_t size, int rw); |
70 | extern void dma_cache_maint_page(struct page *page, unsigned long offset, | ||
71 | size_t size, int rw); | ||
60 | 72 | ||
61 | /* | 73 | /* |
62 | * Return whether the given device DMA address mask can be supported | 74 | * Return whether the given device DMA address mask can be supported |
@@ -316,7 +328,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, | |||
316 | BUG_ON(!valid_dma_direction(dir)); | 328 | BUG_ON(!valid_dma_direction(dir)); |
317 | 329 | ||
318 | if (!arch_is_coherent()) | 330 | if (!arch_is_coherent()) |
319 | dma_cache_maint(page_address(page) + offset, size, dir); | 331 | dma_cache_maint_page(page, offset, size, dir); |
320 | 332 | ||
321 | return page_to_dma(dev, page) + offset; | 333 | return page_to_dma(dev, page) + offset; |
322 | } | 334 | } |
diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h new file mode 100644 index 000000000000..bbae919bceb4 --- /dev/null +++ b/arch/arm/include/asm/fixmap.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef _ASM_FIXMAP_H | ||
2 | #define _ASM_FIXMAP_H | ||
3 | |||
4 | /* | ||
5 | * Nothing too fancy for now. | ||
6 | * | ||
7 | * On ARM we already have well known fixed virtual addresses imposed by | ||
8 | * the architecture such as the vector page which is located at 0xffff0000, | ||
9 | * therefore a second level page table is already allocated covering | ||
10 | * 0xfff00000 upwards. | ||
11 | * | ||
12 | * The cache flushing code in proc-xscale.S uses the virtual area between | ||
13 | * 0xfffe0000 and 0xfffeffff. | ||
14 | */ | ||
15 | |||
16 | #define FIXADDR_START 0xfff00000UL | ||
17 | #define FIXADDR_TOP 0xfffe0000UL | ||
18 | #define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START) | ||
19 | |||
20 | #define FIX_KMAP_BEGIN 0 | ||
21 | #define FIX_KMAP_END (FIXADDR_SIZE >> PAGE_SHIFT) | ||
22 | |||
23 | #define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT)) | ||
24 | #define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT) | ||
25 | |||
26 | extern void __this_fixmap_does_not_exist(void); | ||
27 | |||
28 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
29 | { | ||
30 | if (idx >= FIX_KMAP_END) | ||
31 | __this_fixmap_does_not_exist(); | ||
32 | return __fix_to_virt(idx); | ||
33 | } | ||
34 | |||
35 | static inline unsigned int virt_to_fix(const unsigned long vaddr) | ||
36 | { | ||
37 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
38 | return __virt_to_fix(vaddr); | ||
39 | } | ||
40 | |||
41 | #endif | ||
diff --git a/arch/arm/include/asm/highmem.h b/arch/arm/include/asm/highmem.h new file mode 100644 index 000000000000..7f36d00600b4 --- /dev/null +++ b/arch/arm/include/asm/highmem.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _ASM_HIGHMEM_H | ||
2 | #define _ASM_HIGHMEM_H | ||
3 | |||
4 | #include <asm/kmap_types.h> | ||
5 | |||
6 | #define PKMAP_BASE (PAGE_OFFSET - PMD_SIZE) | ||
7 | #define LAST_PKMAP PTRS_PER_PTE | ||
8 | #define LAST_PKMAP_MASK (LAST_PKMAP - 1) | ||
9 | #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) | ||
10 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) | ||
11 | |||
12 | #define kmap_prot PAGE_KERNEL | ||
13 | |||
14 | #define flush_cache_kmaps() flush_cache_all() | ||
15 | |||
16 | extern pte_t *pkmap_page_table; | ||
17 | |||
18 | #define ARCH_NEEDS_KMAP_HIGH_GET | ||
19 | |||
20 | extern void *kmap_high(struct page *page); | ||
21 | extern void *kmap_high_get(struct page *page); | ||
22 | extern void kunmap_high(struct page *page); | ||
23 | |||
24 | extern void *kmap(struct page *page); | ||
25 | extern void kunmap(struct page *page); | ||
26 | extern void *kmap_atomic(struct page *page, enum km_type type); | ||
27 | extern void kunmap_atomic(void *kvaddr, enum km_type type); | ||
28 | extern void *kmap_atomic_pfn(unsigned long pfn, enum km_type type); | ||
29 | extern struct page *kmap_atomic_to_page(const void *ptr); | ||
30 | |||
31 | #endif | ||
diff --git a/arch/arm/include/asm/kmap_types.h b/arch/arm/include/asm/kmap_types.h index 45def13ee17a..d16ec97ec9a9 100644 --- a/arch/arm/include/asm/kmap_types.h +++ b/arch/arm/include/asm/kmap_types.h | |||
@@ -18,6 +18,7 @@ enum km_type { | |||
18 | KM_IRQ1, | 18 | KM_IRQ1, |
19 | KM_SOFTIRQ0, | 19 | KM_SOFTIRQ0, |
20 | KM_SOFTIRQ1, | 20 | KM_SOFTIRQ1, |
21 | KM_L2_CACHE, | ||
21 | KM_TYPE_NR | 22 | KM_TYPE_NR |
22 | }; | 23 | }; |
23 | 24 | ||
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 0202a7c20e62..85763db87449 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -44,14 +44,21 @@ | |||
44 | * The module space lives between the addresses given by TASK_SIZE | 44 | * The module space lives between the addresses given by TASK_SIZE |
45 | * and PAGE_OFFSET - it must be within 32MB of the kernel text. | 45 | * and PAGE_OFFSET - it must be within 32MB of the kernel text. |
46 | */ | 46 | */ |
47 | #define MODULES_END (PAGE_OFFSET) | 47 | #define MODULES_VADDR (PAGE_OFFSET - 16*1024*1024) |
48 | #define MODULES_VADDR (MODULES_END - 16*1048576) | ||
49 | |||
50 | #if TASK_SIZE > MODULES_VADDR | 48 | #if TASK_SIZE > MODULES_VADDR |
51 | #error Top of user space clashes with start of module space | 49 | #error Top of user space clashes with start of module space |
52 | #endif | 50 | #endif |
53 | 51 | ||
54 | /* | 52 | /* |
53 | * The highmem pkmap virtual space shares the end of the module area. | ||
54 | */ | ||
55 | #ifdef CONFIG_HIGHMEM | ||
56 | #define MODULES_END (PAGE_OFFSET - PMD_SIZE) | ||
57 | #else | ||
58 | #define MODULES_END (PAGE_OFFSET) | ||
59 | #endif | ||
60 | |||
61 | /* | ||
55 | * The XIP kernel gets mapped at the bottom of the module vm area. | 62 | * The XIP kernel gets mapped at the bottom of the module vm area. |
56 | * Since we use sections to map it, this macro replaces the physical address | 63 | * Since we use sections to map it, this macro replaces the physical address |
57 | * with its virtual address while keeping offset from the base section. | 64 | * with its virtual address while keeping offset from the base section. |
@@ -181,6 +188,7 @@ static inline void *phys_to_virt(unsigned long x) | |||
181 | #ifndef __virt_to_bus | 188 | #ifndef __virt_to_bus |
182 | #define __virt_to_bus __virt_to_phys | 189 | #define __virt_to_bus __virt_to_phys |
183 | #define __bus_to_virt __phys_to_virt | 190 | #define __bus_to_virt __phys_to_virt |
191 | #define __pfn_to_bus(x) ((x) << PAGE_SHIFT) | ||
184 | #endif | 192 | #endif |
185 | 193 | ||
186 | static inline __deprecated unsigned long virt_to_bus(void *x) | 194 | static inline __deprecated unsigned long virt_to_bus(void *x) |