summaryrefslogtreecommitdiff
path: root/src/lib/uart8250.c
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2011-04-22 02:17:26 +0000
committerStefan Reinauer <stepan@openbios.org>2011-04-22 02:17:26 +0000
commitf349d55beb6d93aca4d49ac4515c5ef11bb58d8d (patch)
tree2523dba6b117e5769e4e389b6166a66ff41386fc /src/lib/uart8250.c
parent6aca1e8b26e712d056816ba936fb4d5834a07467 (diff)
downloadcoreboot-f349d55beb6d93aca4d49ac4515c5ef11bb58d8d.tar.xz
Get rid of all but one (I/O mapped) UART init functions.
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6539 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/lib/uart8250.c')
-rw-r--r--src/lib/uart8250.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/lib/uart8250.c b/src/lib/uart8250.c
index e7a75017a9..cea400eddc 100644
--- a/src/lib/uart8250.c
+++ b/src/lib/uart8250.c
@@ -85,7 +85,6 @@ void uart8250_init(unsigned base_port, unsigned divisor)
outb(CONFIG_TTYS0_LCS, base_port + UART_LCR);
}
-#if defined(__PRE_RAM__) || defined(__SMM__)
void uart_init(void)
{
/* TODO the divisor calculation is hard coded to standard UARTs. Some
@@ -94,16 +93,21 @@ void uart_init(void)
* codes as the only devices that might be different are the iWave
* iRainbowG6 and the OXPCIe952 card (and the latter is memory mapped)
*/
-#if CONFIG_USE_OPTION_TABLE && !defined(__SMM__)
- static const unsigned char divisor[] = { 1, 2, 3, 6, 12, 24, 48, 96 };
- unsigned ttys0_div, ttys0_index;
- ttys0_index = read_option(CMOS_VSTART_baud_rate, CMOS_VLEN_baud_rate, 0);
- ttys0_index &= 7;
- ttys0_div = divisor[ttys0_index];
-
- uart8250_init(CONFIG_TTYS0_BASE, ttys0_div);
+ unsigned int div = (115200 / CONFIG_TTYS0_BAUD);
+
+#if !defined(__SMM__) && CONFIG_USE_OPTION_TABLE
+ static const unsigned char divisor[8] = { 1, 2, 3, 6, 12, 24, 48, 96 };
+ unsigned b_index = 0;
+#if defined(__PRE_RAM__)
+ b_index = read_option(CMOS_VSTART_baud_rate, CMOS_VLEN_baud_rate, 0);
+ b_index &= 7;
+ div = divisor[ttys0_index];
#else
- uart8250_init(CONFIG_TTYS0_BASE, (115200 / CONFIG_TTYS0_BAUD));
+ if (get_option(&b_index, "baud_rate") == 0) {
+ div = divisor[b_index];
+ }
#endif
-}
#endif
+
+ uart8250_init(CONFIG_TTYS0_BASE, div);
+}