summaryrefslogtreecommitdiff
path: root/drivers/core/root.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-15 07:25:40 +0300
committerSimon Glass <sjg@chromium.org>2021-03-26 07:03:09 +0300
commitcfb9c9b77c29f48ae2c71ff30ca294bdaf369d87 (patch)
tree9852a1cb811d66aef1cb045cc28679efe4b90105 /drivers/core/root.c
parentd5cc19288e00cd287a13717f495d5f1a517feffd (diff)
downloadu-boot-cfb9c9b77c29f48ae2c71ff30ca294bdaf369d87.tar.xz
dm: core: Use separate priv/plat data region
Make use of the new priv/plat data region if enabled. This is implemented as a simple offset from the position set up by dtoc to the new position. So long as all access goes through dm_priv_to_rw() this is safe. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/root.c')
-rw-r--r--drivers/core/root.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 82b3c7de71..d9a19c5e6b 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -347,6 +347,15 @@ __weak int dm_scan_other(bool pre_reloc_only)
return 0;
}
+#if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY)
+void *dm_priv_to_rw(void *priv)
+{
+ long offset = priv - (void *)__priv_data_start;
+
+ return gd_dm_priv_base() + offset;
+}
+#endif
+
/**
* dm_scan() - Scan tables to bind devices
*