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