X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiServicesTablePointerLibKr7%2FPeiServicesTablePointer.c;h=5da6e1d7578223b16bf7f1727bcdadd831ff6932;hp=160e55302997f2197030f81b13e2625687d4e14b;hb=ffdb421ca50c3bb4b31f89707da4c99ca8299a77;hpb=d5b86e43cf23787da85fcf862807c1f6714bfac2
diff --git a/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c b/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c
index 160e553029..5da6e1d757 100644
--- a/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c
+++ b/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c
@@ -1,41 +1,90 @@
-/*++
+/** @file
+ PEI Services Table Pointer Library implementation for IPF that uses Kernel
+ Register 7 to store the pointer.
-Copyright (c) 2006 Intel Corporation. All rights reserved
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
- PEI Services Table Pointer Library.
-
---*/
-
+#include
#include
+#include
/**
- The function returns the pointer to PeiServices.
+ Retrieves the cached value of the PEI Services Table pointer.
- The function returns the pointer to PeiServices.
- It will ASSERT() if the pointer to PeiServices is NULL.
+ Returns the cached value of the PEI Services Table pointer in a CPU specific manner
+ as specified in the CPU binding section of the Platform Initialization Pre-EFI
+ Initialization Core Interface Specification.
+
+ If the cached PEI Services Table pointer is NULL, then ASSERT().
- @retval The pointer to PeiServices.
+ @return The pointer to PeiServices.
**/
-EFI_PEI_SERVICES **
+CONST EFI_PEI_SERVICES **
EFIAPI
GetPeiServicesTablePointer (
VOID
)
{
- EFI_PEI_SERVICES **PeiServices;
+ CONST EFI_PEI_SERVICES **PeiServices;
- PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadKr7 ();
+ PeiServices = (CONST EFI_PEI_SERVICES **)(UINTN)AsmReadKr7 ();
ASSERT (PeiServices != NULL);
return PeiServices;
}
+
+/**
+ Caches a pointer PEI Services Table.
+
+ Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
+ in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
+ Pre-EFI Initialization Core Interface Specification.
+ The function set the pointer of PEI services in KR7 register
+ according to PI specification.
+
+ If PeiServicesTablePointer is NULL, then ASSERT().
+
+ @param PeiServicesTablePointer The address of PeiServices pointer.
+**/
+VOID
+EFIAPI
+SetPeiServicesTablePointer (
+ IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
+ )
+{
+ ASSERT (PeiServicesTablePointer != NULL);
+ AsmWriteKr7 ((UINT64)(UINTN)PeiServicesTablePointer);
+}
+
+/**
+ Perform CPU specific actions required to migrate the PEI Services Table
+ pointer from temporary RAM to permanent RAM.
+
+ For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
+ immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+ For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
+ immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+ For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
+ a dedicated CPU register. This means that there is no memory storage
+ associated with storing the PEI Services Table pointer, so no additional
+ migration actions are required for Itanium or ARM CPUs.
+
+**/
+VOID
+EFIAPI
+MigratePeiServicesTablePointer (
+ )
+{
+ return;
+}
+