diff options
Diffstat (limited to 'include/asm-ppc64')
-rw-r--r-- | include/asm-ppc64/abs_addr.h | 36 | ||||
-rw-r--r-- | include/asm-ppc64/system.h | 2 |
2 files changed, 12 insertions, 26 deletions
diff --git a/include/asm-ppc64/abs_addr.h b/include/asm-ppc64/abs_addr.h index 6d4e8e787058..93dc63ed4f2f 100644 --- a/include/asm-ppc64/abs_addr.h +++ b/include/asm-ppc64/abs_addr.h | |||
@@ -29,46 +29,30 @@ struct msChunks { | |||
29 | extern struct msChunks msChunks; | 29 | extern struct msChunks msChunks; |
30 | 30 | ||
31 | extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); | 31 | extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); |
32 | extern unsigned long reloc_offset(void); | ||
33 | 32 | ||
34 | #ifdef CONFIG_MSCHUNKS | 33 | #ifdef CONFIG_MSCHUNKS |
35 | 34 | ||
36 | static inline unsigned long | 35 | static inline unsigned long chunk_to_addr(unsigned long chunk) |
37 | chunk_to_addr(unsigned long chunk) | ||
38 | { | 36 | { |
39 | unsigned long offset = reloc_offset(); | 37 | return chunk << msChunks.chunk_shift; |
40 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
41 | |||
42 | return chunk << _msChunks->chunk_shift; | ||
43 | } | 38 | } |
44 | 39 | ||
45 | static inline unsigned long | 40 | static inline unsigned long addr_to_chunk(unsigned long addr) |
46 | addr_to_chunk(unsigned long addr) | ||
47 | { | 41 | { |
48 | unsigned long offset = reloc_offset(); | 42 | return addr >> msChunks.chunk_shift; |
49 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
50 | |||
51 | return addr >> _msChunks->chunk_shift; | ||
52 | } | 43 | } |
53 | 44 | ||
54 | static inline unsigned long | 45 | static inline unsigned long chunk_offset(unsigned long addr) |
55 | chunk_offset(unsigned long addr) | ||
56 | { | 46 | { |
57 | unsigned long offset = reloc_offset(); | 47 | return addr & msChunks.chunk_mask; |
58 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
59 | |||
60 | return addr & _msChunks->chunk_mask; | ||
61 | } | 48 | } |
62 | 49 | ||
63 | static inline unsigned long | 50 | static inline unsigned long abs_chunk(unsigned long pchunk) |
64 | abs_chunk(unsigned long pchunk) | ||
65 | { | 51 | { |
66 | unsigned long offset = reloc_offset(); | 52 | if (pchunk >= msChunks.num_chunks) |
67 | struct msChunks *_msChunks = PTRRELOC(&msChunks); | ||
68 | if ( pchunk >= _msChunks->num_chunks ) { | ||
69 | return pchunk; | 53 | return pchunk; |
70 | } | 54 | |
71 | return PTRRELOC(_msChunks->abs)[pchunk]; | 55 | return msChunks.abs[pchunk]; |
72 | } | 56 | } |
73 | 57 | ||
74 | /* A macro so it can take pointers or unsigned long. */ | 58 | /* A macro so it can take pointers or unsigned long. */ |
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index 98d120ca8a91..4104a5dedbaa 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h | |||
@@ -302,5 +302,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
302 | 302 | ||
303 | #define arch_align_stack(x) (x) | 303 | #define arch_align_stack(x) (x) |
304 | 304 | ||
305 | extern unsigned long reloc_offset(void); | ||
306 | |||
305 | #endif /* __KERNEL__ */ | 307 | #endif /* __KERNEL__ */ |
306 | #endif | 308 | #endif |