From owner-freebsd-current@FreeBSD.ORG Mon Jul 12 08:40:00 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8B3D106566B for ; Mon, 12 Jul 2010 08:40:00 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4A1148FC0C for ; Mon, 12 Jul 2010 08:40:00 +0000 (UTC) Received: by fxm13 with SMTP id 13so2318216fxm.13 for ; Mon, 12 Jul 2010 01:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:x-enigmail-version:content-type; bh=sLe4khpjrkuGz0T9BZD3lC/qBvM/hZDereOcKpD0GMU=; b=XQN34CVLx4aB6Gr3981XMKVj7h/r4GZlK5DOroq5IRPCqk7IxK8IAFeubrNjxoF8lP V8rfIqh7yVy1CAvPEmGcGAWP0y1URuK4WrU+VQlITF0VgOpiDZBBW0oH9L4hxe9jsEHo aJB6P4RQxLfmy0cqGEiMh1eHr/Bve8ltenz3o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; b=rbHd0x8Eme0dr1kAYoC3Iyv1XMtPp8DOBEnntMwV6XI/5KHonVY7d5K2j1TJPOYHBD 3eDOQY+fznRux9pZluAHlzxhMxW9HhtFopbYVRWoRFx4aGTRK6BSZjDWeb7Fp1/sWz8F jx4bj6rQFxFUO//lxvr8WU0cxpIFO2o6dVD2o= Received: by 10.223.110.73 with SMTP id m9mr11054098fap.39.1278923999311; Mon, 12 Jul 2010 01:39:59 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id b36sm3414618faq.39.2010.07.12.01.39.57 (version=SSLv3 cipher=RC4-MD5); Mon, 12 Jul 2010 01:39:58 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C3AD4A8.602@FreeBSD.org> Date: Mon, 12 Jul 2010 11:39:04 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: FreeBSD-Current X-Enigmail-Version: 0.96.0 Content-Type: multipart/mixed; boundary="------------030508080806000401030205" Subject: [patch] Clocks on PC98 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2010 08:40:01 -0000 This is a multi-part message in MIME format. --------------030508080806000401030205 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Hi. I've made a patch to unify PC98 event timer code with the rest of x86. Could somebody test it on that hardware, as all I can say now is that it builds. I have no idea about ISA PNP on PC98, so if it doesn't report timer presence, it may be needed to add to device.hints lines like: hint.attimer.0.at="isa" hint.attimer.0.port="0x71" hint.attimer.0.irq="0" -- Alexander Motin --------------030508080806000401030205 Content-Type: text/plain; name="clock.pc98.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="clock.pc98.patch" diff -ruNp --exclude .svn --exclude compile /storage/head/sys/conf/files.pc98 sys/conf/files.pc98 --- /storage/head/sys/conf/files.pc98 2010-06-09 08:33:25.000000000 +0300 +++ sys/conf/files.pc98 2010-07-12 11:02:29.000000000 +0300 @@ -227,7 +227,6 @@ libkern/udivdi3.c standard libkern/umoddi3.c standard pc98/apm/apm_bioscall.S optional apm pc98/cbus/cbus_dma.c optional isa -pc98/cbus/clock.c standard pc98/cbus/fdc.c optional fdc pc98/cbus/fdc_cbus.c optional fdc isa pc98/cbus/gdc.c optional gdc @@ -253,8 +252,11 @@ pc98/pc98/pc98_machdep.c standard # x86 shared code between IA32, AMD64 and PC98 architectures # x86/isa/atpic.c optional atpic +x86/isa/clock.c standard x86/isa/isa.c optional isa x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard x86/x86/msi.c optional apic pci +x86/x86/timeevents.c standard + diff -ruNp --exclude .svn --exclude compile /storage/head/sys/x86/isa/clock.c sys/x86/isa/clock.c --- /storage/head/sys/x86/isa/clock.c 2010-07-12 09:46:16.000000000 +0300 +++ sys/x86/isa/clock.c 2010-07-12 11:16:37.000000000 +0300 @@ -66,9 +66,17 @@ __FBSDID("$FreeBSD: head/sys/x86/isa/clo #include #include +#ifdef PC98 +#include +#else #include +#endif #ifdef DEV_ISA +#ifdef PC98 +#include +#else #include +#endif #include #endif @@ -78,8 +86,12 @@ __FBSDID("$FreeBSD: head/sys/x86/isa/clo int clkintr_pending; #ifndef TIMER_FREQ +#ifdef PC98 +#define TIMER_FREQ 2457600 +#else #define TIMER_FREQ 1193182 #endif +#endif u_int i8254_freq = TIMER_FREQ; TUNABLE_INT("hw.i8254.freq", &i8254_freq); int i8254_max_count; @@ -150,8 +162,11 @@ timer_spkr_acquire(void) { int mode; +#ifdef PC98 + mode = TIMER_SEL1 | TIMER_SQWAVE | TIMER_16BIT; +#else mode = TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT; - +#endif if (timer2_state != RELEASED) return (-1); timer2_state = ACQUIRED; @@ -163,7 +178,11 @@ timer_spkr_acquire(void) * and this is probably good enough for timer2, so we aren't as * careful with it as with timer0. */ +#ifdef PC98 + outb(TIMER_MODE, TIMER_SEL1 | (mode & 0x3f)); +#else outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f)); +#endif ppi_spkr_on(); /* enable counter2 output to speaker */ return (0); } @@ -175,7 +194,11 @@ timer_spkr_release(void) if (timer2_state != ACQUIRED) return (-1); timer2_state = RELEASED; +#ifdef PC98 + outb(TIMER_MODE, TIMER_SEL1 | TIMER_SQWAVE | TIMER_16BIT); +#else outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT); +#endif ppi_spkr_off(); /* disable counter2 output to speaker */ return (0); } @@ -293,7 +316,11 @@ DELAY(int n) while (ticks_left > 0) { #ifdef KDB if (kdb_active) { +#ifdef PC98 + outb(0x5f, 0); +#else inb(0x84); +#endif tick = prev_tick - 1; if (tick <= 0) tick = i8254_max_count; @@ -377,7 +404,9 @@ timer_restore(void) { i8254_restore(); /* restore i8254_freq and hz */ +#ifndef PC98 atrtc_restore(); /* reenable RTC interrupts */ +#endif } #endif @@ -387,6 +416,10 @@ i8254_init(void) { mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_NOPROFILE); +#ifdef PC98 + if (pc98_machine_type & M_8M) + i8254_freq = 1996800L; /* 1.9968 MHz */ +#endif set_i8254_freq(i8254_freq, 0); } --------------030508080806000401030205--