diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-01-01 22:26:12 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-01-01 22:26:12 +0000 |
commit | 96234b61c45d23ce5b18de83324a3e43a3ca97ff (patch) | |
tree | 6c5f48e2a44f107fd2834fe12fced03b5ae9d616 /sys/powerpc | |
parent | dabb40130f55c119eb04d09fd8bd5dbea07a496a (diff) | |
download | FreeBSD-src-96234b61c45d23ce5b18de83324a3e43a3ca97ff.zip FreeBSD-src-96234b61c45d23ce5b18de83324a3e43a3ca97ff.tar.gz |
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
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/mmu_oea64.c | 23 | ||||
-rw-r--r-- | sys/powerpc/conf/GENERIC64 | 1 | ||||
-rw-r--r-- | sys/powerpc/ofw/ofw_machdep.c | 8 | ||||
-rw-r--r-- | sys/powerpc/pseries/xics.c | 12 |
4 files changed, 25 insertions, 19 deletions
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 2db7fcb..9677b52 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -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_offset_t kernelstart, vm_offset_t kernelend 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_offset_t kernelstart, vm_offset_t kernelend */ 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 (sz > 0) - moea64_add_ofw_mappings(mmup, mmu, sz); + 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); } /* diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 3e4d72f..6bfa270 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -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 diff --git a/sys/powerpc/ofw/ofw_machdep.c b/sys/powerpc/ofw/ofw_machdep.c index fdcf68f..2b30012 100644 --- a/sys/powerpc/ofw/ofw_machdep.c +++ b/sys/powerpc/ofw/ofw_machdep.c @@ -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, diff --git a/sys/powerpc/pseries/xics.c b/sys/powerpc/pseries/xics.c index 47b53d6..b09079a 100644 --- a/sys/powerpc/pseries/xics.c +++ b/sys/powerpc/pseries/xics.c @@ -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); } |