[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 20/33] spapr_rtas: add get-sensor-state RTAS interface
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 20/33] spapr_rtas: add get-sensor-state RTAS interface |
Date: |
Thu, 7 May 2015 15:33:46 +1000 |
From: Mike Day <address@hidden>
This interface allows a guest to read various platform/device sensors.
initially, we only implement support necessary to support hotplug:
reading of the dr-entity-sense sensor, which communicates the state of
a hotplugged resource/device to the guest (EMPTY/PRESENT/UNUSABLE).
See docs/specs/ppc-spapr-hotplug.txt for a complete description of
this interface.
Signed-off-by: Mike Day <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_rtas.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 6c741fa..f80beb2 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -377,6 +377,47 @@ out_unimplemented:
rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
}
+static void rtas_get_sensor_state(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+ uint32_t token, uint32_t nargs,
+ target_ulong args, uint32_t nret,
+ target_ulong rets)
+{
+ uint32_t sensor_type;
+ uint32_t sensor_index;
+ sPAPRDRConnector *drc;
+ sPAPRDRConnectorClass *drck;
+ uint32_t entity_sense;
+
+ if (nargs != 2 || nret != 2) {
+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+ return;
+ }
+
+ sensor_type = rtas_ld(args, 0);
+ sensor_index = rtas_ld(args, 1);
+
+ if (sensor_type != RTAS_SENSOR_TYPE_ENTITY_SENSE) {
+ /* currently only DR-related sensors are implemented */
+ DPRINTF("rtas_get_sensor_state: sensor/indicator not implemented:
%d\n",
+ sensor_type);
+ rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
+ return;
+ }
+
+ drc = spapr_dr_connector_by_index(sensor_index);
+ if (!drc) {
+ DPRINTF("rtas_get_sensor_state: invalid sensor/DRC index: %xh\n",
+ sensor_index);
+ rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+ return;
+ }
+ drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
+ entity_sense = drck->entity_sense(drc);
+
+ rtas_st(rets, 0, RTAS_OUT_SUCCESS);
+ rtas_st(rets, 1, entity_sense);
+}
+
static struct rtas_call {
const char *name;
spapr_rtas_fn fn;
@@ -508,6 +549,8 @@ static void core_rtas_register_types(void)
rtas_get_power_level);
spapr_rtas_register(RTAS_SET_INDICATOR, "set-indicator",
rtas_set_indicator);
+ spapr_rtas_register(RTAS_GET_SENSOR_STATE, "get-sensor-state",
+ rtas_get_sensor_state);
}
type_init(core_rtas_register_types)
--
2.1.0
- [Qemu-ppc] [PATCH 27/33] spapr_pci: create DRConnectors for each PCI slot during PHB realize, (continued)
- [Qemu-ppc] [PATCH 27/33] spapr_pci: create DRConnectors for each PCI slot during PHB realize, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 33/33] pseries: Enable in-kernel H_LOGICAL_CI_{LOAD, STORE} implementations, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 19/33] spapr_rtas: add set-indicator RTAS interface, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 30/33] spapr_pci: emit hotplug add/remove events during hotplug, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 24/33] spapr_events: event-scan RTAS interface, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 28/33] pci: make pci_bar useable outside pci.c, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 26/33] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 16/33] docs: add sPAPR hotplug/dynamic-reconfiguration documentation, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 22/33] spapr_rtas: add ibm, configure-connector RTAS interface, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 31/33] machine: add default_ram_size to machine class, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 20/33] spapr_rtas: add get-sensor-state RTAS interface,
David Gibson <=
- [Qemu-ppc] [PATCH 25/33] spapr_drc: add spapr_drc_populate_dt(), David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 23/33] spapr_events: re-use EPOW event infrastructure for hotplug events, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 29/33] spapr_pci: enable basic hotplug operations, David Gibson, 2015/05/07
- [Qemu-ppc] [PATCH 17/33] spapr_drc: initial implementation of sPAPRDRConnector device, David Gibson, 2015/05/07
- Re: [Qemu-ppc] [PATCH 00/33] Accumulated -machine pseries patches 2015-05-07, Alexander Graf, 2015/05/07