Raghu Krishnamurthy | dd9d6c4 | 2021-05-02 01:11:26 -0700 | [diff] [blame] | 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/hftest.h" |
Federico Recanati | 69c554b | 2022-03-14 15:48:28 +0100 | [diff] [blame] | 19 | #include "test/vmapi/ffa.h" |
Raghu Krishnamurthy | dd9d6c4 | 2021-05-02 01:11:26 -0700 | [diff] [blame] | 20 | |
| 21 | alignas(4096) uint8_t kstack[4096]; |
| 22 | |
| 23 | HFTEST_ENABLE(); |
| 24 | |
| 25 | static struct hftest_context global_context; |
| 26 | |
| 27 | struct hftest_context *hftest_get_context(void) |
| 28 | { |
| 29 | return &global_context; |
| 30 | } |
| 31 | |
Federico Recanati | 632fa14 | 2022-04-27 13:14:58 +0200 | [diff] [blame] | 32 | bool sel1_secure_service = false; |
| 33 | |
Raghu Krishnamurthy | 50af660 | 2021-12-12 15:23:09 -0800 | [diff] [blame] | 34 | void test_main_sp(bool); |
Raghu Krishnamurthy | dd9d6c4 | 2021-05-02 01:11:26 -0700 | [diff] [blame] | 35 | |
| 36 | noreturn void abort(void) |
| 37 | { |
| 38 | HFTEST_LOG("Service contained failures."); |
| 39 | /* Cause a fault, as a secondary can't power down the machine. */ |
| 40 | *((volatile uint8_t *)1) = 1; |
| 41 | |
| 42 | /* This should never be reached, but to make the compiler happy... */ |
| 43 | for (;;) { |
| 44 | } |
| 45 | } |
| 46 | |
Raghu Krishnamurthy | 50af660 | 2021-12-12 15:23:09 -0800 | [diff] [blame] | 47 | noreturn void kmain(void) |
Raghu Krishnamurthy | dd9d6c4 | 2021-05-02 01:11:26 -0700 | [diff] [blame] | 48 | { |
Federico Recanati | 69c554b | 2022-03-14 15:48:28 +0100 | [diff] [blame] | 49 | /* Register RX/TX buffers via FFA_RXTX_MAP */ |
| 50 | set_up_mailbox(); |
| 51 | |
Raghu Krishnamurthy | 50af660 | 2021-12-12 15:23:09 -0800 | [diff] [blame] | 52 | test_main_sp(true); |
Raghu Krishnamurthy | dd9d6c4 | 2021-05-02 01:11:26 -0700 | [diff] [blame] | 53 | |
| 54 | /* Do not expect to get to this point, so abort. */ |
| 55 | abort(); |
| 56 | } |