* [PATCH phosphor-host-ipmid v2 0/2] Adding Boot Policy
@ 2016-04-18 11:20 OpenBMC Patches
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 1/2] " OpenBMC Patches
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621 OpenBMC Patches
0 siblings, 2 replies; 5+ messages in thread
From: OpenBMC Patches @ 2016-04-18 11:20 UTC (permalink / raw)
To: openbmc
Adding the boot policy support for get/Set system boot option.Policy can be onetime which is applicable to next boot only or
Permanent which is applicable for all the future boots.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/openbmc/phosphor-host-ipmid/83)
<!-- Reviewable:end -->
https://github.com/openbmc/phosphor-host-ipmid/pull/83
ratagupt (2):
Adding Boot Policy
Review Comment added for 146621
chassishandler.C | 64 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 52 insertions(+), 12 deletions(-)
--
2.7.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH phosphor-host-ipmid v2 1/2] Adding Boot Policy
2016-04-18 11:20 [PATCH phosphor-host-ipmid v2 0/2] Adding Boot Policy OpenBMC Patches
@ 2016-04-18 11:20 ` OpenBMC Patches
2016-04-19 16:49 ` Stewart Smith
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621 OpenBMC Patches
1 sibling, 1 reply; 5+ messages in thread
From: OpenBMC Patches @ 2016-04-18 11:20 UTC (permalink / raw)
To: openbmc; +Cc: ratagupt
From: ratagupt <ratagupt@in.ibm.com>
---
chassishandler.C | 59 ++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 47 insertions(+), 12 deletions(-)
diff --git a/chassishandler.C b/chassishandler.C
index fca3c79..1a5508f 100644
--- a/chassishandler.C
+++ b/chassishandler.C
@@ -92,7 +92,7 @@ finish:
return r;
}
-int dbus_get_property(char **buf)
+int dbus_get_property(const char *name,char **buf)
{
sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *m = NULL;
@@ -128,7 +128,7 @@ int dbus_get_property(char **buf)
&m, /* return message on success */
"ss", /* input signature */
host_intf_name, /* first argument */
- "boot_flags"); /* second argument */
+ name); /* second argument */
if (r < 0) {
fprintf(stderr, "Failed to issue method call: %s\n", error.message);
@@ -161,7 +161,7 @@ finish:
return r;
}
-int dbus_set_property(const char *buf)
+int dbus_set_property(const char * name,const char *value)
{
sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *m = NULL;
@@ -196,16 +196,16 @@ int dbus_set_property(const char *buf)
&m, /* return message on success */
"ssv", /* input signature */
host_intf_name, /* first argument */
- "boot_flags", /* second argument */
+ name, /* second argument */
"s", /* third argument */
- buf); /* fourth argument */
+ value); /* fourth argument */
if (r < 0) {
fprintf(stderr, "Failed to issue method call: %s\n", error.message);
goto finish;
}
- printf("IPMID boot option property set: {%s}.\n", buf);
+ printf("IPMID boot option property set: {%s}.\n", value);
finish:
sd_bus_error_free(&error);
@@ -374,7 +374,8 @@ char* get_boot_option_by_ipmi(uint8_t p) {
}
#define SET_PARM_VERSION 1
-#define SET_PARM_BOOT_FLAGS_VALID 0x80
+#define SET_PARM_BOOT_FLAGS_VALID_ONE_TIME 0x80
+#define SET_PARM_BOOT_FLAGS_VALID_PERMANENT 0xC0
ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
@@ -391,7 +392,7 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
memset(resp,0,sizeof(*resp));
resp->version = SET_PARM_VERSION;
resp->parm = 5;
- resp->data[0] = SET_PARM_BOOT_FLAGS_VALID;
+ resp->data[0] = SET_PARM_BOOT_FLAGS_VALID_ONE_TIME;
*data_len = sizeof(*resp);
@@ -401,10 +402,11 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
*/
if (reqptr->parameter == 5) {
- int r = dbus_get_property(&p);
+ /* Get the boot device */
+ int r = dbus_get_property("boot_flags",&p);
if (r < 0) {
- fprintf(stderr, "Dbus get property failed for get_sys_boot_options.\n");
+ fprintf(stderr, "Dbus get property(boot_flags) failed for get_sys_boot_options.\n");
rc = IPMI_CC_UNSPECIFIED_ERROR;
} else {
@@ -412,8 +414,31 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
s = get_ipmi_boot_option(p);
resp->data[1] = (s << 2);
rc = IPMI_CC_OK;
+
+ }
+
+ if (p)
+ {
+ free(p);
+ p = NULL;
+ }
+
+ /* Get the boot policy */
+ r = dbus_get_property("boot_policy",&p);
+
+ if (r < 0) {
+ fprintf(stderr, "Dbus get property(boot_policy) failed for get_sys_boot_options.\n");
+ rc = IPMI_CC_UNSPECIFIED_ERROR;
+
+ } else {
+
+ printf("BootPolicy is[%s]", p);
+ resp->data[0] = (strcmp(p,"ONETIME")==0)?SET_PARM_BOOT_FLAGS_VALID_ONE_TIME:SET_PARM_BOOT_FLAGS_VALID_PERMANENT;
+ rc = IPMI_CC_OK;
+
}
+
} else {
fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
}
@@ -455,13 +480,23 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
} else {
- int r = dbus_set_property(s);
+ int r = dbus_set_property("boot_flags",s);
if (r < 0) {
- fprintf(stderr, "Dbus set property failed for set_sys_boot_options.\n");
+ fprintf(stderr, "Dbus set property(boot_flags) failed for set_sys_boot_options.\n");
rc = IPMI_CC_UNSPECIFIED_ERROR;
}
}
+
+ /* setting the boot policy */
+ s= (char *)(((reqptr->data[0] & 0x40) == 0x40) ?"PERMANENT":"ONETIME");
+ printf ( "\nBoot Policy is %s",s);
+ int r = dbus_set_property("boot_policy",s);
+
+ if (r < 0) {
+ fprintf(stderr, "Dbus set property(boot_policy) failed for set_sys_boot_options.\n");
+ rc = IPMI_CC_UNSPECIFIED_ERROR;
+ }
} else {
fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
--
2.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621
2016-04-18 11:20 [PATCH phosphor-host-ipmid v2 0/2] Adding Boot Policy OpenBMC Patches
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 1/2] " OpenBMC Patches
@ 2016-04-18 11:20 ` OpenBMC Patches
2016-04-19 4:45 ` Samuel Mendoza-Jonas
1 sibling, 1 reply; 5+ messages in thread
From: OpenBMC Patches @ 2016-04-18 11:20 UTC (permalink / raw)
To: openbmc; +Cc: ratagupt
From: ratagupt <ratagupt@in.ibm.com>
---
chassishandler.C | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/chassishandler.C b/chassishandler.C
index 1a5508f..5144e15 100644
--- a/chassishandler.C
+++ b/chassishandler.C
@@ -92,7 +92,7 @@ finish:
return r;
}
-int dbus_get_property(const char *name,char **buf)
+int dbus_get_property(const char *name, char **buf)
{
sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *m = NULL;
@@ -161,7 +161,7 @@ finish:
return r;
}
-int dbus_set_property(const char * name,const char *value)
+int dbus_set_property(const char * name, const char *value)
{
sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *m = NULL;
@@ -198,7 +198,7 @@ int dbus_set_property(const char * name,const char *value)
host_intf_name, /* first argument */
name, /* second argument */
"s", /* third argument */
- value); /* fourth argument */
+ value); /* fourth argument */
if (r < 0) {
fprintf(stderr, "Failed to issue method call: %s\n", error.message);
@@ -374,8 +374,9 @@ char* get_boot_option_by_ipmi(uint8_t p) {
}
#define SET_PARM_VERSION 1
-#define SET_PARM_BOOT_FLAGS_VALID_ONE_TIME 0x80
-#define SET_PARM_BOOT_FLAGS_VALID_PERMANENT 0xC0
+#define SET_PARM_BOOT_FLAGS_VALID_ONE_TIME 0x80 //boot flags data1 8th bit on
+#define SET_PARM_BOOT_FLAGS_VALID_PERMANENT 0xC0 //boot flags data1 7&8 bit on
+#define SET_PARM_BOOT_FLAGS_ONETIME 0x40 //boot flags data1 7th bit on
ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
@@ -433,7 +434,9 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
} else {
printf("BootPolicy is[%s]", p);
- resp->data[0] = (strcmp(p,"ONETIME")==0)?SET_PARM_BOOT_FLAGS_VALID_ONE_TIME:SET_PARM_BOOT_FLAGS_VALID_PERMANENT;
+ resp->data[0] = (strncmp(p,"ONETIME",strlen("ONETIME"))==0) ?
+ SET_PARM_BOOT_FLAGS_VALID_ONE_TIME:
+ SET_PARM_BOOT_FLAGS_VALID_PERMANENT;
rc = IPMI_CC_OK;
}
@@ -489,7 +492,9 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
}
/* setting the boot policy */
- s= (char *)(((reqptr->data[0] & 0x40) == 0x40) ?"PERMANENT":"ONETIME");
+ s = (char *)(((reqptr->data[0] & SET_PARM_BOOT_FLAGS_ONETIME) ==
+ SET_PARM_BOOT_FLAGS_ONETIME) ?"PERMANENT":"ONETIME");
+
printf ( "\nBoot Policy is %s",s);
int r = dbus_set_property("boot_policy",s);
--
2.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621 OpenBMC Patches
@ 2016-04-19 4:45 ` Samuel Mendoza-Jonas
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Mendoza-Jonas @ 2016-04-19 4:45 UTC (permalink / raw)
To: OpenBMC Patches; +Cc: openbmc, ratagupt
Hi Ratan,
When addressing comments it's best to squash your changes into the
original patch; please resend this as one patch.
Thanks!
Sam
On Mon, Apr 18, 2016 at 06:20:39AM -0500, OpenBMC Patches wrote:
> From: ratagupt <ratagupt@in.ibm.com>
>
> ---
> chassishandler.C | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/chassishandler.C b/chassishandler.C
> index 1a5508f..5144e15 100644
> --- a/chassishandler.C
> +++ b/chassishandler.C
> @@ -92,7 +92,7 @@ finish:
> return r;
> }
>
> -int dbus_get_property(const char *name,char **buf)
> +int dbus_get_property(const char *name, char **buf)
> {
> sd_bus_error error = SD_BUS_ERROR_NULL;
> sd_bus_message *m = NULL;
> @@ -161,7 +161,7 @@ finish:
> return r;
> }
>
> -int dbus_set_property(const char * name,const char *value)
> +int dbus_set_property(const char * name, const char *value)
> {
> sd_bus_error error = SD_BUS_ERROR_NULL;
> sd_bus_message *m = NULL;
> @@ -198,7 +198,7 @@ int dbus_set_property(const char * name,const char *value)
> host_intf_name, /* first argument */
> name, /* second argument */
> "s", /* third argument */
> - value); /* fourth argument */
> + value); /* fourth argument */
>
> if (r < 0) {
> fprintf(stderr, "Failed to issue method call: %s\n", error.message);
> @@ -374,8 +374,9 @@ char* get_boot_option_by_ipmi(uint8_t p) {
> }
>
> #define SET_PARM_VERSION 1
> -#define SET_PARM_BOOT_FLAGS_VALID_ONE_TIME 0x80
> -#define SET_PARM_BOOT_FLAGS_VALID_PERMANENT 0xC0
> +#define SET_PARM_BOOT_FLAGS_VALID_ONE_TIME 0x80 //boot flags data1 8th bit on
> +#define SET_PARM_BOOT_FLAGS_VALID_PERMANENT 0xC0 //boot flags data1 7&8 bit on
> +#define SET_PARM_BOOT_FLAGS_ONETIME 0x40 //boot flags data1 7th bit on
>
> ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
> ipmi_request_t request, ipmi_response_t response,
> @@ -433,7 +434,9 @@ ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
> } else {
>
> printf("BootPolicy is[%s]", p);
> - resp->data[0] = (strcmp(p,"ONETIME")==0)?SET_PARM_BOOT_FLAGS_VALID_ONE_TIME:SET_PARM_BOOT_FLAGS_VALID_PERMANENT;
> + resp->data[0] = (strncmp(p,"ONETIME",strlen("ONETIME"))==0) ?
> + SET_PARM_BOOT_FLAGS_VALID_ONE_TIME:
> + SET_PARM_BOOT_FLAGS_VALID_PERMANENT;
> rc = IPMI_CC_OK;
>
> }
> @@ -489,7 +492,9 @@ ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
> }
>
> /* setting the boot policy */
> - s= (char *)(((reqptr->data[0] & 0x40) == 0x40) ?"PERMANENT":"ONETIME");
> + s = (char *)(((reqptr->data[0] & SET_PARM_BOOT_FLAGS_ONETIME) ==
> + SET_PARM_BOOT_FLAGS_ONETIME) ?"PERMANENT":"ONETIME");
> +
> printf ( "\nBoot Policy is %s",s);
> int r = dbus_set_property("boot_policy",s);
>
> --
> 2.7.1
>
>
> _______________________________________________
> openbmc mailing list
> openbmc@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH phosphor-host-ipmid v2 1/2] Adding Boot Policy
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 1/2] " OpenBMC Patches
@ 2016-04-19 16:49 ` Stewart Smith
0 siblings, 0 replies; 5+ messages in thread
From: Stewart Smith @ 2016-04-19 16:49 UTC (permalink / raw)
To: OpenBMC Patches, openbmc; +Cc: ratagupt
OpenBMC Patches <openbmc-patches@stwcx.xyz> writes:
> From: ratagupt <ratagupt@in.ibm.com>
Also please use "First Last <foo@bar>" (i.e. full name) as user for
git. It helps tracking commits back to people.
--
Stewart Smith
OPAL Architect, IBM.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-19 16:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18 11:20 [PATCH phosphor-host-ipmid v2 0/2] Adding Boot Policy OpenBMC Patches
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 1/2] " OpenBMC Patches
2016-04-19 16:49 ` Stewart Smith
2016-04-18 11:20 ` [PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621 OpenBMC Patches
2016-04-19 4:45 ` Samuel Mendoza-Jonas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.