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