3 Copyright (c) 2009, Intel Corporation. All rights reserved. <BR>
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
15 MiscSystemOptionStringFunction.c
19 BIOS system option string boot time changes.
24 #include "MiscSubclassDriver.h"
28 This function makes boot time changes to the contents of the
29 MiscSystemOptionString (Type 12).
31 @param RecordData Pointer to copy of RecordData from the Data Table.
33 @retval EFI_SUCCESS All parameters were valid.
34 @retval EFI_UNSUPPORTED Unexpected RecordType value.
35 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
38 MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString
)
40 CHAR8
*OptionalStrStart
;
42 EFI_STRING OptionString
;
44 STRING_REF TokenToGet
;
45 EFI_SMBIOS_HANDLE SmbiosHandle
;
46 SMBIOS_TABLE_TYPE12
*SmbiosRecord
;
49 // First check for invalid parameters.
51 if (RecordData
== NULL
) {
52 return EFI_INVALID_PARAMETER
;
55 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING
);
56 OptionString
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
57 OptStrLen
= StrLen(OptionString
);
58 if (OptStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
59 return EFI_UNSUPPORTED
;
63 // Two zeros following the last string.
65 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
66 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE12
) + OptStrLen
+ 1 + 1);
68 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS
;
69 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE12
);
71 // Make handle chosen by smbios protocol.add automatically.
73 SmbiosRecord
->Hdr
.Handle
= 0;
75 SmbiosRecord
->StringCount
= 1;
76 OptionalStrStart
= (CHAR8
*) (SmbiosRecord
+ 1);
77 UnicodeStrToAsciiStr(OptionString
, OptionalStrStart
);
79 // Now we have got the full smbios record, call smbios protocol to add this record.
82 Status
= Smbios
-> Add(
86 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
89 FreePool(SmbiosRecord
);