From 789f6f7c35a3eff5d112ae2afce7f6c8e2b2c000 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 13 Feb 2021 01:09:28 +0100 Subject: soc/amd/common/block/data_fabric: add data_fabric_broadcast_read/write32 Signed-off-by: Felix Held Change-Id: I81e7ff293865ef22ed74606e1e79f67a460de4a7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50621 Reviewed-by: Angel Pons Reviewed-by: Marshall Dawson Tested-by: build bot (Jenkins) --- .../amd/common/block/data_fabric/data_fabric_helper.c | 6 ++---- .../amd/common/block/include/amdblocks/data_fabric.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src/soc/amd') diff --git a/src/soc/amd/common/block/data_fabric/data_fabric_helper.c b/src/soc/amd/common/block/data_fabric/data_fabric_helper.c index d0827e6d36..e784d508ff 100644 --- a/src/soc/amd/common/block/data_fabric/data_fabric_helper.c +++ b/src/soc/amd/common/block/data_fabric/data_fabric_helper.c @@ -22,8 +22,7 @@ static void data_fabric_set_indirect_address(uint8_t func, uint16_t reg, uint8_t uint32_t data_fabric_read32(uint8_t function, uint16_t reg, uint8_t instance_id) { if (instance_id == BROADCAST_FABRIC_ID) - /* No bit masking required. Macros will apply mask to values. */ - return pci_read_config32(_SOC_DEV(DF_DEV, function), reg); + return data_fabric_broadcast_read32(function, reg); /* non-broadcast data fabric accesses need to be done via indirect access */ data_fabric_set_indirect_address(function, reg, instance_id); @@ -33,8 +32,7 @@ uint32_t data_fabric_read32(uint8_t function, uint16_t reg, uint8_t instance_id) void data_fabric_write32(uint8_t function, uint16_t reg, uint8_t instance_id, uint32_t data) { if (instance_id == BROADCAST_FABRIC_ID) { - /* No bit masking required. Macros will apply mask to values. */ - pci_write_config32(_SOC_DEV(DF_DEV, function), reg, data); + data_fabric_write32(function, reg, BROADCAST_FABRIC_ID, data); return; } diff --git a/src/soc/amd/common/block/include/amdblocks/data_fabric.h b/src/soc/amd/common/block/include/amdblocks/data_fabric.h index 3695c4a0c7..386be7a40b 100644 --- a/src/soc/amd/common/block/include/amdblocks/data_fabric.h +++ b/src/soc/amd/common/block/include/amdblocks/data_fabric.h @@ -3,6 +3,9 @@ #ifndef AMD_BLOCK_DATA_FABRIC_H #define AMD_BLOCK_DATA_FABRIC_H +#include +#include +#include #include #define BROADCAST_FABRIC_ID 0xff @@ -10,4 +13,18 @@ uint32_t data_fabric_read32(uint8_t function, uint16_t reg, uint8_t instance_id); void data_fabric_write32(uint8_t function, uint16_t reg, uint8_t instance_id, uint32_t data); +static __always_inline +uint32_t data_fabric_broadcast_read32(uint8_t function, uint16_t reg) +{ + /* No bit masking required. Macros will apply mask to values. */ + return pci_read_config32(_SOC_DEV(DF_DEV, function), reg); +} + +static __always_inline +void data_fabric_broadcast_write32(uint8_t function, uint16_t reg, uint32_t data) +{ + /* No bit masking required. Macros will apply mask to values. */ + pci_write_config32(_SOC_DEV(DF_DEV, function), reg, data); +} + #endif /* AMD_BLOCK_DATA_FABRIC_H */ -- cgit v1.2.3