diff options
Diffstat (limited to 'src/soc/amd')
-rw-r--r-- | src/soc/amd/common/block/data_fabric/data_fabric_helper.c | 6 | ||||
-rw-r--r-- | src/soc/amd/common/block/include/amdblocks/data_fabric.h | 17 |
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 */ |