[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] via-ide: Also emulate non 100% native mode

From: Mark Cave-Ayland
Subject: Re: [PATCH 2/2] via-ide: Also emulate non 100% native mode
Date: Mon, 2 Mar 2020 19:00:02 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

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 
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:

/* 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 

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 
to 14? You should be able to confirm this easily on real hardware using the 
config-* words on the IDE node and reading the prog-if byte before and after.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]