From d64d1e195ceb003c824786bfd817227c7ae81f06 Mon Sep 17 00:00:00 2001 From: Kun Qin Date: Thu, 19 Sep 2024 14:11:37 -0700 Subject: MdeModulePkg: PeiMain: Introduce implementation of delayed dispatch REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4496 This change adds the implementation that fits the needs and description of PI spec defined Delayed Dispatch PPI in Pei Core. The PPI would allow minimal delay for registered callbacks. As well as allowing other functions to wait for GUIDed delayed dispatch callbacks. Cc: Jian J Wang Cc: Dandan Bi Cc: Liming Gao Cc: Debkumar De Cc: Catharine West Co-authored-by: Mike Turner Co-authored-by: Sachin Ganesh Signed-off-by: Kun Qin --- MdeModulePkg/Include/Guid/DelayedDispatch.h | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 MdeModulePkg/Include/Guid/DelayedDispatch.h (limited to 'MdeModulePkg/Include') diff --git a/MdeModulePkg/Include/Guid/DelayedDispatch.h b/MdeModulePkg/Include/Guid/DelayedDispatch.h new file mode 100644 index 0000000000..9be5444e36 --- /dev/null +++ b/MdeModulePkg/Include/Guid/DelayedDispatch.h @@ -0,0 +1,47 @@ +/** @file + Definition for structure & defines exported by Delayed Dispatch PPI + + Copyright (c), Microsoft Corporation. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef DELAYED_DISPATCH_H_ +#define DELAYED_DISPATCH_H_ + +// Delayed Dispatch table GUID +#define EFI_DELAYED_DISPATCH_TABLE_GUID {\ + 0x4b733449, 0x8eff, 0x488c, { 0x92, 0x1a, 0x15, 0x4a, 0xda, 0x25, 0x18, 0x07 } \ + } + +// +// Maximal number of Delayed Dispatch entries supported +// +#define DELAYED_DISPATCH_MAX_ENTRIES 8 + +// +// Internal structure for delayed dispatch entries. +// Packing the structures here to save space as they will be stored as HOBs. +// +#pragma pack (push, 1) + +typedef struct { + EFI_GUID DelayedGroupId; + UINT64 Context; + EFI_DELAYED_DISPATCH_FUNCTION Function; + UINT64 DispatchTime; + UINT32 MicrosecondDelay; +} DELAYED_DISPATCH_ENTRY; + +typedef struct { + UINT32 Count; + UINT32 DispCount; + DELAYED_DISPATCH_ENTRY Entry[DELAYED_DISPATCH_MAX_ENTRIES]; +} DELAYED_DISPATCH_TABLE; + +#pragma pack (pop) + +extern EFI_GUID gEfiDelayedDispatchTableGuid; + +#endif -- cgit