]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.h
Add in more library for ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Platform / Generic / RuntimeDxe / StatusCode / Lib / BsDataHubStatusCode / BsDataHubStatusCode.h
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 BsDataHubStatusCode.h
15
16 Abstract:
17
18 Header for the status code data hub logging component
19
20 --*/
21
22 #ifndef _EFI_BS_DATA_HUB_STATUS_CODE_H_
23 #define _EFI_BS_DATA_HUB_STATUS_CODE_H_
24
25
26 // Statements that include other files.
27 //
28 #include "Tiano.h"
29 #include "EfiCommonLib.h"
30 #include "EfiRuntimeLib.h"
31 #include "EfiPrintLib.h"
32 #include "EfiStatusCode.h"
33
34 //
35 // Dependent protocols
36 //
37 #include EFI_PROTOCOL_DEPENDENCY (DataHub)
38
39 //
40 // Consumed protocols
41 //
42 #include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)
43
44 //
45 // GUID definitions
46 //
47 #include EFI_GUID_DEFINITION (StatusCode)
48 #include EFI_GUID_DEFINITION (StatusCodeCallerId)
49 #include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
50
51 //
52 // Private data declarations
53 //
54 #define MAX_RECORD_NUM 1000
55 #define INITIAL_RECORD_NUM 20
56 #define BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
57 #define BYTES_PER_BUFFER (BYTES_PER_RECORD * sizeof (UINT8))
58
59 #define BS_DATA_HUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')
60
61 typedef struct {
62 UINTN Signature;
63 EFI_LIST_ENTRY Link;
64 UINT8 RecordBuffer[BYTES_PER_RECORD];
65 } STATUS_CODE_RECORD_LIST;
66
67 //
68 // Function prototypes
69 //
70 STATUS_CODE_RECORD_LIST *
71 AllocateRecordBuffer (
72 VOID
73 );
74 /*++
75
76 Routine Description:
77
78 Allocate a new record list node and initialize it.
79 Inserting the node into the list isn't the task of this function.
80
81 Arguments:
82
83 None
84
85 Returns:
86
87 A pointer to the new allocated node or NULL if non available
88
89 --*/
90
91 DATA_HUB_STATUS_CODE_DATA_RECORD *
92 AquireEmptyRecordBuffer (
93 VOID
94 );
95 /*++
96
97 Routine Description:
98
99 Acquire an empty record buffer from the record list if there's free node,
100 or allocate one new node and insert it to the list if the list is full and
101 the function isn't run in EFI_TPL_HIGH_LEVEL.
102
103 Arguments:
104
105 None
106
107 Returns:
108
109 Pointer to new record buffer. NULL if none available.
110
111 --*/
112
113 EFI_STATUS
114 ReleaseRecordBuffer (
115 IN STATUS_CODE_RECORD_LIST *RecordBuffer
116 );
117 /*++
118
119 Routine Description:
120
121 Release a buffer in the list, remove some nodes to keep the list inital length.
122 Arguments:
123
124 RecordBuffer - Buffer to release
125
126 Returns:
127
128 EFI_SUCCESS - If DataRecord is valid
129 EFI_UNSUPPORTED - The record list has empty
130
131 --*/
132
133 void
134 EFIAPI
135 LogDataHubEventHandler (
136 IN EFI_EVENT Event,
137 IN VOID *Context
138 );
139 /*++
140
141 Routine Description:
142
143 The Event handler which will be notified to log data in Data Hub.
144
145 Arguments:
146
147 Event - Instance of the EFI_EVENT to signal whenever data is
148 available to be logged in the system.
149 Context - Context of the event.
150
151 Returns:
152
153 None.
154
155 --*/
156 #endif