On Sat, Sep 07, 2024 at 11:37:09AM +0800, maobibo wrote: > Hi Jason, > > It works well with ELF kernel, however it fails to boot with UEFI BIOS. > Maybe it is problem of UEFI BIOS, can we create UART in reverse order? > so that it can work well on both ELF kernel and UEFI BIOS. > > Also for develops they usually use as earlycon with command line > -serial stdio --append "... earlycon=uart,mmio,0x1fe001e0", this > requires to uart with address 0x1fe001e0 as the first serial port. > > Just small code base your patch like this: > > - for (i = 0; i < VIRT_UART_COUNT; ++i) { > + for (i = VIRT_UART_COUNT - 1; i >= 0; i--) { > hwaddr base = VIRT_UART_BASE + i * VIRT_UART_SIZE; > int irq = VIRT_UART_IRQ + i - VIRT_GSI_BASE; > serial_mm_init(get_system_memory(), base, 0, > qdev_get_gpio_in(pch_pic, irq), > - 115200, serial_hd(VIRT_UART_COUNT - 1 - i), > + 115200, serial_hd(i), > DEVICE_LITTLE_ENDIAN); > - fdt_add_uart_node(lvms, pch_pic_phandle, base, irq, i == > VIRT_UART_COUNT - 1 - i); > + fdt_add_uart_node(lvms, pch_pic_phandle, base, irq, i == 0); > }
Fixed: https://lore.kernel.org/all/20240907143439.2792924-1-ja...@zx2c4.com/