summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--i386/i386/locore.S9
-rw-r--r--i386/i386/pit.c88
3 files changed, 12 insertions, 97 deletions
diff --git a/ChangeLog b/ChangeLog
index b572c3f..6c7ff91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-10-01 Marcus Brinkmann <marcus@gnu.org>
+
+ * i386/i386/locore.S (tenmicrosec): Remove subroutine.
+ * i386/i386/pit.c (delaycount): Remove global variable.
+ (microdata): Likewise.
+ (clkstart): Do not call findspeed() and microfind().
+ (findspeed): Remove function.
+ (spinwait): Likewise.
+ (microfind): Likewise. This function triggers a division by zero
+ trap on AMD K6 350Mhz+ and Athlon 1.1GHz+ machines (and in general
+ leads to bad results on fast cpus), and nothing uses this code anymore.
+
2001-09-30 Roland McGrath <roland@frob.com>
* kern/bootstrap.c (bootstrap_create): Ignore trailing spaces when
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index c5a3577..64a3377 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1735,15 +1735,6 @@ ENTRY(dr_addr)
.text
/*
- * Waste 10 microseconds.
- */
-ENTRY(tenmicrosec)
- movl EXT(microdata),%ecx /* cycle count for 10 microsecond loop */
-tenmicroloop:
- loop tenmicroloop
- ret
-
-/*
* cpu_shutdown()
* Force reboot
*/
diff --git a/i386/i386/pit.c b/i386/i386/pit.c
index d0f3f9c..4d360a7 100644
--- a/i386/i386/pit.c
+++ b/i386/i386/pit.c
@@ -63,15 +63,6 @@ int pitctr2_port = PITCTR2_PORT; /* For 386/20 Board */
int pit0_mode = PIT_C0|PIT_SQUAREMODE|PIT_READMODE ;
-unsigned int delaycount; /* loop count in trying to delay for
- * 1 millisecond
- */
-unsigned long microdata=50; /* loop count for 10 microsecond wait.
- MUST be initialized for those who
- insist on calling "tenmicrosec"
- it before the clock has been
- initialized.
- */
unsigned int clknumb = CLKNUM; /* interrupt interval for timer 0 */
#ifdef PS2
@@ -93,8 +84,6 @@ clkstart()
intpri[0] = SPLHI;
form_pic_mask();
- findspeed();
- microfind();
s = sploff(); /* disable interrupts */
#ifdef PS2
@@ -116,39 +105,6 @@ clkstart()
#define COUNT 10000 /* should be a multiple of 1000! */
-findspeed()
-{
- unsigned int flags;
- unsigned char byte;
- unsigned int leftover;
- int i;
- int j;
- int s;
-
- s = sploff(); /* disable interrupts */
- /* Put counter in count down mode */
-#define PIT_COUNTDOWN PIT_READMODE|PIT_NDIVMODE
- outb(pitctl_port, PIT_COUNTDOWN);
- /* output a count of -1 to counter 0 */
- outb(pitctr0_port, 0xff);
- outb(pitctr0_port, 0xff);
- delaycount = COUNT;
- spinwait(1);
- /* Read the value left in the counter */
- byte = inb(pitctr0_port); /* least siginifcant */
- leftover = inb(pitctr0_port); /* most significant */
- leftover = (leftover<<8) + byte ;
- /* Formula for delaycount is :
- * (loopcount * timer clock speed)/ (counter ticks * 1000)
- * 1000 is for figuring out milliseconds
- */
- /* we arrange calculation so that it doesn't overflow */
- delaycount = ((COUNT/1000) * CLKNUM) / (0xffff-leftover);
- /* printf("findspeed: delaycount=%d (tics=%d)\n",
- delaycount, (0xffff-leftover));*/
- splon(s); /* restore interrupt state */
-}
-
#ifdef PS2
abios_clock_start()
@@ -190,47 +146,3 @@ ackrtclock()
}
}
#endif /* PS2 */
-
-
-spinwait(millis)
- int millis; /* number of milliseconds to delay */
-{
- int i, j;
-
- for (i=0;i<millis;i++)
- for (j=0;j<delaycount;j++)
- ;
-}
-
-#define MICROCOUNT 1000 /* keep small to prevent overflow */
-microfind()
-{
- unsigned int flags;
- unsigned char byte;
- unsigned short leftover;
- int s;
-
-
- s = sploff(); /* disable interrupts */
-
- /* Put counter in count down mode */
- outb(pitctl_port, PIT_COUNTDOWN);
- /* output a count of -1 to counter 0 */
- outb(pitctr0_port, 0xff);
- outb(pitctr0_port, 0xff);
- microdata=MICROCOUNT;
- tenmicrosec();
- /* Read the value left in the counter */
- byte = inb(pitctr0_port); /* least siginifcant */
- leftover = inb(pitctr0_port); /* most significant */
- leftover = (leftover<<8) + byte ;
- /* Formula for delaycount is :
- * (loopcount * timer clock speed)/ (counter ticks * 1000)
- * Note also that 1000 is for figuring out milliseconds
- */
- microdata = (MICROCOUNT * CLKNUM) / ((0xffff-leftover)*100000);
- if (!microdata)
- microdata++;
-
- splon(s); /* restore interrupt state */
-}