2
* Id: ts300.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
4
* Copyright � 1999 Keith Packard
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
24
/* $RCSId: xc/programs/Xserver/hw/kdrive/ts300/ts300.c,v 1.3 2000/02/23 20:30:14 dawes Exp $ */
27
#include <kdrive-config.h>
31
extern KdCardFuncs sisFuncs;
32
extern KdCardFuncs s3Funcs;
35
* Kludgy code to parse the ascii /proc/pci file as the TS300
36
* is running a 2.0 kernel
39
HasPCI (char *name, KdCardAttr *attr)
47
f = fopen ("/proc/pci", "r");
52
while (fgets (line, sizeof (line), f))
57
if (mem = strstr (line, "memory at "))
59
mem += strlen ("memory at ");
60
attr->address[attr->naddr++] = strtoul (mem, NULL, 0);
63
else if (mem = strstr (line, "I/O at "))
65
mem += strlen ("I/O at ");
66
attr->io = strtoul (mem, NULL, 0);
69
else if (strstr (line, "Bus") && strstr (line, "device") &&
70
strstr (line, "function"))
73
else if (strstr (line, "VGA compatible controller"))
75
if (strstr (line, name))
83
typedef struct _PCICard {
89
PCICard PCICards[] = {
90
"sis", "Silicon Integrated Systems", &sisFuncs,
91
"s3", "S3 Inc.", &s3Funcs,
94
#define NUM_PCI_CARDS (sizeof (PCICards) / sizeof (PCICards[0]))
104
for (i = 0; i < NUM_PCI_CARDS; i++)
106
if (!name || !strcmp (name, PCICards[i].user))
108
if (HasPCI (PCICards[i].name, &attr))
110
KdCardInfoAdd (PCICards[i].funcs, &attr, 0);
118
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
120
KdInitOutput (pScreenInfo, argc, argv);
124
InitInput (int argc, char **argv)
126
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
136
ddxProcessArgument (int argc, char **argv, int i)
138
return KdProcessArgument (argc, argv, i);