hw: cortex a9 diagnostic register fixup

This is a follow-up fix for commit 202333c881.
It checks for the diagnostic registers being already setup correctly.
Otherwise on platforms with secure firmware, like Pandaboard it will stuck.

Ref #3639
This commit is contained in:
Stefan Kalkowski 2020-03-23 13:00:03 +01:00 committed by Norman Feske
parent d8bcaa4fa4
commit 256b2fa3e1
1 changed files with 8 additions and 1 deletions

View File

@ -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 { };