~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to device_tree.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "config.h"
22
22
#include "qemu-common.h"
23
23
#include "sysemu/device_tree.h"
 
24
#include "sysemu/sysemu.h"
24
25
#include "hw/loader.h"
25
26
#include "qemu/option.h"
26
27
#include "qemu/config-file.h"
213
214
    uint32_t r;
214
215
 
215
216
    r = fdt_get_phandle(fdt, findnode_nofail(fdt, path));
216
 
    if (r <= 0) {
 
217
    if (r == 0) {
217
218
        fprintf(stderr, "%s: Couldn't get phandle for %s: %s\n", __func__,
218
219
                path, fdt_strerror(r));
219
220
        exit(1);
239
240
     * which phandle id to start allocting phandles.
240
241
     */
241
242
    if (!phandle) {
242
 
        QemuOpts *machine_opts;
243
 
        machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
244
 
        if (machine_opts) {
245
 
            const char *phandle_start;
246
 
            phandle_start = qemu_opt_get(machine_opts, "phandle_start");
247
 
            if (phandle_start) {
248
 
                phandle = strtoul(phandle_start, NULL, 0);
249
 
            }
250
 
        }
 
243
        phandle = qemu_opt_get_number(qemu_get_machine_opts(),
 
244
                                      "phandle_start", 0);
251
245
    }
252
246
 
253
247
    if (!phandle) {
307
301
 
308
302
void qemu_devtree_dumpdtb(void *fdt, int size)
309
303
{
310
 
    QemuOpts *machine_opts;
311
 
 
312
 
    machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
313
 
    if (machine_opts) {
314
 
        const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
315
 
        if (dumpdtb) {
316
 
            /* Dump the dtb to a file and quit */
317
 
            exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
318
 
        }
319
 
    }
320
 
 
 
304
    const char *dumpdtb = qemu_opt_get(qemu_get_machine_opts(), "dumpdtb");
 
305
 
 
306
    if (dumpdtb) {
 
307
        /* Dump the dtb to a file and quit */
 
308
        exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
 
309
    }
 
310
}
 
311
 
 
312
int qemu_devtree_setprop_sized_cells_from_array(void *fdt,
 
313
                                                const char *node_path,
 
314
                                                const char *property,
 
315
                                                int numvalues,
 
316
                                                uint64_t *values)
 
317
{
 
318
    uint32_t *propcells;
 
319
    uint64_t value;
 
320
    int cellnum, vnum, ncells;
 
321
    uint32_t hival;
 
322
 
 
323
    propcells = g_new0(uint32_t, numvalues * 2);
 
324
 
 
325
    cellnum = 0;
 
326
    for (vnum = 0; vnum < numvalues; vnum++) {
 
327
        ncells = values[vnum * 2];
 
328
        if (ncells != 1 && ncells != 2) {
 
329
            return -1;
 
330
        }
 
331
        value = values[vnum * 2 + 1];
 
332
        hival = cpu_to_be32(value >> 32);
 
333
        if (ncells > 1) {
 
334
            propcells[cellnum++] = hival;
 
335
        } else if (hival != 0) {
 
336
            return -1;
 
337
        }
 
338
        propcells[cellnum++] = cpu_to_be32(value);
 
339
    }
 
340
 
 
341
    return qemu_devtree_setprop(fdt, node_path, property, propcells,
 
342
                                cellnum * sizeof(uint32_t));
321
343
}