Revision: 14846
http://sourceforge.net/p/edk2/code/14846
Author: lgao4
Date: 2013-11-15 02:04:57 +0000 (Fri, 15 Nov 2013)
Log Message:
-----------
Add support for PI1.2.1 TempRam Done PPI.
Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
trunk/edk2/MdePkg/MdePkg.dec
Added Paths:
-----------
trunk/edk2/MdePkg/Include/Ppi/TemporaryRamDone.h
Added: trunk/edk2/MdePkg/Include/Ppi/TemporaryRamDone.h
===================================================================
--- trunk/edk2/MdePkg/Include/Ppi/TemporaryRamDone.h
(rev 0)
+++ trunk/edk2/MdePkg/Include/Ppi/TemporaryRamDone.h 2013-11-15 02:04:57 UTC
(rev 14846)
@@ -0,0 +1,52 @@
+/** @file
+ This file declares Temporary RAM Done PPI.
+ The PPI that provides a service to disable the use of Temporary RAM.
+
+ Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
+ 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.
+
+ @par Revision Reference:
+ This PPI is introduced in PI Version 1.2.
+
+**/
+
+#ifndef __TEMPORARY_RAM_DONE_H__
+#define __TEMPORARY_RAM_DONE_H__
+
+#define EFI_PEI_TEMPORARY_RAM_DONE_PPI_GUID \
+ { 0xceab683c, 0xec56, 0x4a2d, { 0xa9, 0x6, 0x40, 0x53, 0xfa, 0x4e, 0x9c,
0x16 } }
+
+/**
+ TemporaryRamDone() disables the use of Temporary RAM. If present, this
service is invoked
+ by the PEI Foundation after the EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is
installed.
+
+ @retval EFI_SUCCESS Use of Temporary RAM was disabled.
+ @retval EFI_INVALID_PARAMETER Temporary RAM could not be disabled.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI * EFI_PEI_TEMPORARY_RAM_DONE) (
+ VOID
+ );
+
+///
+/// This is an optional PPI that may be produced by SEC or a PEIM. If present,
it provide a service to
+/// disable the use of Temporary RAM. This service may only be called by the
PEI Foundation after the
+/// transition from Temporary RAM to Permanent RAM is complete. This PPI
provides an alternative
+/// to the Temporary RAM Migration PPI for system architectures that allow
Temporary RAM and
+/// Permanent RAM to be enabled and accessed at the same time with no side
effects.
+///
+typedef struct _EFI_PEI_TEMPORARY_RAM_DONE_PPI {
+ EFI_PEI_TEMPORARY_RAM_DONE TemporaryRamDone;
+} EFI_PEI_TEMPORARY_RAM_DONE_PPI;
+
+extern EFI_GUID gEfiTemporaryRamDonePpiGuid;
+
+#endif
Modified:
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
===================================================================
---
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
2013-11-14 23:52:43 UTC (rev 14845)
+++
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
2013-11-15 02:04:57 UTC (rev 14846)
@@ -4,7 +4,7 @@
According to PI specification, the peiservice pointer is stored prior at IDT
table in IA32 and x64 architecture.
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -20,6 +20,8 @@
#include <Library/BaseLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Ppi/TemporaryRamSupport.h>
/**
Retrieves the cached value of the PEI Services Table pointer.
@@ -67,11 +69,43 @@
IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
)
{
- IA32_DESCRIPTOR Idtr;
+ IA32_DESCRIPTOR Idtr;
+ EFI_PHYSICAL_ADDRESS IdtBase;
+ EFI_STATUS Status;
+ EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI *TemporaryRamSupportPpi;
ASSERT (PeiServicesTablePointer != NULL);
AsmReadIdtr (&Idtr);
- (*(UINTN*)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer;
+ if ((*(UINTN*)(Idtr.Base - sizeof (UINTN))) !=
(UINTN)PeiServicesTablePointer) {
+ (*(UINTN*)(Idtr.Base - sizeof (UINTN))) = (UINTN)PeiServicesTablePointer;
+ Status = (*PeiServicesTablePointer)->LocatePpi (
+ PeiServicesTablePointer,
+ &gEfiTemporaryRamSupportPpiGuid,
+ 0,
+ NULL,
+ (VOID**)&TemporaryRamSupportPpi
+ );
+
+ if (EFI_ERROR (Status)) {
+ //
+ // If TemporaryRamSupportPpi is not found, Idt table needs to be
migrated into memory.
+ //
+ Status = (*PeiServicesTablePointer)->AllocatePages (
+ PeiServicesTablePointer,
+ EfiBootServicesCode,
+ EFI_SIZE_TO_PAGES(Idtr.Limit + 1 +
sizeof (UINTN)),
+ &IdtBase
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Migrate Idt table
+ //
+ CopyMem ((VOID *) (UINTN) IdtBase, (VOID *) (Idtr.Base - sizeof
(UINTN)), Idtr.Limit + 1 + sizeof (UINTN));
+ Idtr.Base = (UINTN) IdtBase + sizeof (UINTN);
+ AsmWriteIdtr (&Idtr);
+ }
+ }
+ }
}
Modified:
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
===================================================================
---
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
2013-11-14 23:52:43 UTC (rev 14845)
+++
trunk/edk2/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
2013-11-15 02:04:57 UTC (rev 14846)
@@ -4,7 +4,7 @@
# PEI Services Table Pointer Library implementation that retrieves a pointer
to the PEI
# Services Table from the IDT on IA-32 and x64.
#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD
License
@@ -39,6 +39,7 @@
[LibraryClasses]
DebugLib
BaseLib
+ BaseMemoryLib
-
-
+[Ppis]
+ gEfiTemporaryRamSupportPpiGuid ## SOMETIMES_CONSUMES
Modified: trunk/edk2/MdePkg/MdePkg.dec
===================================================================
--- trunk/edk2/MdePkg/MdePkg.dec 2013-11-14 23:52:43 UTC (rev 14845)
+++ trunk/edk2/MdePkg/MdePkg.dec 2013-11-15 02:04:57 UTC (rev 14846)
@@ -695,6 +695,9 @@
## Include/Ppi/PiPcd.h
gEfiPeiPcdPpiGuid = { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f,
0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }
+ ## Include/Ppi/TemporaryRamDone.h
+ gEfiTemporaryRamDonePpiGuid = { 0xceab683c, 0xec56, 0x4a2d, { 0xa9,
0x6, 0x40, 0x53, 0xfa, 0x4e, 0x9c, 0x16 } }
+
#
# PPIs defined in PI 1.3.
#
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits