[coreboot-gerrit] Change in coreboot[master]: soc/cavium/cn81xx: Don't directly manipulate devicetree data
Philipp Deppenwiese (Code Review)
gerrit at coreboot.org
Fri Aug 24 13:39:12 CEST 2018
Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/28266 )
Change subject: soc/cavium/cn81xx: Don't directly manipulate devicetree data
......................................................................
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 at 9elements.com>
Reviewed-on: https://review.coreboot.org/28266
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Paul Menzel <paulepanter at users.sourceforge.net>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
---
M src/soc/cavium/cn81xx/soc.c
1 file changed, 16 insertions(+), 4 deletions(-)
Approvals:
build bot (Jenkins): Verified
Paul Menzel: Looks good to me, but someone else must approve
Philipp Deppenwiese: Looks good to me, approved
diff --git a/src/soc/cavium/cn81xx/soc.c b/src/soc/cavium/cn81xx/soc.c
index dfb06e0..4a4312d 100644
--- a/src/soc/cavium/cn81xx/soc.c
+++ b/src/soc/cavium/cn81xx/soc.c
@@ -241,12 +241,24 @@
__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 */
--
To view, visit https://review.coreboot.org/28266
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5081de020bb73c56aa8bdf7bb17fe6b2913d0ffe
Gerrit-Change-Number: 28266
Gerrit-PatchSet: 3
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180824/607d1644/attachment.html>
More information about the coreboot-gerrit
mailing list