]>
Commit | Line | Data |
---|---|---|
0530bfe3 | 1 | /** @file\r |
2 | PEI Services Table Pointer Library.\r | |
3402aac7 | 3 | \r |
0530bfe3 | 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 | Copyright (c) 2011 Hewlett-Packard Corporation. All rights reserved.<BR>\r | |
4059386c | 9 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
0530bfe3 | 10 | \r |
11 | **/\r | |
12 | \r | |
13 | #include <PiPei.h>\r | |
14 | #include <Library/PeiServicesTablePointerLib.h>\r | |
15 | #include <Library/ArmLib.h>\r | |
16 | #include <Library/DebugLib.h>\r | |
17 | \r | |
18 | /**\r | |
3402aac7 RC |
19 | Caches a pointer PEI Services Table.\r |
20 | \r | |
21 | Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer\r | |
0530bfe3 | 22 | in a platform specific manner.\r |
3402aac7 | 23 | \r |
0530bfe3 | 24 | If PeiServicesTablePointer is NULL, then ASSERT().\r |
3402aac7 | 25 | \r |
0530bfe3 | 26 | @param PeiServicesTablePointer The address of PeiServices pointer.\r |
27 | **/\r | |
28 | VOID\r | |
29 | EFIAPI\r | |
30 | SetPeiServicesTablePointer (\r | |
429309e0 | 31 | IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer\r |
0530bfe3 | 32 | )\r |
33 | {\r | |
429309e0 | 34 | ArmWriteTpidrurw ((UINTN)PeiServicesTablePointer);\r |
0530bfe3 | 35 | }\r |
36 | \r | |
37 | /**\r | |
38 | Retrieves the cached value of the PEI Services Table pointer.\r | |
39 | \r | |
3402aac7 RC |
40 | Returns the cached value of the PEI Services Table pointer in a CPU specific manner\r |
41 | as specified in the CPU binding section of the Platform Initialization Pre-EFI\r | |
0530bfe3 | 42 | Initialization Core Interface Specification.\r |
3402aac7 | 43 | \r |
0530bfe3 | 44 | If the cached PEI Services Table pointer is NULL, then ASSERT().\r |
45 | \r | |
46 | @return The pointer to PeiServices.\r | |
47 | \r | |
48 | **/\r | |
49 | CONST EFI_PEI_SERVICES **\r | |
50 | EFIAPI\r | |
51 | GetPeiServicesTablePointer (\r | |
52 | VOID\r | |
53 | )\r | |
54 | {\r | |
429309e0 | 55 | return (CONST EFI_PEI_SERVICES **)ArmReadTpidrurw ();\r |
0530bfe3 | 56 | }\r |
ebe32e89 EC |
57 | \r |
58 | /**\r | |
59 | Perform CPU specific actions required to migrate the PEI Services Table\r | |
60 | pointer from temporary RAM to permanent RAM.\r | |
61 | \r | |
62 | For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes\r | |
63 | immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r | |
64 | For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes\r | |
65 | immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r | |
66 | For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r | |
67 | a dedicated CPU register. This means that there is no memory storage\r | |
68 | associated with storing the PEI Services Table pointer, so no additional\r | |
69 | migration actions are required for Itanium or ARM CPUs.\r | |
70 | \r | |
71 | **/\r | |
72 | VOID\r | |
73 | EFIAPI\r | |
429309e0 MK |
74 | MigratePeiServicesTablePointer (\r |
75 | VOID\r | |
76 | )\r | |
ebe32e89 EC |
77 | {\r |
78 | return;\r | |
79 | }\r |