hw/x86: add suspend kernel syscall

using the ACPI mechanism. The syscall can be triggered solely via core's
RPC managing_system call.

Issue #4669
This commit is contained in:
Alexander Boettcher
2022-12-05 15:25:12 +01:00
committed by Christian Helmuth
parent 30c6feb86e
commit df27cc87b5
11 changed files with 233 additions and 5 deletions

View File

@ -46,6 +46,7 @@ namespace Kernel {
constexpr Call_arg call_id_time() { return 21; }
constexpr Call_arg call_id_run_vm() { return 22; }
constexpr Call_arg call_id_pause_vm() { return 23; }
constexpr Call_arg call_id_suspend() { return 24; }
/*****************************************************************
@ -431,6 +432,21 @@ namespace Kernel {
{
call(call_id_pause_vm(), cap);
}
/**
* Suspend hardware
*
* \param sleep_type The intended sleep state S0 ... S5. The values are
* read out by an ACPI AML component and are of type
* TYP_SLPx as described in the ACPI specification,
* e.g. TYP_SLPa and TYP_SLPb. The values differ
* between different PC systems/boards.
*/
inline bool suspend(unsigned const sleep_type)
{
return bool(call(call_id_suspend(), sleep_type));
}
}
#endif /* _INCLUDE__KERNEL__INTERFACE_H_ */