Patchwork [v11,5/9] hw/pc_sysfw: enable pc-sysfw as a qdev

login
register
mail settings
Submitter jordan.l.justen@intel.com
Date Feb. 22, 2012, 7:18 a.m.
Message ID <1329895136-20494-6-git-send-email-jordan.l.justen@intel.com>
Download mbox | patch
Permalink /patch/142420/
State New
Headers show

Comments

jordan.l.justen@intel.com - Feb. 22, 2012, 7:18 a.m.
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>
---
 hw/pc_sysfw.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c
index b0bb7b8..ae5c4b1 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);