1 /** @file 2 This code supports a the private implementation 3 of the Data Hub protocol 4 5 Copyright (c) 2006 - 2016, 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 <Library/DebugLib.h> 25 #include <Library/UefiDriverEntryPoint.h> 26 #include <Library/UefiLib.h> 27 #include <Library/BaseLib.h> 28 #include <Library/BaseMemoryLib.h> 29 #include <Library/MemoryAllocationLib.h> 30 #include <Library/UefiBootServicesTableLib.h> 31 #include <Library/UefiRuntimeServicesTableLib.h> 32 33 #define DATA_HUB_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'H', 'u', 'b') 34 typedef struct { 35 UINT32 Signature; 36 37 EFI_HANDLE Handle; 38 39 // 40 // Produced protocol(s) 41 // 42 EFI_DATA_HUB_PROTOCOL DataHub; 43 44 // 45 // Private Data 46 // 47 // 48 // Updates to GlobalMonotonicCount, LogListHead, and FilterDriverListHead 49 // must be locked. 50 // 51 EFI_LOCK DataLock; 52 53 // 54 // Runing Monotonic Count to use for each error record. 55 // Increment AFTER use in an error record. 56 // 57 UINT64 GlobalMonotonicCount; 58 59 // 60 // List of EFI_DATA_ENTRY structures. This is the data log! The list 61 // must be in assending order of LogMonotonicCount. 62 // 63 LIST_ENTRY DataListHead; 64 65 // 66 // List of EFI_DATA_HUB_FILTER_DRIVER structures. Represents all 67 // the registered filter drivers. 68 // 69 LIST_ENTRY FilterDriverListHead; 70 71 } DATA_HUB_INSTANCE; 72 73 #define DATA_HUB_INSTANCE_FROM_THIS(this) CR (this, DATA_HUB_INSTANCE, DataHub, DATA_HUB_INSTANCE_SIGNATURE) 74 75 // 76 // Private data structure to contain the data log. One record per 77 // structure. Head pointer to the list is the Log member of 78 // EFI_DATA_ENTRY. Record is a copy of the data passed in. 79 // 80 #define EFI_DATA_ENTRY_SIGNATURE SIGNATURE_32 ('D', 'r', 'e', 'c') 81 typedef struct { 82 UINT32 Signature; 83 LIST_ENTRY Link; 84 85 EFI_DATA_RECORD_HEADER *Record; 86 87 UINTN RecordSize; 88 89 } EFI_DATA_ENTRY; 90 91 #define DATA_ENTRY_FROM_LINK(link) CR (link, EFI_DATA_ENTRY, Link, EFI_DATA_ENTRY_SIGNATURE) 92 93 // 94 // Private data to contain the filter driver Event and it's 95 // associated EFI_TPL. 96 // 97 #define EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE SIGNATURE_32 ('D', 'h', 'F', 'd') 98 99 typedef struct { 100 UINT32 Signature; 101 LIST_ENTRY Link; 102 103 // 104 // Store Filter Driver Event and Tpl level it can be Signaled at. 105 // 106 EFI_EVENT Event; 107 EFI_TPL Tpl; 108 109 // 110 // Monotonic count on the get next operation for Event. 111 // Zero indicates get next has not been called for this event yet. 112 // 113 UINT64 GetNextMonotonicCount; 114 115 // 116 // Filter driver will register what class filter should be used. 117 // 118 UINT64 ClassFilter; 119 120 // 121 // Filter driver will register what record guid filter should be used. 122 // 123 EFI_GUID FilterDataRecordGuid; 124 125 } DATA_HUB_FILTER_DRIVER; 126 127 #define FILTER_ENTRY_FROM_LINK(link) CR (link, DATA_HUB_FILTER_DRIVER, Link, EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE) 128 129 #endif 130