]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/ResetSystemPei/ResetSystem.h
MdeModulePkg/ResetSystemPei: Change comments of ResetSystem2
[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
3bb9b1fa 61 indicate the reason for the system reset.\r
052c98ce
RN
62 For a ResetType of EfiResetPlatformSpecific the data buffer\r
63 also starts with a Null-terminated string that is followed\r
64 by an EFI_GUID that describes the specific type of reset to perform.\r
65\r
66**/\r
67VOID\r
68EFIAPI\r
69ResetSystem2 (\r
70 IN EFI_RESET_TYPE ResetType,\r
71 IN EFI_STATUS ResetStatus,\r
72 IN UINTN DataSize,\r
73 IN VOID *ResetData OPTIONAL\r
74 );\r
75/**\r
76 Register a notification function to be called when ResetSystem() is called.\r
77\r
78 The RegisterResetNotify() function registers a notification function that is called when\r
79 ResetSystem()is called and prior to completing the reset of the platform.\r
80 The registered functions must not perform a platform reset themselves. These\r
81 notifications are intended only for the notification of components which may need some\r
82 special-purpose maintenance prior to the platform resetting.\r
83\r
84 @param[in] This A pointer to the EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI instance.\r
85 @param[in] ResetFunction Points to the function to be called when a ResetSystem() is executed.\r
86\r
87 @retval EFI_SUCCESS The reset notification function was successfully registered.\r
88 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.\r
89 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to register the reset notification function.\r
90 @retval EFI_ALREADY_STARTED The reset notification function specified by ResetFunction has already been registered.\r
91\r
92**/\r
93EFI_STATUS\r
94EFIAPI\r
95RegisterResetNotify (\r
96 IN EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI *This,\r
97 IN EFI_RESET_SYSTEM ResetFunction\r
98 );\r
99\r
100/**\r
101 Unregister a notification function.\r
102\r
103 The UnregisterResetNotify() function removes the previously registered\r
104 notification using RegisterResetNotify().\r
105\r
106 @param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.\r
107 @param[in] ResetFunction The pointer to the ResetFunction being unregistered.\r
108\r
109 @retval EFI_SUCCESS The reset notification function was unregistered.\r
110 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.\r
111 @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously\r
112 registered using RegisterResetNotify().\r
113\r
114**/\r
115EFI_STATUS\r
116EFIAPI\r
117UnregisterResetNotify (\r
118 IN EFI_RESET_NOTIFICATION_PROTOCOL *This,\r
119 IN EFI_RESET_SYSTEM ResetFunction\r
120 );\r
121#endif\r