[PATCH] w1: Adds a sysfs entry (w1_master_search) that allows you to disable/enable...
[linux-2.6/verdex.git] / include / asm-arm / memory.h
blobe47bea7d17237de5a0cf86d998ff684ec5a5d8e7
1 /*
2 * linux/include/asm-arm/memory.h
4 * Copyright (C) 2000-2002 Russell King
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.
10 * Note: this file should not be included by non-asm/.h files
12 #ifndef __ASM_ARM_MEMORY_H
13 #define __ASM_ARM_MEMORY_H
15 #include <linux/config.h>
16 #include <linux/compiler.h>
17 #include <asm/arch/memory.h>
19 #ifndef TASK_SIZE
21 * TASK_SIZE - the maximum size of a user space task.
22 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
24 #define TASK_SIZE (0xbf000000UL)
25 #define TASK_UNMAPPED_BASE (0x40000000UL)
26 #endif
29 * The maximum size of a 26-bit user space task.
31 #define TASK_SIZE_26 (0x04000000UL)
34 * Page offset: 3GB
36 #ifndef PAGE_OFFSET
37 #define PAGE_OFFSET (0xc0000000UL)
38 #endif
41 * Physical vs virtual RAM address space conversion. These are
42 * private definitions which should NOT be used outside memory.h
43 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
45 #ifndef __virt_to_phys
46 #define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
47 #define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
48 #endif
51 * The module space lives between the addresses given by TASK_SIZE
52 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
54 #define MODULE_END (PAGE_OFFSET)
55 #define MODULE_START (MODULE_END - 16*1048576)
57 #if TASK_SIZE > MODULE_START
58 #error Top of user space clashes with start of module space
59 #endif
61 #ifndef __ASSEMBLY__
64 * The DMA mask corresponding to the maximum bus address allocatable
65 * using GFP_DMA. The default here places no restriction on DMA
66 * allocations. This must be the smallest DMA mask in the system,
67 * so a successful GFP_DMA allocation will always satisfy this.
69 #ifndef ISA_DMA_THRESHOLD
70 #define ISA_DMA_THRESHOLD (0xffffffffULL)
71 #endif
73 #ifndef arch_adjust_zones
74 #define arch_adjust_zones(node,size,holes) do { } while (0)
75 #endif
78 * PFNs are used to describe any physical page; this means
79 * PFN 0 == physical address 0.
81 * This is the PFN of the first RAM page in the kernel
82 * direct-mapped view. We assume this is the first page
83 * of RAM in the mem_map as well.
85 #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
88 * These are *only* valid on the kernel direct mapped RAM memory.
89 * Note: Drivers should NOT use these. They are the wrong
90 * translation for translating DMA addresses. Use the driver
91 * DMA support - see dma-mapping.h.
93 static inline unsigned long virt_to_phys(void *x)
95 return __virt_to_phys((unsigned long)(x));
98 static inline void *phys_to_virt(unsigned long x)
100 return (void *)(__phys_to_virt((unsigned long)(x)));
104 * Drivers should NOT use these either.
106 #define __pa(x) __virt_to_phys((unsigned long)(x))
107 #define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
110 * Virtual <-> DMA view memory address translations
111 * Again, these are *only* valid on the kernel direct mapped RAM
112 * memory. Use of these is *deprecated* (and that doesn't mean
113 * use the __ prefixed forms instead.) See dma-mapping.h.
115 static inline __deprecated unsigned long virt_to_bus(void *x)
117 return __virt_to_bus((unsigned long)x);
120 static inline __deprecated void *bus_to_virt(unsigned long x)
122 return (void *)__bus_to_virt(x);
126 * Conversion between a struct page and a physical address.
128 * Note: when converting an unknown physical address to a
129 * struct page, the resulting pointer must be validated
130 * using VALID_PAGE(). It must return an invalid struct page
131 * for any physical address not corresponding to a system
132 * RAM address.
134 * page_to_pfn(page) convert a struct page * to a PFN number
135 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
136 * pfn_valid(pfn) indicates whether a PFN number is valid
138 * virt_to_page(k) convert a _valid_ virtual address to struct page *
139 * virt_addr_valid(k) indicates whether a virtual address is valid
141 #ifndef CONFIG_DISCONTIGMEM
143 #define page_to_pfn(page) (((page) - mem_map) + PHYS_PFN_OFFSET)
144 #define pfn_to_page(pfn) ((mem_map + (pfn)) - PHYS_PFN_OFFSET)
145 #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
147 #define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
148 #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
150 #define PHYS_TO_NID(addr) (0)
152 #else /* CONFIG_DISCONTIGMEM */
155 * This is more complex. We have a set of mem_map arrays spread
156 * around in memory.
158 #include <linux/numa.h>
160 #define page_to_pfn(page) \
161 (( (page) - page_zone(page)->zone_mem_map) \
162 + page_zone(page)->zone_start_pfn)
163 #define pfn_to_page(pfn) \
164 (PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT))
165 #define pfn_valid(pfn) (PFN_TO_NID(pfn) < MAX_NUMNODES)
167 #define virt_to_page(kaddr) \
168 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
169 #define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
172 * Common discontigmem stuff.
173 * PHYS_TO_NID is used by the ARM kernel/setup.c
175 #define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
177 #endif /* !CONFIG_DISCONTIGMEM */
180 * For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
182 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
185 * Optional device DMA address remapping. Do _not_ use directly!
186 * We should really eliminate virt_to_bus() here - it's deprecated.
188 #ifndef __arch_page_to_dma
189 #define page_to_dma(dev, page) ((dma_addr_t)__virt_to_bus((unsigned long)page_address(page)))
190 #define dma_to_virt(dev, addr) ((void *)__bus_to_virt(addr))
191 #define virt_to_dma(dev, addr) ((dma_addr_t)__virt_to_bus((unsigned long)(addr)))
192 #else
193 #define page_to_dma(dev, page) (__arch_page_to_dma(dev, page))
194 #define dma_to_virt(dev, addr) (__arch_dma_to_virt(dev, addr))
195 #define virt_to_dma(dev, addr) (__arch_virt_to_dma(dev, addr))
196 #endif
198 #endif
200 #endif