]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / ReportStatusCodeRouter / RuntimeDxe / ReportStatusCodeRouterRuntimeDxe.h
CommitLineData
25126a05 1/** @file\r
2 Internal include file for Report Status Code Router Driver.\r
3\r
d1102dba 4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
25126a05 6\r
7**/\r
8\r
9#ifndef __REPORT_STATUS_CODE_ROUTER_RUNTIME_DXE_H__\r
10#define __REPORT_STATUS_CODE_ROUTER_RUNTIME_DXE_H__\r
11\r
25126a05 12#include <Protocol/ReportStatusCodeHandler.h>\r
13#include <Protocol/StatusCode.h>\r
14\r
15#include <Guid/EventGroup.h>\r
16\r
17#include <Library/BaseLib.h>\r
18#include <Library/SynchronizationLib.h>\r
19#include <Library/DebugLib.h>\r
25126a05 20#include <Library/HobLib.h>\r
21#include <Library/UefiDriverEntryPoint.h>\r
22#include <Library/UefiBootServicesTableLib.h>\r
23#include <Library/MemoryAllocationLib.h>\r
cfc2ba61 24#include <Library/BaseMemoryLib.h>\r
25126a05 25#include <Library/UefiRuntimeLib.h>\r
cfc2ba61 26#include "Library/UefiLib.h"\r
25126a05 27\r
28#define RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE SIGNATURE_32 ('r', 'h', 'c', 'e')\r
29\r
30typedef struct {\r
1436aea4
MK
31 UINTN Signature;\r
32 EFI_RSC_HANDLER_CALLBACK RscHandlerCallback;\r
33 EFI_TPL Tpl;\r
34 EFI_EVENT Event;\r
35 EFI_PHYSICAL_ADDRESS StatusCodeDataBuffer;\r
36 UINTN BufferSize;\r
37 EFI_PHYSICAL_ADDRESS EndPointer;\r
38 LIST_ENTRY Node;\r
25126a05 39} RSC_HANDLER_CALLBACK_ENTRY;\r
40\r
41typedef struct {\r
1436aea4
MK
42 EFI_STATUS_CODE_TYPE Type;\r
43 EFI_STATUS_CODE_VALUE Value;\r
44 UINT32 Instance;\r
45 UINT32 Reserved;\r
46 EFI_GUID CallerId;\r
47 EFI_STATUS_CODE_DATA Data;\r
cfc2ba61 48} RSC_DATA_ENTRY;\r
25126a05 49\r
50/**\r
51 Register the callback function for ReportStatusCode() notification.\r
d1102dba 52\r
25126a05 53 When this function is called the function pointer is added to an internal list and any future calls to\r
54 ReportStatusCode() will be forwarded to the Callback function. During the bootservices,\r
55 this is the callback for which this service can be invoked. The report status code router\r
56 will create an event such that the callback function is only invoked at the TPL for which it was\r
57 registered. The entity that registers for the callback should also register for an event upon\r
58 generation of exit boot services and invoke the unregister service.\r
59 If the handler does not have a TPL dependency, it should register for a callback at TPL high. The\r
60 router infrastructure will support making callbacks at runtime, but the caller for runtime invocation\r
61 must meet the following criteria:\r
62 1. must be a runtime driver type so that its memory is not reclaimed\r
63 2. not unregister at exit boot services so that the router will still have its callback address\r
64 3. the caller must be self-contained (eg. Not call out into any boot-service interfaces) and be\r
65 runtime safe, in general.\r
d1102dba 66\r
25126a05 67 @param[in] Callback A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is called when\r
68 a call to ReportStatusCode() occurs.\r
d1102dba
LG
69 @param[in] Tpl TPL at which callback can be safely invoked.\r
70\r
25126a05 71 @retval EFI_SUCCESS Function was successfully registered.\r
72 @retval EFI_INVALID_PARAMETER The callback function was NULL.\r
73 @retval EFI_OUT_OF_RESOURCES The internal buffer ran out of space. No more functions can be\r
74 registered.\r
75 @retval EFI_ALREADY_STARTED The function was already registered. It can't be registered again.\r
76\r
77**/\r
78EFI_STATUS\r
79EFIAPI\r
80Register (\r
1436aea4
MK
81 IN EFI_RSC_HANDLER_CALLBACK Callback,\r
82 IN EFI_TPL Tpl\r
25126a05 83 );\r
84\r
85/**\r
86 Remove a previously registered callback function from the notification list.\r
d1102dba 87\r
25126a05 88 A callback function must be unregistered before it is deallocated. It is important that any registered\r
89 callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.\r
d1102dba 90\r
25126a05 91 @param[in] Callback A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is to be\r
92 unregistered.\r
d1102dba 93\r
25126a05 94 @retval EFI_SUCCESS The function was successfully unregistered.\r
95 @retval EFI_INVALID_PARAMETER The callback function was NULL.\r
96 @retval EFI_NOT_FOUND The callback function was not found to be unregistered.\r
97\r
98**/\r
99EFI_STATUS\r
100EFIAPI\r
101Unregister (\r
1436aea4 102 IN EFI_RSC_HANDLER_CALLBACK Callback\r
25126a05 103 );\r
104\r
105/**\r
106 Provides an interface that a software module can call to report a status code.\r
107\r
108 @param Type Indicates the type of status code being reported.\r
109 @param Value Describes the current status of a hardware or software entity.\r
110 This included information about the class and subclass that is used to\r
111 classify the entity as well as an operation.\r
112 @param Instance The enumeration of a hardware or software entity within\r
113 the system. Valid instance numbers start with 1.\r
114 @param CallerId This optional parameter may be used to identify the caller.\r
115 This parameter allows the status code driver to apply different rules to\r
116 different callers.\r
117 @param Data This optional parameter may be used to pass additional data.\r
118\r
119 @retval EFI_SUCCESS The function completed successfully\r
120 @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.\r
121\r
122**/\r
123EFI_STATUS\r
124EFIAPI\r
125ReportDispatcher (\r
1436aea4
MK
126 IN EFI_STATUS_CODE_TYPE Type,\r
127 IN EFI_STATUS_CODE_VALUE Value,\r
128 IN UINT32 Instance,\r
129 IN EFI_GUID *CallerId OPTIONAL,\r
130 IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
25126a05 131 );\r
132\r
133#endif\r