From owner-svn-src-all@FreeBSD.ORG Thu Sep 4 18:28:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 033C2493; Thu, 4 Sep 2014 18:28:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D716E1294; Thu, 4 Sep 2014 18:28:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s84ISUhG073421; Thu, 4 Sep 2014 18:28:30 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s84ISUi2073419; Thu, 4 Sep 2014 18:28:30 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201409041828.s84ISUi2073419@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 4 Sep 2014 18:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r271114 - stable/10/sys/powerpc/ps3 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Thu, 04 Sep 2014 18:28:31 -0000 Author: nwhitehorn Date: Thu Sep 4 18:28:30 2014 New Revision: 271114 URL: http://svnweb.freebsd.org/changeset/base/271114 Log: MFC r265883,268898: Repair bitrot in PS3 memory and interrupt allocation. Modified: stable/10/sys/powerpc/ps3/platform_ps3.c stable/10/sys/powerpc/ps3/ps3bus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/ps3/platform_ps3.c ============================================================================== --- stable/10/sys/powerpc/ps3/platform_ps3.c Thu Sep 4 18:24:47 2014 (r271113) +++ stable/10/sys/powerpc/ps3/platform_ps3.c Thu Sep 4 18:28:30 2014 (r271114) @@ -110,14 +110,6 @@ ps3_probe(platform_t plat) static int ps3_attach(platform_t plat) { - uint64_t junk; - int count; - struct mem_region avail_regions[2]; - - ps3_mem_regions(plat, NULL, NULL, avail_regions, &count); - - lv1_allocate_memory(avail_regions[1].mr_size, 24 /* 16 MB pages */, - 0, 0x04 /* any address */, &avail_regions[1].mr_start, &junk); pmap_mmu_install("mmu_ps3", BUS_PROBE_SPECIFIC); cpu_idle_hook = ps3_cpu_idle; @@ -152,6 +144,11 @@ ps3_mem_regions(platform_t plat, struct /* Convert to maximum amount we can allocate in 16 MB pages */ avail_regions[1].mr_size -= avail_regions[0].mr_size; avail_regions[1].mr_size -= avail_regions[1].mr_size % (16*1024*1024); + + /* Allocate extended memory region */ + lv1_allocate_memory(avail_regions[1].mr_size, 24 /* 16 MB pages */, + 0, 0x04 /* any address */, &avail_regions[1].mr_start, &junk); + *availsz = 2; if (phys != NULL) { Modified: stable/10/sys/powerpc/ps3/ps3bus.c ============================================================================== --- stable/10/sys/powerpc/ps3/ps3bus.c Thu Sep 4 18:24:47 2014 (r271113) +++ stable/10/sys/powerpc/ps3/ps3bus.c Thu Sep 4 18:28:30 2014 (r271114) @@ -127,6 +127,7 @@ static device_method_t ps3bus_methods[] struct ps3bus_softc { struct rman sc_mem_rman; + struct rman sc_intr_rman; struct mem_region *regions; int rcount; }; @@ -328,7 +329,11 @@ ps3bus_attach(device_t self) sc = device_get_softc(self); sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "PS3Bus Memory Mapped I/O"; + sc->sc_intr_rman.rm_type = RMAN_ARRAY; + sc->sc_intr_rman.rm_descr = "PS3Bus Interrupts"; rman_init(&sc->sc_mem_rman); + rman_init(&sc->sc_intr_rman); + rman_manage_region(&sc->sc_intr_rman, 0, ~0); /* Get memory regions for DMA */ mem_regions(&sc->regions, &sc->rcount, &sc->regions, &sc->rcount); @@ -562,8 +567,13 @@ ps3bus_alloc_resource(device_t bus, devi rm = &sc->sc_mem_rman; break; case SYS_RES_IRQ: - return (resource_list_alloc(&dinfo->resources, bus, child, - type, rid, start, end, count, flags)); + rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, + *rid); + rm = &sc->sc_intr_rman; + adjstart = rle->start; + adjcount = ulmax(count, rle->count); + adjend = ulmax(rle->end, rle->start + adjcount - 1); + break; default: device_printf(bus, "unknown resource request from %s\n", device_get_nameunit(child));