Serial console support in a boot loader is very useful. Thank you for supporting it.
The boot loader should support the 8250A UART and its programming-compatible 82510, 16450, 16550 and 16750 descendants. The serial chip used in the IBM PC/XT, the 8250 (no A), and its 8250B descendant need not be supported. The 8250A data sheet is 82C50A CMOS Asynchronous Communications Element and is updated by Intel's errata 82510 PC Software Compatibility. The 16550 data sheet is PC16550D Universal Asynchronous Receiver/Transmitter with FIFOs.
To set the serial port and serial parameters, most Linux boot loaders use a syntax modeled upon the kernel's console parameter. It would be nice to retain this consistency, since the user needs to learn the kernel syntax in any case.
The default value should be 9600bps, 8 data bits, no parity, 1 stop bit and CTS/RTS flow control. This gives the maximum interoperability with the other programs that use the serial console.
Please do not ignore the lower speeds, as remote serial console is at its most valuable when the computer is located three days walk up a mountain in the New Guinea highlands. It is difficult to get more than 75bps from HF radio under adverse sky conditions.
Be conservative in your use of the modem status lines. Even if you are ignoring incoming status (DSR, DCD) and handshaking lines (RTS) at least assert the outgoing status (DTR) and handshaking (CTS) lines. Correctly configured modems will not receive calls with DTR low, and dropping DTR will cause the modem to hang up.
Consider that the BIOS may have already initialised the UART and provide a configuration option to allow the boot loader to be informed of that. When the boot loader initialises the UART, DTR will fall and the line will hang up. In some scenarios each hang up requires the satelite circuit to be re-booked before another call can be placed.
Cater for line noise. Imagine the boot loader starting and then being sent nonsensical characters every few seconds. Although this is certainly wrong, a fault in a modem is difficult to remotely diagnose and correct if the machine is left stranded at the boot loader prompt. A solution is to boot the default image upon the expiry of a timer; the boot occurring even if the user (or line noise) has started to type. For example the boot loader configuration could say:
# Start the machine regardless after 30 minutes # 30 * 60 seconds per minute * units of tenths of seconds lifetime 18000
The default should be no life timer. The timer is also useful in high availability applications: when a machine is used in environments with an planned availability of 99.999% the lifetime value should be configured to three minutes or less.
Check information read from the BIOS for reasonablness. For example, if the BIOS's Extended Data Area suggests 0x000 as the address for the serial port's registers then don't try to initialise the registers.