Revision 600c60b7

b/hw/misc/pvpanic.c
96 96
    isa_register_ioport(dev, &s->io, s->ioport);
97 97

  
98 98
    if (!port_configured) {
99
        fw_cfg = object_resolve_path("/machine/fw_cfg", NULL);
99
        fw_cfg = fw_cfg_find();
100 100
        if (fw_cfg) {
101 101
            fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
102 102
                            g_memdup(&s->ioport, sizeof(s->ioport)),
b/hw/nvram/fw_cfg.c
32 32

  
33 33
#define FW_CFG_SIZE 2
34 34
#define FW_CFG_DATA_SIZE 1
35
#define TYPE_FW_CFG "fw_cfg"
36
#define FW_CFG_NAME "fw_cfg"
37
#define FW_CFG_PATH "/machine/" FW_CFG_NAME
35 38

  
36 39
typedef struct FWCfgEntry {
37 40
    uint32_t len;
......
493 496

  
494 497
    s = DO_UPCAST(FWCfgState, busdev.qdev, dev);
495 498

  
496
    if (!object_resolve_path("/machine/fw_cfg", NULL)) {
497
        object_property_add_child(qdev_get_machine(), "fw_cfg", OBJECT(s),
499
    if (!object_resolve_path(FW_CFG_PATH, NULL)) {
500
        object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s),
498 501
                                  NULL);
499 502
    }
500 503

  
......
553 556
    DEFINE_PROP_END_OF_LIST(),
554 557
};
555 558

  
559
FWCfgState *fw_cfg_find(void)
560
{
561
    return OBJECT_CHECK(FWCfgState, object_resolve_path(FW_CFG_PATH, NULL),
562
                        TYPE_FW_CFG);
563
}
564

  
556 565
static void fw_cfg_class_init(ObjectClass *klass, void *data)
557 566
{
558 567
    DeviceClass *dc = DEVICE_CLASS(klass);
......
566 575
}
567 576

  
568 577
static const TypeInfo fw_cfg_info = {
569
    .name          = "fw_cfg",
578
    .name          = TYPE_FW_CFG,
570 579
    .parent        = TYPE_SYS_BUS_DEVICE,
571 580
    .instance_size = sizeof(FWCfgState),
572 581
    .class_init    = fw_cfg_class_init,
b/include/hw/nvram/fw_cfg.h
73 73
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
74 74
                        hwaddr crl_addr, hwaddr data_addr);
75 75

  
76
FWCfgState *fw_cfg_find(void);
77

  
76 78
#endif /* NO_QEMU_PROTOS */
77 79

  
78 80
#endif

Also available in: Unified diff