[efi] Centralise definition of efi_cpu_nap()

Define a cpu_halt() function which is architecture-specific but
platform-independent, and merge the multiple architecture-specific
implementations of the EFI cpu_nap() function into a single central
efi_cpu_nap() that uses cpu_halt() if applicable.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-09-13 14:26:34 +01:00
parent 5de5d4626e
commit c85ad12468
12 changed files with 53 additions and 179 deletions

View File

@@ -0,0 +1,18 @@
#ifndef _IPXE_EFI_NAP_H
#define _IPXE_EFI_NAP_H
/** @file
*
* CPU sleeping
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifdef NAP_EFI
#define NAP_PREFIX_efi
#else
#define NAP_PREFIX_efi __efi_
#endif
#endif /* _IPXE_EFI_NAP_H */

View File

@@ -43,6 +43,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/* Include all architecture-independent I/O API headers */
#include <ipxe/null_nap.h>
#include <ipxe/efi/efi_nap.h>
#include <ipxe/linux/linux_nap.h>
/* Include all architecture-dependent I/O API headers */
@@ -52,6 +53,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* Sleep until next CPU interrupt
*
*/
void cpu_halt ( void );
/**
* Sleep with interrupts enabled until next CPU interrupt
*
*/
void cpu_nap ( void );
#endif /* _IPXE_NAP_H */