Revision 04088adb hw/ppce500_mpc8544ds.c

b/hw/ppce500_mpc8544ds.c
72 72
}
73 73
#endif
74 74

  
75
static void *mpc8544_load_device_tree(target_phys_addr_t addr,
75
static int mpc8544_load_device_tree(target_phys_addr_t addr,
76 76
                                     uint32_t ramsize,
77 77
                                     target_phys_addr_t initrd_base,
78 78
                                     target_phys_addr_t initrd_size,
......
87 87

  
88 88
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
89 89
    if (!filename) {
90
        ret = -1;
90 91
        goto out;
91 92
    }
92 93
    fdt = load_device_tree(filename, &fdt_size);
93 94
    qemu_free(filename);
94 95
    if (fdt == NULL) {
96
        ret = -1;
95 97
        goto out;
96 98
    }
97 99

  
......
123 125

  
124 126
        if ((dp = opendir("/proc/device-tree/cpus/")) == NULL) {
125 127
            printf("Can't open directory /proc/device-tree/cpus/\n");
128
            ret = -1;
126 129
            goto out;
127 130
        }
128 131

  
......
136 139
        closedir(dp);
137 140
        if (buf[0] == '\0') {
138 141
            printf("Unknow host!\n");
142
            ret = -1;
139 143
            goto out;
140 144
        }
141 145

  
......
143 147
        mpc8544_copy_soc_cell(fdt, buf, "timebase-frequency");
144 148
    }
145 149

  
146
    cpu_physical_memory_write (addr, (void *)fdt, fdt_size);
150
    ret = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
151
    qemu_free(fdt);
147 152

  
148 153
out:
149 154
#endif
150 155

  
151
    return fdt;
156
    return ret;
152 157
}
153 158

  
154 159
static void mpc8544ds_init(ram_addr_t ram_size,
......
168 173
    target_ulong dt_base=DTB_LOAD_BASE;
169 174
    target_ulong initrd_base=INITRD_LOAD_BASE;
170 175
    target_long initrd_size=0;
171
    void *fdt;
172 176
    int i=0;
173 177
    unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
174 178
    qemu_irq *irqs, *mpic, *pci_irqs;
......
254 258

  
255 259
    /* If we're loading a kernel directly, we must load the device tree too. */
256 260
    if (kernel_filename) {
257
        fdt = mpc8544_load_device_tree(dt_base, ram_size,
258
                                      initrd_base, initrd_size, kernel_cmdline);
259
        if (fdt == NULL) {
261
        if (mpc8544_load_device_tree(dt_base, ram_size,
262
                    initrd_base, initrd_size, kernel_cmdline) < 0) {
260 263
            fprintf(stderr, "couldn't load device tree\n");
261 264
            exit(1);
262 265
        }

Also available in: Unified diff