~ubuntu-branches/ubuntu/trusty/xserver-xorg-video-mach64-lts-xenial/trusty-proposed

« back to all changes in this revision

Viewing changes to src/atibank.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2016-05-03 14:02:37 UTC
  • Revision ID: package-import@ubuntu.com-20160503140237-y946gbjc7p6fg9fn
Tags: upstream-6.9.5
ImportĀ upstreamĀ versionĀ 6.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
 
3
 *
 
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.
 
13
 *
 
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.
 
21
 */
 
22
 
 
23
#ifdef HAVE_CONFIG_H
 
24
#include "config.h"
 
25
#endif
 
26
 
 
27
#include "ati.h"
 
28
#include "atibank.h"
 
29
#include "atimach64io.h"
 
30
#include "atiwonderio.h"
 
31
 
 
32
#ifndef AVOID_CPIO
 
33
 
 
34
/*
 
35
 * ATIx8800SetBank --
 
36
 *
 
37
 * Set an ATI 28800's, 68800's or 88800's read and write bank numbers.
 
38
 */
 
39
void
 
40
ATIx8800SetBank
 
41
(
 
42
    ATIPtr       pATI,
 
43
    unsigned int iBank
 
44
)
 
45
{
 
46
    (void)iBank; /* always called with iBank = 0 */
 
47
 
 
48
    ATIPutExtReg(0xB2U, 0x00U);
 
49
    ATIModifyExtReg(pATI, 0xAEU, -1, (CARD8)(~0x0FU), 0x00U);
 
50
}
 
51
 
 
52
/*
 
53
 * Functions to simulate a banked VGA aperture using a Mach64's small dual
 
54
 * paged apertures.  There are two sets of these:  one for packed modes, the
 
55
 * other for planar modes.
 
56
 */
 
57
 
 
58
static CARD32
 
59
ATIMach64MassagePackedBankNumber
 
60
(
 
61
    CARD8 iBank
 
62
)
 
63
{
 
64
    iBank <<= 1;
 
65
    return ((iBank + 1) << 16) | iBank;
 
66
}
 
67
 
 
68
/*
 
69
 * ATIMach64SetBankPacked --
 
70
 *
 
71
 * Set read and write bank numbers for small dual paged apertures.
 
72
 */
 
73
void
 
74
ATIMach64SetBankPacked
 
75
(
 
76
    ATIPtr       pATI,
 
77
    unsigned int iBank
 
78
)
 
79
{
 
80
    CARD32 tmp = ATIMach64MassagePackedBankNumber(iBank);
 
81
 
 
82
    outr(MEM_VGA_RP_SEL, tmp);
 
83
    outr(MEM_VGA_WP_SEL, tmp);
 
84
}
 
85
 
 
86
static CARD32
 
87
ATIMach64MassagePlanarBankNumber
 
88
(
 
89
    CARD8 iBank
 
90
)
 
91
{
 
92
    iBank <<= 3;
 
93
    return ((iBank + 4) << 16) | iBank;
 
94
}
 
95
 
 
96
/*
 
97
 * ATIMach64SetBankPlanar --
 
98
 *
 
99
 * Set read and write bank numbers for small dual paged apertures.
 
100
 */
 
101
void
 
102
ATIMach64SetBankPlanar
 
103
(
 
104
    ATIPtr       pATI,
 
105
    unsigned int iBank
 
106
)
 
107
{
 
108
    CARD32 tmp = ATIMach64MassagePlanarBankNumber(iBank);
 
109
 
 
110
    outr(MEM_VGA_RP_SEL, tmp);
 
111
    outr(MEM_VGA_WP_SEL, tmp);
 
112
}
 
113
 
 
114
#endif /* AVOID_CPIO */