blob: eb47272840403082493af94d89f4fa50ac7c4f1f [file] [log] [blame]
David Brazdil17e76652020-01-29 14:44:19 +00001/*
2 * Copyright 2020 The Hafnium Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
David Brazdilb856be62020-03-25 10:14:55 +000017#include "hf/check.h"
18
David Brazdil17e76652020-01-29 14:44:19 +000019#include "test/hftest.h"
20
David Brazdilb856be62020-03-25 10:14:55 +000021bool hftest_ctrl_start(const struct fdt *fdt, struct memiter *cmd)
David Brazdil17e76652020-01-29 14:44:19 +000022{
23 struct fdt_node n;
David Brazdilb856be62020-03-25 10:14:55 +000024 struct memiter bootargs;
David Brazdil17e76652020-01-29 14:44:19 +000025
David Brazdilb856be62020-03-25 10:14:55 +000026 if (!fdt_find_node(fdt, "/chosen", &n)) {
27 HFTEST_LOG("Could not find '/chosen' node.");
David Brazdil17e76652020-01-29 14:44:19 +000028 return false;
29 }
30
David Brazdilb856be62020-03-25 10:14:55 +000031 if (!fdt_read_property(&n, "bootargs", &bootargs)) {
David Brazdil17e76652020-01-29 14:44:19 +000032 HFTEST_LOG("Unable to read bootargs.");
33 return false;
34 }
35
36 /* Remove null terminator. */
David Brazdilb856be62020-03-25 10:14:55 +000037 CHECK(memiter_restrict(&bootargs, 1));
38 *cmd = bootargs;
David Brazdil17e76652020-01-29 14:44:19 +000039 return true;
40}
41
42void hftest_ctrl_finish(void)
43{
44 /* Nothing to do. */
45}