Implement pci_intr_disestablish().

This commit is contained in:
augustss 2002-01-13 23:02:33 +00:00
parent 75e5cd6d4f
commit 5a6220e6bc
7 changed files with 83 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.36 2001/11/23 23:48:07 soren Exp $ */
/* $NetBSD: machdep.c,v 1.37 2002/01/13 23:02:33 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -57,6 +57,7 @@
#include <machine/pte.h>
#include <machine/autoconf.h>
#include <machine/intr.h>
#include <machine/intr_machdep.h>
#include <mips/locore.h>
#include <machine/nvram.h>
@ -435,10 +436,7 @@ delay(n)
#define NINTR 6
static struct {
int (*func)(void *);
void *arg;
} intrtab[NINTR];
static struct cobalt_intr intrtab[NINTR];
void *
cpu_intr_establish(level, ipl, func, arg)
@ -453,10 +451,23 @@ cpu_intr_establish(level, ipl, func, arg)
if (intrtab[level].func != NULL)
panic("cannot share CPU interrupts");
intrtab[level].cookie_type = COBALT_COOKIE_TYPE_CPU;
intrtab[level].func = func;
intrtab[level].arg = arg;
return (void *)-1;
return &intrtab[level];
}
void
cpu_intr_disestablish(cookie)
void *cookie;
{
struct cobalt_intr *p = cookie;
if (p->cookie_type == COBALT_COOKIE_TYPE_CPU) {
p->func = NULL;
p->arg = NULL;
}
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: com_mainbus.c,v 1.2 2000/03/31 14:51:52 soren Exp $ */
/* $NetBSD: com_mainbus.c,v 1.3 2002/01/13 23:02:34 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -42,6 +42,7 @@
#include <machine/autoconf.h>
#include <machine/intr.h>
#include <machine/intr_machdep.h>
#include <machine/bus.h>
#include <dev/ic/comreg.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.10 2001/04/13 23:29:59 thorpej Exp $ */
/* $NetBSD: intr.h,v 1.11 2002/01/13 23:02:34 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -91,8 +91,5 @@ extern unsigned int intrcnt[];
#define SOFTCLOCK_INTR 0
#define SOFTNET_INTR 1
extern void * cpu_intr_establish(int, int, int (*)(void *), void *);
extern void * icu_intr_establish(int, int, int, int (*)(void *), void *);
#endif /* !_LOCORE */
#endif /* _LOCORE */

View File

@ -0,0 +1,39 @@
/* $NetBSD: intr_machdep.h,v 1.1 2002/01/13 23:02:34 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*/
struct cobalt_intr {
int cookie_type;
#define COBALT_COOKIE_TYPE_CPU 0x1
#define COBALT_COOKIE_TYPE_ICU 0x2
int (*func)(void *);
void *arg;
};
extern void * cpu_intr_establish(int, int, int (*)(void *), void *);
extern void * icu_intr_establish(int, int, int, int (*)(void *), void *);
extern void cpu_intr_disestablish(void *);
extern void icu_intr_disestablish(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.11 2001/02/05 13:14:21 tsutsui Exp $ */
/* $NetBSD: pci_machdep.c,v 1.12 2002/01/13 23:02:35 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -35,6 +35,7 @@
#define _COBALT_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/intr.h>
#include <machine/intr_machdep.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@ -217,7 +218,7 @@ pci_intr_disestablish(pc, cookie)
pci_chipset_tag_t pc;
void *cookie;
{
panic("pci_intr_disestablish: not implemented");
return;
/* Try both, only the valid one will disestablish. */
cpu_intr_disestablish(cookie);
icu_intr_disestablish(cookie);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcib.c,v 1.2 2000/03/31 14:51:55 soren Exp $ */
/* $NetBSD: pcib.c,v 1.3 2002/01/13 23:02:35 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -35,6 +35,7 @@
#include <machine/bus.h>
#include <machine/autoconf.h>
#include <machine/intr.h>
#include <machine/intr_machdep.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@ -50,10 +51,7 @@ struct cfattach pcib_ca = {
sizeof(struct device), pcib_match, pcib_attach
};
static struct {
int (*func)(void *);
void *arg;
} icu[IO_ICUSIZE];
static struct cobalt_intr icu[IO_ICUSIZE];
static int
pcib_match(parent, match, aux)
@ -113,6 +111,7 @@ icu_intr_establish(irq, type, level, func, arg)
if (icu[i].func != NULL)
continue;
icu[i].cookie_type = COBALT_COOKIE_TYPE_ICU;
icu[i].func = func;
icu[i].arg = arg;
break;
@ -121,6 +120,18 @@ icu_intr_establish(irq, type, level, func, arg)
return (void *)-1;
}
void
icu_intr_disestablish(cookie)
void *cookie;
{
struct cobalt_intr *p = cookie;
if (p->cookie_type == COBALT_COOKIE_TYPE_ICU) {
p->func = NULL;
p->arg = NULL;
}
}
int
icu_intr(arg)
void *arg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciide_machdep.c,v 1.2 2000/03/31 14:51:55 soren Exp $ */
/* $NetBSD: pciide_machdep.c,v 1.3 2002/01/13 23:02:35 augustss Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -34,6 +34,8 @@
#include <dev/pci/pciidereg.h>
#include <dev/pci/pciidevar.h>
#include <machine/intr_machdep.h>
void *
pciide_machdep_compat_intr_establish(dev, pa, chan, func, arg)
struct device *dev;