diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2021-07-08 16:56:25 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-07-09 10:55:11 +1000 |
commit | 21bde1ecb6cecba1d2f0219a1b79c240bed78749 (patch) | |
tree | c24f3da40cfb0665e51c6430abd963331262bb5e /hw/ppc/vof.c | |
parent | 89bb5a4dfdef8316e840ab090ef04a5b7117731b (diff) |
spapr: Fix implementation of Open Firmware client interface
This addresses the comments from v22.
The functional changes are (the VOF ones need retesting with Pegasos2):
(VOF) setprop will start failing if the machine class callback
did not handle it;
(VOF) unit addresses are lowered in path_offset();
(SPAPR) /chosen/bootargs is initialized from kernel_cmdline if
the client did not change it.
Fixes: 5c991e5d4378 ("spapr: Implement Open Firmware client interface")
Cc: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20210708065625.548396-1-aik@ozlabs.ru>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/vof.c')
-rw-r--r-- | hw/ppc/vof.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c index 47c86e394e..81f6596215 100644 --- a/hw/ppc/vof.c +++ b/hw/ppc/vof.c @@ -144,15 +144,16 @@ static int path_offset(const void *fdt, const char *path) * the lower case forms of the hexadecimal digits in the range a..f, * suppressing leading zeros". */ - at = strchr(path, '@'); - if (!at) { - return fdt_path_offset(fdt, path); - } - p = g_strdup(path); - for (at = at - path + p + 1; *at; ++at) { - *at = tolower(*at); + for (at = strchr(p, '@'); at && *at; ) { + if (*at == '/') { + at = strchr(at, '@'); + } else { + *at = tolower(*at); + ++at; + } } + return fdt_path_offset(fdt, p); } @@ -300,6 +301,7 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof, char trval[64] = ""; char nodepath[VOF_MAX_PATH] = ""; Object *vmo = object_dynamic_cast(OBJECT(ms), TYPE_VOF_MACHINE_IF); + VofMachineIfClass *vmc; g_autofree char *val = NULL; if (vallen > VOF_MAX_SETPROPLEN) { @@ -322,13 +324,13 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof, goto trace_exit; } - if (vmo) { - VofMachineIfClass *vmc = VOF_MACHINE_GET_CLASS(vmo); + if (!vmo) { + goto trace_exit; + } - if (vmc->setprop && - !vmc->setprop(ms, nodepath, propname, val, vallen)) { - goto trace_exit; - } + vmc = VOF_MACHINE_GET_CLASS(vmo); + if (!vmc->setprop || !vmc->setprop(ms, nodepath, propname, val, vallen)) { + goto trace_exit; } ret = fdt_setprop(fdt, offset, propname, val, vallen); @@ -919,6 +921,8 @@ static uint32_t vof_client_handle(MachineState *ms, void *fdt, Vof *vof, ret = -1; } +#undef cmpserv + return ret; } |