From owner-svn-src-all@FreeBSD.ORG Sat Oct 30 23:09:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A5E81065673; Sat, 30 Oct 2010 23:09:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DFEB8FC14; Sat, 30 Oct 2010 23:09:56 +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 o9UN9uqn029906; Sat, 30 Oct 2010 23:09:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UN9uA7029904; Sat, 30 Oct 2010 23:09:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010302309.o9UN9uA7029904@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 30 Oct 2010 23:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214575 - head/sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 23:09:56 -0000 Author: nwhitehorn Date: Sat Oct 30 23:09:56 2010 New Revision: 214575 URL: http://svn.freebsd.org/changeset/base/214575 Log: Allow access to the HT I/O port space on the IBM CPC9X5 northbridge chips. MFC after: 2 weeks Modified: head/sys/powerpc/powermac/cpcht.c Modified: head/sys/powerpc/powermac/cpcht.c ============================================================================== --- head/sys/powerpc/powermac/cpcht.c Sat Oct 30 23:07:30 2010 (r214574) +++ head/sys/powerpc/powermac/cpcht.c Sat Oct 30 23:09:56 2010 (r214575) @@ -162,6 +162,7 @@ struct cpcht_softc { vm_offset_t sc_data; uint64_t sc_populated_slots; struct rman sc_mem_rman; + struct rman sc_io_rman; struct cpcht_irq htirq_map[128]; struct mtx htirq_mtx; @@ -177,6 +178,9 @@ static devclass_t cpcht_devclass; DRIVER_MODULE(cpcht, nexus, cpcht_driver, cpcht_devclass, 0, 0); +#define CPCHT_IOPORT_BASE 0xf4000000UL /* Hardwired */ +#define CPCHT_IOPORT_SIZE 0x00400000UL + #define HTAPIC_REQUEST_EOI 0x20 #define HTAPIC_TRIGGER_LEVEL 0x02 #define HTAPIC_MASK 0x01 @@ -236,7 +240,14 @@ cpcht_attach(device_t dev) sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "CPCHT Device Memory"; error = rman_init(&sc->sc_mem_rman); + if (error) { + device_printf(dev, "rman_init() failed. error = %d\n", error); + return (error); + } + sc->sc_io_rman.rm_type = RMAN_ARRAY; + sc->sc_io_rman.rm_descr = "CPCHT I/O Memory"; + error = rman_init(&sc->sc_io_rman); if (error) { device_printf(dev, "rman_init() failed. error = %d\n", error); return (error); @@ -248,6 +259,9 @@ cpcht_attach(device_t dev) * where we get the HT interrupts properties. */ + /* I/O port mappings are usually not in the device tree */ + rman_manage_region(&sc->sc_io_rman, 0, CPCHT_IOPORT_SIZE - 1); + bzero(sc->htirq_map, sizeof(sc->htirq_map)); mtx_init(&sc->htirq_mtx, "cpcht irq", NULL, MTX_DEF); for (i = 0; i < 8; i++) @@ -299,6 +313,9 @@ cpcht_configure_htbridge(device_t dev, p case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; case OFW_PCI_PHYS_HI_SPACE_IO: + rman_manage_region(&sc->sc_io_rman, rp->pci_lo, + rp->pci_lo + rp->size_lo - 1); + break; case OFW_PCI_PHYS_HI_SPACE_MEM32: rman_manage_region(&sc->sc_mem_rman, rp->pci_lo, rp->pci_lo + rp->size_lo - 1); @@ -507,8 +524,9 @@ cpcht_alloc_resource(device_t bus, devic switch (type) { case SYS_RES_IOPORT: end = min(end, start + count); + rm = &sc->sc_io_rman; + break; - /* FALLTHROUGH */ case SYS_RES_MEMORY: rm = &sc->sc_mem_rman; break; @@ -562,6 +580,9 @@ cpcht_activate_resource(device_t bus, de start = (vm_offset_t)rman_get_start(res); + if (type == SYS_RES_IOPORT) + start += CPCHT_IOPORT_BASE; + if (bootverbose) printf("cpcht mapdev: start %zx, len %ld\n", start, rman_get_size(res));