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