2 BIOS system option string boot time changes.
5 Copyright (c) 2013-2016 Intel Corporation.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include "CommonHeader.h"
14 #include "SmbiosMisc.h"
18 This function makes boot time changes to the contents of the
19 MiscSystemOptionString (Type 12).
21 @param RecordData Pointer to copy of RecordData from the Data Table.
23 @retval EFI_SUCCESS All parameters were valid.
24 @retval EFI_UNSUPPORTED Unexpected RecordType value.
25 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
28 MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString
)
30 CHAR8
*OptionalStrStart
;
32 EFI_STRING OptionString
;
34 STRING_REF TokenToGet
;
35 EFI_SMBIOS_HANDLE SmbiosHandle
;
36 SMBIOS_TABLE_TYPE12
*SmbiosRecord
;
39 // First check for invalid parameters.
41 if (RecordData
== NULL
) {
42 return EFI_INVALID_PARAMETER
;
45 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING
);
46 OptionString
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
47 OptStrLen
= StrLen(OptionString
);
48 if (OptStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
49 return EFI_UNSUPPORTED
;
53 // Two zeros following the last string.
55 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
56 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
58 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS
;
59 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE12
);
61 // Make handle chosen by smbios protocol.add automatically.
63 SmbiosRecord
->Hdr
.Handle
= 0;
65 SmbiosRecord
->StringCount
= 1;
66 OptionalStrStart
= (CHAR8
*) (SmbiosRecord
+ 1);
67 UnicodeStrToAsciiStr(OptionString
, OptionalStrStart
);
69 // Now we have got the full smbios record, call smbios protocol to add this record.
71 SmbiosHandle
= SMBIOS_HANDLE_PI_RESERVED
;
72 Status
= Smbios
-> Add(
76 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
79 FreePool(SmbiosRecord
);