Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/22984 )
Change subject: drivers/net: Add deivce index for multiple NIC cards
......................................................................
Patch Set 1:
(4 comments)
https://review.coreboot.org/#/c/22984/1/src/drivers/net/chip.h
File src/drivers/net/chip.h:
https://review.coreboot.org/#/c/22984/1/src/drivers/net/chip.h@20
PS1, Line 20: /* Indentify device number */
Can you please add some more details what this device number is used for? Also, specify the set of valid values that are expected for this field.
https://review.coreboot.org/#/c/22984/1/src/drivers/net/r8168.c
File src/drivers/net/r8168.c:
https://review.coreboot.org/#/c/22984/1/src/drivers/net/r8168.c@94
PS1, Line 94: u8
Why not use the same data type in drivers_net_config?
https://review.coreboot.org/#/c/22984/1/src/drivers/net/r8168.c@107
PS1, Line 107: key[12] = device_index + 0x30;
This is going to break all the older devices using key "ethernet_mac". I think we should maintain backward compatibility. e.g.: Treat device_index 0 as special i.e. no index specified by the board and thus use key --> ethernet_mac\0. Else if device_index is 1-9, use key --> ethernet_macX\0 where X is 1-9.
https://review.coreboot.org/#/c/22984/1/src/drivers/net/r8168.c@109
PS1, Line 109: printk(BIOS_DEBUG, "Requesting %s from VPD.\n", key)
Maybe combine this and the print in L129 to have something like:
printk(BIOS_DEBUG, "Locating %s from VPD...", key);
...
printk(BIOS_DEBUG, "Done\n");
--
To view, visit https://review.coreboot.org/22984
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I108b9bfba39370c8906a2fa4d2b39b106e884e0c
Gerrit-Change-Number: 22984
Gerrit-PatchSet: 1
Gerrit-Owner: Gaggery Tsai <gaggery.tsai(a)intel.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 26 Dec 2017 13:25:01 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
Gaggery Tsai has uploaded this change for review. ( https://review.coreboot.org/22984
Change subject: drivers/net: Add deivce index for multiple NIC cards
......................................................................
drivers/net: Add deivce index for multiple NIC cards
This patch adds a member device_index to r8168 chip information which
allows driver to indetify which NIC card requests MAC address.
In this implmentation, only 10 NIC cards are supported, the device
index is in the range of 0 to 9.
BUG=b:69950854
BRANCH=None
TEST=Added device_indexi = [0-9] under /drivers/net in device tree &&
Programmed the mac address to VPD in shell
vpd -s ethernet_mac[0-9]=<mac address> && reboot the system.
Ensure the MAC address was fetched correctly by ifconfig command.
Change-Id: I108b9bfba39370c8906a2fa4d2b39b106e884e0c
Signed-off-by: Gaggery Tsai <gaggery.tsai(a)intel.com>
---
M src/drivers/net/chip.h
M src/drivers/net/r8168.c
2 files changed, 18 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/22984/1
diff --git a/src/drivers/net/chip.h b/src/drivers/net/chip.h
index 8e8c02b..5d253dc 100644
--- a/src/drivers/net/chip.h
+++ b/src/drivers/net/chip.h
@@ -16,7 +16,8 @@
struct drivers_net_config {
uint16_t customized_leds;
- unsigned wake; /* Wake pin for ACPI _PRW */
+ unsigned wake; /* Wake pin for ACPI _PRW */
+ unsigned device_index; /* Indentify device number */
};
#endif /* __DRIVERS_R8168_CHIP_H__ */
diff --git a/src/drivers/net/r8168.c b/src/drivers/net/r8168.c
index 4c17017..74c8f87 100644
--- a/src/drivers/net/r8168.c
+++ b/src/drivers/net/r8168.c
@@ -91,13 +91,22 @@
#define MACLEN 17
-static enum cb_err fetch_mac_string_vpd(u8 *macstrbuf)
+static enum cb_err fetch_mac_string_vpd(u8 *macstrbuf, const u8 device_index)
{
struct region_device rdev;
void *search_address;
size_t search_length;
size_t offset;
- char key[] = "ethernet_mac";
+ char key[] = "ethernet_mac "; /* Leave a space at tail to stuff an index */
+
+ /* TODO: Limit up to 10 (0-9) NIC MAC address from VPD at this moment
+ * , but will we have 10 more NIC cards?
+ */
+
+ /* Translate index number from integer to ascii, base '0' is 0x30 */
+ key[12] = device_index + 0x30;
+
+ printk(BIOS_DEBUG, "Requesting %s from VPD.\n", key);
if (fmap_locate_area_as_rdev("RO_VPD", &rdev)) {
printk(BIOS_ERR, "Error: Couldn't find RO_VPD region.");
@@ -172,10 +181,14 @@
int i = 0;
/* Default MAC Address of 00:E0:4C:00:C0:B0 */
u8 mac[6] = { 0x00, 0xe0, 0x4c, 0x00, 0xc0, 0xb0 };
+ struct drivers_net_config *config = dev->chip_info;
+
+ if (!config)
+ return;
/* check the VPD for the mac address */
if (IS_ENABLED(CONFIG_RT8168_GET_MAC_FROM_VPD)) {
- if (fetch_mac_string_vpd(macstrbuf) != CB_SUCCESS)
+ if (fetch_mac_string_vpd(macstrbuf, config->device_index) != CB_SUCCESS)
printk(BIOS_ERR, "r8168: mac address not found in VPD,"
" using default 00:e0:4c:00:c0:b0\n");
} else {
--
To view, visit https://review.coreboot.org/22984
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I108b9bfba39370c8906a2fa4d2b39b106e884e0c
Gerrit-Change-Number: 22984
Gerrit-PatchSet: 1
Gerrit-Owner: Gaggery Tsai <gaggery.tsai(a)intel.com>
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/22983 )
Change subject: tianocore: fix Makefile to be able to build a custom revision or branch
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/coreboot-checkpatch/19751/ : SUCCESS
https://qa.coreboot.org/job/coreboot-gerrit/64994/ : SUCCESS
--
To view, visit https://review.coreboot.org/22983
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9711a370eeade3cba0a9e127deb3d96d82adc512
Gerrit-Change-Number: 22983
Gerrit-PatchSet: 1
Gerrit-Owner: Gergely Kiss <mail.gery(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 24 Dec 2017 22:14:17 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes