powerpc/fsl-booke: Cleanup init/exception setup to be runtime
PATCH 1/2 powerpc/fsl-booke: Cleanup init/exception setup to be runtime
We currently have a few variants of fsl-booke processors (e500v1, e500v2, e500mc, and e200). They all have minor differences that we had previously been handling via ifdefs.
To move towards having this support the following changes have been made:
* PID1, PID2 only exist on e500v1 & e500v2 and should not be accessed on e500mc or e200. We use MMUCFG[NPIDS] to determine which case we are since we only touch PID1/2 in extremely early init code.
* Not all IVORs exist on all the processors so introduce cpu_setup functions for each variant to setup the proper IVORs that are either unique or exist but have some variations between the processors
--- arch/powerpc/include/asm/reg_booke.h | 1 + arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kernel/cpu_setup_fsl_booke.S | 31 +++++++++++ arch/powerpc/kernel/cputable.c | 8 +++ arch/powerpc/kernel/head_booke.h | 6 +- arch/powerpc/kernel/head_fsl_booke.S | 83 +++++++++++++++++++---------- 6 files changed, 99 insertions(+), 31 deletions(-) create mode 100644 arch/powerpc/kernel/cpu_setup_fsl_booke.S
arch/powerpc/include/asm/reg_booke.h +1 -0
@@ -110,6 +110,7 @@#define SPRN_L1CSR0 0x3F2/* L1 Cache Control and Status Register 0 */ #define SPRN_L1CSR1 0x3F3/* L1 Cache Control and Status Register 1 */ #define SPRN_MMUCSR0 0x3F4/* MMU Control and Status Register 0 */ +#define SPRN_MMUCFG 0x3F7/* MMU Configuration Register */ #define SPRN_PIT 0x3DB/* Programmable Interval Timer */ #define SPRN_BUCSR 0x3F5/* Branch Unit Control and Status */ #define SPRN_L2CSR0 0x3F9/* L2 Data Cache Control and Status Register 0 */
arch/powerpc/kernel/Makefile +1 -0
@@ -61,6 +61,7 @@ obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ obj64-$(CONFIG_HIBERNATION) += swsusp_asm64.o obj-$(CONFIG_MODULES) += module.o module_$(CONFIG_WORD_SIZE).o obj-$(CONFIG_44x) += cpu_setup_44x.o +obj-$(CONFIG_FSL_BOOKE) += cpu_setup_fsl_booke.o extra-$(CONFIG_PPC_STD_MMU) := head_32.o extra-$(CONFIG_PPC64) := head_64.o
arch/powerpc/kernel/cpu_setup_fsl_booke.S new file +31 -0
@@ -0,0 +1,31 @@ +/* + * This file contains low level CPU setup functions. + * Kumar Gala <[email protected]> + * Copyright 2009 Freescale Semiconductor, Inc. + * + * Based on cpu_setup_6xx code by + * Benjamin Herrenschmidt <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#include <asm/processor.h> +#include <asm/cputable.h> +#include <asm/ppc_asm.h> + +_GLOBAL(__setup_cpu_e200) + /* enable dedicated debug exception handling resources (Debug APU) */ + mfspr r3,SPRN_HID0 + ori r3,r3,HID0_DAPUEN@l + mtspr SPRN_HID0,r3 + b __setup_e200_ivors +_GLOBAL(__setup_cpu_e500v1) +_GLOBAL(__setup_cpu_e500v2) + b __setup_e500_ivors +_GLOBAL(__setup_cpu_e500mc) + b __setup_e500mc_ivors +
arch/powerpc/kernel/cputable.c +8 -0
@@ -35,6 +35,10 @@ const char *powerpc_base_platform;* and ppc64 */ #ifdef CONFIG_PPC32 +extern void __setup_cpu_e200 (unsigned long offset,struct cpu_spec * spec); +extern void __setup_cpu_e500v1 (unsigned long offset,struct cpu_spec * spec); +extern void __setup_cpu_e500v2 (unsigned long offset,struct cpu_spec * spec); +extern void __setup_cpu_e500mc (unsigned long offset,struct cpu_spec * spec);extern void __setup_cpu_440ep (unsigned long offset,struct cpu_spec * spec);extern void __setup_cpu_440epx (unsigned long offset,struct cpu_spec * spec);extern void __setup_cpu_440gx (unsigned long offset,struct cpu_spec * spec);
@@ -1687,6 +1691,7 @@ static struct cpu_spec __initdata cpu_specs[] = { PPC_FEATURE_UNIFIED_CACHE, .mmu_features = MMU_FTR_TYPE_FSL_E, .dcache_bsize = 32, + .cpu_setup = __setup_cpu_e200, .machine_check = machine_check_e200, .platform = "ppc5554", }
@@ -1706,6 +1711,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .num_pmcs = 4, .oprofile_cpu_type = "ppc/e500", .oprofile_type = PPC_OPROFILE_FSL_EMB, + .cpu_setup = __setup_cpu_e500v1, .machine_check = machine_check_e500, .platform = "ppc8540", },
@@ -1724,6 +1730,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .num_pmcs = 4, .oprofile_cpu_type = "ppc/e500", .oprofile_type = PPC_OPROFILE_FSL_EMB, + .cpu_setup = __setup_cpu_e500v2, .machine_check = machine_check_e500, .platform = "ppc8548", },
@@ -1739,6 +1746,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .num_pmcs = 4, .oprofile_cpu_type = "ppc/e500", /* xxx - galak, e500mc? */ .oprofile_type = PPC_OPROFILE_FSL_EMB, + .cpu_setup = __setup_cpu_e500mc, .machine_check = machine_check_e500, .platform = "ppce500mc", },
arch/powerpc/kernel/head_booke.h +3 -3
@@ -70,10 +70,10 @@/* only on e500mc/e200 */ #define DEBUG_STACK_BASE dbgirq_ctx -#ifdef CONFIG_PPC_E500MC -#define DEBUG_SPRG SPRN_SPRG9 -#else +#ifdef CONFIG_E200 #define DEBUG_SPRG SPRN_SPRG6W +#else +#define DEBUG_SPRG SPRN_SPRG9#endif #define EXC_LVL_FRAME_OVERHEAD (THREAD_SIZE - INT_FRAME_SIZE - EXC_LVL_SIZE)
arch/powerpc/kernel/head_fsl_booke.S +55 -28
139 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH 2/2 powerpc/e500mc: Doorbells need to be taken w/exceptions disabled
We use Doorbell interrupts for IPIs and thus we need to make sure we aren't interrupted in the process of processing the IPI.
--- arch/powerpc/kernel/head_fsl_booke.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/head_fsl_booke.S +1 -1
@@ -698,7 +698,7 @@ interrupt_base: /* Performance Monitor */ EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD) - EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_EE) + EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_STD) /* Debug Interrupt */ DEBUG_DEBUG_EXCEPTION
Signature · 1 line
1.5.6.5
RE: [PATCH 2/2] powerpc/e500mc: Doorbells need to be taken w/exceptionsdisabled
Quoted 41 lines
-----Original Message-----
From: [email protected]=20 [mailto:[email protected]]
On Behalf Of Kumar Gala
Sent: 2009?1?9? 8:15 AM
To: [email protected]
Subject: [PATCH 2/2] powerpc/e500mc: Doorbells need to be=20 taken w/exceptionsdisabled
=20
We use Doorbell interrupts for IPIs and thus we need to make=20 sure we aren't
interrupted in the process of processing the IPI.
=20Signed-off-by Kumar Gala <[email protected]>--- arch/powerpc/kernel/head_fsl_booke.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)=20
arch/powerpc/kernel/head_fsl_booke.S +1
-1@@ -698,7 +698,7 @@ interrupt_base: /* Performance Monitor */ EXCEPTION(0x2060, PerformanceMonitor,=20 performance_monitor_exception, EXC_XFER_STD) =09 - EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_EE) + EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_STD)=20
arch/powerpc/kernel/head_fsl_booke.S +0
-1/* Debug Interrupt */ DEBUG_DEBUG_EXCEPTION --=201.5.6.5
=20
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
=20