]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ReportStatusCodeHandler.h
0c810b301c0c7de5e3d0a53def3d192822c460a4
[mirror_edk2.git] / MdePkg / Include / Protocol / ReportStatusCodeHandler.h
1 /** @file
2 This protocol provide registering and unregistering services to status code
3 consumers while in DXE.
4
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. 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 was introduced in PI Specification 1.2.
16
17 **/
18
19 #ifndef __REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
20 #define __REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
21
22 #define EFI_RSC_HANDLER_PROTOCOL_GUID \
23 { \
24 0x86212936, 0xe76, 0x41c8, {0xa0, 0x3a, 0x2a, 0xf2, 0xfc, 0x1c, 0x39, 0xe2} \
25 }
26
27 typedef
28 EFI_STATUS
29 (EFIAPI *EFI_RSC_HANDLER_CALLBACK)(
30 IN EFI_STATUS_CODE_TYPE CodeType,
31 IN EFI_STATUS_CODE_VALUE Value,
32 IN UINT32 Instance,
33 IN EFI_GUID *CallerId,
34 IN EFI_STATUS_CODE_DATA *Data
35 );
36
37 /**
38 Register the callback function for ReportStatusCode() notification.
39
40 When this function is called the function pointer is added to an internal list and any future calls to
41 ReportStatusCode() will be forwarded to the Callback function. During the bootservices,
42 this is the callback for which this service can be invoked. The report status code router
43 will create an event such that the callback function is only invoked at the TPL for which it was
44 registered. The entity that registers for the callback should also register for an event upon
45 generation of exit boot services and invoke the unregister service.
46 If the handler does not have a TPL dependency, it should register for a callback at TPL high. The
47 router infrastructure will support making callbacks at runtime, but the caller for runtime invocation
48 must meet the following criteria:
49 1. must be a runtime driver type so that its memory is not reclaimed
50 2. not unregister at exit boot services so that the router will still have its callback address
51 3. the caller must be self-contained (eg. Not call out into any boot-service interfaces) and be
52 runtime safe, in general.
53
54 @param[in] Callback A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is called when
55 a call to ReportStatusCode() occurs.
56 @param[in] Tpl TPL at which callback can be safely invoked.
57
58 @retval EFI_SUCCESS Function was successfully registered.
59 @retval EFI_INVALID_PARAMETER The callback function was NULL.
60 @retval EFI_OUT_OF_RESOURCES The internal buffer ran out of space. No more functions can be
61 registered.
62 @retval EFI_ALREADY_STARTED The function was already registered. It can't be registered again.
63 **/
64 typedef
65 EFI_STATUS
66 (EFIAPI *EFI_RSC_HANDLER_REGISTER)(
67 IN EFI_RSC_HANDLER_CALLBACK Callback,
68 IN EFI_TPL Tpl
69 );
70
71 /**
72 Remove a previously registered callback function from the notification list.
73
74 A callback function must be unregistered before it is deallocated. It is important that any registered
75 callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.
76
77 @param[in] Callback A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is to be
78 unregistered.
79
80 @retval EFI_SUCCESS The function was successfully unregistered.
81 @retval EFI_INVALID_PARAMETER The callback function was NULL.
82 @retval EFI_NOT_FOUND The callback function was not found to be unregistered.
83 **/
84 typedef
85 EFI_STATUS
86 (EFIAPI *EFI_RSC_HANDLER_UNREGISTER)(
87 IN EFI_RSC_HANDLER_CALLBACK Callback
88 );
89
90 typedef struct {
91 EFI_RSC_HANDLER_REGISTER Register;
92 EFI_RSC_HANDLER_UNREGISTER Unregister;
93 } EFI_RSC_HANDLER_PROTOCOL;
94
95 extern EFI_GUID gEfiRscHandlerProtocolGuid;
96
97 #endif // __REPORT_STATUS_CODE_HANDLER_H__