vga-isa.c (a72dc5fc67cd2412be35dc17698a4eb4f7e00a0c) vga-isa.c (db895a1e6a97e919f9b86d60c969377357b05066)
1/*
2 * QEMU ISA VGA Emulator.
3 *
4 * see docs/specs/standard-vga.txt for virtual hardware specs.
5 *
6 * Copyright (c) 2003 Fabrice Bellard
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy

--- 34 unchanged lines hidden (view full) ---

43static void vga_isa_reset(DeviceState *dev)
44{
45 ISAVGAState *d = ISA_VGA(dev);
46 VGACommonState *s = &d->state;
47
48 vga_common_reset(s);
49}
50
1/*
2 * QEMU ISA VGA Emulator.
3 *
4 * see docs/specs/standard-vga.txt for virtual hardware specs.
5 *
6 * Copyright (c) 2003 Fabrice Bellard
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy

--- 34 unchanged lines hidden (view full) ---

43static void vga_isa_reset(DeviceState *dev)
44{
45 ISAVGAState *d = ISA_VGA(dev);
46 VGACommonState *s = &d->state;
47
48 vga_common_reset(s);
49}
50
51static int vga_initfn(ISADevice *dev)
51static void vga_isa_realizefn(DeviceState *dev, Error **errp)
52{
52{
53 ISADevice *isadev = ISA_DEVICE(dev);
53 ISAVGAState *d = ISA_VGA(dev);
54 VGACommonState *s = &d->state;
55 MemoryRegion *vga_io_memory;
56 const MemoryRegionPortio *vga_ports, *vbe_ports;
57
58 vga_common_init(s);
54 ISAVGAState *d = ISA_VGA(dev);
55 VGACommonState *s = &d->state;
56 MemoryRegion *vga_io_memory;
57 const MemoryRegionPortio *vga_ports, *vbe_ports;
58
59 vga_common_init(s);
59 s->legacy_address_space = isa_address_space(dev);
60 s->legacy_address_space = isa_address_space(isadev);
60 vga_io_memory = vga_init_io(s, &vga_ports, &vbe_ports);
61 vga_io_memory = vga_init_io(s, &vga_ports, &vbe_ports);
61 isa_register_portio_list(dev, 0x3b0, vga_ports, s, "vga");
62 isa_register_portio_list(isadev, 0x3b0, vga_ports, s, "vga");
62 if (vbe_ports) {
63 if (vbe_ports) {
63 isa_register_portio_list(dev, 0x1ce, vbe_ports, s, "vbe");
64 isa_register_portio_list(isadev, 0x1ce, vbe_ports, s, "vbe");
64 }
65 }
65 memory_region_add_subregion_overlap(isa_address_space(dev),
66 memory_region_add_subregion_overlap(isa_address_space(isadev),
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);
70
67 isa_mem_base + 0x000a0000,
68 vga_io_memory, 1);
69 memory_region_set_coalescing(vga_io_memory);
70 s->con = graphic_console_init(DEVICE(dev), s->hw_ops, s);
71
71 vga_init_vbe(s, isa_address_space(dev));
72 vga_init_vbe(s, isa_address_space(isadev));
72 /* ROM BIOS */
73 rom_add_vga(VGABIOS_FILENAME);
73 /* ROM BIOS */
74 rom_add_vga(VGABIOS_FILENAME);
74 return 0;
75}
76
77static Property vga_isa_properties[] = {
78 DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
79 DEFINE_PROP_END_OF_LIST(),
80};
81
82static void vga_isa_class_initfn(ObjectClass *klass, void *data)
83{
84 DeviceClass *dc = DEVICE_CLASS(klass);
75}
76
77static Property vga_isa_properties[] = {
78 DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
79 DEFINE_PROP_END_OF_LIST(),
80};
81
82static void vga_isa_class_initfn(ObjectClass *klass, void *data)
83{
84 DeviceClass *dc = DEVICE_CLASS(klass);
85 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
86
85
87 ic->init = vga_initfn;
86 dc->realize = vga_isa_realizefn;
88 dc->reset = vga_isa_reset;
89 dc->vmsd = &vmstate_vga_common;
90 dc->props = vga_isa_properties;
91}
92
93static 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,
98};
99
100static void vga_isa_register_types(void)
101{
102 type_register_static(&vga_isa_info);
103}
104
105type_init(vga_isa_register_types)
87 dc->reset = vga_isa_reset;
88 dc->vmsd = &vmstate_vga_common;
89 dc->props = vga_isa_properties;
90}
91
92static const TypeInfo vga_isa_info = {
93 .name = TYPE_ISA_VGA,
94 .parent = TYPE_ISA_DEVICE,
95 .instance_size = sizeof(ISAVGAState),
96 .class_init = vga_isa_class_initfn,
97};
98
99static void vga_isa_register_types(void)
100{
101 type_register_static(&vga_isa_info);
102}
103
104type_init(vga_isa_register_types)