blob: 3807524c5cb73816db80c0ba06e266591b6b9f06 [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.
Kyösti Mälkki03731d72014-02-02 19:12:14 +020015 */
16
17#include <console/console.h>
18#include <console/qemu_debugcon.h>
19#include <arch/io.h>
20#include <arch/early_variables.h>
21
22static int qemu_debugcon_detected CAR_GLOBAL;
23
24void qemu_debugcon_init(void)
25{
26 int detected = (inb(CONFIG_CONSOLE_QEMU_DEBUGCON_PORT) == 0xe9);
27 car_set_var(qemu_debugcon_detected, detected);
28 printk(BIOS_INFO, "QEMU debugcon %s [port 0x%x]\n",
29 detected ? "detected" : "not found",
30 CONFIG_CONSOLE_QEMU_DEBUGCON_PORT);
31}
32
33void qemu_debugcon_tx_byte(unsigned char data)
34{
35 if (car_get_var(qemu_debugcon_detected) != 0)
36 outb(data, CONFIG_CONSOLE_QEMU_DEBUGCON_PORT);
37}