On 01/03/2020 21:30, BALATON Zoltan wrote: > On Sun, 1 Mar 2020, Mark Cave-Ayland wrote: >> On 01/03/2020 18:53, BALATON Zoltan wrote: >>> On Sun, 1 Mar 2020, BALATON Zoltan wrote: >>>> is not legacy mode but "not 100% native mode". The prog-if is set to 0x8a >>>> which >>>> corresponds to native mode but this is what the Linux fixup function does, >>>> firmware >>>> sets it to 0x8f which means native mode. >>> >>> I mean, 0x8a legacy mode and 0x8f native mode, I see firmware poking 0x8f >>> and Amiga >>> like OSes reading that yet expecting legacy interrupts. Linux fixes up >>> prog-if so its >>> driver detects legacy interrupts but still uses ioports from PCI BARs. >> >> I see. Note that it is also possible to have a prog-if value of 0x80 which >> is where >> the hardware is locked into legacy mode via a pull-down resistor. Perhaps >> this is the >> case for Pegasos, since it would explain why attempts to switch the mode via >> prog-if >> are ignored? > > I've seen such option in CMD646 docs but couldn't find similar in VT8231. > Genesi has > published the schematics of Pegasos II (linked from my > https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2 page) so we could > check if > you can tell which pin is that. But we get 0x8a in Linux lspci output on real > hardware for prog-if which is explained by firmare setting it to 0x8f then > Linux > fixup function clearing bits 0 and 2 so does not seem it started as 0x80 > because then > firmware should not be able to set it to 0x8f either.
I had a quick look at the schematics linked from the page above, and they confirm that the VIA IDE interface is connected directly to IRQs 14 and 15 and not to the PCI interrupt pins. So on that basis the best explanation as to what is happening is the comment in the link you provided here: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/powerpc/platforms/chrp/pci.c?h=v4.14.172#n353 /* Pegasos2 firmware version 20040810 configures the built-in IDE controller * in legacy mode, but sets the PCI registers to PCI native mode. * The chip can only operate in legacy mode, so force the PCI class into legacy * mode as well. The same fixup must be done to the class-code property in * the IDE node /pci@80000000/ide@C,1 */ Given that the DT is wrong, then we should assume that all OSs would have to compensate for this in the same way as Linux, and therefore this should be handled automatically. AFAICT this then only leaves the question: why does the firmware set PCI_INTERRUPT_LINE to 9, which is presumably why you are seeing problems running MorphOS under QEMU. Could it be that setting prog-if to 0x8a legacy mode also resets PCI_INTERRUPT_LINE to 14? You should be able to confirm this easily on real hardware using the Forth config-* words on the IDE node and reading the prog-if byte before and after. ATB, Mark.