2 BIOS system option string boot time changes.
5 Copyright (c) 2013-2015 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
;
43 EFI_MISC_SYSTEM_OPTION_STRING
*ForType12InputData
;
45 ForType12InputData
= (EFI_MISC_SYSTEM_OPTION_STRING
*)RecordData
;
48 // First check for invalid parameters.
50 if (RecordData
== NULL
) {
51 return EFI_INVALID_PARAMETER
;
54 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING
);
55 OptionString
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
56 OptStrLen
= StrLen(OptionString
);
57 if (OptStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
58 return EFI_UNSUPPORTED
;
62 // Two zeros following the last string.
64 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
65 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
67 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS
;
68 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE12
);
70 // Make handle chosen by smbios protocol.add automatically.
72 SmbiosRecord
->Hdr
.Handle
= 0;
74 SmbiosRecord
->StringCount
= 1;
75 OptionalStrStart
= (CHAR8
*) (SmbiosRecord
+ 1);
76 UnicodeStrToAsciiStr(OptionString
, OptionalStrStart
);
78 // Now we have got the full smbios record, call smbios protocol to add this record.
80 SmbiosHandle
= SMBIOS_HANDLE_PI_RESERVED
;
81 Status
= Smbios
-> Add(
85 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
88 FreePool(SmbiosRecord
);