diff options
| author | Evan Lojewski <github@meklort.com> | 2019-08-03 10:58:33 -0600 |
|---|---|---|
| committer | Evan Lojewski <github@meklort.com> | 2019-08-03 10:58:33 -0600 |
| commit | 6dba2bbc0efac02663a36f33a80702ccbe3d4acb (patch) | |
| tree | 8a6c05bdc8eb7667e5fdf65d60503d58421947d7 /utils/bcmflash | |
| parent | 9a2248f5f838135faa310a22e71ddd6ceea649f2 (diff) | |
| download | bcm5719-ortega-6dba2bbc0efac02663a36f33a80702ccbe3d4acb.tar.gz bcm5719-ortega-6dba2bbc0efac02663a36f33a80702ccbe3d4acb.zip | |
bcmflash; Add --nvm-recovery to reset the NVM config values when autodiscovery fails.
Diffstat (limited to 'utils/bcmflash')
| -rw-r--r-- | utils/bcmflash/main.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/utils/bcmflash/main.cpp b/utils/bcmflash/main.cpp index f7c704f..3626753 100644 --- a/utils/bcmflash/main.cpp +++ b/utils/bcmflash/main.cpp @@ -113,7 +113,7 @@ int main(int argc, char const *argv[]) .dest("target") // .set_default("hardware") .help( "hardware: Use the attached physical device.\n" - "file: Use the file specified with -f, --file\n"); + "file: Use the file specified with -i, --file\n"); parser.add_option("-f", "--function") .dest("function") @@ -122,6 +122,12 @@ int main(int argc, char const *argv[]) .metavar("FUNCTION") .help("Read registers from the specified pci function."); + parser.add_option("--nvm-recovery") + .dest("recovery") + .action("store_true") + .set_default("0") + .help("Recover form an incorrect NVM autodetection. Only valid with --target=hardware"); + parser.add_option("-i", "--file") .dest("filename") .help("Read from the specified file") @@ -200,6 +206,30 @@ int main(int argc, char const *argv[]) printf("ChipId: %x\n", (uint32_t)DEVICE.ChipId.r32); + if(options.get("recovery")) + { + NVRam_acquireLock(); + NVRam_disable(); + // Value pulled form the talos / blackbird. Update as needed. + uint32_t cfg1 = 0x14080f3; + uint32_t cfg2 = 0xd70081; + uint32_t cfg3 = 0x3000a00; + uint32_t sense = 0x30030; + printf("Updating NvmCfg1 from %x to %x.\n", (uint32_t)NVM.NvmCfg1.r32, cfg1); + printf("Updating NvmCfg2 from %x to %x.\n", (uint32_t)NVM.NvmCfg2.r32, cfg2); + printf("Updating NvmCfg3 from %x to %x.\n", (uint32_t)NVM.NvmCfg3.r32, cfg3); + printf("Updating AutoSenseStatus from %x to %x.\n", (uint32_t)NVM.AutoSenseStatus.r32, sense); + NVM.NvmCfg1.r32 = cfg1; + NVM.NvmCfg2.r32 = cfg2; + NVM.NvmCfg3.r32 = cfg3; + NVM.AutoSenseStatus.r32 = sense; + + NVRam_releaseLock(); + + exit(0); + } + + if(options.get("unlock")) { NVM.SoftwareArbitration.bits.ReqClr0 = 1; @@ -242,6 +272,7 @@ int main(int argc, char const *argv[]) if("hardware" == options["target"]) { + cout << "Restoring from " << options["restore"] << " to hardware." << endl; NVRam_acquireLock(); NVRam_enable(); |

