From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRRpT-0007Bg-Ux for qemu-devel@nongnu.org; Thu, 04 Feb 2016 16:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRRpP-0005RV-Qv for qemu-devel@nongnu.org; Thu, 04 Feb 2016 16:52:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRRpP-0005RI-Jz for qemu-devel@nongnu.org; Thu, 04 Feb 2016 16:52:39 -0500 Date: Thu, 4 Feb 2016 23:52:35 +0200 From: "Michael S. Tsirkin" Message-ID: <1454612376-7072-25-git-send-email-mst@redhat.com> References: <1454612376-7072-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1454612376-7072-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 24/49] ipmi: add GET_SYS_RESTART_CAUSE chassis command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Eduardo Habkost , Corey Minyard , =?us-ascii?B?PT9VVEYtOD9xP0M9QzM9QTlkcmljPTIwTGU9MjBHb2F0ZXI/PQ==?= , Marcel Apfelbaum , Greg Kurz From: C=E9dric Le Goater This is a simulator. Just return an unknown cause (0). Signed-off-by: C=E9dric Le Goater Acked-by: Corey Minyard Reviewed-by: Greg Kurz Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/ipmi/ipmi_bmc_sim.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index 24a4b32..29224dd 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -32,6 +32,7 @@ #define IPMI_CMD_GET_CHASSIS_CAPABILITIES 0x00 #define IPMI_CMD_GET_CHASSIS_STATUS 0x01 #define IPMI_CMD_CHASSIS_CONTROL 0x02 +#define IPMI_CMD_GET_SYS_RESTART_CAUSE 0x09 =20 #define IPMI_NETFN_SENSOR_EVENT 0x04 =20 @@ -195,6 +196,8 @@ struct IPMIBmcSim { uint8_t mfg_id[3]; uint8_t product_id[2]; =20 + uint8_t restart_cause; + IPMISel sel; IPMISdr sdr; IPMISensor sensors[MAX_SENSORS]; @@ -754,6 +757,15 @@ static void chassis_control(IPMIBmcSim *ibs, } } =20 +static void chassis_get_sys_restart_cause(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->restart_cause & 0xf); /* Restart Cause */ + IPMI_ADD_RSP_DATA(0); /* Channel 0 */ +} + static void get_device_id(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, @@ -1570,7 +1582,8 @@ static void get_sensor_type(IPMIBmcSim *ibs, static const IPMICmdHandler chassis_cmds[] =3D { [IPMI_CMD_GET_CHASSIS_CAPABILITIES] =3D chassis_capabilities, [IPMI_CMD_GET_CHASSIS_STATUS] =3D chassis_status, - [IPMI_CMD_CHASSIS_CONTROL] =3D chassis_control + [IPMI_CMD_CHASSIS_CONTROL] =3D chassis_control, + [IPMI_CMD_GET_SYS_RESTART_CAUSE] =3D chassis_get_sys_restart_cause }; static const IPMINetfn chassis_netfn =3D { .cmd_nums =3D ARRAY_SIZE(chassis_cmds), @@ -1691,6 +1704,7 @@ static void ipmi_sim_init(Object *obj) ibs->bmc_global_enables =3D (1 << IPMI_BMC_EVENT_LOG_BIT); ibs->device_id =3D 0x20; ibs->ipmi_version =3D 0x02; /* IPMI 2.0 */ + ibs->restart_cause =3D 0; for (i =3D 0; i < 4; i++) { ibs->sel.last_addition[i] =3D 0xff; ibs->sel.last_clear[i] =3D 0xff; --=20 MST