<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/28266">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/cavium/cn81xx: Don't directly manipulate devicetree data<br><br>As preparation to constify devicetree data, do it the right way.<br><br>Change-Id: I5081de020bb73c56aa8bdf7bb17fe6b2913d0ffe<br>Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com><br>---<br>M src/soc/cavium/cn81xx/soc.c<br>1 file changed, 16 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/28266/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/cavium/cn81xx/soc.c b/src/soc/cavium/cn81xx/soc.c</span><br><span>index 9dbbcbf..9317fd9 100644</span><br><span>--- a/src/soc/cavium/cn81xx/soc.c</span><br><span>+++ b/src/soc/cavium/cn81xx/soc.c</span><br><span>@@ -240,12 +240,24 @@</span><br><span> __func__);</span><br><span> continue;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ u32 *data_cleaned = malloc(size);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!data_cleaned)</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ size_t n = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Remove phandle from mmu-masters list */</span><br><span> for (size_t j = 0; j < size / (sizeof(u32) * 2); j++)</span><br><span style="color: hsl(0, 100%, 40%);">- if (be32_to_cpu(data[j * 2]) == phandle) {</span><br><span style="color: hsl(0, 100%, 40%);">- data[j * 2] = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- data[j * 2 + 1] = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (be32_to_cpu(data[j * 2]) != phandle) {</span><br><span style="color: hsl(120, 100%, 40%);">+ data_cleaned[n * 2] = data[j * 2];</span><br><span style="color: hsl(120, 100%, 40%);">+ data_cleaned[n * 2 + 1] = data[j * 2 + 1];</span><br><span style="color: hsl(120, 100%, 40%);">+ n++;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ dt_add_bin_prop(dt_node, "mmu-masters", data_cleaned,</span><br><span style="color: hsl(120, 100%, 40%);">+ n * sizeof(u32) * 2);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ free(data_cleaned);</span><br><span> }</span><br><span> </span><br><span> /* Remove QLM mode entries */</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/28266">change 28266</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/28266"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5081de020bb73c56aa8bdf7bb17fe6b2913d0ffe </div>
<div style="display:none"> Gerrit-Change-Number: 28266 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com> </div>