* grub-core/term/serial.c: Add option for enabling/disabling
RTS/CTS flow control.
This commit is contained in:
parent
2dc1eb6cbf
commit
9f8acdaa5d
8 changed files with 48 additions and 17 deletions
|
@ -58,6 +58,10 @@ do_real_config (struct grub_serial_port *port)
|
|||
stop_bits[port->config.stop_bits]);
|
||||
if (status != GRUB_EFI_SUCCESS)
|
||||
port->broken = 1;
|
||||
|
||||
status = efi_call_2 (port->interface->set_control_bits, port->interface,
|
||||
port->config.rtscts ? 0x4002 : 0x2);
|
||||
|
||||
port->configured = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,20 +107,22 @@ do_real_config (struct grub_serial_port *port)
|
|||
| stop_bits[port->config.stop_bits]);
|
||||
grub_outb (status, port->port + UART_LCR);
|
||||
|
||||
/* On Loongson machines serial port has only 3 wires. */
|
||||
#ifndef GRUB_MACHINE_MIPS_LOONGSON
|
||||
/* Enable the FIFO. */
|
||||
grub_outb (UART_ENABLE_FIFO_TRIGGER1, port->port + UART_FCR);
|
||||
if (port->config.rtscts)
|
||||
{
|
||||
/* Enable the FIFO. */
|
||||
grub_outb (UART_ENABLE_FIFO_TRIGGER1, port->port + UART_FCR);
|
||||
|
||||
/* Turn on DTR and RTS. */
|
||||
grub_outb (UART_ENABLE_DTRRTS, port->port + UART_MCR);
|
||||
#else
|
||||
/* Enable the FIFO. */
|
||||
grub_outb (UART_ENABLE_FIFO_TRIGGER14, port->port + UART_FCR);
|
||||
/* Turn on DTR and RTS. */
|
||||
grub_outb (UART_ENABLE_DTRRTS, port->port + UART_MCR);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enable the FIFO. */
|
||||
grub_outb (UART_ENABLE_FIFO_TRIGGER14, port->port + UART_FCR);
|
||||
|
||||
/* Turn on DTR, RTS, and OUT2. */
|
||||
grub_outb (UART_ENABLE_DTRRTS | UART_ENABLE_OUT2, port->port + UART_MCR);
|
||||
#endif
|
||||
/* Turn on DTR, RTS, and OUT2. */
|
||||
grub_outb (UART_ENABLE_DTRRTS | UART_ENABLE_OUT2, port->port + UART_MCR);
|
||||
}
|
||||
|
||||
/* Drain the input buffer. */
|
||||
endtime = grub_get_time_ms () + 1000;
|
||||
|
|
|
@ -47,7 +47,8 @@ enum
|
|||
OPTION_WORD,
|
||||
OPTION_PARITY,
|
||||
OPTION_STOP,
|
||||
OPTION_BASE_CLOCK
|
||||
OPTION_BASE_CLOCK,
|
||||
OPTION_RTSCTS
|
||||
};
|
||||
|
||||
/* Argument options. */
|
||||
|
@ -60,6 +61,7 @@ static const struct grub_arg_option options[] =
|
|||
{"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING},
|
||||
{"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT},
|
||||
{"base-clock", 'b', 0, N_("Set the base clock."), 0, ARG_TYPE_STRING},
|
||||
{"rtscts", 'f', 0, N_("Enable/disable RTS/CTS."), "on|off", ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -237,6 +239,17 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
N_("unsupported serial port parity"));
|
||||
}
|
||||
|
||||
if (state[OPTION_RTSCTS].set)
|
||||
{
|
||||
if (grub_strcmp (state[OPTION_PARITY].arg, "on") == 0)
|
||||
config.rtscts = 1;
|
||||
if (grub_strcmp (state[OPTION_PARITY].arg, "off") == 0)
|
||||
config.rtscts = 0;
|
||||
else
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port flow"));
|
||||
}
|
||||
|
||||
if (state[OPTION_STOP].set)
|
||||
{
|
||||
if (! grub_strcmp (state[OPTION_STOP].arg, "1"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue