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