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