xf86-video-ati: Branch 'master' - 7 commits

George Sapountzis gsap7 at kemper.freedesktop.org
Thu Feb 7 08:07:31 PST 2008


 src/aticlock.c   |    7 
 src/aticonfig.c  |   23 --
 src/atipreinit.c |  482 ++++++++++++++++++++++++++++---------------------------
 src/atiprobe.c   |    4 
 src/atistruct.h  |    2 
 5 files changed, 255 insertions(+), 263 deletions(-)

New commits:
commit 692789a293970f70b88ccb6adcf0676d8b495ae2
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:03:37 2008 +0200

    mach64: factor out BIOS multimedia parsing

diff --git a/src/atipreinit.c b/src/atipreinit.c
index 1c92f5d..8c67932 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -317,6 +317,60 @@ ati_bios_clock
 }
 
 /*
+ * Pick up multimedia information, which will be at different
+ * displacements depending on table revision.
+ */
+static void
+ati_bios_mmedia
+(
+    ScrnInfoPtr  pScreenInfo,
+    ATIPtr       pATI,
+    CARD8       *BIOS,
+    unsigned int VideoTable
+)
+{
+    pATI->Audio = ATI_AUDIO_NONE;
+
+    if (VideoTable > 0)
+    {
+        switch (BIOSByte(VideoTable - 0x02U))
+        {
+            case 0x00U:
+                pATI->Tuner = BIOSByte(VideoTable) & 0x1FU;
+
+                /*
+                 * XXX  The VideoTable[1] byte is known to have been
+                 *      omitted in LTPro and Mobility BIOS'es.  Any others?
+                 */
+                switch (pATI->Chip)
+                {
+                    case ATI_CHIP_264LTPRO:
+                    case ATI_CHIP_MOBILITY:
+                        pATI->Decoder = BIOSByte(VideoTable + 0x01U) & 0x07U;
+                        pATI->Audio = BIOSByte(VideoTable + 0x02U) & 0x0FU;
+                        break;
+
+                    default:
+                        pATI->Decoder = BIOSByte(VideoTable + 0x02U) & 0x07U;
+                        pATI->Audio = BIOSByte(VideoTable + 0x03U) & 0x0FU;
+                        break;
+                }
+
+                break;
+
+            case 0x01U:
+                pATI->Tuner = BIOSByte(VideoTable) & 0x1FU;
+                pATI->Audio = BIOSByte(VideoTable + 0x01U) & 0x0FU;
+                pATI->Decoder = BIOSByte(VideoTable + 0x05U) & 0x0FU;
+                break;
+
+            default:
+                break;
+        }
+    }
+}
+
+/*
  * ATIPreInit --
  *
  * This function is only called once per screen at the start of the first
@@ -604,7 +658,6 @@ ATIPreInit
 
     pATI->LCDPanelID = -1;
     pATI->nFIFOEntries = 16;                    /* For now */
-    pATI->Audio = ATI_AUDIO_NONE;
 
     /* Finish probing the adapter */
     {
@@ -811,51 +864,7 @@ ATIPreInit
 
         ati_bios_clock(pScreenInfo, pATI, BIOS, ClockTable, pGDev);
 
-        /*
-         * Pick up multimedia information, which will be at different
-         * displacements depending on table revision.
-         */
-        if (VideoTable > 0)
-        {
-            switch (BIOSByte(VideoTable - 0x02U))
-            {
-                case 0x00U:
-                    pATI->Tuner = BIOSByte(VideoTable) & 0x1FU;
-
-                    /*
-                     * XXX  The VideoTable[1] byte is known to have been
-                     *      omitted in LTPro and Mobility BIOS'es.  Any others?
-                     */
-                    switch (pATI->Chip)
-                    {
-                        case ATI_CHIP_264LTPRO:
-                        case ATI_CHIP_MOBILITY:
-                            pATI->Decoder =
-                                BIOSByte(VideoTable + 0x01U) & 0x07U;
-                            pATI->Audio =
-                                BIOSByte(VideoTable + 0x02U) & 0x0FU;
-                            break;
-
-                        default:
-                            pATI->Decoder =
-                                BIOSByte(VideoTable + 0x02U) & 0x07U;
-                            pATI->Audio =
-                                BIOSByte(VideoTable + 0x03U) & 0x0FU;
-                            break;
-                    }
-
-                    break;
-
-                case 0x01U:
-                    pATI->Tuner = BIOSByte(VideoTable) & 0x1FU;
-                    pATI->Audio = BIOSByte(VideoTable + 0x01U) & 0x0FU;
-                    pATI->Decoder = BIOSByte(VideoTable + 0x05U) & 0x0FU;
-                    break;
-
-                default:
-                    break;
-            }
-        }
+        ati_bios_mmedia(pScreenInfo, pATI, BIOS, VideoTable);
 
         /* Determine panel dimensions */
         if (pATI->LCDPanelID >= 0)
commit 933328ffd6d1d872a18d3de8624c4df845a64588
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:03:03 2008 +0200

    mach64: complement hint for sparc

diff --git a/src/aticlock.c b/src/aticlock.c
index 8dd79d4..f4de77f 100644
--- a/src/aticlock.c
+++ b/src/aticlock.c
@@ -140,12 +140,13 @@ ATIClockPreInit
                         ((double)pATI->ReferenceDenominator * 1000.0));
 
 #if defined(__sparc__)
-            if (pATI->ReferenceNumerator != 315000 &&
-                pATI->ReferenceDenominator != 11)
+            if ((pATI->refclk / 100000) != 286 &&
+                (pATI->refclk / 100000) != 295)
             {
                 xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
                     "If modes do not work on Ultra 5/10 or Blade 100/150,\n"
-                    "set option \"reference_clock\" to \"28.636 MHz\"\n");
+                    "\tset option \"reference_clock\" to \"28.636 MHz\""
+                    " or \"29.5 MHz\"\n");
             }
 #endif
 
commit 956c8c81f3ff434930a0cb17b027b2f8e4eeabb2
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:02:31 2008 +0200

    mach64: consolidate refclk #2

diff --git a/src/aticonfig.c b/src/aticonfig.c
index 837720f..9102497 100644
--- a/src/aticonfig.c
+++ b/src/aticonfig.c
@@ -473,28 +473,6 @@ ATIProcessOptions
 
     pATI->refclk = (int)ReferenceClock;
 
-    /* Only set the reference clock if it hasn't already been determined */
-    if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator)
-    {
-        switch (pATI->refclk / 100000)
-        {
-            case 143:
-                pATI->ReferenceNumerator = 157500;
-                pATI->ReferenceDenominator = 11;
-                break;
-
-            case 286:
-                pATI->ReferenceNumerator = 315000;
-                pATI->ReferenceDenominator = 11;
-                break;
-
-            default:
-                pATI->ReferenceNumerator = pATI->refclk / 1000;
-                pATI->ReferenceDenominator = 1;
-                break;
-        }
-    }
-
     pATI->useEXA = FALSE;
     if (pATI->OptionAccel)
     {
diff --git a/src/atipreinit.c b/src/atipreinit.c
index f6b0ce4..1c92f5d 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -150,23 +150,6 @@ ati_bios_clock
         pATI->ClockNumberToProgramme = BIOSByte(ClockTable + 0x06U);
         pATI->refclk = BIOSWord(ClockTable + 0x08U);
         pATI->refclk *= 10000;
-        switch (pATI->refclk / 100000)
-        {
-            case 143:
-                pATI->ReferenceNumerator = 157500;
-                pATI->ReferenceDenominator = 11;
-                break;
-
-            case 286:
-                pATI->ReferenceNumerator = 315000;
-                pATI->ReferenceDenominator = 11;
-                break;
-
-            default:
-                pATI->ReferenceNumerator = pATI->refclk / 1000;
-                pATI->ReferenceDenominator = 1;
-                break;
-        }
     }
     else
     {
@@ -313,6 +296,24 @@ ati_bios_clock
             pATI->DAC = ClockDac;   /* For now */
         }
     }
+
+    switch (pATI->refclk / 100000)
+    {
+        case 143:
+            pATI->ReferenceNumerator = 157500;
+            pATI->ReferenceDenominator = 11;
+            break;
+
+        case 286:
+            pATI->ReferenceNumerator = 315000;
+            pATI->ReferenceDenominator = 11;
+            break;
+
+        default:
+            pATI->ReferenceNumerator = pATI->refclk / 1000;
+            pATI->ReferenceDenominator = 1;
+            break;
+    }
 }
 
 /*
commit dce4cc26a8e2bf53805ec63763243f3ff6b4a6d3
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:02:17 2008 +0200

    mach64: consolidate refclk #1

diff --git a/src/aticonfig.c b/src/aticonfig.c
index 1e119e0..837720f 100644
--- a/src/aticonfig.c
+++ b/src/aticonfig.c
@@ -471,10 +471,12 @@ ATIProcessOptions
         pATI->Cursor = ATI_CURSOR_HARDWARE;
     }
 
+    pATI->refclk = (int)ReferenceClock;
+
     /* Only set the reference clock if it hasn't already been determined */
     if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator)
     {
-        switch ((int)(ReferenceClock / ((double)100000.0)))
+        switch (pATI->refclk / 100000)
         {
             case 143:
                 pATI->ReferenceNumerator = 157500;
@@ -487,8 +489,7 @@ ATIProcessOptions
                 break;
 
             default:
-                pATI->ReferenceNumerator =
-                    (int)(ReferenceClock / ((double)1000.0));
+                pATI->ReferenceNumerator = pATI->refclk / 1000;
                 pATI->ReferenceDenominator = 1;
                 break;
         }
diff --git a/src/atipreinit.c b/src/atipreinit.c
index 65c84eb..f6b0ce4 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -148,7 +148,9 @@ ati_bios_clock
     {
         pATI->ProgrammableClock = BIOSByte(ClockTable);
         pATI->ClockNumberToProgramme = BIOSByte(ClockTable + 0x06U);
-        switch (BIOSWord(ClockTable + 0x08U) / 10)
+        pATI->refclk = BIOSWord(ClockTable + 0x08U);
+        pATI->refclk *= 10000;
+        switch (pATI->refclk / 100000)
         {
             case 143:
                 pATI->ReferenceNumerator = 157500;
@@ -161,8 +163,7 @@ ati_bios_clock
                 break;
 
             default:
-                pATI->ReferenceNumerator =
-                    BIOSWord(ClockTable + 0x08U) * 10;
+                pATI->ReferenceNumerator = pATI->refclk / 1000;
                 pATI->ReferenceDenominator = 1;
                 break;
         }
diff --git a/src/atistruct.h b/src/atistruct.h
index 0db9486..b9f4d08 100644
--- a/src/atistruct.h
+++ b/src/atistruct.h
@@ -352,6 +352,7 @@ typedef struct _ATIRec
     /*
      * Clock-related definitions.
      */
+    int refclk;
     int ClockNumberToProgramme, ReferenceNumerator, ReferenceDenominator;
     int ProgrammableClock, maxClock;
     ClockRec ClockDescriptor;
commit f7ed807f0d82a7446ebc4acdd4e94df44a675f19
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:01:59 2008 +0200

    mach64: cosmetic

diff --git a/src/atipreinit.c b/src/atipreinit.c
index d01bb9c..65c84eb 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -144,10 +144,6 @@ ati_bios_clock
 {
     CARD16 ClockDac;
 
-    /* Set up non-zero defaults */
-    pATI->ClockDescriptor = ATIClockDescriptors[ATI_CLOCK_FIXED];
-    pATI->ClockNumberToProgramme = -1;
-
     if (ClockTable > 0)
     {
         pATI->ProgrammableClock = BIOSByte(ClockTable);
@@ -208,6 +204,8 @@ ati_bios_clock
         pATI->ClockNumberToProgramme = 3;
     }
 
+    pATI->ClockDescriptor = ATIClockDescriptors[ATI_CLOCK_FIXED];
+
     if ((pATI->ProgrammableClock > ATI_CLOCK_FIXED) &&
         (pATI->ProgrammableClock < ATI_CLOCK_MAX))
     {
@@ -220,8 +218,7 @@ ati_bios_clock
             (pATI->DAC == ATI_DAC_IBMRGB514))
             pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
 
-        pATI->ClockDescriptor =
-            ATIClockDescriptors[pATI->ProgrammableClock];
+        pATI->ClockDescriptor = ATIClockDescriptors[pATI->ProgrammableClock];
     }
 
     ClockDac = pATI->DAC;
@@ -234,14 +231,13 @@ ati_bios_clock
              */
             if (ClockTable > 0)
                 pATI->ClockDescriptor.MinM =
-                    pATI->ClockDescriptor.MaxM =
-                        BIOSWord(ClockTable + 0x0AU);
+                pATI->ClockDescriptor.MaxM = BIOSWord(ClockTable + 0x0AU);
             else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-0"))
                 pATI->ClockDescriptor.MinM =
-                    pATI->ClockDescriptor.MaxM = 43;
+                pATI->ClockDescriptor.MaxM = 43;
             else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-1"))
                 pATI->ClockDescriptor.MinM =
-                    pATI->ClockDescriptor.MaxM = 46;
+                pATI->ClockDescriptor.MaxM = 46;
             else
                 pATI->ProgrammableClock = ATI_CLOCK_UNKNOWN;
             break;
@@ -269,8 +265,8 @@ ati_bios_clock
              * effectively prevents generating frequencies beyond the
              * graphics controller's tolerance.
              */
-            pATI->ClockDescriptor.MinM = pATI->ClockDescriptor.MaxM =
-                ATIMach64GetPLLReg(PLL_REF_DIV);
+            pATI->ClockDescriptor.MinM =
+            pATI->ClockDescriptor.MaxM = ATIMach64GetPLLReg(PLL_REF_DIV);
 
             /* The DAC is also integrated */
             if ((pATI->DAC & ~0x0FU) != ATI_DAC_INTERNAL)
@@ -308,8 +304,7 @@ ati_bios_clock
         if (pATI->DAC == ATI_DAC_IBMRGB514)
         {
             pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
-            pATI->ClockDescriptor =
-                ATIClockDescriptors[ATI_CLOCK_IBMRGB514];
+            pATI->ClockDescriptor = ATIClockDescriptors[ATI_CLOCK_IBMRGB514];
             pATI->ClockNumberToProgramme = 7;
         }
         else
commit cda1cd198f33c26ef1b51532a2126468369743b8
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:01:33 2008 +0200

    mach64: factor out BIOS clock parsing

diff --git a/src/atipreinit.c b/src/atipreinit.c
index 2420b9f..d01bb9c 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -123,6 +123,202 @@ ATIPrintNoiseIfRequested
     ATIPrintRegisters(pATI);
 }
 
+#define BIOS_SIZE    0x00010000U     /* 64kB */
+#define BIOSByte(_n) ((CARD8)(BIOS[_n]))
+#define BIOSWord(_n) ((CARD16)(BIOS[_n] |                \
+                               (BIOS[(_n) + 1] << 8)))
+
+/*
+ * For Mach64 adapters, pick up, from the BIOS, the type of programmable
+ * clock generator (if any), and various information about it.
+ */
+static void
+ati_bios_clock
+(
+    ScrnInfoPtr  pScreenInfo,
+    ATIPtr       pATI,
+    CARD8       *BIOS,
+    unsigned int ClockTable,
+    GDevPtr      pGDev
+)
+{
+    CARD16 ClockDac;
+
+    /* Set up non-zero defaults */
+    pATI->ClockDescriptor = ATIClockDescriptors[ATI_CLOCK_FIXED];
+    pATI->ClockNumberToProgramme = -1;
+
+    if (ClockTable > 0)
+    {
+        pATI->ProgrammableClock = BIOSByte(ClockTable);
+        pATI->ClockNumberToProgramme = BIOSByte(ClockTable + 0x06U);
+        switch (BIOSWord(ClockTable + 0x08U) / 10)
+        {
+            case 143:
+                pATI->ReferenceNumerator = 157500;
+                pATI->ReferenceDenominator = 11;
+                break;
+
+            case 286:
+                pATI->ReferenceNumerator = 315000;
+                pATI->ReferenceDenominator = 11;
+                break;
+
+            default:
+                pATI->ReferenceNumerator =
+                    BIOSWord(ClockTable + 0x08U) * 10;
+                pATI->ReferenceDenominator = 1;
+                break;
+        }
+    }
+    else
+    {
+        /*
+         * Compensate for BIOS absence.  Note that the reference
+         * frequency has already been set by option processing.
+         */
+        if ((pATI->DAC & ~0x0FU) == ATI_DAC_INTERNAL)
+        {
+            pATI->ProgrammableClock = ATI_CLOCK_INTERNAL;
+        }
+        else switch (pATI->DAC)
+        {
+            case ATI_DAC_STG1703:
+                pATI->ProgrammableClock = ATI_CLOCK_STG1703;
+                break;
+
+            case ATI_DAC_CH8398:
+                pATI->ProgrammableClock = ATI_CLOCK_CH8398;
+                break;
+
+            case ATI_DAC_ATT20C408:
+                pATI->ProgrammableClock = ATI_CLOCK_ATT20C408;
+                break;
+
+            case ATI_DAC_IBMRGB514:
+                pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
+                break;
+
+            default:        /* Provisional */
+                pATI->ProgrammableClock = ATI_CLOCK_ICS2595;
+                break;
+        }
+
+        /* This should be safe for all generators except IBM's RGB514 */
+        pATI->ClockNumberToProgramme = 3;
+    }
+
+    if ((pATI->ProgrammableClock > ATI_CLOCK_FIXED) &&
+        (pATI->ProgrammableClock < ATI_CLOCK_MAX))
+    {
+        /*
+         * Graphics PRO TURBO 1600's are unusual in that an ICS2595 is used
+         * to generate clocks for VGA modes, and an IBM RGB514 is used for
+         * accelerator modes.
+         */
+        if ((pATI->ProgrammableClock == ATI_CLOCK_ICS2595) &&
+            (pATI->DAC == ATI_DAC_IBMRGB514))
+            pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
+
+        pATI->ClockDescriptor =
+            ATIClockDescriptors[pATI->ProgrammableClock];
+    }
+
+    ClockDac = pATI->DAC;
+    switch (pATI->ProgrammableClock)
+    {
+        case ATI_CLOCK_ICS2595:
+            /*
+             * Pick up reference divider (43 or 46) appropriate to the chip
+             * revision level.
+             */
+            if (ClockTable > 0)
+                pATI->ClockDescriptor.MinM =
+                    pATI->ClockDescriptor.MaxM =
+                        BIOSWord(ClockTable + 0x0AU);
+            else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-0"))
+                pATI->ClockDescriptor.MinM =
+                    pATI->ClockDescriptor.MaxM = 43;
+            else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-1"))
+                pATI->ClockDescriptor.MinM =
+                    pATI->ClockDescriptor.MaxM = 46;
+            else
+                pATI->ProgrammableClock = ATI_CLOCK_UNKNOWN;
+            break;
+
+        case ATI_CLOCK_STG1703:
+            /* This one's also a RAMDAC */
+            ClockDac = ATI_DAC_STG1703;
+            break;
+
+        case ATI_CLOCK_CH8398:
+            /* This one's also a RAMDAC */
+            ClockDac = ATI_DAC_CH8398;
+            break;
+
+        case ATI_CLOCK_INTERNAL:
+            /*
+             * The reference divider has already been programmed by BIOS
+             * initialisation.  Because, there is only one reference
+             * divider for all generated frequencies (including MCLK), it
+             * cannot be changed without reprogramming all clocks every
+             * time one of them needs a different reference divider.
+             *
+             * Besides, it's not a good idea to change the reference
+             * divider.  BIOS initialisation sets it to a value that
+             * effectively prevents generating frequencies beyond the
+             * graphics controller's tolerance.
+             */
+            pATI->ClockDescriptor.MinM = pATI->ClockDescriptor.MaxM =
+                ATIMach64GetPLLReg(PLL_REF_DIV);
+
+            /* The DAC is also integrated */
+            if ((pATI->DAC & ~0x0FU) != ATI_DAC_INTERNAL)
+                ClockDac = ATI_DAC_INTERNAL;
+
+            break;
+
+        case ATI_CLOCK_ATT20C408:
+            /* This one's also a RAMDAC */
+            ClockDac = ATI_DAC_ATT20C408;
+            break;
+
+        case ATI_CLOCK_IBMRGB514:
+            /* This one's also a RAMDAC */
+            ClockDac = ATI_DAC_IBMRGB514;
+            pATI->ClockNumberToProgramme = 7;
+            break;
+
+        default:
+            break;
+    }
+
+    /*
+     * We now have up to two indications of what RAMDAC the adapter uses.
+     * They should be the same.  The following test and corresponding
+     * action are under construction.
+     */
+    if (pATI->DAC != ClockDac)
+    {
+        xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
+                   "Mach64 RAMDAC probe discrepancy detected:\n"
+                   "  DAC=0x%02X;  ClockDac=0x%02X.\n",
+                   pATI->DAC, ClockDac);
+
+        if (pATI->DAC == ATI_DAC_IBMRGB514)
+        {
+            pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
+            pATI->ClockDescriptor =
+                ATIClockDescriptors[ATI_CLOCK_IBMRGB514];
+            pATI->ClockNumberToProgramme = 7;
+        }
+        else
+        {
+            pATI->DAC = ClockDac;   /* For now */
+        }
+    }
+}
+
 /*
  * ATIPreInit --
  *
@@ -136,15 +332,7 @@ ATIPreInit
     int flags
 )
 {
-#   define           BIOS_SIZE       0x00010000U     /* 64kB */
     CARD8            BIOS[BIOS_SIZE];
-#   define           BIOSByte(_n)    ((CARD8)(BIOS[_n]))
-#   define           BIOSWord(_n)    ((CARD16)(BIOS[_n] |                \
-                                               (BIOS[(_n) + 1] << 8)))
-#   define           BIOSLong(_n)    ((CARD32)(BIOS[_n] |                \
-                                               (BIOS[(_n) + 1] << 8) |   \
-                                               (BIOS[(_n) + 2] << 16) |  \
-                                               (BIOS[(_n) + 3] << 24)))
     unsigned int     BIOSSize = 0;
     unsigned int     ROMTable = 0, ClockTable = 0, FrequencyTable = 0;
     unsigned int     LCDTable = 0, LCDPanelInfo = 0, VideoTable = 0;
@@ -590,17 +778,7 @@ ATIPreInit
                 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.
-     */
     {
-        CARD16 ClockDac;
-
-        /* Set up non-zero defaults */
-        pATI->ClockDescriptor = ATIClockDescriptors[ATI_CLOCK_FIXED];
-        pATI->ClockNumberToProgramme = -1;
-
         ROMTable = BIOSWord(0x48U);
         if ((ROMTable < 0x0002U) ||
             (BIOSWord(ROMTable - 0x02U) < 0x0012U) ||
@@ -634,175 +812,7 @@ ATIPreInit
             }
         }
 
-        if (ClockTable > 0)
-        {
-            pATI->ProgrammableClock = BIOSByte(ClockTable);
-            pATI->ClockNumberToProgramme = BIOSByte(ClockTable + 0x06U);
-            switch (BIOSWord(ClockTable + 0x08U) / 10)
-            {
-                case 143:
-                    pATI->ReferenceNumerator = 157500;
-                    pATI->ReferenceDenominator = 11;
-                    break;
-
-                case 286:
-                    pATI->ReferenceNumerator = 315000;
-                    pATI->ReferenceDenominator = 11;
-                    break;
-
-                default:
-                    pATI->ReferenceNumerator =
-                        BIOSWord(ClockTable + 0x08U) * 10;
-                    pATI->ReferenceDenominator = 1;
-                    break;
-            }
-        }
-        else
-        {
-            /*
-             * Compensate for BIOS absence.  Note that the reference
-             * frequency has already been set by option processing.
-             */
-            if ((pATI->DAC & ~0x0FU) == ATI_DAC_INTERNAL)
-            {
-                pATI->ProgrammableClock = ATI_CLOCK_INTERNAL;
-            }
-            else switch (pATI->DAC)
-            {
-                case ATI_DAC_STG1703:
-                    pATI->ProgrammableClock = ATI_CLOCK_STG1703;
-                    break;
-
-                case ATI_DAC_CH8398:
-                    pATI->ProgrammableClock = ATI_CLOCK_CH8398;
-                    break;
-
-                case ATI_DAC_ATT20C408:
-                    pATI->ProgrammableClock = ATI_CLOCK_ATT20C408;
-                    break;
-
-                case ATI_DAC_IBMRGB514:
-                    pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
-                    break;
-
-                default:        /* Provisional */
-                    pATI->ProgrammableClock = ATI_CLOCK_ICS2595;
-                    break;
-            }
-
-            /* This should be safe for all generators except IBM's RGB514 */
-            pATI->ClockNumberToProgramme = 3;
-        }
-
-        if ((pATI->ProgrammableClock > ATI_CLOCK_FIXED) &&
-            (pATI->ProgrammableClock < ATI_CLOCK_MAX))
-        {
-            /*
-             * Graphics PRO TURBO 1600's are unusual in that an ICS2595 is used
-             * to generate clocks for VGA modes, and an IBM RGB514 is used for
-             * accelerator modes.
-             */
-            if ((pATI->ProgrammableClock == ATI_CLOCK_ICS2595) &&
-                (pATI->DAC == ATI_DAC_IBMRGB514))
-                pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
-
-            pATI->ClockDescriptor =
-                ATIClockDescriptors[pATI->ProgrammableClock];
-        }
-
-        ClockDac = pATI->DAC;
-        switch (pATI->ProgrammableClock)
-        {
-            case ATI_CLOCK_ICS2595:
-                /*
-                 * Pick up reference divider (43 or 46) appropriate to the chip
-                 * revision level.
-                 */
-                if (ClockTable > 0)
-                    pATI->ClockDescriptor.MinM =
-                        pATI->ClockDescriptor.MaxM =
-                            BIOSWord(ClockTable + 0x0AU);
-                else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-0"))
-                    pATI->ClockDescriptor.MinM =
-                        pATI->ClockDescriptor.MaxM = 43;
-                else if (!xf86NameCmp(pGDev->clockchip, "ATI 18818-1"))
-                    pATI->ClockDescriptor.MinM =
-                        pATI->ClockDescriptor.MaxM = 46;
-                else
-                    pATI->ProgrammableClock = ATI_CLOCK_UNKNOWN;
-                break;
-
-            case ATI_CLOCK_STG1703:
-                /* This one's also a RAMDAC */
-                ClockDac = ATI_DAC_STG1703;
-                break;
-
-            case ATI_CLOCK_CH8398:
-                /* This one's also a RAMDAC */
-                ClockDac = ATI_DAC_CH8398;
-                break;
-
-            case ATI_CLOCK_INTERNAL:
-                /*
-                 * The reference divider has already been programmed by BIOS
-                 * initialisation.  Because, there is only one reference
-                 * divider for all generated frequencies (including MCLK), it
-                 * cannot be changed without reprogramming all clocks every
-                 * time one of them needs a different reference divider.
-                 *
-                 * Besides, it's not a good idea to change the reference
-                 * divider.  BIOS initialisation sets it to a value that
-                 * effectively prevents generating frequencies beyond the
-                 * graphics controller's tolerance.
-                 */
-                pATI->ClockDescriptor.MinM = pATI->ClockDescriptor.MaxM =
-                    ATIMach64GetPLLReg(PLL_REF_DIV);
-
-                /* The DAC is also integrated */
-                if ((pATI->DAC & ~0x0FU) != ATI_DAC_INTERNAL)
-                    ClockDac = ATI_DAC_INTERNAL;
-
-                break;
-
-            case ATI_CLOCK_ATT20C408:
-                /* This one's also a RAMDAC */
-                ClockDac = ATI_DAC_ATT20C408;
-                break;
-
-            case ATI_CLOCK_IBMRGB514:
-                /* This one's also a RAMDAC */
-                ClockDac = ATI_DAC_IBMRGB514;
-                pATI->ClockNumberToProgramme = 7;
-                break;
-
-            default:
-                break;
-        }
-
-        /*
-         * We now have up to two indications of what RAMDAC the adapter uses.
-         * They should be the same.  The following test and corresponding
-         * action are under construction.
-         */
-        if (pATI->DAC != ClockDac)
-        {
-            xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
-                       "Mach64 RAMDAC probe discrepancy detected:\n"
-                       "  DAC=0x%02X;  ClockDac=0x%02X.\n",
-                       pATI->DAC, ClockDac);
-
-            if (pATI->DAC == ATI_DAC_IBMRGB514)
-            {
-                pATI->ProgrammableClock = ATI_CLOCK_IBMRGB514;
-                pATI->ClockDescriptor =
-                    ATIClockDescriptors[ATI_CLOCK_IBMRGB514];
-                pATI->ClockNumberToProgramme = 7;
-            }
-            else
-            {
-                pATI->DAC = ClockDac;   /* For now */
-            }
-        }
+        ati_bios_clock(pScreenInfo, pATI, BIOS, ClockTable, pGDev);
 
         /*
          * Pick up multimedia information, which will be at different
commit 73ff279469be9c7cbf9f533b85fcb553694ff413
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Thu Feb 7 18:00:55 2008 +0200

    mach64: BIOSBase is no longer used

diff --git a/src/atiprobe.c b/src/atiprobe.c
index ddfed31..6636a7e 100644
--- a/src/atiprobe.c
+++ b/src/atiprobe.c
@@ -191,10 +191,6 @@ ATIMach64Detect
         return FALSE;
     }
 
-    /* Determine legacy BIOS address */
-    pATI->BIOSBase = 0x000C0000U +
-        (GetBits(inr(SCRATCH_REG1), BIOS_BASE_SEGMENT) << 11);
-
     ATIUnmapApertures(-1, pATI);
     return TRUE;
 }
diff --git a/src/atistruct.h b/src/atistruct.h
index d574947..0db9486 100644
--- a/src/atistruct.h
+++ b/src/atistruct.h
@@ -283,7 +283,6 @@ typedef struct _ATIRec
     /*
      * BIOS-related definitions.
      */
-    unsigned long BIOSBase;
     CARD8 I2CType, Tuner, Decoder, Audio;
 
     /*


More information about the xorg-commit mailing list