Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sgimips/dev Move a few things from ip32.c.



details:   https://anonhg.NetBSD.org/src/rev/218d9df673e9
branches:  trunk
changeset: 494041:218d9df673e9
user:      soren <soren%NetBSD.org@localhost>
date:      Thu Jun 29 15:44:10 2000 +0000

description:
Move a few things from ip32.c.

diffstat:

 sys/arch/sgimips/dev/crime.c |  62 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 1 deletions(-)

diffs (89 lines):

diff -r afbdbf785d5b -r 218d9df673e9 sys/arch/sgimips/dev/crime.c
--- a/sys/arch/sgimips/dev/crime.c      Thu Jun 29 15:36:48 2000 +0000
+++ b/sys/arch/sgimips/dev/crime.c      Thu Jun 29 15:44:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crime.c,v 1.1 2000/06/14 16:13:54 soren Exp $  */
+/*     $NetBSD: crime.c,v 1.2 2000/06/29 15:44:10 soren Exp $  */
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -44,15 +44,20 @@
 #include <machine/locore.h>
 #include <machine/autoconf.h>
 #include <machine/bus.h>
+#include <machine/intr.h>
 
 #include <dev/pci/pcivar.h>
 
+#if 0
 #include <sgimips/dev/crimereg.h>
+#endif
 
 #include "locators.h"
 
 static int     crime_match(struct device *, struct cfdata *, void *);
 static void    crime_attach(struct device *, struct device *, void *);
+void *         crime_intr_establish(int, int, int, int (*)(void *), void *);
+int            crime_intr(void *);
 
 struct cfattach crime_ca = {
        sizeof(struct device), crime_match, crime_attach
@@ -104,3 +109,58 @@
        *(volatile u_int64_t *)0xb4000018 = 0x000000000000ffff;
 #endif
 }
+
+/*
+ * XXX
+ */
+
+#define CRIME_NINTR 32         /* XXX */
+
+struct {
+        int     (*func)(void *);
+        void    *arg;
+} crime[CRIME_NINTR];
+
+void *   
+crime_intr_establish(irq, type, level, func, arg)
+        int irq;
+        int type;
+        int level;
+        int (*func)(void *);
+        void *arg;
+{
+       int i;
+
+       for (i = 0; i <= CRIME_NINTR; i++) {
+               if (i == CRIME_NINTR)
+                       panic("too many IRQs");
+
+               if (crime[i].func != NULL)
+                       continue;
+
+               crime[i].func = func;
+               crime[i].arg = arg;
+               break;
+       }
+
+       return (void *)-1;
+}
+
+int
+crime_intr(arg)
+       void *arg;
+{
+       int i;
+
+       for (i = 0; i < CRIME_NINTR; i++) {
+int s;
+               if (crime[i].func == NULL)
+                       return 0;
+
+s = spltty();
+               (*crime[i].func)(crime[i].arg);
+splx(s);
+       }
+
+       return 0;
+}



Home | Main Index | Thread Index | Old Index