From owner-svn-src-projects@FreeBSD.ORG Fri May 14 03:54:54 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15B60106566B; Fri, 14 May 2010 03:54:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04F8E8FC14; Fri, 14 May 2010 03:54:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4E3srj7039565; Fri, 14 May 2010 03:54:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4E3srMb039562; Fri, 14 May 2010 03:54:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201005140354.o4E3srMb039562@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 14 May 2010 03:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208058 - projects/ppc64/sys/powerpc/powermac X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2010 03:54:54 -0000 Author: nwhitehorn Date: Fri May 14 03:54:53 2010 New Revision: 208058 URL: http://svn.freebsd.org/changeset/base/208058 Log: Connect up the Uninorth PCI code to the PCI Express bus found on the U4, which is just different enough from the U3 to be irritating. Modified: projects/ppc64/sys/powerpc/powermac/uninorthpci.c projects/ppc64/sys/powerpc/powermac/uninorthvar.h Modified: projects/ppc64/sys/powerpc/powermac/uninorthpci.c ============================================================================== --- projects/ppc64/sys/powerpc/powermac/uninorthpci.c Fri May 14 03:01:53 2010 (r208057) +++ projects/ppc64/sys/powerpc/powermac/uninorthpci.c Fri May 14 03:54:53 2010 (r208058) @@ -151,9 +151,12 @@ uninorth_probe(device_t dev) if (strcmp(compatible, "uni-north") == 0) { device_set_desc(dev, "Apple UniNorth Host-PCI bridge"); return (0); - } else if (strcmp(compatible,"u3-agp") == 0) { + } else if (strcmp(compatible, "u3-agp") == 0) { device_set_desc(dev, "Apple U3 Host-AGP bridge"); return (0); + } else if (strcmp(compatible, "u4-pcie") == 0) { + device_set_desc(dev, "IBM CPC945 PCI Express Root"); + return (0); } return (ENXIO); @@ -165,7 +168,7 @@ uninorth_attach(device_t dev) struct uninorth_softc *sc; const char *compatible; phandle_t node; - u_int32_t reg[2], busrange[2]; + u_int32_t reg[3], busrange[2]; struct uninorth_range *rp, *io, *mem[2]; int nmem, i, error; @@ -178,14 +181,16 @@ uninorth_attach(device_t dev) if (OF_getprop(node, "bus-range", busrange, sizeof(busrange)) != 8) return (ENXIO); - sc->sc_u3 = 0; + sc->sc_ver = 0; compatible = ofw_bus_get_compat(dev); - if (strcmp(compatible,"u3-agp") == 0) - sc->sc_u3 = 1; + if (strcmp(compatible, "u3-agp") == 0) + sc->sc_ver = 3; + if (strcmp(compatible, "u4-pcie") == 0) + sc->sc_ver = 4; sc->sc_dev = dev; sc->sc_node = node; - if (sc->sc_u3) { + if (sc->sc_ver >= 3) { sc->sc_addr = (vm_offset_t)pmap_mapdev(reg[1] + 0x800000, PAGE_SIZE); sc->sc_data = (vm_offset_t)pmap_mapdev(reg[1] + 0xc00000, PAGE_SIZE); } else { @@ -195,7 +200,7 @@ uninorth_attach(device_t dev) sc->sc_bus = busrange[0]; bzero(sc->sc_range, sizeof(sc->sc_range)); - if (sc->sc_u3) { + if (sc->sc_ver >= 3) { /* * On Apple U3 systems, we have an otherwise standard * Uninorth controller driving AGP. The one difference @@ -495,9 +500,16 @@ uninorth_enable_config(struct uninorth_s return (0); } - if (sc->sc_bus == bus) { + /* + * Issue type 0 configuration space accesses for the root bus. + * + * NOTE: On U4, issue only type 1 accesses. There is a secret + * PCI Express <-> PCI Express bridge not present in the device tree, + * and we need to route all of our configuration space through it. + */ + if (sc->sc_bus == bus && sc->sc_ver < 4) { /* - * No slots less than 11 on the primary bus + * No slots less than 11 on the primary bus on U3 and lower */ if (slot < 11) return (0); @@ -508,6 +520,10 @@ uninorth_enable_config(struct uninorth_s (reg & 0xfc) | 1; } + /* Set extended register bits on U4 */ + if (sc->sc_ver == 4) + cfgval |= (reg >> 8) << 28; + do { out32rb(sc->sc_addr, cfgval); } while (in32rb(sc->sc_addr) != cfgval); @@ -526,44 +542,3 @@ uninorth_get_node(device_t bus, device_t return sc->sc_node; } -/* - * Driver to swallow UniNorth host bridges from the PCI bus side. - */ -static int -unhb_probe(device_t dev) -{ - - if (pci_get_class(dev) == PCIC_BRIDGE && - pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { - device_set_desc(dev, "Host to PCI bridge"); - device_quiet(dev); - return (-10000); - } - - return (ENXIO); -} - -static int -unhb_attach(device_t dev) -{ - - return (0); -} - -static device_method_t unhb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, unhb_probe), - DEVMETHOD(device_attach, unhb_attach), - - { 0, 0 } -}; - -static driver_t unhb_driver = { - "unhb", - unhb_methods, - 1, -}; -static devclass_t unhb_devclass; - -DRIVER_MODULE(unhb, pci, unhb_driver, unhb_devclass, 0, 0); - Modified: projects/ppc64/sys/powerpc/powermac/uninorthvar.h ============================================================================== --- projects/ppc64/sys/powerpc/powermac/uninorthvar.h Fri May 14 03:01:53 2010 (r208057) +++ projects/ppc64/sys/powerpc/powermac/uninorthvar.h Fri May 14 03:54:53 2010 (r208058) @@ -63,7 +63,7 @@ struct uninorth_softc { bus_dma_tag_t sc_dmat; struct ofw_bus_iinfo sc_pci_iinfo; - int sc_u3; + int sc_ver; }; struct unin_chip_softc {