1 /** @file
2   Internal include file for Datahub Status Code Handler Driver.
3 
4   Copyright (c) 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 __DATAHUB_STATUS_CODE_HANDLER_DXE_H__
16 #define __DATAHUB_STATUS_CODE_HANDLER_DXE_H__
17 
18 #include <Protocol/ReportStatusCodeHandler.h>
19 #include <Protocol/DataHub.h>
20 #include <Protocol/StatusCode.h>
21 
22 #include <Guid/StatusCodeDataTypeId.h>
23 #include <Guid/StatusCodeDataTypeDebug.h>
24 #include <Guid/DataHubStatusCodeRecord.h>
25 #include <Guid/EventGroup.h>
26 
27 #include <Library/BaseLib.h>
28 #include <Library/SynchronizationLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/DebugLib.h>
31 #include <Library/ReportStatusCodeLib.h>
32 #include <Library/PrintLib.h>
33 #include <Library/PcdLib.h>
34 #include <Library/UefiDriverEntryPoint.h>
35 #include <Library/UefiBootServicesTableLib.h>
36 #include <Library/MemoryAllocationLib.h>
37 
38 //
39 // Data hub worker definition
40 //
41 #define DATAHUB_STATUS_CODE_SIGNATURE             SIGNATURE_32 ('B', 'D', 'H', 'S')
42 
43 typedef struct {
44   UINTN       Signature;
45   LIST_ENTRY  Node;
46   UINT8       Data[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];
47 } DATAHUB_STATUSCODE_RECORD;
48 
49 /**
50   Report status code into DataHub.
51 
52   @param  CodeType             Indicates the type of status code being reported.
53   @param  Value                Describes the current status of a hardware or software entity.
54                                This included information about the class and subclass that is used to
55                                classify the entity as well as an operation.
56   @param  Instance             The enumeration of a hardware or software entity within
57                                the system. Valid instance numbers start with 1.
58   @param  CallerId             This optional parameter may be used to identify the caller.
59                                This parameter allows the status code driver to apply different rules to
60                                different callers.
61   @param  Data                 This optional parameter may be used to pass additional data.
62 
63   @retval EFI_SUCCESS          The function completed successfully.
64   @retval EFI_DEVICE_ERROR     Function is reentered.
65   @retval EFI_DEVICE_ERROR     Function is called at runtime.
66   @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
67 
68 **/
69 EFI_STATUS
70 EFIAPI
71 DataHubStatusCodeReportWorker (
72   IN EFI_STATUS_CODE_TYPE     CodeType,
73   IN EFI_STATUS_CODE_VALUE    Value,
74   IN UINT32                   Instance,
75   IN EFI_GUID                 *CallerId,
76   IN EFI_STATUS_CODE_DATA     *Data OPTIONAL
77   );
78 
79 /**
80   Locate Data Hub Protocol and create event for logging data
81   as initialization for data hub status code worker.
82 
83   @retval EFI_SUCCESS  Initialization is successful.
84 
85 **/
86 EFI_STATUS
87 DataHubStatusCodeInitializeWorker (
88   VOID
89   );
90 
91 #endif
92