Merger trackers #7807 and #8372.
[mirror_edk2.git] / MdeModulePkg / Core / RuntimeDxe / Runtime.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 Runtime.h
15
16 Abstract:
17
18 Runtime Architectural Protocol as defined in the DXE CIS
19
20 This code is used to produce the EFI runtime architectural protocol.
21
22 --*/
23
24 #ifndef _RUNTIME_H_
25 #define _RUNTIME_H_
26
27 #include <PiDxe.h>
28 #include <Protocol/LoadedImage.h>
29 #include <Protocol/Runtime.h>
30 #include <Library/BaseLib.h>
31 #include <Library/UefiDriverEntryPoint.h>
32 #include <Library/DebugLib.h>
33 #include <Library/ReportStatusCodeLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/UefiRuntimeServicesTableLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/CacheMaintenanceLib.h>
38 #include <Library/PeCoffLib.h>
39 #include <Library/PcdLib.h>
40
41
42 //
43 // Function Prototypes
44 //
45 EFI_STATUS
46 EFIAPI
47 RuntimeDriverCalculateCrc32 (
48 IN VOID *Data,
49 IN UINTN DataSize,
50 OUT UINT32 *CrcOut
51 )
52 /*++
53
54 Routine Description:
55
56 Calculate CRC32 for target data
57
58 Arguments:
59
60 Data - The target data.
61 DataSize - The target data size.
62 CrcOut - The CRC32 for target data.
63
64 Returns:
65
66 EFI_SUCCESS - The CRC32 for target data is calculated successfully.
67 EFI_INVALID_PARAMETER - Some parameter is not valid, so the CRC32 is not
68 calculated.
69
70 --*/
71 ;
72
73 EFI_STATUS
74 EFIAPI
75 RuntimeDriverConvertPointer (
76 IN UINTN DebugDisposition,
77 IN OUT VOID **ConvertAddress
78 )
79 /*++
80
81 Routine Description:
82
83 Determines the new virtual address that is to be used on subsequent memory accesses.
84
85 Arguments:
86
87 DebugDisposition - Supplies type information for the pointer being converted.
88 ConvertAddress - A pointer to a pointer that is to be fixed to be the value needed
89 for the new virtual address mappings being applied.
90
91 Returns:
92
93 EFI_SUCCESS - The pointer pointed to by Address was modified.
94 EFI_NOT_FOUND - The pointer pointed to by Address was not found to be part
95 of the current memory map. This is normally fatal.
96 EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
97
98 --*/
99 ;
100
101 EFI_STATUS
102 EFIAPI
103 RuntimeDriverSetVirtualAddressMap (
104 IN UINTN MemoryMapSize,
105 IN UINTN DescriptorSize,
106 IN UINT32 DescriptorVersion,
107 IN EFI_MEMORY_DESCRIPTOR *VirtualMap
108 )
109 /*++
110
111 Routine Description:
112
113 Changes the runtime addressing mode of EFI firmware from physical to virtual.
114
115 Arguments:
116
117 MemoryMapSize - The size in bytes of VirtualMap.
118 DescriptorSize - The size in bytes of an entry in the VirtualMap.
119 DescriptorVersion - The version of the structure entries in VirtualMap.
120 VirtualMap - An array of memory descriptors which contain new virtual
121 address mapping information for all runtime ranges.
122
123 Returns:
124
125 EFI_SUCCESS - The virtual address map has been applied.
126 EFI_UNSUPPORTED - EFI firmware is not at runtime, or the EFI firmware is already in
127 virtual address mapped mode.
128 EFI_INVALID_PARAMETER - DescriptorSize or DescriptorVersion is invalid.
129 EFI_NO_MAPPING - A virtual address was not supplied for a range in the memory
130 map that requires a mapping.
131 EFI_NOT_FOUND - A virtual address was supplied for an address that is not found
132 in the memory map.
133
134 --*/
135 ;
136
137 VOID
138 RuntimeDriverInitializeCrc32Table (
139 VOID
140 )
141 /*++
142
143 Routine Description:
144
145 Initialize CRC32 table.
146
147 Arguments:
148
149 None.
150
151 Returns:
152
153 None.
154
155 --*/
156 ;
157
158 EFI_STATUS
159 EFIAPI
160 RuntimeDriverInitialize (
161 IN EFI_HANDLE ImageHandle,
162 IN EFI_SYSTEM_TABLE *SystemTable
163 )
164 /*++
165
166 Routine Description:
167
168 Install Runtime AP. This code includes the EfiRuntimeLib, but it only
169 functions at RT in physical mode.
170
171 Arguments:
172
173 ImageHandle - Image handle of this driver.
174 SystemTable - Pointer to the EFI System Table.
175
176 Returns:
177
178 EFI_SUCEESS - Runtime Driver Architectural Protocol installed.
179
180 --*/
181 ;
182
183 #endif