<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 20, 2017 at 10:41 PM, Alex Deucher <span dir="ltr"><<a href="mailto:alexdeucher@gmail.com" target="_blank">alexdeucher@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Mon, Mar 20, 2017 at 5:36 PM, Jan Ziak <<a href="mailto:0xe2.0x9a.0x9b@gmail.com">0xe2.0x9a.0x9b@gmail.com</a>> wrote:<br>
> Hi<br>
><br>
> <a href="https://cgit.freedesktop.org/~agd5f/linux/plain/drivers/gpu/drm/amd/include/asic_reg/vega10/NBIO/nbio_6_1_sh_mask.h?h=amd-staging-4.9&id=9555ef0ba926df25d9a637d0ea21bc0d231c21d2" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/~<wbr>agd5f/linux/plain/drivers/gpu/<wbr>drm/amd/include/asic_reg/<wbr>vega10/NBIO/nbio_6_1_sh_mask.<wbr>h?h=amd-staging-4.9&id=<wbr>9555ef0ba926df25d9a637d0ea21bc<wbr>0d231c21d2</a><br>
><br>
> The file nbio_6_1_sh_mask.h is uncompressed. It consists from 133884 lines.<br>
> Only generated C/C++ code will be able to utilize the content of such a file<br>
> efficiently. All hand-written codes combined will be able to utilize about<br>
> 1% of the file.<br>
><br>
> Is there a reason why nbio_6_1_sh_mask.h is huge?<br>
<br>
</span>That IP block contains a lot of registers.  The idea is to open source<br>
as much IP as possible to facilitate debugging, new features, etc.<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
Alex<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">[This email contains long/wide lines and should be viewed on a sufficiently wide screen]<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">For example if I open the file in vim and go to line 66952:</div><div class="gmail_extra"><br></div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_1_LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT 0x9<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Then abstracting away some of the digits used in the defined identifier and using egrep:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">$ egrep "\<DWC_E12MP_PHY_X._NS_X._._LANE._DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_.__DTB_SEL__SHIFT\>" nbio_6_1_sh_mask.h </div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_0_LANE0_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_0_LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_0_LANE2_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_0_LANE3_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_0_LANEX_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_1_LANE0_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_1_LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_1_LANE2_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_1_LANE3_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_1_LANEX_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_2_LANE0_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_2_LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_2_LANE2_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_2_LANE3_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_2_LANEX_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_3_LANE0_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_3_LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_3_LANE2_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_3_LANE3_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra">#define DWC_E12MP_PHY_X4_NS_X4_3_LANEX_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_1__DTB_SEL__SHIFT                        0x9</div><div class="gmail_extra"><br></div><div class="gmail_extra">The egrep command produced 20 lines.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Instead of the many #define directives, it is a possibility to define functions such as:</div><div class="gmail_extra"><br></div><div class="gmail_extra">int DWC_E12MP_PHY_Xa_NS_Xb_c_LANEd_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_e__DTB_SEL__SHIFT(int a, int b, int c, int d, int e) __attribute__((pure));</div><div class="gmail_extra"><br></div><div class="gmail_extra">I suppose the file nbio_6_1_sh_mask.h is the output of a tool (it is a generated file). It is an option to modify the tool to output C functions with proper input guards instead of #define directives.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Jan</div></div></div>