309-cfe_version_mod.patch 948 B

123456789101112131415161718192021222324252627
  1. --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
  2. +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
  3. @@ -723,10 +723,20 @@ void __init board_prom_init(void)
  4. /* dump cfe version */
  5. cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
  6. - if (!memcmp(cfe, "cfe-v", 5))
  7. - snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
  8. - cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
  9. - else
  10. + if (strstarts(cfe, "cfe-")) {
  11. + if(cfe[4] == 'v') {
  12. + if(cfe[5] == 'd')
  13. + snprintf(cfe_version, 11, "%s", (char *) &cfe[5]);
  14. + else if (cfe[10] > 0)
  15. + snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u-%u",
  16. + cfe[5], cfe[6], cfe[7], cfe[8], cfe[9], cfe[10]);
  17. + else
  18. + snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
  19. + cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
  20. + } else {
  21. + snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
  22. + }
  23. + } else
  24. strcpy(cfe_version, "unknown");
  25. pr_info("CFE version: %s\n", cfe_version);