]>
Commit | Line | Data |
---|---|---|
1 | /*++\r | |
2 | \r | |
3 | Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
4 | \r\r | |
5 | This program and the accompanying materials are licensed and made available under\r\r | |
6 | the terms and conditions of the BSD License that accompanies this distribution. \r\r | |
7 | The full text of the license may be found at \r\r | |
8 | http://opensource.org/licenses/bsd-license.php. \r\r | |
9 | \r\r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r\r | |
12 | \r\r | |
13 | \r | |
14 | Module Name:\r | |
15 | \r | |
16 | MiscResetCapabilitiesFunction.c\r | |
17 | \r | |
18 | Abstract:\r | |
19 | \r | |
20 | ResetCapabilities.\r | |
21 | SMBIOS type 23.\r | |
22 | \r | |
23 | --*/\r | |
24 | \r | |
25 | \r | |
26 | #include "CommonHeader.h"\r | |
27 | \r | |
28 | #include "MiscSubclassDriver.h"\r | |
29 | /**\r | |
30 | This function makes boot time changes to the contents of the\r | |
31 | MiscOemString (Type 11).\r | |
32 | \r | |
33 | @param RecordData Pointer to copy of RecordData from the Data Table.\r | |
34 | \r | |
35 | @retval EFI_SUCCESS All parameters were valid.\r | |
36 | @retval EFI_UNSUPPORTED Unexpected RecordType value.\r | |
37 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
38 | \r | |
39 | **/\r | |
40 | \r | |
41 | MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)\r | |
42 | {\r | |
43 | EFI_STATUS Status;\r | |
44 | EFI_SMBIOS_HANDLE SmbiosHandle;\r | |
45 | SMBIOS_TABLE_TYPE13 *SmbiosRecord;\r | |
46 | UINTN StrLeng;\r | |
47 | CHAR8 *OptionalStrStart;\r | |
48 | EFI_STRING Str;\r | |
49 | STRING_REF TokenToGet;\r | |
50 | \r | |
51 | \r | |
52 | //\r | |
53 | // First check for invalid parameters.\r | |
54 | //\r | |
55 | if (RecordData == NULL) {\r | |
56 | return EFI_INVALID_PARAMETER;\r | |
57 | }\r | |
58 | \r | |
59 | TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_EN_US);\r | |
60 | Str = SmbiosMiscGetString (TokenToGet);\r | |
61 | StrLeng = StrLen(Str);\r | |
62 | if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {\r | |
63 | return EFI_UNSUPPORTED;\r | |
64 | }\r | |
65 | \r | |
66 | //\r | |
67 | // Two zeros following the last string.\r | |
68 | //\r | |
69 | SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);\r | |
70 | ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);\r | |
71 | \r | |
72 | SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;\r | |
73 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);\r | |
74 | \r | |
75 | //\r | |
76 | // Make handle chosen by smbios protocol.add automatically.\r | |
77 | //\r | |
78 | SmbiosRecord->Hdr.Handle = 0;\r | |
79 | SmbiosRecord->InstallableLanguages = 1;\r | |
80 | SmbiosRecord->Flags = 1;\r | |
81 | SmbiosRecord->CurrentLanguages = 1;\r | |
82 | OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r | |
83 | UnicodeStrToAsciiStr(Str, OptionalStrStart);\r | |
84 | \r | |
85 | //\r | |
86 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
87 | //\r | |
88 | SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r | |
89 | Status = Smbios-> Add(\r | |
90 | Smbios,\r | |
91 | NULL,\r | |
92 | &SmbiosHandle,\r | |
93 | (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r | |
94 | );\r | |
95 | FreePool(SmbiosRecord);\r | |
96 | return Status;\r | |
97 | }\r | |
98 | \r |