1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

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
This commit is contained in:
Nathan Whitehorn 2015-01-01 22:26:12 +00:00
parent 5499037c63
commit 44d29d4762
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276515
4 changed files with 24 additions and 18 deletions

View File

@ -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,9 +862,11 @@ 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) {
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)
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");

View File

@ -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

View File

@ -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,

View File

@ -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);
}