aboutsummaryrefslogtreecommitdiff
path: root/drivers/core/root.c
diff options
context:
space:
mode:
authorSimon Glass2020-10-03 11:31:33 -0600
committerSimon Glass2020-10-29 14:42:18 -0600
commita294ead8d2531a641f87bf182fee257029973ac0 (patch)
tree005705b193a11822a09bb0cf32dad428968b35ec /drivers/core/root.c
parent88280529bddf0bd05c90db42b6c8e48de954cf66 (diff)
dm: Use an allocated array for run-time device info
At present we update the driver_info struct with a pointer to the device that it created (i.e. caused to be bound). This works fine when U-Boot SPL is stored in read-write memory. But on some platforms, such as Intel Apollo Lake, it is not possible to update the data memory. In any case, it is bad form to put this information in a structure that is in the data region, since it expands the size of the binary. Create a new driver_rt structure which holds runtime information about drivers. Update the code to store the device pointer in this instead. Also update the test check that this works. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/root.c')
-rw-r--r--drivers/core/root.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c
index de23161cff8..e8df5aebe84 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -185,6 +185,17 @@ int dm_scan_platdata(bool pre_reloc_only)
{
int ret;
+ if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
+ struct driver_rt *dyn;
+ int n_ents;
+
+ n_ents = ll_entry_count(struct driver_info, driver_info);
+ dyn = calloc(n_ents, sizeof(struct driver_rt));
+ if (!dyn)
+ return -ENOMEM;
+ gd_set_dm_driver_rt(dyn);
+ }
+
ret = lists_bind_drivers(DM_ROOT_NON_CONST, pre_reloc_only);
if (ret == -ENOENT) {
dm_warn("Some drivers were not found\n");