Changes to make MPSAFE interrupts work on Alpha:
- Remove the ipl argument to scb_set() and the associated array of "mpsafe" booleans initialized based on the ipl. It was bogus anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM, and for all practical purposes, there is really only one device interrrupt level on Alpha anyway. Intead, we now treat all dispatches from the SCB vector table as MP-safe, and it is now the handler for that vector who is responsible for acquiring the KERNEL_LOCK if needed. - Update the direct interrupt vector handlers in jensenio and TURBOchannel to acquire the KERNEL_LOCK. - Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to alpha_shared_intr_establish(). When it is set, indicate that the handler is MP-safe. Update alpha_shared_intr_dispatch() to pay attention and acquire the KERNEL_LOCK (or not) as indicated. - Re-factor all of the PCI interrupt handling, providing "generic PCI" "PCI interrupts through ISA IRQs" implementations to significantly reduce code duplication. Supplement the PCI chipset tag with more info to facilitate this, and make the PCI interrupt-related routines take a pci_chipset_tag_t argument rather than a void * argument. - Because PCI interrupts on KN8AE are dispatched directly from the SCB, provide a wrapper for non-MPSAFE interrupt handlers that acquires the KERNEL_LOCK. - Change the pci_intr_handle_t type to be a struct rather than an integer type in order to catch any direct use of it as a value. Add a set of functions to interact with pci_intr_handle_t, including setting interrupt flags. - Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute can be set on a pci_intr_handle_t. - While I'm here, make all of the MI PCI back-end operations call through real functions rather than hopping directly through function pointers in the chipset tag. This change looks a lot bigger than it really is because of the re-factor in the plethora of model-specific PCI interrupt back-ends. The KN8AE, KN300, and T2/T3/T4 (Sable) are largely un-changed.
This commit is contained in:
parent
d6ad885809
commit
1099504e8b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: interrupt.c,v 1.88 2020/09/19 03:02:07 thorpej Exp $ */
|
||||
/* $NetBSD: interrupt.c,v 1.89 2020/09/22 15:24:01 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.88 2020/09/19 03:02:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.89 2020/09/22 15:24:01 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -88,8 +88,8 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.88 2020/09/19 03:02:07 thorpej Exp $
|
|||
#include <machine/cpuconf.h>
|
||||
#include <machine/alpha.h>
|
||||
|
||||
struct scbvec scb_iovectab[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)];
|
||||
static bool scb_mpsafe[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)];
|
||||
struct scbvec scb_iovectab[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)]
|
||||
__read_mostly;
|
||||
|
||||
void netintr(void);
|
||||
|
||||
|
@ -114,7 +114,7 @@ scb_stray(void *arg, u_long vec)
|
|||
}
|
||||
|
||||
void
|
||||
scb_set(u_long vec, void (*func)(void *, u_long), void *arg, int level)
|
||||
scb_set(u_long vec, void (*func)(void *, u_long), void *arg)
|
||||
{
|
||||
u_long idx;
|
||||
int s;
|
||||
|
@ -132,7 +132,6 @@ scb_set(u_long vec, void (*func)(void *, u_long), void *arg, int level)
|
|||
|
||||
scb_iovectab[idx].scb_func = func;
|
||||
scb_iovectab[idx].scb_arg = arg;
|
||||
scb_mpsafe[idx] = (level != IPL_VM);
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
@ -257,23 +256,17 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2,
|
|||
|
||||
case ALPHA_INTR_DEVICE: /* I/O device interrupt */
|
||||
{
|
||||
struct scbvec *scb;
|
||||
int idx = SCB_VECTOIDX(a1 - SCB_IOVECBASE);
|
||||
bool mpsafe = scb_mpsafe[idx];
|
||||
const int idx = SCB_VECTOIDX(a1 - SCB_IOVECBASE);
|
||||
|
||||
KDASSERT(a1 >= SCB_IOVECBASE && a1 < SCB_SIZE);
|
||||
|
||||
atomic_inc_ulong(&sc->sc_evcnt_device.ev_count);
|
||||
atomic_inc_ulong(&ci->ci_intrdepth);
|
||||
|
||||
if (!mpsafe) {
|
||||
KERNEL_LOCK(1, NULL);
|
||||
}
|
||||
ci->ci_data.cpu_nintr++;
|
||||
scb = &scb_iovectab[idx];
|
||||
|
||||
struct scbvec * const scb = &scb_iovectab[idx];
|
||||
(*scb->scb_func)(scb->scb_arg, a1);
|
||||
if (!mpsafe)
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
|
||||
atomic_dec_ulong(&ci->ci_intrdepth);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: shared_intr.c,v 1.22 2019/11/10 21:16:22 chs Exp $ */
|
||||
/* $NetBSD: shared_intr.c,v 1.23 2020/09/22 15:24:01 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.22 2019/11/10 21:16:22 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.23 2020/09/22 15:24:01 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -109,7 +109,14 @@ alpha_shared_intr_dispatch(struct alpha_shared_intr *intr, unsigned int num)
|
|||
* -1: This interrupt might have been for me, but I can't say
|
||||
* for sure.
|
||||
*/
|
||||
rv = (*ih->ih_fn)(ih->ih_arg);
|
||||
|
||||
if (!ih->ih_mpsafe) {
|
||||
KERNEL_LOCK(1, NULL);
|
||||
rv = (*ih->ih_fn)(ih->ih_arg);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
} else {
|
||||
rv = (*ih->ih_fn)(ih->ih_arg);
|
||||
}
|
||||
|
||||
handled = handled || (rv != 0);
|
||||
ih = ih->ih_q.tqe_next;
|
||||
|
@ -120,7 +127,8 @@ alpha_shared_intr_dispatch(struct alpha_shared_intr *intr, unsigned int num)
|
|||
|
||||
void *
|
||||
alpha_shared_intr_establish(struct alpha_shared_intr *intr, unsigned int num,
|
||||
int type, int level, int (*fn)(void *), void *arg, const char *basename)
|
||||
int type, int level, int flags,
|
||||
int (*fn)(void *), void *arg, const char *basename)
|
||||
{
|
||||
struct alpha_shared_intrhand *ih;
|
||||
|
||||
|
@ -166,6 +174,7 @@ alpha_shared_intr_establish(struct alpha_shared_intr *intr, unsigned int num,
|
|||
ih->ih_arg = arg;
|
||||
ih->ih_level = level;
|
||||
ih->ih_num = num;
|
||||
ih->ih_mpsafe = (flags & ALPHA_INTR_MPSAFE) != 0;
|
||||
|
||||
intr[num].intr_sharetype = type;
|
||||
TAILQ_INSERT_TAIL(&intr[num].intr_q, ih, ih_q);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intr.h,v 1.78 2020/09/19 01:24:31 thorpej Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.79 2020/09/22 15:24:01 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -195,6 +195,8 @@ void alpha_multicast_ipi(unsigned long, unsigned long);
|
|||
* Alpha shared-interrupt-line common code.
|
||||
*/
|
||||
|
||||
#define ALPHA_INTR_MPSAFE 0x01
|
||||
|
||||
struct alpha_shared_intrhand {
|
||||
TAILQ_ENTRY(alpha_shared_intrhand)
|
||||
ih_q;
|
||||
|
@ -203,6 +205,7 @@ struct alpha_shared_intrhand {
|
|||
void *ih_arg;
|
||||
int ih_level;
|
||||
unsigned int ih_num;
|
||||
int ih_mpsafe;
|
||||
};
|
||||
|
||||
struct alpha_shared_intr {
|
||||
|
@ -225,7 +228,7 @@ struct alpha_shared_intr *alpha_shared_intr_alloc(unsigned int, unsigned int);
|
|||
int alpha_shared_intr_dispatch(struct alpha_shared_intr *,
|
||||
unsigned int);
|
||||
void *alpha_shared_intr_establish(struct alpha_shared_intr *,
|
||||
unsigned int, int, int, int (*)(void *), void *, const char *);
|
||||
unsigned int, int, int, int, int (*)(void *), void *, const char *);
|
||||
void alpha_shared_intr_disestablish(struct alpha_shared_intr *,
|
||||
void *, const char *);
|
||||
int alpha_shared_intr_get_sharetype(struct alpha_shared_intr *,
|
||||
|
@ -254,7 +257,7 @@ struct evcnt *alpha_shared_intr_evcnt(struct alpha_shared_intr *,
|
|||
extern struct scbvec scb_iovectab[];
|
||||
|
||||
void scb_init(void);
|
||||
void scb_set(u_long, void (*)(void *, u_long), void *, int);
|
||||
void scb_set(u_long, void (*)(void *, u_long), void *);
|
||||
u_long scb_alloc(void (*)(void *, u_long), void *);
|
||||
void scb_free(u_long);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_machdep.h,v 1.18 2014/03/29 19:28:25 christos Exp $ */
|
||||
/* $NetBSD: pci_machdep.h,v 1.19 2020/09/22 15:24:01 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -27,6 +27,11 @@
|
|||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#ifndef _ALPHA_PCI_MACHDEP_H_
|
||||
#define _ALPHA_PCI_MACHDEP_H_
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
||||
/*
|
||||
* Machine-specific definitions for PCI autoconfiguration.
|
||||
*/
|
||||
|
@ -37,12 +42,15 @@
|
|||
*/
|
||||
typedef struct alpha_pci_chipset *pci_chipset_tag_t;
|
||||
typedef u_long pcitag_t;
|
||||
typedef u_long pci_intr_handle_t;
|
||||
typedef struct {
|
||||
u_long value;
|
||||
} pci_intr_handle_t;
|
||||
|
||||
/*
|
||||
* Forward declarations.
|
||||
*/
|
||||
struct pci_attach_args;
|
||||
struct alpha_shared_intr;
|
||||
|
||||
/*
|
||||
* alpha-specific PCI structure and type definitions.
|
||||
|
@ -62,43 +70,44 @@ struct alpha_pci_chipset {
|
|||
void *pc_intr_v;
|
||||
int (*pc_intr_map)(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *(*pc_intr_string)(void *, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
|
||||
void *(*pc_intr_establish)(void *, pci_intr_handle_t,
|
||||
int, int (*)(void *), void *);
|
||||
void (*pc_intr_disestablish)(void *, void *);
|
||||
const char *(*pc_intr_string)(pci_chipset_tag_t,
|
||||
pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *(*pc_intr_evcnt)(pci_chipset_tag_t,
|
||||
pci_intr_handle_t);
|
||||
void *(*pc_intr_establish)(pci_chipset_tag_t,
|
||||
pci_intr_handle_t, int, int (*)(void *), void *);
|
||||
void (*pc_intr_disestablish)(pci_chipset_tag_t, void *);
|
||||
|
||||
void *(*pc_pciide_compat_intr_establish)(void *, device_t,
|
||||
void *(*pc_pciide_compat_intr_establish)(device_t,
|
||||
const struct pci_attach_args *, int,
|
||||
int (*)(void *), void *);
|
||||
|
||||
struct alpha_shared_intr *pc_shared_intrs;
|
||||
const char *pc_intr_desc;
|
||||
u_long pc_vecbase;
|
||||
u_int pc_nirq;
|
||||
|
||||
void (*pc_intr_enable)(pci_chipset_tag_t, int);
|
||||
void (*pc_intr_disable)(pci_chipset_tag_t, int);
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions provided to machine-independent PCI code.
|
||||
*/
|
||||
#define pci_attach_hook(p, s, pba) \
|
||||
(*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
|
||||
#define pci_bus_maxdevs(c, b) \
|
||||
(*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
|
||||
#define pci_make_tag(c, b, d, f) \
|
||||
(*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
|
||||
#define pci_decompose_tag(c, t, bp, dp, fp) \
|
||||
(*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
|
||||
#define pci_conf_read(c, t, r) \
|
||||
(*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
|
||||
#define pci_conf_write(c, t, r, v) \
|
||||
(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
|
||||
#define pci_intr_map(pa, ihp) \
|
||||
(*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
|
||||
#define pci_intr_string(c, ih, buf, len) \
|
||||
(*(c)->pc_intr_string)((c)->pc_intr_v, (ih), (buf), (len))
|
||||
#define pci_intr_evcnt(c, ih) \
|
||||
(*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
|
||||
#define pci_intr_establish(c, ih, l, h, a) \
|
||||
(*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
|
||||
#define pci_intr_disestablish(c, iv) \
|
||||
(*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
|
||||
void pci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
|
||||
int pci_bus_maxdevs(pci_chipset_tag_t, int);
|
||||
pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
|
||||
void pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *);
|
||||
pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
|
||||
void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
|
||||
|
||||
int pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
|
||||
const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
|
||||
void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
|
||||
int (*)(void *), void *);
|
||||
void pci_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
|
||||
/*
|
||||
* alpha-specific PCI functions.
|
||||
|
@ -106,8 +115,23 @@ struct alpha_pci_chipset {
|
|||
*/
|
||||
void pci_display_console(bus_space_tag_t, bus_space_tag_t,
|
||||
pci_chipset_tag_t, int, int, int);
|
||||
#define alpha_pciide_compat_intr_establish(c, d, p, ch, f, a) \
|
||||
((c)->pc_pciide_compat_intr_establish == NULL ? NULL : \
|
||||
(*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \
|
||||
(ch), (f), (a)))
|
||||
void device_pci_register(device_t, void *);
|
||||
|
||||
int alpha_pci_generic_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *alpha_pci_generic_intr_string(pci_chipset_tag_t,
|
||||
pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *alpha_pci_generic_intr_evcnt(pci_chipset_tag_t,
|
||||
pci_intr_handle_t);
|
||||
void *alpha_pci_generic_intr_establish(pci_chipset_tag_t,
|
||||
pci_intr_handle_t, int, int (*)(void *), void *);
|
||||
void alpha_pci_generic_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
void alpha_pci_generic_iointr(void *, unsigned long);
|
||||
|
||||
void alpha_pci_intr_handle_init(pci_intr_handle_t *, u_int, u_int);
|
||||
void alpha_pci_intr_handle_set_irq(pci_intr_handle_t *, u_int);
|
||||
u_int alpha_pci_intr_handle_get_irq(const pci_intr_handle_t *);
|
||||
void alpha_pci_intr_handle_set_flags(pci_intr_handle_t *, u_int);
|
||||
u_int alpha_pci_intr_handle_get_flags(const pci_intr_handle_t *);
|
||||
|
||||
#endif /* _ALPHA_PCI_MACHDEP_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: com_jensenio.c,v 1.16 2020/09/19 16:54:34 tsutsui Exp $ */
|
||||
/* $NetBSD: com_jensenio.c,v 1.17 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.16 2020/09/19 16:54:34 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.17 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -118,7 +118,7 @@ com_jensenio_attach(device_t parent, device_t self, void *aux)
|
|||
|
||||
com_attach_subr(sc);
|
||||
|
||||
scb_set(ja->ja_irq[0], com_jensenio_intr, jsc, IPL_VM);
|
||||
scb_set(ja->ja_irq[0], com_jensenio_intr, jsc);
|
||||
aprint_normal_dev(self, "interrupting at vector 0x%x\n",
|
||||
ja->ja_irq[0]);
|
||||
|
||||
|
@ -136,6 +136,8 @@ com_jensenio_intr(void *arg, u_long vec)
|
|||
{
|
||||
struct com_jensenio_softc *jsc = arg;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
jsc->sc_ev_intr.ev_count++;
|
||||
(void) comintr(&jsc->sc_com);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: jensenio_intr.c,v 1.11 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: jensenio_intr.c,v 1.12 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.11 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.12 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -215,12 +215,11 @@ jensenio_eisa_intr_establish(void *v, int irq, int type, int level,
|
|||
}
|
||||
|
||||
cookie = alpha_shared_intr_establish(jensenio_eisa_intr, irq,
|
||||
type, level, fn, arg, "eisa irq");
|
||||
type, level, 0, fn, arg, "eisa irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(jensenio_eisa_intr, irq)) {
|
||||
scb_set(0x800 + SCB_IDXTOVEC(irq), jensenio_iointr, NULL,
|
||||
level);
|
||||
scb_set(0x800 + SCB_IDXTOVEC(irq), jensenio_iointr, NULL);
|
||||
jensenio_setlevel(irq,
|
||||
alpha_shared_intr_get_sharetype(jensenio_eisa_intr,
|
||||
irq) == IST_LEVEL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbc_jensenio.c,v 1.12 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pckbc_jensenio.c,v 1.13 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pckbc_jensenio.c,v 1.12 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pckbc_jensenio.c,v 1.13 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -144,7 +144,7 @@ pckbc_jensenio_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
|
|||
jsc->sc_ic[slot].ic_sc = sc;
|
||||
|
||||
scb_set(jsc->sc_ic[slot].ic_vector, pckbc_jensenio_intr,
|
||||
&jsc->sc_ic[slot], IPL_VM);
|
||||
&jsc->sc_ic[slot]);
|
||||
aprint_normal_dev(sc->sc_dv, "%s slot interrupting at vector 0x%lx\n",
|
||||
pckbc_slot_names[slot], jsc->sc_ic[slot].ic_vector);
|
||||
|
||||
|
@ -159,6 +159,8 @@ pckbc_jensenio_intr(void *arg, u_long vec)
|
|||
{
|
||||
struct pckbc_jensenio_intrcookie *ic = arg;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
ic->ic_ev.ev_count++;
|
||||
(void) pckbcintr(ic->ic_sc);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_1000.c,v 1.26 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_1000.c,v 1.27 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_1000.c,v 1.26 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_1000.c,v 1.27 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -86,23 +86,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_1000.c,v 1.26 2014/03/21 16:39:29 christos Exp $
|
|||
static bus_space_tag_t another_mystery_icu_iot;
|
||||
static bus_space_handle_t another_mystery_icu_ioh;
|
||||
|
||||
int dec_1000_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
|
||||
const char *dec_1000_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_1000_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_1000_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_1000_intr_disestablish(void *, void *);
|
||||
static int dec_1000_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
#define PCI_NIRQ 16
|
||||
#define PCI_STRAY_MAX 5
|
||||
|
||||
struct alpha_shared_intr *dec_1000_pci_intr;
|
||||
|
||||
static void dec_1000_iointr(void *arg, unsigned long vec);
|
||||
static void dec_1000_enable_intr(int irq);
|
||||
static void dec_1000_disable_intr(int irq);
|
||||
static void pci_1000_imi(void);
|
||||
static pci_chipset_tag_t pc_tag;
|
||||
static void dec_1000_enable_intr(pci_chipset_tag_t, int irq);
|
||||
static void dec_1000_disable_intr(pci_chipset_tag_t, int irq);
|
||||
static void pci_1000_imi(void);
|
||||
|
||||
void
|
||||
pci_1000_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc)
|
||||
|
@ -112,30 +104,37 @@ pci_1000_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_chi
|
|||
|
||||
another_mystery_icu_iot = iot;
|
||||
|
||||
pc_tag = pc;
|
||||
if (bus_space_map(iot, 0x536, 2, 0, &another_mystery_icu_ioh))
|
||||
panic("pci_1000_pickintr");
|
||||
|
||||
pc->pc_intr_v = core;
|
||||
pc->pc_intr_map = dec_1000_intr_map;
|
||||
pc->pc_intr_string = dec_1000_intr_string;
|
||||
pc->pc_intr_evcnt = dec_1000_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_1000_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_1000_intr_disestablish;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = alpha_pci_generic_intr_establish;
|
||||
pc->pc_intr_disestablish = alpha_pci_generic_intr_disestablish;
|
||||
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
||||
#define PCI_1000_IRQ_STR 8
|
||||
dec_1000_pci_intr =
|
||||
pc->pc_shared_intrs =
|
||||
alpha_shared_intr_alloc(PCI_NIRQ, PCI_1000_IRQ_STR);
|
||||
pc->pc_intr_desc = "dec 1000 irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = PCI_NIRQ;
|
||||
|
||||
pc->pc_intr_enable = dec_1000_enable_intr;
|
||||
pc->pc_intr_disable = dec_1000_disable_intr;
|
||||
|
||||
for (i = 0; i < PCI_NIRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(dec_1000_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(dec_1000_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_1000_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
dec_1000_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec_1000", cp);
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec 1000", cp);
|
||||
}
|
||||
|
||||
pci_1000_imi();
|
||||
|
@ -144,7 +143,7 @@ pci_1000_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_chi
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
|
@ -163,12 +162,14 @@ dec_1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
case 6:
|
||||
if(buspin != 1)
|
||||
break;
|
||||
*ihp = 0xc; /* integrated ncr scsi */
|
||||
/* integrated ncr scsi */
|
||||
alpha_pci_intr_handle_init(ihp, 0xc, 0);
|
||||
return 0;
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
*ihp = (device - 11) * 4 + buspin - 1;
|
||||
alpha_pci_intr_handle_init(ihp,
|
||||
(device - 11) * 4 + buspin - 1, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -176,90 +177,6 @@ bad: printf("dec_1000_intr_map: can't map dev %d pin %d\n", device, buspin);
|
|||
return 1;
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_1000_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
static const char irqmsg_fmt[] = "dec_1000 irq %ld";
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("%s: bogus dec_1000 IRQ 0x%lx", __func__, ih);
|
||||
|
||||
snprintf(buf, len, irqmsg_fmt, ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_1000_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
{
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("%s: bogus dec_1000 IRQ 0x%lx", __func__, ih);
|
||||
|
||||
return (alpha_shared_intr_evcnt(dec_1000_pci_intr, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_1000_intr_establish(
|
||||
void *ccv,
|
||||
pci_intr_handle_t ih,
|
||||
int level,
|
||||
int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
void *cookie;
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("dec_1000_intr_establish: IRQ too high, 0x%lx", ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(dec_1000_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "dec_1000 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(dec_1000_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), dec_1000_iointr, NULL,
|
||||
level);
|
||||
dec_1000_enable_intr(ih);
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_1000_intr_disestablish(void *ccv, void *cookie)
|
||||
{
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(dec_1000_pci_intr, cookie,
|
||||
"dec_1000 irq");
|
||||
if (alpha_shared_intr_isactive(dec_1000_pci_intr, irq) == 0) {
|
||||
dec_1000_disable_intr(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(dec_1000_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
static void
|
||||
dec_1000_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(dec_1000_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(dec_1000_pci_intr, irq,
|
||||
"dec_1000 irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(dec_1000_pci_intr, irq))
|
||||
dec_1000_disable_intr(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(dec_1000_pci_intr, irq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read and write the mystery ICU IMR registers
|
||||
*/
|
||||
|
@ -275,16 +192,17 @@ dec_1000_iointr(void *arg, unsigned long vec)
|
|||
*/
|
||||
|
||||
static void
|
||||
dec_1000_enable_intr(int irq)
|
||||
dec_1000_enable_intr(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
IW(IR() | 1 << irq);
|
||||
}
|
||||
|
||||
static void
|
||||
dec_1000_disable_intr(int irq)
|
||||
dec_1000_disable_intr(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
IW(IR() & ~(1 << irq));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize mystery ICU
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_1000a.c,v 1.28 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_1000a.c,v 1.29 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_1000a.c,v 1.28 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_1000a.c,v 1.29 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -92,21 +92,12 @@ __KERNEL_RCSID(0, "$NetBSD: pci_1000a.c,v 1.28 2014/03/21 16:39:29 christos Exp
|
|||
static bus_space_tag_t mystery_icu_iot;
|
||||
static bus_space_handle_t mystery_icu_ioh[2];
|
||||
|
||||
int dec_1000a_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_1000a_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_1000a_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_1000a_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_1000a_intr_disestablish(void *, void *);
|
||||
static int dec_1000a_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
struct alpha_shared_intr *dec_1000a_pci_intr;
|
||||
|
||||
static void dec_1000a_iointr(void *arg, unsigned long vec);
|
||||
static void dec_1000a_enable_intr(int irq);
|
||||
static void dec_1000a_disable_intr(int irq);
|
||||
static void pci_1000a_imi(void);
|
||||
static pci_chipset_tag_t pc_tag;
|
||||
static void dec_1000a_enable_intr(pci_chipset_tag_t, int irq);
|
||||
static void dec_1000a_disable_intr(pci_chipset_tag_t, int irq);
|
||||
static void pci_1000a_imi(void);
|
||||
|
||||
void
|
||||
pci_1000a_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc)
|
||||
|
@ -116,31 +107,38 @@ pci_1000a_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_ch
|
|||
|
||||
mystery_icu_iot = iot;
|
||||
|
||||
pc_tag = pc;
|
||||
if (bus_space_map(iot, 0x54a, 2, 0, mystery_icu_ioh + 0)
|
||||
|| bus_space_map(iot, 0x54c, 2, 0, mystery_icu_ioh + 1))
|
||||
panic("pci_1000a_pickintr");
|
||||
|
||||
pc->pc_intr_v = core;
|
||||
pc->pc_intr_map = dec_1000a_intr_map;
|
||||
pc->pc_intr_string = dec_1000a_intr_string;
|
||||
pc->pc_intr_evcnt = dec_1000a_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_1000a_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_1000a_intr_disestablish;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = alpha_pci_generic_intr_establish;
|
||||
pc->pc_intr_disestablish = alpha_pci_generic_intr_disestablish;
|
||||
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
||||
#define PCI_1000A_IRQ_STR 8
|
||||
dec_1000a_pci_intr = alpha_shared_intr_alloc(PCI_NIRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(PCI_NIRQ,
|
||||
PCI_1000A_IRQ_STR);
|
||||
pc->pc_intr_desc = "dec 1000a irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = PCI_NIRQ;
|
||||
|
||||
pc->pc_intr_enable = dec_1000a_enable_intr;
|
||||
pc->pc_intr_disable = dec_1000a_disable_intr;
|
||||
|
||||
for (i = 0; i < PCI_NIRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(dec_1000a_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(dec_1000a_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_1000A_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
dec_1000a_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec_1000a", cp);
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec 1000a", cp);
|
||||
}
|
||||
|
||||
pci_1000a_imi();
|
||||
|
@ -189,7 +187,7 @@ dec_1000a_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
printf("dec_1000a_intr_map: ?! UNEXPECTED DEV 0\n");
|
||||
imrbit = imrmap[device][buspin - 1];
|
||||
if (imrbit) {
|
||||
*ihp = IMR2IRQ(imrbit);
|
||||
alpha_pci_intr_handle_init(ihp, IMR2IRQ(imrbit), 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -197,90 +195,6 @@ bad: printf("dec_1000a_intr_map: can't map dev %d pin %d\n", device, buspin);
|
|||
return 1;
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_1000a_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
static const char irqmsg_fmt[] = "dec_1000a irq %ld";
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("%s: bogus dec_1000a IRQ 0x%lx", __func__, ih);
|
||||
|
||||
snprintf(buf, len, irqmsg_fmt, ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_1000a_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
{
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("%s: bogus dec_1000a IRQ 0x%lx", __func__, ih);
|
||||
|
||||
return (alpha_shared_intr_evcnt(dec_1000a_pci_intr, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_1000a_intr_establish(
|
||||
void *ccv,
|
||||
pci_intr_handle_t ih,
|
||||
int level,
|
||||
int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
void *cookie;
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("dec_1000a_intr_establish: IRQ too high, 0x%lx", ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(dec_1000a_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "dec_1000a irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(dec_1000a_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), dec_1000a_iointr, NULL,
|
||||
level);
|
||||
dec_1000a_enable_intr(ih);
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_1000a_intr_disestablish(void *ccv, void *cookie)
|
||||
{
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(dec_1000a_pci_intr, cookie,
|
||||
"dec_1000a irq");
|
||||
if (alpha_shared_intr_isactive(dec_1000a_pci_intr, irq) == 0) {
|
||||
dec_1000a_disable_intr(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(dec_1000a_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
static void
|
||||
dec_1000a_iointr(void *framep, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(dec_1000a_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(dec_1000a_pci_intr, irq,
|
||||
"dec_1000a irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(dec_1000a_pci_intr, irq))
|
||||
dec_1000a_disable_intr(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(dec_1000a_pci_intr, irq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read and write the mystery ICU IMR registers
|
||||
*/
|
||||
|
@ -293,7 +207,7 @@ dec_1000a_iointr(void *framep, unsigned long vec)
|
|||
*/
|
||||
|
||||
static void
|
||||
dec_1000a_enable_intr(int irq)
|
||||
dec_1000a_enable_intr(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
int imrval = IRQ2IMR(irq);
|
||||
int i = imrval >= 16;
|
||||
|
@ -302,13 +216,14 @@ dec_1000a_enable_intr(int irq)
|
|||
}
|
||||
|
||||
static void
|
||||
dec_1000a_disable_intr(int irq)
|
||||
dec_1000a_disable_intr(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
int imrval = IRQ2IMR(irq);
|
||||
int i = imrval >= 16;
|
||||
|
||||
IW(i, IR(i) & ~(1 << (imrval & 0xf)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize mystery ICU
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_2100_a50.c,v 1.41 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_2100_a50.c,v 1.42 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_2100_a50.c,v 1.41 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_2100_a50.c,v 1.42 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -54,13 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_2100_a50.c,v 1.41 2014/03/21 16:39:29 christos E
|
|||
|
||||
#include "sio.h"
|
||||
|
||||
int dec_2100_a50_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_2100_a50_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_2100_a50_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_2100_a50_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_2100_a50_intr_disestablish(void *, void *);
|
||||
static int dec_2100_a50_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
#define APECS_SIO_DEVICE 7 /* XXX */
|
||||
|
||||
|
@ -81,10 +76,10 @@ pci_2100_a50_pickintr(struct apecs_config *acp)
|
|||
|
||||
pc->pc_intr_v = acp;
|
||||
pc->pc_intr_map = dec_2100_a50_intr_map;
|
||||
pc->pc_intr_string = dec_2100_a50_intr_string;
|
||||
pc->pc_intr_evcnt = dec_2100_a50_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_2100_a50_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_2100_a50_intr_disestablish;
|
||||
pc->pc_intr_string = sio_pci_intr_string;
|
||||
pc->pc_intr_evcnt = sio_pci_intr_evcnt;
|
||||
pc->pc_intr_establish = sio_pci_intr_establish;
|
||||
pc->pc_intr_disestablish = sio_pci_intr_disestablish;
|
||||
|
||||
/* Not supported on 2100 A50. */
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
@ -114,7 +109,7 @@ dec_2100_a50_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_2100_a50_intr_map: bad interrupt pin %d\n",
|
||||
buspin);
|
||||
return 1;
|
||||
|
@ -210,47 +205,6 @@ dec_2100_a50_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
device, '@' + buspin, pirqline);
|
||||
#endif
|
||||
|
||||
*ihp = pirqline;
|
||||
alpha_pci_intr_handle_init(ihp, pirqline, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_2100_a50_intr_string(void *acv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if 0
|
||||
struct apecs_config *acp = acv;
|
||||
#endif
|
||||
|
||||
return sio_intr_string(NULL /*XXX*/, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_2100_a50_intr_evcnt(void *acv, pci_intr_handle_t ih)
|
||||
{
|
||||
#if 0
|
||||
struct apecs_config *acp = acv;
|
||||
#endif
|
||||
|
||||
return sio_intr_evcnt(NULL /*XXX*/, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_2100_a50_intr_establish(void *acv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct apecs_config *acp = acv;
|
||||
#endif
|
||||
|
||||
return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
|
||||
arg);
|
||||
}
|
||||
|
||||
void
|
||||
dec_2100_a50_intr_disestablish(void *acv, void *cookie)
|
||||
{
|
||||
#if 0
|
||||
struct apecs_config *acp = acv;
|
||||
#endif
|
||||
|
||||
sio_intr_disestablish(NULL /*XXX*/, cookie);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_2100_a500.c,v 1.12 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_2100_a500.c,v 1.13 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_2100_a500.c,v 1.12 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_2100_a500.c,v 1.13 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -60,25 +60,24 @@ static bus_space_handle_t pic_elcr_ioh;
|
|||
|
||||
static const int pic_slave_to_master[4] = { 1, 3, 4, 5 };
|
||||
|
||||
int dec_2100_a500_pic_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
static int dec_2100_a500_pic_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
int dec_2100_a500_icic_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
static int dec_2100_a500_icic_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
const char *dec_2100_a500_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_2100_a500_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_2100_a500_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*)(void *), void *);
|
||||
void dec_2100_a500_intr_disestablish(void *, void *);
|
||||
static void *dec_2100_a500_intr_establish(pci_chipset_tag_t,
|
||||
pci_intr_handle_t, int, int (*)(void *), void *);
|
||||
static void dec_2100_a500_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
|
||||
int dec_2100_a500_eisa_intr_map(void *, u_int, eisa_intr_handle_t *);
|
||||
const char *dec_2100_a500_eisa_intr_string(void *, int, char *, size_t);
|
||||
const struct evcnt *dec_2100_a500_eisa_intr_evcnt(void *, int);
|
||||
void *dec_2100_a500_eisa_intr_establish(void *, int, int, int,
|
||||
int (*)(void *), void *);
|
||||
void dec_2100_a500_eisa_intr_disestablish(void *, void *);
|
||||
int dec_2100_a500_eisa_intr_alloc(void *, int, int, int *);
|
||||
static int dec_2100_a500_eisa_intr_map(void *, u_int,
|
||||
eisa_intr_handle_t *);
|
||||
static const char *dec_2100_a500_eisa_intr_string(void *, int, char *, size_t);
|
||||
static const struct evcnt *dec_2100_a500_eisa_intr_evcnt(void *, int);
|
||||
static void *dec_2100_a500_eisa_intr_establish(void *, int, int, int,
|
||||
int (*)(void *), void *);
|
||||
static void dec_2100_a500_eisa_intr_disestablish(void *, void *);
|
||||
static int dec_2100_a500_eisa_intr_alloc(void *, int, int, int *);
|
||||
|
||||
#define PCI_STRAY_MAX 5
|
||||
|
||||
|
@ -89,17 +88,19 @@ int dec_2100_a500_eisa_intr_alloc(void *, int, int, int *);
|
|||
#define SABLE_MAX_IRQ 64
|
||||
#define SABLE_8259_MAX_IRQ 32
|
||||
|
||||
void dec_2100_a500_iointr(void *, u_long);
|
||||
static void dec_2100_a500_iointr(void *, u_long);
|
||||
|
||||
void dec_2100_a500_pic_enable_intr(struct ttwoga_config *, int, int);
|
||||
void dec_2100_a500_pic_init_intr(struct ttwoga_config *);
|
||||
void dec_2100_a500_pic_setlevel(struct ttwoga_config *, int, int);
|
||||
void dec_2100_a500_pic_eoi(struct ttwoga_config *, int);
|
||||
static void dec_2100_a500_pic_enable_intr(struct ttwoga_config *,
|
||||
int, int);
|
||||
static void dec_2100_a500_pic_init_intr(struct ttwoga_config *);
|
||||
static void dec_2100_a500_pic_setlevel(struct ttwoga_config *, int, int);
|
||||
static void dec_2100_a500_pic_eoi(struct ttwoga_config *, int);
|
||||
|
||||
void dec_2100_a500_icic_enable_intr(struct ttwoga_config *, int, int);
|
||||
void dec_2100_a500_icic_init_intr(struct ttwoga_config *);
|
||||
void dec_2100_a500_icic_setlevel(struct ttwoga_config *, int, int);
|
||||
void dec_2100_a500_icic_eoi(struct ttwoga_config *, int);
|
||||
static void dec_2100_a500_icic_enable_intr(struct ttwoga_config *,
|
||||
int, int);
|
||||
static void dec_2100_a500_icic_init_intr(struct ttwoga_config *);
|
||||
static void dec_2100_a500_icic_setlevel(struct ttwoga_config *, int, int);
|
||||
static void dec_2100_a500_icic_eoi(struct ttwoga_config *, int);
|
||||
|
||||
#define T2_IRQ_EISA_START 7
|
||||
#define T2_IRQ_EISA_COUNT 16
|
||||
|
@ -108,7 +109,7 @@ void dec_2100_a500_icic_eoi(struct ttwoga_config *, int);
|
|||
((irq) >= T2_IRQ_EISA_START && \
|
||||
(irq) < (T2_IRQ_EISA_START + T2_IRQ_EISA_COUNT))
|
||||
|
||||
const int dec_2100_a500_intr_deftype[SABLE_MAX_IRQ] = {
|
||||
static const int dec_2100_a500_intr_deftype[SABLE_MAX_IRQ] = {
|
||||
IST_LEVEL, /* PCI slot 0 A */
|
||||
IST_LEVEL, /* on-board SCSI */
|
||||
IST_LEVEL, /* on-board Ethernet */
|
||||
|
@ -190,8 +191,8 @@ pci_2100_a500_pickintr(struct ttwoga_config *tcp)
|
|||
pic_iot = &tcp->tc_iot;
|
||||
|
||||
pc->pc_intr_v = tcp;
|
||||
pc->pc_intr_string = dec_2100_a500_intr_string;
|
||||
pc->pc_intr_evcnt = dec_2100_a500_intr_evcnt;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_2100_a500_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_2100_a500_intr_disestablish;
|
||||
|
||||
|
@ -199,26 +200,30 @@ pci_2100_a500_pickintr(struct ttwoga_config *tcp)
|
|||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
||||
#define PCI_2100_IRQ_STR 8
|
||||
tcp->tc_intrtab = alpha_shared_intr_alloc(SABLE_MAX_IRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(SABLE_MAX_IRQ,
|
||||
PCI_2100_IRQ_STR);
|
||||
|
||||
pc->pc_intr_desc = "T2 irq";
|
||||
|
||||
/* 64 16-byte vectors per hose. */
|
||||
pc->pc_vecbase = 0x800 + ((64 * 16) * tcp->tc_hose);
|
||||
pc->pc_nirq = SABLE_MAX_IRQ;
|
||||
|
||||
for (i = 0; i < SABLE_MAX_IRQ; i++) {
|
||||
alpha_shared_intr_set_dfltsharetype(tcp->tc_intrtab,
|
||||
alpha_shared_intr_set_dfltsharetype(pc->pc_shared_intrs,
|
||||
i, tcp->tc_hose == 0 ?
|
||||
dec_2100_a500_intr_deftype[i] : IST_LEVEL);
|
||||
alpha_shared_intr_set_maxstrays(tcp->tc_intrtab,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs,
|
||||
i, PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(tcp->tc_intrtab, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_2100_IRQ_STR, "irq %d", T2_IRQ_IS_EISA(i) ?
|
||||
i - T2_IRQ_EISA_START : i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
tcp->tc_intrtab, i), EVCNT_TYPE_INTR, NULL,
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
T2_IRQ_IS_EISA(i) ? "eisa" : "T2", cp);
|
||||
}
|
||||
|
||||
/* 64 16-byte vectors per hose. */
|
||||
tcp->tc_vecbase = 0x800 + ((64 * 16) * tcp->tc_hose);
|
||||
|
||||
/*
|
||||
* T2 uses a custom layout of cascaded 8259 PICs for interrupt
|
||||
* control. T3 and T4 use a built-in interrupt controller.
|
||||
|
@ -268,7 +273,7 @@ pci_2100_a500_isa_pickintr(pci_chipset_tag_t pc, isa_chipset_tag_t ic)
|
|||
* PCI interrupt support.
|
||||
*****************************************************************************/
|
||||
|
||||
int
|
||||
static int
|
||||
dec_2100_a500_pic_intr_map(const struct pci_attach_args *pa,
|
||||
pci_intr_handle_t *ihp)
|
||||
{
|
||||
|
@ -346,7 +351,7 @@ dec_2100_a500_pic_intr_map(const struct pci_attach_args *pa,
|
|||
return (1);
|
||||
}
|
||||
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_2100_a500_pic_intr_map: bad interrupt pin %d\n",
|
||||
buspin);
|
||||
return (1);
|
||||
|
@ -365,11 +370,11 @@ dec_2100_a500_pic_intr_map(const struct pci_attach_args *pa,
|
|||
"device %d pin %d\n", device, buspin);
|
||||
return (1);
|
||||
}
|
||||
*ihp = irq;
|
||||
alpha_pci_intr_handle_init(ihp, irq, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_2100_a500_icic_intr_map(const struct pci_attach_args *pa,
|
||||
pci_intr_handle_t *ihp)
|
||||
{
|
||||
|
@ -411,72 +416,52 @@ dec_2100_a500_icic_intr_map(const struct pci_attach_args *pa,
|
|||
return (1);
|
||||
}
|
||||
|
||||
*ihp = irq;
|
||||
alpha_pci_intr_handle_init(ihp, irq, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_2100_a500_intr_string(void *v, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
if (ih >= SABLE_MAX_IRQ)
|
||||
panic("%s: bogus T2 IRQ 0x%lx", __func__, ih);
|
||||
|
||||
snprintf(buf, len, "T2 irq %ld", ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_2100_a500_intr_evcnt(void *v, pci_intr_handle_t ih)
|
||||
{
|
||||
struct ttwoga_config *tcp = v;
|
||||
|
||||
if (ih >= SABLE_MAX_IRQ)
|
||||
panic("%s: bogus T2 IRQ 0x%lx", __func__, ih);
|
||||
|
||||
return (alpha_shared_intr_evcnt(tcp->tc_intrtab, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_2100_a500_intr_establish(void *v, pci_intr_handle_t ih, int level,
|
||||
static void *
|
||||
dec_2100_a500_intr_establish(pci_chipset_tag_t const pc,
|
||||
pci_intr_handle_t const ih, int const level,
|
||||
int (*func)(void *), void *arg)
|
||||
{
|
||||
struct ttwoga_config *tcp = v;
|
||||
struct ttwoga_config *tcp = pc->pc_intr_v;
|
||||
void *cookie;
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
|
||||
if (ih >= SABLE_MAX_IRQ)
|
||||
panic("dec_2100_a500_intr_establish: bogus IRQ 0x%lx",
|
||||
ih);
|
||||
KASSERT(irq < SABLE_MAX_IRQ);
|
||||
|
||||
cookie = alpha_shared_intr_establish(tcp->tc_intrtab, ih,
|
||||
dec_2100_a500_intr_deftype[ih], level, func, arg, "T2 irq");
|
||||
cookie = alpha_shared_intr_establish(pc->pc_shared_intrs, irq,
|
||||
dec_2100_a500_intr_deftype[irq], level, flags, func, arg, "T2 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(tcp->tc_intrtab, ih)) {
|
||||
scb_set(tcp->tc_vecbase + SCB_IDXTOVEC(ih),
|
||||
dec_2100_a500_iointr, tcp, level);
|
||||
(*tcp->tc_enable_intr)(tcp, ih, 1);
|
||||
alpha_shared_intr_firstactive(pc->pc_shared_intrs, irq)) {
|
||||
scb_set(pc->pc_vecbase + SCB_IDXTOVEC(irq),
|
||||
dec_2100_a500_iointr, tcp);
|
||||
(*tcp->tc_enable_intr)(tcp, irq, 1);
|
||||
}
|
||||
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_2100_a500_intr_disestablish(void *v, void *cookie)
|
||||
static void
|
||||
dec_2100_a500_intr_disestablish(pci_chipset_tag_t const pc, void * const cookie)
|
||||
{
|
||||
struct ttwoga_config *tcp = v;
|
||||
struct ttwoga_config *tcp = pc->pc_intr_v;
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(tcp->tc_intrtab, cookie,
|
||||
alpha_shared_intr_disestablish(pc->pc_shared_intrs, cookie,
|
||||
"T2 irq");
|
||||
if (alpha_shared_intr_isactive(tcp->tc_intrtab, irq) == 0) {
|
||||
if (alpha_shared_intr_isactive(pc->pc_shared_intrs, irq) == 0) {
|
||||
(*tcp->tc_enable_intr)(tcp, irq, 0);
|
||||
alpha_shared_intr_set_dfltsharetype(tcp->tc_intrtab,
|
||||
alpha_shared_intr_set_dfltsharetype(pc->pc_shared_intrs,
|
||||
irq, dec_2100_a500_intr_deftype[irq]);
|
||||
scb_free(tcp->tc_vecbase + SCB_IDXTOVEC(irq));
|
||||
scb_free(pc->pc_vecbase + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
@ -486,7 +471,7 @@ dec_2100_a500_intr_disestablish(void *v, void *cookie)
|
|||
* EISA interrupt support.
|
||||
*****************************************************************************/
|
||||
|
||||
int
|
||||
static int
|
||||
dec_2100_a500_eisa_intr_map(void *v, u_int eirq, eisa_intr_handle_t *ihp)
|
||||
{
|
||||
|
||||
|
@ -516,7 +501,7 @@ dec_2100_a500_eisa_intr_map(void *v, u_int eirq, eisa_intr_handle_t *ihp)
|
|||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
static const char *
|
||||
dec_2100_a500_eisa_intr_string(void *v, int eirq, char *buf, size_t len)
|
||||
{
|
||||
if (eirq > 15 || eirq == 13)
|
||||
|
@ -527,23 +512,25 @@ dec_2100_a500_eisa_intr_string(void *v, int eirq, char *buf, size_t len)
|
|||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
static const struct evcnt *
|
||||
dec_2100_a500_eisa_intr_evcnt(void *v, int eirq)
|
||||
{
|
||||
struct ttwoga_config *tcp = v;
|
||||
pci_chipset_tag_t const pc = &tcp->tc_pc;
|
||||
|
||||
if (eirq > 15 || eirq == 13)
|
||||
panic("%s: bogus EISA IRQ 0x%x", __func__, eirq);
|
||||
|
||||
return (alpha_shared_intr_evcnt(tcp->tc_intrtab,
|
||||
return (alpha_shared_intr_evcnt(pc->pc_shared_intrs,
|
||||
eirq + T2_IRQ_EISA_START));
|
||||
}
|
||||
|
||||
void *
|
||||
static void *
|
||||
dec_2100_a500_eisa_intr_establish(void *v, int eirq, int type, int level,
|
||||
int (*fn)(void *), void *arg)
|
||||
{
|
||||
struct ttwoga_config *tcp = v;
|
||||
pci_chipset_tag_t const pc = &tcp->tc_pc;
|
||||
void *cookie;
|
||||
int irq;
|
||||
|
||||
|
@ -567,15 +554,15 @@ dec_2100_a500_eisa_intr_establish(void *v, int eirq, int type, int level,
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
cookie = alpha_shared_intr_establish(tcp->tc_intrtab, irq,
|
||||
type, level, fn, arg, "T2 irq");
|
||||
cookie = alpha_shared_intr_establish(pc->pc_shared_intrs, irq,
|
||||
type, level, 0, fn, arg, "T2 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(tcp->tc_intrtab, irq)) {
|
||||
scb_set(tcp->tc_vecbase + SCB_IDXTOVEC(irq),
|
||||
dec_2100_a500_iointr, tcp, level);
|
||||
alpha_shared_intr_firstactive(pc->pc_shared_intrs, irq)) {
|
||||
scb_set(pc->pc_vecbase + SCB_IDXTOVEC(irq),
|
||||
dec_2100_a500_iointr, tcp);
|
||||
(*tcp->tc_setlevel)(tcp, eirq,
|
||||
alpha_shared_intr_get_sharetype(tcp->tc_intrtab,
|
||||
alpha_shared_intr_get_sharetype(pc->pc_shared_intrs,
|
||||
irq) == IST_LEVEL);
|
||||
(*tcp->tc_enable_intr)(tcp, irq, 1);
|
||||
}
|
||||
|
@ -583,30 +570,31 @@ dec_2100_a500_eisa_intr_establish(void *v, int eirq, int type, int level,
|
|||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_eisa_intr_disestablish(void *v, void *cookie)
|
||||
{
|
||||
struct ttwoga_config *tcp = v;
|
||||
pci_chipset_tag_t const pc = &tcp->tc_pc;
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
int s, irq = ih->ih_num;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
/* Remove it from the link. */
|
||||
alpha_shared_intr_disestablish(tcp->tc_intrtab, cookie,
|
||||
alpha_shared_intr_disestablish(pc->pc_shared_intrs, cookie,
|
||||
"T2 irq");
|
||||
|
||||
if (alpha_shared_intr_isactive(tcp->tc_intrtab, irq) == 0) {
|
||||
if (alpha_shared_intr_isactive(pc->pc_shared_intrs, irq) == 0) {
|
||||
(*tcp->tc_enable_intr)(tcp, irq, 0);
|
||||
alpha_shared_intr_set_dfltsharetype(tcp->tc_intrtab,
|
||||
alpha_shared_intr_set_dfltsharetype(pc->pc_shared_intrs,
|
||||
irq, dec_2100_a500_intr_deftype[irq]);
|
||||
scb_free(tcp->tc_vecbase + SCB_IDXTOVEC(irq));
|
||||
scb_free(pc->pc_vecbase + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_2100_a500_eisa_intr_alloc(void *v, int mask, int type, int *eirqp)
|
||||
{
|
||||
|
||||
|
@ -638,25 +626,26 @@ do { \
|
|||
alpha_mb(); \
|
||||
} while (0)
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_iointr(void *arg, u_long vec)
|
||||
{
|
||||
struct ttwoga_config *tcp = arg;
|
||||
pci_chipset_tag_t const pc = &tcp->tc_pc;
|
||||
int irq, rv;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - tcp->tc_vecbase);
|
||||
irq = SCB_VECTOIDX(vec - pc->pc_vecbase);
|
||||
|
||||
rv = alpha_shared_intr_dispatch(tcp->tc_intrtab, irq);
|
||||
rv = alpha_shared_intr_dispatch(pc->pc_shared_intrs, irq);
|
||||
(*tcp->tc_eoi)(tcp, irq);
|
||||
if (rv == 0) {
|
||||
alpha_shared_intr_stray(tcp->tc_intrtab, irq, "T2 irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(tcp->tc_intrtab, irq))
|
||||
alpha_shared_intr_stray(pc->pc_shared_intrs, irq, "T2 irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(pc->pc_shared_intrs, irq))
|
||||
(*tcp->tc_enable_intr)(tcp, irq, 0);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(tcp->tc_intrtab, irq);
|
||||
alpha_shared_intr_reset_strays(pc->pc_shared_intrs, irq);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_pic_enable_intr(struct ttwoga_config *tcp, int irq, int onoff)
|
||||
{
|
||||
int pic;
|
||||
|
@ -673,7 +662,7 @@ dec_2100_a500_pic_enable_intr(struct ttwoga_config *tcp, int irq, int onoff)
|
|||
bus_space_write_1(pic_iot, pic_slave_ioh[pic], 1, mask);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_icic_enable_intr(struct ttwoga_config *tcp, int irq, int onoff)
|
||||
{
|
||||
uint64_t bit, mask;
|
||||
|
@ -690,7 +679,7 @@ dec_2100_a500_icic_enable_intr(struct ttwoga_config *tcp, int irq, int onoff)
|
|||
ICIC_WRITE(tcp, mask);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_pic_init_intr(struct ttwoga_config *tcp)
|
||||
{
|
||||
static const int picaddr[4] = {
|
||||
|
@ -723,7 +712,7 @@ dec_2100_a500_pic_init_intr(struct ttwoga_config *tcp)
|
|||
"registers");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_icic_init_intr(struct ttwoga_config *tcp)
|
||||
{
|
||||
|
||||
|
@ -731,7 +720,7 @@ dec_2100_a500_icic_init_intr(struct ttwoga_config *tcp)
|
|||
ICIC_WRITE(tcp, 0xffffffffffffffffUL);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_pic_setlevel(struct ttwoga_config *tcp, int eirq, int level)
|
||||
{
|
||||
int elcr;
|
||||
|
@ -777,7 +766,7 @@ dec_2100_a500_pic_setlevel(struct ttwoga_config *tcp, int eirq, int level)
|
|||
bus_space_write_1(pic_iot, pic_elcr_ioh, elcr, mask);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_icic_setlevel(struct ttwoga_config *tcp, int eirq, int level)
|
||||
{
|
||||
uint64_t bit, mask;
|
||||
|
@ -810,7 +799,7 @@ dec_2100_a500_icic_setlevel(struct ttwoga_config *tcp, int eirq, int level)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_pic_eoi(struct ttwoga_config *tcp, int irq)
|
||||
{
|
||||
int pic;
|
||||
|
@ -830,7 +819,7 @@ dec_2100_a500_pic_eoi(struct ttwoga_config *tcp, int irq)
|
|||
0xe0 | pic_slave_to_master[pic]);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dec_2100_a500_icic_eoi(struct ttwoga_config *tcp, int irq)
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_550.c,v 1.37 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_550.c,v 1.38 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 1.37 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 1.38 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -88,16 +88,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 1.37 2014/03/21 16:39:29 christos Exp $"
|
|||
#include <alpha/pci/siovar.h>
|
||||
#endif
|
||||
|
||||
int dec_550_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_550_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_550_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_550_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_550_intr_disestablish(void *, void *);
|
||||
|
||||
void *dec_550_pciide_compat_intr_establish(void *, device_t,
|
||||
const struct pci_attach_args *, int, int (*)(void *), void *);
|
||||
static int dec_550_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
static const char *dec_550_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
static const struct evcnt *dec_550_intr_evcnt(pci_chipset_tag_t,
|
||||
pci_intr_handle_t);
|
||||
static void *dec_550_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
static void dec_550_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
|
||||
#define DEC_550_PCI_IRQ_BEGIN 8
|
||||
#define DEC_550_MAX_IRQ (64 - DEC_550_PCI_IRQ_BEGIN)
|
||||
|
@ -117,11 +116,8 @@ void *dec_550_pciide_compat_intr_establish(void *, device_t,
|
|||
#define DEC_550_LINE_IS_ISA(line) ((line) >= 0xe0 && (line) <= 0xfe)
|
||||
#define DEC_550_LINE_ISA_IRQ(line) ((line) & 0x0f)
|
||||
|
||||
struct alpha_shared_intr *dec_550_pci_intr;
|
||||
|
||||
void dec_550_iointr(void *arg, unsigned long vec);
|
||||
void dec_550_intr_enable(int irq);
|
||||
void dec_550_intr_disable(int irq);
|
||||
static void dec_550_intr_enable(pci_chipset_tag_t, int irq);
|
||||
static void dec_550_intr_disable(pci_chipset_tag_t, int irq);
|
||||
|
||||
void
|
||||
pci_550_pickintr(struct cia_config *ccp)
|
||||
|
@ -139,7 +135,7 @@ pci_550_pickintr(struct cia_config *ccp)
|
|||
pc->pc_intr_disestablish = dec_550_intr_disestablish;
|
||||
|
||||
pc->pc_pciide_compat_intr_establish =
|
||||
dec_550_pciide_compat_intr_establish;
|
||||
sio_pciide_compat_intr_establish;
|
||||
|
||||
/*
|
||||
* DEC 550's interrupts are enabled via the Pyxis interrupt
|
||||
|
@ -147,21 +143,28 @@ pci_550_pickintr(struct cia_config *ccp)
|
|||
*/
|
||||
|
||||
for (i = 0; i < DEC_550_MAX_IRQ; i++)
|
||||
dec_550_intr_disable(i);
|
||||
dec_550_intr_disable(pc, i);
|
||||
|
||||
#define PCI_550_IRQ_STR 8
|
||||
dec_550_pci_intr = alpha_shared_intr_alloc(DEC_550_MAX_IRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(DEC_550_MAX_IRQ,
|
||||
PCI_550_IRQ_STR);
|
||||
pc->pc_intr_desc = "dec 550 irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = DEC_550_MAX_IRQ;
|
||||
|
||||
pc->pc_intr_enable = dec_550_intr_enable;
|
||||
pc->pc_intr_disable = dec_550_intr_disable;
|
||||
|
||||
for (i = 0; i < DEC_550_MAX_IRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(dec_550_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
alpha_shared_intr_set_private(dec_550_pci_intr, i, ccp);
|
||||
alpha_shared_intr_set_private(pc->pc_shared_intrs, i, ccp);
|
||||
|
||||
cp = alpha_shared_intr_string(dec_550_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_550_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
dec_550_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec_550", cp);
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec 550", cp);
|
||||
}
|
||||
|
||||
#if NSIO
|
||||
|
@ -169,7 +172,7 @@ pci_550_pickintr(struct cia_config *ccp)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_550_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
|
@ -181,7 +184,7 @@ dec_550_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_550_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -244,171 +247,85 @@ dec_550_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
line, bus, device, function);
|
||||
return (1);
|
||||
}
|
||||
*ihp = line;
|
||||
alpha_pci_intr_handle_init(ihp, line, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_550_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
static const char *
|
||||
dec_550_intr_string(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
char * const buf, size_t const len)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
|
||||
#if NSIO
|
||||
if (DEC_550_LINE_IS_ISA(ih))
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
if (DEC_550_LINE_IS_ISA(irq))
|
||||
return sio_intr_string(NULL /*XXX*/,
|
||||
DEC_550_LINE_ISA_IRQ(ih), buf, len);
|
||||
DEC_550_LINE_ISA_IRQ(irq), buf, len);
|
||||
#endif
|
||||
|
||||
if (ih >= DEC_550_MAX_IRQ)
|
||||
panic("%s: bogus 550 IRQ 0x%lx", __func__, ih);
|
||||
snprintf(buf, len, "dec 550 irq %ld", ih);
|
||||
return buf;
|
||||
return alpha_pci_generic_intr_string(pc, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_550_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
static const struct evcnt *
|
||||
dec_550_intr_evcnt(pci_chipset_tag_t const pc, pci_intr_handle_t const ih)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
|
||||
#if NSIO
|
||||
if (DEC_550_LINE_IS_ISA(ih))
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
if (DEC_550_LINE_IS_ISA(irq))
|
||||
return (sio_intr_evcnt(NULL /*XXX*/,
|
||||
DEC_550_LINE_ISA_IRQ(ih)));
|
||||
DEC_550_LINE_ISA_IRQ(irq)));
|
||||
#endif
|
||||
|
||||
if (ih >= DEC_550_MAX_IRQ)
|
||||
panic("%s: bogus 550 IRQ 0x%lx", __func__, ih);
|
||||
|
||||
return (alpha_shared_intr_evcnt(dec_550_pci_intr, ih));
|
||||
return alpha_pci_generic_intr_evcnt(pc, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_550_intr_establish(void *ccv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
static void *
|
||||
dec_550_intr_establish(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
int const level, int (*func)(void *), void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
void *cookie;
|
||||
|
||||
#if NSIO
|
||||
if (DEC_550_LINE_IS_ISA(ih))
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
|
||||
if (DEC_550_LINE_IS_ISA(irq))
|
||||
return (sio_intr_establish(NULL /*XXX*/,
|
||||
DEC_550_LINE_ISA_IRQ(ih), IST_LEVEL, level, func, arg));
|
||||
DEC_550_LINE_ISA_IRQ(irq), IST_LEVEL, level, flags,
|
||||
func, arg));
|
||||
#endif
|
||||
|
||||
if (ih >= DEC_550_MAX_IRQ)
|
||||
panic("dec_550_intr_establish: bogus dec 550 IRQ 0x%lx", ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(dec_550_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "dec 550 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(dec_550_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), dec_550_iointr, NULL,
|
||||
level);
|
||||
dec_550_intr_enable(ih);
|
||||
}
|
||||
return (cookie);
|
||||
return alpha_pci_generic_intr_establish(pc, ih, level, func, arg);
|
||||
}
|
||||
|
||||
void
|
||||
dec_550_intr_disestablish(void *ccv, void *cookie)
|
||||
static void
|
||||
dec_550_intr_disestablish(pci_chipset_tag_t const pc, void * const cookie)
|
||||
{
|
||||
struct cia_config *ccp = ccv;
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
#if NSIO
|
||||
struct alpha_shared_intrhand * const ih = cookie;
|
||||
|
||||
/*
|
||||
* We have to determine if this is an ISA IRQ or not! We do this
|
||||
* by checking to see if the intrhand points back to an intrhead
|
||||
* that points to our cia_config. If not, it's an ISA IRQ. Pretty
|
||||
* disgusting, eh?
|
||||
*/
|
||||
if (ih->ih_intrhead->intr_private != ccp) {
|
||||
if (ih->ih_intrhead->intr_private != pc->pc_intr_v) {
|
||||
sio_intr_disestablish(NULL /*XXX*/, cookie);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(dec_550_pci_intr, cookie,
|
||||
"dec 550 irq");
|
||||
if (alpha_shared_intr_isactive(dec_550_pci_intr, irq) == 0) {
|
||||
dec_550_intr_disable(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(dec_550_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
alpha_pci_generic_intr_disestablish(pc, cookie);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_550_pciide_compat_intr_establish(void *v, device_t dev,
|
||||
const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
|
||||
static void
|
||||
dec_550_intr_enable(pci_chipset_tag_t const pc __unused, int const irq)
|
||||
{
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
void *cookie = NULL;
|
||||
int bus, irq;
|
||||
char buf[64];
|
||||
|
||||
pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
|
||||
|
||||
/*
|
||||
* If this isn't PCI bus #0, all bets are off.
|
||||
*/
|
||||
if (bus != 0)
|
||||
return (NULL);
|
||||
|
||||
irq = PCIIDE_COMPAT_IRQ(chan);
|
||||
#if NSIO
|
||||
cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
|
||||
func, arg);
|
||||
if (cookie == NULL)
|
||||
return (NULL);
|
||||
aprint_normal_dev(dev, "%s channel interrupting at %s\n",
|
||||
PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq,
|
||||
buf, sizeof(buf)));
|
||||
#endif
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_550_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (irq >= DEC_550_MAX_IRQ)
|
||||
panic("550_iointr: vec 0x%lx out of range", vec);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(dec_550_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(dec_550_pci_intr, irq,
|
||||
"dec 550 irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(dec_550_pci_intr, irq))
|
||||
dec_550_intr_disable(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(dec_550_pci_intr, irq);
|
||||
}
|
||||
|
||||
void
|
||||
dec_550_intr_enable(int irq)
|
||||
{
|
||||
|
||||
cia_pyxis_intr_enable(irq + DEC_550_PCI_IRQ_BEGIN, 1);
|
||||
}
|
||||
|
||||
void
|
||||
dec_550_intr_disable(int irq)
|
||||
static void
|
||||
dec_550_intr_disable(pci_chipset_tag_t const pc __unused, int const irq)
|
||||
{
|
||||
|
||||
cia_pyxis_intr_enable(irq + DEC_550_PCI_IRQ_BEGIN, 0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_6600.c,v 1.25 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_6600.c,v 1.26 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.25 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.26 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -75,23 +75,24 @@ __KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.25 2014/03/21 16:39:29 christos Exp $
|
|||
#define DEC_6600_LINE_IS_ISA(line) ((line) >= 0xe0 && (line) <= 0xef)
|
||||
#define DEC_6600_LINE_ISA_IRQ(line) ((line) & 0x0f)
|
||||
|
||||
static const char *irqtype = "6600 irq";
|
||||
static struct tsp_config *sioprimary;
|
||||
|
||||
void dec_6600_intr_disestablish(void *, void *);
|
||||
void *dec_6600_intr_establish(
|
||||
void *, pci_intr_handle_t, int, int (*func)(void *), void *);
|
||||
const char *dec_6600_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_6600_intr_evcnt(void *, pci_intr_handle_t);
|
||||
int dec_6600_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
|
||||
void *dec_6600_pciide_compat_intr_establish(void *, device_t,
|
||||
const struct pci_attach_args *, int, int (*)(void *), void *);
|
||||
static void dec_6600_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
static void *dec_6600_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
static const char *dec_6600_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
static const struct evcnt *dec_6600_intr_evcnt(pci_chipset_tag_t,
|
||||
pci_intr_handle_t);
|
||||
static int dec_6600_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
struct alpha_shared_intr *dec_6600_pci_intr;
|
||||
static void *dec_6600_pciide_compat_intr_establish(device_t,
|
||||
const struct pci_attach_args *, int,
|
||||
int (*)(void *), void *);
|
||||
|
||||
void dec_6600_iointr(void *arg, unsigned long vec);
|
||||
extern void dec_6600_intr_enable(int irq);
|
||||
extern void dec_6600_intr_disable(int irq);
|
||||
static void dec_6600_intr_enable(pci_chipset_tag_t, int irq);
|
||||
static void dec_6600_intr_disable(pci_chipset_tag_t, int irq);
|
||||
|
||||
void
|
||||
pci_6600_pickintr(struct tsp_config *pcp)
|
||||
|
@ -107,38 +108,48 @@ pci_6600_pickintr(struct tsp_config *pcp)
|
|||
pc->pc_intr_evcnt = dec_6600_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_6600_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_6600_intr_disestablish;
|
||||
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
||||
pc->pc_intr_desc = "dec 6600 irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = PCI_NIRQ;
|
||||
|
||||
pc->pc_intr_enable = dec_6600_intr_enable;
|
||||
pc->pc_intr_disable = dec_6600_intr_disable;
|
||||
|
||||
/*
|
||||
* System-wide and Pchip-0-only logic...
|
||||
*/
|
||||
if (dec_6600_pci_intr == NULL) {
|
||||
if (sioprimary == NULL) {
|
||||
sioprimary = pcp;
|
||||
pc->pc_pciide_compat_intr_establish =
|
||||
dec_6600_pciide_compat_intr_establish;
|
||||
#define PCI_6600_IRQ_STR 8
|
||||
dec_6600_pci_intr = alpha_shared_intr_alloc(PCI_NIRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(PCI_NIRQ,
|
||||
PCI_6600_IRQ_STR);
|
||||
for (i = 0; i < PCI_NIRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(dec_6600_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
alpha_shared_intr_set_private(dec_6600_pci_intr, i,
|
||||
alpha_shared_intr_set_private(pc->pc_shared_intrs, i,
|
||||
sioprimary);
|
||||
|
||||
cp = alpha_shared_intr_string(dec_6600_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_6600_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
dec_6600_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec_6600", cp);
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"dec 6600", cp);
|
||||
}
|
||||
#if NSIO
|
||||
sio_intr_setup(pc, iot);
|
||||
dec_6600_intr_enable(55); /* irq line for sio */
|
||||
dec_6600_intr_enable(pc, 55); /* irq line for sio */
|
||||
#endif
|
||||
} else {
|
||||
pc->pc_shared_intrs = sioprimary->pc_pc.pc_shared_intrs;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_6600_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
|
@ -150,7 +161,7 @@ dec_6600_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -179,74 +190,62 @@ dec_6600_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
panic("dec_6600_intr_map: dec 6600 irq too large (%d)",
|
||||
line);
|
||||
|
||||
*ihp = line;
|
||||
alpha_pci_intr_handle_init(ihp, line, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_6600_intr_string(void *acv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
static const char *
|
||||
dec_6600_intr_string(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
char * const buf, size_t const len)
|
||||
{
|
||||
|
||||
static const char irqfmt[] = "dec 6600 irq %ld";
|
||||
|
||||
#if NSIO
|
||||
if (DEC_6600_LINE_IS_ISA(ih))
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
if (DEC_6600_LINE_IS_ISA(irq))
|
||||
return (sio_intr_string(NULL /*XXX*/,
|
||||
DEC_6600_LINE_ISA_IRQ(ih), buf, len));
|
||||
DEC_6600_LINE_ISA_IRQ(irq), buf, len));
|
||||
#endif
|
||||
|
||||
snprintf(buf, len, irqfmt, ih);
|
||||
return buf;
|
||||
return alpha_pci_generic_intr_string(pc, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_6600_intr_evcnt(void *acv, pci_intr_handle_t ih)
|
||||
static const struct evcnt *
|
||||
dec_6600_intr_evcnt(pci_chipset_tag_t const pc, pci_intr_handle_t const ih)
|
||||
{
|
||||
|
||||
#if NSIO
|
||||
if (DEC_6600_LINE_IS_ISA(ih))
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
if (DEC_6600_LINE_IS_ISA(irq))
|
||||
return (sio_intr_evcnt(NULL /*XXX*/,
|
||||
DEC_6600_LINE_ISA_IRQ(ih)));
|
||||
DEC_6600_LINE_ISA_IRQ(irq)));
|
||||
#endif
|
||||
|
||||
return (alpha_shared_intr_evcnt(dec_6600_pci_intr, ih));
|
||||
return alpha_pci_generic_intr_evcnt(pc, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_6600_intr_establish(void *acv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
static void *
|
||||
dec_6600_intr_establish(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
int const level, int (*func)(void *), void *arg)
|
||||
{
|
||||
void *cookie;
|
||||
|
||||
#if NSIO
|
||||
if (DEC_6600_LINE_IS_ISA(ih))
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
|
||||
if (DEC_6600_LINE_IS_ISA(irq))
|
||||
return (sio_intr_establish(NULL /*XXX*/,
|
||||
DEC_6600_LINE_ISA_IRQ(ih), IST_LEVEL, level, func, arg));
|
||||
DEC_6600_LINE_ISA_IRQ(irq), IST_LEVEL, level, flags,
|
||||
func, arg));
|
||||
#endif
|
||||
|
||||
if (ih >= PCI_NIRQ)
|
||||
panic("dec_6600_intr_establish: bogus dec 6600 IRQ 0x%lx",
|
||||
ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(dec_6600_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, irqtype);
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(dec_6600_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), dec_6600_iointr, NULL,
|
||||
level);
|
||||
dec_6600_intr_enable(ih);
|
||||
}
|
||||
return (cookie);
|
||||
return alpha_pci_generic_intr_establish(pc, ih, level, func, arg);
|
||||
}
|
||||
|
||||
void
|
||||
dec_6600_intr_disestablish(void *acv, void *cookie)
|
||||
static void
|
||||
dec_6600_intr_disestablish(pci_chipset_tag_t const pc, void * const cookie)
|
||||
{
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
#if NSIO
|
||||
struct alpha_shared_intrhand * const ih = cookie;
|
||||
|
||||
/*
|
||||
* We have to determine if this is an ISA IRQ or not! We do this
|
||||
* by checking to see if the intrhand points back to an intrhead
|
||||
|
@ -259,81 +258,37 @@ dec_6600_intr_disestablish(void *acv, void *cookie)
|
|||
}
|
||||
#endif
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(dec_6600_pci_intr, cookie, irqtype);
|
||||
if (alpha_shared_intr_isactive(dec_6600_pci_intr, irq) == 0) {
|
||||
dec_6600_intr_disable(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(dec_6600_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
return alpha_pci_generic_intr_disestablish(pc, cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_6600_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (irq >= PCI_NIRQ)
|
||||
panic("iointr: irq %d is too high", irq);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(dec_6600_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(dec_6600_pci_intr, irq,
|
||||
irqtype);
|
||||
if (ALPHA_SHARED_INTR_DISABLE(dec_6600_pci_intr, irq))
|
||||
dec_6600_intr_disable(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(dec_6600_pci_intr, irq);
|
||||
}
|
||||
|
||||
void
|
||||
dec_6600_intr_enable(int irq)
|
||||
static void
|
||||
dec_6600_intr_enable(pci_chipset_tag_t const pc __unused, int const irq)
|
||||
{
|
||||
alpha_mb();
|
||||
STQP(TS_C_DIM0) |= 1UL << irq;
|
||||
alpha_mb();
|
||||
}
|
||||
|
||||
void
|
||||
dec_6600_intr_disable(int irq)
|
||||
static void
|
||||
dec_6600_intr_disable(pci_chipset_tag_t const pc __unused, int const irq)
|
||||
{
|
||||
alpha_mb();
|
||||
STQP(TS_C_DIM0) &= ~(1UL << irq);
|
||||
alpha_mb();
|
||||
}
|
||||
|
||||
void *
|
||||
dec_6600_pciide_compat_intr_establish(void *v, device_t dev,
|
||||
static void *
|
||||
dec_6600_pciide_compat_intr_establish(device_t dev,
|
||||
const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
|
||||
{
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
void *cookie = NULL;
|
||||
int bus, irq;
|
||||
char buf[64];
|
||||
|
||||
pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
|
||||
pci_chipset_tag_t const pc = pa->pa_pc;
|
||||
|
||||
/*
|
||||
* If this isn't PCI bus #0 on the TSP that holds the PCI-ISA
|
||||
* bridge, all bets are off.
|
||||
* If this isn't the TSP that holds the PCI-ISA bridge,
|
||||
* all bets are off.
|
||||
*/
|
||||
if (bus != 0 || pc->pc_intr_v != sioprimary)
|
||||
if (pc->pc_intr_v != sioprimary)
|
||||
return (NULL);
|
||||
|
||||
irq = PCIIDE_COMPAT_IRQ(chan);
|
||||
#if NSIO
|
||||
cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
|
||||
func, arg);
|
||||
if (cookie == NULL)
|
||||
return (NULL);
|
||||
aprint_normal_dev(dev, "%s channel interrupting at %s\n",
|
||||
PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq,
|
||||
buf, sizeof(buf)));
|
||||
#endif
|
||||
return (cookie);
|
||||
return sio_pciide_compat_intr_establish(dev, pa, chan, func, arg);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_alphabook1.c,v 1.17 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_alphabook1.c,v 1.18 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_alphabook1.c,v 1.17 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_alphabook1.c,v 1.18 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -82,14 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_alphabook1.c,v 1.17 2014/03/21 16:39:29 christos
|
|||
|
||||
#include "sio.h"
|
||||
|
||||
int dec_alphabook1_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_alphabook1_intr_string(void *, pci_intr_handle_t, char *,
|
||||
size_t);
|
||||
const struct evcnt *dec_alphabook1_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_alphabook1_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_alphabook1_intr_disestablish(void *, void *);
|
||||
static int dec_alphabook1_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
#define LCA_SIO_DEVICE 7 /* XXX */
|
||||
|
||||
|
@ -111,10 +105,10 @@ pci_alphabook1_pickintr(struct lca_config *lcp)
|
|||
|
||||
pc->pc_intr_v = lcp;
|
||||
pc->pc_intr_map = dec_alphabook1_intr_map;
|
||||
pc->pc_intr_string = dec_alphabook1_intr_string;
|
||||
pc->pc_intr_evcnt = dec_alphabook1_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_alphabook1_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_alphabook1_intr_disestablish;
|
||||
pc->pc_intr_string = sio_pci_intr_string;
|
||||
pc->pc_intr_evcnt = sio_pci_intr_evcnt;
|
||||
pc->pc_intr_establish = sio_pci_intr_establish;
|
||||
pc->pc_intr_disestablish = sio_pci_intr_disestablish;
|
||||
|
||||
/* Not supported on AlphaBook. */
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
@ -139,7 +133,7 @@ dec_alphabook1_intr_map(const struct pci_attach_args *pa,
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_alphabook1_intr_map: bad interrupt pin %d\n",
|
||||
buspin);
|
||||
return 1;
|
||||
|
@ -169,47 +163,6 @@ dec_alphabook1_intr_map(const struct pci_attach_args *pa,
|
|||
return 1;
|
||||
}
|
||||
|
||||
*ihp = irq;
|
||||
alpha_pci_intr_handle_init(ihp, irq, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_alphabook1_intr_string(void *lcv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
return sio_intr_string(NULL /*XXX*/, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_alphabook1_intr_evcnt(void *lcv, pci_intr_handle_t ih)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
return sio_intr_evcnt(NULL /*XXX*/, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_alphabook1_intr_establish(void *lcv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
|
||||
arg);
|
||||
}
|
||||
|
||||
void
|
||||
dec_alphabook1_intr_disestablish(void *lcv, void *cookie)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
sio_intr_disestablish(NULL /*XXX*/, cookie);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_axppci_33.c,v 1.38 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_axppci_33.c,v 1.39 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_axppci_33.c,v 1.38 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_axppci_33.c,v 1.39 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -54,13 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_axppci_33.c,v 1.38 2014/03/21 16:39:29 christos
|
|||
|
||||
#include "sio.h"
|
||||
|
||||
int dec_axppci_33_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_axppci_33_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_axppci_33_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_axppci_33_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_axppci_33_intr_disestablish(void *, void *);
|
||||
static int dec_axppci_33_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
#define LCA_SIO_DEVICE 7 /* XXX */
|
||||
|
||||
|
@ -82,10 +77,10 @@ pci_axppci_33_pickintr(struct lca_config *lcp)
|
|||
|
||||
pc->pc_intr_v = lcp;
|
||||
pc->pc_intr_map = dec_axppci_33_intr_map;
|
||||
pc->pc_intr_string = dec_axppci_33_intr_string;
|
||||
pc->pc_intr_evcnt = dec_axppci_33_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_axppci_33_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_axppci_33_intr_disestablish;
|
||||
pc->pc_intr_string = sio_pci_intr_string;
|
||||
pc->pc_intr_evcnt = sio_pci_intr_evcnt;
|
||||
pc->pc_intr_establish = sio_pci_intr_establish;
|
||||
pc->pc_intr_disestablish = sio_pci_intr_disestablish;
|
||||
|
||||
/* Not supported on AXPpci33. */
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
@ -115,7 +110,7 @@ dec_axppci_33_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_axppci_33_intr_map: bad interrupt pin %d\n",
|
||||
buspin);
|
||||
return 1;
|
||||
|
@ -210,47 +205,6 @@ dec_axppci_33_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
device, '@' + buspin, pirqline);
|
||||
#endif
|
||||
|
||||
*ihp = pirqline;
|
||||
alpha_pci_intr_handle_init(ihp, pirqline, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_axppci_33_intr_string(void *lcv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
return sio_intr_string(NULL /*XXX*/, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_axppci_33_intr_evcnt(void *lcv, pci_intr_handle_t ih)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
return sio_intr_evcnt(NULL /*XXX*/, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_axppci_33_intr_establish(void *lcv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
|
||||
arg);
|
||||
}
|
||||
|
||||
void
|
||||
dec_axppci_33_intr_disestablish(void *lcv, void *cookie)
|
||||
{
|
||||
#if 0
|
||||
struct lca_config *lcp = lcv;
|
||||
#endif
|
||||
|
||||
sio_intr_disestablish(NULL /*XXX*/, cookie);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_eb164.c,v 1.45 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_eb164.c,v 1.46 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,v 1.45 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,v 1.46 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -88,28 +88,19 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,v 1.45 2014/03/21 16:39:29 christos Exp
|
|||
#include <alpha/pci/siovar.h>
|
||||
#endif
|
||||
|
||||
int dec_eb164_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
|
||||
const char *dec_eb164_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_eb164_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_eb164_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_eb164_intr_disestablish(void *, void *);
|
||||
|
||||
void *dec_eb164_pciide_compat_intr_establish(void *, device_t,
|
||||
const struct pci_attach_args *, int, int (*)(void *), void *);
|
||||
static int dec_eb164_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
#define EB164_SIO_IRQ 4
|
||||
#define EB164_MAX_IRQ 24
|
||||
#define PCI_STRAY_MAX 5
|
||||
|
||||
struct alpha_shared_intr *eb164_pci_intr;
|
||||
static bus_space_tag_t eb164_intrgate_iot;
|
||||
static bus_space_handle_t eb164_intrgate_ioh;
|
||||
|
||||
bus_space_tag_t eb164_intrgate_iot;
|
||||
bus_space_handle_t eb164_intrgate_ioh;
|
||||
|
||||
void eb164_iointr(void *arg, unsigned long vec);
|
||||
extern void eb164_intr_enable(int irq); /* pci_eb164_intr.S */
|
||||
extern void eb164_intr_disable(int irq); /* pci_eb164_intr.S */
|
||||
/* See pci_eb164_intr.s */
|
||||
extern void eb164_intr_enable(pci_chipset_tag_t, int irq);
|
||||
extern void eb164_intr_disable(pci_chipset_tag_t, int irq);
|
||||
|
||||
void
|
||||
pci_eb164_pickintr(struct cia_config *ccp)
|
||||
|
@ -121,51 +112,58 @@ pci_eb164_pickintr(struct cia_config *ccp)
|
|||
|
||||
pc->pc_intr_v = ccp;
|
||||
pc->pc_intr_map = dec_eb164_intr_map;
|
||||
pc->pc_intr_string = dec_eb164_intr_string;
|
||||
pc->pc_intr_evcnt = dec_eb164_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_eb164_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_eb164_intr_disestablish;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = alpha_pci_generic_intr_establish;
|
||||
pc->pc_intr_disestablish = alpha_pci_generic_intr_disestablish;
|
||||
|
||||
pc->pc_pciide_compat_intr_establish =
|
||||
dec_eb164_pciide_compat_intr_establish;
|
||||
sio_pciide_compat_intr_establish;
|
||||
|
||||
eb164_intrgate_iot = iot;
|
||||
if (bus_space_map(eb164_intrgate_iot, 0x804, 3, 0,
|
||||
&eb164_intrgate_ioh) != 0)
|
||||
panic("pci_eb164_pickintr: couldn't map interrupt PLD");
|
||||
for (i = 0; i < EB164_MAX_IRQ; i++)
|
||||
eb164_intr_disable(i);
|
||||
eb164_intr_disable(pc, i);
|
||||
|
||||
#define PCI_EB164_IRQ_STR 8
|
||||
eb164_pci_intr = alpha_shared_intr_alloc(EB164_MAX_IRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(EB164_MAX_IRQ,
|
||||
PCI_EB164_IRQ_STR);
|
||||
pc->pc_intr_desc = "eb164 irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = EB164_MAX_IRQ;
|
||||
|
||||
pc->pc_intr_enable = eb164_intr_enable;
|
||||
pc->pc_intr_disable = eb164_intr_disable;
|
||||
|
||||
for (i = 0; i < EB164_MAX_IRQ; i++) {
|
||||
/*
|
||||
* Systems with a Pyxis seem to have problems with
|
||||
* stray interrupts, so just ignore them. Sigh,
|
||||
* I hate buggy hardware.
|
||||
*/
|
||||
alpha_shared_intr_set_maxstrays(eb164_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
(ccp->cc_flags & CCF_ISPYXIS) ? 0 : PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(eb164_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_EB164_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
eb164_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"eb164", cp);
|
||||
}
|
||||
|
||||
#if NSIO
|
||||
sio_intr_setup(pc, iot);
|
||||
eb164_intr_enable(EB164_SIO_IRQ);
|
||||
eb164_intr_enable(pc, EB164_SIO_IRQ);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_eb164_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
int buspin = pa->pa_intrpin, line = pa->pa_intrline;
|
||||
int buspin = pa->pa_intrpin;
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
int bus, device, function;
|
||||
uint64_t variation;
|
||||
|
@ -174,7 +172,7 @@ dec_eb164_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_eb164_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -215,147 +213,14 @@ dec_eb164_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The console places the interrupt mapping in the "line" value.
|
||||
* A value of (char)-1 indicates there is no mapping.
|
||||
*/
|
||||
if (line == 0xff) {
|
||||
printf("dec_eb164_intr_map: no mapping for %d/%d/%d\n",
|
||||
bus, device, function);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (line > EB164_MAX_IRQ)
|
||||
panic("dec_eb164_intr_map: eb164 irq too large (%d)",
|
||||
line);
|
||||
|
||||
*ihp = line;
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_eb164_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
|
||||
if (ih > EB164_MAX_IRQ)
|
||||
panic("%s: bogus eb164 IRQ 0x%lx", __func__, ih);
|
||||
snprintf(buf, len, "eb164 irq %ld", ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_eb164_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
|
||||
if (ih > EB164_MAX_IRQ)
|
||||
panic("%s: bogus eb164 IRQ 0x%lx", __func__, ih);
|
||||
return (alpha_shared_intr_evcnt(eb164_pci_intr, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_eb164_intr_establish(void *ccv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
void *cookie;
|
||||
|
||||
if (ih > EB164_MAX_IRQ)
|
||||
panic("dec_eb164_intr_establish: bogus eb164 IRQ 0x%lx", ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(eb164_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "eb164 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(eb164_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), eb164_iointr, NULL,
|
||||
level);
|
||||
eb164_intr_enable(ih);
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_eb164_intr_disestablish(void *ccv, void *cookie)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(eb164_pci_intr, cookie,
|
||||
"eb164 irq");
|
||||
if (alpha_shared_intr_isactive(eb164_pci_intr, irq) == 0) {
|
||||
eb164_intr_disable(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(eb164_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void *
|
||||
dec_eb164_pciide_compat_intr_establish(void *v, device_t dev,
|
||||
const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
|
||||
{
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
void *cookie = NULL;
|
||||
int bus, irq;
|
||||
char buf[64];
|
||||
|
||||
pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
|
||||
|
||||
/*
|
||||
* If this isn't PCI bus #0, all bets are off.
|
||||
*/
|
||||
if (bus != 0)
|
||||
return (NULL);
|
||||
|
||||
irq = PCIIDE_COMPAT_IRQ(chan);
|
||||
#if NSIO
|
||||
cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
|
||||
func, arg);
|
||||
if (cookie == NULL)
|
||||
return (NULL);
|
||||
aprint_normal_dev(dev, "%s channel interrupting at %s\n",
|
||||
PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq,
|
||||
buf, sizeof(buf)));
|
||||
#endif
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
eb164_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(eb164_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(eb164_pci_intr, irq,
|
||||
"eb164 irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(eb164_pci_intr, irq))
|
||||
eb164_intr_disable(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(eb164_pci_intr, irq);
|
||||
return alpha_pci_generic_intr_map(pa, ihp);
|
||||
}
|
||||
|
||||
#if 0 /* THIS DOES NOT WORK! see pci_eb164_intr.S. */
|
||||
uint8_t eb164_intr_mask[3] = { 0xff, 0xff, 0xff };
|
||||
|
||||
void
|
||||
eb164_intr_enable(int irq)
|
||||
eb164_intr_enable(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
int byte = (irq / 8), bit = (irq % 8);
|
||||
|
||||
|
@ -369,7 +234,7 @@ eb164_intr_enable(int irq)
|
|||
}
|
||||
|
||||
void
|
||||
eb164_intr_disable(int irq)
|
||||
eb164_intr_disable(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
int byte = (irq / 8), bit = (irq % 8);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_eb164_intr.s,v 1.6 2002/01/23 21:33:19 ross Exp $ */
|
||||
/* $NetBSD: pci_eb164_intr.s,v 1.7 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -45,19 +45,22 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb164_intr.s,v 1.6 2002/01/23 21:33:19 ross Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb164_intr.s,v 1.7 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* void eb164_intr_enable(pci_chipset_tag_t, int irq);
|
||||
* void eb164_intr_disenable(pci_chipset_tag_t, int irq);
|
||||
*/
|
||||
|
||||
.text
|
||||
LEAF(eb164_intr_enable,1)
|
||||
mov a0, a1
|
||||
LEAF(eb164_intr_enable,2)
|
||||
ldiq a0, 0x34
|
||||
call_pal PAL_cserve
|
||||
RET
|
||||
END(eb164_intr_enable)
|
||||
|
||||
.text
|
||||
LEAF(eb164_intr_disable,1)
|
||||
mov a0, a1
|
||||
LEAF(eb164_intr_disable,2)
|
||||
ldiq a0, 0x35
|
||||
call_pal PAL_cserve
|
||||
RET
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_eb64plus.c,v 1.24 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_eb64plus.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus.c,v 1.24 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -85,25 +85,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb64plus.c,v 1.24 2014/03/21 16:39:29 christos E
|
|||
#include <alpha/pci/siovar.h>
|
||||
#endif
|
||||
|
||||
int dec_eb64plus_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_eb64plus_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_eb64plus_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_eb64plus_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_eb64plus_intr_disestablish(void *, void *);
|
||||
|
||||
#define EB64PLUS_MAX_IRQ 32
|
||||
#define PCI_STRAY_MAX 5
|
||||
|
||||
struct alpha_shared_intr *eb64plus_pci_intr;
|
||||
static bus_space_tag_t eb64plus_intrgate_iot;
|
||||
static bus_space_handle_t eb64plus_intrgate_ioh;
|
||||
|
||||
bus_space_tag_t eb64plus_intrgate_iot;
|
||||
bus_space_handle_t eb64plus_intrgate_ioh;
|
||||
|
||||
void eb64plus_iointr(void *arg, unsigned long vec);
|
||||
extern void eb64plus_intr_enable(int irq); /* pci_eb64plus_intr.S */
|
||||
extern void eb64plus_intr_disable(int irq); /* pci_eb64plus_intr.S */
|
||||
/* See pci_eb64plus_intr.s */
|
||||
extern void eb64plus_intr_enable(pci_chipset_tag_t, int irq);
|
||||
extern void eb64plus_intr_disable(pci_chipset_tag_t, int irq);
|
||||
|
||||
void
|
||||
pci_eb64plus_pickintr(struct apecs_config *acp)
|
||||
|
@ -114,11 +104,11 @@ pci_eb64plus_pickintr(struct apecs_config *acp)
|
|||
int i;
|
||||
|
||||
pc->pc_intr_v = acp;
|
||||
pc->pc_intr_map = dec_eb64plus_intr_map;
|
||||
pc->pc_intr_string = dec_eb64plus_intr_string;
|
||||
pc->pc_intr_evcnt = dec_eb64plus_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_eb64plus_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_eb64plus_intr_disestablish;
|
||||
pc->pc_intr_map = alpha_pci_generic_intr_map;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = alpha_pci_generic_intr_establish;
|
||||
pc->pc_intr_disestablish = alpha_pci_generic_intr_disestablish;
|
||||
|
||||
/* Not supported on the EB64+. */
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
@ -128,19 +118,26 @@ pci_eb64plus_pickintr(struct apecs_config *acp)
|
|||
&eb64plus_intrgate_ioh) != 0)
|
||||
panic("pci_eb64plus_pickintr: couldn't map interrupt PLD");
|
||||
for (i = 0; i < EB64PLUS_MAX_IRQ; i++)
|
||||
eb64plus_intr_disable(i);
|
||||
eb64plus_intr_disable(pc, i);
|
||||
|
||||
#define PCI_EB64PLUS_IRQ_STR 8
|
||||
eb64plus_pci_intr = alpha_shared_intr_alloc(EB64PLUS_MAX_IRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(EB64PLUS_MAX_IRQ,
|
||||
PCI_EB64PLUS_IRQ_STR);
|
||||
pc->pc_intr_desc = "eb64+ irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = EB64PLUS_MAX_IRQ;
|
||||
|
||||
pc->pc_intr_enable = eb64plus_intr_enable;
|
||||
pc->pc_intr_disable = eb64plus_intr_disable;
|
||||
|
||||
for (i = 0; i < EB64PLUS_MAX_IRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(eb64plus_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(eb64plus_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_EB64PLUS_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
eb64plus_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"eb64+", cp);
|
||||
}
|
||||
|
||||
|
@ -149,124 +146,11 @@ pci_eb64plus_pickintr(struct apecs_config *acp)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
dec_eb64plus_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
int buspin = pa->pa_intrpin, line = pa->pa_intrline;
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
int bus, device, function;
|
||||
|
||||
if (buspin == 0) {
|
||||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
printf("dec_eb64plus_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pci_decompose_tag(pc, bustag, &bus, &device, &function);
|
||||
|
||||
/*
|
||||
* The console places the interrupt mapping in the "line" value.
|
||||
* A value of (char)-1 indicates there is no mapping.
|
||||
*/
|
||||
if (line == 0xff) {
|
||||
printf("dec_eb64plus_intr_map: no mapping for %d/%d/%d\n",
|
||||
bus, device, function);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (line >= EB64PLUS_MAX_IRQ)
|
||||
panic("dec_eb64plus_intr_map: eb64+ irq too large (%d)",
|
||||
line);
|
||||
|
||||
*ihp = line;
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_eb64plus_intr_string(void *acv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
if (ih > EB64PLUS_MAX_IRQ)
|
||||
panic("%s: bogus eb64+ IRQ 0x%lx", __func__, ih);
|
||||
snprintf(buf, len, "eb64+ irq %ld", ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_eb64plus_intr_evcnt(void *acv, pci_intr_handle_t ih)
|
||||
{
|
||||
|
||||
if (ih > EB64PLUS_MAX_IRQ)
|
||||
panic("%s: bogus eb64+ IRQ 0x%lx", __func__, ih);
|
||||
return (alpha_shared_intr_evcnt(eb64plus_pci_intr, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_eb64plus_intr_establish(void *acv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
{
|
||||
void *cookie;
|
||||
|
||||
if (ih > EB64PLUS_MAX_IRQ)
|
||||
panic("dec_eb64plus_intr_establish: bogus eb64+ IRQ 0x%lx",
|
||||
ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(eb64plus_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "eb64+ irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(eb64plus_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), eb64plus_iointr, NULL,
|
||||
level);
|
||||
eb64plus_intr_enable(ih);
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_eb64plus_intr_disestablish(void *acv, void *cookie)
|
||||
{
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(eb64plus_pci_intr, cookie,
|
||||
"eb64+ irq");
|
||||
if (alpha_shared_intr_isactive(eb64plus_pci_intr, irq) == 0) {
|
||||
eb64plus_intr_disable(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(eb64plus_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
eb64plus_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(eb64plus_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(eb64plus_pci_intr, irq,
|
||||
"eb64+ irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(eb64plus_pci_intr, irq))
|
||||
eb64plus_intr_disable(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(eb64plus_pci_intr, irq);
|
||||
}
|
||||
|
||||
#if 0 /* THIS DOES NOT WORK! see pci_eb64plus_intr.S. */
|
||||
uint8_t eb64plus_intr_mask[3] = { 0xff, 0xff, 0xff };
|
||||
|
||||
void
|
||||
eb64plus_intr_enable(int irq)
|
||||
eb64plus_intr_enable(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
int byte = (irq / 8), bit = (irq % 8);
|
||||
|
||||
|
@ -280,7 +164,7 @@ eb64plus_intr_enable(int irq)
|
|||
}
|
||||
|
||||
void
|
||||
eb64plus_intr_disable(int irq)
|
||||
eb64plus_intr_disable(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
int byte = (irq / 8), bit = (irq % 8);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_eb64plus_intr.s,v 1.4 2005/12/11 12:16:17 christos Exp $ */
|
||||
/* $NetBSD: pci_eb64plus_intr.s,v 1.5 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -44,19 +44,22 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus_intr.s,v 1.4 2005/12/11 12:16:17 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus_intr.s,v 1.5 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* void eb64plus_intr_enable(pci_chipset_tag_t pc, int irq);
|
||||
* void eb64plus_intr_disable(pci_chipset_tag_t pc, int irq);
|
||||
*/
|
||||
|
||||
.text
|
||||
LEAF(eb64plus_intr_enable,1)
|
||||
mov a0, a1
|
||||
LEAF(eb64plus_intr_enable,2)
|
||||
ldiq a0, 0x34
|
||||
call_pal PAL_cserve
|
||||
RET
|
||||
END(eb64plus_intr_enable)
|
||||
|
||||
.text
|
||||
LEAF(eb64plus_intr_disable,1)
|
||||
mov a0, a1
|
||||
LEAF(eb64plus_intr_disable,2)
|
||||
ldiq a0, 0x35
|
||||
call_pal PAL_cserve
|
||||
RET
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_eb66.c,v 1.24 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_eb66.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v 1.24 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -85,25 +85,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v 1.24 2014/03/21 16:39:29 christos Exp $
|
|||
#include <alpha/pci/siovar.h>
|
||||
#endif
|
||||
|
||||
int dec_eb66_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_eb66_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_eb66_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_eb66_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_eb66_intr_disestablish(void *, void *);
|
||||
|
||||
#define EB66_MAX_IRQ 32
|
||||
#define PCI_STRAY_MAX 5
|
||||
|
||||
struct alpha_shared_intr *eb66_pci_intr;
|
||||
static bus_space_tag_t eb66_intrgate_iot;
|
||||
static bus_space_handle_t eb66_intrgate_ioh;
|
||||
|
||||
bus_space_tag_t eb66_intrgate_iot;
|
||||
bus_space_handle_t eb66_intrgate_ioh;
|
||||
|
||||
void eb66_iointr(void *arg, unsigned long vec);
|
||||
extern void eb66_intr_enable(int irq); /* pci_eb66_intr.S */
|
||||
extern void eb66_intr_disable(int irq); /* pci_eb66_intr.S */
|
||||
/* See pci_eb66_intr.s */
|
||||
extern void eb66_intr_enable(pci_chipset_tag_t pc, int irq);
|
||||
extern void eb66_intr_disable(pci_chipset_tag_t pc, int irq);
|
||||
|
||||
void
|
||||
pci_eb66_pickintr(struct lca_config *lcp)
|
||||
|
@ -114,11 +104,11 @@ pci_eb66_pickintr(struct lca_config *lcp)
|
|||
int i;
|
||||
|
||||
pc->pc_intr_v = lcp;
|
||||
pc->pc_intr_map = dec_eb66_intr_map;
|
||||
pc->pc_intr_string = dec_eb66_intr_string;
|
||||
pc->pc_intr_evcnt = dec_eb66_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_eb66_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_eb66_intr_disestablish;
|
||||
pc->pc_intr_map = alpha_pci_generic_intr_map;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = alpha_pci_generic_intr_establish;
|
||||
pc->pc_intr_disestablish = alpha_pci_generic_intr_disestablish;
|
||||
|
||||
/* Not supported on the EB66. */
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
@ -128,18 +118,26 @@ pci_eb66_pickintr(struct lca_config *lcp)
|
|||
&eb66_intrgate_ioh) != 0)
|
||||
panic("pci_eb66_pickintr: couldn't map interrupt PLD");
|
||||
for (i = 0; i < EB66_MAX_IRQ; i++)
|
||||
eb66_intr_disable(i);
|
||||
eb66_intr_disable(pc, i);
|
||||
|
||||
#define PCI_EB66_IRQ_STR 8
|
||||
eb66_pci_intr = alpha_shared_intr_alloc(EB66_MAX_IRQ, PCI_EB66_IRQ_STR);
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(EB66_MAX_IRQ,
|
||||
PCI_EB66_IRQ_STR);
|
||||
pc->pc_intr_desc = "eb66 irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = EB66_MAX_IRQ;
|
||||
|
||||
pc->pc_intr_enable = eb66_intr_enable;
|
||||
pc->pc_intr_disable = eb66_intr_disable;
|
||||
|
||||
for (i = 0; i < EB66_MAX_IRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(eb66_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(eb66_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_EB66_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
eb66_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"eb66", cp);
|
||||
}
|
||||
|
||||
|
@ -148,123 +146,11 @@ pci_eb66_pickintr(struct lca_config *lcp)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
dec_eb66_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
int buspin = pa->pa_intrpin, line = pa->pa_intrline;
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
int bus, device, function;
|
||||
|
||||
if (buspin == 0) {
|
||||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
printf("dec_eb66_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pci_decompose_tag(pc, bustag, &bus, &device, &function);
|
||||
|
||||
/*
|
||||
* The console places the interrupt mapping in the "line" value.
|
||||
* A value of (char)-1 indicates there is no mapping.
|
||||
*/
|
||||
if (line == 0xff) {
|
||||
printf("dec_eb66_intr_map: no mapping for %d/%d/%d\n",
|
||||
bus, device, function);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (line >= EB66_MAX_IRQ)
|
||||
panic("dec_eb66_intr_map: eb66 irq too large (%d)",
|
||||
line);
|
||||
|
||||
*ihp = line;
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_eb66_intr_string(void *lcv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
if (ih >= EB66_MAX_IRQ)
|
||||
panic("%s: bogus eb66 IRQ 0x%lx", __func__, ih);
|
||||
snprintf(buf, len, "eb66 irq %ld", ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_eb66_intr_evcnt(void *lcv, pci_intr_handle_t ih)
|
||||
{
|
||||
|
||||
if (ih >= EB66_MAX_IRQ)
|
||||
panic("dec_eb66_intr_evcnt: bogus eb66 IRQ 0x%lx", ih);
|
||||
return (alpha_shared_intr_evcnt(eb66_pci_intr, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_eb66_intr_establish(void *lcv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
|
||||
{
|
||||
void *cookie;
|
||||
|
||||
if (ih >= EB66_MAX_IRQ)
|
||||
panic("dec_eb66_intr_establish: bogus eb66 IRQ 0x%lx", ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(eb66_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "eb66 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(eb66_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), eb66_iointr, NULL,
|
||||
level);
|
||||
eb66_intr_enable(ih);
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_eb66_intr_disestablish(void *lcv, void *cookie)
|
||||
{
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(eb66_pci_intr, cookie,
|
||||
"eb66 irq");
|
||||
if (alpha_shared_intr_isactive(eb66_pci_intr, irq) == 0) {
|
||||
eb66_intr_disable(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(eb66_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
eb66_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(eb66_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(eb66_pci_intr, irq,
|
||||
"eb66 irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(eb66_pci_intr, irq))
|
||||
eb66_intr_disable(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(eb66_pci_intr, irq);
|
||||
}
|
||||
|
||||
#if 0 /* THIS DOES NOT WORK! see pci_eb66_intr.S. */
|
||||
uint8_t eb66_intr_mask[3] = { 0xff, 0xff, 0xff };
|
||||
|
||||
void
|
||||
eb66_intr_enable(int irq)
|
||||
eb66_intr_enable(pci_chipset_tag_t pc, __unused, int irq)
|
||||
{
|
||||
int byte = (irq / 8), bit = (irq % 8);
|
||||
|
||||
|
@ -278,7 +164,7 @@ eb66_intr_enable(int irq)
|
|||
}
|
||||
|
||||
void
|
||||
eb66_intr_disable(int irq)
|
||||
eb66_intr_disable(pci_chipset_tag_t pc, __unused, int irq)
|
||||
{
|
||||
int byte = (irq / 8), bit = (irq % 8);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_eb66_intr.s,v 1.3 2005/12/11 12:16:17 christos Exp $ */
|
||||
/* $NetBSD: pci_eb66_intr.s,v 1.4 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -44,19 +44,22 @@
|
|||
|
||||
#include <machine/asm.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb66_intr.s,v 1.3 2005/12/11 12:16:17 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_eb66_intr.s,v 1.4 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* void eb66_intr_enable(pci_chipset_tag_t pc, int irq);
|
||||
* void eb66_intr_disable(pci_chipset_tag_t pc, int irq);
|
||||
*/
|
||||
|
||||
.text
|
||||
LEAF(eb66_intr_enable,1)
|
||||
mov a0, a1
|
||||
LEAF(eb66_intr_enable,2)
|
||||
ldiq a0, 0x34
|
||||
call_pal PAL_cserve
|
||||
RET
|
||||
END(eb66_intr_enable)
|
||||
|
||||
.text
|
||||
LEAF(eb66_intr_disable,1)
|
||||
mov a0, a1
|
||||
LEAF(eb66_intr_disable,2)
|
||||
ldiq a0, 0x35
|
||||
call_pal PAL_cserve
|
||||
RET
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_kn20aa.c,v 1.54 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_kn20aa.c,v 1.55 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c,v 1.54 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c,v 1.55 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -55,23 +55,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c,v 1.54 2014/03/21 16:39:29 christos Exp
|
|||
#include <alpha/pci/siovar.h>
|
||||
#endif
|
||||
|
||||
int dec_kn20aa_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_kn20aa_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_kn20aa_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_kn20aa_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_kn20aa_intr_disestablish(void *, void *);
|
||||
static int dec_kn20aa_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
#define KN20AA_PCEB_IRQ 31
|
||||
#define KN20AA_MAX_IRQ 32
|
||||
#define PCI_STRAY_MAX 5
|
||||
|
||||
struct alpha_shared_intr *kn20aa_pci_intr;
|
||||
|
||||
void kn20aa_iointr(void *arg, unsigned long vec);
|
||||
void kn20aa_enable_intr(int irq);
|
||||
void kn20aa_disable_intr(int irq);
|
||||
static void kn20aa_enable_intr(pci_chipset_tag_t pc, int irq);
|
||||
static void kn20aa_disable_intr(pci_chipset_tag_t pc, int irq);
|
||||
|
||||
void
|
||||
pci_kn20aa_pickintr(struct cia_config *ccp)
|
||||
|
@ -85,35 +77,42 @@ pci_kn20aa_pickintr(struct cia_config *ccp)
|
|||
|
||||
pc->pc_intr_v = ccp;
|
||||
pc->pc_intr_map = dec_kn20aa_intr_map;
|
||||
pc->pc_intr_string = dec_kn20aa_intr_string;
|
||||
pc->pc_intr_evcnt = dec_kn20aa_intr_evcnt;
|
||||
pc->pc_intr_establish = dec_kn20aa_intr_establish;
|
||||
pc->pc_intr_disestablish = dec_kn20aa_intr_disestablish;
|
||||
pc->pc_intr_string = alpha_pci_generic_intr_string;
|
||||
pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
|
||||
pc->pc_intr_establish = alpha_pci_generic_intr_establish;
|
||||
pc->pc_intr_disestablish = alpha_pci_generic_intr_disestablish;
|
||||
|
||||
/* Not supported on KN20AA. */
|
||||
pc->pc_pciide_compat_intr_establish = NULL;
|
||||
|
||||
#define PCI_KN20AA_IRQ_STR 8
|
||||
kn20aa_pci_intr = alpha_shared_intr_alloc(KN20AA_MAX_IRQ,
|
||||
pc->pc_shared_intrs = alpha_shared_intr_alloc(KN20AA_MAX_IRQ,
|
||||
PCI_KN20AA_IRQ_STR);
|
||||
pc->pc_intr_desc = "kn20aa irq";
|
||||
pc->pc_vecbase = 0x900;
|
||||
pc->pc_nirq = KN20AA_MAX_IRQ;
|
||||
|
||||
pc->pc_intr_enable = kn20aa_enable_intr;
|
||||
pc->pc_intr_disable = kn20aa_disable_intr;
|
||||
|
||||
for (i = 0; i < KN20AA_MAX_IRQ; i++) {
|
||||
alpha_shared_intr_set_maxstrays(kn20aa_pci_intr, i,
|
||||
alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
|
||||
PCI_STRAY_MAX);
|
||||
|
||||
cp = alpha_shared_intr_string(kn20aa_pci_intr, i);
|
||||
cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
|
||||
snprintf(cp, PCI_KN20AA_IRQ_STR, "irq %d", i);
|
||||
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
|
||||
kn20aa_pci_intr, i), EVCNT_TYPE_INTR, NULL,
|
||||
pc->pc_shared_intrs, i), EVCNT_TYPE_INTR, NULL,
|
||||
"kn20aa", cp);
|
||||
}
|
||||
|
||||
#if NSIO > 0 || NPCEB > 0
|
||||
sio_intr_setup(pc, iot);
|
||||
kn20aa_enable_intr(KN20AA_PCEB_IRQ);
|
||||
kn20aa_enable_intr(pc, KN20AA_PCEB_IRQ);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_kn20aa_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
|
@ -126,7 +125,7 @@ dec_kn20aa_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_kn20aa_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -172,106 +171,12 @@ dec_kn20aa_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
panic("dec_kn20aa_intr_map: kn20aa_irq too large (%d)",
|
||||
kn20aa_irq);
|
||||
|
||||
*ihp = kn20aa_irq;
|
||||
alpha_pci_intr_handle_init(ihp, kn20aa_irq, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_kn20aa_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
if (ih > KN20AA_MAX_IRQ)
|
||||
panic("%s: bogus kn20aa IRQ 0x%lx", __func__, ih);
|
||||
|
||||
snprintf(buf, len, "kn20aa irq %ld", ih);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_kn20aa_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
|
||||
if (ih > KN20AA_MAX_IRQ)
|
||||
panic("%s: bogus kn20aa IRQ 0x%lx", __func__, ih);
|
||||
return (alpha_shared_intr_evcnt(kn20aa_pci_intr, ih));
|
||||
}
|
||||
|
||||
void *
|
||||
dec_kn20aa_intr_establish(
|
||||
void *ccv,
|
||||
pci_intr_handle_t ih,
|
||||
int level,
|
||||
int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
void *cookie;
|
||||
|
||||
if (ih > KN20AA_MAX_IRQ)
|
||||
panic("dec_kn20aa_intr_establish: bogus kn20aa IRQ 0x%lx",
|
||||
ih);
|
||||
|
||||
cookie = alpha_shared_intr_establish(kn20aa_pci_intr, ih, IST_LEVEL,
|
||||
level, func, arg, "kn20aa irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(kn20aa_pci_intr, ih)) {
|
||||
scb_set(0x900 + SCB_IDXTOVEC(ih), kn20aa_iointr, NULL,
|
||||
level);
|
||||
kn20aa_enable_intr(ih);
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_kn20aa_intr_disestablish(void *ccv, void *cookie)
|
||||
{
|
||||
#if 0
|
||||
struct cia_config *ccp = ccv;
|
||||
#endif
|
||||
struct alpha_shared_intrhand *ih = cookie;
|
||||
unsigned int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(kn20aa_pci_intr, cookie,
|
||||
"kn20aa irq");
|
||||
if (alpha_shared_intr_isactive(kn20aa_pci_intr, irq) == 0) {
|
||||
kn20aa_disable_intr(irq);
|
||||
alpha_shared_intr_set_dfltsharetype(kn20aa_pci_intr, irq,
|
||||
IST_NONE);
|
||||
scb_free(0x900 + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
kn20aa_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
int irq;
|
||||
|
||||
irq = SCB_VECTOIDX(vec - 0x900);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(kn20aa_pci_intr, irq)) {
|
||||
alpha_shared_intr_stray(kn20aa_pci_intr, irq,
|
||||
"kn20aa irq");
|
||||
if (ALPHA_SHARED_INTR_DISABLE(kn20aa_pci_intr, irq))
|
||||
kn20aa_disable_intr(irq);
|
||||
} else
|
||||
alpha_shared_intr_reset_strays(kn20aa_pci_intr, irq);
|
||||
}
|
||||
|
||||
void
|
||||
kn20aa_enable_intr(int irq)
|
||||
static void
|
||||
kn20aa_enable_intr(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -285,8 +190,8 @@ kn20aa_enable_intr(int irq)
|
|||
alpha_mb();
|
||||
}
|
||||
|
||||
void
|
||||
kn20aa_disable_intr(int irq)
|
||||
static void
|
||||
kn20aa_disable_intr(pci_chipset_tag_t pc __unused, int irq)
|
||||
{
|
||||
|
||||
alpha_mb();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_kn300.c,v 1.36 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_kn300.c,v 1.37 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 by Matthew Jacob
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,v 1.36 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,v 1.37 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -59,13 +59,15 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,v 1.36 2014/03/21 16:39:29 christos Exp
|
|||
#include <alpha/pci/siovar.h>
|
||||
#endif
|
||||
|
||||
int dec_kn300_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_kn300_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_kn300_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_kn300_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_kn300_intr_disestablish(void *, void *);
|
||||
static int dec_kn300_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
static const char *dec_kn300_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
static const struct evcnt *dec_kn300_intr_evcnt(pci_chipset_tag_t,
|
||||
pci_intr_handle_t);
|
||||
static void *dec_kn300_intr_establish(pci_chipset_tag_t,
|
||||
pci_intr_handle_t, int, int (*func)(void *), void *);
|
||||
static void dec_kn300_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
|
||||
#define KN300_PCEB_IRQ 16
|
||||
#define NPIN 4
|
||||
|
@ -77,9 +79,9 @@ static struct alpha_shared_intr *kn300_pci_intr;
|
|||
|
||||
static struct mcpcia_config *mcpcia_eisaccp = NULL;
|
||||
|
||||
void kn300_iointr(void *, unsigned long);
|
||||
void kn300_enable_intr(struct mcpcia_config *, int);
|
||||
void kn300_disable_intr(struct mcpcia_config *, int);
|
||||
static void kn300_iointr(void *, unsigned long);
|
||||
static void kn300_enable_intr(struct mcpcia_config *, int);
|
||||
static void kn300_disable_intr(struct mcpcia_config *, int);
|
||||
|
||||
void
|
||||
pci_kn300_pickintr(struct mcpcia_config *ccp, int first)
|
||||
|
@ -123,7 +125,7 @@ pci_kn300_pickintr(struct mcpcia_config *ccp, int first)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
dec_kn300_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
|
@ -137,7 +139,7 @@ dec_kn300_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4 || buspin < 0) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_kn300_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -168,65 +170,72 @@ dec_kn300_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
* Software only:
|
||||
* bits 11-15 MCPCIA IRQ
|
||||
*/
|
||||
*ihp = (pci_intr_handle_t)
|
||||
const u_int irq =
|
||||
(buspin - 1 ) |
|
||||
((device & 0x7) << 2) |
|
||||
((ccp->cc_mid - 4) << 5) |
|
||||
((7 - ccp->cc_gid) << 8) |
|
||||
(mcpcia_irq << 11);
|
||||
alpha_pci_intr_handle_init(ihp, irq, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_kn300_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
static const char *
|
||||
dec_kn300_intr_string(pci_chipset_tag_t const pc __unused,
|
||||
pci_intr_handle_t const ih, char * const buf, size_t const len)
|
||||
{
|
||||
snprintf(buf, len, "kn300 irq %ld", ih & 0x3ff);
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih) & 0x3ff;
|
||||
|
||||
snprintf(buf, len, "kn300 irq %u", irq);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_kn300_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
static const struct evcnt *
|
||||
dec_kn300_intr_evcnt(pci_chipset_tag_t const pc __unused,
|
||||
pci_intr_handle_t const ih)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih) & 0x3ff;
|
||||
|
||||
return (alpha_shared_intr_evcnt(kn300_pci_intr, ih & 0x3ff));
|
||||
return alpha_shared_intr_evcnt(kn300_pci_intr, irq);
|
||||
}
|
||||
|
||||
void *
|
||||
static void *
|
||||
dec_kn300_intr_establish(
|
||||
void *ccv,
|
||||
pci_intr_handle_t ih,
|
||||
int level,
|
||||
pci_chipset_tag_t const pc,
|
||||
pci_intr_handle_t const ih,
|
||||
int const level,
|
||||
int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
struct mcpcia_config *ccp = ccv;
|
||||
struct mcpcia_config * const ccp = pc->pc_intr_v;
|
||||
void *cookie;
|
||||
int irq;
|
||||
const u_int ihv = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int irq = ihv & 0x3ff;
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
|
||||
irq = ih & 0x3ff;
|
||||
cookie = alpha_shared_intr_establish(kn300_pci_intr, irq, IST_LEVEL,
|
||||
level, func, arg, "kn300 irq");
|
||||
level, flags, func, arg, "kn300 irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(kn300_pci_intr, irq)) {
|
||||
scb_set(MCPCIA_VEC_PCI + SCB_IDXTOVEC(irq),
|
||||
kn300_iointr, NULL, level);
|
||||
scb_set(MCPCIA_VEC_PCI + SCB_IDXTOVEC(irq), kn300_iointr, NULL);
|
||||
alpha_shared_intr_set_private(kn300_pci_intr, irq, ccp);
|
||||
savirqs[irq] = (ih >> 11) & 0x1f;
|
||||
savirqs[irq] = (ihv >> 11) & 0x1f;
|
||||
kn300_enable_intr(ccp, savirqs[irq]);
|
||||
alpha_mb();
|
||||
}
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_kn300_intr_disestablish(void *ccv, void *cookie)
|
||||
static void
|
||||
dec_kn300_intr_disestablish(pci_chipset_tag_t const pc __unused,
|
||||
void * const cookie __unused)
|
||||
{
|
||||
panic("dec_kn300_intr_disestablish not implemented");
|
||||
}
|
||||
|
||||
void
|
||||
kn300_iointr(void *arg, unsigned long vec)
|
||||
static void
|
||||
kn300_iointr(void * const arg __unused, unsigned long const vec)
|
||||
{
|
||||
struct mcpcia_softc *mcp;
|
||||
u_long irq;
|
||||
|
@ -270,16 +279,16 @@ kn300_iointr(void *arg, unsigned long vec)
|
|||
kn300_disable_intr(mcp->mcpcia_cc, savirqs[irq]);
|
||||
}
|
||||
|
||||
void
|
||||
kn300_enable_intr(struct mcpcia_config *ccp, int irq)
|
||||
static void
|
||||
kn300_enable_intr(struct mcpcia_config * const ccp, int const irq)
|
||||
{
|
||||
alpha_mb();
|
||||
REGVAL(MCPCIA_INT_MASK0(ccp)) |= (1 << irq);
|
||||
alpha_mb();
|
||||
}
|
||||
|
||||
void
|
||||
kn300_disable_intr(struct mcpcia_config *ccp, int irq)
|
||||
static void
|
||||
kn300_disable_intr(struct mcpcia_config * const ccp, int const irq)
|
||||
{
|
||||
alpha_mb();
|
||||
REGVAL(MCPCIA_INT_MASK0(ccp)) &= ~(1 << irq);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_kn8ae.c,v 1.29 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_kn8ae.c,v 1.30 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 by Matthew Jacob
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,v 1.29 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,v 1.30 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -52,18 +52,39 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,v 1.29 2014/03/21 16:39:29 christos Exp
|
|||
#include <alpha/pci/dwlpxvar.h>
|
||||
#include <alpha/pci/pci_kn8ae.h>
|
||||
|
||||
int dec_kn8ae_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *dec_kn8ae_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *dec_kn8ae_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *dec_kn8ae_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void dec_kn8ae_intr_disestablish(void *, void *);
|
||||
static int dec_kn8ae_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
static const char *dec_kn8ae_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
static const struct evcnt *dec_kn8ae_intr_evcnt(pci_chipset_tag_t,
|
||||
pci_intr_handle_t);
|
||||
static void *dec_kn8ae_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
static void dec_kn8ae_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
|
||||
static uint32_t imaskcache[DWLPX_NIONODE][DWLPX_NHOSE][NHPC];
|
||||
|
||||
void kn8ae_spurious(void *, u_long);
|
||||
void kn8ae_enadis_intr(struct dwlpx_config *, pci_intr_handle_t, int);
|
||||
static void kn8ae_spurious(void *, u_long);
|
||||
static void kn8ae_enadis_intr(struct dwlpx_config *, pci_intr_handle_t,
|
||||
int);
|
||||
|
||||
struct kn8ae_wrapped_pci_intr {
|
||||
int (*ih_fn)(void *);
|
||||
};
|
||||
|
||||
static struct kn8ae_wrapped_pci_intr
|
||||
kn8ae_wrapped_pci_intrs[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)]
|
||||
__read_mostly;
|
||||
|
||||
static void
|
||||
kn8ae_intr_wrapper(void *arg, u_long vec)
|
||||
{
|
||||
const u_long idx = SCB_VECTOIDX(vec - SCB_IOVECBASE);
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
kn8ae_wrapped_pci_intrs[idx].ih_fn(arg);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
pci_kn8ae_pickintr(struct dwlpx_config *ccp, int first)
|
||||
|
@ -101,7 +122,7 @@ pci_kn8ae_pickintr(struct dwlpx_config *ccp, int first)
|
|||
#define IH_DEV(ih) (((ih) >> 16) & 0xff)
|
||||
#define IH_PIN(ih) (((ih) >> 24) & 0xff)
|
||||
|
||||
int
|
||||
static int
|
||||
dec_kn8ae_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pcitag_t bustag = pa->pa_intrtag;
|
||||
|
@ -114,7 +135,7 @@ dec_kn8ae_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("dec_kn8ae_intr_map: bad interrupt pin %d\n", buspin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -127,43 +148,49 @@ dec_kn8ae_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
*ihp = IH_MAKE(vec, device, buspin);
|
||||
alpha_pci_intr_handle_init(ihp, IH_MAKE(vec, device, buspin), 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
dec_kn8ae_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
static const char *
|
||||
dec_kn8ae_intr_string(pci_chipset_tag_t const pc __unused,
|
||||
pci_intr_handle_t const ih, char * const buf, size_t const len)
|
||||
{
|
||||
snprintf(buf, len, "vector 0x%lx", IH_VEC(ih));
|
||||
const u_int ihv = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
snprintf(buf, len, "vector 0x%x", IH_VEC(ihv));
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
dec_kn8ae_intr_evcnt(void *ccv, pci_intr_handle_t ih)
|
||||
static const struct evcnt *
|
||||
dec_kn8ae_intr_evcnt(pci_chipset_tag_t const pc __unused,
|
||||
pci_intr_handle_t const ih __unused)
|
||||
{
|
||||
|
||||
/* XXX for now, no evcnt parent reported */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
static void *
|
||||
dec_kn8ae_intr_establish(
|
||||
void *ccv,
|
||||
pci_intr_handle_t ih,
|
||||
int level,
|
||||
pci_chipset_tag_t const pc,
|
||||
pci_intr_handle_t const ih,
|
||||
int const level,
|
||||
int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
struct dwlpx_config *ccp = ccv;
|
||||
struct dwlpx_config * const ccp = pc->pc_intr_v;
|
||||
void *cookie;
|
||||
struct scbvec *scb;
|
||||
u_long vec;
|
||||
int pin, device, hpc;
|
||||
const u_int ihv = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
|
||||
device = IH_DEV(ih);
|
||||
pin = IH_PIN(ih);
|
||||
vec = IH_VEC(ih);
|
||||
device = IH_DEV(ihv);
|
||||
pin = IH_PIN(ihv);
|
||||
vec = IH_VEC(ihv);
|
||||
|
||||
scb = &scb_iovectab[SCB_VECTOIDX(vec - SCB_IOVECBASE)];
|
||||
|
||||
|
@ -180,7 +207,14 @@ dec_kn8ae_intr_establish(
|
|||
|
||||
scb->scb_arg = arg;
|
||||
alpha_mb();
|
||||
scb->scb_func = (void (*)(void *, u_long))func;
|
||||
if (flags & ALPHA_INTR_MPSAFE) {
|
||||
scb->scb_func = (void (*)(void *, u_long))func;
|
||||
} else {
|
||||
kn8ae_wrapped_pci_intrs[
|
||||
SCB_VECTOIDX(vec - SCB_IOVECBASE)].ih_fn = func;
|
||||
alpha_mb();
|
||||
scb->scb_func = kn8ae_intr_wrapper;
|
||||
}
|
||||
alpha_mb();
|
||||
|
||||
if (device < 4) {
|
||||
|
@ -196,20 +230,21 @@ dec_kn8ae_intr_establish(
|
|||
|
||||
kn8ae_enadis_intr(ccp, ih, 1);
|
||||
|
||||
cookie = (void *) ih;
|
||||
cookie = (void *) ih.value;
|
||||
|
||||
return (cookie);
|
||||
}
|
||||
|
||||
void
|
||||
dec_kn8ae_intr_disestablish(void *ccv, void *cookie)
|
||||
static void
|
||||
dec_kn8ae_intr_disestablish(pci_chipset_tag_t const pc, void * const cookie)
|
||||
{
|
||||
struct dwlpx_config *ccp = ccv;
|
||||
pci_intr_handle_t ih = (u_long) cookie;
|
||||
struct dwlpx_config * const ccp = pc->pc_intr_v;
|
||||
const u_long ihv = (u_long) cookie;
|
||||
pci_intr_handle_t ih = { .value = ihv };
|
||||
struct scbvec *scb;
|
||||
u_long vec;
|
||||
|
||||
vec = IH_VEC(ih);
|
||||
vec = IH_VEC(ihv);
|
||||
|
||||
scb = &scb_iovectab[SCB_VECTOIDX(vec - SCB_IOVECBASE)];
|
||||
__USE(scb);
|
||||
|
@ -219,16 +254,17 @@ dec_kn8ae_intr_disestablish(void *ccv, void *cookie)
|
|||
scb_free(vec);
|
||||
}
|
||||
|
||||
void
|
||||
kn8ae_spurious(void *arg, u_long vec)
|
||||
static void
|
||||
kn8ae_spurious(void * const arg __unused, u_long const vec)
|
||||
{
|
||||
printf("Spurious interrupt on temporary interrupt vector 0x%lx\n", vec);
|
||||
}
|
||||
|
||||
void
|
||||
kn8ae_enadis_intr(struct dwlpx_config *ccp, pci_intr_handle_t irq, int onoff)
|
||||
static void
|
||||
kn8ae_enadis_intr(struct dwlpx_config *ccp, pci_intr_handle_t ih, int onoff)
|
||||
{
|
||||
struct dwlpx_softc *sc = ccp->cc_sc;
|
||||
const u_int ihv = alpha_pci_intr_handle_get_irq(&ih);
|
||||
unsigned long paddr;
|
||||
uint32_t val;
|
||||
int ionode, hose, device, hpc, busp, s;
|
||||
|
@ -236,8 +272,8 @@ kn8ae_enadis_intr(struct dwlpx_config *ccp, pci_intr_handle_t irq, int onoff)
|
|||
ionode = sc->dwlpx_node - 4;
|
||||
hose = sc->dwlpx_hosenum;
|
||||
|
||||
device = IH_DEV(irq);
|
||||
busp = (1 << (IH_PIN(irq) - 1));
|
||||
device = IH_DEV(ihv);
|
||||
busp = (1 << (IH_PIN(ihv) - 1));
|
||||
|
||||
paddr = (1LL << 39);
|
||||
paddr |= (unsigned long) ionode << 36;
|
||||
|
@ -260,8 +296,8 @@ kn8ae_enadis_intr(struct dwlpx_config *ccp, pci_intr_handle_t irq, int onoff)
|
|||
val &= ~busp;
|
||||
imaskcache[ionode][hose][hpc] = val;
|
||||
#if 0
|
||||
printf("kn8ae_%s_intr: irq %lx imsk 0x%x hpc %d TLSB node %d hose %d\n",
|
||||
onoff? "enable" : "disable", irq, val, hpc, ionode + 4, hose);
|
||||
printf("kn8ae_%s_intr: ihv %x imsk 0x%x hpc %d TLSB node %d hose %d\n",
|
||||
onoff? "enable" : "disable", ihv, val, hpc, ionode + 4, hose);
|
||||
#endif
|
||||
s = splhigh();
|
||||
REGVAL(PCIA_IMASK(hpc) + paddr) = val;
|
||||
|
|
|
@ -1,4 +1,33 @@
|
|||
/* $NetBSD: pci_machdep.c,v 1.24 2019/08/09 08:04:16 rin Exp $ */
|
||||
/* $NetBSD: pci_machdep.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2020 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -33,7 +62,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.24 2019/08/09 08:04:16 rin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -129,3 +158,281 @@ device_pci_register(device_t dev, void *aux)
|
|||
prop_dictionary_set_bool(dict, "is_console", true);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
alpha_pci_generic_intr_map(const struct pci_attach_args * const pa,
|
||||
pci_intr_handle_t * const ihp)
|
||||
{
|
||||
pcitag_t const bustag = pa->pa_intrtag;
|
||||
int const buspin = pa->pa_intrpin;
|
||||
int const line = pa->pa_intrline;
|
||||
pci_chipset_tag_t const pc = pa->pa_pc;
|
||||
int bus, device, function;
|
||||
|
||||
if (buspin == 0) {
|
||||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("%s: bad interrupt pin %d\n", __func__, buspin);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pci_decompose_tag(pc, bustag, &bus, &device, &function);
|
||||
|
||||
/*
|
||||
* The console firmware places the interrupt mapping in the "line"
|
||||
* value. A valaue of (char)-1 indicates there is no mapping.
|
||||
*/
|
||||
if (line == 0xff) {
|
||||
printf("%s: no mapping for %d/%d/%d\n", __func__,
|
||||
bus, device, function);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (line < 0 || line >= pc->pc_nirq) {
|
||||
printf("%s: bad line %d for %d/%d/%d\n", __func__,
|
||||
line, bus, device, function);
|
||||
return 1;
|
||||
}
|
||||
|
||||
alpha_pci_intr_handle_init(ihp, line, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
alpha_pci_generic_intr_string(pci_chipset_tag_t const pc,
|
||||
pci_intr_handle_t const ih, char * const buf, size_t const len)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
KASSERT(irq < pc->pc_nirq);
|
||||
|
||||
snprintf(buf, len, "%s %u", pc->pc_intr_desc, irq);
|
||||
return buf;
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
alpha_pci_generic_intr_evcnt(pci_chipset_tag_t const pc,
|
||||
pci_intr_handle_t const ih)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
KASSERT(irq < pc->pc_nirq);
|
||||
|
||||
return alpha_shared_intr_evcnt(pc->pc_shared_intrs, irq);
|
||||
}
|
||||
|
||||
void *
|
||||
alpha_pci_generic_intr_establish(pci_chipset_tag_t const pc,
|
||||
pci_intr_handle_t const ih, int const level,
|
||||
int (*func)(void *), void *arg)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
void *cookie;
|
||||
|
||||
KASSERT(irq < pc->pc_nirq);
|
||||
|
||||
cookie = alpha_shared_intr_establish(pc->pc_shared_intrs,
|
||||
irq, IST_LEVEL, level, flags, func, arg, pc->pc_intr_desc);
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(pc->pc_shared_intrs, irq)) {
|
||||
scb_set(pc->pc_vecbase + SCB_IDXTOVEC(irq),
|
||||
alpha_pci_generic_iointr, pc);
|
||||
pc->pc_intr_enable(pc, irq);
|
||||
}
|
||||
return cookie;
|
||||
}
|
||||
|
||||
void
|
||||
alpha_pci_generic_intr_disestablish(pci_chipset_tag_t const pc,
|
||||
void * const cookie)
|
||||
{
|
||||
struct alpha_shared_intrhand * const ih = cookie;
|
||||
const u_int irq = ih->ih_num;
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
alpha_shared_intr_disestablish(pc->pc_shared_intrs, cookie,
|
||||
pc->pc_intr_desc);
|
||||
if (alpha_shared_intr_isactive(pc->pc_shared_intrs, irq) == 0) {
|
||||
pc->pc_intr_disable(pc, irq);
|
||||
alpha_shared_intr_set_dfltsharetype(pc->pc_shared_intrs,
|
||||
irq, IST_NONE);
|
||||
scb_free(pc->pc_vecbase + SCB_IDXTOVEC(irq));
|
||||
}
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
alpha_pci_generic_iointr(void * const arg, unsigned long const vec)
|
||||
{
|
||||
pci_chipset_tag_t const pc = arg;
|
||||
const u_int irq = SCB_VECTOIDX(vec - pc->pc_vecbase);
|
||||
|
||||
if (!alpha_shared_intr_dispatch(pc->pc_shared_intrs, irq)) {
|
||||
alpha_shared_intr_stray(pc->pc_shared_intrs, irq,
|
||||
pc->pc_intr_desc);
|
||||
if (ALPHA_SHARED_INTR_DISABLE(pc->pc_shared_intrs, irq)) {
|
||||
pc->pc_intr_disable(pc, irq);
|
||||
}
|
||||
} else {
|
||||
alpha_shared_intr_reset_strays(pc->pc_shared_intrs, irq);
|
||||
}
|
||||
}
|
||||
|
||||
#define ALPHA_PCI_INTR_HANDLE_IRQ __BITS(0,31)
|
||||
#define ALPHA_PCI_INTR_HANDLE_FLAGS __BITS(32,63)
|
||||
|
||||
void
|
||||
alpha_pci_intr_handle_init(pci_intr_handle_t * const ihp, u_int const irq,
|
||||
u_int const flags)
|
||||
{
|
||||
ihp->value = __SHIFTIN(irq, ALPHA_PCI_INTR_HANDLE_IRQ) |
|
||||
__SHIFTIN(flags, ALPHA_PCI_INTR_HANDLE_FLAGS);
|
||||
}
|
||||
|
||||
void
|
||||
alpha_pci_intr_handle_set_irq(pci_intr_handle_t * const ihp, u_int const irq)
|
||||
{
|
||||
ihp->value = (ihp->value & ALPHA_PCI_INTR_HANDLE_FLAGS) |
|
||||
__SHIFTIN(irq, ALPHA_PCI_INTR_HANDLE_IRQ);
|
||||
}
|
||||
|
||||
u_int
|
||||
alpha_pci_intr_handle_get_irq(const pci_intr_handle_t * const ihp)
|
||||
{
|
||||
return __SHIFTOUT(ihp->value, ALPHA_PCI_INTR_HANDLE_IRQ);
|
||||
}
|
||||
|
||||
void
|
||||
alpha_pci_intr_handle_set_flags(pci_intr_handle_t * const ihp,
|
||||
u_int const flags)
|
||||
{
|
||||
ihp->value = (ihp->value & ALPHA_PCI_INTR_HANDLE_IRQ) |
|
||||
__SHIFTIN(flags, ALPHA_PCI_INTR_HANDLE_FLAGS);
|
||||
}
|
||||
|
||||
u_int
|
||||
alpha_pci_intr_handle_get_flags(const pci_intr_handle_t * const ihp)
|
||||
{
|
||||
return __SHIFTOUT(ihp->value, ALPHA_PCI_INTR_HANDLE_FLAGS);
|
||||
}
|
||||
|
||||
/*
|
||||
* MI PCI back-end entry points.
|
||||
*/
|
||||
|
||||
void
|
||||
pci_attach_hook(device_t const parent, device_t const self,
|
||||
struct pcibus_attach_args * const pba)
|
||||
{
|
||||
pci_chipset_tag_t const pc = pba->pba_pc;
|
||||
|
||||
KASSERT(pc->pc_attach_hook != NULL);
|
||||
pc->pc_attach_hook(parent, self, pba);
|
||||
}
|
||||
|
||||
int
|
||||
pci_bus_maxdevs(pci_chipset_tag_t const pc, int const busno)
|
||||
{
|
||||
KASSERT(pc->pc_bus_maxdevs != NULL);
|
||||
return pc->pc_bus_maxdevs(pc->pc_conf_v, busno);
|
||||
}
|
||||
|
||||
pcitag_t
|
||||
pci_make_tag(pci_chipset_tag_t const pc, int const bus, int const dev,
|
||||
int const func)
|
||||
{
|
||||
KASSERT(pc->pc_make_tag != NULL);
|
||||
return pc->pc_make_tag(pc->pc_conf_v, bus, dev, func);
|
||||
}
|
||||
|
||||
void
|
||||
pci_decompose_tag(pci_chipset_tag_t const pc, pcitag_t const tag,
|
||||
int * const busp, int * const devp, int * const funcp)
|
||||
{
|
||||
KASSERT(pc->pc_decompose_tag != NULL);
|
||||
pc->pc_decompose_tag(pc->pc_conf_v, tag, busp, devp, funcp);
|
||||
}
|
||||
|
||||
pcireg_t
|
||||
pci_conf_read(pci_chipset_tag_t const pc, pcitag_t const tag, int const reg)
|
||||
{
|
||||
KASSERT(pc->pc_conf_read != NULL);
|
||||
return pc->pc_conf_read(pc->pc_conf_v, tag, reg);
|
||||
}
|
||||
|
||||
void
|
||||
pci_conf_write(pci_chipset_tag_t const pc, pcitag_t const tag, int const reg,
|
||||
pcireg_t const val)
|
||||
{
|
||||
KASSERT(pc->pc_conf_write != NULL);
|
||||
pc->pc_conf_write(pc->pc_conf_v, tag, reg, val);
|
||||
}
|
||||
|
||||
int
|
||||
pci_intr_map(const struct pci_attach_args * const pa,
|
||||
pci_intr_handle_t * const ihp)
|
||||
{
|
||||
pci_chipset_tag_t const pc = pa->pa_pc;
|
||||
|
||||
KASSERT(pc->pc_intr_map != NULL);
|
||||
return pc->pc_intr_map(pa, ihp);
|
||||
}
|
||||
|
||||
const char *
|
||||
pci_intr_string(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
char * const buf, size_t const len)
|
||||
{
|
||||
KASSERT(pc->pc_intr_string != NULL);
|
||||
return pc->pc_intr_string(pc, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
pci_intr_evcnt(pci_chipset_tag_t const pc, pci_intr_handle_t const ih)
|
||||
{
|
||||
KASSERT(pc->pc_intr_evcnt != NULL);
|
||||
return pc->pc_intr_evcnt(pc, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
pci_intr_establish(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
int const ipl, int (*func)(void *), void *arg)
|
||||
{
|
||||
KASSERT(pc->pc_intr_establish != NULL);
|
||||
return pc->pc_intr_establish(pc, ih, ipl, func, arg);
|
||||
}
|
||||
|
||||
void
|
||||
pci_intr_disestablish(pci_chipset_tag_t const pc, void * const cookie)
|
||||
{
|
||||
KASSERT(pc->pc_intr_disestablish != NULL);
|
||||
pc->pc_intr_disestablish(pc, cookie);
|
||||
}
|
||||
|
||||
int
|
||||
pci_intr_setattr(pci_chipset_tag_t const pc __unused,
|
||||
pci_intr_handle_t * const ihp, int const attr, uint64_t const data)
|
||||
{
|
||||
u_int flags = alpha_pci_intr_handle_get_flags(ihp);
|
||||
|
||||
switch (attr) {
|
||||
case PCI_INTR_MPSAFE:
|
||||
if (data)
|
||||
flags |= ALPHA_INTR_MPSAFE;
|
||||
else
|
||||
flags &= ~ALPHA_INTR_MPSAFE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
alpha_pci_intr_handle_set_flags(ihp, flags);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_up1000.c,v 1.15 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: pci_up1000.c,v 1.16 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_up1000.c,v 1.15 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_up1000.c,v 1.16 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -59,16 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_up1000.c,v 1.15 2014/03/21 16:39:29 christos Exp
|
|||
|
||||
#include "sio.h"
|
||||
|
||||
int api_up1000_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
const char *api_up1000_intr_string(void *, pci_intr_handle_t, char *, size_t);
|
||||
const struct evcnt *api_up1000_intr_evcnt(void *, pci_intr_handle_t);
|
||||
void *api_up1000_intr_establish(void *, pci_intr_handle_t,
|
||||
int, int (*func)(void *), void *);
|
||||
void api_up1000_intr_disestablish(void *, void *);
|
||||
|
||||
void *api_up1000_pciide_compat_intr_establish(void *, device_t,
|
||||
const struct pci_attach_args *, int, int (*)(void *), void *);
|
||||
static int api_up1000_intr_map(const struct pci_attach_args *,
|
||||
pci_intr_handle_t *);
|
||||
|
||||
void
|
||||
pci_up1000_pickintr(struct irongate_config *icp)
|
||||
|
@ -79,13 +71,13 @@ pci_up1000_pickintr(struct irongate_config *icp)
|
|||
|
||||
pc->pc_intr_v = icp;
|
||||
pc->pc_intr_map = api_up1000_intr_map;
|
||||
pc->pc_intr_string = api_up1000_intr_string;
|
||||
pc->pc_intr_evcnt = api_up1000_intr_evcnt;
|
||||
pc->pc_intr_establish = api_up1000_intr_establish;
|
||||
pc->pc_intr_disestablish = api_up1000_intr_disestablish;
|
||||
pc->pc_intr_string = sio_pci_intr_string;
|
||||
pc->pc_intr_evcnt = sio_pci_intr_evcnt;
|
||||
pc->pc_intr_establish = sio_pci_intr_establish;
|
||||
pc->pc_intr_disestablish = sio_pci_intr_disestablish;
|
||||
|
||||
pc->pc_pciide_compat_intr_establish =
|
||||
api_up1000_pciide_compat_intr_establish;
|
||||
sio_pciide_compat_intr_establish;
|
||||
|
||||
sio_intr_setup(pc, iot);
|
||||
#else
|
||||
|
@ -93,7 +85,7 @@ pci_up1000_pickintr(struct irongate_config *icp)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
api_up1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
|
@ -106,9 +98,8 @@ api_up1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
/* No IRQ used. */
|
||||
return 1;
|
||||
}
|
||||
if (buspin > 4) {
|
||||
printf("api_up1000_intr_map: bad interrupt pin %d\n",
|
||||
buspin);
|
||||
if (buspin < 0 || buspin > 4) {
|
||||
printf("%s: bad interrupt pin %d\n", __func__, buspin);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -119,94 +110,20 @@ api_up1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
|||
* A value of (char)-1 indicates there is no mapping.
|
||||
*/
|
||||
if (line == 0xff) {
|
||||
printf("api_up1000_intr_map: no mapping for %d/%d/%d\n",
|
||||
printf("%s: no mapping for %d/%d/%d\n", __func__,
|
||||
bus, device, function);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* XXX Check for 0? */
|
||||
if (line > 15) {
|
||||
printf("api_up1000_intr_map: ISA IRQ too large (%d)\n",
|
||||
line);
|
||||
if (line < 0 || line > 15) {
|
||||
printf("%s: bad ISA IRQ (%d)\n", __func__, line);
|
||||
return (1);
|
||||
}
|
||||
if (line == 2) {
|
||||
printf("api_up1000_intr_map: changed IRQ 2 to IRQ 9\n");
|
||||
printf("%s: changed IRQ 2 to IRQ 9\n", __func__);
|
||||
line = 9;
|
||||
}
|
||||
|
||||
*ihp = line;
|
||||
alpha_pci_intr_handle_init(ihp, line, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
api_up1000_intr_string(void *icv, pci_intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if 0
|
||||
struct irongate_config *icp = icv;
|
||||
#endif
|
||||
|
||||
return sio_intr_string(NULL /*XXX*/, ih, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
api_up1000_intr_evcnt(void *icv, pci_intr_handle_t ih)
|
||||
{
|
||||
#if 0
|
||||
struct irongate_config *icp = icv;
|
||||
#endif
|
||||
|
||||
return sio_intr_evcnt(NULL /*XXX*/, ih);
|
||||
}
|
||||
|
||||
void *
|
||||
api_up1000_intr_establish(void *icv, pci_intr_handle_t ih, int level,
|
||||
int (*func)(void *), void *arg)
|
||||
{
|
||||
#if 0
|
||||
struct irongate_config *icp = icv;
|
||||
#endif
|
||||
|
||||
return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
|
||||
arg);
|
||||
}
|
||||
|
||||
void
|
||||
api_up1000_intr_disestablish(void *icv, void *cookie)
|
||||
{
|
||||
#if 0
|
||||
struct irongate_config *icp = icv;
|
||||
#endif
|
||||
|
||||
sio_intr_disestablish(NULL /*XXX*/, cookie);
|
||||
}
|
||||
|
||||
void *
|
||||
api_up1000_pciide_compat_intr_establish(void *icv, device_t dev,
|
||||
const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
|
||||
{
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
void *cookie = NULL;
|
||||
int bus, irq;
|
||||
char buf[64];
|
||||
|
||||
pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
|
||||
|
||||
/*
|
||||
* If this isn't PCI bus #0, all bets are off.
|
||||
*/
|
||||
if (bus != 0)
|
||||
return (NULL);
|
||||
|
||||
irq = PCIIDE_COMPAT_IRQ(chan);
|
||||
#if NSIO
|
||||
cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
|
||||
func, arg);
|
||||
if (cookie == NULL)
|
||||
return (NULL);
|
||||
aprint_normal_dev(dev, "%s channel interrupting at %s\n",
|
||||
PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq, buf,
|
||||
sizeof(buf)));
|
||||
#endif
|
||||
return (cookie);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pciide_machdep.c,v 1.5 2011/04/04 20:37:45 dyoung Exp $ */
|
||||
/* $NetBSD: pciide_machdep.c,v 1.6 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.5 2011/04/04 20:37:45 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.6 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -61,6 +61,8 @@ pciide_machdep_compat_intr_establish(device_t dev,
|
|||
{
|
||||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
|
||||
return (alpha_pciide_compat_intr_establish(pc, dev, pa, chan,
|
||||
func, arg));
|
||||
if (pc->pc_pciide_compat_intr_establish == NULL)
|
||||
return NULL;
|
||||
|
||||
return pc->pc_pciide_compat_intr_establish(dev, pa, chan, func, arg);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sio.c,v 1.52 2012/02/06 02:14:15 matt Exp $ */
|
||||
/* $NetBSD: sio.c,v 1.53 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.52 2012/02/06 02:14:15 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.53 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -229,7 +229,7 @@ sio_bridge_callback(device_t self)
|
|||
ec.ec_intr_map = sio_eisa_intr_map;
|
||||
ec.ec_intr_string = sio_intr_string;
|
||||
ec.ec_intr_evcnt = sio_intr_evcnt;
|
||||
ec.ec_intr_establish = sio_intr_establish;
|
||||
ec.ec_intr_establish = sio_isa_intr_establish;
|
||||
ec.ec_intr_disestablish = sio_intr_disestablish;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ sio_bridge_callback(device_t self)
|
|||
#endif
|
||||
default:
|
||||
sc->sc_ic->ic_intr_evcnt = sio_intr_evcnt;
|
||||
sc->sc_ic->ic_intr_establish = sio_intr_establish;
|
||||
sc->sc_ic->ic_intr_establish = sio_isa_intr_establish;
|
||||
sc->sc_ic->ic_intr_disestablish = sio_intr_disestablish;
|
||||
sc->sc_ic->ic_intr_alloc = sio_intr_alloc;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: sio_pic.c,v 1.43 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: sio_pic.c,v 1.44 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1998, 2000, 2020 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.43 2014/03/21 16:39:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.44 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -74,6 +74,9 @@ __KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.43 2014/03/21 16:39:29 christos Exp $"
|
|||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
|
||||
#include <dev/pci/pciidereg.h>
|
||||
#include <dev/pci/pciidevar.h>
|
||||
|
||||
#include <dev/pci/cy82c693reg.h>
|
||||
#include <dev/pci/cy82c693var.h>
|
||||
|
||||
|
@ -433,20 +436,20 @@ sio_intr_evcnt(void *v, int irq)
|
|||
}
|
||||
|
||||
void *
|
||||
sio_intr_establish(void *v, int irq, int type, int level, int (*fn)(void *), void *arg)
|
||||
sio_intr_establish(void *v, int irq, int type, int level, int flags,
|
||||
int (*fn)(void *), void *arg)
|
||||
{
|
||||
void *cookie;
|
||||
|
||||
if (irq > ICU_LEN || type == IST_NONE)
|
||||
panic("sio_intr_establish: bogus irq or type");
|
||||
|
||||
cookie = alpha_shared_intr_establish(sio_intr, irq, type, level, fn,
|
||||
arg, "isa irq");
|
||||
cookie = alpha_shared_intr_establish(sio_intr, irq, type, level,
|
||||
flags, fn, arg, "isa irq");
|
||||
|
||||
if (cookie != NULL &&
|
||||
alpha_shared_intr_firstactive(sio_intr, irq)) {
|
||||
scb_set(0x800 + SCB_IDXTOVEC(irq), sio_iointr, NULL,
|
||||
level);
|
||||
scb_set(0x800 + SCB_IDXTOVEC(irq), sio_iointr, NULL);
|
||||
sio_setirqstat(irq, 1,
|
||||
alpha_shared_intr_get_sharetype(sio_intr, irq));
|
||||
}
|
||||
|
@ -503,6 +506,79 @@ sio_intr_disestablish(void *v, void *cookie)
|
|||
splx(s);
|
||||
}
|
||||
|
||||
const char *
|
||||
sio_pci_intr_string(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
|
||||
char * const buf, size_t const len)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
return sio_intr_string(NULL /*XXX*/, irq, buf, len);
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
sio_pci_intr_evcnt(pci_chipset_tag_t const pc, pci_intr_handle_t const ih)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
|
||||
return sio_intr_evcnt(NULL /*XXX*/, irq);
|
||||
}
|
||||
|
||||
void *
|
||||
sio_pci_intr_establish(pci_chipset_tag_t const pc, pci_intr_handle_t ih,
|
||||
int const level, int (*func)(void *), void *arg)
|
||||
{
|
||||
const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
|
||||
const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
|
||||
|
||||
return sio_intr_establish(NULL /*XXX*/, irq, IST_LEVEL, level, flags,
|
||||
func, arg);
|
||||
}
|
||||
|
||||
void
|
||||
sio_pci_intr_disestablish(pci_chipset_tag_t const pc, void *cookie)
|
||||
{
|
||||
sio_intr_disestablish(NULL /*XXX*/, cookie);
|
||||
}
|
||||
|
||||
void *
|
||||
sio_pciide_compat_intr_establish(device_t const dev,
|
||||
const struct pci_attach_args * const pa,
|
||||
int const chan, int (*func)(void *), void *arg)
|
||||
{
|
||||
pci_chipset_tag_t const pc = pa->pa_pc;
|
||||
void *cookie;
|
||||
int bus, irq;
|
||||
char buf[64];
|
||||
int flags = 0; /* XXX How to pass MPSAFE? */
|
||||
|
||||
pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
|
||||
|
||||
/*
|
||||
* If this isn't PCI bus #0, all bets are off.
|
||||
*/
|
||||
if (bus != 0)
|
||||
return NULL;
|
||||
|
||||
irq = PCIIDE_COMPAT_IRQ(chan);
|
||||
cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
|
||||
flags, func, arg);
|
||||
if (cookie == NULL)
|
||||
return NULL;
|
||||
|
||||
aprint_normal_dev(dev, "%s channel interrupting at %s\n",
|
||||
PCIIDE_CHANNEL_NAME(chan),
|
||||
sio_intr_string(NULL /*XXX*/, irq, buf, sizeof(buf)));
|
||||
|
||||
return cookie;
|
||||
}
|
||||
|
||||
void *
|
||||
sio_isa_intr_establish(void *v, int irq, int type, int level,
|
||||
int (*fn)(void *), void *arg)
|
||||
{
|
||||
return sio_intr_establish(v, irq, type, level, 0, fn, arg);
|
||||
}
|
||||
|
||||
void
|
||||
sio_iointr(void *arg, unsigned long vec)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siovar.h,v 1.12 2014/03/21 16:39:29 christos Exp $ */
|
||||
/* $NetBSD: siovar.h,v 1.13 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -32,7 +32,19 @@ void sio_iointr(void *framep, unsigned long vec);
|
|||
|
||||
const char *sio_intr_string(void *, int, char *, size_t);
|
||||
const struct evcnt *sio_intr_evcnt(void *, int);
|
||||
void *sio_intr_establish(void *, int, int, int, int (*)(void *),
|
||||
void *sio_intr_establish(void *, int, int, int, int, int (*)(void *),
|
||||
void *);
|
||||
void sio_intr_disestablish(void *, void *);
|
||||
int sio_intr_alloc(void *, int, int, int *);
|
||||
|
||||
const char *sio_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
char *, size_t);
|
||||
const struct evcnt *sio_pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
|
||||
void *sio_pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
int, int (*)(void *), void *);
|
||||
void sio_pci_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
|
||||
void *sio_pciide_compat_intr_establish(device_t,
|
||||
const struct pci_attach_args *, int, int (*)(void *), void *);
|
||||
|
||||
void *sio_isa_intr_establish(void *, int, int, int, int (*)(void *), void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ttwogavar.h,v 1.5 2020/06/17 03:50:04 thorpej Exp $ */
|
||||
/* $NetBSD: ttwogavar.h,v 1.6 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -88,7 +88,6 @@ struct ttwoga_config {
|
|||
struct extent *tc_io_ex, *tc_d_mem_ex, *tc_s_mem_ex;
|
||||
int tc_mallocsafe;
|
||||
|
||||
u_long tc_vecbase;
|
||||
struct alpha_shared_intr *tc_intrtab;
|
||||
|
||||
void (*tc_enable_intr)(struct ttwoga_config *, int, int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: com_sableio.c,v 1.14 2018/12/08 17:46:09 thorpej Exp $ */
|
||||
/* $NetBSD: com_sableio.c,v 1.15 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_sableio.c,v 1.14 2018/12/08 17:46:09 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_sableio.c,v 1.15 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -92,6 +92,7 @@ com_sableio_attach(device_t parent, device_t self, void *aux)
|
|||
const char *intrstr;
|
||||
char buf[PCI_INTRSTR_LEN];
|
||||
bus_space_handle_t ioh;
|
||||
pci_intr_handle_t ih;
|
||||
|
||||
sc->sc_dev = self;
|
||||
if (com_is_console(sa->sa_iot, sa->sa_ioaddr, &ioh) == 0 &&
|
||||
|
@ -106,10 +107,11 @@ com_sableio_attach(device_t parent, device_t self, void *aux)
|
|||
|
||||
com_attach_subr(sc);
|
||||
|
||||
intrstr = pci_intr_string(sa->sa_pc, sa->sa_sableirq[0],
|
||||
buf, sizeof(buf));
|
||||
ssc->sc_ih = pci_intr_establish(sa->sa_pc, sa->sa_sableirq[0],
|
||||
IPL_SERIAL, comintr, sc);
|
||||
alpha_pci_intr_handle_init(&ih, sa->sa_sableirq[0], 0);
|
||||
|
||||
intrstr = pci_intr_string(sa->sa_pc, ih, buf, sizeof(buf));
|
||||
ssc->sc_ih = pci_intr_establish(sa->sa_pc, ih, IPL_SERIAL,
|
||||
comintr, sc);
|
||||
if (ssc->sc_ih == NULL) {
|
||||
aprint_error_dev(self, "unable to establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fdc_sableio.c,v 1.15 2015/04/13 21:18:40 riastradh Exp $ */
|
||||
/* $NetBSD: fdc_sableio.c,v 1.16 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdc_sableio.c,v 1.15 2015/04/13 21:18:40 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdc_sableio.c,v 1.16 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -84,6 +84,7 @@ fdc_sableio_attach(device_t parent, device_t self, void *aux)
|
|||
struct sableio_attach_args *sa = aux;
|
||||
const char *intrstr;
|
||||
char buf[PCI_INTRSTR_LEN];
|
||||
pci_intr_handle_t ih;
|
||||
|
||||
aprint_normal("\n");
|
||||
|
||||
|
@ -110,10 +111,11 @@ fdc_sableio_attach(device_t parent, device_t self, void *aux)
|
|||
return;
|
||||
}
|
||||
|
||||
intrstr = pci_intr_string(sa->sa_pc, sa->sa_sableirq[0],
|
||||
buf, sizeof(buf));
|
||||
fdc->sc_ih = pci_intr_establish(sa->sa_pc, sa->sa_sableirq[0],
|
||||
IPL_BIO, fdcintr, fdc);
|
||||
alpha_pci_intr_handle_init(&ih, sa->sa_sableirq[0], 0);
|
||||
|
||||
intrstr = pci_intr_string(sa->sa_pc, ih, buf, sizeof(buf));
|
||||
fdc->sc_ih = pci_intr_establish(sa->sa_pc, ih, IPL_BIO,
|
||||
fdcintr, fdc);
|
||||
if (fdc->sc_ih == NULL) {
|
||||
aprint_error_dev(self, "unable to establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lpt_sableio.c,v 1.10 2014/03/29 19:28:25 christos Exp $ */
|
||||
/* $NetBSD: lpt_sableio.c,v 1.11 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: lpt_sableio.c,v 1.10 2014/03/29 19:28:25 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lpt_sableio.c,v 1.11 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -91,6 +91,7 @@ lpt_sableio_attach(device_t parent, device_t self, void *aux)
|
|||
struct sableio_attach_args *sa = aux;
|
||||
const char *intrstr;
|
||||
char buf[PCI_INTRSTR_LEN];
|
||||
pci_intr_handle_t ih;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_iot = sa->sa_iot;
|
||||
|
@ -106,10 +107,10 @@ lpt_sableio_attach(device_t parent, device_t self, void *aux)
|
|||
|
||||
lpt_attach_subr(sc);
|
||||
|
||||
intrstr = pci_intr_string(sa->sa_pc, sa->sa_sableirq[0],
|
||||
buf, sizeof(buf));
|
||||
ssc->sc_ih = pci_intr_establish(sa->sa_pc, sa->sa_sableirq[0],
|
||||
IPL_TTY, lptintr, sc);
|
||||
alpha_pci_intr_handle_init(&ih, sa->sa_sableirq[0], 0);
|
||||
|
||||
intrstr = pci_intr_string(sa->sa_pc, ih, buf, sizeof(buf));
|
||||
ssc->sc_ih = pci_intr_establish(sa->sa_pc, ih, IPL_TTY, lptintr, sc);
|
||||
if (ssc->sc_ih == NULL) {
|
||||
aprint_error_dev(self, "unable to establish interrupt");
|
||||
if (intrstr != NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbc_sableio.c,v 1.12 2014/03/29 19:28:25 christos Exp $ */
|
||||
/* $NetBSD: pckbc_sableio.c,v 1.13 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pckbc_sableio.c,v 1.12 2014/03/29 19:28:25 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pckbc_sableio.c,v 1.13 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -136,10 +136,13 @@ pckbc_sableio_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
|
|||
struct pckbc_sableio_softc *ssc = (void *) sc;
|
||||
const char *intrstr;
|
||||
char buf[PCI_INTRSTR_LEN];
|
||||
pci_intr_handle_t ih;
|
||||
|
||||
intrstr = pci_intr_string(ssc->sc_pc, ssc->sc_irq[slot], buf,
|
||||
alpha_pci_intr_handle_init(&ih, ssc->sc_irq[slot], 0);
|
||||
|
||||
intrstr = pci_intr_string(ssc->sc_pc, ih, buf,
|
||||
sizeof(buf));
|
||||
ssc->sc_ih[slot] = pci_intr_establish(ssc->sc_pc, ssc->sc_irq[slot],
|
||||
ssc->sc_ih[slot] = pci_intr_establish(ssc->sc_pc, ih,
|
||||
IPL_TTY, pckbcintr, sc);
|
||||
if (ssc->sc_ih[slot] == NULL) {
|
||||
aprint_error_dev(sc->sc_dv,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tc_3000_300.c,v 1.35 2020/09/05 16:29:08 thorpej Exp $ */
|
||||
/* $NetBSD: tc_3000_300.c,v 1.36 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.35 2020/09/05 16:29:08 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.36 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -205,6 +205,8 @@ tc_3000_300_iointr(void *arg, unsigned long vec)
|
|||
uint32_t tcir, ioasicir, ioasicimr;
|
||||
int ifound;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
int s;
|
||||
if (vec != 0x800)
|
||||
|
@ -273,6 +275,8 @@ tc_3000_300_iointr(void *arg, unsigned long vec)
|
|||
#undef PRINTINTR
|
||||
#endif
|
||||
} while (ifound);
|
||||
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
||||
#if NWSDISPLAY > 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tc_3000_500.c,v 1.34 2020/09/05 16:29:08 thorpej Exp $ */
|
||||
/* $NetBSD: tc_3000_500.c,v 1.35 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.34 2020/09/05 16:29:08 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.35 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -209,6 +209,8 @@ tc_3000_500_iointr(void *arg, unsigned long vec)
|
|||
uint32_t ir;
|
||||
int ifound;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
int s;
|
||||
if (vec != 0x800)
|
||||
|
@ -271,6 +273,8 @@ tc_3000_500_iointr(void *arg, unsigned long vec)
|
|||
#undef PRINTINTR
|
||||
#endif
|
||||
} while (ifound);
|
||||
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
||||
#if NWSDISPLAY > 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tcasic.c,v 1.47 2017/06/22 16:46:52 flxd Exp $ */
|
||||
/* $NetBSD: tcasic.c,v 1.48 2020/09/22 15:24:02 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.47 2017/06/22 16:46:52 flxd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.48 2020/09/22 15:24:02 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -145,7 +145,7 @@ tcasicattach(device_t parent, device_t self, void *aux)
|
|||
(*intr_setup)();
|
||||
|
||||
/* They all come in at 0x800. */
|
||||
scb_set(0x800, iointr, NULL, IPL_VM);
|
||||
scb_set(0x800, iointr, NULL);
|
||||
|
||||
config_found(self, &tba, tcasicprint);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue