Pull up following revision(s) (requested by msaitoh in ticket #948):

sys/arch/x86/x86/mpacpi.c: revisions 1.99, 1.100
	sys/arch/x86/x86/lapic.c: revision 1.49
- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].
--
Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.
This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.
This commit is contained in:
snj 2015-08-11 05:07:16 +00:00
parent d07eef6ec5
commit f33b7c6d75
2 changed files with 42 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lapic.c,v 1.47.4.1 2015/05/22 16:53:32 snj Exp $ */ /* $NetBSD: lapic.c,v 1.47.4.2 2015/08/11 05:07:16 snj Exp $ */
/*- /*-
* Copyright (c) 2000, 2008 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.47.4.1 2015/05/22 16:53:32 snj Exp $"); __KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.47.4.2 2015/08/11 05:07:16 snj Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */ #include "opt_mpbios.h" /* for MPDEBUG */
@ -76,6 +76,8 @@ static void lapic_map(paddr_t);
static void lapic_hwmask(struct pic *, int); static void lapic_hwmask(struct pic *, int);
static void lapic_hwunmask(struct pic *, int); static void lapic_hwunmask(struct pic *, int);
static void lapic_setup(struct pic *, struct cpu_info *, int, int, int); static void lapic_setup(struct pic *, struct cpu_info *, int, int, int);
/* Make it public to call via ddb */
void lapic_dump(void);
struct pic local_pic = { struct pic local_pic = {
.pic_name = "lapic", .pic_name = "lapic",
@ -194,18 +196,8 @@ lapic_set_lvt(void)
} }
#ifdef MULTIPROCESSOR #ifdef MULTIPROCESSOR
if (mp_verbose) { if (mp_verbose)
apic_format_redir (device_xname(ci->ci_dev), "timer", 0, 0, lapic_dump();
i82489_readreg(LAPIC_LVTT));
apic_format_redir (device_xname(ci->ci_dev), "pcint", 0, 0,
i82489_readreg(LAPIC_PCINT));
apic_format_redir (device_xname(ci->ci_dev), "lint", 0, 0,
i82489_readreg(LAPIC_LVINT0));
apic_format_redir (device_xname(ci->ci_dev), "lint", 1, 0,
i82489_readreg(LAPIC_LVINT1));
apic_format_redir (device_xname(ci->ci_dev), "err", 0, 0,
i82489_readreg(LAPIC_LVERR));
}
#endif #endif
} }
@ -616,3 +608,20 @@ lapic_setup(struct pic *pic, struct cpu_info *ci,
int pin, int idtvec, int type) int pin, int idtvec, int type)
{ {
} }
void
lapic_dump(void)
{
struct cpu_info *ci = curcpu();
apic_format_redir (device_xname(ci->ci_dev), "timer", 0, 0,
i82489_readreg(LAPIC_LVTT));
apic_format_redir (device_xname(ci->ci_dev), "pcint", 0, 0,
i82489_readreg(LAPIC_PCINT));
apic_format_redir (device_xname(ci->ci_dev), "lint", 0, 0,
i82489_readreg(LAPIC_LVINT0));
apic_format_redir (device_xname(ci->ci_dev), "lint", 1, 0,
i82489_readreg(LAPIC_LVINT1));
apic_format_redir (device_xname(ci->ci_dev), "err", 0, 0,
i82489_readreg(LAPIC_LVERR));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpacpi.c,v 1.97 2013/03/25 01:30:37 chs Exp $ */ /* $NetBSD: mpacpi.c,v 1.97.10.1 2015/08/11 05:07:16 snj Exp $ */
/* /*
* Copyright (c) 2003 Wasabi Systems, Inc. * Copyright (c) 2003 Wasabi Systems, Inc.
@ -36,10 +36,11 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.97 2013/03/25 01:30:37 chs Exp $"); __KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.97.10.1 2015/08/11 05:07:16 snj Exp $");
#include "acpica.h" #include "acpica.h"
#include "opt_acpi.h" #include "opt_acpi.h"
#include "opt_ddb.h"
#include "opt_mpbios.h" #include "opt_mpbios.h"
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
#include "pchb.h" #include "pchb.h"
@ -123,6 +124,10 @@ static void mpacpi_print_isa_intr(int);
static void mpacpi_user_continue(const char *fmt, ...); static void mpacpi_user_continue(const char *fmt, ...);
#ifdef DDB
void mpacpi_dump(void);
#endif
int mpacpi_nioapic; /* number of ioapics */ int mpacpi_nioapic; /* number of ioapics */
int mpacpi_ncpu; /* number of cpus */ int mpacpi_ncpu; /* number of cpus */
int mpacpi_nintsrc; /* number of non-device interrupts */ int mpacpi_nintsrc; /* number of non-device interrupts */
@ -447,6 +452,8 @@ mpacpi_scan_apics(device_t self, int *ncpup)
mpacpi_ncpu = mpacpi_nintsrc = mpacpi_nioapic = 0; mpacpi_ncpu = mpacpi_nintsrc = mpacpi_nioapic = 0;
acpi_madt_walk(mpacpi_count, self); acpi_madt_walk(mpacpi_count, self);
acpi_madt_walk(mpacpi_config_ioapic, self);
#if NLAPIC > 0 #if NLAPIC > 0
lapic_boot_init(mpacpi_lapic_base); lapic_boot_init(mpacpi_lapic_base);
#endif #endif
@ -456,8 +463,6 @@ mpacpi_scan_apics(device_t self, int *ncpup)
if (mpacpi_ncpu == 0) if (mpacpi_ncpu == 0)
goto done; goto done;
acpi_madt_walk(mpacpi_config_ioapic, self);
#if NPCI > 0 #if NPCI > 0
/* /*
* If PCI routing tables can't be built we report failure * If PCI routing tables can't be built we report failure
@ -1080,3 +1085,13 @@ mpacpi_user_continue(const char *fmt, ...)
printf("<press any key to continue>\n>"); printf("<press any key to continue>\n>");
cngetc(); cngetc();
} }
#ifdef DDB
void
mpacpi_dump(void)
{
int i;
for (i = 0; i < mp_nintr; i++)
mpacpi_print_intr(&mp_intrs[i]);
}
#endif