Re: boot2/loader: serial port handling

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Fri, 12 Oct 2012 17:04:24 -0700
On Fri, Oct 12, 2012 at 4:30 PM, Xin Li <delphij_at_delphij.net> wrote:
> Hi,
>
> We have some rather hacky quick hack at $WORK that addresses a problem
> we have found with boot2/loader and wants to share it and see if we can
> have more neat solution.
>
> Here is the problem: the current boot2 and loader have various places
> where it considers serial port to exist.  When the port is not there,
> the code would hang because it tests whether the hardware's -READY bit,
> basically something like:
>
>         do {
>         } while (inpb(state register) & READY_BIT);
>
> This unfortunately would enter an infinite loop when the device is not
> present -- all in operations would get all bits set.
>
> To reproduce this, one can compile boot2/loader with non-existent port
> and the system will hang at very early stage of boot.
>
> ---
>
> Because boot2 is size constrained we can not use very sophisticated
> detection logic there, what I did is to use something like:
>
>         outb(line control register, word)
>         if (inb(line control register) != word)
>                 Disable the serial port read/write
>
> For loader I'm not sure if we should use better detection logic.  By the
> way, it seems that the system may force using the default console in
> loader regardless if the detection logic said no, if it decides that's
> the only usable one.
>
> So what would be the right way to solve these issue?

    Have you tried out Andriy's commit yet to loader(8) (r241301)?
Cheers,
-Garrett
Received on Fri Oct 12 2012 - 22:04:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:31 UTC