Only in xf86-video-mga_ew/src/: ew3.patch Only in xf86-video-mga_ew/src/: Makefile.in diff -up xf86-video-mga/src/mga_dacG.c xf86-video-mga_ew/src/mga_dacG.c --- xf86-video-mga/src/mga_dacG.c 2015-08-17 16:27:12.993383004 -0400 +++ xf86-video-mga_ew/src/mga_dacG.c 2015-08-17 16:40:50.566420111 -0400 @@ -208,6 +208,74 @@ MGAG200WBComputePLLParam(ScrnInfoPtr pSc } static void +MGAG200EW3ComputePLLParam(long lFo, int *M, int *N, int *P) +{ + unsigned int ulComputedFo; + unsigned int ulFDelta; + unsigned int ulFPermitedDelta; + unsigned int ulFTmpDelta; + unsigned int ulVCOMax, ulVCOMin; + unsigned int ulTestP1; + unsigned int ulTestP2; + unsigned int ulTestM; + unsigned int ulTestN; + unsigned int ulPLLFreqRef; + unsigned int ulTestP1Start; + unsigned int ulTestP1End; + unsigned int ulTestP2Start; + unsigned int ulTestP2End; + unsigned int ulTestMStart; + unsigned int ulTestMEnd; + unsigned int ulTestNStart; + unsigned int ulTestNEnd; + + ulVCOMax = 800000; + ulVCOMin = 400000; + ulPLLFreqRef = 25000; + ulTestP1Start = 1; + ulTestP1End = 8; + ulTestP2Start = 1; + ulTestP2End = 8; + ulTestMStart = 1; + ulTestMEnd = 26; + ulTestNStart = 32; + ulTestNEnd = 2048; + + ulFDelta = 0xFFFFFFFF; + /* Permited delta is 0.5% as VESA Specification */ + ulFPermitedDelta = lFo * 5 / 1000; + + /* Then we need to minimize the M while staying within 0.5% */ + for (ulTestP1 = ulTestP1Start; ulTestP1 < ulTestP1End; ulTestP1++) { + for (ulTestP2 = ulTestP2Start; ulTestP2 < ulTestP2End; ulTestP2++) { + if (ulTestP1 < ulTestP2) continue; + if ((lFo * ulTestP1 * ulTestP2) > ulVCOMax) continue; + if ((lFo * ulTestP1 * ulTestP2) < ulVCOMin) continue; + + for (ulTestM = ulTestMStart; ulTestM < ulTestMEnd; ulTestM++) { + for (ulTestN = ulTestNStart; ulTestN < ulTestNEnd; ulTestN++) { + ulComputedFo = (ulPLLFreqRef * ulTestN) / (ulTestM * ulTestP1 * ulTestP2); + if (ulComputedFo > lFo) + ulFTmpDelta = ulComputedFo - lFo; + else + ulFTmpDelta = lFo - ulComputedFo; + + if (ulFTmpDelta < ulFDelta) { + ulFDelta = ulFTmpDelta; + *M = (CARD8)((ulTestN & 0x100) >> 1) | + (CARD8)(ulTestM); + *N = (CARD8)(ulTestN & 0xFF); + *P = (CARD8)((ulTestN & 0x600) >> 3) | + (CARD8)(ulTestP2 << 3) | + (CARD8)ulTestP1; + } + } + } + } + } +} + +static void MGAG200EHComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P) { unsigned int ulComputedFo; @@ -902,7 +970,14 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_o pReg->PllN = n; pReg->PllP = p; } else if (pMga->is_G200WB) { - MGAG200WBComputePLLParam(pScrn, f_out, &m, &n, &p); + if (pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI) + { + MGAG200EW3ComputePLLParam(f_out, &m, &n, &p); + } + else + { + MGAG200WBComputePLLParam(f_out, &m, &n, &p); + } pReg->PllM = m; pReg->PllN = n; @@ -1092,6 +1167,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModeP break; case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: pReg->DacRegs[MGA1064_VREF_CTL] = 0x07; pReg->Option = 0x41049120; pReg->Option2 = 0x0000b000; @@ -1232,7 +1308,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModeP if (pMga->is_G200WB){ pReg->ExtVga[1] |= 0x88; } - pReg->ExtVga_Index24 = 0x05; + pReg->ExtVga_MgaReq = 0x05; pVga->CRTC[0] = ht - 4; pVga->CRTC[1] = hd; @@ -1528,7 +1604,15 @@ MGA_NOT_HAL( if (pMga->is_G200ER) { OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24); - OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_Index24); + OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_MgaReq); + } + + if (pMga->is_G200WB) { + if(pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI) + { + OUTREG8(MGAREG_CRTCEXT_INDEX, 0x34); + OUTREG8(MGAREG_CRTCEXT_DATA, mgaReg->ExtVga_MgaReq); + } } /* This handles restoring the generic VGA registers. */ @@ -1717,8 +1801,16 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vg if (pMga->is_G200ER) { OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24); - mgaReg->ExtVga_Index24 = INREG8(MGAREG_CRTCEXT_DATA); - } + mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA); + } + if (pMga->is_G200WB) + { + if(pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI) + { + OUTREG8(MGAREG_CRTCEXT_INDEX, 0x34); + mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA); + } + } #ifdef DEBUG ErrorF("Saved values:\nDAC:"); diff -up xf86-video-mga/src/mga_driver.c xf86-video-mga_ew/src/mga_driver.c --- xf86-video-mga/src/mga_driver.c 2015-08-17 16:27:12.995383004 -0400 +++ xf86-video-mga_ew/src/mga_driver.c 2015-08-17 16:51:48.871449990 -0400 @@ -408,6 +408,22 @@ static const struct mga_device_attribute }, 16384, 0x4000, /* Memory probe size & offset values */ + }, + + /* G200WB */ + [16] = { 0, 1, 0, 0, 1, 0, 0, new_BARs, + (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION), + { + { 50000, 230000 }, /* System VCO frequencies */ + { 50000, 203400 }, /* Pixel VCO frequencies */ + { 0, 0 }, /* Video VCO frequencies */ + 45000, /* Memory clock */ + 27050, /* PLL reference frequency */ + 0, /* Supports fast bitblt? */ + MGA_HOST_PCI /* Host interface */ + }, + + 16384, 0x4000, /* Memory probe size & offset values */ } }; @@ -438,7 +454,11 @@ static const struct pci_id_match mga_dev MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_EH_PCI, 14 ), - MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_ER_PCI, 15 ), + MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_ER_PCI, 15 ), + + MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_ER_PCI, 15 ), + + MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_EW3_PCI, 16 ), { 0, 0, 0 }, }; @@ -459,6 +479,7 @@ static SymTabRec MGAChipsets[] = { { PCI_CHIP_MGAG200_EV_PCI, "mgag200 EV Maxim" }, { PCI_CHIP_MGAG200_ER_PCI, "mgag200 ER SH7757" }, { PCI_CHIP_MGAG200_WINBOND_PCI, "mgag200 eW Nuvoton" }, + { PCI_CHIP_MGAG200_EW3_PCI, "mgag200 eW3 Nuvoton" }, { PCI_CHIP_MGAG200_EH_PCI, "mgag200eH" }, { PCI_CHIP_MGAG400, "mgag400" }, { PCI_CHIP_MGAG550, "mgag550" }, @@ -486,6 +507,8 @@ static PciChipsets MGAPciChipsets[] = { RES_SHARED_VGA }, { PCI_CHIP_MGAG200_EH_PCI, PCI_CHIP_MGAG200_EH_PCI, RES_SHARED_VGA }, + { PCI_CHIP_MGAG200_EW3_PCI, PCI_CHIP_MGAG200_EW3_PCI, + RES_SHARED_VGA }, { PCI_CHIP_MGAG400, PCI_CHIP_MGAG400, RES_SHARED_VGA }, { PCI_CHIP_MGAG550, PCI_CHIP_MGAG550, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } @@ -671,6 +694,7 @@ MGAPciProbe(DriverPtr drv, int entity_nu case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_ER_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EH_PCI: xf86DrvMsg(0, X_ERROR, "mga: The PCI device 0x%x at %2.2d@%2.2d:%2.2d:%1.1d has a kernel module claiming it.\n", @@ -923,6 +947,9 @@ MGAProbe(DriverPtr drv, int flags) attrib_no = 15; break; + case PCI_CHIP_MGAG200_EW3_PCI: + attrib_no = 16; + break; default: return FALSE; @@ -1130,6 +1157,10 @@ MGACountRam(ScrnInfoPtr pScrn) else if(Option == 0) ProbeSize = 16*1024; + if (pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI) + if (ProbeSize >= 16*1024) + ProbeSize -= 4*1024; + if (ProbeSize * 1024 > MaxMapSize) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Fb size from config space doesn't fit option register\n"); @@ -1541,7 +1572,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->is_G200SE = (pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI) || (pMga->Chipset == PCI_CHIP_MGAG200_SE_B_PCI); pMga->is_G200EV = (pMga->Chipset == PCI_CHIP_MGAG200_EV_PCI); - pMga->is_G200WB = (pMga->Chipset == PCI_CHIP_MGAG200_WINBOND_PCI); + pMga->is_G200WB = (pMga->Chipset == PCI_CHIP_MGAG200_WINBOND_PCI) + || (pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI); pMga->is_G200EH = (pMga->Chipset == PCI_CHIP_MGAG200_EH_PCI); pMga->is_G200ER = (pMga->Chipset == PCI_CHIP_MGAG200_ER_PCI); @@ -1568,6 +1600,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_ER_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EH_PCI: pMga->HWCursor = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -2049,6 +2082,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_MGAG200_SE_A_PCI: case PCI_CHIP_MGAG200_SE_B_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_EH_PCI: case PCI_CHIP_MGAG200_ER_PCI: @@ -2163,6 +2197,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_MGAG200_SE_A_PCI: case PCI_CHIP_MGAG200_SE_B_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_EH_PCI: case PCI_CHIP_MGAG200_ER_PCI: @@ -2347,6 +2382,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) case PCI_CHIP_MGAG200_PCI: case PCI_CHIP_MGAG200_SE_B_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_EH_PCI: case PCI_CHIP_MGAG200_ER_PCI: @@ -3844,6 +3880,15 @@ MGAValidMode(SCRN_ARG_TYPE arg, DisplayM return MODE_VIRTUAL_Y; if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 318.77) return MODE_BANDWIDTH; + if (pMga->Chipset != PCI_CHIP_MGAG200_EW3_PCI) + { + if (pMga->KVM && mode->HDisplay > 1280) + return MODE_VIRTUAL_X; + if (pMga->KVM && mode->VDisplay > 1024) + return MODE_VIRTUAL_Y; + if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 318.77) + return MODE_BANDWIDTH; + } } else if (pMga->is_G200EV && (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 327)) { return MODE_BANDWIDTH; diff -up xf86-video-mga/src/mga.h xf86-video-mga_ew/src/mga.h --- xf86-video-mga/src/mga.h 2015-08-17 16:27:12.992383004 -0400 +++ xf86-video-mga_ew/src/mga.h 2015-08-17 16:53:16.121453950 -0400 @@ -143,6 +143,7 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,in #define PCI_CHIP_MGAG200_EV_PCI 0x0530 #define PCI_CHIP_MGAG200_EH_PCI 0x0533 #define PCI_CHIP_MGAG200_ER_PCI 0x0534 +#define PCI_CHIP_MGAG200_EW3_PCI 0x0536 #define PCI_CHIP_MGAG400 0x0525 #define PCI_CHIP_MGAG550 0x2527 @@ -209,7 +210,7 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,in typedef struct { unsigned char ExtVga[6]; unsigned char DacClk[6]; - unsigned char ExtVga_Index24; + unsigned char ExtVga_MgaReq; unsigned char Dac_Index90; unsigned char * DacRegs; unsigned long crtc2[0x58]; diff -up xf86-video-mga/src/mga_merge.c xf86-video-mga_ew/src/mga_merge.c --- xf86-video-mga/src/mga_merge.c 2015-08-17 16:27:12.996383004 -0400 +++ xf86-video-mga_ew/src/mga_merge.c 2015-08-17 16:54:25.947457119 -0400 @@ -353,6 +353,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, i case PCI_CHIP_MGAG200_SE_A_PCI: case PCI_CHIP_MGAG200_SE_B_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_EH_PCI: case PCI_CHIP_MGAG200_ER_PCI: @@ -505,6 +506,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, i case PCI_CHIP_MGAG200_SE_A_PCI: case PCI_CHIP_MGAG200_SE_B_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_EH_PCI: case PCI_CHIP_MGAG200_ER_PCI: diff -up xf86-video-mga/src/mga_storm.c xf86-video-mga_ew/src/mga_storm.c --- xf86-video-mga/src/mga_storm.c 2015-08-17 16:27:12.997383004 -0400 +++ xf86-video-mga_ew/src/mga_storm.c 2015-08-17 16:55:21.221459628 -0400 @@ -1148,6 +1148,7 @@ void MGAStormEngineInit( ScrnInfoPtr pSc case PCI_CHIP_MGAG200_SE_A_PCI: case PCI_CHIP_MGAG200_SE_B_PCI: case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EW3_PCI: case PCI_CHIP_MGAG200_EV_PCI: case PCI_CHIP_MGAG200_EH_PCI: case PCI_CHIP_MGAG200_ER_PCI: