aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2006-03-27 04:16:04 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:48 -0500
commit22a9835c350782a5c3257343713932af3ac92ee0 (patch)
tree9688e99426e8aa85a468cc724ffee32c6a8abcad /arch/mips
parent95144c788dc01b6a0ff2c9c2222e37ffdab358b8 (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>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/ite-boards/ivr/init.c3
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/init.c3
-rw-r--r--arch/mips/kernel/setup.c9
-rw-r--r--arch/mips/mips-boards/generic/memory.c7
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c7
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c3
7 files changed, 7 insertions, 29 deletions
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);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern 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
51const char *get_system_type(void) 48const 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);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern 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
51const char *get_system_type(void) 48const 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 */
50extern char _end; 50extern char _end;
51 51
52#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
53
54
55struct prom_pmemblock * __init prom_getmdesc(void) 52struct 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 */
43extern char _end; 43extern char _end;
44 44
45#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
46
47
48struct prom_pmemblock * __init prom_getmdesc(void) 45struct 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
183static inline int page_is_ram(unsigned long pagenr) 181static 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