Esempio n. 1
0
static void setregs(const unsigned char regs[], int mode)
{  
    int i;
    unsigned int *p = (unsigned int *)(regs+VGA_TOTAL_REGS);
    const unsigned char *q = regs+188;

    unlock();

    GLINT_SLOW_WRITE_REG(0xFF, PM2DACReadMask);

    if(chiptype == cPM2V)
    	GLINT_SLOW_WRITE_REG(p[19], ChipConfig);
    GLINT_SLOW_WRITE_REG(p[0], Aperture0);
    GLINT_SLOW_WRITE_REG(p[1], Aperture1);
    GLINT_SLOW_WRITE_REG(p[2], PMFramebufferWriteMask);
    GLINT_SLOW_WRITE_REG(p[3], PMBypassWriteMask);
    GLINT_SLOW_WRITE_REG(p[4], DFIFODis);
    GLINT_SLOW_WRITE_REG(p[5], FIFODis);
    if(0)
    	GLINT_SLOW_WRITE_REG(p[6], PMMemConfig);
    GLINT_SLOW_WRITE_REG(p[17], PMVideoControl);
    GLINT_SLOW_WRITE_REG(p[9], PMHgEnd);
    GLINT_SLOW_WRITE_REG(p[16], PMScreenBase);
    GLINT_SLOW_WRITE_REG(p[18], VClkCtl);
    GLINT_SLOW_WRITE_REG(p[10], PMScreenStride);
    GLINT_SLOW_WRITE_REG(p[7], PMHTotal);
    GLINT_SLOW_WRITE_REG(p[8], PMHbEnd);
    GLINT_SLOW_WRITE_REG(p[24], PMHsStart);
    GLINT_SLOW_WRITE_REG(p[11], PMHsEnd);
    GLINT_SLOW_WRITE_REG(p[12], PMVTotal);
    GLINT_SLOW_WRITE_REG(p[13], PMVbEnd);
    GLINT_SLOW_WRITE_REG(p[14], PMVsStart);
    GLINT_SLOW_WRITE_REG(p[15], PMVsEnd);
    if(chiptype != cPM2V)
    	GLINT_SLOW_WRITE_REG(p[19], ChipConfig);
    
    for (i=0;i<768;i++) {
	    Permedia2WriteAddress(i);
	    Permedia2WriteData(regs[VGA_TOTAL_REGS + 128 + i]);
    }
		
	switch(chiptype) {
		case cPM2:
                    Permedia2OutIndReg(PM2DACIndexMCR, 0x00, p[25]);
    		    Permedia2OutIndReg(PM2DACIndexMDCR, 0x00, p[26]);
    		    Permedia2OutIndReg(PM2DACIndexCMR, 0x00, p[27]);
    		    Permedia2OutIndReg(PM2DACIndexClockAM, 0x00, p[20]);
    		    Permedia2OutIndReg(PM2DACIndexClockAN, 0x00, p[21]);
    		    Permedia2OutIndReg(PM2DACIndexClockAP, 0x00, p[22]);
                    break;
		case cPM2V:
		    GLINT_SLOW_WRITE_REG(p[23],PM2VDACRDIndexControl);
		    Permedia2vOutIndReg(PM2VDACRDOverlayKey, 0x00, p[25]);
		    Permedia2vOutIndReg(PM2VDACRDSyncControl, 0x00, p[26]);
		    Permedia2vOutIndReg(PM2VDACRDMiscControl, 0x00, p[27]);
		    Permedia2vOutIndReg(PM2VDACRDDACControl, 0x00, p[28]);
		    Permedia2vOutIndReg(PM2VDACRDPixelSize, 0x00, p[29]);
		    Permedia2vOutIndReg(PM2VDACRDColorFormat, 0x00, p[30]);
		    i = Permedia2vInIndReg(PM2VDACIndexClockControl) & 0xFC;
		    Permedia2vOutIndReg(PM2VDACRDDClk0PreScale, 0x00, p[20]);
		    Permedia2vOutIndReg(PM2VDACRDDClk0FeedbackScale, 0x00, p[21]);
		    Permedia2vOutIndReg(PM2VDACRDDClk0PostScale, 0x00, p[22]);
		    Permedia2vOutIndReg(PM2VDACIndexClockControl, 0x00, i | 0x03);
                    for(i=0;i<6;i++)
                        Permedia2vOutIndReg(PM2VDACRDCursorPalette+i, 0x00, q[i]);
                    Permedia2vOutIndReg(PM2VDACRDCursorHotSpotX, 0x00, q[6]);
                    Permedia2vOutIndReg(PM2VDACRDCursorHotSpotY, 0x00, q[7]);
                    Permedia2vOutIndReg(PM2VDACRDCursorXLow, 0x00, q[8]);
                    Permedia2vOutIndReg(PM2VDACRDCursorXHigh, 0x00, q[9]);
                    Permedia2vOutIndReg(PM2VDACRDCursorYLow, 0x00, q[10]);
                    Permedia2vOutIndReg(PM2VDACRDCursorYHigh, 0x00, q[11]);
                    Permedia2vOutIndReg(PM2DACCursorControl, 0x00, q[12]);
                    Permedia2vOutIndReg(PM2VDACRDCursorMode, 0x00, q[13]);
	}

}
Esempio n. 2
0
static int saveregs(unsigned char regs[])
{ 
    int i;
    unsigned int *p = (unsigned int *)(regs+VGA_TOTAL_REGS);
    unsigned char *q = regs+188;

    unlock();

    p[0]=GLINT_READ_REG(Aperture0);
    p[1]=GLINT_READ_REG(Aperture1);
    p[2]=GLINT_READ_REG(PMFramebufferWriteMask);
    p[3]=GLINT_READ_REG(PMBypassWriteMask);
    p[4]=GLINT_READ_REG(DFIFODis);
    p[5]=GLINT_READ_REG(FIFODis);
    p[6]=GLINT_READ_REG(PMMemConfig);
    p[7]=GLINT_READ_REG(PMHTotal);
    p[8]=GLINT_READ_REG(PMHbEnd);
    p[9]=GLINT_READ_REG(PMHgEnd);
    p[10]=GLINT_READ_REG(PMScreenStride);
    p[24]=GLINT_READ_REG(PMHsStart);
    p[11]=GLINT_READ_REG(PMHsEnd);
    p[12]=GLINT_READ_REG(PMVTotal);
    p[13]=GLINT_READ_REG(PMVbEnd);
    p[14]=GLINT_READ_REG(PMVsStart);
    p[15]=GLINT_READ_REG(PMVsEnd);
    p[16]=GLINT_READ_REG(PMScreenBase);
    p[17]=GLINT_READ_REG(PMVideoControl);
    p[18]=GLINT_READ_REG(VClkCtl);
    p[19]=GLINT_READ_REG(ChipConfig);

    for(i=0;i<768;i++) {
	    Permedia2ReadAddress(i);
	    regs[128+VGA_TOTAL_REGS+i]=Permedia2ReadData();
    }
    
	switch(chiptype) {
		case cPM2:
			p[25]=Permedia2InIndReg(PM2DACIndexMCR);
    		p[26]=Permedia2InIndReg(PM2DACIndexMDCR);
    		p[27]=Permedia2InIndReg(PM2DACIndexCMR);
    		p[20]=Permedia2InIndReg(PM2DACIndexClockAM);
 			p[21]=Permedia2InIndReg(PM2DACIndexClockAN);
   			p[22]=Permedia2InIndReg(PM2DACIndexClockAP);
    		break;
		case cPM2V:
			p[23]=GLINT_READ_REG(PM2VDACRDIndexControl);
			p[25]=Permedia2vInIndReg(PM2VDACRDOverlayKey);
			p[26]=Permedia2vInIndReg(PM2VDACRDSyncControl);
			p[27]=Permedia2vInIndReg(PM2VDACRDMiscControl);
			p[28]=Permedia2vInIndReg(PM2VDACRDDACControl);
			p[29]=Permedia2vInIndReg(PM2VDACRDPixelSize);
			p[30]=Permedia2vInIndReg(PM2VDACRDColorFormat);
			p[20]=Permedia2vInIndReg(PM2VDACRDDClk0PreScale);
			p[21]=Permedia2vInIndReg(PM2VDACRDDClk0FeedbackScale);
			p[22]=Permedia2vInIndReg(PM2VDACRDDClk0PostScale);
                        
                        for(i=0;i<6;i++)
                            q[i]=Permedia2vInIndReg(PM2VDACRDCursorPalette+i);
                        q[6]=Permedia2vInIndReg(PM2VDACRDCursorHotSpotX);
                        q[7]=Permedia2vInIndReg(PM2VDACRDCursorHotSpotY);
                        q[8]=Permedia2vInIndReg(PM2VDACRDCursorXLow);
                        q[9]=Permedia2vInIndReg(PM2VDACRDCursorXHigh);
                        q[10]=Permedia2vInIndReg(PM2VDACRDCursorYLow);
                        q[11]=Permedia2vInIndReg(PM2VDACRDCursorYHigh);
                        q[12]=Permedia2vInIndReg(PM2DACCursorControl);
                        q[13]=Permedia2vInIndReg(PM2VDACRDCursorMode);
			break;
	}
	
    return TOTAL_REGS - VGA_TOTAL_REGS;
}
void
Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg)
{
    GLINTPtr pGlint = GLINTPTR(pScrn);
    CARD32 temp;
    int i;

    /* We can't rely on the vgahw layer copying the font information
     * back properly, due to problems with MMIO access to VGA space
     * so we memcpy the information using the slow routines */
    if (pGlint->STATE)
	xf86SlowBcopy((CARD8*)pGlint->VGAdata, (CARD8*)pGlint->FbBase, 65536);

    if ((pGlint->numMultiDevices == 2) || (IS_J2000)) {
	RESTOREREG(GCSRAperture);
    }

    if (pGlint->MultiAperture) {
	RESTOREREG(GMultGLINTAperture);
	RESTOREREG(GMultGLINT1);
	RESTOREREG(GMultGLINT2);
    }

    /* Permedia 3 memory Timings */
    RESTOREREG(PM3MemBypassWriteMask);
    RESTOREREG(PM3ByAperture1Mode);
    RESTOREREG(PM3ByAperture2Mode);
    RESTOREREG(ChipConfig);
    RESTOREREG(Aperture0);
    RESTOREREG(Aperture1);
    RESTOREREG(PM3FifoControl);
    if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)
    	RESTOREREG(DFIFODis);
    RESTOREREG(FIFODis);
    RESTOREREG(PMVideoControl);
    RESTOREREG(PMHbEnd);
    RESTOREREG(PMHgEnd);
    RESTOREREG(PMScreenBase);
    RESTOREREG(VClkCtl);
    RESTOREREG(PMScreenStride);
    RESTOREREG(PMHTotal);
    RESTOREREG(PMHsStart);
    RESTOREREG(PMHsEnd);
    RESTOREREG(PMVTotal);
    RESTOREREG(PMVbEnd);
    RESTOREREG(PMVsStart);
    RESTOREREG(PMVsEnd);

    if (pGlint->UseFlatPanel) {
    	RESTOREREG(VSConfiguration);
    	RESTOREREG(VSBBase);
    }

    RESTOREREG(PM2VDACRDIndexControl);
    P2VOUT(PM2VDACRDOverlayKey);
    P2VOUT(PM2VDACRDSyncControl);
    P2VOUT(PM2VDACRDMiscControl);
    P2VOUT(PM2VDACRDDACControl);
    P2VOUT(PM2VDACRDPixelSize);
    P2VOUT(PM2VDACRDColorFormat);

    for (i=0;i<768;i++) {
    	Permedia2WriteAddress(pScrn, i);
	Permedia2WriteData(pScrn, pReg->cmap[i]);
    }

    temp = Permedia2vInIndReg(pScrn, PM2VDACIndexClockControl) & 0xFC;
    P2VOUT(PM2VDACRDDClk0PreScale);
    P2VOUT(PM2VDACRDDClk0FeedbackScale);
    P2VOUT(PM2VDACRDDClk0PostScale);
    Permedia2vOutIndReg(pScrn, PM2VDACIndexClockControl, 0x00, temp|0x03);
}