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