Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56268 )
Change subject: lib/timer: Make udelay respect input parameter ......................................................................
lib/timer: Make udelay respect input parameter
This makes it possible to use `udelay(0)` to yield without actually wasting 1 us.
BUG=b:179699789 TEST=Boot guybrush to the OS
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I03c842ecef7641009f177a1458b88ca500dbfdb4 --- M src/lib/timer.c 1 file changed, 4 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/68/56268/1
diff --git a/src/lib/timer.c b/src/lib/timer.c index 8a06f57..411e60e 100644 --- a/src/lib/timer.c +++ b/src/lib/timer.c @@ -10,15 +10,11 @@ { struct stopwatch sw;
- /* - * As the timer granularity is in microseconds pad the - * requested delay by one to get at least >= requested usec delay. - */ - usec += 1; - if (!thread_yield_microseconds(usec)) return;
- stopwatch_init_usecs_expire(&sw, usec); - stopwatch_wait_until_expired(&sw); + if (usec > 0) { + stopwatch_init_usecs_expire(&sw, usec); + stopwatch_wait_until_expired(&sw); + } }