[PATCH phosphor-host-ipmid v2 2/2] Review Comment added for 146621

OpenBMC Patches openbmc-patches at stwcx.xyz
Mon Apr 18 21:20:39 AEST 2016


From: ratagupt <ratagupt at 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




More information about the openbmc mailing list