it's becoming increasingly popular for manufacturers
to ship motherboards with no serial ports at all.
my terminal has nonfunctional uarts. it's easy enough
to add in pci(e) based serial cards. i just got a startech
pex2s with 2x 16c950 uarts.

unfortunately, i didn't realize that only i8250 work as
consoles.  this makes sense if you always get a serial
console, since pci uarts are obviously not available
until the pci bus has been scanned, which is much later
in the boot process than the onboard uarts can be
enabled.  but, i don't have much choice.

initially i copied the code from uarti8250.c and got
things going, but that doesn't help anyone with a
uartixp or an uartisa part, and it seemed like a hokey
way of doing things.

so on a flier, i rearranged things a little bit by doing
two odd things, 
- adding a function uartconsconf that returns the
uart number and the boot-time cmd string.
- adding a command for enabling a console on a uart (z).

thus, uartreset just needs to call uartsconsconf to
find the boot-time console and call uartctl twice to
configure any console.  for special consoles that can
be enabled really early in boot, a very simple function
is needed.  i8250console, for example, becomes:

void
i8250console(void)
{
        int n;
        char *cmd;

        n = uartconsconf(&cmd);
        if(n == 0 || n == 1){
                uartctl(i8250uart + n, "z");
                uartctl(i8250uart + n, cmd);
        }
}

(i think a similar trick would work for other
arches' consoles.)

as a bonus, adding a command (y) to disable a uart
console fell out naturally.  this is could have saved a
few reboots had it been available before!

in any event, i welcome any feedback.

- erik


Reply via email to