Only register as the platform DELAY() implementation if the setup of the

global timer was successful, since the implementation tries to read it.

Notably, if the platform has a variable-frequency global timer (because
of dynamic frequency scaling), it doesn't set up the global timer for use
as a system timecounter, and in that case it also can't use it for DELAY.
Such platforms use different timer hardware for both timecounter and DELAY.
This commit is contained in:
ian 2017-06-18 17:26:54 +00:00
parent c8d732dce1
commit 56fe240b07

View File

@ -439,7 +439,12 @@ arm_tmr_attach(device_t dev)
}
#ifdef MULTIDELAY
arm_set_delay(arm_tmr_delay, sc);
/*
* We can register as the DELAY() implementation only if we successfully
* set up the global timer.
*/
if (tc_err == 0)
arm_set_delay(arm_tmr_delay, sc);
#endif
return (0);