[coreboot-gerrit] Change in ...coreboot[master]: mb/kontron/986lcd-m: Implement disabling ethernet NIC in ramstage

Arthur Heymans (Code Review) gerrit at coreboot.org
Sun Dec 16 01:06:29 CET 2018


Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30245


Change subject: mb/kontron/986lcd-m: Implement disabling ethernet NIC in ramstage
......................................................................

mb/kontron/986lcd-m: Implement disabling ethernet NIC in ramstage

With the i82801gx code automatically disabling devices ethernet
NICs attached to the southbridge PCIe ports can now be disabled
during the ramstage.

Change-Id: If4163f8101d37cc09c0b51b1be20bf8388ed2b89
Signed-off-by: Arthur Heymans <arthur at aheymans.xyz>
---
M src/mainboard/kontron/986lcd-m/mainboard.c
M src/mainboard/kontron/986lcd-m/romstage.c
2 files changed, 28 insertions(+), 47 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/30245/1

diff --git a/src/mainboard/kontron/986lcd-m/mainboard.c b/src/mainboard/kontron/986lcd-m/mainboard.c
index cc32b99..1f3df71 100644
--- a/src/mainboard/kontron/986lcd-m/mainboard.c
+++ b/src/mainboard/kontron/986lcd-m/mainboard.c
@@ -13,8 +13,10 @@
  * GNU General Public License for more details.
  */
 
+#include <string.h>
 #include <types.h>
 #include <device/device.h>
+#include <device/pci_def.h>
 #include <console/console.h>
 #include <drivers/intel/gma/int15.h>
 #include <pc80/mc146818rtc.h>
@@ -157,6 +159,32 @@
 	hwm_setup();
 }
 
+static void mainboard_init(void *chip_info)
+{
+	int i;
+	struct device *dev;
+
+	for (i = 1; i <= 3; i++) {
+		int ethernet_disable = 0;
+		char cmos_option_name[] = "ethernetx";
+		snprintf(cmos_option_name, sizeof(cmos_option_name),
+			 "ethernet%01d", i);
+		get_option(&ethernet_disable, cmos_option_name);
+		if (!ethernet_disable)
+			continue;
+		printk(BIOS_DEBUG, "Disabling Ethernet NIC #%d\n");
+		dev = dev_find_slot(0, PCI_DEVFN(28, i - 1));
+		if (dev == NULL) {
+			printk(BIOS_ERR,
+			       "Disabling Ethernet NIC: Cannot find 00:1c.%d!\n",
+			       i - 1);
+			continue;
+		}
+		dev->enabled = 0;
+	}
+}
+
 struct chip_operations mainboard_ops = {
+	.init = mainboard_init,
 	.enable_dev = mainboard_enable,
 };
diff --git a/src/mainboard/kontron/986lcd-m/romstage.c b/src/mainboard/kontron/986lcd-m/romstage.c
index e85135b..4e84d7a 100644
--- a/src/mainboard/kontron/986lcd-m/romstage.c
+++ b/src/mainboard/kontron/986lcd-m/romstage.c
@@ -166,8 +166,6 @@
 
 static void rcba_config(void)
 {
-	u32 reg32 = 0;
-
 	/* Set up virtual channel 0 */
 
 	/* Device 1f interrupt pin register */
@@ -185,50 +183,6 @@
 	/* Enable IOAPIC */
 	RCBA8(OIC) = 0x03;
 
-	/* Now, this is a bit ugly. As per PCI specification, function 0 of a
-	 * device always has to be implemented. So disabling ethernet port 1
-	 * would essentially disable all three ethernet ports of the mainboard.
-	 * It's possible to rename the ports to achieve compatibility to the
-	 * PCI spec but this will confuse all (static!) tables containing
-	 * interrupt routing information.
-	 * To avoid this, we enable (unused) port 6 and swap it with port 1
-	 * in the case that ethernet port 1 is disabled. Since no devices
-	 * are connected to that port, we don't have to worry about interrupt
-	 * routing.
-	 */
-	int port_shuffle = 0;
-
-	/* Disable unused devices */
-	if (read_option(ethernet1, 0) != 0) {
-		printk(BIOS_DEBUG, "Disabling ethernet adapter 1.\n");
-		reg32 |= FD_PCIE1;
-	}
-	if (read_option(ethernet2, 0) != 0) {
-		printk(BIOS_DEBUG, "Disabling ethernet adapter 2.\n");
-		reg32 |= FD_PCIE2;
-	} else {
-		if (reg32 & FD_PCIE1)
-			port_shuffle = 1;
-	}
-	if (read_option(ethernet3, 0) != 0) {
-		printk(BIOS_DEBUG, "Disabling ethernet adapter 3.\n");
-		reg32 |= FD_PCIE3;
-	} else {
-		if (reg32 & FD_PCIE1)
-			port_shuffle = 1;
-	}
-
-	if (port_shuffle) {
-		/* Enable PCIE6 again */
-		reg32 &= ~FD_PCIE6;
-		/* Swap PCIE6 and PCIE1 */
-		RCBA32(RPFN) = 0x00043215;
-	}
-
-	reg32 |= 1;
-
-	RCBA32(FD) = reg32;
-
 	/* Enable PCIe Root Port Clock Gate */
 
 }
@@ -272,7 +226,6 @@
 	reg32 &= ~(3 << 0);
 	reg32 |= (1 << 0);
 	RCBA32(0x3430) = reg32;
-	RCBA32(FD) |= (1 << 0);
 	RCBA16(0x0200) = 0x2008;
 	RCBA8(0x2027) = 0x0d;
 	RCBA16(0x3e08) |= (1 << 7);

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If4163f8101d37cc09c0b51b1be20bf8388ed2b89
Gerrit-Change-Number: 30245
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur at aheymans.xyz>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181216/ceb24ff8/attachment.html>


More information about the coreboot-gerrit mailing list