boot2/loader: serial port handling
Xin Li
delphij at delphij.net
Sat Oct 13 00:09:42 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 10/12/12 17:04, Garrett Cooper wrote:
> 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)?
Ah I wish I am not this far behind my email backlog. Yes I think
these (241300 and 241301) will solve the problem.
Cheers,
- --
Xin LI <delphij at delphij.net> https://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
-----BEGIN PGP SIGNATURE-----
iQEcBAEBCAAGBQJQeLFFAAoJEG80Jeu8UPuzktAH/3nyrSCrvHWlOSp/eOWf1oMU
KQwzyUXOVgKWCVTHUYHN6tCs0sN1Vguc1n+Q8tqSCuDOJ4/x0lyb6GcyxZv2tf6+
gGYE54yYjf9UDM0HQ3Zb3ZxmH8Z06eH3jK/SlUg8nMXnReLW2v1KkuQ+T3yTyhQH
7vCjOzQylF4CmzpS7l/skNL2lxkJsoD/XROFzRrDAUSK2rdnupjUIxuTXI2G+Bjf
i51qFZk6JRHnecL2c4Zm6ynO65eXyD0Ux7l+FOa00ntOKD33/HJP/Qtpl2UrU+J5
YhMcPUU2uRM3LTSl2D3mtbasrgKQMTmH4syp4ucR7belFPloX7RYjHItQdO6x1M=
=0R8e
-----END PGP SIGNATURE-----
More information about the freebsd-current
mailing list