SmbiosDxe.h revision 310b04e6f192fc7494b1f69fd37efeef6aacfc50
1/** @file
2  This code supports the implementation of the Smbios protocol
3
4Copyright (c) 2009, Intel Corporation
5All rights reserved. This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution.  The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT 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
33#define SMBIOS_MAJOR_VERSION 2
34#define SMBIOS_MINOR_VERSION 4
35
36
37#define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's')
38typedef struct {
39  UINT32                Signature;
40  EFI_HANDLE            Handle;
41  //
42  // Produced protocol
43  //
44  EFI_SMBIOS_PROTOCOL   Smbios;
45  //
46  // Updates to record list must be locked.
47  //
48  EFI_LOCK              DataLock;
49  //
50  // List of EFI_SMBIOS_ENTRY structures.
51  //
52  LIST_ENTRY            DataListHead;
53  //
54  // List of allocated SMBIOS handle.
55  //
56  LIST_ENTRY            AllocatedHandleListHead;
57} SMBIOS_INSTANCE;
58
59#define SMBIOS_INSTANCE_FROM_THIS(this)  CR (this, SMBIOS_INSTANCE, Smbios, SMBIOS_INSTANCE_SIGNATURE)
60
61//
62// SMBIOS record Header
63//
64// An SMBIOS internal Record is an EFI_SMBIOS_RECORD_HEADER followed by (RecordSize - HeaderSize) bytes of
65//  data. The format of the data is defined by the SMBIOS spec.
66//
67//
68#define EFI_SMBIOS_RECORD_HEADER_VERSION  0x0100
69typedef struct {
70  UINT16      Version;
71  UINT16      HeaderSize;
72  UINTN       RecordSize;
73  EFI_HANDLE  ProducerHandle;
74  UINTN       NumberOfStrings;
75} EFI_SMBIOS_RECORD_HEADER;
76
77
78//
79// Private data structure to contain the SMBIOS record. One record per
80//  structure. SmbiosRecord is a copy of the data passed in and follows RecordHeader .
81//
82#define EFI_SMBIOS_ENTRY_SIGNATURE  SIGNATURE_32 ('S', 'r', 'e', 'c')
83typedef struct {
84  UINT32                    Signature;
85  LIST_ENTRY                Link;
86  EFI_SMBIOS_RECORD_HEADER  *RecordHeader;
87  UINTN                     RecordSize;
88} EFI_SMBIOS_ENTRY;
89
90#define SMBIOS_ENTRY_FROM_LINK(link)  CR (link, EFI_SMBIOS_ENTRY, Link, EFI_SMBIOS_ENTRY_SIGNATURE)
91
92//
93// Private data to contain the Smbios handle that already allocated.
94//
95#define SMBIOS_HANDLE_ENTRY_SIGNATURE  SIGNATURE_32 ('S', 'h', 'r', 'd')
96
97typedef struct {
98  UINT32               Signature;
99  LIST_ENTRY           Link;
100  //
101  // Filter driver will register what record guid filter should be used.
102  //
103  EFI_SMBIOS_HANDLE    SmbiosHandle;
104
105} SMBIOS_HANDLE_ENTRY;
106
107#define SMBIOS_HANDLE_ENTRY_FROM_LINK(link)  CR (link, SMBIOS_HANDLE_ENTRY, Link, SMBIOS_HANDLE_ENTRY_SIGNATURE)
108
109typedef struct {
110  EFI_SMBIOS_TABLE_HEADER  Header;
111  UINT8                    Tailing[2];
112} EFI_SMBIOS_TABLE_END_STRUCTURE;
113
114#endif
115