]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h
f87c8de8ca07f7a66e0e2a7dac3ff6bca7bdbc7c
[mirror_edk2.git] / MdeModulePkg / Universal / SmbiosDxe / SmbiosDxe.h
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 //
35 // The length of the entire structure table (including all strings) must be reported
36 // in the Structure Table Length field of the SMBIOS Structure Table Entry Point,
37 // which is a WORD field limited to 65,535 bytes.
38 //
39 #define SMBIOS_TABLE_MAX_LENGTH 0xFFFF
40
41 //
42 // For SMBIOS 3.0, Structure table maximum size in Entry Point structure is DWORD field limited to 0xFFFFFFFF bytes.
43 //
44 #define SMBIOS_3_0_TABLE_MAX_LENGTH 0xFFFFFFFF
45
46 #define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's')
47 typedef struct {
48 UINT32 Signature;
49 EFI_HANDLE Handle;
50 //
51 // Produced protocol
52 //
53 EFI_SMBIOS_PROTOCOL Smbios;
54 //
55 // Updates to record list must be locked.
56 //
57 EFI_LOCK DataLock;
58 //
59 // List of EFI_SMBIOS_ENTRY structures.
60 //
61 LIST_ENTRY DataListHead;
62 //
63 // List of allocated SMBIOS handle.
64 //
65 LIST_ENTRY AllocatedHandleListHead;
66 } SMBIOS_INSTANCE;
67
68 #define SMBIOS_INSTANCE_FROM_THIS(this) CR (this, SMBIOS_INSTANCE, Smbios, SMBIOS_INSTANCE_SIGNATURE)
69
70 //
71 // SMBIOS record Header
72 //
73 // An SMBIOS internal Record is an EFI_SMBIOS_RECORD_HEADER followed by (RecordSize - HeaderSize) bytes of
74 // data. The format of the data is defined by the SMBIOS spec.
75 //
76 //
77 #define EFI_SMBIOS_RECORD_HEADER_VERSION 0x0100
78 typedef struct {
79 UINT16 Version;
80 UINT16 HeaderSize;
81 UINTN RecordSize;
82 EFI_HANDLE ProducerHandle;
83 UINTN NumberOfStrings;
84 } EFI_SMBIOS_RECORD_HEADER;
85
86
87 //
88 // Private data structure to contain the SMBIOS record. One record per
89 // structure. SmbiosRecord is a copy of the data passed in and follows RecordHeader .
90 //
91 #define EFI_SMBIOS_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'r', 'e', 'c')
92 typedef struct {
93 UINT32 Signature;
94 LIST_ENTRY Link;
95 EFI_SMBIOS_RECORD_HEADER *RecordHeader;
96 UINTN RecordSize;
97 //
98 // Indicate which table this record is added to.
99 //
100 BOOLEAN Smbios32BitTable;
101 BOOLEAN Smbios64BitTable;
102 } EFI_SMBIOS_ENTRY;
103
104 #define SMBIOS_ENTRY_FROM_LINK(link) CR (link, EFI_SMBIOS_ENTRY, Link, EFI_SMBIOS_ENTRY_SIGNATURE)
105
106 //
107 // Private data to contain the Smbios handle that already allocated.
108 //
109 #define SMBIOS_HANDLE_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'h', 'r', 'd')
110
111 typedef struct {
112 UINT32 Signature;
113 LIST_ENTRY Link;
114 //
115 // Filter driver will register what record guid filter should be used.
116 //
117 EFI_SMBIOS_HANDLE SmbiosHandle;
118
119 } SMBIOS_HANDLE_ENTRY;
120
121 #define SMBIOS_HANDLE_ENTRY_FROM_LINK(link) CR (link, SMBIOS_HANDLE_ENTRY, Link, SMBIOS_HANDLE_ENTRY_SIGNATURE)
122
123 typedef struct {
124 EFI_SMBIOS_TABLE_HEADER Header;
125 UINT8 Tailing[2];
126 } EFI_SMBIOS_TABLE_END_STRUCTURE;
127
128 /**
129 Create Smbios Table and installs the Smbios Table to the System Table.
130
131 @param Smbios32BitTable The flag to update 32-bit table.
132 @param Smbios64BitTable The flag to update 64-bit table.
133
134 **/
135 VOID
136 EFIAPI
137 SmbiosTableConstruction (
138 BOOLEAN Smbios32BitTable,
139 BOOLEAN Smbios64BitTable
140 );
141
142 #endif