<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">the crc16 function is a copy of the one found in<br>src/device/dram/ddr3.c<br>so I'd rather like this to be factored out in a file that is<br>used<br>for both ddr2 and ddr3<br>I simply copied it out of ddr3 but it could be any has sort of<br>crc<br>or hash function. Are there any in coreboot? There is indeed no<br>need to reuse this particular one here.</p></blockquote></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">BTW the same holds true for ddr3 when computing a crc over the<br>unique ID bytes. I guess it simply reuses that out of convenience.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">I don't see any strong reason not to use the crc16 here; if that worked well on ddr3, I'd also use it on ddr2.<br>I don't really like duplication of code that could be easily avoided thoough; duplicating code makes maintenance of the code base harder.</p><p style="white-space: pre-wrap; word-wrap: break-word;">My suggestion would be to move the crc16 function in an extra c or h file and include it then in both ddr2 and ddr3 code</p><p><a href="https://review.coreboot.org/23345">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://review.coreboot.org/23345">change 23345</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/23345"/><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: comment </div>
<div style="display:none"> Gerrit-Change-Id: I3c0c42786197f9b4eb3e42261c10ff5e4266120f </div>
<div style="display:none"> Gerrit-Change-Number: 23345 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de> </div>
<div style="display:none"> Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org> </div>
<div style="display:none"> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 25 Jan 2018 13:09:13 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>