From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com []) by mx.groups.io with SMTP id smtpd.web10.2401.1573615709373949821 for ; Tue, 12 Nov 2019 19:29:33 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: michael.a.kubacki@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2019 19:29:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,299,1569308400"; d="scan'208";a="379090996" Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga005.jf.intel.com with ESMTP; 12 Nov 2019 19:29:32 -0800 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Sai Chaganty , Liming Gao Subject: [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package Date: Tue, 12 Nov 2019 19:27:46 -0800 Message-Id: <20191113032816.4056-21-michael.a.kubacki@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20191113032816.4056-1-michael.a.kubacki@intel.com> References: <20191113032816.4056-1-michael.a.kubacki@intel.com> Adds a new feature package for the SMBIOS feature. Cc: Sai Chaganty Cc: Liming Gao Signed-off-by: Michael Kubacki --- Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec | 172 ++++++++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc | 115 +++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc | 30 ++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf | 10 ++ Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf | 8 + Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf | 83 ++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h | 45 +++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c | 125 ++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c | 81 +++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c | 114 +++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c | 131 +++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c | 56 +++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c | 125 ++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md | 86 ++++++++++ 14 files changed, 1181 insertions(+) diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec new file mode 100644 index 0000000000..c06a87aad0 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec @@ -0,0 +1,172 @@ +## @file +# This package provides advanced feature functionality for System Management BIOS (SMBIOS). +# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION = 0x00010017 + PACKAGE_NAME = SmbiosFeaturePkg + PACKAGE_GUID = 8CCEE569-02AD-4844-8725-F4C7966E320A + PACKAGE_VERSION = 0.1 + +[Includes] + Include + +[LibraryClasses] + +[Guids] + gSmbiosFeaturePkgTokenSpaceGuid = {0xc1530658, 0xe234, 0x4c13, {0xb6, 0x82, 0xd3, 0x87, 0x84, 0xf1, 0xd7, 0x16}} + +[PcdsFeatureFlag] + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|FALSE|BOOLEAN|0xA0000001 + +[PcdsDynamic, PcdsDynamicEx] + # + # SMBIOS Type 0 BIOS Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xD0000001 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVersion|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegment|0xF000 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosReleaseDate|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize|0xFF + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PciIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PlugAndPlayIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosIsUpgradable|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BiosShadowingAllowed|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.BootFromCdIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SelectableBootIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.EDDSpecificationIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy525_12IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_720IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Floppy35_288IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrintScreenIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.Keyboard8042IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.SerialIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.PrinterIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosCharacteristics.CgaMonoIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F + + # + # SMBIOS Type 1 System Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|SMBIOS_TABLE_TYPE1|0xD0000002 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufacturer|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.ProductName|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Version|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SerialNumber|0x4 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{GUID("88888888-8887-8888-8888-878888888888")} + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpType|SystemWakeupTypePowerSwitch + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNumber|0x5 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Family|0x6 + + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation|{0x0}|SMBIOS_TABLE_TYPE2|0xD0000003 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + + # + # SMBIOS Type 2 Base Board Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Manufacturer|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.ProductName|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Version|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.SerialNumber|0x4 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.AssetTag|0x5 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Motherboard|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.FeatureFlag.Replaceable|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.LocationInChassis|0x6 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.BoardType|BaseBoardTypeMotherBoard + + # + # SMBIOS Type 3 System Enclosure Chassis + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0x0}|SMBIOS_TABLE_TYPE3|0xD0000004 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Manufacturer|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Type|MiscChassisTypeRackMountChassis + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Version|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SerialNumber|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.AssetTag|0x4 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.BootupState|ChassisStateSafe + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.PowerSupplyState|ChassisStateSafe + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.ThermalState|ChassisStateSafe + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.SecurityStatus|ChassisSecurityStatusNone + + # + # SMBIOS Type 32 System Boot Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0x0}|SMBIOS_TABLE_TYPE32|0xD0000005 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.BootStatus|BootInformationStatusNoError + + # + # SMBIOS Type 0 BIOS Information Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"2008-12-23"|VOID*|0xD1000001 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY CV/CRB BIOS Internal"|VOID*|0xD1000002 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corporation"|VOID*|0xD1000003 + + # + # SMBIOS Type 1 System Information Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOID*|0xD1000004 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel Corporation"|VOID*|0xD1000005 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY"|VOID*|0xD1000006 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNOWN"|VOID*|0xD1000007 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Number"|VOID*|0xD1000008 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*|0xD1000009 + + # + # SMBIOS Type 2 Base Board Information Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Board Asset Tag"|VOID*|0xD100000A + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"Part Component"|VOID*|0xD100000B + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel Corporation"|VOID*|0xD100000C + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY"|VOID*|0xD100000D + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO03200016"|VOID*|0xD100000E + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400"|VOID*|0xD100000F + + # + # SMBIOS Type 3 System Enclosure Chassis Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis Asset Tag"|VOID*|0xD1000011 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel Corporation"|VOID*|0xD1000012 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNOWN"|VOID*|0xD1000013 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Number"|VOID*|0xD1000014 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*|0xD1000015 diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc new file mode 100644 index 0000000000..a59fdf3702 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeature.dsc @@ -0,0 +1,115 @@ +## @file +# This is a build description file for the SMBIOS advanced feature. +# This file should be included into another package DSC file to build this feature. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] +!ifndef $(PEI_ARCH) + !error "PEI_ARCH must be specified to build this feature!" +!endif +!ifndef $(DXE_ARCH) + !error "DXE_ARCH must be specified to build this feature!" +!endif + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this feature. +# +################################################################################ +[LibraryClasses] + ####################################### + # Edk2 Packages + ####################################### + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + +[LibraryClasses.common.DXE_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + +################################################################################ +# +# Component section - list of all components that need built for this feature. +# +# Note: The EDK II DSC file is not used to specify how compiled binary images get placed +# into firmware volume images. This section is just a list of modules to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary files into firmware +# volume images, whose concept is beyond UEFI and is described in PI specification. +# There may also be modules listed in this section that are not required in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be +# generated for it, but the binary will not be put into any firmware volume. +# +################################################################################ +# +# Feature PEI Components +# + +# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308 +# is completed. +[Components.IA32] + ##################################### + # SMBIOS Feature Package + ##################################### + + # Add library instances here that are not included in package components and should be tested + # in the package build. + + # Add components here that should be included in the package build. + +# +# Feature DXE Components +# + +# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzilla.tianocore.org/show_bug.cgi?id=2308 +# is completed. +[Components.X64] + ##################################### + # SMBIOS Feature Package + ##################################### + + # Add library instances here that are not included in package components and should be tested + # in the package build. + + # Add components here that should be included in the package build. + SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf + +################################################################################################### +# +# BuildOptions Section - Define the module specific tool chain flags that should be used as +# the default flags for a module. These flags are appended to any +# standard flags that are defined by the build process. They can be +# applied for any modules or only those modules with the specific +# module style (EDK or EDKII) specified in [Components] section. +# +# For advanced features, it is recommended to enable [BuildOptions] in +# the applicable INF file so it does not affect the whole board package +# build when this DSC file is active. +# +################################################################################################### +[BuildOptions] diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc new file mode 100644 index 0000000000..31141c0725 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dsc @@ -0,0 +1,30 @@ +## @file +# This package provides advanced feature functionality for System Management BIOS (SMBIOS). +# This package should only depend on EDK II Core packages, IntelSiliconPkg, and MinPlatformPkg. +# +# The DEC files are used by the utilities that parse DSC and +# INF files to generate AutoGen.c and AutoGen.h files +# for the build infrastructure. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME = SmbiosFeaturePkg + PLATFORM_GUID = 44AF1C2A-16AD-4509-8DF6-988E73E23A85 + PLATFORM_VERSION = 0.1 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES = IA32|X64 + BUILD_TARGETS = DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER = DEFAULT + PEI_ARCH = IA32 + DXE_ARCH = X64 + +# +# This package always builds the feature. +# +!include Include/SmbiosFeature.dsc diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf new file mode 100644 index 0000000000..3ed23bd937 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PostMemory.fdf @@ -0,0 +1,10 @@ +## @file +# FDF file for post-memory SMBIOS modules. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + INF SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf new file mode 100644 index 0000000000..732c1b69e5 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreMemory.fdf @@ -0,0 +1,8 @@ +## @file +# FDF file for pre-memory SMBIOS modules. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf new file mode 100644 index 0000000000..bd8736b621 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicDxe.inf @@ -0,0 +1,83 @@ +### @file +# Component description file for the SMBIOS basic module. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SmbiosBasic + FILE_GUID = 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = SmbiosBasicEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources] + SmbiosBasic.h + SmbiosBasicEntryPoint.c + Type0BiosVendorFunction.c + Type1SystemManufacturerFunction.c + Type2BaseBoardManufacturerFunction.c + Type32BootInformationFunction.c + Type3ChassisManufacturerFunction.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + HobLib + MemoryAllocationLib + PcdLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiVariableArchProtocolGuid + +[Pcd] + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis + +[Depex] + gEfiSmbiosProtocolGuid AND + gEfiVariableArchProtocolGuid diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h new file mode 100644 index 0000000000..e206d69726 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasic.h @@ -0,0 +1,45 @@ +/** @file + Smbios basic header file. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SMBIOS_BASIC_DRIVER_H +#define _SMBIOS_BASIC_DRIVER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + Add an SMBIOS record. + + @param Smbios The EFI_SMBIOS_PROTOCOL instance. + @param SmbiosHandle A unique handle will be assigned to the SMBIOS record. + @param Record The data for the fixed portion of the SMBIOS record. The format of the record is + determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined + by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or + a set of null terminated strings and a null. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources. + +**/ +EFI_STATUS +AddSmbiosRecord ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, + IN EFI_SMBIOS_TABLE_HEADER *Record + ); + +#endif diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c new file mode 100644 index 0000000000..4b24d1a124 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c @@ -0,0 +1,125 @@ +/** @file + Smbios basic entry point. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosBasic.h" + +EFI_STATUS +EFIAPI +BiosVendorFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +EFI_STATUS +EFIAPI +SystemManufacturerFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +EFI_STATUS +EFIAPI +BaseBoardManufacturerFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +EFI_STATUS +EFIAPI +ChassisManufacturerFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +EFI_STATUS +EFIAPI +BootInfoStatusFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +typedef +EFI_STATUS +(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +typedef struct { + EFI_BASIC_SMBIOS_DATA_FUNCTION *Function; +} EFI_BASIC_SMBIOS_DATA; + +EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] = { + {&BiosVendorFunction}, + {&SystemManufacturerFunction}, + {&BaseBoardManufacturerFunction}, + {&ChassisManufacturerFunction}, + {&BootInfoStatusFunction}, +}; + +/** + Standard EFI driver point. This driver parses the mSmbiosMiscDataTable + structure and reports any generated data using SMBIOS protocol. + + @param ImageHandle Handle for the image of this driver + @param SystemTable Pointer to the EFI System Table + + @retval EFI_SUCCESS The data was successfully stored. + +**/ +EFI_STATUS +EFIAPI +SmbiosBasicEntryPoint( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINTN Index; + EFI_STATUS EfiStatus; + EFI_SMBIOS_PROTOCOL *Smbios; + + EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios); + if (EFI_ERROR(EfiStatus)) { + DEBUG((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus)); + return EfiStatus; + } + + for (Index = 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbiosBasicDataFuncTable[0]); ++Index) { + EfiStatus = (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios); + if (EFI_ERROR(EfiStatus)) { + DEBUG((DEBUG_ERROR, "Basic smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus)); + return EfiStatus; + } + } + + return EfiStatus; +} + +/** + Add an SMBIOS record. + + @param Smbios The EFI_SMBIOS_PROTOCOL instance. + @param SmbiosHandle A unique handle will be assigned to the SMBIOS record. + @param Record The data for the fixed portion of the SMBIOS record. The format of the record is + determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined + by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or + a set of null terminated strings and a null. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources. + +**/ +EFI_STATUS +AddSmbiosRecord ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, + IN EFI_SMBIOS_TABLE_HEADER *Record + ) +{ + *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + return Smbios->Add ( + Smbios, + NULL, + SmbiosHandle, + Record + ); +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c new file mode 100644 index 0000000000..a0db734698 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c @@ -0,0 +1,81 @@ +/** @file + Smbios type 0. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosBasic.h" + +/** + This function makes boot time changes to the contents of the + BiosVendor (Type 0). + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +EFI_STATUS +EFIAPI +BiosVendorFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + CHAR8 *VendorStr; + UINTN VendorStrLen; + CHAR8 *VersionStr; + UINTN VerStrLen; + CHAR8 *DateStr; + UINTN DateStrLen; + SMBIOS_TABLE_TYPE0 *SmbiosRecord; + SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINTN StringOffset; + + PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType0BiosInformation); + + VendorStr = PcdGetPtr (PcdSmbiosType0StringVendor); + VendorStrLen = AsciiStrLen (VendorStr); + ASSERT (VendorStrLen <= SMBIOS_STRING_MAX_LENGTH); + + VersionStr = PcdGetPtr (PcdSmbiosType0StringBiosVersion); + VerStrLen = AsciiStrLen (VersionStr); + ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH); + + DateStr = PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate); + DateStrLen = AsciiStrLen (DateStr); + ASSERT (DateStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); + if (SmbiosRecord == NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0)); + + SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BIOS_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0); + SmbiosRecord->Hdr.Handle = 0; + + StringOffset = SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen); + StringOffset += VendorStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); + StringOffset += VerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + + FreePool (SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c new file mode 100644 index 0000000000..3b8e39fe53 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c @@ -0,0 +1,114 @@ +/** @file + Smbios type 1. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosBasic.h" + +/** + This function makes boot time changes to the contents of the + SystemManufacturer (Type 1). + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +EFI_STATUS +EFIAPI +SystemManufacturerFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + CHAR8 *ManufacturerStr; + CHAR8 *ProductNameStr; + CHAR8 *VersionStr; + CHAR8 *SerialNumberStr; + CHAR8 *SKUNumberStr; + CHAR8 *FamilyStr; + UINTN ManufacturerStrLen; + UINTN ProductNameStrLen; + UINTN VersionStrLen; + UINTN SerialNumberStrLen; + UINTN SKUNumberStrLen; + UINTN FamilyStrLen; + UINTN TableSize; + SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord; + SMBIOS_TABLE_TYPE1 *SmbiosRecord; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINTN StringOffset; + + PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType1SystemInformation); + + ManufacturerStr = PcdGetPtr (PcdSmbiosType1StringManufacturer); + ManufacturerStrLen = AsciiStrLen (ManufacturerStr); + ASSERT (ManufacturerStrLen <= SMBIOS_STRING_MAX_LENGTH); + + ProductNameStr = PcdGetPtr (PcdSmbiosType1StringProductName); + ProductNameStrLen = AsciiStrLen (ProductNameStr); + ASSERT (ProductNameStrLen <= SMBIOS_STRING_MAX_LENGTH); + + VersionStr = PcdGetPtr (PcdSmbiosType1StringVersion); + VersionStrLen = AsciiStrLen (VersionStr); + ASSERT (VersionStrLen <= SMBIOS_STRING_MAX_LENGTH); + + SerialNumberStr = PcdGetPtr (PcdSmbiosType1StringSerialNumber); + SerialNumberStrLen = AsciiStrLen (SerialNumberStr); + ASSERT (SerialNumberStrLen <= SMBIOS_STRING_MAX_LENGTH); + + SKUNumberStr = PcdGetPtr (PcdSmbiosType1StringSKUNumber); + SKUNumberStrLen = AsciiStrLen (SKUNumberStr); + ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH); + + FamilyStr = PcdGetPtr (PcdSmbiosType1StringFamily); + FamilyStrLen = AsciiStrLen (FamilyStr); + ASSERT (FamilyStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Create table size based on string lengths + // + TableSize = sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + ProductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1; + SmbiosRecord = AllocateZeroPool (TableSize); + if (SmbiosRecord == NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1)); + + // + // Fill in Type 1 fields + // + + SmbiosRecord->Hdr.Type = SMBIOS_TYPE_SYSTEM_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1); + SmbiosRecord->Hdr.Handle = 0; + + // + // Add strings to bottom of data block + // + StringOffset = SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManufacturerStrLen); + StringOffset += ManufacturerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNameStrLen); + StringOffset += ProductNameStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen); + StringOffset += VersionStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumberStrLen); + StringOffset += SerialNumberStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen); + StringOffset += SKUNumberStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c new file mode 100644 index 0000000000..9193cb0be7 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c @@ -0,0 +1,131 @@ +/** @file + Smbios type 2. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosBasic.h" + +/** + This function makes boot time changes to the contents of the + BaseBoardManufacturer (Type 2). + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +EFI_STATUS +EFIAPI +BaseBoardManufacturerFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + CHAR8 *ManufacturerStr; + CHAR8 *ProductStr; + CHAR8 *VersionStr; + CHAR8 *SerialNumberStr; + CHAR8 *AssertTagStr; + CHAR8 *ChassisStr; + UINTN ManuStrLen; + UINTN ProductStrLen; + UINTN VerStrLen; + UINTN AssertTagStrLen; + UINTN SerialNumStrLen; + UINTN ChassisStrLen; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord; + SMBIOS_TABLE_TYPE2 *SmbiosRecord; + UINTN SourceSize; + UINTN TotalSize; + UINTN StringOffset; + + PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType2BaseBoardInformation); + + // + // Get BoardManufacturer String. + // + ManufacturerStr = PcdGetPtr (PcdSmbiosType2StringManufacturer); + ManuStrLen = AsciiStrLen (ManufacturerStr); + ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board ProductName String. + // + ProductStr = PcdGetPtr (PcdSmbiosType2StringProductName); + ProductStrLen = AsciiStrLen (ProductStr); + ASSERT (ProductStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Version String. + // + VersionStr = PcdGetPtr (PcdSmbiosType2StringVersion); + VerStrLen = AsciiStrLen (VersionStr); + ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Serial Number String. + // + SerialNumberStr = PcdGetPtr (PcdSmbiosType2StringSerialNumber); + SerialNumStrLen = AsciiStrLen (SerialNumberStr); + ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Asset Tag String. + // + AssertTagStr = PcdGetPtr (PcdSmbiosType2StringAssetTag); + AssertTagStrLen = AsciiStrLen (AssertTagStr); + ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Chassis Location Tag String. + // + ChassisStr = PcdGetPtr (PcdSmbiosType2StringLocationInChassis); + ChassisStrLen = AsciiStrLen (ChassisStr); + ASSERT (ChassisStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Two zeros following the last string. + // + SourceSize = PcdGetSize (PcdSmbiosType2BaseBoardInformation); + TotalSize = SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1; + SmbiosRecord = AllocateZeroPool(TotalSize); + if (SmbiosRecord == NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); + + SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BASEBOARD_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2); + if (PcdSmbiosRecord->NumberOfContainedObjectHandles >= 2) { + SmbiosRecord->Hdr.Length += (PcdSmbiosRecord->NumberOfContainedObjectHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles); + } + ASSERT(SourceSize >= SmbiosRecord->Hdr.Length); + SmbiosRecord->Hdr.Handle = 0; + + StringOffset = SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen); + StringOffset += ManuStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen); + StringOffset += ProductStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); + StringOffset += VerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen); + StringOffset += SerialNumStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen); + StringOffset += AssertTagStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c new file mode 100644 index 0000000000..87bfd045da --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c @@ -0,0 +1,56 @@ +/** @file + Smbios type 32. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosBasic.h" + + +/** + This function makes boot time changes to the contents of the + BootInformation (Type 32). + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +EFI_STATUS +EFIAPI +BootInfoStatusFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord; + SMBIOS_TABLE_TYPE32 *SmbiosRecord; + + PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType32SystemBootInformation); + + // + // Two zeros following the last string. + // + SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1); + if (SmbiosRecord == NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32)); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION; + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32); + SmbiosRecord->Hdr.Handle = 0; + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c new file mode 100644 index 0000000000..33732bc9ca --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c @@ -0,0 +1,125 @@ +/** @file + Smbios type 3. + +Copyright (c) 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosBasic.h" + +/** + This function makes boot time changes to the contents of the + ChassisManufacturer (Type 3). + + @retval EFI_SUCCESS All parameters were valid. + @retval EFI_UNSUPPORTED Unexpected RecordType value. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + +**/ +EFI_STATUS +EFIAPI +ChassisManufacturerFunction( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + UINTN ManuStrLen; + UINTN VerStrLen; + UINTN AssertTagStrLen; + UINTN SerialNumStrLen; + UINTN SKUNumberStrLen; + EFI_STATUS Status; + CHAR8 *ManufacturerStr; + CHAR8 *VersionStr; + CHAR8 *SerialNumberStr; + CHAR8 *AssertTagStr; + CHAR8 *SKUNumberStr; + SMBIOS_TABLE_STRING *SKUNumberPtr; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_TABLE_TYPE3 *SmbiosRecord; + SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord; + UINTN SourceSize; + UINTN TotalSize; + UINTN StringOffset; + + PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis); + + // + // Get ChassisManufacturer String. + // + ManufacturerStr = PcdGetPtr (PcdSmbiosType3StringManufacturer); + ManuStrLen = AsciiStrLen (ManufacturerStr); + ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisVersion String. + // + VersionStr = PcdGetPtr (PcdSmbiosType3StringVersion); + VerStrLen = AsciiStrLen (VersionStr); + ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisSerialNumber String. + // + SerialNumberStr = PcdGetPtr (PcdSmbiosType3StringSerialNumber); + SerialNumStrLen = AsciiStrLen (SerialNumberStr); + ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisAssetTag String. + // + AssertTagStr = PcdGetPtr (PcdSmbiosType3StringAssetTag); + AssertTagStrLen = AsciiStrLen (AssertTagStr); + ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisSKUNumber String. + // + SKUNumberStr = PcdGetPtr (PcdSmbiosType3StringSKUNumber); + SKUNumberStrLen = AsciiStrLen (SKUNumberStr); + ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH); + + // + // Two zeros following the last string. + // + SourceSize = PcdGetSize(PcdSmbiosType3SystemEnclosureChassis); + TotalSize = SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1; + SmbiosRecord = AllocateZeroPool(TotalSize); + if (SmbiosRecord == NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); + + SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; + SmbiosRecord->Hdr.Length = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) + sizeof(SMBIOS_TABLE_STRING); + if (PcdSmbiosRecord->ContainedElementCount >= 1) { + SmbiosRecord->Hdr.Length += PcdSmbiosRecord->ContainedElementCount * PcdSmbiosRecord->ContainedElementRecordLength; + } + SmbiosRecord->Hdr.Handle = 0; + + if ((PcdSmbiosRecord->ContainedElementCount == 0) || (SourceSize < (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) { + SKUNumberPtr = (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING)); + *SKUNumberPtr = 5; + } + + StringOffset = SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen); + StringOffset += ManuStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); + StringOffset += VerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen); + StringOffset += SerialNumStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen); + StringOffset += AssertTagStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen); + + // + // Now we have got the full smbios record, call smbios protocol to add this record. + // + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md new file mode 100644 index 0000000000..104cb153a6 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md @@ -0,0 +1,86 @@ +# Overview +* **Feature Name:** System Management BIOS (SMBIOS) +* **PI Phase(s) Supported:** DXE +* **SMM Required?** No + +## Purpose +*_TODO_* +Simple overview that describes the purpose of the feature. In general, this should be no longer than one paragraph. + +# High-Level Theory of Operation +*_TODO_* +A description of how the device works at a high-level. + +The description should not be constrained to implementation details but provide a simple mental model of how the +feature is supposed to work. + +## Firmware Volumes +*_TODO_* +A bulleted list of the firmware volumes that feature module(s) are placed in. + +## Modules +*_TODO_* +A bulleted list of the modules that make up the feature. + +## +*_TODO_* +Each module in the feature should have a section that describes the module in a level of detail that is useful +to better understand the module source code. + +## +*_TODO_* +Each library in the feature should have a section that describes the library in a level of detail that is useful +to better understand the library source code. + +## Key Functions +*_TODO_* +A bulleted list of key functions for interacting with the feature. + +Not all features need to be listed. Only functions exposed through external interfaces that are important for feature +users to be aware of. + +## Configuration +*_TODO_* +Information that is useful for configuring the feature. + +Not all configuration options need to be listed. This section is used to provide more background on configuration +options than possible elsewhere. + +## Data Flows +*_TODO_* +Architecturally defined data structures and flows for the feature. + +## Control Flows +*_TODO_* +Key control flows for the feature. + +## Build Flows +*_TODO_* +Any special build flows should be described in this section. + +This is particularly useful for features that use custom build tools or require non-standard tool configuration. If the +standard flow in the feature package template is used, this section may be empty. + +## Test Point Results +*_TODO_* +The test(s) that can verify porting is complete for the feature. + +Each feature must describe at least one test point to verify the feature is successful. If the test point is not +implemented, this should be stated. + +## Functional Exit Criteria +*_TODO_* +The testable functionality for the feature. + +This section should provide an ordered list of criteria that a board integrator can reference to ensure the feature is +functional on their board. + +## Feature Enabling Checklist +*_TODO_* +An ordered list of required activities to achieve desired functionality for the feature. + +## Common Optimizations +*_TODO_* +Common size or performance tuning options for this feature. + +This section is recommended but not required. If not used, the contents should be left empty. -- 2.16.2.windows.1