TianoCore EDK2 master
Loading...
Searching...
No Matches
TempRam.c
1/*++ @file
2 Temp RAM PPI
3
4Copyright (c) 2011, Apple Inc. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include <PiPei.h>
10#include <Library/DebugLib.h>
12
14
15VOID
16EFIAPI
18 UINT32 TemporaryMemoryBase,
19 UINT32 PermenentMemoryBase
20 );
21
23EFIAPI
25 IN CONST EFI_PEI_SERVICES **PeiServices,
26 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
27 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
28 IN UINTN CopySize
29 )
30{
31 //
32 // Migrate the whole temporary memory to permanent memory.
33 //
34 CopyMem (
35 (VOID *)(UINTN)PermanentMemoryBase,
36 (VOID *)(UINTN)TemporaryMemoryBase,
37 CopySize
38 );
39
40 //
41 // SecSwitchStack function must be invoked after the memory migration
42 // immediately, also we need fixup the stack change caused by new call into
43 // permanent memory.
44 //
45 SecSwitchStack ((UINT32)TemporaryMemoryBase, (UINT32)PermanentMemoryBase);
46
47 //
48 // We need *not* fix the return address because currently,
49 // The PeiCore is executed in flash.
50 //
51
52 //
53 // Simulate to invalid temporary memory, terminate temporary memory
54 //
55 // ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
56
57 return EFI_SUCCESS;
58}
UINT64 UINTN
STATIC EFI_STATUS EFIAPI SecTemporaryRamSupport(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, IN UINTN CopySize)
Definition: Sec.c:35
VOID SecSwitchStack(INTN StackDelta)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112