Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 18:28:30 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
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
Message-ID:  <201409041828.s84ISUi2073419@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409041828.s84ISUi2073419>