tree 98035e5581a0addfca935fa2d8afddfc7c56c631
parent 38e85dc18036804ada8698951cfad4e6114fec1b
author Michael Ellerman <[EMAIL PROTECTED]> Wed, 03 Aug 2005 20:21:23 +1000
committer Paul Mackerras <[EMAIL PROTECTED]> Mon, 29 Aug 2005 10:53:35 +1000

[PATCH] ppc64: msChunks cleanups

Chunks are 256KB, so use constants for the size/shift/mask, rather than
getting them from the msChunks struct. The iSeries debugger (??) might still
need access to the values in the msChunks struct, so we keep them around
for now, but set them from the constant values.

Replace msChunks_entry typedef with regular u32.

Simplify msChunks_alloc() to manipulate klimit directly, rather than via
a parameter.

Move msChunks_alloc() and msChunks into iSeries_setup.c, as that's where
they're used.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

 arch/ppc64/kernel/LparData.c      |   18 ------------------
 arch/ppc64/kernel/iSeries_setup.c |   20 ++++++++++++++++++--
 include/asm-ppc64/abs_addr.h      |   15 +++++++++------
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c
--- a/arch/ppc64/kernel/LparData.c
+++ b/arch/ppc64/kernel/LparData.c
@@ -225,21 +225,3 @@ struct ItVpdAreas itVpdAreas = {
                0,0
        }
 };
-
-struct msChunks msChunks;
-EXPORT_SYMBOL(msChunks);
-
-unsigned long
-msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long 
chunk_size)
-{
-       _msChunks->num_chunks  = num_chunks;
-       _msChunks->chunk_size  = chunk_size;
-       _msChunks->chunk_shift = __ilog2(chunk_size);
-       _msChunks->chunk_mask  = (1UL<<_msChunks->chunk_shift)-1;
-
-       mem = _ALIGN(mem, sizeof(msChunks_entry));
-       _msChunks->abs = (msChunks_entry *)mem;
-       mem += num_chunks * sizeof(msChunks_entry);
-
-       return mem;
-}
diff --git a/arch/ppc64/kernel/iSeries_setup.c 
b/arch/ppc64/kernel/iSeries_setup.c
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/ppc64/kernel/iSeries_setup.c
@@ -415,6 +415,22 @@ static void __init iSeries_init_early(vo
        DBG(" <- iSeries_init_early()\n");
 }
 
+struct msChunks msChunks = {
+       /* XXX We don't use these, but Piranha might need them. */
+       .chunk_size  = MSCHUNKS_CHUNK_SIZE,
+       .chunk_shift = MSCHUNKS_CHUNK_SHIFT,
+       .chunk_mask  = MSCHUNKS_OFFSET_MASK,
+};
+EXPORT_SYMBOL(msChunks);
+
+void msChunks_alloc(unsigned long num_chunks)
+{
+       klimit = _ALIGN(klimit, sizeof(u32));
+       msChunks.abs = (u32 *)klimit;
+       klimit += num_chunks * sizeof(u32);
+       msChunks.num_chunks = num_chunks;
+}
+
 /*
  * The iSeries may have very large memories ( > 128 GB ) and a partition
  * may get memory in "chunks" that may be anywhere in the 2**52 real
@@ -452,7 +468,7 @@ static void __init build_iSeries_Memory_
 
        /* Chunk size on iSeries is 256K bytes */
        totalChunks = (u32)HvLpConfig_getMsChunks();
-       klimit = msChunks_alloc(klimit, totalChunks, 1UL << 18);
+       msChunks_alloc(totalChunks);
 
        /*
         * Get absolute address of our load area
@@ -498,7 +514,7 @@ static void __init build_iSeries_Memory_
         */
        hptFirstChunk = (u32)addr_to_chunk(HvCallHpt_getHptAddress());
        hptSizePages = (u32)HvCallHpt_getHptPages();
-       hptSizeChunks = hptSizePages >> (msChunks.chunk_shift - PAGE_SHIFT);
+       hptSizeChunks = hptSizePages >> (MSCHUNKS_CHUNK_SHIFT - PAGE_SHIFT);
        hptLastChunk = hptFirstChunk + hptSizeChunks - 1;
 
        printk("HPT absolute addr = %016lx, size = %dK\n",
diff --git a/include/asm-ppc64/abs_addr.h b/include/asm-ppc64/abs_addr.h
--- a/include/asm-ppc64/abs_addr.h
+++ b/include/asm-ppc64/abs_addr.h
@@ -17,34 +17,37 @@
 #include <asm/prom.h>
 #include <asm/lmb.h>
 
-typedef u32 msChunks_entry;
 struct msChunks {
         unsigned long num_chunks;
         unsigned long chunk_size;
         unsigned long chunk_shift;
         unsigned long chunk_mask;
-        msChunks_entry *abs;
+        u32 *abs;
 };
 
 extern struct msChunks msChunks;
 
-extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned 
long);
 
 #ifdef CONFIG_MSCHUNKS
 
+/* Chunks are 256 KB */
+#define MSCHUNKS_CHUNK_SHIFT   (18)
+#define MSCHUNKS_CHUNK_SIZE    (1UL << MSCHUNKS_CHUNK_SHIFT)
+#define MSCHUNKS_OFFSET_MASK   (MSCHUNKS_CHUNK_SIZE - 1)
+
 static inline unsigned long chunk_to_addr(unsigned long chunk)
 {
-       return chunk << msChunks.chunk_shift;
+       return chunk << MSCHUNKS_CHUNK_SHIFT;
 }
 
 static inline unsigned long addr_to_chunk(unsigned long addr)
 {
-       return addr >> msChunks.chunk_shift;
+       return addr >> MSCHUNKS_CHUNK_SHIFT;
 }
 
 static inline unsigned long chunk_offset(unsigned long addr)
 {
-       return addr & msChunks.chunk_mask;
+       return addr & MSCHUNKS_OFFSET_MASK;
 }
 
 static inline unsigned long abs_chunk(unsigned long pchunk)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to