Statistics
| Branch: | Revision:

root / hw / misc / sga.c @ b582b5a3

History | View | Annotate | Download (2.1 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 83c9f4ca Paolo Bonzini
#include "hw/pci/pci.h"
28 0d09e41a Paolo Bonzini
#include "hw/i386/pc.h"
29 83c9f4ca Paolo Bonzini
#include "hw/loader.h"
30 9c17d615 Paolo Bonzini
#include "sysemu/sysemu.h"
31 a90d4690 Glauber Costa
32 a90d4690 Glauber Costa
#define SGABIOS_FILENAME "sgabios.bin"
33 a90d4690 Glauber Costa
34 b582b5a3 Andreas Färber
#define TYPE_SGA "sga"
35 b582b5a3 Andreas Färber
#define SGA(obj) OBJECT_CHECK(ISASGAState, (obj), TYPE_SGA)
36 b582b5a3 Andreas Färber
37 b582b5a3 Andreas Färber
typedef struct ISASGAState {
38 b582b5a3 Andreas Färber
    ISADevice parent_obj;
39 a90d4690 Glauber Costa
} ISASGAState;
40 a90d4690 Glauber Costa
41 6618f909 Blue Swirl
static int sga_initfn(ISADevice *dev)
42 a90d4690 Glauber Costa
{
43 a90d4690 Glauber Costa
    rom_add_vga(SGABIOS_FILENAME);
44 a90d4690 Glauber Costa
    return 0;
45 a90d4690 Glauber Costa
}
46 b582b5a3 Andreas Färber
47 8f04ee08 Anthony Liguori
static void sga_class_initfn(ObjectClass *klass, void *data)
48 8f04ee08 Anthony Liguori
{
49 39bffca2 Anthony Liguori
    DeviceClass *dc = DEVICE_CLASS(klass);
50 8f04ee08 Anthony Liguori
    ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
51 8f04ee08 Anthony Liguori
    ic->init = sga_initfn;
52 39bffca2 Anthony Liguori
    dc->desc = "Serial Graphics Adapter";
53 8f04ee08 Anthony Liguori
}
54 a90d4690 Glauber Costa
55 8c43a6f0 Andreas Färber
static const TypeInfo sga_info = {
56 b582b5a3 Andreas Färber
    .name          = TYPE_SGA,
57 39bffca2 Anthony Liguori
    .parent        = TYPE_ISA_DEVICE,
58 39bffca2 Anthony Liguori
    .instance_size = sizeof(ISASGAState),
59 39bffca2 Anthony Liguori
    .class_init    = sga_class_initfn,
60 a90d4690 Glauber Costa
};
61 a90d4690 Glauber Costa
62 83f7d43a Andreas Färber
static void sga_register_types(void)
63 a90d4690 Glauber Costa
{
64 39bffca2 Anthony Liguori
    type_register_static(&sga_info);
65 a90d4690 Glauber Costa
}
66 a90d4690 Glauber Costa
67 83f7d43a Andreas Färber
type_init(sga_register_types)