]> git.proxmox.com Git - qemu.git/blame - hw/vga-isa.c
tcg-s390: Fix merge error in tgen_brcond
[qemu.git] / hw / vga-isa.c
CommitLineData
76323919
JQ
1/*
2 * QEMU ISA VGA Emulator.
3 *
cc228248
GH
4 * see docs/specs/standard-vga.txt for virtual hardware specs.
5 *
76323919
JQ
6 * Copyright (c) 2003 Fabrice Bellard
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
83c9f4ca 26#include "hw/hw.h"
28ecbaee 27#include "ui/console.h"
83c9f4ca
PB
28#include "hw/pc.h"
29#include "hw/vga_int.h"
28ecbaee 30#include "ui/pixel_ops.h"
1de7afc9 31#include "qemu/timer.h"
83c9f4ca 32#include "hw/loader.h"
76323919 33
7435b791
BS
34typedef struct ISAVGAState {
35 ISADevice dev;
36 struct VGACommonState state;
37} ISAVGAState;
38
39static void vga_reset_isa(DeviceState *dev)
76323919 40{
7435b791
BS
41 ISAVGAState *d = container_of(dev, ISAVGAState, dev.qdev);
42 VGACommonState *s = &d->state;
76323919 43
7435b791
BS
44 vga_common_reset(s);
45}
76323919 46
7435b791
BS
47static int vga_initfn(ISADevice *dev)
48{
49 ISAVGAState *d = DO_UPCAST(ISAVGAState, dev, dev);
50 VGACommonState *s = &d->state;
b1950430 51 MemoryRegion *vga_io_memory;
0a039dc7 52 const MemoryRegionPortio *vga_ports, *vbe_ports;
76323919 53
4a1e244e 54 vga_common_init(s);
53d6e682 55 s->legacy_address_space = isa_address_space(dev);
0a039dc7
RH
56 vga_io_memory = vga_init_io(s, &vga_ports, &vbe_ports);
57 isa_register_portio_list(dev, 0x3b0, vga_ports, s, "vga");
58 if (vbe_ports) {
59 isa_register_portio_list(dev, 0x1ce, vbe_ports, s, "vbe");
60 }
be20f9e9 61 memory_region_add_subregion_overlap(isa_address_space(dev),
b1950430
AK
62 isa_mem_base + 0x000a0000,
63 vga_io_memory, 1);
64 memory_region_set_coalescing(vga_io_memory);
c78f7137
GH
65 s->con = graphic_console_init(s->update, s->invalidate,
66 s->screen_dump, s->text_update, s);
76323919 67
be20f9e9 68 vga_init_vbe(s, isa_address_space(dev));
5245d57a
GH
69 /* ROM BIOS */
70 rom_add_vga(VGABIOS_FILENAME);
76323919
JQ
71 return 0;
72}
7435b791 73
4a1e244e
GH
74static Property vga_isa_properties[] = {
75 DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
76 DEFINE_PROP_END_OF_LIST(),
77};
78
8f04ee08
AL
79static void vga_class_initfn(ObjectClass *klass, void *data)
80{
39bffca2 81 DeviceClass *dc = DEVICE_CLASS(klass);
8f04ee08
AL
82 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
83 ic->init = vga_initfn;
39bffca2
AL
84 dc->reset = vga_reset_isa;
85 dc->vmsd = &vmstate_vga_common;
4a1e244e 86 dc->props = vga_isa_properties;
8f04ee08
AL
87}
88
8c43a6f0 89static const TypeInfo vga_info = {
39bffca2
AL
90 .name = "isa-vga",
91 .parent = TYPE_ISA_DEVICE,
92 .instance_size = sizeof(ISAVGAState),
93 .class_init = vga_class_initfn,
7435b791
BS
94};
95
83f7d43a 96static void vga_register_types(void)
7435b791 97{
39bffca2 98 type_register_static(&vga_info);
7435b791 99}
83f7d43a
AF
100
101type_init(vga_register_types)