Add busy detect quirk to list of console options

This change allows one to set the busy_detect flag
required by the synopsys UART at the loader prompt.
This is needed by the EPYC 3000 SoC.

This will give users a working console up to the point where getty is required:
hw.uart.console="mm:0xfedc9000,rs:2,bd:1"

Reviewed by:	imp
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D16399
This commit is contained in:
mmacy 2018-07-22 23:32:21 +00:00
parent e1b036d886
commit 650f54b65a
3 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,7 @@ struct uart_bas {
u_int rclk; u_int rclk;
u_int regshft; u_int regshft;
u_int regiowidth; u_int regiowidth;
u_int busy_detect;
}; };
#define uart_regofs(bas, reg) ((reg) << (bas)->regshft) #define uart_regofs(bas, reg) ((reg) << (bas)->regshft)

View File

@ -469,6 +469,7 @@ ns8250_bus_attach(struct uart_softc *sc)
bas = &sc->sc_bas; bas = &sc->sc_bas;
ns8250->busy_detect = bas->busy_detect;
ns8250->mcr = uart_getreg(bas, REG_MCR); ns8250->mcr = uart_getreg(bas, REG_MCR);
ns8250->fcr = FCR_ENABLE; ns8250->fcr = FCR_ENABLE;
#ifdef CPU_XBURST #ifdef CPU_XBURST

View File

@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#define UART_TAG_RS 7 #define UART_TAG_RS 7
#define UART_TAG_SB 8 #define UART_TAG_SB 8
#define UART_TAG_XO 9 #define UART_TAG_XO 9
#define UART_TAG_BD 10
static struct uart_class *uart_classes[] = { static struct uart_class *uart_classes[] = {
&uart_ns8250_class, &uart_ns8250_class,
@ -124,6 +125,10 @@ uart_parse_tag(const char **p)
{ {
int tag; int tag;
if ((*p)[0] == 'b' && (*p)[1] == 'd') {
tag = UART_TAG_BD;
goto out;
}
if ((*p)[0] == 'b' && (*p)[1] == 'r') { if ((*p)[0] == 'b' && (*p)[1] == 'r') {
tag = UART_TAG_BR; tag = UART_TAG_BR;
goto out; goto out;
@ -179,6 +184,7 @@ uart_parse_tag(const char **p)
* separated by commas. Each attribute is a tag-value pair with the tag and * separated by commas. Each attribute is a tag-value pair with the tag and
* value separated by a colon. Supported tags are: * value separated by a colon. Supported tags are:
* *
* bd = Busy Detect
* br = Baudrate * br = Baudrate
* ch = Channel * ch = Channel
* db = Data bits * db = Data bits
@ -242,6 +248,9 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
spec = cp; spec = cp;
for (;;) { for (;;) {
switch (uart_parse_tag(&spec)) { switch (uart_parse_tag(&spec)) {
case UART_TAG_BD:
di->bas.busy_detect = uart_parse_long(&spec);
break;
case UART_TAG_BR: case UART_TAG_BR:
di->baudrate = uart_parse_long(&spec); di->baudrate = uart_parse_long(&spec);
break; break;