mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Move led color static array to source file
Move led color static array from header to ipmi_picmg module and introduce `picmg_led_color_str()` function for use in ipmi_vita module. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
parent
83fee27624
commit
5183b2c288
@ -92,18 +92,7 @@ typedef enum picmg_busres_resource_id {
|
|||||||
PICMG_BUSRES_SYNC_CLOCK_GROUP_3
|
PICMG_BUSRES_SYNC_CLOCK_GROUP_3
|
||||||
} t_picmg_busres_resource_id;
|
} t_picmg_busres_resource_id;
|
||||||
|
|
||||||
/* the LED color capabilities */
|
const char *picmg_led_color_str(int color);
|
||||||
static const char *__UNUSED__(led_color_str[]) = {
|
|
||||||
"reserved",
|
|
||||||
"BLUE",
|
|
||||||
"RED",
|
|
||||||
"GREEN",
|
|
||||||
"AMBER",
|
|
||||||
"ORANGE",
|
|
||||||
"WHITE",
|
|
||||||
"reserved"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct sAmcPortState {
|
struct sAmcPortState {
|
||||||
#ifndef WORDS_BIGENDIAN
|
#ifndef WORDS_BIGENDIAN
|
||||||
|
@ -114,27 +114,27 @@ static const char* amc_link_type_ext_str[][16] = {
|
|||||||
},
|
},
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
|
||||||
{
|
{
|
||||||
"1000BASE-BX (SerDES Gigabit)",
|
"1000BASE-BX (SerDES Gigabit)",
|
||||||
"10GBASE-BX410 Gigabit XAUI",
|
"10GBASE-BX410 Gigabit XAUI",
|
||||||
"", "",
|
"", "",
|
||||||
"", "", "", "",
|
"", "", "", "",
|
||||||
"", "", "", "",
|
"", "", "", "",
|
||||||
"", "", "", ""
|
"", "", "", ""
|
||||||
},
|
},
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
|
||||||
{
|
{
|
||||||
"1.25 Gbaud transmission rate",
|
"1.25 Gbaud transmission rate",
|
||||||
"2.5 Gbaud transmission rate",
|
"2.5 Gbaud transmission rate",
|
||||||
"3.125 Gbaud transmission rate",
|
"3.125 Gbaud transmission rate",
|
||||||
"", "", "", "", "",
|
"", "", "", "", "",
|
||||||
"", "", "", "", "", "", "", ""
|
"", "", "", "", "", "", "", ""
|
||||||
},
|
},
|
||||||
/* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
|
/* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
|
||||||
{
|
{
|
||||||
"Fibre Channel",
|
"Fibre Channel",
|
||||||
"Serial ATA",
|
"Serial ATA",
|
||||||
"Serial Attached SCSI",
|
"Serial Attached SCSI",
|
||||||
"", "", "", "", "",
|
"", "", "", "", "",
|
||||||
"", "", "", "", "", "", "", ""
|
"", "", "", "", "", "", "", ""
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -202,6 +202,28 @@ struct sAmcAddrMap {
|
|||||||
{0x88, "reserved", 0},
|
{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
|
/* is_amc_channel - wrapper to convert user input into integer
|
||||||
* AMC Channel range seems to be <0..255>, bits [7:0]
|
* AMC Channel range seems to be <0..255>, bits [7:0]
|
||||||
*
|
*
|
||||||
@ -1306,14 +1328,14 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, char ** argv)
|
|||||||
printf("LED Color Capabilities: ");
|
printf("LED Color Capabilities: ");
|
||||||
for ( i=0 ; i<8 ; i++ ) {
|
for ( i=0 ; i<8 ; i++ ) {
|
||||||
if ( rsp->data[1] & (0x01 << i) ) {
|
if ( rsp->data[1] & (0x01 << i) ) {
|
||||||
printf("%s, ", led_color_str[ i ]);
|
printf("%s, ", picmg_led_color_str(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Default LED Color in\n");
|
printf("Default LED Color in\n");
|
||||||
printf(" LOCAL control: %s\n", led_color_str[ rsp->data[2] ] );
|
printf(" LOCAL control: %s\n", picmg_led_color_str(rsp->data[2]));
|
||||||
printf(" OVERRIDE state: %s\n", led_color_str[ rsp->data[3] ] );
|
printf(" OVERRIDE state: %s\n", picmg_led_color_str(rsp->data[3]));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1380,7 +1402,9 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" Local Control On-Duration: %x\n", rsp->data[3] );
|
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 */
|
/* override state or lamp test */
|
||||||
if (rsp->data[1] & 0x02) {
|
if (rsp->data[1] & 0x02) {
|
||||||
@ -1394,7 +1418,9 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" Override On-Duration: %x\n", rsp->data[6] );
|
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]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,14 +603,14 @@ ipmi_vita_get_led_color_capabilities(struct ipmi_intf *intf, char **argv)
|
|||||||
printf("LED Color Capabilities: ");
|
printf("LED Color Capabilities: ");
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
if (rsp->data[1] & (0x01 << i)) {
|
if (rsp->data[1] & (0x01 << i)) {
|
||||||
printf("%s, ", led_color_str[i]);
|
printf("%s, ", picmg_led_color_str(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
printf("Default LED Color in\n");
|
printf("Default LED Color in\n");
|
||||||
printf(" LOCAL control: %s\n", led_color_str[rsp->data[2]]);
|
printf(" LOCAL control: %s\n", picmg_led_color_str(rsp->data[2]));
|
||||||
printf(" OVERRIDE state: %s\n", led_color_str[rsp->data[3]]);
|
printf(" OVERRIDE state: %s\n", picmg_led_color_str(rsp->data[3]));
|
||||||
|
|
||||||
if (rsp->data_len == 5) {
|
if (rsp->data_len == 5) {
|
||||||
printf("LED flags:\n");
|
printf("LED flags:\n");
|
||||||
@ -692,7 +692,7 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv)
|
|||||||
}
|
}
|
||||||
printf(" Local Control On-Duration: %x\n", rsp->data[3]);
|
printf(" Local Control On-Duration: %x\n", rsp->data[3]);
|
||||||
printf(" Local Control Color: %x\t[%s]\n",
|
printf(" Local Control Color: %x\t[%s]\n",
|
||||||
rsp->data[4], led_color_str[rsp->data[4] & 7]);
|
rsp->data[4], picmg_led_color_str(rsp->data[4] & 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override state or lamp test */
|
/* override state or lamp test */
|
||||||
@ -707,7 +707,7 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv)
|
|||||||
}
|
}
|
||||||
printf(" Override On-Duration: %x\n", rsp->data[6]);
|
printf(" Override On-Duration: %x\n", rsp->data[6]);
|
||||||
printf(" Override Color: %x\t[%s]\n",
|
printf(" Override Color: %x\t[%s]\n",
|
||||||
rsp->data[7], led_color_str[rsp->data[7] & 7]);
|
rsp->data[7], picmg_led_color_str(rsp->data[7] & 7));
|
||||||
if (rsp->data[1] == 0x04) {
|
if (rsp->data[1] == 0x04) {
|
||||||
printf(" Lamp test duration: %x\n", rsp->data[8]);
|
printf(" Lamp test duration: %x\n", rsp->data[8]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user