diff options
author | Trent Piepho <tpiepho@freescale.com> | 2008-12-08 22:34:55 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-01-07 16:33:06 -0500 |
commit | 19f5465e823858a2f0b0e9a92e52816ba3ee70bb (patch) | |
tree | 4e4112f7d8e5a3699df5e808a83ac9eed44bd8d7 /arch/powerpc | |
parent | 565f37642c78754a85efe6c20a4a15e18ed21f07 (diff) |
powerpc/fsl-booke: Don't hard-code size of struct tlbcam
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>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 7 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_fsl_booke.S | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/fsl_booke_mmu.c | 8 | ||||
-rw-r--r-- | arch/powerpc/mm/mmu_decl.h | 9 |
4 files changed, 18 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 661d07d2146b..06958da94f17 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -56,6 +56,10 @@ | |||
56 | #include "head_booke.h" | 56 | #include "head_booke.h" |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #if defined(CONFIG_FSL_BOOKE) | ||
60 | #include "../mm/mmu_decl.h" | ||
61 | #endif | ||
62 | |||
59 | int main(void) | 63 | int main(void) |
60 | { | 64 | { |
61 | DEFINE(THREAD, offsetof(struct task_struct, thread)); | 65 | DEFINE(THREAD, offsetof(struct task_struct, thread)); |
@@ -384,6 +388,9 @@ int main(void) | |||
384 | DEFINE(PGD_T_LOG2, PGD_T_LOG2); | 388 | DEFINE(PGD_T_LOG2, PGD_T_LOG2); |
385 | DEFINE(PTE_T_LOG2, PTE_T_LOG2); | 389 | DEFINE(PTE_T_LOG2, PTE_T_LOG2); |
386 | #endif | 390 | #endif |
391 | #ifdef CONFIG_FSL_BOOKE | ||
392 | DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam)); | ||
393 | #endif | ||
387 | 394 | ||
388 | return 0; | 395 | return 0; |
389 | } | 396 | } |
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index 11b549acc034..805f28d30e49 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S | |||
@@ -909,7 +909,7 @@ KernelSPE: | |||
909 | _GLOBAL(loadcam_entry) | 909 | _GLOBAL(loadcam_entry) |
910 | lis r4,TLBCAM@ha | 910 | lis r4,TLBCAM@ha |
911 | addi r4,r4,TLBCAM@l | 911 | addi r4,r4,TLBCAM@l |
912 | mulli r5,r3,20 | 912 | mulli r5,r3,TLBCAM_SIZE |
913 | add r3,r5,r4 | 913 | add r3,r5,r4 |
914 | lwz r4,0(r3) | 914 | lwz r4,0(r3) |
915 | mtspr SPRN_MAS0,r4 | 915 | mtspr SPRN_MAS0,r4 |
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 23cee39534fd..c9ee59af1006 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c | |||
@@ -61,13 +61,7 @@ static unsigned long __cam0, __cam1, __cam2; | |||
61 | 61 | ||
62 | #define NUM_TLBCAMS (16) | 62 | #define NUM_TLBCAMS (16) |
63 | 63 | ||
64 | struct tlbcam { | 64 | struct tlbcam TLBCAM[NUM_TLBCAMS]; |
65 | u32 MAS0; | ||
66 | u32 MAS1; | ||
67 | u32 MAS2; | ||
68 | u32 MAS3; | ||
69 | u32 MAS7; | ||
70 | } TLBCAM[NUM_TLBCAMS]; | ||
71 | 65 | ||
72 | struct tlbcamrange { | 66 | struct tlbcamrange { |
73 | unsigned long start; | 67 | unsigned long start; |
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h index 4314b39b6faf..6f6ee62c2a04 100644 --- a/arch/powerpc/mm/mmu_decl.h +++ b/arch/powerpc/mm/mmu_decl.h | |||
@@ -75,6 +75,15 @@ extern void _tlbia(void); | |||
75 | #endif /* CONFIG_PPC_MMU_NOHASH */ | 75 | #endif /* CONFIG_PPC_MMU_NOHASH */ |
76 | 76 | ||
77 | #ifdef CONFIG_PPC32 | 77 | #ifdef CONFIG_PPC32 |
78 | |||
79 | struct tlbcam { | ||
80 | u32 MAS0; | ||
81 | u32 MAS1; | ||
82 | u32 MAS2; | ||
83 | u32 MAS3; | ||
84 | u32 MAS7; | ||
85 | }; | ||
86 | |||
78 | extern void mapin_ram(void); | 87 | extern void mapin_ram(void); |
79 | extern int map_page(unsigned long va, phys_addr_t pa, int flags); | 88 | extern int map_page(unsigned long va, phys_addr_t pa, int flags); |
80 | extern void setbat(int index, unsigned long virt, phys_addr_t phys, | 89 | extern void setbat(int index, unsigned long virt, phys_addr_t phys, |