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