From c85ad1246890cf3c0c5f2ac6de06ab046ddd0043 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 13 Sep 2024 14:26:34 +0100 Subject: [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 --- src/include/ipxe/efi/efi_nap.h | 18 ++++++++++++++++++ src/include/ipxe/nap.h | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 src/include/ipxe/efi/efi_nap.h (limited to 'src/include/ipxe') diff --git a/src/include/ipxe/efi/efi_nap.h b/src/include/ipxe/efi/efi_nap.h new file mode 100644 index 000000000..1ffb05569 --- /dev/null +++ b/src/include/ipxe/efi/efi_nap.h @@ -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 */ diff --git a/src/include/ipxe/nap.h b/src/include/ipxe/nap.h index f4de778c4..8d5d8e3df 100644 --- a/src/include/ipxe/nap.h +++ b/src/include/ipxe/nap.h @@ -43,6 +43,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); /* Include all architecture-independent I/O API headers */ #include +#include #include /* 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 */ -- cgit