[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/35] spapr: Implement get_dt_compatible() callback
From: |
David Gibson |
Subject: |
[PULL 14/35] spapr: Implement get_dt_compatible() callback |
Date: |
Mon, 3 Feb 2020 17:11:02 +1100 |
From: Stefan Berger <address@hidden>
For devices that cannot be statically initialized, implement a
get_dt_compatible() callback that allows us to ask the device for
the 'compatible' value.
Signed-off-by: Stefan Berger <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_vio.c | 11 +++++++++--
include/hw/ppc/spapr_vio.h | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index f14944e900..0b085eabe4 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -87,6 +87,7 @@ static int vio_make_devnode(SpaprVioDevice *dev,
SpaprVioDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev);
int vdevice_off, node_off, ret;
char *dt_name;
+ const char *dt_compatible;
vdevice_off = fdt_path_offset(fdt, "/vdevice");
if (vdevice_off < 0) {
@@ -113,9 +114,15 @@ static int vio_make_devnode(SpaprVioDevice *dev,
}
}
- if (pc->dt_compatible) {
+ if (pc->get_dt_compatible) {
+ dt_compatible = pc->get_dt_compatible(dev);
+ } else {
+ dt_compatible = pc->dt_compatible;
+ }
+
+ if (dt_compatible) {
ret = fdt_setprop_string(fdt, node_off, "compatible",
- pc->dt_compatible);
+ dt_compatible);
if (ret < 0) {
return ret;
}
diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h
index ce6d9b0c66..bed7df60e3 100644
--- a/include/hw/ppc/spapr_vio.h
+++ b/include/hw/ppc/spapr_vio.h
@@ -58,6 +58,7 @@ typedef struct SpaprVioDeviceClass {
void (*realize)(SpaprVioDevice *dev, Error **errp);
void (*reset)(SpaprVioDevice *dev);
int (*devnode)(SpaprVioDevice *dev, void *fdt, int node_off);
+ const char *(*get_dt_compatible)(SpaprVioDevice *dev);
} SpaprVioDeviceClass;
struct SpaprVioDevice {
--
2.24.1
- [PULL 00/35] ppc-for-5.0 queue 20200203, David Gibson, 2020/02/03
- [PULL 03/35] ppc:virtex_ml507: remove unused arguments, David Gibson, 2020/02/03
- [PULL 01/35] ppc/pnv: use QEMU unit definition MiB, David Gibson, 2020/02/03
- [PULL 02/35] ppc/pnv: improve error logging when a PNOR update fails, David Gibson, 2020/02/03
- [PULL 06/35] spapr: Fail CAS if option vector table cannot be parsed, David Gibson, 2020/02/03
- [PULL 05/35] target/ppc: Clarify the meaning of return values in kvm_handle_debug, David Gibson, 2020/02/03
- [PULL 09/35] spapr: Don't allow multiple active vCPUs at CAS, David Gibson, 2020/02/03
- [PULL 08/35] target/ppc: add support for Hypervisor Facility Unavailable Exception, David Gibson, 2020/02/03
- [PULL 10/35] ppc/pnv: Add support for HRMOR on Radix host, David Gibson, 2020/02/03
- [PULL 14/35] spapr: Implement get_dt_compatible() callback,
David Gibson <=
- [PULL 11/35] ppc/pnv: remove useless "core-pir" property alias., David Gibson, 2020/02/03
- [PULL 17/35] hw/ppc/Kconfig: Enable TPM_SPAPR as part of PSERIES config, David Gibson, 2020/02/03
- [PULL 12/35] ppc/pnv: Add support for "hostboot" mode, David Gibson, 2020/02/03
- [PULL 07/35] target/ppc: Add privileged message send facilities, David Gibson, 2020/02/03
- [PULL 13/35] tpm: Move tpm_tis_show_buffer to tpm_util.c, David Gibson, 2020/02/03
- [PULL 16/35] tpm_spapr: Support suspend and resume, David Gibson, 2020/02/03
- [PULL 22/35] spapr: Enable DD2.3 accelerated count cache flush in pseries-5.0 machine, David Gibson, 2020/02/03
- [PULL 25/35] ppc: spapr: Introduce FWNMI capability, David Gibson, 2020/02/03
- [PULL 15/35] tpm_spapr: Support TPM for ppc64 using CRQ based interface, David Gibson, 2020/02/03
- [PULL 18/35] docs/specs/tpm: reST-ify TPM documentation, David Gibson, 2020/02/03