git: af0995b7f365 - stable/13 - uart: uart_cpu_arm64: fix the build without FDT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Nov 2022 17:03:09 UTC
The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=af0995b7f3655a8f31c6d2e5d93cbbb5a4b09570 commit af0995b7f3655a8f31c6d2e5d93cbbb5a4b09570 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2022-09-29 19:33:32 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2022-11-02 17:02:24 +0000 uart: uart_cpu_arm64: fix the build without FDT clang 14 doesn't properly determine that we're unconditionally returning if we have ACPI but not FDT. Push FDT setup entirely into a new function, much like we currently do with ACPI, and just return ENXIO if that doesn't succeed. Reviewed by: andrew, manu (earlier version) (cherry picked from commit 4a4ad02da3c8f598b4ccf15b6cac9de3ebce3ba1) --- sys/dev/uart/uart_cpu_arm64.c | 52 ++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/sys/dev/uart/uart_cpu_arm64.c b/sys/dev/uart/uart_cpu_arm64.c index 148bf749f0bb..382e76c57a67 100644 --- a/sys/dev/uart/uart_cpu_arm64.c +++ b/sys/dev/uart/uart_cpu_arm64.c @@ -79,33 +79,17 @@ uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) return ((pmap_kextract(b1->bsh) == pmap_kextract(b2->bsh)) ? 1 : 0); } -int -uart_cpu_getdev(int devtype, struct uart_devinfo *di) +#ifdef FDT +static int +uart_cpu_fdt_setup(struct uart_class *class, int devtype, struct uart_devinfo *di) { - struct uart_class *class; bus_space_handle_t bsh; bus_space_tag_t bst; u_int rclk, shift, iowidth; int br, err; - /* Allow overriding the FDT using the environment. */ - class = &uart_ns8250_class; - err = uart_getenv(devtype, di, class); - if (err == 0) - return (0); - -#ifdef DEV_ACPI - /* Check if SPCR can tell us what console to use. */ - if (uart_cpu_acpi_spcr(devtype, di) == 0) - return (0); -#endif - err = ENXIO; -#ifdef FDT - if (err != 0) { - err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, - &shift, &iowidth, devtype); - } -#endif + err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, + &shift, &iowidth, devtype); if (err != 0) return (err); @@ -128,3 +112,29 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (0); } +#endif + +int +uart_cpu_getdev(int devtype, struct uart_devinfo *di) +{ + struct uart_class *class; + int err; + + /* Allow overriding ACPI/FDT using the environment. */ + class = &uart_ns8250_class; + err = uart_getenv(devtype, di, class); + if (err == 0) + return (0); + +#ifdef DEV_ACPI + /* Check if SPCR can tell us what console to use. */ + if (uart_cpu_acpi_spcr(devtype, di) == 0) + return (0); +#endif +#ifdef FDT + if (uart_cpu_fdt_setup(class, devtype, di) == 0) + return (0); +#endif + + return (ENXIO); +}