--- /dev/null
+/*++\r
+\r
+Copyright (c) 2009, Intel Corporation. All rights reserved. <BR> \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+Module Name:\r
+\r
+ MiscOemStringFunction.c\r
+ \r
+Abstract: \r
+\r
+ boot information boot time changes.\r
+ SMBIOS type 11.\r
+\r
+--*/\r
+\r
+\r
+#include "MiscSubclassDriver.h"\r
+/**\r
+ This function makes boot time changes to the contents of the\r
+ MiscOemString (Type 11).\r
+\r
+ @param RecordData Pointer to copy of RecordData from the Data Table. \r
+\r
+ @retval EFI_SUCCESS All parameters were valid.\r
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.\r
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r
+\r
+**/\r
+MISC_SMBIOS_TABLE_FUNCTION(OemString)\r
+{\r
+ UINTN OemStrLen;\r
+ CHAR8 *OptionalStrStart;\r
+ EFI_STATUS Status;\r
+ EFI_STRING OemStr;\r
+ STRING_REF TokenToGet;\r
+ EFI_SMBIOS_HANDLE SmbiosHandle;\r
+ SMBIOS_TABLE_TYPE11 *SmbiosRecord;\r
+\r
+ //\r
+ // First check for invalid parameters.\r
+ //\r
+ if (RecordData == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ TokenToGet = STRING_TOKEN (STR_MISC_OEM_STRING);\r
+ OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);\r
+ OemStrLen = StrLen(OemStr);\r
+ if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ //\r
+ // Two zeros following the last string.\r
+ //\r
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r
+\r
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;\r
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);\r
+ //\r
+ // Make handle chosen by smbios protocol.add automatically.\r
+ // \r
+ SmbiosRecord->Hdr.Handle = 0; \r
+ SmbiosRecord->StringCount = 1;\r
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r
+ UnicodeStrToAsciiStr(OemStr, OptionalStrStart);\r
+\r
+ //\r
+ // Now we have got the full smbios record, call smbios protocol to add this record.\r
+ //\r
+ SmbiosHandle = 0;\r
+ Status = Smbios-> Add(\r
+ Smbios, \r
+ NULL,\r
+ &SmbiosHandle, \r
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r
+ );\r
+ FreePool(SmbiosRecord);\r
+ return Status;\r
+}\r