[coreboot-gerrit] Change in ...coreboot[master]: drivers/net/rt8168: support loading MAC address from vpd.bin

Matt DeVillier (Code Review) gerrit at coreboot.org
Sat Dec 15 00:50:33 CET 2018


Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30231


Change subject: drivers/net/rt8168: support loading MAC address from vpd.bin
......................................................................

drivers/net/rt8168: support loading MAC address from vpd.bin

Adapted from earlier implementation for google/beltino

Test: build/boot on google/fizz, with RO_VPD region of
stock ChromeOS firmware injected into cbfs as vpd.bin.
Verify LAN MAC address correctly persisted.

Change-Id: If18ab2cd0148c1272cbe65c2ad8864ddd3b4ddf8
Signed-off-by: Matt DeVillier <matt.devillier at gmail.com>
---
M src/drivers/net/r8168.c
1 file changed, 12 insertions(+), 5 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/30231/1

diff --git a/src/drivers/net/r8168.c b/src/drivers/net/r8168.c
index 5280cb6..a125ec3 100644
--- a/src/drivers/net/r8168.c
+++ b/src/drivers/net/r8168.c
@@ -113,17 +113,24 @@
 		/* Translate index number from integer to ascii */
 		key[DEVICE_INDEX_BYTE] = (device_index - 1) + '0';
 
-	if (fmap_locate_area_as_rdev("RO_VPD", &rdev)) {
-		printk(BIOS_ERR, "Error: Couldn't find RO_VPD region.");
-		return CB_ERR;
+	if (IS_ENABLED(CONFIG_CHROMEOS)) {
+		if (fmap_locate_area_as_rdev("RO_VPD", &rdev)) {
+			printk(BIOS_ERR, "Error: Couldn't find RO_VPD region.");
+			return CB_ERR;
+		}
+		search_address = rdev_mmap_full(&rdev);
+		search_length = region_device_sz(&rdev);
+	} else {
+		search_address = cbfs_boot_map_with_leak("vpd.bin",
+							CBFS_TYPE_RAW,
+							&search_length);
 	}
-	search_address = rdev_mmap_full(&rdev);
+
 	if (search_address == NULL) {
 		printk(BIOS_ERR, "LAN: VPD not found.\n");
 		return CB_ERR;
 	}
 
-	search_length = region_device_sz(&rdev);
 	offset = search(key, search_address, strlen(key),
 			search_length);
 

-- 
To view, visit https://review.coreboot.org/c/coreboot/+/30231
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If18ab2cd0148c1272cbe65c2ad8864ddd3b4ddf8
Gerrit-Change-Number: 30231
Gerrit-PatchSet: 1
Gerrit-Owner: Matt DeVillier <matt.devillier at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181214/e7e13548/attachment.html>


More information about the coreboot-gerrit mailing list