Statistics
| Branch: | Revision:

root / hw / vga-isa.c @ e219dea2

History | View | Annotate | Download (2.8 kB)

1 76323919 Juan Quintela
/*
2 76323919 Juan Quintela
 * QEMU ISA VGA Emulator.
3 76323919 Juan Quintela
 *
4 76323919 Juan Quintela
 * Copyright (c) 2003 Fabrice Bellard
5 76323919 Juan Quintela
 *
6 76323919 Juan Quintela
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 76323919 Juan Quintela
 * of this software and associated documentation files (the "Software"), to deal
8 76323919 Juan Quintela
 * in the Software without restriction, including without limitation the rights
9 76323919 Juan Quintela
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 76323919 Juan Quintela
 * copies of the Software, and to permit persons to whom the Software is
11 76323919 Juan Quintela
 * furnished to do so, subject to the following conditions:
12 76323919 Juan Quintela
 *
13 76323919 Juan Quintela
 * The above copyright notice and this permission notice shall be included in
14 76323919 Juan Quintela
 * all copies or substantial portions of the Software.
15 76323919 Juan Quintela
 *
16 76323919 Juan Quintela
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 76323919 Juan Quintela
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 76323919 Juan Quintela
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 76323919 Juan Quintela
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 76323919 Juan Quintela
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 76323919 Juan Quintela
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 76323919 Juan Quintela
 * THE SOFTWARE.
23 76323919 Juan Quintela
 */
24 76323919 Juan Quintela
#include "hw.h"
25 76323919 Juan Quintela
#include "console.h"
26 76323919 Juan Quintela
#include "pc.h"
27 76323919 Juan Quintela
#include "vga_int.h"
28 76323919 Juan Quintela
#include "pixel_ops.h"
29 76323919 Juan Quintela
#include "qemu-timer.h"
30 5245d57a Gerd Hoffmann
#include "loader.h"
31 b1950430 Avi Kivity
#include "exec-memory.h"
32 76323919 Juan Quintela
33 7435b791 Blue Swirl
typedef struct ISAVGAState {
34 7435b791 Blue Swirl
    ISADevice dev;
35 7435b791 Blue Swirl
    struct VGACommonState state;
36 7435b791 Blue Swirl
} ISAVGAState;
37 7435b791 Blue Swirl
38 7435b791 Blue Swirl
static void vga_reset_isa(DeviceState *dev)
39 76323919 Juan Quintela
{
40 7435b791 Blue Swirl
    ISAVGAState *d = container_of(dev, ISAVGAState, dev.qdev);
41 7435b791 Blue Swirl
    VGACommonState *s = &d->state;
42 76323919 Juan Quintela
43 7435b791 Blue Swirl
    vga_common_reset(s);
44 7435b791 Blue Swirl
}
45 76323919 Juan Quintela
46 7435b791 Blue Swirl
static int vga_initfn(ISADevice *dev)
47 7435b791 Blue Swirl
{
48 7435b791 Blue Swirl
    ISAVGAState *d = DO_UPCAST(ISAVGAState, dev, dev);
49 7435b791 Blue Swirl
    VGACommonState *s = &d->state;
50 b1950430 Avi Kivity
    MemoryRegion *vga_io_memory;
51 76323919 Juan Quintela
52 7435b791 Blue Swirl
    vga_common_init(s, VGA_RAM_SIZE);
53 7435b791 Blue Swirl
    vga_io_memory = vga_init_io(s);
54 b1950430 Avi Kivity
    memory_region_add_subregion_overlap(get_system_memory(),
55 b1950430 Avi Kivity
                                        isa_mem_base + 0x000a0000,
56 b1950430 Avi Kivity
                                        vga_io_memory, 1);
57 b1950430 Avi Kivity
    memory_region_set_coalescing(vga_io_memory);
58 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3c0);
59 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3b4);
60 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3ba);
61 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3da);
62 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3c0);
63 7435b791 Blue Swirl
#ifdef CONFIG_BOCHS_VBE
64 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x1ce);
65 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x1cf);
66 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x1d0);
67 7435b791 Blue Swirl
#endif /* CONFIG_BOCHS_VBE */
68 76323919 Juan Quintela
    s->ds = graphic_console_init(s->update, s->invalidate,
69 76323919 Juan Quintela
                                 s->screen_dump, s->text_update, s);
70 76323919 Juan Quintela
71 f0138a63 Anthony Liguori
    vga_init_vbe(s);
72 5245d57a Gerd Hoffmann
    /* ROM BIOS */
73 5245d57a Gerd Hoffmann
    rom_add_vga(VGABIOS_FILENAME);
74 76323919 Juan Quintela
    return 0;
75 76323919 Juan Quintela
}
76 7435b791 Blue Swirl
77 7435b791 Blue Swirl
static ISADeviceInfo vga_info = {
78 7435b791 Blue Swirl
    .qdev.name     = "isa-vga",
79 7435b791 Blue Swirl
    .qdev.size     = sizeof(ISAVGAState),
80 7435b791 Blue Swirl
    .qdev.vmsd     = &vmstate_vga_common,
81 7435b791 Blue Swirl
    .qdev.reset     = vga_reset_isa,
82 7435b791 Blue Swirl
    .init          = vga_initfn,
83 7435b791 Blue Swirl
};
84 7435b791 Blue Swirl
85 7435b791 Blue Swirl
static void vga_register(void)
86 7435b791 Blue Swirl
{
87 7435b791 Blue Swirl
    isa_qdev_register(&vga_info);
88 7435b791 Blue Swirl
}
89 7435b791 Blue Swirl
device_init(vga_register)