aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@st.com>2020-09-10 10:49:59 +0200
committerSimon Glass <sjg@chromium.org>2020-09-22 12:54:13 -0600
commitccaa5747bdeae4261199dd7e80771e4de1c550ca (patch)
treeab94e7a90a9402304aa0c5d0377992e74186ce4b /lib
parent68de0679c940276b97c31b809168052f9d905505 (diff)
downloadu-boot-ccaa5747bdeae4261199dd7e80771e4de1c550ca.zip
u-boot-ccaa5747bdeae4261199dd7e80771e4de1c550ca.tar.gz
u-boot-ccaa5747bdeae4261199dd7e80771e4de1c550ca.tar.bz2
fdtdec: optionally add property no-map to created reserved memory node
Add boolean input argument @no_map to helper function fdtdec_add_reserved_memory() to add or not "no-map" property for an added reserved memory node. Property no-map is used by the Linux kernel to not not map memory in its static memory mapping. It is needed for example for the| consistency of system non-cached memory and to prevent speculative accesses to some firewalled memory. No functional change. A later change will update to OPTEE library to add no-map property to OP-TEE reserved memory nodes. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/fdtdec.c10
-rw-r--r--lib/optee/optee.c2
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 56bf9fc..b8fc5e2 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1316,7 +1316,7 @@ static int fdtdec_init_reserved_memory(void *blob)
int fdtdec_add_reserved_memory(void *blob, const char *basename,
const struct fdt_memory *carveout,
- uint32_t *phandlep)
+ uint32_t *phandlep, bool no_map)
{
fdt32_t cells[4] = {}, *ptr = cells;
uint32_t upper, lower, phandle;
@@ -1416,6 +1416,12 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
if (err < 0)
return err;
+ if (no_map) {
+ err = fdt_setprop(blob, node, "no-map", NULL, 0);
+ if (err < 0)
+ return err;
+ }
+
/* return the phandle for the new node for the caller to use */
if (phandlep)
*phandlep = phandle;
@@ -1481,7 +1487,7 @@ int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name,
fdt32_t value;
void *prop;
- err = fdtdec_add_reserved_memory(blob, name, carveout, &phandle);
+ err = fdtdec_add_reserved_memory(blob, name, carveout, &phandle, false);
if (err < 0) {
debug("failed to add reserved memory: %d\n", err);
return err;
diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index 457d4cc..963c2ff 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -192,7 +192,7 @@ int optee_copy_fdt_nodes(const void *old_blob, void *new_blob)
ret = fdtdec_add_reserved_memory(new_blob,
nodename,
&carveout,
- NULL);
+ NULL, false);
free(oldname);
if (ret < 0)