Remove unused LinuxFindPci and LinuxGetPciCfg
These two functions are not referenced from inside xserver. Remove now-empty klinux.h too. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
63f4bf3917
commit
522ca8179a
|
@ -17,7 +17,6 @@ KDRIVE_HW_SOURCES = \
|
||||||
|
|
||||||
liblinux_la_SOURCES = \
|
liblinux_la_SOURCES = \
|
||||||
bus.c \
|
bus.c \
|
||||||
klinux.h \
|
|
||||||
mouse.c \
|
mouse.c \
|
||||||
ms.c \
|
ms.c \
|
||||||
ps2.c \
|
ps2.c \
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2003 Keith Packard
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of Keith Packard not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Keith Packard makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _KLINUX_H_
|
|
||||||
#define _KLINUX_H_
|
|
||||||
|
|
||||||
Bool
|
|
||||||
LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr);
|
|
||||||
|
|
||||||
unsigned char *
|
|
||||||
LinuxGetPciCfg(KdCardAttr *attr);
|
|
||||||
|
|
||||||
#endif /* _KLINUX_H_ */
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <kdrive-config.h>
|
#include <kdrive-config.h>
|
||||||
#endif
|
#endif
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
#include "klinux.h"
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <linux/vt.h>
|
#include <linux/vt.h>
|
||||||
|
@ -125,110 +124,6 @@ LinuxInit (void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
|
||||||
LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
char line[2048], *l, *end;
|
|
||||||
CARD32 bus, id, addr;
|
|
||||||
int n;
|
|
||||||
CARD32 ven_dev;
|
|
||||||
Bool ret = FALSE;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
attr->vendorID = vendor;
|
|
||||||
attr->deviceID = device;
|
|
||||||
ven_dev = (((CARD32) vendor) << 16) | ((CARD32) device);
|
|
||||||
f = fopen ("/proc/bus/pci/devices", "r");
|
|
||||||
if (!f)
|
|
||||||
return FALSE;
|
|
||||||
attr->io = 0;
|
|
||||||
while (fgets (line, sizeof (line)-1, f))
|
|
||||||
{
|
|
||||||
line[sizeof(line)-1] = '\0';
|
|
||||||
l = line;
|
|
||||||
bus = strtoul (l, &end, 16);
|
|
||||||
if (end == l)
|
|
||||||
continue;
|
|
||||||
l = end;
|
|
||||||
id = strtoul (l, &end, 16);
|
|
||||||
if (end == l)
|
|
||||||
continue;
|
|
||||||
l = end;
|
|
||||||
if (id != ven_dev)
|
|
||||||
continue;
|
|
||||||
if (count--)
|
|
||||||
continue;
|
|
||||||
(void) strtoul (l, &end, 16); /* IRQ */
|
|
||||||
if (end == l)
|
|
||||||
continue;
|
|
||||||
l = end;
|
|
||||||
n = 0;
|
|
||||||
for (i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
addr = strtoul (l, &end, 16);
|
|
||||||
if (end == l)
|
|
||||||
break;
|
|
||||||
if (addr & 1)
|
|
||||||
attr->io = addr & ~0xf;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (n == KD_MAX_CARD_ADDRESS)
|
|
||||||
break;
|
|
||||||
attr->address[n++] = addr & ~0xf;
|
|
||||||
}
|
|
||||||
l = end;
|
|
||||||
}
|
|
||||||
while (n > 0)
|
|
||||||
{
|
|
||||||
if (attr->address[n-1] != 0)
|
|
||||||
break;
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
attr->naddr = n;
|
|
||||||
attr->domain = 0; /* XXX */
|
|
||||||
attr->bus = (bus >> 8) & 0xff;
|
|
||||||
attr->slot = (bus >> 3) & 0x1f;
|
|
||||||
attr->func = bus & 0x07;
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fclose (f);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char *
|
|
||||||
LinuxGetPciCfg(KdCardAttr *attr)
|
|
||||||
{
|
|
||||||
char filename[256];
|
|
||||||
FILE *f;
|
|
||||||
unsigned char *cfg;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
snprintf(filename, 255, "/proc/bus/pci/%02x/%02x.%x",
|
|
||||||
attr->bus >> 8, (attr->bus & 0xff) >> 3, attr->bus & 7);
|
|
||||||
/* fprintf(stderr,"Find card on path %s\n",filename); */
|
|
||||||
|
|
||||||
if (!(f=fopen(filename,"r")))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(cfg=xalloc(256)))
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (256 != (r=fread(cfg, 1, 256, f)))
|
|
||||||
{
|
|
||||||
fprintf(stderr,"LinuxGetPciCfg: read %d, expected 256\n",r);
|
|
||||||
free(cfg);
|
|
||||||
cfg=NULL;
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
/* fprintf(stderr,"LinuxGetPciCfg: success, returning %p\n",cfg); */
|
|
||||||
return cfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
LinuxSetSwitchMode (int mode)
|
LinuxSetSwitchMode (int mode)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue