X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiServicesTablePointerLibKr7%2FPeiServicesTablePointer.c;h=24eea3b6a7fca0aec8abc1839a6dcef584d51421;hp=94895b30c966764c78f9a8a27a78c894618ef5a4;hb=9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107;hpb=10e53a287e3cbec149e4b666cc019a35cec5bc00 diff --git a/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c b/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c index 94895b30c9..24eea3b6a7 100644 --- a/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c +++ b/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c @@ -2,11 +2,11 @@ PEI Services Table Pointer Library implementation for IPF that uses Kernel Register 7 to store the pointer. - Copyright (c) 2006 - 2007, Intel Corporation.
- All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2018, 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 + 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. @@ -18,48 +18,74 @@ #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. - @retval The pointer to PeiServices. + If the cached PEI Services Table pointer is NULL, then ASSERT(). + + @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; } -/** - The constructor function caches the pointer to PEI services. - The constructor function caches the pointer to PEI services. - It will always return EFI_SUCCESS. +/** + Caches a pointer PEI Services Table. - @param FfsHeader Pointer to FFS header the loaded driver. - @param PeiServices Pointer to the PEI services. + 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. - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + If PeiServicesTablePointer is NULL, then ASSERT(). + @param PeiServicesTablePointer The address of PeiServices pointer. **/ -EFI_STATUS +VOID EFIAPI -PeiServicesTablePointerLibConstructor ( - IN EFI_FFS_FILE_HEADER *FfsHeader, - IN EFI_PEI_SERVICES **PeiServices +SetPeiServicesTablePointer ( + IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer ) { - AsmWriteKr7 ((UINT64)(UINTN)PeiServices); - return EFI_SUCCESS; + 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 ( + VOID + ) +{ + return; +}