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