blob: 730ef3e0de4ff414377f38505e88061c4088b1e7 [file] [log] [blame]
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Google Inc.
5 *
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.
9 *
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.
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000014 */
15
16#include <types.h>
17#include <console/uart.h>
18#include <arch/io.h>
19#include <boot/coreboot_tables.h>
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000020
21static uint8_t *buf = (void *)0x3f8;
22uintptr_t uart_platform_base(int idx)
23{
24 return (uintptr_t) buf;
25}
26
27void uart_init(int idx)
28{
29}
30
31unsigned char uart_rx_byte(int idx)
32{
33 return *buf;
34}
35
36void uart_tx_byte(int idx, unsigned char data)
37{
38 *buf = data;
39}
40
41void uart_tx_flush(int idx)
42{
43}
44
45#ifndef __PRE_RAM__
46void uart_fill_lb(void *data)
47{
48 struct lb_serial serial;
49 serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
50 serial.baseaddr = 0x3f8;
51 serial.baud = 115200;
Vadim Bendebury9dccf1c2015-01-09 16:54:19 -080052 serial.regwidth = 1;
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000053 lb_add_serial(&serial, data);
54 lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
55}
56#endif