VirtualBox

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

Last change on this file since 105681 was 99404, checked in by vboxsync, 23 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, 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 The constructor function caches the pointer to PEI services.
63
64 The constructor function caches the pointer to PEI services.
65 It will always return EFI_SUCCESS.
66
67 @param FileHandle The handle of FFS header the loaded driver.
68 @param PeiServices The pointer to the PEI services.
69
70 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
71
72**/
73EFI_STATUS
74EFIAPI
75PeiServicesTablePointerLibConstructor (
76 IN EFI_PEI_FILE_HANDLE FileHandle,
77 IN CONST EFI_PEI_SERVICES **PeiServices
78 )
79{
80 gPeiServices = PeiServices;
81 return EFI_SUCCESS;
82}
83
84/**
85 Perform CPU specific actions required to migrate the PEI Services Table
86 pointer from temporary RAM to permanent RAM.
87
88 For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
89 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
90 For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
91 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
92 For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
93 a dedicated CPU register. This means that there is no memory storage
94 associated with storing the PEI Services Table pointer, so no additional
95 migration actions are required for Itanium or ARM CPUs.
96
97**/
98VOID
99EFIAPI
100MigratePeiServicesTablePointer (
101 VOID
102 )
103{
104 //
105 // PEI Services Table pointer is cached in the global variable. No additional
106 // migration actions are required.
107 //
108 return;
109}
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