[PATCH] talkative reset

Denis Vlasenko vda
Thu May 15 22:53:14 PDT 2003


On 16 May 2003 00:16, Lukas Zvonar wrote:
> It hangs in cor_sreset (after cor_sreset is printed out)...

I tried to hunt it down too but I could not arrange for heavy
traffic for testing and reset every 5 secs overnight did not produce
a hang. Althought I did hit some buglets to play with (IRQ sharing
problems).

It is good you are able to trigger it.

Okay, we need to narrow it dowm. Try again with this patch.
--
vda

--- hostap_cs.c.orig	Fri May 16 08:32:27 2003
+++ hostap_cs.c	Fri May 16 08:38:04 2003
@@ -224,6 +224,7 @@
 	reg.Action = CS_READ;
 	reg.Offset = CISREG_COR;
 	reg.Value = 0;
+printk(KERN_DEBUG "pccard_cor_sreset read...\n"); yield(); yield(); yield();
 	res = CardServices(AccessConfigurationRegister, local->link->handle,
 			   &reg);
 	if (res != CS_SUCCESS) {
@@ -236,6 +237,7 @@
 
 	reg.Action = CS_WRITE;
 	reg.Value |= COR_SOFT_RESET;
+printk(KERN_DEBUG "pccard_cor_sreset write reset high...\n"); yield(); yield(); yield();
 	res = CardServices(AccessConfigurationRegister, local->link->handle,
 			   &reg);
 	if (res != CS_SUCCESS) {
@@ -247,6 +249,7 @@
 	mdelay(1);
 
 	reg.Value &= ~COR_SOFT_RESET;
+printk(KERN_DEBUG "pccard_cor_sreset write reset low...\n"); yield(); yield(); yield();
 	res = CardServices(AccessConfigurationRegister, local->link->handle,
 			   &reg);
 	if (res != CS_SUCCESS) {
@@ -255,6 +258,7 @@
 		return;
 	}
 
+printk(KERN_DEBUG "pccard_cor_sreset done!\n"); yield(); yield(); yield();
 	mdelay(1);
 }
 
--- hostap_hw.c.orig	Wed Apr 30 06:40:27 2003
+++ hostap_hw.c	Thu May 15 09:08:40 2003
@@ -1270,11 +1270,17 @@
 
 	printk(KERN_WARNING "%s: %s: resetting card\n", dev_info, dev->name);
 	local->hw_resetting = 1;
+printk(KERN_DEBUG "disable_interrupts...\n"); yield();
 	hfa384x_disable_interrupts(dev);
-	if (local->func->cor_sreset)
+	if (local->func->cor_sreset) {
+printk(KERN_DEBUG "cor_sreset...\n"); yield();
 		local->func->cor_sreset(local);
+	}
+printk(KERN_DEBUG "hw_shutdown...\n"); yield();
 	prism2_hw_shutdown(dev, 1);
+printk(KERN_DEBUG "hw_config...\n"); yield();
 	prism2_hw_config(dev, 0);
+printk(KERN_DEBUG "done!\n"); yield();
 	local->hw_resetting = 0;
 }
 
--- hostap_pci.c.orig	Fri Apr 18 07:03:31 2003
+++ hostap_pci.c	Fri May 16 08:51:53 2003
@@ -168,9 +168,6 @@
 /* FIX: This might change at some point.. */
 #include "hostap_hw.c"
 
-/* FIX: can jiffies be used this way from every place cor_sreset could be
- * called? (mainly, spin_lock_irq? hw interrupt handler?) */
-
 static void prism2_pci_cor_sreset(local_info_t *local)
 {
 	struct net_device *dev = local->dev;
@@ -184,28 +181,29 @@
 /* #define PRISM2_PCI_USE_LONG_DELAYS */
 
 #ifdef PRISM2_PCI_USE_LONG_DELAYS
-	int timeout;
-
+	int i;
+	
+printk(KERN_DEBUG "pci_cor_sreset reset high...\n"); yield(); yield(); yield();
 	HFA384X_OUTW(0x0080, HFA384X_PCICOR_OFF);
-	timeout = jiffies + HZ / 4;
-	while (time_before(jiffies, timeout))
-		udelay(5);
+	mdelay(250);
 
+printk(KERN_DEBUG "pci_cor_sreset reset low...\n"); yield(); yield(); yield();
 	HFA384X_OUTW(0x0, HFA384X_PCICOR_OFF);
-	timeout = jiffies + HZ / 2;
-	while (time_before(jiffies, timeout))
-		udelay(5);
+	mdelay(500);
 
+printk(KERN_DEBUG "pci_cor_sreset wait...\n"); yield(); yield(); yield();
 	/* Wait for f/w to complete initialization (CMD:BUSY == 0) */
-	timeout = jiffies + 2 * HZ;
-	while ((HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) &&
-	       time_before(jiffies, timeout))
+	i = 2000000/10;
+	while ((HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) && --i)
 		udelay(10);
+if(!i) printk(KERN_ERR "pci_cor_sreset wait timed out!\n");
 
 #else /* PRISM2_PCI_USE_LONG_DELAYS */
 
+printk(KERN_DEBUG "pci_cor_sreset reset high...\n"); yield(); yield(); yield();
 	HFA384X_OUTW(0x0080, HFA384X_PCICOR_OFF);
 	mdelay(1);
+printk(KERN_DEBUG "pci_cor_sreset reset low...\n"); yield(); yield(); yield();
 	HFA384X_OUTW(0x0, HFA384X_PCICOR_OFF);
 	mdelay(1);
 
@@ -214,6 +212,7 @@
 	if (HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) {
 		printk(KERN_DEBUG "%s: COR sreset timeout\n", dev->name);
 	}
+printk(KERN_DEBUG "pci_cor_sreset done!\n"); yield(); yield(); yield();
 }
 
 
--- hostap_plx.c.orig	Sat Apr 12 22:33:26 2003
+++ hostap_plx.c	Fri May 16 08:42:06 2003
@@ -258,20 +258,25 @@
 	if (local->attr_mem == 0) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
+printk(KERN_DEBUG "plx_cor_sreset reset high...\n"); yield(); yield(); yield();
 		outb(corsave | COR_SRESET, local->cor_offset);
 		mdelay(1);
+printk(KERN_DEBUG "plx_cor_sreset reset low...\n"); yield(); yield(); yield();
 		outb(corsave & ~COR_SRESET, local->cor_offset);
 		mdelay(1);
 	} else {
 		/* PLX9052 */
+printk(KERN_DEBUG "plx_cor_sreset reset high...\n"); yield(); yield(); yield();
 		corsave = readb(local->attr_mem + local->cor_offset);
 		writeb(corsave | COR_SRESET,
 		       local->attr_mem + local->cor_offset);
 		mdelay(1);
+printk(KERN_DEBUG "plx_cor_sreset reset low...\n"); yield(); yield(); yield();
 		writeb(corsave & ~COR_SRESET,
 		       local->attr_mem + local->cor_offset);
 		mdelay(1);
 	}
+printk(KERN_DEBUG "plx_cor_sreset done!\n"); yield(); yield(); yield();
 }
 
 




More information about the Hostap mailing list