2 Runtime Architectural Protocol as defined in the DXE CIS.
4 This code is used to produce the EFI runtime architectural protocol.
6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Protocol/LoadedImage.h>
22 #include <Protocol/Runtime.h>
23 #include <Library/BaseLib.h>
24 #include <Library/UefiDriverEntryPoint.h>
25 #include <Library/DebugLib.h>
26 #include <Library/ReportStatusCodeLib.h>
27 #include <Library/UefiRuntimeServicesTableLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/CacheMaintenanceLib.h>
31 #include <Library/PeCoffLib.h>
35 // Function Prototypes
38 Calculate CRC32 for target data.
40 @param Data The target data.
41 @param DataSize The target data size.
42 @param CrcOut The CRC32 for target data.
44 @retval EFI_SUCCESS The CRC32 for target data is calculated successfully.
45 @retval EFI_INVALID_PARAMETER Some parameter is not valid, so the CRC32 is not
51 RuntimeDriverCalculateCrc32 (
58 Determines the new virtual address that is to be used on subsequent memory accesses.
61 @param DebugDisposition Supplies type information for the pointer being converted.
62 @param ConvertAddress A pointer to a pointer that is to be fixed to be the value needed
63 for the new virtual address mappings being applied.
65 @retval EFI_SUCCESS The pointer pointed to by Address was modified.
66 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part
67 of the current memory map. This is normally fatal.
68 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
73 RuntimeDriverConvertPointer (
74 IN UINTN DebugDisposition
,
75 IN OUT VOID
**ConvertAddress
79 Changes the runtime addressing mode of EFI firmware from physical to virtual.
81 @param MemoryMapSize The size in bytes of VirtualMap.
82 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
83 @param DescriptorVersion The version of the structure entries in VirtualMap.
84 @param VirtualMap An array of memory descriptors which contain new virtual
85 address mapping information for all runtime ranges.
87 @retval EFI_SUCCESS The virtual address map has been applied.
88 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
89 virtual address mapped mode.
90 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.
91 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
92 map that requires a mapping.
93 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
99 RuntimeDriverSetVirtualAddressMap (
100 IN UINTN MemoryMapSize
,
101 IN UINTN DescriptorSize
,
102 IN UINT32 DescriptorVersion
,
103 IN EFI_MEMORY_DESCRIPTOR
*VirtualMap
107 Install Runtime AP. This code includes the EfiRuntimeLib, but it only
108 functions at RT in physical mode.
110 @param ImageHandle Image handle of this driver.
111 @param SystemTable Pointer to the EFI System Table.
113 @retval EFI_SUCEESS Runtime Driver Architectural Protocol Installed
114 @return Other value if gBS->InstallMultipleProtocolInterfaces fails. Check
115 gBS->InstallMultipleProtocolInterfaces for details.
120 RuntimeDriverInitialize (
121 IN EFI_HANDLE ImageHandle
,
122 IN EFI_SYSTEM_TABLE
*SystemTable