Statistics
| Branch: | Revision:

root / hw / vga-isa.c @ 00914b7d

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 76323919 Juan Quintela
32 7435b791 Blue Swirl
typedef struct ISAVGAState {
33 7435b791 Blue Swirl
    ISADevice dev;
34 7435b791 Blue Swirl
    struct VGACommonState state;
35 7435b791 Blue Swirl
} ISAVGAState;
36 7435b791 Blue Swirl
37 7435b791 Blue Swirl
static void vga_reset_isa(DeviceState *dev)
38 76323919 Juan Quintela
{
39 7435b791 Blue Swirl
    ISAVGAState *d = container_of(dev, ISAVGAState, dev.qdev);
40 7435b791 Blue Swirl
    VGACommonState *s = &d->state;
41 76323919 Juan Quintela
42 7435b791 Blue Swirl
    vga_common_reset(s);
43 7435b791 Blue Swirl
}
44 76323919 Juan Quintela
45 7435b791 Blue Swirl
static int vga_initfn(ISADevice *dev)
46 7435b791 Blue Swirl
{
47 7435b791 Blue Swirl
    ISAVGAState *d = DO_UPCAST(ISAVGAState, dev, dev);
48 7435b791 Blue Swirl
    VGACommonState *s = &d->state;
49 7435b791 Blue Swirl
    int vga_io_memory;
50 76323919 Juan Quintela
51 7435b791 Blue Swirl
    vga_common_init(s, VGA_RAM_SIZE);
52 7435b791 Blue Swirl
    vga_io_memory = vga_init_io(s);
53 7435b791 Blue Swirl
    cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000,
54 7435b791 Blue Swirl
                                 vga_io_memory);
55 7435b791 Blue Swirl
    qemu_register_coalesced_mmio(isa_mem_base + 0x000a0000, 0x20000);
56 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3c0);
57 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3b4);
58 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3ba);
59 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3da);
60 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x3c0);
61 7435b791 Blue Swirl
#ifdef CONFIG_BOCHS_VBE
62 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x1ce);
63 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x1cf);
64 7435b791 Blue Swirl
    isa_init_ioport(dev, 0x1d0);
65 7435b791 Blue Swirl
#endif /* CONFIG_BOCHS_VBE */
66 76323919 Juan Quintela
    s->ds = graphic_console_init(s->update, s->invalidate,
67 76323919 Juan Quintela
                                 s->screen_dump, s->text_update, s);
68 76323919 Juan Quintela
69 f0138a63 Anthony Liguori
    vga_init_vbe(s);
70 5245d57a Gerd Hoffmann
    /* ROM BIOS */
71 5245d57a Gerd Hoffmann
    rom_add_vga(VGABIOS_FILENAME);
72 76323919 Juan Quintela
    return 0;
73 76323919 Juan Quintela
}
74 7435b791 Blue Swirl
75 7435b791 Blue Swirl
static ISADeviceInfo vga_info = {
76 7435b791 Blue Swirl
    .qdev.name     = "isa-vga",
77 7435b791 Blue Swirl
    .qdev.size     = sizeof(ISAVGAState),
78 7435b791 Blue Swirl
    .qdev.vmsd     = &vmstate_vga_common,
79 7435b791 Blue Swirl
    .qdev.reset     = vga_reset_isa,
80 7435b791 Blue Swirl
    .qdev.no_user  = 1,
81 7435b791 Blue Swirl
    .init          = vga_initfn,
82 7435b791 Blue Swirl
};
83 7435b791 Blue Swirl
84 7435b791 Blue Swirl
static void vga_register(void)
85 7435b791 Blue Swirl
{
86 7435b791 Blue Swirl
    isa_qdev_register(&vga_info);
87 7435b791 Blue Swirl
}
88 7435b791 Blue Swirl
device_init(vga_register)