+++ /dev/null
-/*++ @file\r
- Reset Architectural Protocol as defined in UEFI/PI under Emulation\r
-\r
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
-Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.\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
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-**/\r
-\r
-#include <PiDxe.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/EmuThunkLib.h>\r
-\r
-#include <Protocol/Reset.h>\r
-\r
-\r
-VOID\r
-EFIAPI\r
-EmuResetSystem (\r
- IN EFI_RESET_TYPE ResetType,\r
- IN EFI_STATUS ResetStatus,\r
- IN UINTN DataSize,\r
- IN VOID *ResetData OPTIONAL\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN HandleCount;\r
- EFI_HANDLE *HandleBuffer;\r
- UINTN Index;\r
-\r
- //\r
- // Disconnect all\r
- //\r
- Status = gBS->LocateHandleBuffer (\r
- AllHandles,\r
- NULL,\r
- NULL,\r
- &HandleCount,\r
- &HandleBuffer\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- for (Index = 0; Index < HandleCount; Index++) {\r
- Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);\r
- }\r
- \r
- gBS->FreePool (HandleBuffer);\r
- }\r
-\r
-\r
- //\r
- // Discard ResetType, always return 0 as exit code\r
- //\r
- gEmuThunk->Exit (0);\r
-\r
- //\r
- // Should never go here\r
- //\r
- ASSERT (FALSE);\r
-\r
- return;\r
-}\r
-\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeEmuReset (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-\r
-Arguments:\r
-\r
- ImageHandle of the loaded driver\r
- Pointer to the System Table\r
-\r
-Returns:\r
-\r
- Status\r
-**/\r
-{\r
- EFI_STATUS Status;\r
- EFI_HANDLE Handle;\r
-\r
- SystemTable->RuntimeServices->ResetSystem = EmuResetSystem;\r
-\r
- Handle = NULL;\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &Handle,\r
- &gEfiResetArchProtocolGuid,\r
- NULL,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return Status;\r
-}\r
-\r