Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amigappc/amigappc Rewrote the "amiga" PIC from scra...
details: https://anonhg.NetBSD.org/src/rev/0f5c49955cd6
branches: trunk
changeset: 751380:0f5c49955cd6
user: phx <phx%NetBSD.org@localhost>
date: Tue Feb 02 19:15:33 2010 +0000
description:
Rewrote the "amiga" PIC from scratch. Interrupts are based on IPL 1-6 now
and no longer on IRQ 0-13.
Fixed interrupt levels in amigappc_install_handlers() (IPL_SOFTxxx was very
bad!).
Compilation with all (most?) amiga devices was tested and fixed.
Some smaller fixes.
Status:
With Cybervision64 and A3000 SBIC SCSI (with DMA disabled) the system
reaches multiuser!
Lots of problems left...
diffstat:
sys/arch/amigappc/amigappc/autoconf.c | 7 +-
sys/arch/amigappc/amigappc/machdep.c | 291 +++++++++++---------------------
sys/arch/amigappc/amigappc/p5reg.h | 8 +-
sys/arch/amigappc/amigappc/pic_amiga.c | 101 ++++++----
4 files changed, 169 insertions(+), 238 deletions(-)
diffs (truncated from 618 to 300 lines):
diff -r 2f4986fbda67 -r 0f5c49955cd6 sys/arch/amigappc/amigappc/autoconf.c
--- a/sys/arch/amigappc/amigappc/autoconf.c Tue Feb 02 19:07:05 2010 +0000
+++ b/sys/arch/amigappc/amigappc/autoconf.c Tue Feb 02 19:15:33 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.1 2009/07/21 09:49:15 phx Exp $ */
+/* $NetBSD: autoconf.c,v 1.2 2010/02/02 19:15:33 phx Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2009/07/21 09:49:15 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2010/02/02 19:15:33 phx Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,7 +66,6 @@
*/
amiga_realconfig = 1;
custom.intena = INTF_INTEN;
- printf("spl was %d\n",splhigh()); /* XXX */
if (config_rootfound("mainbus", NULL) == NULL)
panic("configure: mainbus not configured");
@@ -75,8 +74,8 @@
printf("survived autoconf, going to enable interrupts\n");
#endif
+ genppc_cpu_configure();
custom.intena = INTF_SETCLR | INTF_INTEN;
- genppc_cpu_configure();
#ifdef DEBUG_KERNEL_START
printf("survived configure...\n");
diff -r 2f4986fbda67 -r 0f5c49955cd6 sys/arch/amigappc/amigappc/machdep.c
--- a/sys/arch/amigappc/amigappc/machdep.c Tue Feb 02 19:07:05 2010 +0000
+++ b/sys/arch/amigappc/amigappc/machdep.c Tue Feb 02 19:15:33 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.39 2009/07/21 09:49:15 phx Exp $ */
+/* $NetBSD: machdep.c,v 1.40 2010/02/02 19:15:33 phx Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.39 2009/07/21 09:49:15 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.40 2010/02/02 19:15:33 phx Exp $");
#include "opt_ddb.h"
#include "opt_ipkdb.h"
@@ -65,9 +65,6 @@
#include "fd.h"
#include "ser.h"
-/* prototypes */
-void show_me_regs(void);
-
extern void setup_amiga_intr(void);
#if NSER > 0
extern void ser_outintr(void);
@@ -77,9 +74,6 @@
extern void fdintr(int);
#endif
-/* PIC interrupt handler type */
-typedef int (*ih_t)(void *);
-
/*
* patched by some devices at attach time (currently, only the coms)
*/
@@ -112,12 +106,11 @@
p = &q->isr_forw;
isr->isr_forw = NULL;
*p = isr;
-#if 0 /* XXX always enabled */
+
/* enable interrupt */
custom.intena = isr->isr_ipl == 2 ?
INTF_SETCLR | INTF_PORTS :
INTF_SETCLR | INTF_EXTER;
-#endif
}
void
@@ -133,21 +126,22 @@
*p = q->isr_forw;
else
panic("remove_isr: handler not registered");
-#if 0 /* XXX always enabled, why disable? */
+
/* disable interrupt if no more handlers */
p = isr->isr_ipl == 6 ? &isr_exter : &isr_ports;
if (*p == NULL) {
custom.intena = isr->isr_ipl == 6 ?
INTF_EXTER : INTF_PORTS;
}
-#endif
}
-static void
-ports_intr(struct isr **p)
+static int
+ports_intr(void *arg)
{
+ struct isr **p;
struct isr *q;
+ p = (struct isr **)arg;
while ((q = *p) != NULL) {
if ((q->isr_intr)(q->isr_arg))
break;
@@ -155,22 +149,110 @@
}
if (q == NULL)
ciaa_intr(); /* ciaa handles keyboard and parallel port */
+
+ custom.intreq = INTF_PORTS;
+ return 0;
}
-static void
-exter_intr(struct isr **p)
+static int
+exter_intr(void *arg)
{
+ struct isr **p;
struct isr *q;
+ p = (struct isr **)arg;
while ((q = *p) != NULL) {
if ((q->isr_intr)(q->isr_arg))
break;
p = &q->isr_forw;
}
- /*
- * XXX ciab_intr() is not needed, neither the timers nor the
- * floppy disk FGL interrupt
- */
+ if (q == NULL)
+ ciab_intr(); /* clear ciab icr */
+
+ custom.intreq = INTF_EXTER;
+ return 0;
+}
+
+static int
+lev1_intr(void *arg)
+{
+ unsigned short ireq;
+
+ ireq = custom.intreqr;
+ if (ireq & INTF_TBE) {
+#if NSER > 0
+ ser_outintr();
+#else
+ custom.intreq = INTF_TBE;
+#endif
+ }
+ if (ireq & INTF_DSKBLK) {
+#if NFD > 0
+ fdintr(0);
+#endif
+ custom.intreq = INTF_DSKBLK;
+ }
+ if (ireq & INTF_SOFTINT) {
+#ifdef DEBUG
+ printf("intrhand: SOFTINT ignored\n");
+#endif
+ custom.intreq = INTF_SOFTINT;
+ }
+ return 0;
+}
+
+static int
+lev3_intr(void *arg)
+{
+ unsigned short ireq;
+
+ ireq = custom.intreqr;
+ if (ireq & INTF_BLIT)
+ blitter_handler();
+ if (ireq & INTF_COPER)
+ copper_handler();
+ if (ireq & INTF_VERTB)
+ vbl_handler();
+ return 0;
+}
+
+static int
+lev4_intr(void *arg)
+{
+
+ audio_handler();
+ return 0;
+}
+
+static int
+lev5_intr(void *arg)
+{
+ unsigned short ireq;
+
+ ireq = custom.intreqr;
+ if (ireq & INTF_RBF)
+ serintr();
+ if (ireq & INTF_DSKSYNC)
+ custom.intreq = INTF_DSKSYNC;
+ return 0;
+}
+
+static void
+amigappc_install_handlers(void)
+{
+
+ /* handlers for all 6 Amiga interrupt levels */
+ intr_establish(1, IST_LEVEL, IPL_BIO, lev1_intr, NULL);
+
+ intr_establish(2, IST_LEVEL, IPL_BIO, ports_intr, &isr_ports);
+
+ intr_establish(3, IST_LEVEL, IPL_TTY, lev3_intr, NULL);
+
+ intr_establish(4, IST_LEVEL, IPL_AUDIO, lev4_intr, NULL);
+
+ intr_establish(5, IST_LEVEL, IPL_SERIAL, lev5_intr, NULL);
+
+ intr_establish(6, IST_LEVEL, IPL_SERIAL, exter_intr, &isr_exter);
}
static void
@@ -305,42 +387,6 @@
}
static void
-amigappc_install_handlers(void)
-{
-
-#if NSER > 0
- intr_establish(INTB_TBE, IST_LEVEL, IPL_SOFTCLOCK, (ih_t)ser_outintr, NULL);
- intr_establish(INTB_RBF, IST_LEVEL, IPL_SERIAL, (ih_t)serintr, NULL);
-#endif
-
-#if NFD > 0
- intr_establish(INTB_DSKBLK, IST_LEVEL, IPL_SOFTCLOCK, (ih_t)fdintr, 0);
-#endif
-
- intr_establish(INTB_PORTS, IST_LEVEL, IPL_SOFTCLOCK, (ih_t)ports_intr,
- &isr_ports);
-
- intr_establish(INTB_BLIT, IST_LEVEL, IPL_BIO, (ih_t)blitter_handler,
- NULL);
- intr_establish(INTB_COPER, IST_LEVEL, IPL_BIO, (ih_t)copper_handler,
- NULL);
- intr_establish(INTB_VERTB, IST_LEVEL, IPL_BIO, (ih_t)vbl_handler,
- NULL);
-
- intr_establish(INTB_AUD0, IST_LEVEL, IPL_VM, (ih_t)audio_handler,
- NULL);
- intr_establish(INTB_AUD1, IST_LEVEL, IPL_VM, (ih_t)audio_handler,
- NULL);
- intr_establish(INTB_AUD2, IST_LEVEL, IPL_VM, (ih_t)audio_handler,
- NULL);
- intr_establish(INTB_AUD3, IST_LEVEL, IPL_VM, (ih_t)audio_handler,
- NULL);
-
- intr_establish(INTB_EXTER, IST_LEVEL, IPL_CLOCK, (ih_t)exter_intr,
- &isr_exter);
-}
-
-static void
amigappc_bat_add(paddr_t pa, register_t len, register_t prot)
{
static int ni = 0, nd = 0;
@@ -464,75 +510,6 @@
va_end(ap);
}
-#if 0
-/*
- * customized oea_startup(), supports up to 64k msgbuf at 0xfff70000
- */
-static void
-amigappc_startup(const char *model)
-{
- uintptr_t sz;
- void *v;
- vaddr_t minaddr, maxaddr;
- char pbuf[9];
-
- KASSERT(curcpu() != NULL);
- KASSERT(lwp0.l_cpu != NULL);
- KASSERT(curcpu()->ci_intstk != 0);
- KASSERT(curcpu()->ci_intrdepth == -1);
-
- sz = round_page(MSGBUFSIZE);
- v = (void *)0xfff70000;
- initmsgbuf(v, sz);
-
Home |
Main Index |
Thread Index |
Old Index