Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2012 17:04:24 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        d@delphij.net
Cc:        freebsd-current@freebsd.org
Subject:   Re: boot2/loader: serial port handling
Message-ID:  <CAGH67wQNr%2BZtZPUs-NfLYixEDtzv_O6q4kFhcjFyfacMPfssBw@mail.gmail.com>
In-Reply-To: <5078A803.7070705@delphij.net>
References:  <5078A803.7070705@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 12, 2012 at 4:30 PM, Xin Li <delphij@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wQNr%2BZtZPUs-NfLYixEDtzv_O6q4kFhcjFyfacMPfssBw>