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