1 /** @file
2   This PPI provides registering and unregistering services to status code consumers.
3 
4   Copyright (c) 2007 - 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 __REPORT_STATUS_CODE_HANDLER_PPI_H__
16 #define __REPORT_STATUS_CODE_HANDLER_PPI_H__
17 
18 #define EFI_PEI_RSC_HANDLER_PPI_GUID \
19   { \
20     0x65d394, 0x9951, 0x4144, {0x82, 0xa3, 0xa, 0xfc, 0x85, 0x79, 0xc2, 0x51} \
21   }
22 
23 typedef
24 EFI_STATUS
25 (EFIAPI *EFI_PEI_RSC_HANDLER_CALLBACK)(
26   IN CONST  EFI_PEI_SERVICES        **PeiServices,
27   IN        EFI_STATUS_CODE_TYPE    Type,
28   IN        EFI_STATUS_CODE_VALUE   Value,
29   IN        UINT32                  Instance,
30   IN CONST  EFI_GUID                *CallerId,
31   IN CONST  EFI_STATUS_CODE_DATA    *Data
32 );
33 
34 /**
35   Register the callback function for ReportStatusCode() notification.
36 
37   When this function is called the function pointer is added to an internal list and any future calls to
38   ReportStatusCode() will be forwarded to the Callback function.
39 
40   @param[in] Callback           A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is called
41                                 when a call to ReportStatusCode() occurs.
42 
43   @retval EFI_SUCCESS           Function was successfully registered.
44   @retval EFI_INVALID_PARAMETER The callback function was NULL.
45   @retval EFI_OUT_OF_RESOURCES  The internal buffer ran out of space. No more functions can be
46                                 registered.
47   @retval EFI_ALREADY_STARTED   The function was already registered. It can't be registered again.
48 
49 **/
50 typedef
51 EFI_STATUS
52 (EFIAPI *EFI_PEI_RSC_HANDLER_REGISTER)(
53   IN EFI_PEI_RSC_HANDLER_CALLBACK Callback
54 );
55 
56 /**
57   Remove a previously registered callback function from the notification list.
58 
59   ReportStatusCode() messages will no longer be forwarded to the Callback function.
60 
61   @param[in] Callback           A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be
62                                 unregistered.
63 
64   @retval EFI_SUCCESS           The function was successfully unregistered.
65   @retval EFI_INVALID_PARAMETER The callback function was NULL.
66   @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
67 
68 **/
69 typedef
70 EFI_STATUS
71 (EFIAPI *EFI_PEI_RSC_HANDLER_UNREGISTER)(
72   IN EFI_PEI_RSC_HANDLER_CALLBACK Callback
73 );
74 
75 typedef struct _EFI_PEI_RSC_HANDLER_PPI {
76   EFI_PEI_RSC_HANDLER_REGISTER Register;
77   EFI_PEI_RSC_HANDLER_UNREGISTER Unregister;
78 } EFI_PEI_RSC_HANDLER_PPI;
79 
80 extern EFI_GUID gEfiPeiRscHandlerPpiGuid;
81 
82 #endif // __REPORT_STATUS_CODE_HANDLER_PPI_H__
83