From 90ccf9f6bfaa305ee55973b77f9a4e438370c30e Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Tue, 21 Feb 2012 23:18:52 -0800 Subject: [PATCH] hw/pc_sysfw: enable pc-sysfw as a qdev Setup a pc-sysfw device type. It contains a single property of 'rom_only' which is defaulted to enabled. Signed-off-by: Jordan Justen Signed-off-by: Anthony Liguori --- hw/pc_sysfw.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c index b0bb7b8c8d..ae5c4b1856 100644 --- a/hw/pc_sysfw.c +++ b/hw/pc_sysfw.c @@ -23,12 +23,19 @@ * THE SOFTWARE. */ +#include "sysbus.h" +#include "hw.h" #include "pc.h" #include "loader.h" #include "sysemu.h" #define BIOS_FILENAME "bios.bin" +typedef struct PcSysFwDevice { + SysBusDevice busdev; + uint8_t rom_only; +} PcSysFwDevice; + static void pc_system_rom_init(MemoryRegion *rom_memory) { char *filename; @@ -86,7 +93,37 @@ static void pc_system_rom_init(MemoryRegion *rom_memory) void pc_system_firmware_init(MemoryRegion *rom_memory) { + PcSysFwDevice *sysfw_dev; + + sysfw_dev = (PcSysFwDevice*) qdev_create(NULL, "pc-sysfw"); + pc_system_rom_init(rom_memory); } +static Property pcsysfw_properties[] = { + DEFINE_PROP_UINT8("rom_only", PcSysFwDevice, rom_only, 1), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pcsysfw_class_init (ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS (klass); + + dc->desc = "PC System Firmware"; + dc->props = pcsysfw_properties; +} + +static TypeInfo pcsysfw_info = { + .name = "pc-sysfw", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof (PcSysFwDevice), + .class_init = pcsysfw_class_init, +}; + +static void pcsysfw_register (void) +{ + type_register_static (&pcsysfw_info); +} + +type_init (pcsysfw_register);