2002-07-03 Yoshinori K. Okuji <okuji@enbug.org>

* stage2/serial.c [!GRUB_UTIL] (inb): Added a delay into this
	function itself.
	[!GRUB_UTIL] (outb): Likewise.
	[!GRUB_UTIL] (serial_hw_put): Increase the timeout value, and
	don't call serial_hw_delay explicitly any longer.
	(fill_input_buf): Increase the maximum number of retries, reset
	the counter to zero after getting a valid character, and don't
	call serial_hw_delay explicitly any longer.
This commit is contained in:
okuji 2002-07-02 23:39:14 +00:00
parent 321b3d6a1d
commit 4fcd549f56
2 changed files with 24 additions and 11 deletions

View file

@ -1,3 +1,14 @@
2002-07-03 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/serial.c [!GRUB_UTIL] (inb): Added a delay into this
function itself.
[!GRUB_UTIL] (outb): Likewise.
[!GRUB_UTIL] (serial_hw_put): Increase the timeout value, and
don't call serial_hw_delay explicitly any longer.
(fill_input_buf): Increase the maximum number of retries, reset
the counter to zero after getting a valid character, and don't
call serial_hw_delay explicitly any longer.
2002-07-03 Yoshinori K. Okuji <okuji@enbug.org> 2002-07-03 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed a typo. * stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed a typo.

View file

@ -64,8 +64,10 @@ static inline unsigned char
inb (unsigned short port) inb (unsigned short port)
{ {
unsigned char value; unsigned char value;
asm volatile ("inb %w1, %0" : "=a" (value) : "Nd" (port)); asm volatile ("inb %w1, %0" : "=a" (value) : "Nd" (port));
asm volatile ("outb %%al, $0x80" : : );
return value; return value;
} }
@ -74,6 +76,7 @@ static inline void
outb (unsigned short port, unsigned char value) outb (unsigned short port, unsigned char value)
{ {
asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port));
asm volatile ("outb %%al, $0x80" : : );
} }
/* Fetch a key. */ /* Fetch a key. */
@ -90,7 +93,7 @@ serial_hw_fetch (void)
void void
serial_hw_put (int c) serial_hw_put (int c)
{ {
int timeout = 10000; int timeout = 100000;
/* Wait until the transmitter holding register is empty. */ /* Wait until the transmitter holding register is empty. */
while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0)
@ -98,11 +101,8 @@ serial_hw_put (int c)
if (--timeout == 0) if (--timeout == 0)
/* There is something wrong. But what can I do? */ /* There is something wrong. But what can I do? */
return; return;
/* Insert a delay. */
serial_hw_delay ();
} }
outb (serial_hw_port + UART_TX, c); outb (serial_hw_port + UART_TX, c);
} }
@ -263,17 +263,19 @@ static
int fill_input_buf (void) int fill_input_buf (void)
{ {
int i; int i;
for (i = 0; i < 1000 && npending < sizeof (input_buf); i++) for (i = 0; i < 10000 && npending < sizeof (input_buf); i++)
{ {
int c; int c;
c = serial_hw_fetch (); c = serial_hw_fetch ();
if (c >= 0) if (c >= 0)
input_buf[npending++] = c; {
input_buf[npending++] = c;
/* Insert a delay. */ /* Reset the counter to zero, to wait for the same interval. */
serial_hw_delay (); i = 0;
}
} }
/* Translate some key sequences. */ /* Translate some key sequences. */