amdfam10 boards: Fix regression on dev_find_slot() removal

For these platforms, the first PCI node on devicetree
is not the root of PCI bus hierarchy, and the topology
(bus->children and dev->sibling links) are getting
manipulated during HyperTransport enumeration.

This workaround reverts back to old dev_find_slot() with
its bad semantics.

Change-Id: I19745c3070c12e562ffab2f0243c9d91dd051c72
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/30695
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/device/device_const.c b/src/device/device_const.c
index ec128e8..f60f749 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -187,9 +187,17 @@
 {
 	DEVTREE_CONST struct device *pci_domain;
 
+	/* Work around pcidev_path_behind() below failing
+	 * due tue complicated devicetree with topology
+	 * being manipulated on-the-fly.
+	 */
+	if (IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AMDFAM10))
+		return dev_find_slot(0, devfn);
+
 	pci_domain = dev_find_path(NULL, DEVICE_PATH_DOMAIN);
 	if (!pci_domain)
 		return NULL;
+
 	return pcidev_path_behind(pci_domain->link_list, devfn);
 }