lkml.org 
[lkml]   [2012]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC

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

\
 
 \ /
  Last update: 2012-06-28 19:41    [from the cache]
©2003-2011 Jasper Spaans