2 BIOS system option string boot time changes.
5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "MiscSubClassDriver.h"
14 This function makes boot time changes to the contents of the
15 MiscSystemOptionString (Type 12).
17 @param RecordData Pointer to copy of RecordData from the Data Table.
19 @retval EFI_SUCCESS All parameters were valid.
20 @retval EFI_UNSUPPORTED Unexpected RecordType value.
21 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
24 MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString
)
26 CHAR8
*OptionalStrStart
;
28 EFI_STRING OptionString
;
30 STRING_REF TokenToGet
;
31 EFI_SMBIOS_HANDLE SmbiosHandle
;
32 SMBIOS_TABLE_TYPE12
*SmbiosRecord
;
35 // First check for invalid parameters.
37 if (RecordData
== NULL
) {
38 return EFI_INVALID_PARAMETER
;
41 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING
);
42 OptionString
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
43 OptStrLen
= StrLen(OptionString
);
44 if (OptStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
45 return EFI_UNSUPPORTED
;
49 // Two zeros following the last string.
51 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
52 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
54 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS
;
55 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE12
);
57 // Make handle chosen by smbios protocol.add automatically.
59 SmbiosRecord
->Hdr
.Handle
= 0;
61 SmbiosRecord
->StringCount
= 1;
62 OptionalStrStart
= (CHAR8
*) (SmbiosRecord
+ 1);
63 UnicodeStrToAsciiStr(OptionString
, OptionalStrStart
);
65 // Now we have got the full smbios record, call smbios protocol to add this record.
67 Status
= AddSmbiosRecord (Smbios
, &SmbiosHandle
, (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
);
69 FreePool(SmbiosRecord
);