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 | |
| 9 | #include <stdalign.h> |
| 10 | #include <stdint.h> |
| 11 | |
| 12 | #include "hf/arch/vm/interrupts.h" |
| 13 | |
| 14 | #include "hf/mm.h" |
| 15 | |
| 16 | #include "hftest_common.h" |
| 17 | #include "test/hftest.h" |
| 18 | |
| 19 | alignas(4096) uint8_t kstack[4096]; |
| 20 | |
J-Alves | 57caa38 | 2022-01-27 13:54:50 +0000 | [diff] [blame] | 21 | static struct ffa_boot_info_header* boot_info_header; |
| 22 | |
| 23 | struct ffa_boot_info_header* get_boot_info_header(void) |
| 24 | { |
| 25 | return boot_info_header; |
| 26 | } |
| 27 | |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 28 | extern struct hftest_test hftest_begin[]; |
| 29 | extern struct hftest_test hftest_end[]; |
| 30 | |
J-Alves | 57caa38 | 2022-01-27 13:54:50 +0000 | [diff] [blame] | 31 | void kmain(void* boot_info_blob) |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 32 | { |
| 33 | /* Dummy fdt. It is not really used */ |
| 34 | struct fdt fdt; |
| 35 | |
| 36 | /* |
| 37 | * Initialize the stage-1 MMU and identity-map the entire address space. |
| 38 | */ |
| 39 | if ((VM_TOOLCHAIN == 1) && !hftest_mm_init()) { |
| 40 | HFTEST_LOG("Memory initialization failed."); |
| 41 | goto out; |
| 42 | } |
| 43 | |
J-Alves | 57caa38 | 2022-01-27 13:54:50 +0000 | [diff] [blame] | 44 | boot_info_header = boot_info_blob; |
| 45 | |
J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 46 | /* |
| 47 | * Install the exception handler with no IRQ callback for now, so that |
| 48 | * exceptions are logged. |
| 49 | */ |
| 50 | exception_setup(NULL, NULL); |
| 51 | |
| 52 | hftest_use_list(hftest_begin, hftest_end - hftest_begin); |
| 53 | |
| 54 | hftest_command(&fdt); |
| 55 | |
| 56 | out: |
| 57 | hftest_ctrl_finish(); |
| 58 | } |