|
@@ -18,6 +18,8 @@
|
|
|
#include "sysemu/sysemu.h"
|
|
|
#include "qemu/log.h"
|
|
|
|
|
|
+#include "hw/nvram/fw_cfg.h"
|
|
|
+
|
|
|
/* The bit of supported pv event */
|
|
|
#define PVPANIC_F_PANICKED 0
|
|
|
|
|
@@ -86,10 +88,22 @@ static const MemoryRegionOps pvpanic_ops = {
|
|
|
static int pvpanic_isa_initfn(ISADevice *dev)
|
|
|
{
|
|
|
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
|
|
|
+ static bool port_configured;
|
|
|
+ void *fw_cfg;
|
|
|
|
|
|
memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
|
|
|
isa_register_ioport(dev, &s->io, s->ioport);
|
|
|
|
|
|
+ if (!port_configured) {
|
|
|
+ fw_cfg = object_resolve_path("/machine/fw_cfg", NULL);
|
|
|
+ if (fw_cfg) {
|
|
|
+ fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
|
|
|
+ g_memdup(&s->ioport, sizeof(s->ioport)),
|
|
|
+ sizeof(s->ioport));
|
|
|
+ port_configured = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|