From 69a2a39175addddc75cff03338870c86f441d6e4 Mon Sep 17 00:00:00 2001 From: Rebecca Cran Date: Mon, 30 Sep 2024 07:04:37 -0600 Subject: [PATCH] Ampere: Add full set of I2C buses to Ac01.h Boards based on the Altra SoC from vendors such as ADLINK are configured differently and require access to I2C buses not listed in Ac01.h. Fix this by expanding AC01_I2C_BASE_ADDRESS_LIST to contain the full set of buses available. Since this changes the indexing of the buses, update the Mt Jade files to match. Add a new PCD to contain the bus number of the RTC since this is different between Mt Jade and ADLINK's COM-HPC-ALT platform. Signed-off-by: Rebecca Cran --- .../Type09/PlatformSystemSlotFunction.c | 6 +++--- .../PCF85063RealTimeClockLib/PCF85063.h | 3 ++- .../PCF85063RealTimeClockLib.inf | 4 ++++ .../AmpereAltraPkg/Include/Platform/Ac01.h | 21 +++++++++++++++++-- .../AmpereSiliconPkg/AmpereSiliconPkg.dec | 7 ++++++- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotFunction.c b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotFunction.c index 142d7387bf..24f88c0179 100644 --- a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotFunction.c +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/Type09/PlatformSystemSlotFunction.c @@ -38,9 +38,9 @@ // // CPU I2C Bus for IO Expander // -#define S0_RISER_I2C_BUS 0x02 -#define S0_OCP_I2C_BUS 0x02 -#define S1_RISER_I2C_BUS 0x03 +#define S0_RISER_I2C_BUS 0x06 +#define S0_OCP_I2C_BUS 0x06 +#define S1_RISER_I2C_BUS 0x0F // // I2C address of IO Expander devices diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h index 6c27247c8e..341f736a2f 100644 --- a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h @@ -12,12 +12,13 @@ #include #include +#include #include // // I2C bus address that RTC connected to // -#define I2C_RTC_BUS_ADDRESS 1 +#define I2C_RTC_BUS_ADDRESS (FixedPcdGet8 (PcdRtcBusAddress)) // // I2C RTC bus speed diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf index 6ba0049bbd..b72562ab89 100644 --- a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeClockLib.inf @@ -35,6 +35,7 @@ GpioLib DxeServicesTableLib I2cLib + PcdLib TimeBaseLib TimerLib UefiLib @@ -44,3 +45,6 @@ [Guids] gEfiEventVirtualAddressChangeGuid + +[Pcd] + gAmpereTokenSpaceGuid.PcdRtcBusAddress diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index a115619dfc..633f2ad978 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -65,12 +65,29 @@ // // The maximum number of I2C bus // -#define AC01_I2C_MAX_BUS_NUM 4 +#define AC01_I2C_MAX_BUS_NUM 18 // // The base address of DW I2C // -#define AC01_I2C_BASE_ADDRESS_LIST 0x1000026B0000ULL, 0x100002750000ULL, 0x100002770000ULL, 0x500002770000ULL +#define AC01_I2C_BASE_ADDRESS_LIST 0x100002690000, /* Socket 0 IIC 2 */ \ + 0x1000026A0000, /* IIC 3 */ \ + 0x1000026B0000, /* IIC 4 */ \ + 0x1000026C0000, /* IIC 5 */ \ + 0x100002750000, /* IIC 6 */ \ + 0x100002760000, /* IIC 7 */ \ + 0x100002770000, /* IIC 8 */ \ + 0x100002780000, /* IIC 9 */ \ + 0x100002790000, /* IIC 10 */ \ + 0x500002690000, /* Socket 1 IIC 2 */ \ + 0x5000026A0000, /* IIC 3 */ \ + 0x5000026B0000, /* IIC 4 */ \ + 0x5000026C0000, /* IIC 5 */ \ + 0x500002750000, /* IIC 6 */ \ + 0x500002760000, /* IIC 7 */ \ + 0x500002770000, /* IIC 8 */ \ + 0x500002780000, /* IIC 9 */ \ + 0x500002790000 /* IIC 10 */ // // The Array of Soc Gpio Base Address diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 6f312eb32a..b8823071c1 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -61,6 +61,11 @@ # gAmpereTokenSpaceGuid.PcdPlatformConfigUuid|"C416535D-970B-41B9-859A-3CAF0FAF198C"|VOID*|0x00000010 + # + # RTC + # + gAmpereTokenSpaceGuid.PcdRtcBusAddress|0x4|UINT8|0x00000011 + # # SMpro PMpro Pcds # @@ -78,7 +83,7 @@ # # I2C PCDs for SMBUS # - gAmpereTokenSpaceGuid.PcdSmbusI2cBusNumber|0x00|UINT8|0x00000007 + gAmpereTokenSpaceGuid.PcdSmbusI2cBusNumber|0x02|UINT8|0x00000007 gAmpereTokenSpaceGuid.PcdSmbusI2cBusSpeed|100000|UINT32|0x00000008 # Hz #