]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h
MdeModulePkg Variable: Align TPL level for (Smm)EndOfDxe callback
[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
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _RESET_SYSTEM2_H_\r
16#define _RESET_SYSTEM2_H_\r
17\r
18\r
19#include <Uefi.h>\r
20#include <PiPei.h>\r
21\r
22#include <Ppi/Reset2.h>\r
23#include <Ppi/PlatformSpecificResetFilter.h>\r
ce2697ab 24#include <Ppi/PlatformSpecificResetNotification.h>\r
052c98ce
RN
25#include <Ppi/PlatformSpecificResetHandler.h>\r
26\r
27#include <Library/BaseLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/DebugLib.h>\r
30#include <Library/PeiServicesLib.h>\r
31#include <Library/HobLib.h>\r
32#include <Library/ResetSystemLib.h>\r
33#include <Library/ReportStatusCodeLib.h>\r
34\r
35\r
36//\r
37// The maximum recursion depth to ResetSystem() by reset notification handlers\r
38//\r
39#define MAX_RESET_NOTIFY_DEPTH 10\r
40\r
41//\r
42// Data to put in GUIDed HOB\r
43//\r
44typedef struct {\r
45 UINT32 Signature;\r
46 UINT32 Count;\r
47 EFI_RESET_SYSTEM ResetFilters[0]; // ResetFilters[PcdGet32 (PcdMaximumResetNotifies)]\r
48} RESET_FILTER_LIST;\r
49#define RESET_FILTER_LIST_SIGNATURE SIGNATURE_32('r', 's', 't', 'l')\r
50\r
51\r
52typedef struct {\r
53 EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI ResetFilter;\r
54 EFI_GUID *Guid;\r
55} RESET_FILTER_INSTANCE;\r
56\r
57/**\r
58 Resets the entire platform.\r
59\r
60 @param[in] ResetType The type of reset to perform.\r
61 @param[in] ResetStatus The status code for the reset.\r
62 @param[in] DataSize The size, in bytes, of ResetData.\r
63 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
64 EfiResetShutdown the data buffer starts with a Null-terminated\r
65 string, optionally followed by additional binary data.\r
66 The string is a description that the caller may use to further\r
67 indicate the reason for the system reset. ResetData is only\r
68 valid if ResetStatus is something other than EFI_SUCCESS\r
69 unless the ResetType is EfiResetPlatformSpecific\r
70 where a minimum amount of ResetData is always required.\r
71 For a ResetType of EfiResetPlatformSpecific the data buffer\r
72 also starts with a Null-terminated string that is followed\r
73 by an EFI_GUID that describes the specific type of reset to perform.\r
74\r
75**/\r
76VOID\r
77EFIAPI\r
78ResetSystem2 (\r
79 IN EFI_RESET_TYPE ResetType,\r
80 IN EFI_STATUS ResetStatus,\r
81 IN UINTN DataSize,\r
82 IN VOID *ResetData OPTIONAL\r
83 );\r
84/**\r
85 Register a notification function to be called when ResetSystem() is called.\r
86\r
87 The RegisterResetNotify() function registers a notification function that is called when\r
88 ResetSystem()is called and prior to completing the reset of the platform.\r
89 The registered functions must not perform a platform reset themselves. These\r
90 notifications are intended only for the notification of components which may need some\r
91 special-purpose maintenance prior to the platform resetting.\r
92\r
93 @param[in] This A pointer to the EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI instance.\r
94 @param[in] ResetFunction Points to the function to be called when a ResetSystem() is executed.\r
95\r
96 @retval EFI_SUCCESS The reset notification function was successfully registered.\r
97 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.\r
98 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to register the reset notification function.\r
99 @retval EFI_ALREADY_STARTED The reset notification function specified by ResetFunction has already been registered.\r
100\r
101**/\r
102EFI_STATUS\r
103EFIAPI\r
104RegisterResetNotify (\r
105 IN EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI *This,\r
106 IN EFI_RESET_SYSTEM ResetFunction\r
107 );\r
108\r
109/**\r
110 Unregister a notification function.\r
111\r
112 The UnregisterResetNotify() function removes the previously registered\r
113 notification using RegisterResetNotify().\r
114\r
115 @param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.\r
116 @param[in] ResetFunction The pointer to the ResetFunction being unregistered.\r
117\r
118 @retval EFI_SUCCESS The reset notification function was unregistered.\r
119 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.\r
120 @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously\r
121 registered using RegisterResetNotify().\r
122\r
123**/\r
124EFI_STATUS\r
125EFIAPI\r
126UnregisterResetNotify (\r
127 IN EFI_RESET_NOTIFICATION_PROTOCOL *This,\r
128 IN EFI_RESET_SYSTEM ResetFunction\r
129 );\r
130#endif\r