From 2890232f3db17e41ad8f3dceec3f3f26e259e608 Mon Sep 17 00:00:00 2001 From: p-szafonimateusz Date: Wed, 20 Mar 2024 17:01:06 +0100 Subject: [PATCH] arch/intel64: add support for PCI serial intel64 can work with PCI serial cards now Signed-off-by: p-szafonimateusz --- arch/x86_64/src/common/x86_64_internal.h | 7 +++++- arch/x86_64/src/intel64/intel64_serial.c | 30 +++++++++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/arch/x86_64/src/common/x86_64_internal.h b/arch/x86_64/src/common/x86_64_internal.h index 238417455a..c71769df46 100644 --- a/arch/x86_64/src/common/x86_64_internal.h +++ b/arch/x86_64/src/common/x86_64_internal.h @@ -64,9 +64,14 @@ # undef USE_SERIALDRIVER # undef USE_EARLYSERIALINIT # undef CONFIG_DEV_LOWCONSOLE -# elif defined(CONFIG_16550_UART) +# elif defined(CONFIG_16550_UART) && \ + !defined(CONFIG_16550_NO_SERIAL_CONSOLE) # define USE_SERIALDRIVER 1 # define USE_EARLYSERIALINIT 1 +# elif defined(CONFIG_16550_PCI_UART) && \ + !defined(CONFIG_16550_PCI_NO_SERIAL_CONSOLE) +# define USE_SERIALDRIVER 1 +# undef USE_EARLYSERIALINIT # endif #endif diff --git a/arch/x86_64/src/intel64/intel64_serial.c b/arch/x86_64/src/intel64/intel64_serial.c index 2daff248b2..96233dd31b 100644 --- a/arch/x86_64/src/intel64/intel64_serial.c +++ b/arch/x86_64/src/intel64/intel64_serial.c @@ -26,6 +26,7 @@ #include #include +#include #include @@ -72,7 +73,7 @@ void uart_putreg(struct u16550_s *priv, unsigned int offset, outb(value, priv->uartbase + offset); } -#else /* USE_SERIALDRIVER */ +#elif defined(CONFIG_MULTBOOT2_FB_TERM) /**************************************************************************** * Name: up_putc @@ -101,17 +102,30 @@ int up_putc(int ch) up_lowputc(ch); return ch; } -#endif /* USE_SERIALDRIVER */ +#endif #ifdef USE_EARLYSERIALINIT - void x86_64_earlyserialinit(void) { +#ifndef CONFIG_16550_NO_SERIAL_CONSOLE u16550_earlyserialinit(); -} - -void x86_64_serialinit(void) -{ - u16550_serialinit(); +#endif +} +#endif + +#ifdef USE_SERIALDRIVER +void x86_64_serialinit(void) +{ +#ifdef CONFIG_16550_PCI_UART + /* Initialize PCI UART 16550 */ + + pci_u16550_init(); +#endif + +#ifdef CONFIG_16550_UART + /* Initialize UART 16550 */ + + u16550_serialinit(); +#endif } #endif