blob: 534e43438fbd1aab2b3ce9ce75e8b997d158b28e [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
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
19alignas(4096) uint8_t kstack[4096];
20
J-Alves57caa382022-01-27 13:54:50 +000021static struct ffa_boot_info_header* boot_info_header;
22
23struct ffa_boot_info_header* get_boot_info_header(void)
24{
25 return boot_info_header;
26}
27
J-Alves84c24b52020-12-02 11:05:05 +000028extern struct hftest_test hftest_begin[];
29extern struct hftest_test hftest_end[];
30
J-Alves57caa382022-01-27 13:54:50 +000031void kmain(void* boot_info_blob)
J-Alves84c24b52020-12-02 11:05:05 +000032{
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-Alves57caa382022-01-27 13:54:50 +000044 boot_info_header = boot_info_blob;
45
J-Alves84c24b52020-12-02 11:05:05 +000046 /*
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
56out:
57 hftest_ctrl_finish();
58}