Date: Wed, 27 Apr 2011 17:45:53 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 192198 for review Message-ID: <201104271745.p3RHjrfq029450@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@192198?ac=10 Change 192198 by jhb@jhb_jhbbsd on 2011/04/27 17:45:29 - If we fail to allocate the initial window, disable the window. - Make sure we don't pass RF_ACTIVE up to the PCI bus when allocating the initial resource when growing a window. - Enable memory or I/O decoding when first activating a window. Affected files ... .. //depot/projects/pci/sys/dev/pci/pci_pci.c#15 edit Differences ... ==== //depot/projects/pci/sys/dev/pci/pci_pci.c#15 (text+ko) ==== @@ -60,6 +60,7 @@ static int pcib_resume(device_t dev); static int pcib_power_for_sleep(device_t pcib, device_t dev, int *pstate); +static void pcib_write_windows(struct pcib_softc *sc, int mask); static device_method_t pcib_methods[] = { /* Device interface */ @@ -146,7 +147,20 @@ return (pw->valid && pw->base < pw->limit); } +/* + * XXX: If RF_ACTIVE did not also imply allocating a bus space tag and + * handle for the resource, we could pass RF_ACTIVE up to the PCI bus + * when allocating the resource windows and rely on the PCI bus driver + * to do this for us. + */ static void +pcib_activate_window(struct pcib_softc *sc, int type) +{ + + PCI_ENABLE_IO(device_get_parent(sc->dev), sc->dev, type); +} + +static void pcib_alloc_window(struct pcib_softc *sc, struct pcib_window *w, int type, int flags, pci_addr_t max_address) { @@ -181,8 +195,12 @@ device_printf(sc->dev, "failed to allocate initial %s window: %#jx-%#jx\n", w->name, (uintmax_t)w->base, (uintmax_t)w->limit); + w->base = max_address; + w->limit = 0; + pcib_write_windows(sc, w->mask); return; } + pcib_activate_window(sc, type); error = rman_manage_region(&w->rman, rman_get_start(w->res), rman_get_end(w->res)); @@ -859,7 +877,7 @@ count = roundup2(count, 1ul << w->step); rid = w->reg; w->res = bus_alloc_resource(sc->dev, type, &rid, start, end, - count, flags); + count, flags & ~RF_ACTIVE); if (w->res == NULL) { if (bootverbose) device_printf(sc->dev, @@ -883,6 +901,7 @@ w->res = NULL; return (error); } + pcib_activate_window(sc, type); goto updatewin; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104271745.p3RHjrfq029450>