blob: 52fcb8abd0ba6523bc71571bd46391e40893924f [file] [log] [blame]
David Brazdil0dbb41f2019-09-09 18:03:35 +01001/*
2 * Copyright 2019 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
17#include "hf/fdt_handler.h"
18#include "hf/plat/boot_flow.h"
19
20/* Set by arch-specific boot-time hook. */
21uintreg_t plat_fdt_addr;
22
23/**
24 * Returns the physical address of board FDT. This was passed to Hafnium in the
25 * first kernel arg by the boot loader.
26 */
27paddr_t plat_get_fdt_addr(void)
28{
29 return pa_init((uintpaddr_t)plat_fdt_addr);
30}
31
32/**
33 * When handing over to the primary, give it the same FDT address that was given
34 * to Hafnium. The FDT may have been modified during Hafnium init.
35 */
36uintreg_t plat_get_kernel_arg(void)
37{
38 return plat_fdt_addr;
39}
40
41/**
42 * Load initrd range from the board FDT.
43 */
44bool plat_get_initrd_range(const struct fdt_node *fdt_root, paddr_t *begin,
45 paddr_t *end)
46{
47 return fdt_find_initrd(fdt_root, begin, end);
48}