]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / ResetSystemPei / ResetSystem.h
CommitLineData
052c98ce
RN
1/** @file\r
2\r
3 Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
4\r
9d510e61 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
052c98ce
RN
6\r
7**/\r
8\r
9#ifndef _RESET_SYSTEM2_H_\r
10#define _RESET_SYSTEM2_H_\r
11\r
052c98ce
RN
12#include <Uefi.h>\r
13#include <PiPei.h>\r
14\r
15#include <Ppi/Reset2.h>\r
16#include <Ppi/PlatformSpecificResetFilter.h>\r
ce2697ab 17#include <Ppi/PlatformSpecificResetNotification.h>\r
052c98ce
RN
18#include <Ppi/PlatformSpecificResetHandler.h>\r
19\r
20#include <Library/BaseLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/DebugLib.h>\r
23#include <Library/PeiServicesLib.h>\r
24#include <Library/HobLib.h>\r
25#include <Library/ResetSystemLib.h>\r
26#include <Library/ReportStatusCodeLib.h>\r
27\r
052c98ce
RN
28//\r
29// The maximum recursion depth to ResetSystem() by reset notification handlers\r
30//\r
1436aea4 31#define MAX_RESET_NOTIFY_DEPTH 10\r
052c98ce
RN
32\r
33//\r
34// Data to put in GUIDed HOB\r
35//\r
36typedef struct {\r
1436aea4
MK
37 UINT32 Signature;\r
38 UINT32 Count;\r
39 EFI_RESET_SYSTEM ResetFilters[0]; // ResetFilters[PcdGet32 (PcdMaximumResetNotifies)]\r
052c98ce 40} RESET_FILTER_LIST;\r
1436aea4 41#define RESET_FILTER_LIST_SIGNATURE SIGNATURE_32('r', 's', 't', 'l')\r
052c98ce
RN
42\r
43typedef struct {\r
1436aea4
MK
44 EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI ResetFilter;\r
45 EFI_GUID *Guid;\r
052c98ce
RN
46} RESET_FILTER_INSTANCE;\r
47\r
48/**\r
49 Resets the entire platform.\r
50\r
51 @param[in] ResetType The type of reset to perform.\r
52 @param[in] ResetStatus The status code for the reset.\r
53 @param[in] DataSize The size, in bytes, of ResetData.\r
54 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
55 EfiResetShutdown the data buffer starts with a Null-terminated\r
56 string, optionally followed by additional binary data.\r
57 The string is a description that the caller may use to further\r
3bb9b1fa 58 indicate the reason for the system reset.\r
052c98ce
RN
59 For a ResetType of EfiResetPlatformSpecific the data buffer\r
60 also starts with a Null-terminated string that is followed\r
61 by an EFI_GUID that describes the specific type of reset to perform.\r
62\r
63**/\r
64VOID\r
65EFIAPI\r
66ResetSystem2 (\r
1436aea4
MK
67 IN EFI_RESET_TYPE ResetType,\r
68 IN EFI_STATUS ResetStatus,\r
69 IN UINTN DataSize,\r
70 IN VOID *ResetData OPTIONAL\r
052c98ce 71 );\r
1436aea4 72\r
052c98ce
RN
73/**\r
74 Register a notification function to be called when ResetSystem() is called.\r
75\r
76 The RegisterResetNotify() function registers a notification function that is called when\r
77 ResetSystem()is called and prior to completing the reset of the platform.\r
78 The registered functions must not perform a platform reset themselves. These\r
79 notifications are intended only for the notification of components which may need some\r
80 special-purpose maintenance prior to the platform resetting.\r
81\r
82 @param[in] This A pointer to the EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI instance.\r
83 @param[in] ResetFunction Points to the function to be called when a ResetSystem() is executed.\r
84\r
85 @retval EFI_SUCCESS The reset notification function was successfully registered.\r
86 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.\r
87 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to register the reset notification function.\r
88 @retval EFI_ALREADY_STARTED The reset notification function specified by ResetFunction has already been registered.\r
89\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
93RegisterResetNotify (\r
1436aea4
MK
94 IN EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI *This,\r
95 IN EFI_RESET_SYSTEM ResetFunction\r
052c98ce
RN
96 );\r
97\r
98/**\r
99 Unregister a notification function.\r
100\r
101 The UnregisterResetNotify() function removes the previously registered\r
102 notification using RegisterResetNotify().\r
103\r
104 @param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.\r
105 @param[in] ResetFunction The pointer to the ResetFunction being unregistered.\r
106\r
107 @retval EFI_SUCCESS The reset notification function was unregistered.\r
108 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.\r
109 @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously\r
110 registered using RegisterResetNotify().\r
111\r
112**/\r
113EFI_STATUS\r
114EFIAPI\r
115UnregisterResetNotify (\r
1436aea4
MK
116 IN EFI_RESET_NOTIFICATION_PROTOCOL *This,\r
117 IN EFI_RESET_SYSTEM ResetFunction\r
052c98ce 118 );\r
1436aea4 119\r
052c98ce 120#endif\r