trident_bank.c revision 95b296d0
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/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_bank.c,v 1.4 2000/12/07 16:48:04 alanh Exp $ */
25
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
30/* All drivers should typically include these */
31#include "xf86.h"
32#include "xf86_OSproc.h"
33
34/* Drivers for PCI hardware need this */
35#include "xf86PciInfo.h"
36
37/* Drivers that need to access the PCI config space directly need this */
38#include "xf86Pci.h"
39
40#include "compiler.h"
41#include "trident.h"
42#include "trident_regs.h"
43
44int TVGA8900SetRead(ScreenPtr pScreen, int bank)
45{
46  ScrnInfoPtr pScrn;
47  TRIDENTPtr pTrident;
48  pScrn = xf86Screens[pScreen->myNum];
49  pTrident = TRIDENTPTR(pScrn);
50  OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
51  return 0;
52}
53int TGUISetRead(ScreenPtr pScreen, int bank)
54{
55  ScrnInfoPtr pScrn;
56  TRIDENTPtr pTrident;
57  pScrn = xf86Screens[pScreen->myNum];
58  pTrident = TRIDENTPTR(pScrn);
59  OUTB(0x3d9, bank & 0xff);
60  return 0;
61}
62int TVGA8900SetWrite(ScreenPtr pScreen, int bank)
63{
64  ScrnInfoPtr pScrn;
65  TRIDENTPtr pTrident;
66  pScrn = xf86Screens[pScreen->myNum];
67  pTrident = TRIDENTPTR(pScrn);
68  OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
69  return 0;
70}
71int TGUISetWrite(ScreenPtr pScreen, int bank)
72{
73  ScrnInfoPtr pScrn;
74  TRIDENTPtr pTrident;
75  pScrn = xf86Screens[pScreen->myNum];
76  pTrident = TRIDENTPTR(pScrn);
77  OUTB(0x3d8, bank & 0xff);
78  return 0;
79}
80int TVGA8900SetReadWrite(ScreenPtr pScreen, int bank)
81{
82  ScrnInfoPtr pScrn;
83  TRIDENTPtr pTrident;
84  pScrn = xf86Screens[pScreen->myNum];
85  pTrident = TRIDENTPTR(pScrn);
86  OUTW(0x3c4, 0xC000 | (((bank & 0x3f) ^ 0x02)<<8)|0x0E);
87  return 0;
88}
89int TGUISetReadWrite(ScreenPtr pScreen, int bank)
90{
91  ScrnInfoPtr pScrn;
92  TRIDENTPtr pTrident;
93  pScrn = xf86Screens[pScreen->myNum];
94  pTrident = TRIDENTPTR(pScrn);
95  OUTB(0x3d8, bank & 0xff);
96  OUTB(0x3d9, bank & 0xff);
97  return 0;
98}
99