Message ID | 1422577911-18394-5-git-send-email-joel@jms.id.au |
---|---|
State | Changes Requested |
Headers | show |
Joel Stanley <joel@jms.id.au> writes: > +static void sel_power(uint8_t power) > +{ > + switch (power) { > + case SOFT_OFF: > + prlog(PR_NOTICE, "IPMI: soft shutdown requested\n"); > + opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_OFF); > + break; Triple bonus points if documentation added to doc/opal-api r.e. OPAL_MSG_SHUTDOWN and any more of OPAL_MSG things you feel like doing.
On Wed, Feb 4, 2015 at 3:50 PM, Stewart Smith <stewart@linux.vnet.ibm.com> wrote: > Triple bonus points if documentation added to doc/opal-api > r.e. OPAL_MSG_SHUTDOWN and any more of OPAL_MSG things you feel like > doing. Ok, I'll add that. Thanks.
On 01/30/2015 06:01 AM, Joel Stanley wrote: > This sends the previously unused OPAL_MSG_SHUTDOWN using opal_queue_msg > to initiate a graceful shutdown. > > The message provides a single parameter indicating weather the shutdown > is will result in a power-off, or a reboot. > > Signed-off-by: Joel Stanley <joel@jms.id.au> > --- > hw/ipmi/ipmi-sel.c | 22 ++++++++++++++++++++++ > include/opal.h | 2 +- > 2 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c > index 301e559..291f279 100644 > --- a/hw/ipmi/ipmi-sel.c > +++ b/hw/ipmi/ipmi-sel.c > @@ -21,6 +21,7 @@ > #include <lock.h> > #include <errorlog.h> > #include <pel.h> > +#include <opal-msg.h> > > /* OEM SEL fields */ > #define SEL_OEM_ID_0 0x55 > @@ -37,6 +38,9 @@ > #define CMD_AMI_POWER 0x04 > #define CMD_AMI_PNOR_ACCESS 0x07 > > +#define SOFT_OFF 0x00 > +#define SOFT_REBOOT 0x01 Better define these macros in include/opal.h as its part of OPAL API? Rest looks good. -Vasant
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes: >> @@ -37,6 +38,9 @@ >> #define CMD_AMI_POWER 0x04 >> #define CMD_AMI_PNOR_ACCESS 0x07 >> >> +#define SOFT_OFF 0x00 >> +#define SOFT_REBOOT 0x01 > > Better define these macros in include/opal.h as its part of OPAL API? Yes, that would be ideal.
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c index 301e559..291f279 100644 --- a/hw/ipmi/ipmi-sel.c +++ b/hw/ipmi/ipmi-sel.c @@ -21,6 +21,7 @@ #include <lock.h> #include <errorlog.h> #include <pel.h> +#include <opal-msg.h> /* OEM SEL fields */ #define SEL_OEM_ID_0 0x55 @@ -37,6 +38,9 @@ #define CMD_AMI_POWER 0x04 #define CMD_AMI_PNOR_ACCESS 0x07 +#define SOFT_OFF 0x00 +#define SOFT_REBOOT 0x01 + struct oem_sel { /* SEL header */ uint8_t id[2]; @@ -176,6 +180,23 @@ int ipmi_elog_commit(struct errorlog *elog_buf) return 0; } +static void sel_power(uint8_t power) +{ + switch (power) { + case SOFT_OFF: + prlog(PR_NOTICE, "IPMI: soft shutdown requested\n"); + opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_OFF); + break; + case SOFT_REBOOT: + prlog(PR_NOTICE, "IPMI: soft reboot rqeuested\n"); + opal_queue_msg(OPAL_MSG_SHUTDOWN, NULL, NULL, SOFT_REBOOT); + break; + default: + prlog(PR_WARNING, "IPMI: requested bad power state: %02x\n", + power); + } +} + static void dump_sel(struct oem_sel *sel) { const int level = PR_DEBUG; @@ -224,6 +245,7 @@ void ipmi_parse_sel(struct ipmi_msg *msg) switch (sel.cmd) { case CMD_AMI_POWER: + sel_power(sel.data[0]); break; case CMD_AMI_PNOR_ACCESS: break; diff --git a/include/opal.h b/include/opal.h index 6c9b13a..679a0d9 100644 --- a/include/opal.h +++ b/include/opal.h @@ -395,7 +395,7 @@ enum OpalMessageType { */ OPAL_MSG_MEM_ERR, OPAL_MSG_EPOW, - OPAL_MSG_SHUTDOWN, + OPAL_MSG_SHUTDOWN, /* params[0] = 1 reboot, 0 shutdown */ OPAL_MSG_HMI_EVT, OPAL_MSG_DPO, OPAL_MSG_TYPE_MAX,
This sends the previously unused OPAL_MSG_SHUTDOWN using opal_queue_msg to initiate a graceful shutdown. The message provides a single parameter indicating weather the shutdown is will result in a power-off, or a reboot. Signed-off-by: Joel Stanley <joel@jms.id.au> --- hw/ipmi/ipmi-sel.c | 22 ++++++++++++++++++++++ include/opal.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-)