diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-03 00:29:19 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-03 00:29:19 -0400 |
commit | 197b0ecd37e8c41015586ee9711c807b9b625b0b (patch) | |
tree | f7ba4a089353f3388d48cc783b0c5e982395a089 /sys/arch | |
parent | 99b2cad147b58b424f059c1fc49d68da57cf3bfa (diff) |
kernel/aarch64: Add 'board_info' structure
Introduce a 'board_info' structure as well as an md_get_board() routine
to get information about the host
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/aarch64/aarch64/machdep.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/arch/aarch64/aarch64/machdep.c b/sys/arch/aarch64/aarch64/machdep.c index 33d7c42..9a96cbb 100644 --- a/sys/arch/aarch64/aarch64/machdep.c +++ b/sys/arch/aarch64/aarch64/machdep.c @@ -31,6 +31,7 @@ #include <sys/panic.h> #include <machine/cpu.h> #include <machine/sync.h> +#include <machine/board.h> struct cpu_info g_bsp_ci = {0}; @@ -98,3 +99,13 @@ cpu_startup(struct cpu_info *ci) __ASMV("msr tpidr_el1, %0" :: "r" (ci)); md_cpu_init(); } + +void +md_get_board(struct board_info *res) +{ + uint64_t midr_el1; + + __ASMV("mrs %0, midr_el1" : "=r" (midr_el1)); + res->partno = (midr_el1 >> 4) & 0xFFF; + res->implementer = (midr_el1 >> 24) & 0xFF; +} |