Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
mcb30 committed May 4, 2016
1 parent 1e06643 commit 757ab98
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 352 deletions.
302 changes: 0 additions & 302 deletions src/include/ipxe/efi/Protocol/Cpu.h

This file was deleted.

18 changes: 18 additions & 0 deletions src/include/ipxe/efi/efi_timer.h
Expand Up @@ -15,4 +15,22 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define TIMER_PREFIX_efi __efi_
#endif

/**
* Number of ticks per second
*
* This is a policy decision.
*/
#define EFI_TICKS_PER_SEC 20

/**
* Get number of ticks per second
*
* @ret ticks_per_sec Number of ticks per second
*/
static inline __attribute__ (( always_inline )) unsigned long
TIMER_INLINE ( efi, ticks_per_sec ) ( void ) {

return EFI_TICKS_PER_SEC;
}

#endif /* _IPXE_EFI_TIMER_H */

0 comments on commit 757ab98

Please sign in to comment.