mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
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>
This commit is contained in:
parent
b8fdd530be
commit
1693ea1685
2 changed files with 5 additions and 27 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue