From 5df48e5543060daf29f59b910c567d74205da9d6 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Mon, 1 Oct 2001 12:23:05 +0000 Subject: 2001-10-01 Marcus Brinkmann * 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. --- i386/i386/locore.S | 9 ------ i386/i386/pit.c | 88 ------------------------------------------------------ 2 files changed, 97 deletions(-) (limited to 'i386') 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 @@ -1734,15 +1734,6 @@ ENTRY(dr_addr) .long 0,0,0,0 .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