[PATCH] ppc64: Remove redundant abs_to_phys() macro
[linux-2.6/mini2440.git] / include / asm-ppc64 / abs_addr.h
blob200db1c45f292a0b325793bee16126504f19bad3
1 #ifndef _ABS_ADDR_H
2 #define _ABS_ADDR_H
4 #include <linux/config.h>
6 /*
7 * c 2001 PPC 64 Team, IBM Corp
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
15 #include <asm/types.h>
16 #include <asm/page.h>
17 #include <asm/prom.h>
18 #include <asm/lmb.h>
20 #ifdef CONFIG_MSCHUNKS
22 struct mschunks_map {
23 unsigned long num_chunks;
24 unsigned long chunk_size;
25 unsigned long chunk_shift;
26 unsigned long chunk_mask;
27 u32 *mapping;
30 extern struct mschunks_map mschunks_map;
32 /* Chunks are 256 KB */
33 #define MSCHUNKS_CHUNK_SHIFT (18)
34 #define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT)
35 #define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1)
37 static inline unsigned long chunk_to_addr(unsigned long chunk)
39 return chunk << MSCHUNKS_CHUNK_SHIFT;
42 static inline unsigned long addr_to_chunk(unsigned long addr)
44 return addr >> MSCHUNKS_CHUNK_SHIFT;
47 static inline unsigned long phys_to_abs(unsigned long pa)
49 unsigned long chunk;
51 chunk = addr_to_chunk(pa);
53 if (chunk < mschunks_map.num_chunks)
54 chunk = mschunks_map.mapping[chunk];
56 return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK);
59 #else /* !CONFIG_MSCHUNKS */
61 #define chunk_to_addr(chunk) ((unsigned long)(chunk))
62 #define addr_to_chunk(addr) (addr)
63 #define chunk_offset(addr) (0)
64 #define abs_chunk(pchunk) (pchunk)
66 #define phys_to_abs(pa) (pa)
67 #define physRpn_to_absRpn(rpn) (rpn)
69 #endif /* !CONFIG_MSCHUNKS */
71 /* Convenience macros */
72 #define virt_to_abs(va) phys_to_abs(__pa(va))
73 #define abs_to_virt(aa) __va(aa)
75 #endif /* _ABS_ADDR_H */