ID: 48 - Remove hard-coded FRU inventory access length restriction

The patch removes hard-coded 16-byte length restriction onf FRU inventory
transactions. Instead, it adds an optional command-line argument for devices
which need such restriction.
For other devices, 32 bytes cap length is used.
Also, the patch contains several code optimizations as well as several bug-fixes
in API implementations where absolute FRU device offsets were used instead on
relative.

Commit for Dmitry Bazhenov
This commit is contained in:
Zdenek Styblik 2013-10-04 04:57:20 +00:00
parent 041d8e4bf8
commit c7412e5815
3 changed files with 404 additions and 521 deletions

View File

@ -63,6 +63,8 @@ enum {
struct fru_info {
uint16_t size;
uint8_t access:1;
uint8_t max_read_size;
uint8_t max_write_size;
};
#ifdef HAVE_PRAGMA_PACK
@ -70,6 +72,7 @@ struct fru_info {
#endif
struct fru_header {
uint8_t version;
union {
struct {
uint8_t internal;
uint8_t chassis;
@ -77,6 +80,8 @@ struct fru_header {
uint8_t product;
uint8_t multi;
} offset;
uint8_t offsets[5];
};
uint8_t pad;
uint8_t checksum;
}ATTRIBUTE_PACKING;
@ -598,6 +603,20 @@ static const char * chassis_type_desc[] __attribute__((unused)) = {
"AdvancedTCA", "Blade", "Blade Enclosure"
};
typedef struct ipmi_fru_bloc {
struct ipmi_fru_bloc * next;
uint16_t start;
uint16_t size;
uint8_t blocId[32];
} t_ipmi_fru_bloc;
static const char *section_id[4] = {
"Internal Use Section",
"Chassis Section",
"Board Section",
"Product Section"
};
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);

File diff suppressed because it is too large Load Diff

View File

@ -350,6 +350,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf * intf)
return(-1);
}
memset(&fru, 0, sizeof(fru));
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;
@ -637,6 +638,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf * intf)
return(-1);
}
memset(&fru, 0, sizeof(fru));
fru.size = (rsp->data[1] << 8) | rsp->data[0];
fru.access = rsp->data[2] & 0x1;