From 24ae85c3ffb48c72f67a514dcb843c1de54e5416 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Mon, 20 Aug 2018 12:31:11 -0600 Subject: libpayload/x86/apic: Add an apic_delay method and calibrate the timer The apic_delay method will halt the CPU and wait for a timer interrupt to fire. I went with usec because nsec is too granular to guarantee. This method will be called from an arch_ndelay() method when the delay is large enough to justify a sleep. BUG=b:109749762 TEST=Tested it on grunt by changing the _delay method to call apic_delay(). Change-Id: I80363f06bdb22d0907f895885e607fde1c4c468d Signed-off-by: Raul E Rangel Reviewed-on: https://review.coreboot.org/28242 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- payloads/libpayload/include/x86/arch/apic.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'payloads/libpayload/include/x86') diff --git a/payloads/libpayload/include/x86/arch/apic.h b/payloads/libpayload/include/x86/arch/apic.h index fdd447361a..ef962f44d8 100644 --- a/payloads/libpayload/include/x86/arch/apic.h +++ b/payloads/libpayload/include/x86/arch/apic.h @@ -40,4 +40,6 @@ uint8_t apic_id(void); /** Signal the end of the interrupt handler. */ void apic_eoi(void); +void apic_delay(unsigned int usec); + #endif /* __ARCH_X86_INCLUDES_ARCH_APIC_H__ */ -- cgit v1.2.3