]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointer.c
EmulatorPkg: Remove all trailing whitespace
[mirror_edk2.git] / EmulatorPkg / Library / PeiServicesTablePointerLibMagicPage / PeiServicesTablePointer.c
1 /** @file
2 PEI Services Table Pointer Library.
3
4 Store PEI Services Table pointer via gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage.
5 This emulates a platform SRAM. The PI mechaism does not work in the emulator due to
6 lack of privledge.
7
8 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
9 Portiions copyrigth (c) 2011, Apple Inc. All rights reserved.
10 This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php.
14
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18 **/
19
20 #include <PiPei.h>
21 #include <Library/PeiServicesTablePointerLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/EmuMagicPageLib.h>
24
25
26 /**
27 Caches a pointer PEI Services Table.
28
29 Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
30 in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
31 Pre-EFI Initialization Core Interface Specification.
32
33 If PeiServicesTablePointer is NULL, then ASSERT().
34
35 @param PeiServicesTablePointer The address of PeiServices pointer.
36 **/
37 VOID
38 EFIAPI
39 SetPeiServicesTablePointer (
40 IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
41 )
42 {
43 ASSERT (PeiServicesTablePointer != NULL);
44 ASSERT (*PeiServicesTablePointer != NULL);
45 EMU_MAGIC_PAGE()->PeiServicesTablePointer = PeiServicesTablePointer;
46 }
47
48 /**
49 Retrieves the cached value of the PEI Services Table pointer.
50
51 Returns the cached value of the PEI Services Table pointer in a CPU specific manner
52 as specified in the CPU binding section of the Platform Initialization Pre-EFI
53 Initialization Core Interface Specification.
54
55 If the cached PEI Services Table pointer is NULL, then ASSERT().
56
57 @return The pointer to PeiServices.
58
59 **/
60 CONST EFI_PEI_SERVICES **
61 EFIAPI
62 GetPeiServicesTablePointer (
63 VOID
64 )
65 {
66 CONST EFI_PEI_SERVICES **PeiServicesTablePointer;
67
68 PeiServicesTablePointer = EMU_MAGIC_PAGE()->PeiServicesTablePointer;
69 ASSERT (PeiServicesTablePointer != NULL);
70 ASSERT (*PeiServicesTablePointer != NULL);
71 return PeiServicesTablePointer;
72 }
73
74
75