drivers: timer: get mtime cmp reg by reading mhartid

It is not guaranteed that a multi-core RISC-V hart numbering scheme
will match Zephyr's sequential cpu numbering scheme. Read the hartid and
use that value in calculation to get mtime_cmp reg, instead of the
current_cpu id.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
This commit is contained in:
Conor Paxton 2023-01-16 14:20:41 +00:00 committed by Lauren Murphy
commit 6b641c3483

View file

@ -74,7 +74,7 @@ const int32_t z_sys_timer_irq_for_test = TIMER_IRQN;
static uint64_t get_hart_mtimecmp(void)
{
return MTIMECMP_REG + (_current_cpu->id * 8);
return MTIMECMP_REG + (arch_proc_id() * 8);
}
static void set_mtimecmp(uint64_t time)