]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
MdeModulePkg: Remove redundant library classes and GUIDs
[mirror_edk2.git] / MdeModulePkg / Universal / ResetSystemRuntimeDxe / ResetSystem.h
1 /** @file
2
3 Copyright (c) 2006 - 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_SYSTEM_H_
16 #define _RESET_SYSTEM_H_
17
18
19 #include <PiDxe.h>
20
21 #include <Protocol/Reset.h>
22 #include <Protocol/ResetNotification.h>
23 #include <Protocol/PlatformSpecificResetFilter.h>
24 #include <Protocol/PlatformSpecificResetHandler.h>
25 #include <Guid/CapsuleVendor.h>
26
27 #include <Library/BaseLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiRuntimeLib.h>
33 #include <Library/UefiRuntimeServicesTableLib.h>
34 #include <Library/ResetSystemLib.h>
35 #include <Library/ReportStatusCodeLib.h>
36 #include <Library/MemoryAllocationLib.h>
37
38 //
39 // The maximum recurstion depth to ResetSystem() by reset notification handlers
40 //
41 #define MAX_RESET_NOTIFY_DEPTH 10
42
43 typedef struct {
44 UINT32 Signature;
45 LIST_ENTRY Link;
46 EFI_RESET_SYSTEM ResetNotify;
47 } RESET_NOTIFY_ENTRY;
48 #define RESET_NOTIFY_ENTRY_SIGNATURE SIGNATURE_32('r', 's', 't', 'n')
49 #define RESET_NOTIFY_ENTRY_FROM_LINK(a) CR (a, RESET_NOTIFY_ENTRY, Link, RESET_NOTIFY_ENTRY_SIGNATURE)
50
51 typedef struct {
52 UINT32 Signature;
53 EFI_RESET_NOTIFICATION_PROTOCOL ResetNotification;
54 LIST_ENTRY ResetNotifies;
55 } RESET_NOTIFICATION_INSTANCE;
56 #define RESET_NOTIFICATION_INSTANCE_SIGNATURE SIGNATURE_32('r', 's', 't', 'i')
57 #define RESET_NOTIFICATION_INSTANCE_FROM_THIS(a) \
58 CR (a, RESET_NOTIFICATION_INSTANCE, ResetNotification, RESET_NOTIFICATION_INSTANCE_SIGNATURE)
59
60 /**
61 The driver's entry point.
62
63 It initializes the Reset Architectural Protocol.
64
65 @param[in] ImageHandle The firmware allocated handle for the EFI image.
66 @param[in] SystemTable A pointer to the EFI System Table.
67
68 @retval EFI_SUCCESS The entry point is executed successfully.
69 @retval other Cannot install ResetArch protocol.
70
71 **/
72 EFI_STATUS
73 EFIAPI
74 InitializeResetSystem (
75 IN EFI_HANDLE ImageHandle,
76 IN EFI_SYSTEM_TABLE *SystemTable
77 );
78
79 /**
80 Resets the entire platform.
81
82 @param[in] ResetType The type of reset to perform.
83 @param[in] ResetStatus The status code for the reset.
84 @param[in] DataSize The size, in bytes, of ResetData.
85 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
86 EfiResetShutdown the data buffer starts with a Null-terminated
87 string, optionally followed by additional binary data.
88 The string is a description that the caller may use to further
89 indicate the reason for the system reset. ResetData is only
90 valid if ResetStatus is something other than EFI_SUCCESS
91 unless the ResetType is EfiResetPlatformSpecific
92 where a minimum amount of ResetData is always required.
93 For a ResetType of EfiResetPlatformSpecific the data buffer
94 also starts with a Null-terminated string that is followed
95 by an EFI_GUID that describes the specific type of reset to perform.
96
97 **/
98 VOID
99 EFIAPI
100 ResetSystem (
101 IN EFI_RESET_TYPE ResetType,
102 IN EFI_STATUS ResetStatus,
103 IN UINTN DataSize,
104 IN VOID *ResetData OPTIONAL
105 );
106
107 #endif