Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386 Add i386-specific part of MicroChannel Archite...



details:   https://anonhg.NetBSD.org/src/rev/5232c9a3e928
branches:  trunk
changeset: 486032:5232c9a3e928
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu May 11 16:38:10 2000 +0000

description:
Add i386-specific part of MicroChannel Architecture bus support, as
found in some older IBM PS/2 machines.

This code is based upon work by Scott D. Telford, with some minor bits
in arch/i386/mca/mca_machdep.c taken from FreeBSD.

XXX this is still very experimental and development version; use at your
XXX own risk

diffstat:

 sys/arch/i386/conf/PS2              |   91 +++++++++++
 sys/arch/i386/conf/files.i386       |   11 +-
 sys/arch/i386/i386/machdep.c        |   14 +-
 sys/arch/i386/i386/mainbus.c        |   23 ++-
 sys/arch/i386/i386/trap.c           |   27 ++-
 sys/arch/i386/include/mca_machdep.h |   83 ++++++++++
 sys/arch/i386/isa/clock.c           |   14 +-
 sys/arch/i386/isa/isa_machdep.c     |   63 +++++++-
 sys/arch/i386/mca/mca_machdep.c     |  275 ++++++++++++++++++++++++++++++++++++
 9 files changed, 580 insertions(+), 21 deletions(-)

diffs (truncated from 808 to 300 lines):

diff -r d9b06ca331a4 -r 5232c9a3e928 sys/arch/i386/conf/PS2
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/conf/PS2    Thu May 11 16:38:10 2000 +0000
@@ -0,0 +1,91 @@
+#      $NetBSD: PS2,v 1.1 2000/05/11 16:38:10 jdolecek Exp $
+#
+#      Sample kernel config for PS/2 with MCA bus
+#
+#      BEWARE: do NOT use MCA-enabled kernel on non-MCA machine
+
+include "arch/i386/conf/std.i386"
+
+maxusers       32              # estimated number of users
+
+options        I386_CPU
+options        I486_CPU
+
+options        MATH_EMULATE    # floating point emulation
+#options       XSERVER         # X server support in console drivers
+
+#options       UCONSOLE        # users can use TIOCCONS (for xconsole)
+options        INSECURE        # disable kernel security levels
+
+options        RTC_OFFSET=-600 # hardware clock is this many mins. west of GMT
+options        KTRACE          # system call tracing via ktrace(1)
+
+options        SYSVMSG         # System V-like message queues
+options        SYSVSEM         # System V-like semaphores
+options        SYSVSHM         # System V-like memory sharing
+#options       SHMMAXPGS=1024  # 1024 pages is the default
+
+options        DIAGNOSTIC      # cheap kernel consistency checks
+options        DEBUG           # expensive debugging checks/support
+options        KMEMSTATS       # kernel memory statistics (vmstat -m)
+options        DDB             # in-kernel debugger
+
+file-system    FFS             # UFS
+#file-system   NFS             # Network File System client
+file-system    MSDOSFS         # MS-DOS file system
+#file-system   FDESC           # /dev/fd
+#file-system   KERNFS          # /kern
+
+#options       QUOTA           # UFS quotas
+#options       NFSSERVER       # Network File System server
+options        FIFO            # FIFOs; RECOMMENDED
+
+options        INET            # IP + ICMP + TCP + UDP
+
+options        COMPAT_AOUT
+options        COMPAT_13
+options        COMPAT_14
+
+options        MCAVERBOSE      # verbose MCA device autoconfig messages
+
+#options       NFS_BOOT_BOOTP
+
+options        WSEMUL_VT100            # VT100 / VT220 emulation
+options        WS_KERNEL_FG=WSCOL_GREEN
+
+config         netbsd  root on ? type ?
+#config                netbsd  root on ? type nfs
+
+#
+# Device Configuration
+#
+
+mainbus0 at root
+mca0   at mainbus0
+isa0   at mainbus0
+
+npx0   at isa? port 0xf0 irq 13        # x86 math coprocessor
+
+#pc0   at isa? port 0x60 irq 1   
+
+# wscons
+pckbc0         at isa?                 # pc keyboard controller
+#pcconskbd*    at pckbc?
+pms*           at pckbc?               # PS/2 mouse for wsmouse
+wsmouse*       at pms?
+pckbd*         at pckbc?               # PC keyboard
+wskbd*         at pckbd? console ?
+vga0           at isa?
+wsdisplay*     at vga? console ?
+options        WSDISPLAY_DEFAULTSCREENS=4
+
+com0   at isa? port 0x3f8 irq 4        # "SERIAL_!"
+lpt0   at isa? port 0x3bc irq 7        # "PARALLEL_1"
+fdc0   at isa? port 0x3f0 irq 6 drq 2  # standard PC floppy controllers
+fd*    at fdc? drive ?                 # the drives themselves
+tr*    at mca? slot ?                  # IBM Token Ring adapter
+#ef*   at mca? slot ?                  # 3Com 3C523 (not yet)
+
+pseudo-device  bpfilter        4       # Berkeley packet filter
+pseudo-device  loop                    # network loopback
+pseudo-device  pty             16      # pseudo-terminals
diff -r d9b06ca331a4 -r 5232c9a3e928 sys/arch/i386/conf/files.i386
--- a/sys/arch/i386/conf/files.i386     Thu May 11 16:11:54 2000 +0000
+++ b/sys/arch/i386/conf/files.i386     Thu May 11 16:38:10 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i386,v 1.158 2000/04/28 17:23:51 uch Exp $
+#      $NetBSD: files.i386,v 1.159 2000/05/11 16:38:10 jdolecek Exp $
 #
 # new style config file for i386 architecture
 #
@@ -108,8 +108,7 @@
 
 define mainbus { }
 # XXX BIOS32 only if something that uses it is configured!
-# device       mainbus: isabus, eisabus, mcabus, pcibus, mainbus, bios32
-device mainbus: isabus, eisabus, pcibus, mainbus, bios32
+device mainbus: isabus, eisabus, mcabus, pcibus, mainbus, bios32
 attach mainbus at root
 file   arch/i386/i386/mainbus.c        mainbus
 
@@ -260,9 +259,9 @@
 # MCA-only drivers
 #
 
-# device mca {[slot = -1]} : bioscall
-# include "dev/mca/files.mca"
-# file arch/i386/mca/mca_machdep.c     mca
+device mca {[slot = -1]} : bioscall
+include "dev/mca/files.mca"
+file   arch/i386/mca/mca_machdep.c     mca
 
 # ISA Plug 'n Play devices
 file   arch/i386/isa/isapnp_machdep.c  isapnp
diff -r d9b06ca331a4 -r 5232c9a3e928 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Thu May 11 16:11:54 2000 +0000
+++ b/sys/arch/i386/i386/machdep.c      Thu May 11 16:38:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.383 2000/05/03 20:17:37 mycroft Exp $    */
+/*     $NetBSD: machdep.c,v 1.384 2000/05/11 16:38:11 jdolecek Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -162,6 +162,11 @@
 extern struct proc *npxproc;
 #endif
 
+#include "mca.h"
+#if NMCA > 0
+#include <machine/mca_machdep.h>       /* for mca_busprobe() */
+#endif
+
 /* the following is used externally (sysctl_hw) */
 char machine[] = "i386";               /* cpu "architecture" */
 char machine_arch[] = "i386";          /* machine == machine_arch */
@@ -1687,6 +1692,13 @@
        }
 #endif
 
+#if NMCA > 0
+       /* check for MCA bus, needed to be done before ISA stuff - if
+        * MCA is detected, ISA needs to use level triggered interrupts
+        * by default */
+       mca_busprobe();
+#endif
+
 #if NISA > 0
        isa_defaultirq();
 #endif
diff -r d9b06ca331a4 -r 5232c9a3e928 sys/arch/i386/i386/mainbus.c
--- a/sys/arch/i386/i386/mainbus.c      Thu May 11 16:11:54 2000 +0000
+++ b/sys/arch/i386/i386/mainbus.c      Thu May 11 16:38:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.30 2000/03/22 20:58:27 ws Exp $  */
+/*     $NetBSD: mainbus.c,v 1.31 2000/05/11 16:38:11 jdolecek Exp $    */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -45,6 +45,7 @@
 #include "pci.h"
 #include "eisa.h"
 #include "isa.h"
+#include "mca.h"
 #include "apm.h"
 #include "pnpbios.h"
 
@@ -57,6 +58,10 @@
 #include <arch/i386/pnpbios/pnpbiosvar.h>
 #endif
 
+#if NMCA > 0
+#include <dev/mca/mcavar.h>
+#endif
+
 int    mainbus_match __P((struct device *, struct cfdata *, void *));
 void   mainbus_attach __P((struct device *, struct device *, void *));
 
@@ -71,6 +76,9 @@
        struct pcibus_attach_args mba_pba;
        struct eisabus_attach_args mba_eba;
        struct isabus_attach_args mba_iba;
+#if NMCA > 0
+       struct mcabus_attach_args mba_mba;
+#endif
 #if NAPM > 0
        struct apm_attach_args mba_aaa;
 #endif
@@ -151,6 +159,19 @@
        }
 #endif
 
+#if NMCA > 0
+       /* note MCA bus probe is done in i386/machdep.c */
+       if (MCA_system) {
+               mba.mba_mba.mba_busname = "mca";
+               mba.mba_mba.mba_iot = I386_BUS_SPACE_IO;
+               mba.mba_mba.mba_memt = I386_BUS_SPACE_MEM;
+               mba.mba_mba.mba_dmat = &mca_bus_dma_tag;
+               mba.mba_mba.mba_mc = NULL;
+               mba.mba_mba.mba_bus = 0;
+               config_found(self, &mba.mba_mba, mainbus_print);
+       }
+#endif
+
        if (memcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN) == 0 &&
            eisa_has_been_seen == 0) {
                mba.mba_eba.eba_busname = "eisa";
diff -r d9b06ca331a4 -r 5232c9a3e928 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Thu May 11 16:11:54 2000 +0000
+++ b/sys/arch/i386/i386/trap.c Thu May 11 16:38:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.134 1999/12/04 21:20:32 ragge Exp $ */
+/*     $NetBSD: trap.c,v 1.135 2000/05/11 16:38:12 jdolecek Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -114,6 +114,13 @@
 #include <machine/db_machdep.h>
 #endif
 
+#include "mca.h"
+#if NMCA > 0
+#include <machine/mca_machdep.h>
+#endif
+
+#include "isa.h"
+
 #ifdef KGDB
 #include <sys/kgdb.h>
 #endif
@@ -530,8 +537,7 @@
                trapsignal(p, SIGTRAP, type &~ T_USER);
                break;
 
-#include "isa.h"
-#if    NISA > 0
+#if    NISA > 0 || NMCA > 0
        case T_NMI:
 #if defined(KGDB) || defined(DDB)
                /* NMI can be hooked up to a pushbutton for debugging */
@@ -547,11 +553,20 @@
 #endif
 #endif /* KGDB || DDB */
                /* machine/parity/power fail/"kitchen sink" faults */
-               if (isa_nmi() == 0)
-                       return;
+
+#if NMCA > 0
+               /* mca_nmi() takes care to call isa_nmi() if appropriate */
+               if (mca_nmi() != 0)
+                       goto we_re_toast;
                else
+                       return;
+#else /* NISA > 0 */
+               if (isa_nmi() != 0)
                        goto we_re_toast;
-#endif
+               else
+                       return;
+#endif /* NMCA > 0 */
+#endif /* NISA > 0 || NMCA > 0 */
        }
 
        if ((type & T_USER) == 0)
diff -r d9b06ca331a4 -r 5232c9a3e928 sys/arch/i386/include/mca_machdep.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/include/mca_machdep.h       Thu May 11 16:38:10 2000 +0000
@@ -0,0 +1,83 @@
+/*     $NetBSD: mca_machdep.h,v 1.1 2000/05/11 16:38:13 jdolecek Exp $ */
+
+/*
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999 Scott D. Telford.  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



Home | Main Index | Thread Index | Old Index