mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 09:32:33 +03:00
[efi] Add "reboot" command for EFI
Abstract out the ability to reboot the system to a separate reboot() function (with platform-specific implementations), add an EFI implementation, and make the existing "reboot" command available under EFI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
18
src/include/ipxe/efi/efi_reboot.h
Normal file
18
src/include/ipxe/efi/efi_reboot.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _IPXE_EFI_REBOOT_H
|
||||
#define _IPXE_EFI_REBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* iPXE reboot API for EFI
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#ifdef REBOOT_EFI
|
||||
#define REBOOT_PREFIX_efi
|
||||
#else
|
||||
#define REBOOT_PREFIX_efi __efi_
|
||||
#endif
|
||||
|
||||
#endif /* _IPXE_EFI_REBOOT_H */
|
||||
18
src/include/ipxe/null_reboot.h
Normal file
18
src/include/ipxe/null_reboot.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _IPXE_NULL_REBOOT_H
|
||||
#define _IPXE_NULL_REBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* iPXE do-nothing reboot API
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#ifdef REBOOT_NULL
|
||||
#define REBOOT_PREFIX_null
|
||||
#else
|
||||
#define REBOOT_PREFIX_null __null_
|
||||
#endif
|
||||
|
||||
#endif /* _IPXE_NULL_REBOOT_H */
|
||||
57
src/include/ipxe/reboot.h
Normal file
57
src/include/ipxe/reboot.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef _IPXE_REBOOT_H
|
||||
#define _IPXE_REBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* iPXE reboot API
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#include <ipxe/api.h>
|
||||
#include <config/reboot.h>
|
||||
|
||||
/**
|
||||
* Calculate static inline reboot API function name
|
||||
*
|
||||
* @v _prefix Subsystem prefix
|
||||
* @v _api_func API function
|
||||
* @ret _subsys_func Subsystem API function
|
||||
*/
|
||||
#define REBOOT_INLINE( _subsys, _api_func ) \
|
||||
SINGLE_API_INLINE ( REBOOT_PREFIX_ ## _subsys, _api_func )
|
||||
|
||||
/**
|
||||
* Provide an reboot API implementation
|
||||
*
|
||||
* @v _prefix Subsystem prefix
|
||||
* @v _api_func API function
|
||||
* @v _func Implementing function
|
||||
*/
|
||||
#define PROVIDE_REBOOT( _subsys, _api_func, _func ) \
|
||||
PROVIDE_SINGLE_API ( REBOOT_PREFIX_ ## _subsys, _api_func, _func )
|
||||
|
||||
/**
|
||||
* Provide a static inline reboot API implementation
|
||||
*
|
||||
* @v _prefix Subsystem prefix
|
||||
* @v _api_func API function
|
||||
*/
|
||||
#define PROVIDE_REBOOT_INLINE( _subsys, _api_func ) \
|
||||
PROVIDE_SINGLE_API_INLINE ( REBOOT_PREFIX_ ## _subsys, _api_func )
|
||||
|
||||
/* Include all architecture-independent reboot API headers */
|
||||
#include <ipxe/null_reboot.h>
|
||||
#include <ipxe/efi/efi_reboot.h>
|
||||
|
||||
/* Include all architecture-dependent reboot API headers */
|
||||
#include <bits/reboot.h>
|
||||
|
||||
/**
|
||||
* Reboot system
|
||||
*
|
||||
*/
|
||||
void reboot ( void );
|
||||
|
||||
#endif /* _IPXE_REBOOT_H */
|
||||
Reference in New Issue
Block a user