Adds PlatformSocLib library class. Implements null instance of PlatformSocLib. PlatformSocLib provides interface to the SoC specific functionality.
Cc: Abner Chang <abner.ch...@amd.com> Cc: Paul Grimes <paul.gri...@amd.com> Signed-off-by: Abdul Lateef Attar <abdullateef.at...@amd.com> --- .../AMD/AmdPlatformPkg/AmdPlatformPkg.dec | 7 + .../AMD/AmdPlatformPkg/AmdPlatformPkg.dsc | 2 + .../Include/Library/AmdPlatformSocLib.h | 134 ++++++++++++++++++ .../DxePlatformSocLib/DxePlatformSocLibNull.c | 75 ++++++++++ .../DxePlatformSocLibNull.inf | 26 ++++ .../DxePlatformSocLibNull.uni | 13 ++ 6 files changed, 257 insertions(+) create mode 100644 Platform/AMD/AmdPlatformPkg/Include/Library/AmdPlatformSocLib.h create mode 100644 Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.c create mode 100644 Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.inf create mode 100644 Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.uni diff --git a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec index 4d811d1135..4cb66d2a36 100644 --- a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec +++ b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dec @@ -14,6 +14,13 @@ PACKAGE_GUID = 2CB1238B-18E2-4837-B714-9DAB2B30A3C2 PACKAGE_VERSION = 1.0 +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Defines a get/set interface for platform specific data. + PlatformSocLib|Include/Library/AmdPlatformSocLib.h + [Guids] gAmdPlatformPkgTokenSpaceGuid = { 0x663DE733, 0x70E0, 0x4D37, { 0xBB, 0x30, 0x7D, 0x9E, 0xAF, 0x9B, 0xDA, 0xE9 }} diff --git a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc index 2c959fb614..a717263c58 100644 --- a/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc +++ b/Platform/AMD/AmdPlatformPkg/AmdPlatformPkg.dsc @@ -45,9 +45,11 @@ [LibraryClasses.common.DXE_DRIVER] BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + PlatformSocLib|AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.inf [Components] AmdPlatformPkg/Library/BaseAlwaysFalseDepexLib/BaseAlwaysFalseDepexLib.inf + AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.inf AmdPlatformPkg/Library/SimulatorSerialPortLibPort80/SimulatorSerialPortLibPort80.inf AmdPlatformPkg/Universal/LogoDxe/JpegLogoDxe.inf # Server platform JPEG logo driver AmdPlatformPkg/Universal/LogoDxe/LogoDxe.inf # Server platfrom Bitmap logo driver diff --git a/Platform/AMD/AmdPlatformPkg/Include/Library/AmdPlatformSocLib.h b/Platform/AMD/AmdPlatformPkg/Include/Library/AmdPlatformSocLib.h new file mode 100644 index 0000000000..f57e5d4989 --- /dev/null +++ b/Platform/AMD/AmdPlatformPkg/Include/Library/AmdPlatformSocLib.h @@ -0,0 +1,134 @@ +/** @file + AMD Platform SoC Library. + Provides interface to Get/Set platform specific data. + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AMD_PLATFORM_SOC_LIB_H_ +#define AMD_PLATFORM_SOC_LIB_H_ + +#include <IndustryStandard/Acpi65.h> +#include <IndustryStandard/SmBios.h> +#include <Uefi/UefiBaseType.h> + +#define PCIE_MAX_FUNCTIONS 8 +#define PCIE_MAX_DEVICES 32 +#define PCIE_MAX_ROOTPORT (PCIE_MAX_DEVICES * PCIE_MAX_FUNCTIONS) + +typedef struct { + UINTN Index; + BOOLEAN Enabled; + UINT8 PortPresent; + UINTN Device; + UINTN Function; + UINTN SlotNum; + // Interrupts are relative to IOAPIC 0->n + UINTN BridgeInterrupt; // Redirection table entry for mapped bridge interrupt + UINTN EndpointInterruptArray[4]; // Redirection table entries for mapped INT A/B/C/D +} AMD_PCI_ROOT_PORT_OBJECT; + +typedef struct { + UINTN Index; + UINT8 SocketId; + UINTN Segment; + UINTN BaseBusNumber; +} AMD_PCI_ROOT_BRIDGE_OBJECT; + +/// Extended PCI address format +typedef struct { + IN OUT UINT32 Register : 12; ///< Register offset + IN OUT UINT32 Function : 3; ///< Function number + IN OUT UINT32 Device : 5; ///< Device number + IN OUT UINT32 Bus : 8; ///< Bus number + IN OUT UINT32 Segment : 4; ///< Segment +} AMD_EXT_PCI_ADDR; + +/// Union type for PCI address +typedef union { + IN UINT32 AddressValue; ///< Formal address + IN AMD_EXT_PCI_ADDR Address; ///< Extended address +} AMD_PCI_ADDR; + +/// Port Information Structure +typedef struct { + AMD_PCI_ADDR EndPointBDF; ///< Bus/Device/Function of Root Port in PCI_ADDR format + BOOLEAN IsCxl2; +} AMD_CXL_PORT_INFO; + +typedef struct { + EFI_HANDLE Handle; + UINTN Uid; + UINTN GlobalInterruptStart; + VOID *Configuration; // Never free this buffer + AMD_PCI_ROOT_BRIDGE_OBJECT *Object; // Never free this object + UINTN RootPortCount; + AMD_PCI_ROOT_PORT_OBJECT *RootPort[PCIE_MAX_ROOTPORT]; // Never free this object + UINTN CxlCount; + AMD_CXL_PORT_INFO CxlPortInfo; + UINTN PxmDomain; // Proximity domain +} AMD_PCI_ROOT_BRIDGE_OBJECT_INSTANCE; + +/** + Get the platform specific IOAPIC information. + + NOTE: Caller will need to free structure once finished. + + @param IoApicInfo The IOAPIC information + @param IoApicCount Number of IOAPIC present + + @retval EFI_SUCCESS Successfully retrieve the IOAPIC information. + EFI_INVALID_PARAMETERS Incorrect parameters provided. + EFI_UNSUPPORTED Platform do not support this function. + Other value Returns other EFI_STATUS in case of failure. + +**/ +EFI_STATUS +EFIAPI +GetIoApicInfo ( + IN OUT EFI_ACPI_6_5_IO_APIC_STRUCTURE **IoApicInfo, + IN OUT UINT8 *IoApicCount + ); + +/** + Get the platform PCIe configuration information. + + NOTE: Caller will need to free structure once finished. + + @param RootBridge The root bridge information + @param RootBridgeCount Number of root bridges present + + @retval EFI_SUCCESS Successfully retrieve the root bridge information. + EFI_INVALID_PARAMETERS Incorrect parameters provided. + EFI_UNSUPPORTED Platform do not support this function. + Other value Returns other EFI_STATUS in case of failure. + +**/ +EFI_STATUS +EFIAPI +GetPcieInfo ( + IN OUT AMD_PCI_ROOT_BRIDGE_OBJECT_INSTANCE **RootBridge, + IN OUT UINTN *RootBridgeCount + ); + +/** + Get the platform specific System Slot information. + + NOTE: Caller will need to free structure once finished. + + @param[in, out] SystemSlotInfo The System Slot information + @param[in, out] SystemSlotCount Number of System Slot present + + @retval EFI_UNSUPPORTED Platform do not support this function. +**/ +EFI_STATUS +EFIAPI +GetSystemSlotInfo ( + IN OUT SMBIOS_TABLE_TYPE9 **SystemSlotInfo, + IN OUT UINTN *SystemSlotCount + ); + +#endif diff --git a/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.c b/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.c new file mode 100644 index 0000000000..142c3b66a7 --- /dev/null +++ b/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.c @@ -0,0 +1,75 @@ +/** @file + Implements AMD Platform SoC Library. + Provides interface to Get/Set platform specific data. + + Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include <Uefi/UefiBaseType.h> +#include <IndustryStandard/Acpi65.h> +#include <Library/AmdPlatformSocLib.h> +#include <IndustryStandard/SmBios.h> + +/** + Get the platform specific IOAPIC information. + + NOTE: Caller will need to free structure once finished. + + @param IoApicInfo The IOAPIC information + @param IoApicCount Number of IOAPIC present + + @retval EFI_UNSUPPORTED Platform do not support this function. + +**/ +EFI_STATUS +EFIAPI +GetIoApicInfo ( + IN OUT EFI_ACPI_6_5_IO_APIC_STRUCTURE **IoApicInfo, + IN OUT UINT8 *IoApicCount + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Get the platform PCIe configuration information. + + NOTE: Caller will need to free structure once finished. + + @param RootBridge The root bridge information + @param RootBridgeCount Number of root bridges present + + @retval EFI_UNSUPPORTED Platform do not support this function. + +**/ +EFI_STATUS +EFIAPI +GetPcieInfo ( + IN OUT AMD_PCI_ROOT_BRIDGE_OBJECT_INSTANCE **RootBridge, + IN OUT UINTN *RootBridgeCount + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Get the platform specific System Slot information. + + NOTE: Caller will need to free structure once finished. + + @param[in, out] SystemSlotInfo The System Slot information + @param[in, out] SystemSlotCount Number of System Slot present + + @retval EFI_UNSUPPORTED Platform do not support this function. +**/ +EFI_STATUS +EFIAPI +GetSystemSlotInfo ( + IN OUT SMBIOS_TABLE_TYPE9 **SystemSlotInfo, + IN OUT UINTN *SystemSlotCount + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.inf b/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.inf new file mode 100644 index 0000000000..df8eb6b604 --- /dev/null +++ b/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.inf @@ -0,0 +1,26 @@ +## @file +# INF file of AMD Platform SoC library +# +# Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 1.29 + BASE_NAME = DxePlatformSocLibNull + MODULE_UNI_FILE = DxePlatformSocLibNull.uni + FILE_GUID = AFF6B33C-B084-4B35-BC1F-D077CDB3B464 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PlatformSocLib + +[Sources] + DxePlatformSocLibNull.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + diff --git a/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.uni b/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.uni new file mode 100644 index 0000000000..aa2ce2bc2f --- /dev/null +++ b/Platform/AMD/AmdPlatformPkg/Library/DxePlatformSocLib/DxePlatformSocLibNull.uni @@ -0,0 +1,13 @@ +## @file +# UNI file of AMD Platform SoC library +# +# Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +#string STR_MODULE_ABSTRACT #language en-US "AMD DXE Platform SoC null library instance." + +#string STR_MODULE_DESCRIPTION #language en-US "AMD DXE Platform SoC null library instance." + -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118887): https://edk2.groups.io/g/devel/message/118887 Mute This Topic: https://groups.io/mt/106090925/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-