From feba919da450b9cf6a3caad0b5260b19d1ad9e41 Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Mon, 23 May 2016 23:54:43 +0800 Subject: EFI: Add AcpiOsStall()/AcpiOsSleep() support This patch adds AcpiOsStall() and AcpiOsSleep() support. Currently we do not support asynchronous polling of key stroke and timer, so AcpiOsSleep() is simply an invocation of AcpiOsStall(). Lv Zheng. Signed-off-by: Lv Zheng --- source/include/platform/acefiex.h | 8 +++-- source/os_specific/service_layers/osefixf.c | 45 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h index fc1438738..1b74b545b 100644 --- a/source/include/platform/acefiex.h +++ b/source/include/platform/acefiex.h @@ -546,6 +546,11 @@ EFI_STATUS EFI_HANDLE ImageHandle); +typedef +EFI_STATUS +(EFIAPI *EFI_STALL) ( + UINTN Microseconds); + typedef EFI_STATUS (EFIAPI *EFI_SET_WATCHDOG_TIMER) ( @@ -862,12 +867,11 @@ typedef struct _EFI_BOOT_SERVICES { #if 0 EFI_EXIT_BOOT_SERVICES ExitBootServices; EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; - EFI_STALL Stall; #else EFI_UNKNOWN_INTERFACE ExitBootServices; EFI_UNKNOWN_INTERFACE GetNextMonotonicCount; - EFI_UNKNOWN_INTERFACE Stall; #endif + EFI_STALL Stall; EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; #if 0 diff --git a/source/os_specific/service_layers/osefixf.c b/source/os_specific/service_layers/osefixf.c index 439494cbc..193381d00 100644 --- a/source/os_specific/service_layers/osefixf.c +++ b/source/os_specific/service_layers/osefixf.c @@ -705,6 +705,51 @@ AcpiOsGetTimer ( } +/****************************************************************************** + * + * FUNCTION: AcpiOsStall + * + * PARAMETERS: microseconds - Time to sleep + * + * RETURN: Blocks until sleep is completed. + * + * DESCRIPTION: Sleep at microsecond granularity + * + *****************************************************************************/ + +void +AcpiOsStall ( + UINT32 microseconds) +{ + + if (microseconds) + { + uefi_call_wrapper (BS->Stall, 1, microseconds); + } +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsSleep + * + * PARAMETERS: milliseconds - Time to sleep + * + * RETURN: Blocks until sleep is completed. + * + * DESCRIPTION: Sleep at millisecond granularity + * + *****************************************************************************/ + +void +AcpiOsSleep ( + UINT64 milliseconds) +{ + + AcpiOsStall (milliseconds * ACPI_USEC_PER_MSEC); +} + + /****************************************************************************** * * FUNCTION: AcpiOsAllocate -- cgit v1.2.1