+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>
* stage2/serial.c [!GRUB_UTIL] (serial_hw_fetch): Fixed a typo.
inb (unsigned short port)
{
unsigned char value;
-
+
asm volatile ("inb %w1, %0" : "=a" (value) : "Nd" (port));
+ asm volatile ("outb %%al, $0x80" : : );
+
return value;
}
outb (unsigned short port, unsigned char value)
{
asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port));
+ asm volatile ("outb %%al, $0x80" : : );
}
/* Fetch a key. */
void
serial_hw_put (int c)
{
- int timeout = 10000;
+ int timeout = 100000;
/* Wait until the transmitter holding register is empty. */
while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0)
if (--timeout == 0)
/* There is something wrong. But what can I do? */
return;
-
- /* Insert a delay. */
- serial_hw_delay ();
}
-
+
outb (serial_hw_port + UART_TX, c);
}
int fill_input_buf (void)
{
int i;
-
- for (i = 0; i < 1000 && npending < sizeof (input_buf); i++)
+
+ for (i = 0; i < 10000 && npending < sizeof (input_buf); i++)
{
int c;
c = serial_hw_fetch ();
if (c >= 0)
- input_buf[npending++] = c;
+ {
+ input_buf[npending++] = c;
- /* Insert a delay. */
- serial_hw_delay ();
+ /* Reset the counter to zero, to wait for the same interval. */
+ i = 0;
+ }
}
/* Translate some key sequences. */