summaryrefslogtreecommitdiff
path: root/arch
Commit message (Collapse)AuthorAgeFilesLines
* arch/ppc/qemu: Add parse hex words for compatibility with Apple OFHEADmasterBALATON Zoltan2023-01-261-0/+8
| | | | | | | | Apple OF has parse-1hex, parse-2hex, parse-3hex words that may be used by FCode ROMs so add these for compatibility Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* Use parse-nhexBALATON Zoltan2023-01-261-5/+1
| | | | | | | | Instead of reimplementing it several times use parse-nhex to decode two hex numbers, Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* arch/unix/unix.c: fix build on x86 architecture with modern gcc compilersMark Cave-Ayland2022-02-081-0/+2
| | | | | | | | | | | Modern gcc compilers will fail to build x86 OpenBIOS failing with the error message "libc/misc.c:20: multiple definition of `errno_int'" during link. Since the accompanying comment mentions that the reason for adding the definition is to allow compilation to succeed on OS X, surround it with suitable #if defined(__APPLE__) ... #endif guards. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: fix ciface_milliseconds using incorrect frequency for delayGlenn Washburn2022-02-081-2/+3
| | | | | | | | | | Instead of using a constant frequency for all CPUs, use the processor timebase frequency provided by QEMU. This fixes issues where delays from ciface_milliseconds were not corresponding to elapsed time as given by the real time clock on certain platforms, eg. QEMU's mac99 machine. Signed-off-by: Glenn Washburn <development@efficientek.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: Add PVRs for the MPC7450 familyFabiano Rosas2022-01-141-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the processors from the 7450 family to pass the initial PVR verification. Enables 7441, 7445, 7447, 7447a, 7450, 7451, 7455, 7457 and 7457a. This should be used along with a QEMU that includes commit 1da666cd8e ("target/ppc: Disable software TLB for the 7450 family"). With Linux 5.15: $ cd buildroot $ make qemu_ppc_mac99_defconfig $ make $ qemu-system-ppc -m 1G -M mac99,via=pmu -cpu 7450 \ -kernel ./output/images/vmlinux \ -append root=/dev/sda \ -drive file=./output/images/rootfs.ext2,format=raw \ -net nic,model=sungem -net user -serial mon:stdio -nographic >> ============================================================= >> OpenBIOS 1.1 [Jan 10 2022 13:27] >> Configuration device id QEMU version 1 machine id 1 >> CPUs: 1 >> Memory: 1024M >> UUID: 00000000-0000-0000-0000-000000000000 >> CPU type PowerPC,G4 (...) Booting Linux via __start() @ 0x01000000 ... (...) Welcome to Buildroot buildroot login: Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* PPC: mark first 4 pages of physical and virtual memory as unavailableMark Cave-Ayland2020-07-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Debian ports images have now switched from using yaboot to grub as their bootloader. Recent versions of these images will hang rather than boot under QEMU despite there being no obvious changes to the boot process. Further investigation reveals that the second stage grub bootloader appears to use low memory whilst loading the kernel/initrd from disk: unfortunately the OpenBIOS vector table lives within the first few pages of physical RAM and so grub writes over the vector table (in particular overwriting the MMU fault handlers) causing them to fail next time they are executed which causes the hang. Fortunately just before this stage of the bootloader executes, it uses the CIF to request the contents of the /memory node "available" property. It seems that the low memory locations used by grub are taken from the start of the available range, so we can simply increase the number of RAM pages reserved at the bottom of RAM to ensure that the area chosen by the bootloader doesn't conflict with the vector table. This patch raises the start of available memory from 0x1000 to 0x4000 which allows grub to boot successfully in my tests. According to dumps of device trees taken from real PPC Macs there are already several examples where the start of available memory is set to 0x3000 or 0x4000, so as this is already present on real hardware it should not cause any regressions. Finally it is worth noting that even in the earlier grub images I could see write accesses to low memory that would overwrite the vector table: I think that until recently we were lucky that they happened to avoid anything that was critical to allow the kernel to load and boot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: fix kernel and initrd mapping to match SILOMark Cave-Ayland2020-04-262-15/+19
| | | | | | | | | | The previous attempt to fix this was wrong in that I misinterpreted what SILO was doing: whilst it detects a free region of memory for the kernel/initrd, it simply maps the areas at fixed addresses rather than allocating them. Fixes: f633f31 "SPARC32: mark initrd memory as mapped and in use before booting kernel" Fixes: c87d0eb "SPARC32: mark kernel memory as mapped" Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: fix kernel and initrd mapping to match SILOMark Cave-Ayland2020-04-263-10/+11
| | | | | | | | | | The previous attempt to fix this was wrong in that I misinterpreted what SILO was doing: whilst it detects a free region of memory for the kernel/initrd, it simply maps the areas at fixed addresses rather than allocating them. Fixes: 3464681 "SPARC64: mark initrd memory as mapped and in use before booting kernel" Fixes: c21c366 "SPARC64: mark kernel memory as mapped and in use before booting kernel" Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* x86: set active package and current instance to root device node before probeMark Cave-Ayland2019-08-181-1/+8
| | | | | | | | | Now that all PCI devices have been converted to new-device...finish-device we can set both the active package and current instance to the root device node before probe, giving all child devices a correct active package and instance chain during creation. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: set active package and current instance to root device node before ↵Mark Cave-Ayland2019-08-181-0/+6
| | | | | | | | | | | probe Now that all PCI devices have been converted to new-device...finish-device we can set both the active package and current instance to the root device node before probe, giving all child devices a correct active package and instance chain during creation. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: set active package and current instance to root device node before probeMark Cave-Ayland2019-08-181-0/+6
| | | | | | | | | Now that all PCI devices have been converted to new-device...finish-device we can set both the active package and current instance to the root device node before probe, giving all child devices a correct active package and instance chain during creation. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: move New World uninorth and nvram device node creation to the root deviceMark Cave-Ayland2019-08-181-1/+11
| | | | | | | | | | | | Whilst the NVRAM device node exists under the mac-io device node for Old World Macs, both itself and the Uninorth device node exist under the root device node on New World Macs. Move creation of both device nodes to arch_of_init() for New World machines to enable the active package and current instance to be set correctly during device tree construction. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: reduce size of Forth dictionary to 384KMark Cave-Ayland2019-08-181-2/+2
| | | | | | | | | | gcc 9 emits a fatal error when building OpenBIOS for ppc because the size of the generated image is greater than the available ROM area when building with -O0. Reduce the size of the Forth dictionary from 512K to 384K to allow sufficient space for generating OpenBIOS images suitable for debugging. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* all: gcc 9 build fixesMark Cave-Ayland2019-08-181-1/+1
| | | | | | Fix up warnings generated by building with -Werror under gcc 9. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: use serial console when QEMU is launched with -vga noneMark Cave-Ayland2019-06-261-2/+11
| | | | | | | | If no display device has been installed in the DT e.g. passing -vga none into the QEMU command line then fall back to using the serial console as already occurs when launching QEMU in -nographic mode. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: use serial console when QEMU is launched with -vga noneMark Cave-Ayland2019-06-261-0/+8
| | | | | | | | If no display device has been installed in the DT e.g. passing -vga none into the QEMU command line then fall back to using the serial console as already occurs when launching QEMU in -nographic mode. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* sbus: don't use internal fallback TCX driver with QEMUMark Cave-Ayland2019-06-261-2/+5
| | | | | | | | | | | | OpenBIOS SPARC32 has always maintained a fallback option of an internal TCX driver if an FCode driver cannot be located on the TCX card itself. Since QEMU's TCX adapter has supported FCode payloads for a long time then we only require this logic for non-QEMU builds. Otherwise we unintentionally install the fallback driver and device node even if the framebuffer card hasn't been installed into the machine. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: mark initrd memory as mapped and in use before booting kernelMark Cave-Ayland2019-02-083-0/+14
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: mark kernel memory as mapped and in use before booting kernelMark Cave-Ayland2019-02-081-1/+7
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: mark initrd memory as mapped and in use before booting kernelMark Cave-Ayland2019-02-082-0/+12
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: mark kernel memory as mappedMark Cave-Ayland2019-02-081-1/+2
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: fix obp_arg.argv when no kernel command line specifiedMark Cave-Ayland2019-02-011-8/+8
| | | | | | | | Make sure that obp_arg.argv is set to an empty string if no command line is passed from QEMU. Otherwise the kernel will panic on startup when trying to access it. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: divide physical memory reg property into SIMM-sized rangesMark Cave-Ayland2019-01-013-7/+15
| | | | | | | | | | | | | | | Currently the /memory node reg property is set to a single range encompassing the entire physical RAM of the machine. This seems to cause issues with Solaris when booting on QEMU SS-10 and SS-20 machines whereby having just a single entry causes the top of physical memory to be calculated incorrectly and triggers a panic on boot. Instead copy the behaviour of OBP which is to divide the reg property into a set of ranges representing the physical SIMM arrangement in the machine, which fixes the error and allows Solaris to boot under the QEMU SS-10 and SS-20 machines. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* 40p: change residual data model name to IBM PPS Model 6015Mark Cave-Ayland2018-10-051-1/+1
| | | | | | With the corresponding QEMU patches applied, it is now possible to change the reported firmware name to that of a real 40p machine and boot to a working userspace with the Linux sandalfoot zImage.
* 40p: update interrupt routing code to match QEMUMark Cave-Ayland2018-10-051-1/+1
| | | | | | | | Note that whilst guest OSs should be relying on residual data rather than the OF device tree to determine the hardware, we still update the interrupt properties to match the new code in QEMU for consistency. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: add bootindex supportMark Cave-Ayland2018-08-313-8/+34
| | | | | | | | This provides an alternative mechanism for supporting boot device order information from QEMU compared with the legacy FW_CFG_BOOT_DEVICE functionality specified via -boot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: add bootindex supportMark Cave-Ayland2018-08-311-10/+45
| | | | | | | | This provides an alternative mechanism for supporting boot device order information from QEMU compared with the legacy FW_CFG_BOOT_DEVICE functionality specified via -boot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: make sure that we correctly map loader RAM at load-baseMark Cave-Ayland2018-08-312-12/+8
| | | | | | | | | | | | An error in the logic related to FREE_BASE meant that instead of mapping the RAM for the loader at load-base, a small section was being mapped at the bottom of RAM instead. Fix this by deferring the mapping of the load-base RAM to arch_init() when we can access the load-base variable and map 8MB RAM with a 1:1 phys to virt mapping. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: fix up dma-* wordsMark Cave-Ayland2018-08-261-8/+5
| | | | | | | | | Commit 8584d42 "SPARC64: implement dma-* words" introduced the dma-* words for SPARC64 but accidentally introduced an older prototype implementation (probably introduced during a rebase) rather than using the correct defer words. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: move init-program client stack to 1:1 virt to phys mapped memoryMark Cave-Ayland2018-08-261-0/+9
| | | | | | | | | | | | | | | | | The default context used by init-program is allocated from the OpenBIOS heap which uses a different virt to phys mapping to avoid having to physically relocate the PROM on startup for PPC machines. It seems that the OpenBSD bootloader isn't happy with this change introduced by the context rework, most likely because there is an assumption that the client stack is mapped 1:1 virt to phys. Fix this by overriding the default context stack during init-program to a location just under the MMU hash table (SDR1) which was its previous hard-coded location in 1:1 virt to phys mapped memory, and allow OpenBSD to boot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* usbhid: fix up keyboard alias for USB keyboardsMark Cave-Ayland2018-06-091-7/+2
| | | | | | | | | | A USB keyboard is not an ADB keyboard, so make sure that we set the keyboard alias rather than the adb-keyboard alias. This also enables us to simplify the alias logic in the PPC arch_of_init() function. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: add fw_cfg interface for passing VIA/ADB configuration from QEMUMark Cave-Ayland2018-06-091-0/+19
| | | | | | | This is in preparation for allowing OpenBIOS to detect the difference between CUDA/PMU hardware and build the device tree accordingly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* prep: disable VBE extensions when executing client programMark Cave-Ayland2018-05-261-0/+16
| | | | | | | | | | PReP payloads such as Linux expect to be able to set standard VGA modes on startup, but VBE prevents certain modes such as text-only. Disable VBE extensions when executing the client program to allow this behaviour which also matches that of Open HackWare. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: use proper context when pre-loading kernelsMark Cave-Ayland2018-05-263-45/+10
| | | | | | | | | | | Before the introduction of proper init-program contexts, OpenBIOS used a simple assembler call_elf() function to execute the guest kernel directly. Switch over to using proper contexts via arch_init_program() which enables us to remove the legacy call_elf() completely. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: add PReP residual data blockMark Cave-Ayland2018-05-262-2/+128
| | | | | | | This is borrowed from OpenHackWare in order to provide hardware data to the client OS. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: add PReP support to dma-map-inMark Cave-Ayland2018-05-262-5/+18
| | | | | | | | PReP machines have a separate iova address space mapped into the CPU address space at 0x80000000, so add a new dma-map-in implementation that supports this behaviour for the PReP machine. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* sbus: add dma-* call-parent chain to all PCI devices and bridgesMark Cave-Ayland2018-05-261-0/+20
| | | | | | | This enables disk drivers to call the dma-* words as required by the specification. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: implement dma-* wordsMark Cave-Ayland2018-05-262-0/+87
| | | | | | | | | | | Implement the dma-* words in the root node using Forth, except for dma-alloc and dma-sync which require C to use the in-built aligned memory allocator and MMU flushing. Note that as OpenBIOS doesn't enable the IOMMU for SPARC64 it is possible to use the aligned memory allocator directly without any extra support code. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* PPC: implement dma-* wordsMark Cave-Ayland2018-05-262-0/+75
| | | | | | | | Implement the dma-* words in the root node using Forth, except for dma-alloc and dma-sync which require C to use the in-built aligned memory allocator and I-cache and D-cache flushing. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* PPC: add flush_dcache_range() to start.SMark Cave-Ayland2018-05-262-0/+22
| | | | | | | Implement flush_dcache_range() similar to flush_icache_range() in preparation for adding dma command support. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: implement dma-* wordsMark Cave-Ayland2018-05-262-1/+82
| | | | | | | Use Forth wrappers around the existing C functions to implement all the dma-* words in the root package. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC32: move pgtsrmmu.h from arch/sparc32 to include/arch/sparc32Mark Cave-Ayland2018-05-263-225/+2
| | | | | | This is to enable us to use its functions for the upcoming DMA functionality. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: don't hardcode the system bus frequencyMark Cave-Ayland2018-05-191-2/+2
| | | | | | | The system bus frequency has been available from the QEMU fw_cfg interface for some time, so let's use it rather than hard-coding the relevant values. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: implement power-off wordMark Cave-Ayland2018-01-241-0/+27
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* x86: remove static declaration from multiboot_header definitionMark Cave-Ayland2018-01-191-1/+1
| | | | | | | | | | | | Newer versions of gcc fail to compile OpenBIOS giving a "error: ‘multiboot_header’ defined but not used" message when the default build with -Werror enabled is used. Remove the static declaration to enable compilation to succeed, which incidentally matches the other copies of multiboot.c in the OpenBIOS source tree. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: switch to simba PCI bridge machine configurationMark Cave-Ayland2017-10-161-1/+1
| | | | | | | | | | | Fix up the ebus device interrupt parents, plus remove deprecated code for mapping PCI devices to the PCI root bus as this is no longer possible. Now that the transition to a simba configuration is complete, make sure that we update mem_base and io_base to match the start address of each simba module, and update pci_mem_base accordingly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* package.fs: don't reveal interposed packagesMark Cave-Ayland2017-09-221-1/+1
| | | | | | | | | | | | | | | | | The IEEE-1275 interpose specification suggests that interposed packages should not be visible unless an interpose-aware Forth word is used. Commit 247c6169 "Fix for interpose problem" realised this by converting the romvec obp_inst2pkg() function over to use ihandle>non-interposed-phandle but didn't make the same change to the equivalent CIF call instance-to-path (which is presumably correct since the interpose specification also states that interposed packages are only visible to a new instance-to-interposed-path CIF call). Here we add a new instance-to-package word as a wrapper to ihandle>non-interposed-phandle and update obp_inst2pkg() and instance-to-path to use it accordingly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: fix PCI configuration space sizeMark Cave-Ayland2017-07-121-2/+2
| | | | | | | | | Make the PCI configuration space size match that of a real Ultra5 machine. Currently the declared PCI configuration space is too large and actually overlaps PCI memory space. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: fix PCI memory base in host rangesMark Cave-Ayland2017-07-121-1/+1
| | | | | | | | | | | Previously the address of the PCI memory base in the host ranges property was offset by pci_mem_base. While technically correct, Linux incorrectly calculates the start of the Simba window based upon this address. Change the memory base to APB_MEM_BASE to match a real Ultra 5 which prevents Linux from outputting warnings about incorrect window sizes. Signed-off-by: Mark Cave-ayland <mark.cave-ayland@ilande.co.uk>
* SPARC64: increase size of PCI IO spaceMark Cave-Ayland2017-07-121-2/+2
| | | | | | | This is required to ensure that we can fit both SUNW,simba devices within the available space. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>