2
* Copyright 2000 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
4
* Permission to use, copy, modify, distribute, and sell this software and its
5
* documentation for any purpose is hereby granted without fee, provided that
6
* the above copyright notice appear in all copies and that both that copyright
7
* notice and this permission notice appear in supporting documentation, and
8
* that the name of Marc Aurele La France not be used in advertising or
9
* publicity pertaining to distribution of the software without specific,
10
* written prior permission. Marc Aurele La France makes no representations
11
* about the suitability of this software for any purpose. It is provided
12
* "as-is" without express or implied warranty.
14
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
16
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
* PERFORMANCE OF THIS SOFTWARE.
29
#include "atimach64io.h"
32
* ATIMach64AccessPLLReg --
34
* This function sets up the addressing required to access, for read or write,
35
* a 264xT's PLL registers.
45
CARD8 clock_cntl1 = in8(CLOCK_CNTL + 1) &
46
~GetByte(PLL_WR_EN | PLL_ADDR, 1);
48
/* Set PLL register to be read or written */
49
out8(CLOCK_CNTL + 1, clock_cntl1 |
50
GetByte(SetBits(Index, PLL_ADDR) | SetBits(Write, PLL_WR_EN), 1));
54
* ATIMach64PollEngineStatus --
56
* This function refreshes the driver's view of the draw engine's status. This
57
* has been moved into a separate compilation unit to prevent inlining.
60
ATIMach64PollEngineStatus
68
if (pATI->Chip < ATI_CHIP_264VTB)
71
* TODO: Deal with locked engines.
73
IOValue = inm(FIFO_STAT);
74
pATI->EngineIsLocked = GetBits(IOValue, FIFO_ERR);
77
* The following counts the number of bits in FIFO_STAT_BITS, and is
78
* derived from miSetVisualTypes().
80
IOValue = GetBits(IOValue, FIFO_STAT_BITS);
81
Count = (IOValue >> 1) & 0x36DBU;
82
Count = IOValue - Count - ((Count >> 1) & 0x36DBU);
83
Count = ((Count + (Count >> 3)) & 0x71C7U) % 0x3FU;
84
Count = pATI->nFIFOEntries - Count;
85
if (Count > pATI->nAvailableFIFOEntries)
86
pATI->nAvailableFIFOEntries = Count;
89
* If the command FIFO is non-empty, then the engine isn't idle.
91
if (pATI->nAvailableFIFOEntries < pATI->nFIFOEntries)
93
pATI->EngineIsBusy = TRUE;
98
IOValue = inm(GUI_STAT);
99
pATI->EngineIsBusy = GetBits(IOValue, GUI_ACTIVE);
100
Count = GetBits(IOValue, GUI_FIFO);
101
if (Count > pATI->nAvailableFIFOEntries)
102
pATI->nAvailableFIFOEntries = Count;