From 256b2fa3e13a98d913405a988df94d3705711443 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Mon, 23 Mar 2020 13:00:03 +0100 Subject: [PATCH] hw: cortex a9 diagnostic register fixup This is a follow-up fix for commit 202333c881199b9f5845ab3ec35ebe521374936f. It checks for the diagnostic registers being already setup correctly. Otherwise on platforms with secure firmware, like Pandaboard it will stuck. Ref #3639 --- repos/base-hw/src/bootstrap/spec/arm/cortex_a9_mmu.cc | 9 ++++++++- 1 file changed, 8 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 3dece9e7e..1262bd089 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 @@ -120,7 +120,14 @@ unsigned Bootstrap::Platform::enable_mmu() Cpu::Sctlr::init(); Cpu::Cpsr::init(); Actlr::disable_smp(); - Cpu::Diag::write(diag_reg); + + /** + * this is a workaround for platforms with secure firmware + * where it is not allowed to access the diagnostic register from + * the non-secure-world, but we expect that the firmware already + * set it accordingly + */ + if (Cpu::Diag::read() != diag_reg) Cpu::Diag::write(diag_reg); /* locally initialize interrupt controller */ ::Board::Pic pic { };