tech-x11 archive

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

Re: NetBSD-local xf86-video-tdfx diff



Hello,

On Mon, 23 Feb 2015 12:33:45 +0100
Thomas Klausner <wiz%NetBSD.org@localhost> wrote:

> Hi Michael!
> 
> I've reduced our local changes to xf86-video-tdfx to the attached diff
> (vs. upstream git version).
> 
> If I read the code correctly, there are the following effective
> changes (committed with the message that this makes the driver work on
> macppc with one card):
> 
> * If there is only one card, the following code is not executed:
> 
>    (with the MMIOAddr with the lowest 256 bytes set to whatever)
> 
>         PCI_WRITE_LONG(pTDFX->MMIOAddr[i], CFG_MEM0BASE, i);
> 
>    (with the LinearAddr with the lowest 256 bytes set to whatever)
> 
>         PCI_WRITE_LONG(pTDFX->LinearAddr[i], CFG_MEM1BASE, i);
> 
>         PCI_WRITE_LONG(cfgbits, CFG_PCI_DECODE, i);
>         PCI_WRITE_LONG(initbits, CFG_INIT_ENABLE, i);

That was ages ago, I need to look at the code first.
IIRC that's for cold-booting a secondary voodoo3 with garbage in its
BARs, which was run unconditionally and occasionally messed things up
on macppc.
No need to write any of the above if the BIOS/OpenFirmware/whatever
brought the card to a usable state ( as in, set sane addresses for
memory and IO, enable PCI stuff etc. ) On OF we shouldn't need it even
for secondary cards.

> * There's a complete reversal of an ifdef which I don't understand:
> 
> -#if USE_PCIVGAIO
> +#ifndef USE_PCIVGAIO
> +  /* access VGA registers through the IO BAR, not legacy decoding */
>    hwp->PIOOffset = pTDFX->PIOBase[0] - 0x300;
>  #endif

The Voodoo3 and related chips have the VGA registers in an IO BAR,
without the 0x300 gap so if we go through that instead of using the
legacy VGA registers we need to adjust. Using the legacy registers is
fine on x86 but they may not be enabled elsewhere ( I wrote all the
tdfx stuff on macppc ) and it may not be safe to enable them ( there
might be another graphics card for example ).
The above may be a tpyo/thinko, I need to look at it.
Actually, going through the IO BAR should always work unless some
braindead BIOS disabled it.

have fun
Michael


Home | Main Index | Thread Index | Old Index