From 1f8470463634b4e09c986150a07b51edfd1999ee Mon Sep 17 00:00:00 2001 From: Gaggery Tsai Date: Tue, 26 Dec 2017 17:13:52 +0800 Subject: drivers/net: Add device index for multiple NIC cards This patch adds a member device_index to r8168 chip information which allows driver to identify which NIC card requests MAC address. In this implementation, only 10 NIC cards are supported, the device index is in the range of 0 to 10. Regarding to MAC address mapping, when there is only one NIC on DUT, it is treated as a special case mapping to "ethernet_mac" in VPD for backward compatibility. When there are multiple NICs on DUT, they are mapping to "ethernet_macN" where N is [0-9]. Device tree configuration: For single NIC: .device_index = "0", maps to "ethernet_mac" For multiple NICs: .device_index = "[1-10]", maps to "ethernet_mac[device_index - 1]" BUG=b:69950854 BRANCH=None TEST=Added device_index = [0-10] under /drivers/net in device tree && Programmed the mac address to VPD in shell vpd -s ethernet_mac= or vpd -s ethernet-mac[0-9]= && reboot the system. Ensure the MAC address was fetched correctly by ifconfig command. Change-Id: I108b9bfba39370c8906a2fa4d2b39b106e884e0c Signed-off-by: Gaggery Tsai Reviewed-on: https://review.coreboot.org/22984 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/net/chip.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/drivers/net/chip.h') diff --git a/src/drivers/net/chip.h b/src/drivers/net/chip.h index 8e8c02b002..81dbefa556 100644 --- a/src/drivers/net/chip.h +++ b/src/drivers/net/chip.h @@ -16,7 +16,13 @@ struct drivers_net_config { uint16_t customized_leds; - unsigned wake; /* Wake pin for ACPI _PRW */ + unsigned wake; /* Wake pin for ACPI _PRW */ + /* + * There maybe many NIC cards in a system. + * This paramter is for driver to identify what + * the device number is and the valid range is [1-10]. + */ + uint8_t device_index; }; #endif /* __DRIVERS_R8168_CHIP_H__ */ -- cgit v1.2.3