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