Replace special rules for auxiliary files by cbfs-files-y entries
[coreboot.git] / src / console / uart8250_console.c
blob53ca3a762ef0d96d8ceefc75622c36d18ac1dbeb
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2003 Eric Biederman
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <console/console.h>
21 #include <uart8250.h>
22 #include <pc80/mc146818rtc.h>
24 static void ttyS0_init(void)
26 static const unsigned char div[8] = { 1, 2, 3, 6, 12, 24, 48, 96 };
27 int b_index = 0;
28 unsigned int divisor = CONFIG_TTYS0_DIV;
30 if (get_option(&b_index, "baud_rate") == 0) {
31 divisor = div[b_index];
33 uart8250_init(CONFIG_TTYS0_BASE, divisor);
36 static void ttyS0_tx_byte(unsigned char data)
38 uart8250_tx_byte(CONFIG_TTYS0_BASE, data);
41 static unsigned char ttyS0_rx_byte(void)
43 return uart8250_rx_byte(CONFIG_TTYS0_BASE);
46 static int ttyS0_tst_byte(void)
48 return uart8250_can_rx_byte(CONFIG_TTYS0_BASE);
51 static const struct console_driver uart8250_console __console = {
52 .init = ttyS0_init,
53 .tx_byte = ttyS0_tx_byte,
54 .rx_byte = ttyS0_rx_byte,
55 .tst_byte = ttyS0_tst_byte,