3 Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
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
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.
15 #ifndef _RESET_SYSTEM2_H_
16 #define _RESET_SYSTEM2_H_
22 #include <Ppi/Reset2.h>
23 #include <Ppi/PlatformSpecificResetFilter.h>
24 #include <Ppi/PlatformSpecificResetNotification.h>
25 #include <Ppi/PlatformSpecificResetHandler.h>
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>
37 // The maximum recursion depth to ResetSystem() by reset notification handlers
39 #define MAX_RESET_NOTIFY_DEPTH 10
42 // Data to put in GUIDed HOB
47 EFI_RESET_SYSTEM ResetFilters
[0]; // ResetFilters[PcdGet32 (PcdMaximumResetNotifies)]
49 #define RESET_FILTER_LIST_SIGNATURE SIGNATURE_32('r', 's', 't', 'l')
53 EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI ResetFilter
;
55 } RESET_FILTER_INSTANCE
;
58 Resets the entire platform.
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.
79 IN EFI_RESET_TYPE ResetType
,
80 IN EFI_STATUS ResetStatus
,
82 IN VOID
*ResetData OPTIONAL
85 Register a notification function to be called when ResetSystem() is called.
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.
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.
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.
104 RegisterResetNotify (
105 IN EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PPI
*This
,
106 IN EFI_RESET_SYSTEM ResetFunction
110 Unregister a notification function.
112 The UnregisterResetNotify() function removes the previously registered
113 notification using RegisterResetNotify().
115 @param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
116 @param[in] ResetFunction The pointer to the ResetFunction being unregistered.
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().
126 UnregisterResetNotify (
127 IN EFI_RESET_NOTIFICATION_PROTOCOL
*This
,
128 IN EFI_RESET_SYSTEM ResetFunction