Hi, I'm planning to commit this patch unless someone objects. I'll add the necessary make file changes and a man page update.
Thank you very much, Carol On Mon, 2009-03-02 at 13:10 +0100, Tim Bell wrote: > The Peppercon BMCs as used in the Supermicro motherboards have an > extended version string for the firmware version. This patch provides a > peppercon OEM report which has the details of the fields of the > firmware. This is needed to be able to find the different versions of > code which all report the same version.release numbers to ipmitool mc info. > > For example, > > # ipmitool mc info > Device ID : 34 > Device Revision : 1 > Firmware Revision : 1.59 > > # ipmitool pepperconoem firmware show > Firmware Version : 1.59.12 > Firmware Build Number : 5420 > Firmware ID : 34 > Firmware Tag : Jan-05-2008-10-15-NoWeb-NoVM > > I have submitted a patch for src/ipmitool.c and two new files (so it is > consistent with other oem source) > > Index: src/ipmitool.c > =================================================================== > RCS file: /cvsroot/ipmitool/ipmitool/src/ipmitool.c,v > retrieving revision 1.69 > diff -u -p -r1.69 ipmitool.c > --- src/ipmitool.c 17 Sep 2008 19:58:57 -0000 1.69 > +++ src/ipmitool.c 2 Mar 2009 12:06:00 -0000 > @@ -56,6 +56,7 @@ > #include <ipmitool/ipmi_pef.h> > #include <ipmitool/ipmi_oem.h> > #include <ipmitool/ipmi_sunoem.h> > +#include <ipmitool/ipmi_pepperconoem.h> > #include <ipmitool/ipmi_fwum.h> > #include <ipmitool/ipmi_picmg.h> > #include <ipmitool/ipmi_kontronoem.h> > @@ -101,6 +102,7 @@ struct ipmi_cmd ipmitool_cmd_list[] = { > { ipmi_channel_main, "channel", "Configure Management Controller > channels" }, > { ipmi_session_main, "session", "Print session information" }, > { ipmi_sunoem_main, "sunoem", "OEM Commands for Sun servers" }, > + { ipmi_pepperconoem_main, "pepperconoem", "OEM Commands for > Peppercon AG BMCs" }, > { ipmi_kontronoem_main, "kontronoem", "OEM Commands for Kontron > devices"}, > { ipmi_picmg_main, "picmg", "Run a PICMG/ATCA extended cmd"}, > { ipmi_fwum_main, "fwum", "Update IPMC using Kontron OEM > Firmware Update Manager" }, > > Two new files are required (I do not know how to generate these from patch) > > $ cat include/ipmitool/ipmi_pepperconoem.h > #ifndef IPMI_PEPPERCONOEM_H > #define IPMI_PEPPERCONOEM_H > > #if HAVE_CONFIG_H > # include <config.h> > #endif > #include <ipmitool/ipmi.h> > #include <ipmitool/ipmi_sdr.h> > > #define IPMI_NETFN_PEPPERCONOEM 0x3c > > #define IPMI_PEPPERCONOEM_FIRMWARE_SHOW 0x20 > > int ipmi_pepperconoem_main(struct ipmi_intf *, int, char **); > > #endif /*IPMI_PEPPERCONOEM_H*/ > > and > > cat lib/ipmi_peppercon.c > #include <stdlib.h> > #include <stdio.h> > #include <string.h> > #include <sys/types.h> > #include <sys/socket.h> > #include <netinet/in.h> > #include <arpa/inet.h> > #include <errno.h> > #include <unistd.h> > #include <signal.h> > #include <ctype.h> > > #include <ipmitool/ipmi.h> > #include <ipmitool/ipmi_intf.h> > #include <ipmitool/helper.h> > #include <ipmitool/log.h> > #include <ipmitool/ipmi_sel.h> > #include <ipmitool/ipmi_sdr.h> > #include <ipmitool/ipmi_strings.h> > #include <ipmitool/ipmi_channel.h> > #include <ipmitool/ipmi_pepperconoem.h> > #include <ipmitool/ipmi_raw.h> > > static void > ipmi_pepperconoem_usage(void) > { > lprintf(LOG_NOTICE, "usage: pepperconoem <command> [option...]"); > lprintf(LOG_NOTICE, ""); > lprintf(LOG_NOTICE, " firmware show"); > lprintf(LOG_NOTICE, " Show extended version information for > firmware level"); > lprintf(LOG_NOTICE, ""); > } > > /* > * IPMI Request Data: > * > * None > * > * Returns > * > * (Byte 0-3) Firmware Version > * (Byte 4-7) Firmware Minor Version > * (Byte 8-11) Firmware Sub Version > * (Byte 12-15) Firmware Build Number > * (Byte 16) Hardware ID > * (Byte 17...) Tag (null terminated) > * > */ > > static uint32_t get_firmware_uint(unsigned char *data) { > uint32_t firmware_uint=0; > firmware_uint+=*data++; > firmware_uint+=(*data++)<<8; > firmware_uint+=(*data++)<<16; > firmware_uint+=(*data++)<<24; > return firmware_uint; > } > > static int > ipmi_pepperconoem_firmware_show(struct ipmi_intf * intf) > { > struct ipmi_rs * rsp; > struct ipmi_rq req; > int i; > > req.msg.netfn = IPMI_NETFN_PEPPERCONOEM; > req.msg.cmd = IPMI_PEPPERCONOEM_FIRMWARE_SHOW; > req.msg.data = NULL; > req.msg.data_len = 0; > > rsp = intf->sendrecv(intf, &req); > if (rsp == NULL) { > lprintf(LOG_ERR, "Peppercon OEM show firmware command > failed"); > return -1; > } > else if (rsp->ccode > 0) { > lprintf(LOG_ERR, "Peppercon OEM show firmware command > failed: %s", > val2str(rsp->ccode, completion_code_vals)); > return -1; > } > > if (verbose == LOG_DEBUG){ > /* print the raw response buffer */ > for (i=0; i<rsp->data_len; i++) { > if (((i%16) == 0) && (i != 0)) > printf("\n"); > printf(" %2.2x", rsp->data[i]); > } > printf("\n"); > } > > uint32_t firmware_major_version=get_firmware_uint(&rsp->data[0]); > uint32_t firmware_minor_version=get_firmware_uint(&rsp->data[4]); > uint32_t firmware_sub_version =get_firmware_uint(&rsp->data[8]); > uint32_t firmware_build_number =get_firmware_uint(&rsp->data[12]); > uint8_t firmware_id=rsp->data[16]; > char firmware_tag[129]; > char *rsp_data_tag=&rsp->data[17]; > > /* 0x0 terminated string with the tag */ > for (i=0;rsp_data_tag[i]!=0x0 && i<sizeof(firmware_tag)-1;++i) { > firmware_tag[i]=rsp_data_tag[i]; > } > firmware_tag[i]=0; > > printf("Firmware Version : %i.%i.%i\n", > > firmware_major_version,firmware_minor_version,firmware_sub_version); > printf("Firmware Build Number : %i\n", > firmware_build_number); > printf("Firmware ID : %i\n", > firmware_id); > printf("Firmware Tag : %s\n", > firmware_tag); > > return 0; > } > > int > ipmi_pepperconoem_main(struct ipmi_intf * intf, int argc, char ** argv) > { > int rc = 0; > > if (argc == 0 || strncmp(argv[0], "help", 4) == 0) { > ipmi_pepperconoem_usage(); > return 0; > } > > if (strncmp(argv[0], "firmware", 8) == 0) { > if (argc < 2) { > ipmi_pepperconoem_usage(); > return -1; > } > else if (strncmp(argv[1], "show", 4) == 0) { > rc = ipmi_pepperconoem_firmware_show(intf); > } > else { > ipmi_pepperconoem_usage(); > return -1; > } > } > return rc; > } > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Ipmitool-devel mailing list > Ipmitool-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ipmitool-devel ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel