]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h
Enhance SmbiosDxe driver:
[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 - 2012, 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 #define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's')
42 typedef struct {
43 UINT32 Signature;
44 EFI_HANDLE Handle;
45 //
46 // Produced protocol
47 //
48 EFI_SMBIOS_PROTOCOL Smbios;
49 //
50 // Updates to record list must be locked.
51 //
52 EFI_LOCK DataLock;
53 //
54 // List of EFI_SMBIOS_ENTRY structures.
55 //
56 LIST_ENTRY DataListHead;
57 //
58 // List of allocated SMBIOS handle.
59 //
60 LIST_ENTRY AllocatedHandleListHead;
61 } SMBIOS_INSTANCE;
62
63 #define SMBIOS_INSTANCE_FROM_THIS(this) CR (this, SMBIOS_INSTANCE, Smbios, SMBIOS_INSTANCE_SIGNATURE)
64
65 //
66 // SMBIOS record Header
67 //
68 // An SMBIOS internal Record is an EFI_SMBIOS_RECORD_HEADER followed by (RecordSize - HeaderSize) bytes of
69 // data. The format of the data is defined by the SMBIOS spec.
70 //
71 //
72 #define EFI_SMBIOS_RECORD_HEADER_VERSION 0x0100
73 typedef struct {
74 UINT16 Version;
75 UINT16 HeaderSize;
76 UINTN RecordSize;
77 EFI_HANDLE ProducerHandle;
78 UINTN NumberOfStrings;
79 } EFI_SMBIOS_RECORD_HEADER;
80
81
82 //
83 // Private data structure to contain the SMBIOS record. One record per
84 // structure. SmbiosRecord is a copy of the data passed in and follows RecordHeader .
85 //
86 #define EFI_SMBIOS_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'r', 'e', 'c')
87 typedef struct {
88 UINT32 Signature;
89 LIST_ENTRY Link;
90 EFI_SMBIOS_RECORD_HEADER *RecordHeader;
91 UINTN RecordSize;
92 } EFI_SMBIOS_ENTRY;
93
94 #define SMBIOS_ENTRY_FROM_LINK(link) CR (link, EFI_SMBIOS_ENTRY, Link, EFI_SMBIOS_ENTRY_SIGNATURE)
95
96 //
97 // Private data to contain the Smbios handle that already allocated.
98 //
99 #define SMBIOS_HANDLE_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'h', 'r', 'd')
100
101 typedef struct {
102 UINT32 Signature;
103 LIST_ENTRY Link;
104 //
105 // Filter driver will register what record guid filter should be used.
106 //
107 EFI_SMBIOS_HANDLE SmbiosHandle;
108
109 } SMBIOS_HANDLE_ENTRY;
110
111 #define SMBIOS_HANDLE_ENTRY_FROM_LINK(link) CR (link, SMBIOS_HANDLE_ENTRY, Link, SMBIOS_HANDLE_ENTRY_SIGNATURE)
112
113 typedef struct {
114 EFI_SMBIOS_TABLE_HEADER Header;
115 UINT8 Tailing[2];
116 } EFI_SMBIOS_TABLE_END_STRUCTURE;
117
118 /**
119 Create Smbios Table and installs the Smbios Table to the System Table.
120 **/
121 VOID
122 EFIAPI
123 SmbiosTableConstruction (
124 VOID
125 );
126
127 #endif