<p>Werner Zeh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20471">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">siemens/nc_fpga: Modify macro FPGA_SET_PARAM to avoid hwilib errors<br><br>The macro FPGA_SET_PARAM was introduced to make the setting of different<br>FPGA registers with the appropriate values from hwinfo more<br>transparent. The hwilib takes care about the size of the provided buffer<br>where the requested value should be stored in. The fields in hwinfo have<br>not always the same size as the matching registers in the FPGA. So to<br>avoid errors resulting in a too small buffer when calling hwilib_get_field()<br>the buffer is now fixed to 32 bit and will be casted to the destination<br>type when the value is written into the FPGA register.<br><br>Changing the field size in hwilib would be the wrong way as the defined<br>lengths are specified this way to be expandable in the future.<br><br>In addition the number of maximum supported temperature sensors in<br>increased to 8 as the FPGA now supports more.<br><br>Change-Id: I0c697106783158420708a973c3cff2be90fa4fce<br>---<br>M src/drivers/siemens/nc_fpga/nc_fpga.c<br>M src/drivers/siemens/nc_fpga/nc_fpga.h<br>2 files changed, 5 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/71/20471/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.c b/src/drivers/siemens/nc_fpga/nc_fpga.c<br>index 8fb25bc..15b3ad3 100644<br>--- a/src/drivers/siemens/nc_fpga/nc_fpga.c<br>+++ b/src/drivers/siemens/nc_fpga/nc_fpga.c<br>@@ -26,10 +26,9 @@<br> <br> #define FPGA_SET_PARAM(src, dst) \<br> { \<br>- typeof(dst) var; \<br>- size_t len = sizeof(var); \<br>- if (hwilib_get_field(src, (uint8_t *)&var, len) == len) \<br>- dst = (typeof(dst))(var); \<br>+ uint32_t var; \<br>+ if (hwilib_get_field(src, (uint8_t *)&var, sizeof(var))) \<br>+ dst = *((typeof(dst) *)var); \<br> }<br> <br> static void init_temp_mon (void *base_adr)<br>@@ -41,7 +40,7 @@<br> /* Program sensor delay first. */<br> FPGA_SET_PARAM(FANSensorDelay, ctrl->sensordelay);<br> /* Program correction curve for every used sensor. */<br>- if (hwilib_get_field(FANSensorNum, &num, sizeof(num) != sizeof(num)) ||<br>+ if ((hwilib_get_field(FANSensorNum, &num, 1) != 1) ||<br> (num == 0) || (num > MAX_NUM_SENSORS))<br> return;<br> for (i = 0; i < num; i ++) {<br>diff --git a/src/drivers/siemens/nc_fpga/nc_fpga.h b/src/drivers/siemens/nc_fpga/nc_fpga.h<br>index a5a7ab8..0a0b0c6 100644<br>--- a/src/drivers/siemens/nc_fpga/nc_fpga.h<br>+++ b/src/drivers/siemens/nc_fpga/nc_fpga.h<br>@@ -28,7 +28,7 @@<br> #define NC_BL_PWM_OFFSET 0x8C<br> #define NC_FANMON_CTRL_OFFSET 0x400<br> <br>-#define MAX_NUM_SENSORS 4<br>+#define MAX_NUM_SENSORS 8<br> <br> typedef struct {<br> uint16_t rmin;<br></pre><p>To view, visit <a href="https://review.coreboot.org/20471">change 20471</a>. To unsubscribe, 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/20471"/><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: I0c697106783158420708a973c3cff2be90fa4fce </div>
<div style="display:none"> Gerrit-Change-Number: 20471 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Werner Zeh <werner.zeh@siemens.com> </div>