1612 Commits

Author SHA1 Message Date
5cef1d5340 lsi: don't change active package when setting device alias
When generating the DT based upon the active package and current instance, we
cannot change either when setting the alias. Instead look up the phandle and
then set the properties directly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
6daabf01f5 nvram: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
5b3f2c7c7d usbhid: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
0254649339 pmu: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
8dbac9a1fd macio: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
a408b3ae99 cuda: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
618cd87949 escc: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
f51c2a2fbb adb: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
ec03e2df65 ide: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
1afaf3b0a8 floppy: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
661bcc820c pc_serial: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
e516dd0983 pc_kbd: convert to use BIND_NODE_METHODS() macro
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
ca13d318ef libopenbios: introduce BIND_NODE_METHODS() macro
This macro is designed to bind C functions into Forth words during creation
of the device tree, but only into an existing node and without attempting
to create any missing parent nodes.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 21:16:50 +01:00
da2e55182a ppc: reduce size of Forth dictionary to 384K
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>
2019-08-18 20:38:55 +01:00
51067854a7 all: gcc 9 build fixes
Fix up warnings generated by building with -Werror under gcc 9.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-08-18 20:38:44 +01:00
c79e0ecb84 SPARC64: use serial console when QEMU is launched with -vga none
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>
2019-06-26 21:13:44 +01:00
6e1e58dddc SPARC32: use serial console when QEMU is launched with -vga none
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>
2019-06-26 21:13:35 +01:00
2bad58a29f sbus: don't use internal fallback TCX driver with QEMU
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>
2019-06-26 21:13:29 +01:00
3464681b2b SPARC64: mark initrd memory as mapped and in use before booting kernel
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-02-08 12:11:58 +00:00
c21c3667fa SPARC64: mark kernel memory as mapped and in use before booting kernel
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-02-08 12:11:33 +00:00
f633f31bcb SPARC32: mark initrd memory as mapped and in use before booting kernel
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-02-08 12:10:59 +00:00
c87d0eb00c SPARC32: mark kernel memory as mapped
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2019-02-08 12:10:26 +00:00
7238176ecc SPARC32: fix obp_arg.argv when no kernel command line specified
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>
2019-02-01 13:09:06 +00:00
90490576c9 SPARC32: divide physical memory reg property into SIMM-sized ranges
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>
2019-01-01 21:23:05 +00:00
441a84d3a6 40p: change residual data model name to IBM PPS Model 6015
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.
2018-10-05 08:45:05 +01:00
ce7fa4d29b 40p: update interrupt routing code to match QEMU
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>
2018-10-05 08:45:02 +01:00
a1280807a3 40p: fix up generation of interrupt properties
Since support for QEMU's 40p machine has been added there is now the possibility
of having a PPC architecture where !is_newworld() and !is_oldworld() are both
true.

Fix up a couple of instances in this logic that were preventing the generation
of interrupt properties in the device tree for 40p machines.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
2018-08-31 11:27:53 +01:00
0a031401c1 config: enable virtio-blk driver for default PPC and SPARC64 builds
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-08-31 11:22:27 +01:00
7c677d7af4 drivers: add virtio-1.0 virtio-blk driver
Note that as part of this commit we rename the legacy virtio-blk device node
from "virtio-blk" to "scsi" to match up with the QEMU fw path generator.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-08-31 11:22:27 +01:00
0353c63382 SPARC64: add bootindex support
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-31 11:22:27 +01:00
b09c7a3e78 ppc: add bootindex support
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-31 11:22:27 +01:00
bf0620b859 ppc: make sure that we correctly map loader RAM at load-base
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-31 11:21:41 +01:00
3ee90adbb7 SPARC64: fix endian naming of architecture in_*() and out_*() functions
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-31 11:21:35 +01:00
d252d3fba6 SPARC64: fix up dma-* words
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-26 14:16:29 +01:00
b6c94f7306 ppc: move init-program client stack to 1:1 virt to phys mapped memory
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-26 14:16:20 +01:00
502435d979 pci: use absolute PCI IO addresses when programming bridge IO limits
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-18 10:12:26 +01:00
667b8f890b libopenbios: don't allow find_package_method() to push a NULL for empty strings
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-18 10:12:26 +01:00
20186fa8c1 ide: don't use ioports as part of the controller node address
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-08-18 10:12:26 +01:00
8fe6f5f96f usbhid: fix up keyboard alias for USB keyboards
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-09 16:46:58 +01:00
ca1a87aa5e ppc: add PMU driver
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-09 16:46:58 +01:00
bb6943cab7 adb: set compatible property differently if PMU is present
This matches the device tree from a real mac99 system.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-06-09 16:46:58 +01:00
e2c333cfe1 ppc: add GPIO devices to the device tree when PMU hardware detected
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-09 16:46:58 +01:00
ef2e439866 ppc: add fw_cfg interface for passing VIA/ADB configuration from QEMU
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-06-09 16:46:58 +01:00
8d96d0bbba prep: disable VBE extensions when executing client program
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-26 20:09:22 +01:00
ce43b60d61 libopenbios: add PReP boot partition loader for PPC
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26 20:09:22 +01:00
853b59f901 pc-parts: allow successful detection of PReP boot partitions
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-26 20:09:22 +01:00
394238226c ppc: use proper context when pre-loading kernels
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-26 20:09:22 +01:00
75eff5a20d ppc: add PReP residual data block
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-26 20:09:22 +01:00
e713e732c4 pci: add driver for LSI 53C810 SCSI controller
This is to enable booting PReP machines in OpenBIOS.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26 20:09:22 +01:00
e004edf2e6 ppc: add PReP support to dma-map-in
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-26 20:09:22 +01:00