Revision 4b1b1c89

b/device_tree.c
22 22
#include "qemu-common.h"
23 23
#include "device_tree.h"
24 24
#include "hw/loader.h"
25
#include "qemu-option.h"
26
#include "qemu-config.h"
25 27

  
26 28
#include <libfdt.h>
27 29

  
......
200 202

  
201 203
uint32_t qemu_devtree_alloc_phandle(void *fdt)
202 204
{
203
    static int phandle = 0x8000;
205
    static int phandle = 0x0;
206

  
207
    /*
208
     * We need to find out if the user gave us special instruction at
209
     * which phandle id to start allocting phandles.
210
     */
211
    if (!phandle) {
212
        QemuOpts *machine_opts;
213
        machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
214
        if (machine_opts) {
215
            const char *phandle_start;
216
            phandle_start = qemu_opt_get(machine_opts, "phandle_start");
217
            if (phandle_start) {
218
                phandle = strtoul(phandle_start, NULL, 0);
219
            }
220
        }
221
    }
222

  
223
    if (!phandle) {
224
        /*
225
         * None or invalid phandle given on the command line, so fall back to
226
         * default starting point.
227
         */
228
        phandle = 0x8000;
229
    }
204 230

  
205 231
    return phandle++;
206 232
}
b/qemu-config.c
587 587
            .name = "dumpdtb",
588 588
            .type = QEMU_OPT_STRING,
589 589
            .help = "Dump current dtb to a file and quit",
590
        }, {
591
            .name = "phandle_start",
592
            .type = QEMU_OPT_STRING,
593
            .help = "The first phandle ID we may generate dynamically",
590 594
        },
591 595
        { /* End of list */ }
592 596
    },

Also available in: Unified diff