]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
238d8a39adff5b9d8a1f9610b9fc19479ff5cac2
[mirror_edk2.git] / MdeModulePkg / Universal / ResetSystemRuntimeDxe / ResetSystem.h
1 /** @file
2
3 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _RESET_SYSTEM_H_
10 #define _RESET_SYSTEM_H_
11
12 #include <PiDxe.h>
13
14 #include <Protocol/Reset.h>
15 #include <Protocol/ResetNotification.h>
16 #include <Protocol/PlatformSpecificResetFilter.h>
17 #include <Protocol/PlatformSpecificResetHandler.h>
18 #include <Guid/CapsuleVendor.h>
19
20 #include <Library/BaseLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/UefiLib.h>
23 #include <Library/UefiDriverEntryPoint.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/UefiRuntimeLib.h>
26 #include <Library/UefiRuntimeServicesTableLib.h>
27 #include <Library/ResetSystemLib.h>
28 #include <Library/ReportStatusCodeLib.h>
29 #include <Library/MemoryAllocationLib.h>
30
31 //
32 // The maximum recurstion depth to ResetSystem() by reset notification handlers
33 //
34 #define MAX_RESET_NOTIFY_DEPTH 10
35
36 typedef struct {
37 UINT32 Signature;
38 LIST_ENTRY Link;
39 EFI_RESET_SYSTEM ResetNotify;
40 } RESET_NOTIFY_ENTRY;
41 #define RESET_NOTIFY_ENTRY_SIGNATURE SIGNATURE_32('r', 's', 't', 'n')
42 #define RESET_NOTIFY_ENTRY_FROM_LINK(a) CR (a, RESET_NOTIFY_ENTRY, Link, RESET_NOTIFY_ENTRY_SIGNATURE)
43
44 typedef struct {
45 UINT32 Signature;
46 EFI_RESET_NOTIFICATION_PROTOCOL ResetNotification;
47 LIST_ENTRY ResetNotifies;
48 } RESET_NOTIFICATION_INSTANCE;
49 #define RESET_NOTIFICATION_INSTANCE_SIGNATURE SIGNATURE_32('r', 's', 't', 'i')
50 #define RESET_NOTIFICATION_INSTANCE_FROM_THIS(a) \
51 CR (a, RESET_NOTIFICATION_INSTANCE, ResetNotification, RESET_NOTIFICATION_INSTANCE_SIGNATURE)
52
53 /**
54 The driver's entry point.
55
56 It initializes the Reset Architectural Protocol.
57
58 @param[in] ImageHandle The firmware allocated handle for the EFI image.
59 @param[in] SystemTable A pointer to the EFI System Table.
60
61 @retval EFI_SUCCESS The entry point is executed successfully.
62 @retval other Cannot install ResetArch protocol.
63
64 **/
65 EFI_STATUS
66 EFIAPI
67 InitializeResetSystem (
68 IN EFI_HANDLE ImageHandle,
69 IN EFI_SYSTEM_TABLE *SystemTable
70 );
71
72 /**
73 Resets the entire platform.
74
75 @param[in] ResetType The type of reset to perform.
76 @param[in] ResetStatus The status code for the reset.
77 @param[in] DataSize The size, in bytes, of ResetData.
78 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
79 EfiResetShutdown the data buffer starts with a Null-terminated
80 string, optionally followed by additional binary data.
81 The string is a description that the caller may use to further
82 indicate the reason for the system reset.
83 For a ResetType of EfiResetPlatformSpecific the data buffer
84 also starts with a Null-terminated string that is followed
85 by an EFI_GUID that describes the specific type of reset to perform.
86
87 **/
88 VOID
89 EFIAPI
90 RuntimeServiceResetSystem (
91 IN EFI_RESET_TYPE ResetType,
92 IN EFI_STATUS ResetStatus,
93 IN UINTN DataSize,
94 IN VOID *ResetData OPTIONAL
95 );
96
97 #endif