]>
Commit | Line | Data |
---|---|---|
3cbfba02 DW |
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 | MiscOemStringFunction.c\r | |
17 | \r | |
18 | Abstract:\r | |
19 | \r | |
20 | boot information boot time changes.\r | |
21 | SMBIOS type 11.\r | |
22 | \r | |
23 | --*/\r | |
24 | \r | |
25 | \r | |
26 | #include "CommonHeader.h"\r | |
27 | \r | |
28 | #include "MiscSubclassDriver.h"\r | |
29 | \r | |
30 | /**\r | |
31 | This function makes boot time changes to the contents of the\r | |
32 | MiscOemString (Type 11).\r | |
33 | \r | |
34 | @param RecordData Pointer to copy of RecordData from the Data Table.\r | |
35 | \r | |
36 | @retval EFI_SUCCESS All parameters were valid.\r | |
37 | @retval EFI_UNSUPPORTED Unexpected RecordType value.\r | |
38 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
39 | \r | |
40 | **/\r | |
41 | MISC_SMBIOS_TABLE_FUNCTION(OemString)\r | |
42 | {\r | |
43 | UINTN OemStrLen;\r | |
44 | CHAR8 *OptionalStrStart;\r | |
45 | EFI_STATUS Status;\r | |
46 | EFI_STRING OemStr;\r | |
47 | STRING_REF TokenToGet;\r | |
48 | EFI_SMBIOS_HANDLE SmbiosHandle;\r | |
49 | SMBIOS_TABLE_TYPE11 *SmbiosRecord;\r | |
50 | \r | |
51 | //\r | |
52 | // First check for invalid parameters.\r | |
53 | //\r | |
54 | if (RecordData == NULL) {\r | |
55 | return EFI_INVALID_PARAMETER;\r | |
56 | }\r | |
57 | \r | |
58 | TokenToGet = STRING_TOKEN (STR_MISC_OEM_EN_US);\r | |
59 | OemStr = SmbiosMiscGetString (TokenToGet);\r | |
60 | OemStrLen = StrLen(OemStr);\r | |
61 | if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {\r | |
62 | return EFI_UNSUPPORTED;\r | |
63 | }\r | |
64 | \r | |
65 | //\r | |
66 | // Two zeros following the last string.\r | |
67 | //\r | |
68 | SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r | |
69 | ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r | |
70 | \r | |
71 | SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;\r | |
72 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);\r | |
73 | \r | |
74 | //\r | |
75 | // Make handle chosen by smbios protocol.add automatically.\r | |
76 | //\r | |
77 | SmbiosRecord->Hdr.Handle = 0;\r | |
78 | SmbiosRecord->StringCount = 1;\r | |
79 | OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r | |
80 | UnicodeStrToAsciiStr(OemStr, OptionalStrStart);\r | |
81 | \r | |
82 | //\r | |
83 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
84 | //\r | |
85 | SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r | |
86 | Status = Smbios-> Add(\r | |
87 | Smbios,\r | |
88 | NULL,\r | |
89 | &SmbiosHandle,\r | |
90 | (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r | |
91 | );\r | |
92 | FreePool(SmbiosRecord);\r | |
93 | return Status;\r | |
94 | }\r |