David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Hafnium Authors. |
| 3 | * |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame^] | 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. |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 7 | */ |
| 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 Scull | c377107 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 16 | paddr_t plat_boot_flow_get_fdt_addr(void) |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 17 | { |
| 18 | return layout_fdt_begin(); |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Android boot flow does not use kernel arguments. Pass zero. |
| 23 | */ |
Andrew Scull | c377107 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 24 | uintreg_t plat_boot_flow_get_kernel_arg(void) |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | /** |
David Brazdil | 38e0ddb | 2020-01-30 11:52:27 +0000 | [diff] [blame] | 30 | * 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 Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 35 | */ |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 36 | bool plat_boot_flow_get_initrd_range(const struct fdt *fdt, paddr_t *begin, |
| 37 | paddr_t *end) |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 38 | { |
David Brazdil | b856be6 | 2020-03-25 10:14:55 +0000 | [diff] [blame] | 39 | (void)fdt; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 40 | |
David Brazdil | 38e0ddb | 2020-01-30 11:52:27 +0000 | [diff] [blame] | 41 | 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 Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 51 | return true; |
| 52 | } |
Andrew Scull | c377107 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Android boot flow does not change based on the updates. |
| 56 | */ |
| 57 | bool plat_boot_flow_update(struct mm_stage1_locked stage1_locked, |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 58 | const struct manifest *manifest, |
Andrew Scull | 9c251d3 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 59 | struct boot_params_update *p, struct memiter *cpio, |
| 60 | struct mpool *ppool) |
Andrew Scull | c377107 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 61 | { |
| 62 | (void)stage1_locked; |
David Brazdil | e6f8322 | 2019-09-23 14:47:37 +0100 | [diff] [blame] | 63 | (void)manifest; |
Andrew Scull | c377107 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 64 | (void)p; |
Andrew Scull | 9c251d3 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 65 | (void)cpio; |
Andrew Scull | c377107 | 2019-09-19 13:30:42 +0100 | [diff] [blame] | 66 | (void)ppool; |
| 67 | |
| 68 | return true; |
| 69 | } |