[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/49] ipmi: add ACPI power and GUID commands
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 25/49] ipmi: add ACPI power and GUID commands |
Date: |
Thu, 4 Feb 2016 23:52:39 +0200 |
From: Cédric Le Goater <address@hidden>
>From the specs (20.8 Get Device GUID Command), the command needs to
return a GUID (Globally Unique ID), or UUID, that should never change
over the lifetime of the device. qemu_uuid looked like a good
candidate to start with but we could use a specific BMC property also
if needed.
Signed-off-by: Cédric Le Goater <address@hidden>
Acked-by: Corey Minyard <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/ipmi/ipmi_bmc_sim.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 29224dd..e1ad19b 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "sysemu/sysemu.h"
#include "qemu/timer.h"
#include "hw/ipmi/ipmi.h"
#include "qemu/error-report.h"
@@ -49,6 +50,9 @@
#define IPMI_CMD_GET_DEVICE_ID 0x01
#define IPMI_CMD_COLD_RESET 0x02
#define IPMI_CMD_WARM_RESET 0x03
+#define IPMI_CMD_SET_ACPI_POWER_STATE 0x06
+#define IPMI_CMD_GET_ACPI_POWER_STATE 0x07
+#define IPMI_CMD_GET_DEVICE_GUID 0x08
#define IPMI_CMD_RESET_WATCHDOG_TIMER 0x22
#define IPMI_CMD_SET_WATCHDOG_TIMER 0x24
#define IPMI_CMD_GET_WATCHDOG_TIMER 0x25
@@ -198,6 +202,9 @@ struct IPMIBmcSim {
uint8_t restart_cause;
+ uint8_t acpi_power_state[2];
+ uint8_t uuid[16];
+
IPMISel sel;
IPMISdr sdr;
IPMISensor sensors[MAX_SENSORS];
@@ -826,6 +833,36 @@ static void warm_reset(IPMIBmcSim *ibs,
k->reset(s, false);
}
}
+static void set_acpi_power_state(IPMIBmcSim *ibs,
+ uint8_t *cmd, unsigned int cmd_len,
+ uint8_t *rsp, unsigned int *rsp_len,
+ unsigned int max_rsp_len)
+{
+ IPMI_CHECK_CMD_LEN(4);
+ ibs->acpi_power_state[0] = cmd[2];
+ ibs->acpi_power_state[1] = cmd[3];
+}
+
+static void get_acpi_power_state(IPMIBmcSim *ibs,
+ uint8_t *cmd, unsigned int cmd_len,
+ uint8_t *rsp, unsigned int *rsp_len,
+ unsigned int max_rsp_len)
+{
+ IPMI_ADD_RSP_DATA(ibs->acpi_power_state[0]);
+ IPMI_ADD_RSP_DATA(ibs->acpi_power_state[1]);
+}
+
+static void get_device_guid(IPMIBmcSim *ibs,
+ uint8_t *cmd, unsigned int cmd_len,
+ uint8_t *rsp, unsigned int *rsp_len,
+ unsigned int max_rsp_len)
+{
+ unsigned int i;
+
+ for (i = 0; i < 16; i++) {
+ IPMI_ADD_RSP_DATA(ibs->uuid[i]);
+ }
+}
static void set_bmc_global_enables(IPMIBmcSim *ibs,
uint8_t *cmd, unsigned int cmd_len,
@@ -1608,6 +1645,9 @@ static const IPMICmdHandler app_cmds[] = {
[IPMI_CMD_GET_DEVICE_ID] = get_device_id,
[IPMI_CMD_COLD_RESET] = cold_reset,
[IPMI_CMD_WARM_RESET] = warm_reset,
+ [IPMI_CMD_SET_ACPI_POWER_STATE] = set_acpi_power_state,
+ [IPMI_CMD_GET_ACPI_POWER_STATE] = get_acpi_power_state,
+ [IPMI_CMD_GET_DEVICE_GUID] = get_device_guid,
[IPMI_CMD_SET_BMC_GLOBAL_ENABLES] = set_bmc_global_enables,
[IPMI_CMD_GET_BMC_GLOBAL_ENABLES] = get_bmc_global_enables,
[IPMI_CMD_CLR_MSG_FLAGS] = clr_msg_flags,
@@ -1733,6 +1773,15 @@ static void ipmi_sim_init(Object *obj)
i += len;
}
+ ibs->acpi_power_state[0] = 0;
+ ibs->acpi_power_state[1] = 0;
+
+ if (qemu_uuid_set) {
+ memcpy(&ibs->uuid, qemu_uuid, 16);
+ } else {
+ memset(&ibs->uuid, 0, 16);
+ }
+
ipmi_init_sensors_from_sdrs(ibs);
register_cmds(ibs);
--
MST
- [Qemu-devel] [PULL 15/49] hw/pxb: add pxb devices to the bridge category, (continued)
- [Qemu-devel] [PULL 15/49] hw/pxb: add pxb devices to the bridge category, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 16/49] vhost-user-test: use correct ROM to speed up and avoid spurious failures, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 17/49] hw/pci: ensure that only PCI/PCIe bridges can be attached to pxb/pxb-pcie devices, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 18/49] ipmi: replace goto by a return statement, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 19/49] ipmi: replace *_MAXCMD defines, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 20/49] ipmi: cleanup error_report messages, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 21/49] ipmi: fix SDR length value, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 22/49] ipmi: introduce a struct ipmi_sdr_compact, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 23/49] ipmi: add get and set SENSOR_TYPE commands, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 24/49] ipmi: add GET_SYS_RESTART_CAUSE chassis command, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 25/49] ipmi: add ACPI power and GUID commands,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 26/49] pc: Move PcGuestInfo declaration to top of file, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 27/49] pc: Eliminate struct PcGuestInfoState, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 28/49] pc: Simplify pc_memory_init() signature, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 29/49] pc: Simplify xen_load_linux() signature, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 30/49] acpi: Remove guest_info parameters from functions, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 31/49] acpi: Don't save PcGuestInfo on AcpiBuildState, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 32/49] pc: Remove compat fields from PcGuestInfo, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 34/49] pc: Remove PcGuestInfo.isapc_ram_fw field, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 35/49] pc: Move PcGuestInfo.fw_cfg to PCMachineState, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 33/49] pc: Remove RAM size fields from PcGuestInfo, Michael S. Tsirkin, 2016/02/04