]>
Commit | Line | Data |
---|---|---|
bf231ea6 | 1 | /** @file\r |
37f259c9 | 2 | PEI Services Table Pointer Library implementation for IPF that uses Kernel\r |
bf231ea6 | 3 | Register 7 to store the pointer.\r |
c7d265a9 | 4 | \r |
9095d37b | 5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
19388d29 | 6 | This program and the accompanying materials\r |
37f259c9 | 7 | are licensed and made available under the terms and conditions of the BSD License\r |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
2fc59a00 | 9 | http://opensource.org/licenses/bsd-license.php.\r |
c7d265a9 | 10 | \r |
37f259c9 | 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
c7d265a9 | 13 | \r |
bf231ea6 | 14 | **/\r |
c7d265a9 | 15 | \r |
37f259c9 | 16 | #include <PiPei.h>\r |
c7d265a9 | 17 | #include <Library/BaseLib.h>\r |
37f259c9 | 18 | #include <Library/DebugLib.h>\r |
c7d265a9 | 19 | \r |
20 | /**\r | |
4b8157f9 | 21 | Retrieves the cached value of the PEI Services Table pointer.\r |
c7d265a9 | 22 | \r |
9095d37b LG |
23 | Returns the cached value of the PEI Services Table pointer in a CPU specific manner\r |
24 | as specified in the CPU binding section of the Platform Initialization Pre-EFI\r | |
4b8157f9 | 25 | Initialization Core Interface Specification.\r |
9095d37b | 26 | \r |
4b8157f9 | 27 | If the cached PEI Services Table pointer is NULL, then ASSERT().\r |
c7d265a9 | 28 | \r |
373b5cf9 | 29 | @return The pointer to PeiServices.\r |
c7d265a9 | 30 | \r |
31 | **/\r | |
5240b97c | 32 | CONST EFI_PEI_SERVICES **\r |
c7d265a9 | 33 | EFIAPI\r |
34 | GetPeiServicesTablePointer (\r | |
35 | VOID\r | |
36 | )\r | |
37 | {\r | |
5240b97c | 38 | CONST EFI_PEI_SERVICES **PeiServices;\r |
c7d265a9 | 39 | \r |
5240b97c | 40 | PeiServices = (CONST EFI_PEI_SERVICES **)(UINTN)AsmReadKr7 ();\r |
c7d265a9 | 41 | ASSERT (PeiServices != NULL);\r |
42 | return PeiServices;\r | |
43 | }\r | |
44 | \r | |
4b8157f9 | 45 | \r |
61296d0d | 46 | /**\r |
9095d37b LG |
47 | Caches a pointer PEI Services Table.\r |
48 | \r | |
49 | Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer\r | |
50 | in a CPU specific manner as specified in the CPU binding section of the Platform Initialization\r | |
51 | Pre-EFI Initialization Core Interface Specification.\r | |
52 | The function set the pointer of PEI services in KR7 register\r | |
61296d0d | 53 | according to PI specification.\r |
9095d37b | 54 | \r |
4b8157f9 | 55 | If PeiServicesTablePointer is NULL, then ASSERT().\r |
9095d37b | 56 | \r |
42eedea9 | 57 | @param PeiServicesTablePointer The address of PeiServices pointer.\r |
61296d0d | 58 | **/\r |
59 | VOID\r | |
60 | EFIAPI\r | |
61 | SetPeiServicesTablePointer (\r | |
a86fda43 | 62 | IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer\r |
61296d0d | 63 | )\r |
64 | {\r | |
4b8157f9 | 65 | ASSERT (PeiServicesTablePointer != NULL);\r |
58dcdada | 66 | AsmWriteKr7 ((UINT64)(UINTN)PeiServicesTablePointer);\r |
61296d0d | 67 | }\r |
9095d37b | 68 | \r |
ffdb421c | 69 | /**\r |
9095d37b | 70 | Perform CPU specific actions required to migrate the PEI Services Table\r |
ffdb421c | 71 | pointer from temporary RAM to permanent RAM.\r |
58dcdada | 72 | \r |
9095d37b | 73 | For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes\r |
ffdb421c | 74 | immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r |
9095d37b | 75 | For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes\r |
ffdb421c LG |
76 | immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r |
77 | For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r | |
9095d37b LG |
78 | a dedicated CPU register. This means that there is no memory storage\r |
79 | associated with storing the PEI Services Table pointer, so no additional\r | |
ffdb421c | 80 | migration actions are required for Itanium or ARM CPUs.\r |
81c7803c | 81 | \r |
ffdb421c LG |
82 | **/\r |
83 | VOID\r | |
84 | EFIAPI\r | |
85 | MigratePeiServicesTablePointer (\r | |
8a835340 | 86 | VOID\r |
ffdb421c LG |
87 | )\r |
88 | {\r | |
89 | return;\r | |
90 | }\r | |
10e53a28 | 91 | \r |