]>
Commit | Line | Data |
---|---|---|
949f388f | 1 | /** @file\r |
65e3f333 | 2 | PEI Services Table Pointer Library.\r |
d18d8a1d | 3 | \r |
65e3f333 | 4 | This library is used for PEIM which does executed from flash device directly but\r |
5 | executed in memory.\r | |
949f388f | 6 | \r |
7 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
e3ba31da | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
949f388f | 9 | \r |
10 | **/\r | |
11 | \r | |
12 | #include <PiPei.h>\r | |
13 | #include <Library/PeiServicesTablePointerLib.h>\r | |
14 | #include <Library/DebugLib.h>\r | |
15 | \r | |
65e3f333 | 16 | CONST EFI_PEI_SERVICES **gPeiServices;\r |
949f388f | 17 | \r |
18 | /**\r | |
d18d8a1d | 19 | Caches a pointer PEI Services Table.\r |
20 | \r | |
21 | Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer\r | |
22 | in a CPU specific manner as specified in the CPU binding section of the Platform Initialization\r | |
23 | Pre-EFI Initialization Core Interface Specification.\r | |
24 | \r | |
949f388f | 25 | If PeiServicesTablePointer is NULL, then ASSERT().\r |
d18d8a1d | 26 | \r |
949f388f | 27 | @param PeiServicesTablePointer The address of PeiServices pointer.\r |
28 | **/\r | |
29 | VOID\r | |
30 | EFIAPI\r | |
31 | SetPeiServicesTablePointer (\r | |
65e3f333 | 32 | IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer\r |
949f388f | 33 | )\r |
34 | {\r | |
65e3f333 | 35 | ASSERT (PeiServicesTablePointer != NULL);\r |
36 | gPeiServices = PeiServicesTablePointer;\r | |
949f388f | 37 | }\r |
38 | \r | |
39 | /**\r | |
40 | Retrieves the cached value of the PEI Services Table pointer.\r | |
41 | \r | |
d18d8a1d | 42 | Returns the cached value of the PEI Services Table pointer in a CPU specific manner\r |
43 | as specified in the CPU binding section of the Platform Initialization Pre-EFI\r | |
949f388f | 44 | Initialization Core Interface Specification.\r |
d18d8a1d | 45 | \r |
949f388f | 46 | If the cached PEI Services Table pointer is NULL, then ASSERT().\r |
47 | \r | |
48 | @return The pointer to PeiServices.\r | |
49 | \r | |
50 | **/\r | |
51 | CONST EFI_PEI_SERVICES **\r | |
52 | EFIAPI\r | |
53 | GetPeiServicesTablePointer (\r | |
54 | VOID\r | |
55 | )\r | |
56 | {\r | |
57 | ASSERT (gPeiServices != NULL);\r | |
949f388f | 58 | return gPeiServices;\r |
59 | }\r | |
60 | \r | |
61 | \r | |
65e3f333 | 62 | /**\r |
63 | The constructor function caches the pointer to PEI services.\r | |
d18d8a1d | 64 | \r |
65e3f333 | 65 | The constructor function caches the pointer to PEI services.\r |
66 | It will always return EFI_SUCCESS.\r | |
67 | \r | |
68 | @param FileHandle The handle of FFS header the loaded driver.\r | |
69 | @param PeiServices The pointer to the PEI services.\r | |
70 | \r | |
71 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r | |
72 | \r | |
73 | **/\r | |
74 | EFI_STATUS\r | |
75 | EFIAPI\r | |
76 | PeiServicesTablePointerLibConstructor (\r | |
77 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
78 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
79 | )\r | |
80 | {\r | |
81 | gPeiServices = PeiServices;\r | |
82 | return EFI_SUCCESS;\r | |
83 | }\r | |
84 | \r | |
95c2e69a | 85 | /**\r |
79e4f2a5 | 86 | Perform CPU specific actions required to migrate the PEI Services Table\r |
95c2e69a LG |
87 | pointer from temporary RAM to permanent RAM.\r |
88 | \r | |
79e4f2a5 | 89 | For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes\r |
95c2e69a | 90 | immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r |
79e4f2a5 | 91 | For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes\r |
95c2e69a LG |
92 | immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r |
93 | For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r | |
79e4f2a5 RN |
94 | a dedicated CPU register. This means that there is no memory storage\r |
95 | associated with storing the PEI Services Table pointer, so no additional\r | |
95c2e69a LG |
96 | migration actions are required for Itanium or ARM CPUs.\r |
97 | \r | |
98 | **/\r | |
99 | VOID\r | |
100 | EFIAPI\r | |
101 | MigratePeiServicesTablePointer (\r | |
102 | VOID\r | |
103 | )\r | |
104 | {\r | |
105 | //\r | |
79e4f2a5 | 106 | // PEI Services Table pointer is cached in the global variable. No additional\r |
95c2e69a LG |
107 | // migration actions are required.\r |
108 | //\r | |
109 | return;\r | |
110 | }\r | |
65e3f333 | 111 | \r |