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) Differential Revision: https://reviews.freebsd.org/D36788
This commit is contained in:
parent
79794d5c18
commit
4a4ad02da3
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user