1612 Commits

Author SHA1 Message Date
15d3d3d1c1 bootcode_load: ensure LOADER_NOT_SUPPORT is returned if no bootcode is present
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-26 20:09:22 +01:00
9f9d193739 pci: add AMD PCNET information to PCI database
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26 20:09:22 +01:00
066467da2d pci: rename i82378 keyboard device from 8042 to keyboard
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-26 20:09:22 +01:00
a58ec2ccf4 pc_kbd: ensure that we properly reset the 8042 controller and keyboard device
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-26 20:09:22 +01:00
c816bf7a80 esp: switch over to using dma-alloc/dma-map-in
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-26 17:32:53 +01:00
df46ed59ee esp: switch creation of esp device over to use new-device
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-26 17:32:53 +01:00
516feb0d46 sbus: add dma-* call-parent chain to all PCI devices and bridges
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-26 17:32:53 +01:00
b9d95b34fa pci: add dma-* call-parent chain to all PCI devices and bridges
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-26 17:32:53 +01:00
8ba053cb41 macio: add missing REGISTER_NODE for New World macio devices
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-05-26 17:32:53 +01:00
8584d42773 SPARC64: implement dma-* words
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-26 17:32:53 +01:00
29112bad4c PPC: implement dma-* words
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-26 17:32:53 +01:00
0723863980 PPC: add flush_dcache_range() to start.S
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-26 17:32:53 +01:00
fde444d149 SPARC32: implement dma-* words
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-26 17:32:53 +01:00
0abd3d55b2 SPARC32: implement dvma_sync() function for synchronising DMA memory
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-26 17:32:53 +01:00
677c6ce273 SPARC32: move pgtsrmmu.h from arch/sparc32 to include/arch/sparc32
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-26 17:32:53 +01:00
42297c7b82 SPARC32: implement dvma_map_in() for DMA IOVA to phys translation
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-26 17:32:53 +01:00
ce04d7ae35 SPARC32: allocate contiguous physical memory for DVMA
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-26 17:32:53 +01:00
d44e9c8776 SPARC32: rename dvma_alloc()'s ba variable to iova
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-26 17:32:53 +01:00
9b3116e000 dma: add defers for the dma-* words
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-26 17:32:53 +01:00
c9f67ba672 pci: fix OHCI driver PCI address
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-21 22:34:32 +01:00
e0c272b13b macio: set correct UniNorth device revision
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-19 09:08:53 +01:00
c7ab44d6c0 ppc: don't hardcode the system bus frequency
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-19 09:08:53 +01:00
0e6b8b3cb4 openbios: compile fixes for GCC 7.3
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-05-03 21:46:17 +01:00
54d959d97f ofmem: restrict ofmem_claim() allocations to RAM size
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-02-13 22:24:21 +00:00
b5c93acd14 ciface.fs: implement SUNW,power-off service
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-24 20:09:19 +00:00
0252b83c20 SPARC64: implement power-off word
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24 20:09:19 +00:00
6ca9ca07c3 SPARC64: add power device under the ebus device
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-24 20:09:19 +00:00
74ee111f1f SPARC32: implement power-off word
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24 20:09:19 +00:00
137d5463f4 admin: add power.fs with initial dummy power-off implementation
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2018-01-24 20:09:19 +00:00
7c13b264db x86: remove static declaration from multiboot_header definition
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>
2018-01-19 17:47:29 +00:00
9c2d101b5f pci: fix compilation for architectures where OFMEM isn't available
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>
2018-01-19 17:47:29 +00:00
83818bdb44 pci: set sunhme name to "network"
This brings the device tree in agreement with a real Ultra 5.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-10-16 23:59:37 +01:00
e83b251f2f pci: set cmd646 name and device_type properties to "ide"
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>
2017-10-16 23:47:44 +01:00
22060ca03f SPARC64: switch to simba PCI bridge machine configuration
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>
2017-10-16 23:47:44 +01:00
fd7162f7fd pci: add PCI bridge support for 32-bit PCI IO address spaces
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>
2017-09-30 15:11:16 +01:00
9b82260c12 package.fs: don't reveal interposed packages
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>
2017-09-22 14:45:35 +01:00
314d4f8263 pci: add Intel e1000 network device to PCI database
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-09-06 20:16:38 +01:00
d666005a67 pci: add SUN hme network device
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-09-06 20:07:05 +01:00
0d3345f93d pci: add ob_pci_unmap() to unmap PCI memory
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>
2017-09-06 20:07:04 +01:00
5923802972 pci: add basic support for Apple SunGEM
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>
2017-09-06 20:07:04 +01:00
7781886d9d pci: split the PCI mapping code out of ob_pci_bus_map_in() into ob_pci_map()
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>
2017-09-06 20:07:00 +01:00
42fb4ad538 pci: move pci_decode_pci_addr() towards the top of pci.c
This is in anticipation of using in several other places.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-09-05 22:34:36 +01:00
fbc1b4ab5b pci: map Simba PCI bus A on-board devices to fixed interrupts
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-07-12 21:26:54 +01:00
3a6c71a2c3 pci: use ob_pci_bus_set_interrupt_map() to configure interrupts for Simba PCI bus B
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@iande.co.uk>
2017-07-12 21:26:54 +01:00
4f2951e434 pci: alter ob_configure_pci_device() to return its device phandle
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-07-12 21:26:54 +01:00
8925eb5e37 pci: rename SUN4U_INTERRUPT to SUN4U_PCIAINTERRUPT
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>
2017-07-12 21:26:54 +01:00
9be68f6bbb pci: don't set interrupt-map and interrupt-map-mask properties if empty
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-07-12 21:26:54 +01:00
b958ff9fed pci: update interrupt-map-mask to include the bus during interrupt comparisons
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2017-07-12 21:26:54 +01:00
3410094a9a pci: implement simba_config_cb() for programming device ranges
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>
2017-07-12 21:26:54 +01:00
71fdc7bfda SPARC64: add custom sabre reg property to sabre_config_cb()
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>
2017-07-12 21:26:54 +01:00