spapr: Clean up spapr_drc_populate_dt()
This makes some minor cleanups to spapr_drc_populate_dt(), renaming it to the shorter and more idiomatic spapr_dt_drc() along the way. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Acked-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
466e883185
commit
9e7d38e8a3
|
@ -1320,13 +1320,12 @@ static void *spapr_build_fdt(SpaprMachineState *spapr)
|
||||||
spapr_populate_cpus_dt_node(fdt, spapr);
|
spapr_populate_cpus_dt_node(fdt, spapr);
|
||||||
|
|
||||||
if (smc->dr_lmb_enabled) {
|
if (smc->dr_lmb_enabled) {
|
||||||
_FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB));
|
_FDT(spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc->has_hotpluggable_cpus) {
|
if (mc->has_hotpluggable_cpus) {
|
||||||
int offset = fdt_path_offset(fdt, "/cpus");
|
int offset = fdt_path_offset(fdt, "/cpus");
|
||||||
ret = spapr_drc_populate_dt(fdt, offset, NULL,
|
ret = spapr_dt_drc(fdt, offset, NULL, SPAPR_DR_CONNECTOR_TYPE_CPU);
|
||||||
SPAPR_DR_CONNECTOR_TYPE_CPU);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_report("Couldn't set up CPU DR device tree properties");
|
error_report("Couldn't set up CPU DR device tree properties");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -1363,7 +1362,7 @@ static void *spapr_build_fdt(SpaprMachineState *spapr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smc->dr_phb_enabled) {
|
if (smc->dr_phb_enabled) {
|
||||||
ret = spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB);
|
ret = spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_report("Couldn't set up PHB DR device tree properties");
|
error_report("Couldn't set up PHB DR device tree properties");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -781,7 +781,7 @@ SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spapr_drc_populate_dt
|
* spapr_dt_drc
|
||||||
*
|
*
|
||||||
* @fdt: libfdt device tree
|
* @fdt: libfdt device tree
|
||||||
* @path: path in the DT to generate properties
|
* @path: path in the DT to generate properties
|
||||||
|
@ -794,8 +794,7 @@ SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id)
|
||||||
*
|
*
|
||||||
* as documented in PAPR+ v2.1, 13.5.2
|
* as documented in PAPR+ v2.1, 13.5.2
|
||||||
*/
|
*/
|
||||||
int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
|
int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask)
|
||||||
uint32_t drc_type_mask)
|
|
||||||
{
|
{
|
||||||
Object *root_container;
|
Object *root_container;
|
||||||
ObjectProperty *prop;
|
ObjectProperty *prop;
|
||||||
|
@ -873,7 +872,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
|
||||||
*(uint32_t *)drc_names->str = cpu_to_be32(drc_count);
|
*(uint32_t *)drc_names->str = cpu_to_be32(drc_count);
|
||||||
*(uint32_t *)drc_types->str = cpu_to_be32(drc_count);
|
*(uint32_t *)drc_types->str = cpu_to_be32(drc_count);
|
||||||
|
|
||||||
ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-indexes",
|
ret = fdt_setprop(fdt, offset, "ibm,drc-indexes",
|
||||||
drc_indexes->data,
|
drc_indexes->data,
|
||||||
drc_indexes->len * sizeof(uint32_t));
|
drc_indexes->len * sizeof(uint32_t));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -881,7 +880,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-power-domains",
|
ret = fdt_setprop(fdt, offset, "ibm,drc-power-domains",
|
||||||
drc_power_domains->data,
|
drc_power_domains->data,
|
||||||
drc_power_domains->len * sizeof(uint32_t));
|
drc_power_domains->len * sizeof(uint32_t));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -889,14 +888,14 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-names",
|
ret = fdt_setprop(fdt, offset, "ibm,drc-names",
|
||||||
drc_names->str, drc_names->len);
|
drc_names->str, drc_names->len);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("Couldn't finalize ibm,drc-names property");
|
error_report("Couldn't finalize ibm,drc-names property");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-types",
|
ret = fdt_setprop(fdt, offset, "ibm,drc-types",
|
||||||
drc_types->str, drc_types->len);
|
drc_types->str, drc_types->len);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_report("Couldn't finalize ibm,drc-types property");
|
error_report("Couldn't finalize ibm,drc-types property");
|
||||||
|
|
|
@ -2276,8 +2276,7 @@ int spapr_dt_phb(SpaprPhbState *phb, uint32_t intc_phandle, void *fdt,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = spapr_drc_populate_dt(fdt, bus_off, OBJECT(phb),
|
ret = spapr_dt_drc(fdt, bus_off, OBJECT(phb), SPAPR_DR_CONNECTOR_TYPE_PCI);
|
||||||
SPAPR_DR_CONNECTOR_TYPE_PCI);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,8 +266,7 @@ SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type,
|
||||||
uint32_t id);
|
uint32_t id);
|
||||||
SpaprDrc *spapr_drc_by_index(uint32_t index);
|
SpaprDrc *spapr_drc_by_index(uint32_t index);
|
||||||
SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id);
|
SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id);
|
||||||
int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
|
int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask);
|
||||||
uint32_t drc_type_mask);
|
|
||||||
|
|
||||||
void spapr_drc_attach(SpaprDrc *drc, DeviceState *d, Error **errp);
|
void spapr_drc_attach(SpaprDrc *drc, DeviceState *d, Error **errp);
|
||||||
void spapr_drc_detach(SpaprDrc *drc);
|
void spapr_drc_detach(SpaprDrc *drc);
|
||||||
|
|
Loading…
Reference in New Issue