blob: 62ff2a48f7e0dd6e877f1275a6a8af10d14a6d25 [file] [log] [blame]
David Brazdil0dbb41f2019-09-09 18:03:35 +01001/*
2 * Copyright 2019 The Hafnium Authors.
3 *
Andrew Walbrane959ec12020-06-17 15:01:09 +01004 * 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 Brazdil0dbb41f2019-09-09 18:03:35 +01007 */
8
9#include "hf/layout.h"
10#include "hf/plat/boot_flow.h"
11
12/**
13 * FDT was compiled into Hafnium. Return physical address of the `.plat.fdt`
14 * section of Hafnium image.
15 */
Andrew Scullc3771072019-09-19 13:30:42 +010016paddr_t plat_boot_flow_get_fdt_addr(void)
David Brazdil0dbb41f2019-09-09 18:03:35 +010017{
18 return layout_fdt_begin();
19}
20
21/**
22 * Android boot flow does not use kernel arguments. Pass zero.
23 */
Andrew Scullc3771072019-09-19 13:30:42 +010024uintreg_t plat_boot_flow_get_kernel_arg(void)
David Brazdil0dbb41f2019-09-09 18:03:35 +010025{
26 return 0;
27}
28
29/**
David Brazdil38e0ddb2020-01-30 11:52:27 +000030 * Return the memory range of the RAM disk. This can be either:
31 * (a) the range of the '.plat.initrd' section, if it was compiled into the
32 * Hafnium image (INITRD_ADDR and INITRD_SIZE are zero), or
33 * (b) a fixed address range known at build time (INITRD_ADDR and INITRD_SIZE
34 * are not zero).
David Brazdil0dbb41f2019-09-09 18:03:35 +010035 */
David Brazdilb856be62020-03-25 10:14:55 +000036bool plat_boot_flow_get_initrd_range(const struct fdt *fdt, paddr_t *begin,
37 paddr_t *end)
David Brazdil0dbb41f2019-09-09 18:03:35 +010038{
David Brazdilb856be62020-03-25 10:14:55 +000039 (void)fdt;
David Brazdil0dbb41f2019-09-09 18:03:35 +010040
David Brazdil38e0ddb2020-01-30 11:52:27 +000041 uintpaddr_t initrd_addr = (uintpaddr_t)(INITRD_ADDR);
42 size_t initrd_size = (size_t)(INITRD_SIZE);
43
44 if (initrd_addr == 0 || initrd_size == 0) {
45 *begin = layout_initrd_begin();
46 *end = layout_initrd_end();
47 } else {
48 *begin = pa_init(initrd_addr);
49 *end = pa_add(*begin, initrd_size);
50 }
David Brazdil0dbb41f2019-09-09 18:03:35 +010051 return true;
52}
Andrew Scullc3771072019-09-19 13:30:42 +010053
54/**
55 * Android boot flow does not change based on the updates.
56 */
57bool plat_boot_flow_update(struct mm_stage1_locked stage1_locked,
David Brazdile6f83222019-09-23 14:47:37 +010058 const struct manifest *manifest,
Andrew Scull9c251d32019-09-19 13:30:42 +010059 struct boot_params_update *p, struct memiter *cpio,
60 struct mpool *ppool)
Andrew Scullc3771072019-09-19 13:30:42 +010061{
62 (void)stage1_locked;
David Brazdile6f83222019-09-23 14:47:37 +010063 (void)manifest;
Andrew Scullc3771072019-09-19 13:30:42 +010064 (void)p;
Andrew Scull9c251d32019-09-19 13:30:42 +010065 (void)cpio;
Andrew Scullc3771072019-09-19 13:30:42 +010066 (void)ppool;
67
68 return true;
69}