1 /** @file 2 This code supports a the private implementation 3 of the Data Hub protocol 4 5 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 16 #ifndef _DATA_HUB_H_ 17 #define _DATA_HUB_H_ 18 19 20 #include <FrameworkDxe.h> 21 22 #include <Protocol/DataHub.h> 23 24 #include <Guid/ZeroGuid.h> 25 26 #include <Library/DebugLib.h> 27 #include <Library/UefiDriverEntryPoint.h> 28 #include <Library/UefiLib.h> 29 #include <Library/BaseLib.h> 30 #include <Library/BaseMemoryLib.h> 31 #include <Library/MemoryAllocationLib.h> 32 #include <Library/UefiBootServicesTableLib.h> 33 #include <Library/UefiRuntimeServicesTableLib.h> 34 35 #define DATA_HUB_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'H', 'u', 'b') 36 typedef struct { 37 UINT32 Signature; 38 39 EFI_HANDLE Handle; 40 41 // 42 // Produced protocol(s) 43 // 44 EFI_DATA_HUB_PROTOCOL DataHub; 45 46 // 47 // Private Data 48 // 49 // 50 // Updates to GlobalMonotonicCount, LogListHead, and FilterDriverListHead 51 // must be locked. 52 // 53 EFI_LOCK DataLock; 54 55 // 56 // Runing Monotonic Count to use for each error record. 57 // Increment AFTER use in an error record. 58 // 59 UINT64 GlobalMonotonicCount; 60 61 // 62 // List of EFI_DATA_ENTRY structures. This is the data log! The list 63 // must be in assending order of LogMonotonicCount. 64 // 65 LIST_ENTRY DataListHead; 66 67 // 68 // List of EFI_DATA_HUB_FILTER_DRIVER structures. Represents all 69 // the registered filter drivers. 70 // 71 LIST_ENTRY FilterDriverListHead; 72 73 } DATA_HUB_INSTANCE; 74 75 #define DATA_HUB_INSTANCE_FROM_THIS(this) CR (this, DATA_HUB_INSTANCE, DataHub, DATA_HUB_INSTANCE_SIGNATURE) 76 77 // 78 // Private data structure to contain the data log. One record per 79 // structure. Head pointer to the list is the Log member of 80 // EFI_DATA_ENTRY. Record is a copy of the data passed in. 81 // 82 #define EFI_DATA_ENTRY_SIGNATURE SIGNATURE_32 ('D', 'r', 'e', 'c') 83 typedef struct { 84 UINT32 Signature; 85 LIST_ENTRY Link; 86 87 EFI_DATA_RECORD_HEADER *Record; 88 89 UINTN RecordSize; 90 91 } EFI_DATA_ENTRY; 92 93 #define DATA_ENTRY_FROM_LINK(link) CR (link, EFI_DATA_ENTRY, Link, EFI_DATA_ENTRY_SIGNATURE) 94 95 // 96 // Private data to contain the filter driver Event and it's 97 // associated EFI_TPL. 98 // 99 #define EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE SIGNATURE_32 ('D', 'h', 'F', 'd') 100 101 typedef struct { 102 UINT32 Signature; 103 LIST_ENTRY Link; 104 105 // 106 // Store Filter Driver Event and Tpl level it can be Signaled at. 107 // 108 EFI_EVENT Event; 109 EFI_TPL Tpl; 110 111 // 112 // Monotonic count on the get next operation for Event. 113 // Zero indicates get next has not been called for this event yet. 114 // 115 UINT64 GetNextMonotonicCount; 116 117 // 118 // Filter driver will register what class filter should be used. 119 // 120 UINT64 ClassFilter; 121 122 // 123 // Filter driver will register what record guid filter should be used. 124 // 125 EFI_GUID FilterDataRecordGuid; 126 127 } DATA_HUB_FILTER_DRIVER; 128 129 #define FILTER_ENTRY_FROM_LINK(link) CR (link, DATA_HUB_FILTER_DRIVER, Link, EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE) 130 131 #endif 132