MdePkg: Add ResetNotification protocol definition
[mirror_edk2.git] / MdePkg / Include / Protocol / ResetNotification.h
1 /** @file
2 EFI Reset Notification Protocol as defined in UEFI 2.7.
3 This protocol provides services to register for a notification when ResetSystem is called.
4
5 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 @par Revision Reference:
15 This Protocol is introduced in UEFI Specification 2.7
16
17 **/
18
19 #ifndef __EFI_RESET_NOTIFICATION_H__
20 #define __EFI_RESET_NOTIFICATION_H__
21
22 #define EFI_RESET_NOTIFICATION_PROTOCOL_GUID \
23 { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
24
25 typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL EFI_RESET_NOTIFICATION_PROTOCOL;
26
27 /**
28 Register a notification function to be called when ResetSystem() is called.
29
30 The RegisterResetNotify() function registers a notification function that is called when
31 ResetSystem()is called and prior to completing the reset of the platform.
32 The registered functions must not perform a platform reset themselves. These
33 notifications are intended only for the notification of components which may need some
34 special-purpose maintenance prior to the platform resetting.
35 The list of registered reset notification functions are processed if ResetSystem()is called
36 before ExitBootServices(). The list of registered reset notification functions is ignored if
37 ResetSystem()is called after ExitBootServices().
38
39 @param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
40 @param[in] ResetFunction Points to the function to be called when a ResetSystem() is executed.
41
42 @retval EFI_SUCCESS The reset notification function was successfully registered.
43 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
44 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to register the reset notification function.
45 @retval EFI_ALREADY_STARTED The reset notification function specified by ResetFunction has already been registered.
46
47 **/
48 typedef
49 EFI_STATUS
50 (EFIAPI *EFI_REGISTER_RESET_NOTIFY) (
51 IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
52 IN EFI_RESET_SYSTEM ResetFunction
53 );
54
55 /**
56 Unregister a notification function.
57
58 The UnregisterResetNotify() function removes the previously registered
59 notification using RegisterResetNotify().
60
61 @param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
62 @param[in] ResetFunction The pointer to the ResetFunction being unregistered.
63
64 @retval EFI_SUCCESS The reset notification function was unregistered.
65 @retval EFI_INVALID_PARAMETER ResetFunction is NULL.
66 @retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
67 registered using RegisterResetNotify().
68
69 **/
70 typedef
71 EFI_STATUS
72 (EFIAPI *EFI_UNREGISTER_RESET_NOTIFY) (
73 IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
74 IN EFI_RESET_SYSTEM ResetFunction
75 );
76
77 typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL {
78 EFI_REGISTER_RESET_NOTIFY RegisterResetNotify;
79 EFI_UNREGISTER_RESET_NOTIFY UnRegisterResetNotify;
80 } EFI_RESET_NOTIFICATION_PROTOCOL;
81
82
83 extern EFI_GUID gEfiResetNotificationProtocolGuid;
84
85 #endif
86