1*f439973dSWarner Losh /** @file 2*f439973dSWarner Losh Runtime Architectural Protocol as defined in PI Specification VOLUME 2 DXE 3*f439973dSWarner Losh 4*f439973dSWarner Losh Allows the runtime functionality of the DXE Foundation to be contained 5*f439973dSWarner Losh in a separate driver. It also provides hooks for the DXE Foundation to 6*f439973dSWarner Losh export information that is needed at runtime. As such, this protocol allows 7*f439973dSWarner Losh services to the DXE Foundation to manage runtime drivers and events. 8*f439973dSWarner Losh This protocol also implies that the runtime services required to transition 9*f439973dSWarner Losh to virtual mode, SetVirtualAddressMap() and ConvertPointer(), have been 10*f439973dSWarner Losh registered into the UEFI Runtime Table in the UEFI System Table. This protocol 11*f439973dSWarner Losh must be produced by a runtime DXE driver and may only be consumed by the DXE Foundation. 12*f439973dSWarner Losh 13*f439973dSWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 14*f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 15*f439973dSWarner Losh 16*f439973dSWarner Losh **/ 17*f439973dSWarner Losh 18*f439973dSWarner Losh #ifndef __ARCH_PROTOCOL_RUNTIME_H__ 19*f439973dSWarner Losh #define __ARCH_PROTOCOL_RUNTIME_H__ 20*f439973dSWarner Losh 21*f439973dSWarner Losh /// 22*f439973dSWarner Losh /// Global ID for the Runtime Architectural Protocol 23*f439973dSWarner Losh /// 24*f439973dSWarner Losh #define EFI_RUNTIME_ARCH_PROTOCOL_GUID \ 25*f439973dSWarner Losh { 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 } } 26*f439973dSWarner Losh 27*f439973dSWarner Losh typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL; 28*f439973dSWarner Losh 29*f439973dSWarner Losh /// 30*f439973dSWarner Losh /// LIST_ENTRY from BaseType 31*f439973dSWarner Losh /// 32*f439973dSWarner Losh typedef LIST_ENTRY EFI_LIST_ENTRY; 33*f439973dSWarner Losh 34*f439973dSWarner Losh typedef struct _EFI_RUNTIME_IMAGE_ENTRY EFI_RUNTIME_IMAGE_ENTRY; 35*f439973dSWarner Losh 36*f439973dSWarner Losh /// 37*f439973dSWarner Losh /// EFI_RUNTIME_IMAGE_ENTRY 38*f439973dSWarner Losh /// 39*f439973dSWarner Losh struct _EFI_RUNTIME_IMAGE_ENTRY { 40*f439973dSWarner Losh /// 41*f439973dSWarner Losh /// Start of image that has been loaded in memory. It is a pointer 42*f439973dSWarner Losh /// to either the DOS header or PE header of the image. 43*f439973dSWarner Losh /// 44*f439973dSWarner Losh VOID *ImageBase; 45*f439973dSWarner Losh /// 46*f439973dSWarner Losh /// Size in bytes of the image represented by ImageBase. 47*f439973dSWarner Losh /// 48*f439973dSWarner Losh UINT64 ImageSize; 49*f439973dSWarner Losh /// 50*f439973dSWarner Losh /// Information about the fix-ups that were performed on ImageBase when it was 51*f439973dSWarner Losh /// loaded into memory. 52*f439973dSWarner Losh /// 53*f439973dSWarner Losh VOID *RelocationData; 54*f439973dSWarner Losh /// 55*f439973dSWarner Losh /// The ImageHandle passed into ImageBase when it was loaded. 56*f439973dSWarner Losh /// 57*f439973dSWarner Losh EFI_HANDLE Handle; 58*f439973dSWarner Losh /// 59*f439973dSWarner Losh /// Entry for this node in the EFI_RUNTIME_ARCHITECTURE_PROTOCOL.ImageHead list. 60*f439973dSWarner Losh /// 61*f439973dSWarner Losh EFI_LIST_ENTRY Link; 62*f439973dSWarner Losh }; 63*f439973dSWarner Losh 64*f439973dSWarner Losh typedef struct _EFI_RUNTIME_EVENT_ENTRY EFI_RUNTIME_EVENT_ENTRY; 65*f439973dSWarner Losh 66*f439973dSWarner Losh /// 67*f439973dSWarner Losh /// EFI_RUNTIME_EVENT_ENTRY 68*f439973dSWarner Losh /// 69*f439973dSWarner Losh struct _EFI_RUNTIME_EVENT_ENTRY { 70*f439973dSWarner Losh /// 71*f439973dSWarner Losh /// The same as Type passed into CreateEvent(). 72*f439973dSWarner Losh /// 73*f439973dSWarner Losh UINT32 Type; 74*f439973dSWarner Losh /// 75*f439973dSWarner Losh /// The same as NotifyTpl passed into CreateEvent(). 76*f439973dSWarner Losh /// 77*f439973dSWarner Losh EFI_TPL NotifyTpl; 78*f439973dSWarner Losh /// 79*f439973dSWarner Losh /// The same as NotifyFunction passed into CreateEvent(). 80*f439973dSWarner Losh /// 81*f439973dSWarner Losh EFI_EVENT_NOTIFY NotifyFunction; 82*f439973dSWarner Losh /// 83*f439973dSWarner Losh /// The same as NotifyContext passed into CreateEvent(). 84*f439973dSWarner Losh /// 85*f439973dSWarner Losh VOID *NotifyContext; 86*f439973dSWarner Losh /// 87*f439973dSWarner Losh /// The EFI_EVENT returned by CreateEvent(). Event must be in runtime memory. 88*f439973dSWarner Losh /// 89*f439973dSWarner Losh EFI_EVENT *Event; 90*f439973dSWarner Losh /// 91*f439973dSWarner Losh /// Entry for this node in the 92*f439973dSWarner Losh /// EFI_RUNTIME_ARCHITECTURE_PROTOCOL.EventHead list. 93*f439973dSWarner Losh /// 94*f439973dSWarner Losh EFI_LIST_ENTRY Link; 95*f439973dSWarner Losh }; 96*f439973dSWarner Losh 97*f439973dSWarner Losh /// 98*f439973dSWarner Losh /// Allows the runtime functionality of the DXE Foundation to be contained in a 99*f439973dSWarner Losh /// separate driver. It also provides hooks for the DXE Foundation to export 100*f439973dSWarner Losh /// information that is needed at runtime. As such, this protocol allows the DXE 101*f439973dSWarner Losh /// Foundation to manage runtime drivers and events. This protocol also implies 102*f439973dSWarner Losh /// that the runtime services required to transition to virtual mode, 103*f439973dSWarner Losh /// SetVirtualAddressMap() and ConvertPointer(), have been registered into the 104*f439973dSWarner Losh /// EFI Runtime Table in the EFI System Partition. This protocol must be produced 105*f439973dSWarner Losh /// by a runtime DXE driver and may only be consumed by the DXE Foundation. 106*f439973dSWarner Losh /// 107*f439973dSWarner Losh struct _EFI_RUNTIME_ARCH_PROTOCOL { 108*f439973dSWarner Losh EFI_LIST_ENTRY ImageHead; ///< A list of type EFI_RUNTIME_IMAGE_ENTRY. 109*f439973dSWarner Losh EFI_LIST_ENTRY EventHead; ///< A list of type EFI_RUNTIME_EVENT_ENTRY. 110*f439973dSWarner Losh UINTN MemoryDescriptorSize; ///< Size of a memory descriptor that is returned by GetMemoryMap(). 111*f439973dSWarner Losh UINT32 MemoryDesciptorVersion; ///< Version of a memory descriptor that is returned by GetMemoryMap(). 112*f439973dSWarner Losh UINTN MemoryMapSize; ///< Size of the memory map in bytes contained in MemoryMapPhysical and MemoryMapVirtual. 113*f439973dSWarner Losh EFI_MEMORY_DESCRIPTOR *MemoryMapPhysical; ///< Pointer to a runtime buffer that contains a copy of 114*f439973dSWarner Losh ///< the memory map returned via GetMemoryMap(). 115*f439973dSWarner Losh EFI_MEMORY_DESCRIPTOR *MemoryMapVirtual; ///< Pointer to MemoryMapPhysical that is updated to virtual mode after SetVirtualAddressMap(). 116*f439973dSWarner Losh BOOLEAN VirtualMode; ///< Boolean that is TRUE if SetVirtualAddressMap() has been called. 117*f439973dSWarner Losh BOOLEAN AtRuntime; ///< Boolean that is TRUE if ExitBootServices () has been called. 118*f439973dSWarner Losh }; 119*f439973dSWarner Losh 120*f439973dSWarner Losh extern EFI_GUID gEfiRuntimeArchProtocolGuid; 121*f439973dSWarner Losh 122*f439973dSWarner Losh #endif 123