1 /*
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 "hf/check.h"
10 
11 #include "test/hftest.h"
12 
hftest_ctrl_start(const struct fdt * fdt,struct memiter * cmd)13 bool hftest_ctrl_start(const struct fdt *fdt, struct memiter *cmd)
14 {
15 	struct fdt_node n;
16 	struct memiter bootargs;
17 
18 	if (!fdt_find_node(fdt, "/chosen", &n)) {
19 		HFTEST_LOG("Could not find '/chosen' node.");
20 		return false;
21 	}
22 
23 	if (!fdt_read_property(&n, "bootargs", &bootargs)) {
24 		HFTEST_LOG("Unable to read bootargs.");
25 		return false;
26 	}
27 
28 	/* Remove null terminator. */
29 	CHECK(memiter_restrict(&bootargs, 1));
30 	*cmd = bootargs;
31 	return true;
32 }
33 
hftest_ctrl_finish(void)34 void hftest_ctrl_finish(void)
35 {
36 	/* Nothing to do. */
37 }
38 
hftest_ctrl_reboot(void)39 void hftest_ctrl_reboot(void)
40 {
41 	/* Nothing to do. */
42 }
43