summaryrefslogtreecommitdiff
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-263-15/+3
| | | | | | | | 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>
* Generalise parse-hexBALATON Zoltan2023-01-262-31/+34
| | | | | | | | | | | Add parse-nhex word reusing existing parse-ints and use that in parse-hex instead of an independent implementation. The parse-nhex name matches Apple OF, while SLOF calls the same operation hex-decode-unit so adding this word increases compatibility with other OF implementations. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* Limit binary dump bytes in .properties outputBALATON Zoltan2023-01-261-3/+4
| | | | | | | | | Some device trees can contain large chunks of binary data that result in .properties output to get lost in the dump of all binary bytes. Put an upper limit of the bytes dumped. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* .github/workflows: add release.yml for generating an OpenBIOS releaseMark Cave-Ayland2022-02-241-0/+101
| | | | | | | | | | | | This is a GitHub push action that builds OpenBIOS for all of the currently supported architectures (amd64, sparc32, sparc64, ppc and x86) and a new GitHub release consisting of an output zip file containing debug and release binaries, along with the source in .tar.gz and .zip formats. A release build is triggered by pushing a tag beginning with "v" indicating a version number in contrast to pushing a branch. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* .github/workflows: add main.yml for building OpenBIOS upon pushMark Cave-Ayland2022-02-241-0/+103
| | | | | | | | | | | | This is a GitHub push action that builds OpenBIOS for all of the currently supported architectures (amd64, sparc32, sparc64, ppc and x86) and generates an output zip file containing debug and release binaries. The output zip file is stored both as a build artifact (which has a maximum lifetime of 90 days) and for upstream OpenBIOS builds a "latest" release is added to the repository. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* .github/workflows: add build-openbios-builder.yml actionMark Cave-Ayland2022-02-241-0/+42
| | | | | | | | This is a GitHub manual action that generates a container image from docker/Dockerfile.builder and pushes the result to ghcr.io/openbios/openbios-builder:master for public use. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* docker: introduce Dockerfile.builder for openbios-builder containerMark Cave-Ayland2022-02-241-0/+19
| | | | | | | | | | | This introduces a new Dockerfile.builder file that can be used by docker build to generate a container that can build OpenBIOS based upon Debian 11.2 and the crosstool compilers from kernel.org. The installed cross-compilers allow the building of SPARC32, SPARC64 and PPC binaries. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ppc: Do not generate .stabs ELF sections to prevent GDB from choking on themGlenn Washburn2022-02-231-4/+0
| | | | | | | | | | | | | | | | | | Recent versions of GDB (and probably older ones too, but not checked) crash with and abort when loading the non-stripped 32-bit PPC QEMU build[1]. This is due to a bug in GDB on reading stab symbols. The only place in OpenBIOS where stab symbols are generated is in libgcc/crtsavres.S, which was copied from the linux kernel[2]. Symbols that were defined in the stabs section are still able to be seen in GDB after stabs removal. There does not appear to be a loss in debugging functionality. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28900 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/include/asm/ppc_asm.h?h=v5.17-rc4#n211 Signed-off-by: Glenn Washburn <development@efficientek.com> 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>
* config/scripts/switch-arch: allow x86_64 prefix for x86 buildsMark Cave-Ayland2022-02-081-1/+1
| | | | | | | | | Modern 64-bit compilers with a gcc multilib-capable toolchain are easily able to build x86 OpenBIOS. If the build is not gcc multilib-capable then the build typically fails with the message "fatal error: sys/cdefs.h: No such file or directory". 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>
* cuda: fix get-time wordGlenn Washburn2022-01-271-1/+1
| | | | | | | | | | | | | | | | | | An extra byte is written after the CUDA_GET_TIME command causing the command to return an incorrect time. Running QEMU with CUDA debug messages on yields these messages: 1177318@1642469573.070752:cuda_packet_receive length 3 1177318@1642469573.070768:cuda_packet_receive_data [0] 0x01 1177318@1642469573.070771:cuda_packet_receive_data [1] 0x03 1177318@1642469573.070773:cuda_packet_receive_data [2] 0xfb 1177318@1642469573.070776:cuda_receive_packet_cmd handling command GET_TIME CUDA: GET_TIME: wrong parameters 2 Fix the outgoing command length to remove the extra byte. 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>
* drivers: Spell QEMU all capsPhilippe Mathieu-Daudé2022-01-141-1/+1
| | | | | | | Replace Qemu -> QEMU. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* drivers/usb: Fix building with gcc 10.xBALATON Zoltan2022-01-141-9/+7
| | | | | Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* cuda: fix reset-all and power-off wordsMark Cave-Ayland2021-10-301-2/+2
| | | | | | | | | | | | | | | | | | There is a long-standing bug in the CUDA implementation of the reset-all and power-off words whereby an extra byte is written after the CUDA_RESET_SYSTEM and CUDA_POWERDOWN commands. This extra byte used to be ignored in QEMU until commits 017da0b568 ("cuda: port POWERDOWN command to new framework") and 54e894442e ("cuda: port RESET_SYSTEM command to new framework") added a check which rejects the command if the command length is incorrect. Fix the outgoing command length to remove the extra byte which allows the reset-all and power-off words to work in QEMU once again. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/624
* escc: send software reset command before configuring the portMark Cave-Ayland2021-09-021-0/+6
| | | | | | | | | According to the ESCC datasheet all register values are undetermined until an explicit reset command is sent. This is required to fix an issue with QEMU's ESCC device to ensure that the registers are set to default values if the default power-on values are changed. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* escc: add port index to uart_init_line()Mark Cave-Ayland2021-09-021-3/+3
| | | | | | This will be needed to allow uart_init_line() to reset the correct port. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: Rename pci_xbox_blacklisted() as pci_xbox_ignore_device()Philippe Mathieu-Daudé2021-02-151-5/+2
| | | | | | | | | In order to use inclusive terminology, rename pci_xbox_blacklisted() as pci_xbox_ignore_device(), and remove an obvious comment. Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* 40p: simplify IRQ swizzlingPhilippe Mathieu-Daudé2021-02-151-20/+7
| | | | | | | | LSI SCSI on PReP is the unique particular case where we use fixed IRQ routing. All other cases use regular IRQ swizzling. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* 40p: use is_apple() macroPhilippe Mathieu-Daudé2021-02-151-1/+1
| | | | | | | Simplify using the is_apple() macro. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* 40p: Allow Raven controller to handle all IRQsPhilippe Mathieu-Daudé2021-02-151-1/+1
| | | | | | | | | | In commit ce7fa4d29b we adapted to match QEMU (invalid) code. Now than QEMU has been fixed and handle the 4 IRQs, update the OF device tree again. Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> 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>
* SPARC: add implementation of addr wordMark Cave-Ayland2020-07-021-0/+15
| | | | | | | | OpenBSD uses the addr word to retrieve the address of several framebuffer variables during initialisation. Provide an implementation of addr which allows OpenBSD to initialise the framebuffer correctly on SPARC32 and SPARC64. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* virtio: limit ring size to a maximum of 128 descriptor entriesMark Cave-Ayland2020-05-162-3/+9
| | | | | | | | | | | | | | | | | QEMU commit c9b7d9ec21 "virtio: increase virtqueue size for virtio-scsi and virtio-blk" increased the number of queue descriptors from 128 to 256 which caused OpenBIOS to fail when booting from a virtio-blk device under qemu-system-ppc due to a memory overflow. Update the virtio-blk driver so that it uses a maximum of 128 descriptor entries (the previous value) to fix the issue, and also ensure that any further increases in virtqueue size will not cause the same failure. Note that this commit also fixes the vring_area size calculation which was incorrectly based upon the number of virtqueues, and not the number of descriptor entries. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: Enable bus-master on virtio_blkBrandon Bergren2020-05-161-0/+3
| | | | | | | | | | | | | In qemu 9d7bd0826f2d19f88631ad7078662668148f7b5f, the behavior of vring processing was changed to not run whenever bus-mastering is disabled. Since we were never enabling it in the first place, OpenBIOS was no longer able to access virtio disks on qemu. Fix this by enabling bus-mastering before initializing. Signed-off-by: Brandon Bergren <git@bdragon.rtk0.net> 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>
* ide: locate drives by iterating over the device tree during ob_ide_quiesce()Mark Cave-Ayland2019-10-221-22/+8
| | | | | | | | | It is now possible to locate IDE drives by searching the device tree for "block" type devices containing a C drive instance variable. Rewrite ob_ide_quiesce() to locate and quiesce IDE drives using this method which finally enables us to remove the global IDE channels list and its remaining ide_add_channel() function. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* ide: use instance values to hold C drive and channel structuresMark Cave-Ayland2019-10-222-27/+15
| | | | | | | | | Rather than iterate over the global IDE channels list, use instance variables to hold the relevant pointers. This allows us to remove ide_seek_channel() since it is no longer necessary for each IDE device to iterate over the global list in order to locate the drive/channel information. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* escc: explicitly mark variable containing incoming keyboard character as ↵Mark Cave-Ayland2019-10-171-1/+1
| | | | | | | | | volatile Otherwise the compiler may not understand that a read from the assigned buffer is comming from memory-mapped IO space and fail to update accordingly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* admin/devices.fs: Format assigned-addresses propertyBALATON Zoltan2019-10-121-1/+1
| | | | | | | To help reading property listing also format assigned-addresses property the same way as reg was already formatted. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
* virtio: use instance value to initialise C instance parameterMark Cave-Ayland2019-08-181-35/+11
| | | | | | | This simplifies the open word by avoiding having to locate and read the value of the _vdev property. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* lsi: use instance value to hold sd_private_t pointerMark Cave-Ayland2019-08-181-17/+25
| | | | | | | It is also possible to remove the global_lsi variable by adding a pointer to the parent lsi_private_t instance within sd_private_t. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pc_kbd: use instance value to initialise C instance parameterMark Cave-Ayland2019-08-181-9/+7
| | | | | | | This simplifies the open word by avoiding having to locate and read the value of the address property. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pc_serial: remove separate init wordMark Cave-Ayland2019-08-181-8/+5
| | | | | | | Instead use an instance value and initialise the C instance parameter within the open word. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: call set-args before configuring PCI device nodesMark Cave-Ayland2019-08-181-0/+21
| | | | | | | This is to ensure that the my-space and my-address words are set correctly for any PCI devices that wish to execute FCode. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: remove explicit setting of my-self from PCI devicesMark Cave-Ayland2019-08-182-9/+0
| | | | | | | Since the correct current instance is now being set during probe, there is no need to explicitly set it whilst creating the device. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: remove explicit find-device from PCI devicesMark Cave-Ayland2019-08-1813-51/+0
| | | | | | | Since the correct active package is now being set during probe, there is no need to explicitly find the parent node before creating the device. 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-182-3/+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-185-7/+14
| | | | | | | | | | | | 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>
* nvram: ensure that NVRAM configuration is separate from NVRAM node creationMark Cave-Ayland2019-08-182-4/+2
| | | | | | | As part of this separation we can also move "update-nvram" directly to the NVRAM node bindings. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* libopenbios: remove REGISTER_NAMED_NODE and REGISTER_NAMED_NODE_PHANDLE macrosMark Cave-Ayland2019-08-181-11/+0
| | | | | | | Now that we've removed all references to these binding macros they can be removed completely. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: remove ob_pci_initialize() and ob_pci_empty_nodeMark Cave-Ayland2019-08-181-15/+0
| | | | | | | | | The ob_pci_initialize() function can be removed as it is empty, whilst ob_pci_empty_node is no longer required since the existing fallback code will always apply the ob_pci_simple_node bindings if no callback is configured. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* pci: convert to use BIND_NODE_METHODS() macroMark Cave-Ayland2019-08-181-53/+43
| | | | | | | | | Moving the setup of PCI devices to within a new-device...finish-device sequence as part of the conversion further enables us to move the PCI host bridge configuration logic from ob_pci_init() to ob_configure_pci_device() where it belongs. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* virtio: convert to use BIND_NODE_METHODS() macroMark Cave-Ayland2019-08-181-4/+2
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
* lsi: convert to use BIND_NODE_METHODS() macroMark Cave-Ayland2019-08-181-2/+5
| | | | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>