diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 22ebb50..72866ae 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -25,6 +25,7 @@
 #include "sysemu.h"
 #include "isa.h"
 #include "fw_cfg.h"
+#include "sysbus.h"

 /* debug firmware config */
 //#define DEBUG_FW_CFG
@@ -46,6 +47,8 @@ typedef struct FWCfgEntry {
 } FWCfgEntry;

 struct FWCfgState {
+    SysBusDevice busdev;
+    uint32_t ctl_iobase, data_iobase;
     FWCfgEntry entries[2][FW_CFG_MAX_ENTRY];
     FWCfgFiles *files;
     uint16_t cur_entry;
@@ -158,9 +161,9 @@ static CPUWriteMemoryFunc * const
fw_cfg_data_mem_write[3] = {
     NULL,
 };

-static void fw_cfg_reset(void *opaque)
+static void fw_cfg_reset(DeviceState *d)
 {
-    FWCfgState *s = opaque;
+    FWCfgState *s = DO_UPCAST(FWCfgState, busdev.qdev, d);

     fw_cfg_select(s, 0);
