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