diff options
| author | Evan Lojewski <github@meklort.com> | 2020-10-11 11:08:39 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-11 11:08:39 -0600 |
| commit | c61a1b162e62526fb2de948cbb701d6cbaf10d97 (patch) | |
| tree | c1c05c9f2fbda3e1b811d4891ee4283cf2f133d3 /utils/bcmflash/main.cpp | |
| parent | 009d22780ad8a9000a5d3c4abc2530df2f77d82a (diff) | |
| download | bcm5719-ortega-c61a1b162e62526fb2de948cbb701d6cbaf10d97.tar.gz bcm5719-ortega-c61a1b162e62526fb2de948cbb701d6cbaf10d97.zip | |
bcmflash: Parse VPD data in the code directory if it exists. (#138)
Diffstat (limited to 'utils/bcmflash/main.cpp')
| -rw-r--r-- | utils/bcmflash/main.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/utils/bcmflash/main.cpp b/utils/bcmflash/main.cpp index 84858aa..499abee 100644 --- a/utils/bcmflash/main.cpp +++ b/utils/bcmflash/main.cpp @@ -77,6 +77,9 @@ uint32_t gApeLength = 0; uint8_t *gApe = NULL; uint32_t *gApeWd = NULL; +uint8_t *gVPD = NULL; +uint32_t gVPDLength = 0; + typedef struct { const char *type; @@ -214,13 +217,19 @@ void dump_code_directory(NVRAMCodeDirectory_t *cd, uint8_t *nvram, const char *o printf("Expected CRC: 0x%08X\n", crc_expect); printf("\n"); - if (BCM_CODE_DIRECTORY_ADDR_APE == addr && BCM_CODE_DIRECTORY_CPU_APE == cpu) /* APE */ + if (BCM_CODE_DIRECTORY_CPU_APE == cpu) /* APE */ { gApe = &nvram[be32toh(cd->directoryOffset)]; gApeWd = (uint32_t *)gApe; gApeLength = length * sizeof(uint32_t); } + if (BCM_CODE_DIRECTORY_CPU_VPD == cpu) /* Extended VPD */ + { + gVPD = &nvram[be32toh(cd->directoryOffset)]; + gVPDLength = length * sizeof(uint32_t); + } + if (outfile) { if (!bcmflash_file_write(outfile, cd_loc, (length - 1) * sizeof(uint32_t))) @@ -371,6 +380,9 @@ int main(int argc, char const *argv[]) uint8_t *stage1 = NULL; uint32_t *stage1_wd = NULL; + gVPD = nvram.contents.vpd.bytes; + gVPDLength = sizeof(nvram.contents.vpd); + OptionParser parser = OptionParser().description("BCM Flash Utility v" VERSION_STRING); parser.version(VERSION_STRING); @@ -756,7 +768,7 @@ int main(int argc, char const *argv[]) dump_info(&nvram.contents.info, &nvram.contents.info2); - dump_vpd(nvram.contents.vpd.bytes, sizeof(nvram.contents.vpd)); + dump_vpd(gVPD, gVPDLength); return 0; } |

