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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Commit 0d3345f9 "pci: add ob_pci_unmap() to unmap PCI memory" accidentally
broke compilation for architectures where OFMEM is unavailable such as x86.
Add the appropriate #if defined(CONFIG_OFMEM)...#endif block to ob_pci_unmap()
so that compilation can at least succeed for these architectures.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This is because some OSs (noticeably NetBSD) look up devices by device_type
in order to establish an interrupt mapping.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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>
Make sure that we set the upper 16-bits of the IO address for both the
PCI IO base and PCI IO limit registers.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
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>
This can now be used in sungem_config_cb() to unmap the PCI BAR
used to configure the MAC address.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
No driver, but we read the MAC address from the chip and write
it into the device-tree where Linux and MacOS look for it. We
also set the right compatible property for MacOS to pick it up.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This is so that it can be called directly from C rather than just the
pci-map-in Forth binding.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
The current interrupt mapping is only correct for PCI bus A (QEMU
currently alters its PCI mappings to handle that PCI devices are
plugged into the PCI root bus and not behind a Simba bridge).
Add a comment to point out that the existing mapping is deprecated
and should be removed once the QEMU PCI topology has been updated.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
The SUN,simba device doesn't have a ranges properties and so Linux will
calculate the PCI memory/IO ranges by probing the PBM "Memory Address Map"
and "I/O Address Map" registers (see apb_fake_ranges()).
Set sensible default values for both SUNW,simba devices during PCI
configuration and document accordingly.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Sabre has a slightly different reg property than that of other PCI host
bridges. Hardcode the correct value as taken from a real Ultra 5 device
tree.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>