On 10/03/2023 12:45, Peter Maydell wrote:
On Fri, 10 Mar 2023 at 12:32, Alexander Bulekov <alx...@bu.edu> wrote:
This MR seems to be "lsi-ram".
From hw/scsi/lsi53c895a.c:
memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s,
"lsi-ram", 0x2000);
So the LSI device is reading an LSI "Script" from its own IO region.. In
this particular case, I think there was no reason to use
memory_region_init_io rather than memory_region_init_ram, but this makes
me worried that there are other devices that use something like this.
This particular device predates the entire MemoryRegion set of
abstractions, so it might have seemed easier at the time.
The endianness handling of the current code is also a bit
confusing and might make it tricky to convert to a RAM MR.
Since the LSI controller is attached to a PCI BAR then the accesses from the host to
the RAM should all be little endian (you can see the conversions in the driver I
wrote for the 40p machine to allow it to boot Linux:
https://github.com/openbios/openbios/blob/master/drivers/lsi.c).
I'm mildly curious that read_dword() which reads the SCRIPTS program internally
returns the value via cpu_to_le32(), as at first glance I would expect that to be the
other way around...
ATB,
Mark.