Re: [PATCH v1] IntelFsp2WrapperPkg: Remove microcode PCDs
Chiu, Chasel
Reviewed-by: Chasel Chiu <chasel.chiu@...>
toggle quoted message
Show quoted text
-----Original Message----- |
|
Re: [PATCH v2] IntelFsp2WrapperPkg: Remove microcode related PCDs
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>
toggle quoted message
Show quoted text
-----Original Message-----
From: Lou, Yun <yun.lou@...> Sent: Wednesday, April 14, 2021 11:49 PM To: devel@edk2.groups.io Cc: Lou, Yun <yun.lou@...>; Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Zeng, Star <star.zeng@...>; Ni, Ray <ray.ni@...> Subject: [PATCH v2] IntelFsp2WrapperPkg: Remove microcode related PCDs REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3334 IntelFsp2WrapperPkg defines following PCDs: PcdCpuMicrocodePatchAddress PcdCpuMicrocodePatchRegionSize PcdFlashMicrocodeOffset But the PCD name caused confusion because UefiCpuPkg defines: PcdCpuMicrocodePatchAddress PcdCpuMicrocodePatchRegionSize PcdCpuMicrocodePatchAddress in IntelFsp2WrapperPkg means the base address of the FV that holds the microcode. PcdCpuMicrocodePatchAddress in UefiCpuPkg means the address of the microcode. The relationship between the PCDs is: IntelFsp2WrapperPkg.PcdCpuMicrocodePatchAddress + IntelFsp2WrapperPkg.PcdFlashMicrocodeOffset == UefiCpuPkg.PcdCpuMicrocodePatchAddress IntelFsp2WrapperPkg.PcdCpuMicrocodePatchRegionSize - IntelFsp2WrapperPkg.PcdFlashMicrocodeOffset == UefiCpuPkg.PcdCpuMicrocodePatchRegionSize To avoid confusion and actually the PCDs in IntelFsp2WrapperPkg are only used by a sample FSP-T wrapper, this patch removes the 3 PCDs defined in IntelFsp2WrapperPkg. The FSP-T wrapper is updated to directly use the ones in UefiCpuPkg. Signed-off-by: Jason Lou <yun.lou@...> Cc: Chasel Chiu <chasel.chiu@...> Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Star Zeng <star.zeng@...> Cc: Ray Ni <ray.ni@...> --- IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c | 6 +++--- IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec | 8 +------- IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf | 7 +++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c index 96b47e23da..e57b5b57be 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecR +++ amInitData.c @@ -1,7 +1,7 @@ /** @file Sample to provide TempRamInitParams data. - Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/@@ -52,8 +52,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA FsptUpdDataPtr = { } }, {- ((UINT32)FixedPcdGet64 (PcdCpuMicrocodePatchAddress) + FixedPcdGet32 (PcdFlashMicrocodeOffset)),- ((UINT32)FixedPcdGet64 (PcdCpuMicrocodePatchRegionSize) - FixedPcdGet32 (PcdFlashMicrocodeOffset)),+ FixedPcdGet32 (PcdCpuMicrocodePatchAddress),+ FixedPcdGet32 (PcdCpuMicrocodePatchRegionSize), FixedPcdGet32 (PcdFlashCodeCacheAddress), FixedPcdGet32 (PcdFlashCodeCacheSize), }diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec index 6852bf1271..a3b9363779 100644 --- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec +++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec @@ -1,7 +1,7 @@ ## @file # Provides drivers and definitions to support fsp in EDKII bios. #-# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ##@@ -56,12 +56,6 @@ ## Provides the size of the BIOS Flash Device. gIntelFsp2WrapperTokenSpaceGuid.PcdFlashCodeCacheSize|0x00200000|UINT32|0x10000002 - ## Indicates the base address of the first Microcode Patch in the Microcode Region- gIntelFsp2WrapperTokenSpaceGuid.PcdCpuMicrocodePatchAddress|0x0|UINT64|0x10000005- gIntelFsp2WrapperTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize|0x0|UINT64|0x10000006- ## Indicates the offset of the Cpu Microcode.- gIntelFsp2WrapperTokenSpaceGuid.PcdFlashMicrocodeOffset|0x90|UINT32|0x10000007- ## Indicate the PEI memory size platform want to report gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize|0x1800000|UINT32|0x40000004 ## Indicate the PEI memory size platform want to reportdiff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf index d7f8301bef..027b127724 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecF +++ spWrapperPlatformSecLibSample.inf @@ -1,7 +1,7 @@ ## @file # Sample to provide FSP wrapper platform sec related function. #-# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent #@@ -76,8 +76,7 @@ gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## CONSUMES [FixedPcd]- gIntelFsp2WrapperTokenSpaceGuid.PcdCpuMicrocodePatchAddress ## CONSUMES- gIntelFsp2WrapperTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONSUMES- gIntelFsp2WrapperTokenSpaceGuid.PcdFlashMicrocodeOffset ## CONSUMES+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress ## CONSUMES+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONSUMES gIntelFsp2WrapperTokenSpaceGuid.PcdFlashCodeCacheAddress ## CONSUMES gIntelFsp2WrapperTokenSpaceGuid.PcdFlashCodeCacheSize ## CONSUMES-- 2.28.0.windows.1 |
|
Re: GSOC 2021 EXT4 driver Project
Michael Brown
On 24/05/2021 20:26, Pedro Falcato wrote:
Me and my project have been selected for GSoC this year, under Michael Kinney and bret. Thank you for the opportunity to collaborate with you and improve Tianocore!FWIW, the most natural positioning seems to me to be as a separate Ext4Pkg similar to FatPkg. For the sake of your own sanity, you probably want to start by maintaining Ext4Pkg as a completely standalone git repo that you happen to place within your local edk2 checkout directory. This will let you develop in isolation without worrying about where the code will eventually live, at least until the code has reached a state of maturity that makes it worth considering its eventual home. Keeping it in a separate Ext4Pkg repo will also enforce some level of discipline on your coding: you'll naturally avoid being tempted into letting your development work leak outside of Ext4Pkg into other packages. In terms of questions, there are two that immediately spring to mind: - Are you planning on making this read-only, or read-write? - If you're planning on making it read-write: what simplifications will you be able to make to the write path in the UEFI environment? (UEFI is basically a single-user environment in which all filesystem writes should be flushed immediately: you may want to consider a simplified write path that never uses journalling, for example). HTH, Michael |
|
Re: 回复: [edk2-devel] Generic MinPlatform
I had a closer look at the MinPlatform specification and I made a TODO list: https://github.com/riscv/riscv-edk2-platforms/issues/24
Mostly I just have to:
The tasks for x86 QEMU/OVMF should be the same. Doesn't look too scary.
Since there are these test functions, is there a way to test compliance with the spec?
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Daniel Schaefer <daniel.schaefer@...>
Sent: Tuesday, May 25, 2021 02:59 To: devel@edk2.groups.io <devel@edk2.groups.io>; gaoliming@... <gaoliming@...>; kaaira7319@... <kaaira7319@...>; Ni, Ray <ray.ni@...>; mikuback@... <mikuback@...>; isaac.w.oram@... <isaac.w.oram@...> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@...> Subject: Re: 回复: [edk2-devel] Generic MinPlatform
Then I have two more issues unrelated to RISC-V: https://github.com/riscv/riscv-edk2-platforms/commit/b68f4587fc28588b4474ff15d43918182c33b4b7
And some related to RISC-V: https://github.com/riscv/riscv-edk2-platforms/commit/579705cf46dafc90e4a2bc243e5aa5cd828cb126
And what's most relevant to Kaaira, the commit to make my QEMU platform use MinPlatform include files:
Yes, absolutely. As above, for now I created one for common x86 concepts. But there should probably be one for PCI and USB should move to AdvancedFeatures, like you said.
The other two RISC-V platforms I'm working on don't have PCI and one of them doesn't have USB.
Right, that's a good idea. Kaaira and me can create one for QEMU with all of the virtio drivers.
And those for x86 and RISC-V wouldn't actually too big, as you can see in my change. RISC-V needs even less special modules.
Thanks,
Daniel
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Oram, Isaac W <isaac.w.oram@...>
Sent: Friday, May 21, 2021 11:38 To: Schaefer, Daniel <daniel.schaefer@...>; devel@edk2.groups.io <devel@edk2.groups.io>; gaoliming@... <gaoliming@...>; kaaira7319@... <kaaira7319@...>; Ni, Ray <ray.ni@...>; mikuback@... <mikuback@...> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@...> Subject: Re: 回复: [edk2-devel] GSoC 2021 Qemu OpenBoardPkg Project I think we should patch first and move to a common location later.
Looking at some of your changes and comments, I have these comments:
#!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE # PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf #!endif
[PcdsFeatureFlag] # # MinPlatform control flags # gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit |FALSE gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly |FALSE gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable |FALSE gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable |FALSE gMinPlatformPkgTokenSpaceGuid.PcdSmiHandlerProfileEnable|TRUE gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable |FALSE … !include $(PLATFORM_PACKAGE)/Include/Dsc/CoreCommonLib.dsc
This is useful feedback and we should think about how we want to enable optimization (stage 7) in a reasonable way. We haven’t gotten that far into the optimization details as we wanted to get the basics worked out, but it might very much make sense to make more of these things controlled by MinPlatform Arch defined feature flags. Or to move to Advanced Features. And some things we haven’t cleaned up yet. We still have USB in common includes, but those drivers should move to an Advanced Feature. The main thing is we want intelligent default behavior so new board porting people can get productive fast without having to know all these edk2 special features. Then as they get things working, they can start to take advantage of more edk2 and UEFI capabilities as they learn them. Eventually hitting an optimization phase where common things can be quickly stripped out if not needed. I hadn’t thought much about build optimization, but I think that this is reasonable to include in scope.
Looking at your feedback/challenges, I see a few options: · Add more MinPlatform Arch defined feature flags for PCI, SMM, etc. · Add Advanced Features for them · Add “Core System Design” includes. E.G. one for x86, one for QEMU, one for RISKV, etc. I am not sure how many of these we would need.
Thoughts and preferences? I think that we need to keep in mind KISS for new board ports and new users.
The checklists should be “Board Porting Activity Checklist” and unfortunately for you both, you are making the first reference QemuOpenBoardPkg and boards and that is a little more involved than making derivatives, which is what those checklists are going to help the most.
Regards,
From: Schaefer, Daniel <daniel.schaefer@...>
Thanks for the answers, that's very helpful, guys!
I've started to replace some of my DSC and FDF with the include files mentioned by Michael. Since RISC-V doesn't have I/O registers, SMM and some other things, I had to make some changes but not too many. Maybe for Qemu there would have be some more non-Intel changes. Would you accept patches to make it more arch agnostic? Or should we first move it out of the Intel directory?
Sorry for hijacking your thread Kaaira, but I hope this discussion would also be helpful for you 🙂 Just like you, I'm trying to convert a QEMU platform to MinPlatform. (And then the other RISC-V platforms) If you want to have a look, you can check out my progress here: https://github.com/riscv/riscv-edk2-platforms/commits/riscv-virt-minplatform-gh-actions
My plan is:
I see that each stage in the MinPlatform spec has a checklist. They don't look like checklist but rather steps to achieve a certain state but that's also ok.
Thanks, Daniel
From:
devel@edk2.groups.io <devel@edk2.groups.io>
on behalf of Michael Kubacki <mikuback@...>
Daniel, |
|
[edk2-platforms][PATCH V1 3/3] Platform/Sgi: enable support for UEFI secure boot
Sayanta Pattanayak
Enable the use of UEFI secure boot for Arm's Neoverse reference design
platforms. The UEFI authenticated variable store uses NOR flash 2 which is accessible from Standalone MM context residing in a secure partition. Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@...> --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 31 +++++++++++++++++++ Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc | 32 ++++++++++++++++++++ Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 15 +++++++++ Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc | 15 +++++++++ Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf | 5 +++ Platform/ARM/SgiPkg/SgiPlatform.fdf | 9 +++++- 6 files changed, 106 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPk= g/SgiPlatform.dsc.inc index 091de0c99c74..e4aee7a09acf 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -6,6 +6,14 @@ =20 !include Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc =20 +[Defines] + # To allow the use of secure storage, set this to TRUE. + DEFINE SECURE_STORAGE_ENABLE =3D FALSE + + # To allow the use of UEFI secure boot, set this to TRUE. + # Secure boot requires secure storage to be enabled as well. + DEFINE SECURE_BOOT_ENABLE =3D FALSE + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES =20 @@ -22,6 +30,9 @@ NorFlashPlatformLib|Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLi= b.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLi= bNull.inf +!endif =20 # Virtio Support VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf @@ -84,6 +95,7 @@ [PcdsFeatureFlag.common] gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|TRUE gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE =20 [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdVFPEnabled|1 @@ -230,7 +242,15 @@ MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRunt= imeDxe.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { + <LibraryClasses> + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificat= ionLib.inf + } + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig= Dxe.inf +!else MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf +!endif OvmfPkg/VirtioBlkDxe/VirtioBlk.inf =20 MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf @@ -238,6 +258,9 @@ MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.i= nf MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf MdeModulePkg/Universal/SerialDxe/SerialDxe.inf +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +!else MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { <LibraryClasses> NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf @@ -245,6 +268,7 @@ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf +!endif =20 # # ACPI Support @@ -314,4 +338,11 @@ # MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf =20 +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf { + <LibraryClasses> + NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDepend= ency.inf + } +!else ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf +!endif diff --git a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc b/Platform/ARM/Sgi= Pkg/SgiPlatformMm.dsc.inc index 3389ff676a91..6839ec35da8a 100644 --- a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc @@ -59,6 +59,19 @@ HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.i= nf MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Standal= oneMmServicesTableLib.inf MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocati= onLib/StandaloneMmMemoryAllocationLib.inf +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.in= f + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + NorFlashPlatformLib|Platform/ARM/SgiPkg/Library/NorFlashLib/Standalone= MmNorFlashLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf + PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSe= cureLibNull.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroni= zationLib.inf + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempl= ate.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf +!endif =20 ########################################################################= ######## # @@ -75,6 +88,12 @@ =20 gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2 =20 +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE +!endif + ########################################################################= ########################### # # Components Section - list of the modules and components that will be p= rocessed by compilation @@ -101,6 +120,19 @@ =20 [Components.AARCH64] StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandal= oneMm.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf { + <LibraryClasses> + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.i= nf + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLibStand= aloneMm.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariableP= olicyLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperL= ib/VariablePolicyHelperLib.inf + } +!endif =20 ########################################################################= ########################### # diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc b/Platform/ARM/= SgiPkg/PlatformStandaloneMm.dsc index cdf8aaa88f03..2cb4895cfcff 100644 --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc @@ -39,3 +39,18 @@ [PcdsFixedAtBuild] ## PL011 - Serial Terminal gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x7FF70000 + +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + ##Secure NOR Flash 2 + gArmSgiTokenSpaceGuid.PcdSmcCs2Base|0x10000000 + gArmSgiTokenSpaceGuid.PcdSysPeriphBase|0x1C000000 + gArmSgiTokenSpaceGuid.PcdSysPeriphSysRegBase|0x1C010000 + + ##Secure Variable Storage in NOR Flash 2 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x1000000= 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0010000= 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x10100= 000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00100= 000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x1020000= 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0010000= 0 +!endif diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc b/Platform/ARM= /SgiPkg/PlatformStandaloneMm2.dsc index bb359a15cc0d..46c2ae3529d1 100644 --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc @@ -38,3 +38,18 @@ [PcdsFixedAtBuild] ## PL011 - Serial Terminal gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x0EF80000 + +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + ##Secure NOR Flash 2 + gArmSgiTokenSpaceGuid.PcdSmcCs2Base|0x1054000000 + gArmSgiTokenSpaceGuid.PcdSysPeriphBase|0x0C000000 + gArmSgiTokenSpaceGuid.PcdSysPeriphSysRegBase|0x0C010000 + + ##Secure Variable Storage in NOR Flash 2 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0x10540= 00000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0010000= 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0x105= 4100000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00100= 000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0x10542= 00000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x0010000= 0 +!endif diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf b/Platform/ARM/= SgiPkg/PlatformStandaloneMm.fdf index 5a0772cd8522..474c9c0ce764 100644 --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf @@ -49,6 +49,11 @@ READ_LOCK_CAP =3D TRUE READ_LOCK_STATUS =3D TRUE =20 INF StandaloneMmPkg/Core/StandaloneMmCore.inf +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSta= ndaloneMm.inf + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in= f +!endif INF StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.in= f =20 ########################################################################= ######## diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/Sg= iPlatform.fdf index e11d943d6efc..d94e4633e36c 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf @@ -90,10 +90,17 @@ READ_LOCK_STATUS =3D TRUE INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe= .inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounter= RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo= nfigDxe.inf +!endif +!if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.i= nf +!else + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe= .inf INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +!endif =20 # # ACPI Support --=20 2.17.1 |
|
[edk2-platforms][PATCH V1 2/3] Platform/Sgi: add StandaloneMM usable NorFlashPlatformLib
Sayanta Pattanayak
Add the NorFlashPlatformLib library instance that can be linked with
MM_STANDALONE modules that implement a secure variable storage. The third instance of the NOR flash is used as the non-volatile storage. Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@...> --- Platform/ARM/SgiPkg/SgiPlatform.dec | 1= + Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlashLib.inf | 33= ++++++++ Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlashLib.c | 82= ++++++++++++++++++++ 3 files changed, 116 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/Sg= iPlatform.dec index 3effd49592ea..af08ed153eae 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dec +++ b/Platform/ARM/SgiPkg/SgiPlatform.dec @@ -54,6 +54,7 @@ =20 gArmSgiTokenSpaceGuid.PcdSmcCs0Base|0|UINT64|0x0000000C gArmSgiTokenSpaceGuid.PcdSmcCs1Base|0|UINT64|0x0000000D + gArmSgiTokenSpaceGuid.PcdSmcCs2Base|0|UINT64|0x00001000 gArmSgiTokenSpaceGuid.PcdSysPeriphBase|0x00000000|UINT64|0x0000000E gArmSgiTokenSpaceGuid.PcdSysPeriphSysRegBase|0x0|UINT64|0x0000000F =20 diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlash= Lib.inf b/Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlashLib= .inf new file mode 100644 index 000000000000..96bbf1e42313 --- /dev/null +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlashLib.inf @@ -0,0 +1,33 @@ +## @file +# StandaloneMM instance of NOR Flash library. +# +# Copyright (c) 2021, ARM Limited. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D NorFlashMmLib + FILE_GUID =3D 2ce22190-b933-4d1e-99ba-8bf1f076825= 5 + MODULE_TYPE =3D MM_STANDALONE + VERSION_STRING =3D 1.0 + PI_SPECIFICATION_VERSION =3D 0x00010032 + LIBRARY_CLASS =3D NorFlashPlatformLib + +[Sources.common] + StandaloneMmNorFlashLib.c + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Platform/ARM/SgiPkg/SgiPlatform.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + +[FixedPcd] + gArmSgiTokenSpaceGuid.PcdSysPeriphSysRegBase + gArmSgiTokenSpaceGuid.PcdSmcCs2Base diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlash= Lib.c b/Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlashLib.c new file mode 100644 index 000000000000..3e5a5612c17e --- /dev/null +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmNorFlashLib.c @@ -0,0 +1,82 @@ +/** @file +* NOR flash platform library to be used in StandaloneMM context +* +* This file provides platform callbacks for the NOR flash module that ex= ecutes +* in the StandaloneMM context. The third NOR flash instance of 64MB size= on the +* reference design platform is assigned to be used in the StandaloneMM c= ontext. +* +* Copyright (c) 2021, ARM Ltd. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include <Library/DebugLib.h> +#include <Library/IoLib.h> +#include <Library/NorFlashPlatformLib.h> +#include <PiMm.h> +#include <SgiPlatform.h> + +// +// 64MB NOR flash connected to CS2 is assigned to be used in StandaloneM= M +// context. +// +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D { + { + // NOR-Flash2 assigned for secure storage. + FixedPcdGet64 (PcdSmcCs2Base), + FixedPcdGet64 (PcdSmcCs2Base), + SIZE_256KB * 256, + SIZE_256KB, + }, +}; + +/** Allow access to NOR flash + + On the reference design platforms, the access to NOR flash has to be + explicitly permitted by writing to the FLASH_RWEN bit of the SYSPH_SYS= _REG + register. + + @retval EFI_SUCCESS Initialize required to access NOR flash is compl= ete. + +**/ +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + UINT64 SysRegFlash; + + SysRegFlash =3D FixedPcdGet64 (PcdSysPeriphSysRegBase) + SGI_SYSPH_SYS= _REG_FLASH; + MmioOr32 (SysRegFlash, SGI_SYSPH_SYS_REG_FLASH_RWEN); + return EFI_SUCCESS; +} + +/** Returns the list of available NOR flash devices + + For the StandaloneMM execution context, return the list of available N= OR + flash devices that are available for use. + + @param[in] NorFlashDevices Pointer to array of NOR flash devices. + @param[in] Count Number of elements in the NOR flash devi= ces + array. + + @retval EFI_SUCCESS Valid set of NOR flash devices is retu= rned. + @retval EFI_INVALID_PARAMETER Pointers to NOR flash devices and/or c= ount is + invalid. + +**/ +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ) +{ + if ((NorFlashDevices =3D=3D NULL) || (Count =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + *NorFlashDevices =3D mNorFlashDevices; + *Count =3D ARRAY_SIZE (mNorFlashDevices); + return EFI_SUCCESS; +} --=20 2.17.1 |
|
[edk2-platforms][PATCH V1 1/3] Platform/Sgi: refactor StandaloneMM platform description file
Sayanta Pattanayak
The RD-N2 platform has a different memory map from that of the other
platforms supported under the SgiPkg. To enable the use of StandaloneMM as a secure partition on RD-N2 platform, refactor the existing StandaloneMM platform description file. The differing portions are split into two different files and the rest of the platform description file is converted into a include file. Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@...> --- Platform/ARM/SgiPkg/{PlatformStandaloneMm.dsc =3D> SgiPlatformMm.dsc.inc= } | 30 +---- Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc = | 117 ++------------------ Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc = | 40 +++++++ 3 files changed, 53 insertions(+), 134 deletions(-) diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc b/Platform/ARM/= SgiPkg/SgiPlatformMm.dsc.inc similarity index 83% copy from Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc copy to Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc index e281d5490912..3389ff676a91 100644 --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc +++ b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc @@ -1,37 +1,16 @@ +## @file +# StandaloneMM platform description include file for all supported plat= forms. # -# Copyright (c) 2018, ARM Limited. All rights reserved. +# Copyright (c) 2021, ARM Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent -# - -########################################################################= ######## -# -# Defines Section - statements that will be processed to create a Makefi= le. -# -########################################################################= ######## -[Defines] - PLATFORM_NAME =3D SgiMmStandalone - PLATFORM_GUID =3D 34B78C8F-CFD5-49D5-8360-E91143F6106= D - PLATFORM_VERSION =3D 1.0 - DSC_SPECIFICATION =3D 0x00010011 - OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) - SUPPORTED_ARCHITECTURES =3D AARCH64 - BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT - SKUID_IDENTIFIER =3D DEFAULT - FLASH_DEFINITION =3D Platform/ARM/SgiPkg/PlatformStandal= oneMm.fdf - DEFINE DEBUG_MESSAGE =3D TRUE - - # LzmaF86 - DEFINE COMPRESSION_TOOL_GUID =3D D42AE6BD-1352-4bfb-909A-CA72A6EAE88= 9 +## =20 ########################################################################= ######## # # Library Class section - list of all Library Classes needed by this Pla= tform. # ########################################################################= ######## - -!include MdePkg/MdeLibs.dsc.inc - [LibraryClasses] # # Basic @@ -92,7 +71,6 @@ gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f =20 ## PL011 - Serial Terminal - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x7FF70000 gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 =20 gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2 diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc b/Platform/ARM/= SgiPkg/PlatformStandaloneMm.dsc index e281d5490912..cdf8aaa88f03 100644 --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc @@ -1,8 +1,11 @@ +## @file +# StandaloneMM platform description file for SGI-575, RD-N1-Edge, RD-E1= -Edge +# and RD-V1 platforms. # -# Copyright (c) 2018, ARM Limited. All rights reserved. +# Copyright (c) 2021, ARM Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent -# +## =20 ########################################################################= ######## # @@ -11,9 +14,9 @@ ########################################################################= ######## [Defines] PLATFORM_NAME =3D SgiMmStandalone - PLATFORM_GUID =3D 34B78C8F-CFD5-49D5-8360-E91143F6106= D + PLATFORM_GUID =3D 503b97f6-1be9-4661-97fd-9a55bbd2680= d PLATFORM_VERSION =3D 1.0 - DSC_SPECIFICATION =3D 0x00010011 + DSC_SPECIFICATION =3D 0x0001001B OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) SUPPORTED_ARCHITECTURES =3D AARCH64 BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT @@ -24,62 +27,9 @@ # LzmaF86 DEFINE COMPRESSION_TOOL_GUID =3D D42AE6BD-1352-4bfb-909A-CA72A6EAE88= 9 =20 -########################################################################= ######## -# -# Library Class section - list of all Library Classes needed by this Pla= tform. -# -########################################################################= ######## - +# include common definitions. !include MdePkg/MdeLibs.dsc.inc - -[LibraryClasses] - # - # Basic - # - BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.= inf - DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Bas= eDebugPrintErrorLevelLib.inf - ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionL= ib/PrePiExtractGuidedSectionLib.inf - FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf - HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore= HobLib.inf - IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf - MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.i= nf - MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllo= cationLib/StandaloneMmCoreMemoryAllocationLib.inf - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRep= ortStatusCodeLibNull.inf - - # - # Entry point - # - StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoi= nt/StandaloneMmDriverEntryPoint.inf - - ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf - StandaloneMmMmuLib|ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneM= mLib.inf - ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf - CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMain= tenanceLib.inf - PeCoffExtraActionLib|StandaloneMmPkg/Library/StandaloneMmPeCoffExtraAc= tionLib/StandaloneMmPeCoffExtraActionLib.inf - - # ARM PL011 UART Driver - PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartCl= ockLib.inf - PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf - SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPor= tLib.inf - - StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEnt= ryPoint/StandaloneMmCoreEntryPoint.inf - - # - # It is not possible to prevent the ARM compiler for generic intrinsic= functions. - # This library provides the instrinsic functions generate by a given c= ompiler. - # And NULL mean link this library into all ARM images. - # - NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf - -[LibraryClasses.common.MM_STANDALONE] - HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.i= nf - MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Standal= oneMmServicesTableLib.inf - MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocati= onLib/StandaloneMmMemoryAllocationLib.inf +!include Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc =20 ########################################################################= ######## # @@ -87,54 +37,5 @@ # ########################################################################= ######## [PcdsFixedAtBuild] - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x800000CF - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xff - gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f - ## PL011 - Serial Terminal gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x7FF70000 - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 - - gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2 - -########################################################################= ########################### -# -# Components Section - list of the modules and components that will be p= rocessed by compilation -# tools and the EDK II tools to generate PE32/PE32+= /Coff image files. -# -# Note: The EDK II DSC file is not used to specify how compiled binary i= mages get placed -# into firmware volume images. This section is just a list of modu= les 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. -# Binary modules do not need to be listed in this section, as they= should be -# specified in the FDF file. For example: Shell binary (Shell_Full= .efi), FAT binary (Fat.efi), -# Logo (Logo.bmp), and etc. -# There may also be modules listed in this section that are not re= quired in the FDF file, -# When a module listed here is excluded from FDF file, then UEFI-c= ompliant binary will be -# generated for it, but the binary will not be put into any firmwa= re volume. -# -########################################################################= ########################### -[Components.common] - # - # MM Core - # - StandaloneMmPkg/Core/StandaloneMmCore.inf - -[Components.AARCH64] - StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf - -########################################################################= ########################### -# -# BuildOptions Section - Define the module specific tool chain flags tha= t should be used as -# the default flags for a module. These flags are= appended to any -# standard flags that are defined by the build pr= ocess. They can be -# applied for any modules or only those modules w= ith the specific -# module style (EDK or EDKII) specified in [Compo= nents] section. -# -########################################################################= ########################### -[BuildOptions.AARCH64] - GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000 -march=3Darmv8-= a+nofp - -[BuildOptions] - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc b/Platform/ARM= /SgiPkg/PlatformStandaloneMm2.dsc new file mode 100644 index 000000000000..bb359a15cc0d --- /dev/null +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc @@ -0,0 +1,40 @@ +## @file +# StandaloneMM platform description file for RD-N2 platforms. +# +# Copyright (c) 2021, ARM Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +########################################################################= ######## +# +# Defines Section - statements that will be processed to create a Makefi= le. +# +########################################################################= ######## +[Defines] + PLATFORM_NAME =3D SgiMmStandalone + PLATFORM_GUID =3D 67309f8a-d278-4df5-86ee-a1826cf481e= d + PLATFORM_VERSION =3D 1.0 + DSC_SPECIFICATION =3D 0x0001001B + OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES =3D AARCH64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER =3D DEFAULT + FLASH_DEFINITION =3D Platform/ARM/SgiPkg/PlatformStandal= oneMm.fdf + DEFINE DEBUG_MESSAGE =3D TRUE + + # LzmaF86 + DEFINE COMPRESSION_TOOL_GUID =3D D42AE6BD-1352-4bfb-909A-CA72A6EAE88= 9 + +# include common definitions. +!include MdePkg/MdeLibs.dsc.inc +!include Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc + +########################################################################= ######## +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +########################################################################= ######## +[PcdsFixedAtBuild] + ## PL011 - Serial Terminal + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x0EF80000 --=20 2.17.1 |
|
[edk2-platforms][PATCH V1 0/3] Platform/Sgi: enable support for UEFI secure boot
Sayanta Pattanayak
This patch series adds secure boot support for Arm's reference design
platforms. The first patch refactors the existing StandaloneMM platform description file and splits into three different files. This is required to accomodate for changes register base addresses in RD-N2 platform and the other supported platforms. The second path add support for NOR flash platform library to be used with StandaloneMM execution context. The third patch then enables the support for UEFI secure for all the supported reference design platforms. This patch series should be applied on top of the patch series https://edk2.groups.io/g/devel/message/75368 Link to github branch with the patches in this series - https://github.com/SayantaP-arm/edk2-platforms/tree/rd_platform_secure_bo= ot Sayanta Pattanayak (3): Platform/Sgi: refactor StandaloneMM platform description file Platform/Sgi: add StandaloneMM usable NorFlashPlatformLib Platform/Sgi: enable support for UEFI secure boot Platform/ARM/SgiPkg/SgiPlatform.dec | 1 + Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 31 +++++ ...StandaloneMm.dsc =3D> SgiPlatformMm.dsc.inc} | 62 +++++---- Platform/ARM/SgiPkg/PlatformStandaloneMm.dsc | 130 ++++-------------- Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc | 55 ++++++++ Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf | 5 + Platform/ARM/SgiPkg/SgiPlatform.fdf | 9 +- .../NorFlashLib/StandaloneMmNorFlashLib.inf | 33 +++++ .../NorFlashLib/StandaloneMmNorFlashLib.c | 82 +++++++++++ 9 files changed, 274 insertions(+), 134 deletions(-) copy Platform/ARM/SgiPkg/{PlatformStandaloneMm.dsc =3D> SgiPlatformMm.ds= c.inc} (73%) create mode 100644 Platform/ARM/SgiPkg/PlatformStandaloneMm2.dsc create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmN= orFlashLib.inf create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/StandaloneMmN= orFlashLib.c --=20 2.17.1 |
|
[PATCH] MdePkg: Fix AsmReadSs() with GCC toolchain
Satoshi Tanda
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3325
AsmReadSs() in Ia32/GccInlinePriv.c and X64/GccInlinePriv.c return the DS segment selector value instead of SS. Signed-off-by: Satoshi Tanda <tanda.sat@...> --- MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c | 2 +- MdePkg/Library/BaseLib/X64/GccInlinePriv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c b/MdePkg/Library/B= aseLib/Ia32/GccInlinePriv.c index 40e8c08beb..b8b5b85e73 100644 --- a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c +++ b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c @@ -902,7 +902,7 @@ AsmReadSs ( UINT16 Data;=0D =0D __asm__ __volatile__ (=0D - "mov %%ds, %0"=0D + "mov %%ss, %0"=0D :"=3Da" (Data)=0D );=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c b/MdePkg/Library/Ba= seLib/X64/GccInlinePriv.c index 244bd62ee6..c3feb9f922 100644 --- a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c +++ b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c @@ -911,7 +911,7 @@ AsmReadSs ( UINT16 Data;=0D =0D __asm__ __volatile__ (=0D - "mov %%ds, %0"=0D + "mov %%ss, %0"=0D :"=3Da" (Data)=0D );=0D =0D --=20 2.25.1 |
|
Re: [PATCH 1/2] MdePkg: Standalone PCD driver
Michael D Kinney
Why do we need a new PCD?
toggle quoted message
Show quoted text
Can't we make this the default behavior to only install one instance? Thanks, Mike -----Original Message----- |
|
Re: GSOC 2021 EXT4 driver Project
Michael D Kinney
Hi Pedro,
Here is a link to background materials to get started with EDK II. https://github.com/tianocore-training/Tianocore_Training_Contents/wiki The detailed specifications for the EDK II build systems and coding style are: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Draft-Specification Best regards, Mike =================== From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Pedro Falcato Sent: Monday, May 24, 2021 12:27 PM To: devel@edk2.groups.io Subject: [edk2-devel] GSOC 2021 EXT4 driver Project Hi everyone, Me and my project have been selected for GSoC this year, under Michael Kinney and bret. Thank you for the opportunity to collaborate with you and improve Tianocore! If anyone has any questions, please fire away :) How do I get started? I'd like to find some easier tasks as to start trying out patch submission and generally programming in a firmware environment. Also, I've been talking with my mentors and a relevant question to ask the mailing list is: Where should we put the EXT4 driver? Michael said there are other filesystems in MdeModulePkg, but it might be getting too big and proposed the following options: 1) EXT4 in new package in edk2 repo as a peer to FatPkg. 2) EXT4 in edk2 repo in MdeModulePkg 3) EXT4 in edk2-platforms advanced feature package. 4) EXT4 in edk2 advanced feature package As someone that's still learning how to navigate the project's tree(s), this is a bit over my head and so I'd like your opinion on the matter. Also, I would love if someone could point me to some good reading material and/or examples of the package/build system, as I couldn't find documentation on those and my previous experiment with Tianocore involved looking at FatPkg and mindlessly copying what it was doing. Thanks, Pedro |
|
Re: [PATCH v1 1/1] FmpDevicePkg: FmpDeviceLib interface change for Driver Unload support
John Rahn
Just to get some closure on this thread for the list.
toggle quoted message
Show quoted text
I've had some additional side discussions with Michael D Kinney about the reasoning behind the patch and wanted to summarize the results after we got to the root of the issue. Proposed patch is not required. Expected usage of the FmpDxe is as follows: Sample FmpDxe code incorporating FmpDeviceLib for single Fmp instance on ImageHandle. UEFI driver incorporating FmpDxeLib and FmpDeviceLib for FmpInstance(s) on ControllerHandle(s) Attempting to create a driver using and based on the sample FmpDxe code and documentation currently available and extending it to the UEFI driver model can be done but results in inability to properly specify a driver unload function for the driver without modifications to the project. This is not the recommended process as it mixes the expected usage models. The solution to the DriverUnload issue is to create a UEFI driver leveraging FmpDxeLib and FmpDeviceLib with the DRIVER_UNLOAD specified in the UEFI driver INF file and is the proper solution. -----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of John Rahn via groups.io Sent: Tuesday, April 20, 2021 4:25 PM To: Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io Cc: Liming Gao <gaoliming@...>; Jiang, Guomin <guomin.jiang@...>; Xu, Wei6 <wei6.xu@...>; John Rahn <JRahn@...> Subject: Re: [edk2-devel] [PATCH v1 1/1] FmpDevicePkg: FmpDeviceLib interface change for Driver Unload support External email: Use caution opening links or attachments Driver unload in the sample FmpDxe is currently configured to directly call UninstallFmpInstance (UNLOAD_IMAGE) with the ImageHandle and EFI_UNSUPPORTED is returned because the driver binding provided by FmpDeviceLib is managing the instance on the DeviceHandle, not the ImageHandle. The FmpDeviceLib supporting the UEFI Driver Binding model is never notified of the driver unload and the Fmp Instance(s) are not uninstalled and the driver is not unloaded. The sample FmpDxe does not provide a interface for the required driver unload notification to be passed to the FmpDeviceLib implementation. Attempting to have the UninstallFmpInstance in the sample FmpDxe check Fmp instances for drivers managing the device and calling DriverStop with the DeviceHandle didn't align with the standard driver implementation model and was not as straightforward of an approach as exposing a driver unload interface for FmpDeviceLib use for the driver unload notification, so that the FmpDeviceLib can properly stop on it's managed devices and clean up any internal context/private data. A FmpDeviceLib following the driver binding model and implementing the proposed interface can unload the Fmp instance(s) being managed and clean up any allocations before exit. Any remaining allocations in the FmpDxe are properly dealt with in the UninstallFmpInstance path. I was able to successfully build a functional FmpDeviceLib that will properly unload the installed Fmp instance(s) using the proposed interface change. -----Original Message----- From: Kinney, Michael D <michael.d.kinney@...> Sent: Tuesday, April 20, 2021 3:37 PM To: John Rahn <JRahn@...>; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@...> Cc: Liming Gao <gaoliming@...>; Jiang, Guomin <guomin.jiang@...>; Xu, Wei6 <wei6.xu@...> Subject: RE: [PATCH v1 1/1] FmpDevicePkg: FmpDeviceLib interface change for Driver Unload support External email: Use caution opening links or attachments Hi John, The FmpDeviceLib provides the RegisterFmpInstaller() and RegisterFmpUninstaller() APIs for UEFI Driver Model drivers to manage the FMP contexts. Why does the Unload need to be extended into the FmpDeviceLib when these APIs are used? I would think that a UEFI Driver Model Driver that supports FMP could call Stop() on all instances when an Unload() request is received and the Stop() services would use the FMP Uninstaller path to clean up the FMP instances. If all Stops() succeed, then the UEFI Driver that is producing the FMP instances can be unloaded, /** Callback function that installs a Firmware Management Protocol instance onto a handle. @param[in] Handle The device handle to install a Firmware Management Protocol instance. @retval EFI_SUCCESS A Firmware Management Protocol instance was installed onto Handle. @retval EFI_INVALID_PARAMETER Handle is invalid @retval other A Firmware Management Protocol instance could not be installed onto Handle. **/ typedef EFI_STATUS (EFIAPI *FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER)( IN EFI_HANDLE Handle ); /** Callback function that uninstalls a Firmware Management Protocol instance from a handle. @param[in] Handle The device handle to uninstall a Firmware Management Protocol instance. @retval EFI_SUCCESS A Firmware Management Protocol instance was uninstalled from Handle. @retval EFI_INVALID_PARAMETER Handle is invalid @retval other A Firmware Management Protocol instance could not be uninstalled from Handle. **/ typedef EFI_STATUS (EFIAPI *FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER)( IN EFI_HANDLE Handle ); /** Provide a function to install the Firmware Management Protocol instance onto a device handle when the device is managed by a driver that follows the UEFI Driver Model. If the device is not managed by a driver that follows the UEFI Driver Model, then EFI_UNSUPPORTED is returned. @param[in] FmpInstaller Function that installs the Firmware Management Protocol. @retval EFI_SUCCESS The device is managed by a driver that follows the UEFI Driver Model. FmpInstaller must be called on each Driver Binding Start(). @retval EFI_UNSUPPORTED The device is not managed by a driver that follows the UEFI Driver Model. @retval other The Firmware Management Protocol for this firmware device is not installed. The firmware device is still locked using FmpDeviceLock(). **/ EFI_STATUS EFIAPI RegisterFmpInstaller ( IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER FmpInstaller ); /** Provide a function to uninstall the Firmware Management Protocol instance from a device handle when the device is managed by a driver that follows the UEFI Driver Model. If the device is not managed by a driver that follows the UEFI Driver Model, then EFI_UNSUPPORTED is returned. @param[in] FmpUninstaller Function that installs the Firmware Management Protocol. @retval EFI_SUCCESS The device is managed by a driver that follows the UEFI Driver Model. FmpUninstaller must be called on each Driver Binding Stop(). @retval EFI_UNSUPPORTED The device is not managed by a driver that follows the UEFI Driver Model. @retval other The Firmware Management Protocol for this firmware device is not installed. The firmware device is still locked using FmpDeviceLock(). **/ EFI_STATUS EFIAPI RegisterFmpUninstaller ( IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller ); Best regards, Mike -----Original Message----- |
|
GSOC 2021 EXT4 driver Project
Pedro Falcato
Hi everyone,
Me and my project have been selected for GSoC this year, under Michael Kinney and bret. Thank you for the opportunity to collaborate with you and improve Tianocore! If anyone has any questions, please fire away :) How do I get started? I'd like to find some easier tasks as to start trying out patch submission and generally programming in a firmware environment. Also, I've been talking with my mentors and a relevant question to ask the mailing list is: Where should we put the EXT4 driver? Michael said there are other filesystems in MdeModulePkg, but it might be getting too big and proposed the following options: 1) EXT4 in new package in edk2 repo as a peer to FatPkg. 2) EXT4 in edk2 repo in MdeModulePkg 3) EXT4 in edk2-platforms advanced feature package. 4) EXT4 in edk2 advanced feature package As someone that's still learning how to navigate the project's tree(s), this is a bit over my head and so I'd like your opinion on the matter. Also, I would love if someone could point me to some good reading material and/or examples of the package/build system, as I couldn't find documentation on those and my previous experiment with Tianocore involved looking at FatPkg and mindlessly copying what it was doing. Thanks, Pedro |
|
Re: 回复: [edk2-devel] Generic MinPlatform
Then I have two more issues unrelated to RISC-V: https://github.com/riscv/riscv-edk2-platforms/commit/b68f4587fc28588b4474ff15d43918182c33b4b7
And some related to RISC-V: https://github.com/riscv/riscv-edk2-platforms/commit/579705cf46dafc90e4a2bc243e5aa5cd828cb126
And what's most relevant to Kaaira, the commit to make my QEMU platform use MinPlatform include files:
Yes, absolutely. As above, for now I created one for common x86 concepts. But there should probably be one for PCI and USB should move to AdvancedFeatures, like you said.
The other two RISC-V platforms I'm working on don't have PCI and one of them doesn't have USB.
Right, that's a good idea. Kaaira and me can create one for QEMU with all of the virtio drivers.
And those for x86 and RISC-V wouldn't actually too big, as you can see in my change. RISC-V needs even less special modules.
Thanks,
Daniel
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Oram, Isaac W <isaac.w.oram@...>
Sent: Friday, May 21, 2021 11:38 To: Schaefer, Daniel <daniel.schaefer@...>; devel@edk2.groups.io <devel@edk2.groups.io>; gaoliming@... <gaoliming@...>; kaaira7319@... <kaaira7319@...>; Ni, Ray <ray.ni@...>; mikuback@... <mikuback@...> Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@...> Subject: Re: 回复: [edk2-devel] GSoC 2021 Qemu OpenBoardPkg Project I think we should patch first and move to a common location later.
Looking at some of your changes and comments, I have these comments:
#!if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE # PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf #!endif
[PcdsFeatureFlag] # # MinPlatform control flags # gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit |FALSE gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly |FALSE gMinPlatformPkgTokenSpaceGuid.PcdUefiSecureBootEnable |FALSE gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable |FALSE gMinPlatformPkgTokenSpaceGuid.PcdSmiHandlerProfileEnable|TRUE gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable |FALSE … !include $(PLATFORM_PACKAGE)/Include/Dsc/CoreCommonLib.dsc
This is useful feedback and we should think about how we want to enable optimization (stage 7) in a reasonable way. We haven’t gotten that far into the optimization details as we wanted to get the basics worked out, but it might very much make sense to make more of these things controlled by MinPlatform Arch defined feature flags. Or to move to Advanced Features. And some things we haven’t cleaned up yet. We still have USB in common includes, but those drivers should move to an Advanced Feature. The main thing is we want intelligent default behavior so new board porting people can get productive fast without having to know all these edk2 special features. Then as they get things working, they can start to take advantage of more edk2 and UEFI capabilities as they learn them. Eventually hitting an optimization phase where common things can be quickly stripped out if not needed. I hadn’t thought much about build optimization, but I think that this is reasonable to include in scope.
Looking at your feedback/challenges, I see a few options: · Add more MinPlatform Arch defined feature flags for PCI, SMM, etc. · Add Advanced Features for them · Add “Core System Design” includes. E.G. one for x86, one for QEMU, one for RISKV, etc. I am not sure how many of these we would need.
Thoughts and preferences? I think that we need to keep in mind KISS for new board ports and new users.
The checklists should be “Board Porting Activity Checklist” and unfortunately for you both, you are making the first reference QemuOpenBoardPkg and boards and that is a little more involved than making derivatives, which is what those checklists are going to help the most.
Regards,
From: Schaefer, Daniel <daniel.schaefer@...>
Thanks for the answers, that's very helpful, guys!
I've started to replace some of my DSC and FDF with the include files mentioned by Michael. Since RISC-V doesn't have I/O registers, SMM and some other things, I had to make some changes but not too many. Maybe for Qemu there would have be some more non-Intel changes. Would you accept patches to make it more arch agnostic? Or should we first move it out of the Intel directory?
Sorry for hijacking your thread Kaaira, but I hope this discussion would also be helpful for you 🙂 Just like you, I'm trying to convert a QEMU platform to MinPlatform. (And then the other RISC-V platforms) If you want to have a look, you can check out my progress here: https://github.com/riscv/riscv-edk2-platforms/commits/riscv-virt-minplatform-gh-actions
My plan is:
I see that each stage in the MinPlatform spec has a checklist. They don't look like checklist but rather steps to achieve a certain state but that's also ok.
Thanks, Daniel
From:
devel@edk2.groups.io <devel@edk2.groups.io>
on behalf of Michael Kubacki <mikuback@...>
Daniel, |
|
Re: [edk2-platforms][PATCH V4 00/11] Add SMBIOS tables for Arm's Reference Design platforms
Sami Mujawar
Hi Ard,
toggle quoted message
Show quoted text
EDKII is in hard feature freeze starting 2021-05-24 (See https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning). However, does this apply to the edk2-platforms repo as well? Can you let me know, please? Regards, Sami Mujawar On 24/05/2021 03:28 PM, Pranav Madhu wrote:
Changes since V3: |
|
Re: [edk2-platforms PATCH 3/6] Marvell: Armada7k8k/OcteonTx: Switch SPCR UART subtype to 0x1
Samer El-Haj-Mahmoud
That being said, for this particular patch
toggle quoted message
Show quoted text
Reviewed-By: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...> -----Original Message-----IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. |
|
[edk2-platforms][PATCH V4 11/11] Platform/Sgi: Add SMBIOS Type32 Table
Pranav Madhu
Add the SMBIOS type 32 table (System Boot Information) that includes
information about the System Boot Status. Signed-off-by: Pranav Madhu <pranav.madhu@...> Reviewed-by: Sami Mujawar <sami.mujawar@...> --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 17 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformatio= n.c | 84 ++++++++++++++++++++ 4 files changed, 103 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe= .inf index f81494114188..4258eb9deadb 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -23,6 +23,7 @@ Type16PhysicalMemoryArray.c Type17MemoryDevice.c Type19MemoryArrayMappedAddress.c + Type32SystemBootInformation.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index d4b838689a32..f8f69f0785b9 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -158,6 +158,23 @@ InstallType19MemoryArrayMappedAddress ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS system boot information + + Install the SMBIOS system boot information (type 32) table for RD plat= forms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in us= e. +**/ +EFI_STATUS +EFIAPI +InstallType32SystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index bed5da77786d..29535b247b7c 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -34,6 +34,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D= { &InstallType16PhysicalMemoryArray, &InstallType17MemoryDevice, &InstallType19MemoryArrayMappedAddress, + &InstallType32SystemBootInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBo= otInformation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32Sys= temBootInformation.c new file mode 100644 index 000000000000..e98e23fe8fe0 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInfor= mation.c @@ -0,0 +1,84 @@ +/** @file + SMBIOS Type 32 (System Boot Information) table for ARM RD platforms. + + This file installs SMBIOS Type 32 (System Boot Information) table for = Arm's + Reference Design platforms. It includes information about the System B= oot + Status. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.33 +**/ + +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Protocol/Smbios.h> + +#include "SmbiosPlatformDxe.h" + +#define TYPE32_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type32 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE32 Base; + CHAR8 Strings[sizeof (TYPE32_STRINGS)]; +} ARM_RD_SMBIOS_TYPE32; +#pragma pack() + +/* System Boot Information */ +STATIC ARM_RD_SMBIOS_TYPE32 mArmRdSmbiosType32 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, // Type 32 + sizeof (SMBIOS_TABLE_TYPE32), // Length + SMBIOS_HANDLE_PI_RESERVED + }, + {0}, // Reserved field + BootInformationStatusNoError // Boot status + }, + // Text strings (unformatted area) + TYPE32_STRINGS +}; + +/** + Install SMBIOS system boot information + + Install the SMBIOS system boot information (type 32) table for RD plat= forms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in us= e. +**/ +EFI_STATUS +InstallType32SystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32)->Han= dle; + + /* Install type 32 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type32 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.1 |
|
[edk2-platforms][PATCH V4 10/11] Platform/Sgi: Add SMBIOS Type19 Table
Pranav Madhu
Add the SMBIOS type 19 table (Memory Array Mapped Addr) that includes
information about the address mapping for a Physical Memory Array. Signed-off-by: Pranav Madhu <pranav.madhu@...> Reviewed-by: Sami Mujawar <sami.mujawar@...> --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 18 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMappedAdd= ress.c | 97 ++++++++++++++++++++ 4 files changed, 117 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe= .inf index 9061c491d461..f81494114188 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -22,6 +22,7 @@ Type7CacheInformation.c Type16PhysicalMemoryArray.c Type17MemoryDevice.c + Type19MemoryArrayMappedAddress.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 4e663033d515..d4b838689a32 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -140,6 +140,24 @@ InstallType17MemoryDevice ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS memory array mapped address table + + Install the SMBIOS memory array mapped address (type 19) table for RD + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in us= e. +**/ +EFI_STATUS +EFIAPI +InstallType19MemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 4e6a6b250813..bed5da77786d 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -33,6 +33,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D= { &InstallType7CacheInformation, &InstallType16PhysicalMemoryArray, &InstallType17MemoryDevice, + &InstallType19MemoryArrayMappedAddress, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryAr= rayMappedAddress.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19= MemoryArrayMappedAddress.c new file mode 100644 index 000000000000..301208c4bc03 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMapp= edAddress.c @@ -0,0 +1,97 @@ +/** @file + SMBIOS Type 19 (Memory Array Mapped Address) table for ARM RD platform= s. + + This file installs SMBIOS Type 19 (Memory Array Mapped Address) table = for Arm's + Reference Design platforms. It includes information about the address = mapping + for a Physical Memory Array. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.20 +**/ + +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Protocol/Smbios.h> + +#include "SmbiosPlatformDxe.h" + +#define TYPE19_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type19 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE19 Base; + CHAR8 Strings[sizeof (TYPE19_STRINGS)]; +} ARM_RD_SMBIOS_TYPE19; +#pragma pack() + +/* Memory Array Mapped Address */ +STATIC ARM_RD_SMBIOS_TYPE19 mArmRdSmbiosType19 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, // Type 19 + sizeof (SMBIOS_TABLE_TYPE19), // Length + SMBIOS_HANDLE_PI_RESERVED, // Assign an unused handle numbe= r + }, + 0, // Starting address + 0, // Ending address + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Memory array handle + 1 // Partition width + }, + // Text strings (unformatted area) + TYPE19_STRINGS +}; + +/** + Install SMBIOS memory array mapped address table + + Install the SMBIOS memory array mapped address (type 19) table for RD + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in us= e. +**/ +EFI_STATUS +InstallType19MemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19)->Han= dle; + + mArmRdSmbiosType19.Base.StartingAddress =3D 0xFFFFFFFF; + mArmRdSmbiosType19.Base.EndingAddress =3D 0xFFFFFFFF; + mArmRdSmbiosType19.Base.ExtendedStartingAddress =3D + PcdGet64 (PcdSystemMemoryBase); + mArmRdSmbiosType19.Base.ExtendedEndingAddress =3D + (PcdGet64 (PcdSystemMemoryBase) + + PcdGet64 (PcdSystemMemorySize) + + SIZE_16MB // 16MB Trusted DRAM + ) - 1; + + /* Install type 19 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type19 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.1 |
|
[edk2-platforms][PATCH V4 09/11] Platform/Sgi: Add SMBIOS Type17 Table
Pranav Madhu
Add the SMBIOS type 17 table (Memory Device) that includes the
specification of each installed memory device such as size of each device, bank locator, memory device type, and other related information. Signed-off-by: Pranav Madhu <pranav.madhu@...> Reviewed-by: Sami Mujawar <sami.mujawar@...> --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 26 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c | 409 ++++++++++++++++++++ 4 files changed, 437 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index ebd19c1882bb..9061c491d461 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -21,6 +21,7 @@ Type4ProcessorInformation.c Type7CacheInformation.c Type16PhysicalMemoryArray.c + Type17MemoryDevice.c [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 95bb2c4bfc70..4e663033d515 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -122,6 +122,24 @@ InstallType16PhysicalMemoryArray ( IN EFI_SMBIOS_PROTOCOL *Smbios ); + +/** + Install SMBIOS memory device table. + + Install the SMBIOS memory device (type 17) table for RD platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType17MemoryDevice ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE = 0x1000, SMBIOS_HANDLE_CLUSTER1, @@ -131,6 +149,14 @@ typedef enum { SMBIOS_HANDLE_L3_CACHE, SMBIOS_HANDLE_L4_CACHE, SMBIOS_HANDLE_PHYSICAL_MEMORY, + SMBIOS_HANDLE_MEMORY_DEVICE0000, // Chip 0 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0001, // Chip 0 Bank 1 + SMBIOS_HANDLE_MEMORY_DEVICE0100, // Chip 1 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0101, // Chip 1 Bank 1 + SMBIOS_HANDLE_MEMORY_DEVICE0200, // Chip 2 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0201, // Chip 2 Bank 1 + SMBIOS_HANDLE_MEMORY_DEVICE0300, // Chip 3 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0301, // Chip 3 Bank 1 } SMBIOS_REFRENCE_HANDLES; #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 4f14be165c94..4e6a6b250813 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -32,6 +32,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] = { &InstallType4ProcessorInformation, &InstallType7CacheInformation, &InstallType16PhysicalMemoryArray, + &InstallType17MemoryDevice, }; /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c new file mode 100644 index 000000000000..b51e2b3fa1a6 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c @@ -0,0 +1,409 @@ +/** @file + SMBIOS Type 17 (Memory Device) table for ARM RD platforms. + + This file installs SMBIOS Type 17 (Memory Device) table for Arm's Reference + Design platforms. It includes the specification of each installed memory + device such as size of each device, bank locator, memory device type, and + other related information. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.18 +**/ + +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Protocol/Smbios.h> + +#include "SmbiosPlatformDxe.h" + +#define TYPE17_STRINGS \ + "Chip 0 Bank 0\0" \ + "Chip 1 Bank 0\0" \ + "Chip 2 Bank 0\0" \ + "Chip 3 Bank 0\0" \ + "Chip 0 Bank 1\0" \ + "Chip 1 Bank 1\0" \ + "Chip 2 Bank 1\0" \ + "Chip 3 Bank 1\0" + +typedef enum { + Chip0Bank0 = 1, + Chip1Bank0, + Chip2Bank0, + Chip3Bank0, + Chip0Bank1, + Chip1Bank1, + Chip2Bank1, + Chip3Bank1 +} TYPE17_STRING_ELEMENTS; + +/* SMBIOS Type17 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE17 Base; + CHAR8 Strings[sizeof (TYPE17_STRINGS)]; +} ARM_RD_SMBIOS_TYPE17; +#pragma pack() + +/* Memory Device */ +STATIC ARM_RD_SMBIOS_TYPE17 mArmRdSmbiosType17[] = { + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0000 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip0Bank0, // Chip 0 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0001 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip0Bank1, // Chip 0 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0100 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip1Bank0, // Chip 1 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0101 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip1Bank1, // Chip 1 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0200 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip2Bank0, // Chip 2 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0201 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip2Bank1, // Chip 2 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0300 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip3Bank0, // Chip 3 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0301 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip3Bank1, // Chip 3 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, +}; + +/** Update the memory size fields in SMBIOS Memory Device (Type 17) table. + + @param [in] Type17Table Pointer to the Type 17 table. + @param [in] MemorySize Memory size available on the platform. + - If no memory device is installed, this value + is 0. + - If size is unknown, this value is MAX_UINT64. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid Type 17 Table pointer. +**/ +STATIC +UINTN +UpdateMemorySize ( + IN SMBIOS_TABLE_TYPE17 *Type17Table, + IN UINT64 MemorySize + ) +{ + if (Type17Table == NULL) { + return EFI_INVALID_PARAMETER; + } + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + Table 75 – Memory Device (Type 17) structure, description for Size field. + If the value is 0, no memory device is installed in the socket; if + the size is unknown, the field value is FFFFh. + */ + if (MemorySize == 0) { + Type17Table->Size = 0; + Type17Table->ExtendedSize = 0; + return EFI_SUCCESS; + } + + if (MemorySize == MAX_UINT64) { + Type17Table->Size = MAX_UINT16; + Type17Table->ExtendedSize = 0; + return EFI_SUCCESS; + } + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + Table 75 – Memory Device (Type 17) structure, description for Size field. + If the size is 32 GB-1 MB or greater, the field value is 7FFFh and the + actual size is stored in the Extended Size field. + */ + if (MemorySize < (SIZE_32GB - SIZE_1MB)) { + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + section 7.18.5 Memory Device — Extended Size + For compatibility with older SMBIOS parsers, memory devices + smaller than (32 GB - 1 MB) should be represented using their + size in the Size field, leaving the Extended Size field set to 0. + */ + Type17Table->ExtendedSize = 0; + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + Table 75 – Memory Device (Type 17) structure, description for Size field. + The granularity in which the value is specified depends on the setting + of the most-significant bit (bit 15). If the bit is 0, the value is + specified in megabyte units; if the bit is 1, the value is specified + in kilobyte units. + For example, the value 8100h identifies a 256 KB memory device + and 0100h identifies a 256 MB memory device. + */ + if (MemorySize < SIZE_1MB) { + Type17Table->Size = MemorySize >> 10; + Type17Table->Size |= BIT15; + } else { + Type17Table->Size = MemorySize >> 20; + } + return EFI_SUCCESS; + } + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + section 7.18.5 Memory Device — Extended Size + The Extended Size field is intended to represent memory devices + larger than 32,767 MB (32 GB - 1 MB), which cannot be described + using the Size field. This field is only meaningful if the value + in the Size field is 7FFFh. + */ + Type17Table->Size = 0x7FFF; + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + section 7.18.5 Memory Device — Extended Size + Bit 31 is reserved for future use and must be set to 0. + Bits 30:0 represent the size of the memory device in megabytes. + EXAMPLE: 0000_8000h indicates a 32 GB memory device (32,768 MB), + 0002_0000h represents a 128 GB memory device (131,072 MB), and + 0000_7FFFh represents a 32,767 MB (32 GB – 1 MB) device. + */ + Type17Table->ExtendedSize = (MemorySize >> 20) & (~BIT31); + return EFI_SUCCESS; +} + +/** + Install SMBIOS memory device Table. + + Install the SMBIOS memory device (type 17) table for RD platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType17MemoryDevice ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 Idx; + + /* Get system memory information */ + for (Idx = 0; Idx < (FixedPcdGet32 (PcdChipCount) * 2); Idx += 2) { + Status = UpdateMemorySize ( + &mArmRdSmbiosType17[Idx].Base, + PcdGet64 (PcdSystemMemorySize) + SIZE_16MB + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to update DRAM size for chip%d.\n", + Idx / 2 + )); + } else { + mArmRdSmbiosType17[Idx].Base.MemoryTechnology = MemoryTechnologyDram; + mArmRdSmbiosType17[Idx].Base.MemoryOperatingModeCapability.Bits. + VolatileMemory = 1; + } + + if (PcdGet64 (PcdDramBlock2Size) != 0) { + Status = UpdateMemorySize ( + &mArmRdSmbiosType17[Idx + 1].Base, + PcdGet64 (PcdDramBlock2Size) + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to update DRAM block 2 size for chip%d.\n", + Idx / 2 + )); + } else { + mArmRdSmbiosType17[Idx + 1].Base.MemoryTechnology = + MemoryTechnologyDram; + mArmRdSmbiosType17[Idx + 1].Base.MemoryOperatingModeCapability.Bits. + VolatileMemory = 1; + } + } + } + + /* Install valid entries */ + for (Idx = 0; Idx < (FixedPcdGet32 (PcdChipCount) * 2); Idx++) { + SmbiosHandle = + ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType17[Idx])->Handle; + Status = Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType17[Idx] + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type17 SMBIOS table.\n" + )); + break; + } + } + + return Status; +} -- 2.17.1 |
|
[edk2-platforms][PATCH V4 08/11] Platform/Sgi: Add SMBIOS Type16 Table
Pranav Madhu
Add the SMBIOS type 16 table (Physical Memory Array) describes a
collection of memory devices that operate together to form a memory address. It includes information about number of devices, total memory installed, error correction mechanism used and other related information. Signed-off-by: Pranav Madhu <pranav.madhu@...> Reviewed-by: Sami Mujawar <sami.mujawar@...> --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 4 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 19 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMemoryArray.= c | 106 ++++++++++++++++++++ 4 files changed, 130 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe= .inf index ee00b773912b..ebd19c1882bb 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -20,6 +20,7 @@ Type3SystemEnclosure.c Type4ProcessorInformation.c Type7CacheInformation.c + Type16PhysicalMemoryArray.c =20 [Packages] ArmPkg/ArmPkg.dec @@ -44,6 +45,9 @@ gArmPlatformTokenSpaceGuid.PcdClusterCount gArmPlatformTokenSpaceGuid.PcdCoreCount gArmSgiTokenSpaceGuid.PcdChipCount + gArmSgiTokenSpaceGuid.PcdDramBlock2Size + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision =20 [Protocols] diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 43f35ea0518f..95bb2c4bfc70 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -104,6 +104,24 @@ InstallType7CacheInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS physical memory array table. + + Install the SMBIOS physical memory array (type 16) table for Arm's Ref= erence + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in us= e. +**/ +EFI_STATUS +EFIAPI +InstallType16PhysicalMemoryArray ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, @@ -112,6 +130,7 @@ typedef enum { SMBIOS_HANDLE_L2_CACHE, SMBIOS_HANDLE_L3_CACHE, SMBIOS_HANDLE_L4_CACHE, + SMBIOS_HANDLE_PHYSICAL_MEMORY, } SMBIOS_REFRENCE_HANDLES; =20 #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index d3b161b77550..4f14be165c94 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -31,6 +31,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D= { &InstallType3SystemEnclosure, &InstallType4ProcessorInformation, &InstallType7CacheInformation, + &InstallType16PhysicalMemoryArray, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16Physical= MemoryArray.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16Physi= calMemoryArray.c new file mode 100644 index 000000000000..b1b41bf405a2 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMemoryA= rray.c @@ -0,0 +1,106 @@ +/** @file + SMBIOS Type 16 (Physical Memory Array) table for ARM RD platforms. + + This file installs SMBIOS Type 16 (Physical Memory Array) table for Ar= m's + Reference Design platforms. It describes a collection of memory device= s that + operate together to form a memory address. It includes information abo= ut + number of devices, total memory installed, error correction mechanism = used + and other related information. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.17 +**/ + +#include <Library/BaseMemoryLib.h> +#include <Library/DebugLib.h> +#include <Protocol/Smbios.h> + +#include "SmbiosPlatformDxe.h" + +#define TYPE16_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type16 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE16 Base; + CHAR8 Strings[sizeof (TYPE16_STRINGS)]; +} ARM_RD_SMBIOS_TYPE16; +#pragma pack() + +/* Physical Memory Array */ +STATIC ARM_RD_SMBIOS_TYPE16 mArmRdSmbiosType16 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, // Type 16 + sizeof (SMBIOS_TABLE_TYPE16), // Length + SMBIOS_HANDLE_PHYSICAL_MEMORY + }, + MemoryArrayLocationSystemBoard, // Location + MemoryArrayUseSystemMemory, // Used as system memory + MemoryErrorCorrectionUnknown, // Error correction + 0x80000000, // Maximum capacity in KiB, uses Extended Maximum capaci= ty field + 0xFFFE, // Memory error info handle, does not provide this info + 0, // Num of memory devices, update dymamically + 0 // Extended Maximum capacity, update dymamically + }, + // Text strings (unformatted area) + TYPE16_STRINGS +}; + +/** + Install SMBIOS physical memory array table. + + Install the SMBIOS physical memory array (type 16) table for Arm's Ref= erence + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in us= e. +**/ +EFI_STATUS +InstallType16PhysicalMemoryArray ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT16 NumOfMemoryDevices =3D 1; + UINT64 InstalledMemory; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType16)->Han= dle; + + /* Include 16MB of Trusted DRAM as well */ + InstalledMemory =3D PcdGet64 (PcdSystemMemorySize) + SIZE_16MB; + if (PcdGet64 (PcdDramBlock2Size) !=3D 0) { + NumOfMemoryDevices++; + InstalledMemory +=3D PcdGet64 (PcdDramBlock2Size); + } + + mArmRdSmbiosType16.Base.ExtendedMaximumCapacity =3D + InstalledMemory * FixedPcdGet32 (PcdChipCount); + mArmRdSmbiosType16.Base.NumberOfMemoryDevices =3D + NumOfMemoryDevices * FixedPcdGet32 (PcdChipCount); + + /* Install type 16 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType16 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type16 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.1 |
|