From 3a852a884922494cc8daf56dbd6056bfd34f10c8 Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Tue, 17 Dec 2013 04:53:20 +0000 Subject: [PATCH] ID: 85 - Supermicro memory ECC error display Commit adds ipmi_get_oem_id() function. --- ipmitool/include/ipmitool/helper.h | 1 + ipmitool/lib/helper.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ipmitool/include/ipmitool/helper.h b/ipmitool/include/ipmitool/helper.h index 4b80058..b6ee7fa 100644 --- a/ipmitool/include/ipmitool/helper.h +++ b/ipmitool/include/ipmitool/helper.h @@ -99,6 +99,7 @@ void printbuf(const uint8_t * buf, int len, const char * desc); uint8_t ipmi_csum(uint8_t * d, int s); FILE * ipmi_open_file(const char * file, int rw); void ipmi_start_daemon(struct ipmi_intf *intf); +uint16_t ipmi_get_oem_id(struct ipmi_intf *intf); #define ipmi_open_file_read(file) ipmi_open_file(file, 0) #define ipmi_open_file_write(file) ipmi_open_file(file, 1) diff --git a/ipmitool/lib/helper.c b/ipmitool/lib/helper.c index f795a34..546c760 100644 --- a/ipmitool/lib/helper.c +++ b/ipmitool/lib/helper.c @@ -756,3 +756,32 @@ is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr) IPMI_UID_MIN, IPMI_UID_MAX); return (-1); } + +uint16_t +ipmi_get_oem_id(struct ipmi_intf *intf) +{ + /* Execute a Get Board ID command to determine the board */ + struct ipmi_rs *rsp; + struct ipmi_rq req; + uint16_t oem_id; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_TSOL; + req.msg.cmd = 0x21; + req.msg.data_len = 0; + + rsp = intf->sendrecv(intf, &req); + if (rsp == NULL) { + lprintf(LOG_ERR, "Get Board ID command failed"); + return 0; + } + if (rsp->ccode > 0) { + lprintf(LOG_ERR, "Get Board ID command failed: %#x %s", + rsp->ccode, val2str(rsp->ccode, completion_code_vals)); + return 0; + } + oem_id = rsp->data[0] | (rsp->data[1] << 8); + lprintf(LOG_DEBUG,"Board ID: %x", oem_id); + + return oem_id; +}