Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30784
Change subject: northbridge/amdfam10: Deal with PCI_ADDR() better ......................................................................
northbridge/amdfam10: Deal with PCI_ADDR() better
PCI_ADDR() is tightly coupled with different setup_resource_map() variants so move the declaration away from global namespace.
In the implementation of setup_resource_map() use the bottom 12 bits as the register mask like the other variants do already.
Change-Id: Iadedfe993621a4458ce8f12c5e98c8cee537d2db Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/include/arch/io.h M src/northbridge/amd/amdfam10/amdfam10.h M src/northbridge/amd/amdfam10/setup_resource_map.c 3 files changed, 10 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/30784/1
diff --git a/src/arch/x86/include/arch/io.h b/src/arch/x86/include/arch/io.h index 9e2a877..e4e3067 100644 --- a/src/arch/x86/include/arch/io.h +++ b/src/arch/x86/include/arch/io.h @@ -235,12 +235,6 @@
#ifdef __SIMPLE_DEVICE__
-#define PCI_ADDR(SEGBUS, DEV, FN, WHERE) ( \ - (((SEGBUS) & 0xFFF) << 20) | \ - (((DEV) & 0x1F) << 15) | \ - (((FN) & 0x07) << 12) | \ - ((WHERE) & 0xFFF)) - #define PCI_DEV(SEGBUS, DEV, FN) ( \ (((SEGBUS) & 0xFFF) << 20) | \ (((DEV) & 0x1F) << 15) | \ diff --git a/src/northbridge/amd/amdfam10/amdfam10.h b/src/northbridge/amd/amdfam10/amdfam10.h index e1c88c9..c912f18 100644 --- a/src/northbridge/amd/amdfam10/amdfam10.h +++ b/src/northbridge/amd/amdfam10/amdfam10.h @@ -29,6 +29,12 @@
/* Definitions for setup_resourcemap() variants. */
+#define PCI_ADDR(SEGBUS, DEV, FN, WHERE) ( \ + (((SEGBUS) & 0xFFF) << 20) | \ + (((DEV) & 0x1F) << 15) | \ + (((FN) & 0x07) << 12) | \ + ((WHERE) & 0xFFF)) + #define ADDRMAP_REG(r) PCI_ADDR(CONFIG_CBB, CONFIG_CDB, 1, r)
#define RES_PCI_IO 0x10 diff --git a/src/northbridge/amd/amdfam10/setup_resource_map.c b/src/northbridge/amd/amdfam10/setup_resource_map.c index 23e2ba3..5984178 100644 --- a/src/northbridge/amd/amdfam10/setup_resource_map.c +++ b/src/northbridge/amd/amdfam10/setup_resource_map.c @@ -30,8 +30,8 @@ u32 where; u32 reg;
- dev = register_values[i] & ~0xff; - where = register_values[i] & 0xff; + dev = register_values[i] & ~0xfff; + where = register_values[i] & 0xfff; reg = pci_read_config32(dev, where); reg &= register_values[i+1]; reg |= register_values[i+2]; @@ -144,8 +144,8 @@ pci_devfn_t dev; u32 where; u32 reg; - dev = register_values[i+1] & ~0xff; - where = register_values[i+1] & 0xff; + dev = register_values[i+1] & ~0xfff; + where = register_values[i+1] & 0xfff; reg = pci_read_config32(dev, where); reg &= register_values[i+2]; reg |= register_values[i+3];