|
|
|
@@ -25,7 +25,7 @@
|
|
|
|
|
Module Name: Runtime.h
|
|
|
|
|
|
|
|
|
|
@par Revision Reference:
|
|
|
|
|
Version 0.90.
|
|
|
|
|
Version 0.91.
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
@@ -36,115 +36,89 @@
|
|
|
|
|
// Global ID for the Runtime Architectural Protocol
|
|
|
|
|
//
|
|
|
|
|
#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
|
|
|
|
|
{ 0x96d08253, 0x8483, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
|
|
|
|
|
{ 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 } }
|
|
|
|
|
|
|
|
|
|
typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL;
|
|
|
|
|
typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
When a SetVirtualAddressMap() is performed all the runtime images loaded by
|
|
|
|
|
DXE must be fixed up with the new virtual address map. To facilitate this the
|
|
|
|
|
Runtime Architectural Protocol needs to be informed of every runtime driver
|
|
|
|
|
that is registered. All the runtime images loaded by DXE should be registered
|
|
|
|
|
with this service by the DXE Core when ExitBootServices() is called. The
|
|
|
|
|
images that are registered with this service must have successfully been
|
|
|
|
|
loaded into memory with the Boot Service LoadImage(). As a result, no
|
|
|
|
|
parameter checking needs to be performed.
|
|
|
|
|
//
|
|
|
|
|
// LIST_ENTRY from BaseType
|
|
|
|
|
//
|
|
|
|
|
typedef LIST_ENTRY EFI_LIST_ENTRY;
|
|
|
|
|
|
|
|
|
|
@param This The EFI_RUNTIME_ARCH_PROTOCOL instance.
|
|
|
|
|
@param ImageBase Start of image that has been loaded in memory. It is either
|
|
|
|
|
a pointer to the DOS or PE header of the image.
|
|
|
|
|
@param ImageSize Size of the image in bytes.
|
|
|
|
|
@param RelocationData Information about the fixups that were performed on ImageBase
|
|
|
|
|
when it was loaded into memory. This information is needed
|
|
|
|
|
when the virtual mode fix-ups are reapplied so that data that
|
|
|
|
|
has been programmatically updated will not be fixed up. If
|
|
|
|
|
code updates a global variable the code is responsible for
|
|
|
|
|
fixing up the variable for virtual mode.
|
|
|
|
|
typedef struct _EFI_RUNTIME_IMAGE_ENTRY EFI_RUNTIME_IMAGE_ENTRY;
|
|
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The ImageBase has been registered.
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to register ImageBase.
|
|
|
|
|
struct _EFI_RUNTIME_IMAGE_ENTRY {
|
|
|
|
|
VOID *ImageBase;
|
|
|
|
|
UINT64 ImageSize;
|
|
|
|
|
VOID *RelocationData;
|
|
|
|
|
EFI_HANDLE Handle;
|
|
|
|
|
EFI_LIST_ENTRY Link;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
typedef
|
|
|
|
|
EFI_STATUS
|
|
|
|
|
(EFIAPI *EFI_RUNTIME_REGISTER_IMAGE) (
|
|
|
|
|
IN EFI_RUNTIME_ARCH_PROTOCOL *This,
|
|
|
|
|
IN EFI_PHYSICAL_ADDRESS ImageBase,
|
|
|
|
|
IN UINTN ImageSize,
|
|
|
|
|
IN VOID *RelocationData
|
|
|
|
|
);
|
|
|
|
|
typedef struct _EFI_RUNTIME_EVENT_ENTRY EFI_RUNTIME_EVENT_ENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
This function is used to support the required runtime events. Currently only
|
|
|
|
|
runtime events of type EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE needs to be
|
|
|
|
|
registered with this service. All the runtime events that exist in the DXE
|
|
|
|
|
Core should be registered with this service when ExitBootServices() is called.
|
|
|
|
|
All the events that are registered with this service must have been created
|
|
|
|
|
with the Boot Service CreateEvent(). As a result, no parameter checking needs
|
|
|
|
|
to be performed.
|
|
|
|
|
|
|
|
|
|
@param This The EFI_RUNTIME_ARCH_PROTOCOL instance.
|
|
|
|
|
@param Type The same as Type passed into CreateEvent().
|
|
|
|
|
@param NotifyTpl The same as NotifyTpl passed into CreateEvent().
|
|
|
|
|
@param NotifyFunction The same as NotifyFunction passed into CreateEvent().
|
|
|
|
|
@param NotifyContext The same as NotifyContext passed into CreateEvent().
|
|
|
|
|
@param Event The EFI_EVENT returned by CreateEvent(). Event must be in
|
|
|
|
|
runtime memory.
|
|
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The Event has been registered.
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources to register Event.
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
typedef
|
|
|
|
|
EFI_STATUS
|
|
|
|
|
(EFIAPI *EFI_RUNTIME_REGISTER_EVENT) (
|
|
|
|
|
IN EFI_RUNTIME_ARCH_PROTOCOL *This,
|
|
|
|
|
IN UINT32 Type,
|
|
|
|
|
IN EFI_TPL NotifyTpl,
|
|
|
|
|
IN EFI_EVENT_NOTIFY NotifyFunction,
|
|
|
|
|
IN VOID *NotifyContext,
|
|
|
|
|
IN EFI_EVENT *Event
|
|
|
|
|
);
|
|
|
|
|
struct _EFI_RUNTIME_EVENT_ENTRY {
|
|
|
|
|
UINT32 Type;
|
|
|
|
|
EFI_TPL NotifyTpl;
|
|
|
|
|
EFI_EVENT_NOTIFY NotifyFunction;
|
|
|
|
|
VOID *NotifyContext;
|
|
|
|
|
EFI_EVENT *Event;
|
|
|
|
|
EFI_LIST_ENTRY Link;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Interface stucture for the Runtime Architectural Protocol
|
|
|
|
|
//
|
|
|
|
|
/**
|
|
|
|
|
@par Protocol Description:
|
|
|
|
|
The DXE driver that produces this protocol must be a runtime driver. This
|
|
|
|
|
driver is responsible for initializing the SetVirtualAddressMap() and
|
|
|
|
|
ConvertPointer() fields of the EFI Runtime Services Table and the
|
|
|
|
|
CalculateCrc32() field of the EFI Boot Services Table. See the Runtime
|
|
|
|
|
Services chapter and the Boot Services chapter for details on these services.
|
|
|
|
|
After the two fields of the EFI Runtime Services Table and the one field of
|
|
|
|
|
the EFI Boot Services Table have been initialized, the driver must install
|
|
|
|
|
the EFI_RUNTIME_ARCH_PROTOCOL_GUID on a new handle with an EFI_RUNTIME_ARCH_
|
|
|
|
|
PROTOCOL interface pointer. The installation of this protocol informs the
|
|
|
|
|
DXE core that the virtual memory services and the 32-bit CRC services are
|
|
|
|
|
now available, and the DXE core must update the 32-bit CRC of the EFI Runtime
|
|
|
|
|
Services Table and the 32-bit CRC of the EFI Boot Services Table.
|
|
|
|
|
Allows the runtime functionality of the DXE Foundation to be contained in a
|
|
|
|
|
separate driver. It also provides hooks for the DXE Foundation to export
|
|
|
|
|
information that is needed at runtime. As such, this protocol allows the DXE
|
|
|
|
|
Foundation to manage runtime drivers and events. This protocol also implies
|
|
|
|
|
that the runtime services required to transition to virtual mode,
|
|
|
|
|
SetVirtualAddressMap() and ConvertPointer(), have been registered into the
|
|
|
|
|
EFI Runtime Table in the EFI System Partition. This protocol must be produced
|
|
|
|
|
by a runtime DXE driver and may only be consumed by the DXE Foundation.
|
|
|
|
|
|
|
|
|
|
All runtime core services are provided by the EFI_RUNTIME_ARCH_PROTOCOL.
|
|
|
|
|
This includes the support for registering runtime images that must be
|
|
|
|
|
re-fixed up when a transition is made from physical mode to virtual mode.
|
|
|
|
|
This protocol also supports all events that are defined to fire at runtime.
|
|
|
|
|
This protocol also contains a CRC-32 function that will be used by the DXE
|
|
|
|
|
core as a boot service. The EFI_RUNTIME_ARCH_PROTOCOL needs the CRC-32
|
|
|
|
|
function when a transition is made from physical mode to virtual mode and
|
|
|
|
|
the EFI System Table and EFI Runtime Table are fixed up with virtual pointers.
|
|
|
|
|
@param ImageHead
|
|
|
|
|
A list of type EFI_RUNTIME_IMAGE_ENTRY.
|
|
|
|
|
|
|
|
|
|
@param RegisterRuntimeImage
|
|
|
|
|
Register a runtime image so it can be converted to virtual mode if the EFI Runtime Services
|
|
|
|
|
SetVirtualAddressMap() is called.
|
|
|
|
|
@param EventHead
|
|
|
|
|
A list of type EFI_RUNTIME_EVENT_ENTRY.
|
|
|
|
|
|
|
|
|
|
@param RegisterRuntimeEvent
|
|
|
|
|
Register an event than needs to be notified at runtime.
|
|
|
|
|
@param MemoryDescriptorSize
|
|
|
|
|
Size of a memory descriptor that is return by GetMemoryMap().
|
|
|
|
|
|
|
|
|
|
@param MemoryDescriptorVersion
|
|
|
|
|
Version of a memory descriptor that is return by GetMemoryMap().
|
|
|
|
|
|
|
|
|
|
@param MemoryMapSize
|
|
|
|
|
Size of the memory map in bytes contained in MemoryMapPhysical and MemoryMapVirtual.
|
|
|
|
|
|
|
|
|
|
@param MemoryMapPhysical
|
|
|
|
|
Pointer to a runtime buffer that contains a copy of
|
|
|
|
|
the memory map returned via GetMemoryMap().
|
|
|
|
|
|
|
|
|
|
@param MemoryMapVirtual
|
|
|
|
|
Pointer to MemoryMapPhysical that is updated to virtual mode after SetVirtualAddressMap().
|
|
|
|
|
|
|
|
|
|
@param VirtualMode
|
|
|
|
|
Boolean that is TRUE if SetVirtualAddressMap() has been called.
|
|
|
|
|
|
|
|
|
|
@param AtRuntime
|
|
|
|
|
Boolean that is TRUE if ExitBootServices () has been called.
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
struct _EFI_RUNTIME_ARCH_PROTOCOL {
|
|
|
|
|
EFI_RUNTIME_REGISTER_IMAGE RegisterImage;
|
|
|
|
|
EFI_RUNTIME_REGISTER_EVENT RegisterEvent;
|
|
|
|
|
EFI_LIST_ENTRY ImageHead;
|
|
|
|
|
EFI_LIST_ENTRY EventHead;
|
|
|
|
|
UINTN MemoryDescriptorSize;
|
|
|
|
|
UINT32 MemoryDesciptorVersion;
|
|
|
|
|
UINTN MemoryMapSize;
|
|
|
|
|
EFI_MEMORY_DESCRIPTOR *MemoryMapPhysical;
|
|
|
|
|
EFI_MEMORY_DESCRIPTOR *MemoryMapVirtual;
|
|
|
|
|
BOOLEAN VirtualMode;
|
|
|
|
|
BOOLEAN AtRuntime;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern EFI_GUID gEfiRuntimeArchProtocolGuid;
|
|
|
|
|