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