trident_bank.c revision ff89ac2b
1/*
2 * Copyright 1992-2003 by Alan Hourihane, North Wales, UK.
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
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Alan Hourihane not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission.  Alan Hourihane 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 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL ALAN HOURIHANE 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 * Author:  Alan Hourihane, alanh@fairlite.demon.co.uk
23 */
24
25#ifdef HAVE_CONFIG_H
26#include "config.h"
27#endif
28
29/* All drivers should typically include these */
30#include "xf86.h"
31#include "xf86_OSproc.h"
32
33/* Drivers for PCI hardware need this */
34#include "xf86PciInfo.h"
35
36/* Drivers that need to access the PCI config space directly need this */
37#include "xf86Pci.h"
38
39#include "compiler.h"
40#include "trident.h"
41#include "trident_regs.h"
42
43int TVGA8900SetRead(ScreenPtr pScreen, int bank)
44{
45  ScrnInfoPtr pScrn;
46  TRIDENTPtr pTrident;
47  pScrn = xf86Screens[pScreen->myNum];
48  pTrident = TRIDENTPTR(pScrn);
49  OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
50  return 0;
51}
52int TGUISetRead(ScreenPtr pScreen, int bank)
53{
54  ScrnInfoPtr pScrn;
55  TRIDENTPtr pTrident;
56  pScrn = xf86Screens[pScreen->myNum];
57  pTrident = TRIDENTPTR(pScrn);
58  OUTB(0x3d9, bank & 0xff);
59  return 0;
60}
61int TVGA8900SetWrite(ScreenPtr pScreen, int bank)
62{
63  ScrnInfoPtr pScrn;
64  TRIDENTPtr pTrident;
65  pScrn = xf86Screens[pScreen->myNum];
66  pTrident = TRIDENTPTR(pScrn);
67  OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
68  return 0;
69}
70int TGUISetWrite(ScreenPtr pScreen, int bank)
71{
72  ScrnInfoPtr pScrn;
73  TRIDENTPtr pTrident;
74  pScrn = xf86Screens[pScreen->myNum];
75  pTrident = TRIDENTPTR(pScrn);
76  OUTB(0x3d8, bank & 0xff);
77  return 0;
78}
79int TVGA8900SetReadWrite(ScreenPtr pScreen, int bank)
80{
81  ScrnInfoPtr pScrn;
82  TRIDENTPtr pTrident;
83  pScrn = xf86Screens[pScreen->myNum];
84  pTrident = TRIDENTPTR(pScrn);
85  OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
86  return 0;
87}
88int TGUISetReadWrite(ScreenPtr pScreen, int bank)
89{
90  ScrnInfoPtr pScrn;
91  TRIDENTPtr pTrident;
92  pScrn = xf86Screens[pScreen->myNum];
93  pTrident = TRIDENTPTR(pScrn);
94  OUTB(0x3d8, bank & 0xff);
95  OUTB(0x3d9, bank & 0xff);
96  return 0;
97}
98