Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/next68k added kgdb support.
details: https://anonhg.NetBSD.org/src/rev/aca0626dc0e1
branches: trunk
changeset: 467668:aca0626dc0e1
user: dbj <dbj%NetBSD.org@localhost>
date: Sat Mar 27 02:59:41 1999 +0000
description:
added kgdb support.
diffstat:
sys/arch/next68k/conf/GENERIC | 5 +-
sys/arch/next68k/conf/files.next68k | 12 +-
sys/arch/next68k/dev/zs.c | 14 +-
sys/arch/next68k/dev/zs_cons.h | 19 ++
sys/arch/next68k/dev/zs_kgdb.c | 294 ++++++++++++++++++++++++++++++++++++
sys/arch/next68k/next68k/machdep.c | 25 ++-
sys/arch/next68k/next68k/trap.c | 45 +++++-
7 files changed, 392 insertions(+), 22 deletions(-)
diffs (truncated from 602 to 300 lines):
diff -r d5727acf1e5f -r aca0626dc0e1 sys/arch/next68k/conf/GENERIC
--- a/sys/arch/next68k/conf/GENERIC Sat Mar 27 02:48:32 1999 +0000
+++ b/sys/arch/next68k/conf/GENERIC Sat Mar 27 02:59:41 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.13 1999/03/26 23:17:53 dbj Exp $
+# $NetBSD: GENERIC,v 1.14 1999/03/27 02:59:41 dbj Exp $
#
# GENERIC next68k
#
@@ -30,7 +30,7 @@
#makeoptions DEBUG="-g" # debugging symbols for gdb
#options KGDB # support for kernel gdb
#options KGDBDEV=0xc01 # kgdb device number (dev_t)
-#options KGDBRATE=38400 # baud rate
+#options KGDBRATE=0x2580 # baud rate
# Other debugging options
options KMEMSTATS # kernel memory statistics (vmstat -m)
@@ -103,6 +103,7 @@
#options FPU_EMULATE
options ZS_CONSOLE_ABORT
+#options SERCONSOLE
options NFS_BOOT_BOOTP
options NFS_BOOT_DHCP
diff -r d5727acf1e5f -r aca0626dc0e1 sys/arch/next68k/conf/files.next68k
--- a/sys/arch/next68k/conf/files.next68k Sat Mar 27 02:48:32 1999 +0000
+++ b/sys/arch/next68k/conf/files.next68k Sat Mar 27 02:59:41 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.next68k,v 1.9 1999/03/26 04:42:59 dbj Exp $
+# $NetBSD: files.next68k,v 1.10 1999/03/27 02:59:41 dbj Exp $
# next68k-specific configuration info
@@ -7,6 +7,9 @@
maxusers 2 8 64
+# serial console options
+defopt opt_serial.h ZS_CONSOLE_ABORT
+
device mainbus { }
attach mainbus at root
@@ -25,9 +28,10 @@
device zstty: tty
attach zstty at zsc
file dev/ic/z8530tty.c zstty needs-flag
+file arch/next68k/dev/zs_kgdb.c kgdb
-#file arch/m68k/m68k/db_memrw.c ddb
-file arch/next68k/next68k/db_memrw.c ddb
+#file arch/m68k/m68k/db_memrw.c ddb | kgdb
+file arch/next68k/next68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/cacheops.c
@@ -47,6 +51,8 @@
file arch/next68k/next68k/nextrom.c
file arch/next68k/next68k/rtc.c
file arch/next68k/next68k/disksubr.c
+file arch/next68k/next68k/kgdb_machdep.c kgdb
+file arch/next68k/next68k/stub.c kgdb
#file arch/next68k/dev/dbj_debug.c
file arch/next68k/dev/bus_dma.c
diff -r d5727acf1e5f -r aca0626dc0e1 sys/arch/next68k/dev/zs.c
--- a/sys/arch/next68k/dev/zs.c Sat Mar 27 02:48:32 1999 +0000
+++ b/sys/arch/next68k/dev/zs.c Sat Mar 27 02:59:41 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zs.c,v 1.9 1999/03/27 01:21:36 wrstuden Exp $ */
+/* $NetBSD: zs.c,v 1.10 1999/03/27 02:59:41 dbj Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -73,6 +73,7 @@
#include <machine/z8530var.h>
#include <next68k/next68k/isr.h>
+#include <next68k/dev/zs_cons.h>
#include "zsc.h" /* NZSC */
@@ -137,10 +138,7 @@
ZSWR15_BREAK_IE,
};
-static struct zschan *
-zs_get_chan_addr __P((int zsc_unit, int channel));
-
-static struct zschan *
+struct zschan *
zs_get_chan_addr(zs_unit, channel)
int zs_unit, channel;
{
@@ -304,7 +302,6 @@
/* master interrupt control (enable) */
zs_write_reg(cs, 9, zs_init_reg[9]);
splx(s);
-
}
static int
@@ -575,6 +572,8 @@
zs_abort(cs)
struct zs_chanstate *cs;
{
+#include "opt_serial.h"
+#if defined(ZS_CONSOLE_ABORT)
register volatile struct zschan *zc = zs_conschan;
int rr0;
@@ -593,6 +592,9 @@
printf("stopping on keyboard abort\n");
callrom();
#endif
+#else /* !ZS_CONSOLE_ABORT */
+ return;
+#endif
}
/*
diff -r d5727acf1e5f -r aca0626dc0e1 sys/arch/next68k/dev/zs_cons.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/next68k/dev/zs_cons.h Sat Mar 27 02:59:41 1999 +0000
@@ -0,0 +1,19 @@
+/* $NetBSD: zs_cons.h,v 1.1 1999/03/27 02:59:41 dbj Exp $ */
+
+struct consdev;
+struct zs_chanstate;
+
+extern void *zs_conschan;
+
+extern void nullcnprobe __P((struct consdev *));
+
+extern int zs_getc __P((void *arg));
+extern void zs_putc __P((void *arg, int c));
+
+struct zschan *
+zs_get_chan_addr __P((int zsc_unit, int channel));
+
+#ifdef KGDB
+void zs_kgdb_init __P((void));
+void zskgdb __P((struct zs_chanstate *));
+#endif
diff -r d5727acf1e5f -r aca0626dc0e1 sys/arch/next68k/dev/zs_kgdb.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/next68k/dev/zs_kgdb.c Sat Mar 27 02:59:41 1999 +0000
@@ -0,0 +1,294 @@
+/* $NetBSD: zs_kgdb.c,v 1.1 1999/03/27 02:59:41 dbj Exp $ */
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross.
+ *
+ * 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.
+ */
+
+/*
+ * Hooks for kgdb when attached via the z8530 driver
+ *
+ * To use this, build a kernel with: option KGDB, and
+ * boot that kernel with "-d". (The kernel will call
+ * zs_kgdb_init, kgdb_connect.) When the console prints
+ * "kgdb waiting..." you run "gdb -k kernel" and do:
+ * (gdb) set remotebaud 19200
+ * (gdb) target remote /dev/ttyb
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/device.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/syslog.h>
+#include <sys/kgdb.h>
+
+#include <machine/cpu.h>
+
+#include <dev/ic/z8530reg.h>
+#include <machine/z8530var.h>
+#include <next68k/dev/zs_cons.h>
+
+/*
+ * The NeXT provides a 3.686400 MHz clock to the ZS chips.
+ */
+#define PCLK (9600 * 384) /* PCLK pin input clock rate */
+
+/* The layout of this is hardware-dependent (padding, order). */
+struct zschan {
+ volatile u_char zc_csr; /* ctrl,status, and indirect access */
+ u_char zc_xxx0;
+ volatile u_char zc_data; /* data */
+ u_char zc_xxx1;
+};
+
+static void zs_setparam __P((struct zs_chanstate *, int, int));
+struct zsops zsops_kgdb;
+
+static u_char zs_kgdb_regs[16] = {
+ 0, /* 0: CMD (reset, etc.) */
+ 0, /* 1: No interrupts yet. */
+ 0x18 + NEXT_I_IPL(NEXT_I_SCC), /* 2: IVECT */
+ ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
+ ZSWR4_CLK_X16 | ZSWR4_ONESB | ZSWR4_EVENP,
+ ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
+ 0, /* 6: TXSYNC/SYNCLO */
+ 0, /* 7: RXSYNC/SYNCHI */
+ 0, /* 8: alias for data port */
+ ZSWR9_MASTER_IE,
+ 0, /*10: Misc. TX/RX control bits */
+ ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
+ ((PCLK/32)/9600)-2, /*12: BAUDLO (default=9600) */
+ 0, /*13: BAUDHI (default=9600) */
+ ZSWR14_BAUD_ENA | ZSWR14_BAUD_FROM_PCLK,
+ ZSWR15_BREAK_IE,
+};
+
+/*
+ * This replaces "zs_reset()" in the sparc driver.
+ */
+static void
+zs_setparam(cs, iena, rate)
+ struct zs_chanstate *cs;
+ int iena;
+ int rate;
+{
+ int s, tconst;
+
+ bcopy(zs_kgdb_regs, cs->cs_preg, 16);
+
+ if (iena) {
+ cs->cs_preg[1] = ZSWR1_RIE | ZSWR1_SIE;
+ }
+
+ /* Initialize the speed, etc. */
+ tconst = BPS_TO_TCONST(cs->cs_brg_clk, rate);
+ cs->cs_preg[5] |= ZSWR5_DTR | ZSWR5_RTS;
+ cs->cs_preg[12] = tconst;
+ cs->cs_preg[13] = tconst >> 8;
+
+ s = splhigh();
+ zs_loadchannelregs(cs);
+ splx(s);
+}
+
+/*
+ * Set up for kgdb; called at boot time before configuration.
+ * KGDB interrupts will be enabled later when zs0 is configured.
+ * Called after cninit(), so printf() etc. works.
+ */
+void
+zs_kgdb_init()
+{
+ struct zs_chanstate cs;
+ volatile struct zschan *zc;
+ int channel, zs_unit;
+
+ printf("zs_kgdb_init: kgdb_dev=0x%x\n", kgdb_dev);
+ if (major(kgdb_dev) != zs_major)
+ return;
+
+ /* Note: (ttya,ttyb) on zs0, and (ttyc,ttyd) on zs2 */
+ zs_unit = (kgdb_dev & 2) ? 2 : 0; /* XXX - config info! */
+ channel = kgdb_dev & 1;
+ printf("zs_kgdb_init: attaching tty%c at %d baud\n",
+ 'a' + (kgdb_dev & 3), kgdb_rate);
+
Home |
Main Index |
Thread Index |
Old Index