]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/Include/Library/SmbiosLib.h
Add a new SMBIOS Library, and platform SMBIOS driver that does not use Framework...
[mirror_edk2.git] / EmulatorPkg / Include / Library / SmbiosLib.h
1 /** @file
2 Provides library functions for common SMBIOS operations. Only available to DXE
3 and UEFI module types.
4
5
6 Copyright (c) 2012, Apple Inc. All rights reserved.
7 Portitions Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _SMBIOS_LIB_H__
19 #define _SMBIOS_LIB_H__
20
21 #include <IndustryStandard/Smbios.h>
22 #include <Protocol/Smbios.h>
23
24
25 typedef struct {
26 SMBIOS_STRUCTURE *Entry;
27 CHAR8 **StringArray;
28 } SMBIOS_TEMPLATE_ENTRY;
29
30
31 EFI_STATUS
32 InitializeSmbiosTableFromTemplate (
33 IN SMBIOS_TEMPLATE_ENTRY *template
34 );
35
36
37
38 /**
39 Create SMBIOS record.
40
41 Converts a fixed SMBIOS structure and an array of pointers to strings into
42 an SMBIOS record where the strings are cat'ed on the end of the fixed record
43 and terminated via a double NULL and add to SMBIOS table.
44
45 SMBIOS_TABLE_TYPE32 gSmbiosType12 = {
46 { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
47 1 // StringCount
48 };
49 CHAR8 *gSmbiosType12Strings[] = {
50 "Not Found",
51 NULL
52 };
53
54 ...
55 AddSmbiosEntryFromTemplate (
56 (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,
57 gSmbiosType12Strings
58 );
59
60 @param SmbiosEntry Fixed SMBIOS structure
61 @param StringArray Array of strings to convert to an SMBIOS string pack.
62 NULL is OK.
63
64 **/
65 EFI_STATUS
66 CreateSmbiosEntry (
67 IN SMBIOS_STRUCTURE *SmbiosEntry,
68 IN CHAR8 **StringArray
69 );
70
71
72
73 /**
74 Update the string associated with an existing SMBIOS record.
75
76 This function allows the update of specific SMBIOS strings. The number of valid strings for any
77 SMBIOS record is defined by how many strings were present when Add() was called.
78
79 @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
80 @param[in] StringNumber The non-zero string number of the string to update.
81 @param[in] String Update the StringNumber string with String.
82
83 @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
84 @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
85 @retval EFI_UNSUPPORTED String was not added because it is longer than the SMBIOS Table supports.
86 @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
87 **/
88 EFI_STATUS
89 SmbiosUpdateString (
90 IN EFI_SMBIOS_HANDLE SmbiosHandle,
91 IN SMBIOS_TABLE_STRING StringNumber,
92 IN CHAR8 *String
93 );
94
95 /**
96 Update the string associated with an existing SMBIOS record.
97
98 This function allows the update of specific SMBIOS strings. The number of valid strings for any
99 SMBIOS record is defined by how many strings were present when Add() was called.
100
101 @param[in] SmbiosHandle SMBIOS Handle of structure that will have its string updated.
102 @param[in] StringNumber The non-zero string number of the string to update.
103 @param[in] String Update the StringNumber string with String.
104
105 @retval EFI_SUCCESS SmbiosHandle had its StringNumber String updated.
106 @retval EFI_INVALID_PARAMETER SmbiosHandle does not exist. Or String is invalid.
107 @retval EFI_UNSUPPORTED String was not added because it is longer than the SMBIOS Table supports.
108 @retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
109 **/
110 EFI_STATUS
111 SmbiosUpdateUnicodeString (
112 IN EFI_SMBIOS_HANDLE SmbiosHandle,
113 IN SMBIOS_TABLE_STRING StringNumber,
114 IN CHAR16 *String
115 );
116
117 /**
118 Allow caller to read a specific SMBIOS string
119
120 @param[in] Header SMBIOS record that contains the string.
121 @param[in[ Intance Instance of SMBIOS string 0 - N-1.
122
123 @retval NULL Instance of Type SMBIOS string was not found.
124 @retval Other Pointer to matching SMBIOS string.
125 **/
126 CHAR8 *
127 SmbiosReadString (
128 IN SMBIOS_STRUCTURE *Header,
129 IN UINTN Instance
130 );
131
132
133 /**
134 Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.
135
136 @param[in] Type Type of the next SMBIOS record to return.
137 @param[in[ Instance Instance of SMBIOS record 0 - N-1.
138 @param[out] SmbiosHandle Returns SMBIOS handle for the matching record.
139
140 @retval NULL Instance of Type SMBIOS record was not found.
141 @retval Other Pointer to matching SMBIOS record.
142 **/
143 SMBIOS_STRUCTURE *
144 EFIAPI
145 SmbiosGetRecord (
146 IN EFI_SMBIOS_TYPE Type,
147 IN UINTN Instance,
148 OUT EFI_SMBIOS_HANDLE *SmbiosHandle
149 );
150
151 /**
152 Remove an SMBIOS record.
153
154 This function removes an SMBIOS record using the handle specified by SmbiosHandle.
155
156 @param[in] SmbiosHandle The handle of the SMBIOS record to remove.
157
158 @retval EFI_SUCCESS SMBIOS record was removed.
159 @retval EFI_INVALID_PARAMETER SmbiosHandle does not specify a valid SMBIOS record.
160 **/
161 EFI_STATUS
162 EFIAPI
163 SmbiosRemove (
164 OUT EFI_SMBIOS_HANDLE SmbiosHandle
165 );
166
167
168 EFI_STATUS
169 EFIAPI
170 SmbiosGetVersion (
171 OUT UINT8 *SmbiosMajorVersion,
172 OUT UINT8 *SmbiosMinorVersion
173 );
174
175
176 #endif