summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-08-22 09:52:42 +0200
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-08-24 11:39:08 +0000
commit70866e9f383f4a2bb895486616136ba46add5bfa (patch)
tree8c851484380112d2cae0a5a35fc9bebfa19e191b /src
parent0a7d6908bf0daa95b2a689cb293662c175eeb3e7 (diff)
downloadcoreboot-70866e9f383f4a2bb895486616136ba46add5bfa.tar.xz
soc/cavium/cn81xx: Don't directly manipulate devicetree data
As preparation to constify devicetree data, do it the right way. Change-Id: I5081de020bb73c56aa8bdf7bb17fe6b2913d0ffe Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/28266 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/cavium/cn81xx/soc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/soc/cavium/cn81xx/soc.c b/src/soc/cavium/cn81xx/soc.c
index dfb06e0f37..4a4312d86f 100644
--- a/src/soc/cavium/cn81xx/soc.c
+++ b/src/soc/cavium/cn81xx/soc.c
@@ -241,12 +241,24 @@ static int dt_platform_fixup(struct device_tree_fixup *fixup,
__func__);
continue;
}
+
+ u32 *data_cleaned = malloc(size);
+ if (!data_cleaned)
+ continue;
+
+ size_t n = 0;
+ /* Remove phandle from mmu-masters list */
for (size_t j = 0; j < size / (sizeof(u32) * 2); j++)
- if (be32_to_cpu(data[j * 2]) == phandle) {
- data[j * 2] = 0;
- data[j * 2 + 1] = 0;
- break;
+ if (be32_to_cpu(data[j * 2]) != phandle) {
+ data_cleaned[n * 2] = data[j * 2];
+ data_cleaned[n * 2 + 1] = data[j * 2 + 1];
+ n++;
}
+
+ dt_add_bin_prop(dt_node, "mmu-masters", data_cleaned,
+ n * sizeof(u32) * 2);
+
+ free(data_cleaned);
}
/* Remove QLM mode entries */