• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Internal include file for Report Status Code Router Driver.
3 
4   Copyright (c) 2009 - 2010, 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_ROUTER_SMM_H__
16 #define __REPORT_STATUS_CODE_ROUTER_SMM_H__
17 
18 
19 #include <Protocol/SmmReportStatusCodeHandler.h>
20 #include <Protocol/SmmStatusCode.h>
21 
22 #include <Library/BaseLib.h>
23 #include <Library/SynchronizationLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/PcdLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/SmmServicesTableLib.h>
28 #include <Library/MemoryAllocationLib.h>
29 
30 #define SMM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE  SIGNATURE_32 ('s', 'h', 'c', 'e')
31 
32 typedef struct {
33   UINTN                         Signature;
34   EFI_SMM_RSC_HANDLER_CALLBACK  RscHandlerCallback;
35   LIST_ENTRY                    Node;
36 } SMM_RSC_HANDLER_CALLBACK_ENTRY;
37 
38 /**
39   Register the callback function for ReportStatusCode() notification.
40 
41   When this function is called the function pointer is added to an internal list and any future calls to
42   ReportStatusCode() will be forwarded to the Callback function.
43 
44   @param[in] Callback           A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is called
45                                 when a call to ReportStatusCode() occurs.
46 
47   @retval EFI_SUCCESS           Function was successfully registered.
48   @retval EFI_INVALID_PARAMETER The callback function was NULL.
49   @retval EFI_OUT_OF_RESOURCES  The internal buffer ran out of space. No more functions can be
50                                 registered.
51   @retval EFI_ALREADY_STARTED   The function was already registered. It can't be registered again.
52 
53 **/
54 EFI_STATUS
55 EFIAPI
56 Register (
57   IN EFI_SMM_RSC_HANDLER_CALLBACK   Callback
58   );
59 
60 /**
61   Remove a previously registered callback function from the notification list.
62 
63   ReportStatusCode() messages will no longer be forwarded to the Callback function.
64 
65   @param[in] Callback           A pointer to a function of type EFI_PEI_RSC_HANDLER_CALLBACK that is to be
66                                 unregistered.
67 
68   @retval EFI_SUCCESS           The function was successfully unregistered.
69   @retval EFI_INVALID_PARAMETER The callback function was NULL.
70   @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
71 
72 **/
73 EFI_STATUS
74 EFIAPI
75 Unregister (
76   IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
77   );
78 
79 /**
80   Provides an interface that a software module can call to report a status code.
81 
82   @param  This             EFI_SMM_STATUS_CODE_PROTOCOL instance.
83   @param  Type             Indicates the type of status code being reported.
84   @param  Value            Describes the current status of a hardware or software entity.
85                            This included information about the class and subclass that is used to
86                            classify the entity as well as an operation.
87   @param  Instance         The enumeration of a hardware or software entity within
88                            the system. Valid instance numbers start with 1.
89   @param  CallerId         This optional parameter may be used to identify the caller.
90                            This parameter allows the status code driver to apply different rules to
91                            different callers.
92   @param  Data             This optional parameter may be used to pass additional data.
93 
94   @retval EFI_SUCCESS           The function completed successfully
95   @retval EFI_DEVICE_ERROR      The function should not be completed due to a device error.
96 
97 **/
98 EFI_STATUS
99 EFIAPI
100 ReportDispatcher (
101   IN CONST EFI_SMM_STATUS_CODE_PROTOCOL  *This,
102   IN EFI_STATUS_CODE_TYPE                Type,
103   IN EFI_STATUS_CODE_VALUE               Value,
104   IN UINT32                              Instance,
105   IN CONST EFI_GUID                      *CallerId  OPTIONAL,
106   IN EFI_STATUS_CODE_DATA                *Data      OPTIONAL
107   );
108 
109 #endif
110