[gPXE] [PATCH] Disable sky2 interrupts until explicitly enabled

Daniel Verkamp daniel at drv.nu
Fri Feb 26 18:02:31 EST 2010


This fixes lockups encountered on normal PC hardware where
EFI is not used: STI in real-mode code triggered the hang.

This changes probe and open so that all sky2 interrupts are
disabled until sky2_net_irq() is called explicitly.
---
 src/drivers/net/sky2.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/drivers/net/sky2.c b/src/drivers/net/sky2.c
index 00940af..d19757a 100644
--- a/src/drivers/net/sky2.c
+++ b/src/drivers/net/sky2.c
@@ -1130,7 +1130,7 @@ static int sky2_up(struct net_device *dev)
 	struct sky2_port *sky2 = netdev_priv(dev);
 	struct sky2_hw *hw = sky2->hw;
 	unsigned port = sky2->port;
-	u32 imask, ramsize;
+	u32 ramsize;
 	int err = -ENOMEM;
 
 	netdev_link_down(dev);
@@ -1198,10 +1198,8 @@ static int sky2_up(struct net_device *dev)
 	if (err)
 		goto err_out;
 
-	/* Enable interrupts from phy/mac for port */
-	imask = sky2_read32(hw, B0_IMSK);
-	imask |= portirq_msk[port];
-	sky2_write32(hw, B0_IMSK, imask);
+	/* Disable interrupts */
+	sky2_write32(hw, B0_IMSK, 0);
 
 	DBGIO(PFX "%s: le bases: st %p [%x], rx %p [%x], tx %p [%x]\n",
 	      dev->name, hw->st_le, hw->st_dma, sky2->rx_le, sky2->rx_le_map,
@@ -2250,9 +2248,11 @@ static void sky2_net_irq(struct net_device *dev, int enable)
 
 	u32 imask = sky2_read32(hw, B0_IMSK);
 	if (enable)
-		imask |= portirq_msk[sky2->port];
+		imask |= portirq_msk[sky2->port] | Y2_IS_BASE;
 	else
 		imask &= ~portirq_msk[sky2->port];
+	if ((imask & ~Y2_IS_BASE) == 0)
+		imask = 0;
 	sky2_write32(hw, B0_IMSK, imask);
 }
 
@@ -2321,8 +2321,6 @@ static int sky2_probe(struct pci_device *pdev,
 		goto err_out_free_netdev;
 	}
 
-	sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
-
 	sky2_show_addr(dev);
 
 	if (hw->ports > 1) {
-- 
1.6.6.1



More information about the gPXE mailing list