blob: 71c2ce0c0f10ac2c8696e5c2b2373a6b395b3999 [file] [log] [blame]
J-Alves84c24b52020-12-02 11:05:05 +00001/*
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-Alves84c24b52020-12-02 11:05:05 +00009#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
18alignas(4096) uint8_t kstack[4096];
19
J-Alves57caa382022-01-27 13:54:50 +000020static struct ffa_boot_info_header* boot_info_header;
21
22struct ffa_boot_info_header* get_boot_info_header(void)
23{
24 return boot_info_header;
25}
26
Karl Meakin1923faf2025-03-19 14:54:52 +000027[[noreturn]] static void hftest_wait(void)
Olivier Deprezea0e0192022-06-03 08:47:52 +020028{
29 for (;;) {
30 interrupt_wait();
31 }
32}
33
J-Alves5f9d18d2022-08-09 11:16:56 +010034void kmain(struct ffa_boot_info_header* boot_info_blob)
J-Alves84c24b52020-12-02 11:05:05 +000035{
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-Alves57caa382022-01-27 13:54:50 +000047 boot_info_header = boot_info_blob;
48
J-Alves84c24b52020-12-02 11:05:05 +000049 /*
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-Alves84c24b52020-12-02 11:05:05 +000055 hftest_command(&fdt);
56
57out:
58 hftest_ctrl_finish();
Olivier Deprezea0e0192022-06-03 08:47:52 +020059 hftest_wait();
J-Alves84c24b52020-12-02 11:05:05 +000060}