Skip to content

Commit 757ab98

Browse files
committedMay 4, 2016
[efi] Use a timer event to generate the currticks() timer
We currently use the EFI_CPU_ARCH_PROTOCOL's GetTimerValue() method to generate the currticks() timer, calibrated against a 1ms delay from the boot services Stall() method. This does not work on ARM platforms, where GetTimerValue() is an empty stub which just returns EFI_UNSUPPORTED. Fix by instead creating a periodic timer event, and using this event to increment a current tick counter. Signed-off-by: Michael Brown <mcb30@ipxe.org>
1 parent 1e06643 commit 757ab98

File tree

3 files changed

+86
-352
lines changed

3 files changed

+86
-352
lines changed
 

‎src/include/ipxe/efi/Protocol/Cpu.h

Lines changed: 0 additions & 302 deletions
This file was deleted.

‎src/include/ipxe/efi/efi_timer.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,22 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
1515
#define TIMER_PREFIX_efi __efi_
1616
#endif
1717

18+
/**
19+
* Number of ticks per second
20+
*
21+
* This is a policy decision.
22+
*/
23+
#define EFI_TICKS_PER_SEC 20
24+
25+
/**
26+
* Get number of ticks per second
27+
*
28+
* @ret ticks_per_sec Number of ticks per second
29+
*/
30+
static inline __attribute__ (( always_inline )) unsigned long
31+
TIMER_INLINE ( efi, ticks_per_sec ) ( void ) {
32+
33+
return EFI_TICKS_PER_SEC;
34+
}
35+
1836
#endif /* _IPXE_EFI_TIMER_H */

0 commit comments

Comments
 (0)