summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-01-24 23:33:40 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-01-24 23:33:40 +0000
commit3a0c5648e3c0a691e285a4ae1003cb6e06a19df1 (patch)
treef30320b72d576dfcdab1e48da2e44a910185ac87 /mdk-stage1
parente723e8a329c96201c01e5f8b7621e462042bb9e3 (diff)
downloaddrakx-3a0c5648e3c0a691e285a4ae1003cb6e06a19df1.tar
drakx-3a0c5648e3c0a691e285a4ae1003cb6e06a19df1.tar.gz
drakx-3a0c5648e3c0a691e285a4ae1003cb6e06a19df1.tar.bz2
drakx-3a0c5648e3c0a691e285a4ae1003cb6e06a19df1.tar.xz
drakx-3a0c5648e3c0a691e285a4ae1003cb6e06a19df1.zip
stage1: add pcmcia
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/Makefile33
-rw-r--r--mdk-stage1/pcmcia/Makefile34
-rw-r--r--mdk-stage1/pcmcia/bulkmem.h195
-rw-r--r--mdk-stage1/pcmcia/cardmgr.c805
-rw-r--r--mdk-stage1/pcmcia/cardmgr.h107
-rw-r--r--mdk-stage1/pcmcia/cirrus.h182
-rw-r--r--mdk-stage1/pcmcia/cistpl.h604
-rw-r--r--mdk-stage1/pcmcia/config.h59
-rw-r--r--mdk-stage1/pcmcia/cs.h464
-rw-r--r--mdk-stage1/pcmcia/cs_types.h65
-rw-r--r--mdk-stage1/pcmcia/driver_ops.h82
-rw-r--r--mdk-stage1/pcmcia/ds.h163
-rw-r--r--mdk-stage1/pcmcia/i82365.h154
-rw-r--r--mdk-stage1/pcmcia/lex_config.c2008
-rw-r--r--mdk-stage1/pcmcia/pcmcia.h21
-rw-r--r--mdk-stage1/pcmcia/pcmcia_probe.c396
-rw-r--r--mdk-stage1/pcmcia/tcic.h266
-rw-r--r--mdk-stage1/pcmcia/version.h4
-rw-r--r--mdk-stage1/pcmcia/vg468.h112
-rw-r--r--mdk-stage1/pcmcia/yacc_config.c1017
-rw-r--r--mdk-stage1/pcmcia/yacc_config.h37
-rw-r--r--mdk-stage1/stage1.c27
22 files changed, 6813 insertions, 22 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile
index 2aeee3990..efb7440a9 100644
--- a/mdk-stage1/Makefile
+++ b/mdk-stage1/Makefile
@@ -118,23 +118,16 @@ endif
BINS = init stage1-cdrom stage1-disk stage1-network stage1-full
-#ifeq (i386, $(ARCH))
-#BINS += stage1-all stage1-cdrom stage1-network stage1-hd stage1-pcmcia
-#endif
-#
-#ifeq (ia64, $(ARCH))
-#BINS += stage1-all
-#endif
-#
-#ifeq (alpha, $(ARCH))
-#BINS += stage1-all
-#endif
-#
-#ifeq (sparc, $(ARCH))
-#BINS += stage1-all
-#endif
-
DIRS = dietlibc mar insmod-busybox pci-resource
+ifeq (i386,$(ARCH))
+DIRS += pcmcia
+endif
+
+
+ifeq (i386,$(ARCH))
+PCMCIA_LIB = pcmcia/libpcmcia.a
+PCMCIA_DEFS = -DENABLE_PCMCIA
+endif
all: dirs $(BINS)
@@ -160,11 +153,7 @@ stage1-network: $(STAGE1OBJS-NETWORK) $(GLIBC_STAGE1_OWN_LIBS) $(STAGE1_OTHER_LI
$(CC) $(GLIBC_LDFLAGS_STAGE1) -o $@ $^
$(STRIPCMD) $@
-stage1-pcmcia: $(STAGE1OBJS-PCMCIA) $(GLIBC_STAGE1_OWN_LIBS) $(STAGE1_OTHER_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-stage1-full: $(STAGE1OBJS) $(GLIBC_STAGE1_OWN_LIBS) $(STAGE1_OTHER_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK)
+stage1-full: $(STAGE1OBJS) $(GLIBC_STAGE1_OWN_LIBS) $(STAGE1_OTHER_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(PCMCIA_LIB)
$(CC) $(GLIBC_LDFLAGS_STAGE1) -o $@ $^
$(STRIPCMD) $@
@@ -179,7 +168,7 @@ $(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c .depend
$(COMPILE) $(GLIBC_INCLUDES) $(NETWORK_DEFS) -c $< -o $@
.c.o: .depend
- $(COMPILE) $(GLIBC_INCLUDES) -c $<
+ $(COMPILE) $(GLIBC_INCLUDES) $(PCMCIA_DEFS) -c $<
clean:
diff --git a/mdk-stage1/pcmcia/Makefile b/mdk-stage1/pcmcia/Makefile
new file mode 100644
index 000000000..e2e670146
--- /dev/null
+++ b/mdk-stage1/pcmcia/Makefile
@@ -0,0 +1,34 @@
+ #******************************************************************************
+ #
+ # 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
+
+clean:
+ rm -f *.o libpcmcia.a
+
+FLAGS = -Wall -Werror -Os -fomit-frame-pointer -pipe -c -I..
+
+libpcmcia.a: pcmcia_probe.o cardmgr.o lex_config.o yacc_config.o
+ ar -cru $@ $^
+ ranlib $@
+
+.c.o:
+ gcc $(FLAGS) $(GLIBC_INCLUDES) $<
+
diff --git a/mdk-stage1/pcmcia/bulkmem.h b/mdk-stage1/pcmcia/bulkmem.h
new file mode 100644
index 000000000..1b0bcbd1e
--- /dev/null
+++ b/mdk-stage1/pcmcia/bulkmem.h
@@ -0,0 +1,195 @@
+/*
+ * Definitions for bulk memory services
+ *
+ * bulkmem.h 1.12 2000/06/12 21:55:41
+ *
+ * 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.
+ * 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 */
diff --git a/mdk-stage1/pcmcia/cardmgr.c b/mdk-stage1/pcmcia/cardmgr.c
new file mode 100644
index 000000000..1899d04b8
--- /dev/null
+++ b/mdk-stage1/pcmcia/cardmgr.c
@@ -0,0 +1,805 @@
+/*
+ * 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.
+ *
+ */
+
+/* Code comes from /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-3.1.23.tar.bz2
+ *
+ * Licence of this code follows:
+
+ PCMCIA Card Manager daemon
+
+ cardmgr.c 1.150 2000/12/14 17:12: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 <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/utsname.h>
+#include <sys/file.h>
+
+#include <pcmcia/version.h>
+#include <pcmcia/config.h>
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/ds.h>
+
+#include "../log.h"
+#include "modules.h"
+
+#include "cardmgr.h"
+#include "pcmcia.h"
+
+/*====================================================================*/
+
+typedef struct socket_info_t {
+ int fd;
+ int state;
+ card_info_t *card;
+ bind_info_t *bind[MAX_BINDINGS];
+ mtd_ident_t *mtd[2*CISTPL_MAX_DEVICES];
+} socket_info_t;
+
+#define SOCKET_PRESENT 0x01
+#define SOCKET_READY 0x02
+#define SOCKET_BOUND 0x04
+
+/* Linked list of resource adjustments */
+struct adjust_list_t *root_adjust = NULL;
+
+/* Linked list of device definitions */
+struct device_info_t *root_device = NULL;
+
+/* Special pointer to "anonymous" card definition */
+struct card_info_t *blank_card = NULL;
+
+/* Linked list of card definitions */
+struct card_info_t *root_card = NULL;
+
+/* Linked list of function definitions */
+struct card_info_t *root_func = NULL;
+
+/* Linked list of MTD definitions */
+struct mtd_ident_t *root_mtd = NULL;
+
+/* Default MTD */
+struct mtd_ident_t *default_mtd = NULL;
+
+static int sockets;
+static struct socket_info_t socket[MAX_SOCKS];
+
+static char *configpath = "/etc/pcmcia";
+
+/* Default path for socket info table */
+static char *stabfile;
+
+/*====================================================================*/
+
+static int major = 0;
+
+static int lookup_dev(char *name)
+{
+ FILE *f;
+ int n;
+ char s[32], t[32];
+
+ f = fopen("/proc/devices", "r");
+ if (f == NULL)
+ return -errno;
+ while (fgets(s, 32, f) != NULL) {
+ if (sscanf(s, "%d %s", &n, t) == 2)
+ if (strcmp(name, t) == 0)
+ break;
+ }
+ fclose(f);
+ if (strcmp(name, t) == 0)
+ return n;
+ else
+ return -ENODEV;
+}
+
+static int open_dev(dev_t dev, int mode)
+{
+ char *fn;
+ int fd;
+ if ((fn = tmpnam(NULL)) == NULL)
+ return -1;
+ if (mknod(fn, mode, dev) != 0)
+ return -1;
+ fd = open(fn, (mode&S_IWRITE) ? O_RDWR : O_RDONLY);
+ if (fd < 0)
+ fd = open(fn, O_NONBLOCK|((mode&S_IWRITE) ? O_RDWR : O_RDONLY));
+ unlink(fn);
+ return fd;
+}
+
+static int open_sock(int sock, int mode)
+{
+ dev_t dev = (major<<8) + sock;
+ return open_dev(dev, mode);
+}
+
+/*======================================================================
+
+ xlate_scsi_name() is a sort-of-hack used to deduce the minor
+ device numbers of SCSI devices, from the information available to
+ the low-level driver.
+
+======================================================================*/
+
+
+#include <linux/major.h>
+#include <scsi/scsi.h>
+
+static int xlate_scsi_name(bind_info_t *bind)
+{
+ int i, fd, mode, minor;
+ u_long arg[2], id1, id2;
+
+ id1 = strtol(bind->name+3, NULL, 16);
+ if ((bind->major == SCSI_DISK0_MAJOR) ||
+ (bind->major == SCSI_CDROM_MAJOR))
+ mode = S_IREAD|S_IFBLK;
+ else
+ mode = S_IREAD|S_IFCHR;
+
+ for (i = 0; i < 16; i++) {
+ minor = (bind->major == SCSI_DISK0_MAJOR) ? (i<<4) : i;
+ fd = open_dev((bind->major<<8)+minor, mode);
+ if (fd < 0)
+ continue;
+ if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, arg) == 0) {
+ id2 = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) +
+ ((arg[0]>>8)&0xf00) + ((arg[0]>>12)&0xf000);
+ if (id1 == id2) {
+ close(fd);
+ switch (bind->major) {
+ case SCSI_DISK0_MAJOR:
+ case SCSI_GENERIC_MAJOR:
+ sprintf(bind->name+2, "%c", 'a'+i); break;
+ case SCSI_CDROM_MAJOR:
+ sprintf(bind->name, "scd%d", i); break;
+ case SCSI_TAPE_MAJOR:
+ sprintf(bind->name+2, "%d", i); break;
+ }
+ bind->minor = minor;
+ return 0;
+ }
+ }
+ close(fd);
+ }
+ return -1;
+}
+
+
+/*====================================================================*/
+
+static void write_stab(void)
+{
+ int i, j, k;
+ FILE *f;
+ socket_info_t *s;
+ bind_info_t *bind;
+
+ f = fopen(stabfile, "w");
+ if (f == NULL) {
+ log_message("CM: fopen(stabfile) failed: %m");
+ return;
+ }
+ if (flock(fileno(f), LOCK_EX) != 0) {
+ log_message("CM: flock(stabfile) failed: %m");
+ return;
+ }
+ for (i = 0; i < sockets; i++) {
+ s = &socket[i];
+ if (!(s->state & SOCKET_PRESENT))
+ fprintf(f, "Socket %d: empty\n", i);
+ else if (!s->card)
+ fprintf(f, "Socket %d: unsupported card\n", i);
+ else {
+ fprintf(f, "Socket %d: %s\n", i, s->card->name);
+ for (j = 0; j < s->card->bindings; j++)
+ for (k = 0, bind = s->bind[j];
+ bind != NULL;
+ k++, bind = bind->next) {
+ char *class = s->card->device[j]->class;
+ fprintf(f, "%d\t%s\t%s\t%d\t%s",
+ i, (class ? class : "none"),
+ bind->dev_info, k, bind->name);
+ if (bind->major)
+ fprintf(f, "\t%d\t%d\n",
+ bind->major, bind->minor);
+ else
+ fputc('\n', f);
+ }
+ }
+ }
+ fflush(f);
+ fclose(f);
+}
+
+/*====================================================================*/
+
+static int get_tuple(int ns, cisdata_t code, ds_ioctl_arg_t *arg)
+{
+ socket_info_t *s = &socket[ns];
+
+ arg->tuple.DesiredTuple = code;
+ arg->tuple.Attributes = 0;
+ if (ioctl(s->fd, DS_GET_FIRST_TUPLE, arg) != 0)
+ return -1;
+ arg->tuple.TupleOffset = 0;
+ if (ioctl(s->fd, DS_GET_TUPLE_DATA, arg) != 0) {
+ log_message("CM: error reading CIS data on socket %d: %m", ns);
+ return -1;
+ }
+ if (ioctl(s->fd, DS_PARSE_TUPLE, arg) != 0) {
+ log_message("CM: error parsing CIS on socket %d: %m", ns);
+ return -1;
+ }
+ return 0;
+}
+
+/*====================================================================*/
+
+typedef struct {
+ u_short vendor, device;
+} pci_id_t;
+
+
+static card_info_t *lookup_card(int ns)
+{
+ socket_info_t *s = &socket[ns];
+ card_info_t *card = NULL;
+ ds_ioctl_arg_t arg;
+ cistpl_vers_1_t *vers = NULL;
+ cistpl_manfid_t manfid = { 0, 0 };
+ pci_id_t pci_id = { 0, 0 };
+ cistpl_funcid_t funcid = { 0xff, 0xff };
+ cs_status_t status;
+ config_info_t config;
+ int i, ret, match;
+ int has_cis = 0;
+
+ /* Do we have a CIS structure? */
+ ret = ioctl(s->fd, DS_VALIDATE_CIS, &arg);
+ has_cis = ((ret == 0) && (arg.cisinfo.Chains > 0));
+
+ /* Try to read VERS_1, MANFID tuples */
+ if (has_cis) {
+ /* rule of thumb: cards with no FUNCID, but with common memory
+ device geometry information, are probably memory cards */
+ if (get_tuple(ns, CISTPL_FUNCID, &arg) == 0)
+ memcpy(&funcid, &arg.tuple_parse.parse.funcid,
+ sizeof(funcid));
+ else if (get_tuple(ns, CISTPL_DEVICE_GEO, &arg) == 0)
+ funcid.func = CISTPL_FUNCID_MEMORY;
+ if (get_tuple(ns, CISTPL_MANFID, &arg) == 0)
+ memcpy(&manfid, &arg.tuple_parse.parse.manfid,
+ sizeof(manfid));
+ if (get_tuple(ns, CISTPL_VERS_1, &arg) == 0)
+ vers = &arg.tuple_parse.parse.version_1;
+
+ match = 0;
+ for (card = root_card; card; card = card->next) {
+ switch (card->ident_type) {
+
+ case VERS_1_IDENT:
+ if (vers == NULL)
+ break;
+ for (i = 0; i < card->id.vers.ns; i++) {
+ if (strcmp(card->id.vers.pi[i], "*") == 0)
+ continue;
+ if (i >= vers->ns)
+ break;
+ if (strcmp(card->id.vers.pi[i],
+ vers->str+vers->ofs[i]) != 0)
+ break;
+ }
+ if (i < card->id.vers.ns)
+ break;
+ match = 1;
+ break;
+
+ case MANFID_IDENT:
+ if ((manfid.manf == card->id.manfid.manf) &&
+ (manfid.card == card->id.manfid.card))
+ match = 1;
+ break;
+
+ case TUPLE_IDENT:
+ arg.tuple.DesiredTuple = card->id.tuple.code;
+ arg.tuple.Attributes = 0;
+ ret = ioctl(s->fd, DS_GET_FIRST_TUPLE, &arg);
+ if (ret != 0) break;
+ arg.tuple.TupleOffset = card->id.tuple.ofs;
+ ret = ioctl(s->fd, DS_GET_TUPLE_DATA, &arg);
+ if (ret != 0) break;
+ if (strncmp((char *)arg.tuple_parse.data,
+ card->id.tuple.info,
+ strlen(card->id.tuple.info)) != 0)
+ break;
+ match = 1;
+ break;
+
+ default:
+ /* Skip */
+ break;
+ }
+ if (match) break;
+ }
+ }
+
+ /* Check PCI vendor/device info */
+ status.Function = config.Function = config.ConfigBase = 0;
+ if ((ioctl(s->fd, DS_GET_CONFIGURATION_INFO, &config) == 0) &&
+ (config.IntType == INT_CARDBUS)) {
+ pci_id.vendor = config.ConfigBase & 0xffff;
+ pci_id.device = config.ConfigBase >> 16;
+ if (!card) {
+ for (card = root_card; card; card = card->next)
+ if ((card->ident_type == PCI_IDENT) &&
+ (pci_id.vendor == card->id.manfid.manf) &&
+ (pci_id.device == card->id.manfid.card))
+ break;
+ }
+ }
+
+ /* Try for a FUNCID match */
+ if (!card && (funcid.func != 0xff)) {
+ for (card = root_func; card; card = card->next)
+ if (card->id.func.funcid == funcid.func)
+ break;
+ }
+
+ if (card) {
+ log_message("CM: socket %d: %s", ns, card->name);
+ return card;
+ }
+
+ status.Function = 0;
+ if (!blank_card || (status.CardState & CS_EVENT_CB_DETECT) ||
+ manfid.manf || manfid.card || pci_id.vendor || vers) {
+ log_message("CM: unsupported card in socket %d", ns);
+ return NULL;
+ } else {
+ card = blank_card;
+ log_message("CM: socket %d: %s", ns, card->name);
+ return card;
+ }
+}
+
+
+static void cardmgr_fail(void)
+{
+ log_message("CM: cardmgr: failed");
+}
+
+/*====================================================================*/
+
+static int load_config(void)
+{
+ if (chdir(configpath)) {
+ log_message("CM: chdir to %s failed: %m", configpath);
+ return -1;
+ }
+
+ if (parse_configfile("config"))
+ return -1;
+
+ if (!root_device)
+ log_message("CM: no device drivers defined");
+
+ if (!root_card && !root_func)
+ log_message("CM: no cards defined");
+
+ return 0;
+}
+
+
+/*====================================================================*/
+
+static void install_module(char *mod, char *opts)
+{
+ my_insmod(mod, ANY_DRIVER_TYPE, opts);
+}
+
+/*====================================================================*/
+
+static mtd_ident_t *lookup_mtd(region_info_t *region)
+{
+ mtd_ident_t *mtd;
+ int match = 0;
+
+ for (mtd = root_mtd; mtd; mtd = mtd->next) {
+ switch (mtd->mtd_type) {
+ case JEDEC_MTD:
+ if ((mtd->jedec_mfr == region->JedecMfr) &&
+ (mtd->jedec_info == region->JedecInfo)) {
+ match = 1;
+ break;
+ }
+ case DTYPE_MTD:
+ break;
+ default:
+ break;
+ }
+ if (match) break;
+ }
+ if (mtd)
+ return mtd;
+ else
+ return default_mtd;
+}
+
+/*====================================================================*/
+
+static void bind_mtd(int sn)
+{
+ socket_info_t *s = &socket[sn];
+ region_info_t region;
+ bind_info_t bind;
+ mtd_info_t mtd_info;
+ mtd_ident_t *mtd;
+ int i, attr, ret, nr;
+
+ nr = 0;
+ for (attr = 0; attr < 2; attr++) {
+ region.Attributes = attr;
+ ret = ioctl(s->fd, DS_GET_FIRST_REGION, &region);
+ while (ret == 0) {
+ mtd = lookup_mtd(&region);
+ if (mtd) {
+ /* Have we seen this MTD before? */
+ for (i = 0; i < nr; i++)
+ if (s->mtd[i] == mtd) break;
+ if (i == nr) {
+ install_module(mtd->module, mtd->opts);
+ s->mtd[nr] = mtd;
+ mtd->refs++;
+ nr++;
+ }
+ log_message("CM: %s memory region at 0x%lx: %s",
+ attr ? "Attribute" : "Common", (long unsigned int) region.CardOffset,
+ mtd->name);
+ /* Bind MTD to this region */
+ strcpy(mtd_info.dev_info, s->mtd[i]->module);
+ mtd_info.Attributes = region.Attributes;
+ mtd_info.CardOffset = region.CardOffset;
+ if (ioctl(s->fd, DS_BIND_MTD, &mtd_info) != 0) {
+ log_message( "bind MTD '%s' to region at 0x%lx failed: %m",
+ (char *)mtd_info.dev_info, (long unsigned int) region.CardOffset);
+ }
+ }
+ ret = ioctl(s->fd, DS_GET_NEXT_REGION, &region);
+ }
+ }
+ s->mtd[nr] = NULL;
+
+ /* Now bind each unique MTD as a normal client of this socket */
+ for (i = 0; i < nr; i++) {
+ strcpy(bind.dev_info, s->mtd[i]->module);
+ bind.function = 0;
+ if (ioctl(s->fd, DS_BIND_REQUEST, &bind) != 0)
+ log_message("CM: bind MTD '%s' to socket %d failed: %m",
+ (char *)bind.dev_info, sn);
+ }
+}
+
+/*====================================================================*/
+
+static void update_cis(socket_info_t *s)
+{
+ cisdump_t cis;
+ FILE *f = fopen(s->card->cis_file, "r");
+ if (f == NULL)
+ log_message("CM: could not open '%s': %m", s->card->cis_file);
+ else {
+ cis.Length = fread(cis.Data, 1, CISTPL_MAX_CIS_SIZE, f);
+ fclose(f);
+ if (ioctl(s->fd, DS_REPLACE_CIS, &cis) != 0)
+ log_message("CM: could not replace CIS: %m");
+ }
+}
+
+/*====================================================================*/
+
+static void do_insert(int sn)
+{
+ socket_info_t *s = &socket[sn];
+ card_info_t *card;
+ device_info_t **dev;
+ bind_info_t *bind, **tail;
+ int i, j, ret;
+
+ /* Already identified? */
+ if (s->card && (s->card != blank_card))
+ return;
+
+ log_message("CM: initializing socket %d", sn);
+ card = lookup_card(sn);
+ /* Make sure we've learned something new before continuing */
+ if (card == s->card)
+ return;
+ s->card = card;
+ card->refs++;
+ if (card->cis_file)
+ update_cis(s);
+
+ dev = card->device;
+
+ /* Set up MTD's */
+ for (i = 0; i < card->bindings; i++)
+ if (dev[i]->needs_mtd)
+ break;
+
+ if (i < card->bindings)
+ bind_mtd(sn);
+
+ /* Install kernel modules */
+ for (i = 0; i < card->bindings; i++) {
+ dev[i]->refs++;
+ for (j = 0; j < dev[i]->modules; j++)
+ install_module(dev[i]->module[j], dev[i]->opts[j]);
+ }
+
+ /* Bind drivers by their dev_info identifiers */
+ for (i = 0; i < card->bindings; i++) {
+ bind = calloc(1, sizeof(bind_info_t));
+ strcpy((char *)bind->dev_info, (char *)dev[i]->dev_info);
+ if (strcmp(bind->dev_info, "cb_enabler") == 0)
+ bind->function = BIND_FN_ALL;
+ else
+ bind->function = card->dev_fn[i];
+ if (ioctl(s->fd, DS_BIND_REQUEST, bind) != 0) {
+ if (errno == EBUSY) {
+ log_message("CM: '%s' already bound to socket %d",
+ (char *)bind->dev_info, sn);
+ } else {
+ log_message("CM: bind '%s' to socket %d failed: %m",
+ (char *)bind->dev_info, sn);
+ write_stab();
+ return;
+ }
+ }
+
+ for (ret = j = 0; j < 10; j++) {
+ ret = ioctl(s->fd, DS_GET_DEVICE_INFO, bind);
+ if ((ret == 0) || (errno != EAGAIN))
+ break;
+ usleep(100000);
+ }
+ if (ret != 0) {
+ log_message("CM: get dev info on socket %d failed: %m",
+ sn);
+ ioctl(s->fd, DS_UNBIND_REQUEST, bind);
+ write_stab();
+ return;
+ }
+ tail = &s->bind[i];
+ while (ret == 0) {
+ bind_info_t *old;
+ if ((strlen(bind->name) > 3) && (bind->name[2] == '#'))
+ xlate_scsi_name(bind);
+ old = *tail = bind; tail = (bind_info_t **)&bind->next;
+ bind = (bind_info_t *)malloc(sizeof(bind_info_t));
+ memcpy(bind, old, sizeof(bind_info_t));
+ ret = ioctl(s->fd, DS_GET_NEXT_DEVICE, bind);
+ }
+ *tail = NULL; free(bind);
+ write_stab();
+ }
+}
+
+/*====================================================================*/
+
+static void wait_for_pending(void)
+{
+ cs_status_t status;
+ int i;
+ status.Function = 0;
+ for (;;) {
+ usleep(100000);
+ for (i = 0; i < sockets; i++)
+ if ((ioctl(socket[i].fd, DS_GET_STATUS, &status) == 0) && (status.CardState & CS_EVENT_CARD_INSERTION))
+ break;
+ if (i == sockets)
+ break;
+ }
+}
+
+/*====================================================================*/
+
+static void adjust_resources(void)
+{
+ adjust_list_t *al;
+ int ret;
+ char tmp[64];
+ int fd = socket[0].fd;
+
+ for (al = root_adjust; al; al = al->next) {
+ ret = ioctl(fd, DS_ADJUST_RESOURCE_INFO, &al->adj);
+ if (ret != 0) {
+ switch (al->adj.Resource) {
+ case RES_MEMORY_RANGE:
+ sprintf(tmp, "memory %#lx-%#lx",
+ al->adj.resource.memory.Base,
+ al->adj.resource.memory.Base +
+ al->adj.resource.memory.Size - 1);
+ break;
+ case RES_IO_RANGE:
+ sprintf(tmp, "IO ports %#x-%#x",
+ al->adj.resource.io.BasePort,
+ al->adj.resource.io.BasePort +
+ al->adj.resource.io.NumPorts - 1);
+ break;
+ case RES_IRQ:
+ sprintf(tmp, "irq %u", al->adj.resource.irq.IRQ);
+ break;
+ }
+ log_message("CM: could not adjust resource: %s: %m", tmp);
+ }
+ }
+}
+
+/*====================================================================*/
+
+static int init_sockets(void)
+{
+ int fd, i;
+ servinfo_t serv;
+
+ major = lookup_dev("pcmcia");
+ if (major < 0) {
+ if (major == -ENODEV)
+ log_message("CM: no pcmcia driver in /proc/devices");
+ else
+ log_message("CM: could not open /proc/devices: %m");
+ return -1;
+ }
+
+ for (fd = -1, i = 0; i < MAX_SOCKS; i++) {
+ fd = open_sock(i, S_IFCHR|S_IREAD|S_IWRITE);
+ if (fd < 0)
+ break;
+ socket[i].fd = fd;
+ socket[i].state = 0;
+ }
+
+ if ((fd < 0) && (errno != ENODEV) && (errno != ENOENT))
+ log_message("CM: open_sock(socket %d) failed: %m", i);
+ sockets = i;
+ if (sockets == 0) {
+ log_message("CM: no sockets found!");
+ return -1;
+ } else
+ log_message("CM: found %d sockets", sockets);
+
+ if (ioctl(socket[0].fd, DS_GET_CARD_SERVICES_INFO, &serv) == 0) {
+ if (serv.Revision != CS_RELEASE_CODE)
+ log_message("CM: warning, Card Services release does not match kernel");
+ } else {
+ log_message("CM: could not get CS revision info!");
+ return -1;
+ }
+ adjust_resources();
+ return 0;
+}
+
+/*====================================================================*/
+
+int cardmgr_call(void)
+{
+ int i, max_fd, ret, event;
+ struct timeval tv;
+ fd_set fds;
+
+ stabfile = "/var/run/stab";
+
+ log_message("CM: cardmgr/hacked starting, version is " CS_RELEASE);
+
+ if (load_config()) {
+ cardmgr_fail();
+ return -1;
+ }
+
+ if (init_sockets()) {
+ cardmgr_fail();
+ return -1;
+ }
+
+ /* If we've gotten this far, then clean up pid and stab at exit */
+ write_stab();
+
+ for (i = max_fd = 0; i < sockets; i++)
+ max_fd = (socket[i].fd > max_fd) ? socket[i].fd : max_fd;
+
+ /* First select() call: poll, don't wait */
+ tv.tv_sec = tv.tv_usec = 0;
+
+ /* Wait for sockets in setup-pending state to settle */
+ wait_for_pending();
+
+
+ FD_ZERO(&fds);
+ for (i = 0; i < sockets; i++)
+ FD_SET(socket[i].fd, &fds);
+
+ if (select(max_fd+1, &fds, NULL, NULL, &tv) < 0) {
+ log_perror("CM: select fails");
+ return -1;
+ }
+
+ for (i = 0; i < sockets; i++) {
+ if (!FD_ISSET(socket[i].fd, &fds))
+ continue;
+ ret = read(socket[i].fd, &event, 4);
+ if ((ret == -1) && (errno != EAGAIN))
+ log_message("CM: read(%d): %m\n", i);
+ if (ret != 4)
+ continue;
+
+ switch (event) {
+ case CS_EVENT_CARD_INSERTION:
+ case CS_EVENT_INSERTION_REQUEST:
+ socket[i].state |= SOCKET_PRESENT;
+ case CS_EVENT_CARD_RESET:
+ socket[i].state |= SOCKET_READY;
+ do_insert(i);
+ break;
+ case CS_EVENT_RESET_PHYSICAL:
+ socket[i].state &= ~SOCKET_READY;
+ break;
+ }
+
+ }
+
+ return 0;
+
+}
diff --git a/mdk-stage1/pcmcia/cardmgr.h b/mdk-stage1/pcmcia/cardmgr.h
new file mode 100644
index 000000000..fe04044e5
--- /dev/null
+++ b/mdk-stage1/pcmcia/cardmgr.h
@@ -0,0 +1,107 @@
+/*
+ * cardmgr.h 1.35 2000/06/12 21:33:03
+ *
+ * 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.
+ */
+
+#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;
+
+typedef struct card_info_t {
+ char *name;
+ enum {
+ VERS_1_IDENT=1, MANFID_IDENT, TUPLE_IDENT, FUNC_IDENT,
+ BLANK_IDENT, PCI_IDENT
+ } ident_type;
+ union {
+ vers_ident_t vers;
+ manfid_ident_t manfid;
+ tuple_ident_t tuple;
+ func_ident_t func;
+ } id;
+ int bindings;
+ device_info_t *device[MAX_BINDINGS];
+ int dev_fn[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);
diff --git a/mdk-stage1/pcmcia/cirrus.h b/mdk-stage1/pcmcia/cirrus.h
new file mode 100644
index 000000000..b7aad5894
--- /dev/null
+++ b/mdk-stage1/pcmcia/cirrus.h
@@ -0,0 +1,182 @@
+/*
+ * cirrus.h 1.9 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_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 */
diff --git a/mdk-stage1/pcmcia/cistpl.h b/mdk-stage1/pcmcia/cistpl.h
new file mode 100644
index 000000000..a4b16a6e4
--- /dev/null
+++ b/mdk-stage1/pcmcia/cistpl.h
@@ -0,0 +1,604 @@
+/*
+ * cistpl.h 1.34 2000/06/19 23:18: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 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 */
diff --git a/mdk-stage1/pcmcia/config.h b/mdk-stage1/pcmcia/config.h
new file mode 100644
index 000000000..4ad8fe81a
--- /dev/null
+++ b/mdk-stage1/pcmcia/config.h
@@ -0,0 +1,59 @@
+/*
+ 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 */
diff --git a/mdk-stage1/pcmcia/cs.h b/mdk-stage1/pcmcia/cs.h
new file mode 100644
index 000000000..be6f92d65
--- /dev/null
+++ b/mdk-stage1/pcmcia/cs.h
@@ -0,0 +1,464 @@
+/*
+ * cs.h 1.71 2000/08/29 00:54: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 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
+
+/* 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
+
+#ifdef __BEOS__
+#define SS_MODULE_NAME(s) ("busses/pcmcia/" s "/v1")
+#define MTD_MODULE_NAME(s) ("busses/pcmcia/" s "/v1")
+#define CS_CLIENT_MODULE_NAME "bus_managers/pcmcia_cs/client/v1"
+typedef struct cs_client_module_info {
+ bus_manager_info binfo;
+ int (*_CardServices)(int, ...);
+ int (*_MTDHelperEntry)(int, ...);
+ void (*_add_timer)(struct timer_list *);
+ void (*_del_timer)(struct timer_list *);
+} cs_client_module_info;
+#define CS_SOCKET_MODULE_NAME "bus_managers/pcmcia_cs/socket/v1"
+typedef struct cs_socket_module_info {
+ bus_manager_info binfo;
+ int (*_register_ss_entry)(int, ss_entry_t);
+ void (*_unregister_ss_entry)(ss_entry_t);
+ void (*_add_timer)(struct timer_list *);
+ void (*_del_timer)(struct timer_list *);
+ int (*register_resource)(int, u_long, u_long);
+ int (*release_resource)(int, u_long, u_long);
+ int (*check_resource)(int, u_long, u_long);
+} cs_socket_module_info;
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_CS_H */
diff --git a/mdk-stage1/pcmcia/cs_types.h b/mdk-stage1/pcmcia/cs_types.h
new file mode 100644
index 000000000..40cf84b51
--- /dev/null
+++ b/mdk-stage1/pcmcia/cs_types.h
@@ -0,0 +1,65 @@
+/*
+ * cs_types.h 1.18 2000/06/12 21:55:40
+ *
+ * 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_CS_TYPES_H
+#define _LINUX_CS_TYPES_H
+
+#ifdef __linux__
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <sys/types.h>
+#endif
+#endif
+
+typedef u_short socket_t;
+typedef u_short ioaddr_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 */
diff --git a/mdk-stage1/pcmcia/driver_ops.h b/mdk-stage1/pcmcia/driver_ops.h
new file mode 100644
index 000000000..00cde3336
--- /dev/null
+++ b/mdk-stage1/pcmcia/driver_ops.h
@@ -0,0 +1,82 @@
+/*
+ * driver_ops.h 1.15 2000/06/12 21:55:40
+ *
+ * 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_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);
+
+#ifdef __BEOS__
+#define CB_ENABLER_MODULE_NAME "bus_managers/cb_enabler/v1"
+typedef struct cb_enabler_module_info {
+ bus_manager_info binfo;
+ int (*register_driver)(struct driver_operations *ops);
+ void (*unregister_driver)(struct driver_operations *ops);
+} cb_enabler_module_info;
+#endif /* __BEOS__ */
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_DRIVER_OPS_H */
diff --git a/mdk-stage1/pcmcia/ds.h b/mdk-stage1/pcmcia/ds.h
new file mode 100644
index 000000000..975ba596a
--- /dev/null
+++ b/mdk-stage1/pcmcia/ds.h
@@ -0,0 +1,163 @@
+/*
+ * ds.h 1.56 2000/06/12 21:55:40
+ *
+ * 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_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
+
+#ifdef __BEOS__
+#define DS_MODULE_NAME "bus_managers/pcmcia_ds/v1"
+typedef struct ds_module_info {
+ bus_manager_info binfo;
+ int (*_register_pccard_driver)(dev_info_t *,
+ dev_link_t *(*)(void),
+ void (*)(dev_link_t *));
+ int (*_unregister_pccard_driver)(dev_info_t *);
+ struct driver_info_t **root_driver;
+ int *sockets;
+ struct socket_info_t **socket_table;
+ sem_id *list_sem;
+} ds_module_info;
+#endif /* __BEOS__ */
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_DS_H */
diff --git a/mdk-stage1/pcmcia/i82365.h b/mdk-stage1/pcmcia/i82365.h
new file mode 100644
index 000000000..15e8e2540
--- /dev/null
+++ b/mdk-stage1/pcmcia/i82365.h
@@ -0,0 +1,154 @@
+/*
+ * 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 */
diff --git a/mdk-stage1/pcmcia/lex_config.c b/mdk-stage1/pcmcia/lex_config.c
new file mode 100644
index 000000000..b374c8bf4
--- /dev/null
+++ b/mdk-stage1/pcmcia/lex_config.c
@@ -0,0 +1,2008 @@
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header$
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ *yy_cp = yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 45
+#define YY_END_OF_BUFFER 46
+static yyconst short int yy_accept[247] =
+ { 0,
+ 5, 5, 2, 2, 46, 44, 5, 4, 5, 44,
+ 6, 41, 41, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 3,
+ 2, 45, 5, 5, 6, 0, 43, 0, 6, 41,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
+ 0, 0, 3, 2, 0, 43, 0, 42, 0, 0,
+ 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
+ 0, 18, 0, 0, 0, 0, 23, 0, 0, 0,
+
+ 0, 26, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 8, 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,
+ 0, 27, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 11, 0, 0, 14, 0, 0, 0, 0,
+ 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 31, 0, 0, 0, 0, 0, 13, 0,
+ 0, 0, 0, 20, 21, 22, 0, 0, 0, 28,
+ 0, 0, 0, 1, 0, 0, 0, 0, 12, 15,
+ 0, 0, 17, 0, 0, 0, 0, 29, 0, 0,
+
+ 32, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 39, 7, 0, 0, 24, 0, 0,
+ 0, 0, 0, 36, 0, 0, 0, 0, 0, 0,
+ 33, 0, 0, 0, 34, 0, 0, 0, 40, 0,
+ 0, 35, 37, 0, 38, 0
+ } ;
+
+static yyconst int yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 4, 1, 5, 6, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 7, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 1, 6, 1,
+ 1, 1, 1, 1, 9, 9, 9, 9, 9, 9,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 10, 1, 1, 11, 1, 12, 13, 14, 15,
+
+ 16, 17, 18, 1, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst int yy_meta[36] =
+ { 0,
+ 1, 2, 3, 2, 1, 1, 4, 4, 4, 1,
+ 1, 4, 4, 4, 4, 4, 4, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst short int yy_base[253] =
+ { 0,
+ 0, 0, 34, 37, 293, 294, 40, 294, 41, 41,
+ 0, 41, 45, 31, 273, 42, 40, 257, 38, 34,
+ 274, 47, 273, 262, 53, 271, 57, 35, 60, 0,
+ 79, 294, 82, 83, 0, 83, 294, 87, 0, 87,
+ 0, 263, 260, 260, 255, 253, 269, 74, 245, 265,
+ 244, 253, 262, 248, 259, 249, 249, 256, 255, 80,
+ 239, 240, 248, 238, 80, 236, 236, 232, 294, 236,
+ 233, 245, 0, 97, 95, 97, 108, 0, 230, 234,
+ 242, 241, 294, 226, 242, 234, 226, 229, 234, 235,
+ 226, 294, 231, 229, 220, 213, 294, 228, 209, 212,
+
+ 228, 294, 209, 219, 221, 217, 216, 206, 211, 203,
+ 215, 219, 194, 294, 294, 199, 196, 212, 209, 193,
+ 208, 192, 190, 206, 200, 190, 195, 187, 190, 294,
+ 192, 294, 188, 184, 200, 198, 195, 192, 188, 181,
+ 191, 181, 294, 181, 186, 294, 186, 189, 180, 183,
+ 294, 182, 161, 179, 183, 165, 170, 167, 158, 177,
+ 166, 171, 294, 161, 174, 172, 158, 152, 294, 165,
+ 165, 154, 162, 294, 166, 294, 153, 154, 158, 294,
+ 157, 157, 160, 294, 146, 157, 140, 136, 294, 294,
+ 147, 141, 294, 150, 133, 151, 139, 294, 148, 133,
+
+ 294, 143, 142, 127, 126, 294, 142, 138, 140, 140,
+ 124, 124, 136, 294, 294, 126, 118, 294, 130, 118,
+ 113, 114, 115, 294, 125, 127, 108, 116, 99, 87,
+ 294, 90, 87, 86, 294, 96, 78, 74, 294, 75,
+ 64, 294, 294, 46, 294, 294, 118, 122, 126, 130,
+ 134, 64
+ } ;
+
+static yyconst short int yy_def[253] =
+ { 0,
+ 246, 1, 247, 247, 246, 246, 246, 246, 246, 248,
+ 249, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 250,
+ 246, 246, 246, 246, 249, 248, 246, 251, 249, 246,
+ 252, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 250, 246, 248, 248, 251, 252, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 0, 246, 246, 246, 246,
+ 246, 246
+ } ;
+
+static yyconst short int yy_nxt[330] =
+ { 0,
+ 6, 7, 8, 9, 10, 11, 12, 13, 6, 6,
+ 6, 14, 15, 16, 17, 18, 19, 6, 20, 21,
+ 6, 6, 22, 23, 24, 25, 6, 26, 27, 28,
+ 6, 29, 6, 6, 6, 31, 32, 31, 31, 32,
+ 31, 33, 33, 33, 34, 37, 35, 40, 40, 42,
+ 38, 40, 40, 45, 43, 48, 51, 53, 56, 69,
+ 46, 54, 57, 47, 62, 70, 63, 78, 52, 49,
+ 66, 58, 67, 245, 41, 71, 59, 64, 72, 244,
+ 74, 68, 74, 33, 33, 33, 34, 37, 35, 36,
+ 85, 76, 38, 40, 40, 98, 77, 104, 74, 37,
+
+ 74, 37, 243, 242, 38, 86, 38, 241, 105, 99,
+ 36, 240, 76, 239, 238, 237, 236, 77, 30, 30,
+ 30, 30, 36, 36, 36, 36, 39, 39, 235, 39,
+ 73, 234, 233, 73, 75, 75, 75, 75, 232, 231,
+ 230, 229, 228, 227, 226, 225, 224, 223, 222, 221,
+ 220, 219, 218, 217, 216, 215, 214, 213, 212, 211,
+ 210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
+ 200, 199, 198, 197, 196, 195, 194, 193, 192, 191,
+ 190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
+ 180, 179, 178, 177, 176, 175, 174, 173, 172, 171,
+
+ 170, 169, 168, 167, 166, 165, 164, 163, 162, 161,
+ 160, 159, 158, 157, 156, 155, 154, 153, 152, 151,
+ 150, 149, 148, 147, 146, 145, 144, 143, 142, 141,
+ 140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
+ 130, 129, 128, 127, 126, 125, 124, 123, 122, 121,
+ 120, 119, 118, 117, 116, 115, 114, 113, 112, 111,
+ 110, 109, 108, 107, 106, 103, 102, 101, 100, 97,
+ 96, 95, 94, 93, 92, 91, 90, 89, 88, 87,
+ 84, 83, 82, 81, 80, 79, 65, 61, 60, 55,
+ 50, 44, 246, 5, 246, 246, 246, 246, 246, 246,
+
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246
+ } ;
+
+static yyconst short int yy_chk[330] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 3, 3, 3, 4, 4,
+ 4, 7, 9, 7, 9, 10, 9, 12, 12, 14,
+ 10, 13, 13, 16, 14, 17, 19, 20, 22, 28,
+ 16, 20, 22, 16, 25, 28, 25, 252, 19, 17,
+ 27, 22, 27, 244, 12, 29, 22, 25, 29, 241,
+ 31, 27, 31, 33, 34, 33, 34, 36, 34, 38,
+ 48, 38, 36, 40, 40, 60, 38, 65, 74, 75,
+
+ 74, 76, 240, 238, 75, 48, 76, 237, 65, 60,
+ 77, 236, 77, 234, 233, 232, 230, 77, 247, 247,
+ 247, 247, 248, 248, 248, 248, 249, 249, 229, 249,
+ 250, 228, 227, 250, 251, 251, 251, 251, 226, 225,
+ 223, 222, 221, 220, 219, 217, 216, 213, 212, 211,
+ 210, 209, 208, 207, 205, 204, 203, 202, 200, 199,
+ 197, 196, 195, 194, 192, 191, 188, 187, 186, 185,
+ 183, 182, 181, 179, 178, 177, 175, 173, 172, 171,
+ 170, 168, 167, 166, 165, 164, 162, 161, 160, 159,
+ 158, 157, 156, 155, 154, 153, 152, 150, 149, 148,
+
+ 147, 145, 144, 142, 141, 140, 139, 138, 137, 136,
+ 135, 134, 133, 131, 129, 128, 127, 126, 125, 124,
+ 123, 122, 121, 120, 119, 118, 117, 116, 113, 112,
+ 111, 110, 109, 108, 107, 106, 105, 104, 103, 101,
+ 100, 99, 98, 96, 95, 94, 93, 91, 90, 89,
+ 88, 87, 86, 85, 84, 82, 81, 80, 79, 72,
+ 71, 70, 68, 67, 66, 64, 63, 62, 61, 59,
+ 58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
+ 47, 46, 45, 44, 43, 42, 26, 24, 23, 21,
+ 18, 15, 5, 246, 246, 246, 246, 246, 246, 246,
+
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "lex_config.l"
+#define INITIAL 0
+/* Special state for handling include files */
+#define src 1
+
+#line 5 "lex_config.l"
+/*
+ * lex_config.l 1.39 2000/06/12 21:33:02
+ *
+ * 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.
+ */
+
+#undef src
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <syslog.h>
+#include <glob.h>
+#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);
+
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( yy_current_buffer->yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 63 "lex_config.l"
+
+
+
+ if ( yy_init )
+ {
+ yy_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yy_start;
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 247 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 294 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = yy_hold_char;
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 65 "lex_config.l"
+BEGIN(src);
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 66 "lex_config.l"
+/* skip */ ;
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 67 "lex_config.l"
+do_source(yytext); BEGIN(INITIAL);
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(src):
+#line 68 "lex_config.l"
+if (do_eof()) yyterminate();
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 70 "lex_config.l"
+current_lineno++;
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 71 "lex_config.l"
+/* skip */ ;
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 72 "lex_config.l"
+/* skip */ ;
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 74 "lex_config.l"
+return ANONYMOUS;
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 75 "lex_config.l"
+return BIND;
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 76 "lex_config.l"
+return CIS;
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 77 "lex_config.l"
+return CARD;
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 78 "lex_config.l"
+return CLASS;
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 79 "lex_config.l"
+return DEFAULT;
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 80 "lex_config.l"
+return DEVICE;
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 81 "lex_config.l"
+return DTYPE;
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 82 "lex_config.l"
+return EXCLUDE;
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 83 "lex_config.l"
+return FUNCTION;
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 84 "lex_config.l"
+return INCLUDE;
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 85 "lex_config.l"
+return IRQ_NO;
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 86 "lex_config.l"
+return JEDEC;
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 87 "lex_config.l"
+return MANFID;
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 88 "lex_config.l"
+return MEMORY;
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 89 "lex_config.l"
+return MODULE;
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 90 "lex_config.l"
+return MTD;
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 91 "lex_config.l"
+return NEEDS_MTD;
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 92 "lex_config.l"
+return OPTS;
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 93 "lex_config.l"
+return PCI;
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 94 "lex_config.l"
+return PORT;
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 95 "lex_config.l"
+return REGION;
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 96 "lex_config.l"
+return RESERVE;
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 97 "lex_config.l"
+return TO;
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 98 "lex_config.l"
+return TUPLE;
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 99 "lex_config.l"
+return VERSION;
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 101 "lex_config.l"
+return lex_number("1");
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 102 "lex_config.l"
+return lex_number("2");
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 103 "lex_config.l"
+return lex_number("3");
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 104 "lex_config.l"
+return lex_number("4");
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 105 "lex_config.l"
+return lex_number("5");
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 106 "lex_config.l"
+return lex_number("6");
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 107 "lex_config.l"
+return lex_number("7");
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 108 "lex_config.l"
+return lex_number("8");
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 110 "lex_config.l"
+return lex_number(yytext);
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 112 "lex_config.l"
+return lex_number(yytext);
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 114 "lex_config.l"
+return lex_string(yytext);
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 116 "lex_config.l"
+return yytext[0];
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 118 "lex_config.l"
+ECHO;
+ YY_BREAK
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yy_c_buf_p;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap() )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = yy_current_buffer;
+
+ int yy_c_buf_p_offset =
+ (int) (yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = yy_current_buffer->yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
+
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ if ( yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ yy_current_buffer->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = yy_start;
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 247 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+ }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
+ register int yy_is_jam;
+ register char *yy_cp = yy_c_buf_p;
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 247 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 246);
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+
+
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ /* This was really a NUL. */
+ *yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
+
+ switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap() )
+ return EOF;
+
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p = yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
+
+ return c;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
+ return;
+
+ if ( yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yy_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yy_flex_free( (void *) b->yy_ch_buf );
+
+ yy_flex_free( (void *) b );
+ }
+
+
+#ifndef YY_ALWAYS_INTERACTIVE
+#ifndef YY_NEVER_INTERACTIVE
+extern int isatty YY_PROTO(( int ));
+#endif
+#endif
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
+
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
+
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 118 "lex_config.l"
+
+
+#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;
+ glob_t glob;
+} 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];
+ while (s->fileno < s->glob.gl_pathc) {
+ char *fn = s->glob.gl_pathv[s->fileno];
+ 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;
+ }
+ glob(fn, GLOB_NOCHECK, NULL, &s->glob);
+ 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 yyparse(void);
+
+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;
+}
+
diff --git a/mdk-stage1/pcmcia/pcmcia.h b/mdk-stage1/pcmcia/pcmcia.h
new file mode 100644
index 000000000..1967b3497
--- /dev/null
+++ b/mdk-stage1/pcmcia/pcmcia.h
@@ -0,0 +1,21 @@
+/*
+ * 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
diff --git a/mdk-stage1/pcmcia/pcmcia_probe.c b/mdk-stage1/pcmcia/pcmcia_probe.c
new file mode 100644
index 000000000..57651d75f
--- /dev/null
+++ b/mdk-stage1/pcmcia/pcmcia_probe.c
@@ -0,0 +1,396 @@
+/*
+ * 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.
+ *
+ */
+
+/* Code comes from /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-3.1.23.tar.bz2
+ *
+ * Licence of this code follows:
+
+ PCMCIA controller probe
+
+ probe.c 1.52 2000/06/12 21:33:02
+
+ 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 <pcmcia/config.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, 0xac16, "Texas Instruments PCI1250", "TI 1250A" },
+ { 0x104c, 0xac17, "Texas Instruments PCI1220", "TI 1220" },
+ { 0x104c, 0xac19, "Texas Instruments PCI1221", "TI 1221" },
+ { 0x104c, 0xac1a, "Texas Instruments PCI1210", "TI 1210" },
+ { 0x104c, 0xac1d, "Texas Instruments PCI1251A", "TI 1251A" },
+ { 0x104c, 0xac1f, "Texas Instruments PCI1251B", "TI 1251B" },
+ { 0x104c, 0xac1b, "Texas Instruments PCI1450", "TI 1450" },
+ { 0x104c, 0xac1c, "Texas Instruments PCI1225", "TI 1225" },
+ { 0x104c, 0xac1e, "Texas Instruments PCI1211", "TI 1211" },
+ { 0x104c, 0xac50, "Texas Instruments PCI1410", "TI 1410" },
+ { 0x104c, 0xac51, "Texas Instruments PCI1420", "TI 1420" },
+ { 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" },
+ { 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;
+ ioperm(i365_base, 4, 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)..");
+
+ ioperm(TCIC_BASE, 16, 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 "i82365";
+ else if (!i365_probe())
+ return "i82365";
+ else if (!tcic_probe())
+ return "tcic";
+ else
+ return NULL;
+}
diff --git a/mdk-stage1/pcmcia/tcic.h b/mdk-stage1/pcmcia/tcic.h
new file mode 100644
index 000000000..92347cef6
--- /dev/null
+++ b/mdk-stage1/pcmcia/tcic.h
@@ -0,0 +1,266 @@
+/*
+ * 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 */
diff --git a/mdk-stage1/pcmcia/version.h b/mdk-stage1/pcmcia/version.h
new file mode 100644
index 000000000..7a567ea2c
--- /dev/null
+++ b/mdk-stage1/pcmcia/version.h
@@ -0,0 +1,4 @@
+/* version.h 1.95 2000/11/07 22:55:28 (David Hinds) */
+
+#define CS_RELEASE "3.1.23"
+#define CS_RELEASE_CODE 0x3117
diff --git a/mdk-stage1/pcmcia/vg468.h b/mdk-stage1/pcmcia/vg468.h
new file mode 100644
index 000000000..bb5faae87
--- /dev/null
+++ b/mdk-stage1/pcmcia/vg468.h
@@ -0,0 +1,112 @@
+/*
+ * 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 */
diff --git a/mdk-stage1/pcmcia/yacc_config.c b/mdk-stage1/pcmcia/yacc_config.c
new file mode 100644
index 000000000..e68e17cb3
--- /dev/null
+++ b/mdk-stage1/pcmcia/yacc_config.c
@@ -0,0 +1,1017 @@
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define yyclearin (yychar=(-1))
+#define yyerrok (yyerrflag=0)
+#define YYRECOVERING (yyerrflag!=0)
+#define YYPREFIX "yy"
+#line 2 "yacc_config.y"
+/*
+ * yacc_config.y 1.51 2000/06/12 21:33:02
+ *
+ * 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 <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, int fn);
+static int add_module(device_info_t *card, char *name);
+
+#line 65 "yacc_config.y"
+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;
+#line 77 "y.tab.c"
+#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 YYERRCODE 256
+short yylhs[] = { -1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 2, 2, 2, 3, 3, 3, 3, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 8, 9,
+ 10, 11, 12, 12, 13, 15, 14, 14, 14, 14,
+ 4, 21, 5, 5, 5, 6, 16, 16, 16, 16,
+ 18, 17, 19, 20, 20, 22,
+};
+short yylen[] = { 2,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 3, 2, 4, 4, 2, 1, 1, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 7,
+ 5, 5, 3, 3, 3, 3, 3, 5, 3, 5,
+ 2, 4, 3, 3, 3, 3, 2, 1, 1, 1,
+ 3, 4, 2, 3, 3, 4,
+};
+short yydefred[] = { 1,
+ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 17, 0, 19, 0, 21, 22, 23, 24,
+ 0, 26, 0, 28, 0, 49, 48, 50, 0, 6,
+ 7, 16, 20, 0, 47, 0, 0, 0, 0, 9,
+ 10, 11, 0, 41, 0, 0, 0, 0, 29, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 53, 0, 0, 0, 0, 13, 0, 0, 12, 43,
+ 46, 44, 45, 0, 0, 33, 35, 0, 0, 36,
+ 34, 0, 0, 51, 54, 55, 42, 56, 0, 0,
+ 0, 0, 0, 0, 0, 52, 14, 15, 0, 31,
+ 32, 38, 40, 0, 30,
+};
+short yydgoto[] = { 1,
+ 11, 40, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31,
+};
+short yysindex[] = { 0,
+ -250, 0, -279, -278, -274, -265, -259, -242, -242, -242,
+ -10, -248, 0, -44, 0, -249, 0, 0, 0, 0,
+ -9, 0, -3, 0, -243, 0, 0, 0, -233, 0,
+ 0, 0, 0, -228, 0, -227, -240, -238, -237, 0,
+ 0, 0, -242, 0, -235, -232, -231, -230, 0, -234,
+ -229, -226, -225, -224, -222, -221, -220, -219, -218, -217,
+ 0, -215, -213, -212, -211, 0, 9, 11, 0, 0,
+ 0, 0, 0, 14, 21, 0, 0, 30, -192, 0,
+ 0, -191, -207, 0, 0, 0, 0, 0, -206, -205,
+ -204, -203, -202, -201, -200, 0, 0, 0, 41, 0,
+ 0, 0, 0, -197, 0,
+};
+short yyrindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 107, 149, 0, 90, 0, 124, 0, 0, 0, 0,
+ 49, 0, 73, 0, 0, 0, 0, 0, 141, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 25, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+};
+short yygindex[] = { 0,
+ 0, -7, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#define YYTABLESIZE 428
+short yytable[] = { 48,
+ 37, 41, 42, 32, 33, 2, 3, 4, 34, 49,
+ 50, 51, 52, 53, 54, 55, 56, 35, 5, 44,
+ 45, 6, 46, 36, 39, 7, 8, 9, 10, 59,
+ 60, 61, 62, 43, 57, 69, 63, 37, 38, 39,
+ 58, 64, 65, 66, 37, 67, 68, 70, 25, 74,
+ 71, 72, 73, 89, 75, 90, 76, 91, 77, 78,
+ 79, 80, 81, 82, 92, 83, 84, 85, 39, 86,
+ 87, 88, 27, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 103, 104, 105, 0, 0, 0, 18,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 47, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 0, 0, 37,
+ 0, 0, 37, 0, 0, 0, 37, 37, 37, 37,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 0, 0, 39, 0, 0, 39, 0, 0, 0,
+ 39, 39, 39, 39, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 0, 0, 25, 0, 0,
+ 25, 0, 0, 0, 25, 25, 25, 25, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 0,
+ 0, 27, 0, 0, 27, 18, 18, 18, 27, 27,
+ 27, 27, 0, 0, 0, 0, 0, 18, 18, 0,
+ 18, 18, 2, 2, 2, 18, 18, 18, 18, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 2, 5,
+ 5, 5, 2, 2, 2, 2, 0, 0, 0, 0,
+ 0, 0, 5, 0, 0, 5, 4, 4, 4, 5,
+ 5, 5, 5, 0, 3, 3, 3, 0, 0, 4,
+ 0, 0, 4, 0, 0, 0, 4, 4, 4, 4,
+ 3, 0, 0, 0, 3, 3, 3, 3,
+};
+short yycheck[] = { 44,
+ 0, 9, 10, 283, 283, 256, 257, 258, 283, 259,
+ 260, 261, 262, 263, 264, 265, 266, 283, 269, 268,
+ 269, 272, 271, 283, 0, 276, 277, 278, 279, 273,
+ 274, 275, 276, 44, 44, 43, 270, 280, 281, 282,
+ 44, 270, 270, 284, 44, 284, 284, 283, 0, 284,
+ 283, 283, 283, 45, 284, 45, 283, 44, 284, 284,
+ 283, 283, 283, 283, 44, 284, 284, 283, 44, 283,
+ 283, 283, 0, 44, 267, 267, 284, 284, 284, 284,
+ 284, 284, 284, 284, 44, 283, -1, -1, -1, 0,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 0, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 0, -1, -1, -1, -1, -1, -1, -1, 0, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 270, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 256, 257, 258, 259,
+ 260, 261, 262, 263, 264, 265, 266, -1, -1, 269,
+ -1, -1, 272, -1, -1, -1, 276, 277, 278, 279,
+ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
+ 266, -1, -1, 269, -1, -1, 272, -1, -1, -1,
+ 276, 277, 278, 279, 256, 257, 258, 259, 260, 261,
+ 262, 263, 264, 265, 266, -1, -1, 269, -1, -1,
+ 272, -1, -1, -1, 276, 277, 278, 279, 256, 257,
+ 258, 259, 260, 261, 262, 263, 264, 265, 266, -1,
+ -1, 269, -1, -1, 272, 256, 257, 258, 276, 277,
+ 278, 279, -1, -1, -1, -1, -1, 268, 269, -1,
+ 271, 272, 256, 257, 258, 276, 277, 278, 279, -1,
+ -1, -1, -1, -1, -1, 269, -1, -1, 272, 256,
+ 257, 258, 276, 277, 278, 279, -1, -1, -1, -1,
+ -1, -1, 269, -1, -1, 272, 256, 257, 258, 276,
+ 277, 278, 279, -1, 256, 257, 258, -1, -1, 269,
+ -1, -1, 272, -1, -1, -1, 276, 277, 278, 279,
+ 272, -1, -1, -1, 276, 277, 278, 279,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 284
+#if YYDEBUG
+char *yyname[] = {
+"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,"','","'-'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"DEVICE","CARD",
+"ANONYMOUS","TUPLE","MANFID","VERSION","FUNCTION","PCI","BIND","CIS","TO",
+"NEEDS_MTD","MODULE","OPTS","CLASS","REGION","JEDEC","DTYPE","DEFAULT","MTD",
+"INCLUDE","EXCLUDE","RESERVE","IRQ_NO","PORT","MEMORY","STRING","NUMBER",
+};
+char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list adjust",
+"list : list device",
+"list : list mtd",
+"list : list card",
+"list : list opts",
+"list : list mtd_opts",
+"list : list error",
+"adjust : INCLUDE resource",
+"adjust : EXCLUDE resource",
+"adjust : RESERVE resource",
+"adjust : adjust ',' resource",
+"resource : IRQ_NO NUMBER",
+"resource : PORT NUMBER '-' NUMBER",
+"resource : MEMORY NUMBER '-' NUMBER",
+"device : DEVICE STRING",
+"device : needs_mtd",
+"device : module",
+"device : class",
+"card : CARD STRING",
+"card : anonymous",
+"card : tuple",
+"card : manfid",
+"card : pci",
+"card : version",
+"card : function",
+"card : bind",
+"card : cis",
+"anonymous : card ANONYMOUS",
+"tuple : card TUPLE NUMBER ',' NUMBER ',' STRING",
+"manfid : card MANFID NUMBER ',' NUMBER",
+"pci : card PCI NUMBER ',' NUMBER",
+"version : card VERSION STRING",
+"version : version ',' STRING",
+"function : card FUNCTION NUMBER",
+"cis : card CIS STRING",
+"bind : card BIND STRING",
+"bind : card BIND STRING TO NUMBER",
+"bind : bind ',' STRING",
+"bind : bind ',' STRING TO NUMBER",
+"needs_mtd : device NEEDS_MTD",
+"opts : MODULE STRING OPTS STRING",
+"module : device MODULE STRING",
+"module : module OPTS STRING",
+"module : module ',' STRING",
+"class : device CLASS STRING",
+"region : REGION STRING",
+"region : dtype",
+"region : jedec",
+"region : default",
+"dtype : region DTYPE NUMBER",
+"jedec : region JEDEC NUMBER NUMBER",
+"default : region DEFAULT",
+"mtd : region MTD STRING",
+"mtd : mtd OPTS STRING",
+"mtd_opts : MTD STRING OPTS STRING",
+};
+#endif
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+int yydebug;
+int yynerrs;
+int yyerrflag;
+int yychar;
+short *yyssp;
+YYSTYPE *yyvsp;
+YYSTYPE yyval;
+YYSTYPE yylval;
+short yyss[YYSTACKSIZE];
+YYSTYPE yyvs[YYSTACKSIZE];
+#define yystacksize YYSTACKSIZE
+#line 468 "yacc_config.y"
+void yyerror(char *msg, ...)
+{
+ va_list ap;
+ char str[256];
+
+ va_start(ap, msg);
+ sprintf(str, "config error, 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, 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;
+ 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");
+ return -1;
+ }
+ dev->module[dev->modules] = name;
+ dev->opts[dev->modules] = NULL;
+ dev->modules++;
+ return 0;
+}
+
+int yylex(void);
+
+#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
+#line 426 "y.tab.c"
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+int
+yyparse(void)
+{
+ register int yym, yyn, yystate;
+#if YYDEBUG
+ register char *yys;
+ extern char *getenv();
+
+ if (yys = getenv("YYDEBUG"))
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+#endif
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = (-1);
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+ *yyssp = yystate = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate])) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ goto yyoverflow;
+ }
+ *++yyssp = yystate = yytable[yyn];
+ *++yyvsp = yylval;
+ yychar = (-1);
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+ yyerror("syntax error");
+#ifdef lint
+ goto yyerrlab;
+#endif
+yyerrlab:
+ ++yynerrs;
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+#endif
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ goto yyoverflow;
+ }
+ *++yyssp = yystate = yytable[yyn];
+ *++yyvsp = yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yyssp);
+#endif
+ if (yyssp <= yyss) goto yyabort;
+ --yyssp;
+ --yyvsp;
+ }
+ }
+ }
+ else
+ {
+ if (yychar == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar = (-1);
+ goto yyloop;
+ }
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym = yylen[yyn];
+ yyval = yyvsp[1-yym];
+ switch (yyn)
+ {
+case 2:
+#line 84 "yacc_config.y"
+{
+ adjust_list_t **tail = &root_adjust;
+ while (*tail != NULL) tail = &(*tail)->next;
+ *tail = yyvsp[0].adjust;
+ }
+break;
+case 3:
+#line 90 "yacc_config.y"
+{
+ yyvsp[0].device->next = root_device;
+ root_device = yyvsp[0].device;
+ }
+break;
+case 4:
+#line 95 "yacc_config.y"
+{
+ if (yyvsp[0].mtd->mtd_type == 0) {
+ yyerror("no ID method for this card");
+ YYERROR;
+ }
+ if (yyvsp[0].mtd->module == NULL) {
+ yyerror("no MTD module specified");
+ YYERROR;
+ }
+ yyvsp[0].mtd->next = root_mtd;
+ root_mtd = yyvsp[0].mtd;
+ }
+break;
+case 5:
+#line 108 "yacc_config.y"
+{
+ if (yyvsp[0].card->ident_type == 0) {
+ yyerror("no ID method for this card");
+ YYERROR;
+ }
+ if (yyvsp[0].card->bindings == 0) {
+ yyerror("no function bindings");
+ YYERROR;
+ }
+ if (yyvsp[0].card->ident_type == FUNC_IDENT) {
+ yyvsp[0].card->next = root_func;
+ root_func = yyvsp[0].card;
+ } else {
+ yyvsp[0].card->next = root_card;
+ root_card = yyvsp[0].card;
+ }
+ }
+break;
+case 9:
+#line 131 "yacc_config.y"
+{
+ yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;
+ yyval.adjust = yyvsp[0].adjust;
+ }
+break;
+case 10:
+#line 136 "yacc_config.y"
+{
+ yyvsp[0].adjust->adj.Action = REMOVE_MANAGED_RESOURCE;
+ yyval.adjust = yyvsp[0].adjust;
+ }
+break;
+case 11:
+#line 141 "yacc_config.y"
+{
+ yyvsp[0].adjust->adj.Action = ADD_MANAGED_RESOURCE;
+ yyvsp[0].adjust->adj.Attributes |= RES_RESERVED;
+ yyval.adjust = yyvsp[0].adjust;
+ }
+break;
+case 12:
+#line 147 "yacc_config.y"
+{
+ yyvsp[0].adjust->adj.Action = yyvsp[-2].adjust->adj.Action;
+ yyvsp[0].adjust->adj.Attributes = yyvsp[-2].adjust->adj.Attributes;
+ yyvsp[0].adjust->next = yyvsp[-2].adjust;
+ yyval.adjust = yyvsp[0].adjust;
+ }
+break;
+case 13:
+#line 156 "yacc_config.y"
+{
+ yyval.adjust = calloc(sizeof(adjust_list_t), 1);
+ yyval.adjust->adj.Resource = RES_IRQ;
+ yyval.adjust->adj.resource.irq.IRQ = yyvsp[0].num;
+ }
+break;
+case 14:
+#line 162 "yacc_config.y"
+{
+ if ((yyvsp[0].num < yyvsp[-2].num) || (yyvsp[0].num > 0xffff)) {
+ yyerror("invalid port range");
+ YYERROR;
+ }
+ yyval.adjust = calloc(sizeof(adjust_list_t), 1);
+ yyval.adjust->adj.Resource = RES_IO_RANGE;
+ yyval.adjust->adj.resource.io.BasePort = yyvsp[-2].num;
+ yyval.adjust->adj.resource.io.NumPorts = yyvsp[0].num - yyvsp[-2].num + 1;
+ }
+break;
+case 15:
+#line 173 "yacc_config.y"
+{
+ if (yyvsp[0].num < yyvsp[-2].num) {
+ yyerror("invalid address range");
+ YYERROR;
+ }
+ yyval.adjust = calloc(sizeof(adjust_list_t), 1);
+ yyval.adjust->adj.Resource = RES_MEMORY_RANGE;
+ yyval.adjust->adj.resource.memory.Base = yyvsp[-2].num;
+ yyval.adjust->adj.resource.memory.Size = yyvsp[0].num - yyvsp[-2].num + 1;
+ }
+break;
+case 16:
+#line 186 "yacc_config.y"
+{
+ yyval.device = calloc(sizeof(device_info_t), 1);
+ yyval.device->refs = 1;
+ strcpy(yyval.device->dev_info, yyvsp[0].str);
+ free(yyvsp[0].str);
+ }
+break;
+case 20:
+#line 198 "yacc_config.y"
+{
+ yyval.card = calloc(sizeof(card_info_t), 1);
+ yyval.card->refs = 1;
+ yyval.card->name = yyvsp[0].str;
+ }
+break;
+case 29:
+#line 214 "yacc_config.y"
+{
+ if (yyvsp[-1].card->ident_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ if (blank_card) {
+ yyerror("Anonymous card already defined");
+ YYERROR;
+ }
+ yyvsp[-1].card->ident_type = BLANK_IDENT;
+ blank_card = yyvsp[-1].card;
+ }
+break;
+case 30:
+#line 229 "yacc_config.y"
+{
+ if (yyvsp[-6].card->ident_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ yyvsp[-6].card->ident_type = TUPLE_IDENT;
+ yyvsp[-6].card->id.tuple.code = yyvsp[-4].num;
+ yyvsp[-6].card->id.tuple.ofs = yyvsp[-2].num;
+ yyvsp[-6].card->id.tuple.info = yyvsp[0].str;
+ }
+break;
+case 31:
+#line 242 "yacc_config.y"
+{
+ if (yyvsp[-4].card->ident_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ yyvsp[-4].card->ident_type = MANFID_IDENT;
+ yyvsp[-4].card->id.manfid.manf = yyvsp[-2].num;
+ yyvsp[-4].card->id.manfid.card = yyvsp[0].num;
+ }
+break;
+case 32:
+#line 253 "yacc_config.y"
+{
+ if (yyvsp[-4].card->ident_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ yyvsp[-4].card->ident_type = PCI_IDENT;
+ yyvsp[-4].card->id.manfid.manf = yyvsp[-2].num;
+ yyvsp[-4].card->id.manfid.card = yyvsp[0].num;
+ }
+break;
+case 33:
+#line 264 "yacc_config.y"
+{
+ if (yyvsp[-2].card->ident_type != 0) {
+ yyerror("ID method already defined\n");
+ YYERROR;
+ }
+ yyvsp[-2].card->ident_type = VERS_1_IDENT;
+ yyvsp[-2].card->id.vers.ns = 1;
+ yyvsp[-2].card->id.vers.pi[0] = yyvsp[0].str;
+ }
+break;
+case 34:
+#line 274 "yacc_config.y"
+{
+ if (yyvsp[-2].card->id.vers.ns == 4) {
+ yyerror("too many version strings");
+ YYERROR;
+ }
+ yyvsp[-2].card->id.vers.pi[yyvsp[-2].card->id.vers.ns] = yyvsp[0].str;
+ yyvsp[-2].card->id.vers.ns++;
+ }
+break;
+case 35:
+#line 285 "yacc_config.y"
+{
+ if (yyvsp[-2].card->ident_type != 0) {
+ yyerror("ID method already defined\n");
+ YYERROR;
+ }
+ yyvsp[-2].card->ident_type = FUNC_IDENT;
+ yyvsp[-2].card->id.func.funcid = yyvsp[0].num;
+ }
+break;
+case 36:
+#line 296 "yacc_config.y"
+{ yyvsp[-2].card->cis_file = strdup(yyvsp[0].str); }
+break;
+case 37:
+#line 300 "yacc_config.y"
+{
+ if (add_binding(yyvsp[-2].card, yyvsp[0].str, 0) != 0)
+ YYERROR;
+ }
+break;
+case 38:
+#line 305 "yacc_config.y"
+{
+ if (add_binding(yyvsp[-4].card, yyvsp[-2].str, yyvsp[0].num) != 0)
+ YYERROR;
+ }
+break;
+case 39:
+#line 310 "yacc_config.y"
+{
+ if (add_binding(yyvsp[-2].card, yyvsp[0].str, 0) != 0)
+ YYERROR;
+ }
+break;
+case 40:
+#line 315 "yacc_config.y"
+{
+ if (add_binding(yyvsp[-4].card, yyvsp[-2].str, yyvsp[0].num) != 0)
+ YYERROR;
+ }
+break;
+case 41:
+#line 322 "yacc_config.y"
+{
+ yyvsp[-1].device->needs_mtd = 1;
+ }
+break;
+case 42:
+#line 328 "yacc_config.y"
+{
+ 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(yyvsp[-2].str, d->module[i]) == 0) break;
+ if (i < d->modules) {
+ if (d->opts[i])
+ free(d->opts[i]);
+ d->opts[i] = strdup(yyvsp[0].str);
+ found = 1;
+ }
+ }
+ free(yyvsp[-2].str); free(yyvsp[0].str);
+ if (!found) {
+ yyerror("module name not found!");
+ YYERROR;
+ }
+ }
+break;
+case 43:
+#line 350 "yacc_config.y"
+{
+ if (add_module(yyvsp[-2].device, yyvsp[0].str) != 0)
+ YYERROR;
+ }
+break;
+case 44:
+#line 355 "yacc_config.y"
+{
+ if (yyvsp[-2].device->opts[yyvsp[-2].device->modules-1] == NULL) {
+ yyvsp[-2].device->opts[yyvsp[-2].device->modules-1] = yyvsp[0].str;
+ } else {
+ yyerror("too many options");
+ YYERROR;
+ }
+ }
+break;
+case 45:
+#line 364 "yacc_config.y"
+{
+ if (add_module(yyvsp[-2].device, yyvsp[0].str) != 0)
+ YYERROR;
+ }
+break;
+case 46:
+#line 371 "yacc_config.y"
+{
+ if (yyvsp[-2].device->class != NULL) {
+ yyerror("extra class string");
+ YYERROR;
+ }
+ yyvsp[-2].device->class = yyvsp[0].str;
+ }
+break;
+case 47:
+#line 381 "yacc_config.y"
+{
+ yyval.mtd = calloc(sizeof(mtd_ident_t), 1);
+ yyval.mtd->refs = 1;
+ yyval.mtd->name = yyvsp[0].str;
+ }
+break;
+case 51:
+#line 392 "yacc_config.y"
+{
+ if (yyvsp[-2].mtd->mtd_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ yyvsp[-2].mtd->mtd_type = DTYPE_MTD;
+ yyvsp[-2].mtd->dtype = yyvsp[0].num;
+ }
+break;
+case 52:
+#line 403 "yacc_config.y"
+{
+ if (yyvsp[-3].mtd->mtd_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ yyvsp[-3].mtd->mtd_type = JEDEC_MTD;
+ yyvsp[-3].mtd->jedec_mfr = yyvsp[-1].num;
+ yyvsp[-3].mtd->jedec_info = yyvsp[0].num;
+ }
+break;
+case 53:
+#line 415 "yacc_config.y"
+{
+ if (yyvsp[-1].mtd->mtd_type != 0) {
+ yyerror("ID method already defined");
+ YYERROR;
+ }
+ if (default_mtd) {
+ yyerror("Default MTD already defined");
+ YYERROR;
+ }
+ yyvsp[-1].mtd->mtd_type = DEFAULT_MTD;
+ default_mtd = yyvsp[-1].mtd;
+ }
+break;
+case 54:
+#line 430 "yacc_config.y"
+{
+ if (yyvsp[-2].mtd->module != NULL) {
+ yyerror("extra MTD entry");
+ YYERROR;
+ }
+ yyvsp[-2].mtd->module = yyvsp[0].str;
+ }
+break;
+case 55:
+#line 438 "yacc_config.y"
+{
+ if (yyvsp[-2].mtd->opts == NULL) {
+ yyvsp[-2].mtd->opts = yyvsp[0].str;
+ } else {
+ yyerror("too many options");
+ YYERROR;
+ }
+ }
+break;
+case 56:
+#line 449 "yacc_config.y"
+{
+ mtd_ident_t *m;
+ int found = 0;
+ for (m = root_mtd; m; m = m->next)
+ if (strcmp(yyvsp[-2].str, m->module) == 0) break;
+ if (m) {
+ if (m->opts) free(m->opts);
+ m->opts = strdup(yyvsp[0].str);
+ found = 1;
+ }
+ free(yyvsp[-2].str); free(yyvsp[0].str);
+ if (!found) {
+ yyerror("MTD name not found!");
+ YYERROR;
+ }
+ }
+break;
+#line 966 "y.tab.c"
+ }
+ yyssp -= yym;
+ yystate = *yyssp;
+ yyvsp -= yym;
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate = YYFINAL;
+ *++yyssp = YYFINAL;
+ *++yyvsp = yyval;
+ if (yychar < 0)
+ {
+ if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yyssp, yystate);
+#endif
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ goto yyoverflow;
+ }
+ *++yyssp = yystate;
+ *++yyvsp = yyval;
+ goto yyloop;
+yyoverflow:
+ yyerror("yacc stack overflow");
+yyabort:
+ return (1);
+yyaccept:
+ return (0);
+}
diff --git a/mdk-stage1/pcmcia/yacc_config.h b/mdk-stage1/pcmcia/yacc_config.h
new file mode 100644
index 000000000..b4902c8e6
--- /dev/null
+++ b/mdk-stage1/pcmcia/yacc_config.h
@@ -0,0 +1,37 @@
+#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
+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;
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 68e143a22..725201400 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -46,6 +46,10 @@
#include "mount.h"
#include "insmod-busybox/insmod.h"
+#ifdef ENABLE_PCMCIA
+#include "pcmcia/pcmcia.h"
+#endif
+
#ifndef DISABLE_CDROM
#include "cdrom.h"
#endif
@@ -167,6 +171,27 @@ static void expert_third_party_modules(void)
return expert_third_party_modules();
}
+
+static void handle_pcmcia(void)
+{
+#ifdef ENABLE_PCMCIA
+ char * pcmcia_adapter;
+ pcmcia_adapter = pcmcia_probe();
+ if (!pcmcia_adapter) {
+ log_message("no pcmcia adapter found");
+ return;
+ }
+ my_insmod("pcmcia_core", ANY_DRIVER_TYPE, NULL);
+ my_insmod(pcmcia_adapter, ANY_DRIVER_TYPE, NULL);
+ my_insmod("ds", ANY_DRIVER_TYPE, NULL);
+
+ /* call to cardmgr takes time, let's use the wait message */
+ wait_message("Enabling PCMCIA extension cards...");
+ log_message("cardmgr rc: %d", cardmgr_call());
+ remove_wait_message();
+#endif
+}
+
static enum return_type method_select_and_prepare(void)
{
enum return_type results;
@@ -255,6 +280,8 @@ int main(int argc, char **argv, char **env)
if (IS_EXPERT)
expert_third_party_modules();
+ handle_pcmcia();
+
ret = method_select_and_prepare();
finish_frontend();