1 /*
2 * Copyright 1993 by David Dawes <dawes@physics.su.oz.au>
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 David Dawes
9 * not be used in advertising or publicity pertaining to distribution of
10 * the software without specific, written prior permission.
11 * David Dawes makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 * FITNESS, IN NO EVENT SHALL DAVID DAWES BE LIABLE FOR
18 * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
20 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 */
24
25 /* $XFree86: mit/server/ddx/x386/accel/s3/drivers/mmio_928/mmio_928.c,v 2.3 1993/09/29 11:11:23 dawes Exp $ */
26
27 #include "s3.h"
28 #include "regs3.h"
29
30 static Bool MMIO_928Probe();
31 static char *MMIO_928Ident();
32 extern void mmio928_s3EnterLeaveVT();
33 extern Bool mmio928_s3Initialize();
34 extern void mmio928_s3AdjustFrame();
35 extern Bool mmio928_s3SwitchMode();
36 extern int s3ChipId;
37 extern Bool s3Mmio928;
38
39 /*
40 * If 'volatile' isn't available, we disable the MMIO code
41 */
42
43 #if defined(__STDC__) || defined(__GNUC__)
44 #define HAVE_VOLATILE
45 #endif
46
47 s3VideoChipRec MMIO_928 = {
48 MMIO_928Probe,
49 MMIO_928Ident,
50 #ifdef HAVE_VOLATILE
51 mmio928_s3EnterLeaveVT,
52 mmio928_s3Initialize,
53 mmio928_s3AdjustFrame,
54 mmio928_s3SwitchMode,
55 #else
56 NULL,
57 NULL,
58 NULL,
59 NULL,
60 #endif
61 };
62
63 static char *
MMIO_928Ident(n)64 MMIO_928Ident(n)
65 int n;
66 {
67 #ifdef HAVE_VOLATILE
68 static char *chipsets[] = {"mmio_928"};
69
70 if (n + 1 > sizeof(chipsets) / sizeof(char *))
71 return(NULL);
72 else
73 return(chipsets[n]);
74 #else
75 return(NULL);
76 #endif
77 }
78
79
80 static Bool
MMIO_928Probe()81 MMIO_928Probe()
82 {
83 #ifdef HAVE_VOLATILE
84 if (s3InfoRec.chipset) {
85 if (StrCaseCmp(s3InfoRec.chipset, MMIO_928Ident(0)))
86 return(FALSE);
87 else {
88 s3Mmio928 = TRUE;
89 return(TRUE);
90 }
91 }
92
93 if (S3_928_SERIES(s3ChipId)) {
94 s3InfoRec.chipset = MMIO_928Ident(0);
95 s3Mmio928 = TRUE;
96 return(TRUE);
97 } else {
98 return(FALSE);
99 }
100 #else
101 return(FALSE);
102 #endif
103 }
104