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