1 /* 2 * Copyright 2021 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/ffa.h" 13 #include "hf/mm.h" 14 #include "hf/std.h" 15 16 #include "vmapi/hf/call.h" 17 18 #include "test/abort.h" 19 #include "test/hftest.h" 20 #include "test/vmapi/ffa.h" 21 22 static struct ffa_boot_info_header* boot_info_header; 23 get_boot_info_header(void)24struct ffa_boot_info_header* get_boot_info_header(void) 25 { 26 return boot_info_header; 27 } 28 29 alignas(4096) uint8_t kstack[MAX_CPUS][4096]; 30 31 bool sel1_secure_service = true; 32 33 void test_main_sp(bool); 34 kmain(struct ffa_boot_info_header * boot_info_blob)35noreturn void kmain(struct ffa_boot_info_header* boot_info_blob) 36 { 37 extern void secondary_ep_entry(void); 38 struct ffa_value res; 39 40 /* 41 * Initialize the stage-1 MMU and identity-map the entire address space. 42 */ 43 if (!hftest_mm_init()) { 44 HFTEST_LOG_FAILURE(); 45 HFTEST_LOG(HFTEST_LOG_INDENT "Memory initialization failed"); 46 abort(); 47 } 48 49 /* Register entry point for secondary vCPUs. */ 50 res = ffa_secondary_ep_register((uintptr_t)secondary_ep_entry); 51 EXPECT_EQ(res.func, FFA_SUCCESS_32); 52 53 boot_info_header = boot_info_blob; 54 55 /* Register RX/TX buffers via FFA_RXTX_MAP */ 56 set_up_mailbox(); 57 58 test_main_sp(true); 59 60 /* Do not expect to get to this point, so abort. */ 61 abort(); 62 } 63