summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-02-01 05:12:56 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-02-01 05:12:56 +0000
commit8c3155bfa8b79dd47d2cc64189a919a9b434dc79 (patch)
tree7f4579210f3ad3b40021d7dbd71896e5f1f3899e
parentbad76f195320d5f8fe71dd2cdd09b7e6448ae62f (diff)
cats (ARM) support for OpenBSD, based on NetBSD code.
-rw-r--r--sys/arch/cats/Makefile30
-rw-r--r--sys/arch/cats/cats/autoconf.c518
-rw-r--r--sys/arch/cats/cats/cats_machdep.c973
-rw-r--r--sys/arch/cats/compile/.cvsignore2
-rw-r--r--sys/arch/cats/conf/GENERIC349
-rw-r--r--sys/arch/cats/conf/Makefile.cats214
-rw-r--r--sys/arch/cats/conf/RAMDISK374
-rw-r--r--sys/arch/cats/conf/files.cats108
-rw-r--r--sys/arch/cats/conf/ldscript.elf76
-rw-r--r--sys/arch/cats/include/ansi.h4
-rw-r--r--sys/arch/cats/include/asm.h4
-rw-r--r--sys/arch/cats/include/atomic.h2
-rw-r--r--sys/arch/cats/include/bootconfig.h76
-rw-r--r--sys/arch/cats/include/bus.h4
-rw-r--r--sys/arch/cats/include/cdefs.h4
-rw-r--r--sys/arch/cats/include/conf.h19
-rw-r--r--sys/arch/cats/include/cpu.h4
-rw-r--r--sys/arch/cats/include/cyclone_boot.h67
-rw-r--r--sys/arch/cats/include/db_machdep.h4
-rw-r--r--sys/arch/cats/include/disklabel.h4
-rw-r--r--sys/arch/cats/include/elf_abi.h3
-rw-r--r--sys/arch/cats/include/endian.h4
-rw-r--r--sys/arch/cats/include/exec.h49
-rw-r--r--sys/arch/cats/include/float.h4
-rw-r--r--sys/arch/cats/include/fp.h4
-rw-r--r--sys/arch/cats/include/frame.h4
-rw-r--r--sys/arch/cats/include/ieee.h4
-rw-r--r--sys/arch/cats/include/ieeefp.h4
-rw-r--r--sys/arch/cats/include/internal_types.h7
-rw-r--r--sys/arch/cats/include/intr.h6
-rw-r--r--sys/arch/cats/include/irqhandler.h4
-rw-r--r--sys/arch/cats/include/isa_machdep.h13
-rw-r--r--sys/arch/cats/include/limits.h4
-rw-r--r--sys/arch/cats/include/lock.h4
-rw-r--r--sys/arch/cats/include/math.h4
-rw-r--r--sys/arch/cats/include/param.h55
-rw-r--r--sys/arch/cats/include/pcb.h4
-rw-r--r--sys/arch/cats/include/pio.h4
-rw-r--r--sys/arch/cats/include/pmap.h4
-rw-r--r--sys/arch/cats/include/proc.h4
-rw-r--r--sys/arch/cats/include/profile.h4
-rw-r--r--sys/arch/cats/include/psl.h1
-rw-r--r--sys/arch/cats/include/ptrace.h4
-rw-r--r--sys/arch/cats/include/reg.h4
-rw-r--r--sys/arch/cats/include/reloc.h2
-rw-r--r--sys/arch/cats/include/rtc.h4
-rw-r--r--sys/arch/cats/include/setjmp.h4
-rw-r--r--sys/arch/cats/include/signal.h4
-rw-r--r--sys/arch/cats/include/spinlock.h6
-rw-r--r--sys/arch/cats/include/sysarch.h4
-rw-r--r--sys/arch/cats/include/trap.h4
-rw-r--r--sys/arch/cats/include/types.h12
-rw-r--r--sys/arch/cats/include/vmparam.h100
-rw-r--r--sys/arch/cats/isa/isa_machdep.h3
-rw-r--r--sys/arch/cats/pci/pci_machdep.h2
-rw-r--r--sys/arch/cats/pci/pcib.c147
-rw-r--r--sys/arch/cats/pci/pciide_machdep.c90
57 files changed, 3420 insertions, 0 deletions
diff --git a/sys/arch/cats/Makefile b/sys/arch/cats/Makefile
new file mode 100644
index 00000000000..4547fa6a2ee
--- /dev/null
+++ b/sys/arch/cats/Makefile
@@ -0,0 +1,30 @@
+/* $OpenBSD: Makefile,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+# $NetBSD: Makefile,v 1.1 2001/06/12 08:32:46 chris Exp $
+
+# Makefile for cats tags file and boot blocks
+
+TCATS= ../cats/tags
+SCATS= ../cats/cats/*.[ch] ../cats/include/*.h \
+ ../cats/isa/*.[ch]
+ACATS= ../cats/cats/*.S
+
+# Directories in which to place tags links
+DCATS= isa include
+
+.include "../../kern/Make.tags.inc"
+
+tags:
+ -ctags -wdtf ${TCATS} ${SCATS} ${COMM}
+ egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${ACATS} | \
+ sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
+ >> ${TCATS}
+ sort -o ${TCATS} ${TCATS}
+
+links:
+ -for i in ${DCATS}; do \
+ cd $$i && rm -f tags; ln -s ../tags tags; done
+
+
+SUBDIR= compile include
+
+.include <bsd.subdir.mk>
diff --git a/sys/arch/cats/cats/autoconf.c b/sys/arch/cats/cats/autoconf.c
new file mode 100644
index 00000000000..afb2773d8a5
--- /dev/null
+++ b/sys/arch/cats/cats/autoconf.c
@@ -0,0 +1,518 @@
+/* $OpenBSD: autoconf.c,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: autoconf.c,v 1.2 2001/09/05 16:17:36 matt Exp $ */
+
+/*
+ * Copyright (c) 1994-1998 Mark Brinicombe.
+ * Copyright (c) 1994 Brini.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Mark Brinicombe for
+ * the NetBSD project.
+ * 4. The name of the company nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * RiscBSD kernel project
+ *
+ * autoconf.c
+ *
+ * Autoconfiguration functions
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/reboot.h>
+#include <sys/disklabel.h>
+#include <sys/device.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <machine/bootconfig.h>
+#include <machine/intr.h>
+
+#include <dev/cons.h>
+
+#include "isa.h"
+
+struct device *booted_device;
+int booted_partition;
+
+void isa_intr_init (void);
+
+struct device *bootdv = NULL;
+
+int findblkmajor(struct device *dv);
+char * findblkname(int maj);
+
+#if 0
+void rootconf(void);
+#endif
+void swapconf(void);
+void rootconf(void);
+void diskconf(void);
+
+static struct device * getdisk(char *str, int len, int defpart, dev_t *devp);
+struct device *parsedisk(char *, int, int, dev_t *);
+dev_t bootdev = 0;
+
+#include "wd.h"
+#if NWD > 0
+extern struct cfdriver wd_cd;
+#endif
+#include "sd.h"
+#if NSD > 0
+extern struct cfdriver sd_cd;
+#endif
+#include "cd.h"
+#if NCD > 0
+extern struct cfdriver cd_cd;
+#endif
+#if NRD > 0
+extern struct cfdriver rd_cd;
+#endif
+#include "raid.h"
+#if NRAID > 0
+extern struct cfdriver raid_cd;
+#endif
+
+struct genericconf {
+ struct cfdriver *gc_driver;
+ char *gc_name;
+ dev_t gc_major;
+} genericconf[] = {
+#if NWD > 0
+ { &wd_cd, "wd", 16 },
+#endif
+#if NSD > 0
+ { &sd_cd, "sd", 24 },
+#endif
+#if NCD > 0
+ { &cd_cd, "cd", 26 },
+#endif
+#if NRD > 0
+ { &rd_cd, "rd", 18 },
+#endif
+#if NRAID > 0
+ { &raid_cd, "raid", 71 },
+#endif
+ { 0 }
+};
+
+int
+findblkmajor(dv)
+ struct device *dv;
+{
+ char *name = dv->dv_xname;
+ int i;
+
+ for (i = 0; i < sizeof(genericconf)/sizeof(genericconf[0]); ++i)
+ if (strncmp(name, genericconf[i].gc_name,
+ strlen(genericconf[i].gc_name)) == 0)
+ return (genericconf[i].gc_major);
+ return (-1);
+}
+
+char *
+findblkname(maj)
+ int maj;
+{
+ int i;
+
+ for (i = 0; i < sizeof(genericconf)/sizeof(genericconf[0]); ++i)
+ if (maj == genericconf[i].gc_major)
+ return (genericconf[i].gc_name);
+ return (NULL);
+}
+
+static struct device *
+getdisk(char *str, int len, int defpart, dev_t *devp)
+{
+ struct device *dv;
+
+ if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
+ printf("use one of:");
+ for (dv = alldevs.tqh_first; dv != NULL;
+ dv = dv->dv_list.tqe_next) {
+ if (dv->dv_class == DV_DISK)
+ printf(" %s[a-p]", dv->dv_xname);
+#ifdef NFSCLIENT
+ if (dv->dv_class == DV_IFNET)
+ printf(" %s", dv->dv_xname);
+#endif
+ }
+ printf("\n");
+ }
+ return (dv);
+}
+
+struct device *
+parsedisk(char *str, int len, int defpart, dev_t *devp)
+{
+ struct device *dv;
+ char *cp, c;
+ int majdev, part;
+
+ if (len == 0)
+ return (NULL);
+ cp = str + len - 1;
+ c = *cp;
+ if (c >= 'a' && (c - 'a') < MAXPARTITIONS) {
+ part = c - 'a';
+ *cp = '\0';
+ } else
+ part = defpart;
+
+ for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ if (dv->dv_class == DV_DISK &&
+ strcmp(str, dv->dv_xname) == 0) {
+ majdev = findblkmajor(dv);
+ if (majdev < 0)
+ panic("parsedisk");
+ *devp = MAKEDISKDEV(majdev, dv->dv_unit, part);
+ break;
+ }
+#ifdef NFSCLIENT
+ if (dv->dv_class == DV_IFNET &&
+ strcmp(str, dv->dv_xname) == 0) {
+ *devp = NODEV;
+ break;
+ }
+#endif
+ }
+
+ *cp = c;
+ return (dv);
+}
+
+
+/*
+ * Now that we are fully operational, we can checksum the
+ * disks, and using some heuristics, hopefully are able to
+ * always determine the correct root disk.
+ */
+void
+diskconf()
+{
+ /*
+ * Configure root, swap, and dump area. This is
+ * currently done by running the same checksum
+ * algorithm over all known disks, as was done in
+ * /boot. Then we basically fixup the *dev vars
+ * from the info we gleaned from this.
+ */
+#if 0
+ dkcsumattach();
+
+#endif
+ rootconf();
+#if 0
+ swapconf();
+ dumpconf();
+#endif
+}
+
+/*
+ * Configure swap space and related parameters.
+ */
+void
+swapconf()
+{
+ register struct swdevt *swp;
+ register int nblks;
+
+ for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
+ int maj = major(swp->sw_dev);
+
+ if (maj > nblkdev)
+ break;
+ if (bdevsw[maj].d_psize) {
+ nblks = (*bdevsw[maj].d_psize)(swp->sw_dev);
+ if (nblks != -1 &&
+ (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
+ swp->sw_nblks = nblks;
+ swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
+ }
+ }
+}
+
+void rootconf(void);
+void diskconf(void);
+
+
+/*
+ * void cpu_configure()
+ *
+ * Configure all the root devices
+ * The root devices are expected to configure their own children
+ */
+void
+cpu_configure(void)
+{
+ softintr_init();
+
+ /*
+ * Since various PCI interrupts could be routed via the ICU
+ * (for PCI devices in the bridge) we need to set up the ICU
+ * now so that these interrupts can be established correctly
+ * i.e. This is a hack.
+ */
+ isa_intr_init();
+
+ config_rootfound("mainbus", NULL);
+
+ /*
+ * We can not know which is our root disk, defer
+ * until we can checksum blocks to figure it out.
+ */
+ md_diskconf = diskconf;
+ cold = 0;
+
+ /* Time to start taking interrupts so lets open the flood gates .... */
+ (void)spl0();
+
+}
+
+void
+device_register(struct device *dev, void *aux)
+{
+}
+/*
+ * Attempt to find the device from which we were booted.
+ * If we can do so, and not instructed not to do so,
+ * change rootdev to correspond to the load device.
+ */
+void
+rootconf()
+{
+ int majdev, mindev, unit, part, len;
+ dev_t temp;
+ struct swdevt *swp;
+ struct device *dv;
+ dev_t nrootdev, nswapdev = NODEV;
+ char buf[128];
+ int s;
+
+#if defined(NFSCLIENT)
+ extern char *nfsbootdevname;
+#endif
+
+ printf("boot_file: '%s'\n", boot_file);
+
+ if(boothowto & RB_DFLTROOT)
+ return; /* Boot compiled in */
+
+ /*
+ * (raid) device auto-configuration could have returned
+ * the root device's id in rootdev. Check this case.
+ */
+ if (rootdev != NODEV) {
+ majdev = major(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+
+ len = snprintf(buf, sizeof buf, "%s%d", findblkname(majdev),
+ unit);
+ if (len >= sizeof(buf))
+ panic("rootconf: device name too long");
+
+ bootdv = getdisk(buf, len, part, &rootdev);
+ }
+
+#if 0
+ /* Lookup boot device from boot if not set by configuration */
+ if(bootdv == NULL) {
+ bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp);
+ }
+#endif
+ if(bootdv == NULL) {
+ printf("boot device: lookup '%s' failed.\n", bootdev);
+ boothowto |= RB_ASKNAME; /* Don't Panic :-) */
+ /* boothowto |= RB_SINGLE; */
+ } else
+ printf("boot device: %s.\n", bootdv->dv_xname);
+
+ if (boothowto & RB_ASKNAME) {
+ for (;;) {
+ printf("root device ");
+ if (bootdv != NULL)
+ printf("(default %s%c)",
+ bootdv->dv_xname,
+ bootdv->dv_class == DV_DISK
+ ? 'a' : ' ');
+ printf(": ");
+ s = splimp();
+ cnpollc(1);
+ len = getsn(buf, sizeof(buf));
+
+ cnpollc(0);
+ splx(s);
+ if (len == 0 && bootdv != NULL) {
+ strlcpy(buf, bootdv->dv_xname, sizeof buf);
+ len = strlen(buf);
+ }
+ if (len > 0 && buf[len - 1] == '*') {
+ buf[--len] = '\0';
+ dv = getdisk(buf, len, 1, &nrootdev);
+ if (dv != NULL) {
+ bootdv = dv;
+ nswapdev = nrootdev;
+ goto gotswap;
+ }
+ }
+ dv = getdisk(buf, len, 0, &nrootdev);
+ if (dv != NULL) {
+ bootdv = dv;
+ break;
+ }
+ }
+ /*
+ * because swap must be on same device as root, for
+ * network devices this is easy.
+ */
+ if (bootdv->dv_class == DV_IFNET)
+ goto gotswap;
+
+ for (;;) {
+ printf("swap device ");
+ if (bootdv != NULL)
+ printf("(default %s%c)",
+ bootdv->dv_xname,
+ bootdv->dv_class == DV_DISK?'b':' ');
+ printf(": ");
+ s = splimp();
+ cnpollc(1);
+ len = getsn(buf, sizeof(buf));
+ cnpollc(0);
+ splx(s);
+ if (len == 0 && bootdv != NULL) {
+ switch (bootdv->dv_class) {
+ case DV_IFNET:
+ nswapdev = NODEV;
+ break;
+ case DV_DISK:
+ nswapdev = MAKEDISKDEV(major(nrootdev),
+ DISKUNIT(nrootdev), 1);
+ break;
+ case DV_TAPE:
+ case DV_TTY:
+ case DV_DULL:
+ case DV_CPU:
+ break;
+ }
+ break;
+ }
+ dv = getdisk(buf, len, 1, &nswapdev);
+ if (dv) {
+ if (dv->dv_class == DV_IFNET)
+ nswapdev = NODEV;
+ break;
+ }
+ }
+
+gotswap:
+ rootdev = nrootdev;
+ dumpdev = nswapdev;
+ swdevt[0].sw_dev = nswapdev;
+ swdevt[1].sw_dev = NODEV;
+ }
+ else if(mountroot == NULL) {
+ /*
+ * `swap generic': Use the device the ROM told us to use.
+ */
+ if (bootdv == NULL)
+ panic("boot device not known");
+
+ majdev = findblkmajor(bootdv);
+
+ if (majdev >= 0) {
+ /*
+ * Root and Swap are on disk.
+ * Boot is always from partition 0.
+ */
+ rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 0);
+ nswapdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 1);
+ dumpdev = nswapdev;
+ } else {
+ /*
+ * Root and Swap are on net.
+ */
+ nswapdev = dumpdev = NODEV;
+ }
+ swdevt[0].sw_dev = nswapdev;
+ swdevt[1].sw_dev = NODEV;
+
+ } else {
+
+ /*
+ * `root DEV swap DEV': honour rootdev/swdevt.
+ * rootdev/swdevt/mountroot already properly set.
+ */
+ return;
+ }
+
+ switch (bootdv->dv_class) {
+#if defined(NFSCLIENT)
+ case DV_IFNET:
+ mountroot = nfs_mountroot;
+ nfsbootdevname = bootdv->dv_xname;
+ return;
+#endif
+ case DV_DISK:
+ mountroot = dk_mountroot;
+ majdev = major(rootdev);
+ mindev = minor(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+ printf("root on %s%c\n", bootdv->dv_xname, part + 'a');
+ break;
+ default:
+ printf("can't figure root, hope your kernel is right\n");
+ return;
+ }
+
+ /*
+ * XXX: What is this doing?
+ */
+ temp = NODEV;
+ for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
+ if (majdev == major(swp->sw_dev) &&
+ unit == DISKUNIT(swp->sw_dev)) {
+ temp = swdevt[0].sw_dev;
+ swdevt[0].sw_dev = swp->sw_dev;
+ swp->sw_dev = temp;
+ break;
+ }
+ }
+ if (swp->sw_dev == NODEV)
+ return;
+
+ /*
+ * If dumpdev was the same as the old primary swap device, move
+ * it to the new primary swap device.
+ */
+ if (temp == dumpdev)
+ dumpdev = swdevt[0].sw_dev;
+}
+/* End of autoconf.c */
diff --git a/sys/arch/cats/cats/cats_machdep.c b/sys/arch/cats/cats/cats_machdep.c
new file mode 100644
index 00000000000..621a2579b46
--- /dev/null
+++ b/sys/arch/cats/cats/cats_machdep.c
@@ -0,0 +1,973 @@
+/* $OpenBSD: cats_machdep.c,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: cats_machdep.c,v 1.50 2003/10/04 14:28:28 chris Exp $ */
+
+/*
+ * Copyright (c) 1997,1998 Mark Brinicombe.
+ * Copyright (c) 1997,1998 Causality Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Mark Brinicombe
+ * for the NetBSD Project.
+ * 4. The name of the company nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Machine dependant functions for kernel setup for EBSA285 core architecture
+ * using cyclone firmware
+ *
+ * Created : 24/11/97
+ */
+
+#include <sys/cdefs.h>
+#include "isadma.h"
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/exec.h>
+#include <sys/proc.h>
+#include <sys/msgbuf.h>
+#include <sys/reboot.h>
+#include <sys/termios.h>
+
+#include <dev/cons.h>
+
+#include <machine/db_machdep.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_extern.h>
+
+#include <machine/bootconfig.h>
+#define _ARM32_BUS_DMA_PRIVATE
+#include <machine/bus.h>
+#include <machine/cpu.h>
+#include <machine/frame.h>
+#include <machine/intr.h>
+#include <arm/undefined.h>
+#include <arm/machdep.h>
+
+#include <machine/cyclone_boot.h>
+#include <arm/footbridge/dc21285mem.h>
+#include <arm/footbridge/dc21285reg.h>
+
+#include "isa.h"
+#if NISA > 0
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+#endif
+
+/* Kernel text starts at the base of the kernel address space. */
+#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00000000)
+#define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
+
+/*
+ * The range 0xf1000000 - 0xfcffffff is available for kernel VM space
+ * Footbridge registers and I/O mappings occupy 0xfd000000 - 0xffffffff
+ */
+
+/*
+ * Size of available KVM space, note that growkernel will grow into this.
+ */
+#define KERNEL_VM_SIZE 0x0C000000
+
+/*
+ * Address to call from cpu_reset() to reset the machine.
+ * This is machine architecture dependant as it varies depending
+ * on where the ROM appears when you turn the MMU off.
+ */
+
+void debugled(u_int32_t val);
+
+#define DEBUG_LED_OFFSET 0x8c0
+u_int32_t *debugledaddr = (void*)(DC21285_PCI_IO_BASE+DEBUG_LED_OFFSET);
+void
+debugled(u_int32_t val)
+{
+ *debugledaddr = val;
+}
+
+u_int cpu_reset_address = DC21285_ROM_BASE;
+
+u_int dc21285_fclk = FCLK;
+
+/* Define various stack sizes in pages */
+#define IRQ_STACK_SIZE 1
+#define ABT_STACK_SIZE 1
+#ifdef IPKDB
+#define UND_STACK_SIZE 2
+#else
+#define UND_STACK_SIZE 1
+#endif
+
+struct ebsaboot ebsabootinfo;
+BootConfig bootconfig; /* Boot config storage */
+static char bootargs[MAX_BOOT_STRING + 1];
+char *boot_args = NULL;
+char *boot_file = NULL;
+
+vm_offset_t physical_start;
+vm_offset_t physical_freestart;
+vm_offset_t physical_freeend;
+vm_offset_t physical_end;
+u_int free_pages;
+vm_offset_t pagetables_start;
+int physmem = 0;
+
+/*int debug_flags;*/
+#ifndef PMAP_STATIC_L1S
+int max_processes = 64; /* Default number */
+#endif /* !PMAP_STATIC_L1S */
+
+/* Physical and virtual addresses for some global pages */
+pv_addr_t systempage;
+pv_addr_t irqstack;
+pv_addr_t undstack;
+pv_addr_t abtstack;
+extern pv_addr_t kernelstack;
+
+vm_offset_t msgbufphys;
+
+extern u_int data_abort_handler_address;
+extern u_int prefetch_abort_handler_address;
+extern u_int undefined_handler_address;
+
+#ifdef PMAP_DEBUG
+extern int pmap_debug_level;
+#endif
+
+#define KERNEL_PT_SYS 0 /* L2 table for mapping zero page */
+#define KERNEL_PT_KERNEL 1 /* L2 table for mapping kernel */
+#define KERNEL_PT_KERNEL_NUM 2
+
+/* now this could move into something more generic */
+ /* L2 tables for mapping kernel VM */
+#define KERNEL_PT_VMDATA (KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM)
+#define KERNEL_PT_VMDATA_NUM 4 /* 16MB kernel VM !*/
+#define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
+
+pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
+
+extern struct user *proc0paddr;
+
+/* Prototypes */
+
+void consinit __P((void));
+
+int fcomcnattach __P((u_int iobase, int rate,tcflag_t cflag));
+int fcomcndetach __P((void));
+
+static void process_kernel_args __P((char *));
+extern void configure __P((void));
+
+/* A load of console goo. */
+#include "vga.h"
+#if (NVGA > 0)
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#endif
+
+#include "pckbc.h"
+#if (NPCKBC > 0)
+#include <dev/ic/i8042reg.h>
+#include <dev/ic/pckbcvar.h>
+#endif
+
+#include "com.h"
+#if (NCOM > 0)
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+#ifndef CONCOMADDR
+#define CONCOMADDR 0x3f8
+#endif
+#endif
+
+#define CONSDEVNAME "fcom"
+#ifndef CONSDEVNAME
+#define CONSDEVNAME "vga"
+#endif
+
+#define CONSPEED B38400
+#ifndef CONSPEED
+#define CONSPEED B9600 /* TTYDEF_SPEED */
+#endif
+#ifndef CONMODE
+#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
+#endif
+
+int comcnspeed = CONSPEED;
+int comcnmode = CONMODE;
+
+
+/*
+ * void cpu_reboot(int howto, char *bootstr)
+ *
+ * Reboots the system
+ *
+ * Deal with any syncing, unmounting, dumping and shutdown hooks,
+ * then reset the CPU.
+ */
+
+void
+boot(howto)
+ int howto;
+{
+#ifdef DIAGNOSTIC
+ /* info */
+ printf("boot: howto=%08x curproc=%p\n", howto, curproc);
+#endif
+
+ /*
+ * If we are still cold then hit the air brakes
+ * and crash to earth fast
+ */
+ if (cold) {
+ doshutdownhooks();
+ printf("The operating system has halted.\n");
+ printf("Please press any key to reboot.\n\n");
+ cngetc();
+ printf("rebooting...\n");
+ cpu_reset();
+ /*NOTREACHED*/
+ }
+
+ /* Disable console buffering */
+/* cnpollc(1);*/
+
+ /*
+ * If RB_NOSYNC was not specified sync the discs.
+ * Note: Unless cold is set to 1 here, syslogd will die during the unmount.
+ * It looks like syslogd is getting woken up only to find that it cannot
+ * page part of the binary in as the filesystem has been unmounted.
+ */
+ if (!(howto & RB_NOSYNC))
+ bootsync();
+
+ /* Say NO to interrupts */
+ splhigh();
+
+ /* Do a dump if requested. */
+ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
+ dumpsys();
+
+ /* Run any shutdown hooks */
+ doshutdownhooks();
+
+ /* Make sure IRQ's are disabled */
+ IRQdisable;
+
+ if (howto & RB_HALT) {
+ printf("The operating system has halted.\n");
+ printf("Please press any key to reboot.\n\n");
+ cngetc();
+ }
+
+ printf("rebooting...\n");
+ cpu_reset();
+ /*NOTREACHED*/
+}
+
+/*
+ * Mapping table for core kernel memory. This memory is mapped at init
+ * time with section mappings.
+ */
+struct l1_sec_map {
+ vm_offset_t va;
+ vm_offset_t pa;
+ vm_size_t size;
+ vm_prot_t prot;
+ int cache;
+} l1_sec_table[] = {
+ /* Map 1MB for CSR space */
+ { DC21285_ARMCSR_VBASE, DC21285_ARMCSR_BASE,
+ DC21285_ARMCSR_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE },
+
+ /* Map 1MB for fast cache cleaning space */
+ { DC21285_CACHE_FLUSH_VBASE, DC21285_SA_CACHE_FLUSH_BASE,
+ DC21285_CACHE_FLUSH_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_CACHE },
+
+ /* Map 1MB for PCI IO space */
+ { DC21285_PCI_IO_VBASE, DC21285_PCI_IO_BASE,
+ DC21285_PCI_IO_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE },
+
+ /* Map 1MB for PCI IACK space */
+ { DC21285_PCI_IACK_VBASE, DC21285_PCI_IACK_SPECIAL,
+ DC21285_PCI_IACK_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE },
+
+ /* Map 16MB of type 1 PCI config access */
+ { DC21285_PCI_TYPE_1_CONFIG_VBASE, DC21285_PCI_TYPE_1_CONFIG,
+ DC21285_PCI_TYPE_1_CONFIG_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE },
+
+ /* Map 16MB of type 0 PCI config access */
+ { DC21285_PCI_TYPE_0_CONFIG_VBASE, DC21285_PCI_TYPE_0_CONFIG,
+ DC21285_PCI_TYPE_0_CONFIG_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE },
+
+ /* Map 1MB of 32 bit PCI address space for ISA MEM accesses via PCI */
+ { DC21285_PCI_ISA_MEM_VBASE, DC21285_PCI_MEM_BASE,
+ DC21285_PCI_ISA_MEM_VSIZE, VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE },
+
+ { 0, 0, 0, 0, 0 }
+};
+
+/*
+ * u_int initarm(struct ebsaboot *bootinfo)
+ *
+ * Initial entry point on startup. This gets called before main() is
+ * entered.
+ * It should be responsible for setting up everything that must be
+ * in place when main is called.
+ * This includes
+ * Taking a copy of the boot configuration structure.
+ * Initialising the physical console so characters can be printed.
+ * Setting up page tables for the kernel
+ * Relocating the kernel to the bottom of physical memory
+ */
+
+u_int
+initarm(bootargs)
+ void *bootargs;
+{
+ struct ebsaboot *bootinfo = bootargs;
+ int loop;
+ int loop1;
+ u_int l1pagetable;
+ pv_addr_t kernel_l1pt;
+ extern u_int cpu_get_control(void);
+
+debugled(0x1000);
+ /*
+ * Heads up ... Setup the CPU / MMU / TLB functions
+ */
+ set_cpufuncs();
+
+ /* Copy the boot configuration structure */
+ ebsabootinfo = *bootinfo;
+
+ if (ebsabootinfo.bt_fclk >= 50000000
+ && ebsabootinfo.bt_fclk <= 66000000)
+ dc21285_fclk = ebsabootinfo.bt_fclk;
+
+ /* Fake bootconfig structure for the benefit of pmap.c */
+ /* XXX must make the memory description h/w independant */
+ bootconfig.dramblocks = 1;
+ bootconfig.dram[0].address = ebsabootinfo.bt_memstart;
+ bootconfig.dram[0].pages = (ebsabootinfo.bt_memend
+ - ebsabootinfo.bt_memstart) / PAGE_SIZE;
+
+ /*
+ * Initialise the diagnostic serial console
+ * This allows a means of generating output during initarm().
+ * Once all the memory map changes are complete we can call consinit()
+ * and not have to worry about things moving.
+ */
+#ifdef FCOM_INIT_ARM
+ fcomcnattach(DC21285_ARMCSR_BASE, comcnspeed, comcnmode);
+#endif
+
+ /* Talk to the user */
+ printf("OpenBSD/cats booting ...\n");
+
+ if (ebsabootinfo.bt_magic != BT_MAGIC_NUMBER_EBSA
+ && ebsabootinfo.bt_magic != BT_MAGIC_NUMBER_CATS)
+ panic("Incompatible magic number passed in boot args");
+
+/* {
+ int loop;
+ for (loop = 0; loop < 8; ++loop) {
+ printf("%08x\n", *(((int *)bootinfo)+loop));
+ }
+ }*/
+
+ /*
+ * Ok we have the following memory map
+ *
+ * virtual address == physical address apart from the areas:
+ * 0x00000000 -> 0x000fffff which is mapped to
+ * top 1MB of physical memory
+ * 0x00100000 -> 0x0fffffff which is mapped to
+ * physical addresses 0x00100000 -> 0x0fffffff
+ * 0x10000000 -> 0x1fffffff which is mapped to
+ * physical addresses 0x00000000 -> 0x0fffffff
+ * 0x20000000 -> 0xefffffff which is mapped to
+ * physical addresses 0x20000000 -> 0xefffffff
+ * 0xf0000000 -> 0xf03fffff which is mapped to
+ * physical addresses 0x00000000 -> 0x003fffff
+ *
+ * This means that the kernel is mapped suitably for continuing
+ * execution, all I/O is mapped 1:1 virtual to physical and
+ * physical memory is accessible.
+ *
+ * The initarm() has the responsibility for creating the kernel
+ * page tables.
+ * It must also set up various memory pointers that are used
+ * by pmap etc.
+ */
+
+ /*
+ * Examine the boot args string for options we need to know about
+ * now.
+ */
+ process_kernel_args((char *)ebsabootinfo.bt_args);
+
+ printf("initarm: Configuring system ...\n");
+
+ /*
+ * Set up the variables that define the availablilty of
+ * physical memory
+ */
+ physical_start = ebsabootinfo.bt_memstart;
+ physical_freestart = physical_start;
+ physical_end = ebsabootinfo.bt_memend;
+ physical_freeend = physical_end;
+ free_pages = (physical_end - physical_start) / PAGE_SIZE;
+
+ physmem = (physical_end - physical_start) / PAGE_SIZE;
+
+ /* Tell the user about the memory */
+ printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
+ physical_start, physical_end - 1);
+
+ /*
+ * Ok the kernel occupies the bottom of physical memory.
+ * The first free page after the kernel can be found in
+ * ebsabootinfo->bt_memavail
+ * We now need to allocate some fixed page tables to get the kernel
+ * going.
+ * We allocate one page directory and a number page tables and store
+ * the physical addresses in the kernel_pt_table array.
+ *
+ * Ok the next bit of physical allocation may look complex but it is
+ * simple really. I have done it like this so that no memory gets
+ * wasted during the allocation of various pages and tables that are
+ * all different sizes.
+ * The start addresses will be page aligned.
+ * We allocate the kernel page directory on the first free 16KB boundry
+ * we find.
+ * We allocate the kernel page tables on the first 4KB boundry we find.
+ * Since we allocate at least 3 L2 pagetables we know that we must
+ * encounter at least one 16KB aligned address.
+ */
+
+#ifdef VERBOSE_INIT_ARM
+ printf("Allocating page tables");
+#endif
+
+ /* Update the address of the first free page of physical memory */
+ physical_freestart = ebsabootinfo.bt_memavail;
+ free_pages -= (physical_freestart - physical_start) / PAGE_SIZE;
+
+#ifdef VERBOSE_INIT_ARM
+ printf(" above %p\n", (void *)physical_freestart);
+#endif
+ /* Define a macro to simplify memory allocation */
+#define valloc_pages(var, np) \
+ alloc_pages((var).pv_pa, (np)); \
+ (var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
+
+#define alloc_pages(var, np) \
+ (var) = physical_freestart; \
+ physical_freestart += ((np) * PAGE_SIZE);\
+ free_pages -= (np); \
+ memset((char *)(var), 0, ((np) * PAGE_SIZE));
+
+ loop1 = 0;
+ kernel_l1pt.pv_pa = 0;
+ for (loop = 0; loop <= NUM_KERNEL_PTS; ++loop) {
+ /* Are we 16KB aligned for an L1 ? */
+ if ((physical_freestart & (L1_TABLE_SIZE - 1)) == 0
+ && kernel_l1pt.pv_pa == 0) {
+ valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
+ } else {
+ valloc_pages(kernel_pt_table[loop1],
+ L2_TABLE_SIZE / PAGE_SIZE);
+ ++loop1;
+ }
+ }
+
+#ifdef DIAGNOSTIC
+ /* This should never be able to happen but better confirm that. */
+ if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (L1_TABLE_SIZE-1)) != 0)
+ panic("initarm: Failed to align the kernel page directory");
+#endif
+
+ /*
+ * Allocate a page for the system page mapped to V0x00000000
+ * This page will just contain the system vectors and can be
+ * shared by all processes.
+ */
+ alloc_pages(systempage.pv_pa, 1);
+
+ /* Allocate stacks for all modes */
+ valloc_pages(irqstack, IRQ_STACK_SIZE);
+ valloc_pages(abtstack, ABT_STACK_SIZE);
+ valloc_pages(undstack, UND_STACK_SIZE);
+ valloc_pages(kernelstack, UPAGES);
+
+#ifdef VERBOSE_INIT_ARM
+ printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa, irqstack.pv_va);
+ printf("ABT stack: p0x%08lx v0x%08lx\n", abtstack.pv_pa, abtstack.pv_va);
+ printf("UND stack: p0x%08lx v0x%08lx\n", undstack.pv_pa, undstack.pv_va);
+ printf("SVC stack: p0x%08lx v0x%08lx\n", kernelstack.pv_pa, kernelstack.pv_va);
+#endif
+
+ alloc_pages(msgbufphys, round_page(MSGBUFSIZE) / PAGE_SIZE);
+
+ /*
+ * Ok we have allocated physical pages for the primary kernel
+ * page tables
+ */
+
+#ifdef VERBOSE_INIT_ARM
+ printf("Creating L1 page table\n");
+#endif
+
+ /*
+ * Now we start consturction of the L1 page table
+ * We start by mapping the L2 page tables into the L1.
+ * This means that we can replace L1 mappings later on if necessary
+ */
+ l1pagetable = kernel_l1pt.pv_pa;
+
+ /* Map the L2 pages tables in the L1 page table */
+ pmap_link_l2pt(l1pagetable, 0x00000000,
+ &kernel_pt_table[KERNEL_PT_SYS]);
+
+ for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++)
+ pmap_link_l2pt(l1pagetable, KERNEL_BASE + loop * 0x00400000,
+ &kernel_pt_table[KERNEL_PT_KERNEL + loop]);
+
+ for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; ++loop)
+ pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
+ &kernel_pt_table[KERNEL_PT_VMDATA + loop]);
+
+ /* update the top of the kernel VM */
+ pmap_curmaxkvaddr =
+ KERNEL_VM_BASE + (KERNEL_PT_VMDATA_NUM * 0x00400000);
+
+#ifdef VERBOSE_INIT_ARM
+ printf("Mapping kernel\n");
+#endif
+
+ /* Now we fill in the L2 pagetable for the kernel static code/data */
+ {
+ extern char etext[], _end[];
+ size_t textsize = (u_int32_t) etext - KERNEL_BASE;
+ size_t totalsize = (u_int32_t) _end - KERNEL_BASE;
+ u_int logical;
+
+ textsize = round_page(textsize);
+ totalsize = round_page(totalsize);
+
+ logical = pmap_map_chunk(l1pagetable, KERNEL_BASE,
+ physical_start, textsize,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+
+ (void) pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
+ physical_start + logical, totalsize - textsize,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+ }
+
+ /*
+ * PATCH PATCH ...
+ *
+ * Fixup the first word of the kernel to be the instruction
+ * add pc, pc, #0x41000000
+ *
+ * This traps the case where the CPU core resets due to bus contention
+ * on a prototype CATS system and will reboot into the firmware.
+ */
+ *((u_int *)KERNEL_TEXT_BASE) = 0xe28ff441;
+
+#ifdef VERBOSE_INIT_ARM
+ printf("Constructing L2 page tables\n");
+#endif
+
+ /* Map the boot arguments page */
+ pmap_map_entry(l1pagetable, ebsabootinfo.bt_vargp,
+ ebsabootinfo.bt_pargp, VM_PROT_READ, PTE_CACHE);
+
+ /* Map the stack pages */
+ pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
+ IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+ pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
+ ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+ pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
+ UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+ pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
+ UPAGES * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+
+ pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
+ L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
+
+ for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
+ pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
+ kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
+ }
+
+ /* Map the vector page. */
+ pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
+ VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+
+ /* Map the core memory needed before autoconfig */
+ loop = 0;
+ while (l1_sec_table[loop].size) {
+ vm_size_t sz;
+
+#ifdef VERBOSE_INIT_ARM
+ printf("%08lx -> %08lx @ %08lx\n", l1_sec_table[loop].pa,
+ l1_sec_table[loop].pa + l1_sec_table[loop].size - 1,
+ l1_sec_table[loop].va);
+#endif
+ for (sz = 0; sz < l1_sec_table[loop].size; sz += L1_S_SIZE)
+ pmap_map_section(l1pagetable,
+ l1_sec_table[loop].va + sz,
+ l1_sec_table[loop].pa + sz,
+ l1_sec_table[loop].prot,
+ l1_sec_table[loop].cache);
+ ++loop;
+ }
+
+ /*
+ * Now we have the real page tables in place so we can switch to them.
+ * Once this is done we will be running with the REAL kernel page tables.
+ */
+#ifdef VERBOSE_INIT_ARM
+ /* checking sttb address */
+ printf("setttb address = %p\n", cpufuncs.cf_setttb);
+
+ printf("kernel_l1pt=0x%08x old = 0x%08x, phys = 0x%08x\n",
+ ((uint*)kernel_l1pt.pv_va)[0xf00],
+ ((uint*)ebsabootinfo.bt_l1)[0xf00],
+ ((uint*)kernel_l1pt.pv_pa)[0xf00]);
+
+ printf("old pt @ %p, new pt @ %p\n", (uint*)kernel_l1pt.pv_pa, (uint*)ebsabootinfo.bt_l1);
+
+ printf("Enabling System access\n");
+#endif
+ /*
+ * enable the system bit in the control register, otherwise we can't
+ * access the kernel after the switch to the new L1 table
+ * I suspect cyclone hid this problem, by enabling the ROM bit
+ * Note can not have both SYST and ROM enabled together, the results
+ * are "undefined"
+ */
+ cpu_control(CPU_CONTROL_SYST_ENABLE | CPU_CONTROL_ROM_ENABLE, CPU_CONTROL_SYST_ENABLE);
+#ifdef VERBOSE_INIT_ARM
+ printf("switching domains\n");
+#endif
+ /* be a client to all domains */
+ cpu_domains(0x55555555);
+ /* Switch tables */
+#ifdef VERBOSE_INIT_ARM
+ printf("switching to new L1 page table\n");
+#endif
+
+ /*
+ * Ok the DC21285 CSR registers are about to be moved.
+ * Detach the diagnostic serial port.
+ */
+#ifdef FCOM_INIT_ARM
+ fcomcndetach();
+#endif
+
+ setttb(kernel_l1pt.pv_pa);
+debugledaddr = (void*)(DC21285_PCI_IO_VBASE+DEBUG_LED_OFFSET);
+ cpu_tlb_flushID();
+ cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
+ /*
+ * Moved from cpu_startup() as data_abort_handler() references
+ * this during uvm init
+ */
+ proc0paddr = (struct user *)kernelstack.pv_va;
+ proc0.p_addr = proc0paddr;
+ /*
+ * XXX this should only be done in main() but it useful to
+ * have output earlier ...
+ */
+ consinit();
+
+#ifdef VERBOSE_INIT_ARM
+ printf("bootstrap done.\n");
+#endif
+
+ arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);
+
+ /*
+ * Pages were allocated during the secondary bootstrap for the
+ * stacks for different CPU modes.
+ * We must now set the r13 registers in the different CPU modes to
+ * point to these stacks.
+ * Since the ARM stacks use STMFD etc. we must set r13 to the top end
+ * of the stack memory.
+ */
+ printf("init subsystems: stacks ");
+
+ set_stackptr(PSR_IRQ32_MODE,
+ irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE);
+ set_stackptr(PSR_ABT32_MODE,
+ abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE);
+ set_stackptr(PSR_UND32_MODE,
+ undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE);
+
+ /*
+ * Well we should set a data abort handler.
+ * Once things get going this will change as we will need a proper handler.
+ * Until then we will use a handler that just panics but tells us
+ * why.
+ * Initialisation of the vectors will just panic on a data abort.
+ * This just fills in a slighly better one.
+ */
+ printf("vectors ");
+ data_abort_handler_address = (u_int)data_abort_handler;
+ prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
+ undefined_handler_address = (u_int)undefinedinstruction_bounce;
+
+ /* At last !
+ * We now have the kernel in physical memory from the bottom upwards.
+ * Kernel page tables are physically above this.
+ * The kernel is mapped to KERNEL_TEXT_BASE
+ * The kernel data PTs will handle the mapping of 0xf1000000-0xf3ffffff
+ * The page tables are mapped to 0xefc00000
+ */
+
+ /* Initialise the undefined instruction handlers */
+ printf("undefined ");
+ undefined_init();
+
+ /* Load memory into UVM. */
+ printf("page ");
+ uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
+
+ /* XXX Always one RAM block -- nuke the loop. */
+ for (loop = 0; loop < bootconfig.dramblocks; loop++) {
+ paddr_t start = (paddr_t)bootconfig.dram[loop].address;
+ paddr_t end = start + (bootconfig.dram[loop].pages * PAGE_SIZE);
+#if NISADMA > 0
+ paddr_t istart, isize;
+ extern struct arm32_dma_range *footbridge_isa_dma_ranges;
+ extern int footbridge_isa_dma_nranges;
+#endif
+
+ if (start < physical_freestart)
+ start = physical_freestart;
+ if (end > physical_freeend)
+ end = physical_freeend;
+
+#if 0
+ printf("%d: %lx -> %lx\n", loop, start, end - 1);
+#endif
+
+#if NISADMA > 0
+ if (arm32_dma_range_intersect(footbridge_isa_dma_ranges,
+ footbridge_isa_dma_nranges,
+ start, end - start,
+ &istart, &isize)) {
+ /*
+ * Place the pages that intersect with the
+ * ISA DMA range onto the ISA DMA free list.
+ */
+#if 0
+ printf(" ISADMA 0x%lx -> 0x%lx\n", istart,
+ istart + isize - 1);
+#endif
+ uvm_page_physload(atop(istart),
+ atop(istart + isize), atop(istart),
+ atop(istart + isize), VM_FREELIST_ISADMA);
+
+ /*
+ * Load the pieces that come before the
+ * intersection onto the default free list.
+ */
+ if (start < istart) {
+#if 0
+ printf(" BEFORE 0x%lx -> 0x%lx\n",
+ start, istart - 1);
+#endif
+ uvm_page_physload(atop(start),
+ atop(istart), atop(start),
+ atop(istart), VM_FREELIST_DEFAULT);
+ }
+
+ /*
+ * Load the pieces that come after the
+ * intersection onto the default free list.
+ */
+ if ((istart + isize) < end) {
+#if 0
+ printf(" AFTER 0x%lx -> 0x%lx\n",
+ (istart + isize), end - 1);
+#endif
+ uvm_page_physload(atop(istart + isize),
+ atop(end), atop(istart + isize),
+ atop(end), VM_FREELIST_DEFAULT);
+ }
+ } else {
+ uvm_page_physload(atop(start), atop(end),
+ atop(start), atop(end), VM_FREELIST_DEFAULT);
+ }
+#else /* NISADMA > 0 */
+ uvm_page_physload(atop(start), atop(end),
+ atop(start), atop(end), VM_FREELIST_DEFAULT);
+#endif /* NISADMA > 0 */
+ }
+
+ /* Boot strap pmap telling it where the kernel page table is */
+ printf("pmap ");
+ pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, KERNEL_VM_BASE,
+ KERNEL_VM_BASE + KERNEL_VM_SIZE);
+
+ /* Setup the IRQ system */
+ printf("irq ");
+ footbridge_intr_init();
+ printf("done.\n");
+
+#ifdef IPKDB
+ /* Initialise ipkdb */
+ ipkdb_init();
+ if (boothowto & RB_KDB)
+ ipkdb_connect(0);
+#endif
+
+#if 0
+#if NKSYMS || defined(DDB) || defined(LKM)
+#ifdef __ELF__
+ /* ok this is really rather sick, in ELF what happens is that the
+ * ELF symbol table is added after the text section.
+ */
+ ksyms_init(0, NULL, NULL); /* XXX */
+#else
+ {
+ extern int end;
+ extern int *esym;
+
+ ksyms_init(*(int *)&end, ((int *)&end) + 1, esym);
+ }
+#endif /* __ELF__ */
+#endif
+#endif
+
+#ifdef DDB
+ db_machine_init();
+ if (boothowto & RB_KDB)
+ Debugger();
+#endif
+
+ /* We return the new stack pointer address */
+ return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
+}
+
+static void
+process_kernel_args(args)
+ char *args;
+{
+
+ boothowto = 0;
+
+ /* Make a local copy of the bootargs */
+ strncpy(bootargs, args, MAX_BOOT_STRING);
+
+ args = bootargs;
+ boot_file = bootargs;
+
+ /* Skip the kernel image filename */
+ while (*args != ' ' && *args != 0)
+ ++args;
+
+ if (*args != 0)
+ *args++ = 0;
+
+ while (*args == ' ')
+ ++args;
+
+ boot_args = args;
+
+ printf("bootfile: %s\n", boot_file);
+ printf("bootargs: %s\n", boot_args);
+
+#if 0
+ parse_mi_bootargs(boot_args);
+#endif
+}
+
+extern struct bus_space footbridge_pci_io_bs_tag;
+extern struct bus_space footbridge_pci_mem_bs_tag;
+void footbridge_pci_bs_tag_init __P((void));
+
+void
+consinit(void)
+{
+ static int consinit_called = 0;
+ char *console = CONSDEVNAME;
+
+ if (consinit_called != 0)
+ return;
+
+ consinit_called = 1;
+
+#if NISA > 0
+ /* Initialise the ISA subsystem early ... */
+ isa_footbridge_init(DC21285_PCI_IO_VBASE, DC21285_PCI_ISA_MEM_VBASE);
+#endif
+
+ footbridge_pci_bs_tag_init();
+
+ get_bootconf_option(boot_args, "console", BOOTOPT_TYPE_STRING,
+ &console);
+
+ if (strncmp(console, "fcom", 4) == 0
+ || strncmp(console, "diag", 4) == 0) {
+ fcomcnattach(DC21285_ARMCSR_VBASE, comcnspeed, comcnmode);
+ }
+#if (NVGA > 0)
+ else if (strncmp(console, "vga", 3) == 0) {
+ vga_cnattach(&footbridge_pci_io_bs_tag,
+ &footbridge_pci_mem_bs_tag, - 1, 0);
+#if (NPCKBC > 0)
+ pckbc_cnattach(&isa_io_bs_tag, IO_KBD, KBCMDP, PCKBC_KBD_SLOT);
+#endif /* NPCKBC */
+ }
+#endif /* NVGA */
+#if (NCOM > 0)
+ else if (strncmp(console, "com", 3) == 0) {
+ if (comcnattach(&isa_io_bs_tag, CONCOMADDR, comcnspeed,
+ COM_FREQ, comcnmode))
+ panic("can't init serial console @%x", CONCOMADDR);
+ }
+#endif
+ /* Don't know what console was requested so use the fall back. */
+ else
+ fcomcnattach(DC21285_ARMCSR_VBASE, comcnspeed, comcnmode);
+}
+
+/* End of ebsa285_machdep.c */
diff --git a/sys/arch/cats/compile/.cvsignore b/sys/arch/cats/compile/.cvsignore
new file mode 100644
index 00000000000..b72af3039e6
--- /dev/null
+++ b/sys/arch/cats/compile/.cvsignore
@@ -0,0 +1,2 @@
+GENERIC
+RAMDISK
diff --git a/sys/arch/cats/conf/GENERIC b/sys/arch/cats/conf/GENERIC
new file mode 100644
index 00000000000..22fa56f2c03
--- /dev/null
+++ b/sys/arch/cats/conf/GENERIC
@@ -0,0 +1,349 @@
+# $OpenBSD: GENERIC,v 1.1 2004/02/01 05:12:54 drahn Exp $
+# $NetBSD: GENERIC,v 1.27.4.1 2002/08/01 04:18:06 lukem Exp $
+#
+# GENERIC machine description file
+#
+# This machine description file is used to generate the default NetBSD
+# kernel. The generic kernel does not include all options, subsystems
+# and device drivers, but should be useful for most applications.
+#
+# The machine description file can be customised for your specific
+# machine to reduce the kernel size and improve its performance.
+#
+# For further information on compiling NetBSD kernels, see the config(8)
+# man page.
+#
+# For further information on hardware support for this architecture, see
+# the intro(4) man page. For further information about kernel options
+# for this architecture, see the options(4) man page. For an explanation
+# of each device driver in this file see the section 4 man page for the
+# device.
+
+machine cats arm
+
+include "../../../conf/GENERIC"
+
+options ARM32
+options FOOTBRIDGE_INTR
+
+# estimated number of users
+
+maxusers 32
+
+# Standard system options
+
+#options UCONSOLE # users can use TIOCCONS (for xconsole)
+#options INSECURE # disable kernel securelevel
+
+#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
+#options NTP # NTP phase/frequency locked loop
+
+# CPU options
+
+# For StrongARM systems
+options CPU_SA110 # Support the SA110 core
+
+# FPA options
+
+#options ARMFPE # ARM Ltd FPE
+
+
+
+
+# Compatibility options
+
+option WSDISPLAY_COMPAT_USL # VT handling
+option WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
+option WSDISPLAY_DEFAULTSCREENS=6 # can get raw scancodes
+option WSDISPLAY_COMPAT_PCVT # can get raw scancodes
+
+
+config bsd swap generic
+
+# The main bus device
+mainbus0 at root
+
+# The boot cpu
+cpu0 at mainbus?
+
+# Core logic
+footbridge0 at mainbus?
+
+# footbridge uart
+fcom0 at footbridge?
+
+# system clock via footbridge
+#clock* at footbridge?
+
+# time-of-day device via footbridge or RTC
+todclock0 at todservice?
+
+# PCI bus support
+# PCI bus via footbridge
+pci0 at footbridge? # PCI bus
+
+pci* at ppb? bus ?
+
+option PCIVERBOSE
+option USBVERBOSE
+
+# PCI bridges
+ppb* at pci? dev ? function ? # PCI-PCI bridges
+# XXX 'puc's aren't really bridges, but there's no better place for them here
+#puc* at pci? dev ? function ? # PCI "universal" comm. cards
+
+# PCI serial interfaces
+#com* at puc? port ? # 16x50s on "universal" comm boards
+#cy* at pci? dev ? function ? # Cyclades Cyclom-Y serial boards
+
+# PCI parallel printer interfaces
+#lpt* at puc? port ? # || ports on "universal" comm boards
+
+# PCI SCSI Controllers and Buses
+adv* at pci? dev ? function ? # AdvanSys 1200[A,B], ULTRA SCSI
+scsibus* at adv?
+#adw* at pci? dev ? function ? # AdvanSys 9xxUW SCSI
+#scsibus* at adw?
+ahc* at pci? dev ? function ? # Adaptec [23]94x, aic78x0 SCSI controllers
+scsibus* at ahc?
+#bha* at pci? dev ? function ? # BusLogic 9xx SCSI
+#scsibus* at bha?
+iha* at pci? dev ? function ? # Initio INIC-940/950 SCSI
+scsibus* at iha?
+#isp* at pci? dev ? function ? # Qlogic ISP 10x0 SCSI controllers
+#scsibus* at isp?
+pcscp* at pci? dev ? function ? # AMD 53c974 PCscsi-PCI SCSI
+scsibus* at pcscp?
+siop* at pci? dev ? function ? # NCR 53c8xx SCSI
+scsibus* at siop?
+
+# SCSI devices
+sd* at scsibus? target ? lun ? # SCSI disk drives
+st* at scsibus? target ? lun ? # SCSI tape drives
+cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
+#ch* at scsibus? target ? lun ? # SCSI auto-changers
+#uk* at scsibus? target ? lun ? # SCSI unknown device
+#ss* at scsibus? target ? lun ? # SCSI scanner
+
+# PCI IDE Controllers and Devices
+# PCI IDE controllers - see pciide(4) for supported hardware.
+# The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
+# how to set up DMA modes for this chip. This may work, or may cause
+# a machine hang with some controllers.
+pciide* at pci? dev ? function ? flags 0x0000
+
+# IDE drives
+# Flags are used only with controllers that support DMA operations
+# and mode settings (e.g. some pciide controllers)
+# The lowest order four bits (rightmost digit) of the flags define the PIO
+# mode to use, the next set of four bits the DMA mode and the third set the
+# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
+# to use, and the last bit must be 1 for this setting to be used.
+# For DMA and UDMA, 0xf (1111) means 'disable'.
+# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
+# (0xc=1100, 0xa=1010, 0xf=1111)
+# 0x0000 means "use whatever the drive claims to support".
+wd* at pciide? channel ? drive ? flags 0x0000 # the drives themselves
+
+# ATAPI bus support
+atapiscsi* at pciide? channel ?
+scsibus* at atapiscsi?
+
+# PCI network interfaces
+#en* at pci? dev ? function ? # ENI/Adaptec ATM
+#ep* at pci? dev ? function ? # 3C590 ethernet cards
+fxp* at pci? dev ? function ? # Intel EtherExpress PRO 10+/100B
+ne* at pci? dev ? function ? # NE2000 compat ethernet
+#ntwoc* at pci? dev ? function ? # Riscom/N2 PCI Sync Serial
+dc* at pci? dev ? function ? # DECchip 21x4x and clones
+de* at pci? dev ? function ? # DECchip 21x4x and clones
+vr* at pci? dev ? function ? # VIA Rhine Fast Ethernet
+#lmc* at pci? dev ? function ? # Lan Media Corp SSI/HSSI/DS3
+
+# MII/PHY support
+exphy* at mii? phy ? # 3Com internal PHYs
+#icsphy* at mii? phy ? # Integrated Circuit Systems ICS189x
+inphy* at mii? phy ? # Intel 82555 PHYs
+#iophy* at mii? phy ? # Intel 82553 PHYs
+#lxtphy* at mii? phy ? # Level One LXT-970 PHYs
+nsphy* at mii? phy ? # NS83840 PHYs
+#nsphyter* at mii? phy ? # NS83843 PHYs
+qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs
+#sqphy* at mii? phy ? # Seeq 80220/80221/80223 PHYs
+#tlphy* at mii? phy ? # ThunderLAN PHYs
+#tqphy* at mii? phy ? # TDK Semiconductor PHYs
+ukphy* at mii? phy ? # generic unknown PHYs
+
+# USB Controller and Devices
+
+# PCI USB controllers
+ohci* at pci? # Open Host Controller
+
+# USB bus support
+usb* at ohci?
+
+# USB Hubs
+uhub* at usb?
+uhub* at uhub? port ? configuration ? interface ?
+
+# USB HID device
+uhidev* at uhub? port ? configuration ? interface ?
+
+# USB Mice
+ums* at uhidev? reportid ?
+wsmouse* at ums?
+
+# USB Keyboards
+ukbd* at uhidev? reportid ?
+wskbd* at ukbd? console ?
+
+# USB Generic HID devices
+uhid* at uhidev? reportid ?
+
+# USB Printer
+ulpt* at uhub? port ? configuration ? interface ?
+
+# USB Modem
+umodem* at uhub? port ? configuration ?
+ucom* at umodem?
+
+# USB Mass Storage
+umass* at uhub? port ? configuration ? interface ?
+atapiscsi* at umass?
+scsibus* at umass?
+
+# USB audio
+uaudio* at uhub? port ? configuration ?
+audio* at uaudio?
+
+# USB MIDI
+umidi* at uhub? port ? configuration ?
+midi* at umidi?
+
+# USB Ethernet adapters
+aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
+cue* at uhub? port ? # CATC USB-EL1201A based adapters
+kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters
+
+# Prolofic PL2301/PL2302 host-to-host adapter
+upl* at uhub? port ?
+
+# Serial adapters
+# FTDI FT8U100AX serial adapter
+uftdi* at uhub? port ?
+ucom* at uftdi? portno ?
+
+uplcom* at uhub? port ? # I/O DATA USB-RSAQ2 serial adapter
+ucom* at uplcom? portno ?
+
+umct* at uhub? port ? # MCT USB-RS232 serial adapter
+ucom* at umct? portno ?
+
+# Diamond Multimedia Rio 500
+urio* at uhub? port ?
+
+# USB Handspring Visor
+uvisor* at uhub? port ?
+ucom* at uvisor?
+
+# USB scanners
+uscanner* at uhub? port ?
+
+# USB scanners that use SCSI emulation, e.g., HP5300
+usscanner* at uhub? port ?
+scsibus* at usscanner?
+
+# Y@P firmware loader
+uyap* at uhub? port ?
+
+# USB Generic driver
+ugen* at uhub? port ?
+
+# Audio Devices
+
+# PCI audio devices
+#eap* at pci? dev ? function ? # Ensoniq AudioPCI
+#sv* at pci? dev ? function ? # S3 SonicVibes
+
+# Audio support
+#audio* at eap?
+#audio* at sv?
+
+vga* at pci?
+wsdisplay* at vga? console ?
+
+# ISA bus bridging
+
+pcib* at pci? dev ? function ? # PCI-ISA bridge
+isa* at pcib? # ISA bus
+
+# ISA Plug-and-Play bus support
+#isapnp0 at isa?
+
+# wscons
+pckbc0 at isa? # pc keyboard controller
+pckbd* at pckbc? # PC keyboard
+pms* at pckbc? # PS/2 mouse for wsmouse
+wskbd* at pckbd? console ?
+wsmouse* at pms?
+
+pcppi0 at isa?
+sysbeep0 at pcppi?
+
+# ISA Plug-and-Play serial interfaces
+#com* at isapnp? # Modems and serial boards
+
+# ISA Plug-and-Play network interfaces
+#ep* at isapnp? # 3Com 3c509 Ethernet
+
+# ISA serial interfaces
+com0 at isa? port 0x3f8 irq 4 # Standard PC serial ports
+com1 at isa? port 0x2f8 irq 3
+#com2 at isa? port 0x3e8 irq 9
+#com3 at isa? port 0x2e8 irq 10
+
+# ISA parallel printer interfaces
+lpt0 at isa? port 0x378 irq 7 # standard PC parallel ports
+lpt1 at isa? port 0x278 irq 5
+#lpt2 at isa? port 0x3bc
+
+# ISA floppy
+#fdc0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy controllers
+#fdc1 at isa? port 0x370 irq ? drq ?
+#fd* at fdc? drive ? # the drives themselves
+
+# ISA network interface
+#ne0 at isa? port 0x280 irq 9
+#ne1 at isa? port 0x300 irq 10
+#ep* at isa? port ? irq ?
+
+# The spkr driver provides a simple tone interface to the built in speaker.
+spkr0 at pcppi? # PC speaker
+
+ds1687rtc0 at isa? port 0x72 # Dallas RTC
+
+# ISA Plug-and-Play audio devices
+#ess* at isapnp? # ESS Tech ES1887, ES1888, ES888 audio
+#sb* at isapnp? # SoundBlaster-compatible audio
+#wss* at isapnp? # Windows Sound System
+
+# MPU 401 UARTs
+#mpu* at sb?
+
+# MIDI support
+midi* at pcppi? # MIDI interface to the PC speaker
+#midi* at mpu? # MPU 401
+
+# Joysticks
+
+# ISA Plug-and-Play joysticks
+#joy* at isapnp? # Game ports (usually on audio cards)
+
+# ISA joysticks. Probe is a little strange; add only if you have one.
+#joy0 at isa? port 0x201
+
+# Pseudo-Devices
+
+# mouse & keyboard multiplexor pseudo-devices
+pseudo-device wsmux 2
+pseudo-device crypto 1
diff --git a/sys/arch/cats/conf/Makefile.cats b/sys/arch/cats/conf/Makefile.cats
new file mode 100644
index 00000000000..4970327a07b
--- /dev/null
+++ b/sys/arch/cats/conf/Makefile.cats
@@ -0,0 +1,214 @@
+# $OpenBSD: Makefile.cats,v 1.1 2004/02/01 05:12:54 drahn Exp $
+# $OpenBSD: Makefile.cats,v 1.1 2004/02/01 05:12:54 drahn Exp $
+# $NetBSD: Makefile.i386,v 1.67 1996/05/11 16:12:11 mycroft Exp $
+
+# Makefile for OpenBSD
+#
+# This makefile is constructed from a machine description:
+# config machineid
+# Most changes should be made in the machine description
+# /sys/arch/cats/conf/``machineid''
+# after which you should do
+# config machineid
+# Machine generic makefile changes should be made in
+# /sys/arch/cats/conf/Makefile.cats
+# after which config should be rerun for all machines of that type.
+#
+# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
+# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
+#
+# -DTRACE compile in kernel tracing hooks
+# -DQUOTA compile in file system quotas
+
+# DEBUG is set to -g if debugging.
+# PROF is set to -pg if profiling.
+
+.include <bsd.own.mk>
+
+MKDEP?= mkdep
+SIZE?= size
+STRIP?= strip
+
+# source tree is located via $S relative to the compilation directory
+.ifndef S
+S!= cd ../../../..; pwd
+.endif
+CATS= $S/arch/cats
+ARM= $S/arch/arm
+
+INCLUDES= -nostdinc -I. -I$S/arch -I$S
+CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -D__cats__
+CDIAGFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
+ -Wno-uninitialized -Wno-format -Wno-main
+
+CMACHFLAGS= -ffreestanding
+#CMACHFLAGS= -march=armv4 -mtune=strongarm -ffreestanding
+.if ${IDENT:M-DNO_PROPOLICE}
+CMACHFLAGS+= -msoft-float -fno-stack-protector
+.endif
+CMACHFLAGS+= -msoft-float -fno-builtin-printf -fno-builtin-log
+
+COPTS?= -O2
+CFLAGS= ${DEBUG} ${CDIAGFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
+AFLAGS= -x assembler-with-cpp -D_LOCORE ${CMACHFLAGS}
+#LINKFLAGS= -Ttext 0xF0000020 -e start --warn-common
+#LINKFLAGS= -T ${CATS}/conf/kern.ldscript
+LINKFLAGS= -T ${CATS}/conf/ldscript.elf
+LINKFLAGS+= --warn-common
+STRIPFLAGS= -g -X -x
+
+HOSTCC= ${CC}
+HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
+HOSTED_CFLAGS= ${CFLAGS}
+
+### find out what to use for libkern
+.include "$S/lib/libkern/Makefile.inc"
+.ifndef PROF
+LIBKERN= ${KERNLIB}
+.else
+LIBKERN= ${KERNLIB_PROF}
+.endif
+
+### find out what to use for libcompat
+.include "$S/compat/common/Makefile.inc"
+.ifndef PROF
+LIBCOMPAT= ${COMPATLIB}
+.else
+LIBCOMPAT= ${COMPATLIB_PROF}
+.endif
+
+# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
+# where TYPE is NORMAL, DRIVER, or PROFILE; SUFFIX is the file suffix,
+# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
+# is marked as config-dependent.
+
+NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
+
+DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
+
+NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
+NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
+
+HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
+
+%OBJS
+
+%CFILES
+
+%SFILES
+
+# load lines for config "xxx" will be emitted as:
+# xxx: ${SYSTEM_DEP} swapxxx.o
+# ${SYSTEM_LD_HEAD}
+# ${SYSTEM_LD} swapxxx.o
+# ${SYSTEM_LD_TAIL}
+SYSTEM_OBJ= locore.o \
+ param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
+SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
+SYSTEM_LD_HEAD= rm -f $@
+SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
+ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
+SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
+
+DEBUG?=
+.if ${DEBUG} == "-g"
+LINKFLAGS+= -X
+SYSTEM_LD_TAIL+=; \
+ echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
+ echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
+.else
+LINKFLAGS+= -x
+.endif
+
+%LOAD
+
+assym.h: $S/kern/genassym.sh ${ARM}/arm/genassym.cf Makefile
+ cat ${ARM}/arm/genassym.cf | \
+ sh $S/kern/genassym.sh ${CC} ${CFLAGS} \
+ ${CPPFLAGS} ${PARAM} > assym.h.tmp && \
+ mv -f assym.h.tmp assym.h
+
+param.c: $S/conf/param.c
+ rm -f param.c
+ cp $S/conf/param.c .
+
+param.o: param.c Makefile
+ ${NORMAL_C_C}
+
+ioconf.o: ioconf.c
+ ${NORMAL_C}
+
+newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
+ sh $S/conf/newvers.sh
+ ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
+
+
+clean::
+ rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \
+ [Ee]rrs linterrs makelinks assym.h
+
+lint:
+ @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ ${CFILES} ioconf.c param.c | \
+ grep -v 'static function .* unused'
+
+tags:
+ @echo "see $S/kern/Makefile for tags"
+
+links:
+ egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
+ sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
+ echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
+ sort -u | comm -23 - dontlink | \
+ sed 's,.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
+ sh makelinks && rm -f dontlink makelinks
+
+SRCS= ${ARM}/arm/locore.S \
+ param.c ioconf.c ${CFILES} ${SFILES}
+depend:: .depend
+.depend: ${SRCS} assym.h param.c ${APMINC}
+ ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm/locore.S
+ ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+ ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
+ cat ${ARM}/arm/genassym.cf ${ARM}/footbridge/genassym.cf | \
+ sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
+ ${CPPFLAGS}
+ @sed -e 's/.*\.o:.* /assym.h: /' < assym.dep >> .depend
+ @rm -f assym.dep
+
+
+# depend on root or device configuration
+autoconf.o conf.o: Makefile
+
+# depend on network or filesystem configuration
+uipc_domain.o uipc_proto.o vfs_conf.o: Makefile
+if.o if_tun.o if_loop.o if_ethersubr.o: Makefile
+if_arp.o if_ether.o: Makefile
+ip_input.o ip_output.o in_pcb.o in_proto.o: Makefile
+tcp_subr.o tcp_timer.o tcp_output.o: Makefile
+
+# depend on maxusers
+machdep.o: Makefile
+
+# depend on CPU configuration
+locore.o machdep.o: Makefile
+
+
+locore.o: ${ARM}/arm/locore.S assym.h
+ ${NORMAL_S}
+
+# The install target can be redefined by putting a
+# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
+MACHINE_NAME!= uname -n
+install: install-kernel-${MACHINE_NAME}
+.if !target(install-kernel-${MACHINE_NAME}})
+install-kernel-${MACHINE_NAME}:
+ rm -f /obsd
+ ln /bsd /obsd
+ cp bsd /nbsd
+ mv /nbsd /bsd
+.endif
+
+%RULES
diff --git a/sys/arch/cats/conf/RAMDISK b/sys/arch/cats/conf/RAMDISK
new file mode 100644
index 00000000000..19436ee5ac6
--- /dev/null
+++ b/sys/arch/cats/conf/RAMDISK
@@ -0,0 +1,374 @@
+# $OpenBSD: RAMDISK,v 1.1 2004/02/01 05:12:54 drahn Exp $
+# $NetBSD: GENERIC,v 1.27.4.1 2002/08/01 04:18:06 lukem Exp $
+#
+# GENERIC machine description file
+#
+# This machine description file is used to generate the default NetBSD
+# kernel. The generic kernel does not include all options, subsystems
+# and device drivers, but should be useful for most applications.
+#
+# The machine description file can be customised for your specific
+# machine to reduce the kernel size and improve its performance.
+#
+# For further information on compiling NetBSD kernels, see the config(8)
+# man page.
+#
+# For further information on hardware support for this architecture, see
+# the intro(4) man page. For further information about kernel options
+# for this architecture, see the options(4) man page. For an explanation
+# of each device driver in this file see the section 4 man page for the
+# device.
+
+machine cats arm
+
+# include "../../../conf/GENERIC"
+option TIMEZONE=0 # time zone to adjust RTC time by
+option DST=0 # daylight saving time used by RTC
+option COMPAT_43 # and 4.3BSD
+option FFS # UFS
+option NFSCLIENT # Network File System client
+option CD9660 # ISO 9660 + Rock Ridge file system
+option MSDOSFS # MS-DOS file system
+option INET # IP + ICMP + TCP + UDP
+option INET6 # IPv6 (needs INET)
+option DDB # kernel debugger
+option EXT2FS # Second Extended Filesystem
+option FIFO # FIFOs; RECOMMENDED
+
+options SYSCALL_DEBUG
+options ARM32
+options FOOTBRIDGE_INTR
+
+# estimated number of users
+
+maxusers 32
+
+# Standard system options
+
+#options UCONSOLE # users can use TIOCCONS (for xconsole)
+#options INSECURE # disable kernel securelevel
+
+#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
+#options NTP # NTP phase/frequency locked loop
+
+# CPU options
+
+# For StrongARM systems
+options CPU_SA110 # Support the SA110 core
+
+# FPA options
+
+#options ARMFPE # ARM Ltd FPE
+
+
+
+
+# Compatibility options
+
+option WSDISPLAY_COMPAT_USL # VT handling
+option WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
+option WSDISPLAY_DEFAULTSCREENS=6 # can get raw scancodes
+option WSDISPLAY_COMPAT_PCVT # can get raw scancodes
+
+
+#config bsd swap generic
+config bsd root on rd0a swap on rd0b
+
+# The main bus device
+mainbus0 at root
+
+# The boot cpu
+cpu0 at mainbus?
+
+# Core logic
+footbridge0 at mainbus?
+
+# footbridge uart
+fcom0 at footbridge?
+
+# system clock via footbridge
+#clock* at footbridge?
+
+# time-of-day device via footbridge or RTC
+todclock0 at todservice?
+
+# PCI bus support
+# PCI bus via footbridge
+pci0 at footbridge? # PCI bus
+
+pci* at ppb? bus ?
+
+option PCIVERBOSE
+option USBVERBOSE
+
+# PCI bridges
+ppb* at pci? dev ? function ? # PCI-PCI bridges
+# XXX 'puc's aren't really bridges, but there's no better place for them here
+#puc* at pci? dev ? function ? # PCI "universal" comm. cards
+
+# PCI serial interfaces
+#com* at puc? port ? # 16x50s on "universal" comm boards
+#cy* at pci? dev ? function ? # Cyclades Cyclom-Y serial boards
+
+# PCI parallel printer interfaces
+#lpt* at puc? port ? # || ports on "universal" comm boards
+
+# PCI SCSI Controllers and Buses
+adv* at pci? dev ? function ? # AdvanSys 1200[A,B], ULTRA SCSI
+scsibus* at adv?
+#adw* at pci? dev ? function ? # AdvanSys 9xxUW SCSI
+#scsibus* at adw?
+ahc* at pci? dev ? function ? # Adaptec [23]94x, aic78x0 SCSI controllers
+scsibus* at ahc?
+#bha* at pci? dev ? function ? # BusLogic 9xx SCSI
+#scsibus* at bha?
+iha* at pci? dev ? function ? # Initio INIC-940/950 SCSI
+scsibus* at iha?
+#isp* at pci? dev ? function ? # Qlogic ISP 10x0 SCSI controllers
+#scsibus* at isp?
+pcscp* at pci? dev ? function ? # AMD 53c974 PCscsi-PCI SCSI
+scsibus* at pcscp?
+siop* at pci? dev ? function ? # NCR 53c8xx SCSI
+scsibus* at siop?
+
+# SCSI devices
+sd* at scsibus? target ? lun ? # SCSI disk drives
+st* at scsibus? target ? lun ? # SCSI tape drives
+cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
+#ch* at scsibus? target ? lun ? # SCSI auto-changers
+#uk* at scsibus? target ? lun ? # SCSI unknown device
+#ss* at scsibus? target ? lun ? # SCSI scanner
+
+# PCI IDE Controllers and Devices
+# PCI IDE controllers - see pciide(4) for supported hardware.
+# The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
+# how to set up DMA modes for this chip. This may work, or may cause
+# a machine hang with some controllers.
+pciide* at pci? dev ? function ? flags 0x0000
+
+# IDE drives
+# Flags are used only with controllers that support DMA operations
+# and mode settings (e.g. some pciide controllers)
+# The lowest order four bits (rightmost digit) of the flags define the PIO
+# mode to use, the next set of four bits the DMA mode and the third set the
+# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
+# to use, and the last bit must be 1 for this setting to be used.
+# For DMA and UDMA, 0xf (1111) means 'disable'.
+# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
+# (0xc=1100, 0xa=1010, 0xf=1111)
+# 0x0000 means "use whatever the drive claims to support".
+wd* at pciide? channel ? drive ? flags 0x0000 # the drives themselves
+
+# ATAPI bus support
+atapiscsi* at pciide? channel ?
+scsibus* at atapiscsi?
+
+# PCI network interfaces
+#en* at pci? dev ? function ? # ENI/Adaptec ATM
+#ep* at pci? dev ? function ? # 3C590 ethernet cards
+fxp* at pci? dev ? function ? # Intel EtherExpress PRO 10+/100B
+ne* at pci? dev ? function ? # NE2000 compat ethernet
+#ntwoc* at pci? dev ? function ? # Riscom/N2 PCI Sync Serial
+dc* at pci? dev ? function ? # DECchip 21x4x and clones
+de* at pci? dev ? function ? # DECchip 21x4x and clones
+vr* at pci? dev ? function ? # VIA Rhine Fast Ethernet
+#lmc* at pci? dev ? function ? # Lan Media Corp SSI/HSSI/DS3
+
+# MII/PHY support
+exphy* at mii? phy ? # 3Com internal PHYs
+#icsphy* at mii? phy ? # Integrated Circuit Systems ICS189x
+inphy* at mii? phy ? # Intel 82555 PHYs
+#iophy* at mii? phy ? # Intel 82553 PHYs
+#lxtphy* at mii? phy ? # Level One LXT-970 PHYs
+nsphy* at mii? phy ? # NS83840 PHYs
+#nsphyter* at mii? phy ? # NS83843 PHYs
+qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs
+#sqphy* at mii? phy ? # Seeq 80220/80221/80223 PHYs
+#tlphy* at mii? phy ? # ThunderLAN PHYs
+#tqphy* at mii? phy ? # TDK Semiconductor PHYs
+ukphy* at mii? phy ? # generic unknown PHYs
+
+# USB Controller and Devices
+
+# PCI USB controllers
+ohci* at pci? # Open Host Controller
+
+# USB bus support
+usb* at ohci?
+
+# USB Hubs
+uhub* at usb?
+uhub* at uhub? port ? configuration ? interface ?
+
+# USB HID device
+uhidev* at uhub? port ? configuration ? interface ?
+
+# USB Mice
+ums* at uhidev? reportid ?
+wsmouse* at ums?
+
+# USB Keyboards
+ukbd* at uhidev? reportid ?
+wskbd* at ukbd? console ?
+
+# USB Generic HID devices
+uhid* at uhidev? reportid ?
+
+# USB Printer
+ulpt* at uhub? port ? configuration ? interface ?
+
+# USB Modem
+umodem* at uhub? port ? configuration ?
+ucom* at umodem?
+
+# USB Mass Storage
+umass* at uhub? port ? configuration ? interface ?
+atapiscsi* at umass?
+scsibus* at umass?
+
+# USB audio
+uaudio* at uhub? port ? configuration ?
+audio* at uaudio?
+
+# USB MIDI
+umidi* at uhub? port ? configuration ?
+midi* at umidi?
+
+# USB Ethernet adapters
+aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters
+cue* at uhub? port ? # CATC USB-EL1201A based adapters
+kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters
+
+# Prolofic PL2301/PL2302 host-to-host adapter
+upl* at uhub? port ?
+
+# Serial adapters
+# FTDI FT8U100AX serial adapter
+uftdi* at uhub? port ?
+ucom* at uftdi? portno ?
+
+uplcom* at uhub? port ? # I/O DATA USB-RSAQ2 serial adapter
+ucom* at uplcom? portno ?
+
+umct* at uhub? port ? # MCT USB-RS232 serial adapter
+ucom* at umct? portno ?
+
+# Diamond Multimedia Rio 500
+urio* at uhub? port ?
+
+# USB Handspring Visor
+uvisor* at uhub? port ?
+ucom* at uvisor?
+
+# USB scanners
+uscanner* at uhub? port ?
+
+# USB scanners that use SCSI emulation, e.g., HP5300
+usscanner* at uhub? port ?
+scsibus* at usscanner?
+
+# Y@P firmware loader
+uyap* at uhub? port ?
+
+# USB Generic driver
+ugen* at uhub? port ?
+
+# Audio Devices
+
+# PCI audio devices
+#eap* at pci? dev ? function ? # Ensoniq AudioPCI
+#sv* at pci? dev ? function ? # S3 SonicVibes
+
+# Audio support
+#audio* at eap?
+#audio* at sv?
+
+vga* at pci?
+wsdisplay* at vga? console ?
+
+# ISA bus bridging
+
+pcib* at pci? dev ? function ? # PCI-ISA bridge
+isa* at pcib? # ISA bus
+
+# ISA Plug-and-Play bus support
+#isapnp0 at isa?
+
+# wscons
+pckbc0 at isa? # pc keyboard controller
+pckbd* at pckbc? # PC keyboard
+pms* at pckbc? # PS/2 mouse for wsmouse
+wskbd* at pckbd? console ?
+wsmouse* at pms?
+
+pcppi0 at isa?
+sysbeep0 at pcppi?
+
+# ISA Plug-and-Play serial interfaces
+#com* at isapnp? # Modems and serial boards
+
+# ISA Plug-and-Play network interfaces
+#ep* at isapnp? # 3Com 3c509 Ethernet
+
+# ISA serial interfaces
+com0 at isa? port 0x3f8 irq 4 # Standard PC serial ports
+com1 at isa? port 0x2f8 irq 3
+#com2 at isa? port 0x3e8 irq 9
+#com3 at isa? port 0x2e8 irq 10
+
+# ISA parallel printer interfaces
+lpt0 at isa? port 0x378 irq 7 # standard PC parallel ports
+lpt1 at isa? port 0x278 irq 5
+#lpt2 at isa? port 0x3bc
+
+# ISA floppy
+#fdc0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy controllers
+#fdc1 at isa? port 0x370 irq ? drq ?
+#fd* at fdc? drive ? # the drives themselves
+
+# ISA network interface
+#ne0 at isa? port 0x280 irq 9
+#ne1 at isa? port 0x300 irq 10
+#ep* at isa? port ? irq ?
+
+# The spkr driver provides a simple tone interface to the built in speaker.
+spkr0 at pcppi? # PC speaker
+
+ds1687rtc0 at isa? port 0x72 # Dallas RTC
+
+# ISA Plug-and-Play audio devices
+#ess* at isapnp? # ESS Tech ES1887, ES1888, ES888 audio
+#sb* at isapnp? # SoundBlaster-compatible audio
+#wss* at isapnp? # Windows Sound System
+
+# MPU 401 UARTs
+#mpu* at sb?
+
+# MIDI support
+midi* at pcppi? # MIDI interface to the PC speaker
+#midi* at mpu? # MPU 401
+
+# Joysticks
+
+# ISA Plug-and-Play joysticks
+#joy* at isapnp? # Game ports (usually on audio cards)
+
+# ISA joysticks. Probe is a little strange; add only if you have one.
+#joy0 at isa? port 0x201
+
+# Pseudo-Devices
+
+# mouse & keyboard multiplexor pseudo-devices
+pseudo-device wsmux 2
+pseudo-device crypto 1
+pseudo-device loop 1 # network loopback
+pseudo-device bpfilter 1 # packet filter
+pseudo-device rd 1 # ram disk
+
+
+option BOOT_CONFIG # boot-time kernel config
+
+# RAMDISK stuff
+option MINIROOTSIZE=8192
+option RAMDISK_HOOKS
+
diff --git a/sys/arch/cats/conf/files.cats b/sys/arch/cats/conf/files.cats
new file mode 100644
index 00000000000..a9019b29955
--- /dev/null
+++ b/sys/arch/cats/conf/files.cats
@@ -0,0 +1,108 @@
+# $OpenBSD: files.cats,v 1.1 2004/02/01 05:12:54 drahn Exp $
+# $NetBSD: files.cats,v 1.27 2003/10/21 08:15:40 skrll Exp $
+#
+# CATS-specific configuration info
+#
+
+maxpartitions 8
+maxusers 2 8 64
+
+define todservice {}
+
+#
+# ISA and mixed ISA+EISA or ISA+PCI drivers
+#
+include "dev/isa/files.isa"
+include "dev/isa/files.isapnp"
+
+# Include arm32 footbridge
+include "arch/arm/conf/files.footbridge"
+
+#
+# Machine-independent ATA drivers
+#
+include "dev/ata/files.ata"
+major {wd = 16}
+
+#
+# time of day clock
+#
+device todclock
+attach todclock at todservice
+file arch/arm/footbridge/todclock.c todclock needs-count
+
+# ISA DMA glue
+file arch/arm/footbridge/isa/isadma_machdep.c isadma
+
+# Game adapter (joystick)
+file arch/arm/footbridge/isa/joy_timer.c joy
+
+major {rd = 18}
+
+# RAIDframe
+major {raid = 71}
+
+#
+# Machine-independent SCSI/ATAPI drivers
+#
+
+include "../../../scsi/files.scsi"
+include "../../../dev/atapiscsi/files.atapiscsi"
+major {sd = 24}
+major {cd = 26}
+
+file arch/arm/arm/conf.c
+
+# Generic MD files
+file arch/cats/cats/autoconf.c
+file arch/cats/cats/cats_machdep.c
+
+# library functions
+
+file arch/arm/arm/disksubr.c disk
+#file arch/arm/arm/disksubr_acorn.c disk
+file arch/arm/arm/disksubr_mbr.c disk
+
+# ISA Plug 'n Play autoconfiguration glue.
+file arch/arm/footbridge/isa/isapnp_machdep.c isapnp
+
+# ISA support.
+file arch/arm/footbridge/isa/isa_io.c isa
+file arch/arm/footbridge/isa/isa_io_asm.S isa
+
+# CATS boards have an EBSA285 based core with an ISA bus
+file arch/arm/footbridge/isa/isa_machdep.c isa
+
+device sysbeep
+attach sysbeep at pcppi with sysbeep_isa
+file arch/arm/footbridge/isa/sysbeep_isa.c sysbeep_isa
+
+device ds1687rtc: todservice
+attach ds1687rtc at isa
+file arch/arm/footbridge/isa/dsrtc.c ds1687rtc
+
+# Machine-independent I2O drivers.
+include "dev/i2o/files.i2o"
+
+# PCI devices
+
+#
+# Include PCI config
+#
+include "dev/mii/files.mii"
+include "dev/pci/files.pci"
+
+device pcib: isabus
+attach pcib at pci
+file arch/cats/pci/pcib.c pcib
+
+file arch/cats/pci/pciide_machdep.c pciide
+
+# Include USB stuff
+include "dev/usb/files.usb"
+
+# Include WSCONS stuff
+include "dev/wscons/files.wscons"
+include "dev/rasops/files.rasops"
+include "dev/wsfont/files.wsfont"
+include "dev/pckbc/files.pckbc"
diff --git a/sys/arch/cats/conf/ldscript.elf b/sys/arch/cats/conf/ldscript.elf
new file mode 100644
index 00000000000..26b2ab2dbaf
--- /dev/null
+++ b/sys/arch/cats/conf/ldscript.elf
@@ -0,0 +1,76 @@
+/* $OpenBSD: ldscript.elf,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: ldscript.evbarm,v 1.3 2003/05/23 00:57:27 ichiro Exp $ */
+
+OUTPUT_ARCH(arm)
+ENTRY(KERNEL_BASE_phys)
+SECTIONS
+{
+ KERNEL_BASE_phys = 0xF0000000;
+ KERNEL_BASE_virt = 0xF0000000;
+
+ /* Kernel start: */
+ .start (KERNEL_BASE_phys) :
+ {
+ *(.start)
+ } =0
+
+ /* Read-only sections, merged into text segment: */
+ .text (KERNEL_BASE_virt + SIZEOF(.start)) :
+ AT (LOADADDR(.start) + SIZEOF(.start))
+ {
+ *(.text)
+ *(.text.*)
+ *(.stub)
+ *(.glue_7t) *(.glue_7)
+ *(.rodata) *(.rodata.*)
+ } =0
+ PROVIDE (__etext = .);
+ PROVIDE (_etext = .);
+ PROVIDE (etext = .);
+ /* Adjust the address for the data segment to start on the next page
+ boundary. */
+ . = ALIGN(0x8000);
+ .data :
+ AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
+ {
+ __data_start = . ;
+ *(.data)
+ *(.data.*)
+ }
+ .sdata :
+ AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data)))
+ {
+ *(.sdata)
+ *(.sdata.*)
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+ __bss_start = .;
+ __bss_start__ = .;
+ .sbss :
+ {
+ PROVIDE (__sbss_start = .);
+ PROVIDE (___sbss_start = .);
+ *(.dynsbss)
+ *(.sbss)
+ *(.sbss.*)
+ *(.scommon)
+ PROVIDE (__sbss_end = .);
+ PROVIDE (___sbss_end = .);
+ }
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ . = ALIGN(32 / 8);
+ }
+ . = ALIGN(32 / 8);
+ _end = .;
+ _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
+ PROVIDE (end = .);
+}
diff --git a/sys/arch/cats/include/ansi.h b/sys/arch/cats/include/ansi.h
new file mode 100644
index 00000000000..515e651b357
--- /dev/null
+++ b/sys/arch/cats/include/ansi.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: ansi.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: ansi.h,v 1.3 2001/11/25 15:55:54 thorpej Exp $ */
+
+#include <arm/ansi.h>
diff --git a/sys/arch/cats/include/asm.h b/sys/arch/cats/include/asm.h
new file mode 100644
index 00000000000..e730a1e3998
--- /dev/null
+++ b/sys/arch/cats/include/asm.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: asm.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: asm.h,v 1.3 2001/11/25 15:55:54 thorpej Exp $ */
+
+#include <arm/asm.h>
diff --git a/sys/arch/cats/include/atomic.h b/sys/arch/cats/include/atomic.h
new file mode 100644
index 00000000000..3a2957c58fb
--- /dev/null
+++ b/sys/arch/cats/include/atomic.h
@@ -0,0 +1,2 @@
+/* $OpenBSD: atomic.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+#include <arm/atomic.h>
diff --git a/sys/arch/cats/include/bootconfig.h b/sys/arch/cats/include/bootconfig.h
new file mode 100644
index 00000000000..b5c1a28d815
--- /dev/null
+++ b/sys/arch/cats/include/bootconfig.h
@@ -0,0 +1,76 @@
+/* $OpenBSD: bootconfig.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: bootconfig.h,v 1.2 2001/06/21 22:08:28 chris Exp $ */
+
+/*
+ * Copyright (c) 1994 Mark Brinicombe.
+ * Copyright (c) 1994 Brini.
+ * All rights reserved.
+ *
+ * This code is derived from software written for Brini by Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Mark Brinicombe
+ * for the NetBSD Project.
+ * 4. The name of the company nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * boot configuration structures
+ *
+ * Created : 12/09/94
+ *
+ * Based on kate/boot/bootconfig.h
+ */
+
+typedef struct _PhysMem {
+ u_int address;
+ u_int pages;
+} PhysMem;
+
+#if defined(_KERNEL)
+
+#define DRAM_BLOCKS 1
+
+typedef struct _BootConfig {
+ PhysMem dram[DRAM_BLOCKS];
+ u_int dramblocks;
+} BootConfig;
+
+extern BootConfig bootconfig;
+#define MAX_BOOT_STRING 255
+
+#define BOOTOPT_TYPE_BOOLEAN 0
+#define BOOTOPT_TYPE_STRING 1
+#define BOOTOPT_TYPE_INT 2
+#define BOOTOPT_TYPE_BININT 3
+#define BOOTOPT_TYPE_HEXINT 4
+#define BOOTOPT_TYPE_MASK 7
+
+int get_bootconf_option __P((char *string, char *option, int type, void *result));
+
+extern char *boot_args;
+extern char *boot_file;
+#endif /* _KERNEL */
+
+/* End of bootconfig.h */
diff --git a/sys/arch/cats/include/bus.h b/sys/arch/cats/include/bus.h
new file mode 100644
index 00000000000..f0cdace92b6
--- /dev/null
+++ b/sys/arch/cats/include/bus.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: bus.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: bus.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
+
+#include <arm/bus.h>
diff --git a/sys/arch/cats/include/cdefs.h b/sys/arch/cats/include/cdefs.h
new file mode 100644
index 00000000000..254915b785e
--- /dev/null
+++ b/sys/arch/cats/include/cdefs.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: cdefs.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: cdefs.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
+
+#include <arm/cdefs.h>
diff --git a/sys/arch/cats/include/conf.h b/sys/arch/cats/include/conf.h
new file mode 100644
index 00000000000..0e2e895431c
--- /dev/null
+++ b/sys/arch/cats/include/conf.h
@@ -0,0 +1,19 @@
+/* $OpenBSD: conf.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: conf.h,v 1.8 2002/02/10 12:26:03 chris Exp $ */
+
+#ifndef _CATS_CONF_H
+#define _CATS_CONF_H
+
+/*
+ * CATS specific device includes go in here
+ */
+#include "fcom.h"
+
+#define CONF_HAVE_PCI
+#define CONF_HAVE_USB
+#define CONF_HAVE_SCSIPI
+#define CONF_HAVE_WSCONS
+
+#include <arm/conf.h>
+
+#endif /* _CATS_CONF_H */
diff --git a/sys/arch/cats/include/cpu.h b/sys/arch/cats/include/cpu.h
new file mode 100644
index 00000000000..1997a1569d0
--- /dev/null
+++ b/sys/arch/cats/include/cpu.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: cpu.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: cpu.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
+
+#include <arm/cpu.h>
diff --git a/sys/arch/cats/include/cyclone_boot.h b/sys/arch/cats/include/cyclone_boot.h
new file mode 100644
index 00000000000..edf06464f0f
--- /dev/null
+++ b/sys/arch/cats/include/cyclone_boot.h
@@ -0,0 +1,67 @@
+/* $OpenBSD: cyclone_boot.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: cyclone_boot.h,v 1.1 2001/06/20 22:14:34 chris Exp $ */
+
+/*
+ * Copyright (c) 1997,1998 Mark Brinicombe.
+ * Copyright (c) 1997,1998 Causality Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Mark Brinicombe.
+ * 4. The name of the company nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Define the boot structure that is passed to the kernel
+ * from the cyclone firmware.
+ *
+ * The bootloader reserves a page for boot argument info.
+ * This page will contain the ebsaboot structure and the
+ * kernel argument string.
+ */
+
+struct ebsaboot {
+ u_int32_t bt_magic; /* boot info magic number */
+ u_int32_t bt_vargp; /* virtual addr of arg page */
+ u_int32_t bt_pargp; /* physical addr of arg page */
+ const char * bt_args; /* kernel args string pointer */
+ pd_entry_t * bt_l1; /* active L1 page table */
+ u_int32_t bt_memstart; /* start of physical memory */
+ u_int32_t bt_memend; /* end of physical memory */
+ u_int32_t bt_memavail; /* start of avail phys memory */
+ u_int32_t bt_fclk; /* fclk frequency */
+ u_int32_t bt_pciclk; /* PCI bus frequency */
+ u_int32_t bt_vers; /* structure version (CATS) */
+ u_int32_t bt_features; /* feature mask (CATS) */
+};
+
+#define BT_MAGIC_NUMBER_EBSA 0x45425341
+#define BT_MAGIC_NUMBER_CATS 0x43415453
+
+#define BT_BOOT_VERSION_OLD 0
+#define BT_BOOT_VERSION_NEW 1
+
+/* End of cyclone_boot.h */
diff --git a/sys/arch/cats/include/db_machdep.h b/sys/arch/cats/include/db_machdep.h
new file mode 100644
index 00000000000..75cc8636737
--- /dev/null
+++ b/sys/arch/cats/include/db_machdep.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: db_machdep.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: db_machdep.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
+
+#include <arm/db_machdep.h>
diff --git a/sys/arch/cats/include/disklabel.h b/sys/arch/cats/include/disklabel.h
new file mode 100644
index 00000000000..4f02974008d
--- /dev/null
+++ b/sys/arch/cats/include/disklabel.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: disklabel.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: disklabel.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
+
+#include <arm/disklabel.h>
diff --git a/sys/arch/cats/include/elf_abi.h b/sys/arch/cats/include/elf_abi.h
new file mode 100644
index 00000000000..80acd57afe1
--- /dev/null
+++ b/sys/arch/cats/include/elf_abi.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: elf_abi.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+
+#include <arm/elf_abi.h>
diff --git a/sys/arch/cats/include/endian.h b/sys/arch/cats/include/endian.h
new file mode 100644
index 00000000000..b39fda184d3
--- /dev/null
+++ b/sys/arch/cats/include/endian.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: endian.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: endian.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
+
+#include <arm/endian.h>
diff --git a/sys/arch/cats/include/exec.h b/sys/arch/cats/include/exec.h
new file mode 100644
index 00000000000..9b6f5e60507
--- /dev/null
+++ b/sys/arch/cats/include/exec.h
@@ -0,0 +1,49 @@
+/* $OpenBSD: exec.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $OpenBSD: exec.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _I386_EXEC_H_
+#define _I386_EXEC_H_
+
+#define __LDPGSZ 4096
+
+#define NATIVE_EXEC_ELF
+
+#define ARCH_ELFSIZE 32
+
+#define ELF_TARG_CLASS ELFCLASS32
+#define ELF_TARG_DATA ELFDATA2LSB
+#define ELF_TARG_MACH EM_ARM
+
+#define _NLIST_DO_ELF
+
+#define _KERN_DO_ELF
+
+#endif /* _I386_EXEC_H_ */
diff --git a/sys/arch/cats/include/float.h b/sys/arch/cats/include/float.h
new file mode 100644
index 00000000000..c48d6fb3732
--- /dev/null
+++ b/sys/arch/cats/include/float.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: float.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: float.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
+
+#include <arm/float.h>
diff --git a/sys/arch/cats/include/fp.h b/sys/arch/cats/include/fp.h
new file mode 100644
index 00000000000..52072045e73
--- /dev/null
+++ b/sys/arch/cats/include/fp.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: fp.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: fp.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
+
+#include <arm/fp.h>
diff --git a/sys/arch/cats/include/frame.h b/sys/arch/cats/include/frame.h
new file mode 100644
index 00000000000..9d8216149fb
--- /dev/null
+++ b/sys/arch/cats/include/frame.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: frame.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: frame.h,v 1.1 2001/06/08 22:23:00 chris Exp $ */
+
+#include <arm/frame.h>
diff --git a/sys/arch/cats/include/ieee.h b/sys/arch/cats/include/ieee.h
new file mode 100644
index 00000000000..8536ad855bc
--- /dev/null
+++ b/sys/arch/cats/include/ieee.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: ieee.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: ieee.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
+
+#include <arm/ieee.h>
diff --git a/sys/arch/cats/include/ieeefp.h b/sys/arch/cats/include/ieeefp.h
new file mode 100644
index 00000000000..f4367fb3104
--- /dev/null
+++ b/sys/arch/cats/include/ieeefp.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: ieeefp.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: ieeefp.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
+
+#include <arm/ieeefp.h>
diff --git a/sys/arch/cats/include/internal_types.h b/sys/arch/cats/include/internal_types.h
new file mode 100644
index 00000000000..c13787132f0
--- /dev/null
+++ b/sys/arch/cats/include/internal_types.h
@@ -0,0 +1,7 @@
+/* $OpenBSD: internal_types.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#include "arm/internal_types.h"
+#endif
diff --git a/sys/arch/cats/include/intr.h b/sys/arch/cats/include/intr.h
new file mode 100644
index 00000000000..973e06580e5
--- /dev/null
+++ b/sys/arch/cats/include/intr.h
@@ -0,0 +1,6 @@
+/* $OpenBSD: intr.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: intr.h,v 1.4 2002/09/28 15:44:29 chris Exp $ */
+
+#include <arm/footbridge/footbridge_intr.h>
+
+#define splassert(wantipl) do { /* nada */ } while (0)
diff --git a/sys/arch/cats/include/irqhandler.h b/sys/arch/cats/include/irqhandler.h
new file mode 100644
index 00000000000..4805cf98e45
--- /dev/null
+++ b/sys/arch/cats/include/irqhandler.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: irqhandler.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: irqhandler.h,v 1.4 2002/04/12 18:50:32 thorpej Exp $ */
+
+#include <arm/footbridge/footbridge_irqhandler.h>
diff --git a/sys/arch/cats/include/isa_machdep.h b/sys/arch/cats/include/isa_machdep.h
new file mode 100644
index 00000000000..7ff5dd94990
--- /dev/null
+++ b/sys/arch/cats/include/isa_machdep.h
@@ -0,0 +1,13 @@
+/* $OpenBSD: isa_machdep.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: isa_machdep.h,v 1.4 2002/01/07 22:58:08 chris Exp $ */
+
+#ifndef _CATS_ISA_MACHDEP_H_
+#define _CATS_ISA_MACHDEP_H_
+#include <arm/isa_machdep.h>
+
+#ifdef _KERNEL
+#define ISA_FOOTBRIDGE_IRQ IRQ_IN_L2
+void isa_footbridge_init(u_int, u_int);
+#endif /* _KERNEL */
+
+#endif /* _CATS_ISA_MACHDEP_H_ */
diff --git a/sys/arch/cats/include/limits.h b/sys/arch/cats/include/limits.h
new file mode 100644
index 00000000000..f6fd82683af
--- /dev/null
+++ b/sys/arch/cats/include/limits.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: limits.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: limits.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
+
+#include <arm/limits.h>
diff --git a/sys/arch/cats/include/lock.h b/sys/arch/cats/include/lock.h
new file mode 100644
index 00000000000..ba2a06187db
--- /dev/null
+++ b/sys/arch/cats/include/lock.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: lock.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: lock.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
+
+#include <arm/lock.h>
diff --git a/sys/arch/cats/include/math.h b/sys/arch/cats/include/math.h
new file mode 100644
index 00000000000..8a036446ed9
--- /dev/null
+++ b/sys/arch/cats/include/math.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: math.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: math.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
+
+#include <arm/math.h>
diff --git a/sys/arch/cats/include/param.h b/sys/arch/cats/include/param.h
new file mode 100644
index 00000000000..336cdeb3737
--- /dev/null
+++ b/sys/arch/cats/include/param.h
@@ -0,0 +1,55 @@
+/* $OpenBSD: param.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: param.h,v 1.4 2002/02/12 06:58:19 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1994,1995 Mark Brinicombe.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the RiscBSD team.
+ * 4. The name "RiscBSD" nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _CATS_PARAM_H_
+#define _CATS_PARAM_H_
+
+/*
+ * Machine dependent constants for ARM6+ processors
+ */
+
+#define _MACHINE cats
+#define MACHINE "cats"
+
+/*
+ * cats boot dmesg is bigger than 4k
+ */
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE (2*NBPG)
+#endif
+
+#include <arm/param.h>
+
+#endif /* _CATS_PARAM_H_ */
diff --git a/sys/arch/cats/include/pcb.h b/sys/arch/cats/include/pcb.h
new file mode 100644
index 00000000000..f99d13969d8
--- /dev/null
+++ b/sys/arch/cats/include/pcb.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: pcb.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: pcb.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
+
+#include <arm/pcb.h>
diff --git a/sys/arch/cats/include/pio.h b/sys/arch/cats/include/pio.h
new file mode 100644
index 00000000000..045c59ff6c3
--- /dev/null
+++ b/sys/arch/cats/include/pio.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: pio.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: pio.h,v 1.3 2001/12/07 23:09:33 chris Exp $ */
+
+#include <arm/pio.h>
diff --git a/sys/arch/cats/include/pmap.h b/sys/arch/cats/include/pmap.h
new file mode 100644
index 00000000000..aa1f8123abc
--- /dev/null
+++ b/sys/arch/cats/include/pmap.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: pmap.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: pmap.h,v 1.2 2001/11/23 17:29:01 thorpej Exp $ */
+
+#include <arm/pmap.h>
diff --git a/sys/arch/cats/include/proc.h b/sys/arch/cats/include/proc.h
new file mode 100644
index 00000000000..7bda86370d2
--- /dev/null
+++ b/sys/arch/cats/include/proc.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: proc.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: proc.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
+
+#include <arm/proc.h>
diff --git a/sys/arch/cats/include/profile.h b/sys/arch/cats/include/profile.h
new file mode 100644
index 00000000000..c9c50fbe848
--- /dev/null
+++ b/sys/arch/cats/include/profile.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: profile.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: profile.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
+
+#include <arm/profile.h>
diff --git a/sys/arch/cats/include/psl.h b/sys/arch/cats/include/psl.h
new file mode 100644
index 00000000000..0785bb0dffb
--- /dev/null
+++ b/sys/arch/cats/include/psl.h
@@ -0,0 +1 @@
+/* $OpenBSD: psl.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
diff --git a/sys/arch/cats/include/ptrace.h b/sys/arch/cats/include/ptrace.h
new file mode 100644
index 00000000000..8e16de5f88b
--- /dev/null
+++ b/sys/arch/cats/include/ptrace.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: ptrace.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: ptrace.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/ptrace.h>
diff --git a/sys/arch/cats/include/reg.h b/sys/arch/cats/include/reg.h
new file mode 100644
index 00000000000..8e503fbc8d1
--- /dev/null
+++ b/sys/arch/cats/include/reg.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: reg.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: reg.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/reg.h>
diff --git a/sys/arch/cats/include/reloc.h b/sys/arch/cats/include/reloc.h
new file mode 100644
index 00000000000..0a788984d8c
--- /dev/null
+++ b/sys/arch/cats/include/reloc.h
@@ -0,0 +1,2 @@
+/* $OpenBSD: reloc.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+#include <arm/reloc.h>
diff --git a/sys/arch/cats/include/rtc.h b/sys/arch/cats/include/rtc.h
new file mode 100644
index 00000000000..eb59dc12a2f
--- /dev/null
+++ b/sys/arch/cats/include/rtc.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: rtc.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: rtc.h,v 1.2 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/rtc.h>
diff --git a/sys/arch/cats/include/setjmp.h b/sys/arch/cats/include/setjmp.h
new file mode 100644
index 00000000000..bd4d39265e3
--- /dev/null
+++ b/sys/arch/cats/include/setjmp.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: setjmp.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: setjmp.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/setjmp.h>
diff --git a/sys/arch/cats/include/signal.h b/sys/arch/cats/include/signal.h
new file mode 100644
index 00000000000..7f374547760
--- /dev/null
+++ b/sys/arch/cats/include/signal.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: signal.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: signal.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/signal.h>
diff --git a/sys/arch/cats/include/spinlock.h b/sys/arch/cats/include/spinlock.h
new file mode 100644
index 00000000000..c471d638345
--- /dev/null
+++ b/sys/arch/cats/include/spinlock.h
@@ -0,0 +1,6 @@
+
+/* $OpenBSD: spinlock.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+#ifndef _CATS_SPINLOCK_H_
+#define _CATS_SPINLOCK_H_
+#include <arm/spinlock.h>
+#endif _CATS_SPINLOCK_H_
diff --git a/sys/arch/cats/include/sysarch.h b/sys/arch/cats/include/sysarch.h
new file mode 100644
index 00000000000..18778d71e0c
--- /dev/null
+++ b/sys/arch/cats/include/sysarch.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: sysarch.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: sysarch.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/sysarch.h>
diff --git a/sys/arch/cats/include/trap.h b/sys/arch/cats/include/trap.h
new file mode 100644
index 00000000000..3093ee74a2f
--- /dev/null
+++ b/sys/arch/cats/include/trap.h
@@ -0,0 +1,4 @@
+/* $OpenBSD: trap.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: trap.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
+
+#include <arm/trap.h>
diff --git a/sys/arch/cats/include/types.h b/sys/arch/cats/include/types.h
new file mode 100644
index 00000000000..3144509de7c
--- /dev/null
+++ b/sys/arch/cats/include/types.h
@@ -0,0 +1,12 @@
+/* $OpenBSD: types.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: types.h,v 1.4 2002/02/28 03:17:26 simonb Exp $ */
+
+#ifndef _ARM32_TYPES_H_
+#define _ARM32_TYPES_H_
+
+#include <arm/types.h>
+#define __HAVE_GENERIC_SOFT_INTERRUPTS
+#define __HAVE_DEVICE_REGISTER
+#define __HAVE_NWSCONS
+
+#endif
diff --git a/sys/arch/cats/include/vmparam.h b/sys/arch/cats/include/vmparam.h
new file mode 100644
index 00000000000..bf47c165dd3
--- /dev/null
+++ b/sys/arch/cats/include/vmparam.h
@@ -0,0 +1,100 @@
+/* $OpenBSD: vmparam.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: vmparam.h,v 1.23 2003/05/22 05:47:07 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _ARM32_VMPARAM_H_
+#define _ARM32_VMPARAM_H_
+
+#define ARM_KERNEL_BASE 0xf0000000
+
+#include <arm/vmparam.h>
+
+#ifdef _KERNEL
+/*
+ * Address space constants
+ */
+
+/*
+ * The line between user space and kernel space
+ * Mappings >= KERNEL_BASE are constant across all processes
+ */
+#define KERNEL_BASE ARM_KERNEL_BASE
+
+/*
+ * Override the default pager_map size, there's not enough KVA.
+ */
+#define PAGER_MAP_SIZE (4 * 1024 * 1024)
+
+/*
+ * Size of User Raw I/O map
+ */
+
+#define USRIOSIZE 300
+
+/* virtual sizes (bytes) for various kernel submaps */
+
+#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
+
+/*
+ * max number of non-contig chunks of physical RAM you can have
+ */
+
+#define VM_PHYSSEG_MAX 32
+
+/*
+ * when converting a physical address to a vm_page structure, we
+ * want to use a binary search on the chunks of physical memory
+ * to find our RAM
+ */
+
+#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
+
+/*
+ * this indicates that we can't add RAM to the VM system after the
+ * vm system is init'd.
+ */
+
+#define VM_PHYSSEG_NOADD
+
+/*
+ * we support 2 free lists:
+ *
+ * - DEFAULT for all systems
+ * - ISADMA for the ISA DMA range on Sharks only
+ */
+#endif /* _KERNEL */
+
+#define VM_NFREELIST 2
+#define VM_FREELIST_DEFAULT 0
+#define VM_FREELIST_ISADMA 1
+
+
+#endif /* _ARM32_VMPARAM_H_ */
diff --git a/sys/arch/cats/isa/isa_machdep.h b/sys/arch/cats/isa/isa_machdep.h
new file mode 100644
index 00000000000..3995d02ce84
--- /dev/null
+++ b/sys/arch/cats/isa/isa_machdep.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: isa_machdep.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* stub until this file is moved */
+#include <machine/isa_machdep.h>
diff --git a/sys/arch/cats/pci/pci_machdep.h b/sys/arch/cats/pci/pci_machdep.h
new file mode 100644
index 00000000000..ed767599faa
--- /dev/null
+++ b/sys/arch/cats/pci/pci_machdep.h
@@ -0,0 +1,2 @@
+/* $OpenBSD: pci_machdep.h,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+#include <arm/pci_machdep.h>
diff --git a/sys/arch/cats/pci/pcib.c b/sys/arch/cats/pci/pcib.c
new file mode 100644
index 00000000000..12061487b8c
--- /dev/null
+++ b/sys/arch/cats/pci/pcib.c
@@ -0,0 +1,147 @@
+/* $OpenBSD: pcib.c,v 1.1 2004/02/01 05:12:54 drahn Exp $ */
+/* $NetBSD: pcib.c,v 1.4 2003/01/01 01:25:34 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * from: i386/pci/pcib.c,v 1.12
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/isa/isavar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+#include <dev/pci/pcidevs.h>
+
+#include "isadma.h"
+
+int pcibmatch __P((struct device *, void *, void *));
+void pcibattach __P((struct device *, struct device *, void *));
+
+struct cfattach pcib_ca = {
+ sizeof(struct device), pcibmatch, pcibattach
+};
+
+struct cfdriver pcib_cd = {
+ NULL, "pcib", DV_DULL
+};
+
+
+void pcib_callback __P((struct device *));
+int pcib_print __P((void *, const char *));
+
+int
+pcibmatch(parent, match, aux)
+ struct device *parent;
+ void *match;
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+
+ /*
+ * Match tested PCI-ISA bridges.
+ */
+ switch (PCI_VENDOR(pa->pa_id)) {
+ case PCI_VENDOR_ALI:
+ switch (PCI_PRODUCT(pa->pa_id)) {
+ case PCI_PRODUCT_ALI_M1533:
+ case PCI_PRODUCT_ALI_M1543:
+ return (1);
+ }
+ break;
+ }
+
+ return (0);
+}
+
+void
+pcibattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pci_attach_args *pa = aux;
+ char devinfo[256];
+
+ printf("\n");
+
+ /*
+ * Just print out a description and set the ISA bus
+ * callback.
+ */
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof devinfo);
+ printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo,
+ PCI_REVISION(pa->pa_class));
+
+ /* Set the ISA bus callback */
+ config_defer(self, pcib_callback);
+}
+
+void
+pcib_callback(self)
+ struct device *self;
+{
+ struct isabus_attach_args iba;
+
+ /*
+ * Attach the ISA bus behind this bridge.
+ */
+ memset(&iba, 0, sizeof(iba));
+ iba.iba_busname = "isa";
+ iba.iba_iot = &isa_io_bs_tag;
+ iba.iba_memt = &isa_mem_bs_tag;
+#if NISADMA > 0
+ iba.iba_dmat = &isa_bus_dma_tag;
+#endif
+ config_found(self, &iba, pcib_print);
+}
+
+int
+pcib_print(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+
+ /* Only ISAs can attach to pcib's; easy. */
+ if (pnp)
+ printf("isa at %s", pnp);
+ return (UNCONF);
+}
diff --git a/sys/arch/cats/pci/pciide_machdep.c b/sys/arch/cats/pci/pciide_machdep.c
new file mode 100644
index 00000000000..ca78a738f7d
--- /dev/null
+++ b/sys/arch/cats/pci/pciide_machdep.c
@@ -0,0 +1,90 @@
+/* $OpenBSD: pciide_machdep.c,v 1.1 2004/02/01 05:12:55 drahn Exp $ */
+/* $NetBSD: pciide_machdep.c,v 1.2 2002/09/27 15:35:56 provos Exp $ */
+
+/*
+ * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * PCI IDE controller driver (arm32 machine-dependent portion).
+ *
+ * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD
+ * sys/dev/pci/ppb.c, revision 1.16).
+ *
+ * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" from the
+ * PCI SIG.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pciidereg.h>
+#include <dev/pci/pciidevar.h>
+
+#include <dev/isa/isavar.h>
+#include <machine/intr.h>
+#include "isa.h"
+
+void *
+pciide_machdep_compat_intr_establish(dev, pa, chan, func, arg)
+ struct device *dev;
+ struct pci_attach_args *pa;
+ int chan;
+ int (*func) __P((void *));
+ void *arg;
+{
+#if NISA > 0
+ int irq;
+ void *cookie;
+
+ irq = PCIIDE_COMPAT_IRQ(chan);
+ cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg,
+ dev->dv_xname);
+ if (cookie == NULL)
+ return (NULL);
+ printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname,
+ PCIIDE_CHANNEL_NAME(chan), irq);
+ return (cookie);
+#else
+ panic("pciide_machdep_compat_intr_establish() called");
+#endif
+}
+
+void
+pciide_machdep_compat_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
+{
+#if NISA > 0
+ isa_intr_disestablish(NULL, cookie);
+#else
+ panic("pciide_machdep_compat_intr_disestablish() called");
+#endif
+}