[edk2-devel] [edk2-platforms][PATCH 3/4] JadePkg: Refactor SmbiosPlatformDxe
This refactor is derrived from ArmPkg/SMBIOS and customize to adapt with platform. These changes help to separate each Type of SMBIOS table into individual modules. It makes the structure of SmbiosPlatformDxe module clear and easier to add new type of table. Signed-off-by: Minh Nguyen --- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 27 +- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 201 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1083 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c | 72 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnectorData.c | 142 +++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnectorFunction.c | 57 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotData.c | 268 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotFunction.c | 58 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type11/PlatformOemStringData.c | 42 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type11/PlatformOemStringFunction.c | 57 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type24/PlatformHardwareSecurityData.c | 42 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type24/PlatformHardwareSecurityFunction.c | 57 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type38/PlatformIpmiDeviceData.c | 46 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type38/PlatformIpmiDeviceFunction.c | 39 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type41/PlatformOnboardDevicesExtendedData.c | 47 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type41/PlatformOnboardDevicesExtendedFunction.c | 57 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeStrings.uni | 21 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnector.uni | 22 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlot.uni | 20 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type11/PlatformOemString.uni | 11 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type41/PlatformOnboardDevicesExtended.uni | 10 + 21 files changed, 1735 insertions(+), 644 deletions(-) diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf old mode 100644 new mode 100755 index 549aa38b1774..83ff918fc42d --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -15,7 +15,22 @@ [Defines] ENTRY_POINT= SmbiosPlatformDxeEntry [Sources] + SmbiosPlatformDxe.h SmbiosPlatformDxe.c + SmbiosPlatformDxeDataTable.c + SmbiosPlatformDxeStrings.uni + Type08/PlatformPortConnectorData.c + Type08/PlatformPortConnectorFunction.c + Type09/PlatformSystemSlotData.c + Type09/PlatformSystemSlotFunction.c + Type11/PlatformOemStringData.c + Type11/PlatformOemStringFunction.c + Type24/PlatformHardwareSecurityData.c + Type24/PlatformHardwareSecurityFunction.c + Type38/PlatformIpmiDeviceData.c + Type38/PlatformIpmiDeviceFunction.c + Type41/PlatformOnboardDevicesExtendedData.c + Type41/PlatformOnboardDevicesExtendedFunction.c [Packages] ArmPkg/ArmPkg.dec @@ -25,19 +40,23 @@ [Packages] Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec [LibraryClasses] + AmpereCpuLib BaseLib BaseMemoryLib DebugLib + HiiLib MemoryAllocationLib + NVParamLib + #IOExpanderLib UefiBootServicesTableLib UefiDriverEntryPoint UefiLib [Protocols] - gEfiSmbiosProtocolGuid ## CONSUMED + gEfiSmbiosProtocolGuid## CONSUMED -[Pcd] - gArmTokenSpaceGuid.PcdFdSize +[Guids] + gCpuConfigFormSetGuid [Depex] - gEfiSmbiosProtocolGuid + TRUE diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h new file mode 100644 index ..df7d44ffecb6 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -0,0 +1,201 @@ +/** @file + Header file for the SmbiosPlatformDxe Driver. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. + Copyright (c) 2021, NUVIA Inc. All rights reserved. + Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved. + Copyright (c)
[edk2-devel] [edk2-platforms][PATCH 1/4] JadePkg: Correct PCD names for SMBIOS Type 0
This corrects "PcdSmbiosTables1MajorVersion" and "PcdSmbiosTables1MinorVersion" of SMBIOS Type 1, these PCDs should be for Type 0. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec| 14 -- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 6 +++--- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 6 +++--- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 625a9b2b1e89..eeaf8cf87435 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -1,6 +1,6 @@ ## @file # -# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -64,19 +64,13 @@ [PcdsFixedAtBuild] gAmpereTokenSpaceGuid.PcdPmproDbBaseReg|0x1154|UINT64|0x0004 # - # SMBIOS Type 1 Pcd + # SMBIOS Type 0 Pcd # - gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion|0|UINT8|0x0005 - gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion|0|UINT8|0x0006 + gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion|0|UINT8|0x0005 + gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion|0|UINT8|0x0006 [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx] # # Firmware Volume Pcds # gAmpereTokenSpaceGuid.PcdFvBlockSize|0|UINT32|0xB001 - - # - # SMBIOS, default or template values - # - # SMBIOS Type 0 - BIOS Information - gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/"|VOID*|0xB002 # Must follow this MM/DD/ SMBIOS date format diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index a70af6faa212..77148b417b0f 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -1,6 +1,6 @@ ## @file # -# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -40,8 +40,8 @@ [Protocols] [Pcd] # Type 0 gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate - gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion - gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion + gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion + gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString gArmTokenSpaceGuid.PcdFdSize diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index add89f5978d6..32735496ecdc 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. + Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -790,7 +790,7 @@ GetBiosVerMajor ( VOID ) { - return (PcdGet8 (PcdSmbiosTables1MajorVersion)); + return (PcdGet8 (PcdSmbiosTables0MajorVersion)); } STATIC @@ -799,7 +799,7 @@ GetBiosVerMinor ( VOID ) { - return (PcdGet8 (PcdSmbiosTables1MinorVersion)); + return (PcdGet8 (PcdSmbiosTables0MinorVersion)); } STATIC -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105266): https://edk2.groups.io/g/devel/message/105266 Mute This Topic: https://groups.io/mt/99111897/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 4/4] JadePkg: Add support SMBIOS Table Type 16, 17, 19
This adds support SMBIOS Tables Type 16, 17, 19 for information of Physical Memory, Memory Device and Memory Array Mapped Address. Signed-off-by: Minh Nguyen --- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 6 + Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h | 24 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c | 26 +- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type16/PlatformPhysicalMemoryArrayData.c | 48 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type16/PlatformPhysicalMemoryArrayFunction.c | 44 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type17/PlatformMemoryDeviceData.c | 63 +++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type17/PlatformMemoryDeviceFunction.c | 475 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type19/PlatformMemoryArrayMappedAddressData.c | 47 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type19/PlatformMemoryArrayMappedAddressFunction.c | 150 +++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c | 42 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeStrings.uni | 1 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type17/PlatformMemoryDevice.uni | 16 + 12 files changed, 941 insertions(+), 1 deletion(-) diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 83ff918fc42d..13ae38de01f8 100755 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -25,6 +25,12 @@ [Sources] Type09/PlatformSystemSlotFunction.c Type11/PlatformOemStringData.c Type11/PlatformOemStringFunction.c + Type16/PlatformPhysicalMemoryArrayData.c + Type16/PlatformPhysicalMemoryArrayFunction.c + Type17/PlatformMemoryDeviceData.c + Type17/PlatformMemoryDeviceFunction.c + Type19/PlatformMemoryArrayMappedAddressData.c + Type19/PlatformMemoryArrayMappedAddressFunction.c Type24/PlatformHardwareSecurityData.c Type24/PlatformHardwareSecurityFunction.c Type38/PlatformIpmiDeviceData.c diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h index c425ed4431da..9b4f2c1e325c 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h @@ -6,6 +6,8 @@ **/ +#include + #ifndef AMPERE_CPU_LIB_H_ #define AMPERE_CPU_LIB_H_ @@ -182,6 +184,28 @@ GetScpBuild ( UINT8 **ScpBuild ); +/** + Get information of DIMM List. + + @param[out] DimmList Pointer contains information of DIMM List. +**/ +VOID +EFIAPI +GetDimmList ( + PLATFORM_DIMM_LIST **DimmList + ); + +/** + Get information of DRAM. + + @param[out] DramInfo Pointer contains information of DRAM. +**/ +VOID +EFIAPI +GetDramInfo ( + PLATFORM_DRAM_INFO **DramInfo + ); + /** Set the number of configured CPM per socket. diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c index 84a4962d33fc..de5b9b83fb78 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c @@ -23,9 +23,21 @@ SMBIOS_PLATFORM_DXE_TABLE_EXTERNS ( PlatformSystemSlot ) SMBIOS_PLATFORM_DXE_TABLE_EXTERNS ( - SMBIOS_TABLE_TYPE9, + SMBIOS_TABLE_TYPE11, PlatformOemString ) +SMBIOS_PLATFORM_DXE_TABLE_EXTERNS ( + SMBIOS_TABLE_TYPE16, + PlatformPhysicalMemoryArray + ) +SMBIOS_PLATFORM_DXE_TABLE_EXTERNS ( + SMBIOS_TABLE_TYPE17, + PlatformMemoryDevice + ) +SMBIOS_PLATFORM_DXE_TABLE_EXTERNS ( + SMBIOS_TABLE_TYPE19, + PlatformMemoryArrayMappedAddress + ) SMBIOS_PLATFORM_DXE_TABLE_EXTERNS ( SMBIOS_TABLE_TYPE24, PlatformHardwareSecurity @@ -52,6 +64,18 @@ SMBIOS_PLATFORM_DXE_DATA_TABLE mSmbiosPlatformDxeDataTable[] = { SMBIOS_PLATFORM_DXE_TABLE_ENTRY_DATA_AND_FUNCTION ( PlatformOemString ), + //Type16 + SMBIOS_PLATFORM_DXE_TABLE_ENTRY_DATA_AND_FUNCTION ( +PlatformPhysicalMemoryArray + ), + //Type17 + SMBIOS_PLATFORM_DXE_TABLE_ENTRY_DATA_AND_FUNCTION ( +PlatformMemoryDevice + ), + //Type19 + SMBIOS_PLATFORM_DXE_TABLE_ENTRY_DATA_AND_FUNCTION ( +PlatformMemoryArrayMappedAddress + ), // Type24 SMBIOS_PLATFORM_DXE_TABLE_ENTRY_DATA_AND_FUNCTION ( PlatformHardwareSecurity diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type16/PlatformPhysicalMemoryArrayData.c
[edk2-devel] [edk2-platforms][PATCH 0/4] Add support new SMBIOS Tables and refactor to adapt with ArmPkg/SMBIOS
These patches helps to add new SMBIOS Tables (Type 16, 17, 19) and refactor SmbiosPlatformDxe. Minh Nguyen (4): JadePkg: Correct PCD names for SMBIOS Type 0 JadePkg: Leverage ArmPkg/Smbios (Type 0, 1, 2, 3, 13, 32) JadePkg: Refactor SmbiosPlatformDxe JadePkg: Add support SMBIOS Table Type 16, 17, 19 Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | 14 +- Platform/Ampere/JadePkg/Jade.dsc |7 +- Platform/Ampere/JadePkg/Jade.fdf |1 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 43 +- Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf | 15 +- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 201 +++ Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h | 46 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1553 ++-- Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c | 96 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnectorData.c | 142 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnectorFunction.c | 57 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotData.c | 268 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotFunction.c | 58 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type11/PlatformOemStringData.c | 42 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type11/PlatformOemStringFunction.c | 57 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type16/PlatformPhysicalMemoryArrayData.c | 48 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type16/PlatformPhysicalMemoryArrayFunction.c | 44 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type17/PlatformMemoryDeviceData.c | 63 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type17/PlatformMemoryDeviceFunction.c | 475 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type19/PlatformMemoryArrayMappedAddressData.c | 47 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type19/PlatformMemoryArrayMappedAddressFunction.c | 150 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type24/PlatformHardwareSecurityData.c | 42 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type24/PlatformHardwareSecurityFunction.c | 57 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type38/PlatformIpmiDeviceData.c | 46 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type38/PlatformIpmiDeviceFunction.c | 39 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type41/PlatformOnboardDevicesExtendedData.c | 47 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type41/PlatformOnboardDevicesExtendedFunction.c | 57 + Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c | 246 +++- Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c | 84 ++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeStrings.uni | 22 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnector.uni | 22 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlot.uni | 20 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type11/PlatformOemString.uni | 11 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type17/PlatformMemoryDevice.uni | 16 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type41/PlatformOnboardDevicesExtended.uni | 10 + 35 files changed, 3005 insertions(+), 1141 deletions(-) mode change 100644 => 100755 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxeDataTable.c create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnectorData.c create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type08/PlatformPortConnectorFunction.c create mode 100644 Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotData.c create mode 100644
[edk2-devel] [edk2-platforms][PATCH 2/4] JadePkg: Leverage ArmPkg/Smbios (Type 0, 1, 2, 3, 13, 32)
This implementation helps SMBIOS Table (Type 0, 1, 2, 3, 13, 32) of Altra and AltraMax platform to utilize framework from ArmPkg. Signed-off-by: Minh Nguyen --- Platform/Ampere/JadePkg/Jade.dsc| 7 +- Platform/Ampere/JadePkg/Jade.fdf| 1 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 10 - Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf | 15 +- Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h| 22 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 470 Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c | 246 +- Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c | 42 ++ 8 files changed, 326 insertions(+), 487 deletions(-) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc index f14d286cdfb8..2f530740140d 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -117,8 +117,8 @@ [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdProcessorManufacturer|L"Ampere(R)" gArmTokenSpaceGuid.PcdProcessorVersion|L"Ampere(R) Altra(R) Processor" - gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion|$(MAJOR_VER) - gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion|$(MINOR_VER) + gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion|$(MAJOR_VER) + gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion|$(MINOR_VER) # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry point, # if the entry point version is >= 3.0. AARCH64 OSes cannot assume the @@ -137,8 +137,6 @@ [PcdsFixedAtBuild.common] !endif [PcdsDynamicDefault.common.DEFAULT] - # SMBIOS Type 0 - BIOS Information - gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/" [PcdsPatchableInModule] # @@ -181,6 +179,7 @@ [Components.common] MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf # diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jade.fdf index a578d05330ec..7795f0e5 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -347,6 +347,7 @@ [FV.FvMain] INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + INF ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf INF Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf # diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 77148b417b0f..549aa38b1774 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -28,7 +28,6 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib - HobLib MemoryAllocationLib UefiBootServicesTableLib UefiDriverEntryPoint @@ -38,16 +37,7 @@ [Protocols] gEfiSmbiosProtocolGuid ## CONSUMED [Pcd] - # Type 0 - gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate - gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion - gAmpereTokenSpaceGuid.PcdSmbiosTables0MinorVersion - gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString - gArmTokenSpaceGuid.PcdFdSize -[Guids] - gPlatformInfoHobGuid - [Depex] gEfiSmbiosProtocolGuid diff --git a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf index b67ce01fb27f..9d1a0b7e9e06 100644 --- a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf +++ b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf @@ -1,7 +1,7 @@ #/** @file #OemMiscLib.inf # -#Copyright (c) 2021, Ampere Computing LLC. All rights reserved. +#Copyright (c) 2021 - 2023, Ampere Computing LLC. All rights reserved. #Copyright (c) 2021, NUVIA Inc. All rights reserved. #Copyright (c) 2018, Hisilicon Limited. All rights reserved. #Copyright (c) 2018, Linaro Limited. All rights reserved. @@ -27,6 +27,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec [LibraryClasses] AmpereCpuLib @@ -34,3 +35,15 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gAmpereTokenSpaceGuid.PcdSmbiosTables0MajorVersion +
[edk2-devel] [PATCH 2/2] ArmPkg/SmbiosMiscDxe: Remove redundant assign for SmbiosHandle
This helps to remove redundant assign for SmbiosHandle. Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Signed-off-by: Minh Nguyen --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c index 7250da02b3ac..313129460d9c 100644 --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c @@ -213,8 +213,6 @@ SmbiosMiscGetLinkTypeHandle ( return; } - SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; - for (Index = 0; Index < (*HandleCount); Index++) { Status = mSmbiosMiscSmbios->GetNext ( mSmbiosMiscSmbios, -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104981): https://edk2.groups.io/g/devel/message/104981 Mute This Topic: https://groups.io/mt/98948708/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/2] ArmPkg/SmbiosMiscDxe: Fix procedure to get handle of SMBIOS records
To iterate entire SMBIOS table records for searching specific records, "SmbiosHandle" input need to be as "SMBIOS_HANDLE_PI_RESERVED". This patch helps to fix that. Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Signed-off-by: Minh Nguyen --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c index 3a5626b50c0d..7250da02b3ac 100644 --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c @@ -8,6 +8,7 @@ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved. Copyright (c) 2015, Hisilicon Limited. All rights reserved. Copyright (c) 2015, Linaro Limited. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -159,6 +160,7 @@ GetHandleCount ( EFI_SMBIOS_TABLE_HEADER *Record; HandleCount = 0; + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; // Iterate through entries to get the number do { -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104980): https://edk2.groups.io/g/devel/message/104980 Mute This Topic: https://groups.io/mt/98948707/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 0/2] Fix an issue in SmbiosMiscDxe module
These patches help to fix an issue in SmbiosMiscDxe and remove redundant asign for SmbiosHandle. Minh Nguyen (2): ArmPkg/SmbiosMiscDxe: Fix procedure to get handle of SMBIOS records ArmPkg/SmbiosMiscDxe: Remove redundant assign for SmbiosHandle ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104979): https://edk2.groups.io/g/devel/message/104979 Mute This Topic: https://groups.io/mt/98948706/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/1] CryptoPkg: Add new API to get PKCS7 Signature
From: Tam Chi Nguyen This patch adds a new Pkcs7GetSignature API to support extracting the signature data from PKCS7 Certificate. Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang Signed-off-by: Minh Nguyen --- CryptoPkg/Include/Library/BaseCryptLib.h | 29 + CryptoPkg/Private/Protocol/Crypto.h| 30 + CryptoPkg/Driver/Crypto.c | 33 ++ CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c | 120 CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c | 33 ++ CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c | 32 ++ 6 files changed, 277 insertions(+) diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h index a52bd91ad664..e277ea188de8 100644 --- a/CryptoPkg/Include/Library/BaseCryptLib.h +++ b/CryptoPkg/Include/Library/BaseCryptLib.h @@ -5,6 +5,7 @@ functionality enabling. Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved. +Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -2471,6 +2472,34 @@ ImageTimestampVerify ( OUT EFI_TIME *SigningTime ); +/** + Get the data signature from PKCS#7 signed data as described in "PKCS #7: + Cryptographic Message Syntax Standard". The input signed data could be wrapped + in a ContentInfo structure. + + If P7Data, Signature, SignatureLength is NULL, then return FALSE. + If P7Length overflow, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] P7Data Pointer to the PKCS#7 message to verify. + @param[in] P7Length Length of the PKCS#7 message in bytes. + @param[out] SignaturePointer to Signature data + @param[out] SignatureLength Length of signature in bytes. + + @retval TRUEThe operation is finished successfully. + @retval FALSE Error occurs during the operation. + @retval FALSE This interface is not supported. + +**/ +BOOLEAN +EFIAPI +Pkcs7GetSignature ( + IN CONST UINT8 *P7Data, + IN UINTNP7Length, + OUT UINT8**Signature, + OUT UINTN*SignatureLength + ); + /** Retrieve the version from one X.509 certificate. diff --git a/CryptoPkg/Private/Protocol/Crypto.h b/CryptoPkg/Private/Protocol/Crypto.h index 0e0b1d94018d..25cd03fb08a3 100644 --- a/CryptoPkg/Private/Protocol/Crypto.h +++ b/CryptoPkg/Private/Protocol/Crypto.h @@ -3,6 +3,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -1036,6 +1037,34 @@ BOOLEAN OUT EFI_TIME *SigningTime ); +/** + Get the data signature from PKCS#7 signed data as described in "PKCS #7: + Cryptographic Message Syntax Standard". The input signed data could be wrapped + in a ContentInfo structure. + + If P7Data, Signature, SignatureLength is NULL, then return FALSE. + If P7Length overflow, then return FALSE. + If this interface is not supported, then return FALSE. + + @param[in] P7Data Pointer to the PKCS#7 message to verify. + @param[in] P7Length Length of the PKCS#7 message in bytes. + @param[out] SignaturePointer to Signature data + @param[out] SignatureLength Length of signature in bytes. + + @retval TRUEThe operation is finished successfully. + @retval FALSE Error occurs during the operation. + @retval FALSE This interface is not supported. + +**/ +typedef +BOOLEAN +(EFIAPI *EDKII_CRYPTO_PKCS7_GET_SIGNATURE) ( + IN CONST UINT8 *P7Data, + IN UINTNP7Length, + OUT UINT8**Signature, + OUT UINTN*SignatureLength + ); + // = //DH Key Exchange Primitive // = @@ -5371,6 +5400,7 @@ struct _EDKII_CRYPTO_PROTOCOL { EDKII_CRYPTO_PKCS7_SIGN Pkcs7Sign; EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT Pkcs7GetAttachedContent; EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LISTPkcs7GetCertificatesList; + EDKII_CRYPTO_PKCS7_GET_SIGNATUREPkcs7GetSignature; EDKII_CRYPTO_AUTHENTICODE_VERIFYAuthenticodeVerify; EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY ImageTimestampVerify; /// DH diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c index bdbb4863a97e..9b55b70f1c48 100644 --- a/CryptoPkg/Driver/Crypto.c +++ b/CryptoPkg/Driver/Crypto.c @@ -4,6 +4,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved. + Copyright (c) 2023, Ampere Computing
[edk2-devel] [edk2-platforms][PATCH 1/6] AmpereAltraPkg: Add PCIe Hot Plug library
From: Vu Nguyen This adds PCIe Hot Plug library to support Hot Plug feature and specific procedures for setting different Portmap tables (GPIO pins used for PCIe reset). Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec| 8 +- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec| 13 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc| 1 + Platform/Ampere/JadePkg/Jade.dsc| 66 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf | 37 ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h | 162 Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h | 81 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c | 397 8 files changed, 764 insertions(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec index d795c9229691..d4881eaed692 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -1,6 +1,6 @@ ## @file # -# Copyright (c) 2020-2021, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2020-2023, Ampere Computing LLC. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -49,6 +49,9 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to initialize Pcie Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h + ## @libraryclass Defines a set of methods to start Hot plug feature + PcieHotPlugLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h + [Guids] ## NVParam MM GUID gNVParamMmGuid = { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } @@ -70,3 +73,6 @@ [Guids] ## Include/Guid/AcpiConfigHii.h gAcpiConfigFormSetGuid = { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } } + + ## PCIe Hot Plug GUID + gPcieHotPlugGuid = { 0x5598273c, 0x11ea, 0xa496, { 0x42, 0x02, 0x37, 0xbb, 0x02, 0x00, 0x13, 0xac } } diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 625a9b2b1e89..9259956c7caa 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -80,3 +80,16 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx] # # SMBIOS Type 0 - BIOS Information gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/"|VOID*|0xB002 # Must follow this MM/DD/ SMBIOS date format + + # Pcie HotPlug reset map + gAmpereTokenSpaceGuid.PcdPcieHotPlugGpioResetMap|0x0|UINT8|0xB00A + + # + # Pcie HotPlug Port Map table + # + gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable|{0x00}|PCIE_HOT_PLUG_PORT_MAP_TABLE|0xB00B { + + Library/PcieHotPlugPortMapLib.h + + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + } diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 9275e0053af6..8cb2a3fe6422 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -81,6 +81,7 @@ [LibraryClasses.common] NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf + PcieHotPlugLib|Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf PciePhyLib|Silicon/Ampere/AmpereAltraBinPkg/Library/PciePhyLib/PciePhyLib.inf Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc index f14d286cdfb8..a6b5fa3ca2d3 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -100,7 +100,73 @@ [PcdsFeatureFlag.common] # gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + # + # Flag to indicate option of using default or specific platform Port Map table + # + gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.UseDefaultConfig|TRUE + [PcdsFixedAtBuild] + gAmpereTokenSpaceGuid.PcdPcieHotPlugGpioResetMap|0x3F + + # + # Setting Portmap table + # + # * Elements of array: + # - 0: Index of Portmap entry in Portmap table structure (Vport). + # - 1: Socket number (Socket). + # - 2: Root complex port for each Portmap entry (RcaPort). + # - 3: Root complex sub-port for each Portmap entry (RcaSubPort). + # - 4: Select
[edk2-devel] [edk2-platforms][PATCH 3/3] AmpereAltraPkg: Add retry logic when PCIe card is present
From: Tinh Nguyen Add PCIe link retry logic. If the card is detected to be present, allow a retry for 3 times. When the link is down, check if the LTSSMEN bit is cleared. Based on Altra PCIe IP, the LTSSMEN bit is cleared from 1 to 0 if there is a surprising link down. This indicates that a card is present. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c index d797442d9fbc..9cc059788581 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -1769,7 +1769,11 @@ Ac01PcieCoreUpdateLink ( } else { FailedPciePtr[*FailedPcieCount] = PcieIndex; *FailedPcieCount += 1; -*IsNextRoundNeeded = !(*IsNextRoundNeeded) ? Ac01PcieCoreCheckCardPresent (Pcie) : TRUE; + +if (Ac01PcieCoreCheckCardPresent (Pcie)) { + *IsNextRoundNeeded = TRUE; + DEBUG ((DEBUG_INFO, "PCIE%d.%d Link retry\n", RootComplex->ID, PcieIndex)); +} } } } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104713): https://edk2.groups.io/g/devel/message/104713 Mute This Topic: https://groups.io/mt/98831765/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max
These patches support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max. Minh Nguyen (2): AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port initialization AmpereAltraPkg: Change PCIe Amba Link Timeout value Vu Nguyen (4): AmpereAltraPkg: Add PCIe Hot Plug library JadePkg: Support ACPI tables for Hot Plug of Ampere Altra JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max AmpereAltraPkg: Enable NVMe Hot Plug feature Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec|8 +- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec| 13 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc|1 + Platform/Ampere/JadePkg/Jade.dsc| 66 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf |3 +- Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf | 37 + Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h | 162 +++ Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h | 81 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c |3 + Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c| 13 +- Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c | 397 Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi| 24 + Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl | 511 ++ Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi | 92 ++ Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi | 545 ++ Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi | 1072 +++ Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl | 499 - Platform/Ampere/JadePkg/AcpiTables/MHPP.asi | 127 +++ Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi | 548 +- Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi | 1074 +++- 20 files changed, 5269 insertions(+), 7 deletions(-) create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi create mode 100644 Platform/Ampere/JadePkg/AcpiTables/MHPP.asi -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104714): https://edk2.groups.io/g/devel/message/104714 Mute This Topic: https://groups.io/mt/98831766/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 6/6] AmpereAltraPkg: Enable NVMe Hot Plug feature
From: Vu Nguyen This enables NVMe Hot Plug feature after finishing PCIe set up. This helps to detect NVMe disk when it's removed or inserted into its slot. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf | 3 ++- Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf index 32d60bec1440..f9d5c927fca3 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf @@ -1,6 +1,6 @@ ## @file # -# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -30,6 +30,7 @@ [LibraryClasses] BoardPcieLib DebugLib HobLib + PcieHotPlugLib PeimEntryPoint PeiServicesLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c index 598a2e64d02f..bf4395d48d40 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -207,6 +208,8 @@ PcieInitEntry ( Ac01PcieCorePostSetupRC (mRootComplexList); + PcieHotPlugStart (); + // // Build Root Complex info Hob // -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104720): https://edk2.groups.io/g/devel/message/104720 Mute This Topic: https://groups.io/mt/98831774/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 5/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max
From: Vu Nguyen This adds necessary changes of ACPI tables and defines the memory region between OS and Trusted Firmware-A for supporting Hot Plug of Ampere Altra Max. Signed-off-by: Minh Nguyen --- Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi | 24 + Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl | 511 ++ Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi | 92 ++ Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi| 545 ++ Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi| 1072 5 files changed, 2244 insertions(+) diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi b/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi index 17ecd52a553f..73804cab81b5 100644 --- a/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi +++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi @@ -174,7 +174,16 @@ Device(GED0) { } Name(_CRS, ResourceTemplate () { Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 84 } // GHES +Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 44 } // PCIe Hot Plug Doorbell Insertion & Ejection (DBNS4 -> GIC-IRQS44) }) + +// @DBN4 agent base address for HP PCIe insertion/ejection event: 0x1000.0054.4000 +OperationRegion(DBN4, SystemMemory, 0x10544010, 20) +Field (DBN4, DWordAcc, NoLock, Preserve) { +DOUT, 32, // event and PCIe port information at offset 0x10 +offset (0x10), +STA4, 32, // interrupt status at offset 0x20 +} } // Shutdown button using GED. @@ -511,3 +520,18 @@ Device(NVDR) { } } } + +// +// LED Device +Device(LED) { + Name(_HID, "AMPC0008") + Name(_CCA, ONE) + Name(_STR, Unicode("Altra LED Device")) + + Name (_DSD, Package () { +ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), +Package () { + Package () { "uuid", Package (4) { 0x5598273c, 0xa49611ea, 0xbb370242, 0xac130002 }}, +} + }) +} diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl b/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl index ce12272f961d..f2977d4e58a8 100644 --- a/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl +++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl @@ -12,8 +12,519 @@ DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) { Name(\BDMD, "Altra Max Jade Board") Name(AERF, 0) // PCIe AER Firmware-First + Include ("MHPP.asi") + Scope(\_SB) { + Include ("CommonDevices.asi") + +Scope(\_SB.GED0) { +Method(_EVT, 1, Serialized) { + Switch (ToInteger(Arg0)) { +Case (84) { // GHES interrupt + Notify (HED0, 0x80) +} + +Case (44) { // doorbell notification (Insertion/ejection) + local0 = DOUT & 0x00FF + if (local0 == 0x0001) { +local0 = STA4 & 0x +if (local0) { + Store(local0, STA4) // clear interrupt +} +local0 = A050 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P1, 1) // insertion action +} +local0 = A051 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P2, 1) // insertion action +} +local0 = A052 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P3, 1) // insertion action +} +local0 = A053 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P4, 1) // insertion action +} +local0 = A040 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P1, 1) // insertion action +} +local0 = A041 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P2, 1) // insertion action +} +local0 = A042 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P3, 1) // insertion action +} +local0 = A043 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P4, 1) // insertion action +} +local0 = A160 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCIE.P2P1, 1) // insertion action +} +local0 = A161 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify
[edk2-devel] [edk2-platforms][PATCH 2/3] AmpereAltraPkg: Fix PCIe link training sequence
Currently, the implementation starts link training and put device out-of-reset right away. This make LinkStat and BlockEventStat registers indicate that link is not up yet (LinkStat: 0x300 and BlockEventStat: 0x0). This fix will start link training after putting device out-of-reset. The values of LinkStat and BlockEventStat registers after this fix are respectively 0x1103 and 0x1 (Link is up). Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c index f7c8defc1906..d797442d9fbc 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -1177,12 +1177,12 @@ Ac01PcieCoreSetupRC ( // Assert PERST low to reset endpoint BoardPcieAssertPerst (RootComplex, PcieIndex, FALSE); +// Complete the PERST pulse +BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE); + // Start link training StartLinkTraining (RootComplex, PcieIndex, TRUE); -// Complete the PERST pulse -BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE); - // Lock programming of config space EnableDbiAccess (RootComplex, PcieIndex, FALSE); -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104712): https://edk2.groups.io/g/devel/message/104712 Mute This Topic: https://groups.io/mt/98831764/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 4/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra
From: Vu Nguyen This adds necessary changes of ACPI tables and defines the memory region between OS and Trusted Firmware-A for supporting Hot Plug of Ampere Altra. Signed-off-by: Minh Nguyen --- Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl | 499 - Platform/Ampere/JadePkg/AcpiTables/MHPP.asi | 127 +++ Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi | 548 +- Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi | 1074 +++- 4 files changed, 2245 insertions(+), 3 deletions(-) diff --git a/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl b/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl index d7d2df8c3dce..9ee215a26a09 100644 --- a/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl +++ b/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. + Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -11,6 +11,9 @@ DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) { // Board Model Name(\BDMD, "Jade Board") Name(AERF, 0) // PCIe AER Firmware-First + + Include ("MHPP.asi") + Scope(\_SB) { // @@ -181,12 +184,506 @@ DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) { } Name(_CRS, ResourceTemplate () { Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 84 } // GHES + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 44 } // PCIe Hot Plug Doorbell Insertion & Ejection (DBNS4 -> GIC-IRQS44) }) + +// @DBN4 agent base address for HP PCIe insertion/ejection event: 0x1000.0054.4000 +OperationRegion(DBN4, SystemMemory, 0x10544010, 20) +Field (DBN4, DWordAcc, NoLock, Preserve) { + DOUT, 32, // event and PCIe port information at offset 0x10 + offset (0x10), + STA4, 32, // interrupt status at offset 0x20 +} + Method(_EVT, 1, Serialized) { Switch (ToInteger(Arg0)) { Case (84) { // GHES interrupt Notify (HED0, 0x80) } + +Case (44) { // doorbell notification (Insertion/ejection) + local0 = DOUT & 0x00FF + if (local0 == 0x0001) { +local0 = STA4 & 0x +if (local0) { + Store(local0, STA4) // clear interrupt +} +local0 = A120 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCIA.P2P1, 1) // insertion action +} +local0 = A121 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCIA.P2P2, 1) // insertion action +} +local0 = A122 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCIA.P2P3, 1) // insertion action +} +local0 = A123 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCIA.P2P4, 1) // insertion action +} +local0 = B000 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P1, 1) // insertion action +} +local0 = B002 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P3, 1) // insertion action +} +local0 = B004 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P5, 1) // insertion action +} +local0 = B006 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI4.P2P7, 1) // insertion action +} +local0 = B010 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P1, 1) // insertion action +} +local0 = B012 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P3, 1) // insertion action +} +local0 = B014 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P5, 1) // insertion action +} +local0 = B016 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00)) { + Notify (\_SB.PCI5.P2P7, 1) // insertion action +} +local0 = B104 & 0xFF00 +if ((local0 == 0x0100) || (local0 == 0x0F00))
[edk2-devel] [edk2-platforms][PATCH 3/6] AmpereAltraPkg: Change PCIe Amba Link Timeout value
As AMBA_LINK_TIMEOUT_OFF spec, it impacts OS Hot Plug removal delay. The greater value the longer delay it is. Per experiments, set it 2 from beginning of Root Port initialization for stable operation. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c index c5a299cca6c5..d71f56d5fcf1 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -1159,8 +1159,12 @@ Ac01PcieCoreSetupRC ( } } -// Link timeout after 1ms -SetLinkTimeout (RootComplex, PcieIndex, 1); +// +// As AMBA_LINK_TIMEOUT_OFF spec, it impacts OS HP removal delay. +// The greater value the longer delay it is. Per discussion, +// set it 2 from beginning of RP initialization. +// +SetLinkTimeout (RootComplex, PcieIndex, 2); DisableCompletionTimeOut (RootComplex, PcieIndex, TRUE); -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104717): https://edk2.groups.io/g/devel/message/104717 Mute This Topic: https://groups.io/mt/98831769/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 2/6] AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port initialization
In order to detect the NVMe after OS boots successfully but that NVMe's not present previously. Hot Plug Slot Capable will help PCI Linux driver to initialize its slot iomem resource which is used for detecting the disk when it's inserted. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 5 + 1 file changed, 5 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c index f7c8defc1906..c5a299cca6c5 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -1093,6 +1093,11 @@ Ac01PcieCoreSetupRC ( // Program the power limit TargetAddress = CfgBase + PCIE_CAPABILITY_BASE + SLOT_CAPABILITIES_REG; Val = MmioRead32 (TargetAddress); +// In order to detect the NVMe after OS boots successfully but +// that NVMe's not present previously. Hot Plug Slot Capable +// will help PCI Linux driver to initialize its slot iomem resource +// which is used for detecting the disk when it's inserted. +Val = SLOT_HPC_SET(Val, 1); Val = SLOT_CAP_SLOT_POWER_LIMIT_VALUE_SET (Val, SLOT_POWER_LIMIT_75W); MmioWrite32 (TargetAddress, Val); -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104716): https://edk2.groups.io/g/devel/message/104716 Mute This Topic: https://groups.io/mt/98831768/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 1/3] AmpereAltraPkg: Remove PCIe "DevMapModeAuto" case in retrieving Devmap mode
Because PCIe Auto bifurcation feature doesn't depend on the default Devmap mode so that "DevMapModeAuto" is unnecessary in retrieving the PCIe Devmap default mode. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c index a8e23015b605..199929bfdb24 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c @@ -160,7 +160,7 @@ GetDefaultDevMap ( UINT8StartIndex; DEV_MAP_MODE DevMapMode; - DevMapMode = MaxDevMapMode; + DevMapMode = DevMapMode4; StartIndex = IsGetDevMapLow ? PcieController0 : PcieController4; while (DevMapMode >= DevMapMode1) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104711): https://edk2.groups.io/g/devel/message/104711 Mute This Topic: https://groups.io/mt/98831763/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [edk2-platforms][PATCH 0/3] Add necessary changes for PCIe core and remove unnecessary checks for PCIe Devmap mode
These patches help to improve PCIe core for Link training sequence and add logic to check PCIe card is present or not. One patch also removes unnecessary checks for PCIe Devmap mode. Minh Nguyen (2): AmpereAltraPkg: Remove PCIe "DevMapModeAuto" case in retrieving Devmap mode AmpereAltraPkg: Fix PCIe link training sequence Tinh Nguyen (1): AmpereAltraPkg: Add retry logic when PCIe card is present Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c | 2 +- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 12 2 files changed, 9 insertions(+), 5 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104710): https://edk2.groups.io/g/devel/message/104710 Mute This Topic: https://groups.io/mt/98831762/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V3 3/5] RedfishPkg: Create RestEx child on selected interface
From: Vu Nguyen When a MAC address matching interface is found, a RestEx child will be created to provide the Redfish communication on that interface. Currently, It will try to locate all RestEx binding services and choose the first satisfied instance without taking care about current selected interface. This might raise an issue on the system with multiple network devices that the RestEx child was installed on wrong interface. Siigned-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 1 + 3 files changed, 63 insertions(+), 94 deletions(-) diff --git a/RedfishPkg/Include/Library/RestExLib.h b/RedfishPkg/Include/Library/RestExLib.h index bc4e4ca6caa7..2c32c3684cf4 100644 --- a/RedfishPkg/Include/Library/RestExLib.h +++ b/RedfishPkg/Include/Library/RestExLib.h @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -20,6 +21,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -32,6 +34,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c index d9acad24dec1..0b3ae2755e86 100644 --- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -9,6 +10,7 @@ #include #include +#include #include #include #include @@ -21,6 +23,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -33,6 +36,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, @@ -41,8 +45,6 @@ RestExLibCreateChild ( ) { EFI_STATUSStatus; - UINTN NoBuffer; - EFI_HANDLE*Handle; EFI_HANDLEChildHandle; EFI_REST_EX_PROTOCOL *RestEx; EFI_REST_EX_SERVICE_INFO *RestExServiceInfo; @@ -59,116 +61,79 @@ RestExLibCreateChild ( } *ChildInstanceHandle = NULL; - // - // Locate all REST EX binding service. - // - Handle = NULL; - NoBuffer = 0; - Status = gBS->LocateHandleBuffer ( -ByProtocol, -, -NULL, -, - -); - if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) { + + ChildHandle = NULL; + Status = NetLibCreateServiceChild ( + Controller, + Image, + , + + ); + if (EFI_ERROR (Status)) { +DEBUG (( + DEBUG_ERROR, + "%a: Failed to create service child - %r \n", + __func__, + Status + )); return Status; } - - Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * NoBuffer); - if (Handle == NULL) { -return EFI_OUT_OF_RESOURCES; - } - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - , + Status = gBS->OpenProtocol ( + ChildHandle, + , + (VOID **), + Image, NULL, - , - + EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { -FreePool (Handle); -return Status; +goto ON_ERROR; } // - // Search for the proper REST EX instance. + // Get the information of
[edk2-devel] [PATCH V3 4/5] RedfishPkg: Add missing newline character
From: Nhi Pham This adds a missing newline character to make the error log readable in case the module is failed. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Nickle Wang --- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c index 45fc6e2182bc..c4fa59193a2f 100644 --- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c +++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c @@ -8,6 +8,7 @@ (C) Copyright 2020 Hewlett Packard Enterprise Development LP Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -59,7 +60,7 @@ RedfishCreateSmbiosTable42 ( Status = RedfishPlatformHostInterfaceDeviceDescriptor (, ); if (EFI_ERROR (Status)) { if (Status == EFI_NOT_FOUND) { - DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.", __func__)); + DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.\n", __func__)); return EFI_NOT_FOUND; } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104143): https://edk2.groups.io/g/devel/message/104143 Mute This Topic: https://groups.io/mt/98710277/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V3 1/5] RedfishPkg: Correct variable type to prevent memory corruption
From: Vu Nguyen Id will be casted by CoreOpenProtocol, declare this variable with a wrong type might result in the corruption of other local variables. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Nickle Wang --- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h index 4a9e9f7b81a4..6b94e5814c43 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h @@ -3,6 +3,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -84,7 +85,7 @@ struct _RESTEX_SERVICE { // EFI_HANDLE HttpChildHandle; - UINT32 Id; + UINT32 *Id; EFI_REST_EX_SERVICE_INFORestExServiceInfo; }; -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104140): https://edk2.groups.io/g/devel/message/104140 Mute This Topic: https://groups.io/mt/98710274/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V3 5/5] RedfishPkg: Fix compile issue on Linux
From: Vu Nguyen It requires a fixed size array to store the content of device path PCD. Add the array size to solve this issue. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Abner Chang --- RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h index 91b1198297c2..57fc199f61f2 100644 --- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h +++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h @@ -4,6 +4,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -14,6 +15,8 @@ #include +#define MAX_DEVICE_PATH_NODE 40 + typedef enum { DEVICE_PATH_MATCH_MAC_NODE = 1, DEVICE_PATH_MATCH_PCI_NODE = 2, @@ -32,7 +35,7 @@ typedef struct { // 0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, //0x7f,0xff,0x04,0x00} // - EFI_DEVICE_PATH_PROTOCOLDevicePath[]; + EFI_DEVICE_PATH_PROTOCOL DevicePath[MAX_DEVICE_PATH_NODE]; } REST_EX_SERVICE_DEVICE_PATH_DATA; #endif -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104144): https://edk2.groups.io/g/devel/message/104144 Mute This Topic: https://groups.io/mt/98710278/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V3 2/5] RedfishPkg: Fix condition checking of error status
From: Vu Nguyen This change fixes condition checking of error status, the condition should be compared with TRUE status to be identical with an error message. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Nickle Wang --- RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 583c6f78e19c..a247bfed9e34 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -5,6 +5,7 @@ (C) Copyright 2021 Hewlett Packard Enterprise Development LP Copyright (c) 2022, AMD Incorporated. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -926,7 +927,7 @@ AddAndSignalNewRedfishService ( } Status = gBS->SignalEvent (Instance->DiscoverToken->Event); -if (!EFI_ERROR (Status)) { +if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__)); } } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104141): https://edk2.groups.io/g/devel/message/104141 Mute This Topic: https://groups.io/mt/98710275/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V3 0/5] Adding necessary changes for RedfishPkg
This patchset adds necessary changes for RedfishPkg to avoid some unexpected cases and fix compilation. Changes since v3: + Replaced __FUNCTION__ with __func__ to be more C11 compliant. Changes since v2: + Added "Cc:" to maintainers in commit message. + Corrected patch format subject prefix. Changes since v1: + Removed redundant change and change the commit message for more precise in PATCH 2/5. Nhi Pham (1): RedfishPkg: Add missing newline character Vu Nguyen (4): RedfishPkg: Correct variable type to prevent memory corruption RedfishPkg: Fix condition checking of error status RedfishPkg: Create RestEx child on selected interface RedfishPkg: Fix compile issue on Linux RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 +- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h| 3 +- RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 4 +- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 +- 6 files changed, 73 insertions(+), 98 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104139): https://edk2.groups.io/g/devel/message/104139 Mute This Topic: https://groups.io/mt/98699661/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel][edk2-platforms][PATCH 1/2] AmpereAltraPkg: Add support for PCIe Auto Bifurcation
From: Vu Nguyen Add extra option call Auto to the Bifurcation selection. This mode will automatically select the best bifurcation mode the current Root Complex. Currently, this option only availabe on the RCA with x16 width. Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h | 5 +- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h | 5 + Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c | 2 + Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c | 12 +- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 344 +++- Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.uni | 3 +- 6 files changed, 365 insertions(+), 6 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h index 24599b781646..0b252de37dcc 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2021, Ampere Computing LLC. All rights reserved. + Copyright (c) 2021 - 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -40,7 +40,8 @@ typedef enum { DevMapMode2, DevMapMode3, DevMapMode4, - MaxDevMapMode = DevMapMode4 + DevMapModeAuto, + MaxDevMapMode = DevMapModeAuto } DEV_MAP_MODE; // diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h index a18fff7dbb75..988450a54260 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h @@ -46,6 +46,11 @@ #define PFA_MODE_CLEAR 1 #define PFA_MODE_READ2 +#define BIFURCATION_X000 0 +#define BIFURCATION_X0X0 1 +#define BIFURCATION_X0XX 2 +#define BIFURCATION_ 3 + // // Host Bridge registers // diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c index da730c4bd219..08dff0f1311f 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c @@ -128,6 +128,7 @@ SetRootComplexBifurcation ( RootComplex->Pcie[RPStart + 3].Active = TRUE; break; + case DevMapModeAuto: case DevMapMode4: MaxWidth = (RootComplex->Type == RootComplexTypeA) ? LINK_WIDTH_X4 : LINK_WIDTH_X2; RootComplex->Pcie[RPStart].MaxWidth = PCIE_GET_MAX_WIDTH (RootComplex->Pcie[RPStart], MaxWidth); @@ -526,6 +527,7 @@ GetMaxSpeedGen ( } break; +case DevMapModeAuto: case DevMapMode4: /* x4 x4 x4 x4 */ if (RootComplex->Flags & PCIE_ERRATA_SPEED1) { MaxGen = ErrataSpeedDevMap4; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c index e03be2a2f9dc..52a297ff085d 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. + Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -600,6 +600,16 @@ CreateDevMapOptions ( DevMapMode4 ); + if (RootComplex->Type == RootComplexTypeA) { +HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_AUTO), + 0, + EFI_IFR_NUMERIC_SIZE_1, + DevMapModeAuto + ); + } + return OptionsOpCodeHandle; } diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c index 855b094f7948..f7c8defc1906 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -664,6 +664,267 @@ EnableDbiAccess ( MmioWrite32 (TargetAddress, Val); } +VOID +Ac01PcieUpdateMaxWidth ( + IN AC01_ROOT_COMPLEX *RootComplex + ) +{ + if (RootComplex->Type == RootComplexTypeA) { +switch (RootComplex->DevMapLow) { +case DevMapMode1: + RootComplex->Pcie[PcieController0].MaxWidth = CAP_MAX_LINK_WIDTH_X16; + break; + +case DevMapMode2: + RootComplex->Pcie[PcieController0].MaxWidth = CAP_MAX_LINK_WIDTH_X8; + RootComplex->Pcie[PcieController2].MaxWidth =
[edk2-devel][edk2-platforms][PATCH 0/2] Support for PCIe Auto Bifurcation feature
These patches support for PCIe Auto Bifurcation feature of Ampere silicon (Altra and Altra Max). Vu Nguyen (2): AmpereAltraPkg: Add support for PCIe Auto Bifurcation AmpereAltraPkg: Enable auto bifurcation via BoardSetting Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h | 4 +- Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h | 5 +- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h | 5 + Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c | 14 +- Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c | 19 +- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 344 +++- Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.uni | 3 +- 7 files changed, 383 insertions(+), 11 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104078): https://edk2.groups.io/g/devel/message/104078 Mute This Topic: https://groups.io/mt/98698192/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel][edk2-platforms][PATCH 2/2] AmpereAltraPkg: Enable auto bifurcation via BoardSetting
From: Vu Nguyen Add support for new BoardSetting's config value (0x000A) to enable auto bifurcation mode per Root Complex: Example: NV_SI_RO_BOARD_S0_RCA2_CFG, 0x0098, 0x000A NV_SI_RO_BOARD_S0_RCA3_CFG, 0x00A0, 0x000A Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h | 4 +++- Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c | 12 +++- Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c | 7 --- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h index 008a8db69f2c..8c07f086a58f 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. + Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -13,6 +13,8 @@ #define BYTE_MASK 0xFF #define PCIE_ERRATA_SPEED1 0x0001 // Limited speed errata +#define AUTO_BIFURCATION_SETTING_VALUE 0x0A + #ifndef BIT #define BIT(nr) (1 << (nr)) #endif diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c index 08dff0f1311f..a8e23015b605 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c @@ -205,7 +205,9 @@ GetDevMap ( // // Get default Devmap low and configure Devmap low accordingly. // - RootComplex->DefaultDevMapLow = GetDefaultDevMap (RootComplex, TRUE); + if (RootComplex->DefaultDevMapLow != DevMapModeAuto) { +RootComplex->DefaultDevMapLow = GetDefaultDevMap (RootComplex, TRUE); + } if (RootComplex->DevMapLow == 0) { RootComplex->DevMapLow = RootComplex->DefaultDevMapLow; } @@ -398,6 +400,14 @@ GetLaneAllocation ( } } + // Update RootComplex data to handle auto bifurcation mode on RCA + if (Value == AUTO_BIFURCATION_SETTING_VALUE) { +RootComplex->Pcie[PcieController0].MaxWidth = LINK_WIDTH_X4; +RootComplex->Pcie[PcieController0].MaxGen = LINK_SPEED_GEN3; +RootComplex->Pcie[PcieController0].Active = TRUE; +RootComplex->DefaultDevMapLow = DevMapModeAuto; + } + if (RootComplex->Type == RootComplexTypeB) { NvParamOffset += NV_PARAM_ENTRYSIZE; Status = NVParamGet (NvParamOffset, NV_PERM_ALL, ); diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c index 52a297ff085d..bc4812207f63 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c @@ -733,7 +733,8 @@ PcieRCScreenSetup ( // OptionsOpCodeHandle = CreateDevMapOptions (RootComplex); -if (RootComplex->DefaultDevMapLow != 0) { +if ((RootComplex->DefaultDevMapLow != 0) +&& (RootComplex->DefaultDevMapLow != DevMapModeAuto)) { QuestionFlags |= EFI_IFR_FLAG_READ_ONLY; } @@ -1202,8 +1203,8 @@ RootComplexDriverEntry ( RootComplex = GetRootComplex (RCIndex); if (EFI_ERROR (Status)) { - VarStoreConfig->RCBifurcationLow[RCIndex] = RootComplex->DevMapLow; - VarStoreConfig->RCBifurcationHigh[RCIndex] = RootComplex->DevMapHigh; + VarStoreConfig->RCBifurcationLow[RCIndex] = RootComplex->DefaultDevMapLow; + VarStoreConfig->RCBifurcationHigh[RCIndex] = RootComplex->DefaultDevMapHigh; VarStoreConfig->RCStatus[RCIndex] = RootComplex->Active; IsUpdated = TRUE; } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104079): https://edk2.groups.io/g/devel/message/104079 Mute This Topic: https://groups.io/mt/98698193/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V2 5/5] RedfishPkg: Fix compile issue on Linux
From: Vu Nguyen It requires a fixed size array to store the content of device path PCD. Add the array size to solve this issue. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Abner Chang --- RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h index 91b1198297c2..57fc199f61f2 100644 --- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h +++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h @@ -4,6 +4,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -14,6 +15,8 @@ #include +#define MAX_DEVICE_PATH_NODE 40 + typedef enum { DEVICE_PATH_MATCH_MAC_NODE = 1, DEVICE_PATH_MATCH_PCI_NODE = 2, @@ -32,7 +35,7 @@ typedef struct { // 0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, //0x7f,0xff,0x04,0x00} // - EFI_DEVICE_PATH_PROTOCOLDevicePath[]; + EFI_DEVICE_PATH_PROTOCOL DevicePath[MAX_DEVICE_PATH_NODE]; } REST_EX_SERVICE_DEVICE_PATH_DATA; #endif -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103953): https://edk2.groups.io/g/devel/message/103953 Mute This Topic: https://groups.io/mt/98678067/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V2 3/5] RedfishPkg: Create RestEx child on selected interface
From: Vu Nguyen When a MAC address matching interface is found, a RestEx child will be created to provide the Redfish communication on that interface. Currently, It will try to locate all RestEx binding services and choose the first satisfied instance without taking care about current selected interface. This might raise an issue on the system with multiple network devices that the RestEx child was installed on wrong interface. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 1 + 3 files changed, 63 insertions(+), 94 deletions(-) diff --git a/RedfishPkg/Include/Library/RestExLib.h b/RedfishPkg/Include/Library/RestExLib.h index bc4e4ca6caa7..2c32c3684cf4 100644 --- a/RedfishPkg/Include/Library/RestExLib.h +++ b/RedfishPkg/Include/Library/RestExLib.h @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -20,6 +21,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -32,6 +34,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c index d9acad24dec1..6002be93c54e 100644 --- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -9,6 +10,7 @@ #include #include +#include #include #include #include @@ -21,6 +23,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -33,6 +36,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, @@ -41,8 +45,6 @@ RestExLibCreateChild ( ) { EFI_STATUSStatus; - UINTN NoBuffer; - EFI_HANDLE*Handle; EFI_HANDLEChildHandle; EFI_REST_EX_PROTOCOL *RestEx; EFI_REST_EX_SERVICE_INFO *RestExServiceInfo; @@ -59,116 +61,79 @@ RestExLibCreateChild ( } *ChildInstanceHandle = NULL; - // - // Locate all REST EX binding service. - // - Handle = NULL; - NoBuffer = 0; - Status = gBS->LocateHandleBuffer ( -ByProtocol, -, -NULL, -, - -); - if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) { + + ChildHandle = NULL; + Status = NetLibCreateServiceChild ( + Controller, + Image, + , + + ); + if (EFI_ERROR (Status)) { +DEBUG (( + DEBUG_ERROR, + "%a: Failed to create service child - %r \n", + __FUNCTION__, + Status + )); return Status; } - - Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * NoBuffer); - if (Handle == NULL) { -return EFI_OUT_OF_RESOURCES; - } - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - , + Status = gBS->OpenProtocol ( + ChildHandle, + , + (VOID **), + Image, NULL, - , - + EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { -FreePool (Handle); -return Status; +goto ON_ERROR; } // - // Search for the proper REST EX instance. + // Get the information
[edk2-devel] [PATCH V2 2/5] RedfishPkg: Fix condition checking of error status
From: Vu Nguyen This change fixes condition checking of error status, the condition should be compared with TRUE status to be identical with an error message. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 583c6f78e19c..a247bfed9e34 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -5,6 +5,7 @@ (C) Copyright 2021 Hewlett Packard Enterprise Development LP Copyright (c) 2022, AMD Incorporated. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -926,7 +927,7 @@ AddAndSignalNewRedfishService ( } Status = gBS->SignalEvent (Instance->DiscoverToken->Event); -if (!EFI_ERROR (Status)) { +if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__)); } } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103950): https://edk2.groups.io/g/devel/message/103950 Mute This Topic: https://groups.io/mt/98678064/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V2 0/5] Adding necessary changes for RedfishPkg
This patchset adds necessary changes for RedfishPkg to avoid some unexpected cases and fix compilation. Changes since v2: + Add "Cc:" to maintainers in commit message. + Correct patch format subject prefix. Changes since v1: + Remove redundant change and change the commit message for more precise in PATCH 2/5. Nhi Pham (1): RedfishPkg: Add missing newline character Vu Nguyen (4): RedfishPkg: Correct variable type to prevent memory corruption RedfishPkg: Fix condition checking of error status RedfishPkg: Create RestEx child on selected interface RedfishPkg: Fix compile issue on Linux RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 +- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h| 3 +- RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 4 +- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 +- 6 files changed, 73 insertions(+), 98 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103948): https://edk2.groups.io/g/devel/message/103948 Mute This Topic: https://groups.io/mt/98678062/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V2 4/5] RedfishPkg: Add missing newline character
From: Nhi Pham This adds a missing newline character to make the error log readable in case the module is failed. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Nickle Wang --- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c index 45fc6e2182bc..c4fa59193a2f 100644 --- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c +++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c @@ -8,6 +8,7 @@ (C) Copyright 2020 Hewlett Packard Enterprise Development LP Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -59,7 +60,7 @@ RedfishCreateSmbiosTable42 ( Status = RedfishPlatformHostInterfaceDeviceDescriptor (, ); if (EFI_ERROR (Status)) { if (Status == EFI_NOT_FOUND) { - DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.", __func__)); + DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.\n", __func__)); return EFI_NOT_FOUND; } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103952): https://edk2.groups.io/g/devel/message/103952 Mute This Topic: https://groups.io/mt/98678066/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH V2 1/5] RedfishPkg: Correct variable type to prevent memory corruption
From: Vu Nguyen Id will be casted by CoreOpenProtocol, declare this variable with a wrong type might result in the corruption of other local variables. Signed-off-by: Minh Nguyen Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez Reviewed-by: Nickle Wang --- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h index 4a9e9f7b81a4..6b94e5814c43 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h @@ -3,6 +3,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -84,7 +85,7 @@ struct _RESTEX_SERVICE { // EFI_HANDLE HttpChildHandle; - UINT32 Id; + UINT32 *Id; EFI_REST_EX_SERVICE_INFORestExServiceInfo; }; -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103949): https://edk2.groups.io/g/devel/message/103949 Mute This Topic: https://groups.io/mt/98678063/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [v1 PATCH 3/5] RedfishPkg: Create RestEx child on selected interface
From: Vu Nguyen When a MAC address matching interface is found, a RestEx child will be created to provide the Redfish communication on that interface. Currently, It will try to locate all RestEx binding services and choose the first satisfied instance without taking care about current selected interface. This might raise an issue on the system with multiple network devices that the RestEx child was installed on wrong interface. Signed-off-by: Minh Nguyen --- RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 1 + 3 files changed, 63 insertions(+), 94 deletions(-) diff --git a/RedfishPkg/Include/Library/RestExLib.h b/RedfishPkg/Include/Library/RestExLib.h index bc4e4ca6caa7..2c32c3684cf4 100644 --- a/RedfishPkg/Include/Library/RestExLib.h +++ b/RedfishPkg/Include/Library/RestExLib.h @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -20,6 +21,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -32,6 +34,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c index d9acad24dec1..6002be93c54e 100644 --- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -9,6 +10,7 @@ #include #include +#include #include #include #include @@ -21,6 +23,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -33,6 +36,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, @@ -41,8 +45,6 @@ RestExLibCreateChild ( ) { EFI_STATUSStatus; - UINTN NoBuffer; - EFI_HANDLE*Handle; EFI_HANDLEChildHandle; EFI_REST_EX_PROTOCOL *RestEx; EFI_REST_EX_SERVICE_INFO *RestExServiceInfo; @@ -59,116 +61,79 @@ RestExLibCreateChild ( } *ChildInstanceHandle = NULL; - // - // Locate all REST EX binding service. - // - Handle = NULL; - NoBuffer = 0; - Status = gBS->LocateHandleBuffer ( -ByProtocol, -, -NULL, -, - -); - if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) { + + ChildHandle = NULL; + Status = NetLibCreateServiceChild ( + Controller, + Image, + , + + ); + if (EFI_ERROR (Status)) { +DEBUG (( + DEBUG_ERROR, + "%a: Failed to create service child - %r \n", + __FUNCTION__, + Status + )); return Status; } - - Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * NoBuffer); - if (Handle == NULL) { -return EFI_OUT_OF_RESOURCES; - } - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - , + Status = gBS->OpenProtocol ( + ChildHandle, + , + (VOID **), + Image, NULL, - , - + EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { -FreePool (Handle); -return Status; +goto ON_ERROR; } // - // Search for the proper REST EX instance. + // Get the information of REST service provided by this EFI REST EX driver //
[edk2-devel] [v1 PATCH 1/5] RedfishPkg: Correct variable type to prevent memory corruption
From: Vu Nguyen Id will be casted by CoreOpenProtocol, declare this variable with a wrong type might result in the corruption of other local variables. Signed-off-by: Minh Nguyen Reviewed-by: Nickle Wang --- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h index 4a9e9f7b81a4..6b94e5814c43 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h @@ -3,6 +3,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -84,7 +85,7 @@ struct _RESTEX_SERVICE { // EFI_HANDLE HttpChildHandle; - UINT32 Id; + UINT32 *Id; EFI_REST_EX_SERVICE_INFORestExServiceInfo; }; -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103937): https://edk2.groups.io/g/devel/message/103937 Mute This Topic: https://groups.io/mt/98677247/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [v1 PATCH 5/5] RedfishPkg: Fix compile issue on Linux
From: Vu Nguyen It requires a fixed size array to store the content of device path PCD. Add the array size to solve this issue. Signed-off-by: Minh Nguyen Reviewed-by: Abner Chang --- RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h index 91b1198297c2..57fc199f61f2 100644 --- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h +++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h @@ -4,6 +4,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -14,6 +15,8 @@ #include +#define MAX_DEVICE_PATH_NODE 40 + typedef enum { DEVICE_PATH_MATCH_MAC_NODE = 1, DEVICE_PATH_MATCH_PCI_NODE = 2, @@ -32,7 +35,7 @@ typedef struct { // 0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, //0x7f,0xff,0x04,0x00} // - EFI_DEVICE_PATH_PROTOCOLDevicePath[]; + EFI_DEVICE_PATH_PROTOCOL DevicePath[MAX_DEVICE_PATH_NODE]; } REST_EX_SERVICE_DEVICE_PATH_DATA; #endif -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103941): https://edk2.groups.io/g/devel/message/103941 Mute This Topic: https://groups.io/mt/98677251/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [v1 PATCH 0/5] Adding necessary changes for RedfishPkg
This patchset adds necessary changes for RedfishPkg to avoid some unexpected cases and fix compilation. Changes since v1: + Remove redundant change and change the commit message for more precise in PATCH 2/5. Nhi Pham (1): RedfishPkg: Add missing newline character Vu Nguyen (4): RedfishPkg: Correct variable type to prevent memory corruption RedfishPkg: Fix condition checking of error status RedfishPkg: Create RestEx child on selected interface RedfishPkg: Fix compile issue on Linux RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 +- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h| 3 +- RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 4 +- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 +- 6 files changed, 73 insertions(+), 98 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103936): https://edk2.groups.io/g/devel/message/103936 Mute This Topic: https://groups.io/mt/98676443/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [v1 PATCH 2/5] RedfishPkg: Fix condition checking of error status
From: Vu Nguyen This change fixes condition checking of error status, the condition should be compared with TRUE status to be identical with an error message. Signed-off-by: Minh Nguyen --- RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 583c6f78e19c..a247bfed9e34 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -5,6 +5,7 @@ (C) Copyright 2021 Hewlett Packard Enterprise Development LP Copyright (c) 2022, AMD Incorporated. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -926,7 +927,7 @@ AddAndSignalNewRedfishService ( } Status = gBS->SignalEvent (Instance->DiscoverToken->Event); -if (!EFI_ERROR (Status)) { +if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__)); } } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103938): https://edk2.groups.io/g/devel/message/103938 Mute This Topic: https://groups.io/mt/98677248/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [v1 PATCH 4/5] RedfishPkg: Add missing newline character
From: Nhi Pham This adds a missing newline character to make the error log readable in case the module is failed. Signed-off-by: Minh Nguyen Reviewed-by: Nickle Wang --- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c index 45fc6e2182bc..c4fa59193a2f 100644 --- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c +++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c @@ -8,6 +8,7 @@ (C) Copyright 2020 Hewlett Packard Enterprise Development LP Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -59,7 +60,7 @@ RedfishCreateSmbiosTable42 ( Status = RedfishPlatformHostInterfaceDeviceDescriptor (, ); if (EFI_ERROR (Status)) { if (Status == EFI_NOT_FOUND) { - DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.", __func__)); + DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.\n", __func__)); return EFI_NOT_FOUND; } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103940): https://edk2.groups.io/g/devel/message/103940 Mute This Topic: https://groups.io/mt/98677250/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region
Hi Wang, Thanks for this point, you're right. It's a redundant change and I will update in v2 patches, but the second change is necessary. How do you think about that? Thanks, Minh Nguyen -Original Message- From: Nickle Wang Sent: Friday, April 14, 2023 4:04 PM To: Minh Nguyen OS ; devel@edk2.groups.io Cc: Open Source Submission ; abner.ch...@amd.com; ig...@ami.com; Nhi Pham OS ; Tinh Nguyen OS ; Vu Nguyen OS Subject: RE: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region [EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.] Hi Minh, > Prevent assertion of allocate zero length region May I know where does zero length allocation happen? According to my understanding, setting the "SubnetAddrInfoIPv6Number" to zero here and it will be handled by below condition check: https://github.com/tianocore/edk2/blob/55b67b6950e648338adfe8ec54aeb26ed89d2c97/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c#L1005 Then the code leaves function with EFI_NOT_FOUND error. Thanks, Nickle > -Original Message- > From: Minh Nguyen > Sent: Friday, April 14, 2023 4:19 PM > To: devel@edk2.groups.io > Cc: patc...@amperecomputing.com; abner.ch...@amd.com; Nickle Wang > ; ig...@ami.com; n...@os.amperecomputing.com; > tinhngu...@os.amperecomputing.com; Vu Nguyen > ; Minh Nguyen > > Subject: [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero > length region > > External email: Use caution opening links or attachments > > > From: Vu Nguyen > > This change also fix miscellaneous errors on condition checking and > debug argument missing. > > Signed-off-by: Minh Nguyen > --- > RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 583c6f78e19c..29e7b0624ebf 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -5,6 +5,7 @@ >(C) Copyright 2021 Hewlett Packard Enterprise Development LP >Copyright (c) 2022, AMD Incorporated. All rights reserved. >Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. > >SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -272,7 +273,7 @@ Tcp6GetSubnetInfo ( >if (IpModedata.AddressCount == 0) { > DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", __func__)); > Instance->SubnetAddrInfoIPv6Number = 0; > -return EFI_SUCCESS; > +return EFI_NOT_FOUND; >} > >if (Instance->SubnetAddrInfoIPv6 != NULL) { @@ -926,7 +927,7 @@ > AddAndSignalNewRedfishService ( > } > > Status = gBS->SignalEvent (Instance->DiscoverToken->Event); > -if (!EFI_ERROR (Status)) { > +if (EFI_ERROR (Status)) { >DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__)); > } >} > -- > 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103114): https://edk2.groups.io/g/devel/message/103114 Mute This Topic: https://groups.io/mt/98258415/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 5/5] RedfishPkg: Fix compile issue on Linux
From: Vu Nguyen It requires a fixed size array to store the content of device path PCD. Add the array size to solve this issue. Signed-off-by: Minh Nguyen --- RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h index 91b1198297c2..57fc199f61f2 100644 --- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h +++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h @@ -4,6 +4,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -14,6 +15,8 @@ #include +#define MAX_DEVICE_PATH_NODE 40 + typedef enum { DEVICE_PATH_MATCH_MAC_NODE = 1, DEVICE_PATH_MATCH_PCI_NODE = 2, @@ -32,7 +35,7 @@ typedef struct { // 0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, //0x7f,0xff,0x04,0x00} // - EFI_DEVICE_PATH_PROTOCOLDevicePath[]; + EFI_DEVICE_PATH_PROTOCOL DevicePath[MAX_DEVICE_PATH_NODE]; } REST_EX_SERVICE_DEVICE_PATH_DATA; #endif -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103113): https://edk2.groups.io/g/devel/message/103113 Mute This Topic: https://groups.io/mt/98324151/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 4/5] RedfishPkg: Add missing newline character
From: Nhi Pham This adds a missing newline character to make the error log readable in case the module is failed. Signed-off-by: Minh Nguyen --- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c index 45fc6e2182bc..c4fa59193a2f 100644 --- a/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c +++ b/RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c @@ -8,6 +8,7 @@ (C) Copyright 2020 Hewlett Packard Enterprise Development LP Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -59,7 +60,7 @@ RedfishCreateSmbiosTable42 ( Status = RedfishPlatformHostInterfaceDeviceDescriptor (, ); if (EFI_ERROR (Status)) { if (Status == EFI_NOT_FOUND) { - DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.", __func__)); + DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.\n", __func__)); return EFI_NOT_FOUND; } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103112): https://edk2.groups.io/g/devel/message/103112 Mute This Topic: https://groups.io/mt/98324149/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface
From: Vu Nguyen When a MAC address matching interface is found, a RestEx child will be created to provide the Redfish communication on that interface. Currently, It will try to locate all RestEx binding services and choose the first satisfied instance without taking care about current selected interface. This might raise an issue on the system with multiple network devices that the RestEx child was installed on wrong interface. Signed-off-by: Minh Nguyen --- RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 1 + 3 files changed, 63 insertions(+), 94 deletions(-) diff --git a/RedfishPkg/Include/Library/RestExLib.h b/RedfishPkg/Include/Library/RestExLib.h index bc4e4ca6caa7..2c32c3684cf4 100644 --- a/RedfishPkg/Include/Library/RestExLib.h +++ b/RedfishPkg/Include/Library/RestExLib.h @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -20,6 +21,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -32,6 +34,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c index d9acad24dec1..6002be93c54e 100644 --- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c @@ -2,6 +2,7 @@ This library provides help functions for REST EX Protocol. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -9,6 +10,7 @@ #include #include +#include #include #include #include @@ -21,6 +23,7 @@ This function allows the caller to create child handle for specific REST server. + @param[in] Controller The controller handle used of selected interface. @param[in] ImageThe image handle used to open service. @param[in] AccessMode Access mode of REST server. @param[in] ConfigType Underlying configuration to communicate with REST server. @@ -33,6 +36,7 @@ **/ EFI_STATUS RestExLibCreateChild ( + IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, IN EFI_REST_EX_CONFIG_TYPE ConfigType, @@ -41,8 +45,6 @@ RestExLibCreateChild ( ) { EFI_STATUSStatus; - UINTN NoBuffer; - EFI_HANDLE*Handle; EFI_HANDLEChildHandle; EFI_REST_EX_PROTOCOL *RestEx; EFI_REST_EX_SERVICE_INFO *RestExServiceInfo; @@ -59,116 +61,79 @@ RestExLibCreateChild ( } *ChildInstanceHandle = NULL; - // - // Locate all REST EX binding service. - // - Handle = NULL; - NoBuffer = 0; - Status = gBS->LocateHandleBuffer ( -ByProtocol, -, -NULL, -, - -); - if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) { + + ChildHandle = NULL; + Status = NetLibCreateServiceChild ( + Controller, + Image, + , + + ); + if (EFI_ERROR (Status)) { +DEBUG (( + DEBUG_ERROR, + "%a: Failed to create service child - %r \n", + __FUNCTION__, + Status + )); return Status; } - - Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * NoBuffer); - if (Handle == NULL) { -return EFI_OUT_OF_RESOURCES; - } - - Status = gBS->LocateHandleBuffer ( - ByProtocol, - , + Status = gBS->OpenProtocol ( + ChildHandle, + , + (VOID **), + Image, NULL, - , - + EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { -FreePool (Handle); -return Status; +goto ON_ERROR; } // - // Search for the proper REST EX instance. + // Get the information of REST service provided by this EFI REST EX driver //
[edk2-devel] [PATCH 2/5] RedfishPkg: Prevent assertion of allocate zero length region
From: Vu Nguyen This change also fix miscellaneous errors on condition checking and debug argument missing. Signed-off-by: Minh Nguyen --- RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 583c6f78e19c..29e7b0624ebf 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -5,6 +5,7 @@ (C) Copyright 2021 Hewlett Packard Enterprise Development LP Copyright (c) 2022, AMD Incorporated. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -272,7 +273,7 @@ Tcp6GetSubnetInfo ( if (IpModedata.AddressCount == 0) { DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", __func__)); Instance->SubnetAddrInfoIPv6Number = 0; -return EFI_SUCCESS; +return EFI_NOT_FOUND; } if (Instance->SubnetAddrInfoIPv6 != NULL) { @@ -926,7 +927,7 @@ AddAndSignalNewRedfishService ( } Status = gBS->SignalEvent (Instance->DiscoverToken->Event); -if (!EFI_ERROR (Status)) { +if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a:No event to signal!\n", __func__)); } } -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103110): https://edk2.groups.io/g/devel/message/103110 Mute This Topic: https://groups.io/mt/98324145/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/5] RedfishPkg: Correct variable type to prevent memory corruption
From: Vu Nguyen Id will be casted by CoreOpenProtocol, declare this variable with a wrong type might result in the corruption of other local variables. Signed-off-by: Minh Nguyen --- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h index 4a9e9f7b81a4..6b94e5814c43 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h @@ -3,6 +3,7 @@ Copyright (c) 2019, Intel Corporation. All rights reserved. (C) Copyright 2020 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, Ampere Computing LLC. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -84,7 +85,7 @@ struct _RESTEX_SERVICE { // EFI_HANDLE HttpChildHandle; - UINT32 Id; + UINT32 *Id; EFI_REST_EX_SERVICE_INFORestExServiceInfo; }; -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103109): https://edk2.groups.io/g/devel/message/103109 Mute This Topic: https://groups.io/mt/98324142/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 0/5] Adding necessary changes for RedfishPkg
This patchset adds necessary changes for RedfishPkg to avoid some unexpected cases and fix compilation. Nhi Pham (1): RedfishPkg: Add missing newline character Vu Nguyen (4): RedfishPkg: Correct variable type to prevent memory corruption RedfishPkg: Prevent assertion of allocate zero length region RedfishPkg: Create RestEx child on selected interface RedfishPkg: Fix compile issue on Linux RedfishPkg/Include/Library/RestExLib.h | 3 + RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 +- RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h| 3 +- RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 6 +- RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c | 3 +- 6 files changed, 74 insertions(+), 99 deletions(-) -- 2.39.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103108): https://edk2.groups.io/g/devel/message/103108 Mute This Topic: https://groups.io/mt/98324140/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-