aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso/data_fabric.c
diff options
context:
space:
mode:
authorJason Glenesk <jason.glenesk@amd.corp-partner.google.com>2020-11-02 19:56:49 -0800
committerFelix Held <felix-coreboot@felixheld.de>2020-12-11 17:47:57 +0000
commitfe09a6fd47b92d75d63143fe9e40d57835a3fd93 (patch)
treed8c921f6c852fe66e634f889af3410e1b0c56c31 /src/soc/amd/picasso/data_fabric.c
parent44f41537af4022ce8d8c4fadb6b690b3ec6f8c61 (diff)
soc/amd/picasso: Add data fabric read helper function
Add new helper function to support reading a register from the data fabric. BUG=b:155307433 TEST=Boot trembyle with If64fd624597b2ced014ba7f0332a6a48143c0e8c and confirm read values match expected values. BRANCH=Zork Change-Id: If0dc72063fbb99efaeea3fccef16cc1b5b8526f1 Signed-off-by: Jason Glenesk <jason.glenesk@amd.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47726 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/picasso/data_fabric.c')
-rw-r--r--src/soc/amd/picasso/data_fabric.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/soc/amd/picasso/data_fabric.c b/src/soc/amd/picasso/data_fabric.c
index 79fdba1267..f576d89857 100644
--- a/src/soc/amd/picasso/data_fabric.c
+++ b/src/soc/amd/picasso/data_fabric.c
@@ -167,3 +167,23 @@ static const struct pci_driver data_fabric_driver __pci_driver = {
.vendor = PCI_VENDOR_ID_AMD,
.devices = pci_device_ids,
};
+
+uint32_t data_fabric_read_reg32(uint8_t function, uint16_t reg, uint8_t instance_id)
+{
+ uint32_t fabric_indirect_access_reg = 0;
+
+ 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);
+
+ fabric_indirect_access_reg |= DF_IND_CFG_INST_ACC_EN;
+ /* Register offset field [10:2] in this register corresponds to [10:2] of the
+ requested offset. */
+ fabric_indirect_access_reg |= reg & DF_IND_CFG_ACC_REG_MASK;
+ fabric_indirect_access_reg |=
+ (function << DF_IND_CFG_ACC_FUN_SHIFT) & DF_IND_CFG_ACC_FUN_MASK;
+ fabric_indirect_access_reg |= instance_id << DF_IND_CFG_INST_ID_SHIFT;
+ pci_write_config32(SOC_DF_F4_DEV, DF_FICAA_BIOS, fabric_indirect_access_reg);
+
+ return pci_read_config32(SOC_DF_F4_DEV, DF_FICAD_LO);
+}