diff options
author | Atish Patra <atish.patra@wdc.com> | 2020-03-23 22:48:58 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-24 11:00:32 +0300 |
commit | 040e4e2ec220403fb2508aa0809052924ef63a0b (patch) | |
tree | b2a05b09962fc06fca987035b0b0cd8b20bc449e /include/sbi_utils | |
parent | d1d6560a878200679e6e12e77032d06add8847a5 (diff) | |
download | opensbi-040e4e2ec220403fb2508aa0809052924ef63a0b.tar.xz |
lib: utils: Move fdt fixup helper routines to a different file
FDT helper file contain both fdt fixup and parsing functions.
Split the fixup related functions to a separate file for a better code
organization.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'include/sbi_utils')
-rw-r--r-- | include/sbi_utils/fdt/fdt_fixup.h | 64 | ||||
-rw-r--r-- | include/sbi_utils/fdt/fdt_helper.h | 56 |
2 files changed, 67 insertions, 53 deletions
diff --git a/include/sbi_utils/fdt/fdt_fixup.h b/include/sbi_utils/fdt/fdt_fixup.h new file mode 100644 index 0000000..54568c2 --- /dev/null +++ b/include/sbi_utils/fdt/fdt_fixup.h @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: BSD-2-Clause +/* + * fdt_fixup.h - Flat Device Tree manipulation helper routines + * Implement platform specific DT fixups on top of libfdt. + * + * Copyright (C) 2020 Bin Meng <bmeng.cn@gmail.com> + */ + +#ifndef __FDT_FIXUP_H__ +#define __FDT_FIXUP_H__ + +/** + * Fix up the CPU node in the device tree + * + * This routine updates the "status" property of a CPU node in the device tree + * to "disabled" if that hart is in disabled state in OpenSBI. + * + * It is recommended that platform codes call this helper in their final_init() + * + * @param fdt: device tree blob + */ +void fdt_cpu_fixup(void *fdt); + +/** + * Fix up the PLIC node in the device tree + * + * This routine updates the "interrupt-extended" property of the PLIC node in + * the device tree to hide the M-mode external interrupt from CPUs. + * + * It is recommended that platform codes call this helper in their final_init() + * + * @param fdt: device tree blob + * @param compat: PLIC node compatible string + */ +void fdt_plic_fixup(void *fdt, const char *compat); + +/** + * Fix up the reserved memory node in the device tree + * + * This routine inserts a child node of the reserved memory node in the device + * tree that describes the protected memory region done by OpenSBI via PMP. + * + * It is recommended that platform codes call this helper in their final_init() + * + * @param fdt: device tree blob + * @return zero on success and -ve on failure + */ +int fdt_reserved_memory_fixup(void *fdt); + +/** + * General device tree fix-up + * + * This routine do all required device tree fix-ups for a typical platform. + * It fixes up the PLIC node and the reserved memory node in the device tree + * by calling the corresponding helper routines to accomplish the task. + * + * It is recommended that platform codes call this helper in their final_init() + * + * @param fdt: device tree blob + */ +void fdt_fixups(void *fdt); + +#endif /* __FDT_FIXUP_H__ */ + diff --git a/include/sbi_utils/fdt/fdt_helper.h b/include/sbi_utils/fdt/fdt_helper.h index 42baeab..06b8a62 100644 --- a/include/sbi_utils/fdt/fdt_helper.h +++ b/include/sbi_utils/fdt/fdt_helper.h @@ -1,7 +1,8 @@ // SPDX-License-Identifier: BSD-2-Clause /* - * fdt_helper.h - Flat Device Tree manipulation helper routines - * Implement helper routines on top of libfdt for OpenSBI usage + * fdt_helper.h - Flat Device Tree parsing helper routines + * Implement helper routines to parse FDT nodes on top of + * libfdt for OpenSBI usage * * Copyright (C) 2020 Bin Meng <bmeng.cn@gmail.com> */ @@ -29,55 +30,4 @@ int fdt_parse_plic(void *fdt, struct platform_plic_data *plic, int fdt_parse_clint(void *fdt, unsigned long *clint_addr, const char *compatible); -/** - * Fix up the CPU node in the device tree - * - * This routine updates the "status" property of a CPU node in the device tree - * to "disabled" if that hart is in disabled state in OpenSBI. - * - * It is recommended that platform codes call this helper in their final_init() - * - * @param fdt: device tree blob - */ -void fdt_cpu_fixup(void *fdt); - -/** - * Fix up the PLIC node in the device tree - * - * This routine updates the "interrupt-extended" property of the PLIC node in - * the device tree to hide the M-mode external interrupt from CPUs. - * - * It is recommended that platform codes call this helper in their final_init() - * - * @param fdt: device tree blob - * @param compat: PLIC node compatible string - */ -void fdt_plic_fixup(void *fdt, const char *compat); - -/** - * Fix up the reserved memory node in the device tree - * - * This routine inserts a child node of the reserved memory node in the device - * tree that describes the protected memory region done by OpenSBI via PMP. - * - * It is recommended that platform codes call this helper in their final_init() - * - * @param fdt: device tree blob - * @return zero on success and -ve on failure - */ -int fdt_reserved_memory_fixup(void *fdt); - -/** - * General device tree fix-up - * - * This routine do all required device tree fix-ups for a typical platform. - * It fixes up the PLIC node and the reserved memory node in the device tree - * by calling the corresponding helper routines to accomplish the task. - * - * It is recommended that platform codes call this helper in their final_init() - * - * @param fdt: device tree blob - */ -void fdt_fixups(void *fdt); - #endif /* __FDT_HELPER_H__ */ |