]> Pileus Git - ~andy/linux/commitdiff
powerpc/fsl-booke: Don't hard-code size of struct tlbcam
authorTrent Piepho <tpiepho@freescale.com>
Tue, 9 Dec 2008 03:34:55 +0000 (19:34 -0800)
committerKumar Gala <galak@kernel.crashing.org>
Wed, 7 Jan 2009 21:33:06 +0000 (15:33 -0600)
Some assembly code in head_fsl_booke.S hard-coded the size of struct tlbcam
to 20 when it indexed the TLBCAM table.  Anyone changing the size of struct
tlbcam would not know to expect that.

The kernel already has a system to get the size of C structures into
assembly language files, asm-offsets, so let's use it.

The definition of the struct gets moved to a header, so that asm-offsets.c
can include it.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/head_fsl_booke.S
arch/powerpc/mm/fsl_booke_mmu.c
arch/powerpc/mm/mmu_decl.h

index 661d07d2146bcbead9cb44e2a43aff1b5151e562..06958da94f17a0d176d5e3fa878565b5718d2ce2 100644 (file)
 #include "head_booke.h"
 #endif
 
+#if defined(CONFIG_FSL_BOOKE)
+#include "../mm/mmu_decl.h"
+#endif
+
 int main(void)
 {
        DEFINE(THREAD, offsetof(struct task_struct, thread));
@@ -384,6 +388,9 @@ int main(void)
        DEFINE(PGD_T_LOG2, PGD_T_LOG2);
        DEFINE(PTE_T_LOG2, PTE_T_LOG2);
 #endif
+#ifdef CONFIG_FSL_BOOKE
+       DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam));
+#endif
 
        return 0;
 }
index 11b549acc0340909d3f5b253e73d12ec7fa3e589..805f28d30e49aee7c2c0b6cf7780844f7fb86379 100644 (file)
@@ -909,7 +909,7 @@ KernelSPE:
 _GLOBAL(loadcam_entry)
        lis     r4,TLBCAM@ha
        addi    r4,r4,TLBCAM@l
-       mulli   r5,r3,20
+       mulli   r5,r3,TLBCAM_SIZE
        add     r3,r5,r4
        lwz     r4,0(r3)
        mtspr   SPRN_MAS0,r4
index 23cee39534fddf8ab832658e6a3f0cb658cabec8..c9ee59af1006d8fb7b10bd2e28ba37db9711bdb9 100644 (file)
@@ -61,13 +61,7 @@ static unsigned long __cam0, __cam1, __cam2;
 
 #define NUM_TLBCAMS    (16)
 
-struct tlbcam {
-       u32     MAS0;
-       u32     MAS1;
-       u32     MAS2;
-       u32     MAS3;
-       u32     MAS7;
-} TLBCAM[NUM_TLBCAMS];
+struct tlbcam TLBCAM[NUM_TLBCAMS];
 
 struct tlbcamrange {
        unsigned long start;
index 4314b39b6faf6c5c83f517c4bed95d00b5191123..6f6ee62c2a047746f8eaf94d04c759819e73e2eb 100644 (file)
@@ -75,6 +75,15 @@ extern void _tlbia(void);
 #endif /* CONFIG_PPC_MMU_NOHASH */
 
 #ifdef CONFIG_PPC32
+
+struct tlbcam {
+       u32     MAS0;
+       u32     MAS1;
+       u32     MAS2;
+       u32     MAS3;
+       u32     MAS7;
+};
+
 extern void mapin_ram(void);
 extern int map_page(unsigned long va, phys_addr_t pa, int flags);
 extern void setbat(int index, unsigned long virt, phys_addr_t phys,