linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Srinivas_G_Gowda@Dell.com>
To: <linux-kernel@vger.kernel.org>, <minyard@acm.org>, <openipmi@mvista.com>
Subject: [PATCH] ipmi: setting OS name as Linux in BMC
Date: Tue, 26 Jun 2012 18:54:55 +0530	[thread overview]
Message-ID: <4FE9B827.80300@dell.com> (raw)
In-Reply-To: <4FE9A3EB.50505@dell.com>

There is an option in IPMI Spec using which BMC can be made aware
of the OS name that it is talking to.
IPMI_Spec-IPMI2_0E4_061209  -  ref - 22.14a ,  [Set System Info]

This patch will update the OS name as "Linux" in BMC during
IPMI Driver initialization. In the current patch, declaration of
the OS name is done only for the Volatile param.

Signed-off-by: Srinivas Gowda G <Srinivas_G_Gowda@dell.com>
---
 drivers/char/ipmi/ipmi_si_intf.c |   72 ++++++++++++++++++++++++++++++++++++++
 include/linux/ipmi_msgdefs.h     |    1 +
 2 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 1e638ff..df995b4 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2709,6 +2709,71 @@ static int try_get_dev_id(struct smi_info *smi_info)
 	return rv;
 }
 
+/*
+ * Set the Operating System Name as "Linux" using "Set System Info" command.
+ * Only setting Volatile variable - Parameter 4 
+ */
+static int try_set_system_info_os_name(struct smi_info *smi_info)
+{
+	unsigned char         msg[11];
+	unsigned char         *resp;
+	unsigned char         param_select;
+	unsigned char	      set_selector;		
+	unsigned char         string_encode;
+	unsigned char         str_len;
+	unsigned long         resp_len;
+	int                   rv = 0;
+
+	resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
+	if (!resp)
+		return -ENOMEM;
+
+	param_select = 4;	/* parameter number for volatile OS name */
+	set_selector = 0;	/* set selector, block 0 */
+	string_encode = 0;	/* ASCII Encoding */
+	str_len = 5;		/* length of ASCII string - "Linux" */
+
+	msg[0] = IPMI_NETFN_APP_REQUEST << 2;
+	msg[1] = IPMI_SET_SYSTEM_INFO;
+	msg[2] = param_select;
+	msg[3] = set_selector;
+	msg[4] = string_encode;	
+	msg[5] = str_len;
+	msg[6] =  'L';	
+	msg[7] =  'i';	
+	msg[8] =  'n';	
+	msg[9] =  'u';	
+	msg[10] = 'x';	
+
+	smi_info->handlers->start_transaction(smi_info->si_sm, msg, 11);
+
+	rv = wait_for_msg_done(smi_info);
+	if (rv)
+		goto out;
+
+	resp_len = smi_info->handlers->get_result(smi_info->si_sm,
+						  resp, IPMI_MAX_MSG_LENGTH);
+
+	if (resp_len < 3 ||
+			resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
+			resp[1] != IPMI_SET_SYSTEM_INFO   ||
+			resp[2] != 0) {
+		if (resp_len == 3 )
+			 rv = resp[2]; 
+		printk(KERN_WARNING PFX "Failed to set OS name as Linux: 0x%X\n", rv);
+
+		rv = -EINVAL;
+		goto out;
+	}
+	else
+		/* Volatile Opertaing System name */
+		printk(KERN_INFO PFX "OS Name successfully set as Linux\n");
+
+ out:
+	kfree(resp);
+	return rv;
+}
+
 static int try_enable_event_buffer(struct smi_info *smi_info)
 {
 	unsigned char         msg[3];
@@ -3216,6 +3281,13 @@ static int try_smi_init(struct smi_info *new_smi)
 	new_smi->intf_num = smi_num;
 	smi_num++;
 
+	/*
+ 	 * Set the OS in BMC as "Linux" using "Set System Info" Command 
+ 	 */
+	rv = try_set_system_info_os_name(new_smi);
+	if(rv) 
+		printk(KERN_WARNING PFX "Could not set OS Name in BMC\n");
+		
 	rv = try_enable_event_buffer(new_smi);
 	if (rv == 0)
 		new_smi->has_event_buffer = 1;
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index df97e6e..b5ea664 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -57,6 +57,7 @@
 #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD	0x2f
 #define IPMI_READ_EVENT_MSG_BUFFER_CMD	0x35
 #define IPMI_GET_CHANNEL_INFO_CMD	0x42
+#define IPMI_SET_SYSTEM_INFO		0x58
 
 /* Bit for BMC global enables. */
 #define IPMI_BMC_RCV_MSG_INTR     0x01
-- 
1.7.1


Thanks,
G

       reply	other threads:[~2012-06-26 13:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4FE9A3EB.50505@dell.com>
2012-06-26 13:24 ` Srinivas_G_Gowda [this message]
2012-06-26 13:39   ` [PATCH] ipmi: setting OS name as Linux in BMC Corey Minyard
2012-06-26 16:02     ` Srinivas_G_Gowda
2012-06-26 16:59       ` Corey Minyard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE9B827.80300@dell.com \
    --to=srinivas_g_gowda@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=openipmi@mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).