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 that need to access the PCI config space directly need this */
34 #include "xf86Pci.h"
35 
36 #include "compiler.h"
37 #include "trident.h"
38 #include "trident_regs.h"
39 
TVGA8900SetRead(ScreenPtr pScreen,int bank)40 int TVGA8900SetRead(ScreenPtr pScreen, int bank)
41 {
42   ScrnInfoPtr pScrn;
43   TRIDENTPtr pTrident;
44   pScrn = xf86ScreenToScrn(pScreen);
45   pTrident = TRIDENTPTR(pScrn);
46   OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
47   return 0;
48 }
TGUISetRead(ScreenPtr pScreen,int bank)49 int TGUISetRead(ScreenPtr pScreen, int bank)
50 {
51   ScrnInfoPtr pScrn;
52   TRIDENTPtr pTrident;
53   pScrn = xf86ScreenToScrn(pScreen);
54   pTrident = TRIDENTPTR(pScrn);
55   OUTB(0x3d9, bank & 0xff);
56   return 0;
57 }
TVGA8900SetWrite(ScreenPtr pScreen,int bank)58 int TVGA8900SetWrite(ScreenPtr pScreen, int bank)
59 {
60   ScrnInfoPtr pScrn;
61   TRIDENTPtr pTrident;
62   pScrn = xf86ScreenToScrn(pScreen);
63   pTrident = TRIDENTPTR(pScrn);
64   OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
65   return 0;
66 }
TGUISetWrite(ScreenPtr pScreen,int bank)67 int TGUISetWrite(ScreenPtr pScreen, int bank)
68 {
69   ScrnInfoPtr pScrn;
70   TRIDENTPtr pTrident;
71   pScrn = xf86ScreenToScrn(pScreen);
72   pTrident = TRIDENTPTR(pScrn);
73   OUTB(0x3d8, bank & 0xff);
74   return 0;
75 }
TVGA8900SetReadWrite(ScreenPtr pScreen,int bank)76 int TVGA8900SetReadWrite(ScreenPtr pScreen, int bank)
77 {
78   ScrnInfoPtr pScrn;
79   TRIDENTPtr pTrident;
80   pScrn = xf86ScreenToScrn(pScreen);
81   pTrident = TRIDENTPTR(pScrn);
82   OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
83   return 0;
84 }
TGUISetReadWrite(ScreenPtr pScreen,int bank)85 int TGUISetReadWrite(ScreenPtr pScreen, int bank)
86 {
87   ScrnInfoPtr pScrn;
88   TRIDENTPtr pTrident;
89   pScrn = xf86ScreenToScrn(pScreen);
90   pTrident = TRIDENTPTR(pScrn);
91   OUTB(0x3d8, bank & 0xff);
92   OUTB(0x3d9, bank & 0xff);
93   return 0;
94 }
95