aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm26/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-arm26/memory.h')
-rw-r--r--include/asm-arm26/memory.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/include/asm-arm26/memory.h b/include/asm-arm26/memory.h
new file mode 100644
index 000000000000..20d78616f650
--- /dev/null
+++ b/include/asm-arm26/memory.h
@@ -0,0 +1,101 @@
1/*
2 * linux/include/asm-arm26/memory.h
3 *
4 * Copyright (C) 2000-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Note: this file should not be included by non-asm/.h files
11 */
12#ifndef __ASM_ARM_MEMORY_H
13#define __ASM_ARM_MEMORY_H
14
15/*
16 * User space: 26MB
17 */
18#define TASK_SIZE (0x01a00000UL)
19
20/*
21 * This decides where the kernel will search for a free chunk of vm
22 * space during mmap's.
23 */
24#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
25
26/*
27 * Page offset: 32MB
28 */
29#define PAGE_OFFSET (0x02000000UL)
30#define PHYS_OFFSET (0x02000000UL)
31
32#define PHYS_TO_NID(addr) (0)
33
34/*
35 * PFNs are used to describe any physical page; this means
36 * PFN 0 == physical address 0.
37 *
38 * This is the PFN of the first RAM page in the kernel
39 * direct-mapped view. We assume this is the first page
40 * of RAM in the mem_map as well.
41 */
42#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
43
44/*
45 * These are *only* valid on the kernel direct mapped RAM memory.
46 */
47static inline unsigned long virt_to_phys(void *x)
48{
49 return (unsigned long)x;
50}
51
52static inline void *phys_to_virt(unsigned long x)
53{
54 return (void *)((unsigned long)x);
55}
56
57#define __pa(x) (unsigned long)(x)
58#define __va(x) ((void *)(unsigned long)(x))
59
60/*
61 * Virtual <-> DMA view memory address translations
62 * Again, these are *only* valid on the kernel direct mapped RAM
63 * memory. Use of these is *depreciated*.
64 */
65#define virt_to_bus(x) ((unsigned long)(x))
66#define bus_to_virt(x) ((void *)((unsigned long)(x)))
67
68/*
69 * Conversion between a struct page and a physical address.
70 *
71 * Note: when converting an unknown physical address to a
72 * struct page, the resulting pointer must be validated
73 * using VALID_PAGE(). It must return an invalid struct page
74 * for any physical address not corresponding to a system
75 * RAM address.
76 *
77 * page_to_pfn(page) convert a struct page * to a PFN number
78 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
79 * pfn_valid(pfn) indicates whether a PFN number is valid
80 *
81 * virt_to_page(k) convert a _valid_ virtual address to struct page *
82 * virt_addr_valid(k) indicates whether a virtual address is valid
83 */
84#define page_to_pfn(page) (((page) - mem_map) + PHYS_PFN_OFFSET)
85#define pfn_to_page(pfn) ((mem_map + (pfn)) - PHYS_PFN_OFFSET)
86#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
87
88#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
89#define virt_addr_valid(kaddr) ((int)(kaddr) >= PAGE_OFFSET && (int)(kaddr) < (unsigned long)high_memory)
90
91/*
92 * For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
93 */
94#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
95
96/*
97 * We should really eliminate virt_to_bus() here - it's depreciated.
98 */
99#define page_to_bus(page) (page_address(page))
100
101#endif