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