summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powermac
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-14 14:17:51 +0000
committerian <ian@FreeBSD.org>2014-05-14 14:17:51 +0000
commit1baea4807a7a800ea024080ecb08d8018d423b35 (patch)
tree8bba76de8ef5301e1c8c1469cba379463335efa1 /sys/powerpc/powermac
parent796f2c87ad85df08fa64cd699bc66b9054363166 (diff)
downloadFreeBSD-src-1baea4807a7a800ea024080ecb08d8018d423b35.zip
FreeBSD-src-1baea4807a7a800ea024080ecb08d8018d423b35.tar.gz
MFC r258800, r258802, r258805, r258806, r258807, r258851, r258857,
r259199, r259484, r259513, r259514, r259516 The kernel stack guard pages are only below the stack pointer, not above. Remove unnecessary double-setting of the thread's onfault state in copyinstr(). Open Firmware mandates that certain cross-references, in particular those in /chosen, be ihandles. The ePAPR spec makes those cross-reference phandles, since FDT has no concept of ihandles. Have the OF FDT CI module interpret queries about ihandles as cross-reference phandles. Real OF systems have an ihandle under /chosen/stdout, not a phandle. Use the right type. Rearchitect platform memory map parsing to make it less Open Firmware-centric. Remove fdtbus_bs_tag definition, which is now obsolete. The remainder of this file is also slated for future demolition. Return the correct IEEE 1275 code for "nextprop". Use the common Open Firmware PCI interrupt routing code instead of the duplicate version in dev/fdt. Configure interrupt sense based on device tree information. Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf internally instead of requiring the caller to allocate it.
Diffstat (limited to 'sys/powerpc/powermac')
-rw-r--r--sys/powerpc/powermac/platform_powermac.c60
1 files changed, 55 insertions, 5 deletions
diff --git a/sys/powerpc/powermac/platform_powermac.c b/sys/powerpc/powermac/platform_powermac.c
index ce73622..3e1bf7a 100644
--- a/sys/powerpc/powermac/platform_powermac.c
+++ b/sys/powerpc/powermac/platform_powermac.c
@@ -58,8 +58,8 @@ extern void *ap_pcpu;
static int powermac_probe(platform_t);
static int powermac_attach(platform_t);
-void powermac_mem_regions(platform_t, struct mem_region **phys, int *physsz,
- struct mem_region **avail, int *availsz);
+void powermac_mem_regions(platform_t, struct mem_region *phys, int *physsz,
+ struct mem_region *avail, int *availsz);
static u_long powermac_timebase_freq(platform_t, struct cpuref *cpuref);
static int powermac_smp_first_cpu(platform_t, struct cpuref *cpuref);
static int powermac_smp_next_cpu(platform_t, struct cpuref *cpuref);
@@ -117,10 +117,60 @@ powermac_probe(platform_t plat)
}
void
-powermac_mem_regions(platform_t plat, struct mem_region **phys, int *physsz,
- struct mem_region **avail, int *availsz)
+powermac_mem_regions(platform_t plat, struct mem_region *phys, int *physsz,
+ struct mem_region *avail, int *availsz)
{
- ofw_mem_regions(phys,physsz,avail,availsz);
+ phandle_t memory;
+ cell_t memoryprop[PHYS_AVAIL_SZ * 2];
+ ssize_t propsize, i, j;
+ int physacells = 1;
+
+ memory = OF_finddevice("/memory");
+
+ /* "reg" has variable #address-cells, but #size-cells is always 1 */
+ OF_getprop(OF_parent(memory), "#address-cells", &physacells,
+ sizeof(physacells));
+
+ propsize = OF_getprop(memory, "reg", memoryprop, sizeof(memoryprop));
+ propsize /= sizeof(cell_t);
+ for (i = 0, j = 0; i < propsize; i += physacells+1, j++) {
+ phys[j].mr_start = memoryprop[i];
+ if (physacells == 2) {
+#ifndef __powerpc64__
+ /* On 32-bit PPC, ignore regions starting above 4 GB */
+ if (memoryprop[i] != 0) {
+ j--;
+ continue;
+ }
+#else
+ phys[j].mr_start <<= 32;
+#endif
+ phys[j].mr_start |= memoryprop[i+1];
+ }
+ phys[j].mr_size = memoryprop[i + physacells];
+ }
+ *physsz = j;
+
+ /* "available" always has #address-cells = 1 */
+ propsize = OF_getprop(memory, "available", memoryprop,
+ sizeof(memoryprop));
+ propsize /= sizeof(cell_t);
+ for (i = 0, j = 0; i < propsize; i += 2, j++) {
+ avail[j].mr_start = memoryprop[i];
+ avail[j].mr_size = memoryprop[i + 1];
+ }
+
+#ifdef __powerpc64__
+ /* Add in regions above 4 GB to the available list */
+ for (i = 0; i < *physsz; i++) {
+ if (phys[i].mr_start > BUS_SPACE_MAXADDR_32BIT) {
+ avail[j].mr_start = phys[i].mr_start;
+ avail[j].mr_size = phys[i].mr_size;
+ j++;
+ }
+ }
+#endif
+ *availsz = j;
}
static int
OpenPOWER on IntegriCloud