linuxbios vs award bios on EPIA-M

Dave Ashley linuxbios at xdr.com
Wed Nov 24 11:24:01 CET 2004


The VIA XFree86 module for CLE266 used on the epia-m makes some
assumptions about certain of the VGA registers containing information
that would have been set by the bios. Specifically here is a code
snippet from XFree86 4.3.0:

    /* Next go on to detect amount of installed ram */
    if (pScrn->videoRam < 16384 || pScrn->videoRam > 65536) {
        bMemSize = BIOS_GetVideoMemSize(pScrn);
        if (bMemSize) {
            pScrn->videoRam = bMemSize << 6;
        }
        else {
            VGAOUT8(0x3C4, 0x39);
            bMemSize = VGAIN8(0x3c5);
            if (bMemSize > 16 && bMemSize <= 128) {
                pScrn->videoRam = (bMemSize + 1) << 9;
            }
            else if (bMemSize > 0 && bMemSize < 31){
                pScrn->videoRam = bMemSize << 12;
            }
            else {
                DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                "bMemSize = %d\nGet Video Memory Size by default.\n", bMemSize));
                pScrn->videoRam = VIAGetMemSize();
            }
        }
    }


And here is from XFree86 4.4.0:

    /* detect amount of installed ram */
    if (pScrn->videoRam < 16384 || pScrn->videoRam > 65536) {
	if(pVia->Chipset == VIA_CLE266)
	    bMemSize = hwp->readSeq(hwp, 0x34);
	else
	    bMemSize = hwp->readSeq(hwp, 0x39);

	if (bMemSize > 16 && bMemSize <= 128)
	    pScrn->videoRam = (bMemSize + 1) << 9;
	else if (bMemSize > 0 && bMemSize < 31)
	    pScrn->videoRam = bMemSize << 12;
	else {
	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Memory size detection failed: using 16MB\n");
	    pScrn->videoRam = 16 << 10;	/* Assume the base 16Mb */
	}
    }



So the older version tries to query the BIOS first. The newer version
doesn't even bother with the bios and assumes the VGA Seq registers
0x39 or 0x34 contain the memory size.

3c5.34 is Scratch Pad Register 3
3c5.39 is BIOS reserved register 0

XF4.4.0 seems to abstract how the VGA sequence registers are accessed.
Even the logic seems strange, XF4.3.0 assumes seq 0x39 has the info,
but XF4.4.0 assumes seq 0x39 has the info.

linuxbios isn't initializing either as far as I know. To handle this
safely it would seem it must set the ram size in both seq registers.

This seems really weird, using vga seq scratch registers to convey information
from the BIOS to XFree86. Is this common or something specific to VIA?

-Dave



More information about the coreboot mailing list