Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 add intr_handle_t and let pci_intr_handle_t use...
details: https://anonhg.NetBSD.org/src/rev/f6a567a13420
branches: trunk
changeset: 337773:f6a567a13420
user: knakahara <knakahara%NetBSD.org@localhost>
date: Mon Apr 27 06:51:40 2015 +0000
description:
add intr_handle_t and let pci_intr_handle_t use it.
diffstat:
sys/arch/x86/include/i82093var.h | 18 +++++++++---------
sys/arch/x86/include/intr.h | 8 +++++---
sys/arch/x86/include/mpconfig.h | 4 ++--
sys/arch/x86/include/pci_machdep.h | 6 ++++--
sys/arch/x86/isa/isa_machdep.c | 6 +++---
sys/arch/x86/pci/pci_intr_machdep.c | 12 ++++++------
sys/arch/x86/pci/pciide_machdep.c | 6 +++---
sys/arch/x86/x86/intr.c | 20 ++++++++++----------
sys/arch/x86/x86/ioapic.c | 6 +++---
9 files changed, 45 insertions(+), 41 deletions(-)
diffs (truncated from 312 to 300 lines):
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/include/i82093var.h
--- a/sys/arch/x86/include/i82093var.h Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/include/i82093var.h Mon Apr 27 06:51:40 2015 +0000
@@ -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 @@
* 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);
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/include/intr.h
--- a/sys/arch/x86/include/intr.h Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/include/intr.h Mon Apr 27 06:51:40 2015 +0000
@@ -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 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);
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/include/mpconfig.h
--- a/sys/arch/x86/include/mpconfig.h Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/include/mpconfig.h Mon Apr 27 06:51:40 2015 +0000
@@ -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 @@
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;
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/include/pci_machdep.h
--- a/sys/arch/x86/include/pci_machdep.h Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/include/pci_machdep.h Mon Apr 27 06:51:40 2015 +0000
@@ -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>
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/isa/isa_machdep.c
--- a/sys/arch/x86/isa/isa_machdep.c Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/isa/isa_machdep.c Mon Apr 27 06:51:40 2015 +0000
@@ -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 @@
struct pic *pic;
int pin;
#if NIOAPIC > 0
- int mpih;
+ intr_handle_t mpih;
struct ioapic_softc *ioapic;
#endif
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/pci/pci_intr_machdep.c
--- a/sys/arch/x86/pci/pci_intr_machdep.c Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/pci/pci_intr_machdep.c Mon Apr 27 06:51:40 2015 +0000
@@ -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 @@
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 @@
}
pic = &i8259_pic;
- pin = irq = (ih & ~MPSAFE_MASK);
+ pin = irq = APIC_IRQ_LEGACY_IRQ(ih);
mpsafe = ((ih & MPSAFE_MASK) != 0);
#if NIOAPIC > 0
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/pci/pciide_machdep.c
--- a/sys/arch/x86/pci/pciide_machdep.c Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/pci/pciide_machdep.c Mon Apr 27 06:51:40 2015 +0000
@@ -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 @@
int irq;
void *cookie;
#if NIOAPIC > 0
- int mpih;
+ intr_handle_t mpih;
char buf[PCI_INTRSTR_LEN];
#endif
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/x86/intr.c Mon Apr 27 06:51:40 2015 +0000
@@ -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 @@
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 @@
* '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 @@
}
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 @@
}
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 @@
"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;
diff -r 7dc58ffb64dd -r f6a567a13420 sys/arch/x86/x86/ioapic.c
--- a/sys/arch/x86/x86/ioapic.c Mon Apr 27 06:42:52 2015 +0000
+++ b/sys/arch/x86/x86/ioapic.c Mon Apr 27 06:51:40 2015 +0000
@@ -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 $");
Home |
Main Index |
Thread Index |
Old Index