diff options
Diffstat (limited to 'hw/ppc/spapr_drc.c')
-rw-r--r-- | hw/ppc/spapr_drc.c | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 2943cf47d4..597f236b9c 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -29,16 +29,16 @@ #define DRC_INDEX_TYPE_SHIFT 28 #define DRC_INDEX_ID_MASK ((1ULL << DRC_INDEX_TYPE_SHIFT) - 1) -sPAPRDRConnectorType spapr_drc_type(sPAPRDRConnector *drc) +SpaprDrcType spapr_drc_type(SpaprDrc *drc) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); return 1 << drck->typeshift; } -uint32_t spapr_drc_index(sPAPRDRConnector *drc) +uint32_t spapr_drc_index(SpaprDrc *drc) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); /* no set format for a drc index: it only needs to be globally * unique. this is how we encode the DRC type on bare-metal @@ -48,7 +48,7 @@ uint32_t spapr_drc_index(sPAPRDRConnector *drc) | (drc->id & DRC_INDEX_ID_MASK); } -static uint32_t drc_isolate_physical(sPAPRDRConnector *drc) +static uint32_t drc_isolate_physical(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_PHYSICAL_POWERON: @@ -72,7 +72,7 @@ static uint32_t drc_isolate_physical(sPAPRDRConnector *drc) return RTAS_OUT_SUCCESS; } -static uint32_t drc_unisolate_physical(sPAPRDRConnector *drc) +static uint32_t drc_unisolate_physical(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_PHYSICAL_UNISOLATE: @@ -99,7 +99,7 @@ static uint32_t drc_unisolate_physical(sPAPRDRConnector *drc) return RTAS_OUT_SUCCESS; } -static uint32_t drc_isolate_logical(sPAPRDRConnector *drc) +static uint32_t drc_isolate_logical(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_LOGICAL_AVAILABLE: @@ -146,7 +146,7 @@ static uint32_t drc_isolate_logical(sPAPRDRConnector *drc) return RTAS_OUT_SUCCESS; } -static uint32_t drc_unisolate_logical(sPAPRDRConnector *drc) +static uint32_t drc_unisolate_logical(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_LOGICAL_UNISOLATE: @@ -170,7 +170,7 @@ static uint32_t drc_unisolate_logical(sPAPRDRConnector *drc) return RTAS_OUT_SUCCESS; } -static uint32_t drc_set_usable(sPAPRDRConnector *drc) +static uint32_t drc_set_usable(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_LOGICAL_AVAILABLE: @@ -202,7 +202,7 @@ static uint32_t drc_set_usable(sPAPRDRConnector *drc) return RTAS_OUT_SUCCESS; } -static uint32_t drc_set_unusable(sPAPRDRConnector *drc) +static uint32_t drc_set_unusable(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_LOGICAL_UNUSABLE: @@ -226,9 +226,9 @@ static uint32_t drc_set_unusable(sPAPRDRConnector *drc) return RTAS_OUT_SUCCESS; } -static const char *spapr_drc_name(sPAPRDRConnector *drc) +static const char *spapr_drc_name(SpaprDrc *drc) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); /* human-readable name for a DRC to encode into the DT * description. this is mainly only used within a guest in place @@ -261,7 +261,7 @@ static const char *spapr_drc_name(sPAPRDRConnector *drc) * based on the current allocation/indicator/power states * for the DR connector. */ -static sPAPRDREntitySense physical_entity_sense(sPAPRDRConnector *drc) +static SpaprDREntitySense physical_entity_sense(SpaprDrc *drc) { /* this assumes all PCI devices are assigned to a 'live insertion' * power domain, where QEMU manages power state automatically as @@ -272,7 +272,7 @@ static sPAPRDREntitySense physical_entity_sense(sPAPRDRConnector *drc) : SPAPR_DR_ENTITY_SENSE_EMPTY; } -static sPAPRDREntitySense logical_entity_sense(sPAPRDRConnector *drc) +static SpaprDREntitySense logical_entity_sense(SpaprDrc *drc) { switch (drc->state) { case SPAPR_DRC_STATE_LOGICAL_UNUSABLE: @@ -290,7 +290,7 @@ static sPAPRDREntitySense logical_entity_sense(sPAPRDRConnector *drc) static void prop_get_index(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(obj); uint32_t value = spapr_drc_index(drc); visit_type_uint32(v, name, &value, errp); } @@ -298,7 +298,7 @@ static void prop_get_index(Object *obj, Visitor *v, const char *name, static void prop_get_fdt(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(obj); QNull *null = NULL; Error *err = NULL; int fdt_offset_next, fdt_offset, fdt_depth; @@ -374,7 +374,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name, } while (fdt_depth != 0); } -void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, Error **errp) +void spapr_drc_attach(SpaprDrc *drc, DeviceState *d, Error **errp) { trace_spapr_drc_attach(spapr_drc_index(drc)); @@ -393,9 +393,9 @@ void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, Error **errp) NULL, 0, NULL); } -static void spapr_drc_release(sPAPRDRConnector *drc) +static void spapr_drc_release(SpaprDrc *drc) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); drck->release(drc->dev); @@ -407,9 +407,9 @@ static void spapr_drc_release(sPAPRDRConnector *drc) drc->dev = NULL; } -void spapr_drc_detach(sPAPRDRConnector *drc) +void spapr_drc_detach(SpaprDrc *drc) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); trace_spapr_drc_detach(spapr_drc_index(drc)); @@ -425,9 +425,9 @@ void spapr_drc_detach(sPAPRDRConnector *drc) spapr_drc_release(drc); } -void spapr_drc_reset(sPAPRDRConnector *drc) +void spapr_drc_reset(SpaprDrc *drc) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); trace_spapr_drc_reset(spapr_drc_index(drc)); @@ -456,8 +456,8 @@ void spapr_drc_reset(sPAPRDRConnector *drc) bool spapr_drc_needed(void *opaque) { - sPAPRDRConnector *drc = (sPAPRDRConnector *)opaque; - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrc *drc = (SpaprDrc *)opaque; + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); /* If no dev is plugged in there is no need to migrate the DRC state */ if (!drc->dev) { @@ -477,14 +477,14 @@ static const VMStateDescription vmstate_spapr_drc = { .minimum_version_id = 1, .needed = spapr_drc_needed, .fields = (VMStateField []) { - VMSTATE_UINT32(state, sPAPRDRConnector), + VMSTATE_UINT32(state, SpaprDrc), VMSTATE_END_OF_LIST() } }; static void realize(DeviceState *d, Error **errp) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(d); Object *root_container; gchar *link_name; gchar *child_name; @@ -517,7 +517,7 @@ static void realize(DeviceState *d, Error **errp) static void unrealize(DeviceState *d, Error **errp) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(d); Object *root_container; gchar *name; @@ -529,10 +529,10 @@ static void unrealize(DeviceState *d, Error **errp) g_free(name); } -sPAPRDRConnector *spapr_dr_connector_new(Object *owner, const char *type, +SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, uint32_t id) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(object_new(type)); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(object_new(type)); char *prop_name; drc->id = id; @@ -549,8 +549,8 @@ sPAPRDRConnector *spapr_dr_connector_new(Object *owner, const char *type, static void spapr_dr_connector_instance_init(Object *obj) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(obj); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); object_property_add_uint32_ptr(obj, "id", &drc->id, NULL); object_property_add(obj, "index", "uint32", prop_get_index, @@ -574,8 +574,8 @@ static void spapr_dr_connector_class_init(ObjectClass *k, void *data) static bool drc_physical_needed(void *opaque) { - sPAPRDRCPhysical *drcp = (sPAPRDRCPhysical *)opaque; - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(drcp); + SpaprDrcPhysical *drcp = (SpaprDrcPhysical *)opaque; + SpaprDrc *drc = SPAPR_DR_CONNECTOR(drcp); if ((drc->dev && (drcp->dr_indicator == SPAPR_DR_INDICATOR_ACTIVE)) || (!drc->dev && (drcp->dr_indicator == SPAPR_DR_INDICATOR_INACTIVE))) { @@ -590,15 +590,15 @@ static const VMStateDescription vmstate_spapr_drc_physical = { .minimum_version_id = 1, .needed = drc_physical_needed, .fields = (VMStateField []) { - VMSTATE_UINT32(dr_indicator, sPAPRDRCPhysical), + VMSTATE_UINT32(dr_indicator, SpaprDrcPhysical), VMSTATE_END_OF_LIST() } }; static void drc_physical_reset(void *opaque) { - sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(opaque); - sPAPRDRCPhysical *drcp = SPAPR_DRC_PHYSICAL(drc); + SpaprDrc *drc = SPAPR_DR_CONNECTOR(opaque); + SpaprDrcPhysical *drcp = SPAPR_DRC_PHYSICAL(drc); if (drc->dev) { drcp->dr_indicator = SPAPR_DR_INDICATOR_ACTIVE; @@ -609,7 +609,7 @@ static void drc_physical_reset(void *opaque) static void realize_physical(DeviceState *d, Error **errp) { - sPAPRDRCPhysical *drcp = SPAPR_DRC_PHYSICAL(d); + SpaprDrcPhysical *drcp = SPAPR_DRC_PHYSICAL(d); Error *local_err = NULL; realize(d, &local_err); @@ -625,7 +625,7 @@ static void realize_physical(DeviceState *d, Error **errp) static void unrealize_physical(DeviceState *d, Error **errp) { - sPAPRDRCPhysical *drcp = SPAPR_DRC_PHYSICAL(d); + SpaprDrcPhysical *drcp = SPAPR_DRC_PHYSICAL(d); Error *local_err = NULL; unrealize(d, &local_err); @@ -641,7 +641,7 @@ static void unrealize_physical(DeviceState *d, Error **errp) static void spapr_drc_physical_class_init(ObjectClass *k, void *data) { DeviceClass *dk = DEVICE_CLASS(k); - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); dk->realize = realize_physical; dk->unrealize = unrealize_physical; @@ -654,7 +654,7 @@ static void spapr_drc_physical_class_init(ObjectClass *k, void *data) static void spapr_drc_logical_class_init(ObjectClass *k, void *data) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->dr_entity_sense = logical_entity_sense; drck->isolate = drc_isolate_logical; @@ -665,7 +665,7 @@ static void spapr_drc_logical_class_init(ObjectClass *k, void *data) static void spapr_drc_cpu_class_init(ObjectClass *k, void *data) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_CPU; drck->typename = "CPU"; @@ -676,7 +676,7 @@ static void spapr_drc_cpu_class_init(ObjectClass *k, void *data) static void spapr_drc_pci_class_init(ObjectClass *k, void *data) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_PCI; drck->typename = "28"; @@ -687,7 +687,7 @@ static void spapr_drc_pci_class_init(ObjectClass *k, void *data) static void spapr_drc_lmb_class_init(ObjectClass *k, void *data) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_LMB; drck->typename = "MEM"; @@ -698,7 +698,7 @@ static void spapr_drc_lmb_class_init(ObjectClass *k, void *data) static void spapr_drc_phb_class_init(ObjectClass *k, void *data) { - sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(k); drck->typeshift = SPAPR_DR_CONNECTOR_TYPE_SHIFT_PHB; drck->typename = "PHB"; @@ -710,9 +710,9 @@ static void spapr_drc_phb_class_init(ObjectClass *k, void *data) static const TypeInfo spapr_dr_connector_info = { .name = TYPE_SPAPR_DR_CONNECTOR, .parent = TYPE_DEVICE, - .instance_size = sizeof(sPAPRDRConnector), + .instance_size = sizeof(SpaprDrc), .instance_init = spapr_dr_connector_instance_init, - .class_size = sizeof(sPAPRDRConnectorClass), + .class_size = sizeof(SpaprDrcClass), .class_init = spapr_dr_connector_class_init, .abstract = true, }; @@ -720,7 +720,7 @@ static const TypeInfo spapr_dr_connector_info = { static const TypeInfo spapr_drc_physical_info = { .name = TYPE_SPAPR_DRC_PHYSICAL, .parent = TYPE_SPAPR_DR_CONNECTOR, - .instance_size = sizeof(sPAPRDRCPhysical), + .instance_size = sizeof(SpaprDrcPhysical), .class_init = spapr_drc_physical_class_init, .abstract = true, }; @@ -753,13 +753,13 @@ static const TypeInfo spapr_drc_lmb_info = { static const TypeInfo spapr_drc_phb_info = { .name = TYPE_SPAPR_DRC_PHB, .parent = TYPE_SPAPR_DRC_LOGICAL, - .instance_size = sizeof(sPAPRDRConnector), + .instance_size = sizeof(SpaprDrc), .class_init = spapr_drc_phb_class_init, }; /* helper functions for external users */ -sPAPRDRConnector *spapr_drc_by_index(uint32_t index) +SpaprDrc *spapr_drc_by_index(uint32_t index) { Object *obj; gchar *name; @@ -771,9 +771,9 @@ sPAPRDRConnector *spapr_drc_by_index(uint32_t index) return !obj ? NULL : SPAPR_DR_CONNECTOR(obj); } -sPAPRDRConnector *spapr_drc_by_id(const char *type, uint32_t id) +SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id) { - sPAPRDRConnectorClass *drck + SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_CLASS(object_class_by_name(type)); return spapr_drc_by_index(drck->typeshift << DRC_INDEX_TYPE_SHIFT @@ -787,7 +787,7 @@ sPAPRDRConnector *spapr_drc_by_id(const char *type, uint32_t id) * @path: path in the DT to generate properties * @owner: parent Object/DeviceState for which to generate DRC * descriptions for - * @drc_type_mask: mask of sPAPRDRConnectorType values corresponding + * @drc_type_mask: mask of SpaprDrcType values corresponding * to the types of DRCs to generate entries for * * generate OF properties to describe DRC topology/indices to guests @@ -826,8 +826,8 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, object_property_iter_init(&iter, root_container); while ((prop = object_property_iter_next(&iter))) { Object *obj; - sPAPRDRConnector *drc; - sPAPRDRConnectorClass *drck; + SpaprDrc *drc; + SpaprDrcClass *drck; uint32_t drc_index, drc_power_domain; if (!strstart(prop->type, "link<", NULL)) { @@ -918,8 +918,8 @@ out: static uint32_t rtas_set_isolation_state(uint32_t idx, uint32_t state) { - sPAPRDRConnector *drc = spapr_drc_by_index(idx); - sPAPRDRConnectorClass *drck; + SpaprDrc *drc = spapr_drc_by_index(idx); + SpaprDrcClass *drck; if (!drc) { return RTAS_OUT_NO_SUCH_INDICATOR; @@ -943,7 +943,7 @@ static uint32_t rtas_set_isolation_state(uint32_t idx, uint32_t state) static uint32_t rtas_set_allocation_state(uint32_t idx, uint32_t state) { - sPAPRDRConnector *drc = spapr_drc_by_index(idx); + SpaprDrc *drc = spapr_drc_by_index(idx); if (!drc || !object_dynamic_cast(OBJECT(drc), TYPE_SPAPR_DRC_LOGICAL)) { return RTAS_OUT_NO_SUCH_INDICATOR; @@ -965,7 +965,7 @@ static uint32_t rtas_set_allocation_state(uint32_t idx, uint32_t state) static uint32_t rtas_set_dr_indicator(uint32_t idx, uint32_t state) { - sPAPRDRConnector *drc = spapr_drc_by_index(idx); + SpaprDrc *drc = spapr_drc_by_index(idx); if (!drc || !object_dynamic_cast(OBJECT(drc), TYPE_SPAPR_DRC_PHYSICAL)) { return RTAS_OUT_NO_SUCH_INDICATOR; @@ -982,7 +982,7 @@ static uint32_t rtas_set_dr_indicator(uint32_t idx, uint32_t state) return RTAS_OUT_SUCCESS; } -static void rtas_set_indicator(PowerPCCPU *cpu, sPAPRMachineState *spapr, +static void rtas_set_indicator(PowerPCCPU *cpu, SpaprMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -1017,7 +1017,7 @@ out: rtas_st(rets, 0, ret); } -static void rtas_get_sensor_state(PowerPCCPU *cpu, sPAPRMachineState *spapr, +static void rtas_get_sensor_state(PowerPCCPU *cpu, SpaprMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -1025,8 +1025,8 @@ static void rtas_get_sensor_state(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t sensor_type; uint32_t sensor_index; uint32_t sensor_state = 0; - sPAPRDRConnector *drc; - sPAPRDRConnectorClass *drck; + SpaprDrc *drc; + SpaprDrcClass *drck; uint32_t ret = RTAS_OUT_SUCCESS; if (nargs != 2 || nret != 2) { @@ -1079,7 +1079,7 @@ static void configure_connector_st(target_ulong addr, target_ulong offset, } static void rtas_ibm_configure_connector(PowerPCCPU *cpu, - sPAPRMachineState *spapr, + SpaprMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) @@ -1087,9 +1087,9 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu, uint64_t wa_addr; uint64_t wa_offset; uint32_t drc_index; - sPAPRDRConnector *drc; - sPAPRDRConnectorClass *drck; - sPAPRDRCCResponse resp = SPAPR_DR_CC_RESPONSE_CONTINUE; + SpaprDrc *drc; + SpaprDrcClass *drck; + SpaprDRCCResponse resp = SPAPR_DR_CC_RESPONSE_CONTINUE; int rc; if (nargs != 2 || nret != 1) { |