1 /*
2 * Copyright 2019 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/boot_flow.h"
10 #include "hf/dlog.h"
11 #include "hf/fdt_handler.h"
12 #include "hf/plat/boot_flow.h"
13
14 /**
15 * Extract the boot parameters from the FDT and the boot-flow driver.
16 */
boot_flow_get_params(struct boot_params * p,const struct fdt * fdt)17 bool boot_flow_get_params(struct boot_params *p, const struct fdt *fdt)
18 {
19 struct string memory = STRING_INIT("memory");
20 struct string device_memory = STRING_INIT("device-memory");
21
22 p->mem_ranges_count = 0;
23 p->kernel_arg = plat_boot_flow_get_kernel_arg();
24
25 return plat_boot_flow_get_initrd_range(fdt, &p->initrd_begin,
26 &p->initrd_end) &&
27 fdt_find_cpus(fdt, p->cpu_ids, &p->cpu_count) &&
28 fdt_find_memory_ranges(fdt, &memory, p->mem_ranges,
29 &p->mem_ranges_count, MAX_MEM_RANGES) &&
30 fdt_find_memory_ranges(fdt, &device_memory, p->device_mem_ranges,
31 &p->device_mem_ranges_count,
32 MAX_DEVICE_MEM_RANGES);
33 }
34
35 /**
36 * Takes action on any updates that were generated.
37 */
boot_flow_update(struct mm_stage1_locked stage1_locked,const struct manifest * manifest,struct boot_params_update * p,struct memiter * cpio,struct mpool * ppool)38 bool boot_flow_update(struct mm_stage1_locked stage1_locked,
39 const struct manifest *manifest,
40 struct boot_params_update *p, struct memiter *cpio,
41 struct mpool *ppool)
42 {
43 return plat_boot_flow_update(stage1_locked, manifest, p, cpio, ppool);
44 }
45