[PATCH 2/2] x86: Add 16-bit console divider support

3 views
Skip to first unread message

andreas...@st.oth-regensburg.de

unread,
Jan 20, 2017, 4:55:35 AM1/20/17
to jailho...@googlegroups.com
From: Andreas Kölbl <andreas...@st.oth-regensburg.de>

The 8250 chip has two registers to set the baud rate. Write the 8 upper bits to
the UART_DLM register.

Signed-off-by: Andreas Kölbl <andreas...@st.oth-regensburg.de>
---
hypervisor/arch/x86/uart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hypervisor/arch/x86/uart.c b/hypervisor/arch/x86/uart.c
index 736cf3b2..7c970807 100644
--- a/hypervisor/arch/x86/uart.c
+++ b/hypervisor/arch/x86/uart.c
@@ -69,8 +69,8 @@ void uart_init(void)
return;

uart_reg_out(UART_LCR, UART_LCR_DLAB);
- uart_reg_out(UART_DLL, divider);
- uart_reg_out(UART_DLM, 0);
+ uart_reg_out(UART_DLL, divider & 0xff);
+ uart_reg_out(UART_DLM, (divider >> 8) & 0xff);
uart_reg_out(UART_LCR, UART_LCR_8N1);
}

--
2.11.0

andreas...@st.oth-regensburg.de

unread,
Jan 20, 2017, 4:55:35 AM1/20/17
to jailho...@googlegroups.com
From: Andreas Koelbl <andreas...@st.oth-regensburg.de>

At the moment we only support dividers being less or equal than an 8-bit value.
This affects both the x86 and the arm architecture.

Andreas Kölbl (2):
arm: Add 16-bit console divider support
x86: Add 16-bit console divider support

hypervisor/arch/arm-common/uart-8250.c | 6 ++++--
hypervisor/arch/x86/uart.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)

--
2.11.0

andreas...@st.oth-regensburg.de

unread,
Jan 20, 2017, 4:55:35 AM1/20/17
to jailho...@googlegroups.com
From: Andreas Kölbl <andreas...@st.oth-regensburg.de>

The 8250 chip has two registers to set the baud rate. Write the 8 upper bits to
the UART_DLM register.

Signed-off-by: Andreas Kölbl <andreas...@st.oth-regensburg.de>
---
hypervisor/arch/arm-common/uart-8250.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hypervisor/arch/arm-common/uart-8250.c b/hypervisor/arch/arm-common/uart-8250.c
index be600369..e379dd27 100644
--- a/hypervisor/arch/arm-common/uart-8250.c
+++ b/hypervisor/arch/arm-common/uart-8250.c
@@ -39,8 +39,10 @@ static void uart_init(struct uart_chip *chip)
return;

mmio_write32(chip->virt_base + UART_LCR, UART_LCR_DLAB);
- mmio_write32(chip->virt_base + UART_DLL, chip->debug_console->divider);
- mmio_write32(chip->virt_base + UART_DLM, 0);
+ mmio_write32(chip->virt_base + UART_DLL,
+ chip->debug_console->divider & 0xff);
+ mmio_write32(chip->virt_base + UART_DLM,
+ (chip->debug_console->divider >> 8) & 0xff);
mmio_write32(chip->virt_base + UART_LCR, UART_LCR_8N1);
}

--
2.11.0

Jan Kiszka

unread,
Jan 21, 2017, 2:28:36 AM1/21/17
to andreas...@st.oth-regensburg.de, jailho...@googlegroups.com
Subject of patch 1 should be "Add [...] support to 8250" because ARM has
more drivers, but the code looks good. I'll fix that up during merge.

Thanks,
Jan
Reply all
Reply to author
Forward
0 new messages