Re: no network access on today's CURRENT

From: John Baldwin <jhb_at_freebsd.org>
Date: Fri, 23 Mar 2007 00:00:00 -0400
On Thursday 22 March 2007 10:35:13 pm David Wolfskill wrote:
> On Thu, Mar 22, 2007 at 03:13:41PM -0700, David Wolfskill wrote:
> > ...
> > Following up on Bruce's suggestion, then, I reverted the files that
> > appeared most likely to be involved to 20 Mar 2007 03:00 (US/Pacific;
> > currently 7 hrs. west of UTC) and re-built the kernel.
> > 
> > A reboot following that exercise yields a functioning wi0:
> >... 
> > Here's a list of the files I reverted (pruned from a list of files that
> > were updated in yesterday's build process), together with the revision
> > level I'm using & the current revision level:
> 
> I was able to trim the list by some experimenting:
>  
> > File				wi0 OK	no wi0
> > sys/dev/acpica/acpi.c		1.231	1.233
> > sys/i386/bios/smapi.c		1.13	1.14
> > sys/i386/bios/smbios.c	1.5	1.6
> > sys/i386/bios/vpd.c		1.5	1.6
> > sys/i386/i386/legacy.c	1.61	1.62
> > sys/i386/i386/nexus.c		1.69	1.71
> >...
> 
> So: the above set of changes makes the difference between my wi0 device
> being seen (or not) during kernel probes.
> 
> The probe messages from this latest (successful) boot related to the wi0
> device are:
> 
> ata0-slave: pio=PIO4 wdma=WDMA2 udma=UDMA33 cable=40 wire
> pcib2: pccard2 requested memory range 0xf4000000-0xfbffffff: good
> pccard2: CIS version PC Card Standard 5.0
> pccard2: CIS info: Dell, TrueMobile 1150 Series PC Card, Version 01.01, 
> pccard2: Manufacturer code 0x156, product 0x2
> pccard2: function 0: network adapter, ccr addr 3e0 mask 1
> pccard2: function 0, config table entry 1: I/O card; irq mask ffff; iomask 
6, iospace 0-3f; io16 irqpulse irqlevel
> pcib2: pccard2 requested I/O range 0xe000-0xffff: in range
> pcib2: pccard2 requested memory range 0xf4000000-0xfbffffff: good
> wi0: <Dell TrueMobile 1150 Series PC Card> at port 0xe000-0xe03f irq 11 
function 0 config 1 on pccard2
> wi0: [MPSAFE]
> wi0: [ITHREAD]
> wi0: using Lucent Embedded WaveLAN/IEEE
> wi0: Lucent Firmware: Station (6.14.1)
> wi0: bpf attached
> wi0: Ethernet address: 00:02:2d:5b:2c:78
> wi0: bpf attached
> wi0: bpf attached
> wi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
> ata0-master: pio=PIO4 wdma=WDMA2 udma=UDMA100 cable=80 wire
> 
> The corresponding messages from a boot that fails to see wi0:
> 
> ata0-slave: pio=PIO4 wdma=WDMA2 udma=UDMA33 cable=40 wire
> pcib2: pccard2 requested memory range 0xf4000000-0xfbffffff: good
> cbb2: set_res_flags: specified resource not active
> CIS is too long -- truncating
> cbb2: set_res_flags: specified resource not active
> pccard2: Card has no functions!
> cbb2: PC Card card activation failed
> ata0-master: pio=PIO4 wdma=WDMA2 udma=UDMA100 cable=80 wire
> 
> Thanks for suggestions; still willing to test.

Actually, this may be due to weirdness in exca.c, it tries to use bus tags and 
bus handles on a resource before it is activated.  I think I see how to fix 
it by making exca_activate_resource() calling BUS_ACTIVATE_RESOURCE() first.

Try this patch:

Index: dev/exca/exca.c
===================================================================
RCS file: /usr/cvs/src/sys/dev/exca/exca.c,v
retrieving revision 1.27
diff -u -r1.27 exca.c
--- dev/exca/exca.c	24 Feb 2007 15:56:06 -0000	1.27
+++ dev/exca/exca.c	23 Mar 2007 03:57:09 -0000
_at__at_ -259,11 +259,11 _at__at_
 		}
 	}
 	if (win >= EXCA_MEM_WINS)
-		return (1);
+		return (ENOSPC);
 	if (((rman_get_start(res) >> EXCA_MEMREG_WIN_SHIFT) & 0xff) != 0 &&
 	    (sc->flags & EXCA_HAS_MEMREG_WIN) == 0) {
 		device_printf(sc->dev, "Does not support mapping above 24M.");
-		return (1);
+		return (EINVAL);
 	}
 
 	sc->mem[win].cardaddr = 0;
_at__at_ -477,7 +477,7 _at__at_
 		}
 	}
 	if (win >= EXCA_IO_WINS)
-		return (1);
+		return (ENOSPC);
 
 	sc->io[win].iot = rman_get_bustag(r);
 	sc->io[win].ioh = rman_get_bushandle(r);
_at__at_ -789,24 +789,25 _at__at_
     int rid, struct resource *res)
 {
 	int err;
-	if (!(rman_get_flags(res) & RF_ACTIVE)) { /* not already activated */
-		switch (type) {
-		case SYS_RES_IOPORT:
-			err = exca_io_map(exca, PCCARD_WIDTH_AUTO, res);
-			break;
-		case SYS_RES_MEMORY:
-			err = exca_mem_map(exca, PCCARD_A_MEM_COM, res);
-			break;
-		default:
-			err = 0;
-			break;
-		}
-		if (err)
-			return (err);
 
+	if (rman_get_flags(res) & RF_ACTIVE)
+		return (0);
+	err = BUS_ACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
+	    type, rid, res);
+	if (err)
+		return (err);
+	switch (type) {
+	case SYS_RES_IOPORT:
+		err = exca_io_map(exca, PCCARD_WIDTH_AUTO, res);
+		break;
+	case SYS_RES_MEMORY:
+		err = exca_mem_map(exca, PCCARD_A_MEM_COM, res);
+		break;
 	}
-	return (BUS_ACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
-		  type, rid, res));
+	if (err)
+		BUS_DEACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
+		    type, rid, res);
+	return (err);
 }
 
 int


-- 
John Baldwin
Received on Fri Mar 23 2007 - 03:00:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:07 UTC