J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 The Hafnium Authors. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
| 7 | */ |
| 8 | |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 9 | #include <stdint.h> |
| 10 | |
| 11 | #include "hf/arch/vm/interrupts.h" |
| 12 | |
| 13 | #include "hf/mm.h" |
| 14 | |
| 15 | #include "hftest_common.h" |
| 16 | #include "test/hftest.h" |
| 17 | |
| 18 | alignas(4096) uint8_t kstack[4096]; |
| 19 | |
J-Alves | 57caa38 | 2022-01-27 13:54:50 +0000 | [diff] [blame] | 20 | static struct ffa_boot_info_header* boot_info_header; |
| 21 | |
| 22 | struct ffa_boot_info_header* get_boot_info_header(void) |
| 23 | { |
| 24 | return boot_info_header; |
| 25 | } |
| 26 | |
Karl Meakin | 1923faf | 2025-03-19 14:54:52 +0000 | [diff] [blame] | 27 | [[noreturn]] static void hftest_wait(void) |
Olivier Deprez | ea0e019 | 2022-06-03 08:47:52 +0200 | [diff] [blame] | 28 | { |
| 29 | for (;;) { |
| 30 | interrupt_wait(); |
| 31 | } |
| 32 | } |
| 33 | |
J-Alves | 5f9d18d | 2022-08-09 11:16:56 +0100 | [diff] [blame] | 34 | void kmain(struct ffa_boot_info_header* boot_info_blob) |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 35 | { |
| 36 | /* Dummy fdt. It is not really used */ |
| 37 | struct fdt fdt; |
| 38 | |
| 39 | /* |
| 40 | * Initialize the stage-1 MMU and identity-map the entire address space. |
| 41 | */ |
| 42 | if ((VM_TOOLCHAIN == 1) && !hftest_mm_init()) { |
| 43 | HFTEST_LOG("Memory initialization failed."); |
| 44 | goto out; |
| 45 | } |
| 46 | |
J-Alves | 57caa38 | 2022-01-27 13:54:50 +0000 | [diff] [blame] | 47 | boot_info_header = boot_info_blob; |
| 48 | |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 49 | /* |
| 50 | * Install the exception handler with no IRQ callback for now, so that |
| 51 | * exceptions are logged. |
| 52 | */ |
| 53 | exception_setup(NULL, NULL); |
| 54 | |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 55 | hftest_command(&fdt); |
| 56 | |
| 57 | out: |
| 58 | hftest_ctrl_finish(); |
Olivier Deprez | ea0e019 | 2022-06-03 08:47:52 +0200 | [diff] [blame] | 59 | hftest_wait(); |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 60 | } |