From 45df9c1b911e2fcd5857954c10c68cf9b7ab0beb Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 13 Feb 2021 01:08:14 +0100 Subject: soc/amd/common/block/data_fabric: add data_fabric_write32 Signed-off-by: Felix Held Change-Id: I9c1ae03e9aec1dec45333e697060308cb6cbda4b Reviewed-on: https://review.coreboot.org/c/coreboot/+/50620 Reviewed-by: Angel Pons Reviewed-by: Marshall Dawson Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/data_fabric/data_fabric_helper.c | 13 +++++++++++++ src/soc/amd/common/block/include/amdblocks/data_fabric.h | 1 + 2 files changed, 14 insertions(+) (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 e8e02d8eb1..d0827e6d36 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 @@ -29,3 +29,16 @@ uint32_t data_fabric_read32(uint8_t function, uint16_t reg, uint8_t instance_id) data_fabric_set_indirect_address(function, reg, instance_id); return pci_read_config32(SOC_DF_F4_DEV, DF_FICAD_LO); } + +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); + return; + } + + /* non-broadcast data fabric accesses need to be done via indirect access */ + data_fabric_set_indirect_address(function, reg, instance_id); + pci_write_config32(SOC_DF_F4_DEV, DF_FICAD_LO, data); +} 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 606d56419f..3695c4a0c7 100644 --- a/src/soc/amd/common/block/include/amdblocks/data_fabric.h +++ b/src/soc/amd/common/block/include/amdblocks/data_fabric.h @@ -8,5 +8,6 @@ #define BROADCAST_FABRIC_ID 0xff 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); #endif /* AMD_BLOCK_DATA_FABRIC_H */ -- cgit v1.2.3