]> git.proxmox.com Git - mirror_edk2.git/blob - EmbeddedPkg/ResetRuntimeDxe/reset.c
213963b519f94b499c6933205e7451bdd1906e8e
[mirror_edk2.git] / EmbeddedPkg / ResetRuntimeDxe / reset.c
1 /** @file
2
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiDxe.h>
10 #include <Protocol/Reset.h>
11 #include <Library/DebugLib.h>
12 #include <Library/UefiDriverEntryPoint.h>
13 #include <Library/UefiBootServicesTableLib.h>
14 #include <Library/EfiResetSystemLib.h>
15
16 /**
17 Resets the entire platform.
18
19 @param ResetType The type of reset to perform.
20 @param ResetStatus The status code for the reset.
21 @param DataSize The size, in bytes, of WatchdogData.
22 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
23 EfiResetShutdown the data buffer starts with a Null-terminated
24 Unicode string, optionally followed by additional binary data.
25
26 **/
27 VOID
28 EFIAPI
29 ResetSystemViaLib (
30 IN EFI_RESET_TYPE ResetType,
31 IN EFI_STATUS ResetStatus,
32 IN UINTN DataSize,
33 IN VOID *ResetData OPTIONAL
34 )
35 {
36 LibResetSystem (ResetType, ResetStatus, DataSize, ResetData);
37 return;
38 }
39
40 EFI_STATUS
41 EFIAPI
42 InitializeReset (
43 IN EFI_HANDLE ImageHandle,
44 IN EFI_SYSTEM_TABLE *SystemTable
45 )
46 {
47 EFI_STATUS Status;
48 EFI_HANDLE Handle;
49
50 LibInitializeResetSystem (ImageHandle, SystemTable);
51
52 SystemTable->RuntimeServices->ResetSystem = ResetSystemViaLib;
53
54 Handle = NULL;
55 Status = gBS->InstallMultipleProtocolInterfaces (
56 &Handle,
57 &gEfiResetArchProtocolGuid,
58 NULL,
59 NULL
60 );
61 ASSERT_EFI_ERROR (Status);
62
63 return Status;
64 }