]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add new API MigratePeiServicesTablePointer() in PeiServicesTablePointerLib class.
authorGao, Liming <liming.gao@intel.com>
Wed, 15 Jan 2014 02:16:57 +0000 (02:16 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 15 Jan 2014 02:16:57 +0000 (02:16 +0000)
2. PeiCore will call this API to migrate the PEI Services Table pointer from temporary RAM to permanent RAM.

Signed-off-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: Kinney, Michael D <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15114 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/PeiServicesTablePointerLib.h
MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c

index 601e1d57f3deedbfcff8b08ce38b3cffe20fd776..b1bed2579ee4894b8bc5454c11ca171bfe0c422d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides a service to retrieve a pointer to the PEI Services Table.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -50,5 +50,24 @@ SetPeiServicesTablePointer (
   IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer\r
   );\r
 \r
+/**\r
+  Perform CPU specific actions required to migrate the PEI Services Table \r
+  pointer from temporary RAM to permanent RAM.\r
+\r
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r
+  a dedicated CPU register.  This means that there is no memory storage \r
+  associated with storing the PEI Services Table pointer, so no additional \r
+  migration actions are required for Itanium or ARM CPUs.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+MigratePeiServicesTablePointer (\r
+  );\r
+\r
 #endif\r
 \r
index 9b02316af4545eb572b0361568749a1c8a544a9e..0c687a52696971131b6002f5fb5bb0bb2ffb6064 100644 (file)
@@ -4,7 +4,7 @@
   This library is used for PEIM which does executed from flash device directly but\r
   executed in memory.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -88,4 +88,28 @@ PeiServicesTablePointerLibConstructor (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Perform CPU specific actions required to migrate the PEI Services Table \r
+  pointer from temporary RAM to permanent RAM.\r
+\r
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r
+  a dedicated CPU register.  This means that there is no memory storage \r
+  associated with storing the PEI Services Table pointer, so no additional \r
+  migration actions are required for Itanium or ARM CPUs.\r
 \r
+**/\r
+VOID\r
+EFIAPI\r
+MigratePeiServicesTablePointer (\r
+  )\r
+{\r
+  //\r
+  //  PEI Services Table pointer is cached in the global variable. No additional \r
+  //  migration actions are required.\r
+  //\r
+  return;\r
+}\r
index 4e3f013ed9cb43b4c2c327b8f5c10037c360d367..1ce3c727e1e75f336e9cab6c8391625745c92161 100644 (file)
@@ -4,7 +4,7 @@
   According to PI specification, the peiservice pointer is stored prior at IDT\r
   table in IA32 and x64 architecture.\r
   \r
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -21,7 +21,6 @@
 #include <Library/PeiServicesTablePointerLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-#include <Ppi/TemporaryRamSupport.h>\r
 \r
 /**\r
   Retrieves the cached value of the PEI Services Table pointer.\r
@@ -70,42 +69,62 @@ SetPeiServicesTablePointer (
   )\r
 {\r
   IA32_DESCRIPTOR        Idtr;\r
-  EFI_PHYSICAL_ADDRESS   IdtBase;\r
-  EFI_STATUS             Status;\r
-  EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI   *TemporaryRamSupportPpi;\r
   \r
   ASSERT (PeiServicesTablePointer != NULL);\r
   AsmReadIdtr (&Idtr);\r
-  if ((*(UINTN*)(Idtr.Base - sizeof (UINTN))) != (UINTN)PeiServicesTablePointer) {\r
-    (*(UINTN*)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer;\r
-    Status = (*PeiServicesTablePointer)->LocatePpi (\r
-                                          PeiServicesTablePointer, \r
-                                          &gEfiTemporaryRamSupportPpiGuid, \r
-                                          0, \r
-                                          NULL, \r
-                                          (VOID**)&TemporaryRamSupportPpi\r
-                                         );\r
-                                      \r
-    if (EFI_ERROR (Status)) {\r
-      //\r
-      // If TemporaryRamSupportPpi is not found, Idt table needs to be migrated into memory.\r
-      //\r
-      Status = (*PeiServicesTablePointer)->AllocatePages (\r
-                                            PeiServicesTablePointer, \r
-                                            EfiBootServicesCode,\r
-                                            EFI_SIZE_TO_PAGES(Idtr.Limit + 1 + sizeof (UINTN)),\r
-                                            &IdtBase\r
-                                            );\r
-      if (!EFI_ERROR (Status)) {\r
-        //\r
-        // Migrate Idt table\r
-        //\r
-        CopyMem ((VOID *) (UINTN) IdtBase, (VOID *) (Idtr.Base - sizeof (UINTN)), Idtr.Limit + 1 + sizeof (UINTN));\r
-        Idtr.Base = (UINTN) IdtBase + sizeof (UINTN);\r
-        AsmWriteIdtr (&Idtr);\r
-      }\r
-    }\r
-  }\r
+  (*(UINTN*)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer;\r
+}\r
+\r
+/**\r
+  Perform CPU specific actions required to migrate the PEI Services Table \r
+  pointer from temporary RAM to permanent RAM.\r
+\r
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r
+  a dedicated CPU register.  This means that there is no memory storage \r
+  associated with storing the PEI Services Table pointer, so no additional \r
+  migration actions are required for Itanium or ARM CPUs.\r
+\r
+  If The cached PEI Services Table pointer is NULL, then ASSERT().\r
+  If the permanent memory is allocated failed, then ASSERT().\r
+**/\r
+VOID\r
+EFIAPI\r
+MigratePeiServicesTablePointer (\r
+  )\r
+{\r
+  EFI_STATUS             Status;\r
+  IA32_DESCRIPTOR        Idtr;\r
+  EFI_PHYSICAL_ADDRESS   IdtBase;\r
+  CONST EFI_PEI_SERVICES  **PeiServices;\r
+\r
+  //\r
+  // Get PEI Services Table pointer\r
+  //\r
+  AsmReadIdtr (&Idtr);\r
+  PeiServices = (CONST EFI_PEI_SERVICES **) (*(UINTN*)(Idtr.Base - sizeof (UINTN)));\r
+  ASSERT (PeiServices != NULL);\r
+  //\r
+  // Allocate the permanent memory.\r
+  //\r
+  Status = (*PeiServices)->AllocatePages (\r
+                            PeiServices, \r
+                            EfiBootServicesCode,\r
+                            EFI_SIZE_TO_PAGES(Idtr.Limit + 1 + sizeof (UINTN)),\r
+                            &IdtBase\r
+                            );\r
+  ASSERT_EFI_ERROR (Status);\r
+  //\r
+  // Idt table needs to be migrated into memory.\r
+  //\r
+  CopyMem ((VOID *) (UINTN) IdtBase, (VOID *) (Idtr.Base - sizeof (UINTN)), Idtr.Limit + 1 + sizeof (UINTN));\r
+  Idtr.Base = (UINTN) IdtBase + sizeof (UINTN);\r
+  AsmWriteIdtr (&Idtr);\r
+  \r
+  return;\r
 }\r
 \r
 \r
index 020a7f7e83365a8ccbb1f972ef6c3df191713c90..7ebe9c81a3108f9ea21c758dad80981efc444608 100644 (file)
@@ -4,7 +4,7 @@
 # PEI Services Table Pointer Library implementation that retrieves a pointer to the PEI\r
 # Services Table from the IDT on IA-32 and x64.\r
 #\r
-# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -40,6 +40,3 @@
   DebugLib\r
   BaseLib\r
   BaseMemoryLib\r
-\r
-[Ppis]\r
-  gEfiTemporaryRamSupportPpiGuid                ## SOMETIMES_CONSUMES\r
index 4c91a9618726a04c8c19f620b33be1a5529138d5..5da6e1d7578223b16bf7f1727bcdadd831ff6932 100644 (file)
@@ -2,7 +2,7 @@
   PEI Services Table Pointer Library implementation for IPF that uses Kernel\r
   Register 7 to store the pointer.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -66,6 +66,25 @@ SetPeiServicesTablePointer (
   AsmWriteKr7 ((UINT64)(UINTN)PeiServicesTablePointer);\r
 }\r
   \r
+/**\r
+  Perform CPU specific actions required to migrate the PEI Services Table \r
+  pointer from temporary RAM to permanent RAM.\r
 \r
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes \r
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.\r
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in\r
+  a dedicated CPU register.  This means that there is no memory storage \r
+  associated with storing the PEI Services Table pointer, so no additional \r
+  migration actions are required for Itanium or ARM CPUs.\r
 \r
+**/\r
+VOID\r
+EFIAPI\r
+MigratePeiServicesTablePointer (\r
+  )\r
+{\r
+  return;\r
+}\r
 \r