2 * linux/include/asm-arm26/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
18 #define TASK_SIZE (0x01a00000UL)
21 * This decides where the kernel will search for a free chunk of vm
22 * space during mmap's.
24 #define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
29 #define PAGE_OFFSET (0x02000000UL)
30 #define PHYS_OFFSET (0x02000000UL)
32 #define PHYS_TO_NID(addr) (0)
35 * PFNs are used to describe any physical page; this means
36 * PFN 0 == physical address 0.
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.
42 #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
45 * These are *only* valid on the kernel direct mapped RAM memory.
47 static inline unsigned long virt_to_phys(void *x
)
49 return (unsigned long)x
;
52 static inline void *phys_to_virt(unsigned long x
)
54 return (void *)((unsigned long)x
);
57 #define __pa(x) (unsigned long)(x)
58 #define __va(x) ((void *)(unsigned long)(x))
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*.
65 #define virt_to_bus(x) ((unsigned long)(x))
66 #define bus_to_virt(x) ((void *)((unsigned long)(x)))
69 * Conversion between a struct page and a physical address.
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
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
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
84 #define ARCH_PFN_OFFSET (PHYS_PFN_OFFSET)
85 #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
87 #define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
88 #define virt_addr_valid(kaddr) ((int)(kaddr) >= PAGE_OFFSET && (int)(kaddr) < (unsigned long)high_memory)
91 * For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
93 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
96 * We should really eliminate virt_to_bus() here - it's depreciated.
98 #define page_to_bus(page) (page_address(page))
100 #include <asm-generic/memory_model.h>