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