summaryrefslogtreecommitdiffstats
path: root/drivers/video/bochs/bochs_isa.c
blob: f273ac5f74a8acda7a29c52d87a50f97e1dda182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: Copyright (c) 2020 Ahmad Fatoum, Pengutronix
/*
 *  ISA driver entry point for VGA with the Bochs VBE / QEMU stdvga extensions.
 */

#include <common.h>
#include <driver.h>
#include <linux/ioport.h>
#include "bochs_hw.h"

static int bochs_isa_detect(void)
{
	struct device_d *dev;
	int ret;

	outw(0, VBE_DISPI_IOPORT_INDEX);
	ret = inw(VBE_DISPI_IOPORT_DATA);

	if ((ret & 0xB0C0) != 0xB0C0)
		return -ENODEV;

	dev = device_alloc("bochs-dispi", 0);

	ret = platform_device_register(dev);
	if (ret)
		return ret;

	return bochs_hw_probe(dev, (void *)0xe0000000, NULL);
}
device_initcall(bochs_isa_detect);