Kyösti Mälkki | 03731d7 | 2014-02-02 19:12:14 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Red Hat Inc. |
| 5 | * Written by Gerd Hoffmann <kraxel@redhat.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include <console/console.h> |
| 22 | #include <console/qemu_debugcon.h> |
| 23 | #include <arch/io.h> |
| 24 | #include <arch/early_variables.h> |
| 25 | |
| 26 | static int qemu_debugcon_detected CAR_GLOBAL; |
| 27 | |
| 28 | void qemu_debugcon_init(void) |
| 29 | { |
| 30 | int detected = (inb(CONFIG_CONSOLE_QEMU_DEBUGCON_PORT) == 0xe9); |
| 31 | car_set_var(qemu_debugcon_detected, detected); |
| 32 | printk(BIOS_INFO, "QEMU debugcon %s [port 0x%x]\n", |
| 33 | detected ? "detected" : "not found", |
| 34 | CONFIG_CONSOLE_QEMU_DEBUGCON_PORT); |
| 35 | } |
| 36 | |
| 37 | void qemu_debugcon_tx_byte(unsigned char data) |
| 38 | { |
| 39 | if (car_get_var(qemu_debugcon_detected) != 0) |
| 40 | outb(data, CONFIG_CONSOLE_QEMU_DEBUGCON_PORT); |
| 41 | } |