]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
ArmPlatformPkg: Introduce ArmPlatformGlobalVariableLib
[mirror_edk2.git] / ArmPlatformPkg / Library / PeiServicesTablePointerLib / PeiServicesTablePointer.c
CommitLineData
1d5d0ae9 1/** @file\r
2 PEI Services Table Pointer Library.\r
3 \r
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
25 Caches a pointer PEI Services Table. \r
26 \r
27 Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer \r
28 in a platform specific manner.\r
29 \r
30 If PeiServicesTablePointer is NULL, then ASSERT().\r
31 \r
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
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
50 Initialization Core Interface Specification.\r
51 \r
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
70\r