diff options
author | David Gibson | 2017-06-04 12:26:54 +0200 |
---|---|---|
committer | David Gibson | 2017-06-06 01:24:21 +0200 |
commit | 1693ea168575849bc2784e193002c317ef3eee39 (patch) | |
tree | dde353901145eaf7d4245bf5dcc91fa13ba5a812 /hw/ppc/spapr_drc.c | |
parent | spapr: Move configure-connector state into DRC (diff) | |
download | qemu-1693ea168575849bc2784e193002c317ef3eee39.tar.gz qemu-1693ea168575849bc2784e193002c317ef3eee39.tar.xz qemu-1693ea168575849bc2784e193002c317ef3eee39.zip |
spapr: Eliminate spapr_drc_get_type_str()
This function was used in generating the device tree. However, now that
we have different QOM types for different DRC types we can easily store
the information we need in the class structure and avoid this specialized
lookup function.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw/ppc/spapr_drc.c')
-rw-r--r-- | hw/ppc/spapr_drc.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 783c621551..06df5d0b13 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -712,6 +712,7 @@ static void spapr_drc_cpu_class_init(ObjectClass *k, void *data) sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_CPU; + drck->typename = "CPU"; } static void spapr_drc_pci_class_init(ObjectClass *k, void *data) @@ -719,6 +720,7 @@ static void spapr_drc_pci_class_init(ObjectClass *k, void *data) sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_PCI; + drck->typename = "28"; } static void spapr_drc_lmb_class_init(ObjectClass *k, void *data) @@ -726,6 +728,7 @@ static void spapr_drc_lmb_class_init(ObjectClass *k, void *data) sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_LMB; + drck->typename = "MEM"; } static const TypeInfo spapr_dr_connector_info = { @@ -795,31 +798,6 @@ sPAPRDRConnector *spapr_drc_by_id(const char *type, uint32_t id) | (id & DRC_INDEX_ID_MASK)); } -/* generate a string the describes the DRC to encode into the - * device tree. - * - * as documented by PAPR+ v2.7, 13.5.2.6 and C.6.1 - */ -static const char *spapr_drc_get_type_str(sPAPRDRConnectorType type) -{ - switch (type) { - case SPAPR_DR_CONNECTOR_TYPE_CPU: - return "CPU"; - case SPAPR_DR_CONNECTOR_TYPE_PHB: - return "PHB"; - case SPAPR_DR_CONNECTOR_TYPE_VIO: - return "SLOT"; - case SPAPR_DR_CONNECTOR_TYPE_PCI: - return "28"; - case SPAPR_DR_CONNECTOR_TYPE_LMB: - return "MEM"; - default: - g_assert(false); - } - - return NULL; -} - /** * spapr_drc_populate_dt * @@ -901,8 +879,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, drc_names = g_string_insert_len(drc_names, -1, "\0", 1); /* ibm,drc-types */ - drc_types = g_string_append(drc_types, - spapr_drc_get_type_str(spapr_drc_type(drc))); + drc_types = g_string_append(drc_types, drck->typename); drc_types = g_string_insert_len(drc_types, -1, "\0", 1); } |