Date: Sun, 24 Nov 2002 08:10:02 -0800 (PST) From: Giorgos Keramidas <keramida@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/45637: kern/45637: wi0 device_probe_and_attach returns 6 Message-ID: <200211241610.gAOGA2Lv022440@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/45637; it has been noted by GNATS. From: Giorgos Keramidas <keramida@freebsd.org> To: bug-followup@freebsd.org Cc: Subject: Re: kern/45637: kern/45637: wi0 device_probe_and_attach returns 6 Date: Sun, 24 Nov 2002 18:05:07 +0200 Add to audit trail multiple followups that were misfiled... :===================================================================== : : Message-Id: <20021123.012811.85895040.imp@bsdimp.com> : In-Reply-To: <200211230800.gAN80Wig000699@dhcp2.gsicomp.on.ca> : Date: Sat, 23 Nov 2002 01:28:11 -0700 (MST) : From: "M. Warner Losh" <imp@bsdimp.com> : : This patch isn't quite right, but I can see it might work for you. : However, it does show that I've been ignoring the pmem* part of the : bridge and need to correct that. Looks like the following patch will : do the trick. This might let us get rid of unsupported ranges, or at : least reduce its need. This should also make the nvida people happier : too, I hope, since they need this since their card is mapped in : non-prefetchable region. : : # still need fix it so drivers can request prefetch or non-prefetch : # memory on their own. Cardbus needs this, for example. : : ==== //depot/user/imp/newcard/dev/pci/pci_pci.c#8 - /dell/imp/p4/newcard/src/sys/dev/pci/pci_pci.c ==== : @@ -282,6 +282,7 @@ : u_long start, u_long end, u_long count, u_int flags) : { : struct pcib_softc *sc = device_get_softc(dev); : + int ok; : : /* : * If this is a "default" allocation against this rid, we can't work : @@ -299,14 +300,18 @@ : */ : switch (type) { : case SYS_RES_IOPORT: : + ok = 1; : if (!pcib_is_isa_io(start)) { : if (!pci_allow_unsupported_io_range) { : if (start < sc->iobase) : start = sc->iobase; : if (end > sc->iolimit) : end = sc->iolimit; : - if (end < start) : + if (end < start) { : start = 0; : + end = 0; : + ok = 0; : + } : } else { : if (start < sc->iobase) : printf("start (%lx) < sc->iobase (%x)\n", start, : @@ -318,12 +323,11 @@ : printf("end (%lx) < start (%lx)\n", end, start); : } : } : - if (!pcib_is_isa_io(start) && : - ((start < sc->iobase) || (end > sc->iolimit))) { : - device_printf(dev, "device %s%d requested unsupported I/O range 0x%lx-0x%lx" : - " (decoding 0x%x-0x%x)\n", : - device_get_name(child), device_get_unit(child), start, end, : - sc->iobase, sc->iolimit); : + if (!ok) { : + device_printf(dev, "device %s%d requested unsupported I/O " : + "range 0x%lx-0x%lx (decoding 0x%x-0x%x)\n", : + device_get_name(child), device_get_unit(child), start, end, : + sc->iobase, sc->iolimit); : return (NULL); : } : if (bootverbose) : @@ -332,20 +336,35 @@ : break; : : /* : - * XXX will have to decide whether the device making the request is asking : - * for prefetchable memory or not. If it's coming from another bridge : - * down the line, do we assume not, or ask the bridge to pass in another : - * flag as the request bubbles up? : + * XXX will have to decide whether the device making the request : + * is asking for prefetchable memory or not. If it's coming : + * from another bridge down the line, do we assume not, or ask : + * the bridge to pass in another flag as the request bubbles up? : */ : case SYS_RES_MEMORY: : + ok = 1; : if (!pcib_is_isa_mem(start)) { : if (!pci_allow_unsupported_io_range) { : - if (start < sc->membase && end >= sc->membase) : - start = sc->membase; : - if (end > sc->memlimit) : - end = sc->memlimit; : - if (end < start) : - start = 0; : + ok = 0; : + if (sc->membase > sc->memlimit) : + ok = ok || : + (start >= sc->membase && end <= sc->memlimit); : + if (sc->pmembase > sc->pmemlimit) : + ok = ok || : + (start >= sc->pmembase && end <= sc->pmemlimit); : + if (!ok) { : + /* XXX Assume non-prefetchable */ : + if (start < sc->membase) : + start = sc->membase; : + if (end > sc->memlimit) : + end = sc->memlimit; : + ok = true; : + if (end < start) { : + start = 0; : + end = 0; : + ok = false; : + } : + } : } else { : if (start < sc->membase && end > sc->membase) : printf("start (%lx) < sc->membase (%x)\n", : @@ -357,19 +376,15 @@ : printf("end (%lx) < start (%lx)\n", end, start); : } : } : - if (!pcib_is_isa_mem(start) && : - (((start < sc->membase) || (end > sc->memlimit)) && : - ((start < sc->pmembase) || (end > sc->pmemlimit)))) { : - if (bootverbose) : - device_printf(dev, : - "device %s%d requested unsupported memory range " : - "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n", : - device_get_name(child), device_get_unit(child), start, : - end, sc->membase, sc->memlimit, sc->pmembase, : - sc->pmemlimit); : - if (!pci_allow_unsupported_io_range) : - return (NULL); : - } : + if (!ok && bootverbose) : + device_printf(dev, : + "device %s%d requested unsupported memory range " : + "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n", : + device_get_name(child), device_get_unit(child), start, : + end, sc->membase, sc->memlimit, sc->pmembase, : + sc->pmemlimit); : + if (!ok) : + return (NULL); : if (bootverbose) : device_printf(sc->dev, "device %s%d requested decoded memory range 0x%lx-0x%lx\n", : device_get_name(child), device_get_unit(child), start, end); : :===================================================================== : : Message-Id: <20021123.012850.91094754.imp@bsdimp.com> : In-Reply-To: <200211230800.gAN80Wig000699@dhcp2.gsicomp.on.ca> : Date: Sat, 23 Nov 2002 01:28:50 -0700 (MST) : From: "M. Warner Losh" <imp@bsdimp.com> : : P.S. s/true/1/g;s/false/0/g : :===================================================================== : : Message-Id: <20021123.013939.109040651.imp@bsdimp.com> : In-Reply-To: <200211230800.gAN80Wig000699@dhcp2.gsicomp.on.ca> : Date: Sat, 23 Nov 2002 01:39:39 -0700 (MST) : From: "M. Warner Losh" <imp@bsdimp.com> : : Actually, I think this patch has all the comparisons going the right : way. : : Warner : : --- //depot/user/imp/freebsd-imp/sys/dev/pci/pci_pci.c 2002/11/14 23:02:51 : +++ //depot/user/imp/newcard/dev/pci/pci_pci.c 2002/11/23 00:35:32 : @@ -282,6 +282,7 @@ : u_long start, u_long end, u_long count, u_int flags) : { : struct pcib_softc *sc = device_get_softc(dev); : + int ok; : : /* : * If this is a "default" allocation against this rid, we can't work : @@ -299,14 +300,18 @@ : */ : switch (type) { : case SYS_RES_IOPORT: : + ok = 1; : if (!pcib_is_isa_io(start)) { : if (!pci_allow_unsupported_io_range) { : if (start < sc->iobase) : start = sc->iobase; : if (end > sc->iolimit) : end = sc->iolimit; : - if (end < start) : + if (end < start) { : start = 0; : + end = 0; : + ok = 0; : + } : } else { : if (start < sc->iobase) : printf("start (%lx) < sc->iobase (%x)\n", start, : @@ -318,12 +323,11 @@ : printf("end (%lx) < start (%lx)\n", end, start); : } : } : - if (!pcib_is_isa_io(start) && : - ((start < sc->iobase) || (end > sc->iolimit))) { : - device_printf(dev, "device %s%d requested unsupported I/O range 0x%lx-0x%lx" : - " (decoding 0x%x-0x%x)\n", : - device_get_name(child), device_get_unit(child), start, end, : - sc->iobase, sc->iolimit); : + if (!ok) { : + device_printf(dev, "device %s%d requested unsupported I/O " : + "range 0x%lx-0x%lx (decoding 0x%x-0x%x)\n", : + device_get_name(child), device_get_unit(child), start, end, : + sc->iobase, sc->iolimit); : return (NULL); : } : if (bootverbose) : @@ -332,44 +336,64 @@ : break; : : /* : - * XXX will have to decide whether the device making the request is asking : - * for prefetchable memory or not. If it's coming from another bridge : - * down the line, do we assume not, or ask the bridge to pass in another : - * flag as the request bubbles up? : + * XXX will have to decide whether the device making the request : + * is asking for prefetchable memory or not. If it's coming : + * from another bridge down the line, do we assume not, or ask : + * the bridge to pass in another flag as the request bubbles up? : */ : case SYS_RES_MEMORY: : + ok = 1; : if (!pcib_is_isa_mem(start)) { : + ok = 0; : + if (sc->membase > 0 && sc->membase < sc->memlimit) : + ok = ok || (start >= sc->membase && end <= sc->memlimit); : + if (sc->membase > 0 && sc->pmembase < sc->pmemlimit) : + ok = ok || (start >= sc->pmembase && end <= sc->pmemlimit); : if (!pci_allow_unsupported_io_range) { : - if (start < sc->membase && end >= sc->membase) : - start = sc->membase; : - if (end > sc->memlimit) : - end = sc->memlimit; : + if (!ok) { : + /* XXX Assume non-prefetchable */ : + if (start < sc->membase) : + start = sc->membase; : + if (end > sc->memlimit) : + end = sc->memlimit; : + ok = 1; : + if (end < start) { : + start = 0; : + end = 0; : + ok = 0; : + } : + } : + } else if (!ok) { : + ok = 1; /* pci_allow_unsupported_ranges -> always ok */ : + if (sc->membase > 0 && sc->membase < sc->memlimit) { : + if (start < sc->membase) : + printf("start (%lx) < sc->membase (%x)\n", : + start, sc->membase); : + if (end > sc->memlimit) : + printf("end (%lx) > sc->memlimit (%x)\n", : + end, sc->memlimit); : + } : + if (sc->pmembase > 0 && sc->pmembase < sc->pmemlimit) { : + if (start < sc->pmembase) : + printf("start (%lx) < sc->pmembase (%x)\n", : + start, sc->pmembase); : + if (end > sc->pmemlimit) : + printf("end (%lx) > sc->pmemlimit (%x)\n", : + end, sc->memlimit); : + } : if (end < start) : - start = 0; : - } else { : - if (start < sc->membase && end > sc->membase) : - printf("start (%lx) < sc->membase (%x)\n", : - start, sc->membase); : - if (end > sc->memlimit) : - printf("end (%lx) > sc->memlimit (%x)\n", : - end, sc->memlimit); : - if (end < start) : printf("end (%lx) < start (%lx)\n", end, start); : } : } : - if (!pcib_is_isa_mem(start) && : - (((start < sc->membase) || (end > sc->memlimit)) && : - ((start < sc->pmembase) || (end > sc->pmemlimit)))) { : - if (bootverbose) : - device_printf(dev, : - "device %s%d requested unsupported memory range " : - "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n", : - device_get_name(child), device_get_unit(child), start, : - end, sc->membase, sc->memlimit, sc->pmembase, : - sc->pmemlimit); : - if (!pci_allow_unsupported_io_range) : - return (NULL); : - } : + if (!ok && bootverbose) : + device_printf(dev, : + "device %s%d requested unsupported memory range " : + "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n", : + device_get_name(child), device_get_unit(child), start, : + end, sc->membase, sc->memlimit, sc->pmembase, : + sc->pmemlimit); : + if (!ok) : + return (NULL); : if (bootverbose) : device_printf(sc->dev, "device %s%d requested decoded memory range 0x%lx-0x%lx\n", : device_get_name(child), device_get_unit(child), start, end); : :===================================================================== : : Message-Id: <20021123091751.GJ1766@unixpages.org> : In-Reply-To: <20021123.013939.109040651.imp@bsdimp.com> : Date: Sat, 23 Nov 2002 10:17:52 +0100 : From: Christian Brueffer <chris@unixpages.org> : : On Sat, Nov 23, 2002 at 01:39:39AM -0700, M. Warner Losh wrote: : > Actually, I think this patch has all the comparisons going the right : > way. : : Hi, : : your patch has fixed it for me. Thanks! : : - Christian : :===================================================================== : : Message-Id: <20021123.101017.55148442.imp@bsdimp.com> : In-Reply-To: <20021123091751.GJ1766@unixpages.org> : Date: Sat, 23 Nov 2002 10:10:17 -0700 (MST) : From: "M. Warner Losh" <imp@bsdimp.com> : : In message: <20021123091751.GJ1766@unixpages.org> : Christian Brueffer <chris@unixpages.org> writes: : : your patch has fixed it for me. Thanks! : : Thanks for the info! : : Warner : :===================================================================== To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211241610.gAOGA2Lv022440>