summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-02-13 01:08:14 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-02-14 20:52:38 +0000
commit45df9c1b911e2fcd5857954c10c68cf9b7ab0beb (patch)
treeb2d61d4793c591ebe469cacb9d32130d6838284a /src
parentdba3fe7ad168c5339535973f1ef7ff0f7f33bd5e (diff)
soc/amd/common/block/data_fabric: add data_fabric_write32
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I9c1ae03e9aec1dec45333e697060308cb6cbda4b Reviewed-on: https://review.coreboot.org/c/coreboot/+/50620 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/data_fabric/data_fabric_helper.c13
-rw-r--r--src/soc/amd/common/block/include/amdblocks/data_fabric.h1
2 files changed, 14 insertions, 0 deletions
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 */