Il 21/03/2013 09:35, Hu Tao ha scritto:
> This lets seabios patch the corresponding SSDT entry.
>
> Signed-off-by: Hu Tao
> ---
> hw/fw_cfg.h | 2 ++
> hw/pvpanic.c | 14 ++
> 2 files changed, 16 insertions(+)
>
> diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
> index 05c8df1..07cc941 100644
> --- a/hw/fw_cfg.h
> +++ b/hw/fw_cfg.h
> @@ -1,6 +1,8 @@
> #ifndef FW_CFG_H
> #define FW_CFG_H
>
> +#include "exec/hwaddr.h"
> +
> #define FW_CFG_SIGNATURE0x00
> #define FW_CFG_ID 0x01
> #define FW_CFG_UUID 0x02
> diff --git a/hw/pvpanic.c b/hw/pvpanic.c
> index ff0a116..94c3b25 100644
> --- a/hw/pvpanic.c
> +++ b/hw/pvpanic.c
> @@ -17,6 +17,8 @@
> #include
> #include
> #include
> +#include "hw/fw_cfg.h"
> +#include "hw/pc.h"
>
> /* The bit of supported pv event */
> #define PVPANIC_F_PANICKED 0
> @@ -83,6 +85,18 @@ static int pvpanic_isa_initfn(ISADevice *dev)
> memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
> isa_register_ioport(dev, &s->io, s->ioport);
>
> +if (fw_cfg_piix) {
> +fw_cfg_add_file(fw_cfg_piix, "etc/pvpanic-port",
> +g_memdup(&s->ioport, sizeof(s->ioport)),
> +sizeof(s->ioport));
> +}
> +
> +if (fw_cfg_q35) {
> +fw_cfg_add_file(fw_cfg_q35, "etc/pvpanic-port",
> +g_memdup(&s->ioport, sizeof(s->ioport)),
> +sizeof(s->ioport));
> +}
> +
> return 0;
> }
>
You can get fw_cfg with this patch (untested):
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 63a1998..ac6f1a1 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -511,6 +511,8 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t
data_port,
s->machine_ready.notify = fw_cfg_machine_ready;
qemu_add_machine_init_done_notifier(&s->machine_ready);
+object_property_add_child(qdev_get_machine(), "fw_cfg", OBJECT(s), NULL);
+
return s;
}
and then
void *fw_cfg = object_resolve_path("/machine/fw_cfg");
if (fw_cfg) {
...
}
Note that this must be done only once if you create more than 1 pvpanic device.
Also, I would like machine types for 1.5 and newer to create pvpanic by default.
Paolo