[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback |
Date: |
Tue, 03 Dec 2013 10:37:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 25/11/2013 08:27, Alexey Kardashevskiy ha scritto:
> QEMU supports firmware names for all devices in the QEMU tree but
> sometime the exact format differs from what sPAPR platform uses.
>
> This introduces a callback to let a machine fix device tree path names.
>
> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> ---
> hw/core/qdev.c | 15 ++++++++++++++-
> include/hw/boards.h | 1 +
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index e374a93..7347483 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -26,6 +26,7 @@
> this API directly. */
>
> #include "hw/qdev.h"
> +#include "hw/boards.h"
> #include "sysemu/sysemu.h"
> #include "qapi/error.h"
> #include "qapi/qmp/qerror.h"
> @@ -497,6 +498,15 @@ static char *bus_get_fw_dev_path(BusState *bus,
> DeviceState *dev)
> return NULL;
> }
>
> +static char *machine_get_fw_dev_path(BusState *bus, DeviceState *dev)
> +{
> + if (current_machine->get_fw_dev_path) {
> + return current_machine->get_fw_dev_path(bus, dev);
> + }
> +
> + return NULL;
> +}
> +
> static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
> {
> int l = 0;
> @@ -504,7 +514,10 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev,
> char *p, int size)
> if (dev && dev->parent_bus) {
> char *d;
> l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
> - d = bus_get_fw_dev_path(dev->parent_bus, dev);
> + d = machine_get_fw_dev_path(dev->parent_bus, dev);
> + if (!d) {
> + d = bus_get_fw_dev_path(dev->parent_bus, dev);
> + }
> if (d) {
> l += snprintf(p + l, size - l, "%s", d);
> g_free(d);
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 5a7ae9f..50ff24a 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -43,6 +43,7 @@ typedef struct QEMUMachine {
> GlobalProperty *compat_props;
> struct QEMUMachine *next;
> const char *hw_version;
> + char *(*get_fw_dev_path)(BusState *bus, DeviceState *dev);
> } QEMUMachine;
>
> int qemu_register_machine(QEMUMachine *m);
>
You can check "if (current_machine &&
current_machine->get_fw_dev_path)", and move current_machine from vl.c
to hw/qdev/core.c.
Paolo
- Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Alexey Kardashevskiy, 2013/12/02
- Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback,
Paolo Bonzini <=
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Andreas Färber, 2013/12/03
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Paolo Bonzini, 2013/12/03
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Andreas Färber, 2013/12/03
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Paolo Bonzini, 2013/12/03
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Alexey Kardashevskiy, 2013/12/11
- Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Paolo Bonzini, 2013/12/11
- Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Alexey Kardashevskiy, 2013/12/11
- Re: [Qemu-ppc] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Alexey Kardashevskiy, 2013/12/11
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback, Alexey Kardashevskiy, 2013/12/10