From 864ac5ad263c4d1e1043a6612c1b2294d713aa2f Mon Sep 17 00:00:00 2001 From: Francois Isabelle Date: Tue, 12 Jul 2005 14:49:12 +0000 Subject: [PATCH] Added conditionaly built GetDeviceLocator call when INCLUDE_PICMG_GET_DEVICE_LOCATOR is defined. It doesn't allow for bridged send messages to reach AMC yet. --- ipmitool/src/plugins/open/open.c | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ipmitool/src/plugins/open/open.c b/ipmitool/src/plugins/open/open.c index e7914e1..c2ac31f 100644 --- a/ipmitool/src/plugins/open/open.c +++ b/ipmitool/src/plugins/open/open.c @@ -68,6 +68,11 @@ static int ipmi_openipmi_open(struct ipmi_intf * intf) { int i = 0; +#ifdef INCLUDE_PICMG_GET_DEVICE_LOCATOR + struct ipmi_rq req; + struct ipmi_rs *rsp; + char msg_data; +#endif intf->fd = open(IPMI_OPENIPMI_DEV, O_RDWR); @@ -97,9 +102,36 @@ ipmi_openipmi_open(struct ipmi_intf * intf) lprintf(LOG_DEBUG, "Set IPMB address to 0x%x", intf->my_addr); } - intf->opened = 1; +#ifdef INCLUDE_PICMG_GET_DEVICE_LOCATOR + /* PICMG hack to set right IPMB address, + we might want to do GetPICMGProperties first. + + In any case, on a server board or a non-picmg IpmC blade , this code + will not have any adverse side effect + */ + if ( (intf->my_addr == IPMI_BMC_SLAVE_ADDR) ) { + lprintf(LOG_DEBUG, "Running PICMG GetDeviceLocator" ); + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_PICMG; + req.msg.cmd = 0x01; + msg_data = 0x00; + req.msg.data = &msg_data; + req.msg.data_len = 1; + msg_data = 0; + + rsp = intf->sendrecv(intf, &req); + if (rsp) { + if ( !rsp->ccode ) { + intf->my_addr = rsp->data[2]; + intf->target_addr = intf->my_addr; + lprintf(LOG_DEBUG, "Discovered IPMB address = 0x%x", intf->my_addr); + } + } + } +#endif + return intf->fd; }