From 8a715530bb1f9522030757379415b174f3109951 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 19 Dec 2020 10:40:17 -0700 Subject: dm: core: Allow the uclass list to move At present the uclass list head is in global_data. This is convenient but with the new of-platdata we need the list head to be declared by the generated code. Change this over to be a pointer. Provide a 'static' version in global_data to retain the current behaviour. Signed-off-by: Simon Glass --- include/asm-generic/global_data.h | 8 +++++++- include/dm/device-internal.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 87d827d0f43..b63575919f0 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -194,7 +194,13 @@ struct global_data { /** * @uclass_root: head of core tree */ - struct list_head uclass_root; + struct list_head uclass_root_s; + /** + * @uclass_root: pointer to head of core tree, if uclasses are in + * read-only memory and cannot be adjusted to use @uclass_root as a + * list head. + */ + struct list_head *uclass_root; # if CONFIG_IS_ENABLED(OF_PLATDATA) /** Dynamic info about the driver */ struct driver_rt *dm_driver_rt; diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index 03b092bdf7d..639bbd293d9 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -288,6 +288,7 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr); /* Cast away any volatile pointer */ #define DM_ROOT_NON_CONST (((gd_t *)gd)->dm_root) #define DM_UCLASS_ROOT_NON_CONST (((gd_t *)gd)->uclass_root) +#define DM_UCLASS_ROOT_S_NON_CONST (((gd_t *)gd)->uclass_root_s) /* device resource management */ #ifdef CONFIG_DEVRES -- cgit v1.2.3