[PATCH 07/25] inmate: x86: Add support for 8-bit MMIO 1-byte distance UART

4 views
Skip to first unread message

Jan Kiszka

unread,
Apr 19, 2017, 7:09:21 AM4/19/17
to jailho...@googlegroups.com
Required for the Denverton SoC.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
inmates/lib/x86/printk.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/inmates/lib/x86/printk.c b/inmates/lib/x86/printk.c
index 230780e6..17a2cc34 100644
--- a/inmates/lib/x86/printk.c
+++ b/inmates/lib/x86/printk.c
@@ -40,6 +40,16 @@ static u8 uart_pio_in(unsigned int reg)
return inb(printk_uart_base + reg);
}

+static void uart_mmio8_out(unsigned int reg, u8 value)
+{
+ mmio_write8((void *)printk_uart_base + reg, value);
+}
+
+static u8 uart_mmio8_in(unsigned int reg)
+{
+ return mmio_read8((void *)printk_uart_base + reg);
+}
+
static void uart_mmio32_out(unsigned int reg, u8 value)
{
mmio_write32((void *)printk_uart_base + reg * 4, value);
@@ -100,17 +110,23 @@ static void console_init(void)
console_putc = uart_putc;
uart_reg_out = uart_pio_out;
uart_reg_in = uart_pio_in;
- } else if (strcmp(type, "MMIO") == 0) {
+ } else if (strcmp(type, "MMIO8") == 0) {
+ console_putc = uart_putc;
+ uart_reg_out = uart_mmio8_out;
+ uart_reg_in = uart_mmio8_in;
+ } else if (strcmp(type, "MMIO32") == 0) {
console_putc = uart_putc;
uart_reg_out = uart_mmio32_out;
uart_reg_in = uart_mmio32_in;
-#ifdef __x86_64__
- map_range((void *)printk_uart_base, 0x1000, MAP_UNCACHED);
-#endif
} else {
return;
}

+#ifdef __x86_64__
+ if (strncmp(type, "MMIO", 4) == 0)
+ map_range((void *)printk_uart_base, 0x1000, MAP_UNCACHED);
+#endif
+
if (divider > 0) {
uart_reg_out(UART_LCR, UART_LCR_DLAB);
uart_reg_out(UART_DLL, divider);
--
2.12.0

Reply all
Reply to author
Forward
0 new messages