|
Packit Service |
ed0f68 |
/*
|
|
Packit Service |
ed0f68 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
ed0f68 |
* modification, are permitted provided that the following conditions
|
|
Packit Service |
ed0f68 |
* are met:
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Redistribution of source code must retain the above copyright
|
|
Packit Service |
ed0f68 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Redistribution in binary form must reproduce the above copyright
|
|
Packit Service |
ed0f68 |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit Service |
ed0f68 |
* documentation and/or other materials provided with the distribution.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* Neither the name of Sun Microsystems, Inc. or the names of
|
|
Packit Service |
ed0f68 |
* contributors may be used to endorse or promote products derived
|
|
Packit Service |
ed0f68 |
* from this software without specific prior written permission.
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* This software is provided "AS IS," without a warranty of any kind.
|
|
Packit Service |
ed0f68 |
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
|
Packit Service |
ed0f68 |
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
|
Packit Service |
ed0f68 |
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
|
|
Packit Service |
ed0f68 |
* SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
|
|
Packit Service |
ed0f68 |
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
|
|
Packit Service |
ed0f68 |
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
|
|
Packit Service |
ed0f68 |
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
|
|
Packit Service |
ed0f68 |
* OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
|
|
Packit Service |
ed0f68 |
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
|
|
Packit Service |
ed0f68 |
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
|
|
Packit Service |
ed0f68 |
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
Packit Service |
ed0f68 |
*/
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#include <string.h>
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
#include <ipmitool/ipmi.h>
|
|
Packit Service |
ed0f68 |
#include <ipmitool/ipmi_intf.h>
|
|
Packit Service |
ed0f68 |
#include <ipmitool/ipmi_constants.h>
|
|
Packit Service |
ed0f68 |
#include <ipmitool/log.h>
|
|
Packit Service |
ed0f68 |
#include <ipmitool/helper.h>
|
|
Packit Service |
ed0f68 |
#include <ipmitool/ipmi_sel.h>
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
static int ipmi_oem_supermicro(struct ipmi_intf * intf);
|
|
Packit Service |
ed0f68 |
static int ipmi_oem_ibm(struct ipmi_intf * intf);
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
static struct ipmi_oem_handle ipmi_oem_list[] = {
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "supermicro",
|
|
Packit Service |
ed0f68 |
.desc = "Supermicro IPMIv1.5 BMC with OEM LAN authentication support",
|
|
Packit Service |
ed0f68 |
.setup = ipmi_oem_supermicro,
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "intelwv2",
|
|
Packit Service |
ed0f68 |
.desc = "Intel SE7501WV2 IPMIv1.5 BMC with extra LAN communication support",
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "intelplus",
|
|
Packit Service |
ed0f68 |
.desc = "Intel IPMI 2.0 BMC with RMCP+ communication support",
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "icts",
|
|
Packit Service |
ed0f68 |
.desc = "IPMI 2.0 ICTS compliance support",
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "ibm",
|
|
Packit Service |
ed0f68 |
.desc = "IBM OEM support",
|
|
Packit Service |
ed0f68 |
.setup = ipmi_oem_ibm,
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "i82571spt",
|
|
Packit Service |
ed0f68 |
.desc = "Intel 82571 MAC with integrated RMCP+ support in super pass-through mode",
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
.name = "kontron",
|
|
Packit Service |
ed0f68 |
.desc = "Kontron OEM big buffer support"
|
|
Packit Service |
ed0f68 |
},
|
|
Packit Service |
ed0f68 |
{ 0 }
|
|
Packit Service |
ed0f68 |
};
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
/* Supermicro IPMIv2 BMCs use OEM authtype */
|
|
Packit Service |
ed0f68 |
static int
|
|
Packit Service |
ed0f68 |
ipmi_oem_supermicro(struct ipmi_intf * intf)
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
ipmi_intf_session_set_authtype(intf, IPMI_SESSION_AUTHTYPE_OEM);
|
|
Packit Service |
ed0f68 |
return 0;
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
static int
|
|
Packit Service |
ed0f68 |
ipmi_oem_ibm(struct ipmi_intf * intf)
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
char * filename;
|
|
Packit Service |
ed0f68 |
if ((filename = getenv("IPMI_OEM_IBM_DATAFILE")) == NULL) {
|
|
Packit Service |
ed0f68 |
lprintf(LOG_ERR, "Unable to read IPMI_OEM_IBM_DATAFILE from environment");
|
|
Packit Service |
ed0f68 |
return -1;
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
return ipmi_sel_oem_init((const char *)filename);
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
/* ipmi_oem_print - print list of OEM handles
|
|
Packit Service |
ed0f68 |
*/
|
|
Packit Service |
ed0f68 |
void
|
|
Packit Service |
ed0f68 |
ipmi_oem_print(void)
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
struct ipmi_oem_handle * oem;
|
|
Packit Service |
ed0f68 |
lprintf(LOG_NOTICE, "\nOEM Support:");
|
|
Packit Service |
ed0f68 |
for (oem=ipmi_oem_list; oem->name != NULL && oem->desc != NULL; oem++) {
|
|
Packit Service |
ed0f68 |
lprintf(LOG_NOTICE, "\t%-12s %s", oem->name, oem->desc);
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
lprintf(LOG_NOTICE, "");
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
/* ipmi_oem_setup - do initial setup of OEM handle
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* @intf: ipmi interface
|
|
Packit Service |
ed0f68 |
* @oemtype: OEM handle name
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* returns 0 on success
|
|
Packit Service |
ed0f68 |
* returns -1 on error
|
|
Packit Service |
ed0f68 |
*/
|
|
Packit Service |
ed0f68 |
int
|
|
Packit Service |
ed0f68 |
ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
struct ipmi_oem_handle * oem;
|
|
Packit Service |
ed0f68 |
int rc = 0;
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
if (oemtype == NULL ||
|
|
Packit Service |
ed0f68 |
strncmp(oemtype, "help", 4) == 0 ||
|
|
Packit Service |
ed0f68 |
strncmp(oemtype, "list", 4) == 0) {
|
|
Packit Service |
ed0f68 |
ipmi_oem_print();
|
|
Packit Service |
ed0f68 |
return -1;
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
for (oem=ipmi_oem_list; oem->name != NULL; oem++) {
|
|
Packit Service |
ed0f68 |
if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
|
|
Packit Service |
ed0f68 |
break;
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
if (oem->name == NULL)
|
|
Packit Service |
ed0f68 |
return -1;
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
/* save pointer for later use */
|
|
Packit Service |
ed0f68 |
intf->oem = oem;
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
/* run optional setup function if it is defined */
|
|
Packit Service |
ed0f68 |
if (oem->setup != NULL) {
|
|
Packit Service |
ed0f68 |
lprintf(LOG_DEBUG, "Running OEM setup for \"%s\"", oem->desc);
|
|
Packit Service |
ed0f68 |
rc = oem->setup(intf);
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
return rc;
|
|
Packit Service |
ed0f68 |
}
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
/* ipmi_oem_active - used to determine if a particular OEM type is set
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* @intf: ipmi interface
|
|
Packit Service |
ed0f68 |
* @oemtype: string containing name of ipmi handle to check
|
|
Packit Service |
ed0f68 |
*
|
|
Packit Service |
ed0f68 |
* returns 1 if requested ipmi handle is active
|
|
Packit Service |
ed0f68 |
* returns 0 otherwise
|
|
Packit Service |
ed0f68 |
*/
|
|
Packit Service |
ed0f68 |
int
|
|
Packit Service |
ed0f68 |
ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
|
|
Packit Service |
ed0f68 |
{
|
|
Packit Service |
ed0f68 |
if (intf->oem == NULL)
|
|
Packit Service |
ed0f68 |
return 0;
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
if (strncmp(intf->oem->name, oemtype, strlen(oemtype)) == 0)
|
|
Packit Service |
ed0f68 |
return 1;
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
return 0;
|
|
Packit Service |
ed0f68 |
}
|