aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-09-11SPARC32: move Forth/FCode over to use new context wrappersMark Cave-Ayland1-12/+6
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11libopenbios: add context wrappers for Fcode/Forth payloadsMark Cave-Ayland2-0/+22
This enables them to be launched from a native context. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11x86: introduce arch_init_program() implementationMark Cave-Ayland1-5/+35
And switch start_elf() over to use it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: introduce arch_init_program() implementationMark Cave-Ayland1-12/+38
And switch start_elf() over to use it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC32: introduce arch_init_program() implementationMark Cave-Ayland1-3/+24
And switch start_elf() over to use it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11ppc: introduce arch_init_program() implementationMark Cave-Ayland1-16/+37
And switch start_elf() over to use it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11amd64: introduce arch_init_program() implementationMark Cave-Ayland1-6/+36
And switch start_elf() over to use it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11client.fs: add load-state param variableMark Cave-Ayland1-0/+1
This is in case we need to pass elf-boot parameters into the client executable. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11all: create client program context once at startupMark Cave-Ayland5-19/+50
Make sure that __context points to it to potentially allow state to be viewed/altered beforehand. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11libopenbios: introduce arch_init_program() in preparation for per-arch ↵Mark Cave-Ayland1-0/+1
implementations Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11libopenbios: rename saved-program-state to load-stateMark Cave-Ayland12-49/+48
The per-arch context is held via __context, so what we hold here is effectively just information about the last loaded file. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: switch entry.S over to use existing context macrosMark Cave-Ayland4-89/+70
This also requires aligning the CPU context struct as defined in cpustate.h. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: point __context to saved context during CIF callsMark Cave-Ayland1-0/+15
This will enable Forth executed in CIF calls to be able to modify its own context and return. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: split off general CPU registers into *_GENERAL_STATE macrosMark Cave-Ayland1-17/+25
A few of the CPU registers were included in the *_WINDOW_STATE macros. Split them out so that they can be used on their own without altering the window state. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: split off CPU window reset logic into RESET_CPU_WINDOW_STATE macroMark Cave-Ayland3-5/+13
Use the new macro in places where an empty register window set is required. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: save/restore entire CPU state when entering/leaving CIFMark Cave-Ayland1-2/+2
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: make sure that %tl is restored after SAVE_CPU_TRAP_STATEMark Cave-Ayland1-3/+8
Otherwise we end up in the wrong trap level after saving the CPU state. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-11SPARC64: introduce %pc into context and use it when exiting CIFMark Cave-Ayland2-9/+16
This is because some loaders expect to be able to resume execution at an alternative location by altering %pc from within Forth. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09SPARC64: save CIF entry globals under the client stackMark Cave-Ayland1-18/+14
Since we switch to a separate stack when entering the CIF, store the globals at known offsets beneath it. This saves having to alter the stack pointer during CIF entry. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09SPARC64: save/restore global registers to context when entering CIFMark Cave-Ayland1-9/+25
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09SPARC64: allocate space in context to save global registersMark Cave-Ayland2-31/+35
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09SPARC64: add parameter to indicate %cwp save/restore directionMark Cave-Ayland1-2/+12
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09SPARC32: implement full context switch logic in switch_to()Mark Cave-Ayland6-140/+249
Make sure that the whole CPU state is saved/restored during switch_to() to enable a clean context switch and return. Since we have this logic we can also re-use it for initial entry into OpenBIOS. Finally also update context.h to reflect the new CPU state stucture. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09pci: add rtl8139_config_cb() to configure rtl8139 network cardsMark Cave-Ayland3-1/+17
If we are running on an Apple PPC platform, enable bus mastering for this card. This is because it seems that Apple's OF implementation enables bus mastering for rtl8139 cards by default with the result that several drivers forget to explicitly enable it, causing them to fail under QEMU. This has been reported necessary for various rtl8139 drivers under OS 9, OS X and MorphOS. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09pci: add PCI database entry for rtl8139 network cardMark Cave-Ayland2-0/+7
This is taken from a patch submitted earlier by BALATON Zoltan <balaton@eik.bme.hu>. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09pci: introduce ob_pci_enable_bus_master() functionMark Cave-Ayland2-0/+14
This will activate the bus mastering bit for the device represented by the given PCI configuration. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-09-09pci: only try and detect Mac driver in PCI ROM for PPC machinesMark Cave-Ayland1-1/+5
It seems that the VGA option ROM isn't mapped on SPARC64 which causes a fault upon access. Temporarily handle this by surrounding the code in #ifdef CONFIG_PPC guards until the proper solution can be implemented. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26hfsplus: don't force OS 9 startup folder selectionMark Cave-Ayland1-2/+0
For some reason the HFS+ code will ignore the startup folder chosen by the user and force the OS 9 startup folder if it exists. This can break OS X installations with Classic, making it impossible to boot back into the OS. Removing the code to force the use of the OS 9 startup folder allows switching the startup disk between OS 9/OS X using the Disk Startup Utility in each OS as expected. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26Fix build on ppc64le hostBenjamin Herrenschmidt1-1/+1
Switch arch didn't get the right long size Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26ppc: add kbd alias for keyboard deviceMark Cave-Ayland1-1/+2
Some old bootloaders specifically look for the keyboard device via the kbd alias, so add this to keep them happy. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26bootstrap.fs: add 4+ word to bootstrap dictionaryMark Cave-Ayland1-0/+1
Old OS X bootloaders need this in order to execute without throwing an exception. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26mac: Don't set AAPL,address properties on NewWorldBenjamin Herrenschmidt1-3/+2
They are created by the MacOS ROM and in some cases MacOS X to contain the *virtual* addresses of the BARs as mapped by the kernel. Having these already there with the wrong values causes the hangs with MacOS X 10.5 and the video driver. The reason is that the IONDRVFramebuffer code in OS X 10.5 won't replace those properties if they already exist, so the driver ends up accessing the addresses put in there by OpenBIOS which aren't valid mapped virtual addresses under OS X. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26libc: Fix build on recent gccBenjamin Herrenschmidt1-4/+1
This fixes this warning (which escalates as an error): roms/openbios/libc/string.c: In function ‘strdup’: roms/openbios/libc/string.c:353:4: error: nonnull argument ‘str’ compared to NULL [-Werror=nonnull-compare] if( !str ) ^ cc1: all warnings being treated as errors rules.mak:122: recipe for target 'target/libc printf("stdout is %s\n", stdout->name); Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26escc: Don't set aliases for legacy devicesBenjamin Herrenschmidt1-8/+9
We currently overwrite the escc aliases with legacy ones. This causes us to use a legacy one as a stdout path. Linux doesn't parse the legacy ones very well causing problems detecting the default serial console when using a mac model with a serial console. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26ppc: Fix default serial pathBenjamin Herrenschmidt1-3/+3
When CONFIG_SERIAL_PORT is 1 we use port B otherwise port A Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26escc: Fix legacy addressesBenjamin Herrenschmidt1-2/+2
The legacy addresses were incorrect for both ports, fix them. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26pci: Fix locating Mac driver from PCI romBenjamin Herrenschmidt1-25/+29
The ROM is not on BAR 1 but BAR 6, I'm not sure what that code ever did, Qemu uses BAR 6, and I think MOL does too. Additionally, support using a raw PEF binary without a made up header. Eventually we need to support f-code from the ROM but that is not for today. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-08-26Fix encoding of PCI and IDE "interrupts" propertiesBenjamin Herrenschmidt2-2/+2
The main IDE interrupt and the PCI LSIs are level sensitive which is represented by a "1" in the device-tree. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-31Fix the location of the COPYING fileThomas Huth1-1/+1
The COPYING file is in the main directory, not in the Documentation folder. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-17interpreter.fs: allow evaluate to split words on CR as well as LFCormac O'Brien1-1/+1
Otherwise the Forth intepreter fails due to lack of buffer space when trying to execute large boot scripts on platforms that use CR instead of LF for line endings (particularly MacOS 9). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Cormac O'Brien <cormac@c-obrien.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-17interpreter.fs: don't clobber stack across evaluate strings split on newlinesMark Cave-Ayland1-0/+2
When an evaluate string is split across a newline, the current string position is assumed to be the top-most item on the stack. However in the case of yaboot, items are left on the stack to be used by a subsequent line within the same evaluate statement and so subsequent lines are parsed incorrectly. Fix this by saving the current string position on the r-stack across calls to (evaluate) so the stack remains correct for subsequent lines. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-17rstack.fs: add pseudo r-stack implementation for interpret modeMark Cave-Ayland2-0/+22
The OS 9 boot loader uses the r-stack outside of a word in interpret mode. Provide an r-stack implementation which allows r-stack accesses in interpret mode using a separate pseudo stack. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-11ppc: use rfid when running under a CPU from the 970 family.Cédric Le Goater1-0/+32
A recent attempt to restrict the use of rfi on 64bit cpus in qemu broke 32bit OpenBIOS when run under a 970. This patches memory to replace rfi instructions with rfid in the vector code. Signed-off-by: Cédric Le Goater <clg@kaod.org> Suggested-by: Alexander Graf <agraf@suse.de> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08Ensure saved context pointers in switch_to() for all archs are marked as ↵Mark Cave-Ayland2-4/+6
volatile As discovered with the previous ppc patchset, the saved context pointer must be marked as volatile, otherwise the compiler may decide to optimise away saving the pointer to the local stack. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08SPARC32: add disk:a slice to bootpath when booting from diskMark Cave-Ayland1-1/+1
Solaris 9 installs its root filesystem into the first logical slice rather than the first physical slice on the disk, so add disk:a to boot-device to attempt a boot from the first logical slice before falling back to the first physical slice as before. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08ppc: unify CIF save stack layout with that of new context stackMark Cave-Ayland1-101/+94
This makes it possible to define a Forth structure in future that can access the contents of either context directly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08ppc: use separate context to call client imagesMark Cave-Ayland2-1/+18
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08ppc: add new context handlerMark Cave-Ayland7-6/+329
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08ppc: move call_elf() to separate switch.S fileMark Cave-Ayland3-44/+56
Separate out the context switch code into a separate file, similar as to how is already done with the other architectures. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-07-08ppc: fix reuse of MMU translation slotsAlyssa Milburn1-6/+10
The current code always picks slot 0 in the reuse case. (This doesn't seem to matter in the cases I've tested, though.) Signed-off-by: Alyssa Milburn <fuzzie@fuzzie.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>