On Sun, 8 Nov 2026, Helge Deller wrote:
Hello Balaton,
On 11/8/26 12:43, BALATON Zoltan wrote:
On Fri, 6 Nov 2026, Helge Deller wrote:
From: Helge Deller <[email protected]>
This adds a new driver for the NC53C710 chipset. This drover is based on
the
lsi53c895a driver, and thus avoids many issues of the existing ncr53c710
driver, which was written from scratch.
There's a typo "drover" above.
Thanks! I'll fix it the next round.
I asked this before but would it be possible to modify lsi53c895a.c
to also emulate the 53c710 too instead of duplicating code?
Maybe. At least in theory: Probably.
This device model is almost the same as the 53c895a or at least a
large part is shared but it's not easy to see that as it uses
different names for the same structures and functions. It would be
better to at least split the reused struct definitions from 53c895a
into a shared header and use that here. Then compare what are the
differences between the functions and see if the common parts could
either be split into a common super class or if the differences are
small enough to just add conditionals in lsi53c895a.c to also emulate
53c710 with most of the code shared instead of duplicated.
Well, this is a lot of work.
And I'm not sure if you gain that much from that exercise.
OK but at least using a common header should not be that much work and
would reduce the differences and make the two device models more easily
comparable.
If you are a person which really want to know all differences between
those two SCSI chips then this is most likely a very interesting project.
But I fail to see someone who volunteers for this, who has the time and
interest to really do this and who still guarantees he will not break the
lsi53c895a.
I'm not sure what is the state of AI usage discussion but might also be a
project to try an AI agent with.
Looking at the Linux kernel, there are lots of different drivers driving
all various variants of those SCSI chips. The 710 was one of the earlier
SCSI chips (e.g. ISA bus, no PCI,...) while the 53c895a is a newer chip
for PCI.
That's a diference in inteface but if the chip otherwise is the same or
very similar it would be more easily modelled as a super class
implementing the SCSI things and two subclasses embedding it one ISADevice
and the other PCIDevice with the parts that's specific to the interface
belonging to those child classes. That way there would be no code
duplication.
In any case if there's code duplication then try not to make it worse by
renaming everthing but keep the names and shared structs at least the same
so it can be more easily compared and to what's different. That might also
come in handy when there's a fix in one device that could be applied to
the other too.
Regards,
BALATON Zoltan
A somewhat complex example of such code sharing is hw/isa/vt82c686.c
which uses a common super class or hw/display/ati.c which has
conditionals to emulate simlar devices. I was thinking about such
code sharing would be possible for these devices too to avoid code
duplication that can diverge in the future.
Yes, generally I prefer code sharing too.
But in this case the 710 is currently only used by the parisc emulation
(and might be used by one or two old historic non-x86 arches maybe too).
Helge