Module Name: src
Committed By: knakahara
Date: Mon Apr 27 06:51:40 UTC 2015
Modified Files:
src/sys/arch/x86/include: i82093var.h intr.h mpconfig.h pci_machdep.h
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/x86/pci: pci_intr_machdep.c pciide_machdep.c
src/sys/arch/x86/x86: intr.c ioapic.c
Log Message:
add intr_handle_t and let pci_intr_handle_t use it.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/include/i82093var.h
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/include/mpconfig.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/pci_machdep.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/pci/pciide_machdep.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/x86/ioapic.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/i82093var.h
diff -u src/sys/arch/x86/include/i82093var.h:1.12 src/sys/arch/x86/include/i82093var.h:1.13
--- src/sys/arch/x86/include/i82093var.h:1.12 Fri Jun 15 13:55:22 2012
+++ src/sys/arch/x86/include/i82093var.h Mon Apr 27 06:51:40 2015
@@ -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);
Index: src/sys/arch/x86/include/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.46 src/sys/arch/x86/include/intr.h:1.47
--- src/sys/arch/x86/include/intr.h:1.46 Mon Apr 27 06:42:52 2015
+++ src/sys/arch/x86/include/intr.h Mon Apr 27 06:51:40 2015
@@ -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);
Index: src/sys/arch/x86/include/mpconfig.h
diff -u src/sys/arch/x86/include/mpconfig.h:1.14 src/sys/arch/x86/include/mpconfig.h:1.15
--- src/sys/arch/x86/include/mpconfig.h:1.14 Fri Jun 15 13:57:59 2012
+++ src/sys/arch/x86/include/mpconfig.h Mon Apr 27 06:51:40 2015
@@ -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;
Index: src/sys/arch/x86/include/pci_machdep.h
diff -u src/sys/arch/x86/include/pci_machdep.h:1.16 src/sys/arch/x86/include/pci_machdep.h:1.17
--- src/sys/arch/x86/include/pci_machdep.h:1.16 Mon Apr 27 06:42:52 2015
+++ src/sys/arch/x86/include/pci_machdep.h Mon Apr 27 06:51:40 2015
@@ -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>
Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.32 src/sys/arch/x86/isa/isa_machdep.c:1.33
--- src/sys/arch/x86/isa/isa_machdep.c:1.32 Tue Feb 28 20:26:37 2012
+++ src/sys/arch/x86/isa/isa_machdep.c Mon Apr 27 06:51:40 2015
@@ -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,
struct pic *pic;
int pin;
#if NIOAPIC > 0
- int mpih;
+ intr_handle_t mpih;
struct ioapic_softc *ioapic;
#endif
Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.28 src/sys/arch/x86/pci/pci_intr_machdep.c:1.29
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.28 Mon Apr 27 06:42:52 2015
+++ src/sys/arch/x86/pci/pci_intr_machdep.c Mon Apr 27 06:51:40 2015
@@ -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_mac
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,
}
pic = &i8259_pic;
- pin = irq = (ih & ~MPSAFE_MASK);
+ pin = irq = APIC_IRQ_LEGACY_IRQ(ih);
mpsafe = ((ih & MPSAFE_MASK) != 0);
#if NIOAPIC > 0
Index: src/sys/arch/x86/pci/pciide_machdep.c
diff -u src/sys/arch/x86/pci/pciide_machdep.c:1.13 src/sys/arch/x86/pci/pciide_machdep.c:1.14
--- src/sys/arch/x86/pci/pciide_machdep.c:1.13 Mon May 12 11:55:39 2014
+++ src/sys/arch/x86/pci/pciide_machdep.c Mon Apr 27 06:51:40 2015
@@ -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(dev
int irq;
void *cookie;
#if NIOAPIC > 0
- int mpih;
+ intr_handle_t mpih;
char buf[PCI_INTRSTR_LEN];
#endif
Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.79 src/sys/arch/x86/x86/intr.c:1.80
--- src/sys/arch/x86/x86/intr.c:1.79 Mon Apr 27 06:42:52 2015
+++ src/sys/arch/x86/x86/intr.c Mon Apr 27 06:51:40 2015
@@ -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_int
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 *p
* '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, in
}
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, si
}
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 le
"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;
Index: src/sys/arch/x86/x86/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.48 src/sys/arch/x86/x86/ioapic.c:1.49
--- src/sys/arch/x86/x86/ioapic.c:1.48 Fri Jun 28 14:31:49 2013
+++ src/sys/arch/x86/x86/ioapic.c Mon Apr 27 06:51:40 2015
@@ -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
}
struct ioapic_softc *
-ioapic_find(int apicid)
+ioapic_find(intr_handle_t apicid)
{
struct ioapic_softc *sc;