diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2006-03-27 04:16:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:48 -0500 |
commit | 22a9835c350782a5c3257343713932af3ac92ee0 (patch) | |
tree | 9688e99426e8aa85a468cc724ffee32c6a8abcad | |
parent | 95144c788dc01b6a0ff2c9c2222e37ffdab358b8 (diff) |
[PATCH] unify PFN_* macros
Just about every architecture defines some macros to do operations on pfns.
They're all virtually identical. This patch consolidates all of them.
One minor glitch is that at least i386 uses them in a very skeletal header
file. To keep away from #include dependency hell, I stuck the new
definitions in a new, isolated header.
Of all of the implementations, sh64 is the only one that varied by a bit.
It used some masks to ensure that any sign-extension got ripped away before
the arithmetic is done. This has been posted to that sh64 maintainers and
the development list.
Compiles on x86, x86_64, ia64 and ppc64.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/alpha/kernel/setup.c | 9 | ||||
-rw-r--r-- | arch/alpha/mm/numa.c | 4 | ||||
-rw-r--r-- | arch/arm26/mm/init.c | 7 | ||||
-rw-r--r-- | arch/cris/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/i386/kernel/setup.c | 1 | ||||
-rw-r--r-- | arch/i386/mm/discontig.c | 1 | ||||
-rw-r--r-- | arch/m32r/kernel/setup.c | 1 | ||||
-rw-r--r-- | arch/m32r/mm/discontig.c | 1 | ||||
-rw-r--r-- | arch/m32r/mm/init.c | 1 | ||||
-rw-r--r-- | arch/mips/ite-boards/ivr/init.c | 3 | ||||
-rw-r--r-- | arch/mips/ite-boards/qed-4n-s01b/init.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/setup.c | 9 | ||||
-rw-r--r-- | arch/mips/mips-boards/generic/memory.c | 7 | ||||
-rw-r--r-- | arch/mips/mips-boards/sim/sim_mem.c | 7 | ||||
-rw-r--r-- | arch/mips/mm/init.c | 4 | ||||
-rw-r--r-- | arch/mips/sgi-ip27/ip27-memory.c | 3 | ||||
-rw-r--r-- | arch/sh/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/sh64/kernel/setup.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/physmem.c | 3 | ||||
-rw-r--r-- | include/asm-i386/setup.h | 4 | ||||
-rw-r--r-- | include/asm-m32r/setup.h | 4 | ||||
-rw-r--r-- | include/asm-sh64/platform.h | 5 | ||||
-rw-r--r-- | include/linux/pfn.h | 9 |
23 files changed, 29 insertions, 68 deletions
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index b4e5f8ff2b25..9402624453c2 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/root_dev.h> | 34 | #include <linux/root_dev.h> |
35 | #include <linux/initrd.h> | 35 | #include <linux/initrd.h> |
36 | #include <linux/eisa.h> | 36 | #include <linux/eisa.h> |
37 | #include <linux/pfn.h> | ||
37 | #ifdef CONFIG_MAGIC_SYSRQ | 38 | #ifdef CONFIG_MAGIC_SYSRQ |
38 | #include <linux/sysrq.h> | 39 | #include <linux/sysrq.h> |
39 | #include <linux/reboot.h> | 40 | #include <linux/reboot.h> |
@@ -241,9 +242,6 @@ reserve_std_resources(void) | |||
241 | request_resource(io, standard_io_resources+i); | 242 | request_resource(io, standard_io_resources+i); |
242 | } | 243 | } |
243 | 244 | ||
244 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
245 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
246 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
247 | #define PFN_MAX PFN_DOWN(0x80000000) | 245 | #define PFN_MAX PFN_DOWN(0x80000000) |
248 | #define for_each_mem_cluster(memdesc, cluster, i) \ | 246 | #define for_each_mem_cluster(memdesc, cluster, i) \ |
249 | for ((cluster) = (memdesc)->cluster, (i) = 0; \ | 247 | for ((cluster) = (memdesc)->cluster, (i) = 0; \ |
@@ -472,11 +470,6 @@ page_is_ram(unsigned long pfn) | |||
472 | return 0; | 470 | return 0; |
473 | } | 471 | } |
474 | 472 | ||
475 | #undef PFN_UP | ||
476 | #undef PFN_DOWN | ||
477 | #undef PFN_PHYS | ||
478 | #undef PFN_MAX | ||
479 | |||
480 | void __init | 473 | void __init |
481 | setup_arch(char **cmdline_p) | 474 | setup_arch(char **cmdline_p) |
482 | { | 475 | { |
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c index 6d5251254f68..bf6b65c81bef 100644 --- a/arch/alpha/mm/numa.c +++ b/arch/alpha/mm/numa.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/bootmem.h> | 13 | #include <linux/bootmem.h> |
14 | #include <linux/swap.h> | 14 | #include <linux/swap.h> |
15 | #include <linux/initrd.h> | 15 | #include <linux/initrd.h> |
16 | #include <linux/pfn.h> | ||
16 | 17 | ||
17 | #include <asm/hwrpb.h> | 18 | #include <asm/hwrpb.h> |
18 | #include <asm/pgalloc.h> | 19 | #include <asm/pgalloc.h> |
@@ -27,9 +28,6 @@ bootmem_data_t node_bdata[MAX_NUMNODES]; | |||
27 | #define DBGDCONT(args...) | 28 | #define DBGDCONT(args...) |
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
31 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
32 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
33 | #define for_each_mem_cluster(memdesc, cluster, i) \ | 31 | #define for_each_mem_cluster(memdesc, cluster, i) \ |
34 | for ((cluster) = (memdesc)->cluster, (i) = 0; \ | 32 | for ((cluster) = (memdesc)->cluster, (i) = 0; \ |
35 | (i) < (memdesc)->numclusters; (i)++, (cluster)++) | 33 | (i) < (memdesc)->numclusters; (i)++, (cluster)++) |
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c index e3ecaa453747..7da8a5205678 100644 --- a/arch/arm26/mm/init.c +++ b/arch/arm26/mm/init.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/initrd.h> | 23 | #include <linux/initrd.h> |
24 | #include <linux/bootmem.h> | 24 | #include <linux/bootmem.h> |
25 | #include <linux/blkdev.h> | 25 | #include <linux/blkdev.h> |
26 | #include <linux/pfn.h> | ||
26 | 27 | ||
27 | #include <asm/segment.h> | 28 | #include <asm/segment.h> |
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
@@ -101,12 +102,6 @@ struct node_info { | |||
101 | int bootmap_pages; | 102 | int bootmap_pages; |
102 | }; | 103 | }; |
103 | 104 | ||
104 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
105 | #define PFN_UP(x) (PAGE_ALIGN(x) >> PAGE_SHIFT) | ||
106 | #define PFN_SIZE(x) ((x) >> PAGE_SHIFT) | ||
107 | #define PFN_RANGE(s,e) PFN_SIZE(PAGE_ALIGN((unsigned long)(e)) - \ | ||
108 | (((unsigned long)(s)) & PAGE_MASK)) | ||
109 | |||
110 | /* | 105 | /* |
111 | * FIXME: We really want to avoid allocating the bootmap bitmap | 106 | * FIXME: We really want to avoid allocating the bootmap bitmap |
112 | * over the top of the initrd. Hopefully, this is located towards | 107 | * over the top of the initrd. Hopefully, this is located towards |
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c index 1ba57efff60d..619a6eefd893 100644 --- a/arch/cris/kernel/setup.c +++ b/arch/cris/kernel/setup.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
19 | #include <linux/tty.h> | 19 | #include <linux/tty.h> |
20 | #include <linux/utsname.h> | 20 | #include <linux/utsname.h> |
21 | #include <linux/pfn.h> | ||
21 | 22 | ||
22 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
23 | 24 | ||
@@ -88,10 +89,6 @@ setup_arch(char **cmdline_p) | |||
88 | init_mm.end_data = (unsigned long) &_edata; | 89 | init_mm.end_data = (unsigned long) &_edata; |
89 | init_mm.brk = (unsigned long) &_end; | 90 | init_mm.brk = (unsigned long) &_end; |
90 | 91 | ||
91 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
92 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
93 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
94 | |||
95 | /* min_low_pfn points to the start of DRAM, start_pfn points | 92 | /* min_low_pfn points to the start of DRAM, start_pfn points |
96 | * to the first DRAM pages after the kernel, and max_low_pfn | 93 | * to the first DRAM pages after the kernel, and max_low_pfn |
97 | * to the end of DRAM. | 94 | * to the end of DRAM. |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 6917daa159ab..8c08660b4e5d 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/kexec.h> | 46 | #include <linux/kexec.h> |
47 | #include <linux/crash_dump.h> | 47 | #include <linux/crash_dump.h> |
48 | #include <linux/dmi.h> | 48 | #include <linux/dmi.h> |
49 | #include <linux/pfn.h> | ||
49 | 50 | ||
50 | #include <video/edid.h> | 51 | #include <video/edid.h> |
51 | 52 | ||
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index c3f3ae95e22d..fe6eb901326e 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/nodemask.h> | 31 | #include <linux/nodemask.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kexec.h> | 33 | #include <linux/kexec.h> |
34 | #include <linux/pfn.h> | ||
34 | 35 | ||
35 | #include <asm/e820.h> | 36 | #include <asm/e820.h> |
36 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c index d742037a7ccb..0d78942b4c76 100644 --- a/arch/m32r/kernel/setup.c +++ b/arch/m32r/kernel/setup.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/tty.h> | 24 | #include <linux/tty.h> |
25 | #include <linux/cpu.h> | 25 | #include <linux/cpu.h> |
26 | #include <linux/nodemask.h> | 26 | #include <linux/nodemask.h> |
27 | #include <linux/pfn.h> | ||
27 | 28 | ||
28 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
29 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c index 70c8528a0ad5..cf610a7c5ff0 100644 --- a/arch/m32r/mm/discontig.c +++ b/arch/m32r/mm/discontig.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/initrd.h> | 13 | #include <linux/initrd.h> |
14 | #include <linux/nodemask.h> | 14 | #include <linux/nodemask.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/pfn.h> | ||
16 | 17 | ||
17 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
18 | 19 | ||
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c index 2e0fe199ce38..b71348fec1f4 100644 --- a/arch/m32r/mm/init.c +++ b/arch/m32r/mm/init.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
20 | #include <linux/nodemask.h> | 20 | #include <linux/nodemask.h> |
21 | #include <linux/pfn.h> | ||
21 | #include <asm/types.h> | 22 | #include <asm/types.h> |
22 | #include <asm/processor.h> | 23 | #include <asm/processor.h> |
23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
diff --git a/arch/mips/ite-boards/ivr/init.c b/arch/mips/ite-boards/ivr/init.c index ea4e1935fec5..b774db035b31 100644 --- a/arch/mips/ite-boards/ivr/init.c +++ b/arch/mips/ite-boards/ivr/init.c | |||
@@ -45,9 +45,6 @@ extern void __init prom_init_cmdline(void); | |||
45 | extern unsigned long __init prom_get_memsize(void); | 45 | extern unsigned long __init prom_get_memsize(void); |
46 | extern void __init it8172_init_ram_resource(unsigned long memsize); | 46 | extern void __init it8172_init_ram_resource(unsigned long memsize); |
47 | 47 | ||
48 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
49 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) | ||
50 | |||
51 | const char *get_system_type(void) | 48 | const char *get_system_type(void) |
52 | { | 49 | { |
53 | return "Globespan IVR"; | 50 | return "Globespan IVR"; |
diff --git a/arch/mips/ite-boards/qed-4n-s01b/init.c b/arch/mips/ite-boards/qed-4n-s01b/init.c index 56dca7e0c21d..e8ec8be66a80 100644 --- a/arch/mips/ite-boards/qed-4n-s01b/init.c +++ b/arch/mips/ite-boards/qed-4n-s01b/init.c | |||
@@ -45,9 +45,6 @@ extern void __init prom_init_cmdline(void); | |||
45 | extern unsigned long __init prom_get_memsize(void); | 45 | extern unsigned long __init prom_get_memsize(void); |
46 | extern void __init it8172_init_ram_resource(unsigned long memsize); | 46 | extern void __init it8172_init_ram_resource(unsigned long memsize); |
47 | 47 | ||
48 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
49 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) | ||
50 | |||
51 | const char *get_system_type(void) | 48 | const char *get_system_type(void) |
52 | { | 49 | { |
53 | return "ITE QED-4N-S01B"; | 50 | return "ITE QED-4N-S01B"; |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 0cb3b6097e0e..dcbfd27071f0 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/highmem.h> | 34 | #include <linux/highmem.h> |
35 | #include <linux/console.h> | 35 | #include <linux/console.h> |
36 | #include <linux/mmzone.h> | 36 | #include <linux/mmzone.h> |
37 | #include <linux/pfn.h> | ||
37 | 38 | ||
38 | #include <asm/addrspace.h> | 39 | #include <asm/addrspace.h> |
39 | #include <asm/bootinfo.h> | 40 | #include <asm/bootinfo.h> |
@@ -257,10 +258,6 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en | |||
257 | return 0; | 258 | return 0; |
258 | } | 259 | } |
259 | 260 | ||
260 | #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) | ||
261 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
262 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
263 | |||
264 | #define MAXMEM HIGHMEM_START | 261 | #define MAXMEM HIGHMEM_START |
265 | #define MAXMEM_PFN PFN_DOWN(MAXMEM) | 262 | #define MAXMEM_PFN PFN_DOWN(MAXMEM) |
266 | 263 | ||
@@ -493,10 +490,6 @@ static inline void resource_init(void) | |||
493 | } | 490 | } |
494 | } | 491 | } |
495 | 492 | ||
496 | #undef PFN_UP | ||
497 | #undef PFN_DOWN | ||
498 | #undef PFN_PHYS | ||
499 | |||
500 | #undef MAXMEM | 493 | #undef MAXMEM |
501 | #undef MAXMEM_PFN | 494 | #undef MAXMEM_PFN |
502 | 495 | ||
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c index ee5e70c95cf3..32c9210373ac 100644 --- a/arch/mips/mips-boards/generic/memory.c +++ b/arch/mips/mips-boards/generic/memory.c | |||
@@ -49,9 +49,6 @@ static char *mtypes[3] = { | |||
49 | /* References to section boundaries */ | 49 | /* References to section boundaries */ |
50 | extern char _end; | 50 | extern char _end; |
51 | 51 | ||
52 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) | ||
53 | |||
54 | |||
55 | struct prom_pmemblock * __init prom_getmdesc(void) | 52 | struct prom_pmemblock * __init prom_getmdesc(void) |
56 | { | 53 | { |
57 | char *memsize_str; | 54 | char *memsize_str; |
@@ -109,10 +106,10 @@ struct prom_pmemblock * __init prom_getmdesc(void) | |||
109 | 106 | ||
110 | mdesc[3].type = yamon_dontuse; | 107 | mdesc[3].type = yamon_dontuse; |
111 | mdesc[3].base = 0x00100000; | 108 | mdesc[3].base = 0x00100000; |
112 | mdesc[3].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[3].base; | 109 | mdesc[3].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[3].base; |
113 | 110 | ||
114 | mdesc[4].type = yamon_free; | 111 | mdesc[4].type = yamon_free; |
115 | mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end)); | 112 | mdesc[4].base = CPHYSADDR(PAGE_ALIGN(&_end)); |
116 | mdesc[4].size = memsize - mdesc[4].base; | 113 | mdesc[4].size = memsize - mdesc[4].base; |
117 | 114 | ||
118 | return &mdesc[0]; | 115 | return &mdesc[0]; |
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c index 1ec4e75656bd..e57f737bab10 100644 --- a/arch/mips/mips-boards/sim/sim_mem.c +++ b/arch/mips/mips-boards/sim/sim_mem.c | |||
@@ -42,9 +42,6 @@ static char *mtypes[3] = { | |||
42 | /* References to section boundaries */ | 42 | /* References to section boundaries */ |
43 | extern char _end; | 43 | extern char _end; |
44 | 44 | ||
45 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) | ||
46 | |||
47 | |||
48 | struct prom_pmemblock * __init prom_getmdesc(void) | 45 | struct prom_pmemblock * __init prom_getmdesc(void) |
49 | { | 46 | { |
50 | unsigned int memsize; | 47 | unsigned int memsize; |
@@ -64,10 +61,10 @@ struct prom_pmemblock * __init prom_getmdesc(void) | |||
64 | 61 | ||
65 | mdesc[2].type = simmem_reserved; | 62 | mdesc[2].type = simmem_reserved; |
66 | mdesc[2].base = 0x00100000; | 63 | mdesc[2].base = 0x00100000; |
67 | mdesc[2].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[2].base; | 64 | mdesc[2].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[2].base; |
68 | 65 | ||
69 | mdesc[3].type = simmem_free; | 66 | mdesc[3].type = simmem_free; |
70 | mdesc[3].base = CPHYSADDR(PFN_ALIGN(&_end)); | 67 | mdesc[3].base = CPHYSADDR(PAGE_ALIGN(&_end)); |
71 | mdesc[3].size = memsize - mdesc[3].base; | 68 | mdesc[3].size = memsize - mdesc[3].base; |
72 | 69 | ||
73 | return &mdesc[0]; | 70 | return &mdesc[0]; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 52f7d59fe612..ad89c442f299 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/highmem.h> | 25 | #include <linux/highmem.h> |
26 | #include <linux/swap.h> | 26 | #include <linux/swap.h> |
27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
28 | #include <linux/pfn.h> | ||
28 | 29 | ||
29 | #include <asm/bootinfo.h> | 30 | #include <asm/bootinfo.h> |
30 | #include <asm/cachectl.h> | 31 | #include <asm/cachectl.h> |
@@ -177,9 +178,6 @@ void __init paging_init(void) | |||
177 | free_area_init(zones_size); | 178 | free_area_init(zones_size); |
178 | } | 179 | } |
179 | 180 | ||
180 | #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) | ||
181 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
182 | |||
183 | static inline int page_is_ram(unsigned long pagenr) | 181 | static inline int page_is_ram(unsigned long pagenr) |
184 | { | 182 | { |
185 | int i; | 183 | int i; |
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index e0d095daa5ed..6c00dce9f73f 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/nodemask.h> | 19 | #include <linux/nodemask.h> |
20 | #include <linux/swap.h> | 20 | #include <linux/swap.h> |
21 | #include <linux/bootmem.h> | 21 | #include <linux/bootmem.h> |
22 | #include <linux/pfn.h> | ||
22 | #include <asm/page.h> | 23 | #include <asm/page.h> |
23 | #include <asm/sections.h> | 24 | #include <asm/sections.h> |
24 | 25 | ||
@@ -28,8 +29,6 @@ | |||
28 | #include <asm/sn/sn_private.h> | 29 | #include <asm/sn/sn_private.h> |
29 | 30 | ||
30 | 31 | ||
31 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
32 | |||
33 | #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) | 32 | #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) |
34 | #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) | 33 | #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) |
35 | 34 | ||
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index c0e79843f580..7ee4ca203616 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/root_dev.h> | 20 | #include <linux/root_dev.h> |
21 | #include <linux/utsname.h> | 21 | #include <linux/utsname.h> |
22 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
23 | #include <linux/pfn.h> | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/sections.h> | 26 | #include <asm/sections.h> |
@@ -275,10 +276,6 @@ void __init setup_arch(char **cmdline_p) | |||
275 | 276 | ||
276 | sh_mv_setup(cmdline_p); | 277 | sh_mv_setup(cmdline_p); |
277 | 278 | ||
278 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
279 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
280 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
281 | |||
282 | /* | 279 | /* |
283 | * Find the highest page frame number we have available | 280 | * Find the highest page frame number we have available |
284 | */ | 281 | */ |
diff --git a/arch/sh64/kernel/setup.c b/arch/sh64/kernel/setup.c index c7a7b816a30f..d2711c9c9d13 100644 --- a/arch/sh64/kernel/setup.c +++ b/arch/sh64/kernel/setup.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/root_dev.h> | 48 | #include <linux/root_dev.h> |
49 | #include <linux/cpu.h> | 49 | #include <linux/cpu.h> |
50 | #include <linux/initrd.h> | 50 | #include <linux/initrd.h> |
51 | #include <linux/pfn.h> | ||
51 | #include <asm/processor.h> | 52 | #include <asm/processor.h> |
52 | #include <asm/page.h> | 53 | #include <asm/page.h> |
53 | #include <asm/pgtable.h> | 54 | #include <asm/pgtable.h> |
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 0e65340eee33..0500800df1c1 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "linux/vmalloc.h" | 9 | #include "linux/vmalloc.h" |
10 | #include "linux/bootmem.h" | 10 | #include "linux/bootmem.h" |
11 | #include "linux/module.h" | 11 | #include "linux/module.h" |
12 | #include "linux/pfn.h" | ||
12 | #include "asm/types.h" | 13 | #include "asm/types.h" |
13 | #include "asm/pgtable.h" | 14 | #include "asm/pgtable.h" |
14 | #include "kern_util.h" | 15 | #include "kern_util.h" |
@@ -316,8 +317,6 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len, | |||
316 | } | 317 | } |
317 | } | 318 | } |
318 | 319 | ||
319 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
320 | |||
321 | extern int __syscall_stub_start, __binary_start; | 320 | extern int __syscall_stub_start, __binary_start; |
322 | 321 | ||
323 | void setup_physmem(unsigned long start, unsigned long reserve_end, | 322 | void setup_physmem(unsigned long start, unsigned long reserve_end, |
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h index 826a8ca50ac8..ee941457b55d 100644 --- a/include/asm-i386/setup.h +++ b/include/asm-i386/setup.h | |||
@@ -6,9 +6,7 @@ | |||
6 | #ifndef _i386_SETUP_H | 6 | #ifndef _i386_SETUP_H |
7 | #define _i386_SETUP_H | 7 | #define _i386_SETUP_H |
8 | 8 | ||
9 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | 9 | #include <linux/pfn.h> |
10 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
11 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
12 | 10 | ||
13 | /* | 11 | /* |
14 | * Reserved space for vmalloc and iomap - defined in asm/page.h | 12 | * Reserved space for vmalloc and iomap - defined in asm/page.h |
diff --git a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h index 5f028dc26a9b..52f4fa29abfc 100644 --- a/include/asm-m32r/setup.h +++ b/include/asm-m32r/setup.h | |||
@@ -24,10 +24,6 @@ | |||
24 | #define RAMDISK_PROMPT_FLAG (0x8000) | 24 | #define RAMDISK_PROMPT_FLAG (0x8000) |
25 | #define RAMDISK_LOAD_FLAG (0x4000) | 25 | #define RAMDISK_LOAD_FLAG (0x4000) |
26 | 26 | ||
27 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
28 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
29 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
30 | |||
31 | extern unsigned long memory_start; | 27 | extern unsigned long memory_start; |
32 | extern unsigned long memory_end; | 28 | extern unsigned long memory_end; |
33 | 29 | ||
diff --git a/include/asm-sh64/platform.h b/include/asm-sh64/platform.h index 7046a9014027..bd0d9c405a80 100644 --- a/include/asm-sh64/platform.h +++ b/include/asm-sh64/platform.h | |||
@@ -61,9 +61,4 @@ extern int platform_int_priority[NR_INTC_IRQS]; | |||
61 | #define code_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 2]) | 61 | #define code_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 2]) |
62 | #define data_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 1]) | 62 | #define data_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 1]) |
63 | 63 | ||
64 | /* Be prepared to 64-bit sign extensions */ | ||
65 | #define PFN_UP(x) ((((x) + PAGE_SIZE-1) >> PAGE_SHIFT) & 0x000fffff) | ||
66 | #define PFN_DOWN(x) (((x) >> PAGE_SHIFT) & 0x000fffff) | ||
67 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
68 | |||
69 | #endif /* __ASM_SH64_PLATFORM_H */ | 64 | #endif /* __ASM_SH64_PLATFORM_H */ |
diff --git a/include/linux/pfn.h b/include/linux/pfn.h new file mode 100644 index 000000000000..bb01f8b92b56 --- /dev/null +++ b/include/linux/pfn.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _LINUX_PFN_H_ | ||
2 | #define _LINUX_PFN_H_ | ||
3 | |||
4 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) | ||
5 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | ||
6 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | ||
7 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | ||
8 | |||
9 | #endif | ||