1 /** @file 2 This code supports the implementation of the Smbios protocol 3 4 Copyright (c) 2009 - 2015, 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 _SMBIOS_DXE_H_ 16 #define _SMBIOS_DXE_H_ 17 18 19 #include <PiDxe.h> 20 21 #include <Protocol/Smbios.h> 22 #include <IndustryStandard/SmBios.h> 23 #include <Guid/EventGroup.h> 24 #include <Guid/SmBios.h> 25 #include <Library/DebugLib.h> 26 #include <Library/UefiDriverEntryPoint.h> 27 #include <Library/UefiLib.h> 28 #include <Library/BaseLib.h> 29 #include <Library/BaseMemoryLib.h> 30 #include <Library/MemoryAllocationLib.h> 31 #include <Library/UefiBootServicesTableLib.h> 32 #include <Library/PcdLib.h> 33 34 #define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's') 35 typedef struct { 36 UINT32 Signature; 37 EFI_HANDLE Handle; 38 // 39 // Produced protocol 40 // 41 EFI_SMBIOS_PROTOCOL Smbios; 42 // 43 // Updates to record list must be locked. 44 // 45 EFI_LOCK DataLock; 46 // 47 // List of EFI_SMBIOS_ENTRY structures. 48 // 49 LIST_ENTRY DataListHead; 50 // 51 // List of allocated SMBIOS handle. 52 // 53 LIST_ENTRY AllocatedHandleListHead; 54 } SMBIOS_INSTANCE; 55 56 #define SMBIOS_INSTANCE_FROM_THIS(this) CR (this, SMBIOS_INSTANCE, Smbios, SMBIOS_INSTANCE_SIGNATURE) 57 58 // 59 // SMBIOS record Header 60 // 61 // An SMBIOS internal Record is an EFI_SMBIOS_RECORD_HEADER followed by (RecordSize - HeaderSize) bytes of 62 // data. The format of the data is defined by the SMBIOS spec. 63 // 64 // 65 #define EFI_SMBIOS_RECORD_HEADER_VERSION 0x0100 66 typedef struct { 67 UINT16 Version; 68 UINT16 HeaderSize; 69 UINTN RecordSize; 70 EFI_HANDLE ProducerHandle; 71 UINTN NumberOfStrings; 72 } EFI_SMBIOS_RECORD_HEADER; 73 74 75 // 76 // Private data structure to contain the SMBIOS record. One record per 77 // structure. SmbiosRecord is a copy of the data passed in and follows RecordHeader . 78 // 79 #define EFI_SMBIOS_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'r', 'e', 'c') 80 typedef struct { 81 UINT32 Signature; 82 LIST_ENTRY Link; 83 EFI_SMBIOS_RECORD_HEADER *RecordHeader; 84 UINTN RecordSize; 85 // 86 // Indicate which table this record is added to. 87 // 88 BOOLEAN Smbios32BitTable; 89 BOOLEAN Smbios64BitTable; 90 } EFI_SMBIOS_ENTRY; 91 92 #define SMBIOS_ENTRY_FROM_LINK(link) CR (link, EFI_SMBIOS_ENTRY, Link, EFI_SMBIOS_ENTRY_SIGNATURE) 93 94 // 95 // Private data to contain the Smbios handle that already allocated. 96 // 97 #define SMBIOS_HANDLE_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'h', 'r', 'd') 98 99 typedef struct { 100 UINT32 Signature; 101 LIST_ENTRY Link; 102 // 103 // Filter driver will register what record guid filter should be used. 104 // 105 EFI_SMBIOS_HANDLE SmbiosHandle; 106 107 } SMBIOS_HANDLE_ENTRY; 108 109 #define SMBIOS_HANDLE_ENTRY_FROM_LINK(link) CR (link, SMBIOS_HANDLE_ENTRY, Link, SMBIOS_HANDLE_ENTRY_SIGNATURE) 110 111 typedef struct { 112 EFI_SMBIOS_TABLE_HEADER Header; 113 UINT8 Tailing[2]; 114 } EFI_SMBIOS_TABLE_END_STRUCTURE; 115 116 /** 117 Create Smbios Table and installs the Smbios Table to the System Table. 118 119 @param Smbios32BitTable The flag to update 32-bit table. 120 @param Smbios64BitTable The flag to update 64-bit table. 121 122 **/ 123 VOID 124 EFIAPI 125 SmbiosTableConstruction ( 126 BOOLEAN Smbios32BitTable, 127 BOOLEAN Smbios64BitTable 128 ); 129 130 #endif 131