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().
This commit is contained in:
Bruce Evans 1996-03-31 04:05:36 +00:00
parent 5d170d7eb8
commit ef9805a3c8
12 changed files with 79 additions and 50 deletions

View File

@ -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 */
@ -48,18 +48,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)

View File

@ -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 */
@ -48,18 +48,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)

View File

@ -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)
{

View File

@ -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 */

View File

@ -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.

View File

@ -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)
{

View File

@ -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 */
@ -48,18 +48,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)

View File

@ -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)
{

View File

@ -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 */

View File

@ -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.

View File

@ -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)
{

View File

@ -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)
{