Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 1 | /* |
| 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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <types.h> |
| 17 | #include <console/uart.h> |
| 18 | #include <arch/io.h> |
| 19 | #include <boot/coreboot_tables.h> |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 20 | |
| 21 | static uint8_t *buf = (void *)0x3f8; |
| 22 | uintptr_t uart_platform_base(int idx) |
| 23 | { |
| 24 | return (uintptr_t) buf; |
| 25 | } |
| 26 | |
| 27 | void uart_init(int idx) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | unsigned char uart_rx_byte(int idx) |
| 32 | { |
| 33 | return *buf; |
| 34 | } |
| 35 | |
| 36 | void uart_tx_byte(int idx, unsigned char data) |
| 37 | { |
| 38 | *buf = data; |
| 39 | } |
| 40 | |
| 41 | void uart_tx_flush(int idx) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | #ifndef __PRE_RAM__ |
| 46 | void 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 Bendebury | 9dccf1c | 2015-01-09 16:54:19 -0800 | [diff] [blame] | 52 | serial.regwidth = 1; |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 53 | lb_add_serial(&serial, data); |
| 54 | lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data); |
| 55 | } |
| 56 | #endif |