VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c@ 99396

Last change on this file since 99396 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1/** @file
2 PEI Services Table Pointer Library.
3
4 This library is used for PEIM which does executed from flash device directly but
5 executed in memory.
6
7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#include <PiPei.h>
13#include <Library/PeiServicesTablePointerLib.h>
14#include <Library/DebugLib.h>
15
16CONST EFI_PEI_SERVICES **gPeiServices;
17
18/**
19 Caches a pointer PEI Services Table.
20
21 Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
22 in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
23 Pre-EFI Initialization Core Interface Specification.
24
25 If PeiServicesTablePointer is NULL, then ASSERT().
26
27 @param PeiServicesTablePointer The address of PeiServices pointer.
28**/
29VOID
30EFIAPI
31SetPeiServicesTablePointer (
32 IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
33 )
34{
35 ASSERT (PeiServicesTablePointer != NULL);
36 gPeiServices = PeiServicesTablePointer;
37}
38
39/**
40 Retrieves the cached value of the PEI Services Table pointer.
41
42 Returns the cached value of the PEI Services Table pointer in a CPU specific manner
43 as specified in the CPU binding section of the Platform Initialization Pre-EFI
44 Initialization Core Interface Specification.
45
46 If the cached PEI Services Table pointer is NULL, then ASSERT().
47
48 @return The pointer to PeiServices.
49
50**/
51CONST EFI_PEI_SERVICES **
52EFIAPI
53GetPeiServicesTablePointer (
54 VOID
55 )
56{
57 ASSERT (gPeiServices != NULL);
58 return gPeiServices;
59}
60
61
62/**
63 The constructor function caches the pointer to PEI services.
64
65 The constructor function caches the pointer to PEI services.
66 It will always return EFI_SUCCESS.
67
68 @param FileHandle The handle of FFS header the loaded driver.
69 @param PeiServices The pointer to the PEI services.
70
71 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
72
73**/
74EFI_STATUS
75EFIAPI
76PeiServicesTablePointerLibConstructor (
77 IN EFI_PEI_FILE_HANDLE FileHandle,
78 IN CONST EFI_PEI_SERVICES **PeiServices
79 )
80{
81 gPeiServices = PeiServices;
82 return EFI_SUCCESS;
83}
84
85/**
86 Perform CPU specific actions required to migrate the PEI Services Table
87 pointer from temporary RAM to permanent RAM.
88
89 For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
90 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
91 For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
92 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
93 For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
94 a dedicated CPU register. This means that there is no memory storage
95 associated with storing the PEI Services Table pointer, so no additional
96 migration actions are required for Itanium or ARM CPUs.
97
98**/
99VOID
100EFIAPI
101MigratePeiServicesTablePointer (
102 VOID
103 )
104{
105 //
106 // PEI Services Table pointer is cached in the global variable. No additional
107 // migration actions are required.
108 //
109 return;
110}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette