From e3f0f86514126afaf3726e330fbe5fd525ac9f09 Mon Sep 17 00:00:00 2001 From: qinwei1 Date: Sat, 4 Mar 2023 23:34:06 +0800 Subject: [PATCH] arm64: add arm64_serialinit/arm64_earlyserialinit Summary: add arm64_serialinit/arm64_earlyserialinit function prototype to arm64_internal.h as common function for arm64 based chip. Testing with ostest in SP and SMP Signed-off-by: qinwei1 --- arch/arm64/src/a64/a64_boot.c | 2 +- arch/arm64/src/a64/a64_serial.c | 4 ++-- arch/arm64/src/a64/a64_serial.h | 14 -------------- arch/arm64/src/common/arm64_internal.h | 25 +++++++++++++++++++++++++ arch/arm64/src/fvp-v8r/fvp_boot.c | 2 +- arch/arm64/src/fvp-v8r/serial_pl011.c | 16 ++++------------ arch/arm64/src/fvp-v8r/serial_pl011.h | 14 -------------- arch/arm64/src/qemu/qemu_boot.c | 2 +- arch/arm64/src/qemu/qemu_serial.c | 16 ++++------------ arch/arm64/src/qemu/qemu_serial.h | 14 -------------- 10 files changed, 38 insertions(+), 71 deletions(-) diff --git a/arch/arm64/src/a64/a64_boot.c b/arch/arm64/src/a64/a64_boot.c index ac60abe843..fc7c2eb15b 100644 --- a/arch/arm64/src/a64/a64_boot.c +++ b/arch/arm64/src/a64/a64_boot.c @@ -118,7 +118,7 @@ void arm64_chip_boot(void) * driver. */ - a64_earlyserialinit(); + arm64_earlyserialinit(); #endif } diff --git a/arch/arm64/src/a64/a64_serial.c b/arch/arm64/src/a64/a64_serial.c index 573eb81df8..ab61e11ebb 100644 --- a/arch/arm64/src/a64/a64_serial.c +++ b/arch/arm64/src/a64/a64_serial.c @@ -589,7 +589,7 @@ static struct uart_dev_s g_uart1port = ***************************************************************************/ /*************************************************************************** - * Name: a64_earlyserialinit + * Name: arm64_earlyserialinit * * Description: * Performs the low level UART initialization early in @@ -601,7 +601,7 @@ static struct uart_dev_s g_uart1port = * ***************************************************************************/ -void a64_earlyserialinit(void) +void arm64_earlyserialinit(void) { /* NOTE: This function assumes that low level hardware configuration * -- including all clocking and pin configuration -- was performed diff --git a/arch/arm64/src/a64/a64_serial.h b/arch/arm64/src/a64/a64_serial.h index d5737ca514..f64da07bfa 100644 --- a/arch/arm64/src/a64/a64_serial.h +++ b/arch/arm64/src/a64/a64_serial.h @@ -57,19 +57,5 @@ * Public Function Prototypes ****************************************************************************/ -/**************************************************************************** - * Name: a64_earlyserialinit - * - * Description: - * Performs the low level UART initialization early in debug so that the - * serial console will be available during bootup. This must be called - * before arm64_serialinit. - * - ****************************************************************************/ - -#ifdef USE_EARLYSERIALINIT -void a64_earlyserialinit(void); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM64_SRC_A64_A64_SERIAL_H */ diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h index ee5ddef2e5..081908cffb 100644 --- a/arch/arm64/src/common/arm64_internal.h +++ b/arch/arm64/src/common/arm64_internal.h @@ -290,10 +290,35 @@ uint64_t * arm64_syscall_switch(uint64_t *regs); int arm64_syscall(uint64_t *regs); #ifdef USE_SERIALDRIVER +/**************************************************************************** + * Name: arm64_serialinit + * + * Description: + * Register serial console and serial ports. This assumes + * that arm64_earlyserialinit was called previously. + * + ****************************************************************************/ + void arm64_serialinit(void); #endif #ifdef USE_EARLYSERIALINIT + +/**************************************************************************** + * Name: arm64_earlyserialinit + * + * Description: + * Performs the low level UART initialization early in debug so that the + * serial console will be available during bootup. This must be called + * before arm64_serialinit. + * + * Note: + * This function assumes that low level hardware configuration + * including all clocking and pin configuration -- was performed + * earlier in the boot sequence(eg bootloader). + * + ****************************************************************************/ + void arm64_earlyserialinit(void); #endif diff --git a/arch/arm64/src/fvp-v8r/fvp_boot.c b/arch/arm64/src/fvp-v8r/fvp_boot.c index bc82b27cab..6650457ad9 100644 --- a/arch/arm64/src/fvp-v8r/fvp_boot.c +++ b/arch/arm64/src/fvp-v8r/fvp_boot.c @@ -200,6 +200,6 @@ void arm64_chip_boot(void) * driver. */ - fvp_earlyserialinit(); + arm64_earlyserialinit(); #endif } diff --git a/arch/arm64/src/fvp-v8r/serial_pl011.c b/arch/arm64/src/fvp-v8r/serial_pl011.c index aaff42abd7..e855ca8ded 100644 --- a/arch/arm64/src/fvp-v8r/serial_pl011.c +++ b/arch/arm64/src/fvp-v8r/serial_pl011.c @@ -781,22 +781,15 @@ static struct uart_dev_s g_uart1port = ***************************************************************************/ /*************************************************************************** - * Name: qemu_earlyserialinit + * Name: arm64_earlyserialinit * * Description: - * Performs the low level UART initialization early in - * debug so that the serial console will be available - * during bootup. This must be called before arm_serialinit. + * see arm64_internal.h * ***************************************************************************/ -void fvp_earlyserialinit(void) +void arm64_earlyserialinit(void) { - /* NOTE: This function assumes that low level hardware configuration - * -- including all clocking and pin configuration -- was performed by the - * function imx8_lowsetup() earlier in the boot sequence. - */ - /* Enable the console UART. The other UARTs will be initialized if and * when they are first opened. */ @@ -834,8 +827,7 @@ int up_putc(int ch) * Name: arm64_serialinit * * Description: - * Register serial console and serial ports. This assumes - * that imx_earlyserialinit was called previously. + * see arm64_internal.h * ***************************************************************************/ diff --git a/arch/arm64/src/fvp-v8r/serial_pl011.h b/arch/arm64/src/fvp-v8r/serial_pl011.h index 73aee757bc..0eeb0e73d3 100644 --- a/arch/arm64/src/fvp-v8r/serial_pl011.h +++ b/arch/arm64/src/fvp-v8r/serial_pl011.h @@ -64,19 +64,5 @@ * Public Function Prototypes ****************************************************************************/ -/**************************************************************************** - * Name: fvp_earlyserialinit - * - * Description: - * Performs the low level UART initialization early in debug so that the - * serial console will be available during bootup. This must be called - * before arm_serialinit. - * - ****************************************************************************/ - -#ifdef USE_EARLYSERIALINIT -void fvp_earlyserialinit(void); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM64_SRC_FVP_V8R_SERIAL_PL011_H */ diff --git a/arch/arm64/src/qemu/qemu_boot.c b/arch/arm64/src/qemu/qemu_boot.c index a84e1b9803..937b22693b 100644 --- a/arch/arm64/src/qemu/qemu_boot.c +++ b/arch/arm64/src/qemu/qemu_boot.c @@ -173,6 +173,6 @@ void arm64_chip_boot(void) * driver. */ - qemu_earlyserialinit(); + arm64_earlyserialinit(); #endif } diff --git a/arch/arm64/src/qemu/qemu_serial.c b/arch/arm64/src/qemu/qemu_serial.c index 27b79a7076..a825e5c56f 100644 --- a/arch/arm64/src/qemu/qemu_serial.c +++ b/arch/arm64/src/qemu/qemu_serial.c @@ -786,22 +786,15 @@ static struct uart_dev_s g_uart1port = ***************************************************************************/ /*************************************************************************** - * Name: qemu_earlyserialinit + * Name: arm64_earlyserialinit * * Description: - * Performs the low level UART initialization early in - * debug so that the serial console will be available - * during bootup. This must be called before arm_serialinit. + * see arm64_internal.h * ***************************************************************************/ -void qemu_earlyserialinit(void) +void arm64_earlyserialinit(void) { - /* NOTE: This function assumes that low level hardware configuration - * -- including all clocking and pin configuration -- was performed by the - * function imx8_lowsetup() earlier in the boot sequence. - */ - /* Enable the console UART. The other UARTs will be initialized if and * when they are first opened. */ @@ -839,8 +832,7 @@ int up_putc(int ch) * Name: arm64_serialinit * * Description: - * Register serial console and serial ports. This assumes - * that imx_earlyserialinit was called previously. + * see arm64_internal.h * ***************************************************************************/ diff --git a/arch/arm64/src/qemu/qemu_serial.h b/arch/arm64/src/qemu/qemu_serial.h index 9b5ea88f95..815ec639a3 100644 --- a/arch/arm64/src/qemu/qemu_serial.h +++ b/arch/arm64/src/qemu/qemu_serial.h @@ -57,19 +57,5 @@ * Public Function Prototypes ****************************************************************************/ -/**************************************************************************** - * Name: qemu_earlyserialinit - * - * Description: - * Performs the low level UART initialization early in debug so that the - * serial console will be available during bootup. This must be called - * before arm_serialinit. - * - ****************************************************************************/ - -#ifdef USE_EARLYSERIALINIT -void qemu_earlyserialinit(void); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM64_SRC_QEMU_QEMU_SERIAL_H */