aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-08-31SPARC64: add bootindex supportMark Cave-Ayland3-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>
2018-08-31ppc: add bootindex supportMark Cave-Ayland1-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>
2018-08-31ppc: make sure that we correctly map loader RAM at load-baseMark Cave-Ayland2-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>
2018-08-31SPARC64: fix endian naming of architecture in_*() and out_*() functionsMark Cave-Ayland2-21/+20
For reasons lost in the history of time, the SPARC64 endian accessors were given the opposite names to their function i.e. out_le32() would use a standard load whilst out_be32() would use a little-endian load. Switch them around so that their implementation matches their name (and also that of all other architectures). Note that since the references in the inb/inw/inl and outb/outw/outl wrappers are also swapped around then these accessors for legacy ioports (i.e. little endian) will still behave exactly the same as before. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-08-26SPARC64: fix up dma-* wordsMark Cave-Ayland1-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>
2018-08-26ppc: move init-program client stack to 1:1 virt to phys mapped memoryMark Cave-Ayland1-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>
2018-08-18pci: use absolute PCI IO addresses when programming bridge IO limitsMark Cave-Ayland1-1/+1
The upper IO bridge limit was being calculated relative to the lower IO bridge limit, rather than as an absolute address. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-08-18libopenbios: don't allow find_package_method() to push a NULL for empty stringsMark Cave-Ayland1-1/+6
Instead push a valid address with zero length otherwise the Forth find-method word can reference a NULL pointer. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-08-18ide: don't use ioports as part of the controller node addressMark Cave-Ayland3-12/+10
The problem with using the ioport as part of the controller node address is that the address cannot be determined until after the PCI BARs have been programmed. This causes a problem when trying to generate fw bootpaths because by definition they must be passed to the firmware before PCI initialisation. Instead of using the controller ioport address, use the controller index for the node address to provide a consistent device node regardless of how the PCI BARs are programmed. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-06-09usbhid: fix up keyboard alias for USB keyboardsMark Cave-Ayland2-8/+3
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>
2018-06-09ppc: add PMU driverMark Cave-Ayland6-2/+658
The PMU hardware supercedes the CUDA hardware on more modern Macs providing additional power management functionality which is required for more modern Mac OSs. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-06-09adb: set compatible property differently if PMU is presentMark Cave-Ayland1-1/+7
This matches the device tree from a real mac99 system. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-06-09ppc: add GPIO devices to the device tree when PMU hardware detectedMark Cave-Ayland2-0/+88
PMU Mac models expose GPIOs via a separate address range at the start of the via-pmu device. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-06-09ppc: add fw_cfg interface for passing VIA/ADB configuration from QEMUMark Cave-Ayland3-0/+30
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>
2018-05-26prep: disable VBE extensions when executing client programMark Cave-Ayland2-0/+27
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>
2018-05-26libopenbios: add PReP boot partition loader for PPCMark Cave-Ayland7-0/+152
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26pc-parts: allow successful detection of PReP boot partitionsMark Cave-Ayland1-0/+10
The PReP boot partition has its own separate layout, so if we detect a PReP partition then assume success without attempting the filesystem probe (which is always going to fail). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26ppc: use proper context when pre-loading kernelsMark Cave-Ayland3-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>
2018-05-26ppc: add PReP residual data blockMark Cave-Ayland3-2/+244
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>
2018-05-26pci: add driver for LSI 53C810 SCSI controllerMark Cave-Ayland8-0/+807
This is to enable booting PReP machines in OpenBIOS. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26ppc: add PReP support to dma-map-inMark Cave-Ayland2-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>
2018-05-26bootcode_load: ensure LOADER_NOT_SUPPORT is returned if no bootcode is presentMark Cave-Ayland1-0/+2
Otherwise we try unsucessfully to load the bootcode and fail rather than continuing on to the next loader. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26pci: add AMD PCNET information to PCI databaseMark Cave-Ayland2-0/+9
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26pci: rename i82378 keyboard device from 8042 to keyboardMark Cave-Ayland1-1/+1
This ensures the keyboard appears with a more sensible name in the device tree. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26pc_kbd: ensure that we properly reset the 8042 controller and keyboard deviceMark Cave-Ayland1-2/+20
More recent versions of QEMU disable scanning until the controller and keyboard device have been explicitly reset. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26esp: switch over to using dma-alloc/dma-map-inMark Cave-Ayland1-2/+17
Use the proper IEEE-1275 dma words to allocate and map DMA memory. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26esp: switch creation of esp device over to use new-deviceMark Cave-Ayland1-51/+47
Instead of using a C initialize function to create the esp device, switch over to using the Forth "new-device" word so that all of the initialisation can be done in place in ob_esp_init(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26sbus: add dma-* call-parent chain to all PCI devices and bridgesMark Cave-Ayland3-3/+97
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>
2018-05-26pci: add dma-* call-parent chain to all PCI devices and bridgesMark Cave-Ayland5-0/+163
This enables disk drivers to call the dma-* words as required by the specification, and in particular fixes the failing dma-alloc warnings emitted by NetBSD PPC on boot. Note that we also add these methods to any partition/file packages via a new is-call-parent helper word to ensure that the dma-* words are available at all levels of interposition. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26macio: add missing REGISTER_NODE for New World macio devicesMark Cave-Ayland1-0/+1
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26SPARC64: implement dma-* wordsMark Cave-Ayland2-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>
2018-05-26PPC: implement dma-* wordsMark Cave-Ayland2-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>
2018-05-26PPC: add flush_dcache_range() to start.SMark Cave-Ayland2-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>
2018-05-26SPARC32: implement dma-* wordsMark Cave-Ayland2-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>
2018-05-26SPARC32: implement dvma_sync() function for synchronising DMA memoryMark Cave-Ayland2-0/+15
This is required for ensuring that CPU memory is coherent after DMA operations have completed. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26SPARC32: move pgtsrmmu.h from arch/sparc32 to include/arch/sparc32Mark Cave-Ayland3-2/+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>
2018-05-26SPARC32: implement dvma_map_in() for DMA IOVA to phys translationMark Cave-Ayland3-5/+18
Rather than have dvma_alloc() store the result of the physical translation in the specified location, use the fact that we now have contiguous physical DMA memory to implement dvma_map_in() to perform the translation separately. This allows us to remove the pointer to the physical address parameter to dvma_alloc() and instead perform the translation in esp.c by calling dvma_map_in() separately. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26SPARC32: allocate contiguous physical memory for DVMAMark Cave-Ayland1-8/+13
Currently we dynamically allocate physical memory for DVMA as required, however that makes mapping between IOVA and physical addresses almost impossible since the resulting regions are not contiguous. Resolve this by allocating a contiguous physical memory block that we can use to easily map between IOVA and physical addresses. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26SPARC32: rename dvma_alloc()'s ba variable to iovaMark Cave-Ayland1-5/+5
This makes it clearer that we are handling a virtual IO address. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26dma: add defers for the dma-* wordsMark Cave-Ayland2-4/+6
Whilst there is an existing implementation of dma-alloc, it is currently unused so we can make this change now. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-21pci: fix OHCI driver PCI addressMark Cave-Ayland1-1/+4
Commit a1c2e4f "Add USB OHCI + HID driver" hardcoded the high order bit of the PCI address to that used on PPC machines instead of using the correct PCI_ADDR() macro. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
2018-05-19macio: set correct UniNorth device revisionMark Cave-Ayland1-1/+1
Make sure that we set the device-rev property to 7 as found on a real Mac99 machine. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-19ppc: don't hardcode the system bus frequencyMark Cave-Ayland1-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>
2018-05-03openbios: compile fixes for GCC 7.3Mark Cave-Ayland2-2/+2
This fixes additional warnings found when upgrading my compiler toolset from GCC 5.x to 7.x. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-02-13ofmem: restrict ofmem_claim() allocations to RAM sizeMark Cave-Ayland1-1/+1
As OFMEM memory ranges don't provide an explicit upper limit, we must manually check that CIF claim calls lie within a valid maxmimum range if attempting to allocate a specific address. Since the claim method provides a 1:1 mapping between physical and virtual addresses, the valid maximum address is therefore equivalent to the machine RAM size. This fixes booting yaboot 1.3.17 which implements a top-down search using claim to find the next free memory region to locate its heap. Without this fix we blindly accept a claim for physical addresses far above the available RAM which fails silently when we try to use the mapping later. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24ciface.fs: implement SUNW,power-off serviceMark Cave-Ayland1-0/+8
This is a Sun-specific service which is only enabled for the SPARC64 architecture. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24SPARC64: implement power-off wordMark Cave-Ayland1-0/+27
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24SPARC64: add power device under the ebus deviceMark Cave-Ayland1-0/+34
Due to limitations in the current QEMU PCI IO BAR layout, it isn't possible to use the offset of 0x7240000 as used in a real Ultra 5. For the moment locate the power device at offset 0x7240 as a reminder of its true origin. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24SPARC32: implement power-off wordMark Cave-Ayland1-0/+10
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24admin: add power.fs with initial dummy power-off implementationMark Cave-Ayland2-0/+10
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>