arch/intel64: add support for PCI serial

intel64 can work with PCI serial cards now

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2024-03-20 17:01:06 +01:00 committed by Xiang Xiao
parent 8ab0785d71
commit 2890232f3d
2 changed files with 28 additions and 9 deletions

View File

@ -64,9 +64,14 @@
# undef USE_SERIALDRIVER # undef USE_SERIALDRIVER
# undef USE_EARLYSERIALINIT # undef USE_EARLYSERIALINIT
# undef CONFIG_DEV_LOWCONSOLE # 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_SERIALDRIVER 1
# define USE_EARLYSERIALINIT 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
#endif #endif

View File

@ -26,6 +26,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/serial/uart_16550.h> #include <nuttx/serial/uart_16550.h>
#include <nuttx/serial/uart_pci_16550.h>
#include <arch/io.h> #include <arch/io.h>
@ -72,7 +73,7 @@ void uart_putreg(struct u16550_s *priv, unsigned int offset,
outb(value, priv->uartbase + offset); outb(value, priv->uartbase + offset);
} }
#else /* USE_SERIALDRIVER */ #elif defined(CONFIG_MULTBOOT2_FB_TERM)
/**************************************************************************** /****************************************************************************
* Name: up_putc * Name: up_putc
@ -101,17 +102,30 @@ int up_putc(int ch)
up_lowputc(ch); up_lowputc(ch);
return ch; return ch;
} }
#endif /* USE_SERIALDRIVER */ #endif
#ifdef USE_EARLYSERIALINIT #ifdef USE_EARLYSERIALINIT
void x86_64_earlyserialinit(void) void x86_64_earlyserialinit(void)
{ {
#ifndef CONFIG_16550_NO_SERIAL_CONSOLE
u16550_earlyserialinit(); u16550_earlyserialinit();
} #endif
}
void x86_64_serialinit(void) #endif
{
u16550_serialinit(); #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 #endif