virtio-pci: drop unused wmb macro
[qemu/qmp-unstable.git] / hw / display / vga-isa.c
blob9e63b69e03d47162361ff6434fc187dedcfcb141
1 /*
2 * QEMU ISA VGA Emulator.
4 * see docs/specs/standard-vga.txt for virtual hardware specs.
6 * Copyright (c) 2003 Fabrice Bellard
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:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
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.
26 #include "hw/hw.h"
27 #include "ui/console.h"
28 #include "hw/i386/pc.h"
29 #include "vga_int.h"
30 #include "ui/pixel_ops.h"
31 #include "qemu/timer.h"
32 #include "hw/loader.h"
34 #define TYPE_ISA_VGA "isa-vga"
35 #define ISA_VGA(obj) OBJECT_CHECK(ISAVGAState, (obj), TYPE_ISA_VGA)
37 typedef struct ISAVGAState {
38 ISADevice parent_obj;
40 struct VGACommonState state;
41 } ISAVGAState;
43 static void vga_isa_reset(DeviceState *dev)
45 ISAVGAState *d = ISA_VGA(dev);
46 VGACommonState *s = &d->state;
48 vga_common_reset(s);
51 static int vga_initfn(ISADevice *dev)
53 ISAVGAState *d = ISA_VGA(dev);
54 VGACommonState *s = &d->state;
55 MemoryRegion *vga_io_memory;
56 const MemoryRegionPortio *vga_ports, *vbe_ports;
58 vga_common_init(s);
59 s->legacy_address_space = isa_address_space(dev);
60 vga_io_memory = vga_init_io(s, &vga_ports, &vbe_ports);
61 isa_register_portio_list(dev, 0x3b0, vga_ports, s, "vga");
62 if (vbe_ports) {
63 isa_register_portio_list(dev, 0x1ce, vbe_ports, s, "vbe");
65 memory_region_add_subregion_overlap(isa_address_space(dev),
66 isa_mem_base + 0x000a0000,
67 vga_io_memory, 1);
68 memory_region_set_coalescing(vga_io_memory);
69 s->con = graphic_console_init(DEVICE(dev), s->hw_ops, s);
71 vga_init_vbe(s, isa_address_space(dev));
72 /* ROM BIOS */
73 rom_add_vga(VGABIOS_FILENAME);
74 return 0;
77 static Property vga_isa_properties[] = {
78 DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
79 DEFINE_PROP_END_OF_LIST(),
82 static void vga_isa_class_initfn(ObjectClass *klass, void *data)
84 DeviceClass *dc = DEVICE_CLASS(klass);
85 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
87 ic->init = vga_initfn;
88 dc->reset = vga_isa_reset;
89 dc->vmsd = &vmstate_vga_common;
90 dc->props = vga_isa_properties;
93 static const TypeInfo vga_isa_info = {
94 .name = TYPE_ISA_VGA,
95 .parent = TYPE_ISA_DEVICE,
96 .instance_size = sizeof(ISAVGAState),
97 .class_init = vga_isa_class_initfn,
100 static void vga_isa_register_types(void)
102 type_register_static(&vga_isa_info);
105 type_init(vga_isa_register_types)