2008-03-19 04:23:16 +01:00
|
|
|
/**@file
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2011-11-21 09:56:48 +01:00
|
|
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
2019-04-04 01:06:18 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2007-06-27 08:46:00 +02:00
|
|
|
|
|
|
|
Module Name:
|
|
|
|
|
|
|
|
MiscSystemManufacturerFunction.c
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
This driver parses the mMiscSubclassDataTable structure and reports
|
|
|
|
any generated data to the DataHub.
|
|
|
|
|
2008-03-19 04:23:16 +01:00
|
|
|
**/
|
2007-06-27 08:46:00 +02:00
|
|
|
|
|
|
|
#include "MiscSubclassDriver.h"
|
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
/**
|
2007-06-27 08:46:00 +02:00
|
|
|
This function makes boot time changes to the contents of the
|
2009-11-20 05:02:03 +01:00
|
|
|
MiscSystemManufacturer (Type 1).
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
@param RecordData Pointer to copy of RecordData from the Data Table.
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
@retval EFI_SUCCESS All parameters were valid.
|
|
|
|
@retval EFI_UNSUPPORTED Unexpected RecordType value.
|
|
|
|
@retval EFI_INVALID_PARAMETER Invalid parameter was found.
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
**/
|
|
|
|
MISC_SMBIOS_TABLE_FUNCTION(MiscSystemManufacturer)
|
|
|
|
{
|
|
|
|
CHAR8 *OptionalStrStart;
|
|
|
|
UINTN ManuStrLen;
|
|
|
|
UINTN VerStrLen;
|
|
|
|
UINTN PdNameStrLen;
|
|
|
|
UINTN SerialNumStrLen;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_STRING Manufacturer;
|
|
|
|
EFI_STRING ProductName;
|
|
|
|
EFI_STRING Version;
|
|
|
|
EFI_STRING SerialNumber;
|
|
|
|
STRING_REF TokenToGet;
|
|
|
|
EFI_SMBIOS_HANDLE SmbiosHandle;
|
|
|
|
SMBIOS_TABLE_TYPE1 *SmbiosRecord;
|
|
|
|
EFI_MISC_SYSTEM_MANUFACTURER *ForType1InputData;
|
|
|
|
|
|
|
|
ForType1InputData = (EFI_MISC_SYSTEM_MANUFACTURER *)RecordData;
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
//
|
|
|
|
// First check for invalid parameters.
|
|
|
|
//
|
|
|
|
if (RecordData == NULL) {
|
|
|
|
return EFI_INVALID_PARAMETER;
|
|
|
|
}
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER);
|
|
|
|
Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
|
|
|
ManuStrLen = StrLen(Manufacturer);
|
|
|
|
if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME);
|
|
|
|
ProductName = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
|
|
|
PdNameStrLen = StrLen(ProductName);
|
|
|
|
if (PdNameStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_VERSION);
|
|
|
|
Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
|
|
|
VerStrLen = StrLen(Version);
|
|
|
|
if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SERIAL_NUMBER);
|
|
|
|
SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
|
|
|
|
SerialNumStrLen = StrLen(SerialNumber);
|
|
|
|
if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// Two zeros following the last string.
|
|
|
|
//
|
|
|
|
SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
|
|
|
|
ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION;
|
|
|
|
SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
|
2007-06-27 08:46:00 +02:00
|
|
|
//
|
2009-11-20 05:02:03 +01:00
|
|
|
// Make handle chosen by smbios protocol.add automatically.
|
|
|
|
//
|
|
|
|
SmbiosRecord->Hdr.Handle = 0;
|
2007-06-27 08:46:00 +02:00
|
|
|
//
|
2009-11-20 05:02:03 +01:00
|
|
|
// Manu will be the 1st optional string following the formatted structure.
|
2007-06-27 08:46:00 +02:00
|
|
|
//
|
2009-11-20 05:02:03 +01:00
|
|
|
SmbiosRecord->Manufacturer = 1;
|
2007-06-27 08:46:00 +02:00
|
|
|
//
|
2009-11-20 05:02:03 +01:00
|
|
|
// ProductName will be the 2nd optional string following the formatted structure.
|
2007-06-27 08:46:00 +02:00
|
|
|
//
|
2009-11-20 05:02:03 +01:00
|
|
|
SmbiosRecord->ProductName = 2;
|
2007-06-27 08:46:00 +02:00
|
|
|
//
|
2009-11-20 05:02:03 +01:00
|
|
|
// Version will be the 3rd optional string following the formatted structure.
|
|
|
|
//
|
|
|
|
SmbiosRecord->Version = 3;
|
|
|
|
//
|
|
|
|
// Version will be the 4th optional string following the formatted structure.
|
|
|
|
//
|
|
|
|
SmbiosRecord->SerialNumber = 4;
|
|
|
|
CopyMem ((UINT8 *) (&SmbiosRecord->Uuid),&ForType1InputData->SystemUuid,16);
|
|
|
|
SmbiosRecord->WakeUpType = (UINT8)ForType1InputData->SystemWakeupType;
|
|
|
|
|
|
|
|
OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
|
|
|
|
UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
|
|
|
|
UnicodeStrToAsciiStr(ProductName, OptionalStrStart + ManuStrLen + 1);
|
|
|
|
UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1);
|
|
|
|
UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1);
|
2007-06-27 08:46:00 +02:00
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
//
|
|
|
|
// Now we have got the full smbios record, call smbios protocol to add this record.
|
|
|
|
//
|
2011-11-21 09:56:48 +01:00
|
|
|
Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
|
|
|
|
|
2009-11-20 05:02:03 +01:00
|
|
|
FreePool(SmbiosRecord);
|
|
|
|
return Status;
|
2007-06-27 08:46:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* eof - MiscSystemManufacturerFunction.c */
|