svn commit: r276515 - in head/sys/powerpc: aim conf ofw pseries
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Thu Jan 1 22:26:14 UTC 2015
Author: nwhitehorn
Date: Thu Jan 1 22:26:12 2015
New Revision: 276515
URL: https://svnweb.freebsd.org/changeset/base/276515
Log:
Allow booting with both a real Open Firmware tree and a flattened version of
the Open Firmware, as provided by petitboot, for example. Note that this is
not quite complete, since RTAS instantiation still depends on callable
firmware.
MFC after: 2 weeks
Modified:
head/sys/powerpc/aim/mmu_oea64.c
head/sys/powerpc/conf/GENERIC64
head/sys/powerpc/ofw/ofw_machdep.c
head/sys/powerpc/pseries/xics.c
Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c Thu Jan 1 22:20:19 2015 (r276514)
+++ head/sys/powerpc/aim/mmu_oea64.c Thu Jan 1 22:26:12 2015 (r276515)
@@ -188,6 +188,7 @@ extern unsigned char _etext[];
extern unsigned char _end[];
extern int dumpsys_minidump;
+extern int ofw_real_mode;
/*
* Map of physical memory regions.
@@ -850,7 +851,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_off
ihandle_t mmui;
phandle_t chosen;
phandle_t mmu;
- size_t sz;
+ ssize_t sz;
int i;
vm_offset_t pa, va;
void *dpcpu;
@@ -861,15 +862,17 @@ moea64_late_bootstrap(mmu_t mmup, vm_off
*/
chosen = OF_finddevice("/chosen");
- if (chosen != -1 && OF_getprop(chosen, "mmu", &mmui, 4) != -1) {
- mmu = OF_instance_to_package(mmui);
- if (mmu == -1 || (sz = OF_getproplen(mmu, "translations")) == -1)
- sz = 0;
- if (sz > 6144 /* tmpstksz - 2 KB headroom */)
- panic("moea64_bootstrap: too many ofw translations");
+ if (!ofw_real_mode && chosen != -1 &&
+ OF_getprop(chosen, "mmu", &mmui, 4) != -1) {
+ mmu = OF_instance_to_package(mmui);
+ if (mmu == -1 ||
+ (sz = OF_getproplen(mmu, "translations")) == -1)
+ sz = 0;
+ if (sz > 6144 /* tmpstksz - 2 KB headroom */)
+ panic("moea64_bootstrap: too many ofw translations");
- if (sz > 0)
- moea64_add_ofw_mappings(mmup, mmu, sz);
+ if (sz > 0)
+ moea64_add_ofw_mappings(mmup, mmu, sz);
}
/*
Modified: head/sys/powerpc/conf/GENERIC64
==============================================================================
--- head/sys/powerpc/conf/GENERIC64 Thu Jan 1 22:20:19 2015 (r276514)
+++ head/sys/powerpc/conf/GENERIC64 Thu Jan 1 22:26:12 2015 (r276515)
@@ -32,6 +32,7 @@ options PS3 #Sony Playstation 3
options MAMBO #IBM Mambo Full System Simulator
options PSERIES #PAPR-compliant systems (e.g. IBM p)
+options FDT #Flattened Device Tree
options SCHED_ULE #ULE scheduler
options PREEMPTION #Enable kernel thread preemption
options INET #InterNETworking
Modified: head/sys/powerpc/ofw/ofw_machdep.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_machdep.c Thu Jan 1 22:20:19 2015 (r276514)
+++ head/sys/powerpc/ofw/ofw_machdep.c Thu Jan 1 22:26:12 2015 (r276515)
@@ -328,6 +328,9 @@ openfirmware_core(void *args)
int result;
register_t oldmsr;
+ if (openfirmware_entry == NULL)
+ return (-1);
+
/*
* Turn off exceptions - we really don't want to end up
* anywhere unexpected with PCPU set to something strange
@@ -402,7 +405,12 @@ openfirmware(void *args)
int result;
#ifdef SMP
struct ofw_rv_args rv_args;
+ #endif
+ if (openfirmware_entry == NULL)
+ return (-1);
+
+ #ifdef SMP
rv_args.args = args;
rv_args.in_progress = 1;
smp_rendezvous(smp_no_rendevous_barrier, ofw_rendezvous_dispatch,
Modified: head/sys/powerpc/pseries/xics.c
==============================================================================
--- head/sys/powerpc/pseries/xics.c Thu Jan 1 22:20:19 2015 (r276514)
+++ head/sys/powerpc/pseries/xics.c Thu Jan 1 22:26:12 2015 (r276515)
@@ -169,10 +169,7 @@ xicp_attach(device_t dev)
sc->ibm_set_xive = rtas_token_lookup("ibm,set-xive");
sc->ibm_get_xive = rtas_token_lookup("ibm,get-xive");
- if (OF_getproplen(phandle, "ibm,phandle") > 0)
- OF_getprop(phandle, "ibm,phandle", &phandle, sizeof(phandle));
-
- powerpc_register_pic(dev, phandle, MAX_XICP_IRQS,
+ powerpc_register_pic(dev, OF_xref_from_node(phandle), MAX_XICP_IRQS,
1 /* Number of IPIs */, FALSE);
root_pic = dev;
@@ -184,12 +181,9 @@ xics_attach(device_t dev)
{
phandle_t phandle = ofw_bus_get_node(dev);
- if (OF_getproplen(phandle, "ibm,phandle") > 0)
- OF_getprop(phandle, "ibm,phandle", &phandle, sizeof(phandle));
-
/* The XICP (root PIC) will handle all our interrupts */
- powerpc_register_pic(root_pic, phandle, MAX_XICP_IRQS,
- 1 /* Number of IPIs */, FALSE);
+ powerpc_register_pic(root_pic, OF_xref_from_node(phandle),
+ MAX_XICP_IRQS, 1 /* Number of IPIs */, FALSE);
return (0);
}
More information about the svn-src-head
mailing list