linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Srinivas_G_Gowda@Dell.com>
To: <tcminyard@gmail.com>, <linux-kernel@vger.kernel.org>,
	<openipmi@mvista.com>
Subject: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
Date: Thu, 28 Jun 2012 09:45:28 -0700	[thread overview]
Message-ID: <4FEC8A28.4070806@dell.com> (raw)
In-Reply-To: <4FEC8931.5020001@dell.com>


functions that will send the Set System Info command
and its corresponding handler

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

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index d0abb3a..b1a98b5 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2709,6 +2709,79 @@ get_guid(ipmi_smi_t intf)
 	intf->null_user_handler = NULL;
 }
 
+static int 
+send_set_os_name_cmd(ipmi_smi_t intf)
+{
+	unsigned char param_select;
+	unsigned char set_selector;
+	unsigned char string_encode;
+	unsigned char str_len;
+	unsigned char data[9];
+
+	struct kernel_ipmi_msg            msg;
+	struct ipmi_system_interface_addr si;
+
+	si.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
+	si.channel = IPMI_BMC_CHANNEL;
+	si.lun = 0;
+	
+	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" */
+	
+	data[0] = param_select;
+	data[1] = set_selector;
+	data[2] = string_encode;
+	data[3] = str_len;
+	data[4] = 'L';
+	data[5] = 'i';
+	data[6] = 'n';
+	data[7] = 'u';
+	data[8] = 'x';
+
+	msg.netfn = IPMI_NETFN_APP_REQUEST;
+	msg.cmd = IPMI_SET_SYSTEM_INFO;
+	msg.data = data;
+	msg.data_len = 9;
+	return i_ipmi_request(NULL,
+			      intf,
+			      (struct ipmi_addr *) &si,
+			      0,
+			      &msg,
+			      intf,
+			      NULL,
+			      NULL,
+			      0,
+			      intf->channels[0].address,
+			      intf->channels[0].lun,
+			      -1, 0);
+}
+
+/*
+ * msg handler for Set_System_Info cmd - set OS name 
+ */
+static void
+set_os_name_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
+{
+	if ((msg->addr.addr_type != IPMI_SYSTEM_INTERFACE_ADDR_TYPE)
+	    || (msg->msg.netfn != IPMI_NETFN_APP_RESPONSE)
+	    || (msg->msg.cmd != IPMI_SET_SYSTEM_INFO))
+		/* Not for me */
+		return;
+
+	if (msg->msg.data[0] != 0) 
+		/* Error  setting OS name as Linux in BMC. */
+		printk(KERN_WARNING PFX 
+			"Failed to set OS name as Linux: 0x%X\n", msg->msg.data[0]);
+	else
+		printk(KERN_INFO PFX 
+			"OS Name successfully set as Linux\n");		
+
+	os_name_set = 1;
+	wake_up(&intf->waitq);
+}
+
 /*
  *   Set the Operating System Name as "Linux" in BMC 
  *   using "Set System Info" command.
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-28 16:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4FEC8931.5020001@dell.com>
2012-06-28 16:45 ` Srinivas_G_Gowda [this message]
2012-06-29  0:01   ` [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC Andi Kleen
2012-06-29  3:06     ` Corey Minyard
2012-06-29 12:30     ` Matthew Garrett
2012-06-29 14:27       ` Corey Minyard
2012-07-04  5:11         ` Srinivas_G_Gowda
2012-07-04 12:17           ` Andi Kleen
2012-07-04 17:41             ` 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=4FEC8A28.4070806@dell.com \
    --to=srinivas_g_gowda@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi@mvista.com \
    --cc=tcminyard@gmail.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).