Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm26 More FIQ support. This gives me enough to ha...
details: https://anonhg.NetBSD.org/src/rev/39827a822bfd
branches: trunk
changeset: 514054:39827a822bfd
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Mon Aug 20 23:08:10 2001 +0000
description:
More FIQ support. This gives me enough to handle FIQs, and to downgrade them
to IRQs as necessary. All these interfaces are subject to change in the light
of experience.
diffstat:
sys/arch/arm26/arm26/fiq.c | 68 +++++++++++++++++++++++++++++++++++++++++
sys/arch/arm26/arm26/fiq_util.S | 50 ++++++++++++++++++++++++++++++
sys/arch/arm26/arm26/irq.c | 20 ++++++++++-
sys/arch/arm26/conf/files.arm26 | 6 +++-
sys/arch/arm26/include/fiq.h | 19 ++++++++++-
sys/arch/arm26/iobus/iocvar.h | 4 +-
6 files changed, 162 insertions(+), 5 deletions(-)
diffs (272 lines):
diff -r 1b92cf13c014 -r 39827a822bfd sys/arch/arm26/arm26/fiq.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm26/arm26/fiq.c Mon Aug 20 23:08:10 2001 +0000
@@ -0,0 +1,68 @@
+/* $NetBSD: fiq.c,v 1.1 2001/08/20 23:08:10 bjh21 Exp $ */
+
+/*-
+ * Copyright (c) 2001 Ben Harris
+ * 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.
+ */
+
+#include <sys/param.h>
+
+__KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.1 2001/08/20 23:08:10 bjh21 Exp $");
+
+#include <sys/systm.h>
+
+#include <machine/fiq.h>
+
+int fiq_claimed;
+
+extern char fiqhandler[];
+
+void (*fiq_downgrade_handler)(void);
+
+int
+fiq_claim(void *handler, size_t size)
+{
+ int s;
+
+ if (size > 0x100)
+ return -1;
+ s = splhigh();
+ if (fiq_claimed)
+ return -1;
+ fiq_claimed = 1;
+ splx(s);
+ memcpy(fiqhandler, handler, size);
+ return 0;
+}
+
+void
+fiq_release()
+{
+
+ KASSERT(fiq_claimed);
+ fiq_claimed = 0;
+}
+
+
diff -r 1b92cf13c014 -r 39827a822bfd sys/arch/arm26/arm26/fiq_util.S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm26/arm26/fiq_util.S Mon Aug 20 23:08:10 2001 +0000
@@ -0,0 +1,50 @@
+/* $NetBSD: fiq_util.S,v 1.1 2001/08/20 23:08:10 bjh21 Exp $ */
+
+/*-
+ * Copyright (c) 2001 Ben Harris
+ * 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.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: fiq_util.S,v 1.1 2001/08/20 23:08:10 bjh21 Exp $")
+
+#include <machine/memcreg.h>
+#include <arch/arm26/iobus/iocreg.h>
+
+/*
+ * fiq_downgrade should be called in FIQ mode. It uses R12_fiq and R13_fiq
+ * as scratch registers. When finished, it returns from the FIQ.
+ */
+ENTRY(fiq_downgrade)
+ ldr r12, Lioc_base
+ ldrb r13, [r12, #(IOC_IRQMSKA << 2)]
+ orr r13, r13, #(1 <<IOC_IRQ_1)
+ strb r13, [r12, #(IOC_IRQMSKA << 2)]
+ mov r13, #0
+ strb r13, [r12, #(IOC_FIQMSK << 2)]
+ subs pc, r14, #4
+Lioc_base:
+ .word 0x03200000
\ No newline at end of file
diff -r 1b92cf13c014 -r 39827a822bfd sys/arch/arm26/arm26/irq.c
--- a/sys/arch/arm26/arm26/irq.c Mon Aug 20 22:56:10 2001 +0000
+++ b/sys/arch/arm26/arm26/irq.c Mon Aug 20 23:08:10 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irq.c,v 1.18 2001/05/01 22:19:09 bjh21 Exp $ */
+/* $NetBSD: irq.c,v 1.19 2001/08/20 23:08:10 bjh21 Exp $ */
/*-
* Copyright (c) 2000, 2001 Ben Harris
@@ -33,7 +33,7 @@
#include <sys/param.h>
-__RCSID("$NetBSD: irq.c,v 1.18 2001/05/01 22:19:09 bjh21 Exp $");
+__RCSID("$NetBSD: irq.c,v 1.19 2001/08/20 23:08:10 bjh21 Exp $");
#include <sys/device.h>
#include <sys/kernel.h> /* for cold */
@@ -54,12 +54,16 @@
#include <arch/arm26/iobus/iocvar.h>
#include "opt_ddb.h"
+#include "fiq.h"
#include "ioeb.h"
#include "unixbp.h"
#ifdef DDB
#include <ddb/db_output.h>
#endif
+#if NFIQ > 0
+#include <machine/fiq.h>
+#endif
#if NIOEB > 0
#include <arch/arm26/ioc/ioebvar.h>
#endif
@@ -130,7 +134,11 @@
#endif
/* Get interrupt-disabling back to the IOC */
+#if NFIQ > 0
+ s = hardsplx(IPL_HIGH); /* In case it's a FIQ downgrade. */
+#else
s = splhigh();
+#endif
int_on();
#if 0
@@ -139,6 +147,13 @@
uvmexp.intrs++;
stray = 1;
+#if NFIQ > 0
+ /* Check for downgraded FIQs. */
+ if (status & (1 << IOC_IRQ_1)) {
+ fiq_downgrade_handler();
+ goto handled;
+ }
+#endif
/* Find the highest-priority requested interrupt. */
for (h = irq_list_head.lh_first;
h != NULL && h->ipl > s;
@@ -171,6 +186,7 @@
if (__predict_false(stray))
log(LOG_WARNING, "Stray IRQ, status = 0x%x, spl = %d, "
"mask = 0x%x\n", status, s, irqmask[s]);
+handled:
#if 0
printf(" handled\n");
#endif
diff -r 1b92cf13c014 -r 39827a822bfd sys/arch/arm26/conf/files.arm26
--- a/sys/arch/arm26/conf/files.arm26 Mon Aug 20 22:56:10 2001 +0000
+++ b/sys/arch/arm26/conf/files.arm26 Mon Aug 20 23:08:10 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.arm26,v 1.36 2001/08/10 18:24:20 bjh21 Exp $
+# $NetBSD: files.arm26,v 1.37 2001/08/20 23:08:10 bjh21 Exp $
# Copyright (c) 1997, 1998, 2000 Ben Harris
# All rights reserved.
@@ -40,6 +40,8 @@
major {sd = 5}
major {cd = 6}
+define fiq
+
# CPU
#device cpu { }
attach cpu at root with cpu_root
@@ -201,6 +203,8 @@
file arch/arm26/arm26/cons_machdep.c
file arch/arm26/arm26/copyinout.S
file arch/arm26/arm26/except.c
+file arch/arm26/arm26/fiq.c fiq needs-flag
+file arch/arm26/arm26/fiq_util.S fiq
file arch/arm26/arm26/irq.c
file arch/arm26/arm26/Locore.c
file arch/arm26/arm26/machdep.c
diff -r 1b92cf13c014 -r 39827a822bfd sys/arch/arm26/include/fiq.h
--- a/sys/arch/arm26/include/fiq.h Mon Aug 20 22:56:10 2001 +0000
+++ b/sys/arch/arm26/include/fiq.h Mon Aug 20 23:08:10 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fiq.h,v 1.1 2001/08/13 22:59:40 bjh21 Exp $ */
+/* $NetBSD: fiq.h,v 1.2 2001/08/20 23:08:10 bjh21 Exp $ */
/*-
* Copyright (c) 2001 Ben Harris
@@ -45,4 +45,21 @@
#define FIQ_FDDRQ IOC_FIQ_FH0 /* Floppy disc data request */
#define FIQ_SINTR IOC_FIQ_C4 /* Serial line interrupt */
+struct fiq_regs {
+ register_t r8_fiq;
+ register_t r9_fiq;
+ register_t r10_fiq;
+ register_t r11_fiq;
+ register_t r12_fiq;
+ register_t r13_fiq;
+};
+
+extern int fiq_claim(void *, size_t);
+extern void fiq_release(void);
+extern void fiq_enable(int);
+extern void fiq_disable(void);
+extern void fiq_setregs(const struct fiq_regs *);
+extern void fiq_getregs(struct fiq_regs *);
+extern void (*fiq_downgrade_handler)(void);
+
#endif
diff -r 1b92cf13c014 -r 39827a822bfd sys/arch/arm26/iobus/iocvar.h
--- a/sys/arch/arm26/iobus/iocvar.h Mon Aug 20 22:56:10 2001 +0000
+++ b/sys/arch/arm26/iobus/iocvar.h Mon Aug 20 23:08:10 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iocvar.h,v 1.4 2001/01/23 23:58:32 bjh21 Exp $ */
+/* $NetBSD: iocvar.h,v 1.5 2001/08/20 23:08:11 bjh21 Exp $ */
/*-
* Copyright (c) 1998, 1999 Ben Harris
* All rights reserved.
@@ -64,6 +64,8 @@
extern u_int32_t ioc_irq_status_full(void);
extern void ioc_irq_setmask(u_int32_t);
+extern void ioc_fiq_setmask(u_int32_t);
+
extern void ioc_counter_start(struct device *, int, int);
extern void ioc_initclocks(struct device *);
Home |
Main Index |
Thread Index |
Old Index