summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-02-13 01:09:28 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-02-14 20:52:53 +0000
commit789f6f7c35a3eff5d112ae2afce7f6c8e2b2c000 (patch)
tree3b46b18274d5c20944a1012ecae432af46e26c6d /src/soc/amd
parent45df9c1b911e2fcd5857954c10c68cf9b7ab0beb (diff)
soc/amd/common/block/data_fabric: add data_fabric_broadcast_read/write32
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I81e7ff293865ef22ed74606e1e79f67a460de4a7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50621 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/soc/amd')
-rw-r--r--src/soc/amd/common/block/data_fabric/data_fabric_helper.c6
-rw-r--r--src/soc/amd/common/block/include/amdblocks/data_fabric.h17
2 files changed, 19 insertions, 4 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 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 <amdblocks/pci_devs.h>
+#include <device/pci_ops.h>
+#include <soc/pci_devs.h>
#include <stdint.h>
#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 */