add intr_handle_t and let pci_intr_handle_t use it.
This commit is contained in:
parent
c65d622dea
commit
83fd2fa11c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: i82093var.h,v 1.12 2012/06/15 13:55:22 yamt Exp $ */
|
||||
/* $NetBSD: i82093var.h,v 1.13 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
@ -71,20 +71,20 @@ struct ioapic_softc {
|
||||
* 0x80000000 is used by pci_intr_machdep.c for MPSAFE_MASK
|
||||
*/
|
||||
|
||||
#define APIC_INT_VIA_APIC 0x10000000
|
||||
#define APIC_INT_APIC_MASK 0x00ff0000
|
||||
#define APIC_INT_VIA_APIC 0x10000000ULL
|
||||
#define APIC_INT_APIC_MASK 0x00ff0000ULL
|
||||
#define APIC_INT_APIC_SHIFT 16
|
||||
#define APIC_INT_PIN_MASK 0x0000ff00
|
||||
#define APIC_INT_PIN_MASK 0x0000ff00ULL
|
||||
#define APIC_INT_PIN_SHIFT 8
|
||||
|
||||
#define APIC_IRQ_APIC(x) ((x & APIC_INT_APIC_MASK) >> APIC_INT_APIC_SHIFT)
|
||||
#define APIC_IRQ_PIN(x) ((x & APIC_INT_PIN_MASK) >> APIC_INT_PIN_SHIFT)
|
||||
#define APIC_IRQ_ISLEGACY(x) (!((x) & APIC_INT_VIA_APIC))
|
||||
#define APIC_IRQ_LEGACY_IRQ(x) ((x) & 0xff)
|
||||
#define APIC_IRQ_APIC(x) (int)(((x) & APIC_INT_APIC_MASK) >> APIC_INT_APIC_SHIFT)
|
||||
#define APIC_IRQ_PIN(x) (int)(((x) & APIC_INT_PIN_MASK) >> APIC_INT_PIN_SHIFT)
|
||||
#define APIC_IRQ_ISLEGACY(x) (bool)(!((x) & APIC_INT_VIA_APIC))
|
||||
#define APIC_IRQ_LEGACY_IRQ(x) (int)((x) & 0xff)
|
||||
|
||||
void ioapic_print_redir(struct ioapic_softc *, const char *, int);
|
||||
void ioapic_format_redir(char *, const char *, int, uint32_t, uint32_t);
|
||||
struct ioapic_softc *ioapic_find(int);
|
||||
struct ioapic_softc *ioapic_find(intr_handle_t);
|
||||
struct ioapic_softc *ioapic_find_bybase(int);
|
||||
|
||||
void ioapic_enable(void);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: intr.h,v 1.46 2015/04/27 06:42:52 knakahara Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.47 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -181,14 +181,16 @@ struct cpu_info;
|
||||
|
||||
struct pcibus_attach_args;
|
||||
|
||||
typedef uint64_t intr_handle_t;
|
||||
|
||||
void intr_default_setup(void);
|
||||
void x86_nmi(void);
|
||||
void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *, bool);
|
||||
void intr_disestablish(struct intrhand *);
|
||||
void intr_add_pcibus(struct pcibus_attach_args *);
|
||||
const char *intr_string(int, char *, size_t);
|
||||
const char *intr_string(intr_handle_t, char *, size_t);
|
||||
void cpu_intr_init(struct cpu_info *);
|
||||
int intr_find_mpmapping(int, int, int *);
|
||||
int intr_find_mpmapping(int, int, intr_handle_t *);
|
||||
struct pic *intr_findpic(int);
|
||||
void intr_printconfig(void);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mpconfig.h,v 1.14 2012/06/15 13:57:59 yamt Exp $ */
|
||||
/* $NetBSD: mpconfig.h,v 1.15 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*
|
||||
* Definitions originally from the mpbios code, but now used for ACPI
|
||||
@ -60,7 +60,7 @@ struct mp_intr_map
|
||||
int bus_pin;
|
||||
struct pic *ioapic; /* NULL for local apic */
|
||||
int ioapic_pin;
|
||||
int ioapic_ih; /* int handle, see i82093var.h for encoding */
|
||||
intr_handle_t ioapic_ih; /* int handle, see i82093var.h for encoding */
|
||||
int type; /* from mp spec intr record */
|
||||
int flags; /* from mp spec intr record */
|
||||
uint32_t redir;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pci_machdep.h,v 1.16 2015/04/27 06:42:52 knakahara Exp $ */
|
||||
/* $NetBSD: pci_machdep.h,v 1.17 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
@ -33,13 +33,15 @@
|
||||
#ifndef _X86_PCI_MACHDEP_H_
|
||||
#define _X86_PCI_MACHDEP_H_
|
||||
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <x86/intr_distribute.h>
|
||||
|
||||
/*
|
||||
* Types provided to machine-independent PCI code
|
||||
* See also i82093var.h to find out pci_intr_handle_t's bitfield.
|
||||
*/
|
||||
typedef int pci_intr_handle_t;
|
||||
typedef intr_handle_t pci_intr_handle_t;
|
||||
|
||||
#include <x86/pci_machdep_common.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: isa_machdep.c,v 1.32 2012/02/28 20:26:37 mbalmer Exp $ */
|
||||
/* $NetBSD: isa_machdep.c,v 1.33 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.32 2012/02/28 20:26:37 mbalmer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.33 2015/04/27 06:51:40 knakahara Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -203,7 +203,7 @@ isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level,
|
||||
struct pic *pic;
|
||||
int pin;
|
||||
#if NIOAPIC > 0
|
||||
int mpih;
|
||||
intr_handle_t mpih;
|
||||
struct ioapic_softc *ioapic;
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pci_intr_machdep.c,v 1.28 2015/04/27 06:42:52 knakahara Exp $ */
|
||||
/* $NetBSD: pci_intr_machdep.c,v 1.29 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
|
||||
@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.28 2015/04/27 06:42:52 knakahara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.29 2015/04/27 06:51:40 knakahara Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -117,11 +117,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.28 2015/04/27 06:42:52 knakah
|
||||
int
|
||||
pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
int pin = pa->pa_intrpin;
|
||||
int line = pa->pa_intrline;
|
||||
pci_intr_pin_t pin = pa->pa_intrpin;
|
||||
pci_intr_line_t line = pa->pa_intrline;
|
||||
pci_chipset_tag_t ipc, pc = pa->pa_pc;
|
||||
#if NIOAPIC > 0 || NACPICA > 0
|
||||
int rawpin = pa->pa_rawintrpin;
|
||||
pci_intr_pin_t rawpin = pa->pa_rawintrpin;
|
||||
int bus, dev, func;
|
||||
#endif
|
||||
|
||||
@ -292,7 +292,7 @@ pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih,
|
||||
}
|
||||
|
||||
pic = &i8259_pic;
|
||||
pin = irq = (ih & ~MPSAFE_MASK);
|
||||
pin = irq = APIC_IRQ_LEGACY_IRQ(ih);
|
||||
mpsafe = ((ih & MPSAFE_MASK) != 0);
|
||||
|
||||
#if NIOAPIC > 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pciide_machdep.c,v 1.13 2014/05/12 11:55:39 joerg Exp $ */
|
||||
/* $NetBSD: pciide_machdep.c,v 1.14 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.13 2014/05/12 11:55:39 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.14 2015/04/27 06:51:40 knakahara Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -69,7 +69,7 @@ pciide_machdep_compat_intr_establish(device_t dev,
|
||||
int irq;
|
||||
void *cookie;
|
||||
#if NIOAPIC > 0
|
||||
int mpih;
|
||||
intr_handle_t mpih;
|
||||
char buf[PCI_INTRSTR_LEN];
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: intr.c,v 1.79 2015/04/27 06:42:52 knakahara Exp $ */
|
||||
/* $NetBSD: intr.c,v 1.80 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -133,7 +133,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.79 2015/04/27 06:42:52 knakahara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.80 2015/04/27 06:51:40 knakahara Exp $");
|
||||
|
||||
#include "opt_intrdebug.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -200,7 +200,7 @@ static SIMPLEQ_HEAD(, intrsource) io_interrupt_sources =
|
||||
SIMPLEQ_HEAD_INITIALIZER(io_interrupt_sources);
|
||||
|
||||
#if NIOAPIC > 0 || NACPICA > 0
|
||||
static int intr_scan_bus(int, int, int *);
|
||||
static int intr_scan_bus(int, int, intr_handle_t *);
|
||||
#if NPCI > 0
|
||||
static int intr_find_pcibridge(int, pcitag_t *, pci_chipset_tag_t *);
|
||||
#endif
|
||||
@ -401,7 +401,7 @@ intr_find_pcibridge(int bus, pcitag_t *pci_bridge_tag,
|
||||
* 'pin' argument pci bus_pin encoding of a device/pin combination.
|
||||
*/
|
||||
int
|
||||
intr_find_mpmapping(int bus, int pin, int *handle)
|
||||
intr_find_mpmapping(int bus, int pin, intr_handle_t *handle)
|
||||
{
|
||||
|
||||
#if NPCI > 0
|
||||
@ -425,7 +425,7 @@ intr_find_mpmapping(int bus, int pin, int *handle)
|
||||
}
|
||||
|
||||
static int
|
||||
intr_scan_bus(int bus, int pin, int *handle)
|
||||
intr_scan_bus(int bus, int pin, intr_handle_t *handle)
|
||||
{
|
||||
struct mp_intr_map *mip, *intrs;
|
||||
|
||||
@ -1131,14 +1131,14 @@ legacy_intr_string(int ih, char *buf, size_t len, struct pic *pic)
|
||||
}
|
||||
|
||||
const char *
|
||||
intr_string(int ih, char *buf, size_t len)
|
||||
intr_string(intr_handle_t ih, char *buf, size_t len)
|
||||
{
|
||||
#if NIOAPIC > 0
|
||||
struct ioapic_softc *pic;
|
||||
#endif
|
||||
|
||||
if (ih == 0)
|
||||
panic("%s: bogus handle 0x%x", __func__, ih);
|
||||
panic("%s: bogus handle 0x%" PRIx64, __func__, ih);
|
||||
|
||||
#if NIOAPIC > 0
|
||||
if (ih & APIC_INT_VIA_APIC) {
|
||||
@ -1151,13 +1151,13 @@ intr_string(int ih, char *buf, size_t len)
|
||||
"apic %d int %d (irq %d)",
|
||||
APIC_IRQ_APIC(ih),
|
||||
APIC_IRQ_PIN(ih),
|
||||
ih&0xff);
|
||||
APIC_IRQ_LEGACY_IRQ(ih));
|
||||
}
|
||||
} else
|
||||
snprintf(buf, len, "irq %d", ih&0xff);
|
||||
snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
|
||||
#else
|
||||
|
||||
snprintf(buf, len, "irq %d", ih&0xff);
|
||||
snprintf(buf, len, "irq %d" APIC_IRQ_LEGACY_IRQ(ih));
|
||||
#endif
|
||||
return buf;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ioapic.c,v 1.48 2013/06/28 14:31:49 jakllsch Exp $ */
|
||||
/* $NetBSD: ioapic.c,v 1.49 2015/04/27 06:51:40 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
|
||||
@ -64,7 +64,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.48 2013/06/28 14:31:49 jakllsch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.49 2015/04/27 06:51:40 knakahara Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -183,7 +183,7 @@ ioapic_write(struct ioapic_softc *sc,int regid, int val)
|
||||
}
|
||||
|
||||
struct ioapic_softc *
|
||||
ioapic_find(int apicid)
|
||||
ioapic_find(intr_handle_t apicid)
|
||||
{
|
||||
struct ioapic_softc *sc;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user