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