merged changes from propagator_1_1_dev

This commit is contained in:
Sergey Bolshakov 2004-11-22 13:47:29 +00:00
parent 4759507678
commit 7f8d55ebef
49 changed files with 492 additions and 9306 deletions

View File

@ -1,13 +1,18 @@
*.rdz*
.depend
Makefile.stripped
TAGS
debug.log
etc
hack_*
init
stage1-full
stage1-live
mkinitrd_helper.tar.bz2
stage1-cdrom
stage1-disk
stage1-full
stage1-live
stage1-media
stage1-medias
stage1-network
debug.log
.depend
*.rdz*
mkinitrd_helper.tar.bz2
hack_*
stage1-usbnet
version.h

View File

@ -1,24 +0,0 @@
#
# Master Manifest file for documentation-only distribution
#
doc d
MANIFEST.doc f
doc/article.ps f
doc/rose94.ps f
doc/bash.ps f
doc/bashbug.ps f
doc/builtins.ps f
doc/rbash.ps f
doc/bashref.ps f
doc/bashref.dvi f
doc/bash.0 f
doc/bashbug.0 f
doc/builtins.0 f
doc/rbash.0 f
doc/article.txt f
doc/bash.html f
doc/bashref.html f
doc/article.pdf f
doc/bash.pdf f
doc/bashref.pdf f
doc/rose94.pdf f

164
Makefile
View File

@ -35,19 +35,31 @@
#
#*****************************************************************************
PACKAGE = propagator
RPM = /bin/rpm
RPMSPEC = $(PACKAGE).spec
VERSION = $(shell $(RPM) -q --qf '[%{VERSION} ]' --specfile $(RPMSPEC) |cut -f1 -d ' ')
RELEASE = $(shell $(RPM) -q --qf '[%{RELEASE} ]' --specfile $(RPMSPEC) |cut -f1 -d ' ')
TARFILE = $(PACKAGE)-$(VERSION).tar.bz2
TARDIR = $(shell $(RPM) --define 'name $(PACKAGE)' --eval %_sourcedir)
top_dir = .
METHODS = full medias network
DESTDIR =
BINSDIR ?= /usr/lib/propagator/bin
MODDIR ?= /var/lib/propagator/modules
include $(top_dir)/Makefile.common
include Makefile.common
DEFS = -DSPAWN_SHELL
STAGE1BINS = $(METHODS:%=stage1-%)
BINS = init $(STAGE1BINS)
DIRS += pci-resource usb-resource
DEFS = -DSPAWN_SHELL -DENABLE_USB
COMPILE = $(CC) $(DEFS) $(CFLAGS)
#- stage1 "loader"
# i386 name is invalid to force this feature off
#- stage1 "loader"
# i386 name is invalid to force this feature off
ifeq (xi386, $(ARCH))
INITSRC = minilibc.c init.c
INIT_DEFS = -DINIT_HEADERS=\"minilibc.h\"
@ -62,11 +74,10 @@ endif
INITOBJS = $(subst .c,.o,$(INITSRC))
#- frontends
#- frontends
NEWT_FRONTEND_SRC = newt-frontend.c
GLIBC_NEWT_FRONTEND_LIBS = newt/libnewt.a slang/libslang.a
DIETLIBC_NEWT_FRONTEND_LIBS = $(subst .a,-DIET.a,$(GLIBC_NEWT_FRONTEND_LIBS))
DIETLIBC_NEWT_FRONTEND_LIBS = $(DIET_LIBDIR)/libnewt.a $(DIET_LIBDIR)/libslang.a
STDIO_FRONTEND_SRC = stdio-frontend.c
GLIBC_STDIO_FRONTEND_LIBS =
@ -74,62 +85,38 @@ DIETLIBC_STDIO_FRONTEND_LIBS =
FRONTEND_OBJS = $(subst .c,.o,$($(F)_FRONTEND_SRC))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(L)_$(F)_FRONTEND_LIBS)
ifeq (i386, $(ARCH))
# INSMOD = insmod-busybox
INSMOD = insmod-modutils
else
INSMOD = insmod-modutils
endif
GLIBC_STAGE1_OWN_LIBS = $(INSMOD)/libinsmod.a mar/libmar.a bzlib/libbz2.a
#$(top_dir)/$(TMP_PKG)/usr/lib/libbz2.a
DIETLIBC_STAGE1_OWN_LIBS = $(subst .a,-DIET.a,$(GLIBC_STAGE1_OWN_LIBS))
GLIBC_STAGE1_OWN_LIBS = mar/libmar.a /usr/lib/libbz2.a
DIETLIBC_STAGE1_OWN_LIBS = $(DIET_LIBDIR)/libmar.a $(DIET_LIBDIR)/libbz2.a
STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
ifeq (DIETLIBC, $(L))
STAGE1_NETWORK_LIBS = $(top_dir)/$(TMP_PKG)/usr/lib/dietlibc/lib-$(ARCH)/librpc.a
STAGE1_NETWORK_LIBS = $(DIET_LIBDIR)/librpc.a
endif
ifeq (GLIBC, $(L))
STAGE1_NETWORK_LIBS = /usr/lib/libresolv.a
endif
#- stage1 itself
###############################################################################
# stage1 itself
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c automatic.c frontend-common.c
CDROMSRC = cdrom.c
DISKSRC = disk.c lomount.c
MEDIASRC = cdrom.c disk.c lomount.c
NETWORKSRC = network.c nfsmount.c dhcp.c url.c dns.c adsl.c
ALLSRC = $(INITSRC) $(STAGE1SRC) $(MEDIASRC) $(NETWORKSRC)
###############################################################################
ALLSRC = $(INITSRC) $(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC)
STAGE1OBJS-CDROM = $(subst .c,-CDROM.o,$(STAGE1SRC) $(CDROMSRC))
CDROM_DEFS = -DDISABLE_DISK -DDISABLE_NETWORK -DAUTO_METHOD=\""cdrom"\"
STAGE1OBJS-DISK = $(subst .c,-DISK.o,$(STAGE1SRC) $(DISKSRC))
DISK_DEFS = -DDISABLE_CDROM -DDISABLE_NETWORK -DAUTO_METHOD=\""disk"\"
STAGE1OBJS-MEDIA = $(subst .c,-MEDIA.o,$(STAGE1SRC) $(MEDIASRC))
MEDIA_DEFS = -DDISABLE_NETWORK -DAUTO_METHOD=\""cdrom"\" ##-DAUTO_METHOD=\""disk"\"
STAGE1OBJS-NETWORK = $(subst .c,-NETWORK.o,$(STAGE1SRC) $(NETWORKSRC))
NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK
STAGE1OBJS-USBNET = $(subst .c,-USBNET.o,$(STAGE1SRC) $(NETWORKSRC))
STAGE1OBJS-LIVE = $(subst .c,-LIVE.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC))
LIVE_DEFS = -DLIVE
STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC))
STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1SRC) $(MEDIASRC) $(NETWORKSRC))
USBNET_DEFS = -DENABLE_USBNET
USBSTORAGE_DEFS = -DENABLE_USBSTORAGE
ifeq (xi386, $(ARCH))
LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o
@ -144,44 +131,18 @@ endif
endif
BINS = init stage1-full stage1-live
ifeq (i386, $(ARCH))
BINS += stage1-cdrom stage1-disk stage1-network stage1-usbnet
endif
#DIRS += mar pci-resource usb-resource $(INSMOD) slang newt ppp/pppd rp-pppoe/src
DIRS += mar pci-resource usb-resource $(INSMOD) slang newt bzlib
# ppp/pppd rp-pppoe/src
USBNET_DEFS_GEN = -DENABLE_USB -DENABLE_USBNET
USBNET_DEFS = $(USBNET_DEFS_GEN) -DDISABLE_PCINET
all: unpack version.h dirs $(BINS)
unpack:
rm -rf $(top_dir)/$(TMP_PKG)
mkdir $(top_dir)/$(TMP_PKG)
pushd $(top_dir)/$(TMP_PKG); \
for f in `cat $(top_dir)/../REQ`; do \
rpm2cpio `$(SCRIPTS)/get_packages $$f $$f` | cpio -id; \
done
all: version.h dirs $(BINS)
dirs:
@for n in . $(DIRS); do \
[ "$$n" = "." ] || make -C $$n ;\
done
init: $(INITOBJS) $(INIT_LIBC)
init: $(INITOBJS) $(INIT_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_INIT)
$(STRIPCMD) $@
stage1-cdrom: $(STAGE1OBJS-CDROM) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
stage1-disk: $(STAGE1OBJS-DISK) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
stage1-medias: $(STAGE1OBJS-MEDIA) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
@ -189,57 +150,36 @@ stage1-network: $(STAGE1OBJS-NETWORK) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
stage1-usbnet: $(STAGE1OBJS-USBNET) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
stage1-full: $(STAGE1OBJS-FULL) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
stage1-live: $(STAGE1OBJS-LIVE) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
$(INITOBJS): %.o: %.c
$(COMPILE) $(INIT_DEFS) -c $<
$(STAGE1OBJS-CDROM): %-CDROM.o: %.c
$(COMPILE) $(INCLUDES) $(CDROM_DEFS) -c $< -o $@
$(STAGE1OBJS-DISK): %-DISK.o: %.c
$(COMPILE) $(INCLUDES) $(DISK_DEFS) -c $< -o $@
$(STAGE1OBJS-MEDIA): %-MEDIA.o: %.c
$(COMPILE) $(INCLUDES) $(MEDIA_DEFS) $(USBSTORAGE_DEFS) -c $< -o $@
$(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c
$(COMPILE) $(INCLUDES) $(NETWORK_DEFS) -c $< -o $@
$(STAGE1OBJS-USBNET): %-USBNET.o: %.c
$(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(USBNET_DEFS) -c $< -o $@
$(STAGE1OBJS-FULL): %-FULL.o: %.c
$(COMPILE) $(INCLUDES) $(USBNET_DEFS_GEN) -c $< -o $@
$(STAGE1OBJS-LIVE): %-LIVE.o: %.c
$(COMPILE) $(INCLUDES) $(USBNET_DEFS_GEN) $(LIVE_DEFS) -c $< -o $@
$(COMPILE) $(INCLUDES) $(USBNET_DEFS) $(USBSTORAGE_DEFS) -c $< -o $@
.c.o:
$(COMPILE) $(INCLUDES) -c $<
version.h:
echo "#define VERSION \"$$VERSION\"" >version.h; \
echo "#define DISTRIB_NAME \"$$ORIGIN $$VERSION $$SUITE ($$CODENAME)\"" >>version.h
version.h: /etc/altlinux-release
@sed 's|^ALT Linux \([^ ]\+\)\([^(]\+\)(\([^)]\+\))|\
echo \\#define VERSION \\"\2\\";echo \\#define DISTRIB_NAME \\"ALT Linux\2\1 \\(\3\\)\\"|' < $^ |sh > $@
clean:
@for n in $(DIRS); do \
(cd $$n; make clean) \
done
rm -rf $(TMP_PKG)
rm -f *.o .depend *.rdz *.img $(BINS)
rm -f version.h
.depend:
$(CPP) $(CFLAGS) -M $(ALLSRC) > .depend
@ -247,14 +187,22 @@ ifeq (.depend,$(wildcard .depend))
include .depend
endif
*-CDROM.o: %-CDROM.o: %.o
*-DISK.o: %-DISK.o: %.o
*-MEDIA.o: %-MEDIA.o: %.o
*-NETWORK.o: %-NETWORK.o: %.o
*-USBNET.o: %-USBNET.o: %.o
*-FULL.o: %-FULL.o: %.o
*-LIVE.o: %-LIVE.o: %.o
install: all
mkdir -p $(DESTDIR)$(BINSDIR)
install -m0755 init $(DESTDIR)$(BINSDIR)
@methods='$(METHODS)'; for m in $$methods; do \
mkdir -p $(DESTDIR)$(BINSDIR)/$$m; \
install -m0755 stage1-$$m $(DESTDIR)$(BINSDIR)/$$m/stage1; \
done
export: install
bte: clean $(RPMSPEC)
@tar c --exclude CVS --file $(TARDIR)/$(TARFILE) .
cat $(RPMSPEC)

View File

@ -17,7 +17,8 @@
ARCH := $(patsubst i%86,i386,$(shell uname -m))
ARCH := $(patsubst sparc%,sparc,$(ARCH))
include $(DISTRCONF)
DIET_PREFIX = /usr/lib/dietlibc
DIET_LIBDIR = $(DIET_PREFIX)/lib-$(ARCH)
#- default lib is dietlibc (honoured by main Makefile whenever possible)
L = DIETLIBC
@ -35,30 +36,26 @@ ifeq (ppc, $(ARCH))
L = GLIBC
endif
TMP_PKG=tmp_rpm
#- flags used by all stuff
ifeq (ppc, $(ARCH))
CFLAGS = -Os -pipe -Wall -fomit-frame-pointer
else
CFLAGS = -Os -pipe -Wall -fomit-frame-pointer -D_BSD_SOURCE -D_GNU_SOURCE -D__LIBC_DIETLIBC__
CFLAGS = -Os -pipe -Wall -Wno-deprecated-declarations -fomit-frame-pointer -D_BSD_SOURCE -D_GNU_SOURCE -D__LIBC_DIETLIBC__
endif
DIETLIBC_INCLUDES = -I$(top_dir)/$(TMP_PKG)/usr/lib/dietlibc/include -I. -I$(top_dir)/$(TMP_PKG)/usr/include
GLIBC_INCLUDES = -I. -I$(top_dir)/$(TMP_PKG)/usr/include
# -I$(top_dir)/$(TMP_PKG)/usr/lib/dietlibc/include -I$(top_dir)/$(TMP_PKG)/usr/include
INCLUDES = $($(L)_INCLUDES)
DIETLIBC_INCLUDES = -I$(DIET_PREFIX)/include
GLIBC_INCLUDES =
INCLUDES = -I. $($(L)_INCLUDES)
GCC_LIBDIR=$(shell dirname `gcc -print-libgcc-file-name`)
LIBGCC_A=$(shell gcc -print-libgcc-file-name)
GLIBC_LDFLAGS_STAGE1 = -static
DIETLIBC_LDFLAGS_STAGE1 = -nostdlib $(top_dir)/$(TMP_PKG)/usr/lib/dietlibc/lib-$(ARCH)/start.o $(LIBGCC_A)
DIETLIBC_LDFLAGS_STAGE1 = -nostdlib $(DIET_LIBDIR)/start.o $(LIBGCC_A)
LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1)
GLIBC_LIBC =
DIETLIBC_LIBC = $(top_dir)/$(TMP_PKG)/usr/lib/dietlibc/lib-$(ARCH)/libc.a $(top_dir)/$(TMP_PKG)/usr/lib/dietlibc/lib-$(ARCH)/libcompat.a
DIETLIBC_LIBC = $(DIET_LIBDIR)/libc.a $(DIET_LIBDIR)/libcompat.a
STAGE1_LIBC = $($(L)_LIBC)
STRIPCMD = strip -R .note -R .comment

View File

@ -1,30 +0,0 @@
#******************************************************************************
#
# Guillaume Cottenceau (gc@mandrakesoft.com)
#
# Copyright 2000 MandrakeSoft
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#*****************************************************************************
DIRS = dietlibc insmod-busybox
all: dirs
dirs:
@for n in . $(DIRS); do \
[ "$$n" = "." ] || make -C $$n ;\
done
clean:
@for n in $(DIRS); do \
(cd $$n; make clean) \
done

View File

@ -28,6 +28,7 @@
#define RAMDISK_COMPRESSION_RATIO 1.95
#define VERSION_FILE "/.VERSION"
#define LIVE_LOCATION "/ALTLinux/altinst/"
#define RAMDISK_LOCATION "/ALTLinux/base/"
#define IMAGE_LOCATION "/tmp/image"

Binary file not shown.

32
init.c
View File

@ -333,10 +333,13 @@ void unmount_filesystems(void)
int exit_value_rescue = 66;
#define MAJOR(dev) ((dev)>>8)
#define MINOR(dev) ((dev) & 0xff)
#define MKDEV(ma,mi) ((ma)<<8 | (mi))
#define DEV_PERM 00400|00200|00040|00020
#define CHR_DEV 0020000|DEV_PERM
#define BLK_DEV 0060000|DEV_PERM
//static _syscall3(int,mknod,char *,a1,mode_t,a2,dev_t,a3)
int main(int argc, char **argv)
{
@ -345,35 +348,10 @@ int main(int argc, char **argv)
int fd;
int abnormal_termination = 0;
int end_stage2 = 0;
//char *argv2[4] = {"ls","-l","/dev/",0};
/* getpid() != 1 should work, by linuxrc tends to get a larger pid */
/*testing = (getpid() > 50); */
/*
mknod("/dev/ram3", BLK_DEV, MKDEV(1,3));
mknod("/dev/fd0", BLK_DEV, MKDEV(2,0));
mknod("/dev/loop3", BLK_DEV, MKDEV(7,3));
mknod("/dev/mem", CHR_DEV, MKDEV(1,1));
mknod("/dev/null", CHR_DEV, MKDEV(1,3));
mknod("/dev/ptyp0", CHR_DEV, MKDEV(2,0));
mknod("/dev/ttyp0", CHR_DEV, MKDEV(3,0));
mknod("/dev/tty0", CHR_DEV, MKDEV(4,0));
mknod("/dev/tty1", CHR_DEV, MKDEV(4,1));
mknod("/dev/tty2", CHR_DEV, MKDEV(4,2));
mknod("/dev/tty3", CHR_DEV, MKDEV(4,3));
mknod("/dev/tty4", CHR_DEV, MKDEV(4,4));
mknod("/dev/tty5", CHR_DEV, MKDEV(4,5));
mknod("/dev/tty6", CHR_DEV, MKDEV(4,6));
mknod("/dev/tty7", CHR_DEV, MKDEV(4,7));
mknod("/dev/ttyS0", CHR_DEV, MKDEV(4,64));
mknod("/dev/console", CHR_DEV, MKDEV(5,1));
mknod("/dev/fb0", CHR_DEV, MKDEV(29,0));
mknod("/dev/ppp", CHR_DEV, MKDEV(108,0));
*/
//execve("/bin/ls",argv2,0);
if (!testing) {
/* turn off screen blanking */
printf("\033[9;0]");

View File

@ -26,34 +26,102 @@
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include "insmod.h"
#include <errno.h>
#ifdef CONFIG_USE_ZLIB
#include <zlib.h>
#endif
#include "stage1.h"
#include "log.h"
#include "mar/mar-extract-only.h"
#include "frontend.h"
#include "mount.h"
#include "modules_descr.h"
#include "modules.h"
extern int mar_extract_inplace(char *, const char *, void **, int *);
extern char ** mar_list_contents(char *);
static struct module_deps_elem * modules_deps = NULL;
static char * archive_name = "/modules/modules.mar";
int disable_modules = 0;
static const char *moderror(int err)
{
switch (err) {
case ENOEXEC:
return "Invalid module format";
case ENOENT:
return "Unknown symbol in module";
case ESRCH:
return "Module has wrong symbol version";
case EINVAL:
return "Invalid parameters";
default:
return strerror(err);
}
}
static void *grab_file(const char *filename, unsigned long *size)
{
unsigned int max = 16384;
int ret, fd;
void *buffer = malloc(max);
fd = open(filename, O_RDONLY, 0);
if (fd < 0)
return NULL;
*size = 0;
while ((ret = read(fd, buffer + *size, max - *size)) > 0) {
*size += ret;
if (*size == max)
buffer = realloc(buffer, max *= 2);
}
if (ret < 0) {
free(buffer);
buffer = NULL;
}
close(fd);
return buffer;
}
static void release_file(void *data, unsigned long size)
{
free(data);
}
int insmod_call(char *pathname, char *params)
{
void *file;
unsigned long len;
int rc = -1;
file = grab_file(pathname, &len);
if (!file) {
log_message("insmod: can't read '%s': %s", pathname, strerror(errno));
return rc;
}
rc = init_module(file, len, params == NULL ? "" : params);
release_file(file, len);
if (rc != 0) {
log_message("init_module: '%s': %s", pathname, moderror(errno));
return rc;
}
return rc;
}
/* unarchive and insmod given module
* WARNING: module must not contain the trailing ".o"
*/
static enum insmod_return insmod_archived_file(const char * mod_name, char * options)
{
void *file;
char module_name[50];
char final_name[50] = "/tmp/";
int i, rc;
int len, i, rc;
strncpy(module_name, mod_name, sizeof(module_name));
strcat(module_name, ".ko");
i = mar_extract_file(archive_name, module_name, "/tmp/");
i = mar_extract_inplace(archive_name, module_name, &file, &len);
if (i == 1) {
log_message("file-not-found-in-archive %s", module_name);
return INSMOD_FAILED_FILE_NOT_FOUND;
@ -61,20 +129,15 @@ static enum insmod_return insmod_archived_file(const char * mod_name, char * opt
if (i != 0)
return INSMOD_FAILED;
strcat(final_name, mod_name);
strcat(final_name, ".ko");
rc = insmod_call(final_name, options);
unlink(final_name); /* sucking no space left on device */
if (rc) {
log_message("\tfailed");
rc = init_module(file, len, options == NULL ? "" : options);
release_file(file, len);
if (rc != 0) {
log_message("init_module: '%s': %s", module_name, moderror(errno));
return INSMOD_FAILED;
}
return INSMOD_OK;
}
static int load_modules_dependencies(void)
{
char * deps_file = "/modules/modules.dep";

View File

@ -18,6 +18,8 @@
#include "stage1.h"
#include "probing.h"
extern long init_module(void *, unsigned long, const char *);
enum insmod_return { INSMOD_OK, INSMOD_FAILED, INSMOD_FAILED_FILE_NOT_FOUND };
void init_modules_insmoding(void);

View File

@ -31,7 +31,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <sys/time.h>
#include "newt/newt.h"
#include <newt.h>
#include "frontend.h"

View File

@ -15,11 +15,12 @@
#
#*****************************************************************************
VPATH = $(MODDIR)
all: pci-ids.h
pci-ids.h: /usr/share/ldetect-lst/pcitable update-pci-ids.pl /usr/bin/merge2pcitable.pl
perl update-pci-ids.pl > $@ || rm -f $@
pci-ids.h: medias/modules.mar network/modules.mar
./update-pci-ids.sh $^ > $@ || rm -f $@
clean:
rm -f pci-ids.h

View File

@ -1,77 +0,0 @@
#!/usr/bin/perl
use MDK::Common;
-x "../mar/mar" or die "\t*FAILED* Sorry, need ../mar/mar binary\n";
require '/usr/bin/merge2pcitable.pl';
my $drivers = read_pcitable("/usr/share/ldetect-lst/pcitable");
print '
#define PCI_REVISION_ID 0x08 /* Revision ID */
struct pci_module_map {
unsigned short vendor; /* PCI vendor id */
unsigned short device; /* PCI device id */
const char *name; /* PCI human readable name */
const char *module; /* module to load */
};
';
my %t = ( network => [ 'network' ],
medias => [ 'hd' ]
#, 'cdrom', 'other' ]
);
my %sanity_check =
arch() =~ /ia64/ ?
( network => [ '3c59x', 'eepro100', 'e100', 'tulip', 'via-rhine', 'ne2k-pci', '8139too', '3c90x' ],
medias => [ 'aic7xxx', 'advansys', 'sym53c8xx', 'initio' ],
) :
arch() =~ /ppc/ ?
( network => [ '3c59x', 'eepro100', 'tulip', 'via-rhine', 'ne2k-pci', '8139too' ],
medias => [ 'aic7xxx', 'sym53c8xx', 'initio' ],
) :
# ( network => [ '3c59x', 'eepro100', 'e100', 'tulip', 'via-rhine', 'ne2k-pci', '8139too', 'tlan', '3c90x' ],
# ( network => [ '3c59x', 'eepro100', 'e100', 'tulip', 'via-rhine', 'ne2k-pci', '8139too', 'tlan', 'b44', 'e1000', 'sk98lin', 'nvnet' ],
( network => [ '3c59x', 'eepro100', 'e100', 'via-rhine', 'ne2k-pci', '8139too', 'tlan', 'b44', 'sk98lin' ],
# medias => [ 'aic7xxx', 'advansys', 'ncr53c8xx', 'sym53c8xx', 'initio', 'aic79xx' ],
medias => [ 'aic7xxx', 'advansys', 'sym53c8xx', 'aic79xx' ],
);
foreach $type (keys %t) {
print STDERR "$type (checks: ", join('/', @{$sanity_check{$type}}), ") ";
my @modulez;
foreach $floppy (@{$t{$type}}) {
foreach $marfile (glob("../../all.modules/*/${floppy}_modules.mar")) {
-f $marfile or die "\t*FAILED* Sorry, need $marfile mar file\n";
my @modz = `../mar/mar -l $marfile`;
if ($marfile !~ /(2\.2\.14|19)|(other)/) {
foreach $mandatory (@{$sanity_check{$type}}) {
grep(/\t$mandatory\.ko/, @modz) or die "\t*FAILED* Sanity check should prove that $mandatory.ko be part of $marfile\n"
}
}
push @modulez, @modz;
print STDERR ".";
}
}
print "#ifndef DISABLE_".uc($type)."
struct pci_module_map ${type}_pci_ids[] = {
";
while (my ($k, $v) = each %$drivers) {
grep(/^\t$v->[0]\.ko/, @modulez) or next;
$k =~ /^(....)(....)/;
printf qq|\t{ 0x%s, 0x%s, "%s", "%s" },\n|,
$1, $2, $v->[1], $v->[0];
}
print "};
int ${type}_num_ids = sizeof(${type}_pci_ids) / sizeof(struct pci_module_map);
#endif
";
print STDERR "\n";
}

80
pci-resource/update-pci-ids.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/sh -e
MODLIST=
MODHDR=
[ -x /usr/bin/mar ]
[ -x /usr/bin/getpciids ]
exit_handler()
{
local rc=$?
trap - EXIT
[ -z "$MODLIST" ] || rm -f -- "$MODLIST"
[ -z "$MODHDR" ] || rm -f -- "$MODHDR"
exit $rc
}
write_decls()
{
cat <<E_O_F
#define PCI_REVISION_ID 0x08 /* Revision ID */
struct pci_module_map {
unsigned short vendor; /* PCI vendor id */
unsigned short device; /* PCI device id */
const char *name; /* PCI human readable name */
const char *module; /* module to load */
};
E_O_F
}
write_typed()
{
local type=
local TYPE=
local marfile="$1"
shift
[ -n "$marfile" -a -f "$marfile" ]
type=${marfile%/*}
type=${type##*/}
[ -n "$type" ]
TYPE=`echo $type|tr '[a-z]' '[A-Z]'`
cat <<E_O_F
#ifndef DISABLE_${TYPE}
struct pci_module_map ${type}_pci_ids[] = {
E_O_F
mar -l "$marfile" |sed 's|^[[:space:]]\+\([^\.]\+\)\.ko|\1|g' > "$MODLIST"
getpciids -f "$MODLIST" |\
while read vendor device subv subd module; do
[ -n "$module" ] || module="$subv"
echo $module $vendor $device
done |sort -u |while read module vendor device; do
[ -n "${module##*hci-hcd}" ] || continue
printf '\t{ 0x%s, 0x%s, "%s", "%s" },\n' $vendor $device "" $module
done
cat <<E_O_F
};
int ${type}_num_ids = sizeof(${type}_pci_ids) / sizeof(struct pci_module_map);
#endif /* DISABLE_${TYPE} */
E_O_F
}
trap exit_handler SIGHUP SIGPIPE SIGINT SIGTERM SIGQUIT EXIT
MODLIST=`mktemp -t modlist.XXXXXXXXXX`
MODHDR=`mktemp -t modhdr.XXXXXXXXXX`
write_decls > "$MODHDR"
for marfile in "$@"; do
write_typed $marfile >> "$MODHDR"
done
cat "$MODHDR"

View File

@ -1,48 +0,0 @@
#******************************************************************************
#
# Guillaume Cottenceau (gc@mandrakesoft.com)
#
# Copyright 2000 MandrakeSoft
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#*****************************************************************************
top_dir = ..
include $(top_dir)/Makefile.common
all: libpcmcia.a libpcmcia-DIET.a
clean:
rm -f *.o libpcmcia.a
FLAGS = -Wall -Os -fomit-frame-pointer -pipe -c -I.. -D_BSD_SOURCE
OBJS = pcmcia_probe.o cardmgr.o lex_config.o yacc_config.o
OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
libpcmcia.a: $(OBJS)
ar -cru $@ $^
ranlib $@
libpcmcia-DIET.a: $(OBJS-DIET)
ar -cru $@ $^
ranlib $@
$(OBJS): %.o: %.c
gcc $(FLAGS) $(GLIBC_INCLUDES) -c $< -o $@
$(OBJS-DIET): %-DIET.o: %.c
gcc $(FLAGS) $(DIETLIBC_INCLUDES) -c $< -o $@

View File

@ -1,195 +0,0 @@
/*
* Definitions for bulk memory services
*
* bulkmem.h 1.13 2001/08/24 12:16:12
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
* bulkmem.h 1.3 1995/05/27 04:49:49
*/
#ifndef _LINUX_BULKMEM_H
#define _LINUX_BULKMEM_H
/* For GetFirstRegion and GetNextRegion */
typedef struct region_info_t {
u_int Attributes;
u_int CardOffset;
u_int RegionSize;
u_int AccessSpeed;
u_int BlockSize;
u_int PartMultiple;
u_char JedecMfr, JedecInfo;
memory_handle_t next;
} region_info_t;
#define REGION_TYPE 0x0001
#define REGION_TYPE_CM 0x0000
#define REGION_TYPE_AM 0x0001
#define REGION_PREFETCH 0x0008
#define REGION_CACHEABLE 0x0010
#define REGION_BAR_MASK 0xe000
#define REGION_BAR_SHIFT 13
/* For OpenMemory */
typedef struct open_mem_t {
u_int Attributes;
u_int Offset;
} open_mem_t;
/* Attributes for OpenMemory */
#define MEMORY_TYPE 0x0001
#define MEMORY_TYPE_CM 0x0000
#define MEMORY_TYPE_AM 0x0001
#define MEMORY_EXCLUSIVE 0x0002
#define MEMORY_PREFETCH 0x0008
#define MEMORY_CACHEABLE 0x0010
#define MEMORY_BAR_MASK 0xe000
#define MEMORY_BAR_SHIFT 13
typedef struct eraseq_entry_t {
memory_handle_t Handle;
u_char State;
u_int Size;
u_int Offset;
void *Optional;
} eraseq_entry_t;
typedef struct eraseq_hdr_t {
int QueueEntryCnt;
eraseq_entry_t *QueueEntryArray;
} eraseq_hdr_t;
#define ERASE_QUEUED 0x00
#define ERASE_IN_PROGRESS(n) (((n) > 0) && ((n) < 0x80))
#define ERASE_IDLE 0xff
#define ERASE_PASSED 0xe0
#define ERASE_FAILED 0xe1
#define ERASE_MISSING 0x80
#define ERASE_MEDIA_WRPROT 0x84
#define ERASE_NOT_ERASABLE 0x85
#define ERASE_BAD_OFFSET 0xc1
#define ERASE_BAD_TECH 0xc2
#define ERASE_BAD_SOCKET 0xc3
#define ERASE_BAD_VCC 0xc4
#define ERASE_BAD_VPP 0xc5
#define ERASE_BAD_SIZE 0xc6
/* For CopyMemory */
typedef struct copy_op_t {
u_int Attributes;
u_int SourceOffset;
u_int DestOffset;
u_int Count;
} copy_op_t;
/* For ReadMemory and WriteMemory */
typedef struct mem_op_t {
u_int Attributes;
u_int Offset;
u_int Count;
} mem_op_t;
#define MEM_OP_BUFFER 0x01
#define MEM_OP_BUFFER_USER 0x00
#define MEM_OP_BUFFER_KERNEL 0x01
#define MEM_OP_DISABLE_ERASE 0x02
#define MEM_OP_VERIFY 0x04
/* For RegisterMTD */
typedef struct mtd_reg_t {
u_int Attributes;
u_int Offset;
u_long MediaID;
} mtd_reg_t;
/*
* Definitions for MTD requests
*/
typedef struct mtd_request_t {
u_int SrcCardOffset;
u_int DestCardOffset;
u_int TransferLength;
u_int Function;
u_long MediaID;
u_int Status;
u_int Timeout;
} mtd_request_t;
/* Fields in MTD Function */
#define MTD_REQ_ACTION 0x003
#define MTD_REQ_ERASE 0x000
#define MTD_REQ_READ 0x001
#define MTD_REQ_WRITE 0x002
#define MTD_REQ_COPY 0x003
#define MTD_REQ_NOERASE 0x004
#define MTD_REQ_VERIFY 0x008
#define MTD_REQ_READY 0x010
#define MTD_REQ_TIMEOUT 0x020
#define MTD_REQ_LAST 0x040
#define MTD_REQ_FIRST 0x080
#define MTD_REQ_KERNEL 0x100
/* Status codes */
#define MTD_WAITREQ 0x00
#define MTD_WAITTIMER 0x01
#define MTD_WAITRDY 0x02
#define MTD_WAITPOWER 0x03
/*
* Definitions for MTD helper functions
*/
/* For MTDModifyWindow */
typedef struct mtd_mod_win_t {
u_int Attributes;
u_int AccessSpeed;
u_int CardOffset;
} mtd_mod_win_t;
/* For MTDSetVpp */
typedef struct mtd_vpp_req_t {
u_char Vpp1, Vpp2;
} mtd_vpp_req_t;
/* For MTDRDYMask */
typedef struct mtd_rdy_req_t {
u_int Mask;
} mtd_rdy_req_t;
enum mtd_helper {
MTDRequestWindow, MTDModifyWindow, MTDReleaseWindow,
MTDSetVpp, MTDRDYMask
};
#ifdef IN_CARD_SERVICES
extern int MTDHelperEntry(int func, void *a1, void *a2);
#else
extern int MTDHelperEntry(int func, ...);
#endif
#endif /* _LINUX_BULKMEM_H */

View File

@ -1,157 +0,0 @@
/*
* bus_ops.h 1.12 2001/08/24 12:16:12
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_BUS_OPS_H
#define _LINUX_BUS_OPS_H
#include <linux/config.h>
#ifdef CONFIG_VIRTUAL_BUS
typedef struct bus_operations {
void *priv;
u32 (*b_in)(void *bus, u32 port, s32 sz);
void (*b_ins)(void *bus, u32 port, void *buf,
u32 count, s32 sz);
void (*b_out)(void *bus, u32 val, u32 port, s32 sz);
void (*b_outs)(void *bus, u32 port, void *buf,
u32 count, s32 sz);
void *(*b_ioremap)(void *bus, u_long ofs, u_long sz);
void (*b_iounmap)(void *bus, void *addr);
u32 (*b_read)(void *bus, void *addr, s32 sz);
void (*b_write)(void *bus, u32 val, void *addr, s32 sz);
void (*b_copy_from)(void *bus, void *d, void *s, u32 count);
void (*b_copy_to)(void *bus, void *d, void *s, u32 count);
int (*b_request_irq)(void *bus, u_int irq,
void (*handler)(int, void *,
struct pt_regs *),
u_long flags, const char *device,
void *dev_id);
void (*b_free_irq)(void *bus, u_int irq, void *dev_id);
} bus_operations;
#define bus_inb(b,p) (b)->b_in((b),(p),0)
#define bus_inw(b,p) (b)->b_in((b),(p),1)
#define bus_inl(b,p) (b)->b_in((b),(p),2)
#define bus_inw_ns(b,p) (b)->b_in((b),(p),-1)
#define bus_inl_ns(b,p) (b)->b_in((b),(p),-2)
#define bus_insb(b,p,a,c) (b)->b_ins((b),(p),(a),(c),0)
#define bus_insw(b,p,a,c) (b)->b_ins((b),(p),(a),(c),1)
#define bus_insl(b,p,a,c) (b)->b_ins((b),(p),(a),(c),2)
#define bus_insw_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-1)
#define bus_insl_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-2)
#define bus_outb(b,v,p) (b)->b_out((b),(v),(p),0)
#define bus_outw(b,v,p) (b)->b_out((b),(v),(p),1)
#define bus_outl(b,v,p) (b)->b_out((b),(v),(p),2)
#define bus_outw_ns(b,v,p) (b)->b_out((b),(v),(p),-1)
#define bus_outl_ns(b,v,p) (b)->b_out((b),(v),(p),-2)
#define bus_outsb(b,p,a,c) (b)->b_outs((b),(p),(a),(c),0)
#define bus_outsw(b,p,a,c) (b)->b_outs((b),(p),(a),(c),1)
#define bus_outsl(b,p,a,c) (b)->b_outs((b),(p),(a),(c),2)
#define bus_outsw_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-1)
#define bus_outsl_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-2)
#define bus_readb(b,a) (b)->b_read((b),(a),0)
#define bus_readw(b,a) (b)->b_read((b),(a),1)
#define bus_readl(b,a) (b)->b_read((b),(a),2)
#define bus_readw_ns(b,a) (b)->b_read((b),(a),-1)
#define bus_readl_ns(b,a) (b)->b_read((b),(a),-2)
#define bus_writeb(b,v,a) (b)->b_write((b),(v),(a),0)
#define bus_writew(b,v,a) (b)->b_write((b),(v),(a),1)
#define bus_writel(b,v,a) (b)->b_write((b),(v),(a),2)
#define bus_writew_ns(b,v,a) (b)->b_write((b),(v),(a),-1)
#define bus_writel_ns(b,v,a) (b)->b_write((b),(v),(a),-2)
#define bus_ioremap(b,s,n) (b)->b_ioremap((b),(s),(n))
#define bus_iounmap(b,a) (b)->b_iounmap((b),(a))
#define bus_memcpy_fromio(b,d,s,n) (b)->b_copy_from((b),(d),(s),(n))
#define bus_memcpy_toio(b,d,s,n) (b)->b_copy_to((b),(d),(s),(n))
#define bus_request_irq(b,i,h,f,n,d) \
(b)->b_request_irq((b),(i),(h),(f),(n),(d))
#define bus_free_irq(b,i,d) (b)->b_free_irq((b),(i),(d))
#else
#define bus_inb(b,p) inb(p)
#define bus_inw(b,p) inw(p)
#define bus_inl(b,p) inl(p)
#define bus_inw_ns(b,p) inw_ns(p)
#define bus_inl_ns(b,p) inl_ns(p)
#define bus_insb(b,p,a,c) insb(p,a,c)
#define bus_insw(b,p,a,c) insw(p,a,c)
#define bus_insl(b,p,a,c) insl(p,a,c)
#define bus_insw_ns(b,p,a,c) insw_ns(p,a,c)
#define bus_insl_ns(b,p,a,c) insl_ns(p,a,c)
#define bus_outb(b,v,p) outb(b,v,p)
#define bus_outw(b,v,p) outw(b,v,p)
#define bus_outl(b,v,p) outl(b,v,p)
#define bus_outw_ns(b,v,p) outw_ns(b,v,p)
#define bus_outl_ns(b,v,p) outl_ns(b,v,p)
#define bus_outsb(b,p,a,c) outsb(p,a,c)
#define bus_outsw(b,p,a,c) outsw(p,a,c)
#define bus_outsl(b,p,a,c) outsl(p,a,c)
#define bus_outsw_ns(b,p,a,c) outsw_ns(p,a,c)
#define bus_outsl_ns(b,p,a,c) outsl_ns(p,a,c)
#define bus_readb(b,a) readb(a)
#define bus_readw(b,a) readw(a)
#define bus_readl(b,a) readl(a)
#define bus_readw_ns(b,a) readw_ns(a)
#define bus_readl_ns(b,a) readl_ns(a)
#define bus_writeb(b,v,a) writeb(v,a)
#define bus_writew(b,v,a) writew(v,a)
#define bus_writel(b,v,a) writel(v,a)
#define bus_writew_ns(b,v,a) writew_ns(v,a)
#define bus_writel_ns(b,v,a) writel_ns(v,a)
#define bus_ioremap(b,s,n) ioremap(s,n)
#define bus_iounmap(b,a) iounmap(a)
#define bus_memcpy_fromio(b,d,s,n) memcpy_fromio(d,s,n)
#define bus_memcpy_toio(b,d,s,n) memcpy_toio(d,s,n)
#ifdef CONFIG_8xx
#define bus_request_irq(b,i,h,f,n,d) request_8xxirq((i),(h),(f),(n),(d))
#else
#define bus_request_irq(b,i,h,f,n,d) request_irq((i),(h),(f),(n),(d))
#endif
#define bus_free_irq(b,i,d) free_irq((i),(d))
#endif /* CONFIG_VIRTUAL_BUS */
#endif /* _LINUX_BUS_OPS_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,113 +0,0 @@
/*
* cardmgr.h 1.38 2002/08/19 03:21:20
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#define MAX_SOCKS 8
#define MAX_BINDINGS 4
#define MAX_MODULES 4
typedef struct adjust_list_t {
adjust_t adj;
struct adjust_list_t *next;
} adjust_list_t;
typedef struct func_ident_t {
u_char funcid;
} func_ident_t;
typedef struct manfid_ident_t {
u_short manf;
u_short card;
} manfid_ident_t;
typedef struct vers_ident_t {
int ns;
char *pi[4];
} vers_ident_t;
typedef struct tuple_ident_t {
cisdata_t code;
long ofs;
char *info;
} tuple_ident_t;
typedef struct device_info_t {
dev_info_t dev_info;
int needs_mtd;
int modules;
char *module[MAX_MODULES];
char *opts[MAX_MODULES];
char *class;
int refs;
struct device_info_t *next;
} device_info_t;
#define VERS_1_IDENT 0x0001
#define MANFID_IDENT 0x0002
#define TUPLE_IDENT 0x0010
#define FUNC_IDENT 0x0020
#define BLANK_IDENT 0x0040
#define PCI_IDENT 0x0080
#define EXCL_IDENT 0x00f0
typedef struct card_info_t {
char *name;
int ident_type;
union {
vers_ident_t vers;
tuple_ident_t tuple;
func_ident_t func;
} id;
manfid_ident_t manfid;
int bindings;
device_info_t *device[MAX_BINDINGS];
int dev_fn[MAX_BINDINGS];
char *class[MAX_BINDINGS];
char *cis_file;
int refs;
struct card_info_t *next;
} card_info_t;
typedef struct mtd_ident_t {
char *name;
enum {
JEDEC_MTD=1, DTYPE_MTD, DEFAULT_MTD
} mtd_type;
int dtype, jedec_mfr, jedec_info;
char *module, *opts;
int refs;
struct mtd_ident_t *next;
} mtd_ident_t;
extern adjust_list_t *root_adjust;
extern device_info_t *root_device;
extern card_info_t *blank_card;
extern card_info_t *root_card, *root_func;
extern mtd_ident_t *root_mtd, *default_mtd;
int parse_configfile(char *fn);

View File

@ -1,182 +0,0 @@
/*
* cirrus.h 1.10 2001/08/24 12:15:33
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_CIRRUS_H
#define _LINUX_CIRRUS_H
#ifndef PCI_VENDOR_ID_CIRRUS
#define PCI_VENDOR_ID_CIRRUS 0x1013
#endif
#ifndef PCI_DEVICE_ID_CIRRUS_6729
#define PCI_DEVICE_ID_CIRRUS_6729 0x1100
#endif
#ifndef PCI_DEVICE_ID_CIRRUS_6832
#define PCI_DEVICE_ID_CIRRUS_6832 0x1110
#endif
#define PD67_MISC_CTL_1 0x16 /* Misc control 1 */
#define PD67_FIFO_CTL 0x17 /* FIFO control */
#define PD67_MISC_CTL_2 0x1E /* Misc control 2 */
#define PD67_CHIP_INFO 0x1f /* Chip information */
#define PD67_ATA_CTL 0x026 /* 6730: ATA control */
#define PD67_EXT_INDEX 0x2e /* Extension index */
#define PD67_EXT_DATA 0x2f /* Extension data */
#define pd67_ext_get(s, r) \
(i365_set(s, PD67_EXT_INDEX, r), i365_get(s, PD67_EXT_DATA))
#define pd67_ext_set(s, r, v) \
(i365_set(s, PD67_EXT_INDEX, r), i365_set(s, PD67_EXT_DATA, v))
/* PD6722 extension registers -- indexed in PD67_EXT_INDEX */
#define PD67_DATA_MASK0 0x01 /* Data mask 0 */
#define PD67_DATA_MASK1 0x02 /* Data mask 1 */
#define PD67_DMA_CTL 0x03 /* DMA control */
/* PD6730 extension registers -- indexed in PD67_EXT_INDEX */
#define PD67_EXT_CTL_1 0x03 /* Extension control 1 */
#define PD67_MEM_PAGE(n) ((n)+5) /* PCI window bits 31:24 */
#define PD67_EXTERN_DATA 0x0a
#define PD67_MISC_CTL_3 0x25
#define PD67_SMB_PWR_CTL 0x26
/* I/O window address offset */
#define PD67_IO_OFF(w) (0x36+((w)<<1))
/* Timing register sets */
#define PD67_TIME_SETUP(n) (0x3a + 3*(n))
#define PD67_TIME_CMD(n) (0x3b + 3*(n))
#define PD67_TIME_RECOV(n) (0x3c + 3*(n))
/* Flags for PD67_MISC_CTL_1 */
#define PD67_MC1_5V_DET 0x01 /* 5v detect */
#define PD67_MC1_MEDIA_ENA 0x01 /* 6730: Multimedia enable */
#define PD67_MC1_VCC_3V 0x02 /* 3.3v Vcc */
#define PD67_MC1_PULSE_MGMT 0x04
#define PD67_MC1_PULSE_IRQ 0x08
#define PD67_MC1_SPKR_ENA 0x10
#define PD67_MC1_INPACK_ENA 0x80
/* Flags for PD67_FIFO_CTL */
#define PD67_FIFO_EMPTY 0x80
/* Flags for PD67_MISC_CTL_2 */
#define PD67_MC2_FREQ_BYPASS 0x01
#define PD67_MC2_DYNAMIC_MODE 0x02
#define PD67_MC2_SUSPEND 0x04
#define PD67_MC2_5V_CORE 0x08
#define PD67_MC2_LED_ENA 0x10 /* IRQ 12 is LED enable */
#define PD67_MC2_FAST_PCI 0x10 /* 6729: PCI bus > 25 MHz */
#define PD67_MC2_3STATE_BIT7 0x20 /* Floppy change bit */
#define PD67_MC2_DMA_MODE 0x40
#define PD67_MC2_IRQ15_RI 0x80 /* IRQ 15 is ring enable */
/* Flags for PD67_CHIP_INFO */
#define PD67_INFO_SLOTS 0x20 /* 0 = 1 slot, 1 = 2 slots */
#define PD67_INFO_CHIP_ID 0xc0
#define PD67_INFO_REV 0x1c
/* Fields in PD67_TIME_* registers */
#define PD67_TIME_SCALE 0xc0
#define PD67_TIME_SCALE_1 0x00
#define PD67_TIME_SCALE_16 0x40
#define PD67_TIME_SCALE_256 0x80
#define PD67_TIME_SCALE_4096 0xc0
#define PD67_TIME_MULT 0x3f
/* Fields in PD67_DMA_CTL */
#define PD67_DMA_MODE 0xc0
#define PD67_DMA_OFF 0x00
#define PD67_DMA_DREQ_INPACK 0x40
#define PD67_DMA_DREQ_WP 0x80
#define PD67_DMA_DREQ_BVD2 0xc0
#define PD67_DMA_PULLUP 0x20 /* Disable socket pullups? */
/* Fields in PD67_EXT_CTL_1 */
#define PD67_EC1_VCC_PWR_LOCK 0x01
#define PD67_EC1_AUTO_PWR_CLEAR 0x02
#define PD67_EC1_LED_ENA 0x04
#define PD67_EC1_INV_CARD_IRQ 0x08
#define PD67_EC1_INV_MGMT_IRQ 0x10
#define PD67_EC1_PULLUP_CTL 0x20
/* Fields in PD67_EXTERN_DATA */
#define PD67_EXD_VS1(s) (0x01 << ((s)<<1))
#define PD67_EXD_VS2(s) (0x02 << ((s)<<1))
/* Fields in PD67_MISC_CTL_3 */
#define PD67_MC3_IRQ_MASK 0x03
#define PD67_MC3_IRQ_PCPCI 0x00
#define PD67_MC3_IRQ_EXTERN 0x01
#define PD67_MC3_IRQ_PCIWAY 0x02
#define PD67_MC3_IRQ_PCI 0x03
#define PD67_MC3_PWR_MASK 0x0c
#define PD67_MC3_PWR_SERIAL 0x00
#define PD67_MC3_PWR_TI2202 0x08
#define PD67_MC3_PWR_SMB 0x0c
/* Register definitions for Cirrus PD6832 PCI-to-CardBus bridge */
/* PD6832 extension registers -- indexed in PD67_EXT_INDEX */
#define PD68_EXT_CTL_2 0x0b
#define PD68_PCI_SPACE 0x22
#define PD68_PCCARD_SPACE 0x23
#define PD68_WINDOW_TYPE 0x24
#define PD68_EXT_CSC 0x2e
#define PD68_MISC_CTL_4 0x2f
#define PD68_MISC_CTL_5 0x30
#define PD68_MISC_CTL_6 0x31
/* Extra flags in PD67_MISC_CTL_3 */
#define PD68_MC3_HW_SUSP 0x10
#define PD68_MC3_MM_EXPAND 0x40
#define PD68_MC3_MM_ARM 0x80
/* Bridge Control Register */
#define PD6832_BCR_MGMT_IRQ_ENA 0x0800
/* Socket Number Register */
#define PD6832_SOCKET_NUMBER 0x004c /* 8 bit */
/* Data structure for tracking vendor-specific state */
typedef struct cirrus_state_t {
u_char misc1; /* PD67_MISC_CTL_1 */
u_char misc2; /* PD67_MISC_CTL_2 */
u_char ectl1; /* PD67_EXT_CTL_1 */
u_char timer[6]; /* PD67_TIME_* */
} cirrus_state_t;
#define CIRRUS_PCIC_ID \
IS_PD6729, IS_PD6730, IS_PD6832
#define CIRRUS_PCIC_INFO \
{ "Cirrus PD6729", IS_CIRRUS|IS_PCI, ID(CIRRUS, 6729) }, \
{ "Cirrus PD6730", IS_CIRRUS|IS_PCI, PCI_VENDOR_ID_CIRRUS, -1 }, \
{ "Cirrus PD6832", IS_CIRRUS|IS_CARDBUS, ID(CIRRUS, 6832) }
#endif /* _LINUX_CIRRUS_H */

View File

@ -1,138 +0,0 @@
/*
* ciscode.h 1.57 2002/11/03 20:38:14
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_CISCODE_H
#define _LINUX_CISCODE_H
/* Manufacturer and Product ID codes */
#define MANFID_3COM 0x0101
#define PRODID_3COM_3CXEM556 0x0035
#define PRODID_3COM_3CCFEM556 0x0556
#define PRODID_3COM_3C562 0x0562
#define MANFID_ACCTON 0x01bf
#define PRODID_ACCTON_EN2226 0x010a
#define MANFID_ADAPTEC 0x012f
#define PRODID_ADAPTEC_SCSI 0x0001
#define MANFID_ATT 0xffff
#define PRODID_ATT_KIT 0x0100
#define MANFID_CONTEC 0xc001
#define MANFID_FUJITSU 0x0004
#define PRODID_FUJITSU_MBH10302 0x0004
#define PRODID_FUJITSU_MBH10304 0x1003
#define PRODID_FUJITSU_LA501 0x2000
#define MANFID_IBM 0x00a4
#define PRODID_IBM_HOME_AND_AWAY 0x002e
#define MANFID_INTEL 0x0089
#define PRODID_INTEL_DUAL_RS232 0x0301
#define PRODID_INTEL_2PLUS 0x8422
#define MANFID_KME 0x0032
#define PRODID_KME_KXLC005_A 0x0704
#define PRODID_KME_KXLC005_B 0x2904
#define MANFID_LINKSYS 0x0143
#define PRODID_LINKSYS_PCMLM28 0xc0ab
#define PRODID_LINKSYS_3400 0x3341
#define MANFID_MEGAHERTZ 0x0102
#define PRODID_MEGAHERTZ_VARIOUS 0x0000
#define PRODID_MEGAHERTZ_EM3288 0x0006
#define MANFID_MACNICA 0xc00b
#define MANFID_MOTOROLA 0x0109
#define PRODID_MOTOROLA_MARINER 0x0501
#define MANFID_NATINST 0x010b
#define PRODID_NATINST_QUAD_RS232 0xd180
#define MANFID_NEW_MEDIA 0x0057
#define MANFID_NOKIA 0x0124
#define PRODID_NOKIA_CARDPHONE 0x0900
#define MANFID_OLICOM 0x0121
#define PRODID_OLICOM_OC2231 0x3122
#define PRODID_OLICOM_OC2232 0x3222
#define MANFID_OMEGA 0x0137
#define PRODID_OMEGA_QSP_100 0x0025
#define MANFID_OSITECH 0x0140
#define PRODID_OSITECH_JACK_144 0x0001
#define PRODID_OSITECH_JACK_288 0x0002
#define PRODID_OSITECH_JACK_336 0x0007
#define PRODID_OSITECH_SEVEN 0x0008
#define MANFID_OXSEMI 0x0279
#define MANFID_PIONEER 0x000b
#define MANFID_PSION 0x016c
#define PRODID_PSION_NET100 0x0023
#define MANFID_QUATECH 0x0137
#define PRODID_QUATECH_SPP100 0x0003
#define PRODID_QUATECH_DUAL_RS232 0x0012
#define PRODID_QUATECH_DUAL_RS232_D1 0x0007
#define PRODID_QUATECH_DUAL_RS232_D2 0x0052
#define PRODID_QUATECH_QUAD_RS232 0x001b
#define PRODID_QUATECH_DUAL_RS422 0x000e
#define PRODID_QUATECH_QUAD_RS422 0x0045
#define MANFID_SMC 0x0108
#define PRODID_SMC_ETHER 0x0105
#define MANFID_SOCKET 0x0104
#define PRODID_SOCKET_DUAL_RS232 0x0006
#define PRODID_SOCKET_EIO 0x000a
#define PRODID_SOCKET_LPE 0x000d
#define PRODID_SOCKET_LPE_CF 0x0075
#define MANFID_SUNDISK 0x0045
#define MANFID_TDK 0x0105
#define PRODID_TDK_CF010 0x0900
#define PRODID_TDK_GN3410 0x4815
#define MANFID_TOSHIBA 0x0098
#define MANFID_UNGERMANN 0x02c0
#define MANFID_XIRCOM 0x0105
#endif /* _LINUX_CISCODE_H */

View File

@ -1,135 +0,0 @@
/*
* cisreg.h 1.18 2001/08/24 12:16:12
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_CISREG_H
#define _LINUX_CISREG_H
/*
* Offsets from ConfigBase for CIS registers
*/
#define CISREG_COR 0x00
#define CISREG_CCSR 0x02
#define CISREG_PRR 0x04
#define CISREG_SCR 0x06
#define CISREG_ESR 0x08
#define CISREG_IOBASE_0 0x0a
#define CISREG_IOBASE_1 0x0c
#define CISREG_IOBASE_2 0x0e
#define CISREG_IOBASE_3 0x10
#define CISREG_IOSIZE 0x12
/*
* Configuration Option Register
*/
#define COR_CONFIG_MASK 0x3f
#define COR_MFC_CONFIG_MASK 0x38
#define COR_FUNC_ENA 0x01
#define COR_ADDR_DECODE 0x02
#define COR_IREQ_ENA 0x04
#define COR_LEVEL_REQ 0x40
#define COR_SOFT_RESET 0x80
/*
* Card Configuration and Status Register
*/
#define CCSR_INTR_ACK 0x01
#define CCSR_INTR_PENDING 0x02
#define CCSR_POWER_DOWN 0x04
#define CCSR_AUDIO_ENA 0x08
#define CCSR_IOIS8 0x20
#define CCSR_SIGCHG_ENA 0x40
#define CCSR_CHANGED 0x80
/*
* Pin Replacement Register
*/
#define PRR_WP_STATUS 0x01
#define PRR_READY_STATUS 0x02
#define PRR_BVD2_STATUS 0x04
#define PRR_BVD1_STATUS 0x08
#define PRR_WP_EVENT 0x10
#define PRR_READY_EVENT 0x20
#define PRR_BVD2_EVENT 0x40
#define PRR_BVD1_EVENT 0x80
/*
* Socket and Copy Register
*/
#define SCR_SOCKET_NUM 0x0f
#define SCR_COPY_NUM 0x70
/*
* Extended Status Register
*/
#define ESR_REQ_ATTN_ENA 0x01
#define ESR_REQ_ATTN 0x10
/*
* CardBus Function Status Registers
*/
#define CBFN_EVENT 0x00
#define CBFN_MASK 0x04
#define CBFN_STATE 0x08
#define CBFN_FORCE 0x0c
/*
* These apply to all the CardBus function registers
*/
#define CBFN_WP 0x0001
#define CBFN_READY 0x0002
#define CBFN_BVD2 0x0004
#define CBFN_BVD1 0x0008
#define CBFN_GWAKE 0x0010
#define CBFN_INTR 0x8000
/*
* Extra bits in the Function Event Mask Register
*/
#define FEMR_BAM_ENA 0x0020
#define FEMR_PWM_ENA 0x0040
#define FEMR_WKUP_MASK 0x4000
/*
* Indirect Addressing Registers for Zoomed Video: these are addresses
* in common memory space
*/
#define CISREG_ICTRL0 0x02 /* control registers */
#define CISREG_ICTRL1 0x03
#define CISREG_IADDR0 0x04 /* address registers */
#define CISREG_IADDR1 0x05
#define CISREG_IADDR2 0x06
#define CISREG_IADDR3 0x07
#define CISREG_IDATA0 0x08 /* data registers */
#define CISREG_IDATA1 0x09
#define ICTRL0_COMMON 0x01
#define ICTRL0_AUTOINC 0x02
#define ICTRL0_BYTEGRAN 0x04
#endif /* _LINUX_CISREG_H */

View File

@ -1,604 +0,0 @@
/*
* cistpl.h 1.35 2001/08/24 12:16:12
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_CISTPL_H
#define _LINUX_CISTPL_H
#define CISTPL_NULL 0x00
#define CISTPL_DEVICE 0x01
#define CISTPL_LONGLINK_CB 0x02
#define CISTPL_INDIRECT 0x03
#define CISTPL_CONFIG_CB 0x04
#define CISTPL_CFTABLE_ENTRY_CB 0x05
#define CISTPL_LONGLINK_MFC 0x06
#define CISTPL_BAR 0x07
#define CISTPL_PWR_MGMNT 0x08
#define CISTPL_EXTDEVICE 0x09
#define CISTPL_CHECKSUM 0x10
#define CISTPL_LONGLINK_A 0x11
#define CISTPL_LONGLINK_C 0x12
#define CISTPL_LINKTARGET 0x13
#define CISTPL_NO_LINK 0x14
#define CISTPL_VERS_1 0x15
#define CISTPL_ALTSTR 0x16
#define CISTPL_DEVICE_A 0x17
#define CISTPL_JEDEC_C 0x18
#define CISTPL_JEDEC_A 0x19
#define CISTPL_CONFIG 0x1a
#define CISTPL_CFTABLE_ENTRY 0x1b
#define CISTPL_DEVICE_OC 0x1c
#define CISTPL_DEVICE_OA 0x1d
#define CISTPL_DEVICE_GEO 0x1e
#define CISTPL_DEVICE_GEO_A 0x1f
#define CISTPL_MANFID 0x20
#define CISTPL_FUNCID 0x21
#define CISTPL_FUNCE 0x22
#define CISTPL_SWIL 0x23
#define CISTPL_END 0xff
/* Layer 2 tuples */
#define CISTPL_VERS_2 0x40
#define CISTPL_FORMAT 0x41
#define CISTPL_GEOMETRY 0x42
#define CISTPL_BYTEORDER 0x43
#define CISTPL_DATE 0x44
#define CISTPL_BATTERY 0x45
#define CISTPL_FORMAT_A 0x47
/* Layer 3 tuples */
#define CISTPL_ORG 0x46
#define CISTPL_SPCL 0x90
typedef struct cistpl_longlink_t {
u_int addr;
} cistpl_longlink_t;
typedef struct cistpl_checksum_t {
u_short addr;
u_short len;
u_char sum;
} cistpl_checksum_t;
#define CISTPL_MAX_FUNCTIONS 8
#define CISTPL_MFC_ATTR 0x00
#define CISTPL_MFC_COMMON 0x01
typedef struct cistpl_longlink_mfc_t {
u_char nfn;
struct {
u_char space;
u_int addr;
} fn[CISTPL_MAX_FUNCTIONS];
} cistpl_longlink_mfc_t;
#define CISTPL_MAX_ALTSTR_STRINGS 4
typedef struct cistpl_altstr_t {
u_char ns;
u_char ofs[CISTPL_MAX_ALTSTR_STRINGS];
char str[254];
} cistpl_altstr_t;
#define CISTPL_DTYPE_NULL 0x00
#define CISTPL_DTYPE_ROM 0x01
#define CISTPL_DTYPE_OTPROM 0x02
#define CISTPL_DTYPE_EPROM 0x03
#define CISTPL_DTYPE_EEPROM 0x04
#define CISTPL_DTYPE_FLASH 0x05
#define CISTPL_DTYPE_SRAM 0x06
#define CISTPL_DTYPE_DRAM 0x07
#define CISTPL_DTYPE_FUNCSPEC 0x0d
#define CISTPL_DTYPE_EXTEND 0x0e
#define CISTPL_MAX_DEVICES 4
typedef struct cistpl_device_t {
u_char ndev;
struct {
u_char type;
u_char wp;
u_int speed;
u_int size;
} dev[CISTPL_MAX_DEVICES];
} cistpl_device_t;
#define CISTPL_DEVICE_MWAIT 0x01
#define CISTPL_DEVICE_3VCC 0x02
typedef struct cistpl_device_o_t {
u_char flags;
cistpl_device_t device;
} cistpl_device_o_t;
#define CISTPL_VERS_1_MAX_PROD_STRINGS 4
typedef struct cistpl_vers_1_t {
u_char major;
u_char minor;
u_char ns;
u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
char str[254];
} cistpl_vers_1_t;
typedef struct cistpl_jedec_t {
u_char nid;
struct {
u_char mfr;
u_char info;
} id[CISTPL_MAX_DEVICES];
} cistpl_jedec_t;
typedef struct cistpl_manfid_t {
u_short manf;
u_short card;
} cistpl_manfid_t;
#define CISTPL_FUNCID_MULTI 0x00
#define CISTPL_FUNCID_MEMORY 0x01
#define CISTPL_FUNCID_SERIAL 0x02
#define CISTPL_FUNCID_PARALLEL 0x03
#define CISTPL_FUNCID_FIXED 0x04
#define CISTPL_FUNCID_VIDEO 0x05
#define CISTPL_FUNCID_NETWORK 0x06
#define CISTPL_FUNCID_AIMS 0x07
#define CISTPL_FUNCID_SCSI 0x08
#define CISTPL_SYSINIT_POST 0x01
#define CISTPL_SYSINIT_ROM 0x02
typedef struct cistpl_funcid_t {
u_char func;
u_char sysinit;
} cistpl_funcid_t;
typedef struct cistpl_funce_t {
u_char type;
u_char data[0];
} cistpl_funce_t;
/*======================================================================
Modem Function Extension Tuples
======================================================================*/
#define CISTPL_FUNCE_SERIAL_IF 0x00
#define CISTPL_FUNCE_SERIAL_CAP 0x01
#define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02
#define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03
#define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04
#define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05
#define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06
#define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07
#define CISTPL_FUNCE_SERIAL_IF_DATA 0x08
#define CISTPL_FUNCE_SERIAL_IF_FAX 0x09
#define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a
/* UART identification */
#define CISTPL_SERIAL_UART_8250 0x00
#define CISTPL_SERIAL_UART_16450 0x01
#define CISTPL_SERIAL_UART_16550 0x02
#define CISTPL_SERIAL_UART_8251 0x03
#define CISTPL_SERIAL_UART_8530 0x04
#define CISTPL_SERIAL_UART_85230 0x05
/* UART capabilities */
#define CISTPL_SERIAL_UART_SPACE 0x01
#define CISTPL_SERIAL_UART_MARK 0x02
#define CISTPL_SERIAL_UART_ODD 0x04
#define CISTPL_SERIAL_UART_EVEN 0x08
#define CISTPL_SERIAL_UART_5BIT 0x01
#define CISTPL_SERIAL_UART_6BIT 0x02
#define CISTPL_SERIAL_UART_7BIT 0x04
#define CISTPL_SERIAL_UART_8BIT 0x08
#define CISTPL_SERIAL_UART_1STOP 0x10
#define CISTPL_SERIAL_UART_MSTOP 0x20
#define CISTPL_SERIAL_UART_2STOP 0x40
typedef struct cistpl_serial_t {
u_char uart_type;
u_char uart_cap_0;
u_char uart_cap_1;
} cistpl_serial_t;
typedef struct cistpl_modem_cap_t {
u_char flow;
u_char cmd_buf;
u_char rcv_buf_0, rcv_buf_1, rcv_buf_2;
u_char xmit_buf_0, xmit_buf_1, xmit_buf_2;
} cistpl_modem_cap_t;
#define CISTPL_SERIAL_MOD_103 0x01
#define CISTPL_SERIAL_MOD_V21 0x02
#define CISTPL_SERIAL_MOD_V23 0x04
#define CISTPL_SERIAL_MOD_V22 0x08
#define CISTPL_SERIAL_MOD_212A 0x10
#define CISTPL_SERIAL_MOD_V22BIS 0x20
#define CISTPL_SERIAL_MOD_V26 0x40
#define CISTPL_SERIAL_MOD_V26BIS 0x80
#define CISTPL_SERIAL_MOD_V27BIS 0x01
#define CISTPL_SERIAL_MOD_V29 0x02
#define CISTPL_SERIAL_MOD_V32 0x04
#define CISTPL_SERIAL_MOD_V32BIS 0x08
#define CISTPL_SERIAL_MOD_V34 0x10
#define CISTPL_SERIAL_ERR_MNP2_4 0x01
#define CISTPL_SERIAL_ERR_V42_LAPM 0x02
#define CISTPL_SERIAL_CMPR_V42BIS 0x01
#define CISTPL_SERIAL_CMPR_MNP5 0x02
#define CISTPL_SERIAL_CMD_AT1 0x01
#define CISTPL_SERIAL_CMD_AT2 0x02
#define CISTPL_SERIAL_CMD_AT3 0x04
#define CISTPL_SERIAL_CMD_MNP_AT 0x08
#define CISTPL_SERIAL_CMD_V25BIS 0x10
#define CISTPL_SERIAL_CMD_V25A 0x20
#define CISTPL_SERIAL_CMD_DMCL 0x40
typedef struct cistpl_data_serv_t {
u_char max_data_0;
u_char max_data_1;
u_char modulation_0;
u_char modulation_1;
u_char error_control;
u_char compression;
u_char cmd_protocol;
u_char escape;
u_char encrypt;
u_char misc_features;
u_char ccitt_code[0];
} cistpl_data_serv_t;
typedef struct cistpl_fax_serv_t {
u_char max_data_0;
u_char max_data_1;
u_char modulation;
u_char encrypt;
u_char features_0;
u_char features_1;
u_char ccitt_code[0];
} cistpl_fax_serv_t;
typedef struct cistpl_voice_serv_t {
u_char max_data_0;
u_char max_data_1;
} cistpl_voice_serv_t;
/*======================================================================
LAN Function Extension Tuples
======================================================================*/
#define CISTPL_FUNCE_LAN_TECH 0x01
#define CISTPL_FUNCE_LAN_SPEED 0x02
#define CISTPL_FUNCE_LAN_MEDIA 0x03
#define CISTPL_FUNCE_LAN_NODE_ID 0x04
#define CISTPL_FUNCE_LAN_CONNECTOR 0x05
/* LAN technologies */
#define CISTPL_LAN_TECH_ARCNET 0x01
#define CISTPL_LAN_TECH_ETHERNET 0x02
#define CISTPL_LAN_TECH_TOKENRING 0x03
#define CISTPL_LAN_TECH_LOCALTALK 0x04
#define CISTPL_LAN_TECH_FDDI 0x05
#define CISTPL_LAN_TECH_ATM 0x06
#define CISTPL_LAN_TECH_WIRELESS 0x07
typedef struct cistpl_lan_tech_t {
u_char tech;
} cistpl_lan_tech_t;
typedef struct cistpl_lan_speed_t {
u_int speed;
} cistpl_lan_speed_t;
/* LAN media definitions */
#define CISTPL_LAN_MEDIA_UTP 0x01
#define CISTPL_LAN_MEDIA_STP 0x02
#define CISTPL_LAN_MEDIA_THIN_COAX 0x03
#define CISTPL_LAN_MEDIA_THICK_COAX 0x04
#define CISTPL_LAN_MEDIA_FIBER 0x05
#define CISTPL_LAN_MEDIA_900MHZ 0x06
#define CISTPL_LAN_MEDIA_2GHZ 0x07
#define CISTPL_LAN_MEDIA_5GHZ 0x08
#define CISTPL_LAN_MEDIA_DIFF_IR 0x09
#define CISTPL_LAN_MEDIA_PTP_IR 0x0a
typedef struct cistpl_lan_media_t {
u_char media;
} cistpl_lan_media_t;
typedef struct cistpl_lan_node_id_t {
u_char nb;
u_char id[16];
} cistpl_lan_node_id_t;
typedef struct cistpl_lan_connector_t {
u_char code;
} cistpl_lan_connector_t;
/*======================================================================
IDE Function Extension Tuples
======================================================================*/
#define CISTPL_IDE_INTERFACE 0x01
typedef struct cistpl_ide_interface_t {
u_char interface;
} cistpl_ide_interface_t;
/* First feature byte */
#define CISTPL_IDE_SILICON 0x04
#define CISTPL_IDE_UNIQUE 0x08
#define CISTPL_IDE_DUAL 0x10
/* Second feature byte */
#define CISTPL_IDE_HAS_SLEEP 0x01
#define CISTPL_IDE_HAS_STANDBY 0x02
#define CISTPL_IDE_HAS_IDLE 0x04
#define CISTPL_IDE_LOW_POWER 0x08
#define CISTPL_IDE_REG_INHIBIT 0x10
#define CISTPL_IDE_HAS_INDEX 0x20
#define CISTPL_IDE_IOIS16 0x40
typedef struct cistpl_ide_feature_t {
u_char feature1;
u_char feature2;
} cistpl_ide_feature_t;
#define CISTPL_FUNCE_IDE_IFACE 0x01
#define CISTPL_FUNCE_IDE_MASTER 0x02
#define CISTPL_FUNCE_IDE_SLAVE 0x03
/*======================================================================
Configuration Table Entries
======================================================================*/
#define CISTPL_BAR_SPACE 0x07
#define CISTPL_BAR_SPACE_IO 0x10
#define CISTPL_BAR_PREFETCH 0x20
#define CISTPL_BAR_CACHEABLE 0x40
#define CISTPL_BAR_1MEG_MAP 0x80
typedef struct cistpl_bar_t {
u_char attr;
u_int size;
} cistpl_bar_t;
typedef struct cistpl_config_t {
u_char last_idx;
u_int base;
u_int rmask[4];
u_char subtuples;
} cistpl_config_t;
/* These are bits in the 'present' field, and indices in 'param' */
#define CISTPL_POWER_VNOM 0
#define CISTPL_POWER_VMIN 1
#define CISTPL_POWER_VMAX 2
#define CISTPL_POWER_ISTATIC 3
#define CISTPL_POWER_IAVG 4
#define CISTPL_POWER_IPEAK 5
#define CISTPL_POWER_IDOWN 6
#define CISTPL_POWER_HIGHZ_OK 0x01
#define CISTPL_POWER_HIGHZ_REQ 0x02
typedef struct cistpl_power_t {
u_char present;
u_char flags;
u_int param[7];
} cistpl_power_t;
typedef struct cistpl_timing_t {
u_int wait, waitscale;
u_int ready, rdyscale;
u_int reserved, rsvscale;
} cistpl_timing_t;
#define CISTPL_IO_LINES_MASK 0x1f
#define CISTPL_IO_8BIT 0x20
#define CISTPL_IO_16BIT 0x40
#define CISTPL_IO_RANGE 0x80
#define CISTPL_IO_MAX_WIN 16
typedef struct cistpl_io_t {
u_char flags;
u_char nwin;
struct {
u_int base;
u_int len;
} win[CISTPL_IO_MAX_WIN];
} cistpl_io_t;
typedef struct cistpl_irq_t {
u_int IRQInfo1;
u_int IRQInfo2;
} cistpl_irq_t;
#define CISTPL_MEM_MAX_WIN 8
typedef struct cistpl_mem_t {
u_char flags;
u_char nwin;
struct {
u_int len;
u_int card_addr;
u_int host_addr;
} win[CISTPL_MEM_MAX_WIN];
} cistpl_mem_t;
#define CISTPL_CFTABLE_DEFAULT 0x0001
#define CISTPL_CFTABLE_BVDS 0x0002
#define CISTPL_CFTABLE_WP 0x0004
#define CISTPL_CFTABLE_RDYBSY 0x0008
#define CISTPL_CFTABLE_MWAIT 0x0010
#define CISTPL_CFTABLE_AUDIO 0x0800
#define CISTPL_CFTABLE_READONLY 0x1000
#define CISTPL_CFTABLE_PWRDOWN 0x2000
typedef struct cistpl_cftable_entry_t {
u_char index;
u_short flags;
u_char interface;
cistpl_power_t vcc, vpp1, vpp2;
cistpl_timing_t timing;
cistpl_io_t io;
cistpl_irq_t irq;
cistpl_mem_t mem;
u_char subtuples;
} cistpl_cftable_entry_t;
#define CISTPL_CFTABLE_MASTER 0x000100
#define CISTPL_CFTABLE_INVALIDATE 0x000200
#define CISTPL_CFTABLE_VGA_PALETTE 0x000400
#define CISTPL_CFTABLE_PARITY 0x000800
#define CISTPL_CFTABLE_WAIT 0x001000
#define CISTPL_CFTABLE_SERR 0x002000
#define CISTPL_CFTABLE_FAST_BACK 0x004000
#define CISTPL_CFTABLE_BINARY_AUDIO 0x010000
#define CISTPL_CFTABLE_PWM_AUDIO 0x020000
typedef struct cistpl_cftable_entry_cb_t {
u_char index;
u_int flags;
cistpl_power_t vcc, vpp1, vpp2;
u_char io;
cistpl_irq_t irq;
u_char mem;
u_char subtuples;
} cistpl_cftable_entry_cb_t;
typedef struct cistpl_device_geo_t {
u_char ngeo;
struct {
u_char buswidth;
u_int erase_block;
u_int read_block;
u_int write_block;
u_int partition;
u_int interleave;
} geo[CISTPL_MAX_DEVICES];
} cistpl_device_geo_t;
typedef struct cistpl_vers_2_t {
u_char vers;
u_char comply;
u_short dindex;
u_char vspec8, vspec9;
u_char nhdr;
u_char vendor, info;
char str[244];
} cistpl_vers_2_t;
typedef struct cistpl_org_t {
u_char data_org;
char desc[30];
} cistpl_org_t;
#define CISTPL_ORG_FS 0x00
#define CISTPL_ORG_APPSPEC 0x01
#define CISTPL_ORG_XIP 0x02
typedef struct cistpl_format_t {
u_char type;
u_char edc;
u_int offset;
u_int length;
} cistpl_format_t;
#define CISTPL_FORMAT_DISK 0x00
#define CISTPL_FORMAT_MEM 0x01
#define CISTPL_EDC_NONE 0x00
#define CISTPL_EDC_CKSUM 0x01
#define CISTPL_EDC_CRC 0x02
#define CISTPL_EDC_PCC 0x03
typedef union cisparse_t {
cistpl_device_t device;
cistpl_checksum_t checksum;
cistpl_longlink_t longlink;
cistpl_longlink_mfc_t longlink_mfc;
cistpl_vers_1_t version_1;
cistpl_altstr_t altstr;
cistpl_jedec_t jedec;
cistpl_manfid_t manfid;
cistpl_funcid_t funcid;
cistpl_funce_t funce;
cistpl_bar_t bar;
cistpl_config_t config;
cistpl_cftable_entry_t cftable_entry;
cistpl_cftable_entry_cb_t cftable_entry_cb;
cistpl_device_geo_t device_geo;
cistpl_vers_2_t vers_2;
cistpl_org_t org;
cistpl_format_t format;
} cisparse_t;
typedef struct tuple_t {
u_int Attributes;
cisdata_t DesiredTuple;
u_int Flags; /* internal use */
u_int LinkOffset; /* internal use */
u_int CISOffset; /* internal use */
cisdata_t TupleCode;
cisdata_t TupleLink;
cisdata_t TupleOffset;
cisdata_t TupleDataMax;
cisdata_t TupleDataLen;
cisdata_t *TupleData;
} tuple_t;
/* Special cisdata_t value */
#define RETURN_FIRST_TUPLE 0xff
/* Attributes for tuple calls */
#define TUPLE_RETURN_LINK 0x01
#define TUPLE_RETURN_COMMON 0x02
/* For ValidateCIS */
typedef struct cisinfo_t {
u_int Chains;
} cisinfo_t;
#define CISTPL_MAX_CIS_SIZE 0x200
/* For ReplaceCIS */
typedef struct cisdump_t {
u_int Length;
cisdata_t Data[CISTPL_MAX_CIS_SIZE];
} cisdump_t;
#endif /* LINUX_CISTPL_H */

View File

@ -1,59 +0,0 @@
/*
Automatically generated by 'make config' -- don't edit!
*/
#ifndef _PCMCIA_CONFIG_H
#define _PCMCIA_CONFIG_H
#define AUTOCONF_INCLUDED
#define __IN_PCMCIA_PACKAGE__
#define LINUX "/home/gc/rpm/BUILD/linux"
#define PREFIX "/home/gc/rpm/tmp/kernel-2.4.0-build"
#define CC "/usr/bin/kgcc"
#define LD "ld"
#define KFLAGS ""
#define UFLAGS ""
#define PCDEBUG ""
#define USE_PM 1
#define UNSAFE_TOOLS 1
#define CONFIG_CARDBUS 1
#undef CONFIG_PNP_BIOS
#define MODDIR "/lib/modules/2.4.0-6mdk"
/* Options from /home/gc/rpm/BUILD/linux/.config */
#define CONFIG_MODULES 1
#undef CONFIG_PCMCIA
#undef CONFIG_SMP
#define CONFIG_PCI 1
#define CONFIG_PCI_QUIRKS 1
#define CONFIG_PM 1
#define CONFIG_SCSI 1
#define CONFIG_IEEE1394 1
#define CONFIG_INET 1
#define CONFIG_NET_PCMCIA_RADIO 1
#define CONFIG_TR 1
#undef CONFIG_NET_FASTROUTE
#undef CONFIG_NET_DIVERT
#define CONFIG_MODVERSIONS 1
#define CONFIG_X86_L1_CACHE_BYTES 32
#define CONFIG_X86_L1_CACHE_SHIFT 5
#define CONFIG_PROC_FS 1
#define ARCH "i386"
#define HOST_ARCH "i386"
#define AFLAGS ""
#define CONFIG_ISA 1
#define CONFIG_UID16 1
#define UTS_RELEASE "2.4.0-6mdk"
#define UTS_VERSION "#1 Wed Jan 24 16:10:16 CET 2001"
#define LINUX_VERSION_CODE 132096
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define HAS_PROC_BUS 1
#define SYSV_INIT 1
#define RC_DIR "/etc/rc.d"
#undef HAS_FORMS
#define MANDIR "/usr/share/man"
#define XMANDIR "/usr/X11R6/man"
#endif /* _PCMCIA_CONFIG_H */

View File

@ -1,441 +0,0 @@
/*
* cs.h 1.74 2001/10/04 03:15:22
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_CS_H
#define _LINUX_CS_H
/* For AccessConfigurationRegister */
typedef struct conf_reg_t {
u_char Function;
u_int Action;
off_t Offset;
u_int Value;
} conf_reg_t;
/* Actions */
#define CS_READ 1
#define CS_WRITE 2
/* for AdjustResourceInfo */
typedef struct adjust_t {
u_int Action;
u_int Resource;
u_int Attributes;
union {
struct memory {
u_long Base;
u_long Size;
} memory;
struct io {
ioaddr_t BasePort;
ioaddr_t NumPorts;
u_int IOAddrLines;
} io;
struct irq {
u_int IRQ;
} irq;
} resource;
} adjust_t;
/* Action field */
#define REMOVE_MANAGED_RESOURCE 1
#define ADD_MANAGED_RESOURCE 2
#define GET_FIRST_MANAGED_RESOURCE 3
#define GET_NEXT_MANAGED_RESOURCE 4
/* Resource field */
#define RES_MEMORY_RANGE 1
#define RES_IO_RANGE 2
#define RES_IRQ 3
/* Attribute field */
#define RES_IRQ_TYPE 0x03
#define RES_IRQ_TYPE_EXCLUSIVE 0
#define RES_IRQ_TYPE_TIME 1
#define RES_IRQ_TYPE_DYNAMIC 2
#define RES_IRQ_CSC 0x04
#define RES_SHARED 0x08
#define RES_RESERVED 0x10
#define RES_ALLOCATED 0x20
#define RES_REMOVED 0x40
typedef struct servinfo_t {
char Signature[2];
u_int Count;
u_int Revision;
u_int CSLevel;
char *VendorString;
} servinfo_t;
typedef struct event_callback_args_t {
client_handle_t client_handle;
void *info;
void *mtdrequest;
void *buffer;
void *misc;
void *client_data;
struct bus_operations *bus;
} event_callback_args_t;
/* for GetConfigurationInfo */
typedef struct config_info_t {
u_char Function;
u_int Attributes;
u_int Vcc, Vpp1, Vpp2;
u_int IntType;
u_int ConfigBase;
u_char Status, Pin, Copy, Option, ExtStatus;
u_int Present;
u_int CardValues;
u_int AssignedIRQ;
u_int IRQAttributes;
ioaddr_t BasePort1;
ioaddr_t NumPorts1;
u_int Attributes1;
ioaddr_t BasePort2;
ioaddr_t NumPorts2;
u_int Attributes2;
u_int IOAddrLines;
} config_info_t;
/* For CardValues field */
#define CV_OPTION_VALUE 0x01
#define CV_STATUS_VALUE 0x02
#define CV_PIN_REPLACEMENT 0x04
#define CV_COPY_VALUE 0x08
#define CV_EXT_STATUS 0x10
/* For GetFirst/NextClient */
typedef struct client_req_t {
socket_t Socket;
u_int Attributes;
} client_req_t;
#define CLIENT_THIS_SOCKET 0x01
/* For RegisterClient */
typedef struct client_reg_t {
dev_info_t *dev_info;
u_int Attributes;
u_int EventMask;
int (*event_handler)(event_t event, int priority,
event_callback_args_t *);
event_callback_args_t event_callback_args;
u_int Version;
} client_reg_t;
/* ModifyConfiguration */
typedef struct modconf_t {
u_int Attributes;
u_int Vcc, Vpp1, Vpp2;
} modconf_t;
/* Attributes for ModifyConfiguration */
#define CONF_IRQ_CHANGE_VALID 0x100
#define CONF_VCC_CHANGE_VALID 0x200
#define CONF_VPP1_CHANGE_VALID 0x400
#define CONF_VPP2_CHANGE_VALID 0x800
/* For RequestConfiguration */
typedef struct config_req_t {
u_int Attributes;
u_int Vcc, Vpp1, Vpp2;
u_int IntType;
u_int ConfigBase;
u_char Status, Pin, Copy, ExtStatus;
u_char ConfigIndex;
u_int Present;
} config_req_t;
/* Attributes for RequestConfiguration */
#define CONF_ENABLE_IRQ 0x01
#define CONF_ENABLE_DMA 0x02
#define CONF_ENABLE_SPKR 0x04
#define CONF_VALID_CLIENT 0x100
/* IntType field */
#define INT_MEMORY 0x01
#define INT_MEMORY_AND_IO 0x02
#define INT_CARDBUS 0x04
#define INT_ZOOMED_VIDEO 0x08
/* For RequestIO and ReleaseIO */
typedef struct io_req_t {
ioaddr_t BasePort1;
ioaddr_t NumPorts1;
u_int Attributes1;
ioaddr_t BasePort2;
ioaddr_t NumPorts2;
u_int Attributes2;
u_int IOAddrLines;
} io_req_t;
/* Attributes for RequestIO and ReleaseIO */
#define IO_SHARED 0x01
#define IO_FIRST_SHARED 0x02
#define IO_FORCE_ALIAS_ACCESS 0x04
#define IO_DATA_PATH_WIDTH 0x18
#define IO_DATA_PATH_WIDTH_8 0x00
#define IO_DATA_PATH_WIDTH_16 0x08
#define IO_DATA_PATH_WIDTH_AUTO 0x10
/* For RequestIRQ and ReleaseIRQ */
typedef struct irq_req_t {
u_int Attributes;
u_int AssignedIRQ;
u_int IRQInfo1, IRQInfo2;
void *Handler;
void *Instance;
} irq_req_t;
/* Attributes for RequestIRQ and ReleaseIRQ */
#define IRQ_TYPE 0x03
#define IRQ_TYPE_EXCLUSIVE 0x00
#define IRQ_TYPE_TIME 0x01
#define IRQ_TYPE_DYNAMIC_SHARING 0x02
#define IRQ_FORCED_PULSE 0x04
#define IRQ_FIRST_SHARED 0x08
#define IRQ_HANDLE_PRESENT 0x10
#define IRQ_PULSE_ALLOCATED 0x100
/* Bits in IRQInfo1 field */
#define IRQ_MASK 0x0f
#define IRQ_NMI_ID 0x01
#define IRQ_IOCK_ID 0x02
#define IRQ_BERR_ID 0x04
#define IRQ_VEND_ID 0x08
#define IRQ_INFO2_VALID 0x10
#define IRQ_LEVEL_ID 0x20
#define IRQ_PULSE_ID 0x40
#define IRQ_SHARE_ID 0x80
typedef struct eventmask_t {
u_int Attributes;
u_int EventMask;
} eventmask_t;
#define CONF_EVENT_MASK_VALID 0x01
/* Configuration registers present */
#define PRESENT_OPTION 0x001
#define PRESENT_STATUS 0x002
#define PRESENT_PIN_REPLACE 0x004
#define PRESENT_COPY 0x008
#define PRESENT_EXT_STATUS 0x010
#define PRESENT_IOBASE_0 0x020
#define PRESENT_IOBASE_1 0x040
#define PRESENT_IOBASE_2 0x080
#define PRESENT_IOBASE_3 0x100
#define PRESENT_IOSIZE 0x200
/* For GetMemPage, MapMemPage */
typedef struct memreq_t {
u_int CardOffset;
page_t Page;
} memreq_t;
/* For ModifyWindow */
typedef struct modwin_t {
u_int Attributes;
u_int AccessSpeed;
} modwin_t;
/* For RequestWindow */
typedef struct win_req_t {
u_int Attributes;
u_long Base;
u_int Size;
u_int AccessSpeed;
} win_req_t;
/* Attributes for RequestWindow */
#define WIN_ADDR_SPACE 0x0001
#define WIN_ADDR_SPACE_MEM 0x0000
#define WIN_ADDR_SPACE_IO 0x0001
#define WIN_MEMORY_TYPE 0x0002
#define WIN_MEMORY_TYPE_CM 0x0000
#define WIN_MEMORY_TYPE_AM 0x0002
#define WIN_ENABLE 0x0004
#define WIN_DATA_WIDTH 0x0018
#define WIN_DATA_WIDTH_8 0x0000
#define WIN_DATA_WIDTH_16 0x0008
#define WIN_DATA_WIDTH_32 0x0010
#define WIN_PAGED 0x0020
#define WIN_SHARED 0x0040
#define WIN_FIRST_SHARED 0x0080
#define WIN_USE_WAIT 0x0100
#define WIN_STRICT_ALIGN 0x0200
#define WIN_MAP_BELOW_1MB 0x0400
#define WIN_PREFETCH 0x0800
#define WIN_CACHEABLE 0x1000
#define WIN_BAR_MASK 0xe000
#define WIN_BAR_SHIFT 13
/* Attributes for RegisterClient */
#define INFO_MASTER_CLIENT 0x01
#define INFO_IO_CLIENT 0x02
#define INFO_MTD_CLIENT 0x04
#define INFO_MEM_CLIENT 0x08
#define MAX_NUM_CLIENTS 3
#define INFO_CARD_SHARE 0x10
#define INFO_CARD_EXCL 0x20
typedef struct cs_status_t {
u_char Function;
event_t CardState;
event_t SocketState;
} cs_status_t;
typedef struct error_info_t {
int func;
int retcode;
} error_info_t;
/* Special stuff for binding drivers to sockets */
typedef struct bind_req_t {
socket_t Socket;
u_char Function;
dev_info_t *dev_info;
} bind_req_t;
/* Flag to bind to all functions */
#define BIND_FN_ALL 0xff
typedef struct mtd_bind_t {
socket_t Socket;
u_int Attributes;
u_int CardOffset;
dev_info_t *dev_info;
} mtd_bind_t;
/* Events */
#define CS_EVENT_PRI_LOW 0
#define CS_EVENT_PRI_HIGH 1
#define CS_EVENT_WRITE_PROTECT 0x000001
#define CS_EVENT_CARD_LOCK 0x000002
#define CS_EVENT_CARD_INSERTION 0x000004
#define CS_EVENT_CARD_REMOVAL 0x000008
#define CS_EVENT_BATTERY_DEAD 0x000010
#define CS_EVENT_BATTERY_LOW 0x000020
#define CS_EVENT_READY_CHANGE 0x000040
#define CS_EVENT_CARD_DETECT 0x000080
#define CS_EVENT_RESET_REQUEST 0x000100
#define CS_EVENT_RESET_PHYSICAL 0x000200
#define CS_EVENT_CARD_RESET 0x000400
#define CS_EVENT_REGISTRATION_COMPLETE 0x000800
#define CS_EVENT_RESET_COMPLETE 0x001000
#define CS_EVENT_PM_SUSPEND 0x002000
#define CS_EVENT_PM_RESUME 0x004000
#define CS_EVENT_INSERTION_REQUEST 0x008000
#define CS_EVENT_EJECTION_REQUEST 0x010000
#define CS_EVENT_MTD_REQUEST 0x020000
#define CS_EVENT_ERASE_COMPLETE 0x040000
#define CS_EVENT_REQUEST_ATTENTION 0x080000
#define CS_EVENT_CB_DETECT 0x100000
#define CS_EVENT_3VCARD 0x200000
#define CS_EVENT_XVCARD 0x400000
/* Return codes */
#define CS_SUCCESS 0x00
#define CS_BAD_ADAPTER 0x01
#define CS_BAD_ATTRIBUTE 0x02
#define CS_BAD_BASE 0x03
#define CS_BAD_EDC 0x04
#define CS_BAD_IRQ 0x06
#define CS_BAD_OFFSET 0x07
#define CS_BAD_PAGE 0x08
#define CS_READ_FAILURE 0x09
#define CS_BAD_SIZE 0x0a
#define CS_BAD_SOCKET 0x0b
#define CS_BAD_TYPE 0x0d
#define CS_BAD_VCC 0x0e
#define CS_BAD_VPP 0x0f
#define CS_BAD_WINDOW 0x11
#define CS_WRITE_FAILURE 0x12
#define CS_NO_CARD 0x14
#define CS_UNSUPPORTED_FUNCTION 0x15
#define CS_UNSUPPORTED_MODE 0x16
#define CS_BAD_SPEED 0x17
#define CS_BUSY 0x18
#define CS_GENERAL_FAILURE 0x19
#define CS_WRITE_PROTECTED 0x1a
#define CS_BAD_ARG_LENGTH 0x1b
#define CS_BAD_ARGS 0x1c
#define CS_CONFIGURATION_LOCKED 0x1d
#define CS_IN_USE 0x1e
#define CS_NO_MORE_ITEMS 0x1f
#define CS_OUT_OF_RESOURCE 0x20
#define CS_BAD_HANDLE 0x21
#define CS_BAD_TUPLE 0x40
#ifdef __KERNEL__
/*
* Calls to set up low-level "Socket Services" drivers
*/
typedef int (*ss_entry_t)(u_int sock, u_int cmd, void *arg);
extern int register_ss_entry(int nsock, ss_entry_t entry);
extern void unregister_ss_entry(ss_entry_t entry);
/*
* The main Card Services entry point
*/
enum service {
AccessConfigurationRegister, AddSocketServices,
AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
GetClientInfo, GetConfigurationInfo, GetEventMask,
GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
OpenMemory, ParseTuple, ReadMemory, RegisterClient,
RegisterEraseQueue, RegisterMTD, RegisterTimer,
ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
WriteMemory, BindDevice, BindMTD, ReportError,
SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
GetFirstWindow, GetNextWindow, GetMemPage
};
#ifdef IN_CARD_SERVICES
extern int CardServices(int func, void *a1, void *a2, void *a3);
#else
extern int CardServices(int func, ...);
#endif
#endif /* __KERNEL__ */
#endif /* _LINUX_CS_H */

View File

@ -1,70 +0,0 @@
/*
* cs_types.h 1.20 2002/04/17 02:52:39
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_CS_TYPES_H
#define _LINUX_CS_TYPES_H
#ifdef __linux__
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <sys/types.h>
#endif
#endif
#ifdef __arm__
typedef u_int ioaddr_t;
#else
typedef u_short ioaddr_t;
#endif
typedef u_short socket_t;
typedef u_int event_t;
typedef u_char cisdata_t;
typedef u_short page_t;
struct client_t;
typedef struct client_t *client_handle_t;
struct window_t;
typedef struct window_t *window_handle_t;
struct region_t;
typedef struct region_t *memory_handle_t;
struct eraseq_t;
typedef struct eraseq_t *eraseq_handle_t;
#ifndef DEV_NAME_LEN
#define DEV_NAME_LEN 32
#endif
typedef char dev_info_t[DEV_NAME_LEN];
#endif /* _LINUX_CS_TYPES_H */

View File

@ -1,73 +0,0 @@
/*
* driver_ops.h 1.17 2001/10/04 03:15:22
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_DRIVER_OPS_H
#define _LINUX_DRIVER_OPS_H
#ifndef DEV_NAME_LEN
#define DEV_NAME_LEN 32
#endif
#ifdef __KERNEL__
typedef struct dev_node_t {
char dev_name[DEV_NAME_LEN];
u_short major, minor;
struct dev_node_t *next;
} dev_node_t;
typedef struct dev_locator_t {
enum { LOC_ISA, LOC_PCI } bus;
union {
struct {
u_short io_base_1, io_base_2;
u_long mem_base;
u_char irq, dma;
} isa;
struct {
u_char bus;
u_char devfn;
} pci;
} b;
} dev_locator_t;
typedef struct driver_operations {
char *name;
dev_node_t *(*attach) (dev_locator_t *loc);
void (*suspend) (dev_node_t *dev);
void (*resume) (dev_node_t *dev);
void (*detach) (dev_node_t *dev);
} driver_operations;
int register_driver(struct driver_operations *ops);
void unregister_driver(struct driver_operations *ops);
#endif /* __KERNEL__ */
#endif /* _LINUX_DRIVER_OPS_H */

View File

@ -1,148 +0,0 @@
/*
* ds.h 1.58 2001/10/04 03:15:22
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_DS_H
#define _LINUX_DS_H
#include <pcmcia/driver_ops.h>
#include <pcmcia/bulkmem.h>
typedef struct tuple_parse_t {
tuple_t tuple;
cisdata_t data[255];
cisparse_t parse;
} tuple_parse_t;
typedef struct win_info_t {
window_handle_t handle;
win_req_t window;
memreq_t map;
} win_info_t;
typedef struct bind_info_t {
dev_info_t dev_info;
u_char function;
struct dev_link_t *instance;
char name[DEV_NAME_LEN];
u_short major, minor;
void *next;
} bind_info_t;
typedef struct mtd_info_t {
dev_info_t dev_info;
u_int Attributes;
u_int CardOffset;
} mtd_info_t;
typedef union ds_ioctl_arg_t {
servinfo_t servinfo;
adjust_t adjust;
config_info_t config;
tuple_t tuple;
tuple_parse_t tuple_parse;
client_req_t client_req;
cs_status_t status;
conf_reg_t conf_reg;
cisinfo_t cisinfo;
region_info_t region;
bind_info_t bind_info;
mtd_info_t mtd_info;
win_info_t win_info;
cisdump_t cisdump;
} ds_ioctl_arg_t;
#define DS_GET_CARD_SERVICES_INFO _IOR ('d', 1, servinfo_t)
#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
#define DS_RESET_CARD _IO ('d', 8)
#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
#define DS_SUSPEND_CARD _IO ('d', 12)
#define DS_RESUME_CARD _IO ('d', 13)
#define DS_EJECT_CARD _IO ('d', 14)
#define DS_INSERT_CARD _IO ('d', 15)
#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
#ifdef __KERNEL__
typedef struct dev_link_t {
dev_node_t *dev;
u_int state, open;
wait_queue_head_t pending;
struct timer_list release;
client_handle_t handle;
io_req_t io;
irq_req_t irq;
config_req_t conf;
window_handle_t win;
void *priv;
struct dev_link_t *next;
} dev_link_t;
/* Flags for device state */
#define DEV_PRESENT 0x01
#define DEV_CONFIG 0x02
#define DEV_STALE_CONFIG 0x04 /* release on close */
#define DEV_STALE_LINK 0x08 /* detach on release */
#define DEV_CONFIG_PENDING 0x10
#define DEV_RELEASE_PENDING 0x20
#define DEV_SUSPEND 0x40
#define DEV_BUSY 0x80
#define DEV_OK(l) \
((l) && ((l->state & ~DEV_BUSY) == (DEV_CONFIG|DEV_PRESENT)))
int register_pccard_driver(dev_info_t *dev_info,
dev_link_t *(*attach)(void),
void (*detach)(dev_link_t *));
int unregister_pccard_driver(dev_info_t *dev_info);
#define register_pcmcia_driver register_pccard_driver
#define unregister_pcmcia_driver unregister_pccard_driver
#endif /* __KERNEL__ */
#endif /* _LINUX_DS_H */

View File

@ -1,154 +0,0 @@
/*
* i82365.h 1.20 2000/07/20 23:00:27
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License version 2 (the "GPL"), in which
* case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_I82365_H
#define _LINUX_I82365_H
/* register definitions for the Intel 82365SL PCMCIA controller */
/* Offsets for PCIC registers */
#define I365_IDENT 0x00 /* Identification and revision */
#define I365_STATUS 0x01 /* Interface status */
#define I365_POWER 0x02 /* Power and RESETDRV control */
#define I365_INTCTL 0x03 /* Interrupt and general control */
#define I365_CSC 0x04 /* Card status change */
#define I365_CSCINT 0x05 /* Card status change interrupt control */
#define I365_ADDRWIN 0x06 /* Address window enable */
#define I365_IOCTL 0x07 /* I/O control */
#define I365_GENCTL 0x16 /* Card detect and general control */
#define I365_GBLCTL 0x1E /* Global control register */
/* Offsets for I/O and memory window registers */
#define I365_IO(map) (0x08+((map)<<2))
#define I365_MEM(map) (0x10+((map)<<3))
#define I365_W_START 0
#define I365_W_STOP 2
#define I365_W_OFF 4
/* Flags for I365_STATUS */
#define I365_CS_BVD1 0x01
#define I365_CS_STSCHG 0x01
#define I365_CS_BVD2 0x02
#define I365_CS_SPKR 0x02
#define I365_CS_DETECT 0x0C
#define I365_CS_WRPROT 0x10
#define I365_CS_READY 0x20 /* Inverted */
#define I365_CS_POWERON 0x40
#define I365_CS_GPI 0x80
/* Flags for I365_POWER */
#define I365_PWR_OFF 0x00 /* Turn off the socket */
#define I365_PWR_OUT 0x80 /* Output enable */
#define I365_PWR_NORESET 0x40 /* Disable RESETDRV on resume */
#define I365_PWR_AUTO 0x20 /* Auto pwr switch enable */
#define I365_VCC_MASK 0x18 /* Mask for turning off Vcc */
/* There are different layouts for B-step and DF-step chips: the B
step has independent Vpp1/Vpp2 control, and the DF step has only
Vpp1 control, plus 3V control */
#define I365_VCC_5V 0x10 /* Vcc = 5.0v */
#define I365_VCC_3V 0x18 /* Vcc = 3.3v */
#define I365_VPP2_MASK 0x0c /* Mask for turning off Vpp2 */
#define I365_VPP2_5V 0x04 /* Vpp2 = 5.0v */
#define I365_VPP2_12V 0x08 /* Vpp2 = 12.0v */
#define I365_VPP1_MASK 0x03 /* Mask for turning off Vpp1 */
#define I365_VPP1_5V 0x01 /* Vpp2 = 5.0v */
#define I365_VPP1_12V 0x02 /* Vpp2 = 12.0v */
/* Flags for I365_INTCTL */
#define I365_RING_ENA 0x80
#define I365_PC_RESET 0x40
#define I365_PC_IOCARD 0x20
#define I365_INTR_ENA 0x10
#define I365_IRQ_MASK 0x0F
/* Flags for I365_CSC and I365_CSCINT*/
#define I365_CSC_BVD1 0x01
#define I365_CSC_STSCHG 0x01
#define I365_CSC_BVD2 0x02
#define I365_CSC_READY 0x04
#define I365_CSC_DETECT 0x08
#define I365_CSC_ANY 0x0F
#define I365_CSC_GPI 0x10
/* Flags for I365_ADDRWIN */
#define I365_ADDR_MEMCS16 0x20
#define I365_ENA_IO(map) (0x40 << (map))
#define I365_ENA_MEM(map) (0x01 << (map))
/* Flags for I365_IOCTL */
#define I365_IOCTL_MASK(map) (0x0F << (map<<2))
#define I365_IOCTL_WAIT(map) (0x08 << (map<<2))
#define I365_IOCTL_0WS(map) (0x04 << (map<<2))
#define I365_IOCTL_IOCS16(map) (0x02 << (map<<2))
#define I365_IOCTL_16BIT(map) (0x01 << (map<<2))
/* Flags for I365_GENCTL */
#define I365_CTL_16DELAY 0x01
#define I365_CTL_RESET 0x02
#define I365_CTL_GPI_ENA 0x04
#define I365_CTL_GPI_CTL 0x08
#define I365_CTL_RESUME 0x10
#define I365_CTL_SW_IRQ 0x20
/* Flags for I365_GBLCTL */
#define I365_GBL_PWRDOWN 0x01
#define I365_GBL_CSC_LEV 0x02
#define I365_GBL_WRBACK 0x04
#define I365_GBL_IRQ_0_LEV 0x08
#define I365_GBL_IRQ_1_LEV 0x10
/* Flags for memory window registers */
#define I365_MEM_16BIT 0x8000 /* In memory start high byte */
#define I365_MEM_0WS 0x4000
#define I365_MEM_WS1 0x8000 /* In memory stop high byte */
#define I365_MEM_WS0 0x4000
#define I365_MEM_WRPROT 0x8000 /* In offset high byte */
#define I365_MEM_REG 0x4000
#define I365_REG(slot, reg) (((slot) << 6) | (reg))
/* Default ISA interrupt mask */
#define I365_ISA_IRQ_MASK 0xdeb8 /* irq's 3-5,7,9-12,14,15 */
/* Device ID's for PCI-to-PCMCIA bridges */
#ifndef PCI_VENDOR_ID_INTEL
#define PCI_VENDOR_ID_INTEL 0x8086
#endif
#ifndef PCI_DEVICE_ID_INTEL_82092AA_0
#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
#endif
#ifndef PCI_VENDOR_ID_OMEGA
#define PCI_VENDOR_ID_OMEGA 0x119b
#endif
#ifndef PCI_DEVICE_ID_OMEGA_82C092G
#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221
#endif
#endif /* _LINUX_I82365_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,269 +0,0 @@
/* Special state for handling include files */
%x src
%{
/*
* lex_config.l 1.49 2002/10/07 16:39:21
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#undef src
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <syslog.h>
#ifdef HAS_WORDEXP
#include <wordexp.h>
#else
#include <glob.h>
#endif
#define src 1
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include "yacc_config.h"
/* For assembling nice error messages */
char *current_file;
int current_lineno;
static int lex_number(char *s);
static int lex_string(char *s);
static void do_source(char *fn);
static int do_eof(void);
%}
int [0-9]+
hex 0x[0-9a-fA-F]+
str \"([^"]|\\.)*\"
%%
source[ \t]+ BEGIN(src); return SOURCE;
<src>[^\n]+ do_source(yytext); BEGIN(INITIAL);
<<EOF>> if (do_eof()) yyterminate();
\n current_lineno++;
[ \t]* /* skip */ ;
[ ]*[#;].* /* skip */ ;
anonymous return ANONYMOUS;
bind return BIND;
cis return CIS;
card return CARD;
class return CLASS;
default return DEFAULT;
device return DEVICE;
dtype return DTYPE;
exclude return EXCLUDE;
function return FUNCTION;
include return INCLUDE;
irq return IRQ_NO;
jedec return JEDEC;
manfid return MANFID;
memory return MEMORY;
module return MODULE;
mtd return MTD;
needs_mtd return NEEDS_MTD;
opts return OPTS;
pci return PCI;
port return PORT;
region return REGION;
reserve return RESERVE;
to return TO;
tuple return TUPLE;
version return VERSION;
memory_card return lex_number("1");
serial_port return lex_number("2");
parallel_port return lex_number("3");
fixed_disk return lex_number("4");
video_adapter return lex_number("5");
network_adapter return lex_number("6");
aims_card return lex_number("7");
scsi_adapter return lex_number("8");
{int} return lex_number(yytext);
{hex} return lex_number(yytext);
{str} return lex_string(yytext);
. return yytext[0];
%%
#ifndef yywrap
int yywrap() { return 1; }
#endif
/*======================================================================
Stuff to parse basic data types
======================================================================*/
static int lex_number(char *s)
{
yylval.num = strtoul(s, NULL, 0);
return NUMBER;
}
static int lex_string(char *s)
{
int n = strlen(s);
yylval.str = malloc(n-1);
strncpy(yylval.str, s+1, n-2);
yylval.str[n-2] = '\0';
return STRING;
}
/*======================================================================
Code to support nesting of configuration files
======================================================================*/
#define MAX_SOURCE_DEPTH 4
struct source_stack {
YY_BUFFER_STATE buffer;
char *filename;
int lineno, fileno;
FILE *file;
#ifdef HAS_WORDEXP
wordexp_t word;
#else
glob_t glob;
#endif
} source_stack[MAX_SOURCE_DEPTH];
static int source_stack_ptr = 0;
static int parse_env = 0;
static int get_glob(void)
{
struct source_stack *s = &source_stack[source_stack_ptr];
#ifdef HAS_WORDEXP
while (s->fileno < s->word.we_wordc) {
char *fn = s->word.we_wordv[s->fileno];
#else
while (s->fileno < s->glob.gl_pathc) {
char *fn = s->glob.gl_pathv[s->fileno];
#endif
s->file = fopen(fn, "r");
if (s->file == NULL) {
if (strpbrk(fn, "?*[") == NULL)
syslog(LOG_INFO, "could not open '%s': %m", fn);
s->fileno++;
} else {
current_lineno = 1;
current_file = strdup(fn);
yy_switch_to_buffer(yy_create_buffer(s->file, YY_BUF_SIZE));
source_stack_ptr++;
s->fileno++;
return 0;
}
}
return -1;
}
static void do_source(char *fn)
{
struct source_stack *s = &source_stack[source_stack_ptr];
if (source_stack_ptr >= MAX_SOURCE_DEPTH) {
syslog(LOG_INFO, "source depth limit exceeded");
return;
}
#ifdef HAS_WORDEXP
wordexp(fn, &s->word, 0);
#else
glob(fn, GLOB_NOCHECK, NULL, &s->glob);
#endif
s->fileno = 0;
s->buffer = YY_CURRENT_BUFFER;
s->lineno = current_lineno;
s->filename = current_file;
get_glob();
}
static int do_eof(void)
{
struct source_stack *s = &source_stack[--source_stack_ptr];
if (source_stack_ptr < 0) {
if (parse_env == 0) {
char *t = getenv("PCMCIA_OPTS");
if (t == NULL) return -1;
parse_env = 1;
source_stack_ptr = 0;
current_file = "PCMCIA_OPTS";
current_lineno = 1;
yy_scan_string(t);
return 0;
} else
return -1;
}
fclose(s->file);
free(current_file);
yy_delete_buffer(YY_CURRENT_BUFFER);
if (get_glob() != 0) {
yy_switch_to_buffer(s->buffer);
current_lineno = s->lineno;
current_file = s->filename;
}
return 0;
}
/*======================================================================
The main entry point... returns -1 if the file can't be accessed.
======================================================================*/
int parse_configfile(char *fn)
{
FILE *f;
f = fopen(fn, "r");
if (!f) {
syslog(LOG_INFO, "could not open '%s': %m", fn);
return -1;
}
current_lineno = 1;
current_file = fn;
source_stack_ptr = 0;
yyrestart(f);
yyparse();
fclose(f);
return 0;
}

View File

@ -1,21 +0,0 @@
/*
* Guillaume Cottenceau (gc@mandrakesoft.com)
*
* Copyright 2000 MandrakeSoft
*
* This software may be freely redistributed under the terms of the GNU
* public license.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _PCMCIA_CARDMGR_INTERFACE_H_
#define _PCMCIA_CARDMGR_INTERFACE_H_
char * pcmcia_probe(void);
int cardmgr_call(void);
#endif

View File

@ -1,419 +0,0 @@
/*
* Guillaume Cottenceau (gc@mandrakesoft.com)
*
* Copyright 2000-2001 MandrakeSoft
*
* This software may be freely redistributed under the terms of the GNU
* public license.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* Code comes from /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-3.1.28.tar.bz2
*
* Licence of this code follows:
PCMCIA controller probe
probe.c 1.54 2001/05/10 03:01:59
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The initial developer of the original code is David A. Hinds
<dahinds@users.sourceforge.net>. Portions created by David A. Hinds
are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Alternatively, the contents of this file may be used under the
terms of the GNU Public License version 2 (the "GPL"), in which
case the provisions of the GPL are applicable instead of the
above. If you wish to allow the use of your version of this file
only under the terms of the GPL and not to allow others to use
your version of this file under the MPL, indicate your decision
by deleting the provisions above and replace them with the notice
and other provisions required by the GPL. If you do not delete
the provisions above, a recipient may use your version of this
file under either the MPL or the GPL.
======================================================================*/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include "log.h"
#include "pcmcia.h"
/*====================================================================*/
typedef struct {
u_short vendor, device;
char *tag;
char *name;
} pci_id_t;
pci_id_t pci_id[] = {
{ 0x1013, 0x1100, "Cirrus Logic CL 6729", "Cirrus PD6729" },
{ 0x1013, 0x1110, "Cirrus Logic PD 6832", "Cirrus PD6832" },
{ 0x10b3, 0xb106, "SMC 34C90", "SMC 34C90" },
{ 0x1180, 0x0465, "Ricoh RL5C465", "Ricoh RL5C465" },
{ 0x1180, 0x0466, "Ricoh RL5C466", "Ricoh RL5C466" },
{ 0x1180, 0x0475, "Ricoh RL5C475", "Ricoh RL5C475" },
{ 0x1180, 0x0476, "Ricoh RL5C476", "Ricoh RL5C476" },
{ 0x1180, 0x0478, "Ricoh RL5C478", "Ricoh RL5C478" },
{ 0x104c, 0xac12, "Texas Instruments PCI1130", "TI 1130" },
{ 0x104c, 0xac13, "Texas Instruments PCI1031", "TI 1031" },
{ 0x104c, 0xac15, "Texas Instruments PCI1131", "TI 1131" },
{ 0x104c, 0xac1a, "Texas Instruments PCI1210", "TI 1210" },
{ 0x104c, 0xac1e, "Texas Instruments PCI1211", "TI 1211" },
{ 0x104c, 0xac17, "Texas Instruments PCI1220", "TI 1220" },
{ 0x104c, 0xac19, "Texas Instruments PCI1221", "TI 1221" },
{ 0x104c, 0xac1c, "Texas Instruments PCI1225", "TI 1225" },
{ 0x104c, 0xac16, "Texas Instruments PCI1250", "TI 1250A" },
{ 0x104c, 0xac1d, "Texas Instruments PCI1251A", "TI 1251A" },
{ 0x104c, 0xac1f, "Texas Instruments PCI1251B", "TI 1251B" },
{ 0x104c, 0xac50, "Texas Instruments PCI1410", "TI 1410" },
{ 0x104c, 0xac51, "Texas Instruments PCI1420", "TI 1420" },
{ 0x104c, 0xac52, "Texas Instruments PCI1451", "TI 1451" },
{ 0x104c, 0xac53, "Texas Instruments PCI1421", "TI 1421" },
{ 0x104c, 0xac54, "Texas Instruments PCI1620", "TI 1620" },
{ 0x104c, 0xac55, "Texas Instruments PCI1250", "TI 1250" },
{ 0x104c, 0xac56, "Texas Instruments PCI1510", "TI 1510" },
{ 0x104c, 0xac57, "Texas Instruments PCI1530", "TI 1530" },
{ 0x104c, 0xac58, "Texas Instruments PCI1515", "TI 1515" },
{ 0x104c, 0xac59, "Texas Instruments PCI1621", "TI 1621" },
{ 0x104c, 0xac5a, "Texas Instruments PCI1610", "TI 1610" },
{ 0x104c, 0xac1b, "Texas Instruments PCI1450", "TI 1450" },
{ 0x104c, 0xac52, "Texas Instruments PCI1451", "TI 1451" },
{ 0x104c, 0xac41, "Texas Instruments PCI4410", "TI 4410" },
{ 0x104c, 0xac40, "Texas Instruments PCI4450", "TI 4450" },
{ 0x104c, 0xac42, "Texas Instruments PCI4451", "TI 4451" },
{ 0x1217, 0x6729, "O2 Micro 6729", "O2Micro OZ6729" },
{ 0x1217, 0x673a, "O2 Micro 6730", "O2Micro OZ6730" },
{ 0x1217, 0x6832, "O2 Micro 6832/6833", "O2Micro OZ6832/OZ6833" },
{ 0x1217, 0x6836, "O2 Micro 6836/6860", "O2Micro OZ6836/OZ6860" },
{ 0x1217, 0x6872, "O2 Micro 6812", "O2Micro OZ6812" },
{ 0x1179, 0x0603, "Toshiba ToPIC95-A", "Toshiba ToPIC95-A" },
{ 0x1179, 0x060a, "Toshiba ToPIC95-B", "Toshiba ToPIC95-B" },
{ 0x1179, 0x060f, "Toshiba ToPIC97", "Toshiba ToPIC97" },
{ 0x1179, 0x0617, "Toshiba ToPIC100", "Toshiba ToPIC100" },
{ 0x119b, 0x1221, "Omega Micro 82C092G", "Omega Micro 82C092G" },
{ 0x1524, 0x1211, "ENE Technology Inc|CB1211 Cardbus Controller", "ENE CB1211" },
{ 0x1524, 0x1225, "ENE Technology Inc|CB1225 Cardbus Controller", "ENE CB1225" },
{ 0x1524, 0x1410, "ENE Technology Inc|CB1410 Cardbus Controller", "ENE CB1410" },
{ 0x1524, 0x1420, "ENE Technology Inc|CB1420 Cardbus Controller", "ENE CB1420" },
{ 0x8086, 0x1221, "Intel 82092AA", "Intel 82092AA" }
};
#define PCI_COUNT (sizeof(pci_id)/sizeof(pci_id_t))
static int pci_probe(void)
{
char s[256], *name = NULL;
u_int device, vendor, i;
FILE *f;
log_message("PCMCIA: probing PCI bus..");
f = fopen("/proc/bus/pci/devices", "r");
if (!f) {
log_message("where are you going without /proc/bus/pci/devices ??");
return -1;
}
while (fgets(s, 256, f) != NULL) {
u_int n = strtoul(s+5, NULL, 16);
vendor = (n >> 16); device = (n & 0xffff);
for (i = 0; i < PCI_COUNT; i++)
if ((vendor == pci_id[i].vendor) &&
(device == pci_id[i].device)) break;
if (i < PCI_COUNT) {
name = pci_id[i].name;
break;
}
}
fclose(f);
if (name) {
log_message("\t%s found, 2 sockets.", name);
return 0;
} else {
log_message("\tnot found.");
return -ENODEV;
}
}
/*====================================================================*/
#include <sys/io.h>
typedef u_short ioaddr_t;
#include "i82365.h"
#include "cirrus.h"
#include "vg468.h"
static ioaddr_t i365_base = 0x03e0;
static u_char i365_get(u_short sock, u_short reg)
{
u_char val = I365_REG(sock, reg);
outb(val, i365_base); val = inb(i365_base+1);
return val;
}
static void i365_set(u_short sock, u_short reg, u_char data)
{
u_char val = I365_REG(sock, reg);
outb(val, i365_base); outb(data, i365_base+1);
}
static void i365_bset(u_short sock, u_short reg, u_char mask)
{
u_char d = i365_get(sock, reg);
d |= mask;
i365_set(sock, reg, d);
}
static void i365_bclr(u_short sock, u_short reg, u_char mask)
{
u_char d = i365_get(sock, reg);
d &= ~mask;
i365_set(sock, reg, d);
}
static int i365_probe(void)
{
int val, sock, done;
char *name = "i82365sl";
log_message("PCMCIA: probing for Intel PCIC (ISA)..");
sock = done = 0;
if (ioperm(i365_base, 4, 1)) {
log_perror("PCMCIA: ioperm");
return -1;
}
ioperm(0x80, 1, 1);
for (; sock < 2; sock++) {
val = i365_get(sock, I365_IDENT);
switch (val) {
case 0x82:
name = "i82365sl A step";
break;
case 0x83:
name = "i82365sl B step";
break;
case 0x84:
name = "VLSI 82C146";
break;
case 0x88: case 0x89: case 0x8a:
name = "IBM Clone";
break;
case 0x8b: case 0x8c:
break;
default:
done = 1;
}
if (done) break;
}
if (sock == 0) {
log_message("\tnot found.");
return -ENODEV;
}
if ((sock == 2) && (strcmp(name, "VLSI 82C146") == 0))
name = "i82365sl DF";
/* Check for Vadem chips */
outb(0x0e, i365_base);
outb(0x37, i365_base);
i365_bset(0, VG468_MISC, VG468_MISC_VADEMREV);
val = i365_get(0, I365_IDENT);
if (val & I365_IDENT_VADEM) {
if ((val & 7) < 4)
name = "Vadem VG-468";
else
name = "Vadem VG-469";
i365_bclr(0, VG468_MISC, VG468_MISC_VADEMREV);
}
/* Check for Cirrus CL-PD67xx chips */
i365_set(0, PD67_CHIP_INFO, 0);
val = i365_get(0, PD67_CHIP_INFO);
if ((val & PD67_INFO_CHIP_ID) == PD67_INFO_CHIP_ID) {
val = i365_get(0, PD67_CHIP_INFO);
if ((val & PD67_INFO_CHIP_ID) == 0) {
if (val & PD67_INFO_SLOTS)
name = "Cirrus CL-PD672x";
else {
name = "Cirrus CL-PD6710";
sock = 1;
}
i365_set(0, PD67_EXT_INDEX, 0xe5);
if (i365_get(0, PD67_EXT_INDEX) != 0xe5)
name = "VIA VT83C469";
}
}
log_message("\t%s found, %d sockets.", name, sock);
return 0;
} /* i365_probe */
/*====================================================================*/
#include "tcic.h"
static u_char tcic_getb(ioaddr_t base, u_char reg)
{
u_char val = inb(base+reg);
return val;
}
static void tcic_setb(ioaddr_t base, u_char reg, u_char data)
{
outb(data, base+reg);
}
static u_short tcic_getw(ioaddr_t base, u_char reg)
{
u_short val = inw(base+reg);
return val;
}
static void tcic_setw(ioaddr_t base, u_char reg, u_short data)
{
outw(data, base+reg);
}
static u_short tcic_aux_getw(ioaddr_t base, u_short reg)
{
u_char mode = (tcic_getb(base, TCIC_MODE) & TCIC_MODE_PGMMASK) | reg;
tcic_setb(base, TCIC_MODE, mode);
return tcic_getw(base, TCIC_AUX);
}
static void tcic_aux_setw(ioaddr_t base, u_short reg, u_short data)
{
u_char mode = (tcic_getb(base, TCIC_MODE) & TCIC_MODE_PGMMASK) | reg;
tcic_setb(base, TCIC_MODE, mode);
tcic_setw(base, TCIC_AUX, data);
}
static int get_tcic_id(ioaddr_t base)
{
u_short id;
tcic_aux_setw(base, TCIC_AUX_TEST, TCIC_TEST_DIAG);
id = tcic_aux_getw(base, TCIC_AUX_ILOCK);
id = (id & TCIC_ILOCKTEST_ID_MASK) >> TCIC_ILOCKTEST_ID_SH;
tcic_aux_setw(base, TCIC_AUX_TEST, 0);
return id;
}
static int tcic_probe_at(ioaddr_t base)
{
int i;
u_short old;
/* Anything there?? */
for (i = 0; i < 0x10; i += 2)
if (tcic_getw(base, i) == 0xffff)
return -1;
log_message("\tat %#3.3x: ", base);
/* Try to reset the chip */
tcic_setw(base, TCIC_SCTRL, TCIC_SCTRL_RESET);
tcic_setw(base, TCIC_SCTRL, 0);
/* Can we set the addr register? */
old = tcic_getw(base, TCIC_ADDR);
tcic_setw(base, TCIC_ADDR, 0);
if (tcic_getw(base, TCIC_ADDR) != 0) {
tcic_setw(base, TCIC_ADDR, old);
return -2;
}
tcic_setw(base, TCIC_ADDR, 0xc3a5);
if (tcic_getw(base, TCIC_ADDR) != 0xc3a5)
return -3;
return 2;
}
static int tcic_probe(void)
{
int sock, id;
log_message("PCMCIA: probing for Databook TCIC-2 (ISA)..");
if (ioperm(TCIC_BASE, 16, 1)) {
log_perror("PCMCIA: ioperm");
return -1;
}
ioperm(0x80, 1, 1);
sock = tcic_probe_at(TCIC_BASE);
if (sock <= 0) {
log_message("\tnot found.");
return -ENODEV;
}
id = get_tcic_id(TCIC_BASE);
switch (id) {
case TCIC_ID_DB86082:
log_message("DB86082"); break;
case TCIC_ID_DB86082A:
log_message("DB86082A"); break;
case TCIC_ID_DB86084:
log_message("DB86084"); break;
case TCIC_ID_DB86084A:
log_message("DB86084A"); break;
case TCIC_ID_DB86072:
log_message("DB86072"); break;
case TCIC_ID_DB86184:
log_message("DB86184"); break;
case TCIC_ID_DB86082B:
log_message("DB86082B"); break;
default:
log_message("Unknown TCIC-2 ID 0x%02x", id);
}
log_message("\tfound at %#6x, %d sockets.\n", TCIC_BASE, sock);
return 0;
} /* tcic_probe */
/*====================================================================*/
char * pcmcia_probe(void)
{
if (!pci_probe())
return "yenta_socket";
else if (!i365_probe())
return "i82365";
else if (!tcic_probe())
return "tcic";
else
return NULL;
}

View File

@ -1,266 +0,0 @@
/*
* tcic.h 1.14 2000/06/12 21:29:37
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License version 2 (the "GPL"), in which
* case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_TCIC_H
#define _LINUX_TCIC_H
#define TCIC_BASE 0x240
/* offsets of registers from TCIC_BASE */
#define TCIC_DATA 0x00
#define TCIC_ADDR 0x02
#define TCIC_SCTRL 0x06
#define TCIC_SSTAT 0x07
#define TCIC_MODE 0x08
#define TCIC_PWR 0x09
#define TCIC_EDC 0x0A
#define TCIC_ICSR 0x0C
#define TCIC_IENA 0x0D
#define TCIC_AUX 0x0E
#define TCIC_SS_SHFT 12
#define TCIC_SS_MASK 0x7000
/* Flags for TCIC_ADDR */
#define TCIC_ADR2_REG 0x8000
#define TCIC_ADR2_INDREG 0x0800
#define TCIC_ADDR_REG 0x80000000
#define TCIC_ADDR_SS_SHFT (TCIC_SS_SHFT+16)
#define TCIC_ADDR_SS_MASK (TCIC_SS_MASK<<16)
#define TCIC_ADDR_INDREG 0x08000000
#define TCIC_ADDR_IO 0x04000000
#define TCIC_ADDR_MASK 0x03ffffff
/* Flags for TCIC_SCTRL */
#define TCIC_SCTRL_ENA 0x01
#define TCIC_SCTRL_INCMODE 0x18
#define TCIC_SCTRL_INCMODE_HOLD 0x00
#define TCIC_SCTRL_INCMODE_WORD 0x08
#define TCIC_SCTRL_INCMODE_REG 0x10
#define TCIC_SCTRL_INCMODE_AUTO 0x18
#define TCIC_SCTRL_EDCSUM 0x20
#define TCIC_SCTRL_RESET 0x80
/* Flags for TCIC_SSTAT */
#define TCIC_SSTAT_6US 0x01
#define TCIC_SSTAT_10US 0x02
#define TCIC_SSTAT_PROGTIME 0x04
#define TCIC_SSTAT_LBAT1 0x08
#define TCIC_SSTAT_LBAT2 0x10
#define TCIC_SSTAT_RDY 0x20 /* Inverted */
#define TCIC_SSTAT_WP 0x40
#define TCIC_SSTAT_CD 0x80 /* Card detect */
/* Flags for TCIC_MODE */
#define TCIC_MODE_PGMMASK 0x1f
#define TCIC_MODE_NORMAL 0x00
#define TCIC_MODE_PGMWR 0x01
#define TCIC_MODE_PGMRD 0x02
#define TCIC_MODE_PGMCE 0x04
#define TCIC_MODE_PGMDBW 0x08
#define TCIC_MODE_PGMWORD 0x10
#define TCIC_MODE_AUXSEL_MASK 0xe0
/* Registers accessed through TCIC_AUX, by setting TCIC_MODE */
#define TCIC_AUX_TCTL (0<<5)
#define TCIC_AUX_PCTL (1<<5)
#define TCIC_AUX_WCTL (2<<5)
#define TCIC_AUX_EXTERN (3<<5)
#define TCIC_AUX_PDATA (4<<5)
#define TCIC_AUX_SYSCFG (5<<5)
#define TCIC_AUX_ILOCK (6<<5)
#define TCIC_AUX_TEST (7<<5)
/* Flags for TCIC_PWR */
#define TCIC_PWR_VCC(sock) (0x01<<(sock))
#define TCIC_PWR_VCC_MASK 0x03
#define TCIC_PWR_VPP(sock) (0x08<<(sock))
#define TCIC_PWR_VPP_MASK 0x18
#define TCIC_PWR_CLIMENA 0x40
#define TCIC_PWR_CLIMSTAT 0x80
/* Flags for TCIC_ICSR */
#define TCIC_ICSR_CLEAR 0x01
#define TCIC_ICSR_SET 0x02
#define TCIC_ICSR_JAM (TCIC_ICSR_CLEAR|TCIC_ICSR_SET)
#define TCIC_ICSR_STOPCPU 0x04
#define TCIC_ICSR_ILOCK 0x08
#define TCIC_ICSR_PROGTIME 0x10
#define TCIC_ICSR_ERR 0x20
#define TCIC_ICSR_CDCHG 0x40
#define TCIC_ICSR_IOCHK 0x80
/* Flags for TCIC_IENA */
#define TCIC_IENA_CFG_MASK 0x03
#define TCIC_IENA_CFG_OFF 0x00 /* disabled */
#define TCIC_IENA_CFG_OD 0x01 /* active low, open drain */
#define TCIC_IENA_CFG_LOW 0x02 /* active low, totem pole */
#define TCIC_IENA_CFG_HIGH 0x03 /* active high, totem pole */
#define TCIC_IENA_ILOCK 0x08
#define TCIC_IENA_PROGTIME 0x10
#define TCIC_IENA_ERR 0x20 /* overcurrent or iochk */
#define TCIC_IENA_CDCHG 0x40
/* Flags for TCIC_AUX_WCTL */
#define TCIC_WAIT_COUNT_MASK 0x001f
#define TCIC_WAIT_ASYNC 0x0020
#define TCIC_WAIT_SENSE 0x0040
#define TCIC_WAIT_SRC 0x0080
#define TCIC_WCTL_WR 0x0100
#define TCIC_WCTL_RD 0x0200
#define TCIC_WCTL_CE 0x0400
#define TCIC_WCTL_LLBAT1 0x0800
#define TCIC_WCTL_LLBAT2 0x1000
#define TCIC_WCTL_LRDY 0x2000
#define TCIC_WCTL_LWP 0x4000
#define TCIC_WCTL_LCD 0x8000
/* Flags for TCIC_AUX_SYSCFG */
#define TCIC_SYSCFG_IRQ_MASK 0x000f
#define TCIC_SYSCFG_MCSFULL 0x0010
#define TCIC_SYSCFG_IO1723 0x0020
#define TCIC_SYSCFG_MCSXB 0x0040
#define TCIC_SYSCFG_ICSXB 0x0080
#define TCIC_SYSCFG_NOPDN 0x0100
#define TCIC_SYSCFG_MPSEL_SHFT 9
#define TCIC_SYSCFG_MPSEL_MASK 0x0e00
#define TCIC_SYSCFG_MPSENSE 0x2000
#define TCIC_SYSCFG_AUTOBUSY 0x4000
#define TCIC_SYSCFG_ACC 0x8000
#define TCIC_ILOCK_OUT 0x01
#define TCIC_ILOCK_SENSE 0x02
#define TCIC_ILOCK_CRESET 0x04
#define TCIC_ILOCK_CRESENA 0x08
#define TCIC_ILOCK_CWAIT 0x10
#define TCIC_ILOCK_CWAITSNS 0x20
#define TCIC_ILOCK_HOLD_MASK 0xc0
#define TCIC_ILOCK_HOLD_CCLK 0xc0
#define TCIC_ILOCKTEST_ID_SH 8
#define TCIC_ILOCKTEST_ID_MASK 0x7f00
#define TCIC_ILOCKTEST_MCIC_1 0x8000
#define TCIC_ID_DB86082 0x02
#define TCIC_ID_DB86082A 0x03
#define TCIC_ID_DB86084 0x04
#define TCIC_ID_DB86084A 0x08
#define TCIC_ID_DB86072 0x15
#define TCIC_ID_DB86184 0x14
#define TCIC_ID_DB86082B 0x17
#define TCIC_TEST_DIAG 0x8000
/*
* Indirectly addressed registers
*/
#define TCIC_SCF1(sock) ((sock)<<3)
#define TCIC_SCF2(sock) (((sock)<<3)+2)
/* Flags for SCF1 */
#define TCIC_SCF1_IRQ_MASK 0x000f
#define TCIC_SCF1_IRQ_OFF 0x0000
#define TCIC_SCF1_IRQOC 0x0010
#define TCIC_SCF1_PCVT 0x0020
#define TCIC_SCF1_IRDY 0x0040
#define TCIC_SCF1_ATA 0x0080
#define TCIC_SCF1_DMA_SHIFT 8
#define TCIC_SCF1_DMA_MASK 0x0700
#define TCIC_SCF1_DMA_OFF 0
#define TCIC_SCF1_DREQ2 2
#define TCIC_SCF1_IOSTS 0x0800
#define TCIC_SCF1_SPKR 0x1000
#define TCIC_SCF1_FINPACK 0x2000
#define TCIC_SCF1_DELWR 0x4000
#define TCIC_SCF1_HD7IDE 0x8000
/* Flags for SCF2 */
#define TCIC_SCF2_RI 0x0001
#define TCIC_SCF2_IDBR 0x0002
#define TCIC_SCF2_MDBR 0x0004
#define TCIC_SCF2_MLBAT1 0x0008
#define TCIC_SCF2_MLBAT2 0x0010
#define TCIC_SCF2_MRDY 0x0020
#define TCIC_SCF2_MWP 0x0040
#define TCIC_SCF2_MCD 0x0080
#define TCIC_SCF2_MALL 0x00f8
/* Indirect addresses for memory window registers */
#define TCIC_MWIN(sock,map) (0x100+(((map)+((sock)<<2))<<3))
#define TCIC_MBASE_X 2
#define TCIC_MMAP_X 4
#define TCIC_MCTL_X 6
#define TCIC_MBASE_4K_BIT 0x4000
#define TCIC_MBASE_HA_SHFT 12
#define TCIC_MBASE_HA_MASK 0x0fff
#define TCIC_MMAP_REG 0x8000
#define TCIC_MMAP_CA_SHFT 12
#define TCIC_MMAP_CA_MASK 0x3fff
#define TCIC_MCTL_WSCNT_MASK 0x001f
#define TCIC_MCTL_WCLK 0x0020
#define TCIC_MCTL_WCLK_CCLK 0x0000
#define TCIC_MCTL_WCLK_BCLK 0x0020
#define TCIC_MCTL_QUIET 0x0040
#define TCIC_MCTL_WP 0x0080
#define TCIC_MCTL_ACC 0x0100
#define TCIC_MCTL_KE 0x0200
#define TCIC_MCTL_EDC 0x0400
#define TCIC_MCTL_B8 0x0800
#define TCIC_MCTL_SS_SHFT TCIC_SS_SHFT
#define TCIC_MCTL_SS_MASK TCIC_SS_MASK
#define TCIC_MCTL_ENA 0x8000
/* Indirect addresses for I/O window registers */
#define TCIC_IWIN(sock,map) (0x200+(((map)+((sock)<<1))<<2))
#define TCIC_IBASE_X 0
#define TCIC_ICTL_X 2
#define TCIC_ICTL_WSCNT_MASK TCIC_MCTL_WSCNT_MASK
#define TCIC_ICTL_QUIET TCIC_MCTL_QUIET
#define TCIC_ICTL_1K 0x0080
#define TCIC_ICTL_PASS16 0x0100
#define TCIC_ICTL_ACC TCIC_MCTL_ACC
#define TCIC_ICTL_TINY 0x0200
#define TCIC_ICTL_B16 0x0400
#define TCIC_ICTL_B8 TCIC_MCTL_B8
#define TCIC_ICTL_BW_MASK (TCIC_ICTL_B16|TCIC_ICTL_B8)
#define TCIC_ICTL_BW_DYN 0
#define TCIC_ICTL_BW_8 TCIC_ICTL_B8
#define TCIC_ICTL_BW_16 TCIC_ICTL_B16
#define TCIC_ICTL_BW_ATA (TCIC_ICTL_B16|TCIC_ICTL_B8)
#define TCIC_ICTL_SS_SHFT TCIC_SS_SHFT
#define TCIC_ICTL_SS_MASK TCIC_SS_MASK
#define TCIC_ICTL_ENA TCIC_MCTL_ENA
#endif /* _LINUX_TCIC_H */

View File

@ -1,13 +0,0 @@
/* version.h 1.114 2002/11/06 05:23:52 (David Hinds) */
#define CS_PKG_RELEASE "3.2.4"
#define CS_PKG_RELEASE_CODE 0x3204
#define VERSION(v,p,s) (((v)<<16)+(p<<8)+s)
#ifdef CONFIG_PCMCIA
#include_next <pcmcia/version.h>
#else
#define CS_RELEASE CS_PKG_RELEASE
#define CS_RELEASE_CODE CS_PKG_RELEASE_CODE
#endif

View File

@ -1,112 +0,0 @@
/*
* vg468.h 1.13 2000/06/12 21:29:37
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License version 2 (the "GPL"), in which
* case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#ifndef _LINUX_VG468_H
#define _LINUX_VG468_H
/* Special bit in I365_IDENT used for Vadem chip detection */
#define I365_IDENT_VADEM 0x08
/* Special definitions in I365_POWER */
#define VG468_VPP2_MASK 0x0c
#define VG468_VPP2_5V 0x04
#define VG468_VPP2_12V 0x08
/* Unique Vadem registers */
#define VG469_VSENSE 0x1f /* Card voltage sense */
#define VG469_VSELECT 0x2f /* Card voltage select */
#define VG468_CTL 0x38 /* Control register */
#define VG468_TIMER 0x39 /* Timer control */
#define VG468_MISC 0x3a /* Miscellaneous */
#define VG468_GPIO_CFG 0x3b /* GPIO configuration */
#define VG469_EXT_MODE 0x3c /* Extended mode register */
#define VG468_SELECT 0x3d /* Programmable chip select */
#define VG468_SELECT_CFG 0x3e /* Chip select configuration */
#define VG468_ATA 0x3f /* ATA control */
/* Flags for VG469_VSENSE */
#define VG469_VSENSE_A_VS1 0x01
#define VG469_VSENSE_A_VS2 0x02
#define VG469_VSENSE_B_VS1 0x04
#define VG469_VSENSE_B_VS2 0x08
/* Flags for VG469_VSELECT */
#define VG469_VSEL_VCC 0x03
#define VG469_VSEL_5V 0x00
#define VG469_VSEL_3V 0x03
#define VG469_VSEL_MAX 0x0c
#define VG469_VSEL_EXT_STAT 0x10
#define VG469_VSEL_EXT_BUS 0x20
#define VG469_VSEL_MIXED 0x40
#define VG469_VSEL_ISA 0x80
/* Flags for VG468_CTL */
#define VG468_CTL_SLOW 0x01 /* 600ns memory timing */
#define VG468_CTL_ASYNC 0x02 /* Asynchronous bus clocking */
#define VG468_CTL_TSSI 0x08 /* Tri-state some outputs */
#define VG468_CTL_DELAY 0x10 /* Card detect debounce */
#define VG468_CTL_INPACK 0x20 /* Obey INPACK signal? */
#define VG468_CTL_POLARITY 0x40 /* VCCEN polarity */
#define VG468_CTL_COMPAT 0x80 /* Compatibility stuff */
#define VG469_CTL_WS_COMPAT 0x04 /* Wait state compatibility */
#define VG469_CTL_STRETCH 0x10 /* LED stretch */
/* Flags for VG468_TIMER */
#define VG468_TIMER_ZEROPWR 0x10 /* Zero power control */
#define VG468_TIMER_SIGEN 0x20 /* Power up */
#define VG468_TIMER_STATUS 0x40 /* Activity timer status */
#define VG468_TIMER_RES 0x80 /* Timer resolution */
#define VG468_TIMER_MASK 0x0f /* Activity timer timeout */
/* Flags for VG468_MISC */
#define VG468_MISC_GPIO 0x04 /* General-purpose IO */
#define VG468_MISC_DMAWSB 0x08 /* DMA wait state control */
#define VG469_MISC_LEDENA 0x10 /* LED enable */
#define VG468_MISC_VADEMREV 0x40 /* Vadem revision control */
#define VG468_MISC_UNLOCK 0x80 /* Unique register lock */
/* Flags for VG469_EXT_MODE_A */
#define VG469_MODE_VPPST 0x03 /* Vpp steering control */
#define VG469_MODE_INT_SENSE 0x04 /* Internal voltage sense */
#define VG469_MODE_CABLE 0x08
#define VG469_MODE_COMPAT 0x10 /* i82365sl B or DF step */
#define VG469_MODE_TEST 0x20
#define VG469_MODE_RIO 0x40 /* Steer RIO to INTR? */
/* Flags for VG469_EXT_MODE_B */
#define VG469_MODE_B_3V 0x01 /* 3.3v for socket B */
/* Data structure for tracking vendor-specific state */
typedef struct vg46x_state_t {
u_char ctl; /* VG468_CTL */
u_char ema; /* VG468_EXT_MODE_A */
} vg46x_state_t;
#endif /* _LINUX_VG468_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
#ifndef YYERRCODE
#define YYERRCODE 256
#endif
#define DEVICE 257
#define CARD 258
#define ANONYMOUS 259
#define TUPLE 260
#define MANFID 261
#define VERSION 262
#define FUNCTION 263
#define PCI 264
#define BIND 265
#define CIS 266
#define TO 267
#define NEEDS_MTD 268
#define MODULE 269
#define OPTS 270
#define CLASS 271
#define REGION 272
#define JEDEC 273
#define DTYPE 274
#define DEFAULT 275
#define MTD 276
#define INCLUDE 277
#define EXCLUDE 278
#define RESERVE 279
#define IRQ_NO 280
#define PORT 281
#define MEMORY 282
#define STRING 283
#define NUMBER 284
#define SOURCE 285
typedef union {
char *str;
u_long num;
struct device_info_t *device;
struct card_info_t *card;
struct mtd_ident_t *mtd;
struct adjust_list_t *adjust;
} YYSTYPE;
extern YYSTYPE yylval;

View File

@ -1,553 +0,0 @@
%{
/*
* yacc_config.y 1.57 2002/08/19 03:19:56
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License
* at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and
* limitations under the License.
*
* The initial developer of the original code is David A. Hinds
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License version 2 (the "GPL"), in
* which case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the GPL.
*/
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/types.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
#include "cardmgr.h"
/* If bison: generate nicer error messages */
#define YYERROR_VERBOSE 1
/* from lex_config, for nice error messages */
extern char *current_file;
extern int current_lineno;
void yyerror(char *msg, ...);
static int add_binding(card_info_t *card, char *name, char *class, int fn);
static int add_module(device_info_t *card, char *name);
%}
%token DEVICE CARD ANONYMOUS TUPLE MANFID VERSION FUNCTION PCI
%token BIND CIS TO NEEDS_MTD MODULE OPTS CLASS
%token REGION JEDEC DTYPE DEFAULT MTD
%token INCLUDE EXCLUDE RESERVE IRQ_NO PORT MEMORY
%token STRING NUMBER SOURCE
%union {
char *str;
u_long num;
struct device_info_t *device;
struct card_info_t *card;
struct mtd_ident_t *mtd;
struct adjust_list_t *adjust;
}
%type <str> STRING
%type <num> NUMBER
%type <adjust> adjust resource
%type <device> device needs_mtd module class
%type <card> card anonymous tuple manfid pci version function bind cis
%type <mtd> region jedec dtype default mtd
%%
list: /* nothing */
| list adjust
{
adjust_list_t **tail = &root_adjust;
while (*tail != NULL) tail = &(*tail)->next;
*tail = $2;
}
| list device
{
$2->next = root_device;
root_device = $2;
}
| list mtd
{
if ($2->mtd_type == 0) {
yyerror("no ID method for '%s'", $2->name);
YYERROR;
}
if ($2->module == NULL) {
yyerror("no MTD module for '%s'", $2->name);
YYERROR;
}
$2->next = root_mtd;
root_mtd = $2;
}
| list card
{
if ($2->ident_type == 0) {
yyerror("no ID method for '%s'", $2->name);
YYERROR;
}
if ($2->bindings == 0) {
yyerror("no driver bindings for '%s'", $2->name);
YYERROR;
}
if ($2->ident_type == FUNC_IDENT) {
$2->next = root_func;
root_func = $2;
} else {
$2->next = root_card;
root_card = $2;
}
}
| list opts
| list mtd_opts
| list SOURCE
| list error
;
adjust: INCLUDE resource
{
$2->adj.Action = ADD_MANAGED_RESOURCE;
$$ = $2;
}
| EXCLUDE resource
{
$2->adj.Action = REMOVE_MANAGED_RESOURCE;
$$ = $2;
}
| RESERVE resource
{
$2->adj.Action = ADD_MANAGED_RESOURCE;
$2->adj.Attributes |= RES_RESERVED;
$$ = $2;
}
| adjust ',' resource
{
$3->adj.Action = $1->adj.Action;
$3->adj.Attributes = $1->adj.Attributes;
$3->next = $1;
$$ = $3;
}
;
resource: IRQ_NO NUMBER
{
$$ = calloc(sizeof(adjust_list_t), 1);
$$->adj.Resource = RES_IRQ;
$$->adj.resource.irq.IRQ = $2;
}
| PORT NUMBER '-' NUMBER
{
if (($4 < $2) || ($4 > 0xffff)) {
yyerror("invalid port range 0x%x-0x%x", $2, $4);
YYERROR;
}
$$ = calloc(sizeof(adjust_list_t), 1);
$$->adj.Resource = RES_IO_RANGE;
$$->adj.resource.io.BasePort = $2;
$$->adj.resource.io.NumPorts = $4 - $2 + 1;
}
| MEMORY NUMBER '-' NUMBER
{
if ($4 < $2) {
yyerror("invalid address range 0x%x-0x%x", $2, $4);
YYERROR;
}
$$ = calloc(sizeof(adjust_list_t), 1);
$$->adj.Resource = RES_MEMORY_RANGE;
$$->adj.resource.memory.Base = $2;
$$->adj.resource.memory.Size = $4 - $2 + 1;
}
;
device: DEVICE STRING
{
$$ = calloc(sizeof(device_info_t), 1);
$$->refs = 1;
strcpy($$->dev_info, $2);
free($2);
}
| needs_mtd
| module
| class
;
card: CARD STRING
{
$$ = calloc(sizeof(card_info_t), 1);
$$->refs = 1;
$$->name = $2;
}
| anonymous
| tuple
| manfid
| pci
| version
| function
| bind
| cis
;
anonymous: card ANONYMOUS
{
if ($1->ident_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
if (blank_card) {
yyerror("Anonymous card already defined");
YYERROR;
}
$1->ident_type = BLANK_IDENT;
blank_card = $1;
}
;
tuple: card TUPLE NUMBER ',' NUMBER ',' STRING
{
if ($1->ident_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->ident_type = TUPLE_IDENT;
$1->id.tuple.code = $3;
$1->id.tuple.ofs = $5;
$1->id.tuple.info = $7;
}
;
manfid: card MANFID NUMBER ',' NUMBER
{
if ($1->ident_type & (EXCL_IDENT|MANFID_IDENT)) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->ident_type |= MANFID_IDENT;
$1->manfid.manf = $3;
$1->manfid.card = $5;
}
pci: card PCI NUMBER ',' NUMBER
{
if ($1->ident_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->ident_type = PCI_IDENT;
$1->manfid.manf = $3;
$1->manfid.card = $5;
}
version: card VERSION STRING
{
if ($1->ident_type & (EXCL_IDENT|VERS_1_IDENT)) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->ident_type |= VERS_1_IDENT;
$1->id.vers.ns = 1;
$1->id.vers.pi[0] = $3;
}
| version ',' STRING
{
if ($1->id.vers.ns == 4) {
yyerror("too many version strings for '%s'", $1->name);
YYERROR;
}
$1->id.vers.pi[$1->id.vers.ns] = $3;
$1->id.vers.ns++;
}
;
function: card FUNCTION NUMBER
{
if ($1->ident_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->ident_type = FUNC_IDENT;
$1->id.func.funcid = $3;
}
;
cis: card CIS STRING
{ $1->cis_file = strdup($3); }
;
bind: card BIND STRING
{
if (add_binding($1, $3, NULL, 0) != 0)
YYERROR;
}
| card BIND STRING CLASS STRING
{
if (add_binding($1, $3, $5, 0) != 0)
YYERROR;
}
| card BIND STRING TO NUMBER
{
if (add_binding($1, $3, NULL, $5) != 0)
YYERROR;
}
| card BIND STRING CLASS STRING TO NUMBER
{
if (add_binding($1, $3, $5, $7) != 0)
YYERROR;
}
| bind ',' STRING
{
if (add_binding($1, $3, NULL, 0) != 0)
YYERROR;
}
| bind ',' STRING CLASS STRING
{
if (add_binding($1, $3, $5, 0) != 0)
YYERROR;
}
| bind ',' STRING TO NUMBER
{
if (add_binding($1, $3, NULL, $5) != 0)
YYERROR;
}
| bind ',' STRING CLASS STRING TO NUMBER
{
if (add_binding($1, $3, $5, $7) != 0)
YYERROR;
}
;
needs_mtd: device NEEDS_MTD
{
$1->needs_mtd = 1;
}
;
opts: MODULE STRING OPTS STRING
{
device_info_t *d;
int i, found = 0;
for (d = root_device; d; d = d->next) {
for (i = 0; i < d->modules; i++)
if (strcmp($2, d->module[i]) == 0) break;
if (i < d->modules) {
if (d->opts[i])
free(d->opts[i]);
d->opts[i] = strdup($4);
found = 1;
}
}
free($2); free($4);
if (!found) {
yyerror("module name '%s' not found", $2);
YYERROR;
}
}
;
module: device MODULE STRING
{
if (add_module($1, $3) != 0)
YYERROR;
}
| module OPTS STRING
{
if ($1->opts[$1->modules-1] == NULL) {
$1->opts[$1->modules-1] = $3;
} else {
yyerror("too many module options for '%s'",
$1->module[$1->modules-1]);
YYERROR;
}
}
| module ',' STRING
{
if (add_module($1, $3) != 0)
YYERROR;
}
;
class: device CLASS STRING
{
if ($1->class != NULL) {
yyerror("extra class string '%s'", $3);
YYERROR;
}
$1->class = $3;
}
;
region: REGION STRING
{
$$ = calloc(sizeof(mtd_ident_t), 1);
$$->refs = 1;
$$->name = $2;
}
| dtype
| jedec
| default
;
dtype: region DTYPE NUMBER
{
if ($1->mtd_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->mtd_type = DTYPE_MTD;
$1->dtype = $3;
}
;
jedec: region JEDEC NUMBER NUMBER
{
if ($1->mtd_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
$1->mtd_type = JEDEC_MTD;
$1->jedec_mfr = $3;
$1->jedec_info = $4;
}
;
default: region DEFAULT
{
if ($1->mtd_type) {
yyerror("ID method already defined for '%s'", $1->name);
YYERROR;
}
if (default_mtd) {
yyerror("Default MTD already defined");
YYERROR;
}
$1->mtd_type = DEFAULT_MTD;
default_mtd = $1;
}
;
mtd: region MTD STRING
{
if ($1->module != NULL) {
yyerror("extra MTD entry for '%s'", $1->name);
YYERROR;
}
$1->module = $3;
}
| mtd OPTS STRING
{
if ($1->opts == NULL) {
$1->opts = $3;
} else {
yyerror("too many module options for '%s'", $1->module);
YYERROR;
}
}
;
mtd_opts: MTD STRING OPTS STRING
{
mtd_ident_t *m;
int found = 0;
for (m = root_mtd; m; m = m->next)
if (strcmp($2, m->module) == 0) break;
if (m) {
if (m->opts) free(m->opts);
m->opts = strdup($4);
found = 1;
}
free($2); free($4);
if (!found) {
yyerror("MTD name '%s' not found", $2);
YYERROR;
}
}
;
%%
void yyerror(char *msg, ...)
{
va_list ap;
char str[256];
va_start(ap, msg);
sprintf(str, "error in file '%s' line %d: ",
current_file, current_lineno);
vsprintf(str+strlen(str), msg, ap);
#if YYDEBUG
fprintf(stderr, "%s\n", str);
#else
syslog(LOG_ERR, "%s", str);
#endif
va_end(ap);
}
static int add_binding(card_info_t *card, char *name, char *class, int fn)
{
device_info_t *dev = root_device;
if (card->bindings == MAX_BINDINGS) {
yyerror("too many bindings\n");
return -1;
}
for (; dev; dev = dev->next)
if (strcmp((char *)dev->dev_info, name) == 0) break;
if (dev == NULL) {
yyerror("unknown device '%s'", name);
return -1;
}
card->device[card->bindings] = dev;
card->dev_fn[card->bindings] = fn;
if (class)
card->class[card->bindings] = strdup(class);
card->bindings++;
free(name);
return 0;
}
static int add_module(device_info_t *dev, char *name)
{
if (dev->modules == MAX_MODULES) {
yyerror("too many modules for '%s'", dev->dev_info);
return -1;
}
dev->module[dev->modules] = name;
dev->opts[dev->modules] = NULL;
dev->modules++;
return 0;
}
#if YYDEBUG
adjust_list_t *root_adjust = NULL;
device_info_t *root_device = NULL;
card_info_t *root_card = NULL, *blank_card = NULL, *root_func = NULL;
mtd_ident_t *root_mtd = NULL, *default_mtd = NULL;
void main(int argc, char *argv[])
{
yydebug = 1;
if (argc > 1)
parse_configfile(argv[1]);
}
#endif

128
probing.c
View File

@ -127,13 +127,17 @@ static void probe_that_type(enum driver_type type)
return;
}
/* ---- PCI probe ---------------------------------------------- */
{
FILE * f;
int len = 0;
int n, len = 0;
char buf[200];
char devname[22];
u_int8_t devdata[48];
struct pci_module_map * pcidb = NULL;
#ifdef ENABLE_USB
static int need_usb_hcd[HCD_NUM];
#endif
switch (type) {
#ifndef DISABLE_MEDIAS
@ -159,22 +163,40 @@ static void probe_that_type(enum driver_type type)
default:
goto end_pci_probe;
}
if (!(f = fopen("/proc/bus/pci/devices", "rb"))) {
log_message("PCI: could not open proc file");
goto end_pci_probe;
}
log_message("PCI: XXX probing %d XXX", type);
while (1) {
int i, garb, vendor, device;
int i, j, dfn, vendor, device, class, subv, subid;
if (!fgets(buf, sizeof(buf), f)) break;
sscanf(buf, "%x %x", &garb, &vendor);
sscanf(buf, "%x %x", &dfn, &vendor);
device = vendor & 0xFFFF; /* because scanf from dietlibc does not support %4f */
vendor = (vendor >> 16) & 0xFFFF;
log_message("found pci device: %04x %04x", vendor, device);
snprintf(devname, sizeof(devname), "/proc/bus/pci/%02x/%02x.%x",
dfn >> 8, PCI_SLOT(dfn & 0xff), PCI_FUNC(dfn & 0xff));
log_message("gathering info for %s", devname);
if ((i = open(devname, O_RDONLY)) != -1) {
read(i, devdata, sizeof(devdata));
close(i);
} else continue;
class = devdata[9] | (devdata[10] << 8) | (devdata[11] << 16);
subv = devdata[0x2c] | (devdata[0x2d] << 8);
subid = devdata[0x2e] | (devdata[0x2f] << 8);
log_message("found pci device: %04x %04x %06x %04x %04x",
vendor, device, class, subv, subid);
for (i = 0; i < len; i++) {
if (pcidb[i].vendor == vendor && pcidb[i].device == device) {
log_message("module is \"%s\" (%s)", pcidb[i].name, pcidb[i].module);
@ -191,9 +213,8 @@ static void probe_that_type(enum driver_type type)
if (wait_msg)
remove_wait_message();
warning_insmod_failed(failed);
}
#endif
#endif /* DISABLE_MEDIAS */
#ifndef DISABLE_NETWORK
if (type == NETWORK_DEVICES) {
stg1_info_message("About to load driver for network device:\n \n%s", pcidb[i].name);
@ -202,19 +223,53 @@ static void probe_that_type(enum driver_type type)
if (intf_descr_for_discover) /* for modules providing more than one net intf */
net_discovered_interface(NULL);
}
#endif
#endif /* DISABLE_NETWORK */
#ifdef ENABLE_USB
if (type == USB_CONTROLLERS)
my_insmod(pcidb[i].module, USB_CONTROLLERS, NULL);
#endif
if (type == USB_CONTROLLERS) {
/* found explicitly declared module */
for (j=0; j < HCD_NUM; j++) {
if(ptr_begins_static_str(pcidb[i].module, usb_hcd[j])) {
log_message("found explicit %s", usb_hcd[j]);
need_usb_hcd[j] = 1;
break;
}
}
}
#endif /* ENABLE_USB */
} /* vendor & device matched */
#ifdef ENABLE_USB
else {
/* no module found, trying to identify one by class:
HCD: PCI Class:
uhci-hcd 0x000c0300
ohci-hcd 0x000c0310
ehci-hcd 0x000c0320
*/
if (type == USB_CONTROLLERS && (class & 0xffff0f) == 0x0c0300) {
log_message("found by class %s", usb_hcd[(class & 0xf0)>>4]);
need_usb_hcd[(class & 0xf0)>>4] = 1;
}
}
#endif /* ENABLE_USB */
} /* end of this vendor & device */
} /* end of pci device list */
fclose(f);
#ifdef ENABLE_USB
/* load all usb controller modules now, starting from possible ehci-hcd */
/* to prevent case when old-timed module sitting on newer host controller */
if (type == USB_CONTROLLERS) {
for (n=HCD_NUM-1; n; n--) {
if (need_usb_hcd[n]) {
stg1_info_message("About to load driver for usb controller: %s", usb_hcd[n]);
my_insmod(usb_hcd[n], USB_CONTROLLERS, NULL);
}
}
}
fclose(f);
#endif
end_pci_probe:
}
#ifdef ENABLE_USB
/* ---- USB probe ---------------------------------------------- */
{
@ -229,19 +284,27 @@ static void probe_that_type(enum driver_type type)
switch (type) {
#ifdef ENABLE_USBNET
case NETWORK_DEVICES:
usbdb = usbnet_usb_ids;
len = usbnet_usb_num_ids;
/*
usbdb = usbnet_usb_ids;
len = usbnet_usb_num_ids;
*/
break;
#endif
case SCSI_ADAPTERS:
/*
usbdb = usbstorage_usb_ids;
len = usbstorage_usb_num_ids;
*/
break;
default:
goto end_usb_probe;
}
if (!already_probed_usb_controllers) {
already_probed_usb_controllers = 1;
probe_that_type(USB_CONTROLLERS);
probe_that_type(USB_CONTROLLERS);
}
if (!already_mounted_usbdev) {
already_mounted_usbdev = 1;
if (mount("/proc/bus/usb", "/proc/bus/usb", "usbdevfs", 0, NULL)) {
@ -253,6 +316,12 @@ static void probe_that_type(enum driver_type type)
remove_wait_message();
}
/* dirty hack */
if (type == SCSI_ADAPTERS) {
stg1_info_message("About to load driver for usb storage device: usb-storage");
my_insmod("usb-storage", ANY_DRIVER_TYPE, NULL);
}
if (!(f = fopen("/proc/bus/usb/devices", "rb"))) {
log_message("USB: could not open proc file");
goto end_usb_probe;
@ -283,7 +352,6 @@ static void probe_that_type(enum driver_type type)
net_discovered_interface(NULL);
}
#endif
}
}
}
@ -299,23 +367,24 @@ static struct media_info * medias = NULL;
static void find_media(void)
{
char b[50];
char b[50];
char buf[5000];
struct media_info tmp[50];
int count;
int fd;
int fd;
if (!medias)
if (!medias) {
probe_that_type(SCSI_ADAPTERS);
}
else
free(medias); /* that does not free the strings, by the way */
/* ----------------------------------------------- */
log_message("looking for ide media");
count = 0;
strcpy(b, "/proc/ide/hd");
for (b[12] = 'a'; b[12] <= 'h'; b[12]++) {
count = 0;
strcpy(b, "/proc/ide/hd");
for (b[12] = 'a'; b[12] <= 'h'; b[12]++) {
int i;
char ide_disk[] = "disk";
char ide_cdrom[] = "cdrom";
@ -378,7 +447,7 @@ static void find_media(void)
log_message("IDE/%d: %s is a %s", tmp[count].type, tmp[count].name, tmp[count].model);
count++;
}
}
/* ----------------------------------------------- */
@ -604,7 +673,8 @@ void get_medias(enum media_type media, char *** names, char *** models)
#ifndef DISABLE_NETWORK
int net_device_available(char * device) {
int net_device_available(char * device)
{
struct ifreq req;
int s;

View File

@ -32,5 +32,12 @@ void net_discovered_interface(char * intf_name);
char * get_net_intf_description(char * intf_name);
void prepare_intf_descr(const char * intf_descr);
#ifndef PCI_SLOT
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
#endif
#ifndef PCI_FUNC
#define PCI_FUNC(devfn) ((devfn) & 0x07)
#endif
#endif

39
propagator.spec Normal file
View File

@ -0,0 +1,39 @@
# -*- rpm-spec -*-
# $Id$
# some machinery to fix exact kernel modules version
%define bundlename %(rpmquery --whatprovides kernel-modules-bundle --qf '%%{name}' 2> /dev/null)
%define bundlereq %(rpmquery --qf '%%{name} = %%|serial?{%%{serial}:}|%%{version}-%%{release}' %bundlename 2>/dev/null)
Name: propagator
Version: 20041112
Release: alt0.1
Summary: Installer's first stage
License: GPL
Group: System/Kernel and hardware
Source0: %name-%version.tar.bz2
Requires: %bundlereq
BuildRequires: kernel-modules-bundle
%description
%name is a set of binaries useful in 'early userspace' environment,
including init and various helpers for hw probing and bootstrapping.
%prep
%setup -qc
%build
%__make
%install
%make_install DESTDIR=%buildroot install
%files
%_libdir/%name
%changelog
* Fri Nov 12 2004 Sergey Bolshakov <sbolshakov@altlinux.ru> 20041112-alt0.1
- Initial build.

Binary file not shown.

Binary file not shown.

View File

@ -67,9 +67,9 @@
/************************************************************
* globals */
char version[128] = DISTRIB_NAME;
char * method_name;
void fatal_error(char *msg)
{
printf("FATAL ERROR IN STAGE1: %s\n\nI can't recover from this.\nYou may reboot your system.\n", msg);
@ -355,6 +355,18 @@ static enum return_type method_select_and_prepare(void)
return RETURN_OK;
}
void getversion()
{
FILE *f;
char *c;
if (!(f = fopen(VERSION_FILE, "r"))) return;
if (fgets(version, sizeof(version), f)) {
c = strrchr(version, '\n');
if (c) *c = 0;
}
fclose(f);
}
int main(int argc, char **argv, char **env)
{
@ -362,16 +374,19 @@ int main(int argc, char **argv, char **env)
char ** argptr;
char * stage2_args[30];
char * pcmcia_adapter = NULL;
char buf[128];
spawn_interactive();
open_log();
log_message("welcome to the " DISTRIB_NAME " install (alt-stage1, built " __DATE__ " " __TIME__")");
getversion();
log_message("welcome to the %s install (alt-stage1, built " __DATE__ " " __TIME__")", version);
process_cmdline();
handle_env(env);
spawn_shell();
init_modules_insmoding();
init_frontend("Welcome to " DISTRIB_NAME __DATE__ " " __TIME__);
snprintf(buf, sizeof(buf), "Welcome to %s " __DATE__ " " __TIME__, version);
init_frontend(buf);
if (IS_EXPERT)
expert_third_party_modules();

View File

@ -15,11 +15,12 @@
#
#*****************************************************************************
VPATH = $(MODDIR)
all: usb-ids.h
usb-ids.h: /usr/share/ldetect-lst/usbtable update-usb-ids.pl
perl update-usb-ids.pl > $@ || rm -f $@
usb-ids.h: medias/modules.mar network/modules.mar update-usb-ids.sh
./update-usb-ids.sh $^ > $@ || rm -f $@
clean:
rm -f usb-ids.h

View File

@ -1,73 +0,0 @@
#!/usr/bin/perl
sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l }
-x "../mar/mar" or die "\t*FAILED* Sorry, need ../mar/mar binary\n";
my @usbtable_tmp = cat_("/usr/share/ldetect-lst/usbtable");
my @usbtable;
foreach (@usbtable_tmp) {
next if /\s*#/;
/\s*(\S+)\s+(\S+)\s+"(\S+)"\s+"([^"]*)"/ or next;
push @usbtable, { 'vendor' => $1, 'id' => $2, 'module' => $3, 'description' => $4 };
}
print '
struct usb_module_map {
unsigned short vendor; /* vendor */
unsigned short id; /* device */
const char *name; /* human readable name */
const char *module; /* module to load */
};
';
print "#ifdef ENABLE_USB
struct pci_module_map usb_pci_ids[] = {
";
require '/usr/bin/merge2pcitable.pl';
my $drivers = read_pcitable("/usr/share/ldetect-lst/pcitable");
while (my ($k, $v) = each %$drivers) {
$v->[0] =~ /^usb-/ or next;
$k =~ /^(....)(....)/;
printf qq|\t{ 0x%s, 0x%s, "", "%s" },\n|,
$1, $2, $v->[0];
}
print "};
int usb_num_ids=sizeof(usb_pci_ids)/sizeof(struct pci_module_map);
#endif
";
my @t = ('usbnet');
foreach $type (@t) {
my $modulez;
foreach (glob("../../all.modules/*/${type}_modules.mar")) {
-f $_ or die "\t*FAILED* Sorry, need $_ mar file\n";
push @$modulez, (`../mar/mar -l $_`);
}
print "#ifdef ENABLE_".uc($type)."
struct usb_module_map ${type}_usb_ids[] = {
";
foreach my $usbentry (@usbtable) {
grep(/^\t$usbentry->{'module'}\.o\s/, @$modulez) or next;
printf qq|\t{ %s, %s, "%s", "%s" },\n|,
$usbentry->{'vendor'}, $usbentry->{'id'}, $usbentry->{'description'}, $usbentry->{'module'};
}
print "};
int ${type}_usb_num_ids=sizeof(${type}_usb_ids)/sizeof(struct usb_module_map);
#endif
";
}

76
usb-resource/update-usb-ids.sh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/sh -e
MODLIST=
MODHDR=
[ -x /usr/bin/getpciids ]
###############################################################################
# HCD: PCI Class:
# uhci-hcd 0x000c0300
# ohci-hcd 0x000c0310
# ehci-hcd 0x000c0320
###############################################################################
HCDS="uhci-hcd ohci-hcd ehci-hcd"
exit_handler()
{
local rc=$?
trap - EXIT
[ -z "$MODLIST" ] || rm -f -- "$MODLIST"
[ -z "$MODHDR" ] || rm -f -- "$MODHDR"
exit $rc
}
write_decls()
{
cat <<E_O_F
struct usb_module_map {
unsigned short vendor; /* vendor */
unsigned short id; /* device */
const char *name; /* human readable name */
const char *module; /* module to load */
};
#ifndef DISABLE_USB
char *usb_hcd[] = {
E_O_F
> "$MODLIST"
for hcd in `echo $HCDS`; do
echo $hcd >> "$MODLIST"
printf '\t"%s",\n' $hcd
done
cat <<E_O_F
};
#define HCD_NUM (sizeof(usb_hcd) / sizeof(char *))
struct pci_module_map usb_pci_ids[] = {
E_O_F
getpciids -f "$MODLIST" |\
while read vendor device subv subd module; do
[ -n "$module" ] || module="$subv"
echo $module $vendor $device
done |sort -u |while read module vendor device; do
printf '\t{ 0x%s, 0x%s, "%s", "%s" },\n' $vendor $device "" $module
done
cat <<E_O_F
};
int usb_num_ids = sizeof(usb_pci_ids) / sizeof(struct pci_module_map);
#endif /* DISABLE_USB */
E_O_F
}
trap exit_handler SIGHUP SIGPIPE SIGINT SIGTERM SIGQUIT EXIT
MODLIST=`mktemp -t modlist.XXXXXXXXXX`
MODHDR=`mktemp -t modhdr.XXXXXXXXXX`
write_decls > "$MODHDR"
cat "$MODHDR"