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 | /**
|
---|
18 | Resets the entire platform.
|
---|
19 |
|
---|
20 | @param ResetType The type of reset to perform.
|
---|
21 | @param ResetStatus The status code for the reset.
|
---|
22 | @param DataSize The size, in bytes, of WatchdogData.
|
---|
23 | @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
|
---|
24 | EfiResetShutdown the data buffer starts with a Null-terminated
|
---|
25 | Unicode string, optionally followed by additional binary data.
|
---|
26 |
|
---|
27 | **/
|
---|
28 | VOID
|
---|
29 | EFIAPI
|
---|
30 | ResetSystemViaLib (
|
---|
31 | IN EFI_RESET_TYPE ResetType,
|
---|
32 | IN EFI_STATUS ResetStatus,
|
---|
33 | IN UINTN DataSize,
|
---|
34 | IN VOID *ResetData OPTIONAL
|
---|
35 | )
|
---|
36 | {
|
---|
37 | LibResetSystem (ResetType, ResetStatus, DataSize, ResetData);
|
---|
38 | return;
|
---|
39 | }
|
---|
40 |
|
---|
41 |
|
---|
42 |
|
---|
43 | EFI_STATUS
|
---|
44 | EFIAPI
|
---|
45 | InitializeReset (
|
---|
46 | IN EFI_HANDLE ImageHandle,
|
---|
47 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
48 | )
|
---|
49 | {
|
---|
50 | EFI_STATUS Status;
|
---|
51 | EFI_HANDLE Handle;
|
---|
52 |
|
---|
53 | LibInitializeResetSystem (ImageHandle, SystemTable);
|
---|
54 |
|
---|
55 | SystemTable->RuntimeServices->ResetSystem = ResetSystemViaLib;
|
---|
56 |
|
---|
57 | Handle = NULL;
|
---|
58 | Status = gBS->InstallMultipleProtocolInterfaces (
|
---|
59 | &Handle,
|
---|
60 | &gEfiResetArchProtocolGuid,
|
---|
61 | NULL,
|
---|
62 | NULL
|
---|
63 | );
|
---|
64 | ASSERT_EFI_ERROR (Status);
|
---|
65 |
|
---|
66 | return Status;
|
---|
67 | }
|
---|
68 |
|
---|