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>
This commit is contained in:
Simon Glass
2020-10-03 11:31:33 -06:00
parent 88280529bd
commit a294ead8d2
7 changed files with 65 additions and 22 deletions

View File

@@ -24,6 +24,8 @@
#include <membuff.h>
#include <linux/list.h>
struct driver_rt;
typedef struct global_data gd_t;
/**
@@ -192,6 +194,10 @@ struct global_data {
* @uclass_root: head of core tree
*/
struct list_head uclass_root;
# if CONFIG_IS_ENABLED(OF_PLATDATA)
/** Dynamic info about the driver */
struct driver_rt *dm_driver_rt;
# endif
#endif
#ifdef CONFIG_TIMER
/**
@@ -438,6 +444,14 @@ struct global_data {
#define gd_set_of_root(_root)
#endif
#if CONFIG_IS_ENABLED(OF_PLATDATA)
#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
#define gd_dm_driver_rt() gd->dm_driver_rt
#else
#define gd_set_dm_driver_rt(dyn)
#define gd_dm_driver_rt() NULL
#endif
/**
* enum gd_flags - global data flags
*