Commit 16c00596 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Delegate L2 (and below) cache init at power on/reset to the HAL

Historically the kernel looked after all aspects of cache control since they were common across all ARMs. However, not all cache controllers are created equal, and sometimes more complex initialisation steps are needed than fit the generic coprocessor ops - for example the PL310 attached to a Cortex-A9 has memory mapped control registers.
Rather than clutter the kernel with one shot init code for every cache controller invented, we delegate that step to the HAL in HAL_Init. This is only a few hundred instructions later than where it was already being set. The kernel remains responsible for subsequent maintenance, this is just init which is being handed off.
A quick survey of the Cortex-A TRMs shows:
A5 - optional, for example ARM's PL310, ref TRM section 8.1.7.
A7 - optional, C bit of SCTLR, ref TRM section 1.1.
A8 - L2EN bit of ACTLR, note this bit has been recycled for other uses on other cores, ref TRM section 8.3.
A9 - not integrated, ARM's PL310 uses bit 0 of control register 1, ref PL310 TRM section 3.1.1.
A12 - see A17
A15 - integrated, C bit of SCTLR, ref TRM section 7.2.3.
A17 - integrated, bit 18 of L2CTLR & C bit of SCTLR, ref TRM section 7.2.
and while we've got the TRMs open, back fill the CPU id register table.

Version 5.35, 4.79.2.250. Tagged as 'Kernel-5_35-4_79_2_250'
parent 13123813
......@@ -182,6 +182,10 @@ SA1110:SA-1110 Processor
922T:ARM 922T Processor
X80200:80200 Processor
X80321:80321 Processor
CortexA8:Cortex-A8 Processor
CortexA9:Cortex-A9 Processor
ARM1176JZF_S:ARM1176JZF-S Processor
CA5:Cortex-A5 Processor
CA7:Cortex-A7 Processor
CA8:Cortex-A8 Processor
CA9:Cortex-A9 Processor
CA15:Cortex-A15 Processor
CA17:Cortex-A17 Processor
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.249"
Module_Date SETS "06 Dec 2014"
Module_ApplicationDate SETS "06-Dec-14"
Module_MinorVersion SETS "4.79.2.250"
Module_Date SETS "21 Dec 2014"
Module_ApplicationDate SETS "21-Dec-14"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.249)"
Module_HelpVersion SETS "5.35 (06 Dec 2014) 4.79.2.249"
Module_FullVersion SETS "5.35 (4.79.2.250)"
Module_HelpVersion SETS "5.35 (21 Dec 2014) 4.79.2.250"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.249
#define Module_Date_CMHG 06 Dec 2014
#define Module_MinorVersion_CMHG 4.79.2.250
#define Module_Date_CMHG 21 Dec 2014
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.249"
#define Module_Date "06 Dec 2014"
#define Module_MinorVersion "4.79.2.250"
#define Module_Date "21 Dec 2014"
#define Module_ApplicationDate "06-Dec-14"
#define Module_ApplicationDate "21-Dec-14"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.249)"
#define Module_HelpVersion "5.35 (06 Dec 2014) 4.79.2.249"
#define Module_FullVersion "5.35 (4.79.2.250)"
#define Module_HelpVersion "5.35 (21 Dec 2014) 4.79.2.250"
#define Module_LibraryVersionInfo "5:35"
......@@ -42,9 +42,14 @@ ARM920T # 1
ARM922T # 1
X80200 # 1
X80321 # 1
Cortex_A8 # 1
Cortex_A9 # 1
ARM1176JZF_S # 1
Cortex_A5 # 1
Cortex_A7 # 1
Cortex_A8 # 1
Cortex_A9 # 1
Cortex_A12 # 1
Cortex_A15 # 1
Cortex_A17 # 1
ARMunk * 255
; These flags are stored in ProcessorFlags and returned by OS_PlatformFeatures 0 (Read code features)
......
......@@ -624,26 +624,6 @@ Analyse_WB_CR7_Lx
ADRL a1, XCBTableWBR ; assume read-allocate WB/WT cache
STR a1, [v6, #MMU_PCBTrans]
; Enable L2 cache. This could probably be moved earlier on in the boot sequence
; (e.g. when the MMU is turned on), but for now it will go here to reduce the chances
; of stuff breaking
BL Cache_CleanInvalidateAll_WB_CR7_Lx ; Ensure L2 cache is clean
[ "$Machine"="CortexA9"
; write access to ACTLR is only permitted in Secure Mode
; so we must use smc API calls
STMFD sp!, {a2-a4,v3-v4,ip}
LDR ip, =0x102 ; enable/disable PL310 L2 Cache controller
MOV a1, #1 ; enable
myDSB
DCI 0xE1600070 ; SMC #0
LDMFD sp!, {a2-a4,v3-v4,ip}
|
MRC p15, 0, a1, c1, c0, 1
ORR a1, a1, #2 ; L2EN
MCR p15, 0, a1, c1, c0, 1
] ; M_CortexA9
B %FT90
] ; MEMM_Type = "VMSAv6"
......@@ -754,8 +734,13 @@ KnownCPUTable
; The cache size data is ignored for ARMv7.
KnownCPUTable_Fancy
CPUDesc ARM1176JZF_S, &00B760, &00FFF0, ARMvF, WB_CR7_LDc, 1, 16K, 4, 8, 16K, 4, 8
CPUDesc Cortex_A5, &00C050, &00FFF0, ARMvF, WB_CR7_Lx, 1, 16K, 32,16, 16K, 32,16
CPUDesc Cortex_A7, &00C070, &00FFF0, ARMvF, WB_CR7_Lx, 1, 16K, 32,16, 16K, 32,16
CPUDesc Cortex_A8, &00C080, &00FFF0, ARMvF, WB_CR7_Lx, 1, 16K, 32,16, 16K, 32,16
CPUDesc Cortex_A9, &00C090, &00FFF0, ARMvF, WB_CR7_Lx, 1, 32K, 32,16, 32K, 32,16
CPUDesc Cortex_A12, &00C0D0, &00FFF0, ARMvF, WB_CR7_Lx, 1, 32K, 32,16, 32K, 32,16
CPUDesc Cortex_A15, &00C0F0, &00FFF0, ARMvF, WB_CR7_Lx, 1, 32K, 32,16, 32K, 32,16
CPUDesc Cortex_A17, &00C0E0, &00FFF0, ARMvF, WB_CR7_Lx, 1, 32K, 32,16, 32K, 32,16
DCD -1
; Peculiar characteristics of individual ARMs not deducable otherwise. First field is
......@@ -777,9 +762,14 @@ KnownCPUFlags
DCD 0, 0 ; ARM 922T
DCD CPUFlag_ExtendedPages+CPUFlag_XScale, 0 ; X80200
DCD CPUFlag_XScale, 0 ; X80321
DCD 0, 0 ; ARM1176JZF_S
DCD 0, 0 ; Cortex_A5
DCD 0, 0 ; Cortex_A7
DCD 0, 0 ; Cortex_A8
DCD 0, 0 ; Cortex_A9
DCD 0, 0 ; ARM1176JZF_S
DCD 0, 0 ; Cortex_A12
DCD 0, 0 ; Cortex_A15
DCD 0, 0 ; Cortex_A17
[ MEMM_Type = "VMSAv6"
; --------------------------------------------------------------------------
......@@ -2274,9 +2264,14 @@ PNameTable
DCW PName_ARM922T - PNameTable
DCW PName_X80200 - PNameTable
DCW PName_X80321 - PNameTable
DCW PName_ARM1176JZF_S - PNameTable
DCW PName_Cortex_A5 - PNameTable
DCW PName_Cortex_A7 - PNameTable
DCW PName_Cortex_A8 - PNameTable
DCW PName_Cortex_A9 - PNameTable
DCW PName_ARM1176JZF_S - PNameTable
DCW PName_Cortex_A17 - PNameTable ; A12 rebranded as A17
DCW PName_Cortex_A15 - PNameTable
DCW PName_Cortex_A17 - PNameTable
PName_ARM600
= "600:ARM 600 Processor",0
......@@ -2308,12 +2303,20 @@ PName_X80200
= "X80200:80200 Processor",0
PName_X80321
= "X80321:80321 Processor",0
PName_Cortex_A8
= "CortexA8:Cortex-A8 Processor",0
PName_Cortex_A9
= "CortexA9:Cortex-A9 Processor",0
PName_ARM1176JZF_S
= "ARM1176JZF_S:ARM1176JZF-S Processor",0
PName_Cortex_A5
= "CA5:Cortex-A5 Processor",0
PName_Cortex_A7
= "CA7:Cortex-A7 Processor",0
PName_Cortex_A8
= "CA8:Cortex-A8 Processor",0
PName_Cortex_A9
= "CA9:Cortex-A9 Processor",0
PName_Cortex_A15
= "CA15:Cortex-A15 Processor",0
PName_Cortex_A17
= "CA17:Cortex-A17 Processor",0
ALIGN
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment