Ok, I made those changes to openbios, here is the output.
> On May 8, 2018, at 6:50 AM, Joe van Tunen <joevt(a)shaw.ca> wrote:
>
> : (debug-feval) ( fcode# -- fcode# )
> \ Address
> fcode-stream 1 - . here u. ." : "
>
> \ Indicate if word is compiled
> state @ 0<> if
> ." (compile) "
> then
> dup fcode>xt cell - lfa2name type
> dup ." [ 0x" . ." ]" cr
> ;
QEMU emulates two of the three PCI buses found on real hardware because
some clients seem to need both and fail with only one present, but
OpenBIOS only handles a single PCI bus and initialises and puts in the
device tree only one of these: the second one which is where devices are
connected and also marks it bus 0. However, clients getting info from the
device tree may not know about this and thinking there is only one PCI
bus they erroneously use the address of the first bus to access PCI
config registers for devices on the second bus which silently fails as
these requests will go to the other empty bus emulated and return invalid
values. Devices mapped via MMIO still appear to work but they may not be
correctly initialised and some cards are not detected because of this.
Until support for multiple PCI buses is implemented add an empty node in
the device tree for the uninitialised bus to let clients know about it.
This is still not entirely correct as bus-range property does not match
real hardware but this fixes detecting PCI devices (such as USB) under
MorphOS and may also fix enabling the bus master bit needed with some
network cards and allow the workarund for this to be reverted.
Signed-off-by: BALATON Zoltan <balaton(a)eik.bme.hu>
---
v4: Rebased to latest master
v3: See:
https://mail.coreboot.org/pipermail/openbios/2017-January/009867.html
arch/ppc/qemu/init.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index af15682..d362b0e 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -716,6 +716,48 @@ static void kvm_of_init(void)
fword("finish-device");
}
+static void empty_pci_bus_init(void)
+{
+ if (machine_id == ARCH_MAC99) {
+ /* Add empty node for first pci bus */
+ /* Remove this when pci driver is fixed to handle multiple buses */
+ activate_device("/");
+ fword("new-device");
+ push_str("pci");
+ fword("device-name");
+ push_str("pci");
+ fword("device-type");
+ PUSH(0xf0000000);
+ fword("encode-int");
+ PUSH(0x02000000);
+ fword("encode-int");
+ fword("encode+");
+ push_str("reg");
+ fword("property");
+ PUSH(3);
+ fword("encode-int");
+ push_str("#address-cells");
+ fword("property");
+ PUSH(2);
+ fword("encode-int");
+ push_str("#size-cells");
+ fword("property");
+ PUSH(1);
+ fword("encode-int");
+ push_str("#interrupt-cells");
+ fword("property");
+ PUSH(0);
+ fword("encode-int");
+ PUSH(0);
+ fword("encode-int");
+ fword("encode+");
+ push_str("bus-range");
+ fword("property");
+ fword("finish-device");
+ device_end();
+ }
+}
+
/*
* filll ( addr bytes quad -- )
*/
@@ -857,6 +899,7 @@ arch_of_init(void)
feval("['] ppc-dma-sync to (dma-sync)");
#ifdef CONFIG_DRIVER_PCI
+ empty_pci_bus_init();
ob_pci_init();
#endif
--
2.7.6
Here is a reworked version of Ben's mac99 PMU patches for OpenBIOS along with a
minor fix for the keyboard alias.
The main difference between Ben's version and this version are that instead of
defining a new mac99p machine, the aim is to keep using the existing mac99
machine and then switch it over to use PMU by default once the remaining
issues with USB and timers have been fixed.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Mark Cave-Ayland (5):
ppc: add fw_cfg interface for passing VIA/ADB configuration from QEMU
ppc: add GPIO devices to the device tree when PMU hardware detected
adb: set compatible property differently if PMU is present
ppc: add PMU driver
usbhid: fix up keyboard alias for USB keyboards
arch/ppc/qemu/init.c | 28 +-
drivers/adb_bus.c | 8 +-
drivers/adb_bus.h | 5 +
drivers/build.xml | 1 +
drivers/macio.c | 80 +++++-
drivers/pci.c | 18 ++
drivers/pmu.c | 625 +++++++++++++++++++++++++++++++++++++++++++
drivers/pmu.h | 17 ++
drivers/usbhid.c | 2 +-
include/arch/common/fw_cfg.h | 1 +
include/drivers/drivers.h | 10 +
11 files changed, 785 insertions(+), 10 deletions(-)
create mode 100644 drivers/pmu.c
create mode 100644 drivers/pmu.h
--
2.11.0
The current PReP firmware provided with OpenBIOS is OpenHackWare which provides
a basic set of OpenFirmware interfaces but does this without providing any kind
of Forth implementation which limits its usefulness and compatibility.
Whilst the project has allowed QEMU PReP development to continue to date, it is
sadly now abandonware with no patches for over 4 years, and with no-one willing
to take on maintenance it is now time for a different approach.
This patchset adds PReP support for the QEMU 40p machine allowing it to start
booting NetBSD and the sandalfoot Linux zImage. The main features required for
this are support for the LSI SCSI controller, resdidual data and PReP boot
partitions.
In order to test these patches you'll need a recent QEMU with the following
patches applied:
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg05480.htmlhttps://lists.gnu.org/archive/html/qemu-devel/2018-05/msg05964.html
Next you'll need an updated openbios-ppc binary, and for those without access to
a cross-compiler setup I've uploaded the resulting binary to
https://www.ilande.co.uk/tmp/qemu/openbios-ppc.prep.
To boot the sandalfoot zImage from http://www.juneau-lug.org/zImage.initrd.sandalfoot
you can do:
qemu-system-ppc -M 40p -bios openbios-ppc.prep -cdrom zImage.initrd.sandalfoot
-boot d
Note that it seems to get stuck trying to initialise the LSI SCSI controller,
presumably due to a bug in the existing QEMU emulation.
NetBSD works much better and in fact boots all the way to userspace:
qemu-system-pcc -M 40p -bios openbios-ppc.prep -cdrom NetBSD-7.1.2-prep.iso
-boot d -nographic
In terms of functionality I think this patchset is just about there: there are a
few questions around device names but hopefully someone with real PReP experience
can point me in the right direction.
Finally I've added various people on CC who have expressed interest in PReP and/or
OpenHackWare in the past: if this is no longer of any interest to you, do let me
know and I'll drop your email address from future versions.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Mark Cave-Ayland (11):
pc_kbd: ensure that we properly reset the 8042 controller and keyboard
device
pci: rename i82378 keyboard device from 8042 to keyboard
pci: add AMD PCNET information to PCI database
bootcode_load: ensure LOADER_NOT_SUPPORT is returned if no bootcode is
present
ppc: add PReP support to dma-map-in
pci: add driver for LSI 53C810 SCSI controller
ppc: add PReP residual data block
ppc: use proper context when pre-loading kernels
pc-parts: allow successful detection of PReP boot partitions
libopenbios: add PReP boot partition loader for PPC
prep: disable VBE extensions when executing client program
arch/ppc/qemu/context.c | 129 ++++++-
arch/ppc/qemu/context.h | 1 +
arch/ppc/qemu/init.c | 34 ++
arch/ppc/qemu/kernel.h | 1 -
arch/ppc/qemu/main.c | 11 +-
arch/ppc/qemu/switch.S | 43 ---
arch/ppc/qemu/tree.fs | 5 -
config/examples/ppc_config.xml | 2 +
drivers/build.xml | 1 +
drivers/lsi.c | 770 ++++++++++++++++++++++++++++++++++++++++
drivers/pc_kbd.c | 22 +-
drivers/pci.c | 21 +-
drivers/pci_database.c | 14 +
drivers/pci_database.h | 1 +
drivers/vga.fs | 11 +
forth/debugging/client.fs | 1 +
include/arch/ppc/residual.h | 116 ++++++
include/drivers/drivers.h | 4 +
include/drivers/pci.h | 6 +
include/libopenbios/prep_load.h | 24 ++
libopenbios/bootcode_load.c | 2 +
libopenbios/build.xml | 1 +
libopenbios/initprogram.c | 8 +
libopenbios/load.c | 11 +
libopenbios/prep_load.c | 106 ++++++
packages/pc-parts.c | 10 +
26 files changed, 1300 insertions(+), 55 deletions(-)
create mode 100644 drivers/lsi.c
create mode 100644 include/arch/ppc/residual.h
create mode 100644 include/libopenbios/prep_load.h
create mode 100644 libopenbios/prep_load.c
--
2.11.0