update to xf86-video-ast 0.88.8

This commit is contained in:
matthieu 2009-03-07 11:16:36 +00:00
parent 7324280714
commit eb33bec634
11 changed files with 959 additions and 242 deletions

View File

@ -1,3 +1,38 @@
2009-01-16 Y.C. Chen <yc_chen@aspedtech.com>
* src/ast_driver.c
- Fixed Support Modes Incorrect Issues on Solaris 10 x86
2009-01-08 Y.C. Chen >yc_chen@aspedtech.com>
* src/ast.h
* src/ast_driver.c
* src/ast_2dtool.c, ast_2dtool.h
* src/ast_accel.c
* src/ast_cursor.c
* src/ast_mode.c
* src/ast_vgatool.c
- Support AST2200/2150
- Support ASPEED Graphics as Secondary
- Fixed AST1100 1280x1024x32bpp thershold issue
- Fixed Screen saver - celtic, DecayScreen abnormal issues
- Fixed Game - Potato Guys abnormal issue
2008-08-22 Y.C. Chen <yc_chen@aspeedtech.com>
* src/ast.h
* src/ast_driver.c
* src/ast_vgatool.c, ast_vgatool.h
Support AST1100/2050/2100
* src/ast_mode.c ast_mode.h
Modify the display timing of 1920x1200 to reduce blanking timing
* src/ast_driver.c
* src/ast_vgatool.c
Support Clone Display for Two VGA
2008-07-21 Y.C. Chen <yc_chen@aspeedtech.com>
* src/ast_mode.c
Fixed Incorrect Settings for Graphices Registers
2008-03-18 Y.C. Chen <yc_chen@aspeedtech.com>
* src/ast_2dtool.c
* src/ast_tool.c

View File

@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-ast],
0.85.0,
0.88.8,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-ast)

View File

@ -40,10 +40,17 @@
#define PCI_CHIP_AST2000 0x2000
#endif
#ifndef PCI_CHIP_AST2100
#define PCI_CHIP_AST2100 0x2010
#endif
typedef enum _CHIP_ID {
VGALegacy,
AST2000,
AST2100
AST2100,
AST1100,
AST2200,
AST2150
} CHIP_ID;
/* AST REC Info */
@ -156,6 +163,7 @@ typedef struct _ASTRec {
Bool MMIO2D;
int ENGCaps;
int DBGSelect;
Bool VGA2Clone;
ULONG FBPhysAddr; /* Frame buffer physical address */
ULONG MMIOPhysAddr; /* MMIO region physical address */

View File

@ -167,7 +167,7 @@ bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST)
}
*(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort;
pAST->CMDQInfo.ulWritePointer = *(ULONG *) (pAST->CMDQInfo.pjWritePort);
pAST->CMDQInfo.ulWritePointer = *(ULONG *) (pAST->CMDQInfo.pjWritePort) << 3;
break;
case VM_CMD_MMIO:
@ -189,6 +189,22 @@ bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST)
Bool
bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
{
ULONG ulData;
switch (pAST->jChipType)
{
case AST2100:
case AST1100:
case AST2200:
case AST2150:
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c);
*(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c) = (ulData & 0xFFFFFFFD);
break;
}
SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); /* enable 2D */
if (!bInitCMDQInfo(pScrn, pAST))

View File

@ -316,6 +316,10 @@ static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
ASTSetupSRCPitch(pSingleCMD, pAST->VideoModeInfo.ScreenPitch);
pSingleCMD++;
ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
@ -337,83 +341,91 @@ ASTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentScreenToScreenCopy\n");
*/
/* Modify Reg. Value */
cmdreg = pAST->ulCMDReg;
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
srcbase = dstbase = 0;
if (y1 >= MAX_SRC_Y)
{
srcbase=pAST->VideoModeInfo.ScreenPitch*y1;
y1=0;
}
if ((width != 0) && (height != 0))
{
/* Modify Reg. Value */
cmdreg = pAST->ulCMDReg;
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
srcbase = dstbase = 0;
if (y2 >= pScrn->virtualY)
{
dstbase=pAST->VideoModeInfo.ScreenPitch*y2;
y2=0;
}
if (x1 < x2)
{
src_x = x1 + width - 1;
dst_x = x2 + width - 1;
cmdreg |= CMD_X_DEC;
}
else
{
src_x = x1;
dst_x = x2;
}
if (y1 < y2)
{
src_y = y1 + height - 1;
dst_y = y2 + height - 1;
cmdreg |= CMD_Y_DEC;
}
else
{
src_y = y1;
dst_y = y2;
}
if (y1 >= MAX_SRC_Y)
{
srcbase=pAST->VideoModeInfo.ScreenPitch*y1;
}
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6);
ASTSetupSRCBase(pSingleCMD, srcbase);
pSingleCMD++;
ASTSetupDSTBase(pSingleCMD, dstbase);
pSingleCMD++;
ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
pSingleCMD++;
ASTSetupSRCXY(pSingleCMD, src_x, src_y);
pSingleCMD++;
ASTSetupRECTXY(pSingleCMD, width, height);
pSingleCMD++;
ASTSetupCMDReg(pSingleCMD, cmdreg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
ASTSetupSRCBase_MMIO(srcbase);
ASTSetupDSTBase_MMIO(dstbase);
ASTSetupDSTXY_MMIO(dst_x, dst_y);
ASTSetupSRCXY_MMIO(src_x, src_y);
ASTSetupRECTXY_MMIO(width, height);
ASTSetupCMDReg_MMIO(cmdreg);
vWaitEngIdle(pScrn, pAST);
}
if (y2 >= pScrn->virtualY)
{
dstbase=pAST->VideoModeInfo.ScreenPitch*y2;
}
if (x1 < x2)
{
src_x = x1 + width - 1;
dst_x = x2 + width - 1;
cmdreg |= CMD_X_DEC;
}
else
{
src_x = x1;
dst_x = x2;
}
if (y1 < y2)
{
if (srcbase) y1 = 0;
if (dstbase) y2 = 0;
src_y = y1 + height - 1;
dst_y = y2 + height - 1;
cmdreg |= CMD_Y_DEC;
}
else
{
if (srcbase) y1 = 0;
if (dstbase) y2 = 0;
src_y = y1;
dst_y = y2;
}
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*6);
ASTSetupSRCBase(pSingleCMD, srcbase);
pSingleCMD++;
ASTSetupDSTBase(pSingleCMD, dstbase);
pSingleCMD++;
ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
pSingleCMD++;
ASTSetupSRCXY(pSingleCMD, src_x, src_y);
pSingleCMD++;
ASTSetupRECTXY(pSingleCMD, width, height);
pSingleCMD++;
ASTSetupCMDReg(pSingleCMD, cmdreg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
ASTSetupSRCBase_MMIO(srcbase);
ASTSetupDSTBase_MMIO(dstbase);
ASTSetupDSTXY_MMIO(dst_x, dst_y);
ASTSetupSRCXY_MMIO(src_x, src_y);
ASTSetupRECTXY_MMIO(width, height);
ASTSetupCMDReg_MMIO(cmdreg);
vWaitEngIdle(pScrn, pAST);
}
} /* width & height check */
} /* end of ASTSubsequentScreenToScreenCopy */
@ -455,7 +467,11 @@ ASTSetupForSolidFill(ScrnInfoPtr pScrn,
ASTSetupDSTPitchHeight(pSingleCMD, pAST->VideoModeInfo.ScreenPitch, -1);
pSingleCMD++;
ASTSetupFG(pSingleCMD, color);
ASTSetupFG(pSingleCMD, color);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
@ -477,47 +493,51 @@ ASTSubsequentSolidFillRect(ScrnInfoPtr pScrn,
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidFillRect\n");
*/
/* Modify Reg. Value */
cmdreg = pAST->ulCMDReg;
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if (dst_y >= pScrn->virtualY)
{
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
ASTSetupDSTBase(pSingleCMD, dstbase);
pSingleCMD++;
ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
pSingleCMD++;
ASTSetupRECTXY(pSingleCMD, width, height);
pSingleCMD++;
ASTSetupCMDReg(pSingleCMD, cmdreg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
ASTSetupDSTBase_MMIO(dstbase);
ASTSetupDSTXY_MMIO(dst_x, dst_y);
ASTSetupRECTXY_MMIO(width, height);
ASTSetupCMDReg_MMIO(cmdreg);
vWaitEngIdle(pScrn, pAST);
}
if ((width != 0) && (height != 0))
{
/* Modify Reg. Value */
cmdreg = pAST->ulCMDReg;
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if (dst_y >= pScrn->virtualY)
{
dstbase=pAST->VideoModeInfo.ScreenPitch*dst_y;
dst_y=0;
}
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
ASTSetupDSTBase(pSingleCMD, dstbase);
pSingleCMD++;
ASTSetupDSTXY(pSingleCMD, dst_x, dst_y);
pSingleCMD++;
ASTSetupRECTXY(pSingleCMD, width, height);
pSingleCMD++;
ASTSetupCMDReg(pSingleCMD, cmdreg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
ASTSetupDSTBase_MMIO(dstbase);
ASTSetupDSTXY_MMIO(dst_x, dst_y);
ASTSetupRECTXY_MMIO(width, height);
ASTSetupCMDReg_MMIO(cmdreg);
vWaitEngIdle(pScrn, pAST);
}
} /* width & height check */
} /* end of ASTSubsequentSolidFillRect */
@ -563,6 +583,9 @@ static void ASTSetupForSolidLine(ScrnInfoPtr pScrn,
pSingleCMD++;
ASTSetupBG(pSingleCMD, 0);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
@ -586,58 +609,61 @@ static void ASTSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
/*
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ASTSubsequentSolidHorVertLine\n");
*/
/* Modify Reg. Value */
cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT;
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if(dir == DEGREES_0) { /* horizontal */
width = len;
height = 1;
} else { /* vertical */
width = 1;
height = len;
}
if ((y + height) >= pScrn->virtualY)
{
dstbase=pAST->VideoModeInfo.ScreenPitch*y;
y=0;
}
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
ASTSetupDSTBase(pSingleCMD, dstbase);
pSingleCMD++;
ASTSetupDSTXY(pSingleCMD, x, y);
pSingleCMD++;
ASTSetupRECTXY(pSingleCMD, width, height);
pSingleCMD++;
ASTSetupCMDReg(pSingleCMD, cmdreg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
ASTSetupDSTBase_MMIO(dstbase);
ASTSetupDSTXY_MMIO(x, y);
ASTSetupRECTXY_MMIO(width, height);
ASTSetupCMDReg_MMIO(cmdreg);
vWaitEngIdle(pScrn, pAST);
}
if (len != 0)
{
/* Modify Reg. Value */
cmdreg = (pAST->ulCMDReg & (~CMD_MASK)) | CMD_BITBLT;
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if(dir == DEGREES_0) { /* horizontal */
width = len;
height = 1;
} else { /* vertical */
width = 1;
height = len;
}
if ((y + height) >= pScrn->virtualY)
{
dstbase=pAST->VideoModeInfo.ScreenPitch*y;
y=0;
}
if (!pAST->MMIO2D)
{
/* Write to CMDQ */
pSingleCMD = (PKT_SC *) pjRequestCMDQ(pAST, PKT_SINGLE_LENGTH*4);
ASTSetupDSTBase(pSingleCMD, dstbase);
pSingleCMD++;
ASTSetupDSTXY(pSingleCMD, x, y);
pSingleCMD++;
ASTSetupRECTXY(pSingleCMD, width, height);
pSingleCMD++;
ASTSetupCMDReg(pSingleCMD, cmdreg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
ASTSetupDSTBase_MMIO(dstbase);
ASTSetupDSTXY_MMIO(x, y);
ASTSetupRECTXY_MMIO(width, height);
ASTSetupCMDReg_MMIO(cmdreg);
vWaitEngIdle(pScrn, pAST);
}
} /* len check */
} /* end of ASTSubsequentSolidHorVertLine */
@ -674,7 +700,7 @@ static void ASTSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
y1 -= miny;
y2 -= miny;
}
LineInfo.X1 = x1;
LineInfo.Y1 = y1;
LineInfo.X2 = x2;
@ -783,7 +809,10 @@ ASTSetupForDashedLine(ScrnInfoPtr pScrn,
pSingleCMD++;
ASTSetupLineStyle1(pSingleCMD, *pattern);
pSingleCMD++;
ASTSetupLineStyle2(pSingleCMD, *(pattern+4));
ASTSetupLineStyle2(pSingleCMD, *(pattern+4));
/* Update Write Pointer */
mUpdateWritePointer;
}
else
@ -825,7 +854,7 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
if (pAST->EnableClip)
ulCommand |= CMD_ENABLE_CLIP;
else
ulCommand &= ~CMD_ENABLE_CLIP;
ulCommand &= ~CMD_ENABLE_CLIP;
dstbase = 0;
miny = (y1 > y2) ? y2 : y1;
maxy = (y1 > y2) ? y1 : y2;
@ -834,7 +863,7 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
y1 -= miny;
y2 -= miny;
}
LineInfo.X1 = x1;
LineInfo.Y1 = y1;
LineInfo.X2 = x2;
@ -873,7 +902,7 @@ ASTSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
/* Patch KDE pass abnormal point, ycchen@052507 */
vWaitEngIdle(pScrn, pAST);
}
else
{
@ -937,7 +966,11 @@ ASTSetupForMonoPatternFill(ScrnInfoPtr pScrn,
pSingleCMD++;
ASTSetupMONO1(pSingleCMD, patx);
pSingleCMD++;
ASTSetupMONO2(pSingleCMD, paty);
ASTSetupMONO2(pSingleCMD, paty);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
@ -968,7 +1001,7 @@ ASTSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if (dst_y >= pScrn->virtualY)
@ -1056,7 +1089,11 @@ ASTSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
ASTSetupPatReg(pSingleCMD, (i*j + j) , (*(CARD32 *) (pataddr++)));
pSingleCMD++;
}
}
}
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
@ -1089,7 +1126,7 @@ ASTSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if (dst_y >= pScrn->virtualY)
@ -1174,6 +1211,9 @@ ASTSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
ASTSetupFG(pSingleCMD, fg);
pSingleCMD++;
ASTSetupBG(pSingleCMD, bg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
@ -1205,7 +1245,7 @@ ASTSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
if (pAST->EnableClip)
cmdreg |= CMD_ENABLE_CLIP;
else
cmdreg &= ~CMD_ENABLE_CLIP;
cmdreg &= ~CMD_ENABLE_CLIP;
dstbase = 0;
if (dst_y >= pScrn->virtualY)
@ -1298,6 +1338,9 @@ ASTSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
ASTSetupFG(pSingleCMD, fg);
pSingleCMD++;
ASTSetupBG(pSingleCMD, bg);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
@ -1398,7 +1441,11 @@ ASTSetClippingRectangle(ScrnInfoPtr pScrn,
ASTSetupCLIP1(pSingleCMD, left, top);
pSingleCMD++;
ASTSetupCLIP2(pSingleCMD, right, bottom);
ASTSetupCLIP2(pSingleCMD, right, bottom);
/* Update Write Pointer */
mUpdateWritePointer;
}
else
{
@ -1418,5 +1465,4 @@ ASTDisableClipping(ScrnInfoPtr pScrn)
pAST->EnableClip = FALSE;
}
#endif /* end of Accel_2D */

View File

@ -242,6 +242,12 @@ ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
ulTempDstAnd32[1] = ((jTempSrcAnd32 >> (k-1)) & 0x01) ? 0x80000000L:0x00L;
ulTempDstXor32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? 0x40000000L:0x00L;
ulTempDstData32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? (pAST->HWCInfo.fg << 16):(pAST->HWCInfo.bg << 16);
ulTempDstData32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? (pAST->HWCInfo.fg << 16):(pAST->HWCInfo.bg << 16);
/* No inverse for X Window cursor, ycchen@111808 */
if (ulTempDstAnd32[0])
ulTempDstXor32[0] = 0;
if (ulTempDstAnd32[1])
ulTempDstXor32[1] = 0;
*((ULONG *) pjDstData) = ulTempDstAnd32[0] | ulTempDstXor32[0] | ulTempDstData32[0] | ulTempDstAnd32[1] | ulTempDstXor32[1] | ulTempDstData32[1];
ulCheckSum += *((ULONG *) pjDstData);
pjDstData += 4;
@ -276,6 +282,9 @@ ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
static Bool
ASTUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
if ( (pCurs->bits->width > MAX_HWC_WIDTH) || (pCurs->bits->height > MAX_HWC_HEIGHT) )
return FALSE;
return TRUE;
}
@ -377,6 +386,9 @@ ASTLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
static Bool
ASTUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
{
if ( (pCurs->bits->width > MAX_HWC_WIDTH) || (pCurs->bits->height > MAX_HWC_HEIGHT) )
return FALSE;
return TRUE;
}

View File

@ -66,10 +66,13 @@ extern void vASTOpenKey(ScrnInfoPtr pScrn);
extern Bool bASTRegInit(ScrnInfoPtr pScrn);
extern ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
extern ULONG GetMaxDCLK(ScrnInfoPtr pScrn);
extern void GetChipType(ScrnInfoPtr pScrn);
extern void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual);
extern void ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
extern void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
extern Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
extern Bool GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
extern void vInitDRAMReg(ScrnInfoPtr pScrn);
extern Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST);
extern Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST);
@ -121,12 +124,14 @@ _X_EXPORT DriverRec AST = {
/* Chipsets */
static SymTabRec ASTChipsets[] = {
{PCI_CHIP_AST2000, "AST2000"},
{PCI_CHIP_AST2000, "ASPEED Graphics Family"},
{PCI_CHIP_AST2100, "ASPEED Graphics Family"},
{-1, NULL}
};
static PciChipsets ASTPciChipsets[] = {
{PCI_CHIP_AST2000, PCI_CHIP_AST2000, RES_SHARED_VGA},
{PCI_CHIP_AST2100, PCI_CHIP_AST2100, RES_SHARED_VGA},
{-1, -1, RES_UNDEFINED }
};
@ -137,17 +142,19 @@ typedef enum {
OPTION_HWC_NUM,
OPTION_ENG_CAPS,
OPTION_DBG_SELECT,
OPTION_NO_DDC
OPTION_NO_DDC,
OPTION_VGA2_CLONE
} ASTOpts;
static const OptionInfoRec ASTOptions[] = {
{OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_MMIO2D, "MMIO2D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_MMIO2D, "MMIO2D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_HWC_NUM, "HWCNumber", OPTV_INTEGER, {0}, FALSE},
{OPTION_ENG_CAPS, "ENGCaps", OPTV_INTEGER, {0}, FALSE},
{OPTION_DBG_SELECT, "DBGSelect", OPTV_INTEGER, {0}, FALSE},
{OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_ENG_CAPS, "ENGCaps", OPTV_INTEGER, {0}, FALSE},
{OPTION_DBG_SELECT, "DBGSelect", OPTV_INTEGER, {0}, FALSE},
{OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_VGA2_CLONE, "VGA2Clone", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@ -217,6 +224,7 @@ const char *int10Symbols[] = {
"xf86InitInt10",
"xf86Int10AllocPages",
"xf86int10Addr",
"xf86FreeInt10",
NULL
};
@ -564,11 +572,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
(pScrn->chipset != NULL) ? pScrn->chipset : "Unknown ast");
/* Resource Allocation */
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
pAST->IODBase = 0;
#else
pAST->IODBase = pScrn->domainIOBase;
#endif
/* "Patch" the PIOOffset inside vgaHW in order to force
* the vgaHW module to use our relocated i/o ports.
*/
@ -598,7 +602,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
from = X_CONFIG;
} else {
if (PCI_REGION_BASE(pAST->PciInfo, 1, REGION_MEM)) {
pAST->MMIOPhysAddr = PCI_REGION_BASE(pAST->PciInfo, 1, REGION_IO) & 0xFFFF0000;
pAST->MMIOPhysAddr = PCI_REGION_BASE(pAST->PciInfo, 1, REGION_MEM) & 0xFFFF0000;
from = X_PROBED;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@ -610,38 +614,58 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "IO registers at addr 0x%lX\n",
(unsigned long) pAST->MMIOPhysAddr);
pScrn->videoRam = GetVRAMInfo(pScrn) / 1024;
from = X_DEFAULT;
if (pAST->pEnt->device->videoRam) {
pScrn->videoRam = pAST->pEnt->device->videoRam;
from = X_CONFIG;
}
pAST->FbMapSize = pScrn->videoRam * 1024;
pAST->MMIOMapSize = DEFAULT_MMIO_SIZE;
/* Map resource */
if (!ASTMapMem(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
return FALSE;
}
/* Map MMIO */
pAST->MMIOMapSize = DEFAULT_MMIO_SIZE;
if (!ASTMapMMIO(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map Memory Map IO Failed \n");
return FALSE;
}
pScrn->memPhysBase = (ULONG)pAST->FBPhysAddr;
pScrn->fbOffset = 0;
/* Init VGA Adapter */
if (!xf86IsPrimaryPci(pAST->PciInfo))
{
if (xf86LoadSubModule(pScrn, "int10")) {
xf86Int10InfoPtr pInt10;
xf86LoaderReqSymLists(int10Symbols, NULL);
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
pInt10 = xf86InitInt10(pAST->pEnt->index);
xf86FreeInt10(pInt10);
}
}
/* Get Revision */
vASTOpenKey(pScrn);
bASTRegInit(pScrn);
/* Get Chip Type */
if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x10)
pAST->jChipType = AST2100;
GetChipType(pScrn);
else
pAST->jChipType = AST2000;
if (!xf86IsPrimaryPci(pAST->PciInfo))
{
vInitDRAMReg (pScrn);
}
/* Map Framebuffer */
pScrn->videoRam = GetVRAMInfo(pScrn) / 1024;
from = X_DEFAULT;
if (pAST->pEnt->device->videoRam) {
pScrn->videoRam = pAST->pEnt->device->videoRam;
from = X_CONFIG;
}
pAST->FbMapSize = pScrn->videoRam * 1024;
if (!ASTMapMem(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
return FALSE;
}
pScrn->memPhysBase = (ULONG)pAST->FBPhysAddr;
pScrn->fbOffset = 0;
/* Do DDC
* should be done after xf86CollectOptions
*/
@ -657,7 +681,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
clockRanges->doubleScanAllowed = FALSE;
/* Add for AST2100, ycchen@061807 */
if (pAST->jChipType == AST2100)
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200))
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
0, 320, 1920, 8 * pScrn->bitsPerPixel,
@ -1018,7 +1042,7 @@ ASTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
}
/* Add for AST2100, ycchen@061807 */
if (pAST->jChipType == AST2100)
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200))
{
if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1200) )
return MODE_OK;
@ -1082,7 +1106,6 @@ ASTFreeRec(ScrnInfoPtr pScrn)
static Bool
ASTSaveScreen(ScreenPtr pScreen, Bool unblack)
{
/* more ref. SiS */
return vgaHWSaveScreen(pScreen, unblack);
}
@ -1146,7 +1169,12 @@ ASTSave(ScrnInfoPtr pScrn)
astReg = &pAST->SavedReg;
/* do save */
vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
if (xf86IsPrimaryPci(pAST->PciInfo)) {
vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
}
else {
vgaHWSave(pScrn, vgaReg, VGA_SR_MODE);
}
/* Ext. Save */
vASTOpenKey(pScrn);
@ -1173,8 +1201,11 @@ ASTRestore(ScrnInfoPtr pScrn)
astReg = &pAST->SavedReg;
/* do restore */
vgaHWProtect(pScrn, TRUE);
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
vgaHWProtect(pScrn, TRUE);
if (xf86IsPrimaryPci(pAST->PciInfo))
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
else
vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
vgaHWProtect(pScrn, FALSE);
/* Ext. restore */
@ -1201,13 +1232,22 @@ ASTProbeDDC(ScrnInfoPtr pScrn, int index)
}
}
#define SkipDT 0x00
#define DT1 0x01
#define DT2 0x02
static xf86MonPtr
ASTDoDDC(ScrnInfoPtr pScrn, int index)
{
vbeInfoPtr pVbe;
xf86MonPtr MonInfo = NULL;
xf86MonPtr MonInfo = NULL, MonInfo1 = NULL, MonInfo2 = NULL;
ASTRecPtr pAST = ASTPTR(pScrn);
unsigned long i, j, k;
unsigned char DDC_data[128];
struct monitor_ranges ranges, ranges1, ranges2;
int DTSelect, dclock1=0, h_active1=0, v_active1=0, dclock2=0, h_active2=0, v_active2=0;
struct std_timings stdtiming, *stdtiming1, *stdtiming2;
/* Honour Option "noDDC" */
if (xf86ReturnOptValBool(pAST->Options, OPTION_NO_DDC, FALSE)) {
return MonInfo;
@ -1215,7 +1255,150 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL, index))) {
xf86LoaderReqSymLists(vbeSymbols, NULL);
MonInfo = vbeDoEDID(pVbe, NULL);
MonInfo1 = vbeDoEDID(pVbe, NULL);
MonInfo = MonInfo1;
/* For VGA2 CLONE Support, ycchen@012508 */
if ((xf86ReturnOptValBool(pAST->Options, OPTION_VGA2_CLONE, FALSE)) || pAST->VGA2Clone) {
if (GetVGA2EDID(pScrn, DDC_data) == TRUE) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Get VGA2 EDID Correctly!! \n");
MonInfo2 = xf86InterpretEDID(pScrn->scrnIndex, DDC_data);
if (MonInfo1 == NULL) /* No DDC1 EDID */
MonInfo = MonInfo2;
else { /* Check with VGA1 & VGA2 EDID */
/* Update establishment timing */
MonInfo->timings1.t1 = MonInfo1->timings1.t1 & MonInfo2->timings1.t1;
MonInfo->timings1.t2 = MonInfo1->timings1.t2 & MonInfo2->timings1.t2;
MonInfo->timings1.t_manu = MonInfo1->timings1.t_manu & MonInfo2->timings1.t_manu;
/* Update Std. Timing */
for (i=0; i<8; i++) {
stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0;
for (j=0; j<8; j++) {
if ((MonInfo1->timings2[i].hsize == MonInfo2->timings2[j].hsize) && \
(MonInfo1->timings2[i].vsize == MonInfo2->timings2[j].vsize) && \
(MonInfo1->timings2[i].refresh == MonInfo2->timings2[j].refresh)) {
stdtiming = MonInfo1->timings2[i];
break;
}
}
MonInfo->timings2[i] = stdtiming;
} /* Std. Timing */
/* Get Detailed Timing */
for (i=0;i<4;i++) {
if (MonInfo1->det_mon[i].type == 0xFD)
ranges1 = MonInfo1->det_mon[i].section.ranges;
else if (MonInfo1->det_mon[i].type == 0xFA)
stdtiming1 = MonInfo1->det_mon[i].section.std_t;
else if (MonInfo1->det_mon[i].type == 0x00) {
if (MonInfo1->det_mon[i].section.d_timings.clock > dclock1)
dclock1 = MonInfo1->det_mon[i].section.d_timings.clock;
if (MonInfo1->det_mon[i].section.d_timings.h_active > h_active1)
h_active1 = MonInfo1->det_mon[i].section.d_timings.h_active;
if (MonInfo1->det_mon[i].section.d_timings.v_active > v_active1)
v_active1 = MonInfo1->det_mon[i].section.d_timings.v_active;
}
if (MonInfo2->det_mon[i].type == 0xFD)
ranges2 = MonInfo2->det_mon[i].section.ranges;
else if (MonInfo1->det_mon[i].type == 0xFA)
stdtiming2 = MonInfo2->det_mon[i].section.std_t;
else if (MonInfo2->det_mon[i].type == 0x00) {
if (MonInfo2->det_mon[i].section.d_timings.clock > dclock2)
dclock2 = MonInfo2->det_mon[i].section.d_timings.clock;
if (MonInfo2->det_mon[i].section.d_timings.h_active > h_active2)
h_active2 = MonInfo2->det_mon[i].section.d_timings.h_active;
if (MonInfo2->det_mon[i].section.d_timings.v_active > v_active2)
v_active2 = MonInfo2->det_mon[i].section.d_timings.v_active;
}
} /* Get Detailed Timing */
/* Chk Detailed Timing */
if ((dclock1 >= dclock2) && (h_active1 >= h_active2) && (v_active1 >= v_active2))
DTSelect = DT2;
else if ((dclock2 >= dclock1) && (h_active2 >= h_active1) && (v_active2 >= v_active1))
DTSelect = DT1;
else
DTSelect = SkipDT;
/* Chk Monitor Descriptor */
ranges = ranges1;
ranges.min_h = ranges1.min_h > ranges2.min_h ? ranges1.min_h:ranges2.min_h;
ranges.min_v = ranges1.min_v > ranges2.min_v ? ranges1.min_v:ranges2.min_v;
ranges.max_h = ranges1.max_h < ranges2.max_h ? ranges1.max_h:ranges2.max_h;
ranges.max_v = ranges1.max_v < ranges2.max_v ? ranges1.max_v:ranges2.max_v;
ranges.max_clock = ranges1.max_clock < ranges2.max_clock ? ranges1.max_clock:ranges2.max_clock;
/* Update Detailed Timing */
for (i=0; i<4; i++)
{
if (MonInfo->det_mon[i].type == 0xFD) {
MonInfo->det_mon[i].section.ranges = ranges;
}
else if (MonInfo->det_mon[i].type == 0xFA) {
for (j=0; j<5; j++) {
stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0;
for (k=0; k<5; k++) {
if ((stdtiming1[j].hsize == stdtiming2[k].hsize) && \
(stdtiming1[j].vsize == stdtiming2[k].vsize) && \
(stdtiming1[j].refresh == stdtiming2[k].refresh)) {
stdtiming = stdtiming1[j];
break;
}
}
stdtiming1[j] = stdtiming;
} /* Std. Timing */
} /* FA */
else if (MonInfo->det_mon[i].type == 0x00) {
if (DTSelect == DT2)
MonInfo->det_mon[i] = MonInfo2->det_mon[i];
else if (DTSelect == DT1)
MonInfo->det_mon[i] = MonInfo1->det_mon[i];
else /* SkipDT */
{ /* use 1024x768 as default */
MonInfo->det_mon[i] = MonInfo1->det_mon[i];
MonInfo->det_mon[i].section.d_timings.clock = 65000000;
MonInfo->det_mon[i].section.d_timings.h_active = 1024;
MonInfo->det_mon[i].section.d_timings.h_blanking = 320;
MonInfo->det_mon[i].section.d_timings.v_active = 768;
MonInfo->det_mon[i].section.d_timings.v_blanking = 38;
MonInfo->det_mon[i].section.d_timings.h_sync_off = 24;
MonInfo->det_mon[i].section.d_timings.h_sync_width = 136;
MonInfo->det_mon[i].section.d_timings.v_sync_off = 3;
MonInfo->det_mon[i].section.d_timings.v_sync_width = 6;
}
} /* 00 */
else { /* use Monitor 1 as default */
MonInfo->det_mon[i] = MonInfo1->det_mon[i];
}
} /* Update Detailed Timing */
/* set feature size */
if (DTSelect == DT2) {
MonInfo->features.hsize = MonInfo2->features.hsize;
MonInfo->features.vsize = MonInfo2->features.vsize;
}
else if (DTSelect == DT1) {
MonInfo->features.hsize = MonInfo1->features.hsize;
MonInfo->features.vsize = MonInfo1->features.vsize;
}
else /* Skip DT */
{ /* use 1024x768 as default */
MonInfo->features.hsize = 0x20;
MonInfo->features.vsize = 0x18;
}
} /* Check with VGA1 & VGA2 EDID */
} /* GetVGA2EDID */
else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Can't Get VGA2 EDID Correctly!! \n");
}
}
xf86PrintEDID(MonInfo);
xf86SetDDCproperties(pScrn, MonInfo);
vbeFree(pVbe);
@ -1223,7 +1406,7 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"this driver cannot do DDC without VBE\n");
}
return MonInfo;
}

View File

@ -190,11 +190,11 @@ VBIOS_ENHTABLE_STRUCT Res1600x1200Table[] = {
(SyncPP | Charx8Dot), 0xFF, 1, 0x33 },
};
VBIOS_ENHTABLE_STRUCT Res1920x1200Table[] = {
{2592, 1920,136, 200, 1245, 1200, 3, 6, VCLK193_25, /* 60Hz */
(SyncPP | Charx8Dot), 60, 1, 0x33 },
{2592, 1920,136, 200, 1245, 1200, 3, 6, VCLK193_25, /* end */
(SyncPP | Charx8Dot), 0xFF, 1, 0x33 },
VBIOS_ENHTABLE_STRUCT Res1920x1200Table[] = {
{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */
(SyncNP | Charx8Dot), 60, 1, 0x34 },
{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */
(SyncNP | Charx8Dot), 0xFF, 1, 0x34 },
};
VBIOS_DCLK_INFO DCLKTable [] = {
@ -214,7 +214,7 @@ VBIOS_DCLK_INFO DCLKTable [] = {
{0x85, 0x24, 0x00}, /* 0D: VCLK135 */
{0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */
{0x6A, 0x22, 0x00}, /* 0F: VCLK162 */
{0x61, 0x2C, 0x81}, /* 10: VCLK193_25 */
{0x4d, 0x4c, 0x80}, /* 10: VCLK193_25 */
};
VBIOS_DAC_INFO DAC_TEXT[] = {
@ -341,6 +341,7 @@ void vSetCRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMo
void vSetOffsetReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
void vSetDCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
void vSetSyncReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
Bool
@ -363,6 +364,7 @@ ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
vSetOffsetReg(pScrn, mode, &vgamodeinfo);
vSetDCLKReg(pScrn, mode, &vgamodeinfo);
vSetExtReg(pScrn, mode, &vgamodeinfo);
vSetSyncReg(pScrn, mode, &vgamodeinfo);
bSetDACReg(pScrn, mode, &vgamodeinfo);
/* post set mode */
@ -534,6 +536,7 @@ void vSetStdReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod
/* Set GR */
for (i=0; i<9; i++)
{
jReg = pStdModePtr->GR[i];
SetIndexReg(GR_PORT,(UCHAR) i, jReg);
}
@ -568,10 +571,10 @@ vSetCRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInf
if (usTemp & 0x20) jReg05 |= 0x80; /* HBE D[5] */
if (usTemp & 0x40) jRegAD |= 0x01; /* HBE D[6] */
SetIndexRegMask(CRTC_PORT,0x03, 0xE0, (UCHAR) (usTemp & 0x1F));
usTemp = (mode->CrtcHSyncStart >> 3 );
usTemp = (mode->CrtcHSyncStart >> 3 ) + 2;
if (usTemp & 0x100) jRegAC |= 0x40; /* HRS D[5] */
SetIndexRegMask(CRTC_PORT,0x04, 0x00, (UCHAR) (usTemp));
usTemp = (mode->CrtcHSyncEnd >> 3 ) & 0x3F;
usTemp = ((mode->CrtcHSyncEnd >> 3 ) + 2) & 0x3F;
if (usTemp & 0x20) jRegAD |= 0x04; /* HRE D[5] */
SetIndexRegMask(CRTC_PORT,0x05, 0x60, (UCHAR) ((usTemp & 0x1F) | jReg05));
@ -681,11 +684,33 @@ void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAMod
SetIndexRegMask(CRTC_PORT,0xA8, 0xFD, (UCHAR) jRegA8);
/* Set Threshold */
SetIndexReg(CRTC_PORT,0xA7, 0x2F);
SetIndexReg(CRTC_PORT,0xA6, 0x1F);
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150) )
{
SetIndexReg(CRTC_PORT,0xA7, 0x3F);
SetIndexReg(CRTC_PORT,0xA6, 0x2F);
}
else
{
SetIndexReg(CRTC_PORT,0xA7, 0x2F);
SetIndexReg(CRTC_PORT,0xA6, 0x1F);
}
}
void vSetSyncReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
{
PVBIOS_ENHTABLE_STRUCT pEnhModePtr;
ASTRecPtr pAST;
UCHAR jReg;
pAST = ASTPTR(pScrn);
pEnhModePtr = pVGAModeInfo->pEnhTableEntry;
jReg = GetReg(MISC_PORT_READ);
jReg |= (UCHAR) (pEnhModePtr->Flags & SyncNN);
SetReg(MISC_PORT_WRITE,jReg);
}
Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
{

View File

@ -48,7 +48,8 @@
#define VCLK135 0x0D
#define VCLK157_5 0x0E
#define VCLK162 0x0F
#define VCLK193_25 0x10
/* #define VCLK193_25 0x10 */
#define VCLK154 0x10
/* Flags Definition */
#define Charx8Dot 0x00000001

View File

@ -61,11 +61,14 @@ void vASTOpenKey(ScrnInfoPtr pScrn);
Bool bASTRegInit(ScrnInfoPtr pScrn);
ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
ULONG GetMaxDCLK(ScrnInfoPtr pScrn);
void GetChipType(ScrnInfoPtr pScrn);
void vAST1000DisplayOn(ASTRecPtr pAST);
void vAST1000DisplayOff(ASTRecPtr pAST);
void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual);
void ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
Bool GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
void vInitDRAMReg(ScrnInfoPtr pScrn);
void
vASTOpenKey(ScrnInfoPtr pScrn)
@ -172,23 +175,81 @@ GetMaxDCLK(ScrnInfoPtr pScrn)
}
/* Get Bandwidth */
/* Get Bandwidth */
/* Modify DARM utilization to 60% for AST1100/2100 16bits DRAM, ycchen@032508 */
if ( ((pAST->jChipType == AST2100) || (pAST->jChipType == AST1100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2150)) && (ulDRAMBusWidth == 16) )
DRAMEfficiency = 600;
ulDRAMBandwidth = ulMCLK * ulDRAMBusWidth * 2 / 8;
ActualDRAMBandwidth = ulDRAMBandwidth * DRAMEfficiency / 1000;
/* Get Max DCLK */
/* Get Max DCLK */
/* Fixed Fixed KVM + CRT threshold issue on AST2100 8bpp modes, ycchen@100708 */
GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg);
if (jReg & 0x08)
if ((jReg & 0x08) && (pAST->jChipType == AST2000))
ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+16) / 8);
else if ((jReg & 0x08) && (pScrn->bitsPerPixel == 8))
ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+24) / 8);
else
ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1) / 8);
if (ulDCLK > 165) ulDCLK = 165;
/* Add for AST2100, ycchen@061807 */
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200))
{
if (ulDCLK > 200) ulDCLK = 200;
}
else
{
if (ulDCLK > 165) ulDCLK = 165;
}
return(ulDCLK);
}
void
GetChipType(ScrnInfoPtr pScrn)
{
ASTRecPtr pAST = ASTPTR(pScrn);
ULONG ulData;
UCHAR jReg;
pAST->jChipType = AST2100;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1207c);
#if 0
if ((ulData & 0x0300) == 0x0200)
pAST->jChipType = AST1100;
#endif
switch (ulData & 0x0300)
{
case 0x0200:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST1100 Detected.\n");
pAST->jChipType = AST1100;
break;
case 0x0100:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2200 Detected.\n");
pAST->jChipType = AST2200;
break;
case 0x0000:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2150 Detected.\n");
pAST->jChipType = AST2150;
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AST2100 Detected.\n");
pAST->jChipType = AST2100;
}
/* VGA2 Clone Support */
GetIndexRegMask(CRTC_PORT, 0x90, 0xFF, jReg);
if (jReg & 0x10)
pAST->VGA2Clone = TRUE;
}
void
vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base)
{
@ -319,3 +380,331 @@ ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
}
#define I2C_BASE 0x1e780000
#define I2C_OFFSET (0xA000 + 0x40 * 4) /* port4 */
#define I2C_DEVICEADDR 0x0A0 /* slave addr */
Bool
GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer)
{
ASTRecPtr pAST = ASTPTR(pScrn);
UCHAR *ulI2CBase = pAST->MMIOVirtualAddr + 0x10000 + I2C_OFFSET;
ULONG i, ulData;
UCHAR *pjEDID;
pjEDID = pEDIDBuffer;
/* SCU settings */
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
xf86UDelay(10000);
*(ULONG *) (pAST->MMIOVirtualAddr + 0x12000) = 0x1688A8A8;
ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x12004);
ulData &= 0xfffffffb;
*(ULONG *) (pAST->MMIOVirtualAddr + 0x12004) = ulData;
xf86UDelay(10000);
/* I2C settings */
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = I2C_BASE;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
xf86UDelay(10000);
/* I2C Start */
*(ULONG *) (ulI2CBase + 0x00) = 0x0;
*(ULONG *) (ulI2CBase + 0x04) = 0x77777355;
*(ULONG *) (ulI2CBase + 0x08) = 0x0;
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(ULONG *) (ulI2CBase + 0x00) = 0x1;
*(ULONG *) (ulI2CBase + 0x0C) = 0xAF;
*(ULONG *) (ulI2CBase + 0x20) = I2C_DEVICEADDR;
*(ULONG *) (ulI2CBase + 0x14) = 0x03;
do {
ulData = *(volatile ULONG *) (ulI2CBase + 0x10);
} while (!(ulData & 0x03));
if (ulData & 0x02) /* NACK */
return (FALSE);
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(ULONG *) (ulI2CBase + 0x20) = (ULONG) 0; /* Offset */
*(ULONG *) (ulI2CBase + 0x14) = 0x02;
do {
ulData = *(volatile ULONG *) (ulI2CBase + 0x10);
} while (!(ulData & 0x01));
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(ULONG *) (ulI2CBase + 0x20) = I2C_DEVICEADDR + 1;
*(ULONG *) (ulI2CBase + 0x14) = 0x03;
do {
ulData = *(volatile ULONG *) (ulI2CBase + 0x10);
} while (!(ulData & 0x01));
/* I2C Read */
for (i=0; i<127; i++)
{
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(ULONG *) (ulI2CBase + 0x0C) |= 0x10;
*(ULONG *) (ulI2CBase + 0x14) = 0x08;
do {
ulData = *(volatile ULONG *) (ulI2CBase + 0x10);
} while (!(ulData & 0x04));
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(UCHAR *) (pjEDID++) = (UCHAR) ((*(ULONG *) (ulI2CBase + 0x20) & 0xFF00) >> 8);
}
/* Read Last Byte */
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(ULONG *) (ulI2CBase + 0x0C) |= 0x10;
*(ULONG *) (ulI2CBase + 0x14) = 0x18;
do {
ulData = *(volatile ULONG *) (ulI2CBase + 0x10);
} while (!(ulData & 0x04));
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(UCHAR *) (pjEDID++) = (UCHAR) ((*(ULONG *) (ulI2CBase + 0x20) & 0xFF00) >> 8);
/* I2C Stop */
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
*(ULONG *) (ulI2CBase + 0x14) = 0x20;
do {
ulData = *(volatile ULONG *) (ulI2CBase + 0x10);
} while (!(ulData & 0x10));
*(ULONG *) (ulI2CBase + 0x0C) &= 0xffffffef;
*(ULONG *) (ulI2CBase + 0x10) = 0xffffffff;
return (TRUE);
} /* GetVGA2EDID */
typedef struct _AST_DRAMStruct {
USHORT Index;
ULONG Data;
} AST_DRAMStruct, *PAST_DRAMStruct;
AST_DRAMStruct AST2000DRAMTableData[] = {
{ 0x0108, 0x00000000 },
{ 0x0120, 0x00004a21 },
{ 0xFF00, 0x00000043 },
{ 0x0000, 0xFFFFFFFF },
{ 0x0004, 0x00000089 },
{ 0x0008, 0x22331353 },
{ 0x000C, 0x0d07000b },
{ 0x0010, 0x11113333 },
{ 0x0020, 0x00110350 },
{ 0x0028, 0x1e0828f0 },
{ 0x0024, 0x00000001 },
{ 0x001C, 0x00000000 },
{ 0x0014, 0x00000003 },
{ 0xFF00, 0x00000043 },
{ 0x0018, 0x00000131 },
{ 0x0014, 0x00000001 },
{ 0xFF00, 0x00000043 },
{ 0x0018, 0x00000031 },
{ 0x0014, 0x00000001 },
{ 0xFF00, 0x00000043 },
{ 0x0028, 0x1e0828f1 },
{ 0x0024, 0x00000003 },
{ 0x002C, 0x1f0f28fb },
{ 0x0030, 0xFFFFFE01 },
{ 0xFFFF, 0xFFFFFFFF }
};
AST_DRAMStruct AST1100DRAMTableData[] = {
{ 0x2000, 0x1688a8a8 },
{ 0x2020, 0x000041f0 },
{ 0xFF00, 0x00000043 },
{ 0x0000, 0xfc600309 },
{ 0x006C, 0x00909090 },
{ 0x0064, 0x00050000 },
{ 0x0004, 0x00000585 },
{ 0x0008, 0x0011030f },
{ 0x0010, 0x22201724 },
{ 0x0018, 0x1e29011a },
{ 0x0020, 0x00c82222 },
{ 0x0014, 0x01001523 },
{ 0x001C, 0x1024010d },
{ 0x0024, 0x00cb2522 },
{ 0x0038, 0xffffff82 },
{ 0x003C, 0x00000000 },
{ 0x0040, 0x00000000 },
{ 0x0044, 0x00000000 },
{ 0x0048, 0x00000000 },
{ 0x004C, 0x00000000 },
{ 0x0050, 0x00000000 },
{ 0x0054, 0x00000000 },
{ 0x0058, 0x00000000 },
{ 0x005C, 0x00000000 },
{ 0x0060, 0x032aa02a },
{ 0x0064, 0x002d3000 },
{ 0x0068, 0x00000000 },
{ 0x0070, 0x00000000 },
{ 0x0074, 0x00000000 },
{ 0x0078, 0x00000000 },
{ 0x007C, 0x00000000 },
{ 0x0034, 0x00000001 },
{ 0xFF00, 0x00000043 },
{ 0x002C, 0x00000732 },
{ 0x0030, 0x00000040 },
{ 0x0028, 0x00000005 },
{ 0x0028, 0x00000007 },
{ 0x0028, 0x00000003 },
{ 0x0028, 0x00000001 },
{ 0x000C, 0x00005a08 },
{ 0x002C, 0x00000632 },
{ 0x0028, 0x00000001 },
{ 0x0030, 0x000003c0 },
{ 0x0028, 0x00000003 },
{ 0x0030, 0x00000040 },
{ 0x0028, 0x00000003 },
{ 0x000C, 0x00005a21 },
{ 0x0034, 0x00007c03 },
{ 0x0120, 0x00004c41 },
{ 0xffff, 0xffffffff },
};
AST_DRAMStruct AST2100DRAMTableData[] = {
{ 0x2000, 0x1688a8a8 },
{ 0x2020, 0x00004120 },
{ 0xFF00, 0x00000043 },
{ 0x0000, 0xfc600309 },
{ 0x006C, 0x00909090 },
{ 0x0064, 0x00070000 },
{ 0x0004, 0x00000489 },
{ 0x0008, 0x0011030f },
{ 0x0010, 0x32302926 },
{ 0x0018, 0x274c0122 },
{ 0x0020, 0x00ce2222 },
{ 0x0014, 0x01001523 },
{ 0x001C, 0x1024010d },
{ 0x0024, 0x00cb2522 },
{ 0x0038, 0xffffff82 },
{ 0x003C, 0x00000000 },
{ 0x0040, 0x00000000 },
{ 0x0044, 0x00000000 },
{ 0x0048, 0x00000000 },
{ 0x004C, 0x00000000 },
{ 0x0050, 0x00000000 },
{ 0x0054, 0x00000000 },
{ 0x0058, 0x00000000 },
{ 0x005C, 0x00000000 },
{ 0x0060, 0x0f2aa02a },
{ 0x0064, 0x003f3005 },
{ 0x0068, 0x02020202 },
{ 0x0070, 0x00000000 },
{ 0x0074, 0x00000000 },
{ 0x0078, 0x00000000 },
{ 0x007C, 0x00000000 },
{ 0x0034, 0x00000001 },
{ 0xFF00, 0x00000043 },
{ 0x002C, 0x00000942 },
{ 0x0030, 0x00000040 },
{ 0x0028, 0x00000005 },
{ 0x0028, 0x00000007 },
{ 0x0028, 0x00000003 },
{ 0x0028, 0x00000001 },
{ 0x000C, 0x00005a08 },
{ 0x002C, 0x00000842 },
{ 0x0028, 0x00000001 },
{ 0x0030, 0x000003c0 },
{ 0x0028, 0x00000003 },
{ 0x0030, 0x00000040 },
{ 0x0028, 0x00000003 },
{ 0x000C, 0x00005a21 },
{ 0x0034, 0x00007c03 },
{ 0x0120, 0x00005061 },
{ 0xffff, 0xffffffff },
};
void vInitDRAMReg(ScrnInfoPtr pScrn)
{
AST_DRAMStruct *pjDRAMRegInfo;
ASTRecPtr pAST = ASTPTR(pScrn);
ULONG i, ulTemp;
UCHAR jReg;
GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg);
if ((jReg & 0x80) == 0) /* VGA only */
{
if (pAST->jChipType == AST2000)
{
pjDRAMRegInfo = AST2000DRAMTableData;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
*(ULONG *) (pAST->MMIOVirtualAddr + 0x10100) = 0xa8;
do {
;
} while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10100) != 0xa8);
}
else /* AST2100/1100 */
{
GetChipType(pScrn);
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200))
pjDRAMRegInfo = AST2100DRAMTableData;
else
pjDRAMRegInfo = AST1100DRAMTableData;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
*(ULONG *) (pAST->MMIOVirtualAddr + 0x12000) = 0x1688A8A8;
do {
;
} while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x12000) != 0x01);
*(ULONG *) (pAST->MMIOVirtualAddr + 0x10000) = 0xFC600309;
do {
;
} while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10000) != 0x01);
}
while (pjDRAMRegInfo->Index != 0xFFFF)
{
if (pjDRAMRegInfo->Index == 0xFF00) /* Delay function */
{
for (i=0; i<15; i++)
xf86UDelay(pjDRAMRegInfo->Data);
}
else if ( (pjDRAMRegInfo->Index == 0x0004) && (pAST->jChipType != AST2000) )
{
ulTemp = *(ULONG *) (pAST->MMIOVirtualAddr + 0x12070);
ulTemp &= 0x0000000C;
*(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = (pjDRAMRegInfo->Data | ulTemp);
}
else
{
*(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + pjDRAMRegInfo->Index) = pjDRAMRegInfo->Data;
}
pjDRAMRegInfo++;
}
switch (pAST->jChipType)
{
case AST2000:
*(ULONG *) (pAST->MMIOVirtualAddr + 0x10140) |= 0x40;
break;
case AST1100:
case AST2100:
case AST2200:
case AST2150:
ulTemp = *(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c);
*(ULONG *) (pAST->MMIOVirtualAddr + 0x1200c) = (ulTemp & 0xFFFFFFFD);
*(ULONG *) (pAST->MMIOVirtualAddr + 0x12040) |= 0x40;
break;
}
} /* Init DRAM */
/* wait ready */
do {
GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg);
} while ((jReg & 0x40) == 0);
} /* vInitDRAMReg */

View File

@ -25,6 +25,7 @@
#define VIDEOMEM_SIZE_16M 0x01000000
#define VIDEOMEM_SIZE_32M 0x02000000
#define VIDEOMEM_SIZE_64M 0x04000000
#define VIDEOMEM_SIZE_128M 0x08000000
#define AR_PORT_WRITE (pAST->RelocateIO + 0x40)
#define MISC_PORT_WRITE (pAST->RelocateIO + 0x42)
@ -34,6 +35,7 @@
#define GR_PORT (pAST->RelocateIO + 0x4E)
#define CRTC_PORT (pAST->RelocateIO + 0x54)
#define INPUT_STATUS1_READ (pAST->RelocateIO + 0x5A)
#define MISC_PORT_READ (pAST->RelocateIO + 0x4C)
#define GetReg(base) inb(base)
#define SetReg(base,val) outb(base,val)