Louis Mayencourt | 944ade8 | 2019-08-08 12:03:26 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2019-2020, ARM Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | |
| 9 | #include <common/debug.h> |
| 10 | #include <lib/fconf/fconf.h> |
| 11 | #include <libfdt.h> |
| 12 | #include <platform_def.h> |
| 13 | |
| 14 | void fconf_populate(uintptr_t config) |
| 15 | { |
| 16 | assert(config != 0UL); |
| 17 | |
| 18 | /* Check if the pointer to DTB is correct */ |
| 19 | if (fdt_check_header((void *)config) != 0) { |
| 20 | ERROR("FCONF: Invalid DTB file passed for FW_CONFIG\n"); |
| 21 | panic(); |
| 22 | } |
| 23 | |
| 24 | INFO("FCONF: Reading firmware configuration file from: 0x%lx\n", config); |
| 25 | |
| 26 | /* Go through all registered populate functions */ |
| 27 | IMPORT_SYM(struct fconf_populator *, __FCONF_POPULATOR_START__, start); |
| 28 | IMPORT_SYM(struct fconf_populator *, __FCONF_POPULATOR_END__, end); |
| 29 | const struct fconf_populator *populator; |
| 30 | |
| 31 | for (populator = start; populator != end; populator++) { |
| 32 | assert((populator->info != NULL) && (populator->populate != NULL)); |
| 33 | |
| 34 | INFO("FCONF: Reading firmware configuration information for: %s\n", populator->info); |
| 35 | if (populator->populate(config) != 0) { |
| 36 | /* TODO: handle property miss */ |
| 37 | panic(); |
| 38 | } |
| 39 | } |
| 40 | } |