From b26bbde39abed59833a579d4dc9ef2c51c4ae0aa Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 31 Mar 1996 04:05:36 +0000 Subject: Moved rtcin() to clock.c. Always delay using one inb(0x84) after each i/o in rtcin() - don't do this conditional on the bogus option DUMMY_NOPS not being defined. If you want an optionally slightly faster rtcin() again, then inline it and use a better named option or sysctl variable. It only needs to be fast in rtcintr(). --- sys/i386/i386/support.s | 14 +------------- sys/i386/i386/tsc.c | 15 ++++++++++++++- sys/i386/include/clock.h | 3 ++- sys/i386/include/cpufunc.h | 3 +-- sys/i386/isa/clock.c | 15 ++++++++++++++- 5 files changed, 32 insertions(+), 18 deletions(-) (limited to 'sys/i386') diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index 10dfe2f..df32d00 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.30 1995/12/27 18:54:51 davidg Exp $ + * $Id: support.s,v 1.31 1995/12/28 23:14:40 davidg Exp $ */ #include "assym.s" /* system definitions */ @@ -49,18 +49,6 @@ _bzero: .long _generic_bzero .text /* - * Support for reading real time clock registers - */ -ENTRY(rtcin) /* rtcin(val) */ - movl 4(%esp),%eax - outb %al,$0x70 - FASTER_NOP - xorl %eax,%eax - inb $0x71,%al - FASTER_NOP - ret - -/* * bcopy family * void bzero(void *base, u_int cnt) */ diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index d9ae373..b4a01ce 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.51 1996/01/30 18:56:47 wollman Exp $ + * $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $ */ /* @@ -400,6 +400,19 @@ sysbeep(int pitch, int period) * RTC support routines */ +int +rtcin(reg) + int reg; +{ + u_char val; + + outb(IO_RTC, reg); + inb(0x84); + val = inb(IO_RTC + 1); + inb(0x84); + return (val); +} + static __inline void writertc(u_char reg, u_char val) { diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h index 8671311..f7ba36e95 100644 --- a/sys/i386/include/clock.h +++ b/sys/i386/include/clock.h @@ -3,7 +3,7 @@ * Garrett Wollman, September 1994. * This file is in the public domain. * - * $Id: clock.h,v 1.8 1995/12/24 08:10:49 davidg Exp $ + * $Id: clock.h,v 1.9 1996/01/30 18:56:24 wollman Exp $ */ #ifndef _MACHINE_CLOCK_H_ @@ -95,6 +95,7 @@ int acquire_timer0 __P((int rate, int acquire_timer2 __P((int mode)); int release_timer0 __P((void)); int release_timer2 __P((void)); +int rtcin __P((int val)); int sysbeep __P((int pitch, int period)); #endif /* KERNEL && !LOCORE */ diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 756bb65..9e4896d 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.46 1996/03/26 19:57:56 wollman Exp $ + * $Id: cpufunc.h,v 1.47 1996/03/28 20:39:45 wollman Exp $ */ /* @@ -368,7 +368,6 @@ void load_cr3 __P((u_long cr3)); void ltr __P((u_short sel)); u_int rcr0 __P((void)); u_long rcr3 __P((void)); -int rtcin __P((int val)); /* * These functions are NOT in support.s and should be declared elsewhere. diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index d9ae373..b4a01ce 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.51 1996/01/30 18:56:47 wollman Exp $ + * $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $ */ /* @@ -400,6 +400,19 @@ sysbeep(int pitch, int period) * RTC support routines */ +int +rtcin(reg) + int reg; +{ + u_char val; + + outb(IO_RTC, reg); + inb(0x84); + val = inb(IO_RTC + 1); + inb(0x84); + return (val); +} + static __inline void writertc(u_char reg, u_char val) { -- cgit v1.1