Received: from eggs.gnu.org ([2001:4830:134:3::10]:39801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZb9-0005b7-4D for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:09:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMZb1-0000qC-Hb for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:09:42 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:55687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZb1-0000q5-9C for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:09:39 -0500 Received: from localhost by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jan 2016 11:09:38 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2121C17D805A for ; Fri, 22 Jan 2016 11:09:43 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0MB9aVa51118246 for ; Fri, 22 Jan 2016 11:09:36 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0MB9aQN003494 for ; Fri, 22 Jan 2016 04:09:36 -0700 Date: Fri, 22 Jan 2016 12:09:33 +0100 From: Greg Kurz Message-ID: <20160122120933.5d6e23f3@bahia.huguette.org> In-Reply-To: <1453396734-9363-8-git-send-email-clg@fr.ibm.com> References: <1453396734-9363-1-git-send-email-clg@fr.ibm.com> <1453396734-9363-8-git-send-email-clg@fr.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 7/9] ipmi: add GET_SYS_RESTART_CAUSE chassis command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater Cc: Corey Minyard , qemu-devel@nongnu.org, Marcel Apfelbaum , "Michael S. Tsirkin" On Thu, 21 Jan 2016 18:18:52 +0100 C=C3=A9dric Le Goater wrote: > This is a simulator. Just return an unknown cause (0). >=20 > Signed-off-by: C=C3=A9dric Le Goater > Acked-by: Corey Minyard > --- Reviewed-by: Greg Kurz > hw/ipmi/ipmi_bmc_sim.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c > index 7c0f2a1d9799..e882af3f1b40 100644 > --- a/hw/ipmi/ipmi_bmc_sim.c > +++ b/hw/ipmi/ipmi_bmc_sim.c > @@ -34,6 +34,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 > @@ -197,6 +198,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]; > @@ -756,6 +759,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, > @@ -1571,7 +1583,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), > @@ -1692,6 +1705,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;