]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Dxe/ArchProtocol/Runtime.h
bbd4c1a69934296f9e0ea6c7e7c1725de39ee577
[mirror_edk2.git] / MdePkg / Include / Dxe / ArchProtocol / Runtime.h
1 /** @file
2 Runtime Architectural Protocol as defined in DXE CIS
3
4 This code is used to produce the EFI 1.0 runtime virtual switch over
5
6 This driver must add SetVirtualAddressMap () and ConvertPointer () to
7 the EFI system table. This driver is not responcible for CRCing the
8 EFI system table.
9
10 This driver will add EFI_RUNTIME_ARCH_PROTOCOL_GUID protocol with a
11 pointer to the Runtime Arch Protocol instance structure. The protocol
12 member functions are used by the DXE core to export information need
13 by this driver to produce the runtime transition to virtual mode
14 calling.
15
16 Copyright (c) 2006, Intel Corporation
17 All rights reserved. This program and the accompanying materials
18 are licensed and made available under the terms and conditions of the BSD License
19 which accompanies this distribution. The full text of the license may be found at
20 http://opensource.org/licenses/bsd-license.php
21
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24
25 Module Name: Runtime.h
26
27 @par Revision Reference:
28 Version 0.90.
29
30 **/
31
32 #ifndef __ARCH_PROTOCOL_RUNTIME_H__
33 #define __ARCH_PROTOCOL_RUNTIME_H__
34
35 //
36 // Global ID for the Runtime Architectural Protocol
37 //
38 #define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
39 { 0x96d08253, 0x8483, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
40
41 typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL;
42
43 /**
44 When a SetVirtualAddressMap() is performed all the runtime images loaded by
45 DXE must be fixed up with the new virtual address map. To facilitate this the
46 Runtime Architectural Protocol needs to be informed of every runtime driver
47 that is registered. All the runtime images loaded by DXE should be registered
48 with this service by the DXE Core when ExitBootServices() is called. The
49 images that are registered with this service must have successfully been
50 loaded into memory with the Boot Service LoadImage(). As a result, no
51 parameter checking needs to be performed.
52
53 @param This The EFI_RUNTIME_ARCH_PROTOCOL instance.
54
55 @param ImageBase Start of image that has been loaded in memory. It is either
56 a pointer to the DOS or PE header of the image.
57
58 @param ImageSize Size of the image in bytes.
59
60 @param RelocationData Information about the fixups that were performed on ImageBase
61 when it was loaded into memory. This information is needed
62 when the virtual mode fix-ups are reapplied so that data that
63 has been programmatically updated will not be fixed up. If
64 code updates a global variable the code is responsible for
65 fixing up the variable for virtual mode.
66
67 @retval EFI_SUCCESS The ImageBase has been registered.
68
69 @retval EFI_OUT_OF_RESOURCES There are not enough resources to register ImageBase.
70
71 **/
72 typedef
73 EFI_STATUS
74 (EFIAPI *EFI_RUNTIME_REGISTER_IMAGE) (
75 IN EFI_RUNTIME_ARCH_PROTOCOL *This,
76 IN EFI_PHYSICAL_ADDRESS ImageBase,
77 IN UINTN ImageSize,
78 IN VOID *RelocationData
79 );
80
81
82 /**
83 This function is used to support the required runtime events. Currently only
84 runtime events of type EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE needs to be
85 registered with this service. All the runtime events that exist in the DXE
86 Core should be registered with this service when ExitBootServices() is called.
87 All the events that are registered with this service must have been created
88 with the Boot Service CreateEvent(). As a result, no parameter checking needs
89 to be performed.
90
91 @param This The EFI_RUNTIME_ARCH_PROTOCOL instance.
92
93 @param Type The same as Type passed into CreateEvent().
94
95 @param NotifyTpl The same as NotifyTpl passed into CreateEvent().
96
97 @param NotifyFunction The same as NotifyFunction passed into CreateEvent().
98
99 @param NotifyContext The same as NotifyContext passed into CreateEvent().
100
101 @param Event The EFI_EVENT returned by CreateEvent(). Event must be in
102 runtime memory.
103
104 @retval EFI_SUCCESS The Event has been registered.
105
106 @retval EFI_OUT_OF_RESOURCES There are not enough resources to register Event.
107
108 **/
109 typedef
110 EFI_STATUS
111 (EFIAPI *EFI_RUNTIME_REGISTER_EVENT) (
112 IN EFI_RUNTIME_ARCH_PROTOCOL *This,
113 IN UINT32 Type,
114 IN EFI_TPL NotifyTpl,
115 IN EFI_EVENT_NOTIFY NotifyFunction,
116 IN VOID *NotifyContext,
117 IN EFI_EVENT *Event
118 );
119
120 //
121 // Interface stucture for the Runtime Architectural Protocol
122 //
123 /**
124 @par Protocol Description:
125 The DXE driver that produces this protocol must be a runtime driver. This
126 driver is responsible for initializing the SetVirtualAddressMap() and
127 ConvertPointer() fields of the EFI Runtime Services Table and the
128 CalculateCrc32() field of the EFI Boot Services Table. See the Runtime
129 Services chapter and the Boot Services chapter for details on these services.
130 After the two fields of the EFI Runtime Services Table and the one field of
131 the EFI Boot Services Table have been initialized, the driver must install
132 the EFI_RUNTIME_ARCH_PROTOCOL_GUID on a new handle with an EFI_RUNTIME_ARCH_
133 PROTOCOL interface pointer. The installation of this protocol informs the
134 DXE core that the virtual memory services and the 32-bit CRC services are
135 now available, and the DXE core must update the 32-bit CRC of the EFI Runtime
136 Services Table and the 32-bit CRC of the EFI Boot Services Table.
137
138 All runtime core services are provided by the EFI_RUNTIME_ARCH_PROTOCOL.
139 This includes the support for registering runtime images that must be
140 re-fixed up when a transition is made from physical mode to virtual mode.
141 This protocol also supports all events that are defined to fire at runtime.
142 This protocol also contains a CRC-32 function that will be used by the DXE
143 core as a boot service. The EFI_RUNTIME_ARCH_PROTOCOL needs the CRC-32
144 function when a transition is made from physical mode to virtual mode and
145 the EFI System Table and EFI Runtime Table are fixed up with virtual pointers.
146
147 @param RegisterRuntimeImage
148 Register a runtime image so it can be converted to virtual mode if the EFI Runtime Services
149 SetVirtualAddressMap() is called.
150
151 @param RegisterRuntimeEvent
152 Register an event than needs to be notified at runtime.
153
154 **/
155 struct _EFI_RUNTIME_ARCH_PROTOCOL {
156 EFI_RUNTIME_REGISTER_IMAGE RegisterImage;
157 EFI_RUNTIME_REGISTER_EVENT RegisterEvent;
158 };
159
160 extern EFI_GUID gEfiRuntimeArchProtocolGuid;
161
162 #endif