From 3cbfba02fef9dae07a041fdbf2e89611d72d6f90 Mon Sep 17 00:00:00 2001 From: David Wei Date: Mon, 12 Jan 2015 09:37:20 +0000 Subject: Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to https://svn.code.sf.net/p/edk2/code/trunk/edk2/, which are for MinnowBoard MAX open source project. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: David Wei Reviewed-by: Mike Wu Reviewed-by: Hot Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16599 6f19259b-4bc3-4df7-8a09-765794883524 --- Vlv2TbltDevicePkg/SmBiosMiscDxe/CommonHeader.h | 44 + .../SmBiosMiscDxe/MiscBaseBoardManufacturer.uni | Bin 0 -> 2866 bytes .../SmBiosMiscDxe/MiscBaseBoardManufacturerData.c | 63 + .../MiscBaseBoardManufacturerFunction.c | 232 ++++ Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendor.uni | Bin 0 -> 1860 bytes .../SmBiosMiscDxe/MiscBiosVendorData.c | 106 ++ .../SmBiosMiscDxe/MiscBiosVendorFunction.c | 341 ++++++ .../SmBiosMiscDxe/MiscBootInformationData.c | 39 + .../SmBiosMiscDxe/MiscBootInformationFunction.c | 87 ++ .../SmBiosMiscDxe/MiscChassisManufacturer.uni | Bin 0 -> 2056 bytes .../SmBiosMiscDxe/MiscChassisManufacturerData.c | 62 + .../MiscChassisManufacturerFunction.c | 155 +++ .../SmBiosMiscDxe/MiscMemoryDevice.uni | Bin 0 -> 2904 bytes .../SmBiosMiscDxe/MiscMemoryDeviceData.c | 50 + .../SmBiosMiscDxe/MiscMemoryDeviceFunction.c | 324 ++++++ .../MiscNumberOfInstallableLanguagesData.c | 43 + .../MiscNumberOfInstallableLanguagesFunction.c | 254 ++++ Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemString.uni | Bin 0 -> 1848 bytes .../SmBiosMiscDxe/MiscOemStringData.c | 39 + .../SmBiosMiscDxe/MiscOemStringFunction.c | 94 ++ .../SmBiosMiscDxe/MiscOemType0x90.uni | Bin 0 -> 2078 bytes .../SmBiosMiscDxe/MiscOemType0x90Data.c | 41 + .../SmBiosMiscDxe/MiscOemType0x90Function.c | 452 ++++++++ .../SmBiosMiscDxe/MiscOemType0x94.uni | Bin 0 -> 4302 bytes .../SmBiosMiscDxe/MiscOemType0x94Data.c | 59 + .../SmBiosMiscDxe/MiscOemType0x94Function.c | 1223 ++++++++++++++++++++ .../SmBiosMiscDxe/MiscOnboardDevice.uni | Bin 0 -> 1910 bytes .../SmBiosMiscDxe/MiscOnboardDeviceData.c | 53 + .../SmBiosMiscDxe/MiscOnboardDeviceFunction.c | 140 +++ .../SmBiosMiscDxe/MiscPhysicalArray.uni | Bin 0 -> 1518 bytes .../SmBiosMiscDxe/MiscPhysicalArrayData.c | 43 + .../SmBiosMiscDxe/MiscPhysicalArrayFunction.c | 106 ++ .../MiscPortInternalConnectorDesignator.uni | Bin 0 -> 2566 bytes .../MiscPortInternalConnectorDesignatorData.c | 61 + .../MiscPortInternalConnectorDesignatorFunction.c | 157 +++ .../SmBiosMiscDxe/MiscProcessorCache.uni | Bin 0 -> 1506 bytes .../SmBiosMiscDxe/MiscProcessorCacheData.c | 38 + .../SmBiosMiscDxe/MiscProcessorCacheFunction.c | 202 ++++ .../SmBiosMiscDxe/MiscProcessorInformation.uni | Bin 0 -> 2208 bytes .../SmBiosMiscDxe/MiscProcessorInformationData.c | 76 ++ .../MiscProcessorInformationFunction.c | 455 ++++++++ .../SmBiosMiscDxe/MiscResetCapabilitiesData.c | 48 + .../SmBiosMiscDxe/MiscResetCapabilitiesFunction.c | 90 ++ .../SmBiosMiscDxe/MiscSubclassDriver.h | 193 +++ .../SmBiosMiscDxe/MiscSubclassDriver.uni | Bin 0 -> 2354 bytes .../SmBiosMiscDxe/MiscSubclassDriverDataTable.c | 103 ++ .../SmBiosMiscDxe/MiscSubclassDriverEntryPoint.c | 174 +++ .../SmBiosMiscDxe/MiscSystemLanguageString.uni | Bin 0 -> 1576 bytes .../SmBiosMiscDxe/MiscSystemLanguageStringData.c | 39 + .../MiscSystemLanguageStringFunction.c | 98 ++ .../SmBiosMiscDxe/MiscSystemManufacturer.uni | Bin 0 -> 2478 bytes .../SmBiosMiscDxe/MiscSystemManufacturerData.c | 53 + .../SmBiosMiscDxe/MiscSystemManufacturerFunction.c | 353 ++++++ .../SmBiosMiscDxe/MiscSystemOptionString.uni | Bin 0 -> 1578 bytes .../SmBiosMiscDxe/MiscSystemOptionStringData.c | 36 + .../SmBiosMiscDxe/MiscSystemOptionStringFunction.c | 98 ++ .../SmBiosMiscDxe/MiscSystemSlotDesignation.uni | Bin 0 -> 2920 bytes .../SmBiosMiscDxe/MiscSystemSlotDesignationData.c | 251 ++++ .../MiscSystemSlotDesignationFunction.c | 132 +++ Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf | 144 +++ 60 files changed, 6851 insertions(+) create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/CommonHeader.h create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturer.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendor.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturer.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDevice.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemString.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Data.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Data.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDevice.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArray.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignator.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCache.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformation.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.h create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverDataTable.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverEntryPoint.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageString.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturer.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionString.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignation.uni create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationData.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c create mode 100644 Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf (limited to 'Vlv2TbltDevicePkg/SmBiosMiscDxe') diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/CommonHeader.h b/Vlv2TbltDevicePkg/SmBiosMiscDxe/CommonHeader.h new file mode 100644 index 0000000000..4b7f70acc6 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/CommonHeader.h @@ -0,0 +1,44 @@ +/**@file + Common header file shared by all source files. + + This file includes package header files, library classes and protocol, PPI & GUID definitions. + + Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __COMMON_HEADER_H_ +#define __COMMON_HEADER_H_ + + + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturer.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturer.uni new file mode 100644 index 0000000000..5d23abd534 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturer.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerData.c new file mode 100644 index 0000000000..a3bacecd1d --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerData.c @@ -0,0 +1,63 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBaseBoardManufacturerData.c + +Abstract: + + Static data of Base board manufacturer information. + Base board manufacturer information is Misc. subclass type 4 and SMBIOS type 2. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) += { + STRING_TOKEN(STR_MISC_BASE_BOARD_MANUFACTURER), + STRING_TOKEN(STR_MISC_BASE_BOARD_PRODUCT_NAME), + STRING_TOKEN(STR_MISC_BASE_BOARD_VERSION), + STRING_TOKEN(STR_MISC_BASE_BOARD_SERIAL_NUMBER), + STRING_TOKEN(STR_MISC_BASE_BOARD_ASSET_TAG), + STRING_TOKEN(STR_MISC_BASE_BOARD_CHASSIS_LOCATION), + { // BaseBoardFeatureFlags + 1, // Motherboard + 0, // RequiresDaughterCard + 0, // Removable + 1, // Replaceable, + 0, // HotSwappable + 0, // Reserved + }, + EfiBaseBoardTypeUnknown, // BaseBoardType + { // BaseBoardChassisLink + EFI_MISC_SUBCLASS_GUID, // ProducerName + 1, // Instance + 1, // SubInstance + }, + 0, // BaseBoardNumberLinks + { // LinkN + EFI_MISC_SUBCLASS_GUID, // ProducerName + 1, // Instance + 1, // SubInstance + }, +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c new file mode 100644 index 0000000000..6570e7cfd2 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c @@ -0,0 +1,232 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBaseBoardManufacturerFunction.c + +Abstract: + + BaseBoard manufacturer information boot time changes. + SMBIOS type 2. + +--*/ + + +#include "CommonHeader.h" +#include "MiscSubclassDriver.h" +#include +#include "Library/DebugLib.h" +#include + + +/** + This function makes boot time changes to the contents of the + MiscBaseBoardManufacturer (Type 2). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) +{ + CHAR8 *OptionalStrStart; + UINTN ManuStrLen; + UINTN ProductStrLen; + UINTN VerStrLen; + UINTN AssertTagStrLen; + UINTN SerialNumStrLen; + UINTN ChassisStrLen; + EFI_STATUS Status; + EFI_STRING Manufacturer; + EFI_STRING Product; + EFI_STRING Version; + EFI_STRING SerialNumber; + EFI_STRING AssertTag; + EFI_STRING Chassis; + STRING_REF TokenToGet; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE2 *SmbiosRecord; + EFI_MISC_BASE_BOARD_MANUFACTURER *ForType2InputData; + + CHAR16 *MacStr; + EFI_HANDLE *Handles; + UINTN BufferSize; + + ForType2InputData = (EFI_MISC_BASE_BOARD_MANUFACTURER *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER); + Manufacturer = SmbiosMiscGetString (TokenToGet); + ManuStrLen = StrLen(Manufacturer); + if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_PRODUCT_NAME1); + Product = SmbiosMiscGetString (TokenToGet); + ProductStrLen = StrLen(Product); + if (ProductStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_VERSION); + Version = SmbiosMiscGetString (TokenToGet); + VerStrLen = StrLen(Version); + if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + //Get handle infomation + // + BufferSize = 0; + Handles = NULL; + Status = gBS->LocateHandle ( + ByProtocol, + &gEfiSimpleNetworkProtocolGuid, + NULL, + &BufferSize, + Handles + ); + + if (Status == EFI_BUFFER_TOO_SMALL) { + Handles = AllocateZeroPool(BufferSize); + if (Handles == NULL) { + return (EFI_OUT_OF_RESOURCES); + } + Status = gBS->LocateHandle( + ByProtocol, + &gEfiSimpleNetworkProtocolGuid, + NULL, + &BufferSize, + Handles + ); + } + + // + //Get the MAC string + // + Status = NetLibGetMacString ( + *Handles, + NULL, + &MacStr + ); + if (EFI_ERROR (Status)) { + return Status; + } + SerialNumber = MacStr; + SerialNumStrLen = StrLen(SerialNumber); + if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + DEBUG ((EFI_D_ERROR, "MAC Address: %S\n", MacStr)); + + TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG); + AssertTag = SmbiosMiscGetString (TokenToGet); + AssertTagStrLen = StrLen(AssertTag); + if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_CHASSIS_LOCATION); + Chassis = SmbiosMiscGetString (TokenToGet); + ChassisStrLen = StrLen(Chassis); + if (ChassisStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // Manu will be the 1st optional string following the formatted structure. + // + SmbiosRecord->Manufacturer = 1; + + // + // ProductName will be the 2st optional string following the formatted structure. + // + SmbiosRecord->ProductName = 2; + + // + // Version will be the 3rd optional string following the formatted structure. + // + SmbiosRecord->Version = 3; + + // + // SerialNumber will be the 4th optional string following the formatted structure. + // + SmbiosRecord->SerialNumber = 4; + + // + // AssertTag will be the 5th optional string following the formatted structure. + // + SmbiosRecord->AssetTag = 5; + + // + // LocationInChassis will be the 6th optional string following the formatted structure. + // + SmbiosRecord->LocationInChassis = 6; + SmbiosRecord->FeatureFlag = (*(BASE_BOARD_FEATURE_FLAGS*)&(ForType2InputData->BaseBoardFeatureFlags)); + SmbiosRecord->ChassisHandle = 0; + SmbiosRecord->BoardType = (UINT8)ForType2InputData->BaseBoardType; + SmbiosRecord->NumberOfContainedObjectHandles = 0; + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + + // + // Since we fill NumberOfContainedObjectHandles = 0 for simple, just after this filed to fill string + // + UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); + UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1); + UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1); + UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1); + UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); + UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendor.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendor.uni new file mode 100644 index 0000000000..e9fffaef3b Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendor.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorData.c new file mode 100644 index 0000000000..d18adad2b7 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorData.c @@ -0,0 +1,106 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBiosVendorData.c + +Abstract: + + Static data of BIOS vendor information. + BIOS vendor information is Misc. subclass type 2 and SMBIOS type 0. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) += { + STRING_TOKEN(STR_MISC_BIOS_VENDOR), // BiosVendor + STRING_TOKEN(STR_MISC_BIOS_VERSION), // BiosVersion + STRING_TOKEN(STR_MISC_BIOS_RELEASE_DATE), // BiosReleaseDate + 0xF000, // BiosStartingAddress + { // BiosPhysicalDeviceSize + 1, // Value + 21 , // Exponent + }, + { // BiosCharacteristics1 + 0, // Reserved1 :2 + 0, // Unknown :1 + 0, // BiosCharacteristicsNotSupported :1 + 0, // IsaIsSupported :1 + 0, // McaIsSupported :1 + 0, // EisaIsSupported :1 + 1, // PciIsSupported :1 + 0, // PcmciaIsSupported :1 + 0, // PlugAndPlayIsSupported :1 + 0, // ApmIsSupported :1 + 1, // BiosIsUpgradable :1 + 1, // BiosShadowingAllowed :1 + 0, // VlVesaIsSupported :1 + 0, // EscdSupportIsAvailable :1 + 1, // BootFromCdIsSupported :1 + 1, // SelectableBootIsSupported :1 + 0, // RomBiosIsSocketed :1 + 0, // BootFromPcmciaIsSupported :1 + 1, // EDDSpecificationIsSupported :1 + 0, // JapaneseNecFloppyIsSupported :1 + 0, // JapaneseToshibaFloppyIsSupported :1 + 0, // Floppy525_360IsSupported :1 + 0, // Floppy525_12IsSupported :1 + 0, // Floppy35_720IsSupported :1 + 0, // Floppy35_288IsSupported :1 + 0, // PrintScreenIsSupported :1 + 1, // Keyboard8042IsSupported :1 + 1, // SerialIsSupported :1 + 1, // PrinterIsSupported :1 + 1, // CgaMonoIsSupported :1 + 0, // NecPc98 :1 + +// +//BIOS Characteristics Extension Byte 1 +// + 1, // AcpiIsSupported :1 + 1, // UsbLegacyIsSupported :1 + 0, // AgpIsSupported :1 + 0, // I20BootIsSupported :1 + 0, // Ls120BootIsSupported :1 + 1, // AtapiZipDriveBootIsSupported :1 + 0, // Boot1394IsSupported :1 + 0, // SmartBatteryIsSupported :1 + +// +//BIOS Characteristics Extension Byte 2 +// + 1, // BiosBootSpecIsSupported :1 + 1, // FunctionKeyNetworkBootIsSupported :1 + 0x1 // Reserved :19 Bit 2 is SMBiosIsTargContDistEnabled + }, + { // BiosCharacteristics2 + 0x0001,// BiosReserved :16 Bit 0 is BIOS Splash Screen + 0, // SystemReserved :16 + 0 // Reserved :32 + }, + 0xFF, // BiosMajorRelease; + 0xFF, // BiosMinorRelease; + 0xFF, // BiosEmbeddedFirmwareMajorRelease; + 0xFF, // BiosEmbeddedFirmwareMinorRelease; +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c new file mode 100644 index 0000000000..33c14dcc74 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c @@ -0,0 +1,341 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBiosVendorFunction.c + +Abstract: + + BIOS vendor information boot time changes. + Misc. subclass type 2. + SMBIOS type 0. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" +#include +#include + +EFI_SPI_PROTOCOL *mSpiProtocol = NULL; + + +/** + This function read the data from Spi Rom. + + @param BaseAddress The starting address of the read. + @param Byte The pointer to the destination buffer. + @param Length The number of bytes. + @param SpiRegionType Spi Region Type. + + @retval Status + +**/ +EFI_STATUS +FlashRead ( + IN UINTN BaseAddress, + IN UINT8 *Byte, + IN UINTN Length, + IN SPI_REGION_TYPE SpiRegionType + ) +{ + EFI_STATUS Status = EFI_SUCCESS; + UINT32 SectorSize; + UINT32 SpiAddress; + UINT8 Buffer[SECTOR_SIZE_4KB]; + + SpiAddress = (UINT32)(UINTN)(BaseAddress); + SectorSize = SECTOR_SIZE_4KB; + + Status = mSpiProtocol->Execute ( + mSpiProtocol, + SPI_READ, + SPI_WREN, + TRUE, + TRUE, + FALSE, + (UINT32) SpiAddress, + SectorSize, + Buffer, + SpiRegionType + ); + + if (EFI_ERROR (Status)) { +#ifdef _SHOW_LOG_ + Print(L"Read SPI ROM Failed [%08x]\n", SpiAddress); +#endif + return Status; + } + + CopyMem (Byte, (void *)Buffer, Length); + + return Status; +} + +/** + This function returns the value & exponent to Base2 for a given + Hex value. This is used to calculate the BiosPhysicalDeviceSize. + + @param Value The hex value which is to be converted into value-exponent form + @param Exponent The exponent out of the conversion + + @retval EFI_SUCCESS All parameters were valid and *Value & *Exponent have been set. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +EFI_STATUS +GetValueExponentBase2( + IN OUT UINTN *Value, + OUT UINTN *Exponent + ) +{ + if ((Value == NULL) || (Exponent == NULL)) { + return EFI_INVALID_PARAMETER; + } + + while ((*Value % 2) == 0) { + *Value=*Value/2; + (*Exponent)++; + } + + return EFI_SUCCESS; +} + +/** + Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with '64k' + as the unit. + + @param Base2Data Pointer to Base2_Data + + @retval EFI_SUCCESS Transform successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +UINT16 +Base2ToByteWith64KUnit ( + IN EFI_EXP_BASE2_DATA *Base2Data + ) +{ + UINT16 Value; + UINT16 Exponent; + + Value = Base2Data->Value; + Exponent = Base2Data->Exponent; + Exponent -= 16; + Value <<= Exponent; + + return Value; +} + + +/** + This function makes boot time changes to the contents of the + MiscBiosVendor (Type 0). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) +{ + CHAR8 *OptionalStrStart; + UINTN VendorStrLen; + UINTN VerStrLen; + UINTN DateStrLen; + CHAR16 *Version; + CHAR16 *ReleaseDate; + CHAR16 BiosVersion[100]; //Assuming that strings are < 100 UCHAR + CHAR16 BiosReleaseDate[100]; //Assuming that strings are < 100 UCHAR + CHAR16 BiosReleaseTime[100]; //Assuming that strings are < 100 UCHAR + EFI_STATUS Status; + EFI_STRING Char16String; + STRING_REF TokenToGet; + STRING_REF TokenToUpdate; + SMBIOS_TABLE_TYPE0 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_MISC_BIOS_VENDOR *ForType0InputData; + BIOS_ID_IMAGE BiosIdImage; + UINT16 UVerStr[32]; + UINTN LoopIndex; + UINTN CopyIndex; + MANIFEST_OEM_DATA *IFWIVerStruct; + UINT8 *Data8 = NULL; + UINT16 SpaceVer[2]={0x0020,0x0000}; + UINT16 BIOSVersionTemp[100]; + + ForType0InputData = (EFI_MISC_BIOS_VENDOR *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + GetBiosId (&BiosIdImage); + + // + // Add VLV2 BIOS Version and Release data + // + SetMem(BiosVersion, sizeof(BiosVersion), 0); + SetMem(BiosReleaseDate, sizeof(BiosReleaseDate), 0); + SetMem(BiosReleaseTime, sizeof(BiosReleaseTime), 0); + Status = GetBiosVersionDateTime (BiosVersion, BiosReleaseDate, BiosReleaseTime); + DEBUG ((EFI_D_ERROR, "GetBiosVersionDateTime :%s %s %s \n", BiosVersion, BiosReleaseDate, BiosReleaseTime)); + if (StrLen (BiosVersion) > 0) { + TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION); + HiiSetString (mHiiHandle, TokenToUpdate, BiosVersion, NULL); + } + + if (StrLen(BiosReleaseDate) > 0) { + TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE); + HiiSetString (mHiiHandle, TokenToUpdate, BiosReleaseDate, NULL); + } + + TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VENDOR); + Char16String = SmbiosMiscGetString (TokenToGet); + VendorStrLen = StrLen(Char16String); + if (VendorStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION); + Version = SmbiosMiscGetString (TokenToGet); + + ZeroMem (UVerStr, 2*32); + ZeroMem (BIOSVersionTemp, 2*100); + StrCat (BIOSVersionTemp,Version); + Data8 = AllocatePool (SECTOR_SIZE_4KB); + ZeroMem (Data8, SECTOR_SIZE_4KB); + + Status = gBS->LocateProtocol ( + &gEfiSpiProtocolGuid, + NULL, + (VOID **)&mSpiProtocol + ); + if (!EFI_ERROR(Status)) { + // + // Get data form SPI ROM. + // + Status = FlashRead ( + MEM_IFWIVER_START, + Data8, + SECTOR_SIZE_4KB, + EnumSpiRegionAll + ); + if (!EFI_ERROR(Status)) { + for(LoopIndex = 0; LoopIndex <= SECTOR_SIZE_4KB; LoopIndex++) { + IFWIVerStruct = (MANIFEST_OEM_DATA *)(Data8 + LoopIndex); + if(IFWIVerStruct->Signature == SIGNATURE_32('$','F','U','D')) { + DEBUG ((EFI_D_ERROR, "the IFWI Length is:%d\n", IFWIVerStruct->IFWIVersionLen)); + if(IFWIVerStruct->IFWIVersionLen < 32) { + for(CopyIndex = 0; CopyIndex < IFWIVerStruct->IFWIVersionLen; CopyIndex++) { + UVerStr[CopyIndex] = (UINT16)IFWIVerStruct->IFWIVersion[CopyIndex]; + } + UVerStr[CopyIndex] = 0x0000; + DEBUG ((EFI_D_ERROR, "The IFWI Version is :%s,the IFWI Length is:%d\n", UVerStr,IFWIVerStruct->IFWIVersionLen)); + StrCat(BIOSVersionTemp,SpaceVer); + StrCat(BIOSVersionTemp,UVerStr); + DEBUG ((EFI_D_ERROR, "The BIOS and IFWI Version is :%s\n", BIOSVersionTemp)); + } + break; + } + } + } + } + FreePool(Data8); + + VerStrLen = StrLen(BIOSVersionTemp); + if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE); + ReleaseDate = SmbiosMiscGetString (TokenToGet); + DateStrLen = StrLen(ReleaseDate); + if (DateStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // Vendor will be the 1st optional string following the formatted structure. + // + SmbiosRecord->Vendor = 1; + + // + // Version will be the 2nd optional string following the formatted structure. + // + SmbiosRecord->BiosVersion = 2; + SmbiosRecord->BiosSegment = (UINT16)ForType0InputData->BiosStartingAddress; + + // + // ReleaseDate will be the 3rd optional string following the formatted structure. + // + SmbiosRecord->BiosReleaseDate = 3; + + // + // Tiger has no PCD value to indicate BIOS Size, just fill 0 for simply. + // + SmbiosRecord->BiosSize = 0; + SmbiosRecord->BiosCharacteristics = *(MISC_BIOS_CHARACTERISTICS*)(&ForType0InputData->BiosCharacteristics1); + + // + // CharacterExtensionBytes also store in ForType0InputData->BiosCharacteristics1 later two bytes to save size. + // + SmbiosRecord->BIOSCharacteristicsExtensionBytes[0] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 4); + SmbiosRecord->BIOSCharacteristicsExtensionBytes[1] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 5); + + SmbiosRecord->SystemBiosMajorRelease = ForType0InputData->BiosMajorRelease; + SmbiosRecord->SystemBiosMinorRelease = ForType0InputData->BiosMinorRelease; + SmbiosRecord->EmbeddedControllerFirmwareMajorRelease = ForType0InputData->BiosEmbeddedFirmwareMajorRelease; + SmbiosRecord->EmbeddedControllerFirmwareMinorRelease = ForType0InputData->BiosEmbeddedFirmwareMinorRelease; + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(Char16String, OptionalStrStart); + UnicodeStrToAsciiStr(BIOSVersionTemp, OptionalStrStart + VendorStrLen + 1); + UnicodeStrToAsciiStr(ReleaseDate, OptionalStrStart + VendorStrLen + 1 + VerStrLen + 1); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationData.c new file mode 100644 index 0000000000..43cad4b6f5 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationData.c @@ -0,0 +1,39 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBootInformationData.c + +Abstract: + + Static data of Boot information. + Boot information is Misc. subclass type 26 and SMBIOS type 32. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) += { + EfiBootInformationStatusNoError, // BootInformationStatus + 0 // BootInformationData +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationFunction.c new file mode 100644 index 0000000000..5a815c1ed6 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBootInformationFunction.c @@ -0,0 +1,87 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBootInformationFunction.c + +Abstract: + + boot information boot time changes. + SMBIOS type 32. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +/** + This function makes boot time changes to the contents of the + MiscBootInformation (Type 32). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ + +MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE32 *SmbiosRecord; + EFI_MISC_BOOT_INFORMATION_STATUS* ForType32InputData; + + ForType32InputData = (EFI_MISC_BOOT_INFORMATION_STATUS *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + SmbiosRecord->BootStatus = (UINT8)ForType32InputData->BootInformationStatus; + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturer.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturer.uni new file mode 100644 index 0000000000..f56d85a94e Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturer.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerData.c new file mode 100644 index 0000000000..dc750cd4fc --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerData.c @@ -0,0 +1,62 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscChassisManufacturerData.c + +Abstract: + + Static data is Chassis Manufacturer information. + Chassis Manufacturer information is Misc. subclass type 5 and SMBIOS type 3. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Chassis Manufacturer data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) += { + STRING_TOKEN(STR_MISC_CHASSIS_MANUFACTURER), // ChassisManufactrurer + STRING_TOKEN(STR_MISC_CHASSIS_VERSION), // ChassisVersion + STRING_TOKEN(STR_MISC_CHASSIS_SERIAL_NUMBER), // ChassisSerialNumber + STRING_TOKEN(STR_MISC_CHASSIS_ASSET_TAG), // ChassisAssetTag + { // ChassisTypeStatus + EfiMiscChassisTypeUnknown, // ChassisType + 0, // ChassisLockPresent + 0 // Reserved + }, + EfiChassisStateSafe, // ChassisBootupState + EfiChassisStateSafe, // ChassisPowerSupplyState + EfiChassisStateOther, // ChassisThermalState + EfiChassisSecurityStatusOther, // ChassisSecurityState + 0, // ChassisOemDefined + 0, // ChassisHeight + 0, // ChassisNumberPowerCords + 0, // ChassisElementCount + 0, // ChassisElementRecordLength + { // ChassisElements + {0, 0, 0}, // ChassisElementType + 0, // ChassisElementStructure + EfiBaseBoardTypeUnknown, // ChassisBaseBoard + 0, // ChassisElementMinimum + 0 // ChassisElementMaximum + }, +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c new file mode 100644 index 0000000000..f503a2a640 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c @@ -0,0 +1,155 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscChassisManufacturerFunction.c + +Abstract: + + Chassis manufacturer information boot time changes. + SMBIOS type 3. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +/** + This function makes boot time changes to the contents of the + MiscChassisManufacturer (Type 3). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) +{ + CHAR8 *OptionalStrStart; + UINTN ManuStrLen; + UINTN VerStrLen; + UINTN AssertTagStrLen; + UINTN SerialNumStrLen; + EFI_STATUS Status; + EFI_STRING Manufacturer; + EFI_STRING Version; + EFI_STRING SerialNumber; + EFI_STRING AssertTag; + STRING_REF TokenToGet; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE3 *SmbiosRecord; + EFI_MISC_CHASSIS_MANUFACTURER *ForType3InputData; + + ForType3InputData = (EFI_MISC_CHASSIS_MANUFACTURER *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_MANUFACTURER); + Manufacturer = SmbiosMiscGetString (TokenToGet); + ManuStrLen = StrLen(Manufacturer); + if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_VERSION); + Version = SmbiosMiscGetString (TokenToGet); + VerStrLen = StrLen(Version); + if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_SERIAL_NUMBER); + SerialNumber = SmbiosMiscGetString (TokenToGet); + SerialNumStrLen = StrLen(SerialNumber); + if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_ASSET_TAG); + AssertTag = SmbiosMiscGetString (TokenToGet); + AssertTagStrLen = StrLen(AssertTag); + if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // Manu will be the 1st optional string following the formatted structure. + // + SmbiosRecord->Manufacturer = 1; + SmbiosRecord->Type = (UINT8)ForType3InputData->ChassisType.ChassisType; + + // + // Version will be the 2nd optional string following the formatted structure. + // + SmbiosRecord->Version = 2; + + // + // SerialNumber will be the 3rd optional string following the formatted structure. + // + SmbiosRecord->SerialNumber = 3; + + // + // AssertTag will be the 4th optional string following the formatted structure. + // + SmbiosRecord->AssetTag = 4; + SmbiosRecord->BootupState = (UINT8)ForType3InputData->ChassisBootupState; + SmbiosRecord->PowerSupplyState = (UINT8)ForType3InputData->ChassisPowerSupplyState; + SmbiosRecord->ThermalState = (UINT8)ForType3InputData->ChassisThermalState; + SmbiosRecord->SecurityStatus = (UINT8)ForType3InputData->ChassisSecurityState; + CopyMem (SmbiosRecord->OemDefined,(UINT8*)&ForType3InputData->ChassisOemDefined, 4); + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); + UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1); + UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1); + UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDevice.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDevice.uni new file mode 100644 index 0000000000..15b05b10c4 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDevice.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceData.c new file mode 100644 index 0000000000..9c22ba81b6 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceData.c @@ -0,0 +1,50 @@ +/*++ + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscMemoryDeviceData.c + +Abstract: + + Memory Device + Misc. subclass type 17. + SMBIOS type 17. + +--*/ + + +#include "CommonHeader.h" +#include "MiscSubclassDriver.h" + +MISC_SMBIOS_TABLE_DATA(EFI_MEMORY_ARRAY_LINK_DATA, MiscMemoryDevice) = { + STRING_TOKEN (STR_MISC_MEM_DEV_LOCATOR0), // Memory Device locator + STRING_TOKEN (STR_MISC_MEM_BANK_LOCATOR0), // Memory Bank Locator + STRING_TOKEN (STR_MISC_MEM_MANUFACTURER), // Memory manufacturer + STRING_TOKEN (STR_MISC_MEM_SERIAL_NO), // Memory serial Number + STRING_TOKEN (STR_MISC_MEM_ASSET_TAG), // Memory Asset Tag + STRING_TOKEN (STR_MISC_MEM_PART_NUMBER), // Memory Part Number + 0, // Memory Array Link + 0, // Memory SubArray link + 0, // UINT16 MemoryTotalWidth + 0, // UINT16 MemoryDatawidth + 0, // Memory Device Size + EfiMemoryFormFactorDip, // Memory Form Factor + 2, // UINT8 Memory Device type + EfiMemoryTypeDram, // Memory Type + 0, // Memory Type Detail + 0, // Memory Speed + 0 // Memory State + +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c new file mode 100644 index 0000000000..0f3f4d6a90 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c @@ -0,0 +1,324 @@ +/*++ + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscMemoryDeviceFunction.c + +Abstract: + + Memory Device + Misc. subclass type 17. + SMBIOS type 17. + +--*/ + + +#include "CommonHeader.h" +#include "MiscSubclassDriver.h" +#include +#include +#include + + +#define FREQ_800 0x00 +#define FREQ_1066 0x01 +#define FREQ_1333 0x02 +#define FREQ_1600 0x03 + +#define MAX_SOCKETS 2 +#define EfiMemoryTypeDdr3 0x18 + +enum { + DDRType_DDR3 = 0, + DDRType_DDR3L = 1, + DDRType_DDR3U = 2, + DDRType_DDR3All = 3, + DDRType_LPDDR2 = 4, + DDRType_LPDDR3 = 5, + DDRType_DDR4 = 6 +}; + + +typedef struct { + EFI_PHYSICAL_ADDRESS MemoryArrayStartAddress; + EFI_PHYSICAL_ADDRESS MemoryArrayEndAddress; + EFI_INTER_LINK_DATA PhysicalMemoryArrayLink; + UINT16 MemoryArrayPartitionWidth; +} EFI_MEMORY_ARRAY_START_ADDRESS; + +/** + This function makes boot time changes to the contents of the + MiscBiosVendor (Type 0). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +VOID +GetType16Hndl ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + OUT EFI_SMBIOS_HANDLE *Handle + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_TYPE RecordType; + EFI_SMBIOS_TABLE_HEADER *Buffer; + + *Handle = 0; + RecordType = EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY; + + Status = Smbios->GetNext ( + Smbios, + Handle, + &RecordType, + &Buffer, + NULL + ); + if (!EFI_ERROR(Status)) { + return; + } + *Handle = 0xFFFF; +} + +MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) +{ + CHAR8 *OptionalStrStart; + UINTN MemDeviceStrLen; + UINTN MemBankLocatorStrLen; + UINTN MemManufacturerStrLen; + UINTN MemSerialNumberStrLen; + UINTN MemAssetTagStrLen; + UINTN MemPartNumberStrLen; + CHAR16 *MemDevice; + CHAR16 *MemBankLocator; + CHAR16 *MemManufacturer; + CHAR16 *MemSerialNumber; + CHAR16 *MemAssetTag; + CHAR16 *MemPartNumber; + EFI_STATUS Status; + STRING_REF TokenToGet; + SMBIOS_TABLE_TYPE17 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_MEMORY_ARRAY_LINK_DATA *ForType17InputData; + UINT16 DdrFreq=0; + UINT16 Type16Handle=0; + MEM_INFO_PROTOCOL *MemInfoHob; + UINT8 MemoryType; + + UINT8 Dimm; + UINT8 NumSlots; + STRING_REF DevLocator[] = { + STRING_TOKEN(STR_MISC_MEM_DEV_LOCATOR0), STRING_TOKEN(STR_MISC_MEM_DEV_LOCATOR1) + }; + STRING_REF BankLocator[] = { + STRING_TOKEN(STR_MISC_MEM_BANK_LOCATOR0), STRING_TOKEN(STR_MISC_MEM_BANK_LOCATOR1) + }; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + ForType17InputData = (EFI_MEMORY_ARRAY_LINK_DATA *)RecordData; + + // + // Get Memory size parameters for each rank from the chipset registers + // + Status = gBS->LocateProtocol ( + &gMemInfoProtocolGuid, + NULL, + (void **)&MemInfoHob + ); + ASSERT_EFI_ERROR (Status); + + NumSlots = (UINT8)(MAX_SOCKETS); + + // + // Memory Freq + // + switch (MemInfoHob->MemInfoData.ddrFreq){ + case FREQ_800: + DdrFreq = 800; + break; + case FREQ_1066: + DdrFreq = 1066; + break; + case FREQ_1333: + DdrFreq = 1333; + break; + case FREQ_1600: + DdrFreq = 1600; + break; + default: + DdrFreq = 0; + break; + } + + // + // Memory Type + // + switch (MemInfoHob->MemInfoData.ddrType) { + case DDRType_LPDDR2: + MemoryType = EfiMemoryTypeDdr2; + break; + case DDRType_DDR3: + case DDRType_DDR3L: + case DDRType_DDR3U: + case DDRType_LPDDR3: + MemoryType = EfiMemoryTypeDdr3; + break; + default: + MemoryType = EfiMemoryTypeUnknown; + break; + } + + for (Dimm = 0; Dimm < NumSlots; Dimm++) { + // + // Memory Device Locator + // + TokenToGet = DevLocator[Dimm]; + MemDevice = SmbiosMiscGetString (TokenToGet); + MemDeviceStrLen = StrLen(MemDevice); + if (MemDeviceStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = DevLocator[Dimm]; + MemDevice = SmbiosMiscGetString (TokenToGet); + MemDeviceStrLen = StrLen(MemDevice); + if (MemDeviceStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Memory Bank Locator + // + TokenToGet = BankLocator[Dimm]; + MemBankLocator = SmbiosMiscGetString (TokenToGet); + MemBankLocatorStrLen = StrLen(MemBankLocator); + if (MemBankLocatorStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Memory Manufacturer + // + TokenToGet = STRING_TOKEN (STR_MISC_MEM_MANUFACTURER); + MemManufacturer = SmbiosMiscGetString (TokenToGet); + MemManufacturerStrLen = StrLen(MemManufacturer); + if (MemManufacturerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Memory Serial Number + // + TokenToGet = STRING_TOKEN (STR_MISC_MEM_SERIAL_NO); + MemSerialNumber = SmbiosMiscGetString (TokenToGet); + MemSerialNumberStrLen = StrLen(MemSerialNumber); + if (MemSerialNumberStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Memory Asset Tag Number + // + TokenToGet = STRING_TOKEN (STR_MISC_MEM_ASSET_TAG); + MemAssetTag = SmbiosMiscGetString (TokenToGet); + MemAssetTagStrLen = StrLen(MemAssetTag); + if (MemAssetTagStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Memory Part Number + // + TokenToGet = STRING_TOKEN (STR_MISC_MEM_PART_NUMBER); + MemPartNumber = SmbiosMiscGetString (TokenToGet); + MemPartNumberStrLen = StrLen(MemPartNumber); + if (MemPartNumberStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE17) + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE17) + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE17); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // Memory Array Handle will be the 3rd optional string following the formatted structure. + // + GetType16Hndl( Smbios, &Type16Handle); + SmbiosRecord->MemoryArrayHandle = Type16Handle; + + // + // Memory Size + // + if ((MemInfoHob->MemInfoData.dimmSize[Dimm])!=0){ + SmbiosRecord->TotalWidth = 32; + SmbiosRecord->DataWidth = 32; + SmbiosRecord->Size = MemInfoHob->MemInfoData.dimmSize[Dimm]; + SmbiosRecord->Speed = DdrFreq; + SmbiosRecord->ConfiguredMemoryClockSpeed = DdrFreq; + SmbiosRecord->FormFactor = EfiMemoryFormFactorDimm; + } + + SmbiosRecord->DeviceSet =(UINT8) ForType17InputData->MemoryDeviceSet; + SmbiosRecord->DeviceLocator= 1; + SmbiosRecord->BankLocator = 2; + + + SmbiosRecord->Manufacturer = 3; + SmbiosRecord->SerialNumber= 4; + SmbiosRecord->AssetTag= 5; + SmbiosRecord->PartNumber= 6; + SmbiosRecord->Attributes = (UINT8) ForType17InputData->MemoryState; + SmbiosRecord->MemoryType = MemoryType; + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(MemDevice, OptionalStrStart); + UnicodeStrToAsciiStr(MemBankLocator, OptionalStrStart + MemDeviceStrLen + 1); + UnicodeStrToAsciiStr(MemManufacturer, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1); + UnicodeStrToAsciiStr(MemSerialNumber, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1); + UnicodeStrToAsciiStr(MemAssetTag, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1); + UnicodeStrToAsciiStr(MemPartNumber, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1+ MemAssetTagStrLen+1 ); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + } + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesData.c new file mode 100644 index 0000000000..311f747c93 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesData.c @@ -0,0 +1,43 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscNumberOfInstallableLanguagesData.c + +Abstract: + + Static data of the Number of installable languages information. + Number of installable languages information is Misc. subclass type 11 and SMBIOS type 13. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages) += { + 1, // NumberOfInstallableLanguages + { // LanguageFlags + 1, // AbbreviatedLanguageFormat + 0 // Reserved + }, + STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_EN_US) // CurrentLanguageNumber +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c new file mode 100644 index 0000000000..7cf3453a62 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c @@ -0,0 +1,254 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscNumberOfInstallableLanguagesFunction.c + +Abstract: + + This driver parses the mSmbiosMiscDataTable structure and reports + any generated data. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +/** + Check whether the language is supported for given HII handle + + @param HiiHandle The HII package list handle. + @param Offset The offest of current lanague in the supported languages. + @param CurrentLang The language code. + + @retval TRUE Supported. + @retval FALSE Not Supported. + +**/ +VOID +EFIAPI +CurrentLanguageMatch ( + IN EFI_HII_HANDLE HiiHandle, + OUT UINT16 *Offset, + OUT CHAR8 *CurrentLang + ) +{ + CHAR8 *DefaultLang; + CHAR8 *BestLanguage; + CHAR8 *Languages; + CHAR8 *MatchLang; + CHAR8 *EndMatchLang; + UINTN CompareLength; + + Languages = HiiGetSupportedLanguages (HiiHandle); + if (Languages == NULL) { + return; + } + + CurrentLang = GetEfiGlobalVariable (L"PlatformLang"); + DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang); + BestLanguage = GetBestLanguage ( + Languages, + FALSE, + (CurrentLang != NULL) ? CurrentLang : "", + DefaultLang, + NULL + ); + if (BestLanguage != NULL) { + // + // Find the best matching RFC 4646 language, compute the offset. + // + CompareLength = AsciiStrLen (BestLanguage); + for (MatchLang = Languages, (*Offset) = 0; MatchLang != '\0'; (*Offset)++) { + // + // Seek to the end of current match language. + // + for (EndMatchLang = MatchLang; *EndMatchLang != '\0' && *EndMatchLang != ';'; EndMatchLang++); + + if ((EndMatchLang == MatchLang + CompareLength) && AsciiStrnCmp(MatchLang, BestLanguage, CompareLength) == 0) { + // + // Find the current best Language in the supported languages + // + break; + } + // + // best language match be in the supported language. + // + ASSERT (*EndMatchLang == ';'); + MatchLang = EndMatchLang + 1; + } + FreePool (BestLanguage); + } + + FreePool (Languages); + if (CurrentLang != NULL) { + FreePool (CurrentLang); + } + return ; +} + + +/** + Get next language from language code list (with separator ';'). + + @param LangCode Input: point to first language in the list. On + Otput: point to next language in the list, or + NULL if no more language in the list. + @param Lang The first language in the list. + +**/ +VOID +EFIAPI +GetNextLanguage ( + IN OUT CHAR8 **LangCode, + OUT CHAR8 *Lang + ) +{ + UINTN Index; + CHAR8 *StringPtr; + + ASSERT (LangCode != NULL); + ASSERT (*LangCode != NULL); + ASSERT (Lang != NULL); + + Index = 0; + StringPtr = *LangCode; + while (StringPtr[Index] != 0 && StringPtr[Index] != ';') { + Index++; + } + + CopyMem (Lang, StringPtr, Index); + Lang[Index] = 0; + + if (StringPtr[Index] == ';') { + Index++; + } + *LangCode = StringPtr + Index; +} + +/** + This function returns the number of supported languages on HiiHandle. + + @param HiiHandle The HII package list handle. + + @retval The number of supported languages. + +**/ +UINT16 +EFIAPI +GetSupportedLanguageNumber ( + IN EFI_HII_HANDLE HiiHandle + ) +{ + CHAR8 *Lang; + CHAR8 *Languages; + CHAR8 *LanguageString; + UINT16 LangNumber; + + Languages = HiiGetSupportedLanguages (HiiHandle); + if (Languages == NULL) { + return 0; + } + + LangNumber = 0; + Lang = AllocatePool (AsciiStrSize (Languages)); + if (Lang != NULL) { + LanguageString = Languages; + while (*LanguageString != 0) { + GetNextLanguage (&LanguageString, Lang); + LangNumber++; + } + FreePool (Lang); + } + FreePool (Languages); + return LangNumber; +} + + +/** + This function makes boot time changes to the contents of the + MiscNumberOfInstallableLanguages (Type 13). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages) +{ + UINTN LangStrLen; + CHAR8 CurrentLang[SMBIOS_STRING_MAX_LENGTH + 1]; + CHAR8 *OptionalStrStart; + UINT16 Offset; + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE13 *SmbiosRecord; + EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *ForType13InputData; + + ForType13InputData = (EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + ForType13InputData->NumberOfInstallableLanguages = GetSupportedLanguageNumber (mHiiHandle); + + // + // Try to check if current langcode matches with the langcodes in installed languages + // + ZeroMem(CurrentLang, SMBIOS_STRING_MAX_LENGTH + 1); + CurrentLanguageMatch (mHiiHandle, &Offset, CurrentLang); + LangStrLen = AsciiStrLen(CurrentLang); + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + SmbiosRecord->InstallableLanguages = (UINT8)ForType13InputData->NumberOfInstallableLanguages; + SmbiosRecord->Flags = (UINT8)ForType13InputData->LanguageFlags.AbbreviatedLanguageFormat; + SmbiosRecord->CurrentLanguages = 1; + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + AsciiStrCpy(OptionalStrStart, CurrentLang); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemString.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemString.uni new file mode 100644 index 0000000000..2162a79736 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemString.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringData.c new file mode 100644 index 0000000000..294be040af --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringData.c @@ -0,0 +1,39 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscOemStringData.c + +Abstract: + + Static data of OEM String information. + OEM String information is Misc. subclass type 9 and SMBIOS type 11. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_STRING, MiscOemString) = { + STRING_TOKEN(STR_INTEL_ETK_VER) +}; +MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) += { STRING_TOKEN(STR_MISC_OEM_EN_US) }; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c new file mode 100644 index 0000000000..b53777cb0c --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c @@ -0,0 +1,94 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + +Module Name: + + MiscOemStringFunction.c + +Abstract: + + boot information boot time changes. + SMBIOS type 11. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +/** + This function makes boot time changes to the contents of the + MiscOemString (Type 11). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(OemString) +{ + UINTN OemStrLen; + CHAR8 *OptionalStrStart; + EFI_STATUS Status; + EFI_STRING OemStr; + STRING_REF TokenToGet; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE11 *SmbiosRecord; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = STRING_TOKEN (STR_MISC_OEM_EN_US); + OemStr = SmbiosMiscGetString (TokenToGet); + OemStrLen = StrLen(OemStr); + if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + SmbiosRecord->StringCount = 1; + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(OemStr, OptionalStrStart); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90.uni new file mode 100644 index 0000000000..3b49a6e28e Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Data.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Data.c new file mode 100644 index 0000000000..f45650ad3c --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Data.c @@ -0,0 +1,41 @@ +/*++ + +Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved. + + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + + +Module Name: + + MiscOemType0x90Data.c + +Abstract: + + This file contains the Misc Oem Data (SMBIOS data type 0x90) + +--*/ + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +// +// Static (possibly build generated) Oem data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_TYPE_0x90, MiscOemType0x90) = { + +STRING_TOKEN (STR_MISC_SEC_VERSION), +STRING_TOKEN (STR_MISC_UCODE_VERSION), +STRING_TOKEN (STR_MISC_GOP_VERSION), +STRING_TOKEN (STR_MISC_PROCESSOR_STEPPING), + +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c new file mode 100644 index 0000000000..2d0bf8b331 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c @@ -0,0 +1,452 @@ +/*++ + +Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved. + + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + + +Module Name: + + MiscOemType0x88Function.c + +Abstract: + + The function that processes the Smbios data type 0x88 before they + are submitted to Data Hub + +--*/ + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" +#include +#include +#include + + +VOID +GetCPUStepping ( ) +{ + CHAR16 Buffer[40]; + + UINT16 FamilyId; + UINT8 Model; + UINT8 SteppingId; + UINT8 ProcessorType; + + + EfiCpuVersion (&FamilyId, &Model, &SteppingId, &ProcessorType); + + // + //we need raw Model data + // + Model = Model & 0xf; + + // + //Family/Model/Step + // + UnicodeSPrint (Buffer, sizeof (Buffer), L"%d/%d/%d", FamilyId, Model, SteppingId); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_PROCESSOR_STEPPING), Buffer, NULL); + +} + +EFI_STATUS +SearchChildHandle( + EFI_HANDLE Father, + EFI_HANDLE *Child + ) +{ + EFI_STATUS Status; + UINTN HandleIndex; + EFI_GUID **ProtocolGuidArray = NULL; + UINTN ArrayCount; + UINTN ProtocolIndex; + UINTN OpenInfoCount; + UINTN OpenInfoIndex; + EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo = NULL; + UINTN mHandleCount; + EFI_HANDLE *mHandleBuffer= NULL; + + // + // Retrieve the list of all handles from the handle database + // + Status = gBS->LocateHandleBuffer ( + AllHandles, + NULL, + NULL, + &mHandleCount, + &mHandleBuffer + ); + + for (HandleIndex = 0; HandleIndex < mHandleCount; HandleIndex++) { + // + // Retrieve the list of all the protocols on each handle + // + Status = gBS->ProtocolsPerHandle ( + mHandleBuffer[HandleIndex], + &ProtocolGuidArray, + &ArrayCount + ); + if (!EFI_ERROR (Status)) { + for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { + Status = gBS->OpenProtocolInformation ( + mHandleBuffer[HandleIndex], + ProtocolGuidArray[ProtocolIndex], + &OpenInfo, + &OpenInfoCount + ); + + if (!EFI_ERROR (Status)) { + for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { + if(OpenInfo[OpenInfoIndex].AgentHandle == Father) { + if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) { + *Child = mHandleBuffer[HandleIndex]; + Status = EFI_SUCCESS; + goto TryReturn; + } + } + } + Status = EFI_NOT_FOUND; + } + } + if(OpenInfo != NULL) { + FreePool(OpenInfo); + OpenInfo = NULL; + } + } + if(ProtocolGuidArray != NULL) { + FreePool (ProtocolGuidArray); + ProtocolGuidArray = NULL; + } + } +TryReturn: + if(OpenInfo != NULL) { + FreePool (OpenInfo); + OpenInfo = NULL; + } + if(ProtocolGuidArray != NULL) { + FreePool(ProtocolGuidArray); + ProtocolGuidArray = NULL; + } + if(mHandleBuffer != NULL) { + FreePool (mHandleBuffer); + mHandleBuffer = NULL; + } + return Status; +} + +EFI_STATUS +JudgeHandleIsPCIDevice( + EFI_HANDLE Handle, + UINT8 Device, + UINT8 Funs + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH *DPath; + EFI_DEVICE_PATH *DevicePath; + + Status = gBS->HandleProtocol ( + Handle, + &gEfiDevicePathProtocolGuid, + (VOID **) &DPath + ); + if(!EFI_ERROR(Status)) { + DevicePath = DPath; + while(!IsDevicePathEnd(DPath)) { + if((DPath->Type == HARDWARE_DEVICE_PATH) && (DPath->SubType == HW_PCI_DP)) { + PCI_DEVICE_PATH *PCIPath; + PCIPath = (PCI_DEVICE_PATH*) DPath; + DPath = NextDevicePathNode(DPath); + + if(IsDevicePathEnd(DPath) && (PCIPath->Device == Device) && (PCIPath->Function == Funs)) { + return EFI_SUCCESS; + } + } else { + DPath = NextDevicePathNode(DPath); + } + } + } + return EFI_UNSUPPORTED; +} + +EFI_STATUS +GetDriverName( + EFI_HANDLE Handle +) +{ + EFI_DRIVER_BINDING_PROTOCOL *BindHandle = NULL; + EFI_STATUS Status; + UINT32 Version; + UINT16 *Ptr; + CHAR16 Buffer[40]; + STRING_REF TokenToUpdate; + Status = gBS->OpenProtocol( + Handle, + &gEfiDriverBindingProtocolGuid, + (VOID**)&BindHandle, + NULL, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR(Status)) { + return EFI_NOT_FOUND; + } + + Version = BindHandle->Version; + Ptr = (UINT16*)&Version; + UnicodeSPrint(Buffer, sizeof (Buffer), L"%d.%d.%d", Version >> 24 , (Version >>16)& 0x0f ,*(Ptr)); + + TokenToUpdate = (STRING_REF)STR_MISC_GOP_VERSION; + HiiSetString(mHiiHandle, TokenToUpdate, Buffer, NULL); + + return EFI_SUCCESS; +} + +EFI_STATUS +GetGOPDriverName() +{ + UINTN HandleCount; + EFI_HANDLE *Handles= NULL; + UINTN Index; + EFI_STATUS Status; + EFI_HANDLE Child = 0; + + Status = gBS->LocateHandleBuffer( + ByProtocol, + &gEfiDriverBindingProtocolGuid, + NULL, + &HandleCount, + &Handles + ); + + for (Index = 0; Index < HandleCount ; Index++) { + Status = SearchChildHandle(Handles[Index], &Child); + if(!EFI_ERROR(Status)) { + Status = JudgeHandleIsPCIDevice(Child, 0x02, 0x00); + if(!EFI_ERROR(Status)) { + return GetDriverName(Handles[Index]); + } + } + } + return EFI_UNSUPPORTED; +} + +VOID +GetUcodeVersion() +{ + UINT32 MicroCodeVersion; + CHAR16 Buffer[40]; + + // + // Microcode Revision + // + EfiWriteMsr (EFI_MSR_IA32_BIOS_SIGN_ID, 0); + EfiCpuid (EFI_CPUID_VERSION_INFO, NULL); + MicroCodeVersion = (UINT32) RShiftU64 (EfiReadMsr (EFI_MSR_IA32_BIOS_SIGN_ID), 32); + UnicodeSPrint (Buffer, sizeof (Buffer), L"%x", MicroCodeVersion); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_UCODE_VERSION), Buffer, NULL); +} + +/** + Publish the smbios OEM type 0x90. + + @param Event - Event whose notification function is being invoked (gEfiDxeSmmReadyToLockProtocolGuid). + @param Context - Pointer to the notification functions context, which is implementation dependent. + + @retval None + +**/ +EFI_STATUS +EFIAPI +AddSmbiosT0x90Callback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + UINTN SECVerStrLen = 0; + UINTN uCodeVerStrLen = 0; + UINTN GOPStrLen = 0; + UINTN SteppingStrLen = 0; + SMBIOS_TABLE_TYPE90 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_MISC_OEM_TYPE_0x90 *ForType90InputData; + CHAR16 *SECVer; + CHAR16 *uCodeVer; + CHAR16 *GOPVer; + CHAR16 *Stepping; + STRING_REF TokenToGet; + CHAR8 *OptionalStrStart; + EFI_SMBIOS_PROTOCOL *SmbiosProtocol; + + ForType90InputData = (EFI_MISC_OEM_TYPE_0x90 *)Context; + + DEBUG ((EFI_D_INFO, "Executing SMBIOS T0x90 callback.\n")); + + gBS->CloseEvent (Event); // Unload this event. + + // + // First check for invalid parameters. + // + if (Context == NULL) { + return EFI_INVALID_PARAMETER; + } + + Status = gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID *) &SmbiosProtocol + ); + ASSERT_EFI_ERROR (Status); + + GetUcodeVersion(); + GetGOPDriverName(); + GetCPUStepping(); + + TokenToGet = STRING_TOKEN (STR_MISC_SEC_VERSION); + SECVer = SmbiosMiscGetString (TokenToGet); + SECVerStrLen = StrLen(SECVer); + if (SECVerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_UCODE_VERSION); + uCodeVer = SmbiosMiscGetString (TokenToGet); + uCodeVerStrLen = StrLen(uCodeVer); + if (uCodeVerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_GOP_VERSION); + GOPVer = SmbiosMiscGetString (TokenToGet); + GOPStrLen = StrLen(GOPVer); + if (GOPStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_PROCESSOR_STEPPING); + Stepping = SmbiosMiscGetString (TokenToGet); + SteppingStrLen = StrLen(Stepping); + + + if (SteppingStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE90) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE90) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_FIRMWARE_VERSION_INFO; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE90); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // SEC VERSION will be the 1st optional string following the formatted structure. + // + SmbiosRecord->SECVersion = 0; + + // + // Microcode VERSION will be the 2nd optional string following the formatted structure. + // + SmbiosRecord->uCodeVersion = 2; + + // + // GOP VERSION will be the 3rd optional string following the formatted structure. + // + SmbiosRecord->GOPVersion = 3; + + // + // CPU Stepping will be the 4th optional string following the formatted structure. + // + SmbiosRecord->CpuStepping = 4; + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(SECVer, OptionalStrStart); + UnicodeStrToAsciiStr(uCodeVer, OptionalStrStart + SECVerStrLen + 1); + UnicodeStrToAsciiStr(GOPVer, OptionalStrStart + SECVerStrLen + 1 + uCodeVerStrLen + 1); + UnicodeStrToAsciiStr(Stepping, OptionalStrStart + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = SmbiosProtocol-> Add( + SmbiosProtocol, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + + FreePool(SmbiosRecord); + return Status; +} + + +/** + This function makes boot time changes to the contents of the + MiscOemType0x90 (Type 0x90). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscOemType0x90) +{ + EFI_STATUS Status; + static BOOLEAN CallbackIsInstalledT0x90 = FALSE; + VOID *AddSmbiosT0x90CallbackNotifyReg; + EFI_EVENT AddSmbiosT0x90CallbackEvent; + + // + // This callback will create a OEM Type 0x90 record. + // + if (CallbackIsInstalledT0x90 == FALSE) { + CallbackIsInstalledT0x90 = TRUE; // Prevent more than 1 callback. + DEBUG ((EFI_D_INFO, "Create Smbios T0x90 callback.\n")); + + // + // gEfiDxeSmmReadyToLockProtocolGuid is ready + // + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + (EFI_EVENT_NOTIFY)AddSmbiosT0x90Callback, + RecordData, + &AddSmbiosT0x90CallbackEvent + ); + + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + + } + + Status = gBS->RegisterProtocolNotify ( + &gEfiDxeSmmReadyToLockProtocolGuid, + AddSmbiosT0x90CallbackEvent, + &AddSmbiosT0x90CallbackNotifyReg + ); + + return Status; + } + + return EFI_SUCCESS; + +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94.uni new file mode 100644 index 0000000000..061ad6ab66 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Data.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Data.c new file mode 100644 index 0000000000..94847d5ed5 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Data.c @@ -0,0 +1,59 @@ +/*++ + +Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved. + + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + + +Module Name: + + MiscOemType0x94Data.c + +Abstract: + + This file contains the Misc version Data (SMBIOS data type 0x94) + +--*/ + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +// +// Static (possibly build generated) Oem data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_TYPE_0x94, MiscOemType0x94) = { + +STRING_TOKEN (STR_MISC_GOP_VERSION), +STRING_TOKEN (STR_MISC_SEC_VERSION), +STRING_TOKEN (STR_MISC_MRC_VERSION_VALUE), +STRING_TOKEN (STR_MISC_UCODE_VERSION), +STRING_TOKEN (STR_MISC_PUNIT_FW_VALUE), +STRING_TOKEN (STR_MISC_PMC_FW_VALUE), +STRING_TOKEN (STR_MISC_ULPMC_FW_VALUE), +STRING_TOKEN (STR_MISC_SOC_VALUE), +STRING_TOKEN (STR_MISC_BOARD_ID_VALUE), +STRING_TOKEN (STR_MISC_FAB_ID_VALUE), +STRING_TOKEN (STR_MISC_CPU_FLAVOR_VALUE), +STRING_TOKEN (STR_MISC_BIOS_VERSION), +STRING_TOKEN (STR_MISC_PMIC_VERSION), +STRING_TOKEN (STR_MISC_TOUCH_VERSION), +STRING_TOKEN (STR_MISC_SECURE_BOOT), +STRING_TOKEN (STR_MISC_BOOT_MODE), +STRING_TOKEN (STR_MISC_SPEED_STEP), +STRING_TOKEN (STR_MISC_CPU_TURBO), +STRING_TOKEN (STR_MISC_CSTATE), +STRING_TOKEN (STR_MISC_GFX_TURBO), +STRING_TOKEN (STR_MISC_S0IX_VALUE), +STRING_TOKEN (STR_MISC_RC6_VALUE), + +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c new file mode 100644 index 0000000000..898fc7cf0d --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c @@ -0,0 +1,1223 @@ +/*++ + +Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved. + + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + + +Module Name: + + MiscOemType0x94Function.c + +Abstract: + + The function that processes the Smbios data type 0x94. + +--*/ + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "Valleyview.h" +#include "VlvAccess.h" +#include "PchAccess.h" +#include "SetupMode.h" +#include "PchCommonDefinitions.h" +#include + +typedef struct { + UINT8 RevId; + CHAR8 String[16]; +} SB_REV; + +// +// Silicon Steppings +// +SB_REV SBRevisionTable[] = { + {V_PCH_LPC_RID_0, "(A0 Stepping)"}, + {V_PCH_LPC_RID_1, "(A0 Stepping)"}, + {V_PCH_LPC_RID_2, "(A1 Stepping)"}, + {V_PCH_LPC_RID_3, "(A1 Stepping)"}, + {V_PCH_LPC_RID_4, "(B0 Stepping)"}, + {V_PCH_LPC_RID_5, "(B0 Stepping)"}, + {V_PCH_LPC_RID_6, "(B1 Stepping)"}, + {V_PCH_LPC_RID_7, "(B1 Stepping)"}, + {V_PCH_LPC_RID_8, "(B2 Stepping)"}, + {V_PCH_LPC_RID_9, "(B2 Stepping)"}, + {V_PCH_LPC_RID_A, "(B3 Stepping)"}, + {V_PCH_LPC_RID_B, "(B3 Stepping)"} +}; + +#define LEFT_JUSTIFY 0x01 +#define PREFIX_SIGN 0x02 +#define PREFIX_BLANK 0x04 +#define COMMA_TYPE 0x08 +#define LONG_TYPE 0x10 +#define PREFIX_ZERO 0x20 + +#define ICH_REG_REV 0x08 +#define MSR_IA32_PLATFORM_ID 0x17 +#define CHARACTER_NUMBER_FOR_VALUE 30 + + +UINT8 ReadBuffer[20]; //Version report length +UINT8 WriteBuffer[22] = {0x40,0x01,0x14,0x00,0x06,0x51,0x02,0x07,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //Version request + +/** + + VSPrint worker function that prints a Value as a decimal number in Buffer + + @param Buffer Location to place ascii decimal number string of Value. + @param Value Decimal value to convert to a string in Buffer. + @param Flags Flags to use in printing decimal string, see file header for details. + @param Width Width of hex value. + + @retval Number of characters printed. + +**/ +UINTN +EfiValueToString ( + IN OUT CHAR16 *Buffer, + IN INT64 Value, + IN UINTN Flags, + IN UINTN Width + ) +{ + CHAR16 TempBuffer[CHARACTER_NUMBER_FOR_VALUE]; + CHAR16 *TempStr; + CHAR16 *BufferPtr; + UINTN Count; + UINTN ValueCharNum; + UINTN Remainder; + CHAR16 Prefix; + UINTN Index; + BOOLEAN ValueIsNegative; + UINT64 TempValue; + + TempStr = TempBuffer; + BufferPtr = Buffer; + Count = 0; + ValueCharNum = 0; + ValueIsNegative = FALSE; + + if (Width > CHARACTER_NUMBER_FOR_VALUE - 1) { + Width = CHARACTER_NUMBER_FOR_VALUE - 1; + } + + if (Value < 0) { + Value = -Value; + ValueIsNegative = TRUE; + } + + do { + TempValue = Value; + Value = (INT64)DivU64x32 ((UINT64)Value, 10); + Remainder = (UINTN)((UINT64)TempValue - 10 * Value); + *(TempStr++) = (CHAR16)(Remainder + '0'); + ValueCharNum++; + Count++; + if ((Flags & COMMA_TYPE) == COMMA_TYPE) { + if (ValueCharNum % 3 == 0 && Value != 0) { + *(TempStr++) = ','; + Count++; + } + } + } while (Value != 0); + + if (ValueIsNegative) { + *(TempStr++) = '-'; + Count++; + } + + if ((Flags & PREFIX_ZERO) && !ValueIsNegative) { + Prefix = '0'; + } else { + Prefix = ' '; + } + + Index = Count; + if (!(Flags & LEFT_JUSTIFY)) { + for (; Index < Width; Index++) { + *(TempStr++) = Prefix; + } + } + + // + // Reverse temp string into Buffer. + // + if (Width > 0 && (UINTN) (TempStr - TempBuffer) > Width) { + TempStr = TempBuffer + Width; + } + Index = 0; + while (TempStr != TempBuffer) { + *(BufferPtr++) = *(--TempStr); + Index++; + } + + *BufferPtr = 0; + return Index; +} + +static CHAR16 mHexStr[] = { L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', + L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F' }; +/** + VSPrint worker function that prints a Value as a hex number in Buffer + + @param Buffer Location to place ascii hex string of Value. + @param Value Hex value to convert to a string in Buffer. + @param Flags Flags to use in printing Hex string, see file header for details. + @param Width Width of hex value. + + @retval Number of characters printed. + +**/ +UINTN +EfiValueToHexStr ( + IN OUT CHAR16 *Buffer, + IN UINT64 Value, + IN UINTN Flags, + IN UINTN Width + ) +{ + CHAR16 TempBuffer[CHARACTER_NUMBER_FOR_VALUE]; + CHAR16 *TempStr; + CHAR16 Prefix; + CHAR16 *BufferPtr; + UINTN Count; + UINTN Index; + + TempStr = TempBuffer; + BufferPtr = Buffer; + + // + // Count starts at one since we will null terminate. Each iteration of the + // loop picks off one nibble. Oh yea TempStr ends up backwards + // + Count = 0; + + if (Width > CHARACTER_NUMBER_FOR_VALUE - 1) { + Width = CHARACTER_NUMBER_FOR_VALUE - 1; + } + + do { + Index = ((UINTN)Value & 0xf); + *(TempStr++) = mHexStr[Index]; + Value = RShiftU64 (Value, 4); + Count++; + } while (Value != 0); + + if (Flags & PREFIX_ZERO) { + Prefix = '0'; + } else { + Prefix = ' '; + } + + Index = Count; + if (!(Flags & LEFT_JUSTIFY)) { + for (; Index < Width; Index++) { + *(TempStr++) = Prefix; + } + } + + // + // Reverse temp string into Buffer. + // + if (Width > 0 && (UINTN) (TempStr - TempBuffer) > Width) { + TempStr = TempBuffer + Width; + } + Index = 0; + while (TempStr != TempBuffer) { + *(BufferPtr++) = *(--TempStr); + Index++; + } + + *BufferPtr = 0; + return Index; +} + +/** + Converts MAC address to Unicode string. + The value is 64-bit and the resulting string will be 12 + digit hex number in pairs of digits separated by dashes. + + @param String - string that will contain the value + @param Val - value to convert + +**/ +CHAR16 * +StrMacToString ( + OUT CHAR16 *String, + IN EFI_MAC_ADDRESS *MacAddr, + IN UINT32 AddrSize + ) +{ + UINT32 i; + + for (i = 0; i < AddrSize; i++) { + + EfiValueToHexStr ( + &String[2 * i], + MacAddr->Addr[i] & 0xFF, + PREFIX_ZERO, + 2 + ); + } + + // + // Terminate the string. + // + String[2 * AddrSize] = L'\0'; + + return String; +} + + + +EFI_STATUS +TJudgeHandleIsPCIDevice( + EFI_HANDLE Handle, + UINT8 Device, + UINT8 Funs +) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH *DPath; + EFI_DEVICE_PATH *DevicePath; + + Status = gBS->HandleProtocol ( + Handle, + &gEfiDevicePathProtocolGuid, + (VOID **) &DPath + ); + if(!EFI_ERROR(Status)) + { + DevicePath = DPath; + while(!IsDevicePathEnd(DPath)) + { + if((DPath->Type == HARDWARE_DEVICE_PATH) && (DPath->SubType == HW_PCI_DP)) + { + PCI_DEVICE_PATH *PCIPath; + + PCIPath = (PCI_DEVICE_PATH*) DPath; + DPath = NextDevicePathNode(DPath); + if(IsDevicePathEnd(DPath) && (PCIPath->Device == Device) && (PCIPath->Function == Funs)) + { + return EFI_SUCCESS; + } + } + else + { + DPath = NextDevicePathNode(DPath); + } + } + } + return EFI_UNSUPPORTED; +} + +EFI_STATUS +TSearchChildHandle( + EFI_HANDLE Father, + EFI_HANDLE *Child + ) +{ + EFI_STATUS Status; + UINTN HandleIndex; + EFI_GUID **ProtocolGuidArray = NULL; + UINTN ArrayCount; + UINTN ProtocolIndex; + UINTN OpenInfoCount; + UINTN OpenInfoIndex; + EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo = NULL; + UINTN mHandleCount; + EFI_HANDLE *mHandleBuffer= NULL; + + // + // Retrieve the list of all handles from the handle database + // + Status = gBS->LocateHandleBuffer ( + AllHandles, + NULL, + NULL, + &mHandleCount, + &mHandleBuffer + ); + + for (HandleIndex = 0; HandleIndex < mHandleCount; HandleIndex++) + { + // + // Retrieve the list of all the protocols on each handle + // + Status = gBS->ProtocolsPerHandle ( + mHandleBuffer[HandleIndex], + &ProtocolGuidArray, + &ArrayCount + ); + if (!EFI_ERROR (Status)) + { + for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) + { + Status = gBS->OpenProtocolInformation ( + mHandleBuffer[HandleIndex], + ProtocolGuidArray[ProtocolIndex], + &OpenInfo, + &OpenInfoCount + ); + if (!EFI_ERROR (Status)) + { + for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) + { + if(OpenInfo[OpenInfoIndex].AgentHandle == Father) + { + if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) + { + *Child = mHandleBuffer[HandleIndex]; + Status = EFI_SUCCESS; + goto TryReturn; + } + } + } + Status = EFI_NOT_FOUND; + } + } + if(OpenInfo != NULL) + { + FreePool(OpenInfo); + OpenInfo = NULL; + } + } + FreePool (ProtocolGuidArray); + ProtocolGuidArray = NULL; + } +TryReturn: + if(OpenInfo != NULL) + { + FreePool (OpenInfo); + OpenInfo = NULL; + } + if(ProtocolGuidArray != NULL) + { + FreePool(ProtocolGuidArray); + ProtocolGuidArray = NULL; + } + if(mHandleBuffer != NULL) + { + FreePool (mHandleBuffer); + mHandleBuffer = NULL; + } + return Status; +} + +EFI_STATUS +TGetDriverName( + EFI_HANDLE Handle, + CHAR16 *Name +) +{ + EFI_DRIVER_BINDING_PROTOCOL *BindHandle = NULL; + EFI_STATUS Status; + UINT32 Version; + UINT16 *Ptr; + Status = gBS->OpenProtocol( + Handle, + &gEfiDriverBindingProtocolGuid, + (VOID**)&BindHandle, + NULL, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR(Status)) + { + return EFI_NOT_FOUND; + } + + Version = BindHandle->Version; + Ptr = (UINT16*)&Version; + UnicodeSPrint(Name, 40, L"%d.%d.%d", Version >> 24 , (Version >>16)& 0x0f ,*(Ptr)); + return EFI_SUCCESS; +} + +EFI_STATUS +TGetGOPDriverName( + CHAR16 *Name +) +{ + UINTN HandleCount; + EFI_HANDLE *Handles= NULL; + UINTN Index; + EFI_STATUS Status; + EFI_HANDLE Child = 0; + + Status = gBS->LocateHandleBuffer( + ByProtocol, + &gEfiDriverBindingProtocolGuid, + NULL, + &HandleCount, + &Handles + ); + for (Index = 0; Index < HandleCount ; Index++) + { + Status = TSearchChildHandle(Handles[Index], &Child); + if(!EFI_ERROR(Status)) + { + Status = TJudgeHandleIsPCIDevice(Child, 0x02, 0x00); + if(!EFI_ERROR(Status)) + { + return TGetDriverName(Handles[Index], Name); + } + } + } + return EFI_UNSUPPORTED; +} + +EFI_STATUS +TGetTouchFirmwareVersion( + ) +{ + EFI_STATUS rc=EFI_SUCCESS; + UINTN TouchVer = 0; + UINTN Size = sizeof(UINTN); + + + CHAR16 Buffer[40]; + + rc = gRT->GetVariable( + L"TouchVer", + &gEfiVlv2VariableGuid, + NULL, + &Size, + &TouchVer + ); + if(!EFI_ERROR(rc)){ + UnicodeSPrint(Buffer, sizeof(Buffer), L"%02x.%02x", (TouchVer&0xFFFF)>>8,TouchVer&0xFF); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_TOUCH_VERSION), Buffer, NULL); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +UpdatePlatformInformation ( + ) +{ + UINT32 MicroCodeVersion; + CHAR16 Buffer[40]; + UINT8 IgdVBIOSRevH; + UINT8 IgdVBIOSRevL; + UINT16 EDX; + EFI_IA32_REGISTER_SET RegSet; + EFI_LEGACY_BIOS_PROTOCOL *LegacyBios = NULL; + EFI_STATUS Status; + UINT8 CpuFlavor=0; + EFI_PEI_HOB_POINTERS GuidHob; + EFI_PLATFORM_INFO_HOB *mPlatformInfo=NULL; + UINTN NumHandles; + EFI_HANDLE *HandleBuffer; + UINTN Index; + DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy; + UINTN PciD31F0RegBase; + UINT8 count; + UINT8 Data8; + UINT8 Data8_1; + + CHAR16 Name[40]; + UINT32 MrcVersion; + + UINT8 KscFwRevH =0; + UINT8 KscFwRevL =0; + + // + // Get the HOB list. If it is not present, then ASSERT. + // + GuidHob.Raw = GetHobList (); + if (GuidHob.Raw != NULL) { + if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) { + mPlatformInfo = GET_GUID_HOB_DATA (GuidHob.Guid); + } + } + + // + //VBIOS version + // + Status = gBS->LocateProtocol( + &gEfiLegacyBiosProtocolGuid, + NULL, + (VOID **)&LegacyBios + ); + + RegSet.X.AX = 0x5f01; + Status = LegacyBios->Int86 (LegacyBios, 0x10, &RegSet); + ASSERT_EFI_ERROR(Status); + + // + // simulate AMI int15 (ax=5f01) handler + // check NbInt15.asm in AMI code for asm edition + // + EDX = (UINT16)((RegSet.E.EBX >> 16) & 0xffff); + IgdVBIOSRevH = (UINT8)(((EDX & 0x0F00) >> 4) | (EDX & 0x000F)); + IgdVBIOSRevL = (UINT8)(((RegSet.X.BX & 0x0F00) >> 4) | (RegSet.X.BX & 0x000F)); + + if (IgdVBIOSRevH==0 && IgdVBIOSRevL==0) { + HiiSetString(mHiiHandle, STRING_TOKEN(STR_CHIP_IGD_VBIOS_REV_VALUE), L"N/A", NULL); + } else { + UnicodeSPrint (Buffer, sizeof (Buffer), L"%02X%02X", IgdVBIOSRevH,IgdVBIOSRevL); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_CHIP_IGD_VBIOS_REV_VALUE), Buffer, NULL); + } + + Status = TGetGOPDriverName(Name); + + if(!EFI_ERROR(Status)) + { + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_GOP_VERSION), Name, NULL); + } + + // + //CpuFlavor + // + //VLV + //VLV-DC Tablet 000 + //VLV-QC Notebook 001 + //VLV-QC Desktop 010 + // + //CPU flavor + // + CpuFlavor = RShiftU64 (EfiReadMsr (MSR_IA32_PLATFORM_ID), 50) & 0x07; + + switch(CpuFlavor){ + case 0x0: + UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-DC Tablet", CpuFlavor); + break; + case 0x01: + UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-QC Notebook", CpuFlavor); + break; + case 0x02: + UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-QC Desktop", CpuFlavor); + break; + case 0x03: + UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-QC Notebook", CpuFlavor); + break; + default: + UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"Unknown CPU", CpuFlavor); + break; + } + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_CPU_FLAVOR_VALUE), Buffer, NULL); + + if ( NULL != mPlatformInfo) { + // + // Board Id + // + UnicodeSPrint (Buffer, sizeof (Buffer), L"%x", mPlatformInfo->BoardId); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_BOARD_ID_VALUE), Buffer, NULL); + + // + // FAB ID + // + UnicodeSPrint (Buffer, sizeof (Buffer), L"%x", mPlatformInfo->BoardRev); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_FAB_ID_VALUE), Buffer, NULL); + } + + // + //Update MRC Version + // + MrcVersion = MmioRead32 (MmPciAddress (0, 0, 0, 0, 0xF0)); + MrcVersion &= 0xffff; + Index = EfiValueToString (Buffer, MrcVersion/100, PREFIX_ZERO, 0); + StrCat (Buffer, L"."); + EfiValueToString (Buffer + Index + 1, (MrcVersion%100)/10, PREFIX_ZERO, 0); + EfiValueToString (Buffer + Index + 2, (MrcVersion%100)%10, PREFIX_ZERO, 0); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_MRC_VERSION_VALUE), Buffer, NULL); + + // + //Update Soc Version + // + + // + // Retrieve all instances of PCH Platform Policy protocol + // + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gDxePchPlatformPolicyProtocolGuid, + NULL, + &NumHandles, + &HandleBuffer + ); + if (!EFI_ERROR (Status)) { + // + // Find the matching PCH Policy protocol + // + for (Index = 0; Index < NumHandles; Index++) { + Status = gBS->HandleProtocol ( + HandleBuffer[Index], + &gDxePchPlatformPolicyProtocolGuid, + (VOID **) &PchPlatformPolicy + ); + if (!EFI_ERROR (Status)) { + PciD31F0RegBase = MmPciAddress ( + 0, + PchPlatformPolicy->BusNumber, + PCI_DEVICE_NUMBER_PCH_LPC, + PCI_FUNCTION_NUMBER_PCH_LPC, + 0 + ); + + Data8 = MmioRead8 (PciD31F0RegBase + R_PCH_LPC_RID_CC); + count = sizeof (SBRevisionTable) / sizeof (SBRevisionTable[0]); + for (Index = 0; Index < count; Index++) { + if(Data8 == SBRevisionTable[Index].RevId) { + UnicodeSPrint (Buffer, sizeof (Buffer), L"%02x %a", Data8, SBRevisionTable[Index].String); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SOC_VALUE), Buffer, NULL); + break; + } + } + break; + } + } + } + + // + // Microcode Revision + // + EfiWriteMsr (EFI_MSR_IA32_BIOS_SIGN_ID, 0); + EfiCpuid (EFI_CPUID_VERSION_INFO, NULL); + MicroCodeVersion = (UINT32) RShiftU64 (EfiReadMsr (EFI_MSR_IA32_BIOS_SIGN_ID), 32); + UnicodeSPrint (Buffer, sizeof (Buffer), L"%x", MicroCodeVersion); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_PROCESSOR_MICROCODE_VALUE), Buffer, NULL); + + + // + //Secure boot + // + Data8 = SystemConfiguration.SecureBoot; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_SECURE_BOOT), Buffer, NULL); + + // + //Bootmode + // + BootMode = GetBootModeHob(); + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", BootMode); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_BOOT_MODE), Buffer, NULL); + + // + //SpeedStep + // + Data8 = 1; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_SPEED_STEP), Buffer, NULL); + + // + //CPU Turbo + // + Data8 = 2; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_CPU_TURBO), Buffer, NULL); + + // + //CState + // + Data8 = 3; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_CSTATE), Buffer, NULL); + + // + //GFX Turbo + // + Data8 = SystemConfiguration.IgdTurboEnabled; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_GFX_TURBO), Buffer, NULL); + + Data8 = 0; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_S0IX_VALUE), Buffer, NULL); + + // + //RC6 + // + Data8 = 0; + UnicodeSPrint (Buffer, sizeof(Buffer), L"%x", Data8); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_RC6_VALUE), Buffer, NULL); + + // + // Punit Version + // + Data8 = 0; + UnicodeSPrint (Buffer, sizeof (Buffer), L"0x%x", Data8); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_PUNIT_FW_VALUE), Buffer, NULL); + + // + // PMC Version + // + Data8 = (UINT8)((MmioRead32 (PMC_BASE_ADDRESS + R_PCH_PMC_PRSTS)>>16)&0x00FF); + Data8_1 = (UINT8)((MmioRead32 (PMC_BASE_ADDRESS + R_PCH_PMC_PRSTS)>>24)&0x00FF); + UnicodeSPrint (Buffer, sizeof (Buffer), L"0x%X_%X", Data8_1, Data8); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_PMC_FW_VALUE), Buffer, NULL); + + // + //PMIC Version + // + Status = ByteReadI2C(PMICI2cBus, PMICI2cAdd, PMICVendorOffset, 1, &Data8); + if(!EFI_ERROR(Status)){ + Status = ByteReadI2C(PMICI2cBus, PMICI2cAdd, PMICRevOffset, 1, &Data8_1); + if(!EFI_ERROR(Status)){ + UnicodeSPrint(Buffer, sizeof(Buffer), L"%02x.%02x", Data8, Data8_1); + HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_PMIC_VERSION), Buffer, NULL); + } + } + + TGetTouchFirmwareVersion(); + + return EFI_SUCCESS; +} + + +/** + Smbios OEM type 0x94 callback. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification functions context, which is implementation dependent. + + @retval None + +**/ +VOID +AddSmbiosT0x94Callback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + UINTN SECVerStrLen = 0; + UINTN uCodeVerStrLen = 0; + UINTN GOPStrLen = 0; + UINTN MRCVersionStrLen = 0; + UINTN PMCVersionStrLen = 0; + UINTN ULPMCVersionStrLen = 0; + UINTN PUNITVersionStrLen = 0; + UINTN SOCVersionStrLen = 0; + UINTN BOARDVersionStrLen = 0; + UINTN FABVersionStrLen = 0; + UINTN CPUFLAVORStrLen = 0; + UINTN BIOSVersionStrLen = 0; + UINTN PMICVersionStrLen = 0; + UINTN TOUCHVersionStrLen = 0; + UINTN SecureBootModeLen = 0; + UINTN BootModeLen = 0; + UINTN SpeedStepModeLen = 0; + UINTN MaxCStateLen = 0; + UINTN CpuTurboLen = 0; + UINTN GfxTurboLen = 0; + UINTN IdleReserveLen = 0; + UINTN RC6Len = 0; + + SMBIOS_TABLE_TYPE94 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_MISC_OEM_TYPE_0x94 *ForType94InputData; + CHAR16 *SECVer; + CHAR16 *uCodeVer; + CHAR16 *GOPVer; + CHAR16 *MrcVer; + CHAR16 *PmcVer; + CHAR16 *UlpmcVer; + CHAR16 *PunitVer; + CHAR16 *SocVer; + CHAR16 *BoardVer; + CHAR16 *FabVer; + CHAR16 *CpuFlavor; + CHAR16 *BiosVer; + CHAR16 *PmicVer; + CHAR16 *TouchVer = L"15.16"; + CHAR16 *SecureBootMode; + CHAR16 *BootMode; + CHAR16 *SpeedStepMode; + CHAR16 *MaxCState; + CHAR16 *CpuTurbo; + CHAR16 *GfxTurbo; + CHAR16 *IdleReserve; + CHAR16 *RC6; + + UINTN RecordLen = 0; + UINTN StrIdx = 0; + + + STRING_REF TokenToGet; + CHAR8 *OptionalStrStart; + EFI_SMBIOS_PROTOCOL *SmbiosProtocol; + + ForType94InputData = (EFI_MISC_OEM_TYPE_0x94 *)Context; + + DEBUG ((EFI_D_INFO, "Executing SMBIOS T0x94 callback.\n")); + + gBS->CloseEvent (Event); // Unload this event. + + // + // First check for invalid parameters. + // + if (Context == NULL) { + return; + } + + UpdatePlatformInformation(); + + Status = gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID **) &SmbiosProtocol + ); + ASSERT_EFI_ERROR (Status); + + TokenToGet = STRING_TOKEN (STR_MISC_SEC_VERSION); + SECVer = SmbiosMiscGetString (TokenToGet); + SECVerStrLen = StrLen(SECVer); + if (SECVerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_UCODE_VERSION); + uCodeVer = SmbiosMiscGetString (TokenToGet); + uCodeVerStrLen = StrLen(uCodeVer); + if (uCodeVerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_GOP_VERSION); + GOPVer = SmbiosMiscGetString (TokenToGet); + GOPStrLen = StrLen(GOPVer); + if (GOPStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_MRC_VERSION_VALUE); + MrcVer = SmbiosMiscGetString (TokenToGet); + MRCVersionStrLen = StrLen(MrcVer); + if (MRCVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_PMC_FW_VALUE); + PmcVer = SmbiosMiscGetString (TokenToGet); + PMCVersionStrLen = StrLen(PmcVer); + if (PMCVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_ULPMC_FW_VALUE); + UlpmcVer = SmbiosMiscGetString (TokenToGet); + ULPMCVersionStrLen = StrLen(UlpmcVer); + if (ULPMCVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_PUNIT_FW_VALUE); + PunitVer = SmbiosMiscGetString (TokenToGet); + PUNITVersionStrLen = StrLen(PunitVer); + if (PUNITVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SOC_VALUE); + SocVer = SmbiosMiscGetString (TokenToGet); + SOCVersionStrLen = StrLen(SocVer); + if (SOCVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BOARD_ID_VALUE); + BoardVer = SmbiosMiscGetString (TokenToGet); + BOARDVersionStrLen = StrLen(BoardVer); + if (BOARDVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_FAB_ID_VALUE); + FabVer = SmbiosMiscGetString (TokenToGet); + FABVersionStrLen = StrLen(FabVer); + if (FABVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CPU_FLAVOR_VALUE); + CpuFlavor = SmbiosMiscGetString (TokenToGet); + CPUFLAVORStrLen = StrLen(CpuFlavor); + if (CPUFLAVORStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION); + BiosVer = SmbiosMiscGetString (TokenToGet); + BIOSVersionStrLen = StrLen(BiosVer); + if (BIOSVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_PMIC_VERSION); + PmicVer = SmbiosMiscGetString (TokenToGet); + PMICVersionStrLen = StrLen(PmicVer); + if (PMICVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_TOUCH_VERSION); + TouchVer = SmbiosMiscGetString (TokenToGet); + TOUCHVersionStrLen = StrLen(TouchVer); + if (TOUCHVersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SECURE_BOOT); + SecureBootMode = SmbiosMiscGetString(TokenToGet); + SecureBootModeLen = StrLen(SecureBootMode); + if (SecureBootModeLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_BOOT_MODE); + BootMode = SmbiosMiscGetString(TokenToGet); + BootModeLen = StrLen(BootMode); + if (BootModeLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SPEED_STEP); + SpeedStepMode = SmbiosMiscGetString(TokenToGet); + SpeedStepModeLen = StrLen(SpeedStepMode); + if (SpeedStepModeLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CPU_TURBO); + CpuTurbo = SmbiosMiscGetString(TokenToGet); + CpuTurboLen = StrLen(CpuTurbo); + if (CpuTurboLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_CSTATE); + MaxCState = SmbiosMiscGetString(TokenToGet); + MaxCStateLen = StrLen(MaxCState); + if (MaxCStateLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_GFX_TURBO); + GfxTurbo = SmbiosMiscGetString(TokenToGet); + GfxTurboLen = StrLen(GfxTurbo); + if (GfxTurboLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_S0IX_VALUE); + IdleReserve = SmbiosMiscGetString(TokenToGet); + IdleReserveLen = StrLen(IdleReserve); + if (S0ixLen > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + TokenToGet = STRING_TOKEN (STR_MISC_RC6_VALUE); + RC6 = SmbiosMiscGetString(TokenToGet); + RC6Len = StrLen(RC6); + if (RC6Len > SMBIOS_STRING_MAX_LENGTH) { + return; + } + + RecordLen = sizeof (SMBIOS_TABLE_TYPE94) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + PMCVersionStrLen + 1 + \ + TOUCHVersionStrLen + 1 + PMICVersionStrLen + 1 + BIOSVersionStrLen + 1 + CPUFLAVORStrLen + 1 + \ + BOARDVersionStrLen + 1 + FABVersionStrLen + 1 + PUNITVersionStrLen+ 1 + ULPMCVersionStrLen + 1 + \ + MRCVersionStrLen + 1 + SOCVersionStrLen + 1 + SecureBootModeLen + 1 + BootModeLen + 1 + \ + SpeedStepModeLen + 1 + CpuTurboLen + 1 + MaxCStateLen + 1 + GfxTurboLen + 1 + + RC6Len + 1 + 1; + + SmbiosRecord = AllocatePool(RecordLen); + + ZeroMem(SmbiosRecord, RecordLen); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_MISC_VERSION_INFO; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE94); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + SmbiosRecord->GopVersion = 1; + + SmbiosRecord->SECVersion = 2; + + SmbiosRecord->MRCVersion = 3; + + SmbiosRecord->uCodeVersion = 4; + + SmbiosRecord->PUnitVersion = 5; + + SmbiosRecord->PMCVersion = 6; + + SmbiosRecord->ULPMCVersion = 7; + + SmbiosRecord->SoCVersion = 8; + + SmbiosRecord->BoardVersion = 9; + + SmbiosRecord->FabVersion = 10; + + SmbiosRecord->CPUFlavor = 11; + + SmbiosRecord->BiosVersion = 12; + + SmbiosRecord->PmicVersion = 13; + + SmbiosRecord->TouchVersion = 14; + + SmbiosRecord->SecureBoot = 15; + + SmbiosRecord->BootMode = 16; + + SmbiosRecord->SpeedStepMode= 17; + + SmbiosRecord->CPUTurboMode = 18; + + SmbiosRecord->MaxCState = 19; + + SmbiosRecord->GfxTurbo = 20; + SmbiosRecord->IdleReserve = 21; + + SmbiosRecord->RC6 = 22; + + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(GOPVer, OptionalStrStart); + StrIdx += GOPStrLen + 1; + + UnicodeStrToAsciiStr(SECVer, OptionalStrStart + StrIdx); + StrIdx += SECVerStrLen + 1; + + UnicodeStrToAsciiStr(MrcVer, OptionalStrStart + StrIdx); + StrIdx += MRCVersionStrLen + 1; + + UnicodeStrToAsciiStr(uCodeVer, OptionalStrStart + StrIdx); + StrIdx += uCodeVerStrLen + 1; + + UnicodeStrToAsciiStr(PunitVer, OptionalStrStart + StrIdx); + StrIdx += PUNITVersionStrLen + 1; + + UnicodeStrToAsciiStr(PmcVer, OptionalStrStart + StrIdx); + StrIdx += PMCVersionStrLen + 1; + + UnicodeStrToAsciiStr(UlpmcVer, OptionalStrStart + StrIdx); + StrIdx += ULPMCVersionStrLen + 1; + + + UnicodeStrToAsciiStr(SocVer, OptionalStrStart + StrIdx); + StrIdx += SOCVersionStrLen +1; + + UnicodeStrToAsciiStr(BoardVer, OptionalStrStart + StrIdx); + StrIdx += BOARDVersionStrLen + 1; + + UnicodeStrToAsciiStr(FabVer, OptionalStrStart + StrIdx); + StrIdx += FABVersionStrLen + 1; + + UnicodeStrToAsciiStr(CpuFlavor, OptionalStrStart + StrIdx); + StrIdx += CPUFLAVORStrLen + 1; + + UnicodeStrToAsciiStr(BiosVer, OptionalStrStart + StrIdx); + StrIdx += BIOSVersionStrLen + 1; + + UnicodeStrToAsciiStr(PmicVer, OptionalStrStart + StrIdx); + StrIdx += PMICVersionStrLen + 1; + + UnicodeStrToAsciiStr(TouchVer, OptionalStrStart + StrIdx); + StrIdx += TOUCHVersionStrLen + 1; + + UnicodeStrToAsciiStr(SecureBootMode, OptionalStrStart + StrIdx); + StrIdx += SecureBootModeLen + 1; + + UnicodeStrToAsciiStr(BootMode, OptionalStrStart + StrIdx); + StrIdx += BootModeLen + 1; + + UnicodeStrToAsciiStr(SpeedStepMode, OptionalStrStart + StrIdx); + StrIdx += SpeedStepModeLen + 1; + + UnicodeStrToAsciiStr(CpuTurbo, OptionalStrStart + StrIdx); + StrIdx += CpuTurboLen + 1; + + UnicodeStrToAsciiStr(MaxCState, OptionalStrStart + StrIdx); + StrIdx += MaxCStateLen + 1; + + UnicodeStrToAsciiStr(GfxTurbo, OptionalStrStart + StrIdx); + StrIdx += GfxTurboLen + 1; + + UnicodeStrToAsciiStr(IdleReserve, OptionalStrStart + StrIdx); + StrIdx += S0ixLen + 1; + + UnicodeStrToAsciiStr(RC6, OptionalStrStart + StrIdx); + StrIdx += RC6Len + 1; + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = SmbiosProtocol-> Add ( + SmbiosProtocol, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + + FreePool(SmbiosRecord); + return; +} + +/** + This function makes boot time changes to the contents of the + MiscOemType0x94 (Type 0x94). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscOemType0x94) +{ + EFI_STATUS Status; + EFI_EVENT AddSmbiosT0x94CallbackEvent; + + Status = EfiCreateEventReadyToBootEx ( + TPL_CALLBACK, + AddSmbiosT0x94Callback, + RecordData, + &AddSmbiosT0x94CallbackEvent + ); + + ASSERT_EFI_ERROR (Status); + return Status; + +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDevice.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDevice.uni new file mode 100644 index 0000000000..bc06bad581 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDevice.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceData.c new file mode 100644 index 0000000000..732e3d83fa --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceData.c @@ -0,0 +1,53 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscOnboardDeviceData.c + +Abstract: + + Static data of Onboard device information . + The onboard device information is Misc. subclass type 8 and SMBIOS type 10. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_ONBOARD_DEVICE_DATA, MiscOnboardDeviceVideo) = { + STRING_TOKEN(STR_MISC_ONBOARD_DEVICE_VIDEO), // OnBoardDeviceDescription + { // OnBoardDeviceStatus + EfiOnBoardDeviceTypeVideo, // DeviceType + 1, // DeviceEnabled + 0 // Reserved + }, + 0 // OnBoardDevicePath +}; +MISC_SMBIOS_TABLE_DATA(EFI_MISC_ONBOARD_DEVICE_DATA, MiscOnboardDeviceAudio) = { + STRING_TOKEN(STR_MISC_ONBOARD_DEVICE_AUDIO), // OnBoardDeviceDescription + { // OnBoardDeviceStatus + EfiOnBoardDeviceTypeSound, // DeviceType + 1, // DeviceEnabled + 0 // Reserved + }, + 0 // OnBoardDevicePath +}; + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c new file mode 100644 index 0000000000..ecf6e6e2bc --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c @@ -0,0 +1,140 @@ +/** @file + +Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscOnboardDeviceFunction.c + +Abstract: + + Create the device path for the Onboard device. + The Onboard device information is Misc. subclass type 8 and SMBIOS type 10. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + + +/** + This is a macro defined function, in fact, the function is + MiscOnboardDeviceFunction (RecordType, RecordLen, RecordData, LogRecordData) + This function makes boot time changes to the contents of the + MiscOnboardDevice structure. + + @param MiscOnboardDevice The string which is used to create the function + The Arguments in fact: + @param RecordType Type of record to be processed from the Data + Table. mMiscSubclassDataTable[].RecordType + @param RecordLen Size of static RecordData from the Data Table. + mMiscSubclassDataTable[].RecordLen + @param RecordData Pointer to RecordData, which will be written to + the Data Hub + @param LogRecordData TRUE to log RecordData to Data Hub. FALSE when + there is no more data to log. + + @retval EFI_SUCCESS *RecordData and *LogRecordData have been set. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER One of the following parameter conditions was + true: RecordLen was zero. RecordData was NULL. + LogRecordData was NULL. + +**/ +MISC_SMBIOS_TABLE_FUNCTION ( + MiscOnboardDevice + ) +{ + CHAR8 *OptionalStrStart; + UINT8 StatusAndType; + UINTN DescriptionStrLen; + EFI_STRING DeviceDescription; + STRING_REF TokenToGet; + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE10 *SmbiosRecord; + EFI_MISC_ONBOARD_DEVICE *ForType10InputData; + + ForType10InputData = (EFI_MISC_ONBOARD_DEVICE *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = 0; + switch (ForType10InputData->OnBoardDeviceDescription) { + case STR_MISC_ONBOARD_DEVICE_VIDEO: + TokenToGet = STRING_TOKEN (STR_MISC_ONBOARD_DEVICE_VIDEO); + break; + case STR_MISC_ONBOARD_DEVICE_AUDIO: + TokenToGet = STRING_TOKEN (STR_MISC_ONBOARD_DEVICE_AUDIO); + break; + default: + break; + } + + DeviceDescription = SmbiosMiscGetString (TokenToGet); + DescriptionStrLen = StrLen(DeviceDescription); + if (DescriptionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE10) + DescriptionStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE10) + DescriptionStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_ONBOARD_DEVICE_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE10); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // Status & Type: Bit 7 Devicen Status, Bits 6:0 Type of Device + // + StatusAndType = (UINT8) ForType10InputData->OnBoardDeviceStatus.DeviceType; + if (ForType10InputData->OnBoardDeviceStatus.DeviceEnabled != 0) { + StatusAndType |= 0x80; + } else { + StatusAndType &= 0x7F; + } + + SmbiosRecord->Device[0].DeviceType = StatusAndType; + SmbiosRecord->Device[0].DescriptionString = 1; + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(DeviceDescription, OptionalStrStart); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArray.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArray.uni new file mode 100644 index 0000000000..510ec40dbf Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArray.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayData.c new file mode 100644 index 0000000000..43095e84de --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayData.c @@ -0,0 +1,43 @@ +/*++ + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscPhysicalArrayData.c + +Abstract: + + BIOS Physical Array static data. + SMBIOS type 16. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + + +// +// Static (possibly build generated) Physical Memory Array Dat. +// +MISC_SMBIOS_TABLE_DATA(EFI_MEMORY_ARRAY_LOCATION_DATA, MiscPhysicalMemoryArray) = +{ + EfiMemoryArrayLocationSystemBoard, // Memory location + EfiMemoryArrayUseSystemMemory, // Memory array use + EfiMemoryErrorCorrectionNone, // Memory error correction + 0, // Maximum Memory Capacity + 0x01 // Number of Devices +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayFunction.c new file mode 100644 index 0000000000..8f035cc925 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPhysicalArrayFunction.c @@ -0,0 +1,106 @@ +/*++ + +Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscPhysicalArrayFunction.c + +Abstract: + + BIOS system Physical Array boot time changes. + SMBIOS type 16. + +--*/ + + +#include "CommonHeader.h" +#include "MiscSubclassDriver.h" + + + +/** + This function makes boot time changes to the contents of the + MiscPhysicalArrayFunction (Type 16). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ + +MISC_SMBIOS_TABLE_FUNCTION(MiscPhysicalMemoryArray) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE16 *SmbiosRecord; + EFI_MEMORY_ARRAY_LOCATION_DATA *ForType16InputData; + UINT32 TopOfMemory = 8 * 1024 * 1024; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + ForType16InputData = (EFI_MEMORY_ARRAY_LOCATION_DATA *)RecordData; + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE16) + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE16) + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE16); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // ReleaseDate will be the 3rd optional string following the formatted structure. + // + SmbiosRecord->Location = *(UINT8 *) &ForType16InputData ->MemoryArrayLocation; + SmbiosRecord->Use = *(UINT8 *) &ForType16InputData ->MemoryArrayUse; + SmbiosRecord->MemoryErrorCorrection = *(UINT8 *) &ForType16InputData->MemoryErrorCorrection; + + // + // System does not provide the error information structure + // + SmbiosRecord->MemoryErrorInformationHandle = 0xFFFE; + + // + // Maximum memory capacity + // + SmbiosRecord-> MaximumCapacity = TopOfMemory; + SmbiosRecord-> NumberOfMemoryDevices= 0x02; + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; + +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignator.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignator.uni new file mode 100644 index 0000000000..c0e4b55f86 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignator.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorData.c new file mode 100644 index 0000000000..2bc49932d8 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorData.c @@ -0,0 +1,61 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscPortInternalConnectorDesignatorData.c + +Abstract: + + Static data of Port internal connector designator information. + Port internal connector designator information is Misc. subclass type 6 and + SMBIOS type 8. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Port connector designations +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortIde1) = { + STRING_TOKEN(STR_MISC_PORT_INTERNAL_IDE1), + STRING_TOKEN(STR_MISC_PORT_EXTERNAL_IDE1), + EfiPortConnectorTypeOnboardIde, + EfiPortConnectorTypeNone, + EfiPortTypeOther, + 0 +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortIde2) = { + STRING_TOKEN(STR_MISC_PORT_INTERNAL_IDE2), + STRING_TOKEN(STR_MISC_PORT_EXTERNAL_IDE2), + EfiPortConnectorTypeOnboardIde, + EfiPortConnectorTypeNone, + EfiPortTypeOther, + 0 +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortAtxPower) = { + STRING_TOKEN(STR_MISC_PORT_INTERNAL_ATX_POWER), + STRING_TOKEN(STR_MISC_PORT_EXTERNAL_ATX_POWER), + EfiPortConnectorTypeOther, + EfiPortConnectorTypeNone, + EfiPortTypeOther, + 0 +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c new file mode 100644 index 0000000000..81e7613532 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c @@ -0,0 +1,157 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscPortInternalConnectorDesignatorFunction.c + +Abstract: + + Create the device path for the Port internal connector designator. + Port internal connector designator information is Misc. subclass type 6 + and SMBIOS type 8. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +/** + This is a macro defined function, in fact, the function is + MiscPortInternalConnectorDesignatorFunction (RecordType, RecordLen, RecordData, LogRecordData) + This function makes boot time changes to the contents of the + MiscPortConnectorInformation. + + @param MiscPortInternalConnectorDesignator The string which is used to create + the function + The Arguments in fact: + @param RecordType Type of record to be processed from + the Data Table. + mMiscSubclassDataTable[].RecordType + @param RecordLen Size of static RecordData from the + Data Table. + mMiscSubclassDataTable[].RecordLen + @param RecordData Pointer to RecordData, which will be + written to the Data Hub + @param LogRecordData TRUE to log RecordData to Data Hub. + FALSE when there is no more data to + log. + + @retval EFI_SUCCESS *RecordData and *LogRecordData have + been set. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER One of the following parameter + conditions was true: RecordLen was + zero. RecordData was NULL. + LogRecordData was NULL. + +**/ +MISC_SMBIOS_TABLE_FUNCTION ( + MiscPortInternalConnectorDesignator + ) +{ + CHAR8 *OptionalStrStart; + UINTN InternalRefStrLen; + UINTN ExternalRefStrLen; + EFI_STRING InternalRef; + EFI_STRING ExternalRef; + STRING_REF TokenForInternal; + STRING_REF TokenForExternal; + EFI_STATUS Status; + SMBIOS_TABLE_TYPE8 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *ForType8InputData; + + ForType8InputData = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenForInternal = 0; + TokenForExternal = 0; + + switch (ForType8InputData->PortInternalConnectorDesignator) { + + case STR_MISC_PORT_INTERNAL_IDE1: + TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_IDE1); + TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_IDE1); + break; + case STR_MISC_PORT_INTERNAL_IDE2: + TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_IDE2); + TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_IDE2); + break; + case STR_MISC_PORT_INTERNAL_ATX_POWER: + TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_ATX_POWER); + TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_ATX_POWER); + break; + default: + break; + } + + InternalRef = SmbiosMiscGetString (TokenForInternal); + InternalRefStrLen = StrLen(InternalRef); + if (InternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + ExternalRef = SmbiosMiscGetString (TokenForExternal); + ExternalRefStrLen = StrLen(ExternalRef); + if (ExternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE8); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + SmbiosRecord->InternalReferenceDesignator = 1; + SmbiosRecord->InternalConnectorType = (UINT8)ForType8InputData->PortInternalConnectorType; + SmbiosRecord->ExternalReferenceDesignator = 2; + SmbiosRecord->ExternalConnectorType = (UINT8)ForType8InputData->PortExternalConnectorType; + SmbiosRecord->PortType = (UINT8)ForType8InputData->PortType; + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(InternalRef, OptionalStrStart); + UnicodeStrToAsciiStr(ExternalRef, OptionalStrStart + InternalRefStrLen + 1); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCache.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCache.uni new file mode 100644 index 0000000000..ee5736de57 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCache.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheData.c new file mode 100644 index 0000000000..aed07ba876 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheData.c @@ -0,0 +1,38 @@ +/*++ + +Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscBiosProcessorCache.c + +Abstract: + + Processor cache static data. + Misc. subclass type 7. + SMBIOS type 7. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +// +// Static (possibly build generated) Processor cache data. +// +MISC_SMBIOS_TABLE_DATA(EFI_CACHE_VARIABLE_RECORD, MiscProcessorCache) = { +0 +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c new file mode 100644 index 0000000000..cbed988b13 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c @@ -0,0 +1,202 @@ +/*++ + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscProcessorCacheFunction.c + +Abstract: + + BIOS processor cache details. + Misc. subclass type 7. + SMBIOS type 7. + +--*/ +#include "CommonHeader.h" +#include "MiscSubclassDriver.h" +#include +#include + + +extern SMBIOS_TABLE_TYPE7 *SmbiosRecordL1; +extern SMBIOS_TABLE_TYPE7 *SmbiosRecordL2; +extern SMBIOS_TABLE_TYPE7 *SmbiosRecordL3; + + +UINT32 +ConvertBase2ToRaw ( + IN EFI_EXP_BASE2_DATA *Data) +{ + UINTN Index; + UINT32 RawData; + + RawData = Data->Value; + for (Index = 0; Index < (UINTN) Data->Exponent; Index++) { + RawData <<= 1; + } + + return RawData; +} + + +MISC_SMBIOS_TABLE_FUNCTION(MiscProcessorCache) +{ + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE7 *SmbiosRecordL1; + SMBIOS_TABLE_TYPE7 *SmbiosRecordL2; + + EFI_CACHE_SRAM_TYPE_DATA CacheSramType; + CHAR16 *SocketDesignation; + CHAR8 *OptionalStrStart; + UINTN SocketStrLen; + STRING_REF TokenToGet; + EFI_DATA_HUB_PROTOCOL *DataHub; + UINT64 MonotonicCount; + EFI_DATA_RECORD_HEADER *Record; + EFI_SUBCLASS_TYPE1_HEADER *DataHeader; + UINT8 *SrcData; + UINT32 SrcDataSize; + EFI_STATUS Status; + + // + // Memory Device LOcator + // + DEBUG ((EFI_D_ERROR, "type 7\n")); + + TokenToGet = STRING_TOKEN (STR_SOCKET_DESIGNATION); + SocketDesignation = SmbiosMiscGetString (TokenToGet); + SocketStrLen = StrLen(SocketDesignation); + if (SocketStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + SmbiosRecordL1 = AllocatePool(sizeof (SMBIOS_TABLE_TYPE7) + 7 + 1 + 1); + ASSERT (SmbiosRecordL1 != NULL); + ZeroMem(SmbiosRecordL1, sizeof (SMBIOS_TABLE_TYPE7) + 7 + 1 + 1); + + SmbiosRecordL2 = AllocatePool(sizeof (SMBIOS_TABLE_TYPE7) + 7 + 1 + 1); + ASSERT (SmbiosRecordL2 != NULL); + ZeroMem(SmbiosRecordL2, sizeof (SMBIOS_TABLE_TYPE7) + 7 + 1 + 1); + + // + // Get the Data Hub Protocol. Assume only one instance + // + Status = gBS->LocateProtocol ( + &gEfiDataHubProtocolGuid, + NULL, + (VOID **)&DataHub + ); + ASSERT_EFI_ERROR(Status); + + MonotonicCount = 0; + Record = NULL; + + do { + Status = DataHub->GetNextRecord ( + DataHub, + &MonotonicCount, + NULL, + &Record + ); + if (!EFI_ERROR(Status)) { + if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) { + DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *)(Record + 1); + SrcData = (UINT8 *)(DataHeader + 1); + SrcDataSize = Record->RecordSize - Record->HeaderSize - sizeof (EFI_SUBCLASS_TYPE1_HEADER); + if (CompareGuid(&Record->DataRecordGuid, &gEfiCacheSubClassGuid) && (DataHeader->RecordType == CacheSizeRecordType)) { + if (DataHeader->SubInstance == EFI_CACHE_L1) { + SmbiosRecordL1->InstalledSize += (UINT16) (ConvertBase2ToRaw((EFI_EXP_BASE2_DATA *)SrcData) >> 10); + SmbiosRecordL1->MaximumCacheSize = SmbiosRecordL1->InstalledSize; + } + else if (DataHeader->SubInstance == EFI_CACHE_L2) { + SmbiosRecordL2->InstalledSize += (UINT16) (ConvertBase2ToRaw((EFI_EXP_BASE2_DATA *)SrcData) >> 10); + SmbiosRecordL2->MaximumCacheSize = SmbiosRecordL2->InstalledSize; + } else { + continue; + } + } + } + } + } while (!EFI_ERROR(Status) && (MonotonicCount != 0)); + + // + //Filling SMBIOS type 7 information for different cache levels. + // + + SmbiosRecordL1->Hdr.Type = EFI_SMBIOS_TYPE_CACHE_INFORMATION; + SmbiosRecordL1->Hdr.Length = (UINT8) sizeof (SMBIOS_TABLE_TYPE7); + SmbiosRecordL1->Hdr.Handle = 0; + + SmbiosRecordL1->Associativity = CacheAssociativity8Way; + SmbiosRecordL1->SystemCacheType = CacheTypeUnknown; + SmbiosRecordL1->SocketDesignation = 0x01; + SmbiosRecordL1->CacheSpeed = 0; + SmbiosRecordL1->CacheConfiguration = 0x0180; + ZeroMem (&CacheSramType, sizeof (EFI_CACHE_SRAM_TYPE_DATA)); + CacheSramType.Synchronous = 1; + CopyMem(&SmbiosRecordL1->SupportedSRAMType, &CacheSramType, 2); + CopyMem(&SmbiosRecordL1->CurrentSRAMType, &CacheSramType, 2); + SmbiosRecordL1->ErrorCorrectionType = EfiCacheErrorSingleBit; + + + SmbiosRecordL2->Hdr.Type = EFI_SMBIOS_TYPE_CACHE_INFORMATION; + SmbiosRecordL2->Hdr.Length = (UINT8) sizeof (SMBIOS_TABLE_TYPE7); + SmbiosRecordL2->Hdr.Handle = 0; + + SmbiosRecordL2->Associativity = CacheAssociativity16Way; + SmbiosRecordL2->SystemCacheType = CacheTypeInstruction; + SmbiosRecordL2->SocketDesignation = 0x01; + SmbiosRecordL2->CacheSpeed = 0; + SmbiosRecordL2->CacheConfiguration = 0x0281; + ZeroMem (&CacheSramType, sizeof (EFI_CACHE_SRAM_TYPE_DATA)); + CacheSramType.Synchronous = 1; + CopyMem(&SmbiosRecordL2->SupportedSRAMType, &CacheSramType, 2); + CopyMem(&SmbiosRecordL2->CurrentSRAMType, &CacheSramType, 2); + SmbiosRecordL2->ErrorCorrectionType = EfiCacheErrorSingleBit; + + + + // + //Adding SMBIOS type 7 records to SMBIOS table. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + OptionalStrStart = (CHAR8 *)(SmbiosRecordL1 + 1); + UnicodeStrToAsciiStr(SocketDesignation, OptionalStrStart); + + Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecordL1 + ); + + // + //VLV2 incorporates two SLM modules (quad cores) in the SoC. 2 cores share BIU/L2 cache + // + SmbiosRecordL2->InstalledSize = (SmbiosRecordL2->InstalledSize)/2; + SmbiosRecordL2->MaximumCacheSize = SmbiosRecordL2->InstalledSize; + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + + OptionalStrStart = (CHAR8 *)(SmbiosRecordL2 + 1); + UnicodeStrToAsciiStr(SocketDesignation, OptionalStrStart); + + Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecordL2 + ); + + return EFI_SUCCESS; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformation.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformation.uni new file mode 100644 index 0000000000..f07d978c70 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformation.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationData.c new file mode 100644 index 0000000000..86ae858b90 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationData.c @@ -0,0 +1,76 @@ +/*++ + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscOnboardDeviceData.c + +Abstract: + + This driver parses the mMiscSubclassDataTable structure and reports + any generated data to smbios. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +/* + EFI_PROCESSOR_CORE_FREQUENCY_LIST_DATA ProcessorCoreFrequencyList; + EFI_PROCESSOR_FSB_FREQUENCY_LIST_DATA ProcessorFsbFrequencyList; + EFI_PROCESSOR_SERIAL_NUMBER_DATA ProcessorSerialNumber; + EFI_PROCESSOR_CORE_FREQUENCY_DATA ProcessorCoreFrequency; + EFI_PROCESSOR_FSB_FREQUENCY_DATA ProcessorFsbFrequency; + EFI_PROCESSOR_MAX_CORE_FREQUENCY_DATA ProcessorMaxCoreFrequency; + EFI_PROCESSOR_MAX_FSB_FREQUENCY_DATA ProcessorMaxFsbFrequency; + EFI_PROCESSOR_VERSION_DATA ProcessorVersion; + EFI_PROCESSOR_MANUFACTURER_DATA ProcessorManufacturer; + EFI_PROCESSOR_ID_DATA ProcessorId; + EFI_PROCESSOR_TYPE_DATA ProcessorType; + EFI_PROCESSOR_FAMILY_DATA ProcessorFamily; + EFI_PROCESSOR_VOLTAGE_DATA ProcessorVoltage; + EFI_PROCESSOR_APIC_BASE_ADDRESS_DATA ProcessorApicBase; + EFI_PROCESSOR_APIC_ID_DATA ProcessorApicId; + EFI_PROCESSOR_APIC_VERSION_NUMBER_DATA ProcessorApicVersionNumber; + EFI_PROCESSOR_MICROCODE_REVISION_DATA CpuUcodeRevisionData; + EFI_PROCESSOR_STATUS_DATA ProcessorStatus; + EFI_PROCESSOR_SOCKET_TYPE_DATA ProcessorSocketType; + EFI_PROCESSOR_SOCKET_NAME_DATA ProcessorSocketName; + EFI_PROCESSOR_ASSET_TAG_DATA ProcessorAssetTag; + EFI_PROCESSOR_HEALTH_STATUS ProcessorHealthStatus; + EFI_PROCESSOR_PACKAGE_NUMBER_DATA ProcessorPackageNumber; +} EFI_CPU_VARIABLE_RECORD; +*/ + + +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_CPU_DATA_RECORD, MiscProcessorInformation) = { + +0, + /* + STRING_TOKEN (STR_MISC_SOCKET_NAME), // Processor Socket Name + STRING_TOKEN (STR_MISC_PROCESSOR_MAUFACTURER), // Processor Manufacturer + STRING_TOKEN (STR_MISC_PROCESSOR_VERSION), // Processor Version Information + STRING_TOKEN (STR_MISC_PROCESSOR_SERIAL_NUMBER), // Serial Number + STRING_TOKEN (STR_MISC_ASSERT_TAG_DATA), // Processor Assert TAg Data + STRING_TOKEN (STR_MISC_PART_NUMBER) // Processor Part Numbe +*/ +}; + + + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c new file mode 100644 index 0000000000..005b43cde5 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c @@ -0,0 +1,455 @@ +/*++ + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscProcessorInformationFunction.c + +Abstract: + + Onboard processor information boot time changes. + SMBIOS type 4. + +--*/ + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +#include +#include +#include +#include + +#define EfiProcessorFamilyIntelAtomProcessor 0x2B + +EFI_GUID mProcessorProducerGuid; + + +/** + Get cache SMBIOS record handle. + + @param Smbios Pointer to SMBIOS protocol instance. + @param CacheLevel Level of cache, starting from one. + @param Handle Returned record handle. + +**/ + +VOID +GetCacheHandle ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + IN UINT8 CacheLevel, + OUT EFI_SMBIOS_HANDLE *Handle + ) +{ + UINT16 CacheConfig; + EFI_STATUS Status; + EFI_SMBIOS_TYPE RecordType; + EFI_SMBIOS_TABLE_HEADER *Buffer; + + *Handle = 0; + RecordType = EFI_SMBIOS_TYPE_CACHE_INFORMATION; + + do { + Status = Smbios->GetNext ( + Smbios, + Handle, + &RecordType, + &Buffer, + NULL + ); + if (!EFI_ERROR(Status)) { + CacheConfig = *(UINT16*)((UINT8*)Buffer + 5); + if ((CacheConfig & 0x7) == (CacheLevel -1) ) { + return; + } + } + } while (!EFI_ERROR(Status)); + + *Handle = 0xFFFF; +} + + +/** + This function makes boot time changes to the contents of the + MiscProcessorInformation (Type 4). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +UINT32 +ConvertBase10ToRaw ( + IN EFI_EXP_BASE10_DATA *Data) +{ + UINTN Index; + UINT32 RawData; + + RawData = Data->Value; + for (Index = 0; Index < (UINTN) Data->Exponent; Index++) { + RawData *= 10; + } + + return RawData; +} + +#define BSEL_CR_OVERCLOCK_CONTROL 0xCD +#define FUSE_BSEL_MASK 0x03 + + + +UINT16 miFSBFrequencyTable[4] = { + 83, // 83.3MHz + 100, // 100MHz + 133, // 133MHz + 117 // 116.7MHz +}; + +/** + Determine the processor core frequency + + @param None + + @retval Processor core frequency multiplied by 3 + + +**/ +UINT16 +DetermineiFsbFromMsr ( + VOID + ) +{ + // + // Determine the processor core frequency + // + UINT64 Temp; + Temp = (EfiReadMsr (BSEL_CR_OVERCLOCK_CONTROL)) & FUSE_BSEL_MASK; + return miFSBFrequencyTable[(UINT32)(Temp)]; + +} + +MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) +{ + CHAR8 *OptionalStrStart; + EFI_STRING SerialNumber; + CHAR16 *Version=NULL; + CHAR16 *Manufacturer=NULL; + CHAR16 *Socket=NULL; + CHAR16 *AssetTag=NULL; + CHAR16 *PartNumber=NULL; + UINTN SerialNumberStrLen=0; + UINTN VersionStrLen=0; + UINTN ManufacturerStrLen=0; + UINTN SocketStrLen=0; + UINTN AssetTagStrLen=0; + UINTN PartNumberStrLen=0; + UINTN ProcessorVoltage=0xAE; + UINT32 Eax01; + UINT32 Ebx01; + UINT32 Ecx01; + UINT32 Edx01; + STRING_REF TokenToGet; + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE4 *SmbiosRecord; + EFI_CPU_DATA_RECORD *ForType4InputData; + UINT16 L1CacheHandle=0; + UINT16 L2CacheHandle=0; + UINT16 L3CacheHandle=0; + UINTN NumberOfEnabledProcessors=0 ; + UINTN NumberOfProcessors=0; + UINT64 Frequency = 0; + EFI_MP_SERVICES_PROTOCOL *MpService; + EFI_DATA_HUB_PROTOCOL *DataHub; + UINT64 MonotonicCount; + EFI_DATA_RECORD_HEADER *Record; + EFI_SUBCLASS_TYPE1_HEADER *DataHeader; + UINT8 *SrcData; + UINT32 SrcDataSize; + EFI_PROCESSOR_VERSION_DATA *ProcessorVersion; + CHAR16 *NewStringToken; + STRING_REF TokenToUpdate; + PROCESSOR_ID_DATA *ProcessorId = NULL; + + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + ForType4InputData = (EFI_CPU_DATA_RECORD *)RecordData; + + ProcessorId = AllocateZeroPool(sizeof(PROCESSOR_ID_DATA)); + if (ProcessorId == NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Get the Data Hub Protocol. Assume only one instance + // + Status = gBS->LocateProtocol ( + &gEfiDataHubProtocolGuid, + NULL, + (VOID **)&DataHub + ); + ASSERT_EFI_ERROR(Status); + + MonotonicCount = 0; + Record = NULL; + + do { + Status = DataHub->GetNextRecord ( + DataHub, + &MonotonicCount, + NULL, + &Record + ); + if (!EFI_ERROR(Status)) { + if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) { + + DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *)(Record + 1); + SrcData = (UINT8 *)(DataHeader + 1); + SrcDataSize = Record->RecordSize - Record->HeaderSize - sizeof (EFI_SUBCLASS_TYPE1_HEADER); + + // + // Processor + // + if (CompareGuid(&Record->DataRecordGuid, &gEfiProcessorSubClassGuid)) { + CopyMem (&mProcessorProducerGuid, &Record->ProducerName, sizeof(EFI_GUID)); + switch (DataHeader->RecordType) { + case ProcessorVoltageRecordType: + ProcessorVoltage = (((EFI_EXP_BASE10_DATA *)SrcData)->Value)/100 + 0x80; + break; + case ProcessorCoreFrequencyRecordType: + DEBUG ((EFI_D_ERROR, "ProcessorCoreFrequencyRecordType SrcData1 =%d\n", ConvertBase10ToRaw((EFI_EXP_BASE10_DATA *)SrcData)/1000000)); + Frequency = (ConvertBase10ToRaw((EFI_EXP_BASE10_DATA *)SrcData)/1000000); + break; + case ProcessorVersionRecordType: + ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *)SrcData; + NewStringToken = HiiGetPackageString(&mProcessorProducerGuid, *ProcessorVersion, NULL); + TokenToUpdate = (STRING_REF)STR_MISC_PROCESSOR_VERSION; + HiiSetString(mHiiHandle, TokenToUpdate, NewStringToken, NULL); + break; + default: + break; + } + } + } + } + } while (!EFI_ERROR(Status) && (MonotonicCount != 0)); + + // + // Token to get for Socket Name + // + TokenToGet = STRING_TOKEN (STR_MISC_SOCKET_NAME); + Socket = SmbiosMiscGetString (TokenToGet); + SocketStrLen = StrLen(Socket); + if (SocketStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Token to get for Processor Manufacturer + // + TokenToGet = STRING_TOKEN (STR_MISC_PROCESSOR_MAUFACTURER); + Manufacturer = SmbiosMiscGetString (TokenToGet); + ManufacturerStrLen = StrLen(Manufacturer); + if (ManufacturerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Token to get for Processor Version + // + TokenToGet = STRING_TOKEN (STR_MISC_PROCESSOR_VERSION); + Version = SmbiosMiscGetString (TokenToGet); + VersionStrLen = StrLen(Version); + if (VersionStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Token to get for Serial Number + // + TokenToGet = STRING_TOKEN (STR_MISC_PROCESSOR_SERIAL_NUMBER); + SerialNumber = SmbiosMiscGetString (TokenToGet); + SerialNumberStrLen = StrLen(SerialNumber); + if (SerialNumberStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Token to get for Assert Tag Information + // + TokenToGet = STRING_TOKEN (STR_MISC_ASSERT_TAG_DATA); + AssetTag = SmbiosMiscGetString (TokenToGet); + AssetTagStrLen = StrLen(AssetTag); + if (AssetTagStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Token to get for part number Information + // + TokenToGet = STRING_TOKEN (STR_MISC_PART_NUMBER); + PartNumber = SmbiosMiscGetString (TokenToGet); + PartNumberStrLen = StrLen(PartNumber); + if (PartNumberStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE4) + AssetTagStrLen + 1 + SocketStrLen + 1+ ManufacturerStrLen +1 + VersionStrLen+ 1+ SerialNumberStrLen + 1 + PartNumberStrLen+ 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + SmbiosRecord-> Socket= 1; + SmbiosRecord -> ProcessorManufacture = 2; + SmbiosRecord -> ProcessorVersion = 3; + SmbiosRecord ->SerialNumber =4; + + SmbiosRecord-> AssetTag= 5; + SmbiosRecord-> PartNumber= 6; + + // + // Processor Type + // + ForType4InputData-> VariableRecord.ProcessorType= EfiCentralProcessor; + SmbiosRecord -> ProcessorType = ForType4InputData-> VariableRecord.ProcessorType; + + // + // Processor Family + // + ForType4InputData-> VariableRecord.ProcessorFamily= EfiProcessorFamilyIntelAtomProcessor; //0x2B;; + SmbiosRecord -> ProcessorFamily = ForType4InputData-> VariableRecord.ProcessorFamily; + SmbiosRecord -> ExternalClock = DetermineiFsbFromMsr(); + + // + // Processor ID + // + AsmCpuid(0x001, &Eax01, &Ebx01, &Ecx01, &Edx01); + ProcessorId->Signature = *(PROCESSOR_SIGNATURE *)&Eax01; + ProcessorId->FeatureFlags = *(PROCESSOR_FEATURE_FLAGS *)&Edx01; + SmbiosRecord -> ProcessorId = *(PROCESSOR_ID_DATA *)ProcessorId; + + // + // Processor Voltage + // + ForType4InputData-> VariableRecord.ProcessorVoltage= *(EFI_PROCESSOR_VOLTAGE_DATA *)&ProcessorVoltage; + SmbiosRecord -> Voltage = *(PROCESSOR_VOLTAGE *) &(ForType4InputData-> VariableRecord.ProcessorVoltage); + + // + // Status + // + ForType4InputData-> VariableRecord.ProcessorHealthStatus= 0x41;//0x41; + SmbiosRecord -> Status = ForType4InputData-> VariableRecord.ProcessorHealthStatus; + + // + // Processor Upgrade + // + SmbiosRecord -> ProcessorUpgrade = 0x008; + + // + // Processor Family 2 + // + SmbiosRecord -> ProcessorFamily2 = ForType4InputData-> VariableRecord.ProcessorFamily; + + // + // Processor speed + // + SmbiosRecord-> CurrentSpeed = *(UINT16*) & Frequency; + SmbiosRecord-> MaxSpeed = *(UINT16*) & Frequency; + + // + // Processor Characteristics + // + AsmCpuid(0x8000000, NULL, NULL, NULL, &Edx01); + Edx01= Edx01 >> 28; + Edx01 &= 0x01; + SmbiosRecord-> ProcessorCharacteristics= (UINT16)Edx01; + + // + // Processor Core Count and Enabled core count + // + Status = gBS->LocateProtocol ( + &gEfiMpServiceProtocolGuid, + NULL, + (void **)&MpService + ); + if (!EFI_ERROR (Status)) { + // + // Determine the number of processors + // + MpService->GetNumberOfProcessors ( + MpService, + &NumberOfProcessors, + &NumberOfEnabledProcessors + ); + } + SmbiosRecord-> CoreCount= (UINT8)NumberOfProcessors; + SmbiosRecord-> EnabledCoreCount= (UINT8)NumberOfEnabledProcessors; + SmbiosRecord-> ThreadCount= (UINT8)NumberOfEnabledProcessors; + SmbiosRecord-> ProcessorCharacteristics = 0x2; // Unknown + + // + // Processor Cache Handle + // + GetCacheHandle( Smbios,1, &L1CacheHandle); + GetCacheHandle( Smbios,2, &L2CacheHandle); + GetCacheHandle( Smbios,3, &L3CacheHandle); + + // + // Updating Cache Handle Information + // + SmbiosRecord->L1CacheHandle = L1CacheHandle; + SmbiosRecord->L2CacheHandle = L2CacheHandle; + SmbiosRecord->L3CacheHandle = L3CacheHandle; + + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(Socket, OptionalStrStart); + UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart + SocketStrLen + 1); + UnicodeStrToAsciiStr(Version, OptionalStrStart + SocketStrLen + 1 + ManufacturerStrLen+ 1); + UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + SocketStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1); + UnicodeStrToAsciiStr(AssetTag, OptionalStrStart + SerialNumberStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1 + SocketStrLen + 1); + UnicodeStrToAsciiStr(PartNumber, OptionalStrStart + SerialNumberStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1 + SocketStrLen + 1 + AssetTagStrLen + 1 ); + + // + // Now we have got the full Smbios record, call Smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + if (EFI_ERROR (Status)) return Status; + FreePool(SmbiosRecord); + return Status; + +} + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesData.c new file mode 100644 index 0000000000..903a34d1b1 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesData.c @@ -0,0 +1,48 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscResetCapabilitiesData.c + +Abstract: + + Static data of Reset Capabilities information. + Reset Capabilities information is Misc. subclass type 17 and SMBIOS type 23. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) += { + { // ResetCapabilities + 0, // Status + 0, // BootOption + 0, // BootOptionOnLimit + 0, // WatchdogTimerPresent + 0 // Reserved + }, + 0xFFFF, // ResetCount + 0xFFFF, // ResetLimit + 0xFFFF, // ResetTimerInterval + 0xFFFF // ResetTimeout +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesFunction.c new file mode 100644 index 0000000000..1cf0f9023a --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesFunction.c @@ -0,0 +1,90 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + +Module Name: + + MiscResetCapabilitiesFunction.c + +Abstract: + + ResetCapabilities. + SMBIOS type 23. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +/** + This function makes boot time changes to the contents of the + MiscOemString (Type 11). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE23 *SmbiosRecord; + EFI_MISC_RESET_CAPABILITIES *ForType23InputData; + + ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities); + SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount; + SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit; + SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval; + SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout; + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.h b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.h new file mode 100644 index 0000000000..9e188c69a9 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.h @@ -0,0 +1,193 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSubclassDriver.h + +Abstract: + + Header file for MiscSubclass Driver. + + +**/ + +#ifndef _MISC_SUBCLASS_DRIVER_H +#define _MISC_SUBCLASS_DRIVER_H + + +#include "CommonHeader.h" + +extern UINT8 MiscSubclassStrings[]; + + +#define T14_FVI_STRING "Driver/firmware version" +#define EFI_SMBIOS_TYPE_FIRMWARE_VERSION_INFO 0x90 +#define EFI_SMBIOS_TYPE_MISC_VERSION_INFO 0x94 +#define TOUCH_ACPI_ID "I2C05\\SFFFF\\400K" +#define TOUCH_RESET_GPIO_MMIO 0xFED0C508 +#define EFI_SMBIOS_TYPE_SEC_INFO 0x83 +#define IntelIdentifer 0x6F725076 + +// +// Data table entry update function. +// +typedef EFI_STATUS (EFIAPI EFI_MISC_SMBIOS_DATA_FUNCTION) ( + IN VOID *RecordData, + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +// +// Data table entry definition. +// +typedef struct { + // + // intermediat input data for SMBIOS record + // + VOID *RecordData; + EFI_MISC_SMBIOS_DATA_FUNCTION *Function; +} EFI_MISC_SMBIOS_DATA_TABLE; + +// +// Data Table extern definitions. +// +#define MISC_SMBIOS_TABLE_EXTERNS(NAME1, NAME2, NAME3) \ +extern NAME1 NAME2 ## Data; \ +extern EFI_MISC_SMBIOS_DATA_FUNCTION NAME3 ## Function + + +// +// Data Table entries +// +#define MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \ +{ \ + & NAME1 ## Data, \ + & NAME2 ## Function \ +} + +// +// Global definition macros. +// +#define MISC_SMBIOS_TABLE_DATA(NAME1, NAME2) \ + NAME1 NAME2 ## Data + +#define MISC_SMBIOS_TABLE_FUNCTION(NAME2) \ + EFI_STATUS EFIAPI NAME2 ## Function( \ + IN VOID *RecordData, \ + IN EFI_SMBIOS_PROTOCOL *Smbios \ + ) + +#pragma pack(1) + +// +// This is definition for SMBIOS Oem data type 0x90 +// +typedef struct { + STRING_REF SECVersion; + STRING_REF uCodeVersion; + STRING_REF GOPVersion; + STRING_REF CpuStepping; +} EFI_MISC_OEM_TYPE_0x90; + +// +// This is definition for SMBIOS Oem data type 0x90 +// +typedef struct { + SMBIOS_STRUCTURE Hdr; + SMBIOS_TABLE_STRING SECVersion; + SMBIOS_TABLE_STRING uCodeVersion; + SMBIOS_TABLE_STRING GOPVersion; + SMBIOS_TABLE_STRING CpuStepping; +} SMBIOS_TABLE_TYPE90; + +typedef struct { + STRING_REF GopVersion; + STRING_REF UCodeVersion; + STRING_REF MRCVersion; + STRING_REF SECVersion; + STRING_REF ULPMCVersion; + STRING_REF PMCVersion; + STRING_REF PUnitVersion; + STRING_REF SoCVersion; + STRING_REF BoardVersion; + STRING_REF FabVersion; + STRING_REF CPUFlavor; + STRING_REF BiosVersion; + STRING_REF PmicVersion; + STRING_REF TouchVersion; + STRING_REF SecureBoot; + STRING_REF BootMode; + STRING_REF SpeedStepMode; + STRING_REF CPUTurboMode; + STRING_REF MaxCState; + STRING_REF GfxTurbo; + STRING_REF IdleReserve; + STRING_REF RC6; +}EFI_MISC_OEM_TYPE_0x94; + +typedef struct { + SMBIOS_STRUCTURE Hdr; + SMBIOS_TABLE_STRING GopVersion; + SMBIOS_TABLE_STRING uCodeVersion; + SMBIOS_TABLE_STRING MRCVersion; + SMBIOS_TABLE_STRING SECVersion; + SMBIOS_TABLE_STRING ULPMCVersion; + SMBIOS_TABLE_STRING PMCVersion; + SMBIOS_TABLE_STRING PUnitVersion; + SMBIOS_TABLE_STRING SoCVersion; + SMBIOS_TABLE_STRING BoardVersion; + SMBIOS_TABLE_STRING FabVersion; + SMBIOS_TABLE_STRING CPUFlavor; + SMBIOS_TABLE_STRING BiosVersion; + SMBIOS_TABLE_STRING PmicVersion; + SMBIOS_TABLE_STRING TouchVersion; + SMBIOS_TABLE_STRING SecureBoot; + SMBIOS_TABLE_STRING BootMode; + SMBIOS_TABLE_STRING SpeedStepMode; + SMBIOS_TABLE_STRING CPUTurboMode; + SMBIOS_TABLE_STRING MaxCState; + SMBIOS_TABLE_STRING GfxTurbo; + SMBIOS_TABLE_STRING IdleReserve; + SMBIOS_TABLE_STRING RC6; +}SMBIOS_TABLE_TYPE94; + +#pragma pack() +// +// Data Table Array +// +extern EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[]; + +// +// Data Table Array Entries +// +extern UINTN mMiscSubclassDataTableEntries; +extern EFI_HII_HANDLE mHiiHandle; + +// +// Prototypes +// +EFI_STATUS +EFIAPI +MiscSubclassDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + +EFI_STRING +EFIAPI +SmbiosMiscGetString ( + IN EFI_STRING_ID StringId + ); + +#endif diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.uni new file mode 100644 index 0000000000..2d0d1415d3 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriver.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverDataTable.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverDataTable.c new file mode 100644 index 0000000000..3b77a75443 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverDataTable.c @@ -0,0 +1,103 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSubclassDriverDataTable.c + +Abstract: + + Create the mMiscSubclassDataTable structure, and it is used to report + any generate data to the DataHub. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// External definitions referenced by Data Table entries. +// +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor, MiscBiosVendor); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer, MiscSystemManufacturer); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer, MiscBaseBoardManufacturer); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer, MiscChassisManufacturer); +MISC_SMBIOS_TABLE_EXTERNS(EFI_CACHE_VARIABLE_RECORD, MiscProcessorCache, MiscProcessorCache); //type 7 +MISC_SMBIOS_TABLE_EXTERNS(EFI_CPU_DATA_RECORD, MiscProcessorInformation, MiscProcessorInformation); //type 4 +MISC_SMBIOS_TABLE_EXTERNS(EFI_MEMORY_ARRAY_LOCATION_DATA, MiscPhysicalMemoryArray,MiscPhysicalMemoryArray); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MEMORY_ARRAY_LINK_DATA, MiscMemoryDevice, MiscMemoryDevice); + +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortIde1, MiscPortInternalConnectorDesignator); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortIde2, MiscPortInternalConnectorDesignator); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortAtxPower, MiscPortInternalConnectorDesignator); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx16Slot1, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx16Slot2, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx4, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx1Slot1, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx1Slot2, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx1Slot3, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCI1, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCI2, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCI3, MiscSystemSlotDesignation); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_ONBOARD_DEVICE_DATA, MiscOnboardDeviceVideo, MiscOnboardDevice); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_ONBOARD_DEVICE_DATA, MiscOnboardDeviceNetwork, MiscOnboardDevice); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_ONBOARD_DEVICE_DATA, MiscOnboardDeviceAudio, MiscOnboardDevice); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages, NumberOfInstallableLanguages); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString, SystemLanguageString); +MISC_SMBIOS_TABLE_EXTERNS(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus, BootInformationStatus); + +// +// Data Table. +// +EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[] = { + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscBiosVendor, MiscBiosVendor), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemManufacturer, MiscSystemManufacturer), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscBaseBoardManufacturer, MiscBaseBoardManufacturer), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscChassisManufacturer, MiscChassisManufacturer), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscProcessorCache, MiscProcessorCache), //type 7 + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscProcessorInformation, MiscProcessorInformation), //type 4 + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscPhysicalMemoryArray, MiscPhysicalMemoryArray), //Type 16 + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscMemoryDevice, MiscMemoryDevice), //Type 17 + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscPortIde1, MiscPortInternalConnectorDesignator), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscPortIde2, MiscPortInternalConnectorDesignator), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscPortAtxPower, MiscPortInternalConnectorDesignator), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCIEx16Slot1, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCIEx16Slot2, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCIEx4, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCIEx1Slot1, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCIEx1Slot2, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCIEx1Slot3, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCI1, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCI2, MiscSystemSlotDesignation), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscSystemSlotPCI3, MiscSystemSlotDesignation), +#if defined( ALWAYS_DISABLE_ONBOARD_VIDEO ) && \ + ( ALWAYS_DISABLE_ONBOARD_VIDEO != 0 ) + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscOnboardDeviceNetwork, MiscOnboardDevice), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscOnboardDeviceAudio, MiscOnboardDevice), +#else + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscOnboardDeviceVideo, MiscOnboardDevice), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(MiscOnboardDeviceAudio, MiscOnboardDevice), +#endif + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(SystemLanguageString, SystemLanguageString), + MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(BootInformationStatus, BootInformationStatus), +}; + +// +// Number of Data Table entries. +// +UINTN mMiscSubclassDataTableEntries = + (sizeof mMiscSubclassDataTable) / sizeof(EFI_MISC_SMBIOS_DATA_TABLE); diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverEntryPoint.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverEntryPoint.c new file mode 100644 index 0000000000..cae5a8e38a --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSubclassDriverEntryPoint.c @@ -0,0 +1,174 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSubclassDriverEntryPoint.c + +Abstract: + + This driver parses the mMiscSubclassDataTable structure and reports + any generated data to the DataHub. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" +#include + +EFI_HII_HANDLE mHiiHandle; +EFI_HII_STRING_PROTOCOL *mHiiString; + + +EFI_STRING +EFIAPI +SmbiosMiscGetString ( + IN EFI_STRING_ID StringId + ){ + + EFI_STATUS Status; + UINTN StringSize; + CHAR16 TempString; + EFI_STRING String; + String = NULL; + + // + // Retrieve the size of the string in the string package for the BestLanguage + // + StringSize = 0; + Status = mHiiString->GetString ( + mHiiString, + "en-US", + mHiiHandle, + StringId, + &TempString, + &StringSize, + NULL + ); + // + // If GetString() returns EFI_SUCCESS for a zero size, + // then there are no supported languages registered for HiiHandle. If GetString() + // returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present + // in the HII Database + // + if (Status != EFI_BUFFER_TOO_SMALL) { + goto Error; + } + + // + // Allocate a buffer for the return string + // + String = AllocateZeroPool (StringSize); + if (String == NULL) { + goto Error; + } + + // + // Retrieve the string from the string package + // + Status = mHiiString->GetString ( + mHiiString, + "en-US", + mHiiHandle, + StringId, + String, + &StringSize, + NULL + ); + if (EFI_ERROR (Status)) { + // + // Free the buffer and return NULL if the supported languages can not be retrieved. + // + FreePool (String); + String = NULL; + } +Error: + + return String; +} + +/** + Standard EFI driver point. This driver parses the mMiscSubclassDataTable + structure and reports any generated data to the DataHub. + + @param ImageHandle - Handle for the image of this driver + @param SystemTable - Pointer to the EFI System Table + + @retval EFI_SUCCESS - The data was successfully reported to the Data Hub. + @retval EFI_DEVICE_ERROR - Can not locate any protocols + +**/ +EFI_STATUS +EFIAPI +MiscSubclassDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINTN Index; + EFI_STATUS EfiStatus; + EFI_SMBIOS_PROTOCOL *Smbios; + + // + // Retrieve the pointer to the UEFI HII String Protocol + // + EfiStatus = gBS->LocateProtocol ( + &gEfiHiiStringProtocolGuid, + NULL, + (VOID **) &mHiiString + ); + ASSERT_EFI_ERROR (EfiStatus); + + EfiStatus = gBS->LocateProtocol( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID**)&Smbios + ); + + if (EFI_ERROR(EfiStatus)) { + DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus)); + return EfiStatus; + } + + mHiiHandle = HiiAddPackages ( + &gEfiCallerIdGuid, + NULL, + MiscSubclassStrings, + NULL + ); + ASSERT (mHiiHandle != NULL); + + for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) { + // + // If the entry have a function pointer, just log the data. + // + if (mMiscSubclassDataTable[Index].Function != NULL) { + EfiStatus = (*mMiscSubclassDataTable[Index].Function)( + mMiscSubclassDataTable[Index].RecordData, + Smbios + ); + + if (EFI_ERROR(EfiStatus)) { + DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus)); + return EfiStatus; + } + } + } + + return EfiStatus; +} + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageString.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageString.uni new file mode 100644 index 0000000000..763a11f467 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageString.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringData.c new file mode 100644 index 0000000000..6108697222 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringData.c @@ -0,0 +1,39 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemLanguageStringData.c + +Abstract: + + Static data of System language string information. + System language string information is Misc. subclass type 12 and SMBIOS type 13. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) += { + 0, + STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_EN_US) +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c new file mode 100644 index 0000000000..c4494c3f65 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c @@ -0,0 +1,98 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + +Module Name: + + MiscResetCapabilitiesFunction.c + +Abstract: + + ResetCapabilities. + SMBIOS type 23. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" +/** + This function makes boot time changes to the contents of the + MiscOemString (Type 11). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ + +MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE13 *SmbiosRecord; + UINTN StrLeng; + CHAR8 *OptionalStrStart; + EFI_STRING Str; + STRING_REF TokenToGet; + + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_EN_US); + Str = SmbiosMiscGetString (TokenToGet); + StrLeng = StrLen(Str); + if (StrLeng > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + SmbiosRecord->InstallableLanguages = 1; + SmbiosRecord->Flags = 1; + SmbiosRecord->CurrentLanguages = 1; + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(Str, OptionalStrStart); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturer.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturer.uni new file mode 100644 index 0000000000..cf563c8d21 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturer.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerData.c new file mode 100644 index 0000000000..055eb29b13 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerData.c @@ -0,0 +1,53 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemManufacturerData.c + +Abstract: + + Static data of System manufacturer information. + System manufacturer information is Misc. subclass type 3 and SMBIOS type 1. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) System Manufacturer data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer) += { + STRING_TOKEN(STR_MISC_SYSTEM_MANUFACTURER), // SystemManufactrurer + STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), // SystemProductName + STRING_TOKEN(STR_MISC_SYSTEM_VERSION), // SystemVersion + STRING_TOKEN(STR_MISC_SYSTEM_SERIAL_NUMBER), // SystemSerialNumber + { // SystemUuid + // + // Undefined GUID but can be programmed later. + //0xFFFFFFFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + + // Undefined GUID that cannot be programmed later. + //0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + // TODO Hard code here for WHCT test. + 0xa5000288, 0x6462, 0x4524, 0x98, 0x6a, 0x9b, 0x77, 0x37, 0xe3, 0x15, 0xcf + // + }, + EfiSystemWakeupTypePowerSwitch // SystemWakeupType +}; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c new file mode 100644 index 0000000000..ff08b5b52f --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c @@ -0,0 +1,353 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemManufacturerFunction.c + +Abstract: + + This driver parses the mMiscSubclassDataTable structure and reports + any generated data. + +--*/ + + +#include "CommonHeader.h" +#include "MiscSubclassDriver.h" +#include +#include +#include "Library/DebugLib.h" +#include + +/** + + Publish the smbios type 1. + + @param Event Event whose notification function is being invoked (gEfiDxeSmmReadyToLockProtocolGuid). + @param Context Pointer to the notification functions context, which is implementation dependent. + + @retval None + +**/ +EFI_STATUS +EFIAPI +AddSmbiosManuCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + + CHAR8 *OptionalStrStart; + UINTN ManuStrLen; + UINTN VerStrLen; + UINTN PdNameStrLen; + UINTN SerialNumStrLen; + UINTN SkuNumberStrLen; + UINTN FamilyNameStrLen; + EFI_STATUS Status; + EFI_STRING Manufacturer; + EFI_STRING ProductName; + EFI_STRING Version; + EFI_STRING SerialNumber; + EFI_STRING SkuNumber; + EFI_STRING FamilyName; + STRING_REF TokenToGet; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE1 *SmbiosRecord; + EFI_MISC_SYSTEM_MANUFACTURER *ForType1InputData; + EFI_SMBIOS_PROTOCOL *Smbios; + CHAR16 Buffer[40]; + + CHAR16 *MacStr; + EFI_HANDLE *Handles; + UINTN BufferSize; + + ForType1InputData = (EFI_MISC_SYSTEM_MANUFACTURER *)Context; + + // + // First check for invalid parameters. + // + if (Context == NULL) { + return EFI_INVALID_PARAMETER; + } + + Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID *) &Smbios); + ASSERT_EFI_ERROR (Status); + + // + // Silicon Steppings + // + switch (PchStepping()) { + case PchA0: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX A0 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"A0"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "A0 Stepping Detected\n")); + break; + case PchA1: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX A1 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"A1"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "A1 Stepping Detected\n")); + break; + case PchB0: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX B0 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B0"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "B0 Stepping Detected\n")); + break; + case PchB1: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX B1 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B1"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "B1 Stepping Detected\n")); + break; + case PchB2: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX B2 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B2"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "B2 Stepping Detected\n")); + break; + case PchB3: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX B3 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B3"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "B3 Stepping Detected\n")); + break; + case PchC0: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX C0 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"C0"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "C0 Stepping Detected\n")); + break; + case PchD0: + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"MinnowBoard MAX D0 PLATFORM"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); + UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"D0"); + HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); + DEBUG ((EFI_D_ERROR, "D0 Stepping Detected\n")); + break; + default: + DEBUG ((EFI_D_ERROR, "Unknow Stepping Detected\n")); + break; + } + + + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER); + Manufacturer = SmbiosMiscGetString (TokenToGet); + ManuStrLen = StrLen(Manufacturer); + if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME); + ProductName = SmbiosMiscGetString (TokenToGet); + PdNameStrLen = StrLen(ProductName); + if (PdNameStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_VERSION); + Version = SmbiosMiscGetString (TokenToGet); + VerStrLen = StrLen(Version); + if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + //Get handle infomation + // + BufferSize = 0; + Handles = NULL; + Status = gBS->LocateHandle ( + ByProtocol, + &gEfiSimpleNetworkProtocolGuid, + NULL, + &BufferSize, + Handles + ); + + if (Status == EFI_BUFFER_TOO_SMALL) { + Handles = AllocateZeroPool(BufferSize); + if (Handles == NULL) { + return (EFI_OUT_OF_RESOURCES); + } + Status = gBS->LocateHandle( + ByProtocol, + &gEfiSimpleNetworkProtocolGuid, + NULL, + &BufferSize, + Handles + ); + } + + // + //Get the MAC string + // + Status = NetLibGetMacString ( + *Handles, + NULL, + &MacStr + ); + if (EFI_ERROR (Status)) { + return Status; + } + SerialNumber = MacStr; + SerialNumStrLen = StrLen(SerialNumber); + if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SKU_NUMBER); + SkuNumber = SmbiosMiscGetString (TokenToGet); + SkuNumberStrLen = StrLen(SkuNumber); + if (SkuNumberStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_FAMILY_NAME1); + FamilyName = SmbiosMiscGetString (TokenToGet); + FamilyNameStrLen = StrLen(FamilyName); + if (FamilyNameStrLen > 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 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + // + // Manu will be the 1st optional string following the formatted structure. + // + SmbiosRecord->Manufacturer = 1; + + // + // ProductName will be the 2nd optional string following the formatted structure. + // + SmbiosRecord->ProductName = 2; + + // + // 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; + + SmbiosRecord->SKUNumber= 5; + SmbiosRecord->Family= 6; + + // + // Unique UUID + // + ForType1InputData->SystemUuid.Data1 = PcdGet32 (PcdProductSerialNumber); + ForType1InputData->SystemUuid.Data4[0] = PcdGet8 (PcdEmmcManufacturerId); + + 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); + + UnicodeStrToAsciiStr(SkuNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); + UnicodeStrToAsciiStr(FamilyName, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen +1); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} + +/** + This function makes boot time changes to the contents of the + MiscSystemManufacturer (Type 1). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscSystemManufacturer) +{ + EFI_STATUS Status; + static BOOLEAN CallbackIsInstalledManu = FALSE; + VOID *AddSmbiosManuCallbackNotifyReg; + EFI_EVENT AddSmbiosManuCallbackEvent; + + + if (CallbackIsInstalledManu == FALSE) { + CallbackIsInstalledManu = TRUE; // Prevent more than 1 callback. + DEBUG ((EFI_D_INFO, "Create Smbios Manu callback.\n")); + + // + // gEfiDxeSmmReadyToLockProtocolGuid is ready + // + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + (EFI_EVENT_NOTIFY)AddSmbiosManuCallback, + RecordData, + &AddSmbiosManuCallbackEvent + ); + + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + + } + + Status = gBS->RegisterProtocolNotify ( + &gEfiDxeSmmReadyToLockProtocolGuid, + AddSmbiosManuCallbackEvent, + &AddSmbiosManuCallbackNotifyReg + ); + + return Status; + } + + return EFI_SUCCESS; + +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionString.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionString.uni new file mode 100644 index 0000000000..696887a192 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionString.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringData.c new file mode 100644 index 0000000000..8fbaa8a148 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringData.c @@ -0,0 +1,36 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemOptionStringData.c + +Abstract: + + Static data of System option string. + System option string is Miscellaneous subclass type: 10 and SMBIOS type: 13. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) += { STRING_TOKEN(STR_MISC_SYSTEM_OPTION_EN_US) }; diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c new file mode 100644 index 0000000000..414afd3abc --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c @@ -0,0 +1,98 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemOptionStringFunction.c + +Abstract: + + BIOS system option string boot time changes. + SMBIOS type 12. + +--*/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +/** + This function makes boot time changes to the contents of the + MiscSystemOptionString (Type 12). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString) +{ + CHAR8 *OptionalStrStart; + UINTN OptStrLen; + EFI_STRING OptionString; + EFI_STATUS Status; + STRING_REF TokenToGet; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE12 *SmbiosRecord; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_OPTION_EN_US); + OptionString = SmbiosMiscGetString (TokenToGet); + OptStrLen = StrLen(OptionString); + if (OptStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE12); + + // + // Make handle chosen by smbios protocol.add automatically. + // + SmbiosRecord->Hdr.Handle = 0; + + SmbiosRecord->StringCount = 1; + OptionalStrStart = (CHAR8*) (SmbiosRecord + 1); + UnicodeStrToAsciiStr(OptionString, OptionalStrStart); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignation.uni b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignation.uni new file mode 100644 index 0000000000..d5470b6fb0 Binary files /dev/null and b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignation.uni differ diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationData.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationData.c new file mode 100644 index 0000000000..17e69c2e3d --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationData.c @@ -0,0 +1,251 @@ +/** @file + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemSlotDesignationData.c + +Abstract: + + Static data of System Slot Designation. + System Slot Designation is Misc. subclass type 7 and SMBIOS type 9. + + +**/ + + +#include "CommonHeader.h" + +#include "MiscSubclassDriver.h" + + +// +// Static (possibly build generated) Bios Vendor data. +// +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx16Slot1) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCIEX16_1), // SlotDesignation + EfiSlotTypePciExpress, // SlotType + EfiSlotDataBusWidth16xOrx16, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthShort, // SlotLength + 0x06, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 0, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 0, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx16Slot2) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCIEX16_2), // SlotDesignation + EfiSlotTypePciExpress, // SlotType + EfiSlotDataBusWidth16xOrx16, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthShort, // SlotLength + 0x04, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 0, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 0, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx4) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCIEX4), // SlotDesignation + EfiSlotTypePciExpress, // SlotType + EfiSlotDataBusWidth4xOrx4, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthShort, // SlotLength + 0x03, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 0, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 0, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx1Slot1) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCIEX1_1), // SlotDesignation + EfiSlotTypePciExpress, // SlotType + EfiSlotDataBusWidth1xOrx1, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthShort, // SlotLength + 0x02, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 1, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 1, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx1Slot2) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCIEX1_2), // SlotDesignation + EfiSlotTypePciExpress, // SlotType + EfiSlotDataBusWidth1xOrx1, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthShort, // SlotLength + 0x15, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 1, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 1, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCIEx1Slot3) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCIEX1_3), // SlotDesignation + EfiSlotTypePciExpress, // SlotType + EfiSlotDataBusWidth1xOrx1, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthShort, // SlotLength + 0x16, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 1, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 1, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCI1) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCI1), // SlotDesignation + EfiSlotTypePci, // SlotType + EfiSlotDataBusWidth32Bit, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthLong , // SlotLength + 0x07, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 1, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 1, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCI2) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCI2), // SlotDesignation + EfiSlotTypePci, // SlotType + EfiSlotDataBusWidth32Bit, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthLong , // SlotLength + 0x18, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 1, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 1, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + +MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotPCI3) = { + STRING_TOKEN(STR_MISC_SYSTEM_SLOT_PCI3), // SlotDesignation + EfiSlotTypePci, // SlotType + EfiSlotDataBusWidth32Bit, // SlotDataBusWidth + EfiSlotUsageAvailable, // SlotUsage + EfiSlotLengthLong , // SlotLength + 0x17, // SlotId + { // SlotCharacteristics + 0, // CharacteristicsUnknown :1; + 0, // Provides50Volts :1; + 1, // Provides33Volts :1; + 0, // SharedSlot :1; + 0, // PcCard16Supported :1; + 0, // CardBusSupported :1; + 0, // ZoomVideoSupported :1; + 0, // ModemRingResumeSupported:1; + 1, // PmeSignalSupported :1; + 0, // HotPlugDevicesSupported :1; + 1, // SmbusSignalSupported :1; + 0 // Reserved :21; + }, + 0 // SlotDevicePath +}; + diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c new file mode 100644 index 0000000000..30be4adac4 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c @@ -0,0 +1,132 @@ +/*++ + +Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + MiscSystemSlotDesignatorFunction.c + +Abstract: + + BIOS system slot designator information boot time changes. + SMBIOS type 9. + +--*/ + +#include "MiscSubclassDriver.h" + +/** + This function makes boot time changes to the contents of the + MiscSystemSlotDesignator structure (Type 9). + + @param RecordData Pointer to copy of RecordData from the Data Table. + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation) +{ + CHAR8 *OptionalStrStart; + UINTN SlotDesignationStrLen; + EFI_STATUS Status; + EFI_STRING SlotDesignation; + STRING_REF TokenToGet; + SMBIOS_TABLE_TYPE9 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_MISC_SYSTEM_SLOT_DESIGNATION* ForType9InputData; + + ForType9InputData = (EFI_MISC_SYSTEM_SLOT_DESIGNATION *)RecordData; + + // + // First check for invalid parameters. + // + if (RecordData == NULL) { + return EFI_INVALID_PARAMETER; + } + + TokenToGet = 0; + switch (ForType9InputData->SlotDesignation) { + case STR_MISC_SYSTEM_SLOT_PCIEX16_1: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCIEX16_1); + break; + case STR_MISC_SYSTEM_SLOT_PCIEX16_2: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCIEX16_2); + break; + case STR_MISC_SYSTEM_SLOT_PCIEX4: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCIEX4); + break; + case STR_MISC_SYSTEM_SLOT_PCIEX1_1: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCIEX1_1); + break; + case STR_MISC_SYSTEM_SLOT_PCIEX1_2: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCIEX1_2); + break; + case STR_MISC_SYSTEM_SLOT_PCIEX1_3: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCIEX1_3); + break; + case STR_MISC_SYSTEM_SLOT_PCI1: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCI1); + break; + case STR_MISC_SYSTEM_SLOT_PCI2: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCI2); + break; + case STR_MISC_SYSTEM_SLOT_PCI3: + TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_PCI3); + break; + default: + break; + } + + SlotDesignation = SmbiosMiscGetString (TokenToGet); + SlotDesignationStrLen = StrLen(SlotDesignation); + if (SlotDesignationStrLen > SMBIOS_STRING_MAX_LENGTH) { + return EFI_UNSUPPORTED; + } + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE9) + SlotDesignationStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE9) +SlotDesignationStrLen + 1 + 1); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE9); + SmbiosRecord->Hdr.Handle = 0; + SmbiosRecord->SlotDesignation = 1; + SmbiosRecord->SlotType = (UINT8)ForType9InputData->SlotType; + SmbiosRecord->SlotDataBusWidth = (UINT8)ForType9InputData->SlotDataBusWidth; + SmbiosRecord->CurrentUsage = (UINT8)ForType9InputData->SlotUsage; + SmbiosRecord->SlotLength = (UINT8)ForType9InputData->SlotLength; + SmbiosRecord->SlotID = ForType9InputData->SlotId; + + // + // Slot Characteristics + // + CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2); + OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart); + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + Status = Smbios-> Add( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord + ); + FreePool(SmbiosRecord); + return Status; +} diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf b/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf new file mode 100644 index 0000000000..842dda3600 --- /dev/null +++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf @@ -0,0 +1,144 @@ +## @file +# Component name for module MiscSubclass +# +# FIX ME! +# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available under +# the terms and conditions of the BSD License that accompanies this distribution. +# The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = MiscSubclass + FILE_GUID = 4EFFB560-B28B-4e57-9DAD-4344E32EA3BA + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = MiscSubclassDriverEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + MiscBaseBoardManufacturer.uni + MiscBaseBoardManufacturerData.c + MiscBaseBoardManufacturerFunction.c + MiscBiosVendor.uni + MiscBiosVendorData.c + MiscBiosVendorFunction.c + MiscBootInformationData.c + MiscBootInformationFunction.c + MiscChassisManufacturer.uni + MiscChassisManufacturerData.c + MiscChassisManufacturerFunction.c + MiscNumberOfInstallableLanguagesData.c + MiscNumberOfInstallableLanguagesFunction.c + MiscOemString.uni + MiscOemStringData.c + MiscOemStringFunction.c + MiscOnboardDevice.uni + MiscOnboardDeviceData.c + MiscOnboardDeviceFunction.c + MiscPortInternalConnectorDesignator.uni + MiscPortInternalConnectorDesignatorData.c + MiscPortInternalConnectorDesignatorFunction.c + MiscResetCapabilitiesData.c + MiscResetCapabilitiesFunction.c + MiscSystemLanguageString.uni + MiscSystemLanguageStringData.c + MiscSystemLanguageStringFunction.c + MiscSystemManufacturer.uni + MiscSystemManufacturerData.c + MiscSystemManufacturerFunction.c + MiscSystemOptionString.uni + MiscSystemOptionStringData.c + MiscSystemOptionStringFunction.c + MiscSystemSlotDesignation.uni + MiscSystemSlotDesignationData.c + MiscSystemSlotDesignationFunction.c + MiscSubclassDriver.h + MiscSubclassDriver.uni + MiscSubclassDriverDataTable.c + MiscSubclassDriverEntryPoint.c + CommonHeader.h + MiscOemType0x90Function.c + MiscOemType0x90Data.c + MiscOemType0x90.uni + MiscProcessorInformation.uni + MiscProcessorInformationData.c + MiscProcessorInformationFunction.c + MiscProcessorCache.uni + MiscProcessorCacheData.c + MiscProcessorCacheFunction.c + MiscPhysicalArray.uni + MiscPhysicalArrayData.c + MiscPhysicalArrayFunction.c + MiscMemoryDevice.uni + MiscMemoryDeviceData.c + MiscMemoryDeviceFunction.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + Vlv2TbltDevicePkg/PlatformPkg.dec + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec + +[LibraryClasses] + HiiLib + DevicePathLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiDriverEntryPoint + BaseMemoryLib + DebugLib + BaseLib + MemoryAllocationLib + PcdLib + UefiLib + BiosIdLib + PrintLib + CpuIA32Lib + PchPlatformLib + I2cLib + NetLib + +[Guids] + gEfiProcessorSubClassGuid + gEfiCacheSubClassGuid + gEfiNormalSetupGuid + gEfiPlatformInfoGuid + gEfiVlv2VariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiDataHubProtocolGuid + gEfiMpServiceProtocolGuid + gMemInfoProtocolGuid + gEfiTdtOperationProtocolGuid + gDxePchPlatformPolicyProtocolGuid + gEfiSpiProtocolGuid + gEfiSimpleNetworkProtocolGuid + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang + gEfiVLVTokenSpaceGuid.PcdEmmcManufacturerId + gEfiVLVTokenSpaceGuid.PcdProductSerialNumber + +[Depex] + gEfiSmbiosProtocolGuid AND gMemInfoProtocolGuid AND gEfiMpServiceProtocolGuid AND gEfiSimpleNetworkProtocolGuid -- cgit v1.2.3