2 BIOS system option string boot time changes.
5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "MiscSubClassDriver.h"
20 This function makes boot time changes to the contents of the
21 MiscSystemOptionString (Type 12).
23 @param RecordData Pointer to copy of RecordData from the Data Table.
25 @retval EFI_SUCCESS All parameters were valid.
26 @retval EFI_UNSUPPORTED Unexpected RecordType value.
27 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
30 MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString
)
32 CHAR8
*OptionalStrStart
;
34 EFI_STRING OptionString
;
36 STRING_REF TokenToGet
;
37 EFI_SMBIOS_HANDLE SmbiosHandle
;
38 SMBIOS_TABLE_TYPE12
*SmbiosRecord
;
41 // First check for invalid parameters.
43 if (RecordData
== NULL
) {
44 return EFI_INVALID_PARAMETER
;
47 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING
);
48 OptionString
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
49 OptStrLen
= StrLen(OptionString
);
50 if (OptStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
51 return EFI_UNSUPPORTED
;
55 // Two zeros following the last string.
57 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
58 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
60 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS
;
61 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE12
);
63 // Make handle chosen by smbios protocol.add automatically.
65 SmbiosRecord
->Hdr
.Handle
= 0;
67 SmbiosRecord
->StringCount
= 1;
68 OptionalStrStart
= (CHAR8
*) (SmbiosRecord
+ 1);
69 UnicodeStrToAsciiStr(OptionString
, OptionalStrStart
);
71 // Now we have got the full smbios record, call smbios protocol to add this record.
73 Status
= AddSmbiosRecord (Smbios
, &SmbiosHandle
, (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
);
75 FreePool(SmbiosRecord
);