On Tue, 16 Mar 2021, Mark Cave-Ayland wrote:
On 16/03/2021 17:25, BALATON Zoltan wrote:
On Tue, 16 Mar 2021, Mark Cave-Ayland wrote:
On 16/03/2021 13:06, BALATON Zoltan wrote:
The PATCH 1 doesn't seem to be needed to have a working Pegasos 2
machine, does it?
It is needed (as well as all other patches in the series). Patch 1 is
needed for getting serial output which is the only way to communicate
with the Pegasos2 firmware so it's really hard to boot anything without
it.
Just having a quick look at patch 1: presumably the issue here is that
the Pegasos 2 firmware moves the serial ports to a different address on
startup. If you know what that address is, then why not simply change the
serial port base address(es) on the SuperIO device from the default?
I had that as first version but other guests may expect the serial at the
default address or set it up differently and we can emulate the device
more fully this way that works with all guests which is also more like the
device works. So putting it at a default address would be a step back. I
can attempt that if this approach cannot be used but so far nobody said
so.
That would certainly be my first choice, as swapping out the memory regions
within the ISA bus without its knowledge is likely to cause problems (I can
see ioport_id being incorrect for one).
Did you check what's that used for? Unlikely to cause any problems other than
displaying initial value of port address instead of current address in device
ID but that could be argued about if an ID should change or stay the same as
initially. Easily fixable either way.
Do the guest OSs actually use this feature at all? I don't think I've ever
seen such registers being used within QEMU, OSs tend to simply relocate the
IO space base address using the BAR if required.
The ISA devices don't have io BAR, they are relocatable _within_ ISA IO space
by the config registers of the VIA superio chip. But the two guests that
currently boot (MorphOS and Linux) don't seems to change default set by the
firmware so we can go with the firmware defaults which is less correct than
actually emulating what the chip does but whatever. (AmigaOS may also boot
but has no gfx driver so can't really check at the moment.)
If Linux/MorphOS work with a fixed address then that's good enough for now:
the code should look something like this:
dev = qdev_new(TYPE_SUPER_IO);
serial_dev = object_resolve_path_component(OBJECT(dev), "serial0"));
qdev_prop_set_uint32(dev, "iobase", 0x1234);
qdev_realise_and_unref(dev, &error_fatal);
I've sent a v8 dropping patch 1 and setting a default but using the callback