summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-11-24 21:45:59 -0700
committerGitHub <noreply@github.com>2020-11-24 21:45:59 -0700
commite748bb2049be7151efa2369a3bc0c50d13e4aa82 (patch)
treeba443ffdd15e5b66a3d2dfb0ebdad4835427f13e
parentfcb3fecb2d7ed14baa67c39fb998055c7ac14aa5 (diff)
downloadbcm5719-ortega-e748bb2049be7151efa2369a3bc0c50d13e4aa82.tar.gz
bcm5719-ortega-e748bb2049be7151efa2369a3bc0c50d13e4aa82.zip
ape: Cleanup reset logic. (#181)
-rw-r--r--ape/main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/ape/main.c b/ape/main.c
index 1965d7a..1eb90ae 100644
--- a/ape/main.c
+++ b/ape/main.c
@@ -304,33 +304,35 @@ void __attribute__((noreturn)) loaderLoop(void)
if (host_state != SHM.HostDriverState.bits.State)
{
+ reload_type_t type;
host_state = SHM.HostDriverState.bits.State;
+
if (SHM_HOST_DRIVER_STATE_STATE_START == host_state)
{
+ type = NEVER_RESET;
printf("host started\n");
- wait_for_all_rx();
- RMU_init();
- NCSI_reload(NEVER_RESET);
reset_allowed = true;
}
else
{
- wait_for_all_rx();
- RMU_init();
if (SHM_HOST_DRIVER_STATE_STATE_UNLOAD == host_state)
{
printf("host unloaded.\n");
- NCSI_reload(ALWAYS_RESET);
+ type = ALWAYS_RESET;
}
else
{
printf("wol?\n");
- NCSI_reload(AS_NEEDED);
+ type = AS_NEEDED;
}
reset_allowed = false;
}
+
+ wait_for_all_rx();
+ RMU_init();
+ NCSI_reload(type);
}
else if (reset_allowed && !Network_checkEnableState(gPort))
{
OpenPOWER on IntegriCloud