]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
ArmPlatformPkg: drop ArmPlatformGlobalVariableLib resolutions
[mirror_edk2.git] / ArmPlatformPkg / Library / PeiServicesTablePointerLib / PeiServicesTablePointer.c
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 - 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #include <PiPei.h>
19 #include <Library/ArmPlatformGlobalVariableLib.h>
20 #include <Library/PeiServicesTablePointerLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/PcdLib.h>
23
24 /**
25 Caches a pointer PEI Services Table.
26
27 Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
28 in a platform specific manner.
29
30 If PeiServicesTablePointer is NULL, then ASSERT().
31
32 @param PeiServicesTablePointer The address of PeiServices pointer.
33 **/
34 VOID
35 EFIAPI
36 SetPeiServicesTablePointer (
37 IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
38 )
39 {
40 ASSERT (PeiServicesTablePointer != NULL);
41
42 ArmPlatformSetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);
43 }
44
45 /**
46 Retrieves the cached value of the PEI Services Table pointer.
47
48 Returns the cached value of the PEI Services Table pointer in a CPU specific manner
49 as specified in the CPU binding section of the Platform Initialization Pre-EFI
50 Initialization Core Interface Specification.
51
52 If the cached PEI Services Table pointer is NULL, then ASSERT().
53
54 @return The pointer to PeiServices.
55
56 **/
57 CONST EFI_PEI_SERVICES**
58 EFIAPI
59 GetPeiServicesTablePointer (
60 VOID
61 )
62 {
63 EFI_PEI_SERVICES **PeiServicesTablePointer;
64
65 ArmPlatformGetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);
66
67 return (CONST EFI_PEI_SERVICES**)PeiServicesTablePointer;
68 }
69
70 /**
71 Perform CPU specific actions required to migrate the PEI Services Table
72 pointer from temporary RAM to permanent RAM.
73
74 For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
75 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
76 For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
77 immediately preceding the Interrupt Descriptor Table (IDT) in memory.
78 For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
79 a dedicated CPU register. This means that there is no memory storage
80 associated with storing the PEI Services Table pointer, so no additional
81 migration actions are required for Itanium or ARM CPUs.
82
83 **/
84 VOID
85 EFIAPI
86 MigratePeiServicesTablePointer (
87 VOID
88 )
89 {
90 return;
91 }