From owner-svn-src-all@FreeBSD.ORG Mon Mar 12 12:06:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F2811065670; Mon, 12 Mar 2012 12:06:40 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from sakura.ccs.furiru.org (sakura.ccs.furiru.org [IPv6:2001:2f0:104:8060::1]) by mx1.freebsd.org (Postfix) with ESMTP id 236E88FC12; Mon, 12 Mar 2012 12:06:38 +0000 (UTC) Received: from localhost (authenticated bits=0) by sakura.ccs.furiru.org (unknown) with ESMTP id q2CC6Ymh058719; Mon, 12 Mar 2012 21:06:37 +0900 (JST) (envelope-from nyan@FreeBSD.org) Date: Mon, 12 Mar 2012 21:04:11 +0900 (JST) Message-Id: <20120312.210411.242248466057936089.nyan@FreeBSD.org> To: jhb@freebsd.org From: TAKAHASHI Yoshihiro In-Reply-To: <201203091942.q29Jgmj1022231@svn.freebsd.org> References: <201203091942.q29Jgmj1022231@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Mar_12_21_04_11_2012_721)--" Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232744 - in head/sys: conf i386/i386 i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 12:06:40 -0000 ----Next_Part(Mon_Mar_12_21_04_11_2012_721)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit In article <201203091942.q29Jgmj1022231@svn.freebsd.org> John Baldwin writes: > Author: jhb > Date: Fri Mar 9 19:42:48 2012 > New Revision: 232744 > URL: http://svn.freebsd.org/changeset/base/232744 > > Log: > Allow a native i386 kernel to be built with 'nodevice atpic'. Just as on > amd64, if 'device isa' is present quiesce the 8259A's during boot and > resume from suspend. This change broke a kernel without the SMP and atpic. The attached patch fixes the problem and includes changes for pc98. Please review it. --- TAKAHASHI Yoshihiro ----Next_Part(Mon_Mar_12_21_04_11_2012_721)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="atpic.diff" Index: conf/files.pc98 =================================================================== RCS file: /home/ncvs/src/sys/conf/files.pc98,v retrieving revision 1.399 diff -u -r1.399 files.pc98 --- conf/files.pc98 9 Mar 2012 20:43:29 -0000 1.399 +++ conf/files.pc98 10 Mar 2012 12:47:46 -0000 @@ -226,7 +226,7 @@ pc98/cbus/nmi.c standard pc98/cbus/olpt.c optional olpt pc98/cbus/pckbd.c optional pckbd -pc98/cbus/pcrtc.c optional atpic +pc98/cbus/pcrtc.c standard pc98/cbus/pmc.c optional pmc pc98/cbus/scgdcrndr.c optional sc gdc pc98/cbus/scterm-sck.c optional sc Index: i386/i386/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.742 diff -u -r1.742 machdep.c --- i386/i386/machdep.c 9 Mar 2012 19:42:48 -0000 1.742 +++ i386/i386/machdep.c 10 Mar 2012 15:51:40 -0000 @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.742 2012/03/09 19:42:48 jhb Exp $"); #include "opt_atalk.h" +#include "opt_apic.h" #include "opt_atpic.h" #include "opt_compat.h" #include "opt_cpu.h" @@ -136,6 +137,10 @@ #include #endif +#ifdef DEV_APIC +#include +#endif + #ifdef DEV_ISA #include #endif Index: pc98/pc98/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/pc98/pc98/machdep.c,v retrieving revision 1.452 diff -u -r1.452 machdep.c --- pc98/pc98/machdep.c 21 Jan 2012 17:45:27 -0000 1.452 +++ pc98/pc98/machdep.c 10 Mar 2012 15:51:55 -0000 @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD: src/sys/pc98/pc98/machdep.c,v 1.452 2012/01/21 17:45:27 kib Exp $"); #include "opt_atalk.h" +#include "opt_apic.h" +#include "opt_atpic.h" #include "opt_compat.h" #include "opt_cpu.h" #include "opt_ddb.h" @@ -132,6 +134,10 @@ #include #endif +#ifdef DEV_APIC +#include +#endif + #ifdef DEV_ISA #include #endif @@ -2296,7 +2302,21 @@ printf("WARNING: loader(8) metadata is missing!\n"); #ifdef DEV_ISA +#ifdef DEV_ATPIC atpic_startup(); +#else + /* Reset and mask the atpics and leave them shut down. */ + atpic_reset(); + + /* + * Point the ICU spurious interrupt vectors at the APIC spurious + * interrupt handler. + */ + setidt(IDT_IO_INTS + 7, IDTVEC(spuriousint), SDT_SYS386IGT, SEL_KPL, + GSEL(GCODE_SEL, SEL_KPL)); + setidt(IDT_IO_INTS + 15, IDTVEC(spuriousint), SDT_SYS386IGT, SEL_KPL, + GSEL(GCODE_SEL, SEL_KPL)); +#endif #endif #ifdef DDB Index: x86/isa/atpic.c =================================================================== RCS file: /home/ncvs/src/sys/x86/isa/atpic.c,v retrieving revision 1.1 diff -u -r1.1 atpic.c --- x86/isa/atpic.c 25 Feb 2010 14:13:39 -0000 1.1 +++ x86/isa/atpic.c 10 Mar 2012 12:48:03 -0000 @@ -72,48 +72,6 @@ #define MASTER 0 #define SLAVE 1 -/* - * PC-98 machines wire the slave 8259A to pin 7 on the master PIC, and - * PC-AT machines wire the slave PIC to pin 2 on the master PIC. - */ -#ifdef PC98 -#define ICU_SLAVEID 7 -#else -#define ICU_SLAVEID 2 -#endif - -/* - * Determine the base master and slave modes not including auto EOI support. - * All machines that FreeBSD supports use 8086 mode. - */ -#ifdef PC98 -/* - * PC-98 machines do not support auto EOI on the second PIC. Also, it - * seems that PC-98 machine PICs use buffered mode, and the master PIC - * uses special fully nested mode. - */ -#define BASE_MASTER_MODE (ICW4_SFNM | ICW4_BUF | ICW4_MS | ICW4_8086) -#define BASE_SLAVE_MODE (ICW4_BUF | ICW4_8086) -#else -#define BASE_MASTER_MODE ICW4_8086 -#define BASE_SLAVE_MODE ICW4_8086 -#endif - -/* Enable automatic EOI if requested. */ -#ifdef AUTO_EOI_1 -#define MASTER_MODE (BASE_MASTER_MODE | ICW4_AEOI) -#else -#define MASTER_MODE BASE_MASTER_MODE -#endif -#ifdef AUTO_EOI_2 -#define SLAVE_MODE (BASE_SLAVE_MODE | ICW4_AEOI) -#else -#define SLAVE_MODE BASE_SLAVE_MODE -#endif - -#define IRQ_MASK(irq) (1 << (irq)) -#define IMEN_MASK(ai) (IRQ_MASK((ai)->at_irq)) - #define NUM_ISA_IRQS 16 static void atpic_init(void *dummy); Index: x86/isa/icu.h =================================================================== RCS file: /home/ncvs/src/sys/x86/isa/icu.h,v retrieving revision 1.1 diff -u -r1.1 icu.h --- x86/isa/icu.h 25 Feb 2010 14:13:39 -0000 1.1 +++ x86/isa/icu.h 10 Mar 2012 12:48:12 -0000 @@ -47,6 +47,48 @@ #define ICU_IMR_OFFSET 1 #endif +/* + * PC-98 machines wire the slave 8259A to pin 7 on the master PIC, and + * PC-AT machines wire the slave PIC to pin 2 on the master PIC. + */ +#ifdef PC98 +#define ICU_SLAVEID 7 +#else +#define ICU_SLAVEID 2 +#endif + +/* + * Determine the base master and slave modes not including auto EOI support. + * All machines that FreeBSD supports use 8086 mode. + */ +#ifdef PC98 +/* + * PC-98 machines do not support auto EOI on the second PIC. Also, it + * seems that PC-98 machine PICs use buffered mode, and the master PIC + * uses special fully nested mode. + */ +#define BASE_MASTER_MODE (ICW4_SFNM | ICW4_BUF | ICW4_MS | ICW4_8086) +#define BASE_SLAVE_MODE (ICW4_BUF | ICW4_8086) +#else +#define BASE_MASTER_MODE ICW4_8086 +#define BASE_SLAVE_MODE ICW4_8086 +#endif + +/* Enable automatic EOI if requested. */ +#ifdef AUTO_EOI_1 +#define MASTER_MODE (BASE_MASTER_MODE | ICW4_AEOI) +#else +#define MASTER_MODE BASE_MASTER_MODE +#endif +#ifdef AUTO_EOI_2 +#define SLAVE_MODE (BASE_SLAVE_MODE | ICW4_AEOI) +#else +#define SLAVE_MODE BASE_SLAVE_MODE +#endif + +#define IRQ_MASK(irq) (1 << (irq)) +#define IMEN_MASK(ai) (IRQ_MASK((ai)->at_irq)) + void atpic_handle_intr(u_int vector, struct trapframe *frame); void atpic_startup(void); Index: x86/x86/intr_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/x86/x86/intr_machdep.c,v retrieving revision 1.1 diff -u -r1.1 intr_machdep.c --- x86/x86/intr_machdep.c 9 Mar 2012 20:43:29 -0000 1.1 +++ x86/x86/intr_machdep.c 10 Mar 2012 12:48:18 -0000 @@ -63,8 +63,12 @@ #include #include #include +#ifdef PC98 +#include +#else #include #endif +#endif #define MAX_STRAY_LOG 5 @@ -391,15 +395,15 @@ outb(IO_ICU1, ICW1_RESET | ICW1_IC4); outb(IO_ICU1 + ICU_IMR_OFFSET, IDT_IO_INTS); - outb(IO_ICU1 + ICU_IMR_OFFSET, 1 << 2); - outb(IO_ICU1 + ICU_IMR_OFFSET, ICW4_8086); + outb(IO_ICU1 + ICU_IMR_OFFSET, IRQ_MASK(ICU_SLAVEID)); + outb(IO_ICU1 + ICU_IMR_OFFSET, MASTER_MODE); outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); outb(IO_ICU1, OCW3_SEL | OCW3_RR); outb(IO_ICU2, ICW1_RESET | ICW1_IC4); outb(IO_ICU2 + ICU_IMR_OFFSET, IDT_IO_INTS + 8); - outb(IO_ICU2 + ICU_IMR_OFFSET, 2); - outb(IO_ICU2 + ICU_IMR_OFFSET, ICW4_8086); + outb(IO_ICU2 + ICU_IMR_OFFSET, ICU_SLAVEID); + outb(IO_ICU2 + ICU_IMR_OFFSET, SLAVE_MODE); outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); outb(IO_ICU2, OCW3_SEL | OCW3_RR); } ----Next_Part(Mon_Mar_12_21_04_11_2012_721)----