mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 11:07:23 +00:00
fixed display format (suppressed TAB from formatted output)
This commit is contained in:
parent
0b9f0d6a35
commit
c306d08d7e
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -445,6 +446,7 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
char * fru_area;
|
char * fru_area;
|
||||||
uint8_t * fru_data;
|
uint8_t * fru_data;
|
||||||
uint32_t fru_len, area_len, i;
|
uint32_t fru_len, area_len, i;
|
||||||
|
time_t tval;
|
||||||
|
|
||||||
i = offset;
|
i = offset;
|
||||||
fru_len = 0;
|
fru_len = 0;
|
||||||
@ -473,8 +475,11 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
i++; /* skip fru area version */
|
i++; /* skip fru area version */
|
||||||
area_len = fru_data[i++] * 8; /* fru area length */
|
area_len = fru_data[i++] * 8; /* fru area length */
|
||||||
i++; /* skip fru board language */
|
i++; /* skip fru board language */
|
||||||
i += 3; /* skip mfg. date time */
|
tval=((fru_data[i+2] << 16) + (fru_data[i+1] << 8) + (fru_data[i]));
|
||||||
|
tval=tval * 60;
|
||||||
|
tval=tval + secs_from_1970_1996;
|
||||||
|
printf(" Board Mfg Date : %s", asctime(localtime(&tval)));
|
||||||
|
i += 3; /* skip mfg. date time */
|
||||||
|
|
||||||
fru_area = get_fru_area_str(fru_data, &i);
|
fru_area = get_fru_area_str(fru_data, &i);
|
||||||
if (fru_area != NULL && strlen(fru_area) > 0) {
|
if (fru_area != NULL && strlen(fru_area) > 0) {
|
||||||
@ -513,7 +518,7 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
int j = i;
|
int j = i;
|
||||||
fru_area = get_fru_area_str(fru_data, &i);
|
fru_area = get_fru_area_str(fru_data, &i);
|
||||||
if (fru_area != NULL && strlen(fru_area) > 0) {
|
if (fru_area != NULL && strlen(fru_area) > 0) {
|
||||||
printf(" Board Extra : %s\n", fru_area);
|
printf(" Board Extra : %s\n", fru_area);
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
}
|
}
|
||||||
if (i == j)
|
if (i == j)
|
||||||
@ -615,7 +620,7 @@ fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
int j = i;
|
int j = i;
|
||||||
fru_area = get_fru_area_str(fru_data, &i);
|
fru_area = get_fru_area_str(fru_data, &i);
|
||||||
if (fru_area != NULL && strlen(fru_area) > 0) {
|
if (fru_area != NULL && strlen(fru_area) > 0) {
|
||||||
printf(" Product Extra : %s\n", fru_area);
|
printf(" Product Extra : %s\n", fru_area);
|
||||||
free(fru_area);
|
free(fru_area);
|
||||||
}
|
}
|
||||||
if (i == j)
|
if (i == j)
|
||||||
@ -639,13 +644,13 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
uint8_t id, uint32_t offset)
|
uint8_t id, uint32_t offset)
|
||||||
{
|
{
|
||||||
uint8_t * fru_data;
|
uint8_t * fru_data;
|
||||||
uint32_t fru_len, i;
|
uint32_t fru_len, i, j, toff;
|
||||||
struct fru_multirec_header * h;
|
struct fru_multirec_header * h;
|
||||||
struct fru_multirec_powersupply * ps;
|
struct fru_multirec_powersupply * ps;
|
||||||
struct fru_multirec_dcoutput * dc;
|
struct fru_multirec_dcoutput * dc;
|
||||||
struct fru_multirec_dcload * dl;
|
struct fru_multirec_dcload * dl;
|
||||||
uint16_t peak_capacity;
|
uint16_t peak_capacity;
|
||||||
uint8_t peak_hold_up_time;
|
uint8_t peak_hold_up_time, bn;
|
||||||
uint32_t last_off, len;
|
uint32_t last_off, len;
|
||||||
|
|
||||||
i = last_off = offset;
|
i = last_off = offset;
|
||||||
@ -804,7 +809,7 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
/* Now makes sure this is really PICMG record */
|
/* Now makes sure this is really PICMG record */
|
||||||
|
|
||||||
if( iana == IPMI_OEM_PICMG ){
|
if( iana == IPMI_OEM_PICMG ){
|
||||||
printf(" PICMG Extension Record\n");
|
printf(" PICMG Extension Record\n");
|
||||||
ipmi_fru_picmg_ext_print(fru_data,
|
ipmi_fru_picmg_ext_print(fru_data,
|
||||||
i + sizeof(struct fru_multirec_header),
|
i + sizeof(struct fru_multirec_header),
|
||||||
h->len);
|
h->len);
|
||||||
@ -1176,62 +1181,62 @@ static void ipmi_fru_picmg_ext_print(uint8_t * fru_data, int off, int length)
|
|||||||
{
|
{
|
||||||
|
|
||||||
case FRU_PICMG_BACKPLANE_P2P:
|
case FRU_PICMG_BACKPLANE_P2P:
|
||||||
{
|
{
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
struct fru_picmgext_slot_desc * slot_d
|
struct fru_picmgext_slot_desc * slot_d
|
||||||
= (struct fru_picmgext_slot_desc*) &fru_data[offset];
|
= (struct fru_picmgext_slot_desc*) &fru_data[offset];
|
||||||
|
|
||||||
offset += sizeof(struct fru_picmgext_slot_desc);
|
offset += sizeof(struct fru_picmgext_slot_desc);
|
||||||
printf(" FRU_PICMG_BACKPLANE_P2P\n");
|
printf(" FRU_PICMG_BACKPLANE_P2P\n");
|
||||||
|
|
||||||
while (offset <= (start_offset+length)) {
|
while (offset <= (start_offset+length)) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" Channel Type: ");
|
printf(" Channel Type: ");
|
||||||
switch ( slot_d -> chan_type )
|
switch ( slot_d -> chan_type )
|
||||||
{
|
{
|
||||||
case 0x00:
|
case 0x00:
|
||||||
case 0x07:
|
case 0x07:
|
||||||
printf("PICMG 2.9\n");
|
printf("PICMG 2.9\n");
|
||||||
break;
|
break;
|
||||||
case 0x08:
|
case 0x08:
|
||||||
printf("Single Port Fabric IF\n");
|
printf("Single Port Fabric IF\n");
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
printf("Double Port Fabric IF\n");
|
printf("Double Port Fabric IF\n");
|
||||||
break;
|
break;
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
printf("Full Channel Fabric IF\n");
|
printf("Full Channel Fabric IF\n");
|
||||||
break;
|
break;
|
||||||
case 0x0b:
|
case 0x0b:
|
||||||
printf("Base IF\n");
|
printf("Base IF\n");
|
||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
printf("Update Channel IF\n");
|
printf("Update Channel IF\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unknown IF\n");
|
printf("Unknown IF\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf(" Slot Addr. : %02x\n", slot_d -> slot_addr );
|
printf(" Slot Addr. : %02x\n", slot_d -> slot_addr );
|
||||||
printf(" Channel Count: %i\n", slot_d -> chn_count);
|
printf(" Channel Count: %i\n", slot_d -> chn_count);
|
||||||
|
|
||||||
for (index = 0; index < (slot_d -> chn_count); index++) {
|
for (index = 0; index < (slot_d -> chn_count); index++) {
|
||||||
struct fru_picmgext_chn_desc * d
|
struct fru_picmgext_chn_desc * d
|
||||||
= (struct fru_picmgext_chn_desc *) &fru_data[offset];
|
= (struct fru_picmgext_chn_desc *) &fru_data[offset];
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf( " "
|
printf( " "
|
||||||
"Chn: %02x -> "
|
"Chn: %02x -> "
|
||||||
"Chn: %02x in "
|
"Chn: %02x in "
|
||||||
"Slot: %02x\n",
|
"Slot: %02x\n",
|
||||||
d->local_chn, d->remote_chn, d->remote_slot);
|
d->local_chn, d->remote_chn, d->remote_slot);
|
||||||
|
|
||||||
offset += sizeof(struct fru_picmgext_chn_desc);
|
offset += sizeof(struct fru_picmgext_chn_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
slot_d = (struct fru_picmgext_slot_desc*) &fru_data[offset];
|
slot_d = (struct fru_picmgext_slot_desc*) &fru_data[offset];
|
||||||
offset += sizeof(struct fru_picmgext_slot_desc);
|
offset += sizeof(struct fru_picmgext_slot_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1239,7 +1244,7 @@ static void ipmi_fru_picmg_ext_print(uint8_t * fru_data, int off, int length)
|
|||||||
{
|
{
|
||||||
unsigned char entries = 0;
|
unsigned char entries = 0;
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
|
|
||||||
printf(" FRU_PICMG_ADDRESS_TABLE\n");
|
printf(" FRU_PICMG_ADDRESS_TABLE\n");
|
||||||
|
|
||||||
printf(" Type/Len: 0x%02x\n", fru_data[offset++]);
|
printf(" Type/Len: 0x%02x\n", fru_data[offset++]);
|
||||||
|
@ -4,18 +4,18 @@
|
|||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* Redistribution of source code must retain the above copyright
|
* Redistribution of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistribution in binary form must reproduce the above copyright
|
* Redistribution in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of Kontron, or the names of
|
* Neither the name of Kontron, or the names of
|
||||||
* contributors may be used to endorse or promote products derived
|
* contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* This software is provided "AS IS," without a warranty of any kind.
|
* This software is provided "AS IS," without a warranty of any kind.
|
||||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
|
||||||
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
||||||
@ -162,10 +162,10 @@ ipmi_picmg_getaddr(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf(" -> IPMB-L Address: 0x%02x\n", amcAddrMap[rsp->data[5]].ipmbLAddr);
|
printf(" -> IPMB-L Address: 0x%02x\n", amcAddrMap[rsp->data[5]].ipmbLAddr);
|
||||||
break;
|
break;
|
||||||
case PICMG_PMC:
|
case PICMG_PMC:
|
||||||
printf("PMC\n");
|
printf("PMC\n");
|
||||||
break;
|
break;
|
||||||
case PICMG_RTM:
|
case PICMG_RTM:
|
||||||
printf("RTM\n");
|
printf("RTM\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (rsp->data[6] >= 0xc0 && rsp->data[6] <= 0xcf) {
|
if (rsp->data[6] >= 0xc0 && rsp->data[6] <= 0xcf) {
|
||||||
@ -197,19 +197,19 @@ ipmi_picmg_properties(struct ipmi_intf * intf, int show )
|
|||||||
printf("Error getting address information\n");
|
printf("Error getting address information\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( show )
|
if( show )
|
||||||
{
|
{
|
||||||
printf("PICMG identifier : 0x%02x\n", rsp->data[0]);
|
printf("PICMG identifier : 0x%02x\n", rsp->data[0]);
|
||||||
printf("PICMG Ext. Version : %i.%i\n", rsp->data[1]&0x0f,
|
printf("PICMG Ext. Version : %i.%i\n", rsp->data[1]&0x0f,
|
||||||
(rsp->data[1]&0xf0) >> 4);
|
(rsp->data[1]&0xf0) >> 4);
|
||||||
printf("Max FRU Device ID : 0x%02x\n", rsp->data[2]);
|
printf("Max FRU Device ID : 0x%02x\n", rsp->data[2]);
|
||||||
printf("FRU Device ID : 0x%02x\n", rsp->data[3]);
|
printf("FRU Device ID : 0x%02x\n", rsp->data[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We cache the major extension version ...
|
/* We cache the major extension version ...
|
||||||
to know how to format some commands */
|
to know how to format some commands */
|
||||||
PicmgExtMajorVersion = rsp->data[1]&0x0f;
|
PicmgExtMajorVersion = rsp->data[1]&0x0f;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ ipmi_picmg_properties(struct ipmi_intf * intf, int show )
|
|||||||
|
|
||||||
|
|
||||||
#define PICMG_FRU_DEACTIVATE (unsigned char) 0x00
|
#define PICMG_FRU_DEACTIVATE (unsigned char) 0x00
|
||||||
#define PICMG_FRU_ACTIVATE (unsigned char) 0x01
|
#define PICMG_FRU_ACTIVATE (unsigned char) 0x01
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsigned char state)
|
ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsigned char state)
|
||||||
@ -228,18 +228,18 @@ ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsig
|
|||||||
struct picmg_set_fru_activation_cmd cmd;
|
struct picmg_set_fru_activation_cmd cmd;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = PICMG_FRU_ACTIVATION_CMD;
|
req.msg.cmd = PICMG_FRU_ACTIVATION_CMD;
|
||||||
req.msg.data = (unsigned char*) &cmd;
|
req.msg.data = (unsigned char*) &cmd;
|
||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
|
|
||||||
cmd.picmg_id = 0; /* PICMG identifier */
|
cmd.picmg_id = 0; /* PICMG identifier */
|
||||||
cmd.fru_id = (unsigned char) atoi(argv[0]); /* FRU ID */
|
cmd.fru_id = (unsigned char) atoi(argv[0]); /* FRU ID */
|
||||||
cmd.fru_state = state;
|
cmd.fru_state = state;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if (!rsp || rsp->ccode) {
|
if (!rsp || rsp->ccode) {
|
||||||
printf("Error activation/deactivation of FRU\n");
|
printf("Error activation/deactivation of FRU\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -260,9 +260,9 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char **
|
|||||||
unsigned char msg_data[4];
|
unsigned char msg_data[4];
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = PICMG_GET_FRU_POLICY_CMD;
|
req.msg.cmd = PICMG_GET_FRU_POLICY_CMD;
|
||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
msg_data[0] = 0; /* PICMG identifier */
|
msg_data[0] = 0; /* PICMG identifier */
|
||||||
@ -281,9 +281,9 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char **
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" %s\n", ((rsp->data[1] & 0x01) == 0x01) ?
|
printf(" %s\n", ((rsp->data[1] & 0x01) == 0x01) ?
|
||||||
"activation locked" : "activation not locked");
|
"activation locked" : "activation not locked");
|
||||||
printf(" %s\n", ((rsp->data[1] & 0x02) == 0x02) ?
|
printf(" %s\n", ((rsp->data[1] & 0x02) == 0x02) ?
|
||||||
"deactivation locked" : "deactivation not locked");
|
"deactivation locked" : "deactivation not locked");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -297,14 +297,14 @@ ipmi_picmg_fru_activation_policy_set(struct ipmi_intf * intf, int argc, char **
|
|||||||
unsigned char msg_data[4];
|
unsigned char msg_data[4];
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = PICMG_SET_FRU_POLICY_CMD;
|
req.msg.cmd = PICMG_SET_FRU_POLICY_CMD;
|
||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
|
|
||||||
msg_data[0] = 0; /* PICMG identifier */
|
msg_data[0] = 0; /* PICMG identifier */
|
||||||
msg_data[1] = (unsigned char) atoi(argv[0]); /* FRU ID */
|
msg_data[1] = (unsigned char) atoi(argv[0]); /* FRU ID */
|
||||||
msg_data[2] = (unsigned char) atoi(argv[1])& 0x03; /* FRU act policy mask */
|
msg_data[2] = (unsigned char) atoi(argv[1])& 0x03; /* FRU act policy mask */
|
||||||
msg_data[3] = (unsigned char) atoi(argv[2])& 0x03; /* FRU act policy set bits */
|
msg_data[3] = (unsigned char) atoi(argv[2])& 0x03; /* FRU act policy set bits */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
@ -337,13 +337,13 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
|
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = PICMG_GET_PORT_STATE_CMD;
|
req.msg.cmd = PICMG_GET_PORT_STATE_CMD;
|
||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
msg_data[0] = 0x00; /* PICMG identifier */
|
msg_data[0] = 0x00; /* PICMG identifier */
|
||||||
msg_data[1] = (interface & 0x3)<<6; /* interface */
|
msg_data[1] = (interface & 0x3)<<6; /* interface */
|
||||||
msg_data[1] |= (channel & 0x3F); /* channel number */
|
msg_data[1] |= (channel & 0x3F); /* channel number */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
@ -362,17 +362,14 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
|
|
||||||
if (rsp->data_len >= 6) {
|
if (rsp->data_len >= 6) {
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* add support for more than one link per channel */
|
/* add support for more than one link per channel */
|
||||||
for(index=0;index<PICMG_MAX_LINK_PER_CHANNEL;index++){
|
for(index=0;index<PICMG_MAX_LINK_PER_CHANNEL;index++){
|
||||||
|
|
||||||
if( rsp->data_len > (1+ (index*5))){
|
if( rsp->data_len > (1+ (index*5))){
|
||||||
|
|
||||||
d = (struct fru_picmgext_link_desc *) &(rsp->data[1 + (index*5)]);
|
d = (struct fru_picmgext_link_desc *) &(rsp->data[1 + (index*5)]);
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
mode == PICMG_EKEY_MODE_PRINT_ALL
|
mode == PICMG_EKEY_MODE_PRINT_ALL
|
||||||
||
|
||
|
||||||
mode == PICMG_EKEY_MODE_QUERY
|
mode == PICMG_EKEY_MODE_QUERY
|
||||||
||
|
||
|
||||||
@ -389,9 +386,9 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
printf(" Link Grouping ID: 0x%02x\n", d->grouping);
|
printf(" Link Grouping ID: 0x%02x\n", d->grouping);
|
||||||
printf(" Link Type Extension: 0x%02x\n", d->ext);
|
printf(" Link Type Extension: 0x%02x\n", d->ext);
|
||||||
printf(" Link Type: 0x%02x ", d->type);
|
printf(" Link Type: 0x%02x ", d->type);
|
||||||
if (d->type == 0 || d->type == 0xff)
|
if (d->type == 0 || d->type == 0xff)
|
||||||
{
|
{
|
||||||
printf("Reserved %d\n",d->type);
|
printf("Reserved %d\n",d->type);
|
||||||
@ -420,7 +417,7 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
case FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR:
|
case FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR:
|
||||||
printf("PICMG 3.3 Star Fabric Interface\n");
|
printf("PICMG 3.3 Star Fabric Interface\n");
|
||||||
break;
|
break;
|
||||||
case FRU_PICMGEXT_LINK_TYPE_PCIE:
|
case FRU_PICMGEXT_LINK_TYPE_PCIE:
|
||||||
printf("PCI Express Fabric Interface\n");
|
printf("PCI Express Fabric Interface\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -428,9 +425,9 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(" Link Designator: \n");
|
printf(" Link Designator: \n");
|
||||||
printf(" Port Flag: 0x%02x\n", d->desig_port);
|
printf(" Port Flag: 0x%02x\n", d->desig_port);
|
||||||
printf(" Interface: 0x%02x - ", d->desig_if);
|
printf(" Interface: 0x%02x - ", d->desig_if);
|
||||||
switch (d->desig_if)
|
switch (d->desig_if)
|
||||||
{
|
{
|
||||||
case FRU_PICMGEXT_DESIGN_IF_BASE:
|
case FRU_PICMGEXT_DESIGN_IF_BASE:
|
||||||
@ -449,9 +446,10 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
printf("Invalid");
|
printf("Invalid");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf(" Channel Number: 0x%02x\n", d->desig_channel);
|
printf(" Channel Number: 0x%02x\n", d->desig_channel);
|
||||||
|
printf(" STATE: %s\n",
|
||||||
|
( rsp->data[5 +(index*5)] == 0x01) ?"enabled":"disabled");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" STATE: %s\n", rsp->data[5 +(index*5)] == 0x01?"enabled":"disabled");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,7 +464,7 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int interface,int channel,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_portstate_set(struct ipmi_intf * intf, int interface, int channel,
|
ipmi_picmg_portstate_set(struct ipmi_intf * intf, int interface, int channel,
|
||||||
int port, int type, int typeext, int group, int enable)
|
int port, int type, int typeext, int group, int enable)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
@ -477,17 +475,17 @@ ipmi_picmg_portstate_set(struct ipmi_intf * intf, int interface, int channel,
|
|||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
|
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = PICMG_SET_PORT_STATE_CMD;
|
req.msg.cmd = PICMG_SET_PORT_STATE_CMD;
|
||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 6;
|
req.msg.data_len = 6;
|
||||||
|
|
||||||
msg_data[0] = 0x00; /* PICMG identifier */
|
msg_data[0] = 0x00; /* PICMG identifier */
|
||||||
msg_data[1] = (channel & 0x3f) | ((interface & 3) << 6);
|
msg_data[1] = (channel & 0x3f) | ((interface & 3) << 6);
|
||||||
msg_data[2] = (port & 0xf) | ((type & 0xf) << 4);
|
msg_data[2] = (port & 0xf) | ((type & 0xf) << 4);
|
||||||
msg_data[3] = ((type >> 4) & 0xf) | ((typeext & 0xf) << 4);
|
msg_data[3] = ((type >> 4) & 0xf) | ((typeext & 0xf) << 4);
|
||||||
msg_data[4] = group & 0xff;
|
msg_data[4] = group & 0xff;
|
||||||
msg_data[5] = (unsigned char) (enable & 0x01); /* en/dis */
|
msg_data[5] = (unsigned char) (enable & 0x01); /* en/dis */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
@ -555,10 +553,10 @@ ipmi_picmg_amc_portstate_get(struct ipmi_intf * intf,int device,int channel,
|
|||||||
|
|
||||||
if (rsp->data_len >= 5) {
|
if (rsp->data_len >= 5) {
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* add support for more than one link per channel */
|
/* add support for more than one link per channel */
|
||||||
for(index=0;index<PICMG_AMC_MAX_LINK_PER_CHANNEL;index++){
|
for(index=0;index<PICMG_AMC_MAX_LINK_PER_CHANNEL;index++){
|
||||||
|
|
||||||
if( rsp->data_len > (1+ (index*4))){
|
if( rsp->data_len > (1+ (index*4))){
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
unsigned char ext;
|
unsigned char ext;
|
||||||
@ -567,20 +565,20 @@ ipmi_picmg_amc_portstate_get(struct ipmi_intf * intf,int device,int channel,
|
|||||||
unsigned char enabled;
|
unsigned char enabled;
|
||||||
d = (struct fru_picmgext_amc_link_info *)&(rsp->data[1 + (index*4)]);
|
d = (struct fru_picmgext_amc_link_info *)&(rsp->data[1 + (index*4)]);
|
||||||
|
|
||||||
|
|
||||||
/* Removed endianness check here, probably not required
|
/* Removed endianness check here, probably not required
|
||||||
as we dont use bitfields */
|
as we dont use bitfields */
|
||||||
port = d->linkInfo[0] & 0x0F;
|
port = d->linkInfo[0] & 0x0F;
|
||||||
type = ((d->linkInfo[0] & 0xF0) >> 4 )|(d->linkInfo[1] & 0x0F );
|
type = ((d->linkInfo[0] & 0xF0) >> 4 )|(d->linkInfo[1] & 0x0F );
|
||||||
ext = ((d->linkInfo[1] & 0xF0) >> 4 );
|
ext = ((d->linkInfo[1] & 0xF0) >> 4 );
|
||||||
grouping = d->linkInfo[2];
|
grouping = d->linkInfo[2];
|
||||||
|
|
||||||
|
|
||||||
enabled = rsp->data[4 + (index*4) ];
|
enabled = rsp->data[4 + (index*4) ];
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
mode == PICMG_EKEY_MODE_PRINT_ALL
|
mode == PICMG_EKEY_MODE_PRINT_ALL
|
||||||
||
|
||
|
||||||
mode == PICMG_EKEY_MODE_QUERY
|
mode == PICMG_EKEY_MODE_QUERY
|
||||||
||
|
||
|
||||||
@ -598,38 +596,42 @@ ipmi_picmg_amc_portstate_get(struct ipmi_intf * intf,int device,int channel,
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(device == -1 || PicmgExtMajorVersion != 2){
|
if(device == -1 || PicmgExtMajorVersion != 2){
|
||||||
printf(" Link device : AMC\n");
|
printf(" Link device : AMC\n");
|
||||||
}else{
|
}else{
|
||||||
printf(" Link device : 0x%02x\n", device );
|
printf(" Link device : 0x%02x\n", device );
|
||||||
}
|
}
|
||||||
printf(" Link channel: 0x%02x\n", channel);
|
|
||||||
|
printf(" Link Grouping ID: 0x%02x\n", grouping);
|
||||||
printf(" Link Grouping ID: 0x%02x\n", grouping);
|
|
||||||
|
|
||||||
if (type == 0 || type == 1 ||type == 0xff)
|
if (type == 0 || type == 1 ||type == 0xff)
|
||||||
{
|
{
|
||||||
printf(" Link Type Extension: 0x%02x\n", ext);
|
printf(" Link Type Extension: 0x%02x\n", ext);
|
||||||
printf(" Link Type: Reserved\n");
|
printf(" Link Type: Reserved\n");
|
||||||
}
|
}
|
||||||
else if (type >= 0xf0 && type <= 0xfe)
|
else if (type >= 0xf0 && type <= 0xfe)
|
||||||
{
|
{
|
||||||
printf(" Link Type Extension: 0x%02x\n", ext);
|
printf(" Link Type Extension: 0x%02x\n", ext);
|
||||||
printf(" Link Type: OEM GUID Definition\n");
|
printf(" Link Type: OEM GUID Definition\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (type <= FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE )
|
if (type <= FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE )
|
||||||
{
|
{
|
||||||
printf(" Link Type Extension: %s\n",amc_link_type_ext_str[type][ext]);
|
printf(" Link Type Extension: %s\n",
|
||||||
printf(" Link Type: %s\n",amc_link_type_str[type]);
|
amc_link_type_ext_str[type][ext]);
|
||||||
|
printf(" Link Type: %s\n",
|
||||||
|
amc_link_type_str[type]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
printf(" Link Type Extension: 0x%02x\n", ext);
|
printf(" Link Type Extension: 0x%02x\n", ext);
|
||||||
printf(" Link Type: undefined\n");
|
printf(" Link Type: undefined\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(" Port Flag: 0x%02x\n", port );
|
printf(" Link Designator: \n");
|
||||||
printf(" STATE: %s\n",( enabled == 0x01 )?"enabled":"disabled");
|
printf(" Channel Number: 0x%02x\n", channel);
|
||||||
|
printf(" Port Flag: 0x%02x\n", port );
|
||||||
|
printf(" STATE: %s\n",
|
||||||
|
( enabled == 0x01 )?"enabled":"disabled");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -644,9 +646,9 @@ ipmi_picmg_amc_portstate_get(struct ipmi_intf * intf,int device,int channel,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_picmg_amc_portstate_set(struct ipmi_intf * intf, int channel, int port,
|
ipmi_picmg_amc_portstate_set(struct ipmi_intf * intf, int channel, int port,
|
||||||
int type, int typeext, int group, int enable, int device)
|
int type, int typeext, int group, int enable, int device)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
@ -721,8 +723,8 @@ ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("General Status LED Properties: 0x%2x\n\r", rsp->data[1] );
|
printf("General Status LED Properties: 0x%2x\n\r", rsp->data[1] );
|
||||||
printf("App. Specific LED Count: 0x%2x\n\r", rsp->data[2] );
|
printf("App. Specific LED Count: 0x%2x\n\r", rsp->data[2] );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -769,8 +771,8 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("\n\r");
|
printf("\n\r");
|
||||||
|
|
||||||
printf("Default LED Color in\n\r");
|
printf("Default LED Color in\n\r");
|
||||||
printf(" LOCAL control: %s\n\r", led_color_str[ rsp->data[2] ] );
|
printf(" LOCAL control: %s\n\r", led_color_str[ rsp->data[2] ] );
|
||||||
printf(" OVERRIDE state: %s\n\r", led_color_str[ rsp->data[3] ] );
|
printf(" OVERRIDE state: %s\n\r", led_color_str[ rsp->data[3] ] );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -817,7 +819,7 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else
|
else
|
||||||
printf("\n\r");
|
printf("\n\r");
|
||||||
|
|
||||||
printf(" Local Control function: %x ", rsp->data[2] );
|
printf(" Local Control function: %x ", rsp->data[2] );
|
||||||
if (rsp->data[2] == 0x0)
|
if (rsp->data[2] == 0x0)
|
||||||
printf("[OFF]\n\r");
|
printf("[OFF]\n\r");
|
||||||
else if (rsp->data[2] == 0xff)
|
else if (rsp->data[2] == 0xff)
|
||||||
@ -825,12 +827,12 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else
|
else
|
||||||
printf("[BLINKING]\n\r");
|
printf("[BLINKING]\n\r");
|
||||||
|
|
||||||
printf(" Local Control On-Duration: %x\n\r", rsp->data[3] );
|
printf(" Local Control On-Duration: %x\n\r", rsp->data[3] );
|
||||||
printf(" Local Control Color: %x [%s]\n\r", rsp->data[4], led_color_str[ rsp->data[4] ]);
|
printf(" Local Control Color: %x [%s]\n\r", rsp->data[4], 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) {
|
||||||
printf(" Override function: %x ", rsp->data[5] );
|
printf(" Override function: %x ", rsp->data[5] );
|
||||||
if (rsp->data[2] == 0x0)
|
if (rsp->data[2] == 0x0)
|
||||||
printf("[OFF]\n\r");
|
printf("[OFF]\n\r");
|
||||||
else if (rsp->data[2] == 0xff)
|
else if (rsp->data[2] == 0xff)
|
||||||
@ -838,20 +840,20 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else
|
else
|
||||||
printf("[BLINKING]\n\r");
|
printf("[BLINKING]\n\r");
|
||||||
|
|
||||||
printf(" Override On-Duration: %x\n\r", rsp->data[6] );
|
printf(" Override On-Duration: %x\n\r", rsp->data[6] );
|
||||||
printf(" Override Color: %x [%s]\n\r", rsp->data[7], led_color_str[ rsp->data[7] ]);
|
printf(" Override Color: %x [%s]\n\r", rsp->data[7], led_color_str[ rsp->data[7] ]);
|
||||||
|
|
||||||
}else if (rsp->data[1] == 0x06) {
|
}else if (rsp->data[1] == 0x06) {
|
||||||
printf(" Override function: %x ", rsp->data[5] );
|
printf(" Override function: %x ", rsp->data[5] );
|
||||||
if (rsp->data[2] == 0x0)
|
if (rsp->data[2] == 0x0)
|
||||||
printf("[OFF]\n\r");
|
printf("[OFF]\n\r");
|
||||||
else if (rsp->data[2] == 0xff)
|
else if (rsp->data[2] == 0xff)
|
||||||
printf("[ON]\n\r");
|
printf("[ON]\n\r");
|
||||||
else
|
else
|
||||||
printf("[BLINKING]\n\r");
|
printf("[BLINKING]\n\r");
|
||||||
printf(" Override On-Duration: %x\n\r", rsp->data[6] );
|
printf(" Override On-Duration: %x\n\r", rsp->data[6] );
|
||||||
printf(" Override Color: %x [%s]\n\r", rsp->data[7], led_color_str[ rsp->data[7] ]);
|
printf(" Override Color: %x [%s]\n\r", rsp->data[7], led_color_str[ rsp->data[7] ]);
|
||||||
printf(" Lamp test duration: %x\n\r", rsp->data[8] );
|
printf(" Lamp test duration: %x\n\r", rsp->data[8] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -929,13 +931,13 @@ ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Dynamic Power Configuration: %s\n", (rsp->data[1]&0x80)==0x80?"enabled":"disabled" );
|
printf("Dynamic Power Configuration: %s\n", (rsp->data[1]&0x80)==0x80?"enabled":"disabled" );
|
||||||
printf("Actual Power Level: %i\n", (rsp->data[1] & 0xf));
|
printf("Actual Power Level: %i\n", (rsp->data[1] & 0xf));
|
||||||
printf("Delay to stable Power: %i\n", rsp->data[2]);
|
printf("Delay to stable Power: %i\n", rsp->data[2]);
|
||||||
printf("Power Multiplier: %i\n", rsp->data[3]);
|
printf("Power Multiplier: %i\n", rsp->data[3]);
|
||||||
|
|
||||||
|
|
||||||
for ( i = 1; i+3 < rsp->data_len ; i++ ) {
|
for ( i = 1; i+3 < rsp->data_len ; i++ ) {
|
||||||
printf(" Power Draw %i: %i\n", i, (rsp->data[i+3]) * rsp->data[3] / 10);
|
printf(" Power Draw %i: %i\n", i, (rsp->data[i+3]) * rsp->data[3] / 10);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -960,9 +962,9 @@ ipmi_picmg_set_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
msg_data[1] = atoi(argv[0]); /* FRU-ID */
|
msg_data[1] = atoi(argv[0]); /* FRU-ID */
|
||||||
msg_data[2] = atoi(argv[1]); /* power level */
|
msg_data[2] = atoi(argv[1]); /* power level */
|
||||||
msg_data[3] = atoi(argv[2]); /* present to desired */
|
msg_data[3] = atoi(argv[2]); /* present to desired */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if (!rsp) {
|
if (!rsp) {
|
||||||
printf("no response\n");
|
printf("no response\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -972,7 +974,7 @@ ipmi_picmg_set_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("returned CC code 0x%02x\n", rsp->ccode);
|
printf("returned CC code 0x%02x\n", rsp->ccode);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -995,7 +997,7 @@ ipmi_picmg_fru_control(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
msg_data[1] = atoi(argv[0]); /* FRU-ID */
|
msg_data[1] = atoi(argv[0]); /* FRU-ID */
|
||||||
msg_data[2] = atoi(argv[1]); /* control option */
|
msg_data[2] = atoi(argv[1]); /* control option */
|
||||||
|
|
||||||
printf("0: 0x%02x 1: 0x%02x\n\r", msg_data[1], msg_data[2]);
|
printf("0: 0x%02x 1: 0x%02x\n\r", msg_data[1], msg_data[2]);
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
@ -1021,7 +1023,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int i;
|
int i;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
|
|
||||||
unsigned char enabled;
|
unsigned char enabled;
|
||||||
unsigned char direction;
|
unsigned char direction;
|
||||||
|
|
||||||
@ -1030,20 +1032,20 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
|
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = PICMG_AMC_GET_CLK_STATE_CMD;
|
req.msg.cmd = PICMG_AMC_GET_CLK_STATE_CMD;
|
||||||
req.msg.data = msg_data;
|
req.msg.data = msg_data;
|
||||||
req.msg.data_len = 2;
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
msg_data[0] = 0x00; /* PICMG identifier */
|
msg_data[0] = 0x00; /* PICMG identifier */
|
||||||
msg_data[1] = atoi(argv[0]); /* clk id */
|
msg_data[1] = atoi(argv[0]); /* clk id */
|
||||||
|
|
||||||
if(argc>2){
|
if(argc>2){
|
||||||
msg_data[2] = atoi(argv[1]); /* resource id */
|
msg_data[2] = atoi(argv[1]); /* resource id */
|
||||||
req.msg.data_len = 3;
|
req.msg.data_len = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if (!rsp) {
|
if (!rsp) {
|
||||||
printf("no response\n");
|
printf("no response\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -1053,26 +1055,26 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("returned CC code 0x%02x\n", rsp->ccode);
|
printf("returned CC code 0x%02x\n", rsp->ccode);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled = (rsp->data[1]&0x8)!=0;
|
enabled = (rsp->data[1]&0x8)!=0;
|
||||||
direction = (rsp->data[1]&0x4)!=0;
|
direction = (rsp->data[1]&0x4)!=0;
|
||||||
|
|
||||||
printf("CLK setting: 0x%02x\n", rsp->data[1]);
|
printf("CLK setting: 0x%02x\n", rsp->data[1]);
|
||||||
printf(" - state: %s\n", (enabled)?"enabled":"disabled");
|
printf(" - state: %s\n", (enabled)?"enabled":"disabled");
|
||||||
printf(" - direction: %s\n", (direction)?"Source":"Receiver");
|
printf(" - direction: %s\n", (direction)?"Source":"Receiver");
|
||||||
printf(" - PLL ctrl: 0x%x\n", rsp->data[1]&0x3);
|
printf(" - PLL ctrl: 0x%x\n", rsp->data[1]&0x3);
|
||||||
|
|
||||||
if(enabled){
|
if(enabled){
|
||||||
unsigned long freq = 0;
|
unsigned long freq = 0;
|
||||||
freq = ( rsp->data[5] << 0
|
freq = ( rsp->data[5] << 0
|
||||||
| rsp->data[6] << 8
|
| rsp->data[6] << 8
|
||||||
| rsp->data[7] << 16
|
| rsp->data[7] << 16
|
||||||
| rsp->data[8] << 24 );
|
| rsp->data[8] << 24 );
|
||||||
printf(" - Index: %d\n", rsp->data[2]);
|
printf(" - Index: %d\n", rsp->data[2]);
|
||||||
printf(" - Family: %d\n", rsp->data[3]);
|
printf(" - Family: %d\n", rsp->data[3]);
|
||||||
printf(" - AccLVL: %d\n", rsp->data[4]);
|
printf(" - AccLVL: %d\n", rsp->data[4]);
|
||||||
printf(" - Freq: %d\n", freq);
|
printf(" - Freq: %d\n", freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1101,27 +1103,27 @@ ipmi_picmg_clk_set(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
msg_data[3] = strtoul(argv[2], NULL,0); /* setting */
|
msg_data[3] = strtoul(argv[2], NULL,0); /* setting */
|
||||||
msg_data[4] = strtoul(argv[3], NULL,0); /* family */
|
msg_data[4] = strtoul(argv[3], NULL,0); /* family */
|
||||||
msg_data[5] = strtoul(argv[4], NULL,0); /* acc */
|
msg_data[5] = strtoul(argv[4], NULL,0); /* acc */
|
||||||
|
|
||||||
freq = strtoul(argv[5], NULL,0);
|
freq = strtoul(argv[5], NULL,0);
|
||||||
msg_data[6] = (freq >> 0)& 0xFF; /* freq */
|
msg_data[6] = (freq >> 0)& 0xFF; /* freq */
|
||||||
msg_data[7] = (freq >> 8)& 0xFF; /* freq */
|
msg_data[7] = (freq >> 8)& 0xFF; /* freq */
|
||||||
msg_data[8] = (freq >>16)& 0xFF; /* freq */
|
msg_data[8] = (freq >>16)& 0xFF; /* freq */
|
||||||
msg_data[9] = (freq >>24)& 0xFF; /* freq */
|
msg_data[9] = (freq >>24)& 0xFF; /* freq */
|
||||||
|
|
||||||
msg_data[10] = strtoul(argv[6 ], NULL,0); /* resource id */
|
msg_data[10] = strtoul(argv[6 ], NULL,0); /* resource id */
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
printf("## ID: %d\n", msg_data[1]);
|
printf("## ID: %d\n", msg_data[1]);
|
||||||
printf("## index: %d\n", msg_data[2]);
|
printf("## index: %d\n", msg_data[2]);
|
||||||
printf("## setting: 0x02x\n", msg_data[3]);
|
printf("## setting: 0x02x\n", msg_data[3]);
|
||||||
printf("## family: %d\n", msg_data[4]);
|
printf("## family: %d\n", msg_data[4]);
|
||||||
printf("## acc: %d\n", msg_data[5]);
|
printf("## acc: %d\n", msg_data[5]);
|
||||||
printf("## freq: %d\n", freq );
|
printf("## freq: %d\n", freq );
|
||||||
printf("## res: %d\n", msg_data[10]);
|
printf("## res: %d\n", msg_data[10]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
|
||||||
if (!rsp) {
|
if (!rsp) {
|
||||||
printf("no response\n");
|
printf("no response\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -1131,7 +1133,7 @@ printf("## res: %d\n", msg_data[10]);
|
|||||||
printf("returned CC code 0x%02x\n", rsp->ccode);
|
printf("returned CC code 0x%02x\n", rsp->ccode);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,12 +1144,12 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int showProperties = 0;
|
int showProperties = 0;
|
||||||
|
|
||||||
/* Get PICMG properties is called to obtain version information */
|
/* Get PICMG properties is called to obtain version information */
|
||||||
if (argc !=0 && !strncmp(argv[0], "properties", 10)) {
|
if (argc !=0 && !strncmp(argv[0], "properties", 10)) {
|
||||||
showProperties =1;
|
showProperties =1;
|
||||||
}
|
}
|
||||||
rc = ipmi_picmg_properties(intf,showProperties);
|
rc = ipmi_picmg_properties(intf,showProperties);
|
||||||
|
|
||||||
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
|
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
|
||||||
ipmi_picmg_help();
|
ipmi_picmg_help();
|
||||||
@ -1166,13 +1168,13 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("usage: frucontrol <FRU-ID><OPTION>\n");
|
printf("usage: frucontrol <FRU-ID><OPTION>\n");
|
||||||
printf(" OPTION:\n");
|
printf(" OPTION:\n");
|
||||||
printf(" 0x00 - Cold Reset\n");
|
printf(" 0x00 - Cold Reset\n");
|
||||||
printf(" 0x01 - Warm Reset\n");
|
printf(" 0x01 - Warm Reset\n");
|
||||||
printf(" 0x02 - Graceful Reboot\n");
|
printf(" 0x02 - Graceful Reboot\n");
|
||||||
printf(" 0x03 - Issue Diagnostic Interrupt\n");
|
printf(" 0x03 - Issue Diagnostic Interrupt\n");
|
||||||
printf(" 0x04 - Quiesce [AMC only]\n");
|
printf(" 0x04 - Quiesce [AMC only]\n");
|
||||||
printf(" 0x05-0xFF - Cold Reset\n");
|
printf(" 0x05-0xFF - Cold Reset\n");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1215,10 +1217,10 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
rc = ipmi_picmg_fru_activation_policy_set(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_fru_activation_policy_set(intf, argc-1, &(argv[2]));
|
||||||
} else {
|
} else {
|
||||||
printf("usage: set <fruid> <lockmask> <lock>\n");
|
printf("usage: set <fruid> <lockmask> <lock>\n");
|
||||||
printf(" lockmask: [1] affect the deactivation locked bit\n");
|
printf(" lockmask: [1] affect the deactivation locked bit\n");
|
||||||
printf(" [0] affect the activation locked bit\n");
|
printf(" [0] affect the activation locked bit\n");
|
||||||
printf(" lock: [1] set/clear deactivation locked\n");
|
printf(" lock: [1] set/clear deactivation locked\n");
|
||||||
printf(" [0] set/clear locked \n");
|
printf(" [0] set/clear locked \n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1247,7 +1249,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if(!strncmp(argv[1], "getall", 6)){
|
if(!strncmp(argv[1], "getall", 6)){
|
||||||
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++){
|
for(iface=0;iface<=PICMG_EKEY_MAX_INTERFACE;iface++){
|
||||||
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++){
|
for(channel=1;channel<=PICMG_EKEY_MAX_CHANNEL;channel++){
|
||||||
if(
|
if(
|
||||||
!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC )
|
!(( iface == FRU_PICMGEXT_DESIGN_IF_FABRIC )
|
||||||
&&
|
&&
|
||||||
( channel > PICMG_EKEY_MAX_FABRIC_CHANNEL ) )
|
( channel > PICMG_EKEY_MAX_FABRIC_CHANNEL ) )
|
||||||
@ -1276,10 +1278,10 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
else if (argc > 3){
|
else if (argc > 3){
|
||||||
iface = atoi(argv[2]);
|
iface = atoi(argv[2]);
|
||||||
channel = atoi(argv[3]);
|
channel = atoi(argv[3]);
|
||||||
lprintf(LOG_DEBUG,"PICMG: requesting interface %d",iface);
|
lprintf(LOG_DEBUG,"PICMG: requesting interface %d",iface);
|
||||||
lprintf(LOG_DEBUG,"PICMG: requesting channel %d",channel);
|
lprintf(LOG_DEBUG,"PICMG: requesting channel %d",channel);
|
||||||
|
|
||||||
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
rc = ipmi_picmg_portstate_get(intf,iface,channel,
|
||||||
PICMG_EKEY_MODE_QUERY );
|
PICMG_EKEY_MODE_QUERY );
|
||||||
}
|
}
|
||||||
@ -1288,15 +1290,15 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strncmp(argv[1], "set", 3)) {
|
||||||
if (argc == 9) {
|
if (argc == 9) {
|
||||||
int interface = strtoul(argv[2], NULL, 0);
|
int interface = strtoul(argv[2], NULL, 0);
|
||||||
int channel = strtoul(argv[3], NULL, 0);
|
int channel = strtoul(argv[3], NULL, 0);
|
||||||
int port = strtoul(argv[4], NULL, 0);
|
int port = strtoul(argv[4], NULL, 0);
|
||||||
int type = strtoul(argv[5], NULL, 0);
|
int type = strtoul(argv[5], NULL, 0);
|
||||||
int typeext = strtoul(argv[6], NULL, 0);
|
int typeext = strtoul(argv[6], NULL, 0);
|
||||||
int group = strtoul(argv[7], NULL, 0);
|
int group = strtoul(argv[7], NULL, 0);
|
||||||
int enable = strtoul(argv[8], NULL, 0);
|
int enable = strtoul(argv[8], NULL, 0);
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: interface %d",interface);
|
lprintf(LOG_DEBUG,"PICMG: interface %d",interface);
|
||||||
lprintf(LOG_DEBUG,"PICMG: channel %d",channel);
|
lprintf(LOG_DEBUG,"PICMG: channel %d",channel);
|
||||||
lprintf(LOG_DEBUG,"PICMG: port %d",port);
|
lprintf(LOG_DEBUG,"PICMG: port %d",port);
|
||||||
@ -1304,7 +1306,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_DEBUG,"PICMG: typeext %d",typeext);
|
lprintf(LOG_DEBUG,"PICMG: typeext %d",typeext);
|
||||||
lprintf(LOG_DEBUG,"PICMG: group %d",group);
|
lprintf(LOG_DEBUG,"PICMG: group %d",group);
|
||||||
lprintf(LOG_DEBUG,"PICMG: enable %d",enable);
|
lprintf(LOG_DEBUG,"PICMG: enable %d",enable);
|
||||||
|
|
||||||
rc = ipmi_picmg_portstate_set(intf, interface, channel, port,
|
rc = ipmi_picmg_portstate_set(intf, interface, channel, port,
|
||||||
type, typeext ,group ,enable);
|
type, typeext ,group ,enable);
|
||||||
}
|
}
|
||||||
@ -1370,13 +1372,13 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else if (argc > 2){
|
else if (argc > 2){
|
||||||
channel = atoi(argv[2]);
|
channel = atoi(argv[2]);
|
||||||
if (argc > 3){
|
if (argc > 3){
|
||||||
device = atoi(argv[3]);
|
device = atoi(argv[3]);
|
||||||
}else{
|
}else{
|
||||||
device = -1;
|
device = -1;
|
||||||
}
|
}
|
||||||
lprintf(LOG_DEBUG,"PICMG: requesting device %d",device);
|
lprintf(LOG_DEBUG,"PICMG: requesting device %d",device);
|
||||||
lprintf(LOG_DEBUG,"PICMG: requesting channel %d",channel);
|
lprintf(LOG_DEBUG,"PICMG: requesting channel %d",channel);
|
||||||
|
|
||||||
rc = ipmi_picmg_amc_portstate_get(intf,device,channel,
|
rc = ipmi_picmg_amc_portstate_get(intf,device,channel,
|
||||||
PICMG_EKEY_MODE_QUERY );
|
PICMG_EKEY_MODE_QUERY );
|
||||||
}
|
}
|
||||||
@ -1386,17 +1388,17 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
else if (!strncmp(argv[1], "set", 3)) {
|
else if (!strncmp(argv[1], "set", 3)) {
|
||||||
if (argc > 7) {
|
if (argc > 7) {
|
||||||
int channel = atoi(argv[2]);
|
int channel = atoi(argv[2]);
|
||||||
int port = atoi(argv[3]);
|
int port = atoi(argv[3]);
|
||||||
int type = atoi(argv[4]);
|
int type = atoi(argv[4]);
|
||||||
int typeext = atoi(argv[5]);
|
int typeext = atoi(argv[5]);
|
||||||
int group = atoi(argv[6]);
|
int group = atoi(argv[6]);
|
||||||
int enable = atoi(argv[7]);
|
int enable = atoi(argv[7]);
|
||||||
int device = -1;
|
int device = -1;
|
||||||
if(argc > 8){
|
if(argc > 8){
|
||||||
device = atoi(argv[8]);
|
device = atoi(argv[8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
lprintf(LOG_DEBUG,"PICMG: channel %d",channel);
|
lprintf(LOG_DEBUG,"PICMG: channel %d",channel);
|
||||||
lprintf(LOG_DEBUG,"PICMG: portflags %d",port);
|
lprintf(LOG_DEBUG,"PICMG: portflags %d",port);
|
||||||
lprintf(LOG_DEBUG,"PICMG: type %d",type);
|
lprintf(LOG_DEBUG,"PICMG: type %d",type);
|
||||||
@ -1404,12 +1406,12 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_DEBUG,"PICMG: group %d",group);
|
lprintf(LOG_DEBUG,"PICMG: group %d",group);
|
||||||
lprintf(LOG_DEBUG,"PICMG: enable %d",enable);
|
lprintf(LOG_DEBUG,"PICMG: enable %d",enable);
|
||||||
lprintf(LOG_DEBUG,"PICMG: device %d",device);
|
lprintf(LOG_DEBUG,"PICMG: device %d",device);
|
||||||
|
|
||||||
rc = ipmi_picmg_amc_portstate_set(intf, channel, port, type,
|
rc = ipmi_picmg_amc_portstate_set(intf, channel, port, type,
|
||||||
typeext, group, enable, device);
|
typeext, group, enable, device);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("<chn> <portflags> <type> <ext> <group> <1|0> [<device>]\n");
|
printf("<chn> <portflags> <type> <ext> <group> <1|0> [<device>]\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1531,7 +1533,7 @@ ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
unsigned char clk_id;
|
unsigned char clk_id;
|
||||||
unsigned char clk_res;
|
unsigned char clk_res;
|
||||||
|
|
||||||
rc = ipmi_picmg_clk_get(intf, argc-1, &(argv[2]));
|
rc = ipmi_picmg_clk_get(intf, argc-1, &(argv[2]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user