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 <jordan.l.justen@intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
master
Jordan Justen 2012-02-21 23:18:52 -08:00 committed by Anthony Liguori
parent cbc5b5f3aa
commit 90ccf9f6bf
1 changed files with 37 additions and 0 deletions

View File

@ -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);