]>
Commit | Line | Data |
---|---|---|
aaa2cc19 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2009, Intel Corporation. All rights reserved. <BR> \r | |
4 | This software and associated documentation (if any) is furnished\r | |
5 | under a license and may only be used or copied in accordance\r | |
6 | with the terms of the license. Except as permitted by such\r | |
7 | license, no part of this software or documentation may be\r | |
8 | reproduced, stored in a retrieval system, or transmitted in any\r | |
9 | form or by any means without the express written consent of\r | |
10 | Intel Corporation.\r | |
11 | \r | |
12 | \r | |
13 | Module Name:\r | |
14 | \r | |
15 | MiscSystemOptionStringFunction.c\r | |
16 | \r | |
17 | Abstract: \r | |
18 | \r | |
19 | BIOS system option string boot time changes.\r | |
20 | SMBIOS type 12.\r | |
21 | \r | |
22 | --*/\r | |
23 | \r | |
24 | #include "MiscSubClassDriver.h"\r | |
25 | \r | |
26 | \r | |
27 | /**\r | |
28 | This function makes boot time changes to the contents of the\r | |
29 | MiscSystemOptionString (Type 12).\r | |
30 | \r | |
31 | @param RecordData Pointer to copy of RecordData from the Data Table. \r | |
32 | \r | |
33 | @retval EFI_SUCCESS All parameters were valid.\r | |
34 | @retval EFI_UNSUPPORTED Unexpected RecordType value.\r | |
35 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
36 | \r | |
37 | **/\r | |
38 | MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString)\r | |
39 | {\r | |
40 | CHAR8 *OptionalStrStart;\r | |
41 | UINTN OptStrLen;\r | |
42 | EFI_STRING OptionString;\r | |
43 | EFI_STATUS Status;\r | |
44 | STRING_REF TokenToGet;\r | |
45 | EFI_SMBIOS_HANDLE SmbiosHandle;\r | |
46 | SMBIOS_TABLE_TYPE12 *SmbiosRecord;\r | |
47 | \r | |
48 | //\r | |
49 | // First check for invalid parameters.\r | |
50 | //\r | |
51 | if (RecordData == NULL) {\r | |
52 | return EFI_INVALID_PARAMETER;\r | |
53 | }\r | |
54 | \r | |
55 | TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING);\r | |
56 | OptionString = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);\r | |
57 | OptStrLen = StrLen(OptionString);\r | |
58 | if (OptStrLen > SMBIOS_STRING_MAX_LENGTH) {\r | |
59 | return EFI_UNSUPPORTED;\r | |
60 | }\r | |
61 | \r | |
62 | //\r | |
63 | // Two zeros following the last string.\r | |
64 | //\r | |
65 | SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);\r | |
66 | ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);\r | |
67 | \r | |
68 | SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS;\r | |
69 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE12);\r | |
70 | //\r | |
71 | // Make handle chosen by smbios protocol.add automatically.\r | |
72 | //\r | |
73 | SmbiosRecord->Hdr.Handle = 0; \r | |
74 | \r | |
75 | SmbiosRecord->StringCount = 1;\r | |
76 | OptionalStrStart = (CHAR8*) (SmbiosRecord + 1);\r | |
77 | UnicodeStrToAsciiStr(OptionString, OptionalStrStart);\r | |
78 | //\r | |
79 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
80 | //\r | |
81 | SmbiosHandle = 0;\r | |
82 | Status = Smbios-> Add(\r | |
83 | Smbios, \r | |
84 | NULL,\r | |
85 | &SmbiosHandle, \r | |
86 | (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r | |
87 | );\r | |
88 | \r | |
89 | FreePool(SmbiosRecord);\r | |
90 | return Status;\r | |
91 | }\r |