aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2005-08-03 06:21:23 -0400
committerPaul Mackerras <paulus@samba.org>2005-08-28 20:53:35 -0400
commit38e85dc18036804ada8698951cfad4e6114fec1b (patch)
treee1c503d81ce23d1ac7d50897bb2b190db09ace5d
parentaed31351941aa990fb0865c186565a589c56d3fe (diff)
[PATCH] ppc64: Remove PTRRELOC() from msChunks code
The msChunks code was written to work on pSeries, but now it's only used on iSeries. This means there's no need to do PTRRELOC anymore, so remove it all. A few places were getting "extern reloc_offset()" from abs_addr.h, move it into system.h instead. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/ppc64/kernel/LparData.c10
-rw-r--r--include/asm-ppc64/abs_addr.h36
-rw-r--r--include/asm-ppc64/system.h2
3 files changed, 13 insertions, 35 deletions
diff --git a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c
index 3b9a2600fec2..0ed77b2f7d5f 100644
--- a/arch/ppc64/kernel/LparData.c
+++ b/arch/ppc64/kernel/LparData.c
@@ -229,24 +229,16 @@ struct ItVpdAreas itVpdAreas = {
229struct msChunks msChunks; 229struct msChunks msChunks;
230EXPORT_SYMBOL(msChunks); 230EXPORT_SYMBOL(msChunks);
231 231
232/* Depending on whether this is called from iSeries or pSeries setup
233 * code, the location of the msChunks struct may or may not have
234 * to be reloc'd, so we force the caller to do that for us by passing
235 * in a pointer to the structure.
236 */
237unsigned long 232unsigned long
238msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long chunk_size) 233msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long chunk_size)
239{ 234{
240 unsigned long offset = reloc_offset();
241 struct msChunks *_msChunks = PTRRELOC(&msChunks);
242
243 _msChunks->num_chunks = num_chunks; 235 _msChunks->num_chunks = num_chunks;
244 _msChunks->chunk_size = chunk_size; 236 _msChunks->chunk_size = chunk_size;
245 _msChunks->chunk_shift = __ilog2(chunk_size); 237 _msChunks->chunk_shift = __ilog2(chunk_size);
246 _msChunks->chunk_mask = (1UL<<_msChunks->chunk_shift)-1; 238 _msChunks->chunk_mask = (1UL<<_msChunks->chunk_shift)-1;
247 239
248 mem = _ALIGN(mem, sizeof(msChunks_entry)); 240 mem = _ALIGN(mem, sizeof(msChunks_entry));
249 _msChunks->abs = (msChunks_entry *)(mem + offset); 241 _msChunks->abs = (msChunks_entry *)mem;
250 mem += num_chunks * sizeof(msChunks_entry); 242 mem += num_chunks * sizeof(msChunks_entry);
251 243
252 return mem; 244 return mem;
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 {
29extern struct msChunks msChunks; 29extern struct msChunks msChunks;
30 30
31extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); 31extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long);
32extern unsigned long reloc_offset(void);
33 32
34#ifdef CONFIG_MSCHUNKS 33#ifdef CONFIG_MSCHUNKS
35 34
36static inline unsigned long 35static inline unsigned long chunk_to_addr(unsigned long chunk)
37chunk_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
45static inline unsigned long 40static inline unsigned long addr_to_chunk(unsigned long addr)
46addr_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
54static inline unsigned long 45static inline unsigned long chunk_offset(unsigned long addr)
55chunk_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
63static inline unsigned long 50static inline unsigned long abs_chunk(unsigned long pchunk)
64abs_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
305extern unsigned long reloc_offset(void);
306
305#endif /* __KERNEL__ */ 307#endif /* __KERNEL__ */
306#endif 308#endif