UINTN gSystemMemoryCount = 0;\r
NT_SYSTEM_MEMORY *gSystemMemory;\r
\r
+BASE_LIBRARY_JUMP_BUFFER mResetJumpBuffer;\r
+CHAR8 *mResetTypeStr[] = {\r
+ "EfiResetCold",\r
+ "EfiResetWarm",\r
+ "EfiResetShutdown",\r
+ "EfiResetPlatformSpecific"\r
+};\r
+\r
/*++\r
\r
Routine Description:\r
);\r
}\r
\r
+/**\r
+ Resets the entire platform.\r
+\r
+ @param[in] ResetType The type of reset to perform.\r
+ @param[in] ResetStatus The status code for the reset.\r
+ @param[in] DataSize The size, in bytes, of ResetData.\r
+ @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
+ the data buffer starts with a Null-terminated string, optionally\r
+ followed by additional binary data. The string is a description\r
+ that the caller may use to further indicate the reason for the\r
+ system reset.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+WinReset (\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN VOID *ResetData OPTIONAL\r
+ )\r
+{\r
+ ASSERT (ResetType <= EfiResetPlatformSpecific);\r
+ SecPrint (" Emu ResetSystem is called: ResetType = %s\n", mResetTypeStr[ResetType]);\r
+\r
+ if (ResetType == EfiResetShutdown) {\r
+ exit (0);\r
+ } else {\r
+ //\r
+ // Jump back to SetJump with jump code = ResetType + 1\r
+ //\r
+ LongJump (&mResetJumpBuffer, ResetType + 1);\r
+ }\r
+}\r
+\r
+EFI_PEI_RESET2_PPI mEmuReset2Ppi = {\r
+ WinReset\r
+};\r
+\r
/*++\r
\r
Routine Description:\r
UINTN ProcessAffinityMask;\r
UINTN SystemAffinityMask;\r
INT32 LowBit;\r
+ UINTN ResetJumpCode;\r
\r
//\r
// Enable the privilege so that RTC driver can successfully run SetTime()\r
// PPIs pased into PEI_CORE\r
//\r
AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, &mSecEmuThunkPpi);\r
+ AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiPeiReset2PpiGuid, &mEmuReset2Ppi);\r
\r
//\r
// Emulator Bus Driver Thunks\r
exit (1);\r
}\r
\r
- SetMem32 (TemporaryRam, TemporaryRamSize, PcdGet32 (PcdInitValueInTempStack));\r
-\r
- SecPrint (\r
- " OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n\r",\r
- TemporaryRamSize / SIZE_1KB,\r
- TemporaryRam\r
- );\r
-\r
//\r
// If enabled use the magic page to communicate between modules\r
// This replaces the PI PeiServicesTable pointer mechanism that\r
SecPrint ("\n\r");\r
}\r
\r
+ ResetJumpCode = SetJump (&mResetJumpBuffer);\r
+\r
+ //\r
+ // Do not clear memory content for warm reset.\r
+ //\r
+ if (ResetJumpCode != EfiResetWarm + 1) {\r
+ SecPrint (" OS Emulator clearing temp RAM and physical RAM (to be discovered later)......\n\r");\r
+ SetMem32 (TemporaryRam, TemporaryRamSize, PcdGet32 (PcdInitValueInTempStack));\r
+ for (Index = 0; Index < gSystemMemoryCount; Index++) {\r
+ SetMem32 ((VOID *)(UINTN)gSystemMemory[Index].Memory, (UINTN)gSystemMemory[Index].Size, PcdGet32 (PcdInitValueInTempStack));\r
+ }\r
+ }\r
+\r
+ SecPrint (\r
+ " OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n\r",\r
+ TemporaryRamSize / SIZE_1KB,\r
+ TemporaryRam\r
+ );\r
//\r
// Hand off to SEC Core\r
//\r
/**@file\r
\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
#include <Guid/FileSystemInfo.h>\r
#include <Guid/FileSystemVolumeLabelInfo.h>\r
#include <Ppi/EmuThunk.h>\r
+#include <Ppi/Reset2.h>\r
#include <Protocol/EmuThunk.h>\r
#include <Protocol/SimpleFileSystem.h>\r
\r