David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 The Hafnium Authors. |
| 3 | * |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame] | 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. |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 9 | #include "hf/check.h" |
| 10 | |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 11 | #include "test/hftest.h" |
| 12 | |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 13 | bool hftest_ctrl_start(const struct fdt *fdt, struct memiter *cmd) |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 14 | { |
| 15 | struct fdt_node n; |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 16 | struct memiter bootargs; |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 17 | |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 18 | if (!fdt_find_node(fdt, "/chosen", &n)) { |
| 19 | HFTEST_LOG("Could not find '/chosen' node."); |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 20 | return false; |
| 21 | } |
| 22 | |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 23 | if (!fdt_read_property(&n, "bootargs", &bootargs)) { |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 24 | HFTEST_LOG("Unable to read bootargs."); |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | /* Remove null terminator. */ |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 29 | CHECK(memiter_restrict(&bootargs, 1)); |
| 30 | *cmd = bootargs; |
David Brazdil | 17e7665 | 2020-01-29 14:44:19 +0000 | [diff] [blame] | 31 | return true; |
| 32 | } |
| 33 | |
| 34 | void hftest_ctrl_finish(void) |
| 35 | { |
| 36 | /* Nothing to do. */ |
| 37 | } |
Olivier Deprez | ea0e019 | 2022-06-03 08:47:52 +0200 | [diff] [blame^] | 38 | |
| 39 | void hftest_ctrl_reboot(void) |
| 40 | { |
| 41 | /* Nothing to do. */ |
| 42 | } |