From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.420.1575417428424812441 for ; Tue, 03 Dec 2019 15:57:25 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: nathaniel.l.desimone@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 15:57:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,275,1571727600"; d="scan'208";a="223018329" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by orsmga002.jf.intel.com with ESMTP; 03 Dec 2019 15:57:25 -0800 Received: from orsmsx125.amr.corp.intel.com (10.22.240.125) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 3 Dec 2019 15:57:24 -0800 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.67]) by ORSMSX125.amr.corp.intel.com ([169.254.3.139]) with mapi id 14.03.0439.000; Tue, 3 Dec 2019 15:57:24 -0800 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "Kubacki, Michael A" CC: "Chaganty, Rangasai V" , "Gao, Liming" Subject: Re: [edk2-devel] [edk2-platforms][PATCH V2 16/47] Features/Intel/SmbiosFeaturePkg: Add initial package Thread-Topic: [edk2-devel] [edk2-platforms][PATCH V2 16/47] Features/Intel/SmbiosFeaturePkg: Add initial package Thread-Index: AQHVpYg32JAF7CZ9CEKnjaqiVrpkbaepHvvA Date: Tue, 3 Dec 2019 23:57:24 +0000 Message-ID: <02A34F284D1DA44BB705E61F7180EF0AB5C13DCD@ORSMSX114.amr.corp.intel.com> References: <20191128010614.43628-1-michael.a.kubacki@intel.com> <20191128010614.43628-17-michael.a.kubacki@intel.com> In-Reply-To: <20191128010614.43628-17-michael.a.kubacki@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZmY5MmRlNzYtMWY0ZS00NWExLWJmY2UtMTA0NzEwNTc2Y2M2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS2dyb1NhZ3dRVVp2XC9rODd5a0RtcEcxdW92b3ZIVzJmODR3bk5yU1FZREVoUkFRSUFxSFlpYVBDYjFuNEJQamQifQ== x-ctpclassification: CTP_NT x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Return-Path: nathaniel.l.desimone@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone -----Original Message----- From: devel@edk2.groups.io On Behalf Of Kubacki, Mi= chael A Sent: Wednesday, November 27, 2019 5:06 PM To: devel@edk2.groups.io Cc: Chaganty, Rangasai V ; Gao, Liming Subject: [edk2-devel] [edk2-platforms][PATCH V2 16/47] Features/Intel/Smbi= osFeaturePkg: Add initial package 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.d= sc | 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/SmbiosBa= sicDxe.inf | 83 ++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBa= sic.h | 45 +++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/SmbiosBa= sicEntryPoint.c | 125 ++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type0Bio= sVendorFunction.c | 81 +++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type1Sys= temManufacturerFunction.c | 114 +++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type2Bas= eBoardManufacturerFunction.c | 131 +++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type32Bo= otInformationFunction.c | 56 +++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Type3Cha= ssisManufacturerFunction.c | 125 ++++++++++++++ Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md = | 96 +++++++++++ 14 files changed, 1191 insertions(+) diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeatu= rePkg.dec b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeature= Pkg.dec new file mode 100644 index 0000000000..c06a87aad0 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.d= ec @@ -0,0 +1,172 @@ +## @file +# This package provides advanced feature functionality for System Managem= ent BIOS (SMBIOS). +# This package should only depend on EDK II Core packages, IntelSiliconPk= g, 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 =3D 0x00010017 + PACKAGE_NAME =3D SmbiosFeaturePkg + PACKAGE_GUID =3D 8CCEE569-02AD-4844-8725-F4C7966E320A + PACKAGE_VERSION =3D 0.1 + +[Includes] + Include + +[LibraryClasses] + +[Guids] + gSmbiosFeaturePkgTokenSpaceGuid =3D {0xc1530658, 0xe234, 0x4c13, {0xb= 6, 0x82, 0xd3, 0x87, 0x84, 0xf1, 0xd7, 0x16}} + +[PcdsFeatureFlag] + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|FALSE|BOOLEAN|0x= A0000001 + +[PcdsDynamic, PcdsDynamicEx] + # + # SMBIOS Type 0 BIOS Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMB= IOS_TABLE_TYPE0|0xD0000001 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x= 1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosVersi= on|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSegme= nt|0xF000 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosRelea= seDate|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosSize|= 0xFF + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.PciIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.PlugAndPlayIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.BiosIsUpgradable|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.BiosShadowingAllowed|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.BootFromCdIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.SelectableBootIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.EDDSpecificationIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.Floppy525_12IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.Floppy35_720IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.Floppy35_288IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.PrintScreenIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.Keyboard8042IsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.SerialIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.PrinterIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BiosChara= cteristics.CgaMonoIsSupported|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSChara= cteristicsExtensionBytes[0]|0x33 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSChara= cteristicsExtensionBytes[1]|0x0F + + # + # SMBIOS Type 1 System Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation|{0x0}|S= MBIOS_TABLE_TYPE1|0xD0000002 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Manufac= turer|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Product= Name|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Version= |0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SerialN= umber|0x4 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.Uuid|{G= UID("88888888-8887-8888-8888-878888888888")} + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.WakeUpT= ype|SystemWakeupTypePowerSwitch + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation.SKUNumb= er|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.Manu= facturer|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Prod= uctName|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Vers= ion|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Seri= alNumber|0x4 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Asse= tTag|0x5 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Feat= ureFlag.Motherboard|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Feat= ureFlag.Replaceable|1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Loca= tionInChassis|0x6 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation.Boar= dType|BaseBoardTypeMotherBoard + + # + # SMBIOS Type 3 System Enclosure Chassis + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis|{0= x0}|SMBIOS_TABLE_TYPE3|0xD0000004 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Ma= nufacturer|0x1 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Ty= pe|MiscChassisTypeRackMountChassis + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Ve= rsion|0x2 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Se= rialNumber|0x3 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.As= setTag|0x4 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Bo= otupState|ChassisStateSafe + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Po= werSupplyState|ChassisStateSafe + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Th= ermalState|ChassisStateSafe + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis.Se= curityStatus|ChassisSecurityStatusNone + + # + # SMBIOS Type 32 System Boot Information + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation|{0= x0}|SMBIOS_TABLE_TYPE32|0xD0000005 { + + IndustryStandard/SmBios.h + + MdePkg/MdePkg.dec + SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec + } + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation.Bo= otStatus|BootInformationStatusNoError + + # + # SMBIOS Type 0 BIOS Information Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate|"20= 08-12-23"|VOID*|0xD1000001 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion|"PURLEY= CV/CRB BIOS Internal"|VOID*|0xD1000002 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor|"Intel Corpo= ration"|VOID*|0xD1000003 + + # + # SMBIOS Type 1 System Information Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily|"Family"|VOI= D*|0xD1000004 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer|"Intel= Corporation"|VOID*|0xD1000005 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName|"PURLEY= "|VOID*|0xD1000006 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber|"UNKNO= WN"|VOID*|0xD1000007 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber|"SKU Numb= er"|VOID*|0xD1000008 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion|"1.0"|VOID*= |0xD1000009 + + # + # SMBIOS Type 2 Base Board Information Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag|"Base Boar= d Asset Tag"|VOID*|0xD100000A + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis|"= Part Component"|VOID*|0xD100000B + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer|"Intel= Corporation"|VOID*|0xD100000C + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName|"PURLEY= "|VOID*|0xD100000D + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber|"SPRO0= 3200016"|VOID*|0xD100000E + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion|"E63448-400= "|VOID*|0xD100000F + + # + # SMBIOS Type 3 System Enclosure Chassis Strings + # + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag|"Chassis A= sset Tag"|VOID*|0xD1000011 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer|"Intel= Corporation"|VOID*|0xD1000012 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber|"UNKNO= WN"|VOID*|0xD1000013 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber|"SKU Numb= er"|VOID*|0xD1000014 + gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion|"0.1"|VOID*= |0xD1000015 diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/Smb= iosFeature.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/= SmbiosFeature.dsc new file mode 100644 index 0000000000..a59fdf3702 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/SmbiosFeat= ure.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 thi= s 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 Makefil= e. +# +#########################################################################= ####### +[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 feat= ure. +# +#########################################################################= ####### +[LibraryClasses] + ####################################### + # Edk2 Packages + ####################################### + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.in= f + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo= otServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntr= yPoint.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/UefiMemoryAl= locationLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + +#########################################################################= ####### +# +# Component section - list of all components that need built for this fea= ture. +# +# Note: The EDK II DSC file is not used to specify how compiled binary im= ages get placed +# into firmware volume images. This section is just a list of modul= es 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 P= I specification. +# There may also be modules listed in this section that are not req= uired in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-co= mpliant binary will be +# generated for it, but the binary will not be put into any firmwar= e volume. +# +#########################################################################= ####### +# +# Feature PEI Components +# + +# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugz= illa.tianocore.org/show_bug.cgi?id=3D2308 +# is completed. +[Components.IA32] + ##################################### + # SMBIOS Feature Package + ##################################### + + # Add library instances here that are not included in package component= s 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://bugz= illa.tianocore.org/show_bug.cgi?id=3D2308 +# is completed. +[Components.X64] + ##################################### + # SMBIOS Feature Package + ##################################### + + # Add library instances here that are not included in package component= s 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 pro= cess. They can be +# applied for any modules or only those modules wi= th the specific +# module style (EDK or EDKII) specified in [Compon= ents] section. +# +# For advanced features, it is recommended to enab= le [BuildOptions] in +# the applicable INF file so it does not affect th= e whole board package +# build when this DSC file is active. +# +#########################################################################= ########################## +[BuildOptions] diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeatu= rePkg.dsc b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeature= Pkg.dsc new file mode 100644 index 0000000000..31141c0725 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.d= sc @@ -0,0 +1,30 @@ +## @file +# This package provides advanced feature functionality for System Managem= ent BIOS (SMBIOS). +# This package should only depend on EDK II Core packages, IntelSiliconPk= g, 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 =3D SmbiosFeaturePkg + PLATFORM_GUID =3D 44AF1C2A-16AD-4509-8DF6-988E73E23A85 + PLATFORM_VERSION =3D 0.1 + DSC_SPECIFICATION =3D 0x00010005 + OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES =3D IA32|X64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER =3D DEFAULT + PEI_ARCH =3D IA32 + DXE_ARCH =3D X64 + +# +# This package always builds the feature. +# +!include Include/SmbiosFeature.dsc diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/Pos= tMemory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/Pos= tMemory.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.in= f diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/Pre= Memory.fdf b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Include/PreM= emory.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/SmbiosBasic= Dxe/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/Smb= iosBasicDxe.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 =3D 0x00010005 + BASE_NAME =3D SmbiosBasic + FILE_GUID =3D 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SmbiosBasicEntryPoint + +# +# The following information is for reference only and not required by the= build tools. +# +# VALID_ARCHITECTURES =3D 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/SmbiosBasic= Dxe/SmbiosBasic.h b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Smbio= sBasicDxe/SmbiosBasic.h new file mode 100644 index 0000000000..2a349bcd37 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Smb= iosBasic.h @@ -0,0 +1,45 @@ +/** @file + Smbios basic header file. + +Copyright (c) 2018 - 2019, 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 S= MBIOS record. + @param Record The data for the fixed portion of the SMB= IOS record. The format of the record is + determined by EFI_SMBIOS_TABLE_HEADER.Typ= e. The size of the formatted area is defined + by EFI_SMBIOS_TABLE_HEADER.Length and eit= her followed by a double-null (0x0000) or + a set of null terminated strings and a nu= ll. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of syste= m 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/SmbiosBasic= Dxe/SmbiosBasicEntryPoint.c b/Features/Intel/SystemInformation/SmbiosFeatur= ePkg/SmbiosBasicDxe/SmbiosBasicEntryPoint.c new file mode 100644 index 0000000000..4b24d1a124 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Smb= iosBasicEntryPoint.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[] =3D { + {&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 =3D gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID*= *)&Smbios); + if (EFI_ERROR(EfiStatus)) { + DEBUG((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiSta= tus)); + return EfiStatus; + } + + for (Index =3D 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmb= iosBasicDataFuncTable[0]); ++Index) { + EfiStatus =3D (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios); + if (EFI_ERROR(EfiStatus)) { + DEBUG((DEBUG_ERROR, "Basic smbios store error. Index=3D%d, ReturnS= tatus=3D%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 S= MBIOS record. + @param Record The data for the fixed portion of the SMB= IOS record. The format of the record is + determined by EFI_SMBIOS_TABLE_HEADER.Typ= e. The size of the formatted area is defined + by EFI_SMBIOS_TABLE_HEADER.Length and eit= her followed by a double-null (0x0000) or + a set of null terminated strings and a nu= ll. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of syste= m resources. + +**/ +EFI_STATUS +AddSmbiosRecord ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, + IN EFI_SMBIOS_TABLE_HEADER *Record + ) +{ + *SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; + return Smbios->Add ( + Smbios, + NULL, + SmbiosHandle, + Record + ); +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasic= Dxe/Type0BiosVendorFunction.c b/Features/Intel/SystemInformation/SmbiosFeat= urePkg/SmbiosBasicDxe/Type0BiosVendorFunction.c new file mode 100644 index 0000000000..7730756ee5 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Typ= e0BiosVendorFunction.c @@ -0,0 +1,81 @@ +/** @file + Smbios type 0. + +Copyright (c) 2018 - 2019, 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 =3D PcdGetPtr (PcdSmbiosType0BiosInformation); + + VendorStr =3D PcdGetPtr (PcdSmbiosType0StringVendor); + VendorStrLen =3D AsciiStrLen (VendorStr); + ASSERT (VendorStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + VersionStr =3D PcdGetPtr (PcdSmbiosType0StringBiosVersion); + VerStrLen =3D AsciiStrLen (VersionStr); + ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + DateStr =3D PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate); + DateStrLen =3D AsciiStrLen (DateStr); + ASSERT (DateStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Two zeros following the last string. + // + SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + Vendor= StrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); + if (SmbiosRecord =3D=3D NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0)); + + SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_BIOS_INFORMATION; + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE0); + SmbiosRecord->Hdr.Handle =3D 0; + + StringOffset =3D SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen)= ; + StringOffset +=3D VendorStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); + StringOffset +=3D VerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen); + + // + // Now we have got the full smbios record, call smbios protocol to add = this record. + // + Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HE= ADER *) SmbiosRecord); + + FreePool (SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasic= Dxe/Type1SystemManufacturerFunction.c b/Features/Intel/SystemInformation/Sm= biosFeaturePkg/SmbiosBasicDxe/Type1SystemManufacturerFunction.c new file mode 100644 index 0000000000..88c32e018e --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Typ= e1SystemManufacturerFunction.c @@ -0,0 +1,114 @@ +/** @file + Smbios type 1. + +Copyright (c) 2018 - 2019, 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 =3D PcdGetPtr (PcdSmbiosType1SystemInformation); + + ManufacturerStr =3D PcdGetPtr (PcdSmbiosType1StringManufacturer); + ManufacturerStrLen =3D AsciiStrLen (ManufacturerStr); + ASSERT (ManufacturerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + ProductNameStr =3D PcdGetPtr (PcdSmbiosType1StringProductName); + ProductNameStrLen =3D AsciiStrLen (ProductNameStr); + ASSERT (ProductNameStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + VersionStr =3D PcdGetPtr (PcdSmbiosType1StringVersion); + VersionStrLen =3D AsciiStrLen (VersionStr); + ASSERT (VersionStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + SerialNumberStr =3D PcdGetPtr (PcdSmbiosType1StringSerialNumber); + SerialNumberStrLen =3D AsciiStrLen (SerialNumberStr); + ASSERT (SerialNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + SKUNumberStr =3D PcdGetPtr (PcdSmbiosType1StringSKUNumber); + SKUNumberStrLen =3D AsciiStrLen (SKUNumberStr); + ASSERT (SKUNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + FamilyStr =3D PcdGetPtr (PcdSmbiosType1StringFamily); + FamilyStrLen =3D AsciiStrLen (FamilyStr); + ASSERT (FamilyStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Create table size based on string lengths + // + TableSize =3D sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + Pr= oductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumbe= rStrLen + 1 + FamilyStrLen + 1 + 1; + SmbiosRecord =3D AllocateZeroPool (TableSize); + if (SmbiosRecord =3D=3D 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 =3D SMBIOS_TYPE_SYSTEM_INFORMATION; + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE1); + SmbiosRecord->Hdr.Handle =3D 0; + + // + // Add strings to bottom of data block + // + StringOffset =3D SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, Manufac= turerStrLen); + StringOffset +=3D ManufacturerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductN= ameStrLen); + StringOffset +=3D ProductNameStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLe= n); + StringOffset +=3D VersionStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialN= umberStrLen); + StringOffset +=3D SerialNumberStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberS= trLen); + StringOffset +=3D SKUNumberStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen)= ; + + // + // Now we have got the full smbios record, call smbios protocol to add = this record. + // + Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HE= ADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasic= Dxe/Type2BaseBoardManufacturerFunction.c b/Features/Intel/SystemInformation= /SmbiosFeaturePkg/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c new file mode 100644 index 0000000000..f72e6a67c8 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Typ= e2BaseBoardManufacturerFunction.c @@ -0,0 +1,131 @@ +/** @file + Smbios type 2. + +Copyright (c) 2018 - 2019, 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 =3D PcdGetPtr (PcdSmbiosType2BaseBoardInformation); + + // + // Get BoardManufacturer String. + // + ManufacturerStr =3D PcdGetPtr (PcdSmbiosType2StringManufacturer); + ManuStrLen =3D AsciiStrLen (ManufacturerStr); + ASSERT (ManuStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board ProductName String. + // + ProductStr =3D PcdGetPtr (PcdSmbiosType2StringProductName); + ProductStrLen =3D AsciiStrLen (ProductStr); + ASSERT (ProductStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Version String. + // + VersionStr =3D PcdGetPtr (PcdSmbiosType2StringVersion); + VerStrLen =3D AsciiStrLen (VersionStr); + ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Serial Number String. + // + SerialNumberStr =3D PcdGetPtr (PcdSmbiosType2StringSerialNumber); + SerialNumStrLen =3D AsciiStrLen (SerialNumberStr); + ASSERT (SerialNumStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Asset Tag String. + // + AssertTagStr =3D PcdGetPtr (PcdSmbiosType2StringAssetTag); + AssertTagStrLen =3D AsciiStrLen (AssertTagStr); + ASSERT (AssertTagStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get Board Chassis Location Tag String. + // + ChassisStr =3D PcdGetPtr (PcdSmbiosType2StringLocationInChassis); + ChassisStrLen =3D AsciiStrLen (ChassisStr); + ASSERT (ChassisStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Two zeros following the last string. + // + SourceSize =3D PcdGetSize (PcdSmbiosType2BaseBoardInformation); + TotalSize =3D SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrL= en + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1; + SmbiosRecord =3D AllocateZeroPool(TotalSize); + if (SmbiosRecord =3D=3D NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); + + SmbiosRecord->Hdr.Type =3D SMBIOS_TYPE_BASEBOARD_INFORMATION; + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2); + if (PcdSmbiosRecord->NumberOfContainedObjectHandles >=3D 2) { + SmbiosRecord->Hdr.Length +=3D (PcdSmbiosRecord->NumberOfContainedObje= ctHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles); + } + ASSERT(SourceSize >=3D SmbiosRecord->Hdr.Length); + SmbiosRecord->Hdr.Handle =3D 0; + + StringOffset =3D SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStr= Len); + StringOffset +=3D ManuStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLe= n); + StringOffset +=3D ProductStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); + StringOffset +=3D VerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialN= umStrLen); + StringOffset +=3D SerialNumStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagS= trLen); + StringOffset +=3D AssertTagStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLe= n); + + // + // Now we have got the full smbios record, call smbios protocol to add = this record. + // + Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HE= ADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasic= Dxe/Type32BootInformationFunction.c b/Features/Intel/SystemInformation/Smbi= osFeaturePkg/SmbiosBasicDxe/Type32BootInformationFunction.c new file mode 100644 index 0000000000..85d8fc4320 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Typ= e32BootInformationFunction.c @@ -0,0 +1,56 @@ +/** @file + Smbios type 32. + +Copyright (c) 2018 - 2019, 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 =3D PcdGetPtr (PcdSmbiosType32SystemBootInformation); + + // + // Two zeros following the last string. + // + SmbiosRecord =3D AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1)= ; + if (SmbiosRecord =3D=3D NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32)); + + SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION; + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE32); + SmbiosRecord->Hdr.Handle =3D 0; + + // + // Now we have got the full smbios record, call smbios protocol to add = this record. + // + Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HE= ADER *) SmbiosRecord); + + FreePool(SmbiosRecord); + return Status; +} diff --git a/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasic= Dxe/Type3ChassisManufacturerFunction.c b/Features/Intel/SystemInformation/S= mbiosFeaturePkg/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c new file mode 100644 index 0000000000..035e47be4c --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosBasicDxe/Typ= e3ChassisManufacturerFunction.c @@ -0,0 +1,125 @@ +/** @file + Smbios type 3. + +Copyright (c) 2018 - 2019, 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 =3D PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis); + + // + // Get ChassisManufacturer String. + // + ManufacturerStr =3D PcdGetPtr (PcdSmbiosType3StringManufacturer); + ManuStrLen =3D AsciiStrLen (ManufacturerStr); + ASSERT (ManuStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisVersion String. + // + VersionStr =3D PcdGetPtr (PcdSmbiosType3StringVersion); + VerStrLen =3D AsciiStrLen (VersionStr); + ASSERT (VerStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisSerialNumber String. + // + SerialNumberStr =3D PcdGetPtr (PcdSmbiosType3StringSerialNumber); + SerialNumStrLen =3D AsciiStrLen (SerialNumberStr); + ASSERT (SerialNumStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisAssetTag String. + // + AssertTagStr =3D PcdGetPtr (PcdSmbiosType3StringAssetTag); + AssertTagStrLen =3D AsciiStrLen (AssertTagStr); + ASSERT (AssertTagStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Get ChassisSKUNumber String. + // + SKUNumberStr =3D PcdGetPtr (PcdSmbiosType3StringSKUNumber); + SKUNumberStrLen =3D AsciiStrLen (SKUNumberStr); + ASSERT (SKUNumberStrLen <=3D SMBIOS_STRING_MAX_LENGTH); + + // + // Two zeros following the last string. + // + SourceSize =3D PcdGetSize(PcdSmbiosType3SystemEnclosureChassis); + TotalSize =3D SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1= + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStr= Len + 1 + 1; + SmbiosRecord =3D AllocateZeroPool(TotalSize); + if (SmbiosRecord =3D=3D NULL) { + ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize); + + SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; + SmbiosRecord->Hdr.Length =3D OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedEl= ements) + sizeof(SMBIOS_TABLE_STRING); + if (PcdSmbiosRecord->ContainedElementCount >=3D 1) { + SmbiosRecord->Hdr.Length +=3D PcdSmbiosRecord->ContainedElementCount = * PcdSmbiosRecord->ContainedElementRecordLength; + } + SmbiosRecord->Hdr.Handle =3D 0; + + if ((PcdSmbiosRecord->ContainedElementCount =3D=3D 0) || (SourceSize < = (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) { + SKUNumberPtr =3D (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + Smbios= Record->Hdr.Length - sizeof(SMBIOS_TABLE_STRING)); + *SKUNumberPtr =3D 5; + } + + StringOffset =3D SmbiosRecord->Hdr.Length; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStr= Len); + StringOffset +=3D ManuStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen); + StringOffset +=3D VerStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialN= umStrLen); + StringOffset +=3D SerialNumStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagS= trLen); + StringOffset +=3D AssertTagStrLen + 1; + CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberS= trLen); + + // + // Now we have got the full smbios record, call smbios protocol to add = this record. + // + Status =3D AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HE= ADER *) 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..7f31094365 --- /dev/null +++ b/Features/Intel/SystemInformation/SmbiosFeaturePkg/Readme.md @@ -0,0 +1,96 @@ +# Overview +* **Feature Name:** System Management BIOS (SMBIOS) +* **PI Phase(s) Supported:** DXE +* **SMM Required?** No + +More Information: +* [SMBIOS Reference Specification](https://www.dmtf.org/standards/smbios) + +## Purpose +System Management BIOS (SMBIOS) is an industry standard for delivering ma= nagement information via system firmware. +SMBIOS provides a standard format to present management information acros= s various environments including OS-present, +OS-absent, and pre-OS environments. SMBIOS was originally designed for In= tel® processor architecture systems, SMBIOS +now includes support for IA-32 (x86), x64 (x86-64, Intel64, AMD64, EM64T)= , Intel® Itanium® architecture, 32-bit +ARM (Aarch32) and 64-bit ARM (Aarch64). + +The SMBIOS feature includes generic firmware functionality to implement t= he SMBIOS reference specification. Since the +information required by these modules is very platform/board-specific by = nature this feature requires a high-level of +customization (mostly in the form of PCD values) by the feature consumer. + +# 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 p= rovide 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 modul= e 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 libr= ary 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 extern= al 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 r= equire non-standard tool configuration. If the +standard flow in the feature package template is used, this section may b= e 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 inte= grator 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 f= or 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 s= hould be left empty. --=20 2.16.2.windows.1