2 BIOS system option string boot time changes.
5 Copyright (c) 2013-2016 Intel Corporation.
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include "CommonHeader.h"
20 #include "SmbiosMisc.h"
24 This function makes boot time changes to the contents of the
25 MiscSystemOptionString (Type 12).
27 @param RecordData Pointer to copy of RecordData from the Data Table.
29 @retval EFI_SUCCESS All parameters were valid.
30 @retval EFI_UNSUPPORTED Unexpected RecordType value.
31 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
34 MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString
)
36 CHAR8
*OptionalStrStart
;
38 EFI_STRING OptionString
;
40 STRING_REF TokenToGet
;
41 EFI_SMBIOS_HANDLE SmbiosHandle
;
42 SMBIOS_TABLE_TYPE12
*SmbiosRecord
;
45 // First check for invalid parameters.
47 if (RecordData
== NULL
) {
48 return EFI_INVALID_PARAMETER
;
51 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING
);
52 OptionString
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
53 OptStrLen
= StrLen(OptionString
);
54 if (OptStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
55 return EFI_UNSUPPORTED
;
59 // Two zeros following the last string.
61 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
62 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
64 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS
;
65 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE12
);
67 // Make handle chosen by smbios protocol.add automatically.
69 SmbiosRecord
->Hdr
.Handle
= 0;
71 SmbiosRecord
->StringCount
= 1;
72 OptionalStrStart
= (CHAR8
*) (SmbiosRecord
+ 1);
73 UnicodeStrToAsciiStr(OptionString
, OptionalStrStart
);
75 // Now we have got the full smbios record, call smbios protocol to add this record.
77 SmbiosHandle
= SMBIOS_HANDLE_PI_RESERVED
;
78 Status
= Smbios
-> Add(
82 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
85 FreePool(SmbiosRecord
);