blob: 9c005851ea21f36de8c476961b59e8015f4b4c2b [file] [log] [blame]
Kyösti Mälkki03731d72014-02-02 19:12:14 +02001/*
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
26static int qemu_debugcon_detected CAR_GLOBAL;
27
28void 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
37void 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}