Statistics
| Branch: | Revision:

root / hw / sga.c @ 2cae4119

History | View | Annotate | Download (2 kB)

1 a90d4690 Glauber Costa
/*
2 a90d4690 Glauber Costa
 * QEMU dummy ISA device for loading sgabios option rom.
3 a90d4690 Glauber Costa
 *
4 a90d4690 Glauber Costa
 * Copyright (c) 2011 Glauber Costa, Red Hat Inc.
5 a90d4690 Glauber Costa
 *
6 a90d4690 Glauber Costa
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 a90d4690 Glauber Costa
 * of this software and associated documentation files (the "Software"), to deal
8 a90d4690 Glauber Costa
 * in the Software without restriction, including without limitation the rights
9 a90d4690 Glauber Costa
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 a90d4690 Glauber Costa
 * copies of the Software, and to permit persons to whom the Software is
11 a90d4690 Glauber Costa
 * furnished to do so, subject to the following conditions:
12 a90d4690 Glauber Costa
 *
13 a90d4690 Glauber Costa
 * The above copyright notice and this permission notice shall be included in
14 a90d4690 Glauber Costa
 * all copies or substantial portions of the Software.
15 a90d4690 Glauber Costa
 *
16 a90d4690 Glauber Costa
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 a90d4690 Glauber Costa
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 a90d4690 Glauber Costa
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 a90d4690 Glauber Costa
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 a90d4690 Glauber Costa
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 a90d4690 Glauber Costa
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 a90d4690 Glauber Costa
 * THE SOFTWARE.
23 a90d4690 Glauber Costa
 *
24 a90d4690 Glauber Costa
 * sgabios code originally available at code.google.com/p/sgabios
25 a90d4690 Glauber Costa
 *
26 a90d4690 Glauber Costa
 */
27 a90d4690 Glauber Costa
#include "pci.h"
28 a90d4690 Glauber Costa
#include "pc.h"
29 a90d4690 Glauber Costa
#include "loader.h"
30 a90d4690 Glauber Costa
#include "sysemu.h"
31 a90d4690 Glauber Costa
32 a90d4690 Glauber Costa
#define SGABIOS_FILENAME "sgabios.bin"
33 a90d4690 Glauber Costa
34 a90d4690 Glauber Costa
typedef struct ISAGAState {
35 a90d4690 Glauber Costa
    ISADevice dev;
36 a90d4690 Glauber Costa
} ISASGAState;
37 a90d4690 Glauber Costa
38 6618f909 Blue Swirl
static int sga_initfn(ISADevice *dev)
39 a90d4690 Glauber Costa
{
40 a90d4690 Glauber Costa
    rom_add_vga(SGABIOS_FILENAME);
41 a90d4690 Glauber Costa
    return 0;
42 a90d4690 Glauber Costa
}
43 8f04ee08 Anthony Liguori
static void sga_class_initfn(ObjectClass *klass, void *data)
44 8f04ee08 Anthony Liguori
{
45 39bffca2 Anthony Liguori
    DeviceClass *dc = DEVICE_CLASS(klass);
46 8f04ee08 Anthony Liguori
    ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
47 8f04ee08 Anthony Liguori
    ic->init = sga_initfn;
48 39bffca2 Anthony Liguori
    dc->desc = "Serial Graphics Adapter";
49 8f04ee08 Anthony Liguori
}
50 a90d4690 Glauber Costa
51 39bffca2 Anthony Liguori
static TypeInfo sga_info = {
52 39bffca2 Anthony Liguori
    .name          = "sga",
53 39bffca2 Anthony Liguori
    .parent        = TYPE_ISA_DEVICE,
54 39bffca2 Anthony Liguori
    .instance_size = sizeof(ISASGAState),
55 39bffca2 Anthony Liguori
    .class_init    = sga_class_initfn,
56 a90d4690 Glauber Costa
};
57 a90d4690 Glauber Costa
58 83f7d43a Andreas Färber
static void sga_register_types(void)
59 a90d4690 Glauber Costa
{
60 39bffca2 Anthony Liguori
    type_register_static(&sga_info);
61 a90d4690 Glauber Costa
}
62 a90d4690 Glauber Costa
63 83f7d43a Andreas Färber
type_init(sga_register_types)