Mario Scheithauer has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58849 )
Change subject: mb/siemens/mc_ehl: Set MAC address for all enabled TSN GbE ......................................................................
mb/siemens/mc_ehl: Set MAC address for all enabled TSN GbE
This mainboard uses all available TSE GbE controllers. Therefore we need a function to set the MAC address by using of Siemens hwilib.
Change-Id: I77e1dbbb3d0a791f33f63626663f6f65a8626d0f Signed-off-by: Mario Scheithauer mario.scheithauer@siemens.com --- M src/mainboard/siemens/mc_ehl/mainboard.c 1 file changed, 53 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/58849/1
diff --git a/src/mainboard/siemens/mc_ehl/mainboard.c b/src/mainboard/siemens/mc_ehl/mainboard.c index e64dbda..8641428 100644 --- a/src/mainboard/siemens/mc_ehl/mainboard.c +++ b/src/mainboard/siemens/mc_ehl/mainboard.c @@ -89,6 +89,31 @@ return CB_ERR; }
+static enum cb_err set_tsn_mac_address(struct device *dev) +{ + uint8_t adr_to_set[6]; + enum cb_err status; + + /* Check first whether there is a valid MAC address available */ + status = mainboard_get_mac_address(dev, adr_to_set); + if (status != CB_SUCCESS) { + printk(BIOS_ERR, "TSN (0x%2x): No valid MAC address found\n", + dev->path.pci.devfn); + return status; + } + + uint32_t bar = (pci_read_config32(dev, PCI_BASE_ADDRESS_0) & 0xFFFFF000); + if (bar) { + uint32_t *mac_p; + mac_p = (uint32_t *)(bar + 0x300); + *mac_p = (*mac_p & 0xFFFF0000) | (adr_to_set[5] << 8) | adr_to_set[4]; + mac_p++; + *mac_p = (adr_to_set[3] << 24) | (adr_to_set[2] << 16) | + (adr_to_set[1] << 8) | adr_to_set[0]; + } + return CB_SUCCESS; +} + static void wait_for_legacy_dev(void *unused) { uint32_t legacy_delay, us_since_boot; @@ -140,6 +165,34 @@ if (dev) pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER); } + + // set mac address for 1e.4 tsn + dev = dev_find_device(PCI_VENDOR_ID_INTEL, 0x4b32, 0); + if (dev) { + enum cb_err status; + status = set_tsn_mac_address(dev); + if (!status) + printk(BIOS_INFO, "TSN (1e.4 - SGMII - X127): Update MAC " + "address successful\n"); + } + // set mac address for 1d.1 tsn + dev = dev_find_device(PCI_VENDOR_ID_INTEL, 0x4ba0, 0); + if (dev) { + enum cb_err status; + status = set_tsn_mac_address(dev); + if (!status) + printk(BIOS_INFO, "TSN (1d.1 - RGMII P0 - X120/X170): " + "Update MAC address successful\n"); + } + // set mac address for 1d.2 tsn + dev = dev_find_device(PCI_VENDOR_ID_INTEL, 0x4bb0, 0); + if (dev) { + enum cb_err status; + status = set_tsn_mac_address(dev); + if (!status) + printk(BIOS_INFO, "TSN (1d.2 - RGMII P1 - X130/X160): " + "Update MAC address successful\n"); + } }
/* The following function performs board specific things. */