summaryrefslogtreecommitdiff
path: root/lib/ipmi_picmg.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipmi_picmg.c')
-rw-r--r--lib/ipmi_picmg.c278
1 files changed, 188 insertions, 90 deletions
diff --git a/lib/ipmi_picmg.c b/lib/ipmi_picmg.c
index c7d9c8e..8becc78 100644
--- a/lib/ipmi_picmg.c
+++ b/lib/ipmi_picmg.c
@@ -37,11 +37,6 @@
#include <ipmitool/ipmi_strings.h>
#include <ipmitool/log.h>
-#define PICMG_EXTENSION_ATCA_MAJOR_VERSION 2
-#define PICMG_EXTENSION_AMC0_MAJOR_VERSION 4
-#define PICMG_EXTENSION_UTCA_MAJOR_VERSION 5
-
-
#define PICMG_EKEY_MODE_QUERY 0
#define PICMG_EKEY_MODE_PRINT_ALL 1
#define PICMG_EKEY_MODE_PRINT_ENABLED 2
@@ -67,7 +62,84 @@ typedef enum picmg_card_type {
PICMG_CARD_TYPE_RESERVED
} t_picmg_card_type ;
-/* This is the version of the PICMG Extenstion */
+static const char* amc_link_type_str[] = {
+ "RESERVED",
+ "RESERVED1",
+ "PCI EXPRESS",
+ "ADVANCED SWITCHING1",
+ "ADVANCED SWITCHING2",
+ "ETHERNET",
+ "RAPIDIO",
+ "STORAGE",
+};
+
+static const char* amc_link_type_ext_str[][16] = {
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */
+ {
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */
+ {
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */
+ {
+ "Gen 1 - NSSC",
+ "Gen 1 - SSC",
+ "Gen 2 - NSSC",
+ "Gen 2 - SSC",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */
+ {
+ "Gen 1 - NSSC",
+ "Gen 1 - SSC",
+ "Gen 2 - NSSC",
+ "Gen 2 - SSC",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */
+ {
+ "Gen 1 - NSSC",
+ "Gen 1 - SSC",
+ "Gen 2 - NSSC",
+ "Gen 2 - SSC",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
+ {
+ "1000BASE-BX (SerDES Gigabit)",
+ "10GBASE-BX410 Gigabit XAUI",
+ "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
+ {
+ "1.25 Gbaud transmission rate",
+ "2.5 Gbaud transmission rate",
+ "3.125 Gbaud transmission rate",
+ "", "", "", "", "",
+ "", "", "", "", "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
+ {
+ "Fibre Channel",
+ "Serial ATA",
+ "Serial Attached SCSI",
+ "", "", "", "", "",
+ "", "", "", "", "", "", "", ""
+ }
+};
+
+/* This is the version of the PICMG Extension */
static t_picmg_card_type PicmgCardType = PICMG_CARD_TYPE_RESERVED;
void
@@ -130,6 +202,28 @@ struct sAmcAddrMap {
{0x88, "reserved", 0},
};
+/* the LED color capabilities */
+static const char *led_color_str[] = {
+ "reserved",
+ "BLUE",
+ "RED",
+ "GREEN",
+ "AMBER",
+ "ORANGE",
+ "WHITE",
+ "reserved"
+};
+
+const char *
+picmg_led_color_str(int color)
+{
+ if (color < 0 || (size_t)color >= ARRAY_SIZE(led_color_str)) {
+ return "invalid";
+ }
+
+ return led_color_str[color];
+}
+
/* is_amc_channel - wrapper to convert user input into integer
* AMC Channel range seems to be <0..255>, bits [7:0]
*
@@ -151,7 +245,7 @@ is_amc_channel(const char *argv_ptr, uint8_t *amc_chan_ptr)
return (-1);
}
/* is_amc_dev - wrapper to convert user input into integer.
- * AMC Dev ID limits are uknown.
+ * AMC Dev ID limits are unknown.
*
* @argv_ptr: source string to convert from; usually argv
* @amc_dev_ptr: pointer where to store result
@@ -172,7 +266,7 @@ is_amc_dev(const char *argv_ptr, int32_t *amc_dev_ptr)
return (-1);
}
/* is_amc_intf - wrapper to convert user input into integer.
- * AMC Interface (ID) limits are uknown.
+ * AMC Interface (ID) limits are unknown.
*
* @argv_ptr: source string to convert from; usually argv
* @amc_intf_ptr: pointer where to store result
@@ -193,7 +287,7 @@ is_amc_intf(const char *argv_ptr, int32_t *amc_intf_ptr)
return (-1);
}
/* is_amc_port - wrapper to convert user input into integer.
- * AMC Port limits are uknown.
+ * AMC Port limits are unknown.
*
* @argv_ptr: source string to convert from; usually argv
* @amc_port_ptr: pointer where to store result
@@ -213,7 +307,7 @@ is_amc_port(const char *argv_ptr, int32_t *amc_port_ptr)
return (-1);
}
/* is_clk_acc - wrapper to convert user input into integer.
- * Clock Accuracy limits are uknown[1byte by spec].
+ * Clock Accuracy limits are unknown[1byte by spec].
*
* @argv_ptr: source string to convert from; usually argv
* @clk_acc_ptr: pointer where to store result
@@ -234,7 +328,7 @@ is_clk_acc(const char *argv_ptr, uint8_t *clk_acc_ptr)
return (-1);
}
/* is_clk_family - wrapper to convert user input into integer.
- * Clock Family limits are uknown[1byte by spec].
+ * Clock Family limits are unknown[1byte by spec].
*
* @argv_ptr: source string to convert from; usually argv
* @clk_family_ptr: pointer where to store result
@@ -255,7 +349,7 @@ is_clk_family(const char *argv_ptr, uint8_t *clk_family_ptr)
return (-1);
}
/* is_clk_freq - wrapper to convert user input into integer.
- * Clock Frequency limits are uknown, but specification says
+ * Clock Frequency limits are unknown, but specification says
* 3Bytes + 1B checksum
*
* @argv_ptr: source string to convert from; usually argv
@@ -277,7 +371,7 @@ is_clk_freq(const char *argv_ptr, uint32_t *clk_freq_ptr)
return (-1);
}
/* is_clk_id - wrapper to convert user input into integer.
- * Clock ID limits are uknown, however it's 1B by specification and I've
+ * Clock ID limits are unknown, however it's 1B by specification and I've
* found two ranges: <1..5> or <0..15>
*
* @argv_ptr: source string to convert from; usually argv
@@ -298,7 +392,7 @@ is_clk_id(const char *argv_ptr, uint8_t *clk_id_ptr)
return (-1);
}
/* is_clk_index - wrapper to convert user input into integer.
- * Clock Index limits are uknown[1B by spec]
+ * Clock Index limits are unknown[1B by spec]
*
* @argv_ptr: source string to convert from; usually argv
* @clk_index_ptr: pointer where to store result
@@ -318,7 +412,7 @@ is_clk_index(const char *argv_ptr, uint8_t *clk_index_ptr)
return (-1);
}
/* is_clk_resid - wrapper to convert user input into integer.
- * Clock Resource Index(?) limits are uknown, but maximum seems to be 15.
+ * Clock Resource Index(?) limits are unknown, but maximum seems to be 15.
*
* @argv_ptr: source string to convert from; usually argv
* @clk_resid_ptr: pointer where to store result
@@ -661,7 +755,7 @@ ipmi_picmg_properties(struct ipmi_intf * intf, int show )
#define PICMG_FRU_ACTIVATE (unsigned char) 0x01
int
-ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsigned char state)
+ipmi_picmg_fru_activation(struct ipmi_intf * intf, char ** argv, unsigned char state)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -695,7 +789,7 @@ ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsig
int
-ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -734,7 +828,7 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char **
}
int
-ipmi_picmg_fru_activation_policy_set(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_fru_activation_policy_set(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -1029,7 +1123,7 @@ ipmi_picmg_amc_portstate_get(struct ipmi_intf * intf, int32_t device,
/* Removed endianness check here, probably not required
- as we dont use bitfields */
+ as we don't use bitfields */
port = d->linkInfo[0] & 0x0F;
type = ((d->linkInfo[0] & 0xF0) >> 4 )|(d->linkInfo[1] & 0x0F );
ext = ((d->linkInfo[1] & 0xF0) >> 4 );
@@ -1158,7 +1252,7 @@ ipmi_picmg_amc_portstate_set(struct ipmi_intf * intf, uint8_t channel,
int
-ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_get_led_properties(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -1197,7 +1291,7 @@ ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv)
}
int
-ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, char ** argv)
{
int i;
struct ipmi_rs * rsp;
@@ -1234,20 +1328,20 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
printf("LED Color Capabilities: ");
for ( i=0 ; i<8 ; i++ ) {
if ( rsp->data[1] & (0x01 << i) ) {
- printf("%s, ", led_color_str[ i ]);
+ printf("%s, ", picmg_led_color_str(i));
}
}
printf("\n");
printf("Default LED Color in\n");
- printf(" LOCAL control: %s\n", led_color_str[ rsp->data[2] ] );
- printf(" OVERRIDE state: %s\n", led_color_str[ rsp->data[3] ] );
+ printf(" LOCAL control: %s\n", picmg_led_color_str(rsp->data[2]));
+ printf(" OVERRIDE state: %s\n", picmg_led_color_str(rsp->data[3]));
return 0;
}
int
-ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_get_led_state(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -1308,7 +1402,9 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
}
printf(" Local Control On-Duration: %x\n", rsp->data[3] );
- printf(" Local Control Color: %x [%s]\n", rsp->data[4], led_color_str[ rsp->data[4] ]);
+ printf(" Local Control Color: %x [%s]\n",
+ rsp->data[4],
+ picmg_led_color_str(rsp->data[4]));
/* override state or lamp test */
if (rsp->data[1] & 0x02) {
@@ -1322,7 +1418,9 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
}
printf(" Override On-Duration: %x\n", rsp->data[6] );
- printf(" Override Color: %x [%s]\n", rsp->data[7], led_color_str[ rsp->data[7] ]);
+ printf(" Override Color: %x [%s]\n",
+ rsp->data[7],
+ picmg_led_color_str(rsp->data[7]));
}
@@ -1334,7 +1432,7 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
}
int
-ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_set_led_state(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -1410,7 +1508,7 @@ ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
}
int
-ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_get_power_level(struct ipmi_intf * intf, char ** argv)
{
int i;
struct ipmi_rs * rsp;
@@ -1461,7 +1559,7 @@ ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
}
int
-ipmi_picmg_set_power_level(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_set_power_level(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -1565,7 +1663,7 @@ ipmi_picmg_bused_resource(struct ipmi_intf * intf, t_picmg_bused_resource_mode m
}
int
-ipmi_picmg_fru_control(struct ipmi_intf * intf, int argc, char ** argv)
+ipmi_picmg_fru_control(struct ipmi_intf * intf, char ** argv)
{
struct ipmi_rs * rsp;
struct ipmi_rq req;
@@ -1654,7 +1752,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, uint8_t clk_id, int8_t clk_res,
return -1;
}
- if (rsp->ccode == 0 ) {
+ if (!rsp->ccode) {
enabled = (rsp->data[1]&0x8)!=0;
direction = (rsp->data[1]&0x4)!=0;
@@ -1785,24 +1883,24 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
int rc = 0;
int showProperties = 0;
- if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
+ if (!argc || !strcmp(argv[0], "help")) {
ipmi_picmg_help();
return 0;
}
/* Get PICMG properties is called to obtain version information */
- if (argc !=0 && !strncmp(argv[0], "properties", 10)) {
+ if (!strcmp(argv[0], "properties")) {
showProperties =1;
}
rc = ipmi_picmg_properties(intf,showProperties);
/* address info command */
- if (!strncmp(argv[0], "addrinfo", 8)) {
+ if (!strcmp(argv[0], "addrinfo")) {
rc = ipmi_picmg_getaddr(intf, argc-1, &argv[1]);
}
- else if (!strncmp(argv[0], "busres", 6)) {
+ else if (!strcmp(argv[0], "busres")) {
if (argc > 1) {
- if (!strncmp(argv[1], "summary", 7)) {
+ if (!strcmp(argv[1], "summary")) {
ipmi_picmg_bused_resource(intf, PICMG_BUSED_RESOURCE_SUMMARY );
}
} else {
@@ -1810,9 +1908,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
/* fru control command */
- else if (!strncmp(argv[0], "frucontrol", 10)) {
+ else if (!strcmp(argv[0], "frucontrol")) {
if (argc > 2) {
- rc = ipmi_picmg_fru_control(intf, argc-1, &(argv[1]));
+ rc = ipmi_picmg_fru_control(intf, &(argv[1]));
}
else {
lprintf(LOG_NOTICE, "usage: frucontrol <FRU-ID> <OPTION>");
@@ -1830,9 +1928,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
/* fru activation command */
- else if (!strncmp(argv[0], "activate", 8)) {
+ else if (!strcmp(argv[0], "activate")) {
if (argc > 1) {
- rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_ACTIVATE);
+ rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_ACTIVATE);
}
else {
lprintf(LOG_ERR, "Specify the FRU to activate.");
@@ -1841,9 +1939,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
/* fru deactivation command */
- else if (!strncmp(argv[0], "deactivate", 10)) {
+ else if (!strcmp(argv[0], "deactivate")) {
if (argc > 1) {
- rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_DEACTIVATE);
+ rc = ipmi_picmg_fru_activation(intf, &(argv[1]), PICMG_FRU_DEACTIVATE);
}else {
lprintf(LOG_ERR, "Specify the FRU to deactivate.");
return -1;
@@ -1851,17 +1949,17 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
/* activation policy command */
- else if (!strncmp(argv[0], "policy", 6)) {
+ else if (!strcmp(argv[0], "policy")) {
if (argc > 1) {
- if (!strncmp(argv[1], "get", 3)) {
+ if (!strcmp(argv[1], "get")) {
if (argc > 2) {
- rc = ipmi_picmg_fru_activation_policy_get(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_fru_activation_policy_get(intf, &(argv[2]));
} else {
lprintf(LOG_NOTICE, "usage: get <fruid>");
}
- } else if (!strncmp(argv[1], "set", 3)) {
+ } else if (!strcmp(argv[1], "set")) {
if (argc > 4) {
- rc = ipmi_picmg_fru_activation_policy_set(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_fru_activation_policy_set(intf, &(argv[2]));
} else {
lprintf(LOG_NOTICE, "usage: set <fruid> <lockmask> <lock>");
lprintf(LOG_NOTICE,
@@ -1884,18 +1982,18 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
/* portstate command */
- else if (!strncmp(argv[0], "portstate", 9)) {
+ else if (!strcmp(argv[0], "portstate")) {
lprintf(LOG_DEBUG,"PICMG: portstate API");
if (argc > 1) {
- if (!strncmp(argv[1], "get", 3)) {
+ if (!strcmp(argv[1], "get")) {
int32_t iface;
uint8_t channel = 0;
lprintf(LOG_DEBUG,"PICMG: get");
- if(!strncmp(argv[1], "getall", 6)) {
+ if(!strcmp(argv[1], "getall")) {
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
if(!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC ) &&
@@ -1907,7 +2005,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
- else if(!strncmp(argv[1], "getgranted", 10)) {
+ else if(!strcmp(argv[1], "getgranted")) {
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
rc = ipmi_picmg_portstate_get(intf,iface,channel,
@@ -1915,7 +2013,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
- else if(!strncmp(argv[1], "getdenied", 9)){
+ else if(!strcmp(argv[1], "getdenied")){
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++) {
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++) {
rc = ipmi_picmg_portstate_get(intf,iface,channel,
@@ -1938,7 +2036,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
lprintf(LOG_NOTICE, "<intf> <chn>|getall|getgranted|getdenied");
}
}
- else if (!strncmp(argv[1], "set", 3)) {
+ else if (!strcmp(argv[1], "set")) {
if (argc == 9) {
int32_t interface = 0;
int32_t port = 0;
@@ -1981,18 +2079,18 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
/* amc portstate command */
- else if (!strncmp(argv[0], "amcportstate", 12)) {
+ else if (!strcmp(argv[0], "amcportstate")) {
lprintf(LOG_DEBUG,"PICMG: amcportstate API");
if (argc > 1) {
- if (!strncmp(argv[1], "get", 3)){
+ if (!strcmp(argv[1], "get")){
int32_t device;
uint8_t channel;
lprintf(LOG_DEBUG,"PICMG: get");
- if(!strncmp(argv[1], "getall", 6)){
+ if(!strcmp(argv[1], "getall")){
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
maxDevice = 0;
@@ -2004,7 +2102,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
- else if(!strncmp(argv[1], "getgranted", 10)){
+ else if(!strcmp(argv[1], "getgranted")){
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
maxDevice = 0;
@@ -2016,7 +2114,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
- else if(!strncmp(argv[1], "getdenied", 9)){
+ else if(!strcmp(argv[1], "getdenied")){
int maxDevice = PICMG_EKEY_AMC_MAX_DEVICE;
if( PicmgCardType != PICMG_CARD_TYPE_ATCA ){
maxDevice = 0;
@@ -2049,7 +2147,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
lprintf(LOG_NOTICE, "<chn> <device>|getall|getgranted|getdenied");
}
}
- else if (!strncmp(argv[1], "set", 3)) {
+ else if (!strcmp(argv[1], "set")) {
if (argc > 7) {
int32_t device = -1;
int32_t port = 0;
@@ -2096,35 +2194,35 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
/* ATCA led commands */
- else if (!strncmp(argv[0], "led", 3)) {
+ else if (!strcmp(argv[0], "led")) {
if (argc > 1) {
- if (!strncmp(argv[1], "prop", 4)) {
+ if (!strcmp(argv[1], "prop")) {
if (argc > 2) {
- rc = ipmi_picmg_get_led_properties(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_get_led_properties(intf, &(argv[2]));
}
else {
lprintf(LOG_NOTICE, "led prop <FRU-ID>");
}
}
- else if (!strncmp(argv[1], "cap", 3)) {
+ else if (!strcmp(argv[1], "cap")) {
if (argc > 3) {
- rc = ipmi_picmg_get_led_capabilities(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_get_led_capabilities(intf, &(argv[2]));
}
else {
lprintf(LOG_NOTICE, "led cap <FRU-ID> <LED-ID>");
}
}
- else if (!strncmp(argv[1], "get", 3)) {
+ else if (!strcmp(argv[1], "get")) {
if (argc > 3) {
- rc = ipmi_picmg_get_led_state(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_get_led_state(intf, &(argv[2]));
}
else {
lprintf(LOG_NOTICE, "led get <FRU-ID> <LED-ID>");
}
}
- else if (!strncmp(argv[1], "set", 3)) {
+ else if (!strcmp(argv[1], "set")) {
if (argc > 6) {
- rc = ipmi_picmg_set_led_state(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_set_led_state(intf, &(argv[2]));
}
else {
lprintf(LOG_NOTICE,
@@ -2164,11 +2262,11 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
/* power commands */
- else if (!strncmp(argv[0], "power", 5)) {
+ else if (!strcmp(argv[0], "power")) {
if (argc > 1) {
- if (!strncmp(argv[1], "get", 3)) {
+ if (!strcmp(argv[1], "get")) {
if (argc > 3) {
- rc = ipmi_picmg_get_power_level(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_get_power_level(intf, &(argv[2]));
}
else {
lprintf(LOG_NOTICE, "power get <FRU-ID> <type>");
@@ -2181,9 +2279,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
return -1;
}
}
- else if (!strncmp(argv[1], "set", 3)) {
+ else if (!strcmp(argv[1], "set")) {
if (argc > 4) {
- rc = ipmi_picmg_set_power_level(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_set_power_level(intf, &(argv[2]));
}
else {
lprintf(LOG_NOTICE, "power set <FRU-ID> <level> <present-desired>");
@@ -2208,9 +2306,9 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
return -1;
}
}/* clk commands*/
- else if (!strncmp(argv[0], "clk", 3)) {
+ else if (!strcmp(argv[0], "clk")) {
if (argc > 1) {
- if (!strncmp(argv[1], "get", 3)) {
+ if (!strcmp(argv[1], "get")) {
int8_t clk_res = -1;
uint8_t clk_id;
uint8_t max_res = 15;
@@ -2219,7 +2317,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
max_res = 0;
}
- if(!strncmp(argv[1], "getall", 6)) {
+ if(!strcmp(argv[1], "getall")) {
if( verbose ) { printf("Getting all clock state\n") ;}
for(clk_res=0;clk_res<=max_res;clk_res++) {
for(clk_id=0;clk_id<=15;clk_id++) {
@@ -2228,7 +2326,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
- else if(!strncmp(argv[1], "getdenied", 6)) {
+ else if(!strcmp(argv[1], "getdenied")) {
if( verbose ) { printf("Getting disabled clocks\n") ;}
for(clk_res=0;clk_res<=max_res;clk_res++) {
for(clk_id=0;clk_id<=15;clk_id++) {
@@ -2237,7 +2335,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
}
}
}
- else if(!strncmp(argv[1], "getgranted", 6)) {
+ else if(!strcmp(argv[1], "getgranted")) {
if( verbose ) { printf("Getting enabled clocks\n") ;}
for(clk_res=0;clk_res<=max_res;clk_res++) {
for(clk_id=0;clk_id<=15;clk_id++) {
@@ -2266,7 +2364,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
return -1;
}
}
- else if (!strncmp(argv[1], "set", 3)) {
+ else if (!strcmp(argv[1], "set")) {
if (argc > 7) {
rc = ipmi_picmg_clk_set(intf, argc-1, &(argv[2]));
}
@@ -2330,7 +2428,7 @@ ipmi_picmg_ipmb_address(struct ipmi_intf *intf) {
uint8_t
picmg_discover(struct ipmi_intf *intf) {
/* Check if PICMG extension is available to use the function
- * GetDeviceLocator to retreive i2c address PICMG hack to set
+ * GetDeviceLocator to retrieve i2c address PICMG hack to set
* right IPMB address, If extension is not supported, should
* not give any problems
* PICMG Extension Version 2.0 (PICMG 3.0 Revision 1.0 ATCA) to
@@ -2353,13 +2451,13 @@ picmg_discover(struct ipmi_intf *intf) {
req.msg.data_len = 1;
msg_data = 0;
- lprintf(LOG_INFO, "Running Get PICMG Properties my_addr %#x, transit %#x, target %#x",
+ lprintf(LOG_DEBUG, "Running Get PICMG Properties my_addr %#x, transit %#x, target %#x",
intf->my_addr, intf->transit_addr, intf->target_addr);
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
- lprintf(LOG_INFO,"No response from Get PICMG Properties");
- } else if (rsp->ccode != 0) {
- lprintf(LOG_INFO,"Error response %#x from Get PICMG Properities",
+ if (!rsp) {
+ lprintf(LOG_DEBUG,"No response from Get PICMG Properties");
+ } else if (rsp->ccode) {
+ lprintf(LOG_DEBUG,"Error response %#x from Get PICMG Properties",
rsp->ccode);
} else if (rsp->data_len < 4) {
lprintf(LOG_INFO,"Invalid Get PICMG Properties response length %d",
@@ -2367,14 +2465,14 @@ picmg_discover(struct ipmi_intf *intf) {
} else if (rsp->data[0] != 0) {
lprintf(LOG_INFO,"Invalid Get PICMG Properties group extension %#x",
rsp->data[0]);
- } else if ((rsp->data[1] & 0x0F) != PICMG_EXTENSION_ATCA_MAJOR_VERSION
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_AMC0_MAJOR_VERSION
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_UTCA_MAJOR_VERSION) {
+ } else if ((rsp->data[1] & 0x0F) != PICMG_ATCA_MAJOR_VERSION
+ && (rsp->data[1] & 0x0F) != PICMG_AMC_MAJOR_VERSION
+ && (rsp->data[1] & 0x0F) != PICMG_UTCA_MAJOR_VERSION) {
lprintf(LOG_INFO,"Unknown PICMG Extension Version %d.%d",
(rsp->data[1] & 0x0F), (rsp->data[1] >> 4));
} else {
picmg_avail = 1;
- lprintf(LOG_INFO, "Discovered PICMG Extension Version %d.%d",
+ lprintf(LOG_DEBUG, "Discovered PICMG Extension Version %d.%d",
(rsp->data[1] & 0x0f), (rsp->data[1] >> 4));
}