Date: Wed, 6 Apr 2011 19:55:55 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 191107 for review Message-ID: <201104061955.p36JttkD009131@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@191107?ac=10 Change 191107 by jhb@jhb_jhbbsd on 2011/04/06 19:54:51 - Purge some old cruft. Enable SUBTRACTIVE_WITH_WINDOWS by default and remove support for not using it. These bridges do exist. - Add a new SUBTRACTIVE_GROW_WINDOWS knob and enable it by default that causes subtractive PCI-PCI bridges to still try to grow windows like other PCI-PCI bridges. Now what happens is that if all of the normal route for allocating resources fails and the bridge is subtractive, then we will just pass the request up the tree. With this change, the driver now allocates all the same windows as the BIOS on my test machine. - Remove completely wrong commented out code about the ISA enable bit and add a todo item to describe what proper ISA enable support would really entail. Affected files ... .. //depot/projects/pci/sys/dev/pci/pci_pci.c#11 edit Differences ... ==== //depot/projects/pci/sys/dev/pci/pci_pci.c#11 (text+ko) ==== @@ -104,18 +104,15 @@ #ifdef NEW_PCIB /* - * I have seen at least one of these in the wild: - * - * pcib9: <ACPI PCI-PCI bridge> at device 30.0 on pci0 - * pcib9: domain 0 - * pcib9: secondary bus 9 - * pcib9: subordinate bus 9 - * pcib9: I/O decode 0x4000-0x4fff - * pcib9: memory decode 0xda200000-0xda2fffff - * pcib9: prefetched decode 0xd0000000-0xd7ffffff - * pcib9: Subtractively decoded bridge. + * NEW_PCIB todo: + * - test SUBTRACTIVE_GROW_WINDOWS and see if that should be the default + * behavior + * - properly handle the ISA enable bit. If it is set, we should change + * the behavior of the I/O window resource and rman to not allocate the + * blocked ranges (upper 768 bytes of each 1K in the first 64k of the + * I/O port address space). */ -#define SUBTRACTIVE_WITH_WINDOWS +#define SUBTRACTIVE_GROW_WINDOWS /* * Is a resource from a child device sub-allocated from one of our @@ -125,13 +122,6 @@ pcib_is_resource_managed(struct pcib_softc *sc, int type, struct resource *r) { - /* XXX: Can subtractive bridges still use windows? */ -#ifndef SUBTRACTIVE_WITH_WINDOWS - /* Subtractive bridges don't manage resources. */ - if (sc->flags & PCIB_SUBTRACTIVE) - return (0); -#endif - switch (type) { case SYS_RES_IOPORT: return (rman_is_region_manager(r, &sc->io.rman)); @@ -1055,40 +1045,13 @@ return (NULL); } - /* - * XXX: Need similar handling for ISA resources subject to the - * ISA enable bit. - * - * XXX: Err, no. What we need to do is block access to specific - * I/O port ranges when ISA enable is set. - */ -#ifdef notyet - if ((type == SYS_RES_IOPORT && pci_is_isa_ioport_range(start, end)) || - (type == SYS_RES_MEMORY && pci_is_isa_memory_range(start, end))) { - if (sc->bridgectl & PCIB_BCR_ISA_ENABLE) - return (bus_generic_alloc_resource(dev, child, type, - rid, start, end, count, flags)); - else - return (NULL); - } -#endif - -#ifndef SUBTRACTIVE_WITH_WINDOWS - /* - * XXX: What to do about subtractive bridges? Do they have windows? - */ - if (sc->flags & PCIB_SUBTRACTIVE) - return (bus_generic_alloc_resource(dev, child, type, rid, - start, end, count, flags)); -#endif - switch (type) { case SYS_RES_IOPORT: r = pcib_suballoc_resource(sc, &sc->io, child, type, rid, start, end, count, flags); if (r != NULL) break; -#ifdef SUBTRACTIVE_WITH_WINDOWS +#ifndef SUBTRACTIVE_GROW_WINDOWS if (sc->flags & PCIB_SUBTRACTIVE) return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); @@ -1117,7 +1080,7 @@ start, end, count, flags); if (r != NULL) break; -#ifdef SUBTRACTIVE_WITH_WINDOWS +#ifndef SUBTRACTIVE_GROW_WINDOWS if (sc->flags & PCIB_SUBTRACTIVE) return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); @@ -1140,6 +1103,16 @@ return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); } + +#ifdef SUBTRACTIVE_GROW_WINDOWS + /* + * If attempts to suballocate from the window fail but this is a + * subtractive bridge, pass the request up the tree. + */ + if (sc->flags & PCIB_SUBTRACTIVE && r == NULL) + return (bus_generic_alloc_resource(dev, child, type, rid, + start, end, count, flags)); +#endif return (r); } #else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104061955.p36JttkD009131>
