Move GeodeLX register name array to .rodata and make my checker happy. This one is far from obvious, so let me explain: Basically, *msrnames[] is an array of pointers (strings) and pointers need relocation. That's why they end up in .data.rel.ro.local and make lots of trouble. This should fix the crash Ron was seeing when register name printing was enabled.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: corebootv3-check_illegal_global_vars/northbridge/amd/geodelx/raminit.c =================================================================== --- corebootv3-check_illegal_global_vars/northbridge/amd/geodelx/raminit.c (Revision 792) +++ corebootv3-check_illegal_global_vars/northbridge/amd/geodelx/raminit.c (Arbeitskopie) @@ -35,7 +35,29 @@
u8 spd_read_byte(u16 device, u8 address);
+const static unsigned long msrs[] = { + MC_CF07_DATA, + MC_CF8F_DATA, + MC_CF1017_DATA, + GLCP_DELAY_CONTROLS, + MC_CFCLK_DBUG, + MC_CF_PMCTR, + GLCP_SYS_RSTPLL +};
+/* If you ever change any of the strings below, make sure the char array size + * is the length of the longest string +1 + */ +const static char msrnames[][20] = { + "MC_CF07_DATA", + "MC_CF8F_DATA", + "MC_CF1017_DATA", + "GLCP_DELAY_CONTROLS", + "MC_CFCLK_DBUG", + "MC_CF_PMCTR", + "PLL reg" +}; + /** * Dump key MSR values for RAM init. You can call this function and then use it to * compare to a factory BIOS setting. @@ -43,24 +65,6 @@ */ void dumplxmsrs(void) { - const static unsigned long msrs[] = { - MC_CF07_DATA, - MC_CF8F_DATA, - MC_CF1017_DATA, - GLCP_DELAY_CONTROLS, - MC_CFCLK_DBUG, - MC_CF_PMCTR, - GLCP_SYS_RSTPLL - }; - const static const char *msrnames[] = { - "MC_CF07_DATA", - "MC_CF8F_DATA", - "MC_CF1017_DATA", - "GLCP_DELAY_CONTROLS", - "MC_CFCLK_DBUG", - "MC_CF_PMCTR", - "PLL reg" - }; int i;
for (i = 0; i < ARRAY_SIZE(msrs); i++) {