Commit e27e1cc9 authored by Álvaro Fernández Rojas's avatar Álvaro Fernández Rojas Committed by Thomas Bogendoerfer

MIPS: BCM63xx: improve CFE version detection

There are some CFE variants that start with 'cfe-vd' instead of 'cfe-v', such
as the one used in the Huawei HG556a: "cfe-vd081.5003". In this case, the CFE
version is stored as is (string vs number bytes).

Some newer devices have an additional version number, such as the Comtrend
VR-3032u: "1.0.38-112.118-11".

Finally, print the string as is if the version doesn't start with "cfe-v" or
"cfe-vd", but starts with "cfe-".
Signed-off-by: default avatarÁlvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 0d10d17b
...@@ -760,11 +760,25 @@ void __init board_prom_init(void) ...@@ -760,11 +760,25 @@ void __init board_prom_init(void)
/* dump cfe version */ /* dump cfe version */
cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
if (!memcmp(cfe, "cfe-v", 5)) if (strstarts(cfe, "cfe-")) {
snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u", if(cfe[4] == 'v') {
cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]); if(cfe[5] == 'd')
else snprintf(cfe_version, 11, "%s",
(char *) &cfe[5]);
else if (cfe[10] > 0)
snprintf(cfe_version, sizeof(cfe_version),
"%u.%u.%u-%u.%u-%u", cfe[5], cfe[6],
cfe[7], cfe[8], cfe[9], cfe[10]);
else
snprintf(cfe_version, sizeof(cfe_version),
"%u.%u.%u-%u.%u", cfe[5], cfe[6],
cfe[7], cfe[8], cfe[9]);
} else {
snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
}
} else {
strcpy(cfe_version, "unknown"); strcpy(cfe_version, "unknown");
}
pr_info("CFE version: %s\n", cfe_version); pr_info("CFE version: %s\n", cfe_version);
bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET); bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment