GRUB tries to use nonexistent serial port
In serial_hw_init(), GRUB will happily try to use the port even if the address is 0. Since serial_hw_get_port() returns the firmware's port address which is 0 to indicate no port, we need to fail in that case.
We also don't properly fail if the firmware lies to us, which means we'll happily use a nonexistent port with a valid address. In either case, we'll usually end up in the delay loop in serial_hw_put() for every single character.
Instead, we need to do two things, at minimum: first, fail on port 0; second, write and read back the UART's scratch register and verify the contents, failing if they don't match. This is what asy(7d) does.
There's a second enhancement that's really needed here, which is to have GRUB support an "all-consoles" option that will send output to and accept input from every working serial port. Without this but with the above changes, there's no fallback if the unit specified in the configuration file does not exist/work. That will be covered by a separate RFE.
Updated by Electric Monk over 6 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 5626beece2e5dedec7197ecf325cfaa1854a6c2e Author: Keith M Wesolowski <email@example.com> Date: 2016-04-08T20:26:43.000Z 6834 GRUB tries to use nonexistent serial port 6835 GRUB should allow multiple serial consoles Reviewed by: Hans Rosenfeld <firstname.lastname@example.org> Approved by: Richard Lowe <email@example.com>