Hi,

I have attached three patches to Merge. Let me know if you have comments on 
them.

There are so many warnings caused by additions to CFLAGS, how should I 
contribute to fix them?
Is this the forum to discuss those ?


regards
Partha
From e4b5119f49e8573fb4c855877bb7ca6e93dd6973 Mon Sep 17 00:00:00 2001
From: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvara...@ericsson.com>
Date: Mon, 16 Feb 2015 14:57:36 +0100
Subject: [PATCH 1/3] add anonymous union support in CFLAGS for older gcc

Change-Id: Id80617ad9336c7a02fbe613b58e3f337fa4baeee
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvara...@ericsson.com>
---
 configure.ac | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/configure.ac b/configure.ac
index d7c5620..baaf032 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,6 +130,26 @@ if test "x$xenable_all_options" = "xyes" || test "x$xenable_solaris_opt" = "xyes
 	AC_DEFINE(ENABLE_ALL_OPTIONS, [1], [Define to 1 to enable all command line options.])
 fi
 
+dnl Determine anonymous union/structure support in GCC
+AC_TRY_COMPILE([], [
+	#include <stdio.h>
+	struct test {
+		union {
+			int a;
+			unsigned int b;
+		};
+	} test;
+
+	int main()
+	{
+	printf("a is %d", test.a);
+	}
+        ], ac_fms_extension=no, ac_fms_extension=yes)
+if test "x$ac_fms_extension" = "xyes"; then
+       CFLAGS="$CFLAGS -fms-extensions"
+       AC_SUBST(CFLAGS)
+fi
+
 dnl check for OpenSSL functionality
 AC_ARG_ENABLE([internal-md5],
 	[AC_HELP_STRING([--enable-internal-md5],
-- 
1.9.0

From 4c7fc6bf37d5c922ecc2666ec5f23ff0380c43ba Mon Sep 17 00:00:00 2001
From: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvara...@ericsson.com>
Date: Mon, 16 Feb 2015 10:12:46 +0100
Subject: [PATCH 2/3] add ericsson oem

Change-Id: I4fa230b2388e83ae0bc560539675d4dd8783a33e
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvara...@ericsson.com>
---
 include/ipmitool/ipmi.h | 1 +
 lib/ipmi_strings.c      | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/include/ipmitool/ipmi.h b/include/ipmitool/ipmi.h
index 4d17698..5800e1b 100644
--- a/include/ipmitool/ipmi.h
+++ b/include/ipmitool/ipmi.h
@@ -260,6 +260,7 @@ typedef enum IPMI_OEM {
      IPMI_OEM_HITACHI_116 = 116,
      IPMI_OEM_NEC        = 119,
      IPMI_OEM_TOSHIBA    = 186,
+     IPMI_OEM_ERICSSON   = 193,
      IPMI_OEM_INTEL      = 343,
      IPMI_OEM_TATUNG     = 373,
      IPMI_OEM_HITACHI_399 = 399,
diff --git a/lib/ipmi_strings.c b/lib/ipmi_strings.c
index aecb3e2..9472541 100644
--- a/lib/ipmi_strings.c
+++ b/lib/ipmi_strings.c
@@ -68,6 +68,7 @@ const struct valstr ipmi_oem_info[] = {
    { IPMI_OEM_BULL,                   "Bull Company" },
    { IPMI_OEM_PPS,                    "Pigeon Point Systems" },
    { IPMI_OEM_BROADCOM,               "Broadcom Corporation" },
+   { IPMI_OEM_ERICSSON,               "Ericsson AB"},
    { IPMI_OEM_QUANTA,                 "Quanta" },
    { 0xffff , NULL },
 };
@@ -116,6 +117,8 @@ const struct oemvalstr ipmi_oem_product_info[] = {
    { IPMI_OEM_KONTRON,5303, "AT8901" },
    /* Broadcom */
    { IPMI_OEM_BROADCOM, 5725, "BCM5725" },
+   /* Ericsson */
+   { IPMI_OEM_ERICSSON, 0x0054, "Phantom" },
 
    { 0xffffff        , 0xffff , NULL },
  };
-- 
1.9.0

From e2376b17f3f6f32441f64d931753909d98da0801 Mon Sep 17 00:00:00 2001
From: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvara...@ericsson.com>
Date: Mon, 16 Feb 2015 11:39:33 +0100
Subject: [PATCH 3/3] auto detect oem/vendor and setup

Set the oem attributes on the interface based on vendor information
during device detection. This feels cleaner than using command-line
option like oem etc..

Change-Id: I5e65d11bc35583c5583a3b67cfa7fe6bd198e8ef
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.xx.bhuvara...@ericsson.com>
---
 configure.ac                | 13 +++++--------
 include/ipmitool/ipmi_oem.h |  1 +
 lib/ipmi_main.c             |  4 ++++
 lib/ipmi_oem.c              | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index baaf032..e132650 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,8 +131,9 @@ if test "x$xenable_all_options" = "xyes" || test "x$xenable_solaris_opt" = "xyes
 fi
 
 dnl Determine anonymous union/structure support in GCC
-AC_TRY_COMPILE([], [
-	#include <stdio.h>
+AC_TRY_COMPILE([
+#include <stdio.h>
+	], [
 	struct test {
 		union {
 			int a;
@@ -140,14 +141,10 @@ AC_TRY_COMPILE([], [
 		};
 	} test;
 
-	int main()
-	{
 	printf("a is %d", test.a);
-	}
-        ], ac_fms_extension=no, ac_fms_extension=yes)
-if test "x$ac_fms_extension" = "xyes"; then
+        ], [ac_need_fms_extension=no], [ac_need_fms_extension=yes])
+if test "x$ac_need_fms_extension" = "xyes"; then
        CFLAGS="$CFLAGS -fms-extensions"
-       AC_SUBST(CFLAGS)
 fi
 
 dnl check for OpenSSL functionality
diff --git a/include/ipmitool/ipmi_oem.h b/include/ipmitool/ipmi_oem.h
index ad22fde..842b47e 100644
--- a/include/ipmitool/ipmi_oem.h
+++ b/include/ipmitool/ipmi_oem.h
@@ -43,5 +43,6 @@ struct ipmi_oem_handle {
 void ipmi_oem_print(void);
 int ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype);
 int ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype);
+char * ipmi_oem_detect_manufacturer(struct ipmi_intf * intf);
 
 #endif /*IPMI_OEM_H*/
diff --git a/lib/ipmi_main.c b/lib/ipmi_main.c
index 0f01001..fa02046 100644
--- a/lib/ipmi_main.c
+++ b/lib/ipmi_main.c
@@ -871,6 +871,10 @@ ipmi_main(int argc, char ** argv,
 	/* setup log */
 	log_init(progname, 0, verbose);
 
+	/* Detect OEM if not specified by user */
+	if (oemtype == NULL) {
+		oemtype = ipmi_oem_detect_manufacturer(ipmi_main_intf);
+	}
 	/* run OEM setup if found */
 	if (oemtype != NULL &&
 	    ipmi_oem_setup(ipmi_main_intf, oemtype) < 0) {
diff --git a/lib/ipmi_oem.c b/lib/ipmi_oem.c
index 96db2ea..2edc8d4 100644
--- a/lib/ipmi_oem.c
+++ b/lib/ipmi_oem.c
@@ -36,6 +36,8 @@
 #include <ipmitool/log.h>
 #include <ipmitool/helper.h>
 #include <ipmitool/ipmi_sel.h>
+#include <ipmitool/ipmi_mc.h>
+#include <ipmitool/ipmi_strings.h>
 
 static int ipmi_oem_supermicro(struct ipmi_intf * intf);
 static int ipmi_oem_ibm(struct ipmi_intf * intf);
@@ -71,6 +73,10 @@ static struct ipmi_oem_handle ipmi_oem_list[] = {
 		.name = "kontron",
 		.desc = "Kontron OEM big buffer support"
 	},
+	{
+		.name = "Ericsson AB",
+		.desc = "Ericsson OEM support",
+	},
 	{ 0 }
 };
 
@@ -106,6 +112,37 @@ ipmi_oem_print(void)
 	lprintf(LOG_NOTICE, "");
 }
 
+/* ipmi_oem_get_manufacturer - return the BMC provider if found */
+char *
+ipmi_oem_detect_manufacturer(struct ipmi_intf * intf)
+{
+	struct ipmi_oem_handle * oem;
+	struct ipm_devid_rsp *devid;
+	struct ipmi_rs *rsp;
+	struct ipmi_rq req;
+	const char *name;
+	char *vendor;
+	memset(&req, 0, sizeof(req));
+	req.msg.netfn = IPMI_NETFN_APP;
+	req.msg.cmd = BMC_GET_DEVICE_ID;
+	req.msg.data_len = 0;
+
+	rsp = intf->sendrecv(intf, &req);
+	if ((rsp == NULL) || (rsp->ccode > 0)) {
+		return NULL;
+	}
+
+	devid = (struct ipm_devid_rsp *) rsp->data;
+	name = val2str(buf2short(devid->manufacturer_id), ipmi_oem_info);
+	for (oem=ipmi_oem_list; oem->name != NULL; oem++) {
+		if (strncmp(name, oem->name, strlen(oem->name)) == 0) {
+			vendor = strdup(name);
+			return vendor;
+		}
+	}
+	return NULL;
+}
+
 /* ipmi_oem_setup  -  do initial setup of OEM handle
  *
  * @intf:	ipmi interface
-- 
1.9.0

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to