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