diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-07-03 10:49:44 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-07-04 09:35:13 +0000 |
commit | dace2498ecfadf645599aaa3ba8fef8cbb111c2d (patch) | |
tree | 232bc02b5c634d0e7e157e6a6095106dddc26b7e /src/mainboard/pcengines/apu1/mainboard.c | |
parent | 367497486d637ff07518872ad21f2cf2d8443e80 (diff) |
pcengines/apuX: Replace use of dev_find_slot()
Find the NIC device based on the PCIe root port function.
Change-Id: Ia8c6e115c9b836ee60862427dfc9d46ca3dd1b69
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34003
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Diffstat (limited to 'src/mainboard/pcengines/apu1/mainboard.c')
-rw-r--r-- | src/mainboard/pcengines/apu1/mainboard.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mainboard/pcengines/apu1/mainboard.c b/src/mainboard/pcengines/apu1/mainboard.c index e5e30e031c..088c839239 100644 --- a/src/mainboard/pcengines/apu1/mainboard.c +++ b/src/mainboard/pcengines/apu1/mainboard.c @@ -206,17 +206,23 @@ static void mainboard_enable(struct device *dev) const char *smbios_mainboard_serial_number(void) { static char serial[10]; - struct device *nic_dev; + struct device *dev; uintptr_t bar18; u32 mac_addr = 0; int i; - nic_dev = dev_find_slot(1, PCI_DEVFN(0, 0)); - if ((serial[0] != 0) || !nic_dev) + /* Already initialized. */ + if (serial[0] != 0) + return serial; + + dev = pcidev_on_root(4, 0); + if (dev) + dev = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 0)); + if (!dev) return serial; /* Read in the last 3 bytes of NIC's MAC address. */ - bar18 = pci_read_config32(nic_dev, 0x18); + bar18 = pci_read_config32(dev, 0x18); bar18 &= 0xFFFFFC00; for (i = 3; i < 6; i++) { mac_addr <<= 8; |