diff options
Diffstat (limited to 'src/atipreinit.c')
-rw-r--r-- | src/atipreinit.c | 697 |
1 files changed, 154 insertions, 543 deletions
diff --git a/src/atipreinit.c b/src/atipreinit.c index d2a9b53..fd4d47e 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -52,250 +52,6 @@ #include "vbe.h" #include "xf86RAC.h" -#ifndef AVOID_CPIO - -typedef CARD16 Colour; /* The correct spelling should be OK :-) */ - -/* - * Bit patterns which are extremely unlikely to show up when reading from - * nonexistant memory (which normally shows up as either all bits set or all - * bits clear). - */ -static const Colour Test_Pixel[] = {0x5AA5U, 0x55AAU, 0xA55AU, 0xCA53U}; - -static const struct -{ - int videoRamSize; - int Miscellaneous_Options_Setting; - struct - { - short int x, y; - } - Coordinates[NumberOf(Test_Pixel) + 1]; -} -Test_Case[] = -{ - /* - * Given the engine settings used, only a 4M card will have enough memory - * to back up the 1025th line of the display. Since the pixel coordinates - * are zero-based, line 1024 will be the first one which is only backed on - * 4M cards. - * - * <Mark_Weaver@brown.edu>: - * In case memory is being wrapped, (0,0) and (0,1024) to make sure they - * can each hold a unique value. - */ - {4096, MEM_SIZE_4M, {{0,0}, {0,1024}, {-1,-1}}}, - - /* - * This card has 2M or less. On a 1M card, the first 2M of the card's - * memory will have even doublewords backed by physical memory and odd - * doublewords unbacked. - * - * Pixels 0 and 1 of a row will be in the zeroth doubleword, while pixels 2 - * and 3 will be in the first. Check both pixels 2 and 3 in case this is a - * pseudo-1M card (one chip pulled to turn a 2M card into a 1M card). - * - * <Mark_Weaver@brown.edu>: - * I don't have a 1M card, so I'm taking a stab in the dark. Maybe memory - * wraps every 512 lines, or maybe odd doublewords are aliases of their - * even doubleword counterparts. I try everything here. - */ - {2048, MEM_SIZE_2M, {{0,0}, {0,512}, {2,0}, {3,0}, {-1,-1}}}, - - /* - * This is a either a 1M card or a 512k card. Test pixel 1, since it is an - * odd word in an even doubleword. - * - * <Mark_Weaver@brown.edu>: - * This is the same idea as the test above. - */ - {1024, MEM_SIZE_1M, {{0,0}, {0,256}, {1,0}, {-1,-1}}}, - - /* - * Assume it is a 512k card by default, since that is the minimum - * configuration. - */ - {512, MEM_SIZE_512K, {{-1,-1}}} -}; - -/* - * ATIMach32ReadPixel -- - * - * Return the colour of the specified screen location. Called from - * ATIMach32videoRam function below. - */ -static Colour -ATIMach32ReadPixel -( - const short int X, - const short int Y -) -{ - Colour Pixel_Colour; - - /* Wait for idle engine */ - ProbeWaitIdleEmpty(); - - /* Set up engine for pixel read */ - ATIWaitQueue(7); - outw(RD_MASK, (CARD16)(~0)); - outw(DP_CONFIG, FG_COLOR_SRC_BLIT | DATA_WIDTH | DRAW | DATA_ORDER); - outw(CUR_X, X); - outw(CUR_Y, Y); - outw(DEST_X_START, X); - outw(DEST_X_END, X + 1); - outw(DEST_Y_END, Y + 1); - - /* Wait for data to become ready */ - ATIWaitQueue(16); - WaitDataReady(); - - /* Read pixel colour */ - Pixel_Colour = inw(PIX_TRANS); - ProbeWaitIdleEmpty(); - return Pixel_Colour; -} - -/* - * ATIMach32WritePixel -- - * - * Set the colour of the specified screen location. Called from - * ATIMach32videoRam function below. - */ -static void -ATIMach32WritePixel -( - const short int X, - const short int Y, - const Colour Pixel_Colour -) -{ - /* Set up engine for pixel write */ - ATIWaitQueue(9); - outw(WRT_MASK, (CARD16)(~0)); - outw(DP_CONFIG, FG_COLOR_SRC_FG | DRAW | READ_WRITE); - outw(ALU_FG_FN, MIX_FN_PAINT); - outw(FRGD_COLOR, Pixel_Colour); - outw(CUR_X, X); - outw(CUR_Y, Y); - outw(DEST_X_START, X); - outw(DEST_X_END, X + 1); - outw(DEST_Y_END, Y + 1); -} - -/* - * ATIMach32videoRam -- - * - * Determine the amount of video memory installed on an 68800-6 based adapter. - * This is done because these chips exhibit a bug that causes their - * MISC_OPTIONS register to report 1M rather than the true amount of memory. - * - * This function is adapted from a similar function in mach32mem.c written by - * Robert Wolff, David Dawes and Mark Weaver. - */ -static int -ATIMach32videoRam -( - void -) -{ - CARD16 clock_sel, mem_bndry, misc_options, ext_ge_config; - Colour saved_Pixel[NumberOf(Test_Pixel)]; - unsigned int Case_Number, Pixel_Number; - Bool AllPixelsOK; - - /* Save register values to be modified */ - clock_sel = inw(CLOCK_SEL); - mem_bndry = inw(MEM_BNDRY); - misc_options = inw(MISC_OPTIONS) & ~MEM_SIZE_ALIAS; - ext_ge_config = inw(R_EXT_GE_CONFIG); - - /* Wait for enough FIFO entries */ - ATIWaitQueue(7); - - /* Enable accelerator */ - outw(CLOCK_SEL, clock_sel | DISABPASSTHRU); - - /* Make accelerator and VGA share video memory */ - outw(MEM_BNDRY, mem_bndry & ~(MEM_PAGE_BNDRY | MEM_BNDRY_ENA)); - - /* Prevent video memory wrap */ - outw(MISC_OPTIONS, misc_options | MEM_SIZE_4M); - - /* - * Set up the drawing engine for a pitch of 1024 at 16 bits per pixel. No - * need to mess with the CRT because the results of this test are not - * intended to be seen. - */ - outw(EXT_GE_CONFIG, PIXEL_WIDTH_16 | ORDER_16BPP_565 | MONITOR_8514 | - ALIAS_ENA); - outw(GE_PITCH, 1024 >> 3); - outw(GE_OFFSET_HI, 0); - outw(GE_OFFSET_LO, 0); - - for (Case_Number = 0; - Case_Number < (NumberOf(Test_Case) - 1); - Case_Number++) - { - /* Reduce redundancy as per Mark_Weaver@brown.edu */ -# define TestPixel Test_Case[Case_Number].Coordinates[Pixel_Number] -# define ForEachTestPixel \ - for (Pixel_Number = 0; TestPixel.x >= 0; Pixel_Number++) - - /* Save pixel colours that will be clobbered */ - ForEachTestPixel - saved_Pixel[Pixel_Number] = - ATIMach32ReadPixel(TestPixel.x, TestPixel.y); - - /* Write test patterns */ - ForEachTestPixel - ATIMach32WritePixel(TestPixel.x, TestPixel.y, - Test_Pixel[Pixel_Number]); - - /* Test for lost pixels */ - AllPixelsOK = TRUE; - ForEachTestPixel - { - if (ATIMach32ReadPixel(TestPixel.x, TestPixel.y) != - Test_Pixel[Pixel_Number]) - { - AllPixelsOK = FALSE; - break; - } - } - - /* Restore clobbered pixels */ - ForEachTestPixel - ATIMach32WritePixel(TestPixel.x, TestPixel.y, - saved_Pixel[Pixel_Number]); - - /* End test on success */ - if (AllPixelsOK) - break; - - /* Completeness */ -# undef ForEachTestPixel -# undef TestPixel - } - - /* Restore what was changed and correct MISC_OPTIONS register */ - ATIWaitQueue(4); - outw(EXT_GE_CONFIG, ext_ge_config); - misc_options |= Test_Case[Case_Number].Miscellaneous_Options_Setting; - outw(MISC_OPTIONS, misc_options); - outw(MEM_BNDRY, mem_bndry); - outw(CLOCK_SEL, clock_sel); - - /* Wait for activity to die down */ - ProbeWaitIdleEmpty(); - - /* Tell ATIPreInit the REAL story */ - return Test_Case[Case_Number].videoRamSize; -} - -#endif /* AVOID_CPIO */ - /* * */ @@ -354,6 +110,7 @@ static Bool ATIMach64Detect(ATIPtr pATI) { CARD32 IOValue, bus_cntl, gen_test_cntl; + Bool Found = FALSE; (void)ATIMapApertures(-1, pATI); /* Ignore errors */ @@ -400,7 +157,7 @@ ATIMach64Detect(ATIPtr pATI) */ ATIMach64ChipID(pATI, pATI->PCIInfo->chipType); if ((pATI->Chip != ATI_CHIP_Mach64) || (pATI->CPIODecoding == BLOCK_IO)) - pATI->Adapter = ATI_ADAPTER_MACH64; + Found = TRUE; } } @@ -408,7 +165,7 @@ ATIMach64Detect(ATIPtr pATI) outr(SCRATCH_REG0, IOValue); /* If no Mach64 was detected, return now */ - if (pATI->Adapter != ATI_ADAPTER_MACH64) { + if (!Found) { outr(GEN_TEST_CNTL, gen_test_cntl); outr(BUS_CNTL, bus_cntl); ATIUnmapApertures(-1, pATI); @@ -1399,260 +1156,162 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) pATI->nFIFOEntries = 16; /* For now */ pATI->Audio = ATI_AUDIO_NONE; - /* Finish probing the adapter */ - switch (pATI->Adapter) - { - -#ifndef AVOID_CPIO - - case ATI_ADAPTER_NONE: - case ATI_ADAPTER_EGA: - case ATI_ADAPTER_EGA_PLUS: - case ATI_ADAPTER_VGA: - case ATI_ADAPTER_BASIC: - pATI->NewHW.SetBank = (ATIBankProcPtr)NoopDDA; - pATI->BankInfo.SetSourceBank = - pATI->BankInfo.SetDestinationBank = - pATI->BankInfo.SetSourceAndDestinationBanks = - (miBankProcPtr)NoopDDA; - break; - - case ATI_ADAPTER_V3: - pATI->NewHW.SetBank = ATIV3SetBank; - pATI->BankInfo.SetSourceBank = ATIV3SetRead; - pATI->BankInfo.SetDestinationBank = ATIV3SetWrite; - pATI->BankInfo.SetSourceAndDestinationBanks = ATIV3SetReadWrite; - break; - - case ATI_ADAPTER_V4: - case ATI_ADAPTER_V5: - pATI->NewHW.SetBank = ATIV4V5SetBank; - pATI->BankInfo.SetSourceBank = ATIV4V5SetRead; - pATI->BankInfo.SetDestinationBank = ATIV4V5SetWrite; - pATI->BankInfo.SetSourceAndDestinationBanks = ATIV4V5SetReadWrite; - break; - - case ATI_ADAPTER_XL: - pATI->DAC = ATI_DAC_SC11483; - break; - - case ATI_ADAPTER_8514A: - pATI->VideoRAM = - videoRamSizes[GetBits(inw(SUBSYS_STAT), _8PLANE) + 2]; - break; - - case ATI_ADAPTER_MACH8: - pATI->VideoRAM = - videoRamSizes[GetBits(inw(CONFIG_STATUS_1), MEM_INSTALLED) + 2]; - break; - - case ATI_ADAPTER_MACH32: - IOValue = inw(CONFIG_STATUS_1); - pATI->DAC = ATI_DAC(GetBits(IOValue, DACTYPE), 0); - pATI->MemoryType = GetBits(IOValue, MEM_TYPE); - - IOValue = inw(MISC_OPTIONS); - pATI->VideoRAM = - videoRamSizes[GetBits(IOValue, MEM_SIZE_ALIAS) + 2]; - - /* - * The 68800-6 doesn't necessarily report the correct video memory - * size. - */ - if ((pATI->Chip == ATI_CHIP_68800_6) && (pATI->VideoRAM == 1024)) - pATI->VideoRAM = ATIMach32videoRam(); - - break; - -#endif /* AVOID_CPIO */ - - case ATI_ADAPTER_MACH64: - do - { - /* - * Find and mmap() MMIO area. Allow only auxiliary aperture if - * it exists. - */ - if (!(Block0Base = pATI->Block0Base)) - { - if (pVideo) - { - /* Check tail end of linear (8MB or 4MB) aperture */ - if ((pATI->Block0Base = pVideo->memBase[0])) - { - pATI->Block0Base += 0x007FFC00U; - ATIMach64Map(pScreenInfo->scrnIndex, pATI); - if (pATI->pBlock[0]) - break; - - pATI->Block0Base -= 0x00400000U; - ATIMach64Map(pScreenInfo->scrnIndex, pATI); - if (pATI->pBlock[0]) - break; - } - } + do { + /* + * Find and mmap() MMIO area. Allow only auxiliary aperture if + * it exists. + */ + if (!(Block0Base = pATI->Block0Base)) { + if (pVideo) { + /* Check tail end of linear (8MB or 4MB) aperture */ + if ((pATI->Block0Base = pVideo->memBase[0])) { + pATI->Block0Base += 0x007FFC00U; + ATIMach64Map(pScreenInfo->scrnIndex, pATI); + if (pATI->pBlock[0]) + break; - /* Check VGA MMIO aperture */ - pATI->Block0Base = 0x000BFC00U; + pATI->Block0Base -= 0x00400000U; + ATIMach64Map(pScreenInfo->scrnIndex, pATI); + if (pATI->pBlock[0]) + break; } + } - ATIMach64Map(pScreenInfo->scrnIndex, pATI); - } while (0); - pATI->Block0Base = Block0Base; + /* Check VGA MMIO aperture */ + pATI->Block0Base = 0x000BFC00U; + } + + ATIMach64Map(pScreenInfo->scrnIndex, pATI); + } while (0); + pATI->Block0Base = Block0Base; #ifdef AVOID_CPIO - if (!pATI->pBlock[0]) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to mmap() adapter registers.\n"); - return FALSE; - } + if (!pATI->pBlock[0]) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to mmap() adapter registers.\n"); + return FALSE; + } #endif /* AVOID_CPIO */ - pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL); - if (!(pATIHW->crtc_gen_cntl & CRTC_EN) && - (pATI->Chip >= ATI_CHIP_264CT)) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Adapter has not been initialised.\n"); - ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); - ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); - return FALSE; - } + pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL); + if (!(pATIHW->crtc_gen_cntl & CRTC_EN) && + (pATI->Chip >= ATI_CHIP_264CT)) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Adapter has not been initialised.\n"); + ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } #ifdef AVOID_CPIO - if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN)) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Adapters found to be in VGA mode on server entry are not" - " supported by the MMIO-only version of this driver.\n"); - ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); - ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); - return FALSE; - } + if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN)) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Adapters found to be in VGA mode on server entry are not" + " supported by the MMIO-only version of this driver.\n"); + ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } #endif /* AVOID_CPIO */ - pATIHW->mem_cntl = inr(MEM_CNTL); - if (pATI->Chip < ATI_CHIP_264VTB) - { - pATI->VideoRAM = - videoRamSizes[GetBits(pATIHW->mem_cntl, CTL_MEM_SIZE) + 2]; - } - else - { - pATI->nFIFOEntries = /* Don't care */ - (unsigned int)(-1) >> 1; - - IOValue = GetBits(pATIHW->mem_cntl, CTL_MEM_SIZEB); - if (IOValue < 8) - pATI->VideoRAM = (IOValue + 1) * 512; - else if (IOValue < 12) - pATI->VideoRAM = (IOValue - 3) * 1024; + pATIHW->mem_cntl = inr(MEM_CNTL); + if (pATI->Chip < ATI_CHIP_264VTB) { + pATI->VideoRAM = videoRamSizes[GetBits(pATIHW->mem_cntl, + CTL_MEM_SIZE) + 2]; + } else { + pATI->nFIFOEntries = (unsigned int)(-1) >> 1; /* Don't care */ + + IOValue = GetBits(pATIHW->mem_cntl, CTL_MEM_SIZEB); + if (IOValue < 8) + pATI->VideoRAM = (IOValue + 1) * 512; + else if (IOValue < 12) + pATI->VideoRAM = (IOValue - 3) * 1024; + else + pATI->VideoRAM = (IOValue - 7) * 2048; + } + + pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE); + + IOValue = inr(CONFIG_STATUS64_0); + if (pATI->Chip >= ATI_CHIP_264CT) { + pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE_T); + + /* Get LCD panel id */ + if (pATI->Chip == ATI_CHIP_264LT) { + pATI->LCDPanelID = GetBits(IOValue, CFG_PANEL_ID); + + pATIHW->horz_stretching = inr(HORZ_STRETCHING); + pATIHW->vert_stretching = inr(VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); + } else if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) { + pATI->LCDPanelID = GetBits(IOValue, CFG_PANEL_ID); + + pATIHW->lcd_index = inr(LCD_INDEX); + pATIHW->horz_stretching = ATIMach64GetLCDReg(LCD_HORZ_STRETCHING); + pATI->LCDHorizontal = GetBits(pATIHW->horz_stretching, + HORZ_PANEL_SIZE); + if (pATI->LCDHorizontal) { + if (pATI->LCDHorizontal == MaxBits(HORZ_PANEL_SIZE)) + pATI->LCDHorizontal = 0; else - pATI->VideoRAM = (IOValue - 7) * 2048; - } - - pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE); - - IOValue = inr(CONFIG_STATUS64_0); - if (pATI->Chip >= ATI_CHIP_264CT) - { - pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE_T); - - /* Get LCD panel id */ - if (pATI->Chip == ATI_CHIP_264LT) - { - pATI->LCDPanelID = GetBits(IOValue, CFG_PANEL_ID); - - pATIHW->horz_stretching = inr(HORZ_STRETCHING); - pATIHW->vert_stretching = inr(VERT_STRETCHING); - pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); - } - else if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) - { - pATI->LCDPanelID = GetBits(IOValue, CFG_PANEL_ID); - - pATIHW->lcd_index = inr(LCD_INDEX); - pATIHW->horz_stretching = - ATIMach64GetLCDReg(LCD_HORZ_STRETCHING); - pATI->LCDHorizontal = - GetBits(pATIHW->horz_stretching, HORZ_PANEL_SIZE); - if (pATI->LCDHorizontal) - { - if (pATI->LCDHorizontal == MaxBits(HORZ_PANEL_SIZE)) - pATI->LCDHorizontal = 0; - else - pATI->LCDHorizontal = - (pATI->LCDHorizontal + 1) << 3; - } - pATIHW->ext_vert_stretch = - ATIMach64GetLCDReg(LCD_EXT_VERT_STRETCH); - pATI->LCDVertical = - GetBits(pATIHW->ext_vert_stretch, VERT_PANEL_SIZE); - if (pATI->LCDVertical) - { - if (pATI->LCDVertical == MaxBits(VERT_PANEL_SIZE)) - pATI->LCDVertical = 0; - else - pATI->LCDVertical++; - } - pATIHW->vert_stretching = - ATIMach64GetLCDReg(LCD_VERT_STRETCHING); - pATIHW->lcd_gen_ctrl = ATIMach64GetLCDReg(LCD_GEN_CNTL); - outr(LCD_INDEX, pATIHW->lcd_index); - } - - /* - * Don't bother with panel support if it hasn't been previously - * enabled. - */ - if ((pATI->LCDPanelID >= 0) && - !(pATIHW->horz_stretching & HORZ_STRETCH_EN) && - !(pATIHW->vert_stretching & VERT_STRETCH_EN) && - !(pATIHW->lcd_gen_ctrl & LCD_ON)) - { - /* - * At this point, if an XL or Mobility BIOS hasn't set - * panel dimensions, then there is no panel. Otherwise, - * keep any panel disabled to allow for modes greater than - * the panel's dimensions. - */ - if ((pATI->Chip >= ATI_CHIP_264XL) && - (!pATI->LCDHorizontal || !pATI->LCDVertical)) - pATI->LCDPanelID = -1; - else - pATI->OptionPanelDisplay = FALSE; - } + pATI->LCDHorizontal = (pATI->LCDHorizontal + 1) << 3; } - else - { - pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE); - - /* Factor in what the BIOS says the DAC is */ - pATI->DAC = ATI_DAC(pATI->DAC, - GetBits(inr(SCRATCH_REG1), BIOS_INIT_DAC_SUBTYPE)); + pATIHW->ext_vert_stretch = ATIMach64GetLCDReg(LCD_EXT_VERT_STRETCH); + pATI->LCDVertical = GetBits(pATIHW->ext_vert_stretch, + VERT_PANEL_SIZE); + if (pATI->LCDVertical) { + if (pATI->LCDVertical == MaxBits(VERT_PANEL_SIZE)) + pATI->LCDVertical = 0; + else + pATI->LCDVertical++; } + pATIHW->vert_stretching = ATIMach64GetLCDReg(LCD_VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = ATIMach64GetLCDReg(LCD_GEN_CNTL); + outr(LCD_INDEX, pATIHW->lcd_index); + } + /* + * Don't bother with panel support if it hasn't been previously + * enabled. + */ + if ((pATI->LCDPanelID >= 0) && + !(pATIHW->horz_stretching & HORZ_STRETCH_EN) && + !(pATIHW->vert_stretching & VERT_STRETCH_EN) && + !(pATIHW->lcd_gen_ctrl & LCD_ON)) { /* - * RAMDAC types 0 & 1 for Mach64's are different than those for - * Mach32's. + * At this point, if an XL or Mobility BIOS hasn't set + * panel dimensions, then there is no panel. Otherwise, + * keep any panel disabled to allow for modes greater than + * the panel's dimensions. */ - if (pATI->DAC < ATI_DAC_ATI68875) - pATI->DAC += ATI_DAC_INTERNAL; - - break; + if ((pATI->Chip >= ATI_CHIP_264XL) && + (!pATI->LCDHorizontal || !pATI->LCDVertical)) + pATI->LCDPanelID = -1; + else + pATI->OptionPanelDisplay = FALSE; + } + } else { + pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE); - default: - break; + /* Factor in what the BIOS says the DAC is */ + pATI->DAC = ATI_DAC(pATI->DAC, + GetBits(inr(SCRATCH_REG1), BIOS_INIT_DAC_SUBTYPE)); } /* + * RAMDAC types 0 & 1 for Mach64's are different than those for + * Mach32's. + */ + if (pATI->DAC < ATI_DAC_ATI68875) + pATI->DAC += ATI_DAC_INTERNAL; + + /* * For Mach64 adapters, pick up, from the BIOS, the type of programmable * clock generator (if any), and various information about it. */ @@ -1720,30 +1379,19 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) Buffer, pATI->ChipClass, pATI->ChipRevision); } + Message = Buffer + snprintf(Buffer, SizeOf(Buffer), + "%s bus interface detected", + ATIBusNames[pATI->BusType]); #ifndef AVOID_CPIO - - if (pATI->Adapter >= ATI_ADAPTER_MACH8) - -#endif /* AVOID_CPIO */ - - { - Message = Buffer + snprintf(Buffer, SizeOf(Buffer), - "%s bus interface detected", ATIBusNames[pATI->BusType]); - -#ifndef AVOID_CPIO - - if (pATI->Adapter >= ATI_ADAPTER_MACH64) - { - Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, - "; %s I/O base is 0x%04lX", - (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block", - pATI->CPIOBase); - } + + Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, + "; %s I/O base is 0x%04lX", + (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block", + pATI->CPIOBase); #endif /* AVOID_CPIO */ - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s.\n", Buffer); - } + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s.\n", Buffer); #ifndef AVOID_CPIO @@ -1761,7 +1409,7 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) #endif /* AVOID_CPIO */ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "%s adapter detected.\n", ATIAdapterNames[pATI->Adapter]); + "Mach64 adapter detected.\n"); if (pATI->Chip >= ATI_CHIP_264GT) xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, @@ -1970,14 +1618,9 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) return FALSE; } + /* Accelerator and VGA cannot share memory */ if (pATI->Coprocessor != ATI_CHIP_NONE) - { - /* Ignore any 8514/A or Mach8 accelerator from this point on */ - pATI->Adapter = pATI->VGAAdapter; - - /* Accelerator and VGA cannot share memory */ pATI->VideoRAM = 0; - } } #endif /* AVOID_CPIO */ @@ -3041,37 +2684,15 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) } } -#ifndef AVOID_CPIO - - if (pATI->Adapter >= ATI_ADAPTER_MACH32) - -#endif /* AVOID_CPIO */ - - { - if (pATI->Chip >= ATI_CHIP_264CT) - ATIReportMemory(pScreenInfo, pATI, - ATIMemoryTypeNames_264xT[pATI->MemoryType]); - else if (pATI->Chip == ATI_CHIP_88800CX) - ATIReportMemory(pScreenInfo, pATI, - ATIMemoryTypeNames_88800CX[pATI->MemoryType]); - else - ATIReportMemory(pScreenInfo, pATI, - ATIMemoryTypeNames_Mach[pATI->MemoryType]); - } - -#ifndef AVOID_CPIO - - else if (pATI->Adapter >= ATI_ADAPTER_V3) - { + if (pATI->Chip >= ATI_CHIP_264CT) ATIReportMemory(pScreenInfo, pATI, - (ATIGetExtReg(0xB7U) & 0x04U) ? "DRAM" : "VRAM"); - } + ATIMemoryTypeNames_264xT[pATI->MemoryType]); + else if (pATI->Chip == ATI_CHIP_88800CX) + ATIReportMemory(pScreenInfo, pATI, + ATIMemoryTypeNames_88800CX[pATI->MemoryType]); else - { - ATIReportMemory(pScreenInfo, pATI, "video memory"); - } - -#endif /* AVOID_CPIO */ + ATIReportMemory(pScreenInfo, pATI, + ATIMemoryTypeNames_Mach[pATI->MemoryType]); /* * Finish banking setup. This needs to be fixed to not assume the mode on @@ -3458,12 +3079,6 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) #ifndef AVOID_CPIO case ATI_CRTC_VGA: - /* - * IBM's VGA doesn't allow for interlaced modes. - */ - if (pATI->Adapter <= ATI_ADAPTER_VGA) - ATIClockRange.interlaceAllowed = FALSE; - pScreenInfo->maxHValue = (0xFFU + 1) << 3; /* max HTotal */ /* @@ -3472,13 +3087,9 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) * Finer-grained checks are done in ATIValidateMode(). */ pScreenInfo->maxVValue = 0x03FFU + 1; - if (pATI->Adapter > ATI_ADAPTER_VGA) - { + pScreenInfo->maxVValue <<= 1; + if (ATIClockRange.interlaceAllowed && (pATI->Chip < ATI_CHIP_264CT)) pScreenInfo->maxVValue <<= 1; - if (ATIClockRange.interlaceAllowed && - (pATI->Chip < ATI_CHIP_264CT)) - pScreenInfo->maxVValue <<= 1; - } /* * 18800-x and 28800-x do not support interlaced modes when the |