From 202333c881199b9f5845ab3ec35ebe521374936f Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 1 Nov 2018 16:05:06 +0100 Subject: [PATCH] hw: cortex a9 diagnostic register initialization We cannot count on the correct initialization of the diagnostic register of the secondary cores. But the boot core gets initialized by the bootchain, so we can copy over those values. Fix #3639 --- repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc | 7 ++++++- repos/base-hw/src/include/hw/spec/arm/cpu.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc b/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc index de148528a..ce339dc99 100644 --- a/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc +++ b/repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc @@ -109,13 +109,18 @@ unsigned Bootstrap::Platform::enable_mmu() static Cpu_counter data_cache_invalidated; static Cpu_counter data_cache_enabled; static Cpu_counter smp_coherency_enabled; + static unsigned long diag_reg = 0; bool primary = primary_cpu; - if (primary) primary_cpu = false; + if (primary) { + primary_cpu = false; + diag_reg = Cpu::Diag::read(); + } Cpu::Sctlr::init(); Cpu::Cpsr::init(); Actlr::disable_smp(); + Cpu::Diag::write(diag_reg); /* locally initialize interrupt controller */ ::Board::Pic pic { }; diff --git a/repos/base-hw/src/include/hw/spec/arm/cpu.h b/repos/base-hw/src/include/hw/spec/arm/cpu.h index 81f6619a5..3773cf309 100644 --- a/repos/base-hw/src/include/hw/spec/arm/cpu.h +++ b/repos/base-hw/src/include/hw/spec/arm/cpu.h @@ -249,6 +249,9 @@ struct Hw::Arm_cpu /* Physical Count register */ ARM_CP15_REGISTER_64BIT(Cntpct, c14, 0); + /* Diagnostic register */ + ARM_CP15_REGISTER_32BIT(Diag, c15, c0, 0, 1); + /****************************** ** Program status registers ** ******************************/