1 /** @file
2   Internal include file for Report Status Code Router PEIM.
3 
4   Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __PEI_REPORT_STATUS_CODE_ROUTER_H__
16 #define __PEI_REPORT_STATUS_CODE_ROUTER_H__
17 
18 
19 #include <Ppi/ReportStatusCodeHandler.h>
20 #include <Ppi/StatusCode.h>
21 
22 #include <Guid/StatusCodeCallbackGuid.h>
23 
24 #include <Library/DebugLib.h>
25 #include <Library/HobLib.h>
26 #include <Library/PeiServicesLib.h>
27 #include <Library/PeimEntryPoint.h>
28 
29 /**
30   Register the callback function for ReportStatusCode() notification.
31 
32   When this function is called the function pointer is added to an internal list and any future calls to
33   ReportStatusCode() will be forwarded to the Callback function.
34 
35   @param[in] Callback           A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is called
36                                 when a call to ReportStatusCode() occurs.
37 
38   @retval EFI_SUCCESS           Function was successfully registered.
39   @retval EFI_INVALID_PARAMETER The callback function was NULL.
40   @retval EFI_OUT_OF_RESOURCES  The internal buffer ran out of space. No more functions can be
41                                 registered.
42   @retval EFI_ALREADY_STARTED   The function was already registered. It can't be registered again.
43 
44 **/
45 EFI_STATUS
46 EFIAPI
47 Register (
48   IN EFI_PEI_RSC_HANDLER_CALLBACK Callback
49   );
50 
51 /**
52   Remove a previously registered callback function from the notification list.
53 
54   ReportStatusCode() messages will no longer be forwarded to the Callback function.
55 
56   @param[in] Callback           A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be
57                                 unregistered.
58 
59   @retval EFI_SUCCESS           The function was successfully unregistered.
60   @retval EFI_INVALID_PARAMETER The callback function was NULL.
61   @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
62 
63 **/
64 EFI_STATUS
65 EFIAPI
66 Unregister (
67   IN EFI_PEI_RSC_HANDLER_CALLBACK Callback
68   );
69 
70 /**
71   Publishes an interface that allows PEIMs to report status codes.
72 
73   This function implements EFI_PEI_PROGRESS_CODE_PPI.ReportStatusCode().
74   It publishes an interface that allows PEIMs to report status codes.
75 
76   @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
77   @param  CodeType         Indicates the type of status code being reported.
78   @param  Value            Describes the current status of a hardware or
79                            software entity. This includes information about the class and
80                            subclass that is used to classify the entity as well as an operation.
81                            For progress codes, the operation is the current activity.
82                            For error codes, it is the exception.For debug codes,it is not defined at this time.
83   @param  Instance         The enumeration of a hardware or software entity within
84                            the system. A system may contain multiple entities that match a class/subclass
85                            pairing. The instance differentiates between them. An instance of 0 indicates
86                            that instance information is unavailable, not meaningful, or not relevant.
87                            Valid instance numbers start with 1.
88   @param  CallerId         This optional parameter may be used to identify the caller.
89                            This parameter allows the status code driver to apply different rules to
90                            different callers.
91   @param  Data             This optional parameter may be used to pass additional data.
92 
93   @retval EFI_SUCCESS      The function completed successfully.
94 
95 **/
96 EFI_STATUS
97 EFIAPI
98 ReportDispatcher (
99   IN CONST EFI_PEI_SERVICES         **PeiServices,
100   IN EFI_STATUS_CODE_TYPE           CodeType,
101   IN EFI_STATUS_CODE_VALUE          Value,
102   IN UINT32                         Instance,
103   IN CONST EFI_GUID                 *CallerId OPTIONAL,
104   IN CONST EFI_STATUS_CODE_DATA     *Data OPTIONAL
105   );
106 
107 #endif
108 
109 
110