diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c index 7c96a3409026..b04dc6b9f539 100644 --- a/sys/arch/i386/i386/autoconf.c +++ b/sys/arch/i386/i386/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.101 2016/10/16 10:24:59 maxv Exp $ */ +/* $NetBSD: autoconf.c,v 1.102 2017/04/22 04:29:31 nonaka Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.101 2016/10/16 10:24:59 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.102 2017/04/22 04:29:31 nonaka Exp $"); #include "opt_compat_oldboot.h" #include "opt_intrdebug.h" @@ -131,6 +131,6 @@ cpu_configure(void) spl0(); #if NLAPIC > 0 - i82489_writereg(LAPIC_TPRI, 0); + lapic_write_tpri(0); #endif } diff --git a/sys/arch/x86/include/i82489var.h b/sys/arch/x86/include/i82489var.h index 9398af6911fe..76d44ac83a56 100644 --- a/sys/arch/x86/include/i82489var.h +++ b/sys/arch/x86/include/i82489var.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82489var.h,v 1.17 2017/04/19 06:43:05 nonaka Exp $ */ +/* $NetBSD: i82489var.h,v 1.18 2017/04/22 04:29:31 nonaka Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -104,4 +104,6 @@ extern void lapic_enable(void); extern void lapic_calibrate_timer(struct cpu_info *ci); extern void lapic_initclocks(void); +extern void lapic_write_tpri(uint32_t); + #endif diff --git a/sys/arch/x86/x86/cpu.c b/sys/arch/x86/x86/cpu.c index 2043f8a6e212..fda26fc341a7 100644 --- a/sys/arch/x86/x86/cpu.c +++ b/sys/arch/x86/x86/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.123 2017/02/11 14:11:24 maxv Exp $ */ +/* $NetBSD: cpu.c,v 1.124 2017/04/22 04:29:31 nonaka Exp $ */ /*- * Copyright (c) 2000-2012 NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.123 2017/02/11 14:11:24 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.124 2017/04/22 04:29:31 nonaka Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -879,11 +879,7 @@ cpu_hatch(void *v) cpu_get_tsc_freq(ci); s = splhigh(); -#ifdef i386 - i82489_writereg(LAPIC_TPRI, 0); -#else - lcr8(0); -#endif + lapic_write_tpri(0); x86_enable_intr(); splx(s); x86_errata(); diff --git a/sys/arch/x86/x86/lapic.c b/sys/arch/x86/x86/lapic.c index 1d3fc3cc3cff..5f77c8e2ce9b 100644 --- a/sys/arch/x86/x86/lapic.c +++ b/sys/arch/x86/x86/lapic.c @@ -1,4 +1,4 @@ -/* $NetBSD: lapic.c,v 1.55 2017/04/22 04:24:26 nonaka Exp $ */ +/* $NetBSD: lapic.c,v 1.56 2017/04/22 04:29:31 nonaka Exp $ */ /*- * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.55 2017/04/22 04:24:26 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.56 2017/04/22 04:29:31 nonaka Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -89,6 +89,18 @@ struct pic local_pic = { .pic_delroute = lapic_setup, }; +void +lapic_write_tpri(uint32_t val) +{ + + val &= LAPIC_TPRI_MASK; +#ifdef i386 + i82489_writereg(LAPIC_TPRI, val); +#else + lcr8(val >> 4); +#endif +} + static void lapic_map(paddr_t lapic_base) { @@ -130,7 +142,7 @@ lapic_map(paddr_t lapic_base) cpu_init_first(); /* catch up to changed cpu_number() */ #endif - i82489_writereg(LAPIC_TPRI, 0); + lapic_write_tpri(0); x86_enable_intr(); }