mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-05-23 22:31:32 +01:00
6767861c48
Add the Tenstorrent Atlantis as a generic-platform. This initial support enables the single_fw_region option, and verifies and prints HART PMA CSR configuration. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260424062520.238403-1-npiggin@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/*
|
|
* SPDX-FileCopyrightText: (c) 2025-2026 Tenstorrent USA, Inc.
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <sbi/riscv_asm.h>
|
|
#include <sbi/sbi_console.h>
|
|
#include <sbi/sbi_csr_detect.h>
|
|
|
|
#include <tenstorrent/ascalon.h>
|
|
#include <tenstorrent/pma.h>
|
|
|
|
#define CSR_PMACFG0 0x7e0
|
|
|
|
void tt_ascalon_discover_pmas_from_boot_hart(void)
|
|
{
|
|
struct sbi_trap_info trap = {0};
|
|
|
|
/* Whisper virtual platform does not implement PMA */
|
|
csr_read_allowed(CSR_PMACFG0, &trap);
|
|
if (trap.cause)
|
|
return;
|
|
|
|
for (unsigned int i = 0; i < TT_MAX_PMAS; i++) {
|
|
u64 pma = csr_read_num(CSR_PMACFG0 + i);
|
|
if (!tt_pma_validate(i, pma)) {
|
|
sbi_printf("HART%d: Bad boot PMA%02d 0x%016lx\n",
|
|
current_hartid(), i, pma);
|
|
}
|
|
tt_pma_set(i, pma);
|
|
|
|
if (pma)
|
|
tt_pma_print(i, pma);
|
|
}
|
|
}
|
|
|
|
void tt_ascalon_verify_pmas_nonboot_hart(void)
|
|
{
|
|
struct sbi_trap_info trap = {0};
|
|
|
|
/* Whisper virtual platform does not implement PMA */
|
|
csr_read_allowed(CSR_PMACFG0, &trap);
|
|
if (trap.cause)
|
|
return;
|
|
|
|
for (unsigned int i = 0; i < TT_MAX_PMAS; i++) {
|
|
u64 pma = csr_read_num(CSR_PMACFG0 + i);
|
|
if (pma != tt_pma_get(i)) {
|
|
sbi_printf("HART%d: Bad boot PMA%02d 0x%016lx does not match boot HART\n",
|
|
current_hartid(), i, pma);
|
|
}
|
|
}
|
|
}
|