u-boot/drivers/serial
Mark Kettenis c12f9d2e54 drivers: serial: Make sure we really return a serial device
The stdout-path property in the device tree does not necessarily
point at a serial device. On machines such as the Apple M1 laptops
where the serial port isn't easy to access and users expect to see
console output on the integrated display stdout-path may point at
the device tree node for the framebuffer for example.

If stdout-path does not point at a node for a serial device, the
serial_check_stdout() will not find a bound device and will drop
down into code that attempts to use lists_bind_fdt() to bind a
device anyway. However, that fallback code does not check that
the uclass of the device is UCLASS_SERIAL. So if stdout-path points
at the framebuffer instead of the serial device it will return a
UCLASS_VIDEO device. Since the code that calls this function
expects the returned device to be a UCLASS_SERIAL device, U-Boot
will crash as soon as it attempts to send output to the console.

Add a check here to verify that the uclass of the bound device
really is UCLASS_SERIAL. If it isn't, serial_check_stdout() will
return an error and serial_find_console_or_panic() will use the
serial device with sequence number 0 as the console and all is fine.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-03-08 08:42:43 -05:00
..
altera_jtag_uart.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
altera_uart.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
arm_dcc.c serial: arm_dcc: Use CONFIG_ARM64 not CONFIG_CPU_ARMV8 2021-12-27 16:20:18 -05:00
atmel_usart.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
atmel_usart.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig serial: Add RISC-V HTIF console driver 2022-02-10 11:18:12 +08:00
lpc32xx_hsuart.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
Makefile serial: Add RISC-V HTIF console driver 2022-02-10 11:18:12 +08:00
ns16550.c ti: keystone: Move away from CONFIG_SOC_KEYSTONE 2021-09-27 21:38:34 -04:00
sandbox.c sandbox: sandbox_serial_pending depends on DM_VIDEO 2022-01-25 12:36:11 -07:00
serial-uclass.c drivers: serial: Make sure we really return a serial device 2022-03-08 08:42:43 -05:00
serial.c global: Convert simple_strtoul() with decimal to dectoul() 2021-08-02 13:32:14 -04:00
serial_ar933x.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_arc.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_bcm283x_mu.c doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
serial_bcm283x_pl011.c doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
serial_bcm6345.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_coreboot.c x86: Make coreboot sysinfo available to any x86 board 2021-03-27 13:59:37 +13:00
serial_cortina.c dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
serial_efi.c efi: serial: Support arrow keys 2021-12-31 06:45:01 +01:00
serial_htif.c serial: Add RISC-V HTIF console driver 2022-02-10 11:18:12 +08:00
serial_intel_mid.c serial: Update NS16550_t and struct NS16550 2021-01-05 12:24:40 -07:00
serial_linflexuart.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_lpuart.c Finish conversion of CONFIG_SYS_CLK_FREQ to Kconfig 2021-12-27 16:20:18 -05:00
serial_mcf.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_meson.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
serial_mpc8xx.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_msm.c WS cleanup: remove trailing white space 2021-09-30 08:08:56 -04:00
serial_msm_geni.c serial: qcom: add support for GENI serial driver 2021-10-31 08:46:44 -04:00
serial_mt7620.c treewide: Use OF_REAL instead of !OF_PLATDATA 2021-09-25 09:46:15 -06:00
serial_mtk.c serial: mtk: rewrite the setbrg function 2021-03-20 16:24:27 -04:00
serial_mvebu_a3700.c Prepare v2022.01-rc4 2021-12-20 17:12:04 -05:00
serial_mxc.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_ns16550.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_nulldev.c serial: remove nulldev_serial_input 2022-02-09 12:30:13 -07:00
serial_octeon_bootcmd.c serial: serial_octeon_bootcmd.c: Add PCI remote console support 2021-04-23 21:22:55 +02:00
serial_octeon_pcie_console.c serial: serial_octeon_pcie_console.c: Add PCI remote console support 2021-04-23 21:22:55 +02:00
serial_omap.c treewide: Simply conditions with the new OF_REAL 2021-09-25 09:46:15 -06:00
serial_owl.c dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
serial_pic32.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_pl01x.c serial: pl011: Enable DEBUG_UART_PL011 in SPL 2021-07-24 08:57:53 -04:00
serial_pl01x_internal.h dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
serial_pxa.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_rockchip.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
serial_s5p.c serial: samsung: add support for skip debug init in s5p 2021-10-31 11:25:39 -04:00
serial_sbi.c serial: Add a debug console using the RISC-V SBI interface 2021-10-07 16:08:23 +08:00
serial_sh.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_sh.h sh: sh3: Remove CPU support 2019-05-10 22:43:18 +02:00
serial_sifive.c Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
serial_sti_asc.c WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
serial_stm32.c serial: stm32: define LOG_CATEGORY 2021-01-13 09:52:58 +01:00
serial_stm32.h dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
serial_uniphier.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_xen.c WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
serial_xuartlite.c Xilinx changes for v2021.04 2021-01-06 07:57:33 -05:00
serial_zynq.c serial: zynq: Add missing xlnx,zynqmp-uart compatible 2022-01-12 10:40:32 +01:00
usbtty.c serial: usbtty: Send urb data in correct order 2021-03-03 04:12:45 +01:00
usbtty.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00