+mstflint (4.4.0-1) unstable; urgency=low
+
+ * Updated from MFT-4.4.0
+
mstflint (4.3.0-1) unstable; urgency=low
* Updated from MFT-4.4.0 initial release
* SOFTWARE.
*/
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
DM_UNKNOWN = -1,
DM_HCA,
DM_SWITCH,
- DM_BRIDGE
+ DM_BRIDGE,
+ DM_QSFP_CABLE,
+ DM_SFP_CABLE,
};
struct dev_info {
};
#define DEVID_ADDR 0xf0014
+#define CABLEID_ADDR 0x0
+#define SFP_51_ADDR 92
+#define SFP_51_PAGING_ADDR 64
-static struct dev_info g_devs_info[] = {
+#ifdef CABLES_SUPP
+enum dm_dev_type getCableType(u_int8_t id) {
+ switch (id) {
+ case 0xd:
+ case 0x11:
+ case 0xe:
+ case 0xc:
+ return DM_QSFP_CABLE;
+ case 0x3:
+ return DM_SFP_CABLE;
+ default:
+ return DM_UNKNOWN;
+ }
+}
+#endif
+static struct dev_info g_devs_info[] = {
{
.dm_id = DeviceInfiniScaleIV,
.hw_dev_id = 0x01b3,
.port_num = 2,
.dev_type = DM_HCA
},
+
{
.dm_id = DeviceConnectX3,
.hw_dev_id = 0x1f5,
.port_num = 36,
.dev_type = DM_SWITCH
},
+ {
+ .dm_id = DeviceCable,
+ .hw_dev_id = 0xffff,
+ .hw_rev_id = -1,
+ .sw_dev_id = -1,
+ .name = "Cable",
+ .port_num = -1,
+ .dev_type = DM_QSFP_CABLE
+ },
+ {
+ .dm_id = DeviceCableQSFP,
+ .hw_dev_id = 0xffff,
+ .hw_rev_id = 0,
+ .sw_dev_id = -1,
+ .name = "CableQSFP",
+ .port_num = -1,
+ .dev_type = DM_QSFP_CABLE
+ },
+ {
+ .dm_id = DeviceCableQSFPaging,
+ .hw_dev_id = 0xffff,
+ .hw_rev_id = 1,
+ .sw_dev_id = -1,
+ .name = "CableQSFPaging",
+ .port_num = -1,
+ .dev_type = DM_QSFP_CABLE
+ },
+ {
+ .dm_id = DeviceCableSFP,
+ .hw_dev_id = 0xffff,
+ .hw_rev_id = 1,
+ .sw_dev_id = -1,
+ .name = "CableSFP",
+ .port_num = -1,
+ .dev_type = DM_SFP_CABLE
+ },
+ {
+ .dm_id = DeviceCableSFP51,
+ .hw_dev_id = 0xffff,
+ .hw_rev_id = 1,
+ .sw_dev_id = -1,
+ .name = "CableSFP51",
+ .port_num = -1,
+ .dev_type = DM_SFP_CABLE
+ },
+ {
+ .dm_id = DeviceCableSFP51Paging,
+ .hw_dev_id = 0xffff,
+ .hw_rev_id = 1,
+ .sw_dev_id = -1,
+ .name = "CableSFP51Paging",
+ .port_num = -1,
+ .dev_type = DM_SFP_CABLE
+ },
{
.dm_id = DeviceDummy,
.hw_dev_id = 0x1,
return 0;
}
#endif
-
+#ifdef CABLES_SUPP
+ if (mf->tp == MST_CABLE) {
+ //printf("-D- Getting cable ID\n");
+ if (mread4(mf, CABLEID_ADDR, &dword) != 4)
+ {
+ //printf("FATAL - crspace read (0x%x) failed: %s\n", DEVID_ADDR, strerror(errno));
+ return 1;
+ }
+ dword = __cpu_to_le32(dword); // Cable pages are in LE
+ *ptr_hw_dev_id = 0xffff;
+ u_int8_t id = EXTRACT(dword, 0, 8);
+ enum dm_dev_type cbl_type = getCableType(id);
+ if (cbl_type == DM_QSFP_CABLE) {
+ // Get Byte 2 bit 2 ~ bit 18
+ u_int8_t paging = EXTRACT(dword, 18, 1);
+ //printf("DWORD: %#x, paging: %d\n", dword, paging);
+ if (paging == 0) {
+ *ptr_dm_dev_id = DeviceCableQSFPaging;
+ } else {
+ *ptr_dm_dev_id = DeviceCableQSFP;
+ }
+ } else if (cbl_type == DM_SFP_CABLE) {
+ *ptr_dm_dev_id = DeviceCableSFP;
+ if (mread4(mf, SFP_51_ADDR, &dword) != 4)
+ {
+ //printf("FATAL - crspace read (0x%x) failed: %s\n", DEVID_ADDR, strerror(errno));
+ return 1;
+ }
+ u_int8_t byte = EXTRACT(dword, 6, 1); //Byte 92 bit 6
+ if (byte) {
+ *ptr_dm_dev_id = DeviceCableSFP51;
+ if (mread4(mf, SFP_51_PAGING_ADDR, &dword) != 4)
+ {
+ //printf("FATAL - crspace read (0x%x) failed: %s\n", DEVID_ADDR, strerror(errno));
+ return 1;
+ }
+ byte = EXTRACT(dword, 4, 1); //Byte 64 bit 4
+ if (byte) {
+ *ptr_dm_dev_id = DeviceCableSFP51Paging;
+ }
+ }
+ } else {
+ *ptr_dm_dev_id = DeviceUnknown;
+ }
+ return 0;
+ }
+#endif
rc = mget_mdevs_flags(mf, &dev_flags);
return get_entry(type)->dev_type == DM_BRIDGE;
}
+int dm_dev_is_cable(dm_dev_id_t type)
+{
+ return (get_entry(type)->dev_type == DM_QSFP_CABLE || get_entry(type)->dev_type == DM_SFP_CABLE);
+}
+
u_int32_t dm_get_hw_dev_id(dm_dev_id_t type)
{
return get_entry(type)->hw_dev_id;
return get_entry(type)->dm_id != DeviceUnknown;
}
+int dm_is_livefish_mode(mfile* mf)
+{
+ if(!mf || !mf->dinfo) {
+ return 0;
+ }
+ dm_dev_id_t devid_t;
+ u_int32_t devid = 0;
+ u_int32_t revid = 0;
+ int rc = dm_get_device_id(mf, &devid_t, &devid, &revid);
+ if (rc) {
+ // Could not detrmine , by default is not livefish
+ return 0;
+ }
+ u_int32_t swid = mf->dinfo->pci.dev_id;
+ //printf("-D- swid: %#x, devid: %#x\n", swid, devid);
+ if (devid_t == DeviceConnectX2 ||
+ devid_t == DeviceConnectX3 ||
+ devid_t == DeviceConnectX3Pro ||
+ devid_t == DeviceSwitchX ) {
+ return (devid == swid - 1);
+ } else {
+ return (devid == swid);
+ }
+
+ return 0;
+}
+
* SOFTWARE.
*/
+
#ifndef TOOLS_DEV_TYPE_H
#define TOOLS_DEV_TYPE_H
DeviceInfiniScaleIII, // UnSupported
DeviceInfiniHostIIILx, // UnSupported
DeviceConnectX, // UnSupported
- DeviceConnectX2,
+ DeviceConnectX2,
DeviceInfiniScaleIV,
DeviceBridgeX, // UnSupported
DeviceSwitchX,
DeviceFPGA,
DeviceSwitchIB2,
DeviceFPGANewton,
+ DeviceCable,
+ DeviceCableQSFP,
+ DeviceCableQSFPaging,
+ DeviceCableSFP,
+ DeviceCableSFP51,
+ DeviceCableSFP51Paging,
DeviceDummy,
DeviceEndMarker // Dummy Device - Marker for indicating end of devices when iterating
*/
int dm_dev_is_bridge(dm_dev_id_t type);
+/**
+ * A predicate returning if the device is a Cable
+ */
+int dm_dev_is_cable(dm_dev_id_t type);
+
/**
* Returns the max num of ports or -1 on error
*/
*/
int dm_is_fpp_supported(dm_dev_id_t type);
+/*
+ * A predicate returning if the device is in LiveFish mode
+ */
+int dm_is_livefish_mode(mfile* mf);
+
#ifdef __cplusplus
} /* end of 'extern "C"' */
#endif
_sCmds.push_back(new SubCmd("", "fi", SC_Fix_Img));
_sCmds.push_back(new SubCmd("cs", "checksum", SC_Check_Sum));
_sCmds.push_back(new SubCmd("ts", "timestamp", SC_Time_Stamp));
+ _sCmds.push_back(new SubCmd("ci", "cache_image", SC_Cache_Image));
}
SubCmdMetaData::~SubCmdMetaData() {
#define FLINT_IMAGE_READ_ERROR "Failed to read image. %s\n"
#define FLINT_READ_ERROR "Failed to read from %s. %s\n"
#define FLINT_WIN_NOT_SUPP_ERROR "Command \"%s\" is not supported in windows.\n"
+#define FLINT_WIN_ONLY_SUPP_ERROR "Command \"%s\" is supported only in windows.\n"
#define FLINT_GEN_COMMAND_ERROR "Failed to execute command %s. %s\n"
#define FLINT_FS3_BB_ERROR "bb command is not supported anymore in FS3 image, please use b for burning FS3 image.\n"
#define FLINT_FS3_BURN_ERROR "Burning FS3 image failed: %s\n"
#define FLINT_CHECKSUM_PARSE_ERROR "Failed to parse given checksum.\n"
#define FLINT_CHECKSUM_LEN_ERROR "MD5 checksum should be exactly 16 bytes long.\n"
#define FLINT_CHECKSUM_HEX_ERROR "MD5 checksum should contain only hexadecimal digits.\n"
+#define FLINT_CACHE_IMAGE_ERROR "Failed to issue image cache request to driver. %s. make sure Mellanox driver is loaded and working properly.\n"
/**************************
* Flint Warning Messages
cmdMap[SC_Clear_Sem] = new ClearSemSubCommand();
cmdMap[SC_Check_Sum] = new CheckSumSubCommand();
cmdMap[SC_Time_Stamp] = new TimeStampSubCommand();
+ cmdMap[SC_Cache_Image] = new CacheImageSubCommand();
return cmdMap;
}
}
//TODO: Step 3 check flintParams for contradictions?
//Step 4 execute command from the correct subcommand class
+ if (_subcommands.count(_flintParams.cmd) == 0) {
+ // should not be reached
+ printf("-E- FATAL: command object not found.");
+ return FLINT_FAILED;
+ }
_subcommands[_flintParams.cmd]->setParams(_flintParams);
return _subcommands[_flintParams.cmd]->executeCommand();
}
SC_Fix_Img,
SC_Qrom,
SC_Check_Sum,
- SC_Time_Stamp
+ SC_Time_Stamp,
+ SC_Cache_Image
} sub_cmd_t;
class FlintParams {
#ifdef __WIN__
#include <windows.h>
#include <ctype.h>
+
+#include <win_driver_cif.h>
#endif
#include "subcommands.h"
FlintStatus BurnSubCommand::burnFs3()
{
// Here we want to burn FS3 device so we check if the image is indeed FS3 image
- if (_imgInfo.fw_type != FIT_FS3) {
+ if (_imgInfo.fw_type != FIT_FS3 && _imgInfo.fw_type != FIT_FS4) {
reportErr(true, FLINT_IMG_DEV_COMPAT_ERROR, "FS3", "FS3");
return FLINT_FAILED;
- }
-
+ }
// on FS3 burn we require query to pass
if (!_devQueryRes && _burnParams.burnFailsafe) {
reportErr(true, FLINT_FS3_BURN_ERROR, _fwOps->err());
return FLINT_FAILED;
}
-
//check FwVersion
if ( !checkFwVersion()) {
return FLINT_BURN_ABORTED;
return FLINT_FAILED;
}
// deal with rom
-
dealWithExpRom();
bool getRomFromDev = ( _burnParams.burnRomOptions == FwOperations::ExtBurnParams::BRO_FROM_DEV_IF_EXIST);
if (!getRomFromDev && !checkMatchingExpRomDevId(_imgInfo)) {
}
}
- // perform some checks incase of a corrupt CX4
- // TODO: remove this check in MFT-4.1.0
- if(_burnParams.burnFailsafe) {
- if (!_fwOps->CheckCX4Device()) {
- printf(" An inconsistency was detected in the device parameters. A fix must be performed before burning FW.\n");
- printf(" Please do not terminate the process. Operation is not failsafe.\n");
- if (!askUser()) {
- return FLINT_FAILED;
- }
- }
- }
if (!_fwOps->FwBurnAdvanced(_imgOps, _burnParams)) {
reportErr(true, FLINT_FS3_BURN_ERROR, _fwOps->err());
return FLINT_FAILED;
}
PRINT_PROGRESS(_burnParams.progressFunc, 101);
-
write_result_to_log(FLINT_SUCCESS, "", _flintParams.log_specified);
const char* resetRec = _fwOps->FwGetResetRecommandationStr();
if (resetRec) {
// query both image and device (deviceQuery can fail but we save rc)
_devQueryRes = _fwOps->FwQuery(&_devInfo);
if (!_imgOps->FwQuery(&_imgInfo))
- {
- reportErr(true, FLINT_FAILED_QUERY_ERROR, "image", _flintParams.image.c_str(), _imgOps->err());
- return FLINT_FAILED;
- }
+ {
+ reportErr(true, FLINT_FAILED_QUERY_ERROR, "image", _flintParams.image.c_str(), _imgOps->err());
+ return FLINT_FAILED;
+ }
//updateBurnParams with input given by user
updateBurnParams();
- if (_fwType == FIT_FS3) {
- return burnFs3();
+ if (_fwType == FIT_FS3 || _fwType == FIT_FS4) {
+
+ return burnFs3();//CodeView: change the name of this function
} else if (_fwType == FIT_FS2) {
- return burnFs2();
+ return burnFs2();
}
// unknown fw type
reportErr(true, FLINT_UNKNOWN_FW_TYPE_ERROR);
FlintStatus QuerySubCommand::printInfo(const fw_info_t& fwInfo, bool fullQuery)
{
+ //char imageTypeStr[4] = {'\0', '\0', '\0', '\0'};
bool isFs2 = (fwInfo.fw_type == FIT_FS2) ? true : false;
+ bool isFs3 = (fwInfo.fw_type == FIT_FS3) ? true : false;
+ bool isFs4 = (fwInfo.fw_type == FIT_FS4) ? true : false;
- printf("Image type: %s\n",(isFs2)? "FS2" : "FS3");
+ /*switch(fwInfo.fw_type){
+ case FIT_FS2:
+ snprintf(imageTypeStr, 4, "FS2");
+ break;
+ case FIT_FS3:
+ snprintf(imageTypeStr, 4, "FS3");
+ break;
+ case FIT_FS4:
+ snprintf(imageTypeStr, 4, "FS4");
+ break;
+ }*/
+ printf("Image type: %s\n", isFs2 ? "FS2" : (isFs3 ? "FS3" : isFs4 ? "FS4" : "Unknown"));
if (fwInfo.fw_info.fw_ver[0] || fwInfo.fw_info.fw_ver[1] || fwInfo.fw_info.fw_ver[2]) {
char versionStr[64] = {0};
}
+/***********************
+ *Class: CacheImage
+ **********************/
+CacheImageSubCommand:: CacheImageSubCommand()
+{
+ _name = "cache image";
+ _desc = "cache FW image(Windows only).";
+ _extendedDesc = "cache the FW image using Mellanox driver to allow faster FW load time upon loading the driver(Windows only).";
+ _flagLong = "cache_image";
+ _flagShort = "ci";
+ _param = "";
+ _paramExp = "";
+ _example = FLINT_NAME" -d "MST_DEV_EXAMPLE1" cache_image";
+ _v = Wtv_Dev;
+ _maxCmdParamNum = 0;
+ _minCmdParamNum = 0;
+ _cmdType = SC_Cache_Image;
+}
+
+CacheImageSubCommand:: ~CacheImageSubCommand()
+{
+
+}
+
+FlintStatus CacheImageSubCommand:: executeCommand()
+{
+#ifdef __WIN__
+ int rc;
+
+ if (preFwAccess() == FLINT_FAILED) {
+ return FLINT_FAILED;
+ }
+ rc = wdcif_send_image_cache_request(((Flash*)_io)->getMfileObj());
+ if (rc) {
+ reportErr(true, FLINT_CACHE_IMAGE_ERROR, wdcif_err_str(rc));
+ return FLINT_FAILED;
+ }
+ printf("\n-I- FW was successfully cached by driver.\n");
+ return FLINT_SUCCESS;
+#else
+ reportErr(true, FLINT_WIN_ONLY_SUPP_ERROR, _name.c_str());
+ return FLINT_FAILED;
+#endif
+}
struct tools_open_fw_version _userFwVer;
};
+class CacheImageSubCommand : public SubCommand
+{
+public:
+ CacheImageSubCommand();
+ ~CacheImageSubCommand();
+ FlintStatus executeCommand();
+};
+
#endif
#include <sys/types.h>
#include "mtcr_com_defs.h"
+#include "mtcr_mf.h"
typedef enum mtcr_access_method {
MTCR_ACCESS_ERROR = MST_ERROR,
mfile *mopen_fw_ctx(void* fw_cmd_context, void* fw_cmd_func, void* extra_data);
+mfile *mopen_adv(const char *name, MType mtype);
+
/*
* Close Mellanox driver
* req. descriptor
int mget_addr_space(mfile* mf);
int mset_addr_space(mfile* mf, int space);
+int mclear_pci_semaphore(const char* name);
+
#ifdef __cplusplus
}
#endif
* SOFTWARE.
*/
+
#ifndef _MTCR_COM_DEFS_H
#define _MTCR_COM_DEFS_H
ME_BAD_PARAMS,
ME_CR_ERROR,
ME_NOT_IMPLEMENTED,
+
ME_SEM_LOCKED,
ME_MEM_ERROR,
ME_PCI_SPACE_NOT_SUPPORTED,
ME_PCI_IFC_TOUT,
+ ME_UNSUPPORTED_OPERATION,
+ ME_UNSUPPORTED_ACCESS_TYPE,
+
// errors regarding REG_ACCESS
ME_REG_ACCESS_OK = 0,
ME_REG_ACCESS_BAD_STATUS_ERR = 0x100,
// 0x2000 reserved
MST_FPGA_NEWTON = 0x4000,
MST_CABLE = 0x8000,
- MST_DEFAULT = 0xffffffff & ~MST_FPGA
+ MST_DEFAULT = 0xffffffff & ~MST_FPGA & ~MST_CABLE
} MType;
typedef enum DType_t {
#define CPUMODE_SHIFT 30
#define CPUMODE 0xf0150
+#define IS4_HW_ID 0x1b3
#define SWITCHX_HW_ID 0x245
#define CONNECTX_HW_ID 0x190
#define CX3_PRO_HW_ID 0x1F7
#define CX4_HW_ID 0x209
#define CX4LX_HW_ID 0x20b
#define CX5_HW_ID 0x20d
-
#define CONNECT_IB_HW_ID 0x1FF
#define SWITCH_IB_HW_ID 0x247
#define SPECTRUM_HW_ID 0x249
#define IS_CONNECTX_4TH_GEN_FAMILY(dev_id) \
(((dev_id) == CONNECTX_HW_ID) || ((dev_id) == CX3_HW_ID) || ((dev_id) == CX3_PRO_HW_ID))
#define IS_IS4_FAMILY(dev_id) \
- (((dev_id) == 435)) // 435 == InfiniScaleIV
+ (((dev_id) == IS4_HW_ID))
#define IS_SX(dev_id) \
((dev_id) == SWITCHX_HW_ID)
#define IS_SIB(dev_id) \
#define IS_SWITCH(dev_id) \
((IS_IS4_FAMILY(dev_id)) || (IS_SX(dev_id)) || (IS_SIB(dev_id)) || (IS_SEN(dev_id)) || (IS_SIB2(dev_id)))
#define SUPPORTS_SW_RESET(devid)\
- (((devid) == 435) || ((devid) == SWITCHX_HW_ID) || ((devid) == SWITCH_IB_HW_ID) || ((devid) == SWITCH_IB2_HW_ID))
+ (((devid) == IS4_HW_ID) || ((devid) == SWITCHX_HW_ID) || ((devid) == SWITCH_IB_HW_ID) || ((devid) == SWITCH_IB2_HW_ID))
// Write/Erase delays
int spi_get_num_of_flashes(int prev_num_of_flashes);
+#ifndef UEFI_BUILD
static int trm2mfe_err(trm_sts rc);
-
+#endif
int my_memset(void* dst, u_int8_t data, u_int32_t len) {
u_int32_t i;
SFC_RDSR2 = 0x35,
SFC_WREN = 0x06,
SFC_READ = 0x03,
+ SFC_FAST_READ = 0x3B,
+ SFC_QUAD_READ = 0x3B,
SFC_RES = 0xAB,
SFC_JEDEC = 0x9F,
SFC_RDNVR = 0xB5,
flash_info_t g_flash_info_arr[] =
{
- {"M25PXxx", FV_ST, FMT_ST_M25PX, MCS_STSPI, SFC_SSE, FSS_4KB, 0, 0, 0, 0, 0},
+ {"M25PXxx", FV_ST, FMT_ST_M25PX, MCS_STSPI, SFC_SSE, FSS_4KB, 1, 0, 0, 0, 0},
{"M25Pxx", FV_ST, FMT_ST_M25P, MCS_STSPI, SFC_SE, FSS_64KB, 0, 0, 0, 0, 0},
{"N25Q0XX", FV_ST, FMT_N25QXXX, MCS_STSPI, SFC_SSE, FSS_4KB, 1, 1, 1, 0, 1},
{SST_FLASH_NAME, FV_SST, FMT_SST_25, MCS_SSTSPI, SFC_SE, FSS_64KB, 0, 0, 0, 0, 0},
{WINBOND_W25X, FV_WINBOND, FMT_WINBOND_W25X, MCS_STSPI, SFC_SSE, FSS_4KB, 0, 0, 0, 0, 0},
{ATMEL_NAME, FV_ATMEL, FMT_ATMEL, MCS_STSPI, SFC_SSE, FSS_4KB, 0, 0, 0, 0, 0},
{S25FLXXXP_NAME, FV_S25FLXXXX, FMT_S25FLXXXP, MCS_STSPI, SFC_SE, FSS_64KB, 0, 0, 0, 0, 0},
- {S25FL116K_NAME, FV_S25FLXXXX, FMT_S25FL116K, MCS_STSPI, SFC_SSE, FSS_4KB, 0, 0, 0, 0, 0}, // this flash actually supports quad and write protect but we dont need it at this moment
+ {S25FL116K_NAME, FV_S25FLXXXX, FMT_S25FL116K, MCS_STSPI, SFC_SSE, FSS_4KB, 1, 1, 1, 1, 0}, // this flash actually supports quad and write protect but we dont need it at this moment
{MACRONIX_NAME, FV_MX25K16XXX, FMT_ST_M25P, MCS_STSPI, SFC_SSE, FSS_4KB, 0, 0, 0, 0, 0}, // this flash actually supports write protection but we dont use it at this time
};
int num_of_flashes = get_num_of_banks_int(mfl);
int spi_sel, rc;
int params_were_set = 0;
+ flash_info_t tmp_flash_info;
memset(flash_params, 0, sizeof(flash_params_t));
+ memset (flash_info, 0, sizeof(flash_info_t));
+ memset (&tmp_flash_info, 0, sizeof(flash_info_t));
// if number of flash banks is zero exit with error
if (num_of_flashes == 0) {
u_int8_t no_flash = 0;
const char *type_name;
rc = set_bank(mfl, spi_sel); CHECK_RC(rc);
- rc = mfl->f_get_info(mfl, flash_info, &log2size, &no_flash); CHECK_RC(rc);
+ rc = mfl->f_get_info(mfl, &tmp_flash_info, &log2size, &no_flash); CHECK_RC(rc);
//printf("-D- spi_sel = %d, num_of_flashes = %d, rc = %d, no_flash = %d\n", spi_sel, num_of_flashes, rc, no_flash);
if (no_flash == 1) {
break;
}
- type_name = flash_info->name;
+ type_name = tmp_flash_info.name;
if (params_were_set == 0) {
flash_params->type_name = type_name;
flash_params->log2size = log2size;
+ memcpy(flash_info, &tmp_flash_info, sizeof(flash_info_t));
params_were_set = 1;
} else {
rc = compare_flash_params(flash_params, spi_sel, type_name, log2size); CHECK_RC(rc);
return MFE_OK;
}
+int mf_release_semaphore(mflash* mfl)
+{
+ return release_semaphore(mfl, 1);
+}
+
int release_semaphore(mflash* mfl, int ignore_writer_lock) {
int rc;
if (mfl->is_locked && mfl->f_lock && (!mfl->writer_lock || ignore_writer_lock)) {
}
-int is4_flash_init(mflash* mfl, flash_params_t* flash_params) {
-
+int is4_flash_init(mflash* mfl, flash_params_t* flash_params)
+{
mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_NO;
mfl->f_lock = is4_flash_lock;
return gen4_flash_init_com(mfl, flash_params, 0);
int mf_open_fw(mflash* mfl, flash_params_t* flash_params, int num_of_banks)
{
int rc;
- trm_sts trm_rc;
if (!mfl) {
return MFE_BAD_PARAMS;
}
if (mfl->access_type == MFAT_MFILE ) {
rc = get_dev_info(mfl); CHECK_RC(rc);
+#ifndef UEFI_BUILD
+ trm_sts trm_rc;
trm_rc = trm_create(&(mfl->trm), mfl->mf);
if (trm_rc) {
return trm2mfe_err(trm_rc);
}
+#endif
mfl->opts[MFO_NUM_OF_BANKS] = spi_get_num_of_flashes(num_of_banks);
rc = spi_update_num_of_banks(mfl, num_of_banks);CHECK_RC(rc);
return "MFE_CMDIF_TIMEOUT_ERR";
case MFE_CMDIF_GO_BIT_BUSY:
return "MFE_CMDIF_GO_BIT_BUSY";
+ case MFE_CMDIF_BAD_OP:
+ return "MFE_CMDIF_BAD_OP";
+ case MFE_MISSING_KEY:
+ return "No key was set";
case MFE_MISMATCH_KEY:
return "The given key is incorrect";
case MFE_UNKNOWN_REG:
}
}
+#ifndef UEFI_BUILD
int trm2mfe_err(trm_sts rc)
{
switch (rc) {
return MFE_ERROR;
}
}
+#endif
int mf_set_opt (mflash* mfl, MfOpt opt, int val) {
if ((int)opt < 0 || opt >= MFO_LAST) {
int rc;
rc = set_bank_int(mfl, bank_num); CHECK_RC(rc);
- if ( mfl->attr.vendor == FV_WINBOND && mfl->attr.type == FMT_WINBOND) {
+ if ( (mfl->attr.vendor == FV_WINBOND && mfl->attr.type == FMT_WINBOND) ||
+ (mfl->attr.vendor == FV_S25FLXXXX && mfl->attr.type == FMT_S25FL116K)) {
/*
* if we have 2 status registers, winbond are allowing us to write both of them
* in a single command WRSR status_reg1 located in MSB, status_reg2 after status_reg1
return MFE_NOT_SUPPORTED_OPERATION;
}
for (bank = 0; bank < mfl->attr.banks_num; bank++) {
- if (mfl->attr.vendor == FV_WINBOND) {
+ if (mfl->attr.vendor == FV_WINBOND || mfl->attr.vendor == FV_S25FLXXXX) {
rc = mf_read_modify_status_winbond(mfl, bank, 0, quad_en, QUAD_EN_OFFSET, 1); CHECK_RC(rc);
} else if (mfl->attr.vendor == FV_ST) {
rc = mf_read_modify_status_new(mfl, bank, SFC_RDNVR, SFC_WRNVR, !quad_en, QUAD_EN_OFFSET_ST, 1, 2); CHECK_RC(rc);
return MFE_NOT_SUPPORTED_OPERATION;
}
- if (mfl->attr.vendor == FV_WINBOND) {
+ if (mfl->attr.vendor == FV_WINBOND || mfl->attr.vendor == FV_S25FLXXXX) {
return mf_get_param_int(mfl, quad_en_p, SFC_RDSR2, QUAD_EN_OFFSET, 1, 1, 1);
} else if (mfl->attr.vendor == FV_ST) {
return mf_get_param_int(mfl, quad_en_p, SFC_RDNVR, QUAD_EN_OFFSET_ST, 1, 2, 0);
// We need to release the semaphore because we will not have any access to semaphore after disabling the HW access
rc = release_semaphore(mfl, 1); CHECK_RC(rc);
rc = tcif_hw_access(mfl->mf, 0, 1 /* Lock */);
- return (rc == ME_CMDIF_UNKN_TLV) ? MFE_MISMATCH_KEY : MError2MfError(rc);
+ // translate to operation specific errors
+ switch (rc) {
+ case ME_CMDIF_UNKN_TLV:
+ rc = MFE_MISMATCH_KEY;
+ break;
+ case ME_CMDIF_BAD_OP:
+ rc = MFE_MISSING_KEY;
+ break;
+ default:
+ rc = MError2MfError(rc);
+ break;
+ }
+ return rc;
#else
(void)mfl;
return MFE_NOT_SUPPORTED_OPERATION;
* Version: $Id: $
*
*/
-
#ifndef MFLASH_H
#define MFLASH_H
int mf_enable_hw_access(mflash* mfl, u_int64_t key);
int mf_disable_hw_access(mflash* mfl);
-int mf_release_semaphore();
+int mf_release_semaphore(mflash* mfl);
// get mfile object
mfile* mf_get_mfile(mflash* mfl);
case ME_CMDIF_UNKN_TLV:
return MFE_CMDIF_UNKN_TLV;
+ case ME_CMDIF_BAD_OP:
+ return MFE_CMDIF_BAD_OP;
default:
break;
}
* SOFTWARE.
*/
+/*
+ * mflash_inband.h
+ *
+ * Created on: Jul 6, 2011
+ * Author: mohammad
+ */
+
#ifndef MFLASH_COMMON_H_
#define MFLASH_COMMON_H_
#include "mflash_types.h"
#include "mflash_common_structs.h"
+
+#ifndef UEFI_BUILD
#include <tools_res_mgmt.h>
+#else
+typedef void* trm_ctx;
+#endif
// TODO: use: (int)log2((float)num)
#define NEAREST_POW2(num)\
MFE_CMDIF_TIMEOUT_ERR,
MFE_CMDIF_GO_BIT_BUSY,
MFE_CMDIF_UNKN_TLV,
+ MFE_CMDIF_BAD_OP,
MFE_MISMATCH_KEY,
+ MFE_MISSING_KEY,
MFE_UNKNOWN_REG,
MFE_DIRECT_FW_ACCESS_DISABLED,
MFE_MANAGED_SWITCH_NOT_SUPPORTED,
noinst_LIBRARIES = libmftutils.a
-libmftutils_a_SOURCES = mft_sig_handler.c errmsg.cpp
+libmftutils_a_SOURCES = mft_sig_handler.c errmsg.cpp calc_hw_crc.c mlarge_buffer.cpp
--- /dev/null
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "stdio.h"
+#include "string.h"
+#include <stdlib.h>
+
+#include "calc_hw_crc.h"
+
+u_int16_t crc16table2[256] = {
+ 0x0000, 0x1BA1, 0x3742, 0x2CE3, 0x6E84, 0x7525, 0x59C6, 0x4267,
+ 0xDD08, 0xC6A9, 0xEA4A, 0xF1EB, 0xB38C, 0xA82D, 0x84CE, 0x9F6F,
+ 0x1A01, 0x01A0, 0x2D43, 0x36E2, 0x7485, 0x6F24, 0x43C7, 0x5866,
+ 0xC709, 0xDCA8, 0xF04B, 0xEBEA, 0xA98D, 0xB22C, 0x9ECF, 0x856E,
+ 0x3402, 0x2FA3, 0x0340, 0x18E1, 0x5A86, 0x4127, 0x6DC4, 0x7665,
+ 0xE90A, 0xF2AB, 0xDE48, 0xC5E9, 0x878E, 0x9C2F, 0xB0CC, 0xAB6D,
+ 0x2E03, 0x35A2, 0x1941, 0x02E0, 0x4087, 0x5B26, 0x77C5, 0x6C64,
+ 0xF30B, 0xE8AA, 0xC449, 0xDFE8, 0x9D8F, 0x862E, 0xAACD, 0xB16C,
+ 0x6804, 0x73A5, 0x5F46, 0x44E7, 0x0680, 0x1D21, 0x31C2, 0x2A63,
+ 0xB50C, 0xAEAD, 0x824E, 0x99EF, 0xDB88, 0xC029, 0xECCA, 0xF76B,
+ 0x7205, 0x69A4, 0x4547, 0x5EE6, 0x1C81, 0x0720, 0x2BC3, 0x3062,
+ 0xAF0D, 0xB4AC, 0x984F, 0x83EE, 0xC189, 0xDA28, 0xF6CB, 0xED6A,
+ 0x5C06, 0x47A7, 0x6B44, 0x70E5, 0x3282, 0x2923, 0x05C0, 0x1E61,
+ 0x810E, 0x9AAF, 0xB64C, 0xADED, 0xEF8A, 0xF42B, 0xD8C8, 0xC369,
+ 0x4607, 0x5DA6, 0x7145, 0x6AE4, 0x2883, 0x3322, 0x1FC1, 0x0460,
+ 0x9B0F, 0x80AE, 0xAC4D, 0xB7EC, 0xF58B, 0xEE2A, 0xC2C9, 0xD968,
+ 0xD008, 0xCBA9, 0xE74A, 0xFCEB, 0xBE8C, 0xA52D, 0x89CE, 0x926F,
+ 0x0D00, 0x16A1, 0x3A42, 0x21E3, 0x6384, 0x7825, 0x54C6, 0x4F67,
+ 0xCA09, 0xD1A8, 0xFD4B, 0xE6EA, 0xA48D, 0xBF2C, 0x93CF, 0x886E,
+ 0x1701, 0x0CA0, 0x2043, 0x3BE2, 0x7985, 0x6224, 0x4EC7, 0x5566,
+ 0xE40A, 0xFFAB, 0xD348, 0xC8E9, 0x8A8E, 0x912F, 0xBDCC, 0xA66D,
+ 0x3902, 0x22A3, 0x0E40, 0x15E1, 0x5786, 0x4C27, 0x60C4, 0x7B65,
+ 0xFE0B, 0xE5AA, 0xC949, 0xD2E8, 0x908F, 0x8B2E, 0xA7CD, 0xBC6C,
+ 0x2303, 0x38A2, 0x1441, 0x0FE0, 0x4D87, 0x5626, 0x7AC5, 0x6164,
+ 0xB80C, 0xA3AD, 0x8F4E, 0x94EF, 0xD688, 0xCD29, 0xE1CA, 0xFA6B,
+ 0x6504, 0x7EA5, 0x5246, 0x49E7, 0x0B80, 0x1021, 0x3CC2, 0x2763,
+ 0xA20D, 0xB9AC, 0x954F, 0x8EEE, 0xCC89, 0xD728, 0xFBCB, 0xE06A,
+ 0x7F05, 0x64A4, 0x4847, 0x53E6, 0x1181, 0x0A20, 0x26C3, 0x3D62,
+ 0x8C0E, 0x97AF, 0xBB4C, 0xA0ED, 0xE28A, 0xF92B, 0xD5C8, 0xCE69,
+ 0x5106, 0x4AA7, 0x6644, 0x7DE5, 0x3F82, 0x2423, 0x08C0, 0x1361,
+ 0x960F, 0x8DAE, 0xA14D, 0xBAEC, 0xF88B, 0xE32A, 0xCFC9, 0xD468,
+ 0x4B07, 0x50A6, 0x7C45, 0x67E4, 0x2583, 0x3E22, 0x12C1, 0x0960};
+
+u_int16_t calc_hw_crc(u_int8_t* d, int size) {
+ int i;
+ u_int8_t* data = (u_int8_t*) malloc(sizeof(u_int8_t) * size);
+
+ memcpy(data, d, size);
+ data[0] = ~data[0];
+ data[1] = ~data[1];
+
+ unsigned crc = 0xffff;
+ for (i = 0; i < size; i++) {
+ int table_index = ((crc ^ data[i]) & 0xff);
+ crc = ((crc >> 8) ^ crc16table2[table_index]);
+ };
+ crc = ((crc << 8) & 0xff00) | ((crc >> 8) & 0xff);
+
+ free(data);
+ return crc;
+}
--- /dev/null
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef MFT_CALC_HW_CRC
+#define MFT_CALC_HW_CRC
+
+#include <tools_utils.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+u_int16_t calc_hw_crc(u_int8_t* data, int size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
s_interrupt_message = msg;
}
+void mft_restore_and_raise()
+{
+ int sig;
+ sig = mft_signal_is_fired();
+ if (sig) {
+ // reset recieved signal
+ mft_signal_set_fired(0);
+ // retore prev handler
+ mft_signal_set_handling(0);
+ //raise signal to let the previous handle deal with it.
+ raise(sig);
+ }
+ mft_signal_set_handling(0);
+ return;
+}
*/
void mft_signal_set_msg(char* msg);
+/**
+ * @brief Deal with signals, if got signal - raise, otherwise restore it
+ */
+void mft_restore_and_raise();
#ifdef __cplusplus
}
#endif
--- /dev/null
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ *
+ * mlarge_buffer.cpp
+ *
+ * Created on: Mar 9, 2016
+ * Author: adrianc
+ */
+
+#include <string.h>
+
+#include "mlarge_buffer.h"
+
+
+#define MFT_MIN(x,y) ((x) < (y) ? (x) : (y))
+#define MFT_MAX(x,y) ((x) > (y) ? (x) : (y))
+
+#ifdef _DEBUG_MODE
+#define DBG_PRINTF(...) fprintf(stderr, __VA_ARGS__)
+#else
+#define DBG_PRINTF(...)
+#endif
+
+MBufferUnit& operator <<(MBufferUnit& a, MBufferUnit& b)
+{
+ if (!a.intersects(b) ) {
+ return a;
+ }
+ u_int32_t newSize = MFT_MAX(a.offset() + a.size(), b.offset() + b.size()) - MFT_MIN(a.offset(), b.offset());
+ u_int32_t newOffset = MFT_MIN(a.offset(), b.offset());
+ std::vector<u_int8_t> newData(newSize, 0);
+
+ // merge b onto a
+ u_int32_t relativeOffsInBuffer = a.offset() - newOffset;
+ memcpy(&newData[0] + relativeOffsInBuffer, &(a.data()[0]), a.size());
+ relativeOffsInBuffer = b.offset() - newOffset;
+ memcpy(&newData[0] + relativeOffsInBuffer, &(b.data()[0]), b.size());
+ a = MBufferUnit(newData, newOffset);
+ return a;
+}
+
+MBufferUnit& MBufferUnit::operator=(const MBufferUnit& other)
+{
+ if (this != &other) {
+ this->_data = other._data;
+ this->_offset = other._offset;
+ }
+ return *this;
+}
+
+bool MBufferUnit::intersects( const MBufferUnit& other) const
+{
+ if (this->offset() > (other.offset() + other.size()) || (this->offset() + this->size()) < other.offset() ) {
+ return false;
+ }
+ return true;
+}
+
+void MlargeBuffer::add(const std::vector<u_int8_t>& data, u_int32_t offset)
+{
+ if (data.size() == 0) {
+ return;
+ }
+ DBG_PRINTF("-D- adding chunk: 0x%08x - 0x%08x (0x%08x)\n", offset, (unsigned)data.size() + offset, (unsigned)data.size());
+ // create MBufferUnit
+ MBufferUnit bufferUnit(data, offset);
+ bool unitInserted = false;
+ bool unitIntersects = false;
+ unsigned intersecIdx = 0;
+ unsigned bSize = _bData.size();
+ for (unsigned idx = 0; idx < bSize; idx++) {
+ if (unitIntersects) {
+ if (_bData[idx].intersects(_bData[intersecIdx])) {
+ // merge element in intersecIdx onto it
+ _bData[idx] << _bData[intersecIdx];
+ _bData.erase(_bData.begin() + intersecIdx);
+ intersecIdx = --idx;
+ bSize--;
+ } else {
+ break; // done :)
+ }
+ }else if (bufferUnit.offset() + bufferUnit.size() <_bData[idx].offset()) {// check if we can insert before
+ _bData.insert(_bData.begin() + idx, bufferUnit);
+ unitInserted = true;
+ break;
+ } else if (bufferUnit.intersects(_bData[idx])) {
+ unitIntersects = true;
+ unitInserted = true;
+ _bData[idx] << bufferUnit;
+ intersecIdx = idx;
+ continue;
+ }
+ }
+
+ if (!unitInserted) {
+ _bData.push_back(bufferUnit);
+ }
+ DBG_PRINTF("-D- bData size: %d\n", (int)_bData.size());
+
+#ifdef _DEBUG_MODE
+ std::vector<MBufferUnit>::iterator it = _bData.begin();
+ for (; it != _bData.end(); it++) {
+ DBG_PRINTF("-D- chunk : 0x%08x - 0x%08x (0x%08x)\n", it->offset(), it->size() + it->offset(), it->size());
+ }
+#endif
+}
+void MlargeBuffer::add(const u_int8_t* data, u_int32_t offset, u_int32_t size)
+{
+ std::vector<u_int8_t> dataVec(data, data+size);
+ return add(dataVec, offset);
+}
+
+u_int8_t MlargeBuffer::operator[] (const u_int32_t offset)
+{
+ u_int8_t data;
+ get(&data, offset, 1);
+ return data;
+}
+void MlargeBuffer::get(std::vector<u_int8_t>& data, u_int32_t offset, u_int32_t size)
+{
+ data.resize(size);
+ return get(&data[0], offset, size);
+}
+
+void MlargeBuffer::get(u_int8_t* data, u_int32_t offset, u_int32_t size)
+{
+ DBG_PRINTF("-D- get request on offset: 0x%08x with size 0x%x\n", offset, size);
+ if (!data || size == 0) {
+ return;
+ }
+ memset(data, _defaultValue, size);
+ u_int8_t* ptr = data;
+ for (std::vector<MBufferUnit>::iterator it = _bData.begin(); it != _bData.end(); it++) {
+ if (offset < (it->offset() + it->size()) && (offset + size) > it->offset()) {
+ // intersects with current MBufferUnit
+ u_int32_t offsetInBuffer = ((long int)it->offset() - (long int)offset) < 0 ? 0 : it->offset() - offset;
+ u_int32_t copySize = MFT_MIN(offset + size, it->offset() + it->size()) - MFT_MAX(offset, it->offset());
+ u_int32_t offsetInData = ((long int)offset - (long int)it->offset()) < 0 ? 0 : offset - it->offset();
+ DBG_PRINTF("-D- getting from chunk at offset 0x%08x , size: 0x%x\n", it->offset(), (unsigned)it->size() );
+ DBG_PRINTF("-D- integrating at buffer offset : 0x%08x size: 0x%x, offset in data: 0x%08x\n", offsetInBuffer, copySize, offsetInData);
+ memcpy(ptr + offsetInBuffer, &(it->data())[0] + offsetInData , copySize);
+ }
+ }
+ return;
+}
--- /dev/null
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ *
+ * mlarge_buffer.h
+ *
+ * Created on: Mar 9, 2016
+ * Author: adrianc
+ */
+
+#ifndef USER_MFT_UTILS_MLARGE_BUFFER_H_
+#define USER_MFT_UTILS_MLARGE_BUFFER_H_
+
+#include <vector>
+
+#include <compatibility.h>
+
+class MBufferUnit {
+public:
+ MBufferUnit(const std::vector<u_int8_t>& data, u_int32_t offset) : _data(data), _offset(offset) {}
+ u_int32_t size() const {return (u_int32_t)_data.size();}
+ u_int32_t offset() const {return _offset;}
+ std::vector<u_int8_t>& data() { return _data; }
+ u_int8_t& operator[] (const u_int32_t idx) { return _data[idx]; }
+ MBufferUnit& operator=(const MBufferUnit& other);
+ bool intersects( const MBufferUnit& other) const;
+private:
+ std::vector<u_int8_t> _data;
+ u_int32_t _offset;
+};
+
+MBufferUnit& operator<<(MBufferUnit& a, MBufferUnit& b);
+
+/*
+ * Large buffer with minimal memory footprint
+ */
+class MlargeBuffer {
+public:
+ MlargeBuffer(u_int8_t defaultVal = 0x0) : _defaultValue(defaultVal){}
+ void add(const std::vector<u_int8_t>& data, u_int32_t offset);
+ void add(const u_int8_t* data, u_int32_t offset, u_int32_t size);
+ u_int8_t operator[] (const u_int32_t offset); // for read only
+ void get(std::vector<u_int8_t>& data, u_int32_t offset, u_int32_t size);
+ void get(std::vector<u_int8_t>& data, u_int32_t size) {return get(data, 0, size);}
+ void get(u_int8_t* data, u_int32_t offset, u_int32_t size);
+ void get(u_int8_t* data, u_int32_t size) {return get(data, 0, size);}
+private:
+ u_int8_t _defaultValue;
+ std::vector<MBufferUnit> _bData;
+};
+
+#endif /* USER_MFT_UTILS_MLARGE_BUFFER_H_ */
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
+ */
+/*
+ * mlxcfg_lib.cpp
*
+ * Created on: Feb 17, 2014
+ * Author: adrianc
*/
#include <set>
return errmsg(MCE_UNSUPPORTED_DEVICE);
}
+ if(dm_is_livefish_mode(mf)) {
+ return errmsg("Device in Livefish mode is not supported.");
+ }
+
// init _cfgList, _param2TypeMap
if (_isFifthGen) {
// Wake On LAN
_cfgList[Mct_Boot_Settings_Extras_5thGen] = new BootSettingsExtParams5thGen();
_param2TypeMap[Mcp_Boot_Settings_Ext_IP_Ver] = Mct_Boot_Settings_Extras_5thGen;
+ _cfgList[Mct_QoS_P1] = new QoS(1);
+ _cfgList[Mct_QoS_P2] = new QoS(2);
+ _param2TypeMap[Mcp_QoS_Num_of_TC_P1] = Mct_QoS_P1;
+ _param2TypeMap[Mcp_QoS_Num_of_VL_P1] = Mct_QoS_P1;
+ _param2TypeMap[Mcp_QoS_Num_of_TC_P2] = Mct_QoS_P2;
+ _param2TypeMap[Mcp_QoS_Num_of_VL_P2] = Mct_QoS_P2;
+
+ _cfgList[Mct_LLDP_Client_Settings_P1] = new LLDPClientSettings(1);
+ _cfgList[Mct_LLDP_Client_Settings_P2] = new LLDPClientSettings(2);
+ _param2TypeMap[Mcp_LLDP_NB_RX_Mode_P1] = Mct_LLDP_Client_Settings_P1;
+ _param2TypeMap[Mcp_LLDP_NB_TX_Mode_P1] = Mct_LLDP_Client_Settings_P1;
+ _param2TypeMap[Mcp_LLDP_NB_DCBX_P1] = Mct_LLDP_Client_Settings_P1;
+ _param2TypeMap[Mcp_LLDP_NB_RX_Mode_P2] = Mct_LLDP_Client_Settings_P2;
+ _param2TypeMap[Mcp_LLDP_NB_TX_Mode_P2] = Mct_LLDP_Client_Settings_P2;
+ _param2TypeMap[Mcp_LLDP_NB_DCBX_P2] = Mct_LLDP_Client_Settings_P2;
+
+ _cfgList[Mct_DCBX_P1] = new DCBX(1);
+ _cfgList[Mct_DCBX_P2] = new DCBX(2);
+ _param2TypeMap[Mcp_DCBX_IEEE_EN_P1] = Mct_DCBX_P1;
+ _param2TypeMap[Mcp_DCBX_CEE_EN_P1] = Mct_DCBX_P1;
+ _param2TypeMap[Mcp_DCBX_WILLING_P1] = Mct_DCBX_P1;
+ _param2TypeMap[Mcp_DCBX_IEEE_EN_P2] = Mct_DCBX_P2;
+ _param2TypeMap[Mcp_DCBX_CEE_EN_P2] = Mct_DCBX_P2;
+ _param2TypeMap[Mcp_DCBX_WILLING_P2] = Mct_DCBX_P2;
+
} else {
// SR-IOV
_cfgList[Mct_Sriov] = new SriovParams4thGen();
return MCE_SUCCESS;
}
-int MlxCfgOps::setCfg(const std::vector<cfgInfo>& infoVec)
+int MlxCfgOps::setCfg(const std::vector<cfgInfo>& infoVec, mlxCfgParam& failedParam)
{
// set params
std::set<CfgParams*> CfgToSet;
return MCE_BAD_PARAMS;
}
if (!supportsParam(it->first)) {
+ failedParam = it->first;
return errmsg(MCE_UNSUPPORTED_CFG);
}
// get configuration from device first (if preset) in case of multiple params per type
return MCE_SUCCESS;
}
+int MlxCfgOps::backupCfgs(vector< pair< u_int32_t, vector<u_int8_t> > >& cfgsMap)
+{
+ int rc;
+ int status = 0;
+ u_int32_t ptr = 0;
+ struct tools_open_mnvgn mnvgnTlv;
+ do {
+ memset(&mnvgnTlv, 0, sizeof(struct tools_open_mnvgn));
+ mnvgnTlv.nv_pointer = ptr;
+ mft_signal_set_handling(1);
+ rc = reg_access_mnvgn(_mf, REG_ACCESS_METHOD_GET, &mnvgnTlv, &status);
+ dealWithSignal();
+ if (rc) {
+ if(status == ME_NOT_IMPLEMENTED) {
+ return errmsg("Firmware does not support backup command");
+ }
+ return errmsg("failed to backup configurations, %s.", m_err2str((MError)rc));
+ }
+ ptr = mnvgnTlv.nv_pointer;
+ if (ptr != 0) {
+ u_int32_t k = mnvgnTlv.nv_hdr.type.tlv_type_dw.tlv_type_dw;
+ vector<u_int8_t> v;
+ v.resize(TOOLS_OPEN_NV_HDR_FIFTH_GEN_SIZE + mnvgnTlv.nv_hdr.length);
+ //Copy header:
+ tools_open_nv_hdr_fifth_gen_pack(&mnvgnTlv.nv_hdr, v.data());
+ //Copy data:
+ memcpy(v.data() + TOOLS_OPEN_NV_HDR_FIFTH_GEN_SIZE,
+ &mnvgnTlv.nv_data,
+ mnvgnTlv.nv_hdr.length);
+ cfgsMap.push_back(make_pair(k, v));
+ }
+ } while (ptr != 0);
+
+ return rc;
+}
+
bool MlxCfgOps::isLegal(mlxCfgType cfg)
{
if (_cfgList.find(cfg) != _cfgList.end()) {
int MlxCfgOps::setRawCfg(std::vector<u_int32_t> rawTlvVec)
{
if (!_isFifthGen) {
- return errmsg("Setting Raw Configuration is supported for 5th Generation devices only.");
+ return errmsg("Setting Raw Configuration is supported for " FIFTH_GENERATION_LIST " devices only.");
}
RawCfgParams5thGen rawTlv;
if (rawTlv.setRawData(rawTlvVec)) {
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
+ */
+/*
+ * mlxcfg_lib.h
*
+ * Created on: Feb 17, 2014
+ * Author: adrianc
*/
#ifndef MLXCFG_LIB_H_
#include "mlxcfg_status.h"
#include "mlxcfg_param_lib.h"
+#define FIFTH_GENERATION_LIST "Connect-IB/Connect-X4/LX"
+#define FOURTH_GENERATION_LIST "ConnectX3/Pro"
+
class MlxCfgOps : public ErrMsg {
public:
MlxCfgOps();
int getCfg(std::vector<cfgInfo>& infoVec);
int setCfg(mlxCfgParam cfgParam, u_int32_t val);
- int setCfg(const std::vector<cfgInfo>& infoVec);
+ int setCfg(const std::vector<cfgInfo>& infoVec, mlxCfgParam& cfgParam);
int setRawCfg(std::vector<u_int32_t> rawTlvVec);
int isDefaultSupported(bool &defaultSupported);
+ int backupCfgs(std::vector<std::pair<u_int32_t, std::vector<u_int8_t> > >& cfgs);
+
private:
int openComChk();
int supportsToolsHCR();
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
+ */
+/*
+ * mlxcfg_param_lib.cpp
*
+ * Created on: Mar 22, 2015
+ * Author: adrianc
*/
#include <signal.h>
return false;
}
- if ( _rpgTimeReset >= (1 << 16)) {
- errmsg("Illegal RPG_TIME_RESET_P%d parameter value(%d), value should be [0..%d]", _port, _rpgTimeReset, (1 << 16) - 1);
+ if ( _rpgTimeReset >= (1 << 17)) {
+ errmsg("Illegal RPG_TIME_RESET_P%d parameter value(%d), value should be [0..%d]", _port, _rpgTimeReset, (1 << 17) - 1);
return false;
}
- if (_rpgByteReset >= (1 << 14)) {
- errmsg("Illegal RPG_BYTE_RESET_P%d parameter value(%d), value should be [0..%d]", _port, _rpgByteReset, (1 << 14) - 1);
+ if (_rpgByteReset >= (1 << 15)) {
+ errmsg("Illegal RPG_BYTE_RESET_P%d parameter value(%d), value should be [0..%d]", _port, _rpgByteReset, (1 << 15) - 1);
return false;
}
- if (_rpgThreshold >= (1 << 4)) {
- errmsg("Illegal RPG_THRESHOLD_P%d parameter value(%d), value should be [0..%d]", _port, _rpgThreshold, (1 << 4) - 1);
+ if (_rpgThreshold >= (1 << 5)) {
+ errmsg("Illegal RPG_THRESHOLD_P%d parameter value(%d), value should be [0..%d]", _port, _rpgThreshold, (1 << 5) - 1);
return false;
}
- if ( _rpgAiRate >= (1 << 16)) {
- errmsg("Illegal RPG_AI_RATE_P%d parameter value(%d), value should be [0..%d]", _port, _rpgAiRate, (1 << 16) - 1);
+ if ( _rpgAiRate >= (1 << 17)) {
+ errmsg("Illegal RPG_AI_RATE_P%d parameter value(%d), value should be [0..%d]", _port, _rpgAiRate, (1 << 17) - 1);
return false;
}
- if ( _rpgHaiRate >= (1 << 16)) {
- errmsg("Illegal RPG_HAI_RATE_P%d parameter value(%d), value should be [0..%d]", _port, _rpgHaiRate, (1 << 16) - 1);
+ if ( _rpgHaiRate >= (1 << 17)) {
+ errmsg("Illegal RPG_HAI_RATE_P%d parameter value(%d), value should be [0..%d]", _port, _rpgHaiRate, (1 << 17) - 1);
return false;
}
return false;
}
- if (_rpgMinRate >= (1 << 16)) {
- errmsg("Illegal RPG_MIN_RATE_P%d parameters value(%d), value should be [1..%d]", _port, _rpgMinRate, (1 << 16) - 1);
+ if (_rpgMinRate >= (1 << 17)) {
+ errmsg("Illegal RPG_MIN_RATE_P%d parameters value(%d), value should be [0..%d]", _port, _rpgMinRate, (1 << 17) - 1);
return false;
}
- if (_rateToSetOnFirstCnp >= (1 << 16)) {
- errmsg("Illegal RATE_TO_SET_ON_FIRST_CNP_P%d parameters value(%d), value should be [1..%d]", _port, _rateToSetOnFirstCnp, (1 << 16) - 1);
+ if (_rateToSetOnFirstCnp >= (1 << 17)) {
+ errmsg("Illegal RATE_TO_SET_ON_FIRST_CNP_P%d parameters value(%d), value should be [0..%d]", _port, _rateToSetOnFirstCnp, (1 << 17) - 1);
return false;
}
- if (_dceTcpG >= (1 << 9)) {
- errmsg("Illegal DCE_TCP_G_P%d parameters value(%d), value should be [1..%d]", _port, _dceTcpG, (1 << 9) - 1);
+ if (_dceTcpG == 0 || _dceTcpG >= (1 << 10)) {
+ errmsg("Illegal DCE_TCP_G_P%d parameters value(%d), value should be [1..%d]", _port, _dceTcpG, (1 << 10) - 1);
return false;
}
- if (_dceTcpRtt >= (1 << 16)) {
- errmsg("Illegal DCE_TCP_RTT_P%d parameters value(%d), value should be [1..%d]", _port, _dceTcpRtt, (1 << 16) - 1);
+ if (_dceTcpRtt == 0 || _dceTcpRtt >= (1 << 17)) {
+ errmsg("Illegal DCE_TCP_RTT_P%d parameters value(%d), value should be [1..%d]", _port, _dceTcpRtt, (1 << 17) - 1);
return false;
}
- if (_rateReduceMonitorPeriod >= (1 << 16)) {
- errmsg("Illegal RATE_REDUCE_MONITOR_PERIOD_P%d parameters value(%d), value should be [1..%d]", _port, _rateReduceMonitorPeriod, (1 << 16) - 1);
+ if (_rateReduceMonitorPeriod == 0 || _rateReduceMonitorPeriod >= (1 << 17)) {
+ errmsg("Illegal RATE_REDUCE_MONITOR_PERIOD_P%d parameters value(%d), value should be [1..%d]", _port, _rateReduceMonitorPeriod, (1 << 17) - 1);
return false;
}
- if (_initialAlphaValue >= (1 << 9)) {
- errmsg("Illegal INITIAL_ALPHA_VALUE_P%d parameters value(%d), value should be [1..%d]", _port, _initialAlphaValue, (1 << 9) - 1);
+ if (_initialAlphaValue >= (1 << 10)) {
+ errmsg("Illegal INITIAL_ALPHA_VALUE_P%d parameters value(%d), value should be [0..%d]", _port, _initialAlphaValue, (1 << 10) - 1);
return false;
}
- if (_minTimeBetweenCnps >= (1 << 16)) {
- errmsg("Illegal MIN_TIME_BETWEEN_CNPS_P%d parameters value(%d), value should be [1..%d]", _port, _minTimeBetweenCnps, (1 << 16) - 1);
+ if (_minTimeBetweenCnps >= (1 << 17)) {
+ errmsg("Illegal MIN_TIME_BETWEEN_CNPS_P%d parameters value(%d), value should be [0..%d]", _port, _minTimeBetweenCnps, (1 << 17) - 1);
return false;
}
- if (_cnpDscp > 7) {
- errmsg("Illegal CNP_DSCP_P%d parameters value(%d), value should be [0..7]", _port, _cnpDscp);
+ if (_cnpDscp >= (1 << 6)) {
+ errmsg("Illegal CNP_DSCP_P%d parameters value(%d), value should be [0..%d]", _port, _cnpDscp, (1 << 6) - 1);
return false;
}
- if (_cnp802pPrio >= (1 << 6)) {
- errmsg("Illegal CNP_802P_PRIO_P%d parameters value(%d), value should be [1..%d]", _port, _cnp802pPrio, (1 << 6) - 1);
+ if (_cnp802pPrio >= (1 << 3)) {
+ errmsg("Illegal CNP_802P_PRIO_P%d parameters value(%d), value should be [0..%d]", _port, _cnp802pPrio, (1 << 3) - 1);
return false;
}
return true;
return;
}
+/*
+ * QoS Class implementation
+ */
+
+bool QoS::cfgSupported(mfile* mf, mlxCfgParam param)
+{
+ MError rc;
+ (void)param;
+ bool suppRead, suppWrite;
+ rc = nvqcCom5thGen(mf, getTlvTypeBe(), suppRead, suppWrite);
+ if (rc) {
+ errmsg("Failed to get QoS capabilities. %s", m_err2str(rc));
+ return false;
+ }
+ if (!suppRead || !suppWrite) {
+ return false;
+ }
+
+ if (!getCap(mf)) {
+ return false;
+ }
+
+ return true;
+}
+
+void QoS::setParam(mlxCfgParam paramType, u_int32_t val)
+{
+ if (paramType == Mcp_QoS_Num_of_TC_P1 || paramType == Mcp_QoS_Num_of_TC_P2) {
+ _numOfTC = val;
+ }
+
+ if (paramType == Mcp_QoS_Num_of_VL_P1 || paramType == Mcp_QoS_Num_of_VL_P2) {
+ _numOfVL = val;
+ }
+ return;
+}
+
+u_int32_t QoS::getParam(mlxCfgParam paramType)
+{
+ if (paramType == Mcp_QoS_Num_of_TC_P1 || paramType == Mcp_QoS_Num_of_TC_P2) {
+ return _numOfTC;
+ }
+ if (paramType == Mcp_QoS_Num_of_VL_P1 || paramType == Mcp_QoS_Num_of_VL_P2) {
+ return _numOfVL;
+ }
+ return MLXCFG_UNKNOWN;
+}
+
+u_int32_t QoS::getDefaultParam(mlxCfgParam paramType)
+{
+ if (paramType == Mcp_QoS_Num_of_TC_P1 || paramType == Mcp_QoS_Num_of_TC_P2) {
+ return _numOfTCDefault;
+ }
+ if (paramType == Mcp_QoS_Num_of_VL_P1 || paramType == Mcp_QoS_Num_of_VL_P2) {
+ return _numOfVLDefault;
+ }
+ return MLXCFG_UNKNOWN;
+}
+
+void QoS::setParams(u_int32_t numOfTC, u_int32_t numOfVL)
+{
+ _numOfTC = numOfTC;
+ _numOfVL = numOfVL;
+}
+
+void QoS::updateClassAttrFromDefaultParams()
+{
+ setParams(
+ _numOfTC,
+ _numOfVL);
+}
+
+int QoS::getFromDev(mfile* mf)
+{
+ GET_FROM_DEV_5TH_GEN(mf, tools_open_qos, "QoS Conf");
+}
+
+int QoS::setOnDev(mfile* mf, bool ignoreCheck)
+{
+ SET_ON_DEV_5TH_GEN(mf, ignoreCheck, tools_open_qos, "QoS Conf");
+}
+
+int QoS::getDefaultParams(mfile* mf)
+{
+ GET_DEFAULT_5TH_GEN(mf, tools_open_qos, "QoS Conf");
+}
+
+bool QoS::getCap(mfile *mf)
+{
+ MError rc;
+ u_int8_t tlvCapBuff[TOOLS_OPEN_QOS_CAP_SIZE] = {0};
+ struct tools_open_qos_cap qosCapTlv;
+ memset(&qosCapTlv, 0, sizeof(qosCapTlv));
+ rc = mnvaCom5thGen(mf, &tlvCapBuff[0], TOOLS_OPEN_QOS_CAP_SIZE, getQoSCapTlvTypeBe(), REG_ACCESS_METHOD_GET);
+ if (rc) {
+ return false;
+ }
+ tools_open_qos_cap_unpack(&qosCapTlv, tlvCapBuff);
+ _maxNumOfTC = qosCapTlv.max_num_of_tc;
+ _maxNumOfVL = qosCapTlv.max_num_of_vl;
+ return true;
+}
+
+bool QoS::hardLimitCheckAux(u_int32_t maxNumOfX, u_int32_t numOfX,const char *x)
+{
+ u_int32_t minVal;
+ u_int32_t maxVal;
+ // 0 and 8 have the same maxNumOfX meaning (they both indicate max 8 TCs which translates to the value 0)
+ minVal = (maxNumOfX == 0 || maxNumOfX >= 8) ? 0 : 1;
+ maxVal = (maxNumOfX == 0 || maxNumOfX == 8) ? 7 : maxNumOfX;
+ if ((numOfX < minVal) || numOfX > maxVal) {
+ errmsg("Illegal %s parameter value(%d), max allowed value is (%d), min allowed value is (%d)",
+ x,
+ numOfX,
+ maxVal,
+ minVal);
+ return false;
+ }
+
+ return true;
+}
+
+bool QoS::hardLimitCheck()
+{
+ if(!hardLimitCheckAux(_maxNumOfTC, _numOfTC, _port == 1 ? "NUM_OF_TC_P1" : "NUM_OF_TC_P2")) {
+ return false;
+ }
+
+ if(_numOfVL < 1 || _numOfVL > _maxNumOfVL){
+ errmsg("Illegal %s parameter value(%x), max allowed value is (%x), min allowed value is (%x)",
+ _port == 1 ? "NUM_OF_VL_P1" : "NUM_OF_VL_P2",
+ _numOfVL,
+ _maxNumOfVL,
+ 1);
+ return false;
+ }
+
+ return true;
+}
+
+u_int32_t QoS::getTlvTypeBe()
+{
+ struct tools_open_per_port_type type;
+ u_int32_t tlvType = 0;
+ type.param_class = CLASS_PHYS_PORT;
+ type.param_idx = tlvTypeIdx;
+ type.port = _port;
+ tools_open_per_port_type_pack(&type, (u_int8_t*)&tlvType);
+ return tlvType;
+}
+
+void QoS::updateTlvFromClassAttr(void* tlv)
+{
+ struct tools_open_qos* qosPortTlv = (struct tools_open_qos*)tlv;
+ qosPortTlv->num_of_tc = _numOfTC;
+ qosPortTlv->num_of_vl = _numOfVL;
+ return;
+}
+
+void QoS::updateClassAttrFromTlv(void* tlv)
+{
+ struct tools_open_qos* qosPortTlv = (struct tools_open_qos*)tlv;
+ _numOfTC = qosPortTlv->num_of_tc;
+ _numOfVL = qosPortTlv->num_of_vl;
+ return;
+}
+
+void QoS::updateClassDefaultAttrFromTlv(void* tlv)
+{
+ struct tools_open_qos* qosPortTlv = (struct tools_open_qos*)tlv;
+ _numOfTCDefault = qosPortTlv->num_of_tc;
+ _numOfVLDefault = qosPortTlv->num_of_vl;
+ return;
+}
+
+u_int32_t QoS::getQoSCapTlvTypeBe()
+{
+ struct tools_open_per_port_type type;
+ u_int32_t tlvType = 0;
+ type.param_class = CLASS_PHYS_PORT;
+ type.param_idx = QOS_CAP;
+ type.port = _port;
+ tools_open_per_port_type_pack(&type, (u_int8_t*)&tlvType);
+ return tlvType;
+}
+
+
+/*
+ * LLDP Client Settings Class implementation
+ */
+
+bool LLDPClientSettings::cfgSupported(mfile* mf, mlxCfgParam param)
+{
+ MError rc;
+ (void)param;
+ bool suppRead, suppWrite;
+ rc = nvqcCom5thGen(mf, getTlvTypeBe(), suppRead, suppWrite);
+ if (rc) {
+ errmsg("Failed to get LLDP Client Settings capabilities. %s", m_err2str(rc));
+ return false;
+ }
+ if (!suppRead || !suppWrite) {
+ return false;
+ }
+
+ if (!getCap(mf)) {
+ return false;
+ }
+
+ return true;
+}
+
+void LLDPClientSettings::setParam(mlxCfgParam paramType, u_int32_t val)
+{
+ if (paramType == Mcp_LLDP_NB_RX_Mode_P1|| paramType == Mcp_LLDP_NB_RX_Mode_P2) {
+ _userSpecifiedRx = true;
+ _lldpNbRxMode = val;
+ }
+ if (paramType == Mcp_LLDP_NB_TX_Mode_P1|| paramType == Mcp_LLDP_NB_TX_Mode_P2) {
+ _userSpecifiedTx = true;
+ _lldpNbTxMode = val;
+ }
+ if (paramType == Mcp_LLDP_NB_DCBX_P1|| paramType == Mcp_LLDP_NB_DCBX_P2) {
+ _userSpecifiedDcbx = true;
+ _lldpNbDcbx = val;
+ }
+ return;
+}
+
+u_int32_t LLDPClientSettings::getParam(mlxCfgParam paramType)
+{
+ if (paramType == Mcp_LLDP_NB_RX_Mode_P1|| paramType == Mcp_LLDP_NB_RX_Mode_P2) {
+ return _lldpNbRxMode;
+ }
+ if (paramType == Mcp_LLDP_NB_TX_Mode_P1|| paramType == Mcp_LLDP_NB_TX_Mode_P2) {
+ return _lldpNbTxMode;
+ }
+ if (paramType == Mcp_LLDP_NB_DCBX_P1|| paramType == Mcp_LLDP_NB_DCBX_P2) {
+ return _lldpNbDcbx;
+ }
+ return MLXCFG_UNKNOWN;
+}
+
+u_int32_t LLDPClientSettings::getDefaultParam(mlxCfgParam paramType)
+{
+ if (paramType == Mcp_LLDP_NB_RX_Mode_P1|| paramType == Mcp_LLDP_NB_RX_Mode_P2) {
+ return _lldpNbRxModeDefault;
+ }
+ if (paramType == Mcp_LLDP_NB_TX_Mode_P1|| paramType == Mcp_LLDP_NB_TX_Mode_P2) {
+ return _lldpNbTxModeDefault;
+ }
+ if (paramType == Mcp_LLDP_NB_DCBX_P1|| paramType == Mcp_LLDP_NB_DCBX_P2) {
+ return _lldpNbDcbxDefault;
+ }
+ return MLXCFG_UNKNOWN;
+}
+
+void LLDPClientSettings::setParams(u_int32_t lldpNbRxMode, u_int32_t lldpNbTxMode, u_int32_t lldpNbDcbx)
+{
+ _lldpNbRxMode = lldpNbRxMode;
+ _lldpNbTxMode = lldpNbTxMode;
+ _lldpNbDcbx = lldpNbDcbx;
+}
+
+void LLDPClientSettings::updateClassAttrFromDefaultParams()
+{
+ setParams(
+ _lldpNbRxModeDefault,
+ _lldpNbTxModeDefault,
+ _lldpNbDcbxDefault);
+}
+
+int LLDPClientSettings::getFromDev(mfile* mf)
+{
+ GET_FROM_DEV_5TH_GEN(mf, tools_open_lldp_client_settings, "LLDP Client Settings");
+}
+
+int LLDPClientSettings::setOnDev(mfile* mf, bool ignoreCheck)
+{
+ SET_ON_DEV_5TH_GEN(mf, ignoreCheck, tools_open_lldp_client_settings, "LLDP Client Settings");
+}
+
+int LLDPClientSettings::getDefaultParams(mfile* mf)
+{
+ GET_DEFAULT_5TH_GEN(mf, tools_open_lldp_client_settings, "LLDP Client Settings");
+}
+
+bool LLDPClientSettings::getCap(mfile *mf)
+{
+ MError rc;
+ u_int8_t tlvCapBuff[TOOLS_OPEN_LLDP_NB_CAP_SIZE] = {0};
+ struct tools_open_lldp_nb_cap lldpNbCapTlv;
+ memset(&lldpNbCapTlv, 0, sizeof(lldpNbCapTlv));
+ rc = mnvaCom5thGen(mf, &tlvCapBuff[0], TOOLS_OPEN_LLDP_NB_CAP_SIZE, getLLDPNBCapTlvTypeBe(), REG_ACCESS_METHOD_GET);
+ if (rc) {
+ return false;
+ }
+ tools_open_lldp_nb_cap_unpack(&lldpNbCapTlv, tlvCapBuff);
+ _lldpNbTxCap = lldpNbCapTlv.lldp_nb_tx_cap;
+ _lldpNbRxCap = lldpNbCapTlv.lldp_nb_rx_cap;
+ _lldpNbDcbxEn = lldpNbCapTlv.lldp_nb_dcbx_en;
+ return true;
+}
+
+bool LLDPClientSettings::hardLimitCheck()
+{
+ if (_userSpecifiedRx && _lldpNbRxCap == 0) {
+ errmsg("The LLDP_NB_RX_MODE parameter cannot be set");
+ return false;
+ }
+
+ if (_lldpNbRxMode > _lldpNbRxCap) {
+ errmsg("Illegal LLDP_NB_RX_MODE parameter value(%d), max allowed value is (%d)", _lldpNbRxMode, _lldpNbRxCap);
+ return false;
+ }
+
+ if (_userSpecifiedTx && _lldpNbTxCap == 0) {
+ errmsg("The LLDP_NB_TX_MODE parameter cannot be set");
+ return false;
+ }
+
+ if (_lldpNbTxMode > _lldpNbTxCap) {
+ errmsg("Illegal LLDP_NB_TX_MODE parameter value(%d), max allowed value is (%d)", _lldpNbTxMode, _lldpNbTxCap);
+ return false;
+ }
+
+ if (_userSpecifiedDcbx && _lldpNbDcbxEn == 0) {
+ errmsg("LLDP_NB_RX_MODE parameter can not be set.");
+ return false;
+ }
+
+ if (_lldpNbDcbx > 1) {
+ errmsg("Illegal LLDP_NB_RX_MODE parameter value(%d), value must be False(0) or True(1)", _lldpNbDcbx);
+ return false;
+ }
+
+ return true;
+}
+
+u_int32_t LLDPClientSettings::getTlvTypeBe()
+{
+ struct tools_open_per_port_type type;
+ u_int32_t tlvType = 0;
+ type.param_class = CLASS_PHYS_PORT;
+ type.param_idx = tlvTypeIdx;
+ type.port = _port;
+ tools_open_per_port_type_pack(&type, (u_int8_t*)&tlvType);
+ return tlvType;
+}
+
+void LLDPClientSettings::updateTlvFromClassAttr(void* tlv)
+{
+ struct tools_open_lldp_client_settings* lldpClientSettingsPortTlv = (struct tools_open_lldp_client_settings*)tlv;
+ lldpClientSettingsPortTlv->lldp_nb_dcbx = _lldpNbDcbx;
+ lldpClientSettingsPortTlv->lldp_nb_rx_mode = _lldpNbRxMode;
+ lldpClientSettingsPortTlv->lldp_nb_tx_mode = _lldpNbTxMode;
+ return;
+}
+
+void LLDPClientSettings::updateClassAttrFromTlv(void* tlv)
+{
+ struct tools_open_lldp_client_settings* lldpClientSettingsPortTlv = (struct tools_open_lldp_client_settings*)tlv;
+ _lldpNbDcbx = lldpClientSettingsPortTlv->lldp_nb_dcbx;
+ _lldpNbRxMode = lldpClientSettingsPortTlv->lldp_nb_rx_mode;
+ _lldpNbTxMode = lldpClientSettingsPortTlv->lldp_nb_tx_mode;
+ return;
+}
+
+void LLDPClientSettings::updateClassDefaultAttrFromTlv(void* tlv)
+{
+ struct tools_open_lldp_client_settings* lldpClientSettingsPortTlv = (struct tools_open_lldp_client_settings*)tlv;
+ _lldpNbDcbxDefault = lldpClientSettingsPortTlv->lldp_nb_dcbx;
+ _lldpNbRxModeDefault = lldpClientSettingsPortTlv->lldp_nb_rx_mode;
+ _lldpNbTxModeDefault = lldpClientSettingsPortTlv->lldp_nb_tx_mode;
+ return;
+}
+
+u_int32_t LLDPClientSettings::getLLDPNBCapTlvTypeBe()
+{
+ struct tools_open_per_port_type type;
+ u_int32_t tlvType = 0;
+ type.param_class = CLASS_PHYS_PORT;
+ type.param_idx = LLDP_NB_CAPABILITIES_TYPE;
+ type.port = _port;
+ tools_open_per_port_type_pack(&type, (u_int8_t*)&tlvType);
+ return tlvType;
+}
+
+
+/*
+ * LLDP NB DCBX Class implementation
+ */
+
+bool DCBX::cfgSupported(mfile* mf, mlxCfgParam param)
+{
+ MError rc;
+ (void)param;
+ bool suppRead, suppWrite;
+ rc = nvqcCom5thGen(mf, getTlvTypeBe(), suppRead, suppWrite);
+ if (rc) {
+ errmsg("Failed to get LLDP NB DCBX capabilities. %s", m_err2str(rc));
+ return false;
+ }
+ if (!suppRead || !suppWrite) {
+ return false;
+ }
+
+ if (!getCap(mf)) {
+ return false;
+ }
+
+ return true;
+}
+
+void DCBX::setParam(mlxCfgParam paramType, u_int32_t val)
+{
+ if (paramType == Mcp_DCBX_IEEE_EN_P1|| paramType == Mcp_DCBX_IEEE_EN_P2) {
+ _ieee = val;
+ }
+ if (paramType == Mcp_DCBX_CEE_EN_P1|| paramType == Mcp_DCBX_CEE_EN_P2) {
+ _cee = val;
+ }
+ if (paramType == Mcp_DCBX_WILLING_P1|| paramType == Mcp_DCBX_WILLING_P2) {
+ _willing = val;
+ }
+ return;
+}
+
+u_int32_t DCBX::getParam(mlxCfgParam paramType)
+{
+ if (paramType == Mcp_DCBX_IEEE_EN_P1|| paramType == Mcp_DCBX_IEEE_EN_P2) {
+ return _ieee;
+ }
+ if (paramType == Mcp_DCBX_CEE_EN_P1|| paramType == Mcp_DCBX_CEE_EN_P2) {
+ return _cee;
+ }
+ if (paramType == Mcp_DCBX_WILLING_P1|| paramType == Mcp_DCBX_WILLING_P2) {
+ return _willing;
+ }
+ return MLXCFG_UNKNOWN;
+}
+
+u_int32_t DCBX::getDefaultParam(mlxCfgParam paramType)
+{
+ if (paramType == Mcp_DCBX_IEEE_EN_P1|| paramType == Mcp_DCBX_IEEE_EN_P2) {
+ return _ieeeDefault;
+ }
+ if (paramType == Mcp_DCBX_CEE_EN_P1|| paramType == Mcp_DCBX_CEE_EN_P2) {
+ return _ceeDefault;
+ }
+ if (paramType == Mcp_DCBX_WILLING_P1|| paramType == Mcp_DCBX_WILLING_P2) {
+ return _willingDefault;
+ }
+ return MLXCFG_UNKNOWN;
+}
+
+void DCBX::setParams(u_int32_t ieee, u_int32_t cee, u_int32_t willing)
+{
+ _ieee = ieee;
+ _cee = cee;
+ _willing = willing;
+}
+
+void DCBX::updateClassAttrFromDefaultParams()
+{
+ setParams(
+ _ieeeDefault,
+ _ceeDefault,
+ _willingDefault);
+}
+
+int DCBX::getFromDev(mfile* mf)
+{
+ GET_FROM_DEV_5TH_GEN(mf, tools_open_lldp_nb_dcbx, "LLDP NB DCBX");
+}
+
+int DCBX::setOnDev(mfile* mf, bool ignoreCheck)
+{
+ SET_ON_DEV_5TH_GEN(mf, ignoreCheck, tools_open_lldp_nb_dcbx, "LLDP NB DCBX");
+}
+
+int DCBX::getDefaultParams(mfile* mf)
+{
+ GET_DEFAULT_5TH_GEN(mf, tools_open_lldp_nb_dcbx, "LLDP NB DCBX");
+}
+
+bool DCBX::hardLimitCheck()
+{
+ if (_lldpNbDcbxEn == 0) {
+ errmsg("DCBX parameters cannot be set");
+ return false;
+ }
+ if (_ieee > 1) {
+ errmsg("Illegal %s parameter value(%d)", _port == 1 ?
+ "DCBX_IEEE_P1" : "DCBX_IEEE_P2", _ieee);
+ return false;
+ }
+ if (_cee > 1) {
+ errmsg("Illegal %s parameter value(%d)", _port == 1 ?
+ "DCBX_CEE_P1" : "DCBX_CEE_P2", _cee);
+ return false;
+ }
+ if (_willing > 1) {
+ errmsg("Illegal %s parameter value(%d)", _port == 1 ?
+ "DCBX_WILLING_P1" : "DCBX_WILLING_P2", _willing);
+ return false;
+ }
+ return true;
+}
+
+u_int32_t DCBX::getTlvTypeBe()
+{
+ struct tools_open_per_port_type type;
+ u_int32_t tlvType = 0;
+ type.param_class = CLASS_PHYS_PORT;
+ type.param_idx = tlvTypeIdx;
+ type.port = _port;
+ tools_open_per_port_type_pack(&type, (u_int8_t*)&tlvType);
+ return tlvType;
+}
+
+u_int32_t DCBX::getLLDPNBCapTlvTypeBe()
+{
+ struct tools_open_per_port_type type;
+ u_int32_t tlvType = 0;
+ type.param_class = CLASS_PHYS_PORT;
+ type.param_idx = LLDP_NB_CAPABILITIES_TYPE;
+ type.port = _port;
+ tools_open_per_port_type_pack(&type, (u_int8_t*)&tlvType);
+ return tlvType;
+}
+
+void DCBX::updateTlvFromClassAttr(void* tlv)
+{
+ struct tools_open_lldp_nb_dcbx* DCBXPortTlv = (struct tools_open_lldp_nb_dcbx*)tlv;
+ DCBXPortTlv->ieee_dcbx_en = _ieee;
+ DCBXPortTlv->cee_dcbx_en = _cee;
+ DCBXPortTlv->dcbx_willing = _willing;
+ return;
+}
+
+void DCBX::updateClassAttrFromTlv(void* tlv)
+{
+ struct tools_open_lldp_nb_dcbx* lldpClientSettingsPortTlv = (struct tools_open_lldp_nb_dcbx*)tlv;
+ _ieee = lldpClientSettingsPortTlv->ieee_dcbx_en;
+ _cee = lldpClientSettingsPortTlv->cee_dcbx_en;
+ _willing = lldpClientSettingsPortTlv->dcbx_willing;
+ return;
+}
+
+void DCBX::updateClassDefaultAttrFromTlv(void* tlv)
+{
+ struct tools_open_lldp_nb_dcbx* lldpClientSettingsPortTlv = (struct tools_open_lldp_nb_dcbx*)tlv;
+ _ieeeDefault = lldpClientSettingsPortTlv->ieee_dcbx_en;
+ _ceeDefault = lldpClientSettingsPortTlv->cee_dcbx_en;
+ _willingDefault = lldpClientSettingsPortTlv->dcbx_willing;
+ return;
+}
+
+bool DCBX::getCap(mfile *mf)
+{
+ MError rc;
+ u_int8_t tlvCapBuff[TOOLS_OPEN_LLDP_NB_CAP_SIZE] = {0};
+ struct tools_open_lldp_nb_cap lldpNbCapTlv;
+ memset(&lldpNbCapTlv, 0, sizeof(lldpNbCapTlv));
+ rc = mnvaCom5thGen(mf, &tlvCapBuff[0], TOOLS_OPEN_LLDP_NB_CAP_SIZE, getLLDPNBCapTlvTypeBe(), REG_ACCESS_METHOD_GET);
+ if (rc) {
+ return false;
+ }
+ tools_open_lldp_nb_cap_unpack(&lldpNbCapTlv, tlvCapBuff);
+ _lldpNbDcbxEn = lldpNbCapTlv.lldp_nb_dcbx_en;
+ return true;
+}
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
+ */
+/*
+ * mlxcfg_param_lib.h
*
+ * Created on: Mar 22, 2015
+ * Author: adrianc
*/
#ifndef MLXCFG_PARAM_LIB_H_
#define ROCE_NEXT_PROTOCOL_TYPE 0x10
#define ROCE_CC_TYPE 0x107
#define ROCE_CC_ECN_TYPE 0x108
-#define LLDP_NB_SETTINGS_TYPE 0x10a
+#define LLDP_CLIENT_SETTINGS_TYPE 0x10a
#define LLDP_NB_CAPABILITIES_TYPE 0x10b
#define EXTERNAL_PORT 0x192
#define BOOT_SETTINGS_EXTRAS_GEN4 0x2001
#define BOOT_SETTINGS_EXTRAS_GEN5 0x195
#define BOOT_SETTINGS_EXTRAS_GEN5_CAP 0x101
+#define QOS 0x192
+#define QOS_CAP 0x193
+#define LLDP_NB_DCBX 0x18E
+
typedef enum {
// SRIOV
Mct_Sriov = 0,
Mct_Boot_Settings_Extras_5thGen,
Mct_Boot_Settings_Extras_4thGen_P1,
Mct_Boot_Settings_Extras_4thGen_P2,
+ Mct_QoS_P1,
+ Mct_QoS_P2,
+ Mct_LLDP_Client_Settings_P1,
+ Mct_LLDP_Client_Settings_P2,
+ Mct_DCBX_P1,
+ Mct_DCBX_P2,
Mct_Last
} mlxCfgType;
Mcp_Boot_Settings_Ext_IP_Ver,
Mcp_Boot_Settings_Ext_IP_Ver_P1,
Mcp_Boot_Settings_Ext_IP_Ver_P2,
+ Mcp_QoS_Num_of_TC_P1,
+ Mcp_QoS_Num_of_VL_P1,
+ Mcp_QoS_Num_of_TC_P2,
+ Mcp_QoS_Num_of_VL_P2,
+ Mcp_LLDP_NB_RX_Mode_P1,
+ Mcp_LLDP_NB_TX_Mode_P1,
+ Mcp_LLDP_NB_DCBX_P1,
+ Mcp_LLDP_NB_RX_Mode_P2,
+ Mcp_LLDP_NB_TX_Mode_P2,
+ Mcp_LLDP_NB_DCBX_P2,
+ Mcp_DCBX_IEEE_EN_P1,
+ Mcp_DCBX_CEE_EN_P1,
+ Mcp_DCBX_WILLING_P1,
+ Mcp_DCBX_IEEE_EN_P2,
+ Mcp_DCBX_CEE_EN_P2,
+ Mcp_DCBX_WILLING_P2,
Mcp_Last
} mlxCfgParam;
};
+/*
+ * QoS parameters Class
+ */
+
+class QoS : public CfgParams
+{
+public:
+ QoS(int port) : CfgParams(port == 1 ? Mct_QoS_P1 : Mct_QoS_P2, QOS),
+ _port(port), _numOfTC(MLXCFG_UNKNOWN), _numOfVL(MLXCFG_UNKNOWN),
+ _numOfTCDefault(MLXCFG_UNKNOWN), _numOfVLDefault(MLXCFG_UNKNOWN),
+ _maxNumOfTC(MLXCFG_UNKNOWN), _maxNumOfVL(MLXCFG_UNKNOWN){}
+ ~QoS() {};
+
+ virtual bool cfgSupported(mfile* mf, mlxCfgParam param=Mcp_Last);
+
+ virtual void setParam(mlxCfgParam paramType, u_int32_t val);
+ virtual u_int32_t getParam(mlxCfgParam paramType);
+ virtual u_int32_t getDefaultParam(mlxCfgParam paramType);
+
+ virtual int getFromDev(mfile* mf);
+ virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
+ virtual int getDefaultParams(mfile* mf);
+ bool getCap(mfile *mf);
+ u_int32_t getQoSCapTlvTypeBe();
+
+protected:
+ bool hardLimitCheckAux(u_int32_t maxNumOfX, u_int32_t numOfX,const char *x);
+ virtual bool hardLimitCheck();
+ u_int32_t getTlvTypeBe();
+
+ virtual void updateTlvFromClassAttr(void* tlv);
+ virtual void updateClassAttrFromTlv(void* tlv);
+ virtual void updateClassDefaultAttrFromTlv(void* tlv);
+ void updateClassAttrFromDefaultParams();
+ void setParams(u_int32_t numOfTCDefault, u_int32_t numOfVLDefault);
+
+ int _port;
+
+ u_int32_t _numOfTC;
+ u_int32_t _numOfVL;
+
+ u_int32_t _numOfTCDefault;
+ u_int32_t _numOfVLDefault;
+
+ u_int32_t _maxNumOfTC;
+ u_int32_t _maxNumOfVL;
+};
+
+/*
+ * LLDP Client Settings Class
+ */
+
+class LLDPClientSettings : public CfgParams
+{
+public:
+ LLDPClientSettings(int port) : CfgParams(port == 1 ?
+ Mct_LLDP_Client_Settings_P1 : Mct_LLDP_Client_Settings_P2, LLDP_CLIENT_SETTINGS_TYPE),
+ _port(port), _lldpNbTxMode(MLXCFG_UNKNOWN), _lldpNbRxMode(MLXCFG_UNKNOWN), _lldpNbDcbx(MLXCFG_UNKNOWN),
+ _userSpecifiedRx(false), _userSpecifiedTx(false), _userSpecifiedDcbx(false),
+ _lldpNbTxModeDefault(MLXCFG_UNKNOWN), _lldpNbRxModeDefault(MLXCFG_UNKNOWN),
+ _lldpNbDcbxDefault(MLXCFG_UNKNOWN), _lldpNbTxCap(MLXCFG_UNKNOWN),
+ _lldpNbRxCap(MLXCFG_UNKNOWN), _lldpNbDcbxEn(MLXCFG_UNKNOWN){}
+ ~LLDPClientSettings() {};
+
+ virtual bool cfgSupported(mfile* mf, mlxCfgParam param=Mcp_Last);
+
+ virtual void setParam(mlxCfgParam paramType, u_int32_t val);
+ virtual u_int32_t getParam(mlxCfgParam paramType);
+ virtual u_int32_t getDefaultParam(mlxCfgParam paramType);
+
+ virtual int getFromDev(mfile* mf);
+ virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
+ virtual int getDefaultParams(mfile* mf);
+ bool getCap(mfile *mf);
+ u_int32_t getLLDPNBCapTlvTypeBe();
+
+protected:
+ virtual bool hardLimitCheck();
+ u_int32_t getTlvTypeBe();
+
+ virtual void updateTlvFromClassAttr(void* tlv);
+ virtual void updateClassAttrFromTlv(void* tlv);
+ virtual void updateClassDefaultAttrFromTlv(void* tlv);
+ void updateClassAttrFromDefaultParams();
+ void setParams(u_int32_t lldpNbRxMode, u_int32_t lldpNbTxMode, u_int32_t lldpNbDcbx);
+
+ int _port;
+
+ u_int32_t _lldpNbTxMode;
+ u_int32_t _lldpNbRxMode;
+ u_int32_t _lldpNbDcbx;
+
+ bool _userSpecifiedRx;
+ bool _userSpecifiedTx;
+ bool _userSpecifiedDcbx;
+
+ u_int32_t _lldpNbTxModeDefault;
+ u_int32_t _lldpNbRxModeDefault;
+ u_int32_t _lldpNbDcbxDefault;
+
+ u_int32_t _lldpNbTxCap;
+ u_int32_t _lldpNbRxCap;
+ u_int32_t _lldpNbDcbxEn;
+};
+
+/*
+ * LLDP NB DCBX Class
+ */
+
+class DCBX : public CfgParams
+{
+public:
+ DCBX(int port) : CfgParams(port == 1 ?
+ Mct_DCBX_P1 : Mct_DCBX_P2, LLDP_NB_DCBX),
+ _port(port), _ieee(MLXCFG_UNKNOWN), _cee(MLXCFG_UNKNOWN), _willing(MLXCFG_UNKNOWN),
+ _lldpNbDcbxEn(MLXCFG_UNKNOWN),
+ _ieeeDefault(MLXCFG_UNKNOWN), _ceeDefault(MLXCFG_UNKNOWN), _willingDefault(MLXCFG_UNKNOWN){}
+ ~DCBX() {};
+
+ virtual bool cfgSupported(mfile* mf, mlxCfgParam param=Mcp_Last);
+
+ virtual void setParam(mlxCfgParam paramType, u_int32_t val);
+ virtual u_int32_t getParam(mlxCfgParam paramType);
+ virtual u_int32_t getDefaultParam(mlxCfgParam paramType);
+
+ virtual int getFromDev(mfile* mf);
+ virtual int setOnDev(mfile* mf, bool ignoreCheck=false);
+ virtual int getDefaultParams(mfile* mf);
+
+protected:
+ virtual bool hardLimitCheck();
+ u_int32_t getTlvTypeBe();
+ u_int32_t getLLDPNBCapTlvTypeBe();
+
+ virtual void updateTlvFromClassAttr(void* tlv);
+ virtual void updateClassAttrFromTlv(void* tlv);
+ virtual void updateClassDefaultAttrFromTlv(void* tlv);
+ void updateClassAttrFromDefaultParams();
+ void setParams(u_int32_t lldpNbRxMode, u_int32_t lldpNbTxMode, u_int32_t lldpNbDcbx);
+ bool getCap(mfile* m);
+
+ int _port;
+
+ u_int32_t _ieee;
+ u_int32_t _cee;
+ u_int32_t _willing;
+
+ u_int32_t _lldpNbDcbxEn;
+
+ u_int32_t _ieeeDefault;
+ u_int32_t _ceeDefault;
+ u_int32_t _willingDefault;
+};
#endif /* MLXCFG_PARAM_LIB_H_ */
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
- *
*/
#include <stdlib.h>
#define DEVICE_NAME "mst device"
#endif
-void MlxCfg::printHelp(bool longDesc)
+void MlxCfg::printHelp()
{
// print opening
printf(IDENT"NAME:\n"
IDENT2 MLXCFG_NAME"\n"
IDENT"SYNOPSIS:\n"
- IDENT2 MLXCFG_NAME " [-d <%s> ] [-y|-e] <s[et] <parameters to set>|q[uery]|r[eset]>\n", DEVICE_NAME);
+ IDENT2 MLXCFG_NAME " [-d <%s> ] [-y|-e] <s[et] <parameters to set>|q[uery]|r[eset]|[ -f <filename> backup|set_raw]>\n", DEVICE_NAME);
// print options
printf("\n");
printFlagLine("d", "dev", "device", "Perform operation for a specified mst device.");
printFlagLine("f", "file", "conf_file", "raw configuration file.");
printFlagLine("h", "help", "", "Display help message.");
- printFlagLine("hh", "full_help", "", "Display full help message.");
printFlagLine("v", "version", "", "Display version info.");
printFlagLine("e", "show_default", "", "Show default configurations.");
printFlagLine("y", "yes", "", "Answer yes in prompt.");
printf(IDENT2"%-24s : %s\n","q[uery]", "query current supported configurations.");
printf(IDENT2"%-24s : %s\n","r[eset]", "reset all configurations to their default value.");
printf(IDENT2"%-24s : %s\n","s[et]", "set configurations to a specific device.");
- printf(IDENT2"%-24s : %s\n","set_raw", "set raw configuration file.(5th generation devices only.)");
+ printf(IDENT2"%-24s : %s\n","set_raw", "set raw configuration file.(only " FIFTH_GENERATION_LIST ".)");
+ printf(IDENT2"%-24s : %s\n","backup", "backup configurations to a file (only " FIFTH_GENERATION_LIST ".). Use set_raw command to restore file.");
// print supported commands
printf("\n");
printf(IDENT"Supported Configurations:\n");
printf("\n");
- if(longDesc) {
- _allInfo.printLongDesc();
- } else {
- _allInfo.printShortDesc();
- }
+ _allInfo.printLongDesc();
// print usage examples
printf("\n");
void MlxCfg::printUsage() {
printf("\n"IDENT"Usage:\n"
- IDENT2 MLXCFG_NAME " [-d <%s> ] [-y|-e] <s[et] <parameters to set>|q[uery]|r[eset]>\n\n", DEVICE_NAME);
+ IDENT2 MLXCFG_NAME " [-d <%s> ] [-y|-e] <s[et] <parameters to set>|q[uery]|r[eset]|[ -f <filename> backup|set_raw]>\n\n", DEVICE_NAME);
}
bool MlxCfg::tagExsists(mlxCfgParam tag) {
} else if (arg == "-h" || arg == "--help"){
printHelp();
return MLX_CFG_OK_EXIT;
- } else if (arg == "-hh" || arg == "--full_help"){
- printHelp(true);
- return MLX_CFG_OK_EXIT;
} else if (arg == "-d" || arg == "--dev") {
if (++i == argc) {
return err(true, "missing device name");
} else if (arg == "set_raw") {
_mlxParams.cmd = Mc_Set_Raw;
break;
+ } else if (arg == "backup") {
+ _mlxParams.cmd = Mc_Backup;
+ break;
// hidden flag --force used to ignore parameter checks
- }else if (arg == "--force"){
+ } else if (arg == "--force"){
_mlxParams.force = true;
} else {
return err(true, "invalid argument: %s", arg.c_str());
if (i != argc && (_mlxParams.cmd == Mc_Reset || _mlxParams.cmd == Mc_Query)) {
return err(true, "%s command expects no argument but %d argument recieved", (_mlxParams.cmd == Mc_Reset) ? "reset" : "query", argc -i);
}
- if ((_mlxParams.cmd == Mc_Set || _mlxParams.cmd == Mc_Clr_Sem || _mlxParams.cmd == Mc_Set_Raw) && _mlxParams.device.length() == 0) {
- return err(true, "%s command expects device to be specified.", _mlxParams.cmd == Mc_Set ? "set" : _mlxParams.cmd == Mc_Set_Raw ? "set_raw" : "clear_semaphore");
+ if ((_mlxParams.cmd == Mc_Set || _mlxParams.cmd == Mc_Clr_Sem || _mlxParams.cmd == Mc_Set_Raw || _mlxParams.cmd == Mc_Backup) && _mlxParams.device.length() == 0) {
+ return err(true, "%s command expects device to be specified.",
+ _mlxParams.cmd == Mc_Set ?
+ "set" : _mlxParams.cmd == Mc_Set_Raw ?
+ "set_raw" : _mlxParams.cmd == Mc_Clr_Sem ?
+ "clear_semaphore" : "backup");
}
if ((_mlxParams.cmd == Mc_Set_Raw && _mlxParams.rawTlvFile.size() == 0 )) {
return err(true, "set_raw command expects raw TLV file to be specified.");
}
- if ((_mlxParams.cmd != Mc_Set_Raw && _mlxParams.rawTlvFile.size() != 0 )) {
+ if ((_mlxParams.cmd == Mc_Backup && _mlxParams.rawTlvFile.size() == 0 )) {
+ return err(true, "backup command expects file to be specified.");
+ }
+ if (((_mlxParams.cmd != Mc_Set_Raw && _mlxParams.cmd != Mc_Backup) &&
+ _mlxParams.rawTlvFile.size() != 0 )) {
return err(true, "raw TLV file can only be specified with set_raw command.");
}
std::map<string, u_int32_t>::iterator it;
//first check if it is a numeric value
if(strToNum(input, val, 0)) {
+ if(val == MLXCFG_UNKNOWN) {
+ return MLX_CFG_ERROR;
+ }
return MLX_CFG_OK;
}
for(it = _strMap.begin(); it != _strMap.end(); it++){
paramMap["True"] = 1;
paramMap["False"] = 0;
params[Mcp_Fpp_En] = MlxCfgParamParser(Mcp_Fpp_En, "FPP_EN", "Enable function per port", paramMap);
- params[Mcp_Log_Bar_Size] = MlxCfgParamParser(Mcp_Log_Bar_Size, "LOG_BAR_SIZE", "example: for 8Mb bar size set LOG_BAR_SIZE=3 (4th Generation)", "base_2_log_in_mb");
+ params[Mcp_Log_Bar_Size] = MlxCfgParamParser(Mcp_Log_Bar_Size, "LOG_BAR_SIZE", "example: for 8Mb bar size set LOG_BAR_SIZE=3 (only " FOURTH_GENERATION_LIST")", "base_2_log_in_mb");
params[Mcp_Sriov_En] = MlxCfgParamParser(Mcp_Sriov_En, "SRIOV_EN", "Enable SR-IOV", paramMap);
- params[Mcp_PF_Log_Bar_Size] = MlxCfgParamParser(Mcp_PF_Log_Bar_Size, "PF_LOG_BAR_SIZE", "example: for 8Mb bar size set PF_LOG_BAR_SIZE=3 (5th Generation)", "base_2_log_in_mb");
- params[Mcp_VF_Log_Bar_Size] = MlxCfgParamParser(Mcp_VF_Log_Bar_Size, "VF_LOG_BAR_SIZE", "example: for 8Mb bar size set VF_LOG_BAR_SIZE=3 (5th Generation)", "base_2_log_in_mb");
+ params[Mcp_PF_Log_Bar_Size] = MlxCfgParamParser(Mcp_PF_Log_Bar_Size, "PF_LOG_BAR_SIZE", "example: for 8Mb bar size set PF_LOG_BAR_SIZE=3 (only " FIFTH_GENERATION_LIST ")", "base_2_log_in_mb");
+ params[Mcp_VF_Log_Bar_Size] = MlxCfgParamParser(Mcp_VF_Log_Bar_Size, "VF_LOG_BAR_SIZE", "example: for 8Mb bar size set VF_LOG_BAR_SIZE=3 (only " FIFTH_GENERATION_LIST ")", "base_2_log_in_mb");
params[Mcp_Num_Of_Vfs] = MlxCfgParamParser(Mcp_Num_Of_Vfs, "NUM_OF_VFS", "desired amount of virtual functions", "NUM");
- params[Mcp_Num_Pf_Msix] = MlxCfgParamParser(Mcp_Num_Pf_Msix, "NUM_PF_MSIX", "Number of MSI-X vectors and EQs per PF (5th Generation)", "NUM");
- params[Mcp_Num_Vf_Msix] = MlxCfgParamParser(Mcp_Num_Vf_Msix, "NUM_VF_MSIX", "Number of MSI-X vectors and EQs per VF (5th Generation)", "NUM");
+ params[Mcp_Num_Pf_Msix] = MlxCfgParamParser(Mcp_Num_Pf_Msix, "NUM_PF_MSIX", "Number of MSI-X vectors and EQs per PF (only "FIFTH_GENERATION_LIST")", "NUM");
+ params[Mcp_Num_Vf_Msix] = MlxCfgParamParser(Mcp_Num_Vf_Msix, "NUM_VF_MSIX", "Number of MSI-X vectors and EQs per VF (only "FIFTH_GENERATION_LIST")", "NUM");
return MlxCfgInfo("PCI Settings", "", params);
}
//Wake On LAN
paramMap["True"] = 1;
paramMap["False"] = 0;
- params[Mcp_Wol_Magic_En] = MlxCfgParamParser(Mcp_Wol_Magic_En, "WOL_MAGIC_EN", "5th generation devices only (per physical function)", paramMap);
+ params[Mcp_Wol_Magic_En] = MlxCfgParamParser(Mcp_Wol_Magic_En, "WOL_MAGIC_EN", "only " FIFTH_GENERATION_LIST " (per physical function)", paramMap);
params[Mcp_Wol_Magic_En_P1] = MlxCfgParamParser(Mcp_Wol_Magic_En_P1, "WOL_MAGIC_EN_P1", "enable wake on magic packet(per port.)", paramMap);
- params[Mcp_Wol_Magic_En_P2] = MlxCfgParamParser(Mcp_Wol_Magic_En_P2, "WOL_MAGIC_EN_P2", "4th generation devices only", paramMap);
+ params[Mcp_Wol_Magic_En_P2] = MlxCfgParamParser(Mcp_Wol_Magic_En_P2, "WOL_MAGIC_EN_P2", "only " FOURTH_GENERATION_LIST, paramMap);
return MlxCfgInfo("Wake On LAN", "", params);
}
paramMap["IPv6"] = 1;
paramMap["IPv4_IPv6"] = 2;
paramMap["IPv6_IPv4"] = 3;
- params[Mcp_Boot_Settings_Ext_IP_Ver] = MlxCfgParamParser(Mcp_Boot_Settings_Ext_IP_Ver, "IP_VER", "Select which IP protocol version will be used by flexboot. 5th Generation only.", paramMap);
- params[Mcp_Boot_Settings_Ext_IP_Ver_P1] = MlxCfgParamParser(Mcp_Boot_Settings_Ext_IP_Ver_P1, "IP_VER_P1", "Select which IP protocol version will be used by flexboot, 4th Generation (per port).", paramMap);
+ params[Mcp_Boot_Settings_Ext_IP_Ver] = MlxCfgParamParser(Mcp_Boot_Settings_Ext_IP_Ver, "IP_VER", "Select which IP protocol version will be used by flexboot. only " FIFTH_GENERATION_LIST ".", paramMap);
+ params[Mcp_Boot_Settings_Ext_IP_Ver_P1] = MlxCfgParamParser(Mcp_Boot_Settings_Ext_IP_Ver_P1, "IP_VER_P1", "Select which IP protocol version will be used by flexboot, only " FOURTH_GENERATION_LIST " (per port).", paramMap);
params[Mcp_Boot_Settings_Ext_IP_Ver_P2] = MlxCfgParamParser(Mcp_Boot_Settings_Ext_IP_Ver_P2, "IP_VER_P2", "", paramMap);
return MlxCfgInfo("Boot Settings Extras", "These parameters are relevant only for servers using legacy BIOS PXE boot (flexboot).", params);
}
+MlxCfgInfo MlxCfgAllInfo::createQoS()
+{
+ map<string, u_int32_t> vlParamMap;
+ map<string, u_int32_t> tcParamMap;
+ map<mlxCfgParam, MlxCfgParamParser> params;
+
+ tcParamMap["8_TCS"] = 0;
+ tcParamMap["1_TC"] = 1;
+ tcParamMap["2_TCS"] = 2;
+ tcParamMap["3_TCS"] = 3;
+ tcParamMap["4_TCS"] = 4;
+ tcParamMap["5_TCS"] = 5;
+ tcParamMap["6_TCS"] = 6;
+ tcParamMap["7_TCS"] = 7;
+
+ vlParamMap["1_VL"] = 1;
+ vlParamMap["2_VLS"] = 2;
+ vlParamMap["4_VLS"] = 3;
+ vlParamMap["8_VLS"] = 4;
+ vlParamMap["15_VLS"] = 5;
+
+ params[Mcp_QoS_Num_of_TC_P1] = MlxCfgParamParser(Mcp_QoS_Num_of_TC_P1, "NUM_OF_TC_P1", "Number of traffic classes, when DCB-X is enabled, this is the maximum number of TC that can negotiated with the remote peer.", tcParamMap);
+ params[Mcp_QoS_Num_of_TC_P2] = MlxCfgParamParser(Mcp_QoS_Num_of_TC_P2, "NUM_OF_TC_P2", "", tcParamMap);
+ params[Mcp_QoS_Num_of_VL_P1] = MlxCfgParamParser(Mcp_QoS_Num_of_VL_P1, "NUM_OF_VL_P1", "Number of Infiniband Virtual Lanes for this port.", vlParamMap);
+ params[Mcp_QoS_Num_of_VL_P2] = MlxCfgParamParser(Mcp_QoS_Num_of_VL_P2, "NUM_OF_VL_P2", "", vlParamMap);
+ return MlxCfgInfo("QoS", "", params);
+}
+
+MlxCfgInfo MlxCfgAllInfo::createLLDPClientSettings()
+{
+ map<string, u_int32_t> paramMap;
+ map<mlxCfgParam, MlxCfgParamParser> params;
+
+ paramMap["False"] = 0;
+ paramMap["True"] = 1;
+
+ params[Mcp_LLDP_NB_RX_Mode_P1] = MlxCfgParamParser(Mcp_LLDP_NB_RX_Mode_P1, "LLDP_NB_RX_MODE_P1", "Enable the internal LLDP client, and define which TLV it will process.", "0..2");
+ params[Mcp_LLDP_NB_TX_Mode_P1] = MlxCfgParamParser(Mcp_LLDP_NB_TX_Mode_P1, "LLDP_NB_TX_MODE_P1", "Select which LLDP TLV will be generated by the NIC.", "0..2");
+ params[Mcp_LLDP_NB_DCBX_P1] = MlxCfgParamParser(Mcp_LLDP_NB_DCBX_P1, "LLDP_NB_DCBX_P1", "Enable DCBX (applicable when LLDP_NB_TX_MODE and LLDP_NB_RX_MODE are in ALL mode)", paramMap);
+ params[Mcp_LLDP_NB_RX_Mode_P2] = MlxCfgParamParser(Mcp_LLDP_NB_RX_Mode_P2, "LLDP_NB_RX_MODE_P2", "", "0..2");
+ params[Mcp_LLDP_NB_TX_Mode_P2] = MlxCfgParamParser(Mcp_LLDP_NB_TX_Mode_P2, "LLDP_NB_TX_MODE_P2", "", "0..2");
+ params[Mcp_LLDP_NB_DCBX_P2] = MlxCfgParamParser(Mcp_LLDP_NB_DCBX_P2, "LLDP_NB_DCBX_P2", "", paramMap);
+ return MlxCfgInfo("LLDP Client Settings", "", params);
+}
+
+MlxCfgInfo MlxCfgAllInfo::createLLDPNBDCBX()
+{
+ map<string, u_int32_t> paramMap;
+ map<mlxCfgParam, MlxCfgParamParser> params;
+
+ paramMap["False"] = 0;
+ paramMap["True"] = 1;
+
+ params[Mcp_DCBX_IEEE_EN_P1] = MlxCfgParamParser(Mcp_DCBX_IEEE_EN_P1, "DCBX_IEEE_P1", "Enable DCBX in IEEE mode.", paramMap);
+ params[Mcp_DCBX_CEE_EN_P1] = MlxCfgParamParser(Mcp_DCBX_CEE_EN_P1, "DCBX_CEE_P1", "Enable DCBX in CEE mode.", paramMap);
+ params[Mcp_DCBX_WILLING_P1] = MlxCfgParamParser(Mcp_DCBX_WILLING_P1, "DCBX_WILLING_P1", "Allow the NIC to accept DCBX configuration from the remote peer.", paramMap);
+ params[Mcp_DCBX_IEEE_EN_P2] = MlxCfgParamParser(Mcp_DCBX_IEEE_EN_P2, "DCBX_IEEE_P2", "", paramMap);
+ params[Mcp_DCBX_CEE_EN_P2] = MlxCfgParamParser(Mcp_DCBX_CEE_EN_P2, "DCBX_CEE_P2", "", paramMap);
+ params[Mcp_DCBX_WILLING_P2] = MlxCfgParamParser(Mcp_DCBX_WILLING_P2, "DCBX_WILLING_P2", "", paramMap);
+ return MlxCfgInfo("LLDP NB DCBX", "", params);
+}
+
bool sortCfg(MlxCfgInfo a, MlxCfgInfo b)
{
return a.getName() < b.getName();
_allInfo.push_back(createWakeOnLAN());
_allInfo.push_back(createExternalPort());
_allInfo.push_back(createBootSettingsExt());
+ _allInfo.push_back(createQoS());
+ _allInfo.push_back(createLLDPClientSettings());
+ _allInfo.push_back(createLLDPNBDCBX());
std::sort(_allInfo.begin(), _allInfo.end(), sortCfg);
}
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
+ */
+/*
+ * mlxcfg_status.h
*
+ * Created on: Mar 23, 2015
+ * Author: adrianc
*/
#ifndef MLXCFG_STATUS_H_
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
- *
*/
#include <stdlib.h>
"INITIAL_ALPHA_VALUE_P2", "MIN_TIME_BETWEEN_CNPS_P2", "CNP_DSCP_P2", "CNP_802P_PRIO_P2",
"BOOT_OPTION_ROM_EN_P1", "BOOT_VLAN_EN_P1", "BOOT_RETRY_CNT_P1", "LEGACY_BOOT_PROTOCOL_P1", "BOOT_VLAN_P1",
"BOOT_OPTION_ROM_EN_P2", "BOOT_VLAN_EN_P2", "BOOT_RETRY_CNT_P2", "LEGACY_BOOT_PROTOCOL_P2", "BOOT_VLAN_P2",
- "PORT_OWNER", "ALLOW_RD_COUNTERS", "IP_VER", "IP_VER_P1", "IP_VER_P2"
+ "PORT_OWNER", "ALLOW_RD_COUNTERS", "IP_VER", "IP_VER_P1", "IP_VER_P2",
+ "NUM_OF_TC_P1", "NUM_OF_VL_P1",
+ "NUM_OF_TC_P2", "NUM_OF_VL_P2",
+ "LLDP_NB_RX_MODE_P1", "LLDP_NB_TX_MODE_P1", "LLDP_NB_DCBX_P1",
+ "LLDP_NB_RX_MODE_P2", "LLDP_NB_TX_MODE_P2", "LLDP_NB_DCBX_P2",
+ "DCBX_IEEE_P1", "DCBX_CEE_P1", "DCBX_WILLING_P1",
+ "DCBX_IEEE_P2", "DCBX_CEE_P2", "DCBX_WILLING_P2"
};
u_int32_t MlxCfgParams::getParamVal(mlxCfgParam p)
}
}
if (!ops.supportsParam((mlxCfgParam)p)) {
+ if (_mlxParams.cmd == Mc_Set) {
+ err(false, "Device doesn't support %s configuration.", MlxCfgParams::param2str[p].c_str());
+ return MLX_CFG_ERROR_EXIT;
+ }
continue;
}
nothingSupported= false;
printf("The '*' shows parameters with current value different from default value.\n");
}
if (nothingSupported) {
- err(false, "Device Doesn't support any configuration changes.");
+ err(false, "Device doesn't support any configuration changes.");
return MLX_CFG_ERROR_EXIT;
}
return failedToGetCfg ? MLX_CFG_ERROR : MLX_CFG_OK;
// write cfgs
MlxCfgOps ops;
- bool rc;
+ int rc;
+ mlxCfgParam p;
rc = ops.open(_mlxParams.device.c_str());
if (rc) {
printf("Applying... ");
// set Configuration
- rc = ops.setCfg(_mlxParams.params);
+ rc = ops.setCfg(_mlxParams.params, p);
if (rc) {
printf("Failed!\n");
- err(true, "Failed to set configuration: %s", ops.err());
+ if (rc == MCE_UNSUPPORTED_CFG) {
+ err(true, "Unsupported Configuration: %s", MlxCfgParams::param2str[p].c_str());
+ } else {
+ err(true, "Failed to set configuration: %s", ops.err());
+ }
return MLX_CFG_ERROR;
}
return MLX_CFG_OK;
}
+mlxCfgStatus MlxCfg::backupCfg()
+{
+ MlxCfgOps ops;
+ bool rc;
+ vector<pair<u_int32_t, vector<u_int8_t> > > cfgsMap;
+ FILE * file;
+
+ rc = ops.open(_mlxParams.device.c_str(), true);
+ if (rc) {
+ printf(" Failed!\n");
+ return err(true, "Failed to open device: %s. %s", _mlxParams.device.c_str(), ops.err());
+ }
+
+ printf("Collecting...\n");
+ if (ops.backupCfgs(cfgsMap)) {
+ printf(" Failed!\n");
+ return err(true, "Failed to backup the configurations: %s", ops.err());
+ }
+
+ // open file
+ printf("Saving output...\n");
+ file = fopen(_mlxParams.rawTlvFile.c_str(), "w");
+ if (file == NULL) {
+ return err(true, "Failed to open file: %s", _mlxParams.rawTlvFile.c_str());
+ }
+
+ fprintf(file, "%s\n", MLNX_RAW_TLV_FILE_SIG);
+
+ for(std::vector<pair<u_int32_t, vector<u_int8_t> > >::iterator it = cfgsMap.begin();
+ it != cfgsMap.end(); it++) {
+ fprintf(file, "%% TLV Type: 0x%08x\n", it->first);
+ vector<u_int8_t> v = it->second;
+ for(size_t i = 0; i < v.size() / 4; i++) {
+ fprintf(file, "0x%08x ", __cpu_to_be32(((u_int32_t*)v.data())[i]));
+ }
+ fprintf(file, "\n");
+ }
+
+ fclose(file);
+
+ printf("Done!\n");
+ return MLX_CFG_OK;
+}
+
mlxCfgStatus MlxCfg::tlvLine2DwVec(const std::string& tlvStringLine, std::vector<u_int32_t>& tlvVec) {
tlvVec.resize(0);
std::string dwStr;
case Mc_Set_Raw:
ret = setDevRawCfg();
break;
+ case Mc_Backup:
+ ret = backupCfg();
+ break;
default:
// should not reach here.
return err(true, "invalid command.");
return ret;
}
-mlxCfgStatus MlxCfg::test(const char* dev)
-{
- bool rc;
- MlxCfgOps ops;
- rc = ops.open(dev);
- if (rc) {
- return err(true, "Failed to open device: %s. %s", dev, ops.err());
- }
- u_int32_t val;
- rc =ops.invalidateCfgs();
- printf("after invalidate all : rc = %d\n", rc);
- rc =ops.getCfg(Mcp_Wol_Magic_En_P1, val);
- printf("get sriov_en get before set : rc = %d , val = %d\n", rc,val);
- rc = ops.setCfg(_mlxParams.params);
- printf("get sriov_en set : rc = %d , val = %d\n", rc,val);
- rc =ops.getCfg(Mcp_Wol_Magic_En_P1, val);
- printf("get sriov_en get after set : rc = %d , val = %d\n", rc,val);
- if (rc) {
- printf("-D- %s\n",ops.err());
- }
- return MLX_CFG_OK;
-}
-
-
int main(int argc, char* argv[])
{
try
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
- *
*/
#ifndef MLXCFG_UI_H_
Mc_Reset,
Mc_Clr_Sem,
Mc_Set_Raw,
+ Mc_Backup,
Mc_UnknownCmd
} mlxCfgCmd;
MlxCfgInfo createWakeOnLAN();
MlxCfgInfo createExternalPort();
MlxCfgInfo createBootSettingsExt();
+ MlxCfgInfo createQoS();
+ MlxCfgInfo createLLDPClientSettings();
+ MlxCfgInfo createLLDPNBDCBX();
};
class MlxCfgParams
private:
// User interface and parsing methods
- void printHelp(bool longDesc=false);
+ void printHelp();
void printVersion();
void printUsage();
mlxCfgStatus parseArgs(int argc, char* argv[]);
mlxCfgStatus resetDevCfg(const char* dev);
// Set Raw TLV file
mlxCfgStatus setDevRawCfg();
+ mlxCfgStatus backupCfg();
mlxCfgStatus tlvLine2DwVec(const std::string& tlvStringLine, std::vector<u_int32_t>& tlvVec);
mlxCfgStatus clrDevSem();
- //
- mlxCfgStatus test(const char* dev);
bool askUser(const char* question);
mlxCfgStatus err(bool report, const char* errMsg, ...);
UEFI_COMMON_DIR = $(top_srcdir)/mlxfwops/uefi_c
AM_CPPFLAGS = -I$(srcdir) -I$(MTCR_INC_DIR) -I$(MFLASH_DIR) -I$(top_srcdir)/ext_libs/json -I$(MINIXZ_DIR)\
- -I$(COMMON_DIR) -I $(LAYOUTS_DIR) -I$(top_srcdir)/common -I$(UTILS_LIB) -I$(UEFI_COMMON_DIR)
+ -I$(COMMON_DIR) -I$(LAYOUTS_DIR) -I$(top_srcdir)/common -I$(UTILS_LIB) -I$(UEFI_COMMON_DIR)
MLXFWOPS_VERSION = 1
} aux_tlv_t;
-class ImageTlvOps : public ErrMsg
+class ImageTlvOps : public FlintErrMsg
{
public:
- ImageTlvOps(const char* fname, bool readOnly=false) : ErrMsg() , _fname(fname), _tlvSectionFound(false),
+ ImageTlvOps(const char* fname, bool readOnly=false) : FlintErrMsg() , _fname(fname), _tlvSectionFound(false),
_tlvSectionFilePos(0), _initialized(false),
_readOnly(readOnly){}
- ImageTlvOps(u_int8_t* buf, unsigned int size) : ErrMsg() , _fname((const char*)NULL),
+ ImageTlvOps(u_int8_t* buf, unsigned int size) : FlintErrMsg() , _fname((const char*)NULL),
_tlvSectionFound(false), _tlvSectionFilePos(0),
_initialized(false), _readOnly(true)
{
};
-class TimeStampIFC : public ErrMsg
+class TimeStampIFC : public FlintErrMsg
{
public:
- TimeStampIFC() : ErrMsg() {};
+ TimeStampIFC() : FlintErrMsg() {};
virtual ~TimeStampIFC(){};
static TimeStampIFC* getIFC(mfile* mf);
static TimeStampIFC* getIFC(const char* fname, u_int32_t lastFWAddr=0);
-void ErrMsg::err_clear(){
+void FlintErrMsg::err_clear(){
delete [] _err;
_err = 0;
}
#endif
}
-bool ErrMsg::errmsg(const char *format, ...) {
+bool FlintErrMsg::errmsg(const char *format, ...) {
va_list args;
char* prev_err = _err;
return false;
}
-bool ErrMsg::errmsg(int errorCode, const char *format, ...) {
+bool FlintErrMsg::errmsg(int errorCode, const char *format, ...) {
va_list args;
char* prev_err = _err;
return false;
}
-bool ErrMsg::errmsgAdv(bool showAdv, const char *normalFmt, const char *AdvFmt, ...) {
+bool FlintErrMsg::errmsgAdv(bool showAdv, const char *normalFmt, const char *AdvFmt, ...) {
// args should only apply to advanced format (i.e normalFmt does not contain %<char>)
va_list args;
char errFmt[1024];
return false;
}
-int ErrMsg::errmsgWCode(int errorCode, const char *format, ...) {
+int FlintErrMsg::errmsgWCode(int errorCode, const char *format, ...) {
va_list args;
char* prev_err = _err;
return errorCode;
}
-
////////////////////////////////////////////////////////////////////////
void Crc16::add(u_int32_t o)
{
#include "uefi_c.h"
#endif
+#if defined __FreeBSD__
+ #include <stdarg.h>
+#endif
+
#include <signal.h>
#include "tools_version.h"
return false; }} while (0)
#define READBUF(f,o,d,l,p) do { if (!f.read(o,d,l)) { \
return errmsg("%s - read error (%s)\n", p, f.err()); }} while (0)
+#define READALLOCBUF(f,o,d,l,p) do {\
+ d = (u_int8_t*) malloc(sizeof(u_int8_t) * l);\
+ if (!f.read(o,d,l)) { \
+ free(d);\
+ return errmsg("%s - read error (%s)\n", p, f.err());\
+ }\
+} while (0)
#define FS2_BOOT_START 0x38
#define FS_DATA_OFF 0x28
#define FS3_BOOT_START FS2_BOOT_START
#define FS3_BOOT_START_IN_DW FS3_BOOT_START/4
-
#define CRC_CHECK_OLD "%s /0x%08x-0x%08x (0x%06x)/ (%s"
#define MAX_NUM_SUPP_HW_IDS 200
FS3_NV_DATA2 = 0xe4,
FS3_FW_NV_LOG = 0xe5,
FS3_NV_DATA0 = 0xe6, // replaces FS3_NV_DATA1
+ FS4_HW_PTR = 0xfb,
+ FS4_TOOLS_AREA = 0xfc,
FS3_ITOC = 0xfd,
+ FS3_DTOC = 0xfe,
FS3_END = 0xff,
} fs3_section_t;
-
enum CommandType {
CMD_UNKNOWN,
CMD_BURN,
// BASE CLASSES
////////////////////////////////////////////////////////////////////////////////////////////////////////////
-class MLXFWOP_API ErrMsg {
+class MLXFWOP_API FlintErrMsg {
public:
- ErrMsg() : _err(0), _errCode(0){}
- ~ErrMsg() { err_clear();}
+ FlintErrMsg() : _err(0), _errCode(0){}
+ ~FlintErrMsg() { err_clear();}
const char *err() const { return _err;}
void err_clear();
int getErrorCode() {return _errCode;}
{
#ifndef UEFI_BUILD
-//#ifndef 1
int fsize;
- int r_cnt;
FILE *fh;
(void)read_only; // FImage can be opened only for read so we ignore compiler warnings
fname);
}
- _buf = new u_int32_t[fsize/4];
- if ((r_cnt = fread(_buf, 1, fsize, fh)) != fsize) {
- fclose(fh);
- if (r_cnt < 0) {
- return errmsg("Read error on file \"%s\" - %s",fname, strerror(errno));
- } else {
- return errmsg("Read error on file \"%s\" - read only %d bytes (from %ld)",
- fname, r_cnt, (unsigned long)fsize);
- }
- }
-
+ _fname = fname;
_len = fsize;
+ _isFile = true;
fclose(fh);
return true;
#else
_buf = 0;
} // FImage::close
+/////////////////////////////////////////////////////////////////////////
+u_int32_t* FImage::getBuf()
+{
+ if (_isFile) {
+ // Read the entire file on demand
+ FILE* fh = fopen(_fname, "rb");
+ int r_cnt;
+ u_int32_t* retBuf;
+ if (!fh) {
+ errmsg("Can not open file \"%s\" - %s", _fname, strerror(errno));
+ return (u_int32_t*)NULL;
+ }
+ _buf = new u_int32_t[_len/4];
+ if ((r_cnt = fread(_buf, 1, _len, fh)) != (int)_len) {
+ if (r_cnt < 0) {
+ errmsg("Read error on file \"%s\" - %s",_fname, strerror(errno));
+ retBuf = (u_int32_t*)NULL;
+ goto cleanup;
+ } else {
+ errmsg("Read error on file \"%s\" - read only %d bytes (from %ld)",
+ _fname, r_cnt, (unsigned long)_len);
+ retBuf = (u_int32_t*)NULL;
+ goto cleanup;
+ }
+ }
+ _isFile = false;
+ retBuf = _buf;
+ cleanup:
+ fclose(fh);
+ if (!retBuf) {
+ delete[] _buf;
+ }
+ return retBuf;
+ } else {
+ return _buf;
+ }
+}
+
////////////////////////////////////////////////////////////////////////
bool FImage::read(u_int32_t addr, u_int32_t *data)
{
if (len & 0x3) {
return errmsg("Length should be 4-bytes aligned.");
}
- if (!_buf) {
+ if (!_isFile && !_buf) {
return errmsg("read() when not opened");
}
align.Init (addr, len);
while (align.GetNextChunk(chunk_addr, chunk_size)) {
u_int32_t phys_addr = cont2phys(chunk_addr);
-
- memcpy((u_int8_t*)data + (chunk_addr - addr),
+ if (_isFile) {
+ FILE* fh = fopen(_fname, "rb");
+ if (!fh) {
+ return errmsg("Can not open file \"%s\" - %s", _fname, strerror(errno));
+ }
+ fseek(fh, phys_addr, SEEK_SET);
+ if (fread((u_int8_t*)data + (chunk_addr - addr), chunk_size, 1, fh) != 1) {
+ fclose(fh);
+ return errmsg("Failed to read from FW file, offset: %#x - %s", phys_addr, strerror(errno));
+ }
+ fclose(fh);
+ } else {
+ memcpy((u_int8_t*)data + (chunk_addr - addr),
(u_int8_t*)_buf + phys_addr,
chunk_size);
+ }
}
return true;
}
- if (_attr.hw_dev_id == 435 || _attr.hw_dev_id == SWITCHX_HW_ID) {
+ if (_attr.hw_dev_id == IS4_HW_ID || _attr.hw_dev_id == SWITCHX_HW_ID) {
_port_num = 0;
} else {
_port_num = 2;
} ext_flash_attr_t;
// Common base class for Flash and for FImage
-class MLXFWOP_API FBase : public ErrMsg {
+class MLXFWOP_API FBase : public FlintErrMsg {
public:
FBase(bool is_flash) :
_is_image_in_odd_chunks(false),
return phys_addr;
}
+ u_int32_t get_log2_chunk_size(){return _log2_chunk_size;}
+ bool get_is_image_in_odd_chunks(){return _is_image_in_odd_chunks;}
+
enum {
MAX_FLASH = 4*1048576
};
public:
FImage() :
FBase(false),
+ _fname(0),
_buf(0),
+ _isFile(false),
_len(0) {}
virtual ~FImage() { close();}
- u_int32_t *getBuf() { return _buf;}
+ u_int32_t *getBuf();
u_int32_t getBufLength() { return _len;}
virtual bool open(const char *fname, bool read_only = false, bool advErr = true);
using FBase::open;
virtual u_int32_t get_dev_id() { return 0;}
virtual u_int32_t get_rev_id() { return 0;}
private:
+ const char* _fname;
u_int32_t *_buf;
+ bool _isFile;
u_int32_t _len;
};
static void deal_with_signal();
mfile* getMfileObj() {return mf_get_mfile(_mfl);}
+ mflash* getMflashObj() {return _mfl;}
enum {
TRANS = 4096
#include <cibfw_layouts.h>
#include "fs2_ops.h"
+#ifdef __WIN__
+#include <win_driver_cif.h>
+#endif
+
#define PRE_CRC_OUTPUT " "
#define CRC_CHECK_OUTPUT CRC_CHECK_OLD")"
// printf("-D- VerifyFs2 = ok\n");
// Look for image in "physical addresses
- CntxFindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num);
+ FindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num, _cntx_magic_pattern);
if (cntx_image_num == 0) {
return errmsg(MLXFW_NO_VALID_IMAGE_ERR, "No valid image found");
} else if (cntx_image_num > 2) {
u_int32_t cntx_image_start[CNTX_START_POS_SIZE];
u_int32_t cntx_image_num;
- CntxFindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num);
+ FindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num, _cntx_magic_pattern);
// Address convertor is disabled now - use phys addresses
for (u_int32_t i = 0; i < cntx_image_num; i++) {
if (cntx_image_start[i] != new_image_start) {
report_warn("Failed to update FW boot address. Power cycle the device in order to load the new FW.\n");
}
+ // on windows send caching command to driver (best effort)
+#ifdef __WIN__
+ mf_release_semaphore(((Flash*)_ioAccess)->getMflashObj());
+ wdcif_send_image_cache_request(((Flash*)_ioAccess)->getMfileObj());
+#endif
return true;
}
u_int32_t cntx_image_start[CNTX_START_POS_SIZE];
u_int32_t cntx_image_num;
- CntxFindAllImageStart(romImg, cntx_image_start, &cntx_image_num);
+ FindAllImageStart(romImg, cntx_image_start, &cntx_image_num, _cntx_magic_pattern);
if (cntx_image_num != 0) {
return errmsg("Expecting an expansion ROM image, Recieved Mellanox FW image.");
}
#define DEFAULT_GUID_NUM 0xff
#define DEFAULT_STEP DEFAULT_GUID_NUM
-// FW Binary version
-
-// max supported major version
-// first time breaking compatibility remove the check if the version is not initialized
-#define FS3_MAX_BIN_VER_MAJOR 1
-
-// min supported version
-#define FS3_MIN_BIN_VER_MAJOR 1
-#define FS3_MIN_BIN_VER_MINOR 1
-
+//fs4 use the same itoc signatures, please double check
const u_int32_t Fs3Operations::_itocSignature[4] = {
ITOC_ASCII, // Ascii of "MTFW"
TOC_RAND1, // Random data
{FS3_NV_DATA0, "NV_DATA"},
{FS3_FW_NV_LOG, "FW_NV_LOG"},
{FS3_NV_DATA0, "NV_DATA"},
+ {FS3_DTOC, "DTOC_Header"},
+ {FS4_HW_PTR, "HW Pointers"},
+ {FS4_TOOLS_AREA, "Tools Area"}
};
bool Fs3Operations::Fs3UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size)
{
- // vector<u_int8_t>::iterator it;
- u_int32_t min_required_size = addr + size;
-
- if (_fs3ImgInfo.imageCache.size() < min_required_size) {
- _fs3ImgInfo.imageCache.resize(min_required_size);
- }
- for (u_int32_t i = 0; i < size; i++) {
- _fs3ImgInfo.imageCache.at(addr + i) = buff[i];
+ if (size == 0) { // empty
+ return true;
}
+ _imageCache.add(buff, addr, size);
return true;
}
_fs3ImgInfo.sizeOfImgData = (_fs3ImgInfo.sizeOfImgData > currSizeOfImgdata) ? _fs3ImgInfo.sizeOfImgData : phys_addr;
}
section_last_addr = phys_addr + entry_size_in_bytes;
- _fwImgInfo.lastImageAddr = (_fwImgInfo.lastImageAddr >= phys_addr + section_last_addr) ? _fwImgInfo.lastImageAddr : section_last_addr;
+ _fwImgInfo.lastImageAddr = (_fwImgInfo.lastImageAddr >= section_last_addr) ? _fwImgInfo.lastImageAddr : section_last_addr;
if (IsFs3SectionReadable(toc_entry.type, queryOptions)) {
// Only when we have full verify or the info of this section should be collected for query
std::vector<u_int8_t> buffv(entry_size_in_bytes);
u_int8_t *buff = (u_int8_t*)(&(buffv[0]));
-
if (show_itoc) {
cibfw_itoc_entry_dump(&toc_entry, stdout);
DumpFs3CRCCheck(toc_entry.type, phys_addr, entry_size_in_bytes, 0, 0, true, verifyCallBackFunc);
Fs3UpdateImgCache(buff, flash_addr, entry_size_in_bytes);
u_int32_t sect_crc = CalcImageCRC((u_int32_t*)buff, toc_entry.size);
- // printf("-D- flash_addr: %#x, toc_entry_size = %#x, actual sect = %#x, from itoc: %#x np_crc = %s\n", flash_addr, toc_entry.size, sect_crc,
- // toc_entry.section_crc, toc_entry.no_crc ? "yes" : "no");
+ //printf("-D- flash_addr: %#x, toc_entry_size = %#x, actual sect = %#x, from itoc: %#x np_crc = %s\n", flash_addr, toc_entry.size, sect_crc,
+ // toc_entry.section_crc, toc_entry.no_crc ? "yes" : "no");
if (!DumpFs3CRCCheck(toc_entry.type, phys_addr, entry_size_in_bytes, sect_crc, toc_entry.section_crc, toc_entry.no_crc, verifyCallBackFunc)) {
if (toc_entry.device_data) {
_badDevDataSections = true;
queryOptions.readRom = true;
queryOptions.quickQuery = false;
- return Fs3Verify(verifyCallBackFunc, showItoc, queryOptions);
+ return FsVerifyAux(verifyCallBackFunc, showItoc, queryOptions);
}
#define BOOT_RECORD_SIZE 0x10
return true;
}
-bool Fs3Operations::CheckBinVersion(u_int8_t binVerMajor, u_int8_t binVerMinor)
-{
- if (binVerMajor == 0 && binVerMinor == 0) {
- return true;
- }
-
- if (binVerMajor > FS3_MAX_BIN_VER_MAJOR) {
- return errmsg(MLXFW_UNSUPPORTED_BIN_VER_ERR, "Unsupported binary version (%d.%d) please update to latest MFT package", binVerMajor, binVerMinor);
- }
-
- if (binVerMajor < FS3_MIN_BIN_VER_MAJOR || (binVerMajor == FS3_MIN_BIN_VER_MAJOR && binVerMinor < FS3_MIN_BIN_VER_MINOR)) {
- return errmsg(MLXFW_UNSUPPORTED_BIN_VER_ERR, "Unsupported binary version (%d.%d) minimal supported version (%d.%d)", \
- binVerMajor, binVerMinor, FS3_MIN_BIN_VER_MAJOR, FS3_MIN_BIN_VER_MINOR);
- }
-
- return true;
-}
-
-bool Fs3Operations::Fs3Verify(VerifyCallBack verifyCallBackFunc, bool show_itoc, struct QueryOptions queryOptions)
+bool Fs3Operations::FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_itoc, struct QueryOptions queryOptions)
{
u_int32_t cntx_image_start[CNTX_START_POS_SIZE];
u_int32_t cntx_image_num;
u_int8_t binVerMajor = 0, binVerMinor = 0;
bool bad_signature;
- CntxFindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num);
+ FindAllImageStart(_ioAccess, cntx_image_start, &cntx_image_num, _cntx_magic_pattern);
if (cntx_image_num == 0) {
return errmsg(MLXFW_NO_VALID_IMAGE_ERR, "No valid FS3 image found");
}
offset = (offset % sector_size == 0) ? offset : (offset + sector_size - offset % 0x1000);
while (offset < _ioAccess->get_size())
{
+
if (VerifyTOC(offset, bad_signature, verifyCallBackFunc, show_itoc, queryOptions)) {
return true;
} else {
}
-bool Fs3Operations::Fs3IntQuery(bool readRom, bool quickQuery)
+bool Fs3Operations::FsIntQueryAux(bool readRom, bool quickQuery)
{
struct QueryOptions queryOptions;
queryOptions.readRom = readRom;
queryOptions.quickQuery = quickQuery;
- if (!Fs3Verify((VerifyCallBack)NULL, 0, queryOptions)) {
+ if (!FsVerifyAux((VerifyCallBack)NULL, 0, queryOptions)) {
return false;
}
// get chip type and device sw id, from device/image
if (!_fwParams.ignoreCacheRep) {
getRunningFwVersion();
}
+ } else if(_fwImgInfo.supportedHwIdNum > 0){ // image
+ if (!getInfoFromHwDevid(_fwImgInfo.supportedHwId[0], _fwImgInfo.ext_info.chip_type, &swId)) {
+ return false;
+ }
+ _fwImgInfo.ext_info.dev_type = swId[0];
}
return true;
}
//isStripedImage flag is not needed in FS3 image format
// Avoid warning - no striped image in FS3
(void)isStripedImage;
- if (!Fs3IntQuery(readRom)) {
+ if (!FsIntQueryAux(readRom)) {
return false;
}
- //adrianc: best effort to get chip_type for image on image since it can "theoretically" be used on more than one device , take the first one.
- if (!_ioAccess->is_flash()) {
- const u_int32_t* swId = (u_int32_t*)NULL;
- if (!getInfoFromHwDevid(_fwImgInfo.supportedHwId[0], _fwImgInfo.ext_info.chip_type, &swId)) {
- return false;
- }
- _fwImgInfo.ext_info.dev_type = swId[0];
- }
memcpy(&(fwInfo->fw_info), &(_fwImgInfo.ext_info), sizeof(fw_info_com_t));
memcpy(&(fwInfo->fs3_info), &(_fs3ImgInfo.ext_info), sizeof(fs3_info_t));
- fwInfo->fw_type = FIT_FS3;
+ fwInfo->fw_type = FwType();
return true;
}
return true;
}
-bool Fs3Operations::DevDataHackCheck(struct cibfw_itoc_entry *devTocEntry)
-{
- if (_fwImgInfo.ext_info.chip_type != CT_CONNECT_IB) {
- return false;
- }
- switch(devTocEntry->type) {
- case FS3_NV_DATA2 :
- case FS3_FW_NV_LOG :
- case FS3_NV_DATA0 :
- if (devTocEntry->device_data == 0 && devTocEntry->no_crc == 0 && devTocEntry->relative_addr == 1) {
- return true;
- }
- break;
- default :
- break;
- }
- return false;
-}
-
#define GET_DIFFER_STR(flash_toc_entry, image_toc_entry) \
(flash_toc_entry->device_data != image_toc_entry->device_data) ? "device_data" : \
(flash_toc_entry->no_crc != image_toc_entry->no_crc) ? "no_crc" : \
(flash_toc_entry->relative_addr != image_toc_entry->relative_addr) ? "relative_addr" : ""
-bool Fs3Operations::UpdateDevDataITOC(u_int8_t *image_data, struct toc_info *image_toc_info_entry, struct toc_info *flash_toc_arr, int flash_toc_size)
+bool Fs3Operations::UpdateDevDataITOC(Fs3Operations &imageOps, struct toc_info *image_toc_info_entry, struct toc_info *flash_toc_arr, int flash_toc_size)
{
u_int8_t itoc_data[CIBFW_ITOC_ENTRY_SIZE];
struct cibfw_itoc_entry *image_toc_entry = &image_toc_info_entry->toc_entry;
if ( (flash_toc_entry->device_data != image_toc_entry->device_data) || \
(flash_toc_entry->no_crc != image_toc_entry->no_crc) || \
(flash_toc_entry->relative_addr != image_toc_entry->relative_addr)) {
- /* HACK: adrianc:remove at MFT-4.1.0
- * if we encounter NV_DATA0/NV_DATA1/FW_NV_LOG that are marked in the device as non dev data
- * it means a corrupt binary was burnt on device. take those entries from the image
- */
- if (DevDataHackCheck(flash_toc_entry)) {
- // perform HACK : i.e keep itoc entry as is in the image
- continue;
- } else {
return errmsg(MLXFW_DEVICE_IMAGE_MISSMATCH_ERR, "An inconsistency was found in %s section attributes. %s ITOC attribute differs",\
GetSectionNameByType(image_toc_entry->type), GET_DIFFER_STR(flash_toc_entry, image_toc_entry));
- }
}
// replace itoc entry in the image
memset(itoc_data, 0, CIBFW_ITOC_ENTRY_SIZE);
cibfw_itoc_entry_pack(flash_toc_entry, itoc_data);
- memcpy(&image_data[image_toc_info_entry->entry_addr], itoc_data, CIBFW_ITOC_ENTRY_SIZE);
- cibfw_itoc_entry_unpack(&image_toc_info_entry->toc_entry, &image_data[image_toc_info_entry->entry_addr]);
+ imageOps.Fs3UpdateImgCache(itoc_data, image_toc_info_entry->entry_addr, CIBFW_ITOC_ENTRY_SIZE);
+ cibfw_itoc_entry_unpack(&image_toc_info_entry->toc_entry, itoc_data);
}
}
return true;
}
+
// add an itoc entry to the image (just the entry no the section itself)
bool Fs3Operations::AddDevDataITOC(struct toc_info *flash_toc_entry, u_int8_t *image_data, struct toc_info *image_toc_arr, int& image_toc_size)
{
#define SUPPORTS_ISFU(chip_type) \
(chip_type == CT_CONNECT_IB || chip_type == CT_CONNECTX4 || chip_type == CT_CONNECTX4_LX || chip_type == CT_CONNECTX5)
-#define FLASH_RESTORE(origFlashObj) \
- if (origFlashObj) {\
- _ioAccess->close();\
- delete _ioAccess;\
- _ioAccess = origFlashObj;\
- _fwParams.ignoreCacheRep = 0;\
- }
-
bool Fs3Operations::BurnFs3Image(Fs3Operations &imageOps,
ExtBurnParams& burnParams)
{
u_int32_t new_image_start;
u_int32_t total_img_size = 0;
u_int32_t sector_size = FS3_DEFAULT_SECTOR_SIZE;
-
+ u_int8_t imageSignature[16];
Flash *f = (Flash*)(this->_ioAccess);
FImage *fim = (FImage*)(imageOps._ioAccess);
- u_int8_t *data8 = (u_int8_t *) fim->getBuf();
+ u_int8_t *data8;
if (_fwImgInfo.imgStart != 0 || (!burnParams.burnFailsafe && ((Flash*)_ioAccess)->get_ignore_cache_replacment())) {
// if the burn is not failsafe and with -ocr, the image is burnt at 0x0
is_curr_image_in_odd_chunks = 0;
new_image_start = (1 << imageOps._fwImgInfo.cntxLog2ChunkSize);
}
- /*printf("-D- new_image_start = %#x, is_curr_image_in_odd_chunks = %#x\n", new_image_start, is_curr_image_in_odd_chunks);
- printf("-D- num_of_itocs = %d\n", image_info->num_of_itocs);
- */
+ /*printf("-D- new_image_start = %#x, is_curr_image_in_odd_chunks = %#x\n", new_image_start, is_curr_image_in_odd_chunks);*/
+
// take chunk size from image in case of a non failsafe burn (in any case they should be the same)
f->set_address_convertor(imageOps._fwImgInfo.cntxLog2ChunkSize, !is_curr_image_in_odd_chunks);
struct toc_info *itoc_info_p = &imageOps._fs3ImgInfo.tocArr[i];
struct cibfw_itoc_entry *toc_entry = &itoc_info_p->toc_entry;
- if (toc_entry->device_data) {// updare dev_data itoc with the device's dev_data section addr
+ if (toc_entry->device_data) {// update dev_data itoc with the device's dev_data section addr
if (burnParams.burnFailsafe || !burnParams.useImgDevData) {
// we update the device data entires if : a. we burn failsafe or b. we burn non-failsafe but we take the device data anyway
- if(!UpdateDevDataITOC(data8, itoc_info_p, _fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs)){
+ if(!UpdateDevDataITOC(imageOps, itoc_info_p, _fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs)){
return false;
}
}
continue;
}
}
+
// add boot section, itoc array (wo signature)
total_img_size += imageOps._fs3ImgInfo.itocAddr + sector_size - FS3_FW_SIGNATURE_SIZE;
return errmsg("Failed to burn FW. Internal error.");
}
- u_int32_t zeroes = 0;
// write the image
int alreadyWrittenSz=0;
+
+ /* Write begining of image: up to and including ITOCs W/O signature */
+ u_int32_t beginingWithoutSignatureSize = imageOps._fs3ImgInfo.itocAddr + sector_size - FS3_FW_SIGNATURE_SIZE;
+ data8 = new u_int8_t[beginingWithoutSignatureSize];
+ imageOps._imageCache.get(data8, FS3_FW_SIGNATURE_SIZE, beginingWithoutSignatureSize);
// write boot section, itoc array (wo signature)
if (!writeImage(burnParams.progressFunc,
FS3_FW_SIGNATURE_SIZE,
- data8 + FS3_FW_SIGNATURE_SIZE,
- imageOps._fs3ImgInfo.itocAddr + sector_size - FS3_FW_SIGNATURE_SIZE,
+ data8,
+ beginingWithoutSignatureSize,
false,
false,
total_img_size,
alreadyWrittenSz)) {
+ delete[] data8;
return false;
}
- alreadyWrittenSz += imageOps._fs3ImgInfo.itocAddr + sector_size - FS3_FW_SIGNATURE_SIZE;
+ delete[] data8;
+ alreadyWrittenSz += beginingWithoutSignatureSize;
// write itoc entries data
for (int i = 0; i < imageOps._fs3ImgInfo.numOfItocs; i++) {
struct toc_info *itoc_info_p = &imageOps._fs3ImgInfo.tocArr[i];
if (!f->is_flash()) {
return true;
}
+ fim->read(0, imageSignature, 16);
// Write new signature
- if (!f->write(0, data8, 16, true)) {
+ if (!f->write(0, imageSignature, 16, true)) {
return false;
}
- bool boot_address_was_updated = true;
-
- // if we access without cache replacement or the burn was non failsafe, update YU bootloaders.
- // if we access with cache replacement notify currently running fw of new image start address to crspace (for SW reset)
- //TODO: add SwitchIB, Spectrum when we have support for ISFU
- if (!SUPPORTS_ISFU(_fwImgInfo.ext_info.chip_type) || !burnParams.burnFailsafe || f->get_ignore_cache_replacment()) {
- boot_address_was_updated = f->update_boot_addr(new_image_start);
- } else {
- _isfuSupported = Fs3IsfuActivateImage(new_image_start);
- boot_address_was_updated = _isfuSupported;
- }
-
- if (imageOps._fwImgInfo.ext_info.is_failsafe) {
- if (!burnParams.burnFailsafe) {
- // When burning in nofs, remnant of older image with different chunk size
- // may reside on the flash -
- // Invalidate all images marking on flash except the one we've just burnt
-
- u_int32_t cntx_image_start[CNTX_START_POS_SIZE];
- u_int32_t cntx_image_num;
-
- CntxFindAllImageStart(f, cntx_image_start, &cntx_image_num);
- // Address convertor is disabled now - use phys addresses
- for (u_int32_t i = 0; i < cntx_image_num; i++) {
- if (cntx_image_start[i] != new_image_start) {
- if (!f->write(cntx_image_start[i], &zeroes, sizeof(zeroes), true)) {
- return errmsg(MLXFW_FLASH_WRITE_ERR, "Failed to invalidate old fw signature: %s", f->err());
- }
- }
- }
- } else {
- // invalidate previous signature
- f->set_address_convertor(imageOps._fwImgInfo.cntxLog2ChunkSize, is_curr_image_in_odd_chunks);
- if (!f->write(0, &zeroes, sizeof(zeroes), true)) {
- return errmsg(MLXFW_FLASH_WRITE_ERR, "Failed to invalidate old fw signature: %s", f->err());
- }
- }
- }
- if (boot_address_was_updated == false) {
- report_warn("Failed to update FW boot address. Power cycle the device in order to load the new FW.\n");
- }
- return true;
+ return DoAfterBurnJobs(_cntx_magic_pattern, imageOps, burnParams, f,
+ new_image_start, is_curr_image_in_odd_chunks);
}
-bool Fs3Operations::Fs3Burn(Fs3Operations &imageOps, ExtBurnParams& burnParams)
+
+bool Fs3Operations::FsBurnAux(FwOperations *imgops, ExtBurnParams& burnParams)
{
+ Fs3Operations& imageOps = * ((Fs3Operations *) imgops);
+
if (imageOps.FwType() != FIT_FS3) {
return errmsg(MLXFW_IMAGE_FORMAT_ERR, "FW image type is not FS3\n");
}
- bool devIntQueryRes = Fs3IntQuery();
+ bool devIntQueryRes = FsIntQueryAux();
if (!devIntQueryRes && burnParams.burnFailsafe) {
return false;
}
// for image we execute full verify to bring all the information needed for ROM Patch
- if (!imageOps.Fs3IntQuery(true, false)) {
+ if (!imageOps.FsIntQueryAux(true, false)) {
return false;
}
// Check Matching device ID
}
}
- Fs3Operations *imgToBurn = &imageOps;
- bool createNewImg = false;
- std::vector<u_int8_t> newImageData(imageOps._fwImgInfo.lastImageAddr);
-
if (devIntQueryRes && !CheckPSID(imageOps, burnParams.allowPsidChange)) {
return false;
}
- // no access to flash parameters under uefi
-#ifndef UEFI_BUILD
- // TODO: adrianc: remove this in MFT-4.1.0
- if(burnParams.burnFailsafe) {
- if(!CheckAndFixCX4(false)) {
- return false;
- }
- if(!FixCX4WriteProtection(false)) {
- return false;
- }
- }
-#endif
-
if (burnParams.burnFailsafe) {
// Check image and device chunk sizes are Ok
if (_fwImgInfo.cntxLog2ChunkSize != imageOps._fwImgInfo.cntxLog2ChunkSize) {
// 1. use Fs3ModifySection to integrate _romSect buff with the image , newImageData contains the modified image buffer
std::vector<u_int8_t> romSect = _romSect;
TOCPUn((u_int32_t*)&romSect[0], romSect.size()/4);
- if (!imageOps.Fs3ReplaceSectionInDevImg(FS3_ROM_CODE, FS3_PCI_CODE, true, (u_int8_t*)&newImageData[0], imageOps._fwImgInfo.lastImageAddr,
- (u_int32_t*)&romSect[0], (u_int32_t)romSect.size(), true)) {
+ if (!imageOps.Fs3ReplaceSectionInDevImg(FS3_ROM_CODE, FS3_PCI_CODE, true, (u_int8_t*)NULL, 0,
+ (u_int32_t*)&romSect[0], (u_int32_t)romSect.size())) {
return errmsg(MLXFW_ROM_UPDATE_IN_IMAGE_ERR, "failed to update ROM in image. %s", imageOps.err());
}
- createNewImg = true;
- }
+ }
// image vsd patch
if (!burnParams.useImagePs && (burnParams.vsdSpecified || burnParams.useDevImgInfo)) {
// get image info section :
strncpy(tools_image_info.description, _fs3ImgInfo.ext_info.description, DESCRIPTION_LEN - 1);
tools_open_image_info_pack(&tools_image_info, &imageInfoSect[0]);
}
-
// re-insert it into the image:
- if (!imageOps.Fs3ReplaceSectionInDevImg(FS3_IMAGE_INFO, FS3_FW_ADB, true, (u_int8_t*)&newImageData[0], imageOps._fwImgInfo.lastImageAddr,
- (u_int32_t*)&imageInfoSect[0], (u_int32_t)imageInfoSect.size(), true)) {
+ if (!imageOps.Fs3ReplaceSectionInDevImg(FS3_IMAGE_INFO, FS3_FW_ADB, true,(u_int8_t*) NULL, 0,
+ (u_int32_t*)&imageInfoSect[0], (u_int32_t)imageInfoSect.size())) {
return errmsg(MLXFW_UPDATE_SECT_ERR, "failed to update IMAGE_INFO section in image. %s", imageOps.err());
}
- createNewImg = true;
- }
-
- // create fs3Operation Obj (handl type BUFF) if NEEDED
- // open the image buffer
- if (createNewImg) {
- FwOperations* newImageOps = FwOperationsCreate((void*)&newImageData[0], (void*)&imageOps._fwImgInfo.lastImageAddr, (char*)NULL, FHT_FW_BUFF);
- if (!newImageOps) {
- return errmsg(MLXFW_IMAGE_CORRUPTED_ERR, "Internal error: The prepared image is corrupted.");
- }
- // 3. verify it
- if (!((Fs3Operations*)newImageOps)->Fs3IntQuery(true,false)) {
- errmsg(MLXFW_IMAGE_CORRUPTED_ERR, "Internal error: The prepared image is corrupted: %s", newImageOps->err());
- newImageOps->FwCleanUp();
- delete newImageOps;
- return false;
- }
- // 4. pass it to BurnFs3Image instead of imageOps
- imgToBurn = (Fs3Operations*)newImageOps;
}
}
- bool rc = BurnFs3Image(*imgToBurn, burnParams);
- if (imgToBurn != &imageOps) {
- imgToBurn->FwCleanUp();
- delete imgToBurn;
- }
-
- return rc ;
+ return BurnFs3Image(imageOps, burnParams);
}
bool Fs3Operations::FwBurn(FwOperations *imageOps, u_int8_t forceVersion, ProgressCallBack progressFunc)
burnParams.ignoreVersionCheck = forceVersion;
burnParams.progressFunc = progressFunc;
- return Fs3Burn((*(Fs3Operations*)imageOps), burnParams);
+ return FsBurnAux(imageOps, burnParams);
+
}
bool Fs3Operations::FwBurnAdvanced(FwOperations *imageOps, ExtBurnParams& burnParams)
if (imageOps == NULL) {
return errmsg("bad parameter is given to FwBurnAdvanced\n");
}
- return Fs3Burn((*(Fs3Operations*)imageOps), burnParams);
+ return FsBurnAux(imageOps, burnParams);
}
bool Fs3Operations::FwBurnBlock(FwOperations *imageOps, ProgressCallBack progressFunc)
queryOptions.quickQuery = true;
}
// Avoid Warning
- if (!Fs3Verify((VerifyCallBack)NULL, 0, queryOptions)) {
+ if (!FsVerifyAux((VerifyCallBack)NULL, 0, queryOptions)) {
return false;
}
- if (image != NULL) {
- memcpy(image, &_fs3ImgInfo.imageCache[0], _fwImgInfo.lastImageAddr);
- }
+ _imageCache.get((u_int8_t*)image, _fwImgInfo.lastImageAddr);
*imageSize = _fwImgInfo.lastImageAddr;
return true;
}
bool Fs3Operations::FwReadRom(std::vector<u_int8_t>& romSect)
{
- if (!Fs3IntQuery()) {
+ if (!FsIntQueryAux()) {
return false;
}
if (_romSect.empty()) {
}
//set the sector to read (need to remove it after read)
_readSectList.push_back(sectType);
- if (!Fs3IntQuery()) {
+ if (!FsIntQueryAux()) {
_readSectList.pop_back();
return false;
}
return false;
}
// on image verify that image is OK after modification (we skip this on device for performance reasons)
- if (!_ioAccess->is_flash() && !Fs3IntQuery(false, false)) {
+ if (!_ioAccess->is_flash() && !FsIntQueryAux(false, false)) {
return false;
}
return true;
return errmsg("Base GUID not found.");
}
//query device to get mfg info (for guids override en bit)
- if (!Fs3IntQuery(false)) {
+ if (!FsIntQueryAux(false)) {
return false;
}
return false;
}
// on image verify that image is OK after modification (we skip this on device for performance reasons)
- if (!_ioAccess->is_flash() && !Fs3IntQuery(false, false)) {
+ if (!_ioAccess->is_flash() && !FsIntQueryAux(false, false)) {
return false;
}
return true;
return false;
}
// on image verify that image is OK after modification (we skip this on device for performance reasons)
- if (!_ioAccess->is_flash() && !Fs3IntQuery(false, false)) {
+ if (!_ioAccess->is_flash() && !FsIntQueryAux(false, false)) {
return false;
}
return true;
shiftSize -= removedOrNewSectSize;
}
numOfItocs = 0;
+ int shifEntryToc = 0;
+ u_int32_t shiftEntryAddr = -1;
+ int ignoreShiftIdx = -1;
for (int i = 0; i < _fs3ImgInfo.numOfItocs; i++) {
struct toc_info *curr_itoc = &_fs3ImgInfo.tocArr[i];
struct toc_info *newTocInfo = &tocArr[numOfItocs];
u_int32_t currSectaddr = curr_itoc->toc_entry.flash_addr << 2; // Put it in one place
-
+ //printf("-D- BEFORE : Entry Type: %#x, Entry offset: %#x\n", curr_itoc->toc_entry.type, curr_itoc->entry_addr);
if (currSectaddr > newSectAddr) {
if (!curr_itoc->toc_entry.relative_addr) {
CopyItocInfo(newTocInfo, curr_itoc);
} else {
ShiftItocAddrInEntry(newTocInfo, curr_itoc, shiftSize);
+
}
} else if (currSectaddr == newSectAddr) {
+ shiftEntryAddr = curr_itoc->entry_addr + CIBFW_ITOC_ENTRY_SIZE;
if (!toAdd) {
+ shifEntryToc = -1 * CIBFW_ITOC_ENTRY_SIZE;
continue;
}
+ shifEntryToc = CIBFW_ITOC_ENTRY_SIZE;
CopyItocInfo(newTocInfo, curr_itoc);
Fs3UpdateItocInfo(newTocInfo, newSectAddr, sectionType, newSectData, removedOrNewSectSize);
// put next section
newTocInfo = &tocArr[++numOfItocs];
ShiftItocAddrInEntry(newTocInfo, curr_itoc, shiftSize);
+ newTocInfo->entry_addr = shiftEntryAddr;
+ ignoreShiftIdx = numOfItocs;
+ } else {
+ shifEntryToc = 0;
}
} else {
// just Copy the ITOC as is
}
numOfItocs++;
}
+ if (shifEntryToc) {
+ for (int i = 0; i < (int)numOfItocs; i++) {
+ struct toc_info *tocInfo = &tocArr[i];
+ if (i != ignoreShiftIdx && tocInfo->entry_addr >= shiftEntryAddr) {
+ tocInfo->entry_addr += shifEntryToc;
+ }
+ //printf("-D- AFTER : Entry Type: %#x, Entry offset: %#x\n", tocInfo->toc_entry.type, tocInfo->entry_addr);
+ }
+ }
return true;
}
{
// Copy data before itocAddr and ITOC header
- memcpy(newImgData, &_fs3ImgInfo.imageCache[0], _fs3ImgInfo.itocAddr);
- memcpy(&newImgData[_fs3ImgInfo.itocAddr], _fs3ImgInfo.itocHeader, CIBFW_ITOC_HEADER_SIZE);
+ //memcpy(newImgData, &_imageCache[0], _fs3ImgInfo.itocAddr);
+ if (newImgData) {
+ _imageCache.get(newImgData, _fs3ImgInfo.itocAddr);
+ memcpy(&newImgData[_fs3ImgInfo.itocAddr], _fs3ImgInfo.itocHeader, CIBFW_ITOC_HEADER_SIZE);
+ } else {
+ Fs3UpdateImgCache(_fs3ImgInfo.itocHeader, _fs3ImgInfo.itocAddr, CIBFW_ITOC_HEADER_SIZE);
+ newImageSize = _fwImgInfo.lastImageAddr;
+ }
for (int i = 0; i < (int)numOfItocs; i++) {
// Inits
u_int32_t itocOffset = _fs3ImgInfo.itocAddr + CIBFW_ITOC_HEADER_SIZE + i * CIBFW_ITOC_ENTRY_SIZE;
return errmsg("Internal error: Sectoion size of %s (0x%x) is not equal to allocated memory for it(0x%x)", GetSectionNameByType(sectType),
sectSize, (u_int32_t)currItoc->section_data.size());
}
+ if (!newImgData) {
+ Fs3UpdateImgCache(currItoc->data, itocOffset, CIBFW_ITOC_ENTRY_SIZE);
+ Fs3UpdateImgCache(&currItoc->section_data[0], sectAddr, sectSize);
+ } else {
+ memcpy(&newImgData[itocOffset], currItoc->data, CIBFW_ITOC_ENTRY_SIZE);
- memcpy(&newImgData[itocOffset], currItoc->data, CIBFW_ITOC_ENTRY_SIZE);
-
- memcpy(&newImgData[sectAddr], &currItoc->section_data[0], sectSize);
+ memcpy(&newImgData[sectAddr], &currItoc->section_data[0], sectSize);
+ }
}
u_int32_t lastItocSect = _fs3ImgInfo.itocAddr + CIBFW_ITOC_HEADER_SIZE + numOfItocs * CIBFW_ITOC_ENTRY_SIZE;
- memset(&newImgData[lastItocSect], FS3_END, CIBFW_ITOC_ENTRY_SIZE);
+ if (!newImgData) {
+ u_int8_t fs3_end_buf[CIBFW_ITOC_ENTRY_SIZE] = {FS3_END};
+ Fs3UpdateImgCache(fs3_end_buf, lastItocSect, CIBFW_ITOC_ENTRY_SIZE);
+ } else {
+ memset(&newImgData[lastItocSect], FS3_END, CIBFW_ITOC_ENTRY_SIZE);
+ }
+
return true;
}
+/*
+ * Adrianc: this is probably the longest method signature in this file. to make things clear:
+ * Fs3ReplaceSectionInDevImg() adds a new section to the firmware image or removes an exsisting section from the firmware image.
+ * if user specified newImgData, the modified image (after add/remove) will be copied to the buffer, else the object itself will be modified
+ * (i.e imageCache and itocs updated)
+ *
+ *@param sectionType : section type to add or remove
+ *@param nextSectionType : in case of adding, add the new section before this section type
+ *@param toAdd : specifies whether the operation is add or remove
+ *@param newImageData : if not null the new modified image will be written here (object context remains un-changed)
+ *@param newImageSize: size of newImageData
+ *@param newSectData : data buffer of the section to be added
+ *@param newSectSize : newSectData size
+ *@param UpdateExsistingTocArr: update the objects itoc array
+ * */
+
bool Fs3Operations::Fs3ReplaceSectionInDevImg(fs3_section_t sectionType, fs3_section_t nextSectionType, bool toAdd, u_int8_t* newImgData, u_int32_t newImageSize,
- u_int32_t* newSectData, u_int32_t NewSectSize, bool UpdateExsistingTocArr)
+ u_int32_t* newSectData, u_int32_t NewSectSize)
{
u_int32_t newSectAddr;
u_int32_t numOfItocs;
struct toc_info tocArr[MAX_TOCS_NUM];
fs3_section_t sectToPut;
u_int32_t oldSectSize;
-
if (!GetModifiedSectionInfo(sectionType, nextSectionType, newSectAddr, sectToPut, oldSectSize)) {
return false;
}
if (!UpdateImageAfterInsert(tocArr, numOfItocs, newImgData, newImageSize)) {
return false;
}
-
- if (UpdateExsistingTocArr) {
+ if (!newImgData) { // uptade was perform on the object, update its itoc array
_fs3ImgInfo.numOfItocs = numOfItocs;
for (u_int32_t i=0;i < numOfItocs;i++) {
_fs3ImgInfo.tocArr[i] = tocArr[i];
return Fs3ModifySection(sectionType, sectionType, false, (u_int32_t*)NULL, 0, progressFunc);
}
-
bool Fs3Operations::FwBurnRom(FImage* romImg, bool ignoreProdIdCheck, bool ignoreDevidCheck,
ProgressCallBack progressFunc)
{
if (!FwOperations::getRomsInfo(romImg, romsInfo)) {
return errmsg("Failed to read given ROM.");
}
- if (!Fs3IntQuery(false)) {
+ if (!FsIntQueryAux(false)) {
return false;
}
+ if (getInfoFromChipType(_fwImgInfo.ext_info.chip_type).chipFamilyType != CFT_HCA) {
+ return errmsg("Burn ROM is supported only for HCA devices.");
+ }
+
if (!ignoreProdIdCheck && strcmp(_fwImgInfo.ext_info.product_ver, "") != 0) {
return errmsg("The device FW contains common FW/ROM Product Version - The ROM cannot be updated separately.");
}
return errmsg("Image file ROM: FW is for device %d, but Exp-ROM is for device %d\n", _fwImgInfo.ext_info.dev_type,
romsInfo.exp_rom_com_devid);
}
+ // Burning ROM is not allowed on Device with Timestamp enabled.
+ if (DeviceTimestampEnabled()) {
+ return errmsg("A valid Timestamp was detected on device. ROM cannot be updated. reset timestamp and resume operation");
+ }
return Fs3AddSection(FS3_ROM_CODE, FS3_PCI_CODE, romImg->getBuf(), romImg->getBufLength(), progressFunc);
}
bool Fs3Operations::FwDeleteRom(bool ignoreProdIdCheck, ProgressCallBack progressFunc)
{
//run int query to get product ver
- if (!Fs3IntQuery(true)) {
+ if (!FsIntQueryAux(true)) {
return false;
}
+ if (getInfoFromChipType(_fwImgInfo.ext_info.chip_type).chipFamilyType != CFT_HCA) {
+ return errmsg("Delete ROM is supported only for HCA devices.");
+ }
+
if (_romSect.empty()) {
return errmsg("The FW does not contain a ROM section");
}
if (!ignoreProdIdCheck && strcmp(_fwImgInfo.ext_info.product_ver, "") != 0) {
return errmsg("The device FW contains common FW/ROM Product Version - The ROM cannot be updated separately.");
}
-
+ // Deleting ROM is not allowed on Device with Timestamp enabled.
+ if (DeviceTimestampEnabled()) {
+ return errmsg("A valid Timestamp was detected on device. ROM cannot be updated. reset timestamp and resume operation");
+ }
return Fs3RemoveSection(FS3_ROM_CODE, progressFunc);
}
// (i.e we assume they are located in: mfg_addr - 4k and mfg_addr - 8k)
devInfoAddr1 = (toc->toc_entry.flash_addr << 2) - 0x1000;
devInfoAddr2 = (toc->toc_entry.flash_addr << 2) - 0x2000;
- //printf("-D-mfg_section: 0x%x devInfoAddr1: 0x%x devInfoAddr2: 0x%x\n", toc->toc_entry.flash_addr, devInfoAddr1, devInfoAddr2);
if ((flash_addr == devInfoAddr1) || (flash_addr == devInfoAddr2)){
NewSectionAddr = (flash_addr == devInfoAddr1) ? devInfoAddr2 : devInfoAddr1;
const char *type_msg;
// init sector to read
_readSectList.push_back(sect_type);
- if (!Fs3IntQuery()) {
+ if (!FsIntQueryAux()) {
_readSectList.pop_back();
return false;
}
return false;
}
// on image verify that image is OK after modification (we skip this on device for performance reasons)
- if (!_ioAccess->is_flash() && !Fs3IntQuery(false, false)) {
+ if (!_ioAccess->is_flash() && !FsIntQueryAux(false, false)) {
return false;
}
return true;
/*
// future support for cx4
- if (!Fs3IntQuery(false)) {
+ if (!FsIntQueryAux(false)) {
return false;
}
if (_fwImgInfo.ext_info.chip_type != CT_CONNECTX) {
//query device and get device data sectors.
PUSH_DEV_DATA(_readSectList);
- if (!Fs3IntQuery()) {
+ if (!FsIntQueryAux()) {
POP_DEV_DATA(_readSectList);
return false;
}
return true;
}
-
-#define IS_EMPTY_CX4_MFG_UIDS(fs3_uids_info) \
- (((fs3_uids_info).cx4_uids.base_guid.uid == 0x0ULL) && ((fs3_uids_info).cx4_uids.base_mac.uid == 0x0ULL))
-
-
-#define GET_UID_LOW(uid) \
- ((uid) & 0xffffffffULL)
-
-#define GET_UID_HIGH(uid) \
- ((uid) >> 32)
-
-bool Fs3Operations::CheckAndFixCX4(bool justCheck)
-{
- // assuming query/verify was ran before and this is being called on an MST device during burn
- FBase* origFlashObj = (FBase*)NULL;
-
- if (!_ioAccess->is_flash()) {
- return true;
- }
-
- if (((Flash*)_ioAccess)->get_dev_id() != CX4_HW_ID || _maxImgLog2Size != 0x16) {
- // nothing to do return
- return true;
- }
-
- // re-open flash with -ocr if needed
- if (_fwParams.ignoreCacheRep == 0) {
- origFlashObj = _ioAccess;
- _fwParams.ignoreCacheRep = 1;
- if (!FwOperations::FwAccessCreate(_fwParams, &_ioAccess)) {
- _ioAccess = origFlashObj;
- _fwParams.ignoreCacheRep = 0;
- return errmsg("Failed to open device for direct flash access");
- }
- }
- // check if Flash0 last sub-sector is write protected (indication if we need to continue)
- ext_flash_attr_t attr;
- memset(&attr, 0, sizeof(attr));
-
- if (!((Flash*)_ioAccess)->get_attr(attr)) {
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to perform Flash operation");
- }
-
- if (attr.type_str) {
- delete [] attr.type_str;
- }
-
- if (!(attr.protect_info_array[0].is_subsector && attr.protect_info_array[0].sectors_num == 1 && attr.protect_info_array[0].is_bottom == 0)) {
- // Flash0 protection is not as expected : Flash0.Top,1-SubSectors. nothing to do
- FLASH_RESTORE(origFlashObj);
- return true;
- }
- // mlxmodfw has corrupted dev_data sections and flash protection. attempt to fix
-
- if (justCheck) {
- // just perform checks and return
- FLASH_RESTORE(origFlashObj);
- return false;
- }
-
- char paramName[50] = {0};
- char paramVal[50] = {0};
- bool rc = FixCX4Uids();
-
- // set write protection to last sector
- strncpy(paramName, "Flash0.WriteProtected", 50);
- strncpy(paramVal, "Top,1-Sectors", 50);
- if (!((Flash*)_ioAccess)->set_attr(paramName, paramVal)) {
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to perform Flash operation");
- }
- // wait for flash op to finish
- msleep(500);
- FLASH_RESTORE(origFlashObj);
-
- if (!rc || !Fs3IntQuery()) {
- return false;
- }
- return true;
-}
-
-bool Fs3Operations::FixCX4Uids()
-{
- // fix mfg guids_num and step_size
- fs3_uid_t baseUid;
- memset(&baseUid, 0, sizeof(baseUid));
- if(IS_EMPTY_CX4_MFG_UIDS(_fs3ImgInfo.ext_info.orig_fs3_uids_info)) {
- // fix macs/guids
- // adrianc: if MFGs are zero: set the same uids as in dev_info.
- baseUid.base_guid.l = GET_UID_LOW(_fs3ImgInfo.ext_info.fs3_uids_info.cx4_uids.base_guid.uid);
- baseUid.base_guid.h = GET_UID_HIGH(_fs3ImgInfo.ext_info.fs3_uids_info.cx4_uids.base_guid.uid);
-
- baseUid.base_mac.l = GET_UID_LOW(_fs3ImgInfo.ext_info.fs3_uids_info.cx4_uids.base_mac.uid);
- baseUid.base_mac.h = GET_UID_HIGH(_fs3ImgInfo.ext_info.fs3_uids_info.cx4_uids.base_mac.uid);
-
- baseUid.base_guid_specified = 1;
- baseUid.base_mac_specified = 1;
- baseUid.set_mac_from_guid = 0;
-
- // set manufacture guids
- if (!FwSetMFG(baseUid)) {
- return false;
- }
- }
- return true;
-}
-
-#define OPEN_OCR(origFlashObj) do {\
- origFlashObj = _ioAccess;\
- _fwParams.ignoreCacheRep = 1;\
- if (!FwOperations::FwAccessCreate(_fwParams, &_ioAccess)) {\
- _ioAccess = origFlashObj;\
- _fwParams.ignoreCacheRep = 0;\
- return errmsg("Failed to open device for direct flash access");\
- }\
- } while (0)
-
-#define SET_WRITE_PROTECT(name, val) do { \
- char paramName[50] = {0};\
- char paramVal[50] = {0};\
- strncpy(paramName, name, 50);\
- strncpy(paramVal, val, 50);\
- if (!((Flash*)_ioAccess)->set_attr(paramName, paramVal)) {\
- FLASH_RESTORE(origFlashObj);\
- return errmsg("Failed to perform Flash operation");\
- }\
- msleep(500);\
- } while (0)
-
-bool Fs3Operations::FixCX4WriteProtection(bool justCheck)
-{
- if (!_ioAccess->is_flash() || ((Flash*)_ioAccess)->get_dev_id() != CX4_HW_ID) {
- return true;
- }
-
- struct toc_info* mfgToc = (struct toc_info*)NULL;
- struct toc_info* vpdToc = (struct toc_info*)NULL;
- u_int32_t mfgAddr = 0;
- u_int32_t vpdAddr = 0;
- u_int32_t flashSize = 0;
- u_int32_t shiftSize = 0x8000;
- FBase* origFlashObj = (FBase*)NULL;
- std::vector<u_int8_t> newVpdSection;
- int retries = 0;
- if (!Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, FS3_MFG_INFO, mfgToc)) {
- return errmsg("failed to locate MFG_INFO address within the FW image");
- }
- ext_flash_attr_t attr;
- memset(&attr, 0, sizeof(attr));
- if (!((Flash*)_ioAccess)->get_attr(attr)) {
- return errmsg("Failed to perform Flash operation");
- }
- flashSize = attr.size;
- mfgAddr = getAbsAddr(mfgToc);
- /* If the flash size is 16-MB and the MFG at the end 0xff0000
- * Move it with the VPD the bottom 32-bit (shift 0x8000) and
- * FlashProtected Top,8-SubSectors
- */
- if (flashSize != 0x1000000 || mfgAddr != 0xff0000) {
- return true;
- }
-
- if (justCheck) {
- // just perform checks and return
- FLASH_RESTORE(origFlashObj);
- return false;
- }
-
- // get VPD section
- _readSectList.push_back(FS3_VPD_R0);
- if (!Fs3IntQuery()) {
- _readSectList.pop_back();
- return false;
- }
- _readSectList.pop_back();
-
- // re-open flash with -ocr if needed
- if (_fwParams.ignoreCacheRep == 0) {
- OPEN_OCR(origFlashObj);
- }
- /*
- * Check if write protected and disable it
- */
- if (((Flash*)_ioAccess)->is_flash_write_protected()) {
- SET_WRITE_PROTECT("Flash0.WriteProtected", "Disabled");
- }
- while (((Flash*)_ioAccess)->is_flash_write_protected() && retries < 5) {
- msleep(500);
- }
- if (retries == 5) {
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to disable flash write protection");
- }
- /*
- * MOVE MFG & VPD Sections to +0x8000
- */
- const char* flashParamName = "Flash0.WriteProtected";
- const char* flashParamVal = "Top,8-SubSectors";
-
- /*
- * Moving VPD section
- */
- if (!Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, FS3_VPD_R0, vpdToc)) {
- SET_WRITE_PROTECT(flashParamName, flashParamVal);
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to locate VPD_R0 address within the FW image");
- }
- /*
- * VPD_R0 address is after the MFG_INFO section
- */
- vpdAddr = mfgAddr + mfgToc->toc_entry.size * 4;
-
- if (!Fs3UpdateItocInfo(vpdToc, vpdAddr + shiftSize)) {
- SET_WRITE_PROTECT(flashParamName, flashParamVal);
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to shift VPD_R0 section");
- }
- if (!Fs3ReburnItocSection(vpdAddr + shiftSize, vpdToc->toc_entry.size * 4, vpdToc->section_data, "VPD")) {
- SET_WRITE_PROTECT(flashParamName, flashParamVal);
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to burn VPD_R0 section, the image maybe left in bad situation");;
- }
- if (!Fs3UpdateItocInfo(mfgToc, mfgAddr + shiftSize)) {
- SET_WRITE_PROTECT(flashParamName, flashParamVal);
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to shift MFG_INFO section");
- }
- if (!Fs3ReburnItocSection(mfgAddr + shiftSize, mfgToc->toc_entry.size * 4, mfgToc->section_data, "GUID")) {
- SET_WRITE_PROTECT(flashParamName, flashParamVal);
- FLASH_RESTORE(origFlashObj);
- return errmsg("Failed to burn MFG_INFO section, the image maybe left in bad situation");
- }
- /*
- * Enable Flash protected
- */
- SET_WRITE_PROTECT(flashParamName, flashParamVal);
- FLASH_RESTORE(origFlashObj);
- /*
- * Query for check
- */
- if (!Fs3IntQuery()) {
- return errmsg("Failed to query device after fixing write protected sections");
- }
- return true;
-}
-
bool Fs3Operations::FwCalcMD5(u_int8_t md5sum[16])
{
#if defined(UEFI_BUILD) || defined(NO_OPEN_SSL)
(void)md5sum;
return errmsg("Operation not supported");
#else
- if (!Fs3IntQuery(true, false)) {
+ if (!FsIntQueryAux(true, false)) {
return false;
}
// push beggining of image to md5buff
int sz = FS3_BOOT_START + _fwImgInfo.bootSize;
- std::vector<u_int8_t> md5buff(_fs3ImgInfo.imageCache.begin(), _fs3ImgInfo.imageCache.begin() + sz);
+ std::vector<u_int8_t> md5buff(sz, 0);
+ _imageCache.get(&(md5buff[0]), sz);
// push all non dev data sections to md5buff
for (unsigned int j = 0; j < TOC_HEADER_SIZE; j++) {
- md5buff.push_back(_fs3ImgInfo.imageCache[_fs3ImgInfo.itocAddr + j]);
+ md5buff.push_back(_imageCache[_fs3ImgInfo.itocAddr + j]);
}
// push itoc header
for (int i = 0; i < _fs3ImgInfo.numOfItocs; i++) {
if (!_fs3ImgInfo.tocArr[i].toc_entry.device_data) {
// itoc entry
for (unsigned int j = 0; j < TOC_ENTRY_SIZE; j++) {
- md5buff.push_back(_fs3ImgInfo.imageCache[tocEntryAddr + j]);
+ md5buff.push_back(_imageCache[tocEntryAddr + j]);
}
// itoc data
for (unsigned int j = 0; j < tocDataSize; j++) {
- md5buff.push_back(_fs3ImgInfo.imageCache[tocDataAddr + j]);
+ md5buff.push_back(_imageCache[tocDataAddr + j]);
}
}
}
TimeStampIFC* tsObj;
Tlv_Status_t rc;
- if (!_ioAccess->is_flash() && !Fs3IntQuery(false, true)) {
+ if (!_ioAccess->is_flash() && !FsIntQueryAux(false, true)) {
return false;
}
if (GetTsObj(&tsObj)) {
TimeStampIFC* tsObj;
Tlv_Status_t rc;
- if (!_ioAccess->is_flash() && !Fs3IntQuery(false, true)) {
+ if (!_ioAccess->is_flash() && !FsIntQueryAux(false, true)) {
return false;
}
if (GetTsObj(&tsObj)) {
if (queryRunning) {
return errmsg("cannot get running FW Timestamp on image file");
}
- if (!Fs3IntQuery(false, true)) {
+ if (!FsIntQueryAux(false, true)) {
return false;
}
}
memset(&devFwVer, 0, sizeof(devFwVer));
if (!_ioAccess->is_flash()) {
- return errmsg("cannot run TestAndSetTimeStamp on image");
+ // no need to test timestamp on image
+ return true;
}
if (_fwParams.ignoreCacheRep) {
delete devTsObj;
return retRc;
}
+
+bool Fs3Operations::DeviceTimestampEnabled()
+{
+ Tlv_Status_t rc;
+ Tlv_Status_t queryNextTsRc;
+ Tlv_Status_t queryRunningTsRc;
+ TimeStampIFC* devTsObj;
+ struct tools_open_ts_entry devTs;
+ struct tools_open_fw_version devFwVer;
+ memset(&devTs, 0, sizeof(devTs));
+ memset(&devFwVer, 0, sizeof(devFwVer));
+
+ if (!_ioAccess->is_flash()) {
+ return false;
+ }
+
+ if (_fwParams.ignoreCacheRep) {
+ // direct flash assume no TS
+ return false;
+ }
+
+ rc = GetTsObj(&devTsObj);
+ if (rc) {
+ return false;
+ }
+ // TS supported, make sure no valid TS is set
+ queryRunningTsRc = devTsObj->queryTimeStamp(devTs, devFwVer, true);
+ queryNextTsRc = devTsObj->queryTimeStamp(devTs, devFwVer);
+ // Cleanup
+ delete devTsObj;
+
+ if (queryRunningTsRc == TS_OK || queryNextTsRc == TS_OK) {
+ return true;
+ }
+ return false;
+}
+
+bool Fs3Operations::DoAfterBurnJobs(const u_int32_t magic_patter[],
+ Fs3Operations &imageOps, ExtBurnParams& burnParams, Flash *f,
+ u_int32_t new_image_start, u_int8_t is_curr_image_in_odd_chunks)
+{
+ u_int32_t zeroes = 0;
+ bool boot_address_was_updated = true;
+
+ // if we access without cache replacement or the burn was non failsafe, update YU bootloaders.
+ // if we access with cache replacement notify currently running fw of new image start address to crspace (for SW reset)
+ //TODO: add SwitchIB, Spectrum when we have support for ISFU
+ if (!SUPPORTS_ISFU(_fwImgInfo.ext_info.chip_type) || !burnParams.burnFailsafe || f->get_ignore_cache_replacment()) {
+ boot_address_was_updated = f->update_boot_addr(new_image_start);
+ } else {
+ _isfuSupported = Fs3IsfuActivateImage(new_image_start);
+ boot_address_was_updated = _isfuSupported;
+ }
+
+ if (imageOps._fwImgInfo.ext_info.is_failsafe) {
+ if (!burnParams.burnFailsafe) {
+ // When burning in nofs, remnant of older image with different chunk size
+ // may reside on the flash -
+ // Invalidate all images marking on flash except the one we've just burnt
+
+ u_int32_t cntx_image_start[CNTX_START_POS_SIZE];
+ u_int32_t cntx_image_num;
+
+ FindAllImageStart(f, cntx_image_start, &cntx_image_num, magic_patter);
+ // Address convertor is disabled now - use phys addresses
+ for (u_int32_t i = 0; i < cntx_image_num; i++) {
+ if (cntx_image_start[i] != new_image_start) {
+ if (!f->write(cntx_image_start[i], &zeroes, sizeof(zeroes), true)) {
+ return errmsg(MLXFW_FLASH_WRITE_ERR, "Failed to invalidate old fw signature: %s", f->err());
+ }
+ }
+ }
+ } else {
+ // invalidate previous signature
+ f->set_address_convertor(imageOps._fwImgInfo.cntxLog2ChunkSize, is_curr_image_in_odd_chunks);
+ if (!f->write(0, &zeroes, sizeof(zeroes), true)) {
+ return errmsg(MLXFW_FLASH_WRITE_ERR, "Failed to invalidate old fw signature: %s", f->err());
+ }
+ }
+ }
+ if (boot_address_was_updated == false) {
+ report_warn("Failed to update FW boot address. Power cycle the device in order to load the new FW.\n");
+ }
+ return true;
+}
#include <cibfw_layouts.h>
#include <cx4fw_layouts.h>
-#include <tools_open_layouts.h>
+#include <mlarge_buffer.h>
+// #include "flint_base.h"
#include "fw_ops.h"
#include "aux_tlv_ops.h"
+// FW Binary version
+
+// max supported major version
+// first time breaking compatibility remove the check if the version is not initialized
+#define FS3_MAX_BIN_VER_MAJOR 1
+
+// min supported version
+#define FS3_MIN_BIN_VER_MAJOR 1
+#define FS3_MIN_BIN_VER_MINOR 1
+
+#define FLASH_RESTORE(origFlashObj) \
+ if (origFlashObj) {\
+ _ioAccess->close();\
+ delete _ioAccess;\
+ _ioAccess = origFlashObj;\
+ _fwParams.ignoreCacheRep = 0;\
+ }
class Fs3Operations : public FwOperations {
public:
- Fs3Operations(FBase *ioAccess) : FwOperations(ioAccess), _isfuSupported(false), _badDevDataSections(false), _maxImgLog2Size(0){};
+ Fs3Operations(FBase *ioAccess) : FwOperations(ioAccess),
+ _isfuSupported(false), _badDevDataSections(false), _maxImgLog2Size(0){
+ _minBinMinorVer = FS3_MIN_BIN_VER_MINOR;
+ _minBinMajorVer = FS3_MIN_BIN_VER_MAJOR;
+ _maxBinMajorVer = FS3_MAX_BIN_VER_MAJOR;
+ };
virtual ~Fs3Operations() {};
//virtual void print_type() {printf("-D- FS3 type!\n");};
virtual bool FwResetNvData();
virtual bool FwShiftDevData(PrintCallBack progressFunc=(PrintCallBack)NULL);
virtual const char* FwGetResetRecommandationStr();
- virtual bool CheckCX4Device() {return (CheckAndFixCX4() && FixCX4WriteProtection());}
virtual bool FwCalcMD5(u_int8_t md5sum[16]);
virtual bool FwSetTimeStamp(struct tools_open_ts_entry& timestamp, struct tools_open_fw_version& fwVer);
virtual bool FwQueryTimeStamp(struct tools_open_ts_entry& timestamp, struct tools_open_fw_version& fwVer, bool queryRunning=false);
virtual bool FwResetTimeStamp();
-
-private:
- #define CRC_CHECK_OUTPUT CRC_CHECK_OLD")"
- #define FS3_CRC_CHECK_OUT CRC_CHECK_OLD":0x%x)"
- #define PRE_CRC_OUTPUT " "
- #define MAX_TOCS_NUM 64
- #define FS3_DEFAULT_SECTOR_SIZE 0x1000
- #define FS3_LOG2_CHUNK_SIZE_DW_OFFSET 0x9
+protected:
#define ITOC_ASCII 0x49544f43
- #define DTOC_ASCII 0x64544f43
#define TOC_RAND1 0x04081516
#define TOC_RAND2 0x2342cafa
#define TOC_RAND3 0xbacafe00
#define TOC_HEADER_SIZE 0x20
#define TOC_ENTRY_SIZE 0x20
#define FS3_FW_SIGNATURE_SIZE 0x10
+ #define MAX_TOCS_NUM 64
#define MFG_INFO "MFG_INFO"
#define UNKNOWN_SECTION "UNKNOWN"
+ virtual bool FsBurnAux(FwOperations *imageOps, ExtBurnParams& burnParams);
+ bool DumpFs3CRCCheck(u_int8_t sect_type, u_int32_t sect_addr, u_int32_t sect_size, u_int32_t crc_act, u_int32_t crc_exp,
+ bool ignore_crc = false, VerifyCallBack verifyCallBackFunc = (VerifyCallBack)NULL);
+ bool Fs3UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size);
+ virtual bool UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size);
+ virtual bool FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_itoc, struct QueryOptions queryOptions);
+ bool FsIntQueryAux(bool readRom = true, bool quickQuery=true);
+ const char* GetSectionNameByType(u_int8_t section_type);
+ bool GetImageInfoFromSection(u_int8_t *buff, u_int8_t sect_type, u_int32_t sect_size, u_int8_t check_support_only = 0);
+ bool IsGetInfoSupported(u_int8_t sect_type);
+ bool IsFs3SectionReadable(u_int8_t type, QueryOptions queryOptions);
+ bool GetMfgInfo(u_int8_t *buff);
+ bool GetDevInfo(u_int8_t *buff);
+ bool GetImageInfo(u_int8_t *buff);
+ bool GetRomInfo(u_int8_t *buff, u_int32_t size);
+ bool DoAfterBurnJobs(const u_int32_t magic_patter[], Fs3Operations &imageOps,
+ ExtBurnParams& burnParams, Flash *f,
+ u_int32_t new_image_start, u_int8_t is_curr_image_in_odd_chunks);
-
-
+ virtual bool getRunningFwVersion();
+ virtual bool Fs3IsfuActivateImage(u_int32_t newImageStart);
+ bool TestAndSetTimeStamp(Fs3Operations &imageOps);
struct toc_info {
u_int32_t entry_addr;
u_int8_t data[CIBFW_ITOC_ENTRY_SIZE];
std::vector<u_int8_t> section_data;
};
-
+
struct Fs3ImgInfo {
fs3_info_t ext_info;
- std::vector<u_int8_t> imageCache;
int numOfItocs;
struct toc_info tocArr[MAX_TOCS_NUM];
u_int8_t itocHeader[CIBFW_ITOC_HEADER_SIZE];
u_int32_t itocAddr;
u_int32_t smallestAbsAddr;
u_int32_t sizeOfImgData;
-
};
- struct SectionInfo {
- u_int8_t type;
- const char *name;
- };
+ static const SectionInfo _fs3SectionsInfoArr[];
+ static const u_int32_t _itocSignature[4];
+ Fs3ImgInfo _fs3ImgInfo;
+ MlargeBuffer _imageCache;
+ bool _isfuSupported;
+ bool _badDevDataSections; // set true if during verify one of the device data section is corrupt or mfg section missing
+ u_int32_t _maxImgLog2Size;
+
+private:
+ #define CRC_CHECK_OUTPUT CRC_CHECK_OLD")"
+ #define FS3_CRC_CHECK_OUT CRC_CHECK_OLD":0x%x)"
+ #define PRE_CRC_OUTPUT " "
+ #define FS3_DEFAULT_SECTOR_SIZE 0x1000
+ #define FS3_LOG2_CHUNK_SIZE_DW_OFFSET 0x9
- struct QueryOptions {
- bool quickQuery;
- bool readRom;
- };
- bool Fs3UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size);
- virtual bool UpdateImgCache(u_int8_t *buff, u_int32_t addr, u_int32_t size);
bool VerifyTOC(u_int32_t dtoc_addr, bool& bad_signature, VerifyCallBack verifyCallBackFunc, bool show_itoc,
struct QueryOptions queryOptions);
bool checkPreboot(u_int32_t* prebootBuff, u_int32_t size, VerifyCallBack verifyCallBackFunc);
- bool Fs3Verify(VerifyCallBack verifyCallBackFunc, bool show_itoc, struct QueryOptions queryOptions);
- const char* GetSectionNameByType(u_int8_t section_type);
bool CheckTocSignature(struct cibfw_itoc_header *itoc_header, u_int32_t first_signature);
- bool DumpFs3CRCCheck(u_int8_t sect_type, u_int32_t sect_addr, u_int32_t sect_size, u_int32_t crc_act, u_int32_t crc_exp,
- bool ignore_crc = false, VerifyCallBack verifyCallBackFunc = (VerifyCallBack)NULL);
- bool GetImageInfoFromSection(u_int8_t *buff, u_int8_t sect_type, u_int32_t sect_size, u_int8_t check_support_only = 0);
- bool IsGetInfoSupported(u_int8_t sect_type);
- bool IsFs3SectionReadable(u_int8_t type, QueryOptions queryOptions);
- bool GetMfgInfo(u_int8_t *buff);
- bool GetDevInfo(u_int8_t *buff);
- bool GetImageInfo(u_int8_t *buff);
- bool GetRomInfo(u_int8_t *buff, u_int32_t size);
- bool Fs3IntQuery(bool readRom = true, bool quickQuery=true);
- bool Fs3Burn(Fs3Operations &imageOps, ExtBurnParams& burnParams);
bool BurnFs3Image(Fs3Operations &imageOps, ExtBurnParams& burnParams);
- bool UpdateDevDataITOC(u_int8_t *image_data, struct toc_info *image_toc_info_entry, struct toc_info *flash_toc_arr, int flash_toc_size);
+ bool UpdateDevDataITOC(Fs3Operations &imageOps, struct toc_info *image_toc_info_entry, struct toc_info *flash_toc_arr, int flash_toc_size);
+
bool AddDevDataITOC(struct toc_info *flash_toc_entry, u_int8_t *image_data, struct toc_info *image_toc_arr, int& image_toc_size);
bool Fs3UpdateSection(void *new_info, fs3_section_t sect_type=FS3_DEV_INFO, bool is_sect_failsafe=true, CommandType cmd_type=CMD_UNKNOWN, PrintCallBack callBackFunc=(PrintCallBack)NULL );
bool Fs3GetItocInfo(struct toc_info *tocArr, int num_of_itocs, fs3_section_t sect_type, struct toc_info *&curr_toc);
std::vector<u_int8_t> &newSectionData);
bool Fs3UpdateVpdSection(struct toc_info *curr_toc, char *vpd, std::vector<u_int8_t> &newSectionData);
bool Fs3GetNewSectionAddr(struct toc_info *curr_toc, u_int32_t &NewSectionAddr, bool failsafe_section);
-
bool Fs3UpdateItocInfo(struct toc_info *curr_toc, u_int32_t newSectionAddr, u_int32_t itocSize, std::vector<u_int8_t> newSectionData);
bool Fs3UpdateItocInfo(struct toc_info *curr_toc, u_int32_t newSectionAddr);
bool Fs3UpdateItocInfo(struct toc_info *newItocInfo, u_int32_t newSectionAddr, fs3_section_t sectionType, u_int32_t* newSectData, u_int32_t NewSectSize);
struct toc_info *tocArr, u_int32_t &numOfItocs);
bool UpdateImageAfterInsert(struct toc_info *tocArr, u_int32_t numOfItocs, u_int8_t* newImgData, u_int32_t newSectSize);
bool Fs3ReplaceSectionInDevImg(fs3_section_t sectionType, fs3_section_t nextSectionType, bool toAdd, u_int8_t* newImgData,
- u_int32_t newImageSize, u_int32_t* newSectData, u_int32_t NewSectSize, bool UpdateExsistingTocArr= false);
+ u_int32_t newImageSize, u_int32_t* newSectData, u_int32_t NewSectSize);
bool CalcItocEntryCRC(struct toc_info *curr_toc);
bool ShiftItocAddrInEntry(struct toc_info *newItocInfo, struct toc_info *oldItocInfo, int shiftSize);
bool CopyItocInfo(struct toc_info *newTocInfo, struct toc_info *currToc);
bool CheckFs3ImgSize(Fs3Operations& imageOps, bool useImageDevData=false);
bool CheckItocArray();
bool CheckItocArrConsistency(std::vector<struct toc_info*>& sortedTocVec, u_int32_t imageStartAddr);
- bool CheckBinVersion(u_int8_t binVerMajor, u_int8_t binVerMinor);
- bool getRunningFwVersion();
+
u_int32_t getAbsAddr(toc_info* toc);
u_int32_t getAbsAddr(toc_info* toc, u_int32_t imgStart);
bool getLastFwSAddr(u_int32_t& lastAddr);
bool getFirstDevDataAddr(u_int32_t& firstAddr);
bool reburnItocSection(PrintCallBack callBackFunc);
- bool Fs3IsfuActivateImage(u_int32_t newImageStart);
- bool TestAndSetTimeStamp(Fs3Operations &imageOps);
+ bool DeviceTimestampEnabled();
Tlv_Status_t GetTsObj(TimeStampIFC** tsObj);
- bool CheckAndFixCX4(bool justCheck=true);
- bool FixCX4Uids();
- bool FixCX4WriteProtection(bool justCheck=true);
- bool DevDataHackCheck(struct cibfw_itoc_entry *devTocEntry);
-
// this class is for sorting the itoc array by ascending absolute flash_addr used in FwShiftDevData
class TocComp {
public:
u_int32_t _startAdd;
};
- // Members
- static const SectionInfo _fs3SectionsInfoArr[];
- static const u_int32_t _itocSignature[4];
- Fs3ImgInfo _fs3ImgInfo;
- bool _isfuSupported;
- bool _badDevDataSections; // set true if during verify one of the device data section is corrupt or mfg section missing
- u_int32_t _maxImgLog2Size;
-
};
#include "fs3_ops.h"
#include "fs2_ops.h"
+#ifdef CABLES_SUPP
+#include "cablefw_ops.h"
+#endif
#ifndef NO_MFA_SUPPORT
#include <mfa.h>
if (!strncmp(tmpb, "MFAR", 4)) {
res = IMG_SIG_TYPE_MFA;
}
+ if (!strncmp(tmpb, "MTCF", 4)) {
+ res = IMG_SIG_TYPE_CF;
+ }
clean_up:
fclose(fin);
// Get absolute address on flash when checking BOOT2 for FS3 image format (for FS2 its always displayed as contiguous)
// Adrianc: why dont we show them both in the same way when running verify.
- u_int32_t boot2AbsAddr = (this->FwType() == FIT_FS3 && _ioAccess->is_flash()) ? \
+ u_int32_t boot2AbsAddr = ((this->FwType() == FIT_FS3 || this->FwType() == FIT_FS4) && _ioAccess->is_flash()) ? \
_ioAccess->get_phys_from_cont(beg, _fwImgInfo.cntxLog2ChunkSize, (_fwImgInfo.imgStart != 0)) : beg;
sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (BOOT2)", pref, offs+boot2AbsAddr,
READBUF((*_ioAccess), offs+beg, buff, size*4 + 16, pr);
// we hold for FS3 an image cache so we selectevely update it in UpdateImgCache() call
UpdateImgCache((u_int8_t*)buff, offs+beg, size*4 + 16);
-
TOCPUn(buff, size+4);
CRC1n(crc, buff, size+4);
CRC1n(_ioAccess->get_image_crc(), buff, size+4);
0x4154BEEF
};
+const u_int32_t FwOperations::_fs4_magic_pattern[4] = {
+ 0x4D544657,
+ 0xABCDEF00,
+ 0xFADE1234,
+ 0x5678DEAD
+};
+
const u_int32_t FwOperations::_cntx_image_start_pos[FwOperations::CNTX_START_POS_SIZE] = {
0,
0x10000,
0x400000
};
-bool FwOperations::CntxFindMagicPattern (FBase* ioAccess, u_int32_t addr) {
+bool FwOperations::FindMagicPattern(FBase* ioAccess, u_int32_t addr,
+ u_int32_t const cntx_magic_pattern[]) {
if (addr + 16 > ioAccess->get_size()) {
return false;
}
u_int32_t w;
READ4_NOERRMSG((*ioAccess), addr + i * 4, &w);
TOCPU1(w);
- if (w != _cntx_magic_pattern[i]) {
+ if (w != cntx_magic_pattern[i]) {
//printf("-D- Looking for magic pattern %d addr %06x: Exp=%08x Act=%08x\n", i, addr + i * 4, _cntx_magic_pattern[i], w);
return false;
}
return true;
}
-
-
// FindAllImageStart
// OUT: start_locations: set to the start addresses of the found image markers (in accending order)
// OUT: found_images: Number of found images (and number of valid entries in the start_locations array).
-bool FwOperations::CntxFindAllImageStart (FBase* ioAccess, u_int32_t start_locations[CNTX_START_POS_SIZE], u_int32_t* found_images) {
+bool FwOperations::FindAllImageStart (FBase* ioAccess,
+ u_int32_t start_locations[CNTX_START_POS_SIZE],
+ u_int32_t* found_images,
+ u_int32_t const cntx_magic_pattern[]) {
+
int needed_pos_num;
needed_pos_num = CNTX_START_POS_SIZE;
if (ioAccess->is_flash()) {
- if ( (((Flash*)ioAccess)->get_dev_id() == 400) ||
- (((Flash*)ioAccess)->get_dev_id() == 435)) {
+ if ( (((Flash*)ioAccess)->get_dev_id() == CX2_HW_ID) ||
+ (((Flash*)ioAccess)->get_dev_id() == IS4_HW_ID)) {
needed_pos_num = OLD_CNTX_START_POS_SIZE;
}
}
}
ioAccess->set_address_convertor(0,0);
- *found_images = 0;
- for (int i = 0; i < needed_pos_num; i++) {
- if (CntxFindMagicPattern(ioAccess, _cntx_image_start_pos[i])) {
- start_locations[*found_images] = _cntx_image_start_pos[i];
- (*found_images)++;
+ if (found_images) {
+ *found_images = 0;
+ for (int i = 0; i < needed_pos_num; i++) {
+ if (FindMagicPattern(ioAccess, _cntx_image_start_pos[i], cntx_magic_pattern)) {
+ start_locations[*found_images] = _cntx_image_start_pos[i];
+ (*found_images)++;
+ }
}
}
return true;
}
-
-
-
// CAN BE IN ANOTHER MODULE
bool FwOperations::GetSectData(std::vector<u_int8_t>& file_sect, const u_int32_t *buff, const u_int32_t size) {
WriteToErrBuff(fwParams.errBuff, strerror(errno), fwParams.errBuffSize);
return false;
}
- if (sig == IMG_SIG_TYPE_BIN) {
+ if (sig == IMG_SIG_TYPE_BIN || sig == IMG_SIG_TYPE_CF) {
*ioAccessP = new FImage;
if (!(*ioAccessP)->open(fwParams.fileHndl, false, !fwParams.shortErrors)) {
WriteToErrBuff(fwParams.errBuff,(*ioAccessP)->err(), fwParams.errBuffSize);
return true;
}
+u_int8_t FwOperations::IsFS4Image(FBase& f, u_int32_t* found_images) {
+ u_int32_t data;
+ u_int8_t image_version;
+ u_int32_t image_start[CNTX_START_POS_SIZE];
+
+ FindAllImageStart(&f, image_start, found_images, _fs4_magic_pattern);
+
+ if(*found_images){
+ //check if the image_format_version is ok
+ READ4_NOERRMSG(f, image_start[0] + 0x10, &data);
+ TOCPU1(data);
+ image_version = data >> 24;
+ if(image_version == 1){//1 is the current version
+ return FS_FS4_GEN;
+ } else {
+ return FS_UNKNOWN_IMG;
+ }
+ }
+
+ return FS_UNKNOWN_IMG;
+}
+
+u_int8_t FwOperations::IsFS3OrFS2Image(FBase& f, u_int32_t* found_images) {
+ u_int32_t data;
+ u_int8_t image_version;
+ u_int32_t image_start[CNTX_START_POS_SIZE];
+
+ FindAllImageStart(&f, image_start, found_images, _cntx_magic_pattern);
+
+ if (found_images) {
+ READ4_NOERRMSG(f, image_start[0] + FS3_IND_ADDR, &data);
+ TOCPU1(data);
+ image_version = data >> 24;
+ if (image_version == IMG_VER_FS3) {
+ return FS_FS3_GEN;
+ } else {
+ // TODO: if the img format version is unknown we should fail instead of considering it FS2
+ return FS_FS2_GEN;
+ }
+ }
+
+ return FS_UNKNOWN_IMG;
+}
+
u_int8_t FwOperations::CheckFwFormat(FBase& f, bool getFwFormatFromImg) {
+ u_int8_t v;
+ u_int32_t found_images = 0;
+
if (f.is_flash() && !getFwFormatFromImg) {
if ( ( ((Flash*)&f)->get_dev_id() == CX2_HW_ID) ||
( ((Flash*)&f)->get_dev_id() == CX3_HW_ID) ||
} else if ( (((Flash*)&f)->get_dev_id() == CONNECT_IB_HW_ID) ||
(((Flash*)&f)->get_dev_id() == SWITCH_IB_HW_ID) ||
(((Flash*)&f)->get_dev_id() == CX4_HW_ID) ||
- (((Flash*)&f)->get_dev_id() == CX4LX_HW_ID) ||
- (((Flash*)&f)->get_dev_id() == CX5_HW_ID) ||
+ (((Flash*)&f)->get_dev_id() == CX4LX_HW_ID) ||
(((Flash*)&f)->get_dev_id() == SPECTRUM_HW_ID) ||
(((Flash*)&f)->get_dev_id() == SWITCH_IB2_HW_ID)) {
return FS_FS3_GEN;
}
} else {
- u_int32_t found_images;
- u_int32_t image_start[CNTX_START_POS_SIZE];
-
- // Image - check if magic pattern is somewhere in the file:
- CntxFindAllImageStart(&f, image_start, &found_images);
+ //First check if it is FS4
+ v = IsFS4Image(f, &found_images);
if (found_images) {
- u_int32_t data;
- u_int8_t image_version;
- READ4_NOERRMSG(f, image_start[0] + FS3_IND_ADDR, &data);
- TOCPU1(data);
- image_version = data >> 24;
- if (image_version == IMG_VER_FS3) {
- return FS_FS3_GEN;
- } else {
- // TODO: if the img format version is unknown we should fail instead of considering it FS2
- return FS_FS2_GEN;
- }
+ return v;
}
+ //If not FS4 then check if it is FS3 or FS2
+ return IsFS3OrFS2Image(f, &found_images);
}
- return FS_OLD_GEN;
+ return FS_UNKNOWN_IMG;
+}
+
+
+bool FwOperations::CheckBinVersion(u_int8_t binVerMajor, u_int8_t binVerMinor)
+{
+ if (binVerMajor == 0 && binVerMinor == 0) {
+ return true;
+ }
+
+ if (binVerMajor > _maxBinMajorVer/*FS4_MAX_BIN_VER_MAJOR*/) {
+ return errmsg(MLXFW_UNSUPPORTED_BIN_VER_ERR,
+ "Unsupported binary version (%d.%d) please update to latest MFT package",
+ binVerMajor,
+ binVerMinor);
+ }
+ if (binVerMajor < _minBinMajorVer/*FS4_MIN_BIN_VER_MAJOR*/
+ || (binVerMajor == _minBinMajorVer/*FS4_MIN_BIN_VER_MAJOR*/
+ && binVerMinor < _minBinMinorVer)) {
+ return errmsg(MLXFW_UNSUPPORTED_BIN_VER_ERR,
+ "Unsupported binary version (%d.%d) minimal supported version (%d.%d)", \
+ binVerMajor,
+ binVerMinor,
+ _minBinMajorVer/*FS4_MIN_BIN_VER_MAJOR*/,
+ _minBinMinorVer/*FS4_MIN_BIN_VER_MINOR*/);
+ }
+
+ return true;
}
FwOperations* FwOperations::FwOperationsCreate(void* fwHndl, void *info, char* psid, fw_hndl_type_t hndlType, char* errBuff, int buffSize)
fwParams.ignoreCacheRep = 0;
fwParams.noFlashVerify = false;
fwParams.cx3FwAccess = 0;
+ } else if (hndlType == FHT_CABLE_DEV) {
+ fwParams.buffHndl = (u_int32_t*)fwHndl;
}
return FwOperationsCreate(fwParams);
}
_fwParams.shortErrors = fwParams.shortErrors;
_fwParams.uefiExtra = fwParams.uefiExtra;
_fwParams.uefiHndl = fwParams.uefiHndl;
+ _fwParams.isCableFw = fwParams.isCableFw;
}
FwOperations* FwOperations::FwOperationsCreate(fw_ops_params_t& fwParams)
u_int8_t fwFormat;
FBase *ioAccess;
bool getFwFormatFromImg = false;
- if (!FwAccessCreate(fwParams, &ioAccess)) {
- return (FwOperations*)NULL;
- }
- if (fwParams.hndlType == FHT_UEFI_DEV) {
- // IN UEFI we don't have an access to read devID from cr-space so we are reading it from FW image signature
- getFwFormatFromImg = true;
- }
- fwFormat = CheckFwFormat(*ioAccess, getFwFormatFromImg);
- switch (fwFormat) {
- case FS_FS2_GEN: {
- fwops = new Fs2Operations(ioAccess);
- break;
- }
- case FS_FS3_GEN: {
- fwops = new Fs3Operations(ioAccess);
- break;
+#ifdef CABLES_SUPP
+ if (fwParams.hndlType == FHT_CABLE_DEV) {
+ fwops = new CableFwOperations(fwParams.mstHndl);
+ if(!fwops->FwInit()) {
+ WriteToErrBuff(fwParams.errBuff, fwops->err(), fwParams.errBuffSize);
+ return (FwOperations*)NULL;
}
- default:
- delete ioAccess;
- WriteToErrBuff(fwParams.errBuff,"invalid Firmware Format (found FS Gen 1)", fwParams.errBuffSize);
+ fwops->_devName = strcpy(new char[strlen(fwParams.mstHndl)+ 1], fwParams.mstHndl);
+ } else
+#endif
+ {
+ if (!FwAccessCreate(fwParams, &ioAccess)) {
return (FwOperations*)NULL;
- }
- // save initialization parameters
- fwops->BackUpFwParams(fwParams);
+ }
+ if (fwParams.hndlType == FHT_UEFI_DEV) {
+ // IN UEFI we don't have an access to read devID from cr-space so we are reading it from FW image signature
+ getFwFormatFromImg = true;
+ }
+#if 0 // TODO: Fix when you have cable_fw
+ if (fwParams.isCableFw) {
+ fwops = new CableFwOperations(ioAccess);
+ } else
+#endif
+ {
+ fwFormat = CheckFwFormat(*ioAccess, getFwFormatFromImg);
+ switch (fwFormat) {
+ case FS_FS2_GEN: {
+ fwops = new Fs2Operations(ioAccess);
+ break;
+ }
+ case FS_FS3_GEN: {
+ fwops = new Fs3Operations(ioAccess);
+ break;
+ }
+ default:
+ delete ioAccess;
+ WriteToErrBuff(fwParams.errBuff,"invalid Firmware Format (found FS Gen 1)", fwParams.errBuffSize);
+ return (FwOperations*)NULL;
+ }
+ }
+ // save initialization parameters
+ fwops->BackUpFwParams(fwParams);
- fwops->_advErrors = !fwParams.shortErrors;
- fwops->FwInit();
- if (fwParams.hndlType == FHT_FW_FILE) {
- fwops->_fname = strcpy(new char[strlen(fwParams.fileHndl)+ 1], fwParams.fileHndl);
- }
- if (fwParams.hndlType == FHT_MST_DEV) {
- fwops->_devName = strcpy(new char[strlen(fwParams.mstHndl)+ 1], fwParams.mstHndl);
+ fwops->_advErrors = !fwParams.shortErrors;
+ fwops->FwInit();
+ if (fwParams.hndlType == FHT_FW_FILE) {
+ fwops->_fname = strcpy(new char[strlen(fwParams.fileHndl)+ 1], fwParams.fileHndl);
+ }
+ if (fwParams.hndlType == FHT_MST_DEV) {
+ fwops->_devName = strcpy(new char[strlen(fwParams.mstHndl)+ 1], fwParams.mstHndl);
+ }
}
return fwops;
}
*swIds = hwDevData[i].swDevIds;
return true;
}
- i++;
+ i++;
}
return errmsg(MLXFW_DEV_ID_ERR, "Failed to identify device ID(MT%d).", hwDevId);
}
+FwOperations::HwDevData FwOperations::getInfoFromChipType(chip_type_t chipT) const {
+ int i = 0;
+ while (hwDevData[i].name != NULL) {
+ if (hwDevData[i].chipType == chipT) {
+ return hwDevData[i];
+ }
+ i++;
+ }
+ return hwDevData[i];
+}
+
// TODO:combine both databases(hwDevData and hwDev2Str) and remove old unsupporded devices i.e infinihost infinihost_iii_ex infinihost_iii_lx
const FwOperations::HwDevData FwOperations::hwDevData[] = {
- { "ConnectX", CX2_HW_ID, CT_CONNECTX, 2, {25408, 25418, 26418, 26438,
+ { "ConnectX", CX2_HW_ID, CT_CONNECTX, CFT_HCA, 2, {25408, 25418, 26418, 26438,
26428, 25448, 26448, 26468,
25458, 26458, 26478, 26488,
4097, 4098, 0}},
- { "ConnectX-3", CX3_HW_ID, CT_CONNECTX, 2, {4099, 4100, 4101, 4102,
+ { "ConnectX-3", CX3_HW_ID, CT_CONNECTX, CFT_HCA, 2, {4099, 4100, 4101, 4102,
4104, 4105, 4106,
4107, 4108, 4109, 4110,
4111, 4112, 0}},
- { "ConnectX-3Pro", CX3_PRO_HW_ID, CT_CONNECTX, 2, {4103,0}},
- { "Connect_IB", CONNECT_IB_HW_ID, CT_CONNECT_IB, 2, {CONNECT_IB_SW_ID, 4114, 4115, 4116,
+ { "ConnectX-3Pro", CX3_PRO_HW_ID, CT_CONNECTX, CFT_HCA, 2, {4103,0}},
+ { "Connect_IB", CONNECT_IB_HW_ID, CT_CONNECT_IB, CFT_HCA, 2, {CONNECT_IB_SW_ID, 4114, 4115, 4116,
4117, 4118, 4119, 4120,
4121, 4122, 4123, 4124, 0}},
- { "InfiniScale IV", IS4_HW_ID, CT_IS4, 0, {48436, 48437, 48438, 0}},
- { "SwitchX", SWITCHX_HW_ID, CT_SWITCHX, 0, {51000, 0}},
- { "Switch_IB", SWITCH_IB_HW_ID, CT_SWITCH_IB, 0, {52000, 0}},
- { "ConnectX-4", CX4_HW_ID, CT_CONNECTX4, 0, {4115, 0}},
- { "ConnectX-4LX", CX4LX_HW_ID, CT_CONNECTX4_LX, 0, {4117, 0}},
- { "ConnectX-5", CX5_HW_ID, CT_CONNECTX5, 0, {4119, 0}},
- { "Spectrum", SPECTRUM_HW_ID, CT_SPECTRUM, 0, {52100, 0}},
- { "Switch_IB2", SWITCH_IB2_HW_ID, CT_SWITCH_IB2, 0, {53000, 0}},
- { (char*)NULL , 0, CT_UNKNOWN, 0, {0}},// zero devid terminator
+ { "InfiniScale IV", IS4_HW_ID, CT_IS4, CFT_SWITCH, 0, {48436, 48437, 48438, 0}},
+ { "SwitchX", SWITCHX_HW_ID, CT_SWITCHX, CFT_SWITCH, 0, {51000, 0}},
+ { "Switch_IB", SWITCH_IB_HW_ID, CT_SWITCH_IB, CFT_SWITCH, 0, {52000, 0}},
+ { "ConnectX-4", CX4_HW_ID, CT_CONNECTX4, CFT_HCA, 0, {4115, 0}},
+ { "ConnectX-4LX", CX4LX_HW_ID, CT_CONNECTX4_LX, CFT_HCA, 0, {4117, 0}},
+ { "ConnectX-5", CX5_HW_ID, CT_CONNECTX5, CFT_HCA, 0, {4119, 0}},
+ { "Spectrum", SPECTRUM_HW_ID, CT_SPECTRUM, CFT_SWITCH, 0, {52100, 0}},
+ { "Switch_IB2", SWITCH_IB2_HW_ID, CT_SWITCH_IB2, CFT_SWITCH, 0, {53000, 0}},
+ { (char*)NULL , 0, CT_UNKNOWN, CFT_UNKNOWN, 0, {0}},// zero devid terminator
};
const FwOperations::HwDev2Str FwOperations::hwDev2Str[] = {
bool FwOperations::FwBurnData(u_int32_t *data, u_int32_t dataSize, ProgressCallBack progressFunc) {
FwOperations* newImgOps;
fwOpsParams imgOpsParams;
+ memset(&imgOpsParams, 0, sizeof(imgOpsParams));
char errBuff[1024] = {0};
imgOpsParams.psid = (char*)NULL;
#include "flint_io.h"
#include "mlxfwops_com.h"
+#ifdef CABLES_SUPP
+#include <cable_access/cable_access.h>
+#endif
+
typedef f_prog_func_str VerifyCallBack;
typedef f_prog_func ProgressCallBack;
typedef f_prog_func_str PrintCallBack;
typedef int (*PrintCallBackAdv) (int completion, char* str);
-class MLXFWOP_API FwOperations : public ErrMsg {
+class MLXFWOP_API FwOperations : public FlintErrMsg {
public:
// typedef std::tr1::function<void (void)> VerifyCallback;
FwOperations(FBase *ioAccess) :
- _ioAccess(ioAccess), _isCached(false), _wasVerified(false),
+ _ioAccess(ioAccess), _isCached(false), _wasVerified(false),
_quickQuery(false), _printFunc((PrintCallBack)NULL), _fname((const char*)NULL),\
- _devName((const char*)NULL), _advErrors(true)
+ _devName((const char*)NULL), _advErrors(true), _minBinMinorVer(0), _minBinMajorVer(0),
+ _maxBinMajorVer(0)
{
memset(_sectionsToRead, 0, sizeof(_sectionsToRead));
memset(&_fwImgInfo, 0, sizeof(_fwImgInfo));
//needed for flint low level operations
bool FwSwReset();
- virtual bool CheckCX4Device() {return true;}
+ virtual bool CheckCX4Device() {return true; /* deprecated always return true*/ }
virtual bool FwCalcMD5(u_int8_t md5sum[16]) = 0;
//bool GetExpRomVersionWrapper();
void getSupporteHwId(u_int32_t **supportedHwId, u_int32_t &supportedHwIdNum);
- class MLXFWOP_API RomInfo : ErrMsg {
+ class MLXFWOP_API RomInfo : FlintErrMsg {
public:
RomInfo(const std::vector<u_int8_t>& romSector, bool resEndi=true);
~RomInfo() {};
bool noFlashVerify;
bool shortErrors; // show short/long error msgs (default shuold be false)
int cx3FwAccess;
+ int isCableFw;
};
struct sgParams {
};
protected:
#define FS3_IND_ADDR 0x24
+ #define FS4_IND_ADDR 0x10
#define ARR_SIZE(arr) sizeof(arr)/sizeof(arr[0])
#define RESTORING_MSG "Restoring signature"
IMG_SIG_TYPE_UNKNOWN = 0,
IMG_SIG_TYPE_BIN = 1,
IMG_SIG_TYPE_MFA = 2,
- IMG_SIG_OPEN_FILE_FAILED = 3
+ IMG_SIG_TYPE_CF = 3,
+ IMG_SIG_OPEN_FILE_FAILED = 4
};
enum {
IMG_VER_FS2 = 0,
IMG_VER_FS3 = 3,
+ IMG_VER_FS4 = 4
};
enum {
FS_OLD_GEN = 0,
FS_FS2_GEN,
FS_FS3_GEN,
+ FS_FS4_GEN,
+ FS_UNKNOWN_IMG
};
struct HwDevData {
const char* name;
u_int32_t hwDevId;
chip_type_t chipType;
+ chip_family_type chipFamilyType;
int portNum;
// Zero terminated list of SW device ids
const u_int32_t swDevIds[MAX_SW_DEVICES_PER_HW];
u_int8_t revId;
};
+ struct SectionInfo {
+ u_int8_t type;
+ const char *name;
+ };
+
+ struct QueryOptions {
+ bool quickQuery;
+ bool readRom;
+ };
+
typedef int (*print2log_func) (const char* format, ...);
// Protected Methods
void FwInitCom();
void FwDebugPrint(char *str);
- static bool CntxFindAllImageStart (FBase *ioAccess, u_int32_t start_locations[CNTX_START_POS_SIZE], u_int32_t* found_images);
+ static bool FindAllImageStart (FBase *ioAccess, u_int32_t start_locations[CNTX_START_POS_SIZE], u_int32_t* found_images, u_int32_t const cntx_magic_pattern[]);
static bool getRomsInfo(FBase* io, roms_info_t& romsInfo);
bool GetQuickQuery() {return _quickQuery;}
bool CheckPSID(FwOperations &imageOps, u_int8_t allow_psid_change = false);
chip_type_t getChipType();
bool getInfoFromHwDevid(u_int32_t hwDevId, chip_type_t& chipT, const u_int32_t** swIds);
+ HwDevData getInfoFromChipType(chip_type_t chipT) const;
bool ReadImageFile(const char *fimage, u_int8_t *&file_data, int &file_size, int min_size=-1); // min_size=-1 like int flint_ops needed for fs3updateSection
bool ModifyImageFile(const char *fimage, u_int32_t addr, void *data, int cnt);
bool WriteImageToFile(const char *file_name, u_int8_t *data, u_int32_t length);
bool FwBurnData(u_int32_t *data, u_int32_t dataSize, ProgressCallBack progressFunc);
static bool FwAccessCreate(fw_ops_params_t& fwParams, FBase **ioAccessP);
+ bool CheckBinVersion(u_int8_t binVerMajor, u_int8_t binVerMinor);
// Protected Members
FBase* _ioAccess;
// show advanced error msgs
bool _advErrors;
+ u_int8_t _minBinMinorVer;
+ u_int8_t _minBinMajorVer;
+ u_int8_t _maxBinMajorVer;
+
private:
// Static Methods
static int getFileSignature(const char* fname);
static int getBufferSignature(u_int8_t* buf, u_int32_t size);
static u_int8_t CheckFwFormat(FBase& f, bool getFwFormatFromImg = false);
- static bool CntxFindMagicPattern (FBase* ioAccess, u_int32_t addr);
+ static u_int8_t IsFS4Image(FBase& f, u_int32_t* found_images);
+ static u_int8_t IsFS3OrFS2Image(FBase& f, u_int32_t* found_images);
+ static bool FindMagicPattern (FBase* ioAccess, u_int32_t addr,
+ u_int32_t const cntx_magic_pattern[]);
+
static void WriteToErrBuff(char* errBuff, const char* errStr, int size);
void BackUpFwParams(fw_ops_params_t& fwParams);
static const char * err2str(int errNum);
// Static Members
static const u_int32_t _cntx_image_start_pos[CNTX_START_POS_SIZE];
- static const u_int32_t _cntx_magic_pattern[4];
// Members
static const HwDevData hwDevData[];
static const HwDev2Str hwDev2Str[];
//fw_hndl_type_t _hndlType; //not used atm
+protected:
+ static const u_int32_t _cntx_magic_pattern[4];
+ static const u_int32_t _fs4_magic_pattern[4];
};
#endif // FW_ACCESS_H
return mlxfw_open_int(mlxfwops_p, buffer, &size, psid, FHT_FW_BUFF, (char*)NULL, 0);
}
+#ifdef CABLES_SUPP
+MLXFWOP_API int MLXFWOPCALL mlxfw_open_cable(mlxfwops_t** mlxfwops_p, char *handle_name, int port)
+{
+ return mlxfw_open_int(mlxfwops_p, handle_name, &port, (char*)NULL, FHT_CABLE_DEV, (char*)NULL, 0);
+}
+#endif
+
#ifdef UEFI_BUILD
MLXFWOP_API int MLXFWOPCALL mlxfw_open_uefi(mlxfwops_t** mlxfwops_p, uefi_Dev_t* dev, f_fw_cmd fw_cmd_func, uefi_dev_info_t* dev_info)
MLXFWOP_API int MLXFWOPCALL mlxfw_open_buffer(mlxfwops_t** mlxfwops_p, void* buffer, u_int32_t size, char *psid);
+#ifdef CABLES_SUPP
+MLXFWOP_API int MLXFWOPCALL mlxfw_open_cable(mlxfwops_t** mlxfwops_p, char *handle_name, int port);
+#endif
#ifdef UEFI_BUILD
#include <mft_uefi_common.h>
#define PRODUCT_VER_LEN 16
#define PRS_NAME_LEN 100
#define FS3_PRS_NAME_LEN 97
+#define FS4_PRS_NAME_LEN 97
#define NAME_LEN 65
#define DESCRIPTION_LEN 257
MLXFW_GET_SECT_ERR,
MLXFW_UPDATE_SECT_ERR,
MLXFW_BAD_PARAM_ERR,
- MLXFW_PRS_MISSMATCH_ERR
+ MLXFW_PRS_MISSMATCH_ERR,
+ MLXFW_NO_VALID_DEVICE_INFO_ERR,
+ MLXFW_TWO_VALID_DEVICE_INFO_ERR,
+ MLXFW_DTOC_OVERWRITE_CHUNK
};
enum {
CT_CONNECTX5,
}chip_type_t;
+typedef enum chip_family_type {
+ CFT_UNKNOWN = 0,
+ CFT_HCA,
+ CFT_SWITCH,
+}chip_family_type_t;
+
typedef struct guid {
u_int32_t h;
u_int32_t l;
u_int8_t step_size_pp[2]; // set 0xff for default, not relevant for devices >= CX4
} fs3_uid_t;
+typedef struct fs4_uid {
+ guid_t base_guid;
+ int base_guid_specified;
+ guid_t base_mac;
+ int base_mac_specified;
+ u_int8_t num_of_guids; // set 0 for default
+ u_int8_t step_size; // set 0 for default, not relevant for devices >= CX4
+ int set_mac_from_guid; // if set , base_mac will be derrived automatically from base guid
+ int use_pp_attr; // if set, num_of_guids[2] and step_size[2] will be used for the uid attributes.
+ u_int8_t num_of_guids_pp[2]; // set 0xff for default
+ u_int8_t step_size_pp[2]; // set 0xff for default, not relevant for devices >= CX4
+} fs4_uid_t;
+
typedef struct rom_info {
u_int16_t exp_rom_product_id; // 0 - invalid.
u_int16_t exp_rom_ver[3];
} fs3_info_t;
+typedef struct fs3_info_ext fs4_info_t;
typedef struct fs2_info_ext {
guid_t guids[MAX_GUIDS];
char prs_name[PRS_NAME_LEN];
} fs2_info_t;
+#ifdef CABLES_SUPP
+typedef struct cablefw_info_ext {
+ u_int8_t fw_gw_revision[2];
+ u_int16_t fw_dev_id;
+ u_int32_t fw_revision;
+ u_int8_t image_key;
+} cablefw_info_t;
+#endif
+
typedef struct roms_info {
u_int8_t exp_rom_found;
u_int8_t num_of_exp_rom;
typedef struct fw_info_ext {
- u_int8_t fw_type;
- fw_info_com_t fw_info;
- fs2_info_t fs2_info;
- fs3_info_t fs3_info;
+ u_int8_t fw_type;
+ fw_info_com_t fw_info;
+ fs2_info_t fs2_info;
+ fs3_info_t fs3_info;
+#ifdef CABLES_SUPP
+ cablefw_info_t cablefw_info;
+#endif
+ fs3_info_t fs4_info;
} fw_info_t;
typedef enum fw_hndl_type {
FHT_FW_FILE,
FHT_UEFI_DEV,
FHT_FW_BUFF,
+ FHT_CABLE_DEV,
} fw_hndl_type_t;
typedef enum fw_img_type {
FIT_FS2,
FIT_FS3,
+ FIT_FC1,
+ FIT_FS4,
} fw_img_type_t;
for (i = 1; i < argc; ++i) {
/* check position-independent flags */
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help")) {
- fprintf(stderr, "%s", correct_cmdline);
+ fprintf(stdout, "%s", correct_cmdline);
exit (0);
}
else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version")) {
return 1;
}
strncpy(device, argv[i], MAX_DEV_LEN -1);
- if (!( mf = mopen((const char *)device))) {
+ if (!( mf = mopen_adv((const char *)device, (MType)(MST_DEFAULT | MST_CABLE)))) {
fprintf(stderr, "Unable to open device %s. Exiting.\n", argv[i]);
return 1;
}
0x0d4740,14,
0x0d4780,62,
0x0d487c,1,
-0x0d4884,1,
-0x0d488c,1,
-0x0d4894,1,
-0x0d489c,1,
-0x0d48a4,1,
-0x0d48ac,1,
-0x0d48b4,1,
-0x0d48bc,1,
-0x0d4900,3,
-0x0d4940,3,
-0x0d4980,3,
-0x0d49c0,3,
0x0d4a00,8,
0x0d4a24,15,
0x0d4a64,30,
0x0d4e94,5,
0x0d4eac,1,
0x0d4eb4,3,
-0x0d4f00,15,
-0x0d4f40,15,
-0x0d4f80,15,
-0x0d4fc0,15,
0x0d5000,29,
0x0d5078,4,
0x0d5090,2,
0x0d5740,14,
0x0d5780,62,
0x0d587c,1,
-0x0d5884,1,
-0x0d588c,1,
-0x0d5894,1,
-0x0d589c,1,
-0x0d58a4,1,
-0x0d58ac,1,
-0x0d58b4,1,
-0x0d58bc,1,
-0x0d5900,3,
-0x0d5940,3,
-0x0d5980,3,
-0x0d59c0,3,
0x0d5a00,8,
0x0d5a24,15,
0x0d5a64,30,
0x0d5e94,5,
0x0d5eac,1,
0x0d5eb4,3,
-0x0d5f00,15,
-0x0d5f40,15,
-0x0d5f80,15,
-0x0d5fc0,15,
0x0d6000,15,
0x0d6070,3,
0x0d6080,6,
0x118740,14,
0x118780,62,
0x11887c,1,
-0x118884,1,
-0x11888c,1,
-0x118894,1,
-0x11889c,1,
-0x1188a4,1,
-0x1188ac,1,
-0x1188b4,1,
-0x1188bc,1,
-0x118900,3,
-0x118940,3,
-0x118980,3,
-0x1189c0,3,
0x118a00,8,
0x118a24,15,
0x118a64,30,
0x118e94,5,
0x118eac,1,
0x118eb4,3,
-0x118f00,15,
-0x118f40,15,
-0x118f80,15,
-0x118fc0,15,
0x119000,29,
0x119078,4,
0x119090,2,
0x119740,14,
0x119780,62,
0x11987c,1,
-0x119884,1,
-0x11988c,1,
-0x119894,1,
-0x11989c,1,
-0x1198a4,1,
-0x1198ac,1,
-0x1198b4,1,
-0x1198bc,1,
-0x119900,3,
-0x119940,3,
-0x119980,3,
-0x1199c0,3,
0x119a00,8,
0x119a24,15,
0x119a64,30,
0x119e94,5,
0x119eac,1,
0x119eb4,3,
-0x119f00,15,
-0x119f40,15,
-0x119f80,15,
-0x119fc0,15,
0x11a000,29,
0x11a078,4,
0x11a090,2,
0x11a740,14,
0x11a780,62,
0x11a87c,1,
-0x11a884,1,
-0x11a88c,1,
-0x11a894,1,
-0x11a89c,1,
-0x11a8a4,1,
-0x11a8ac,1,
-0x11a8b4,1,
-0x11a8bc,1,
-0x11a900,3,
-0x11a940,3,
-0x11a980,3,
-0x11a9c0,3,
0x11aa00,8,
0x11aa24,15,
0x11aa64,30,
0x11ae94,5,
0x11aeac,1,
0x11aeb4,3,
-0x11af00,15,
-0x11af40,15,
-0x11af80,15,
-0x11afc0,15,
0x11b000,29,
0x11b078,4,
0x11b090,2,
0x11b740,14,
0x11b780,62,
0x11b87c,1,
-0x11b884,1,
-0x11b88c,1,
-0x11b894,1,
-0x11b89c,1,
-0x11b8a4,1,
-0x11b8ac,1,
-0x11b8b4,1,
-0x11b8bc,1,
-0x11b900,3,
-0x11b940,3,
-0x11b980,3,
-0x11b9c0,3,
0x11ba00,8,
0x11ba24,15,
0x11ba64,30,
0x11be94,5,
0x11beac,1,
0x11beb4,3,
-0x11bf00,15,
-0x11bf40,15,
-0x11bf80,15,
-0x11bfc0,15,
0x11c000,19,
0x11c050,10,
0x11c080,19,
ExclusiveArch: i386 i486 i586 i686 x86_64 ia64 ppc ppc64 ppc64le arm64 aarch64
BuildRequires: zlib-devel %{ibmadlib}
-%if %{buildtype} == "ppc64le"
-Requires: advance-toolchain-at7.1-runtime
-%endif
-
%description
This package contains firmware update tool, vpd dump and register dump tools
for network adapters based on Mellanox Technologies chips.
%{_mandir}/man1/*
%changelog
+* Wed May 17 2016 Adrian Chiris <adrianc@dev.mellanox.co.il>
+ MFT 4.4.0 Updates
+
* Wed Mar 23 2016 Adrian Chiris <adrianc@dev.mellanox.co.il>
MFT 4.4.0 Updates
#ifndef _MTCR_IB_H
#define _MTCR_IB_H
-#include "mtcr_com_defs.h"
-
-#ifdef __WIN__
- #include <mtcr.h>
-#endif
+ #include <mtcr.h>
int mib_open(const char *name, mfile *mf, int mad_init);
int mib_close(mfile *mf);
*/
#include <string.h>
+
#include "mtcr_ib.h"
#include "mtcr_ib_res_mgt.h"
#include "packets_common.h"
+
#define IB_SMP_DATA_SIZE 48
#define SMP_SEMAPHOE_LOCK_CMD 0xff53
u_int8_t op;
/*---------------- DWORD[2] (Offset 0x8) ----------------*/
/* Description - This field is provided by the device on a successful lock. It should be used by the user in order to either extend or release of the lock. */
- /* 8.0 - 12.31 */
+ /* 8.0 - 8.31 */
u_int32_t lock_key;
};
push_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->op);
offset=64;
- push_to_buff_64(ptr_buff, offset, (u_int64_t)ptr_struct->lock_key);
+ push_to_buff_32(ptr_buff, offset, ptr_struct->lock_key);
}
ptr_struct->op = (u_int8_t)pop_from_buff(ptr_buff, offset, 2);
offset=64;
- ptr_struct->lock_key = (u_int32_t)pop_from_buff_64(ptr_buff, offset);
+ ptr_struct->lock_key = pop_from_buff_32(ptr_buff, offset);
}
#include <compatibility.h>
-#ifdef MST_UL
-#include <mtcr_int_defs.h>
-#include <mtcr_mf.h>
-#endif
#include <mtcr.h>
#define FLASH_REG_ACCESS 0x9001
return mclose_ul(mf);
}
+mfile *mopen_adv(const char *name, MType mtype)
+{
+ mfile* mf = mopend(name, MST_TAVOR);
+ if (mf) {
+ if (mf->tp & mtype) {
+ return mf;
+ } else {
+ errno = EPERM;
+ mclose(mf);
+ return NULL;
+ }
+ }
+ return mf;
+}
+
mfile *mopen_fw_ctx(void* fw_cmd_context, void* fw_cmd_func, void* extra_data)
{
// not implemented
*mtype = mf->tp;
return 0;
}
-/************************************
- * Function: m_err2str
- ************************************/
-const char* m_err2str(MError status)
-{
- switch (status) {
- case ME_OK:
- return "ME_OK";
- case ME_ERROR:
- return "General error";
- case ME_BAD_PARAMS:
- return "ME_BAD_PARAMS";
- case ME_CR_ERROR:
- return "ME_CR_ERROR";
- case ME_NOT_IMPLEMENTED:
- return "ME_NOT_IMPLEMENTED";
- case ME_SEM_LOCKED:
- return "Semaphore locked";
- case ME_MEM_ERROR:
- return "ME_MEM_ERROR";
- case ME_PCI_READ_ERROR:
- return "ME_PCI_READ_ERROR";
- case ME_PCI_WRITE_ERROR:
- return "ME_PCI_WRITE_ERROR";
- case ME_PCI_SPACE_NOT_SUPPORTED:
- return "ME_PCI_SPACE_NOT_SUPPORTED";
- case ME_PCI_IFC_TOUT:
- return "ME_PCI_IFC_TOUT";
-
- case ME_MAD_SEND_FAILED:
- return "ME_MAD_SEND_FAILED";
- case ME_UNKOWN_ACCESS_TYPE:
- return "ME_UNKOWN_ACCESS_TYPE";
- case ME_UNSUPPORTED_DEVICE:
- return "ME_UNSUPPORTED_DEVICE";
-
- // Reg access errors
- case ME_REG_ACCESS_BAD_STATUS_ERR:
- return "ME_REG_ACCESS_BAD_STATUS_ERR";
- case ME_REG_ACCESS_BAD_METHOD:
- return "Bad method";
- case ME_REG_ACCESS_NOT_SUPPORTED:
- return "Register access isn't supported by device";
- case ME_REG_ACCESS_DEV_BUSY:
- return "Device is busy";
- case ME_REG_ACCESS_VER_NOT_SUPP:
- return "Version not supported";
- case ME_REG_ACCESS_UNKNOWN_TLV:
- return "Unknown TLV";
- case ME_REG_ACCESS_REG_NOT_SUPP:
- return "Register not supported";
- case ME_REG_ACCESS_CLASS_NOT_SUPP:
- return "Class not supported";
- case ME_REG_ACCESS_METHOD_NOT_SUPP:
- return "Method not supported";
- case ME_REG_ACCESS_BAD_PARAM:
- return "Bad parameter";
- case ME_REG_ACCESS_RES_NOT_AVLBL:
- return "Resource not available";
- case ME_REG_ACCESS_MSG_RECPT_ACK:
- return "Message receipt ack";
- case ME_REG_ACCESS_UNKNOWN_ERR:
- return "Unknown register error";
- case ME_REG_ACCESS_SIZE_EXCCEEDS_LIMIT:
- return "Register is too large";
- case ME_REG_ACCESS_CONF_CORRUPT:
- return "Config Section Corrupted";
- case ME_REG_ACCESS_LEN_TOO_SMALL:
- return "given register length too small for Tlv";
- case ME_REG_ACCESS_BAD_CONFIG:
- return "configuration refused";
- case ME_REG_ACCESS_ERASE_EXEEDED:
- return "erase count exceeds limit";
- case ME_REG_ACCESS_INTERNAL_ERROR:
- return "FW internal error";
-
- // ICMD access errors
- case ME_ICMD_STATUS_CR_FAIL:
- return "ME_ICMD_STATUS_CR_FAIL";
- case ME_ICMD_STATUS_SEMAPHORE_TO:
- return "ME_ICMD_STATUS_SEMAPHORE_TO";
- case ME_ICMD_STATUS_EXECUTE_TO:
- return "ME_ICMD_STATUS_EXECUTE_TO";
- case ME_ICMD_STATUS_IFC_BUSY:
- return "ME_ICMD_STATUS_IFC_BUSY";
- case ME_ICMD_STATUS_ICMD_NOT_READY:
- return "ME_ICMD_STATUS_ICMD_NOT_READY";
- case ME_ICMD_UNSUPPORTED_ICMD_VERSION:
- return "ME_ICMD_UNSUPPORTED_ICMD_VERSION";
- case ME_ICMD_NOT_SUPPORTED:
- return "ME_REG_ACCESS_ICMD_NOT_SUPPORTED";
- case ME_ICMD_INVALID_OPCODE:
- return "ME_ICMD_INVALID_OPCODE";
- case ME_ICMD_INVALID_CMD:
- return "ME_ICMD_INVALID_CMD";
- case ME_ICMD_OPERATIONAL_ERROR:
- return "ME_ICMD_OPERATIONAL_ERROR";
- case ME_ICMD_BAD_PARAM:
- return "ME_ICMD_BAD_PARAM";
- case ME_ICMD_BUSY:
- return "ME_ICMD_BUSY";
- case ME_ICMD_ICM_NOT_AVAIL:
- return "ME_ICMD_ICM_NOT_AVAIL";
- case ME_ICMD_WRITE_PROTECT:
- return "ME_ICMD_WRITE_PROTECT";
- case ME_ICMD_SIZE_EXCEEDS_LIMIT:
- return "ME_ICMD_SIZE_EXCEEDS_LIMIT";
- case ME_ICMD_UNKNOWN_STATUS:
- return "ME_ICMD_UNKNOWN_STATUS";
-
- // TOOLS HCR access errors
- case ME_CMDIF_BUSY:
- return "Tools HCR busy";
- case ME_CMDIF_TOUT:
- return "Tools HCR time out";
- case ME_CMDIF_BAD_OP:
- return "Operation not supported";
- case ME_CMDIF_NOT_SUPP:
- return "Tools HCR not supported";
- case ME_CMDIF_BAD_SYS:
- return "bad system status (driver may be down or Fw does not support this operation)";
- case ME_CMDIF_UNKN_TLV:
- return "Unknown TLV";
- case ME_CMDIF_RES_STATE:
- return "Bad reset state";
- case ME_CMDIF_UNKN_STATUS:
- return "Unknown status";
-
- // MAD IFC errors
- case ME_MAD_BUSY:
- return "Temporarily busy. MAD discarded. This is not an error";
- case ME_MAD_REDIRECT:
- return "Redirection. This is not an error";
- case ME_MAD_BAD_VER:
- return "Bad version";
- case ME_MAD_METHOD_NOT_SUPP:
- return "Method not supported";
- case ME_MAD_METHOD_ATTR_COMB_NOT_SUPP:
- return "Method and attribute combination isn't supported";
- case ME_MAD_BAD_DATA:
- return "Bad attribute modifer or field";
- case ME_MAD_GENERAL_ERR:
- return "Unknown MAD error";
- default:
- return "Unknown error code";
- }
+int mclear_pci_semaphore(const char* name)
+{
+ return mclear_pci_semaphore_ul(name);
}
#define CX3_SW_ID 4099
#define CX3PRO_SW_ID 4103
+typedef enum {
+ Clear_Vsec_Semaphore = 0x1,
+} adv_opt_t;
+
/* Forward decl*/
static int get_inband_dev_from_pci(char* inband_dev, char* pci_dev);
-
int check_force_config(unsigned my_domain, unsigned my_bus, unsigned my_dev, unsigned my_func);
+mfile *mopen_ul_int(const char *name, u_int32_t adv_opt);
+int init_dev_info_ul(mfile* mf, const char* dev_name, unsigned domain, unsigned bus, unsigned dev, unsigned func);
/*
* Lock file section:
*
}
static
-int mtcr_pcicr_open(mfile *mf, const char *name, char* conf_name, off_t off, int ioctl_needed)
+int mtcr_pcicr_open(mfile *mf, const char *name, char* conf_name, off_t off, int ioctl_needed, u_int32_t adv_opt)
{
int rc;
ul_ctx_t *ctx = mf->ul_ctx;
if (rc) {
mtcr_pcicr_mclose(mf);
} else if (conf_name != NULL) {
- mfile* conf_mf = mopen_ul(conf_name);
+ mfile* conf_mf = mopen_ul_int(conf_name, adv_opt);
if (conf_mf != NULL) {
mf->res_fd = conf_mf->fd;
ul_ctx_t *conf_ctx = conf_mf->ul_ctx;
}
static
-int mtcr_pciconf_open(mfile *mf, const char *name)
+int mtcr_pciconf_open(mfile *mf, const char *name, u_int32_t adv_opt)
{
- int err;
- int rc;
ul_ctx_t *ctx = mf->ul_ctx;
mf->fd = -1;
mf->fd = open(name, O_RDWR | O_SYNC);
if ((mf->vsec_addr = pci_find_capability(mf, CAP_ID))) {
// check if the needed spaces are supported
+ if (adv_opt & Clear_Vsec_Semaphore) {
+ mtcr_pciconf_cap9_sem(mf, 0);
+ }
+ if (mtcr_pciconf_cap9_sem(mf, 1)) {
+ close(mf->fd);
+ errno = EBUSY;
+ return -1;
+ }
if (mtcr_pciconf_set_addr_space(mf, ICMD_DOMAIN) || mtcr_pciconf_set_addr_space(mf, SEMAPHORE_DOMAIN)
|| mtcr_pciconf_set_addr_space(mf, CR_SPACE_DOMAIN)) {
mf->vsec_supp = 0;
} else {
mf->vsec_supp = 1;
}
+ mtcr_pciconf_cap9_sem(mf, 0);
}
if (mf->vsec_supp) {
ctx->mwrite4_block = mwrite_chunk_as_multi_mwrite4;
}
ctx->mclose = mtcr_pciconf_mclose;
-
- rc = mtcr_check_signature(mf);
- if (rc) {
- rc = -1;
- goto end;
- }
-
- end: if (rc) {
- err = errno;
- mtcr_pciconf_mclose(mf);
- errno = err;
- }
- return rc;
+ return 0;
}
#else
static
-int mtcr_pciconf_open(mfile *mf, const char *name)
+int mtcr_pciconf_open(mfile *mf, const char *name, u_int32_t adv_opt)
{
return -1;
}
0xcf08, //Switch-IB2
-1 };
+static long live_fish_id_database[] = {
+ 0x191,
+ 0x246,
+ 0x249,
+ 0x24b,
+ 0x1F6,
+ 0x1F8,
+ 0x1FF,
+ 0x247,
+ 0x209,
+ 0x20b,
+ 0x20d,
+ -1
+};
+
int is_supported_devid(long devid)
{
int i = 0;
- int ret_val = 0;
while (supported_dev_ids[i] != -1) {
if (devid == supported_dev_ids[i]) {
- ret_val = 1;
- break;
+ return 1;
}
i++;
}
- return ret_val;
+ i = 0;
+ while (live_fish_id_database[i] != -1) {
+ if (devid == live_fish_id_database[i]) {
+ return 1;
+ }
+ i++;
+ }
+ return 0;
}
int is_supported_device(char* devname)
return NULL;
}
+static void get_numa_node(u_int16_t domain, u_int8_t bus, u_int8_t dev, u_int8_t func, char* data)
+{
+ char numa_path[64];
+ int c;
+ int i = 0;
+ sprintf(numa_path, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/numa_node", domain, bus, dev, func);
+ FILE* f = fopen(numa_path, "rb");
+ if (!f) {
+ strcpy(data, "NA");
+ return;
+ }
+
+ while((c = getc(f)) != EOF && c != '\n') {
+ data[i++] = c;
+ }
+ data[i] = '\0';
+ fclose(f);
+}
dev_info* mdevices_info_ul(int mask, int* len)
{
} while (rc == -1);
if (rc <= 0) {
- len = 0;
+ *len = 0;
if (devs) {
free(devs);
}
// Get attached infiniband devices
dev_info_arr[i].pci.ib_devs = get_ib_net_devs(domain, bus, dev, func, 1);
dev_info_arr[i].pci.net_devs = get_ib_net_devs(domain, bus, dev, func, 0);
+ get_numa_node(domain, bus, dev, func, (char*)(dev_info_arr[i].pci.numa_node));
// read configuration space header
if (read_pci_config_header(domain, bus, dev, func, conf_header)) {
}
+void mdevices_info_destroy_ul(dev_info* dev_info, int len)
+{
+ int i, j;
+ if (dev_info) {
+ for (i = 0; i < len; i++) {
+ if (dev_info[i].type == MDEVS_TAVOR_CR &&
+ dev_info[i].pci.ib_devs) {
+ for (j = 0; dev_info[i].pci.ib_devs[j]; j++) {
+ if (dev_info[i].pci.ib_devs[j]) {
+ free(dev_info[i].pci.ib_devs[j]);
+ }
+ }
+ free(dev_info[i].pci.ib_devs);
+ }
+ if (dev_info[i].type == MDEVS_TAVOR_CR &&
+ dev_info[i].pci.net_devs) {
+ for (j = 0; dev_info[i].pci.net_devs[j]; j++) {
+ if (dev_info[i].pci.net_devs[j]) {
+ free(dev_info[i].pci.net_devs[j]);
+ }
+ }
+ free(dev_info[i].pci.net_devs);
+ }
+
+ }
+ free(dev_info);
+ }
+}
+
/*
* This function used to change from running on CONF to CR
* and vice versa
mf->res_fd = fd;
}
-
-mfile *mopen_ul(const char *name)
+mfile *mopen_ul_int(const char *name, u_int32_t adv_opt)
{
mfile *mf;
off_t offset;
goto open_failed;
}
mf->tp = dev_type;
+ mf->flags = MDEVS_TAVOR_CR;
if (dev_type == MST_PCICONF || dev_type == MST_PCI) {
// allocate lock to sync between parallel cr space requests (CONF/MEMORY only)
if (force) {
errno = ENOTSUP;
goto open_failed;
}
- }
+ if (init_dev_info_ul(mf, name, domain, bus, dev, func)) {
+ goto open_failed;
+ }
+ }
sprintf(cbuf, "/sys/bus/pci/devices/%4.4x:%2.2x:%2.2x.%1.1x/config", domain, bus, dev, func);
if (force) {
switch (dev_type) {
case MST_PCICONF:
- rc = mtcr_pciconf_open(mf, name);
+ rc = mtcr_pciconf_open(mf, name, adv_opt);
break;
case MST_PCI:
- rc = mtcr_pcicr_open(mf, name, cbuf, 0, 0);
+ rc = mtcr_pcicr_open(mf, name, cbuf, 0, 0, adv_opt);
break;
case MST_IB:
rc = mtcr_inband_open(mf, name);
sprintf(rbuf, "/sys/bus/pci/devices/%4.4x:%2.2x:%2.2x.%1.1x/resource0", domain, bus, dev, func);
- rc = mtcr_pcicr_open(mf, rbuf, cbuf, 0, 0);
+ rc = mtcr_pcicr_open(mf, rbuf, cbuf, 0, 0, adv_opt);
if (rc == 0) {
return mf;
} else if (rc == 1) {
goto access_config_forced;
sprintf(pdbuf, "/proc/bus/pci/%4.4x:%2.2x/%2.2x.%1.1x", domain, bus, dev, func);
- rc = mtcr_pcicr_open(mf, pdbuf, cbuf, offset, 1);
+ rc = mtcr_pcicr_open(mf, pdbuf, cbuf, offset, 1, adv_opt);
if (rc == 0) {
return mf;
} else if (rc == 1) {
if (!domain) {
sprintf(pbuf, "/proc/bus/pci/%2.2x/%2.2x.%1.1x", bus, dev, func);
- rc = mtcr_pcicr_open(mf, pbuf, cbuf, offset, 1);
+ rc = mtcr_pcicr_open(mf, pbuf, cbuf, offset, 1, adv_opt);
if (rc == 0) {
return mf;
} else if (rc == 1) {
#if CONFIG_USE_DEV_MEM
/* Non-portable, but helps some systems */
- if (!mtcr_pcicr_open(mf, "/dev/mem", cbuf, offset, 0))
+ if (!mtcr_pcicr_open(mf, "/dev/mem", cbuf, offset, 0, adv_opt))
return mf;
#endif
access_config_forced:
sprintf(cbuf, "/sys/bus/pci/devices/%4.4x:%2.2x:%2.2x.%1.1x/config", domain, bus, dev, func);
- if (!mtcr_pciconf_open(mf, cbuf))
+ if (!mtcr_pciconf_open(mf, cbuf, adv_opt))
return mf;
sprintf(pdbuf, "/proc/bus/pci/%4.4x:%2.2x/%2.2x.%1.1x", domain, bus, dev, func);
- if (!mtcr_pciconf_open(mf, pdbuf))
+ if (!mtcr_pciconf_open(mf, pdbuf, adv_opt))
return mf;
if (!domain) {
sprintf(pbuf, "/proc/bus/pci/%2.2x/%2.2x.%1.1x", bus, dev, func);
- if (!mtcr_pciconf_open(mf, pdbuf))
+ if (!mtcr_pciconf_open(mf, pdbuf, adv_opt))
return mf;
}
return NULL;
}
+int init_dev_info_ul(mfile* mf, const char* dev_name, unsigned domain, unsigned bus, unsigned dev, unsigned func)
+{
+ int i;
+ int devs_len;
+ int ret = 0;
+ dev_info* devs = mdevices_info_v_ul(0xffffffff, &devs_len, 1);
+ for (i = 0; i < devs_len; i++) {
+ if (devs[i].pci.domain == domain &&
+ devs[i].pci.bus == bus &&
+ devs[i].pci.dev == dev &&
+ devs[i].pci.func == func) {
+ break;
+ }
+ }
+
+ if (i == devs_len) {
+ ret = 1;
+ goto cleanup;
+ }
+
+ mf->dinfo = malloc(sizeof(*mf->dinfo));
+ if (!mf->dinfo) {
+ errno = ENOMEM;
+ ret = 2;
+ goto cleanup;
+ }
+
+ memcpy(mf->dinfo, &devs[i], sizeof(*mf->dinfo));
+ strncpy(mf->dinfo->dev_name, dev_name, sizeof(mf->dinfo->dev_name)/sizeof(mf->dinfo->dev_name[0])-1);
+ if (mf->dinfo->type == MDEVS_TAVOR_CR) {
+ if (devs[i].pci.ib_devs) {
+ // count ib devs
+ int j;
+ char** curr = devs[i].pci.ib_devs;
+ int cnt = 0;
+ while (*(curr++)) {
+ cnt++;
+ }
+
+ mf->dinfo->pci.ib_devs = malloc((cnt + 1) * sizeof(char*));
+ if (!mf->dinfo->pci.ib_devs) {
+ errno = ENOMEM;
+ free(mf->dinfo);
+ ret = 3;
+ goto cleanup;
+ }
+
+ for (j = 0; j < cnt; j++) {
+ mf->dinfo->pci.ib_devs[j] = malloc(strlen(devs[i].pci.ib_devs[j]) + 1);
+ strcpy(mf->dinfo->pci.ib_devs[j], devs[i].pci.ib_devs[j]);
+ }
+ mf->dinfo->pci.ib_devs[cnt] = NULL;
+ }
+
+ if (devs[i].pci.net_devs) {
+ // count net devs
+ int j;
+ char** curr = devs[i].pci.net_devs;
+ int cnt = 0;
+ while (*(curr++)) {
+ cnt++;
+ }
+
+ mf->dinfo->pci.net_devs = malloc((cnt + 1) * sizeof(char*));
+ if (!mf->dinfo->pci.net_devs) {
+ errno = ENOMEM;
+ if (mf->dinfo->pci.ib_devs) {
+ free(mf->dinfo->pci.ib_devs);
+ }
+ free(mf->dinfo);
+ ret = 4;
+ goto cleanup;
+ }
+
+ for (j = 0; j < cnt; j++) {
+ mf->dinfo->pci.net_devs[j] = malloc(strlen(devs[i].pci.net_devs[j]) + 1);
+ strcpy(mf->dinfo->pci.net_devs[j], devs[i].pci.net_devs[j]);
+ }
+ mf->dinfo->pci.net_devs[cnt] = NULL;
+ }
+ }
+
+ cleanup:
+ mdevices_info_destroy_ul(devs, devs_len);
+ return ret;
+}
+
+
+mfile *mopen_ul(const char *name)
+{
+ mfile* mf = mopen_ul_int(name, 0);
+
+ return mf;
+}
+
int mclose_ul(mfile *mf)
{
if (mf != NULL) {
}
return mf->acc_reg_params.max_reg_size;
}
+
+int mclear_pci_semaphore_ul(const char* name)
+{
+ mfile* mf;
+ int rc = ME_OK;
+ mf = mopen_ul_int(name, Clear_Vsec_Semaphore);
+ if (!mf) {
+ return ME_ERROR;
+ }
+ if ((mf->tp & (MST_PCICONF | MST_PCI)) == 0) {
+ rc = ME_UNSUPPORTED_ACCESS_TYPE;
+ }
+ mclose_ul(mf);
+ return rc;
+}
+
+/************************************
+ * Function: m_err2str
+ ************************************/
+const char* m_err2str(MError status)
+{
+ switch(status) {
+ case ME_OK:
+ return "ME_OK";
+ case ME_ERROR:
+ return "General error";
+ case ME_BAD_PARAMS:
+ return "ME_BAD_PARAMS";
+ case ME_CR_ERROR:
+ return "ME_CR_ERROR";
+ case ME_NOT_IMPLEMENTED:
+ return "ME_NOT_IMPLEMENTED";
+ case ME_SEM_LOCKED:
+ return "Semaphore locked";
+ case ME_MEM_ERROR:
+ return "ME_MEM_ERROR";
+ case ME_UNSUPPORTED_OPERATION:
+ return "ME_UNSUPPORTED_OPERATION";
+
+ case ME_MAD_SEND_FAILED:
+ return "ME_MAD_SEND_FAILED";
+ case ME_UNKOWN_ACCESS_TYPE:
+ return "ME_UNKOWN_ACCESS_TYPE";
+ case ME_UNSUPPORTED_ACCESS_TYPE:
+ return "ME_UNSUPPORTED_ACCESS_TYPE";
+ case ME_UNSUPPORTED_DEVICE:
+ return "ME_UNSUPPORTED_DEVICE";
+
+ // Reg access errors
+ case ME_REG_ACCESS_BAD_STATUS_ERR:
+ return "ME_REG_ACCESS_BAD_STATUS_ERR";
+ case ME_REG_ACCESS_BAD_METHOD:
+ return "Bad method";
+ case ME_REG_ACCESS_NOT_SUPPORTED:
+ return "Register access isn't supported by device";
+ case ME_REG_ACCESS_DEV_BUSY:
+ return "Device is busy";
+ case ME_REG_ACCESS_VER_NOT_SUPP:
+ return "Version not supported";
+ case ME_REG_ACCESS_UNKNOWN_TLV:
+ return "Unknown TLV";
+ case ME_REG_ACCESS_REG_NOT_SUPP:
+ return "Register not supported";
+ case ME_REG_ACCESS_CLASS_NOT_SUPP:
+ return "Class not supported";
+ case ME_REG_ACCESS_METHOD_NOT_SUPP:
+ return "Method not supported";
+ case ME_REG_ACCESS_BAD_PARAM:
+ return "Bad parameter";
+ case ME_REG_ACCESS_RES_NOT_AVLBL:
+ return "Resource not available";
+ case ME_REG_ACCESS_MSG_RECPT_ACK:
+ return "Message receipt ack";
+ case ME_REG_ACCESS_UNKNOWN_ERR:
+ return "Unknown register error";
+ case ME_REG_ACCESS_SIZE_EXCCEEDS_LIMIT:
+ return "Register is too large";
+ case ME_REG_ACCESS_CONF_CORRUPT:
+ return "Config Section Corrupted";
+ case ME_REG_ACCESS_LEN_TOO_SMALL:
+ return "given register length too small for Tlv";
+ case ME_REG_ACCESS_BAD_CONFIG:
+ return "configuration refused";
+ case ME_REG_ACCESS_ERASE_EXEEDED:
+ return "erase count exceeds limit";
+ case ME_REG_ACCESS_INTERNAL_ERROR:
+ return "FW internal error";
+
+ // ICMD access errors
+ case ME_ICMD_STATUS_CR_FAIL:
+ return "ME_ICMD_STATUS_CR_FAIL";
+ case ME_ICMD_STATUS_SEMAPHORE_TO:
+ return "ME_ICMD_STATUS_SEMAPHORE_TO";
+ case ME_ICMD_STATUS_EXECUTE_TO:
+ return "ME_ICMD_STATUS_EXECUTE_TO";
+ case ME_ICMD_STATUS_IFC_BUSY:
+ return "ME_ICMD_STATUS_IFC_BUSY";
+ case ME_ICMD_STATUS_ICMD_NOT_READY:
+ return "ME_ICMD_STATUS_ICMD_NOT_READY";
+ case ME_ICMD_UNSUPPORTED_ICMD_VERSION:
+ return "ME_ICMD_UNSUPPORTED_ICMD_VERSION";
+ case ME_ICMD_NOT_SUPPORTED:
+ return "ME_REG_ACCESS_ICMD_NOT_SUPPORTED";
+ case ME_ICMD_INVALID_OPCODE:
+ return "ME_ICMD_INVALID_OPCODE";
+ case ME_ICMD_INVALID_CMD:
+ return "ME_ICMD_INVALID_CMD";
+ case ME_ICMD_OPERATIONAL_ERROR:
+ return "ME_ICMD_OPERATIONAL_ERROR";
+ case ME_ICMD_BAD_PARAM:
+ return "ME_ICMD_BAD_PARAM";
+ case ME_ICMD_BUSY:
+ return "ME_ICMD_BUSY";
+ case ME_ICMD_ICM_NOT_AVAIL:
+ return "ME_ICMD_ICM_NOT_AVAIL";
+ case ME_ICMD_WRITE_PROTECT:
+ return "ME_ICMD_WRITE_PROTECT";
+ case ME_ICMD_UNKNOWN_STATUS:
+ return "ME_ICMD_UNKNOWN_STATUS";
+ case ME_ICMD_SIZE_EXCEEDS_LIMIT:
+ return "ME_ICMD_SIZE_EXCEEDS_LIMIT";
+
+ // TOOLS HCR access errors
+ case ME_CMDIF_BUSY:
+ return "Tools HCR busy";
+ case ME_CMDIF_TOUT:
+ return "Tools HCR time out.";
+ case ME_CMDIF_BAD_OP:
+ return "Operation not supported";
+ case ME_CMDIF_NOT_SUPP:
+ return "Tools HCR not supported";
+ case ME_CMDIF_BAD_SYS:
+ return "bad system status (driver may be down or Fw does not support this operation)";
+ case ME_CMDIF_UNKN_TLV:
+ return "Unknown TLV";
+ case ME_CMDIF_RES_STATE:
+ return "Bad reset state";
+ case ME_CMDIF_UNKN_STATUS:
+ return "Unknown status";
+
+ // MAD IFC errors
+ case ME_MAD_BUSY:
+ return "Temporarily busy. MAD discarded. This is not an error";
+ case ME_MAD_REDIRECT:
+ return "Redirection. This is not an error";
+ case ME_MAD_BAD_VER:
+ return "Bad version";
+ case ME_MAD_METHOD_NOT_SUPP:
+ return "Method not supported";
+ case ME_MAD_METHOD_ATTR_COMB_NOT_SUPP:
+ return "Method and attribute combination isn't supported";
+ case ME_MAD_BAD_DATA:
+ return "Bad attribute modifier or field";
+ case ME_MAD_GENERAL_ERR:
+ return "Unknown MAD error";
+
+ default:
+ return "Unknown error code";
+ }
+}
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
+ *
+ * mtcr_ul_com.h
+ *
+ * Created on: Feb 16, 2016
+ * Author: adham
*/
#ifndef USER_MTCR_MTCR_UL_COM_H_
int mread_buffer_ul(mfile* mf, unsigned int offset, u_int8_t* data, int byte_len);
int mwrite_buffer_ul(mfile* mf, unsigned int offset, u_int8_t* data, int byte_len);
+int mclear_pci_semaphore_ul(const char* name);
+
#ifdef __cplusplus
}
#endif
#define REG_ID_NVQC 0x9030
#define REG_ID_NVIA 0x9033 // 5th gen
#define REG_ID_NVQGC 0x9034
+#define REG_ID_MNVGN 0x9035
// TODO: get correct register ID for mfrl mfai
#define REG_ID_MFRL 0x9028
// register access for variable size registers (like mfba)
-#define REG_ACCCESS_VAR(mf, methdod, reg_id, data_struct, struct_name, reg_size , r_reg_size, w_reg_size, prefix)\
- int status = 0;\
+#define REG_ACCESS_GENERIC_VAR_WITH_STATUS(mf, methdod, reg_id, data_struct, struct_name, reg_size , r_reg_size, w_reg_size, pack_func,\
+ unpack_func, size_func, print_func, status)\
int rc;\
- int max_data_size = prefix##_##struct_name##_size();\
+ int max_data_size = size_func();\
u_int8_t data[max_data_size];\
memset(data, 0, max_data_size);\
- prefix##_##struct_name##_pack(data_struct, data);\
+ pack_func(data_struct, data);\
if (method != REG_ACCESS_METHOD_GET && method != REG_ACCESS_METHOD_SET) {\
return ME_REG_ACCESS_BAD_METHOD;\
}\
- DEBUG_PRINT_SEND(data_struct, struct_name, method, prefix);\
- rc = maccess_reg(mf, reg_id, (maccess_reg_method_t)method, data, reg_size, r_reg_size, w_reg_size, &status);\
- prefix##_##struct_name##_unpack(data_struct, data);\
- DEBUG_PRINT_RECIEVE(data_struct, struct_name, method, prefix);\
+ DEBUG_PRINT_SEND(data_struct, struct_name, method, print_func);\
+ rc = maccess_reg(mf, reg_id, (maccess_reg_method_t)method, data, reg_size, r_reg_size, w_reg_size, status);\
+ unpack_func(data_struct, data);\
+ DEBUG_PRINT_RECIEVE(data_struct, struct_name, method, print_func);
+
+#define REG_ACCESS_GENERIC_VAR(mf, methdod, reg_id, data_struct, struct_name, reg_size , r_reg_size, w_reg_size, pack_func,\
+ unpack_func, size_func, print_func)\
+ int status = 0;\
+ REG_ACCESS_GENERIC_VAR_WITH_STATUS(mf, methdod, reg_id, data_struct, struct_name, reg_size , r_reg_size, w_reg_size, pack_func,\
+ unpack_func, size_func, print_func, &status)\
if (rc || status) {\
return (reg_access_status_t)rc;\
}\
return ME_OK
+#define REG_ACCCESS_VAR(mf, methdod, reg_id, data_struct, struct_name, reg_size , r_reg_size, w_reg_size, prefix)\
+ REG_ACCESS_GENERIC_VAR(mf, method, reg_id, data_struct, struct_name, reg_size, r_reg_size, w_reg_size,\
+ prefix##_##struct_name##_pack, prefix##_##struct_name##_unpack, prefix##_##struct_name##_size,\
+ prefix##_##struct_name##_print)
+
// register access for static sized registers
#define REG_ACCCESS(mf, methdod, reg_id, data_struct, struct_name, prefix)\
- int data_size = prefix##_##struct_name##_size();\
- REG_ACCCESS_VAR(mf, methdod, reg_id, data_struct, struct_name, data_size, data_size, data_size, prefix)
+ int data_size = prefix##_##struct_name##_size();\
+ REG_ACCCESS_VAR(mf, methdod, reg_id, data_struct, struct_name, data_size, data_size, data_size, prefix)
/************************************
* Function: reg_access_mfba
REG_ACCCESS(mf, method, REG_ID_MVTS, mvts, mvts, tools_open);
}
+/************************************
+ * Function: reg_access_mnvgn
+ ************************************/
+reg_access_status_t reg_access_mnvgn (mfile* mf, reg_access_method_t method, struct tools_open_mnvgn* mnvgn, int *status)
+{
+ int data_size = tools_open_mnvgn_size();
+ if (method != REG_ACCESS_METHOD_GET ) { // this register supports only get method
+ return ME_REG_ACCESS_BAD_METHOD;
+ }
+
+ REG_ACCESS_GENERIC_VAR_WITH_STATUS(mf, method, REG_ID_MNVGN, mnvgn, mnvgn, data_size, data_size, data_size,\
+ tools_open_mnvgn_pack, tools_open_mnvgn_unpack, tools_open_mnvgn_size,\
+ tools_open_mnvgn_print, status);
+
+ if (rc || *status) {\
+ return (reg_access_status_t)rc;\
+ }\
+ return ME_OK;
+}
+
/************************************
* Function: reg_access_err2str
************************************/
reg_access_status_t reg_access_nvqc (mfile* mf, reg_access_method_t method, struct tools_open_nvqc* nvqc);
reg_access_status_t reg_access_nvqgc (mfile* mf, reg_access_method_t method, struct tools_open_nvqgc* nvqgc);
reg_access_status_t reg_access_mvts (mfile* mf, reg_access_method_t method, struct tools_open_mvts* mvts);
+reg_access_status_t reg_access_mnvgn (mfile* mf, reg_access_method_t method, struct tools_open_mnvgn* mnvgn, int *status);
#ifdef __cplusplus
}
void usage(const char *n, int with_exit)
{
printf(" Mellanox Configuration Registers Access tool\n");
- printf(" Usage: %s [-s <i2c-slave>] [-a <adb dump>] [-v] [-h] <device>\n", n);
+ printf(" Usage: %s [-s <i2c-slave>] [-a <adb dump>] [-v] [-h] [-c] <device>\n", n);
printf(" <addr[.<bit offset>:<bit size>]|[,<bytes number>]> [data]\n");
printf(" If data is given, operation is write. Otherwise it is read.\n");
printf(" If a bit range is given in the address (E.G.: 0xf0014.16:8):\n");
" number of dwords should be (bytes number/4).\n\n");
printf(" -s <i2c-slave> : I2C slave address.\n");
printf(" -a <dump file> : adb dump file, used for access by path.\n");
+ printf(" -c : clear the device's PCI semaphore.\n");
printf(" -h : Print this help message.\n");
printf(" -v : Display version info\n");
printf("\n");
int bit_size = 32;
int byte_size = 0;
int read_block = 0; /* if 0 then read field according to "addr.bit:size", else read block of size "byte_size" */
+ int clear_semaphore = 0;
const char* op_name = "cr write";
#if 0
usage(argv[0], 1);
}
- while ((c = getopt(argc, argv, "s:a:hv")) != -1) {
+ while ((c = getopt(argc, argv, "s:a:hvc")) != -1) {
switch (c) {
case 's':
i2c_slave = strtoul(optarg, &endp, 0);
usage(argv[0], 0);
exit(0);
- case '?':
+ case 'c':
+ clear_semaphore = 1;
break;
+ case '?':
+ exit(1);
+
default:
fprintf(stderr, "-E- Unknown flag \"%c\"\n", c);
exit(1);
optind++;
}
+ if (clear_semaphore) {
+ if ((rc = mclear_pci_semaphore(dev))) {
+ fprintf(stderr, "-E- Failed to clear PCI semaphore for device: %s. %s\n", dev, m_err2str((MError)rc));
+ exit(1);
+ }
+ printf("-I- PCI Semaphore cleared successfully.\n");
+ exit(0);
+ }
+
if (optind >= argc) {
fprintf(stderr, "-E- Missing address argument\n");
exit(1);
}
strncpy(device, dev, MAX_DEV_LEN -1);
// Do the job
- mf = mopen((const char *)device);
+ mf = mopen_adv((const char *)device, (MType)(MST_DEFAULT | MST_CABLE));
if (!mf) {
perror("mopen");
return 1;
-
-/* - Mellanox Confidential and Proprietary -
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
*
- * Copyright (C) Jan 2013, Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
*
- * Except as specifically permitted herein, no portion of the information,
- * including but not limited to object code and source code, may be reproduced,
- * modified, distributed, republished or otherwise exploited in any form or by
- * any means for any purpose without the prior written permission of Mellanox
- * Technologies Ltd. Use of software subject to the terms and conditions
- * detailed in the file "LICENSE.txt".
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
*/
#include <openssl/md5.h>
-
-/* - Mellanox Confidential and Proprietary -
+/*
+ * Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
*
- * Copyright (C) Jan 2013, Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
*
- * Except as specifically permitted herein, no portion of the information,
- * including but not limited to object code and source code, may be reproduced,
- * modified, distributed, republished or otherwise exploited in any form or by
- * any means for any purpose without the prior written permission of Mellanox
- * Technologies Ltd. Use of software subject to the terms and conditions
- * detailed in the file "LICENSE.txt".
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
*/
#ifndef TOOLS_MD5_H
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
/***
- *** This file was generated at "2016-02-23 00:12:07"
+ *** This file was generated at "2016-05-02 14:45:27"
*** by:
*** > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/register_access_open/register_access_open.adb --file-prefix register_access_open --prefix register_access_
***/
#include "register_access_open_layouts.h"
-void register_access_mfba_pack(const struct register_access_mfba *ptr_struct, u_int8_t* ptr_buff){
+void register_access_mfba_pack(const struct register_access_mfba *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=26;
+ offset = 26;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->fs);
- offset=23;
+ offset = 23;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->p);
- offset=55;
+ offset = 55;
adb2c_push_bits_to_buff(ptr_buff, offset, 9, (u_int32_t)ptr_struct->size);
- offset=72;
+ offset = 72;
adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->address);
- for (i=0; i < 64; i++) {
- offset=adb2c_calc_array_field_address(96, 32, i, 2144, 0);
+ for (i = 0; i < 64; i++) {
+ offset = adb2c_calc_array_field_address(96, 32, i, 2144, 0);
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->data[i]);
}
}
-void register_access_mfba_unpack(struct register_access_mfba *ptr_struct, const u_int8_t* ptr_buff){
+void register_access_mfba_unpack(struct register_access_mfba *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=26;
+ offset = 26;
ptr_struct->fs = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=23;
+ offset = 23;
ptr_struct->p = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=55;
+ offset = 55;
ptr_struct->size = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 9);
- offset=72;
+ offset = 72;
ptr_struct->address = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
- for (i=0; i < 64; i++) {
- offset=adb2c_calc_array_field_address(96, 32, i, 2144, 0);
+ for (i = 0; i < 64; i++) {
+ offset = adb2c_calc_array_field_address(96, 32, i, 2144, 0);
ptr_struct->data[i] = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
}
-void register_access_mfba_print(const struct register_access_mfba *ptr_struct, FILE* file, int indent_level){
+void register_access_mfba_print(const struct register_access_mfba *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== register_access_mfba ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
fprintf(file, "address : "UH_FMT"\n", ptr_struct->address);
- for (i=0; i < 64; i++) {
+ for (i = 0; i < 64; i++) {
adb2c_add_indentation(file, indent_level);
fprintf(file, "data_%03d : "U32H_FMT"\n", i, ptr_struct->data[i]);
}
}
-int register_access_mfba_size(void){
+int register_access_mfba_size(void)
+{
return 268;
}
-void register_access_mfba_dump(const struct register_access_mfba *ptr_struct, FILE* file) {
+void register_access_mfba_dump(const struct register_access_mfba *ptr_struct, FILE* file)
+{
register_access_mfba_print(ptr_struct, file, 0);
}
-void register_access_mfpa_pack(const struct register_access_mfpa *ptr_struct, u_int8_t* ptr_buff){
+void register_access_mfpa_pack(const struct register_access_mfpa *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=26;
+ offset = 26;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->fs);
- offset=23;
+ offset = 23;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->p);
- offset=40;
+ offset = 40;
adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->boot_address);
- offset=156;
+ offset = 156;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->flash_num);
- offset=130;
+ offset = 130;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->bulk_64kb_erase_en);
- offset=168;
+ offset = 129;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->bulk_32kb_erase_en);
+
+ offset = 168;
adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->jedec_id);
- offset=214;
+ offset = 214;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->sector_size);
- offset=200;
+ offset = 200;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->block_allignment);
- offset=224;
+ offset = 224;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->capability_mask);
}
-void register_access_mfpa_unpack(struct register_access_mfpa *ptr_struct, const u_int8_t* ptr_buff){
+void register_access_mfpa_unpack(struct register_access_mfpa *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=26;
+ offset = 26;
ptr_struct->fs = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=23;
+ offset = 23;
ptr_struct->p = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=40;
+ offset = 40;
ptr_struct->boot_address = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
- offset=156;
+ offset = 156;
ptr_struct->flash_num = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=130;
+ offset = 130;
ptr_struct->bulk_64kb_erase_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=168;
+ offset = 129;
+ ptr_struct->bulk_32kb_erase_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+ offset = 168;
ptr_struct->jedec_id = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
- offset=214;
+ offset = 214;
ptr_struct->sector_size = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=200;
+ offset = 200;
ptr_struct->block_allignment = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=224;
+ offset = 224;
ptr_struct->capability_mask = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void register_access_mfpa_print(const struct register_access_mfpa *ptr_struct, FILE* file, int indent_level){
+void register_access_mfpa_print(const struct register_access_mfpa *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== register_access_mfpa ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
fprintf(file, "bulk_64kb_erase_en : "UH_FMT"\n", ptr_struct->bulk_64kb_erase_en);
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "bulk_32kb_erase_en : "UH_FMT"\n", ptr_struct->bulk_32kb_erase_en);
+
adb2c_add_indentation(file, indent_level);
fprintf(file, "jedec_id : "UH_FMT"\n", ptr_struct->jedec_id);
}
-int register_access_mfpa_size(void){
- return 36;
+int register_access_mfpa_size(void)
+{
+ return 32;
}
-void register_access_mfpa_dump(const struct register_access_mfpa *ptr_struct, FILE* file) {
+void register_access_mfpa_dump(const struct register_access_mfpa *ptr_struct, FILE* file)
+{
register_access_mfpa_print(ptr_struct, file, 0);
}
-void register_access_mfbe_pack(const struct register_access_mfbe *ptr_struct, u_int8_t* ptr_buff){
+void register_access_mfbe_pack(const struct register_access_mfbe *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=26;
+ offset = 26;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->fs);
- offset=23;
+ offset = 23;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->p);
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->bulk_64kb_erase);
- offset=72;
+ offset = 1;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->bulk_32kb_erase);
+
+ offset = 72;
adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->address);
}
-void register_access_mfbe_unpack(struct register_access_mfbe *ptr_struct, const u_int8_t* ptr_buff){
+void register_access_mfbe_unpack(struct register_access_mfbe *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=26;
+ offset = 26;
ptr_struct->fs = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=23;
+ offset = 23;
ptr_struct->p = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=2;
+ offset = 2;
ptr_struct->bulk_64kb_erase = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=72;
+ offset = 1;
+ ptr_struct->bulk_32kb_erase = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+ offset = 72;
ptr_struct->address = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
}
-void register_access_mfbe_print(const struct register_access_mfbe *ptr_struct, FILE* file, int indent_level){
+void register_access_mfbe_print(const struct register_access_mfbe *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== register_access_mfbe ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
fprintf(file, "bulk_64kb_erase : "UH_FMT"\n", ptr_struct->bulk_64kb_erase);
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "bulk_32kb_erase : "UH_FMT"\n", ptr_struct->bulk_32kb_erase);
+
adb2c_add_indentation(file, indent_level);
fprintf(file, "address : "UH_FMT"\n", ptr_struct->address);
}
-int register_access_mfbe_size(void){
+int register_access_mfbe_size(void)
+{
return 12;
}
-void register_access_mfbe_dump(const struct register_access_mfbe *ptr_struct, FILE* file) {
+void register_access_mfbe_dump(const struct register_access_mfbe *ptr_struct, FILE* file)
+{
register_access_mfbe_print(ptr_struct, file, 0);
}
register_access_mfba_unpack(&(ptr_struct->mfba), ptr_buff);
}
-void register_access_register_access_open_Nodes_print(const union register_access_register_access_open_Nodes *ptr_struct, FILE* file, int indent_level){
+void register_access_register_access_open_Nodes_print(const union register_access_register_access_open_Nodes *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== register_access_register_access_open_Nodes ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int register_access_register_access_open_Nodes_size(void){
+int register_access_register_access_open_Nodes_size(void)
+{
return 268;
}
-void register_access_register_access_open_Nodes_dump(const union register_access_register_access_open_Nodes *ptr_struct, FILE* file) {
+void register_access_register_access_open_Nodes_dump(const union register_access_register_access_open_Nodes *ptr_struct, FILE* file)
+{
register_access_register_access_open_Nodes_print(ptr_struct, file, 0);
}
* SOFTWARE.
*/
+
/***
- *** This file was generated at "2016-02-23 00:12:07"
+ *** This file was generated at "2016-05-02 14:45:27"
*** by:
*** > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/register_access_open/register_access_open.adb --file-prefix register_access_open --prefix register_access_
***/
};
/* Description - */
-/* Size in bytes - 36 */
+/* Size in bytes - 32 */
struct register_access_mfpa {
/*---------------- DWORD[0] (Offset 0x0) ----------------*/
/* Description - Flash Select */
/* Description - number of flash devices connected */
/* 16.0 - 16.3 */
u_int8_t flash_num;
- /* Description - */
+ /* Description - If set, MFBE register supports 64KB bulk erase operation. */
/* 16.29 - 16.29 */
u_int8_t bulk_64kb_erase_en;
+ /* Description - If set, MFBE register supports 32KB bulk erase operation. */
+ /* 16.30 - 16.30 */
+ u_int8_t bulk_32kb_erase_en;
/*---------------- DWORD[5] (Offset 0x14) ----------------*/
/* Description - Flash JEDEC ID */
/* 20.0 - 20.23 */
/* Description - Parallel */
/* 0.8 - 0.8 */
u_int8_t p;
- /* Description - erase 64KB flash area */
+ /* Description - Erase a 64KB flash area in one bulk operation. */
/* 0.29 - 0.29 */
u_int8_t bulk_64kb_erase;
+ /* Description - Erase a 32KB flash area in one bulk operation. */
+ /* 0.30 - 0.30 */
+ u_int8_t bulk_32kb_erase;
/*---------------- DWORD[2] (Offset 0x8) ----------------*/
/* Description - address in bytes */
/* 8.0 - 8.23 */
/* 0.0 - 12.31 */
struct register_access_mfbe mfbe;
/* Description - */
- /* 0.0 - 36.31 */
+ /* 0.0 - 32.31 */
struct register_access_mfpa mfpa;
/* Description - */
/* 0.0 - 268.31 */
void register_access_mfpa_unpack(struct register_access_mfpa *ptr_struct, const u_int8_t* ptr_buff);
void register_access_mfpa_print(const struct register_access_mfpa *ptr_struct, FILE* file, int indent_level);
int register_access_mfpa_size(void);
-#define REGISTER_ACCESS_MFPA_SIZE (0x24)
+#define REGISTER_ACCESS_MFPA_SIZE (0x20)
void register_access_mfpa_dump(const struct register_access_mfpa *ptr_struct, FILE* file);
/* mfbe */
void register_access_mfbe_pack(const struct register_access_mfbe *ptr_struct, u_int8_t* ptr_buff);
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
/***
- *** This file was generated at "2016-05-04 19:06:49"
+ *** This file was generated at "2016-05-09 12:11:56"
*** by:
*** > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools_open/tools_open.adb --file-prefix tools_open --prefix tools_open_
***/
#include "tools_open_layouts.h"
-void tools_open_tlv_type_dw_pack(const struct tools_open_tlv_type_dw *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_tlv_type_dw_pack(const struct tools_open_tlv_type_dw *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->tlv_type_dw);
}
-void tools_open_tlv_type_dw_unpack(struct tools_open_tlv_type_dw *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_tlv_type_dw_unpack(struct tools_open_tlv_type_dw *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->tlv_type_dw = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void tools_open_tlv_type_dw_print(const struct tools_open_tlv_type_dw *ptr_struct, FILE* file, int indent_level){
+void tools_open_tlv_type_dw_print(const struct tools_open_tlv_type_dw *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_tlv_type_dw ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_tlv_type_dw_size(void){
+int tools_open_tlv_type_dw_size(void)
+{
return 4;
}
-void tools_open_tlv_type_dw_dump(const struct tools_open_tlv_type_dw *ptr_struct, FILE* file) {
+void tools_open_tlv_type_dw_dump(const struct tools_open_tlv_type_dw *ptr_struct, FILE* file)
+{
tools_open_tlv_type_dw_print(ptr_struct, file, 0);
}
-void tools_open_per_port_type_pack(const struct tools_open_per_port_type *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_per_port_type_pack(const struct tools_open_per_port_type *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->param_idx);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->port);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->param_class);
}
-void tools_open_per_port_type_unpack(struct tools_open_per_port_type *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_per_port_type_unpack(struct tools_open_per_port_type *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
ptr_struct->param_idx = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=8;
+ offset = 8;
ptr_struct->port = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=0;
+ offset = 0;
ptr_struct->param_class = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_per_port_type_print(const struct tools_open_per_port_type *ptr_struct, FILE* file, int indent_level){
+void tools_open_per_port_type_print(const struct tools_open_per_port_type *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_per_port_type ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_per_port_type_size(void){
+int tools_open_per_port_type_size(void)
+{
return 4;
}
-void tools_open_per_port_type_dump(const struct tools_open_per_port_type *ptr_struct, FILE* file) {
+void tools_open_per_port_type_dump(const struct tools_open_per_port_type *ptr_struct, FILE* file)
+{
tools_open_per_port_type_print(ptr_struct, file, 0);
}
-void tools_open_bmc_type_pack(const struct tools_open_bmc_type *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_bmc_type_pack(const struct tools_open_bmc_type *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=19;
+ offset = 19;
adb2c_push_bits_to_buff(ptr_buff, offset, 13, (u_int32_t)ptr_struct->param_idx);
- offset=14;
+ offset = 14;
adb2c_push_bits_to_buff(ptr_buff, offset, 5, (u_int32_t)ptr_struct->channel);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->host);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->param_class);
}
-void tools_open_bmc_type_unpack(struct tools_open_bmc_type *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_bmc_type_unpack(struct tools_open_bmc_type *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=19;
+ offset = 19;
ptr_struct->param_idx = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 13);
- offset=14;
+ offset = 14;
ptr_struct->channel = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 5);
- offset=8;
+ offset = 8;
ptr_struct->host = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=0;
+ offset = 0;
ptr_struct->param_class = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_bmc_type_print(const struct tools_open_bmc_type *ptr_struct, FILE* file, int indent_level){
+void tools_open_bmc_type_print(const struct tools_open_bmc_type *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_bmc_type ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_bmc_type_size(void){
+int tools_open_bmc_type_size(void)
+{
return 4;
}
-void tools_open_bmc_type_dump(const struct tools_open_bmc_type *ptr_struct, FILE* file) {
+void tools_open_bmc_type_dump(const struct tools_open_bmc_type *ptr_struct, FILE* file)
+{
tools_open_bmc_type_print(ptr_struct, file, 0);
}
-void tools_open_per_host_type_pack(const struct tools_open_per_host_type *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_per_host_type_pack(const struct tools_open_per_host_type *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=22;
+ offset = 22;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->param_idx);
- offset=14;
+ offset = 14;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->function);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->host);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->param_class);
}
-void tools_open_per_host_type_unpack(struct tools_open_per_host_type *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_per_host_type_unpack(struct tools_open_per_host_type *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=22;
+ offset = 22;
ptr_struct->param_idx = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=14;
+ offset = 14;
ptr_struct->function = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=8;
+ offset = 8;
ptr_struct->host = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=0;
+ offset = 0;
ptr_struct->param_class = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_per_host_type_print(const struct tools_open_per_host_type *ptr_struct, FILE* file, int indent_level){
+void tools_open_per_host_type_print(const struct tools_open_per_host_type *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_per_host_type ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_per_host_type_size(void){
+int tools_open_per_host_type_size(void)
+{
return 4;
}
-void tools_open_per_host_type_dump(const struct tools_open_per_host_type *ptr_struct, FILE* file) {
+void tools_open_per_host_type_dump(const struct tools_open_per_host_type *ptr_struct, FILE* file)
+{
tools_open_per_host_type_print(ptr_struct, file, 0);
}
-void tools_open_eswitch_type_pack(const struct tools_open_eswitch_type *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_eswitch_type_pack(const struct tools_open_eswitch_type *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->param_idx);
- offset=14;
+ offset = 14;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->port);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->host);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->param_class);
}
-void tools_open_eswitch_type_unpack(struct tools_open_eswitch_type *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_eswitch_type_unpack(struct tools_open_eswitch_type *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
ptr_struct->param_idx = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=14;
+ offset = 14;
ptr_struct->port = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=8;
+ offset = 8;
ptr_struct->host = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=0;
+ offset = 0;
ptr_struct->param_class = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_eswitch_type_print(const struct tools_open_eswitch_type *ptr_struct, FILE* file, int indent_level){
+void tools_open_eswitch_type_print(const struct tools_open_eswitch_type *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_eswitch_type ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_eswitch_type_size(void){
+int tools_open_eswitch_type_size(void)
+{
return 4;
}
-void tools_open_eswitch_type_dump(const struct tools_open_eswitch_type *ptr_struct, FILE* file) {
+void tools_open_eswitch_type_dump(const struct tools_open_eswitch_type *ptr_struct, FILE* file)
+{
tools_open_eswitch_type_print(ptr_struct, file, 0);
}
-void tools_open_global_type_pack(const struct tools_open_global_type *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_global_type_pack(const struct tools_open_global_type *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->param_idx);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->param_class);
}
-void tools_open_global_type_unpack(struct tools_open_global_type *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_global_type_unpack(struct tools_open_global_type *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=8;
+ offset = 8;
ptr_struct->param_idx = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
- offset=0;
+ offset = 0;
ptr_struct->param_class = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_global_type_print(const struct tools_open_global_type *ptr_struct, FILE* file, int indent_level){
+void tools_open_global_type_print(const struct tools_open_global_type *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_global_type ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_global_type_size(void){
+int tools_open_global_type_size(void)
+{
return 4;
}
-void tools_open_global_type_dump(const struct tools_open_global_type *ptr_struct, FILE* file) {
+void tools_open_global_type_dump(const struct tools_open_global_type *ptr_struct, FILE* file)
+{
tools_open_global_type_print(ptr_struct, file, 0);
}
-void tools_open_ts_entry_pack(const struct tools_open_ts_entry *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_tlv_type_pack(const union tools_open_tlv_type *ptr_struct, u_int8_t* ptr_buff)
+{
+ tools_open_tlv_type_dw_pack(&(ptr_struct->tlv_type_dw), ptr_buff);
+}
+
+void tools_open_tlv_type_unpack(union tools_open_tlv_type *ptr_struct, const u_int8_t* ptr_buff)
+{
+ tools_open_tlv_type_dw_unpack(&(ptr_struct->tlv_type_dw), ptr_buff);
+}
+
+void tools_open_tlv_type_print(const union tools_open_tlv_type *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_tlv_type ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "global:\n");
+ tools_open_global_type_print(&(ptr_struct->global), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "eswitch:\n");
+ tools_open_eswitch_type_print(&(ptr_struct->eswitch), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "per_host:\n");
+ tools_open_per_host_type_print(&(ptr_struct->per_host), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "bmc:\n");
+ tools_open_bmc_type_print(&(ptr_struct->bmc), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "per_port:\n");
+ tools_open_per_port_type_print(&(ptr_struct->per_port), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "tlv_type_dw:\n");
+ tools_open_tlv_type_dw_print(&(ptr_struct->tlv_type_dw), file, indent_level + 1);
+
+}
+
+int tools_open_tlv_type_size(void)
+{
+ return 4;
+}
+
+void tools_open_tlv_type_dump(const union tools_open_tlv_type *ptr_struct, FILE* file)
+{
+ tools_open_tlv_type_print(ptr_struct, file, 0);
+}
+
+void tools_open_ts_entry_pack(const struct tools_open_ts_entry *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->ts_day);
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->ts_month);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->ts_year);
- offset=48;
+ offset = 48;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->ts_seconds);
- offset=40;
+ offset = 40;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->ts_minutes);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->ts_hour);
}
-void tools_open_ts_entry_unpack(struct tools_open_ts_entry *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_ts_entry_unpack(struct tools_open_ts_entry *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->ts_day = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=16;
+ offset = 16;
ptr_struct->ts_month = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=0;
+ offset = 0;
ptr_struct->ts_year = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=48;
+ offset = 48;
ptr_struct->ts_seconds = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=40;
+ offset = 40;
ptr_struct->ts_minutes = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=32;
+ offset = 32;
ptr_struct->ts_hour = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_ts_entry_print(const struct tools_open_ts_entry *ptr_struct, FILE* file, int indent_level){
+void tools_open_ts_entry_print(const struct tools_open_ts_entry *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_ts_entry ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_ts_entry_size(void){
+int tools_open_ts_entry_size(void)
+{
return 8;
}
-void tools_open_ts_entry_dump(const struct tools_open_ts_entry *ptr_struct, FILE* file) {
+void tools_open_ts_entry_dump(const struct tools_open_ts_entry *ptr_struct, FILE* file)
+{
tools_open_ts_entry_print(ptr_struct, file, 0);
}
-void tools_open_fw_version_pack(const struct tools_open_fw_version *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_fw_version_pack(const struct tools_open_fw_version *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->fw_ver_major);
- offset=48;
+ offset = 48;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->fw_ver_subminor);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->fw_ver_minor);
}
-void tools_open_fw_version_unpack(struct tools_open_fw_version *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_fw_version_unpack(struct tools_open_fw_version *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->fw_ver_major = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=48;
+ offset = 48;
ptr_struct->fw_ver_subminor = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=32;
+ offset = 32;
ptr_struct->fw_ver_minor = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}
-void tools_open_fw_version_print(const struct tools_open_fw_version *ptr_struct, FILE* file, int indent_level){
+void tools_open_fw_version_print(const struct tools_open_fw_version *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_fw_version ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_fw_version_size(void){
+int tools_open_fw_version_size(void)
+{
return 8;
}
-void tools_open_fw_version_dump(const struct tools_open_fw_version *ptr_struct, FILE* file) {
- tools_open_fw_version_print(ptr_struct, file, 0);
-}
-
-void tools_open_tlv_type_pack(const union tools_open_tlv_type *ptr_struct, u_int8_t* ptr_buff)
+void tools_open_fw_version_dump(const struct tools_open_fw_version *ptr_struct, FILE* file)
{
- tools_open_tlv_type_dw_pack(&(ptr_struct->tlv_type_dw), ptr_buff);
+ tools_open_fw_version_print(ptr_struct, file, 0);
}
-void tools_open_tlv_type_unpack(union tools_open_tlv_type *ptr_struct, const u_int8_t* ptr_buff)
+void tools_open_pmdio_addr_data_pack(const struct tools_open_pmdio_addr_data *ptr_struct, u_int8_t* ptr_buff)
{
- tools_open_tlv_type_dw_unpack(&(ptr_struct->tlv_type_dw), ptr_buff);
-}
-
-void tools_open_tlv_type_print(const union tools_open_tlv_type *ptr_struct, FILE* file, int indent_level){
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_tlv_type ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
- (void)file;
- (void)indent_level;
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "global:\n");
- tools_open_global_type_print(&(ptr_struct->global), file, indent_level + 1);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "eswitch:\n");
- tools_open_eswitch_type_print(&(ptr_struct->eswitch), file, indent_level + 1);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "per_host:\n");
- tools_open_per_host_type_print(&(ptr_struct->per_host), file, indent_level + 1);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "bmc:\n");
- tools_open_bmc_type_print(&(ptr_struct->bmc), file, indent_level + 1);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "per_port:\n");
- tools_open_per_port_type_print(&(ptr_struct->per_port), file, indent_level + 1);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "tlv_type_dw:\n");
- tools_open_tlv_type_dw_print(&(ptr_struct->tlv_type_dw), file, indent_level + 1);
-
-}
-
-int tools_open_tlv_type_size(void){
- return 4;
-}
-
-void tools_open_tlv_type_dump(const union tools_open_tlv_type *ptr_struct, FILE* file) {
- tools_open_tlv_type_print(ptr_struct, file, 0);
-}
-
-void tools_open_pmdio_addr_data_pack(const struct tools_open_pmdio_addr_data *ptr_struct, u_int8_t* ptr_buff){
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->data);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->addr);
}
-void tools_open_pmdio_addr_data_unpack(struct tools_open_pmdio_addr_data *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_pmdio_addr_data_unpack(struct tools_open_pmdio_addr_data *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
ptr_struct->data = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=0;
+ offset = 0;
ptr_struct->addr = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}
-void tools_open_pmdio_addr_data_print(const struct tools_open_pmdio_addr_data *ptr_struct, FILE* file, int indent_level){
+void tools_open_pmdio_addr_data_print(const struct tools_open_pmdio_addr_data *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_pmdio_addr_data ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_pmdio_addr_data_size(void){
+int tools_open_pmdio_addr_data_size(void)
+{
return 4;
}
-void tools_open_pmdio_addr_data_dump(const struct tools_open_pmdio_addr_data *ptr_struct, FILE* file) {
+void tools_open_pmdio_addr_data_dump(const struct tools_open_pmdio_addr_data *ptr_struct, FILE* file)
+{
tools_open_pmdio_addr_data_print(ptr_struct, file, 0);
}
-void tools_open_timestamp_pack(const struct tools_open_timestamp *ptr_struct, u_int8_t* ptr_buff){
- u_int32_t offset;
- int i=0;
- (void)offset;
- (void)i;
- (void)ptr_struct;
- (void)ptr_buff;
-
- offset=0;
- tools_open_fw_version_pack(&(ptr_struct->fw_version), ptr_buff + offset/8);
-
- offset=64;
- tools_open_ts_entry_pack(&(ptr_struct->ts_entry), ptr_buff + offset/8);
-
-}
-
-void tools_open_timestamp_unpack(struct tools_open_timestamp *ptr_struct, const u_int8_t* ptr_buff){
- u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
- (void)offset;
- (void)i;
- (void)ptr_struct;
- (void)ptr_buff;
-
- offset=0;
- tools_open_fw_version_unpack(&(ptr_struct->fw_version), ptr_buff + offset/8);
-
- offset=64;
- tools_open_ts_entry_unpack(&(ptr_struct->ts_entry), ptr_buff + offset/8);
-
-}
-
-void tools_open_timestamp_print(const struct tools_open_timestamp *ptr_struct, FILE* file, int indent_level){
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_timestamp ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
- (void)file;
- (void)indent_level;
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "fw_version:\n");
- tools_open_fw_version_print(&(ptr_struct->fw_version), file, indent_level + 1);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "ts_entry:\n");
- tools_open_ts_entry_print(&(ptr_struct->ts_entry), file, indent_level + 1);
-
-}
-
-int tools_open_timestamp_size(void){
- return 16;
-}
-
-void tools_open_timestamp_dump(const struct tools_open_timestamp *ptr_struct, FILE* file) {
- tools_open_timestamp_print(ptr_struct, file, 0);
-}
-
-void tools_open_nv_hdr_fifth_gen_pack(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_nv_hdr_fifth_gen_pack(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->length);
- offset=20;
+ offset = 20;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->shadow);
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->version);
- offset=9;
+ offset = 9;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_supported);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_);
- offset=7;
+ offset = 7;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->rd_en);
- offset=6;
+ offset = 6;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->over_en);
- offset=32;
+ offset = 32;
tools_open_tlv_type_pack(&(ptr_struct->type), ptr_buff + offset/8);
}
-void tools_open_nv_hdr_fifth_gen_unpack(struct tools_open_nv_hdr_fifth_gen *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_nv_hdr_fifth_gen_unpack(struct tools_open_nv_hdr_fifth_gen *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->length = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=20;
+ offset = 20;
ptr_struct->shadow = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=16;
+ offset = 16;
ptr_struct->version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=9;
+ offset = 9;
ptr_struct->default_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=8;
+ offset = 8;
ptr_struct->default_ = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=7;
+ offset = 7;
ptr_struct->rd_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=6;
+ offset = 6;
ptr_struct->over_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=32;
+ offset = 32;
tools_open_tlv_type_unpack(&(ptr_struct->type), ptr_buff + offset/8);
}
-void tools_open_nv_hdr_fifth_gen_print(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, FILE* file, int indent_level){
+void tools_open_nv_hdr_fifth_gen_print(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nv_hdr_fifth_gen ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_nv_hdr_fifth_gen_size(void){
+int tools_open_nv_hdr_fifth_gen_size(void)
+{
return 12;
}
-void tools_open_nv_hdr_fifth_gen_dump(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, FILE* file) {
+void tools_open_nv_hdr_fifth_gen_dump(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, FILE* file)
+{
tools_open_nv_hdr_fifth_gen_print(ptr_struct, file, 0);
}
-void tools_open_nv_hdr_pack(const struct tools_open_nv_hdr *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_timestamp_pack(const struct tools_open_timestamp *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
- adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->type);
-
- offset=2;
- adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->length);
-
- offset=40;
- adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->type_mod);
-
- offset=39;
- adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->shadow);
-
- offset=37;
- adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->pad_cnt);
+ offset = 0;
+ tools_open_fw_version_pack(&(ptr_struct->fw_version), ptr_buff + offset/8);
- offset=32;
- adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->version);
+ offset = 64;
+ tools_open_ts_entry_pack(&(ptr_struct->ts_entry), ptr_buff + offset/8);
}
-void tools_open_nv_hdr_unpack(struct tools_open_nv_hdr *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_timestamp_unpack(struct tools_open_timestamp *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
- ptr_struct->type = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
-
- offset=2;
- ptr_struct->length = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
-
- offset=40;
- ptr_struct->type_mod = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
-
- offset=39;
- ptr_struct->shadow = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
-
- offset=37;
- ptr_struct->pad_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+ offset = 0;
+ tools_open_fw_version_unpack(&(ptr_struct->fw_version), ptr_buff + offset/8);
- offset=32;
- ptr_struct->version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+ offset = 64;
+ tools_open_ts_entry_unpack(&(ptr_struct->ts_entry), ptr_buff + offset/8);
}
-void tools_open_nv_hdr_print(const struct tools_open_nv_hdr *ptr_struct, FILE* file, int indent_level){
+void tools_open_timestamp_print(const struct tools_open_timestamp *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_nv_hdr ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ fprintf(file, "======== tools_open_timestamp ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
- fprintf(file, "type : "UH_FMT"\n", ptr_struct->type);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "length : "UH_FMT"\n", ptr_struct->length);
+ fprintf(file, "fw_version:\n");
+ tools_open_fw_version_print(&(ptr_struct->fw_version), file, indent_level + 1);
adb2c_add_indentation(file, indent_level);
- fprintf(file, "type_mod : "UH_FMT"\n", ptr_struct->type_mod);
+ fprintf(file, "ts_entry:\n");
+ tools_open_ts_entry_print(&(ptr_struct->ts_entry), file, indent_level + 1);
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "shadow : "UH_FMT"\n", ptr_struct->shadow);
+}
- adb2c_add_indentation(file, indent_level);
+int tools_open_timestamp_size(void)
+{
+ return 16;
+}
+
+void tools_open_timestamp_dump(const struct tools_open_timestamp *ptr_struct, FILE* file)
+{
+ tools_open_timestamp_print(ptr_struct, file, 0);
+}
+
+void tools_open_nv_hdr_pack(const struct tools_open_nv_hdr *ptr_struct, u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 16;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->type);
+
+ offset = 2;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->length);
+
+ offset = 40;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->type_mod);
+
+ offset = 39;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->shadow);
+
+ offset = 37;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->pad_cnt);
+
+ offset = 32;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->version);
+
+}
+
+void tools_open_nv_hdr_unpack(struct tools_open_nv_hdr *ptr_struct, const u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 16;
+ ptr_struct->type = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
+
+ offset = 2;
+ ptr_struct->length = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
+
+ offset = 40;
+ ptr_struct->type_mod = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+
+ offset = 39;
+ ptr_struct->shadow = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+ offset = 37;
+ ptr_struct->pad_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+ offset = 32;
+ ptr_struct->version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+}
+
+void tools_open_nv_hdr_print(const struct tools_open_nv_hdr *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_nv_hdr ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "type : "UH_FMT"\n", ptr_struct->type);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "length : "UH_FMT"\n", ptr_struct->length);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "type_mod : "UH_FMT"\n", ptr_struct->type_mod);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "shadow : "UH_FMT"\n", ptr_struct->shadow);
+
+ adb2c_add_indentation(file, indent_level);
fprintf(file, "pad_cnt : "UH_FMT"\n", ptr_struct->pad_cnt);
adb2c_add_indentation(file, indent_level);
}
-int tools_open_nv_hdr_size(void){
+int tools_open_nv_hdr_size(void)
+{
return 8;
}
-void tools_open_nv_hdr_dump(const struct tools_open_nv_hdr *ptr_struct, FILE* file) {
+void tools_open_nv_hdr_dump(const struct tools_open_nv_hdr *ptr_struct, FILE* file)
+{
tools_open_nv_hdr_print(ptr_struct, file, 0);
}
-void tools_open_aux_tlv_header_pack(const struct tools_open_aux_tlv_header *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_aux_tlv_header_pack(const struct tools_open_aux_tlv_header *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major_version);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->type);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->header_type);
- offset=32;
+ offset = 32;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->length);
- offset=80;
+ offset = 80;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->crc);
- offset=96;
+ offset = 96;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->reserved0);
- offset=128;
+ offset = 128;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->reserved1);
}
-void tools_open_aux_tlv_header_unpack(struct tools_open_aux_tlv_header *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_aux_tlv_header_unpack(struct tools_open_aux_tlv_header *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=16;
+ offset = 16;
ptr_struct->major_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=8;
+ offset = 8;
ptr_struct->type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=0;
+ offset = 0;
ptr_struct->header_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=32;
+ offset = 32;
ptr_struct->length = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=80;
+ offset = 80;
ptr_struct->crc = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=96;
+ offset = 96;
ptr_struct->reserved0 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=128;
+ offset = 128;
ptr_struct->reserved1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void tools_open_aux_tlv_header_print(const struct tools_open_aux_tlv_header *ptr_struct, FILE* file, int indent_level){
+void tools_open_aux_tlv_header_print(const struct tools_open_aux_tlv_header *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_aux_tlv_header ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_aux_tlv_header_size(void){
+int tools_open_aux_tlv_header_size(void)
+{
return 20;
}
-void tools_open_aux_tlv_header_dump(const struct tools_open_aux_tlv_header *ptr_struct, FILE* file) {
+void tools_open_aux_tlv_header_dump(const struct tools_open_aux_tlv_header *ptr_struct, FILE* file)
+{
tools_open_aux_tlv_header_print(ptr_struct, file, 0);
}
-void tools_open_pmdio_pack(const struct tools_open_pmdio *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_pmdio_pack(const struct tools_open_pmdio *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=29;
+ offset = 29;
adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->operation);
- offset=22;
+ offset = 22;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->clause);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->local_port);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->lock);
- offset=59;
+ offset = 59;
adb2c_push_bits_to_buff(ptr_buff, offset, 5, (u_int32_t)ptr_struct->reg_adr_mmd);
- offset=48;
+ offset = 48;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->last_op_idx);
- offset=40;
+ offset = 40;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_ops_done);
- for (i=0; i < 64; i++) {
- offset=adb2c_calc_array_field_address(64, 32, i, 2112, 1);
+ for (i = 0; i < 64; i++) {
+ offset = adb2c_calc_array_field_address(64, 32, i, 2112, 1);
tools_open_pmdio_addr_data_pack(&(ptr_struct->mdio_trans[i]), ptr_buff + offset/8);
}
}
-void tools_open_pmdio_unpack(struct tools_open_pmdio *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_pmdio_unpack(struct tools_open_pmdio *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=29;
+ offset = 29;
ptr_struct->operation = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
- offset=22;
+ offset = 22;
ptr_struct->clause = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=8;
+ offset = 8;
ptr_struct->local_port = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=0;
+ offset = 0;
ptr_struct->lock = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=59;
+ offset = 59;
ptr_struct->reg_adr_mmd = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 5);
- offset=48;
+ offset = 48;
ptr_struct->last_op_idx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=40;
+ offset = 40;
ptr_struct->num_ops_done = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- for (i=0; i < 64; i++) {
- offset=adb2c_calc_array_field_address(64, 32, i, 2112, 1);
+ for (i = 0; i < 64; i++) {
+ offset = adb2c_calc_array_field_address(64, 32, i, 2112, 1);
tools_open_pmdio_addr_data_unpack(&(ptr_struct->mdio_trans[i]), ptr_buff + offset/8);
}
}
-void tools_open_pmdio_print(const struct tools_open_pmdio *ptr_struct, FILE* file, int indent_level){
+void tools_open_pmdio_print(const struct tools_open_pmdio *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_pmdio ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
fprintf(file, "num_ops_done : "UH_FMT"\n", ptr_struct->num_ops_done);
- for (i=0; i < 64; i++) {
+ for (i = 0; i < 64; i++) {
adb2c_add_indentation(file, indent_level);
fprintf(file, "mdio_trans_%03d:\n", i);
tools_open_pmdio_addr_data_print(&(ptr_struct->mdio_trans[i]), file, indent_level + 1);
}
-int tools_open_pmdio_size(void){
+int tools_open_pmdio_size(void)
+{
return 264;
}
-void tools_open_pmdio_dump(const struct tools_open_pmdio *ptr_struct, FILE* file) {
+void tools_open_pmdio_dump(const struct tools_open_pmdio *ptr_struct, FILE* file)
+{
tools_open_pmdio_print(ptr_struct, file, 0);
}
-void tools_open_pmdic_pack(const struct tools_open_pmdic *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_pmdic_pack(const struct tools_open_pmdic *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->local_port);
- offset=56;
+ offset = 56;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->operation_cap);
- offset=38;
+ offset = 38;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->clause);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->mdio_preset);
- offset=88;
+ offset = 88;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->misc_cap);
}
-void tools_open_pmdic_unpack(struct tools_open_pmdic *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_pmdic_unpack(struct tools_open_pmdic *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=8;
+ offset = 8;
ptr_struct->local_port = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=56;
+ offset = 56;
ptr_struct->operation_cap = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=38;
+ offset = 38;
ptr_struct->clause = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=32;
+ offset = 32;
ptr_struct->mdio_preset = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=88;
+ offset = 88;
ptr_struct->misc_cap = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_pmdic_print(const struct tools_open_pmdic *ptr_struct, FILE* file, int indent_level){
+void tools_open_pmdic_print(const struct tools_open_pmdic *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_pmdic ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_pmdic_size(void){
+int tools_open_pmdic_size(void)
+{
return 12;
}
-void tools_open_pmdic_dump(const struct tools_open_pmdic *ptr_struct, FILE* file) {
+void tools_open_pmdic_dump(const struct tools_open_pmdic *ptr_struct, FILE* file)
+{
tools_open_pmdic_print(ptr_struct, file, 0);
}
-void tools_open_mvts_pack(const struct tools_open_mvts *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_mnvgn_pack(const struct tools_open_mnvgn *ptr_struct, u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 0;
+ adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->nv_pointer);
+
+ offset = 128;
+ tools_open_nv_hdr_fifth_gen_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
+
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(248, 8, i, 1248, 1);
+ adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->nv_data[i]);
+ }
+
+}
+
+void tools_open_mnvgn_unpack(struct tools_open_mnvgn *ptr_struct, const u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 0;
+ ptr_struct->nv_pointer = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
+
+ offset = 128;
+ tools_open_nv_hdr_fifth_gen_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
+
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(248, 8, i, 1248, 1);
+ ptr_struct->nv_data[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
+ }
+
+}
+
+void tools_open_mnvgn_print(const struct tools_open_mnvgn *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_mnvgn ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "nv_pointer : "U32H_FMT"\n", ptr_struct->nv_pointer);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "nv_hdr:\n");
+ tools_open_nv_hdr_fifth_gen_print(&(ptr_struct->nv_hdr), file, indent_level + 1);
+
+ for (i = 0; i < 128; i++) {
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "nv_data_%03d : "UH_FMT"\n", i, ptr_struct->nv_data[i]);
+ }
+
+}
+
+int tools_open_mnvgn_size(void)
+{
+ return 156;
+}
+
+void tools_open_mnvgn_dump(const struct tools_open_mnvgn *ptr_struct, FILE* file)
+{
+ tools_open_mnvgn_print(ptr_struct, file, 0);
+}
+
+void tools_open_mvts_pack(const struct tools_open_mvts *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->check_timestamp_flag);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->running_flag);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->clear_all_ts_flag);
- offset=32;
+ offset = 32;
tools_open_timestamp_pack(&(ptr_struct->timestamp), ptr_buff + offset/8);
}
-void tools_open_mvts_unpack(struct tools_open_mvts *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_mvts_unpack(struct tools_open_mvts *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=2;
+ offset = 2;
ptr_struct->check_timestamp_flag = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=1;
+ offset = 1;
ptr_struct->running_flag = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->clear_all_ts_flag = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=32;
+ offset = 32;
tools_open_timestamp_unpack(&(ptr_struct->timestamp), ptr_buff + offset/8);
}
-void tools_open_mvts_print(const struct tools_open_mvts *ptr_struct, FILE* file, int indent_level){
+void tools_open_mvts_print(const struct tools_open_mvts *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_mvts ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_mvts_size(void){
+int tools_open_mvts_size(void)
+{
return 20;
}
-void tools_open_mvts_dump(const struct tools_open_mvts *ptr_struct, FILE* file) {
+void tools_open_mvts_dump(const struct tools_open_mvts *ptr_struct, FILE* file)
+{
tools_open_mvts_print(ptr_struct, file, 0);
}
-void tools_open_nvqgc_pack(const struct tools_open_nvqgc *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_nvqgc_pack(const struct tools_open_nvqgc *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=31;
+ offset = 31;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->read_factory_settings_support);
}
-void tools_open_nvqgc_unpack(struct tools_open_nvqgc *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_nvqgc_unpack(struct tools_open_nvqgc *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=31;
+ offset = 31;
ptr_struct->read_factory_settings_support = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_nvqgc_print(const struct tools_open_nvqgc *ptr_struct, FILE* file, int indent_level){
+void tools_open_nvqgc_print(const struct tools_open_nvqgc *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nvqgc ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_nvqgc_size(void){
+int tools_open_nvqgc_size(void)
+{
return 16;
}
-void tools_open_nvqgc_dump(const struct tools_open_nvqgc *ptr_struct, FILE* file) {
+void tools_open_nvqgc_dump(const struct tools_open_nvqgc *ptr_struct, FILE* file)
+{
tools_open_nvqgc_print(ptr_struct, file, 0);
}
-void tools_open_nvdi_pack(const struct tools_open_nvdi *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_nvdi_pack(const struct tools_open_nvdi *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_fifth_gen_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
}
-void tools_open_nvdi_unpack(struct tools_open_nvdi *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_nvdi_unpack(struct tools_open_nvdi *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_fifth_gen_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
}
-void tools_open_nvdi_print(const struct tools_open_nvdi *ptr_struct, FILE* file, int indent_level){
+void tools_open_nvdi_print(const struct tools_open_nvdi *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nvdi ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_nvdi_size(void){
+int tools_open_nvdi_size(void)
+{
return 12;
}
-void tools_open_nvdi_dump(const struct tools_open_nvdi *ptr_struct, FILE* file) {
+void tools_open_nvdi_dump(const struct tools_open_nvdi *ptr_struct, FILE* file)
+{
tools_open_nvdi_print(ptr_struct, file, 0);
}
-void tools_open_nvda_pack(const struct tools_open_nvda *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_nvda_pack(const struct tools_open_nvda *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_fifth_gen_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
- for (i=0; i < 128; i++) {
- offset=adb2c_calc_array_field_address(120, 8, i, 2048, 1);
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(120, 8, i, 2048, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->data[i]);
}
}
-void tools_open_nvda_unpack(struct tools_open_nvda *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_nvda_unpack(struct tools_open_nvda *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_fifth_gen_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
- for (i=0; i < 128; i++) {
- offset=adb2c_calc_array_field_address(120, 8, i, 2048, 1);
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(120, 8, i, 2048, 1);
ptr_struct->data[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
}
-void tools_open_nvda_print(const struct tools_open_nvda *ptr_struct, FILE* file, int indent_level){
+void tools_open_nvda_print(const struct tools_open_nvda *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nvda ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "nv_hdr:\n");
tools_open_nv_hdr_fifth_gen_print(&(ptr_struct->nv_hdr), file, indent_level + 1);
- for (i=0; i < 128; i++) {
+ for (i = 0; i < 128; i++) {
adb2c_add_indentation(file, indent_level);
fprintf(file, "data_%03d : "UH_FMT"\n", i, ptr_struct->data[i]);
}
}
-int tools_open_nvda_size(void){
+int tools_open_nvda_size(void)
+{
return 256;
}
-void tools_open_nvda_dump(const struct tools_open_nvda *ptr_struct, FILE* file) {
+void tools_open_nvda_dump(const struct tools_open_nvda *ptr_struct, FILE* file)
+{
tools_open_nvda_print(ptr_struct, file, 0);
}
-void tools_open_nvia_pack(const struct tools_open_nvia *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_nvia_pack(const struct tools_open_nvia *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_fifth_gen_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
- offset=125;
+ offset = 125;
adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->target);
}
-void tools_open_nvia_unpack(struct tools_open_nvia *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_nvia_unpack(struct tools_open_nvia *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_fifth_gen_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
- offset=125;
+ offset = 125;
ptr_struct->target = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
}
-void tools_open_nvia_print(const struct tools_open_nvia *ptr_struct, FILE* file, int indent_level){
+void tools_open_nvia_print(const struct tools_open_nvia *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nvia ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_nvia_size(void){
+int tools_open_nvia_size(void)
+{
return 20;
}
-void tools_open_nvia_dump(const struct tools_open_nvia *ptr_struct, FILE* file) {
+void tools_open_nvia_dump(const struct tools_open_nvia *ptr_struct, FILE* file)
+{
tools_open_nvia_print(ptr_struct, file, 0);
}
-void tools_open_nvqc_pack(const struct tools_open_nvqc *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_nvqc_pack(const struct tools_open_nvqc *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_tlv_type_pack(&(ptr_struct->type), ptr_buff + offset/8);
- offset=63;
+ offset = 63;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->support_rd);
- offset=62;
+ offset = 62;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->support_wr);
- offset=56;
+ offset = 56;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->version);
}
-void tools_open_nvqc_unpack(struct tools_open_nvqc *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_nvqc_unpack(struct tools_open_nvqc *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_tlv_type_unpack(&(ptr_struct->type), ptr_buff + offset/8);
- offset=63;
+ offset = 63;
ptr_struct->support_rd = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=62;
+ offset = 62;
ptr_struct->support_wr = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=56;
+ offset = 56;
ptr_struct->version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
}
-void tools_open_nvqc_print(const struct tools_open_nvqc *ptr_struct, FILE* file, int indent_level){
+void tools_open_nvqc_print(const struct tools_open_nvqc *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nvqc ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_nvqc_size(void){
+int tools_open_nvqc_size(void)
+{
return 8;
}
-void tools_open_nvqc_dump(const struct tools_open_nvqc *ptr_struct, FILE* file) {
+void tools_open_nvqc_dump(const struct tools_open_nvqc *ptr_struct, FILE* file)
+{
tools_open_nvqc_print(ptr_struct, file, 0);
}
-void tools_open_mnvia_pack(const struct tools_open_mnvia *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_mnvia_pack(const struct tools_open_mnvia *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
}
-void tools_open_mnvia_unpack(struct tools_open_mnvia *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_mnvia_unpack(struct tools_open_mnvia *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
}
-void tools_open_mnvia_print(const struct tools_open_mnvia *ptr_struct, FILE* file, int indent_level){
+void tools_open_mnvia_print(const struct tools_open_mnvia *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_mnvia ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_mnvia_size(void){
+int tools_open_mnvia_size(void)
+{
return 8;
}
-void tools_open_mnvia_dump(const struct tools_open_mnvia *ptr_struct, FILE* file) {
+void tools_open_mnvia_dump(const struct tools_open_mnvia *ptr_struct, FILE* file)
+{
tools_open_mnvia_print(ptr_struct, file, 0);
}
-void tools_open_mnvi_pack(const struct tools_open_mnvi *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_mnvi_pack(const struct tools_open_mnvi *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
}
-void tools_open_mnvi_unpack(struct tools_open_mnvi *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_mnvi_unpack(struct tools_open_mnvi *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
}
-void tools_open_mnvi_print(const struct tools_open_mnvi *ptr_struct, FILE* file, int indent_level){
+void tools_open_mnvi_print(const struct tools_open_mnvi *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_mnvi ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_mnvi_size(void){
+int tools_open_mnvi_size(void)
+{
return 8;
}
-void tools_open_mnvi_dump(const struct tools_open_mnvi *ptr_struct, FILE* file) {
+void tools_open_mnvi_dump(const struct tools_open_mnvi *ptr_struct, FILE* file)
+{
tools_open_mnvi_print(ptr_struct, file, 0);
}
-void tools_open_mnva_pack(const struct tools_open_mnva *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_mnva_pack(const struct tools_open_mnva *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_pack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
- for (i=0; i < 128; i++) {
- offset=adb2c_calc_array_field_address(88, 8, i, 2048, 1);
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(88, 8, i, 2048, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->data[i]);
}
}
-void tools_open_mnva_unpack(struct tools_open_mnva *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_mnva_unpack(struct tools_open_mnva *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_nv_hdr_unpack(&(ptr_struct->nv_hdr), ptr_buff + offset/8);
- for (i=0; i < 128; i++) {
- offset=adb2c_calc_array_field_address(88, 8, i, 2048, 1);
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(88, 8, i, 2048, 1);
ptr_struct->data[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
}
-void tools_open_mnva_print(const struct tools_open_mnva *ptr_struct, FILE* file, int indent_level){
+void tools_open_mnva_print(const struct tools_open_mnva *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_mnva ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "nv_hdr:\n");
tools_open_nv_hdr_print(&(ptr_struct->nv_hdr), file, indent_level + 1);
- for (i=0; i < 128; i++) {
+ for (i = 0; i < 128; i++) {
adb2c_add_indentation(file, indent_level);
fprintf(file, "data_%03d : "UH_FMT"\n", i, ptr_struct->data[i]);
}
}
-int tools_open_mnva_size(void){
+int tools_open_mnva_size(void)
+{
return 256;
}
-void tools_open_mnva_dump(const struct tools_open_mnva *ptr_struct, FILE* file) {
+void tools_open_mnva_dump(const struct tools_open_mnva *ptr_struct, FILE* file)
+{
tools_open_mnva_print(ptr_struct, file, 0);
}
-void tools_open_mfg_info_pack(const struct tools_open_mfg_info *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_mfg_info_pack(const struct tools_open_mfg_info *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(24, 8, i, 2560, 1);
+ for (i = 0; i < 16; i++) {
+ offset = adb2c_calc_array_field_address(24, 8, i, 2560, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->psid[i]);
}
- offset=232;
+ offset = 232;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
- offset=224;
+ offset = 224;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major_version);
- for (i=0; i < 96; i++) {
- offset=adb2c_calc_array_field_address(792, 8, i, 2560, 1);
+ for (i = 0; i < 96; i++) {
+ offset = adb2c_calc_array_field_address(792, 8, i, 2560, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->orig_prs_name[i]);
}
}
-void tools_open_mfg_info_unpack(struct tools_open_mfg_info *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_mfg_info_unpack(struct tools_open_mfg_info *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(24, 8, i, 2560, 1);
+ for (i = 0; i < 16; i++) {
+ offset = adb2c_calc_array_field_address(24, 8, i, 2560, 1);
ptr_struct->psid[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
ptr_struct->psid[16] = '\0';
- offset=232;
+ offset = 232;
ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=224;
+ offset = 224;
ptr_struct->major_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- for (i=0; i < 96; i++) {
- offset=adb2c_calc_array_field_address(792, 8, i, 2560, 1);
+ for (i = 0; i < 96; i++) {
+ offset = adb2c_calc_array_field_address(792, 8, i, 2560, 1);
ptr_struct->orig_prs_name[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
ptr_struct->orig_prs_name[96] = '\0';
}
-void tools_open_mfg_info_print(const struct tools_open_mfg_info *ptr_struct, FILE* file, int indent_level){
+void tools_open_mfg_info_print(const struct tools_open_mfg_info *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_mfg_info ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "orig_prs_name : \"%s\"\n", ptr_struct->orig_prs_name);
}
-int tools_open_mfg_info_size(void){
+int tools_open_mfg_info_size(void)
+{
return 320;
}
-void tools_open_mfg_info_dump(const struct tools_open_mfg_info *ptr_struct, FILE* file) {
+void tools_open_mfg_info_dump(const struct tools_open_mfg_info *ptr_struct, FILE* file)
+{
tools_open_mfg_info_print(ptr_struct, file, 0);
}
-void tools_open_image_info_pack(const struct tools_open_image_info *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_image_info_pack(const struct tools_open_image_info *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->minor_version);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->major_version);
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(312, 8, i, 8192, 1);
+ for (i = 0; i < 16; i++) {
+ offset = adb2c_calc_array_field_address(312, 8, i, 8192, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->psid[i]);
}
- for (i=0; i < 256; i++) {
- offset=adb2c_calc_array_field_address(3736, 8, i, 8192, 1);
+ for (i = 0; i < 256; i++) {
+ offset = adb2c_calc_array_field_address(3736, 8, i, 8192, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->description[i]);
}
- for (i=0; i < 64; i++) {
- offset=adb2c_calc_array_field_address(6680, 8, i, 8192, 1);
+ for (i = 0; i < 64; i++) {
+ offset = adb2c_calc_array_field_address(6680, 8, i, 8192, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->name[i]);
}
- for (i=0; i < 96; i++) {
- offset=adb2c_calc_array_field_address(7192, 8, i, 8192, 1);
+ for (i = 0; i < 96; i++) {
+ offset = adb2c_calc_array_field_address(7192, 8, i, 8192, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->prs_name[i]);
}
}
-void tools_open_image_info_unpack(struct tools_open_image_info *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_image_info_unpack(struct tools_open_image_info *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=8;
+ offset = 8;
ptr_struct->minor_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=0;
+ offset = 0;
ptr_struct->major_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(312, 8, i, 8192, 1);
+ for (i = 0; i < 16; i++) {
+ offset = adb2c_calc_array_field_address(312, 8, i, 8192, 1);
ptr_struct->psid[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
ptr_struct->psid[16] = '\0';
- for (i=0; i < 256; i++) {
- offset=adb2c_calc_array_field_address(3736, 8, i, 8192, 1);
+ for (i = 0; i < 256; i++) {
+ offset = adb2c_calc_array_field_address(3736, 8, i, 8192, 1);
ptr_struct->description[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
ptr_struct->description[256] = '\0';
- for (i=0; i < 64; i++) {
- offset=adb2c_calc_array_field_address(6680, 8, i, 8192, 1);
+ for (i = 0; i < 64; i++) {
+ offset = adb2c_calc_array_field_address(6680, 8, i, 8192, 1);
ptr_struct->name[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
ptr_struct->name[64] = '\0';
- for (i=0; i < 96; i++) {
- offset=adb2c_calc_array_field_address(7192, 8, i, 8192, 1);
+ for (i = 0; i < 96; i++) {
+ offset = adb2c_calc_array_field_address(7192, 8, i, 8192, 1);
ptr_struct->prs_name[i] = (char)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
ptr_struct->prs_name[96] = '\0';
}
-void tools_open_image_info_print(const struct tools_open_image_info *ptr_struct, FILE* file, int indent_level){
+void tools_open_image_info_print(const struct tools_open_image_info *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_image_info ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "prs_name : \"%s\"\n", ptr_struct->prs_name);
}
-int tools_open_image_info_size(void){
+int tools_open_image_info_size(void)
+{
return 1024;
}
-void tools_open_image_info_dump(const struct tools_open_image_info *ptr_struct, FILE* file) {
+void tools_open_image_info_dump(const struct tools_open_image_info *ptr_struct, FILE* file)
+{
tools_open_image_info_print(ptr_struct, file, 0);
}
-void tools_open_aux_tlv_pack(const struct tools_open_aux_tlv *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_aux_tlv_pack(const struct tools_open_aux_tlv *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_aux_tlv_header_pack(&(ptr_struct->aux_tlv_header), ptr_buff + offset/8);
- for (i=0; i < 128; i++) {
- offset=adb2c_calc_array_field_address(184, 8, i, 2048, 1);
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(184, 8, i, 2048, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->data[i]);
}
}
-void tools_open_aux_tlv_unpack(struct tools_open_aux_tlv *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_aux_tlv_unpack(struct tools_open_aux_tlv *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
tools_open_aux_tlv_header_unpack(&(ptr_struct->aux_tlv_header), ptr_buff + offset/8);
- for (i=0; i < 128; i++) {
- offset=adb2c_calc_array_field_address(184, 8, i, 2048, 1);
+ for (i = 0; i < 128; i++) {
+ offset = adb2c_calc_array_field_address(184, 8, i, 2048, 1);
ptr_struct->data[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
}
-void tools_open_aux_tlv_print(const struct tools_open_aux_tlv *ptr_struct, FILE* file, int indent_level){
+void tools_open_aux_tlv_print(const struct tools_open_aux_tlv *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_aux_tlv ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "aux_tlv_header:\n");
tools_open_aux_tlv_header_print(&(ptr_struct->aux_tlv_header), file, indent_level + 1);
- for (i=0; i < 128; i++) {
+ for (i = 0; i < 128; i++) {
adb2c_add_indentation(file, indent_level);
fprintf(file, "data_%03d : "UH_FMT"\n", i, ptr_struct->data[i]);
}
}
-int tools_open_aux_tlv_size(void){
+int tools_open_aux_tlv_size(void)
+{
return 256;
}
-void tools_open_aux_tlv_dump(const struct tools_open_aux_tlv *ptr_struct, FILE* file) {
+void tools_open_aux_tlv_dump(const struct tools_open_aux_tlv *ptr_struct, FILE* file)
+{
tools_open_aux_tlv_print(ptr_struct, file, 0);
}
-void tools_open_aux_data_hdr_pack(const struct tools_open_aux_data_hdr *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_aux_data_hdr_pack(const struct tools_open_aux_data_hdr *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->signature0);
- offset=32;
+ offset = 32;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->signature1);
- offset=64;
+ offset = 64;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->signature2);
- offset=96;
+ offset = 96;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->signature3);
}
-void tools_open_aux_data_hdr_unpack(struct tools_open_aux_data_hdr *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_aux_data_hdr_unpack(struct tools_open_aux_data_hdr *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->signature0 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=32;
+ offset = 32;
ptr_struct->signature1 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=64;
+ offset = 64;
ptr_struct->signature2 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=96;
+ offset = 96;
ptr_struct->signature3 = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void tools_open_aux_data_hdr_print(const struct tools_open_aux_data_hdr *ptr_struct, FILE* file, int indent_level){
+void tools_open_aux_data_hdr_print(const struct tools_open_aux_data_hdr *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_aux_data_hdr ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_aux_data_hdr_size(void){
+int tools_open_aux_data_hdr_size(void)
+{
return 16;
}
-void tools_open_aux_data_hdr_dump(const struct tools_open_aux_data_hdr *ptr_struct, FILE* file) {
+void tools_open_aux_data_hdr_dump(const struct tools_open_aux_data_hdr *ptr_struct, FILE* file)
+{
tools_open_aux_data_hdr_print(ptr_struct, file, 0);
}
-void tools_open_query_def_params_per_port_pack(const struct tools_open_query_def_params_per_port *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_query_def_params_per_port_pack(const struct tools_open_query_def_params_per_port *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=13;
+ offset = 13;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_vpi);
- offset=12;
+ offset = 12;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_wol);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->fw_default_config_payload_version);
- offset=52;
+ offset = 52;
adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->default_boot_vlan);
- offset=44;
+ offset = 44;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->default_boot_protocol);
- offset=40;
+ offset = 40;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->default_boot_retry_cnt);
- offset=37;
+ offset = 37;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->default_network_link_type);
- offset=36;
+ offset = 36;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_en_wol_magic);
- offset=35;
+ offset = 35;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_boot_vlan_en);
- offset=34;
+ offset = 34;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_boot_option_rom_en);
- offset=33;
+ offset = 33;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_pprx);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->default_pptx);
- offset=80;
+ offset = 80;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->default_boot_pkey);
- offset=70;
+ offset = 70;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->boot_ip_ver);
- offset=68;
+ offset = 68;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_infiniband_dhcp_settings);
- offset=67;
+ offset = 67;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_infiniband_boot_settings);
- offset=66;
+ offset = 66;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_dhcp_iscsi_parameters);
- offset=65;
+ offset = 65;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_iscsi_parameters);
- offset=64;
+ offset = 64;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->nv_config_boot_parameters);
- offset=108;
+ offset = 108;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->client_indentifier);
- offset=106;
+ offset = 106;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->mac_admin_bit);
- offset=104;
+ offset = 104;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->iscsi_boot_to_target);
- offset=101;
+ offset = 101;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_vlan_en);
- offset=100;
+ offset = 100;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_tcp_timestamps_en);
- offset=99;
+ offset = 99;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_chap_mutual_auth_en);
- offset=98;
+ offset = 98;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_chap_auth_en);
- offset=97;
+ offset = 97;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_dhcp_params_en);
- offset=96;
+ offset = 96;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->iscsi_ipv4_dhcp_en);
- offset=152;
+ offset = 152;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->iscsi_lun_busy_retry_cnt);
- offset=144;
+ offset = 144;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->iscsi_link_up_delay_time);
}
-void tools_open_query_def_params_per_port_unpack(struct tools_open_query_def_params_per_port *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_query_def_params_per_port_unpack(struct tools_open_query_def_params_per_port *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=13;
+ offset = 13;
ptr_struct->nv_config_vpi = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=12;
+ offset = 12;
ptr_struct->nv_config_wol = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->fw_default_config_payload_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=52;
+ offset = 52;
ptr_struct->default_boot_vlan = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
- offset=44;
+ offset = 44;
ptr_struct->default_boot_protocol = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=40;
+ offset = 40;
ptr_struct->default_boot_retry_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=37;
+ offset = 37;
ptr_struct->default_network_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=36;
+ offset = 36;
ptr_struct->default_en_wol_magic = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=35;
+ offset = 35;
ptr_struct->default_boot_vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=34;
+ offset = 34;
ptr_struct->default_boot_option_rom_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=33;
+ offset = 33;
ptr_struct->default_pprx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=32;
+ offset = 32;
ptr_struct->default_pptx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=80;
+ offset = 80;
ptr_struct->default_boot_pkey = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=70;
+ offset = 70;
ptr_struct->boot_ip_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=68;
+ offset = 68;
ptr_struct->nv_config_infiniband_dhcp_settings = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=67;
+ offset = 67;
ptr_struct->nv_config_infiniband_boot_settings = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=66;
+ offset = 66;
ptr_struct->nv_config_dhcp_iscsi_parameters = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=65;
+ offset = 65;
ptr_struct->nv_config_iscsi_parameters = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=64;
+ offset = 64;
ptr_struct->nv_config_boot_parameters = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=108;
+ offset = 108;
ptr_struct->client_indentifier = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=106;
+ offset = 106;
ptr_struct->mac_admin_bit = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=104;
+ offset = 104;
ptr_struct->iscsi_boot_to_target = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=101;
+ offset = 101;
ptr_struct->iscsi_vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=100;
+ offset = 100;
ptr_struct->iscsi_tcp_timestamps_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=99;
+ offset = 99;
ptr_struct->iscsi_chap_mutual_auth_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=98;
+ offset = 98;
ptr_struct->iscsi_chap_auth_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=97;
+ offset = 97;
ptr_struct->iscsi_dhcp_params_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=96;
+ offset = 96;
ptr_struct->iscsi_ipv4_dhcp_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=152;
+ offset = 152;
ptr_struct->iscsi_lun_busy_retry_cnt = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=144;
+ offset = 144;
ptr_struct->iscsi_link_up_delay_time = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_query_def_params_per_port_print(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file, int indent_level){
+void tools_open_query_def_params_per_port_print(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_query_def_params_per_port ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_query_def_params_per_port_size(void){
+int tools_open_query_def_params_per_port_size(void)
+{
return 28;
}
-void tools_open_query_def_params_per_port_dump(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file) {
+void tools_open_query_def_params_per_port_dump(const struct tools_open_query_def_params_per_port *ptr_struct, FILE* file)
+{
tools_open_query_def_params_per_port_print(ptr_struct, file, 0);
}
-void tools_open_query_def_params_global_pack(const struct tools_open_query_def_params_global *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_query_def_params_global_pack(const struct tools_open_query_def_params_global *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->fw_default_config_payload_version);
- offset=56;
+ offset = 56;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->num_vfs);
- offset=52;
+ offset = 52;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->uar_bar_size);
- offset=48;
+ offset = 48;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->max_uar_bar_size);
- offset=42;
+ offset = 42;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_ip_ver);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
}
-void tools_open_query_def_params_global_unpack(struct tools_open_query_def_params_global *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_query_def_params_global_unpack(struct tools_open_query_def_params_global *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->fw_default_config_payload_version = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=56;
+ offset = 56;
ptr_struct->num_vfs = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=52;
+ offset = 52;
ptr_struct->uar_bar_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=48;
+ offset = 48;
ptr_struct->max_uar_bar_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=42;
+ offset = 42;
ptr_struct->boot_ip_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=32;
+ offset = 32;
ptr_struct->sriov_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_query_def_params_global_print(const struct tools_open_query_def_params_global *ptr_struct, FILE* file, int indent_level){
+void tools_open_query_def_params_global_print(const struct tools_open_query_def_params_global *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_query_def_params_global ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_query_def_params_global_size(void){
+int tools_open_query_def_params_global_size(void)
+{
return 20;
}
-void tools_open_query_def_params_global_dump(const struct tools_open_query_def_params_global *ptr_struct, FILE* file) {
+void tools_open_query_def_params_global_dump(const struct tools_open_query_def_params_global *ptr_struct, FILE* file)
+{
tools_open_query_def_params_global_print(ptr_struct, file, 0);
}
tools_open_pmdio_unpack(&(ptr_struct->pmdio), ptr_buff);
}
-void tools_open_phy_reg_print(const union tools_open_phy_reg *ptr_struct, FILE* file, int indent_level){
+void tools_open_phy_reg_print(const union tools_open_phy_reg *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_phy_reg ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_phy_reg_size(void){
+int tools_open_phy_reg_size(void)
+{
return 264;
}
-void tools_open_phy_reg_dump(const union tools_open_phy_reg *ptr_struct, FILE* file) {
+void tools_open_phy_reg_dump(const union tools_open_phy_reg *ptr_struct, FILE* file)
+{
tools_open_phy_reg_print(ptr_struct, file, 0);
}
void tools_open_mnv_cfg_pack(const union tools_open_mnv_cfg *ptr_struct, u_int8_t* ptr_buff)
{
- tools_open_mvts_pack(&(ptr_struct->mvts), ptr_buff);
+ tools_open_mnvgn_pack(&(ptr_struct->mnvgn), ptr_buff);
}
void tools_open_mnv_cfg_unpack(union tools_open_mnv_cfg *ptr_struct, const u_int8_t* ptr_buff)
{
- tools_open_mvts_unpack(&(ptr_struct->mvts), ptr_buff);
+ tools_open_mnvgn_unpack(&(ptr_struct->mnvgn), ptr_buff);
}
-void tools_open_mnv_cfg_print(const union tools_open_mnv_cfg *ptr_struct, FILE* file, int indent_level){
+void tools_open_mnv_cfg_print(const union tools_open_mnv_cfg *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_mnv_cfg ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "mvts:\n");
tools_open_mvts_print(&(ptr_struct->mvts), file, indent_level + 1);
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "mnvgn:\n");
+ tools_open_mnvgn_print(&(ptr_struct->mnvgn), file, indent_level + 1);
+
}
-int tools_open_mnv_cfg_size(void){
+int tools_open_mnv_cfg_size(void)
+{
return 256;
}
-void tools_open_mnv_cfg_dump(const union tools_open_mnv_cfg *ptr_struct, FILE* file) {
+void tools_open_mnv_cfg_dump(const union tools_open_mnv_cfg *ptr_struct, FILE* file)
+{
tools_open_mnv_cfg_print(ptr_struct, file, 0);
}
-void tools_open_option_rom_capability_pack(const struct tools_open_option_rom_capability *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_lldp_nb_dcbx_pack(const struct tools_open_lldp_nb_dcbx *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
- adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->ip_ver);
+ offset = 31;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->ieee_dcbx_en);
+
+ offset = 30;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->cee_dcbx_en);
+
+ offset = 29;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->dcbx_willing);
}
-void tools_open_option_rom_capability_unpack(struct tools_open_option_rom_capability *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_lldp_nb_dcbx_unpack(struct tools_open_lldp_nb_dcbx *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
- ptr_struct->ip_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+ offset = 31;
+ ptr_struct->ieee_dcbx_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+ offset = 30;
+ ptr_struct->cee_dcbx_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+ offset = 29;
+ ptr_struct->dcbx_willing = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_option_rom_capability_print(const struct tools_open_option_rom_capability *ptr_struct, FILE* file, int indent_level){
+void tools_open_lldp_nb_dcbx_print(const struct tools_open_lldp_nb_dcbx *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_option_rom_capability ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ fprintf(file, "======== tools_open_lldp_nb_dcbx ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
- fprintf(file, "ip_ver : "UH_FMT"\n", ptr_struct->ip_ver);
+ fprintf(file, "ieee_dcbx_en : "UH_FMT"\n", ptr_struct->ieee_dcbx_en);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "cee_dcbx_en : "UH_FMT"\n", ptr_struct->cee_dcbx_en);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "dcbx_willing : "UH_FMT"\n", ptr_struct->dcbx_willing);
}
-int tools_open_option_rom_capability_size(void){
+int tools_open_lldp_nb_dcbx_size(void)
+{
return 4;
}
-void tools_open_option_rom_capability_dump(const struct tools_open_option_rom_capability *ptr_struct, FILE* file) {
- tools_open_option_rom_capability_print(ptr_struct, file, 0);
+void tools_open_lldp_nb_dcbx_dump(const struct tools_open_lldp_nb_dcbx *ptr_struct, FILE* file)
+{
+ tools_open_lldp_nb_dcbx_print(ptr_struct, file, 0);
}
-void tools_open_boot_settings_ext_pack(const struct tools_open_boot_settings_ext *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_lldp_nb_cap_pack(const struct tools_open_lldp_nb_cap *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=22;
- adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->ip_ver);
+ offset = 4;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->lldp_nb_dcbx_en);
+
+ offset = 2;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->lldp_nb_rx_cap);
+
+ offset = 0;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->lldp_nb_tx_cap);
}
-void tools_open_boot_settings_ext_unpack(struct tools_open_boot_settings_ext *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_lldp_nb_cap_unpack(struct tools_open_lldp_nb_cap *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=22;
- ptr_struct->ip_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+ offset = 4;
+ ptr_struct->lldp_nb_dcbx_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+ offset = 2;
+ ptr_struct->lldp_nb_rx_cap = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+ offset = 0;
+ ptr_struct->lldp_nb_tx_cap = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
}
-void tools_open_boot_settings_ext_print(const struct tools_open_boot_settings_ext *ptr_struct, FILE* file, int indent_level){
+void tools_open_lldp_nb_cap_print(const struct tools_open_lldp_nb_cap *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_boot_settings_ext ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ fprintf(file, "======== tools_open_lldp_nb_cap ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
- fprintf(file, "ip_ver : "UH_FMT"\n", ptr_struct->ip_ver);
+ fprintf(file, "lldp_nb_dcbx_en : "UH_FMT"\n", ptr_struct->lldp_nb_dcbx_en);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_rx_cap : "UH_FMT"\n", ptr_struct->lldp_nb_rx_cap);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_tx_cap : "UH_FMT"\n", ptr_struct->lldp_nb_tx_cap);
}
-int tools_open_boot_settings_ext_size(void){
- return 4;
+int tools_open_lldp_nb_cap_size(void)
+{
+ return 12;
}
-void tools_open_boot_settings_ext_dump(const struct tools_open_boot_settings_ext *ptr_struct, FILE* file) {
- tools_open_boot_settings_ext_print(ptr_struct, file, 0);
+void tools_open_lldp_nb_cap_dump(const struct tools_open_lldp_nb_cap *ptr_struct, FILE* file)
+{
+ tools_open_lldp_nb_cap_print(ptr_struct, file, 0);
}
-void tools_open_external_port_pack(const struct tools_open_external_port *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_lldp_client_settings_pack(const struct tools_open_lldp_client_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=31;
- adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->port_owner);
+ offset = 4;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->lldp_nb_dcbx);
- offset=30;
- adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->allow_rd_counters);
+ offset = 2;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->lldp_nb_rx_mode);
+
+ offset = 0;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->lldp_nb_tx_mode);
}
-void tools_open_external_port_unpack(struct tools_open_external_port *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_lldp_client_settings_unpack(struct tools_open_lldp_client_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=31;
- ptr_struct->port_owner = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+ offset = 4;
+ ptr_struct->lldp_nb_dcbx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=30;
- ptr_struct->allow_rd_counters = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+ offset = 2;
+ ptr_struct->lldp_nb_rx_mode = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+ offset = 0;
+ ptr_struct->lldp_nb_tx_mode = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
}
-void tools_open_external_port_print(const struct tools_open_external_port *ptr_struct, FILE* file, int indent_level){
+void tools_open_lldp_client_settings_print(const struct tools_open_lldp_client_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_external_port ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ fprintf(file, "======== tools_open_lldp_client_settings ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_dcbx : "UH_FMT"\n", ptr_struct->lldp_nb_dcbx);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_rx_mode : "UH_FMT"\n", ptr_struct->lldp_nb_rx_mode);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_tx_mode : "UH_FMT"\n", ptr_struct->lldp_nb_tx_mode);
+
+}
+
+int tools_open_lldp_client_settings_size(void)
+{
+ return 12;
+}
+
+void tools_open_lldp_client_settings_dump(const struct tools_open_lldp_client_settings *ptr_struct, FILE* file)
+{
+ tools_open_lldp_client_settings_print(ptr_struct, file, 0);
+}
+
+void tools_open_qos_cap_pack(const struct tools_open_qos_cap *ptr_struct, u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 28;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->max_num_of_vl);
+
+ offset = 24;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->max_num_of_tc);
+
+}
+
+void tools_open_qos_cap_unpack(struct tools_open_qos_cap *ptr_struct, const u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 28;
+ ptr_struct->max_num_of_vl = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+ offset = 24;
+ ptr_struct->max_num_of_tc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+}
+
+void tools_open_qos_cap_print(const struct tools_open_qos_cap *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_qos_cap ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "max_num_of_vl : "UH_FMT"\n", ptr_struct->max_num_of_vl);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "max_num_of_tc : "UH_FMT"\n", ptr_struct->max_num_of_tc);
+
+}
+
+int tools_open_qos_cap_size(void)
+{
+ return 12;
+}
+
+void tools_open_qos_cap_dump(const struct tools_open_qos_cap *ptr_struct, FILE* file)
+{
+ tools_open_qos_cap_print(ptr_struct, file, 0);
+}
+
+void tools_open_qos_pack(const struct tools_open_qos *ptr_struct, u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 28;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->num_of_vl);
+
+ offset = 24;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->num_of_tc);
+
+}
+
+void tools_open_qos_unpack(struct tools_open_qos *ptr_struct, const u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 28;
+ ptr_struct->num_of_vl = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+ offset = 24;
+ ptr_struct->num_of_tc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
+
+}
+
+void tools_open_qos_print(const struct tools_open_qos *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_qos ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "num_of_vl : "UH_FMT"\n", ptr_struct->num_of_vl);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "num_of_tc : "UH_FMT"\n", ptr_struct->num_of_tc);
+
+}
+
+int tools_open_qos_size(void)
+{
+ return 12;
+}
+
+void tools_open_qos_dump(const struct tools_open_qos *ptr_struct, FILE* file)
+{
+ tools_open_qos_print(ptr_struct, file, 0);
+}
+
+void tools_open_option_rom_capability_pack(const struct tools_open_option_rom_capability *ptr_struct, u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 0;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->ip_ver);
+
+}
+
+void tools_open_option_rom_capability_unpack(struct tools_open_option_rom_capability *ptr_struct, const u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 0;
+ ptr_struct->ip_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
+
+}
+
+void tools_open_option_rom_capability_print(const struct tools_open_option_rom_capability *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_option_rom_capability ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
+ (void)file;
+ (void)indent_level;
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "ip_ver : "UH_FMT"\n", ptr_struct->ip_ver);
+
+}
+
+int tools_open_option_rom_capability_size(void)
+{
+ return 4;
+}
+
+void tools_open_option_rom_capability_dump(const struct tools_open_option_rom_capability *ptr_struct, FILE* file)
+{
+ tools_open_option_rom_capability_print(ptr_struct, file, 0);
+}
+
+void tools_open_boot_settings_ext_pack(const struct tools_open_boot_settings_ext *ptr_struct, u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 22;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->ip_ver);
+
+}
+
+void tools_open_boot_settings_ext_unpack(struct tools_open_boot_settings_ext *ptr_struct, const u_int8_t* ptr_buff)
+{
+ u_int32_t offset;
+ int i = 0;
+ (void)offset;
+ (void)i;
+ (void)ptr_struct;
+ (void)ptr_buff;
+
+ offset = 22;
+ ptr_struct->ip_ver = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
+
+}
+
+void tools_open_boot_settings_ext_print(const struct tools_open_boot_settings_ext *ptr_struct, FILE* file, int indent_level)
+{
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "======== tools_open_boot_settings_ext ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
- fprintf(file, "port_owner : "UH_FMT"\n", ptr_struct->port_owner);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "allow_rd_counters : "UH_FMT"\n", ptr_struct->allow_rd_counters);
+ fprintf(file, "ip_ver : "UH_FMT"\n", ptr_struct->ip_ver);
}
-int tools_open_external_port_size(void){
- return 8;
+int tools_open_boot_settings_ext_size(void)
+{
+ return 4;
}
-void tools_open_external_port_dump(const struct tools_open_external_port *ptr_struct, FILE* file) {
- tools_open_external_port_print(ptr_struct, file, 0);
+void tools_open_boot_settings_ext_dump(const struct tools_open_boot_settings_ext *ptr_struct, FILE* file)
+{
+ tools_open_boot_settings_ext_print(ptr_struct, file, 0);
}
-void tools_open_lldp_nb_capability_pack(const struct tools_open_lldp_nb_capability *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_external_port_pack(const struct tools_open_external_port *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
- adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->lldp_nb_supported);
-
- offset=48;
- adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->max_total_lldp_tlv_len);
+ offset = 31;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->port_owner);
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(88, 8, i, 192, 1);
- adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->supported_lldp_tx_tlv_mask[i]);
- }
+ offset = 30;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->allow_rd_counters);
}
-void tools_open_lldp_nb_capability_unpack(struct tools_open_lldp_nb_capability *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_external_port_unpack(struct tools_open_external_port *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
- ptr_struct->lldp_nb_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
-
- offset=48;
- ptr_struct->max_total_lldp_tlv_len = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
+ offset = 31;
+ ptr_struct->port_owner = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(88, 8, i, 192, 1);
- ptr_struct->supported_lldp_tx_tlv_mask[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- }
+ offset = 30;
+ ptr_struct->allow_rd_counters = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_lldp_nb_capability_print(const struct tools_open_lldp_nb_capability *ptr_struct, FILE* file, int indent_level){
+void tools_open_external_port_print(const struct tools_open_external_port *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_lldp_nb_capability ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ fprintf(file, "======== tools_open_external_port ========\n");
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
- fprintf(file, "lldp_nb_supported : "UH_FMT"\n", ptr_struct->lldp_nb_supported);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "max_total_lldp_tlv_len : "UH_FMT"\n", ptr_struct->max_total_lldp_tlv_len);
+ fprintf(file, "port_owner : "UH_FMT"\n", ptr_struct->port_owner);
- for (i=0; i < 16; i++) {
adb2c_add_indentation(file, indent_level);
- fprintf(file, "supported_lldp_tx_tlv_mask_%03d : "UH_FMT"\n", i, ptr_struct->supported_lldp_tx_tlv_mask[i]);
- }
+ fprintf(file, "allow_rd_counters : "UH_FMT"\n", ptr_struct->allow_rd_counters);
}
-int tools_open_lldp_nb_capability_size(void){
- return 24;
+int tools_open_external_port_size(void)
+{
+ return 8;
}
-void tools_open_lldp_nb_capability_dump(const struct tools_open_lldp_nb_capability *ptr_struct, FILE* file) {
- tools_open_lldp_nb_capability_print(ptr_struct, file, 0);
+void tools_open_external_port_dump(const struct tools_open_external_port *ptr_struct, FILE* file)
+{
+ tools_open_external_port_print(ptr_struct, file, 0);
}
-void tools_open_lldp_nb_pack(const struct tools_open_lldp_nb *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_lldp_nb_pack(const struct tools_open_lldp_nb *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->lldp_nb_rx_en);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->lldp_nb_tx_en);
- offset=84;
+ offset = 84;
adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->lldp_msg_tx_interval);
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(120, 8, i, 224, 1);
+ for (i = 0; i < 16; i++) {
+ offset = adb2c_calc_array_field_address(120, 8, i, 224, 1);
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->lldp_tx_tlv_mask[i]);
}
}
-void tools_open_lldp_nb_unpack(struct tools_open_lldp_nb *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_lldp_nb_unpack(struct tools_open_lldp_nb *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=1;
+ offset = 1;
ptr_struct->lldp_nb_rx_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->lldp_nb_tx_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=84;
+ offset = 84;
ptr_struct->lldp_msg_tx_interval = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
- for (i=0; i < 16; i++) {
- offset=adb2c_calc_array_field_address(120, 8, i, 224, 1);
+ for (i = 0; i < 16; i++) {
+ offset = adb2c_calc_array_field_address(120, 8, i, 224, 1);
ptr_struct->lldp_tx_tlv_mask[i] = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
}
-void tools_open_lldp_nb_print(const struct tools_open_lldp_nb *ptr_struct, FILE* file, int indent_level){
+void tools_open_lldp_nb_print(const struct tools_open_lldp_nb *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_lldp_nb ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
adb2c_add_indentation(file, indent_level);
fprintf(file, "lldp_msg_tx_interval : "UH_FMT"\n", ptr_struct->lldp_msg_tx_interval);
- for (i=0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
adb2c_add_indentation(file, indent_level);
fprintf(file, "lldp_tx_tlv_mask_%03d : "UH_FMT"\n", i, ptr_struct->lldp_tx_tlv_mask[i]);
}
}
-int tools_open_lldp_nb_size(void){
+int tools_open_lldp_nb_size(void)
+{
return 28;
}
-void tools_open_lldp_nb_dump(const struct tools_open_lldp_nb *ptr_struct, FILE* file) {
+void tools_open_lldp_nb_dump(const struct tools_open_lldp_nb *ptr_struct, FILE* file)
+{
tools_open_lldp_nb_print(ptr_struct, file, 0);
}
-void tools_open_roce_cc_ecn_pack(const struct tools_open_roce_cc_ecn *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_roce_cc_ecn_pack(const struct tools_open_roce_cc_ecn *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->clamp_tgt_rate_after_time_inc);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->clamp_tgt_rate);
- offset=47;
+ offset = 47;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->rpg_time_reset);
- offset=81;
+ offset = 81;
adb2c_push_bits_to_buff(ptr_buff, offset, 15, (u_int32_t)ptr_struct->rpg_byte_reset);
- offset=123;
+ offset = 123;
adb2c_push_bits_to_buff(ptr_buff, offset, 5, (u_int32_t)ptr_struct->rpg_threshold);
- offset=129;
+ offset = 129;
adb2c_push_bits_to_buff(ptr_buff, offset, 31, (u_int32_t)ptr_struct->rpg_max_rate);
- offset=175;
+ offset = 175;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->rpg_ai_rate);
- offset=207;
+ offset = 207;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->rpg_hai_rate);
- offset=252;
+ offset = 252;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->rpg_gd);
- offset=280;
+ offset = 280;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->rpg_min_dec_fac);
- offset=303;
+ offset = 303;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->rpg_min_rate);
- offset=335;
+ offset = 335;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->rate_to_set_on_first_cnp);
- offset=374;
+ offset = 374;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->dce_tcp_g);
- offset=399;
+ offset = 399;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->dce_tcp_rtt);
- offset=431;
+ offset = 431;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->rate_reduce_monitor_period);
- offset=470;
+ offset = 470;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->initial_alpha_value);
- offset=495;
+ offset = 495;
adb2c_push_bits_to_buff(ptr_buff, offset, 17, (u_int32_t)ptr_struct->min_time_between_cnps);
- offset=541;
- adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->cnp_dscp);
+ offset = 541;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->cnp_802p_prio);
- offset=530;
- adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->cnp_802p_prio);
+ offset = 530;
+ adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->cnp_dscp);
}
-void tools_open_roce_cc_ecn_unpack(struct tools_open_roce_cc_ecn *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_roce_cc_ecn_unpack(struct tools_open_roce_cc_ecn *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=1;
+ offset = 1;
ptr_struct->clamp_tgt_rate_after_time_inc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->clamp_tgt_rate = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=47;
+ offset = 47;
ptr_struct->rpg_time_reset = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=81;
+ offset = 81;
ptr_struct->rpg_byte_reset = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 15);
- offset=123;
+ offset = 123;
ptr_struct->rpg_threshold = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 5);
- offset=129;
+ offset = 129;
ptr_struct->rpg_max_rate = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 31);
- offset=175;
+ offset = 175;
ptr_struct->rpg_ai_rate = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=207;
+ offset = 207;
ptr_struct->rpg_hai_rate = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=252;
+ offset = 252;
ptr_struct->rpg_gd = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=280;
+ offset = 280;
ptr_struct->rpg_min_dec_fac = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=303;
+ offset = 303;
ptr_struct->rpg_min_rate = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=335;
+ offset = 335;
ptr_struct->rate_to_set_on_first_cnp = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=374;
+ offset = 374;
ptr_struct->dce_tcp_g = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=399;
+ offset = 399;
ptr_struct->dce_tcp_rtt = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=431;
+ offset = 431;
ptr_struct->rate_reduce_monitor_period = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=470;
+ offset = 470;
ptr_struct->initial_alpha_value = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=495;
+ offset = 495;
ptr_struct->min_time_between_cnps = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 17);
- offset=541;
- ptr_struct->cnp_dscp = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
+ offset = 541;
+ ptr_struct->cnp_802p_prio = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
- offset=530;
- ptr_struct->cnp_802p_prio = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
+ offset = 530;
+ ptr_struct->cnp_dscp = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
}
-void tools_open_roce_cc_ecn_print(const struct tools_open_roce_cc_ecn *ptr_struct, FILE* file, int indent_level){
+void tools_open_roce_cc_ecn_print(const struct tools_open_roce_cc_ecn *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_roce_cc_ecn ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "min_time_between_cnps : "UH_FMT"\n", ptr_struct->min_time_between_cnps);
adb2c_add_indentation(file, indent_level);
- fprintf(file, "cnp_dscp : "UH_FMT"\n", ptr_struct->cnp_dscp);
+ fprintf(file, "cnp_802p_prio : "UH_FMT"\n", ptr_struct->cnp_802p_prio);
adb2c_add_indentation(file, indent_level);
- fprintf(file, "cnp_802p_prio : "UH_FMT"\n", ptr_struct->cnp_802p_prio);
+ fprintf(file, "cnp_dscp : "UH_FMT"\n", ptr_struct->cnp_dscp);
}
-int tools_open_roce_cc_ecn_size(void){
+int tools_open_roce_cc_ecn_size(void)
+{
return 68;
}
-void tools_open_roce_cc_ecn_dump(const struct tools_open_roce_cc_ecn *ptr_struct, FILE* file) {
+void tools_open_roce_cc_ecn_dump(const struct tools_open_roce_cc_ecn *ptr_struct, FILE* file)
+{
tools_open_roce_cc_ecn_print(ptr_struct, file, 0);
}
-void tools_open_roce_cc_pack(const struct tools_open_roce_cc *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_roce_cc_pack(const struct tools_open_roce_cc *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->roce_cc_enable_priority);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->roce_cc_algorithm);
}
-void tools_open_roce_cc_unpack(struct tools_open_roce_cc *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_roce_cc_unpack(struct tools_open_roce_cc *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->roce_cc_enable_priority = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=0;
+ offset = 0;
ptr_struct->roce_cc_algorithm = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_roce_cc_print(const struct tools_open_roce_cc *ptr_struct, FILE* file, int indent_level){
+void tools_open_roce_cc_print(const struct tools_open_roce_cc *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_roce_cc ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_roce_cc_size(void){
+int tools_open_roce_cc_size(void)
+{
return 4;
}
-void tools_open_roce_cc_dump(const struct tools_open_roce_cc *ptr_struct, FILE* file) {
+void tools_open_roce_cc_dump(const struct tools_open_roce_cc *ptr_struct, FILE* file)
+{
tools_open_roce_cc_print(ptr_struct, file, 0);
}
-void tools_open_roce_v_1_5_next_protocol_pack(const struct tools_open_roce_v_1_5_next_protocol *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_roce_v_1_5_next_protocol_pack(const struct tools_open_roce_v_1_5_next_protocol *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->roce_over_ip_next_protocol);
}
-void tools_open_roce_v_1_5_next_protocol_unpack(struct tools_open_roce_v_1_5_next_protocol *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_roce_v_1_5_next_protocol_unpack(struct tools_open_roce_v_1_5_next_protocol *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->roce_over_ip_next_protocol = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_roce_v_1_5_next_protocol_print(const struct tools_open_roce_v_1_5_next_protocol *ptr_struct, FILE* file, int indent_level){
+void tools_open_roce_v_1_5_next_protocol_print(const struct tools_open_roce_v_1_5_next_protocol *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_roce_v_1_5_next_protocol ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_roce_v_1_5_next_protocol_size(void){
+int tools_open_roce_v_1_5_next_protocol_size(void)
+{
return 4;
}
-void tools_open_roce_v_1_5_next_protocol_dump(const struct tools_open_roce_v_1_5_next_protocol *ptr_struct, FILE* file) {
+void tools_open_roce_v_1_5_next_protocol_dump(const struct tools_open_roce_v_1_5_next_protocol *ptr_struct, FILE* file)
+{
tools_open_roce_v_1_5_next_protocol_print(ptr_struct, file, 0);
}
-void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_vpi_settings_pack(const struct tools_open_vpi_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=30;
+ offset = 30;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->network_link_type);
- offset=28;
+ offset = 28;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->default_link_type);
}
-void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_vpi_settings_unpack(struct tools_open_vpi_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=30;
+ offset = 30;
ptr_struct->network_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=28;
+ offset = 28;
ptr_struct->default_link_type = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
}
-void tools_open_vpi_settings_print(const struct tools_open_vpi_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_vpi_settings_print(const struct tools_open_vpi_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_vpi_settings ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_vpi_settings_size(void){
+int tools_open_vpi_settings_size(void)
+{
return 4;
}
-void tools_open_vpi_settings_dump(const struct tools_open_vpi_settings *ptr_struct, FILE* file) {
+void tools_open_vpi_settings_dump(const struct tools_open_vpi_settings *ptr_struct, FILE* file)
+{
tools_open_vpi_settings_print(ptr_struct, file, 0);
}
-void tools_open_bar_size_pack(const struct tools_open_bar_size *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_bar_size_pack(const struct tools_open_bar_size *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->log_uar_bar_size);
}
-void tools_open_bar_size_unpack(struct tools_open_bar_size *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_bar_size_unpack(struct tools_open_bar_size *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->log_uar_bar_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void tools_open_bar_size_print(const struct tools_open_bar_size *ptr_struct, FILE* file, int indent_level){
+void tools_open_bar_size_print(const struct tools_open_bar_size *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_bar_size ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_bar_size_size(void){
+int tools_open_bar_size_size(void)
+{
return 4;
}
-void tools_open_bar_size_dump(const struct tools_open_bar_size *ptr_struct, FILE* file) {
+void tools_open_bar_size_dump(const struct tools_open_bar_size *ptr_struct, FILE* file)
+{
tools_open_bar_size_print(ptr_struct, file, 0);
}
-void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_sriov_pack(const struct tools_open_sriov *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->total_vfs);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
}
-void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_sriov_unpack(struct tools_open_sriov *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
ptr_struct->total_vfs = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=0;
+ offset = 0;
ptr_struct->sriov_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_sriov_print(const struct tools_open_sriov *ptr_struct, FILE* file, int indent_level){
+void tools_open_sriov_print(const struct tools_open_sriov *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_sriov ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_sriov_size(void){
+int tools_open_sriov_size(void)
+{
return 4;
}
-void tools_open_sriov_dump(const struct tools_open_sriov *ptr_struct, FILE* file) {
+void tools_open_sriov_dump(const struct tools_open_sriov *ptr_struct, FILE* file)
+{
tools_open_sriov_print(ptr_struct, file, 0);
}
-void tools_open_preboot_flow_ctrl_pack(const struct tools_open_preboot_flow_ctrl *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_preboot_flow_ctrl_pack(const struct tools_open_preboot_flow_ctrl *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->pfcrx);
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->pfctx);
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pfc_willing);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pprx);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pptx);
}
-void tools_open_preboot_flow_ctrl_unpack(struct tools_open_preboot_flow_ctrl *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_preboot_flow_ctrl_unpack(struct tools_open_preboot_flow_ctrl *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->pfcrx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=16;
+ offset = 16;
ptr_struct->pfctx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=2;
+ offset = 2;
ptr_struct->pfc_willing = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=1;
+ offset = 1;
ptr_struct->pprx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->pptx = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_preboot_flow_ctrl_print(const struct tools_open_preboot_flow_ctrl *ptr_struct, FILE* file, int indent_level){
+void tools_open_preboot_flow_ctrl_print(const struct tools_open_preboot_flow_ctrl *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_preboot_flow_ctrl ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_preboot_flow_ctrl_size(void){
+int tools_open_preboot_flow_ctrl_size(void)
+{
return 4;
}
-void tools_open_preboot_flow_ctrl_dump(const struct tools_open_preboot_flow_ctrl *ptr_struct, FILE* file) {
+void tools_open_preboot_flow_ctrl_dump(const struct tools_open_preboot_flow_ctrl *ptr_struct, FILE* file)
+{
tools_open_preboot_flow_ctrl_print(ptr_struct, file, 0);
}
-void tools_open_preboot_boot_settings_pack(const struct tools_open_preboot_boot_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_preboot_boot_settings_pack(const struct tools_open_preboot_boot_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=20;
+ offset = 20;
adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->boot_vlan);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->legacy_boot_protocol);
- offset=5;
+ offset = 5;
adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->boot_retry_count);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_vlan_en);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_option_rom_en);
}
-void tools_open_preboot_boot_settings_unpack(struct tools_open_preboot_boot_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_preboot_boot_settings_unpack(struct tools_open_preboot_boot_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=20;
+ offset = 20;
ptr_struct->boot_vlan = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
- offset=8;
+ offset = 8;
ptr_struct->legacy_boot_protocol = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=5;
+ offset = 5;
ptr_struct->boot_retry_count = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
- offset=1;
+ offset = 1;
ptr_struct->boot_vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->boot_option_rom_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_preboot_boot_settings_print(const struct tools_open_preboot_boot_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_preboot_boot_settings_print(const struct tools_open_preboot_boot_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_preboot_boot_settings ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_preboot_boot_settings_size(void){
+int tools_open_preboot_boot_settings_size(void)
+{
return 4;
}
-void tools_open_preboot_boot_settings_dump(const struct tools_open_preboot_boot_settings *ptr_struct, FILE* file) {
+void tools_open_preboot_boot_settings_dump(const struct tools_open_preboot_boot_settings *ptr_struct, FILE* file)
+{
tools_open_preboot_boot_settings_print(ptr_struct, file, 0);
}
-void tools_open_boot_settings_pack(const struct tools_open_boot_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_boot_settings_pack(const struct tools_open_boot_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=20;
+ offset = 20;
adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->boot_vlan);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->legacy_boot_protocol);
- offset=5;
+ offset = 5;
adb2c_push_bits_to_buff(ptr_buff, offset, 3, (u_int32_t)ptr_struct->boot_retry_conut);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_vlan_en);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->boot_option_rom_en);
}
-void tools_open_boot_settings_unpack(struct tools_open_boot_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_boot_settings_unpack(struct tools_open_boot_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=20;
+ offset = 20;
ptr_struct->boot_vlan = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
- offset=8;
+ offset = 8;
ptr_struct->legacy_boot_protocol = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=5;
+ offset = 5;
ptr_struct->boot_retry_conut = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 3);
- offset=1;
+ offset = 1;
ptr_struct->boot_vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->boot_option_rom_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_boot_settings_print(const struct tools_open_boot_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_boot_settings_print(const struct tools_open_boot_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_boot_settings ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_boot_settings_size(void){
+int tools_open_boot_settings_size(void)
+{
return 4;
}
-void tools_open_boot_settings_dump(const struct tools_open_boot_settings *ptr_struct, FILE* file) {
+void tools_open_boot_settings_dump(const struct tools_open_boot_settings *ptr_struct, FILE* file)
+{
tools_open_boot_settings_print(ptr_struct, file, 0);
}
-void tools_open_infiniband_boot_settings_pack(const struct tools_open_infiniband_boot_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_infiniband_boot_settings_pack(const struct tools_open_infiniband_boot_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->boot_pkey);
}
-void tools_open_infiniband_boot_settings_unpack(struct tools_open_infiniband_boot_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_infiniband_boot_settings_unpack(struct tools_open_infiniband_boot_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=16;
+ offset = 16;
ptr_struct->boot_pkey = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
}
-void tools_open_infiniband_boot_settings_print(const struct tools_open_infiniband_boot_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_infiniband_boot_settings_print(const struct tools_open_infiniband_boot_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_infiniband_boot_settings ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_infiniband_boot_settings_size(void){
+int tools_open_infiniband_boot_settings_size(void)
+{
return 4;
}
-void tools_open_infiniband_boot_settings_dump(const struct tools_open_infiniband_boot_settings *ptr_struct, FILE* file) {
+void tools_open_infiniband_boot_settings_dump(const struct tools_open_infiniband_boot_settings *ptr_struct, FILE* file)
+{
tools_open_infiniband_boot_settings_print(ptr_struct, file, 0);
}
-void tools_open_iscsi_settings_pack(const struct tools_open_iscsi_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_iscsi_settings_pack(const struct tools_open_iscsi_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=10;
+ offset = 10;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->target_as_first_hdd_en);
- offset=8;
+ offset = 8;
adb2c_push_bits_to_buff(ptr_buff, offset, 2, (u_int32_t)ptr_struct->boot_to_target);
- offset=7;
+ offset = 7;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->ipv6_auto_config_en);
- offset=5;
+ offset = 5;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->vlan_en);
- offset=4;
+ offset = 4;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->tcp_timestamps_en);
- offset=3;
+ offset = 3;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->chap_mutual_auth_en);
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->chap_auth_en);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->dhcp_iscsi_en);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->ipv4_dhcp_en);
- offset=52;
+ offset = 52;
adb2c_push_bits_to_buff(ptr_buff, offset, 12, (u_int32_t)ptr_struct->vlan);
- offset=88;
+ offset = 88;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->lun_busy_retry_count);
- offset=80;
+ offset = 80;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->link_up_delay_time);
}
-void tools_open_iscsi_settings_unpack(struct tools_open_iscsi_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_iscsi_settings_unpack(struct tools_open_iscsi_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=10;
+ offset = 10;
ptr_struct->target_as_first_hdd_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=8;
+ offset = 8;
ptr_struct->boot_to_target = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 2);
- offset=7;
+ offset = 7;
ptr_struct->ipv6_auto_config_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=5;
+ offset = 5;
ptr_struct->vlan_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=4;
+ offset = 4;
ptr_struct->tcp_timestamps_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=3;
+ offset = 3;
ptr_struct->chap_mutual_auth_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=2;
+ offset = 2;
ptr_struct->chap_auth_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=1;
+ offset = 1;
ptr_struct->dhcp_iscsi_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->ipv4_dhcp_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=52;
+ offset = 52;
ptr_struct->vlan = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 12);
- offset=88;
+ offset = 88;
ptr_struct->lun_busy_retry_count = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=80;
+ offset = 80;
ptr_struct->link_up_delay_time = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
}
-void tools_open_iscsi_settings_print(const struct tools_open_iscsi_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_iscsi_settings_print(const struct tools_open_iscsi_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_iscsi_settings ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_iscsi_settings_size(void){
+int tools_open_iscsi_settings_size(void)
+{
return 12;
}
-void tools_open_iscsi_settings_dump(const struct tools_open_iscsi_settings *ptr_struct, FILE* file) {
+void tools_open_iscsi_settings_dump(const struct tools_open_iscsi_settings *ptr_struct, FILE* file)
+{
tools_open_iscsi_settings_print(ptr_struct, file, 0);
}
-void tools_open_port_boot_state_pack(const struct tools_open_port_boot_state *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_port_boot_state_pack(const struct tools_open_port_boot_state *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
adb2c_push_bits_to_buff(ptr_buff, offset, 8, (u_int32_t)ptr_struct->aux_power_indication_gpio);
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->aux_power_indication_gpio_en);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->standby_on_aux);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->power_up_on_aux);
}
-void tools_open_port_boot_state_unpack(struct tools_open_port_boot_state *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_port_boot_state_unpack(struct tools_open_port_boot_state *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=24;
+ offset = 24;
ptr_struct->aux_power_indication_gpio = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 8);
- offset=2;
+ offset = 2;
ptr_struct->aux_power_indication_gpio_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=1;
+ offset = 1;
ptr_struct->standby_on_aux = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->power_up_on_aux = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_port_boot_state_print(const struct tools_open_port_boot_state *ptr_struct, FILE* file, int indent_level){
+void tools_open_port_boot_state_print(const struct tools_open_port_boot_state *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_port_boot_state ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_port_boot_state_size(void){
+int tools_open_port_boot_state_size(void)
+{
return 4;
}
-void tools_open_port_boot_state_dump(const struct tools_open_port_boot_state *ptr_struct, FILE* file) {
+void tools_open_port_boot_state_dump(const struct tools_open_port_boot_state *ptr_struct, FILE* file)
+{
tools_open_port_boot_state_print(ptr_struct, file, 0);
}
-void tools_open_pci_configuration_pack(const struct tools_open_pci_configuration *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_pci_configuration_pack(const struct tools_open_pci_configuration *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=7;
+ offset = 7;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pf_bar_size_valid);
- offset=6;
+ offset = 6;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->vf_bar_size_valid);
- offset=5;
+ offset = 5;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->num_pfs_msix_valid);
- offset=4;
+ offset = 4;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->num_vfs_msix_valid);
- offset=3;
+ offset = 3;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->num_pfs_valid);
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->fpp_valid);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->full_vf_qos_valid);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_valid);
- offset=48;
+ offset = 48;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->total_vfs);
- offset=44;
+ offset = 44;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->num_pfs);
- offset=34;
+ offset = 34;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->fpp_en);
- offset=33;
+ offset = 33;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->full_vf_qos);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_en);
- offset=90;
+ offset = 90;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->log_pf_uar_bar_size);
- offset=84;
+ offset = 84;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->log_vf_uar_bar_size);
- offset=74;
+ offset = 74;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->num_pf_msix);
- offset=64;
+ offset = 64;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->num_vf_msix);
}
-void tools_open_pci_configuration_unpack(struct tools_open_pci_configuration *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_pci_configuration_unpack(struct tools_open_pci_configuration *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=7;
+ offset = 7;
ptr_struct->pf_bar_size_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=6;
+ offset = 6;
ptr_struct->vf_bar_size_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=5;
+ offset = 5;
ptr_struct->num_pfs_msix_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=4;
+ offset = 4;
ptr_struct->num_vfs_msix_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=3;
+ offset = 3;
ptr_struct->num_pfs_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=2;
+ offset = 2;
ptr_struct->fpp_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=1;
+ offset = 1;
ptr_struct->full_vf_qos_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->sriov_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=48;
+ offset = 48;
ptr_struct->total_vfs = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=44;
+ offset = 44;
ptr_struct->num_pfs = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=34;
+ offset = 34;
ptr_struct->fpp_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=33;
+ offset = 33;
ptr_struct->full_vf_qos = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=32;
+ offset = 32;
ptr_struct->sriov_en = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=90;
+ offset = 90;
ptr_struct->log_pf_uar_bar_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=84;
+ offset = 84;
ptr_struct->log_vf_uar_bar_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=74;
+ offset = 74;
ptr_struct->num_pf_msix = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=64;
+ offset = 64;
ptr_struct->num_vf_msix = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
}
-void tools_open_pci_configuration_print(const struct tools_open_pci_configuration *ptr_struct, FILE* file, int indent_level){
+void tools_open_pci_configuration_print(const struct tools_open_pci_configuration *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_pci_configuration ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_pci_configuration_size(void){
+int tools_open_pci_configuration_size(void)
+{
return 12;
}
-void tools_open_pci_configuration_dump(const struct tools_open_pci_configuration *ptr_struct, FILE* file) {
+void tools_open_pci_configuration_dump(const struct tools_open_pci_configuration *ptr_struct, FILE* file)
+{
tools_open_pci_configuration_print(ptr_struct, file, 0);
}
-void tools_open_pci_capabilities_pack(const struct tools_open_pci_capabilities *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_pci_capabilities_pack(const struct tools_open_pci_capabilities *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=7;
+ offset = 7;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->pf_bar_size_supported);
- offset=6;
+ offset = 6;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->vf_bar_size_supported);
- offset=5;
+ offset = 5;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->num_pf_msix_supported);
- offset=4;
+ offset = 4;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->num_vf_msix_supported);
- offset=3;
+ offset = 3;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->num_pfs_supported);
- offset=2;
+ offset = 2;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->max_total_bar_valid);
- offset=1;
+ offset = 1;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->max_total_msix_valid);
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->max_vfs_per_pf_valid);
- offset=48;
+ offset = 48;
adb2c_push_bits_to_buff(ptr_buff, offset, 16, (u_int32_t)ptr_struct->max_vfs_per_pf);
- offset=44;
+ offset = 44;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->max_num_pfs);
- offset=34;
+ offset = 34;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->fpp_support);
- offset=33;
+ offset = 33;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->vf_qos_control_support);
- offset=32;
+ offset = 32;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->sriov_support);
- offset=90;
+ offset = 90;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->log_max_pf_uar_bar_size1);
- offset=84;
+ offset = 84;
adb2c_push_bits_to_buff(ptr_buff, offset, 6, (u_int32_t)ptr_struct->log_max_vf_uar_bar_size);
- offset=74;
+ offset = 74;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->max_num_pf_msix);
- offset=64;
+ offset = 64;
adb2c_push_bits_to_buff(ptr_buff, offset, 10, (u_int32_t)ptr_struct->max_num_vf_msix);
- offset=96;
+ offset = 96;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->max_total_msix);
- offset=128;
+ offset = 128;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->max_total_bar);
}
-void tools_open_pci_capabilities_unpack(struct tools_open_pci_capabilities *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_pci_capabilities_unpack(struct tools_open_pci_capabilities *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=7;
+ offset = 7;
ptr_struct->pf_bar_size_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=6;
+ offset = 6;
ptr_struct->vf_bar_size_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=5;
+ offset = 5;
ptr_struct->num_pf_msix_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=4;
+ offset = 4;
ptr_struct->num_vf_msix_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=3;
+ offset = 3;
ptr_struct->num_pfs_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=2;
+ offset = 2;
ptr_struct->max_total_bar_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=1;
+ offset = 1;
ptr_struct->max_total_msix_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=0;
+ offset = 0;
ptr_struct->max_vfs_per_pf_valid = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=48;
+ offset = 48;
ptr_struct->max_vfs_per_pf = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 16);
- offset=44;
+ offset = 44;
ptr_struct->max_num_pfs = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
- offset=34;
+ offset = 34;
ptr_struct->fpp_support = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=33;
+ offset = 33;
ptr_struct->vf_qos_control_support = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=32;
+ offset = 32;
ptr_struct->sriov_support = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=90;
+ offset = 90;
ptr_struct->log_max_pf_uar_bar_size1 = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=84;
+ offset = 84;
ptr_struct->log_max_vf_uar_bar_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 6);
- offset=74;
+ offset = 74;
ptr_struct->max_num_pf_msix = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=64;
+ offset = 64;
ptr_struct->max_num_vf_msix = (u_int16_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 10);
- offset=96;
+ offset = 96;
ptr_struct->max_total_msix = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=128;
+ offset = 128;
ptr_struct->max_total_bar = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void tools_open_pci_capabilities_print(const struct tools_open_pci_capabilities *ptr_struct, FILE* file, int indent_level){
+void tools_open_pci_capabilities_print(const struct tools_open_pci_capabilities *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_pci_capabilities ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_pci_capabilities_size(void){
+int tools_open_pci_capabilities_size(void)
+{
return 20;
}
-void tools_open_pci_capabilities_dump(const struct tools_open_pci_capabilities *ptr_struct, FILE* file) {
+void tools_open_pci_capabilities_dump(const struct tools_open_pci_capabilities *ptr_struct, FILE* file)
+{
tools_open_pci_capabilities_print(ptr_struct, file, 0);
}
-void tools_open_tpt_configuration_pack(const struct tools_open_tpt_configuration *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_tpt_configuration_pack(const struct tools_open_tpt_configuration *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=28;
+ offset = 28;
adb2c_push_bits_to_buff(ptr_buff, offset, 4, (u_int32_t)ptr_struct->log_max_payload_size);
}
-void tools_open_tpt_configuration_unpack(struct tools_open_tpt_configuration *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_tpt_configuration_unpack(struct tools_open_tpt_configuration *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=28;
+ offset = 28;
ptr_struct->log_max_payload_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 4);
}
-void tools_open_tpt_configuration_print(const struct tools_open_tpt_configuration *ptr_struct, FILE* file, int indent_level){
+void tools_open_tpt_configuration_print(const struct tools_open_tpt_configuration *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_tpt_configuration ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_tpt_configuration_size(void){
+int tools_open_tpt_configuration_size(void)
+{
return 4;
}
-void tools_open_tpt_configuration_dump(const struct tools_open_tpt_configuration *ptr_struct, FILE* file) {
+void tools_open_tpt_configuration_dump(const struct tools_open_tpt_configuration *ptr_struct, FILE* file)
+{
tools_open_tpt_configuration_print(ptr_struct, file, 0);
}
-void tools_open_tpt_capabilities_pack(const struct tools_open_tpt_capabilities *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_tpt_capabilities_pack(const struct tools_open_tpt_capabilities *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->log_max_payload_size_supported);
}
-void tools_open_tpt_capabilities_unpack(struct tools_open_tpt_capabilities *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_tpt_capabilities_unpack(struct tools_open_tpt_capabilities *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->log_max_payload_size_supported = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_tpt_capabilities_print(const struct tools_open_tpt_capabilities *ptr_struct, FILE* file, int indent_level){
+void tools_open_tpt_capabilities_print(const struct tools_open_tpt_capabilities *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_tpt_capabilities ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_tpt_capabilities_size(void){
+int tools_open_tpt_capabilities_size(void)
+{
return 4;
}
-void tools_open_tpt_capabilities_dump(const struct tools_open_tpt_capabilities *ptr_struct, FILE* file) {
+void tools_open_tpt_capabilities_dump(const struct tools_open_tpt_capabilities *ptr_struct, FILE* file)
+{
tools_open_tpt_capabilities_print(ptr_struct, file, 0);
}
-void tools_open_infiniband_dc_settings_pack(const struct tools_open_infiniband_dc_settings *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_infiniband_dc_settings_pack(const struct tools_open_infiniband_dc_settings *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=27;
+ offset = 27;
adb2c_push_bits_to_buff(ptr_buff, offset, 5, (u_int32_t)ptr_struct->log_dcr_hash_table_size);
- offset=40;
+ offset = 40;
adb2c_push_bits_to_buff(ptr_buff, offset, 24, (u_int32_t)ptr_struct->dcr_lifo_size);
}
-void tools_open_infiniband_dc_settings_unpack(struct tools_open_infiniband_dc_settings *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_infiniband_dc_settings_unpack(struct tools_open_infiniband_dc_settings *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=27;
+ offset = 27;
ptr_struct->log_dcr_hash_table_size = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 5);
- offset=40;
+ offset = 40;
ptr_struct->dcr_lifo_size = (u_int32_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 24);
}
-void tools_open_infiniband_dc_settings_print(const struct tools_open_infiniband_dc_settings *ptr_struct, FILE* file, int indent_level){
+void tools_open_infiniband_dc_settings_print(const struct tools_open_infiniband_dc_settings *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_infiniband_dc_settings ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_infiniband_dc_settings_size(void){
+int tools_open_infiniband_dc_settings_size(void)
+{
return 8;
}
-void tools_open_infiniband_dc_settings_dump(const struct tools_open_infiniband_dc_settings *ptr_struct, FILE* file) {
+void tools_open_infiniband_dc_settings_dump(const struct tools_open_infiniband_dc_settings *ptr_struct, FILE* file)
+{
tools_open_infiniband_dc_settings_print(ptr_struct, file, 0);
}
-void tools_open_infiniband_dc_capabilities_pack(const struct tools_open_infiniband_dc_capabilities *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_infiniband_dc_capabilities_pack(const struct tools_open_infiniband_dc_capabilities *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->min_log_dcr_hash_table_size);
- offset=32;
+ offset = 32;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->max_log_dcr_hash_table_size);
- offset=64;
+ offset = 64;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->min_dcr_lifo_size);
- offset=96;
+ offset = 96;
adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->max_dcr_lifo_size);
}
-void tools_open_infiniband_dc_capabilities_unpack(struct tools_open_infiniband_dc_capabilities *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_infiniband_dc_capabilities_unpack(struct tools_open_infiniband_dc_capabilities *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=0;
+ offset = 0;
ptr_struct->min_log_dcr_hash_table_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=32;
+ offset = 32;
ptr_struct->max_log_dcr_hash_table_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=64;
+ offset = 64;
ptr_struct->min_dcr_lifo_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
- offset=96;
+ offset = 96;
ptr_struct->max_dcr_lifo_size = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
}
-void tools_open_infiniband_dc_capabilities_print(const struct tools_open_infiniband_dc_capabilities *ptr_struct, FILE* file, int indent_level){
+void tools_open_infiniband_dc_capabilities_print(const struct tools_open_infiniband_dc_capabilities *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_infiniband_dc_capabilities ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_infiniband_dc_capabilities_size(void){
+int tools_open_infiniband_dc_capabilities_size(void)
+{
return 16;
}
-void tools_open_infiniband_dc_capabilities_dump(const struct tools_open_infiniband_dc_capabilities *ptr_struct, FILE* file) {
+void tools_open_infiniband_dc_capabilities_dump(const struct tools_open_infiniband_dc_capabilities *ptr_struct, FILE* file)
+{
tools_open_infiniband_dc_capabilities_print(ptr_struct, file, 0);
}
-void tools_open_wol_pack(const struct tools_open_wol *ptr_struct, u_int8_t* ptr_buff){
+void tools_open_wol_pack(const struct tools_open_wol *ptr_struct, u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=22;
+ offset = 22;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_psswd_magic);
- offset=21;
+ offset = 21;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_magic);
- offset=20;
+ offset = 20;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_arp);
- offset=19;
+ offset = 19;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_bc);
- offset=18;
+ offset = 18;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_mc);
- offset=17;
+ offset = 17;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_uc);
- offset=16;
+ offset = 16;
adb2c_push_bits_to_buff(ptr_buff, offset, 1, (u_int32_t)ptr_struct->en_wol_phy);
}
-void tools_open_wol_unpack(struct tools_open_wol *ptr_struct, const u_int8_t* ptr_buff){
+void tools_open_wol_unpack(struct tools_open_wol *ptr_struct, const u_int8_t* ptr_buff)
+{
u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
+ int i = 0;
(void)offset;
(void)i;
(void)ptr_struct;
(void)ptr_buff;
- offset=22;
+ offset = 22;
ptr_struct->en_wol_psswd_magic = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=21;
+ offset = 21;
ptr_struct->en_wol_magic = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=20;
+ offset = 20;
ptr_struct->en_wol_arp = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=19;
+ offset = 19;
ptr_struct->en_wol_bc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=18;
+ offset = 18;
ptr_struct->en_wol_mc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=17;
+ offset = 17;
ptr_struct->en_wol_uc = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
- offset=16;
+ offset = 16;
ptr_struct->en_wol_phy = (u_int8_t)adb2c_pop_bits_from_buff(ptr_buff, offset, 1);
}
-void tools_open_wol_print(const struct tools_open_wol *ptr_struct, FILE* file, int indent_level){
+void tools_open_wol_print(const struct tools_open_wol *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_wol ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_wol_size(void){
+int tools_open_wol_size(void)
+{
return 8;
}
-void tools_open_wol_dump(const struct tools_open_wol *ptr_struct, FILE* file) {
+void tools_open_wol_dump(const struct tools_open_wol *ptr_struct, FILE* file)
+{
tools_open_wol_print(ptr_struct, file, 0);
}
tools_open_mfg_info_unpack(&(ptr_struct->mfg_info), ptr_buff);
}
-void tools_open_misc_structs_print(const union tools_open_misc_structs *ptr_struct, FILE* file, int indent_level){
+void tools_open_misc_structs_print(const union tools_open_misc_structs *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_misc_structs ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_misc_structs_size(void){
+int tools_open_misc_structs_size(void)
+{
return 1024;
}
-void tools_open_misc_structs_dump(const union tools_open_misc_structs *ptr_struct, FILE* file) {
+void tools_open_misc_structs_dump(const union tools_open_misc_structs *ptr_struct, FILE* file)
+{
tools_open_misc_structs_print(ptr_struct, file, 0);
}
tools_open_aux_tlv_unpack(&(ptr_struct->aux_tlv), ptr_buff);
}
-void tools_open_aux_img_data_print(const union tools_open_aux_img_data *ptr_struct, FILE* file, int indent_level){
+void tools_open_aux_img_data_print(const union tools_open_aux_img_data *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_aux_img_data ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_aux_img_data_size(void){
+int tools_open_aux_img_data_size(void)
+{
return 256;
}
-void tools_open_aux_img_data_dump(const union tools_open_aux_img_data *ptr_struct, FILE* file) {
+void tools_open_aux_img_data_dump(const union tools_open_aux_img_data *ptr_struct, FILE* file)
+{
tools_open_aux_img_data_print(ptr_struct, file, 0);
}
tools_open_query_def_params_per_port_unpack(&(ptr_struct->query_def_params_per_port), ptr_buff);
}
-void tools_open_hcr_cmds_print(const union tools_open_hcr_cmds *ptr_struct, FILE* file, int indent_level){
+void tools_open_hcr_cmds_print(const union tools_open_hcr_cmds *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_hcr_cmds ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_hcr_cmds_size(void){
+int tools_open_hcr_cmds_size(void)
+{
return 264;
}
-void tools_open_hcr_cmds_dump(const union tools_open_hcr_cmds *ptr_struct, FILE* file) {
+void tools_open_hcr_cmds_dump(const union tools_open_hcr_cmds *ptr_struct, FILE* file)
+{
tools_open_hcr_cmds_print(ptr_struct, file, 0);
}
tools_open_phy_reg_unpack(&(ptr_struct->PhyReg), ptr_buff);
}
-void tools_open_access_registers_print(const union tools_open_access_registers *ptr_struct, FILE* file, int indent_level){
+void tools_open_access_registers_print(const union tools_open_access_registers *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_access_registers ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_access_registers_size(void){
+int tools_open_access_registers_size(void)
+{
return 512;
}
-void tools_open_access_registers_dump(const union tools_open_access_registers *ptr_struct, FILE* file) {
+void tools_open_access_registers_dump(const union tools_open_access_registers *ptr_struct, FILE* file)
+{
tools_open_access_registers_print(ptr_struct, file, 0);
}
void tools_open_nv_cfg_pack(const union tools_open_nv_cfg *ptr_struct, u_int8_t* ptr_buff)
{
- tools_open_option_rom_capability_pack(&(ptr_struct->option_rom_capability), ptr_buff);
+ tools_open_lldp_nb_dcbx_pack(&(ptr_struct->lldp_nb_dcbx), ptr_buff);
}
void tools_open_nv_cfg_unpack(union tools_open_nv_cfg *ptr_struct, const u_int8_t* ptr_buff)
{
- tools_open_option_rom_capability_unpack(&(ptr_struct->option_rom_capability), ptr_buff);
+ tools_open_lldp_nb_dcbx_unpack(&(ptr_struct->lldp_nb_dcbx), ptr_buff);
}
-void tools_open_nv_cfg_print(const union tools_open_nv_cfg *ptr_struct, FILE* file, int indent_level){
+void tools_open_nv_cfg_print(const union tools_open_nv_cfg *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_nv_cfg ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
fprintf(file, "lldp_nb:\n");
tools_open_lldp_nb_print(&(ptr_struct->lldp_nb), file, indent_level + 1);
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "lldp_nb_capability:\n");
- tools_open_lldp_nb_capability_print(&(ptr_struct->lldp_nb_capability), file, indent_level + 1);
-
adb2c_add_indentation(file, indent_level);
fprintf(file, "external_port:\n");
tools_open_external_port_print(&(ptr_struct->external_port), file, indent_level + 1);
fprintf(file, "option_rom_capability:\n");
tools_open_option_rom_capability_print(&(ptr_struct->option_rom_capability), file, indent_level + 1);
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "qos:\n");
+ tools_open_qos_print(&(ptr_struct->qos), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "qos_cap:\n");
+ tools_open_qos_cap_print(&(ptr_struct->qos_cap), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_client_settings:\n");
+ tools_open_lldp_client_settings_print(&(ptr_struct->lldp_client_settings), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_cap:\n");
+ tools_open_lldp_nb_cap_print(&(ptr_struct->lldp_nb_cap), file, indent_level + 1);
+
+ adb2c_add_indentation(file, indent_level);
+ fprintf(file, "lldp_nb_dcbx:\n");
+ tools_open_lldp_nb_dcbx_print(&(ptr_struct->lldp_nb_dcbx), file, indent_level + 1);
+
}
-int tools_open_nv_cfg_size(void){
+int tools_open_nv_cfg_size(void)
+{
return 256;
}
-void tools_open_nv_cfg_dump(const union tools_open_nv_cfg *ptr_struct, FILE* file) {
+void tools_open_nv_cfg_dump(const union tools_open_nv_cfg *ptr_struct, FILE* file)
+{
tools_open_nv_cfg_print(ptr_struct, file, 0);
}
tools_open_misc_structs_unpack(&(ptr_struct->MiscStructs), ptr_buff);
}
-void tools_open_tools_open_print(const union tools_open_tools_open *ptr_struct, FILE* file, int indent_level){
+void tools_open_tools_open_print(const union tools_open_tools_open *ptr_struct, FILE* file, int indent_level)
+{
adb2c_add_indentation(file, indent_level);
fprintf(file, "======== tools_open_tools_open ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
+ int i = 0;
+ (void)i;
+ (void)ptr_struct;
(void)file;
(void)indent_level;
}
-int tools_open_tools_open_size(void){
+int tools_open_tools_open_size(void)
+{
return 1048576;
}
-void tools_open_tools_open_dump(const union tools_open_tools_open *ptr_struct, FILE* file) {
+void tools_open_tools_open_dump(const union tools_open_tools_open *ptr_struct, FILE* file)
+{
tools_open_tools_open_print(ptr_struct, file, 0);
}
-void tools_open_uint64_pack(const struct tools_open_uint64 *ptr_struct, u_int8_t* ptr_buff){
- u_int32_t offset;
- int i=0;
- (void)offset;
- (void)i;
- (void)ptr_struct;
- (void)ptr_buff;
-
- offset=0;
- adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->hi);
-
- offset=32;
- adb2c_push_integer_to_buff(ptr_buff, offset, 4, (u_int64_t)ptr_struct->lo);
-
-}
-
-void tools_open_uint64_unpack(struct tools_open_uint64 *ptr_struct, const u_int8_t* ptr_buff){
- u_int32_t offset;
- int i=0;
- u_int8_t val=0;
- (void)val;
- (void)offset;
- (void)i;
- (void)ptr_struct;
- (void)ptr_buff;
-
- offset=0;
- ptr_struct->hi = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
-
- offset=32;
- ptr_struct->lo = (u_int32_t)adb2c_pop_integer_from_buff(ptr_buff, offset, 4);
-
-}
-
-void tools_open_uint64_print(const struct tools_open_uint64 *ptr_struct, FILE* file, int indent_level){
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "======== tools_open_uint64 ========\n");
- int i=0;
- (void)i;(void)ptr_struct;
- (void)file;
- (void)indent_level;
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "hi : "U32H_FMT"\n", ptr_struct->hi);
-
- adb2c_add_indentation(file, indent_level);
- fprintf(file, "lo : "U32H_FMT"\n", ptr_struct->lo);
-
-}
-
-int tools_open_uint64_size(void){
- return 8;
-}
-
-void tools_open_uint64_dump(const struct tools_open_uint64 *ptr_struct, FILE* file) {
- tools_open_uint64_print(ptr_struct, file, 0);
-}
-
*/
/***
- *** This file was generated at "2016-05-04 19:06:49"
+ *** This file was generated at "2016-05-09 12:11:56"
*** by:
*** > /mswg/release/eat_me/last_release/adabe_plugins/adb2c/adb2pack.py --input adb/tools_open/tools_open.adb --file-prefix tools_open --prefix tools_open_
***/
u_int8_t param_class;
};
+/* Description - */
+/* Size in bytes - 4 */
+union tools_open_tlv_type {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_global_type global;
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_eswitch_type eswitch;
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_per_host_type per_host;
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_bmc_type bmc;
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_per_port_type per_port;
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_tlv_type_dw tlv_type_dw;
+};
+
/* Description - */
/* Size in bytes - 8 */
struct tools_open_ts_entry {
u_int16_t fw_ver_minor;
};
-/* Description - */
-/* Size in bytes - 4 */
-union tools_open_tlv_type {
-/*---------------- DWORD[0] (Offset 0x0) ----------------*/
- /* Description - */
- /* 0.0 - 4.31 */
- struct tools_open_global_type global;
- /* Description - */
- /* 0.0 - 4.31 */
- struct tools_open_eswitch_type eswitch;
- /* Description - */
- /* 0.0 - 4.31 */
- struct tools_open_per_host_type per_host;
- /* Description - */
- /* 0.0 - 4.31 */
- struct tools_open_bmc_type bmc;
- /* Description - */
- /* 0.0 - 4.31 */
- struct tools_open_per_port_type per_port;
- /* Description - */
- /* 0.0 - 4.31 */
- struct tools_open_tlv_type_dw tlv_type_dw;
-};
-
/* Description - */
/* Size in bytes - 4 */
struct tools_open_pmdio_addr_data {
u_int16_t addr;
};
-/* Description - */
-/* Size in bytes - 16 */
-struct tools_open_timestamp {
-/*---------------- DWORD[0] (Offset 0x0) ----------------*/
- /* Description - fw_version */
- /* 0.0 - 8.31 */
- struct tools_open_fw_version fw_version;
-/*---------------- DWORD[2] (Offset 0x8) ----------------*/
- /* Description - Timestamp */
- /* 8.0 - 16.31 */
- struct tools_open_ts_entry ts_entry;
-};
-
/* Description - */
/* Size in bytes - 12 */
struct tools_open_nv_hdr_fifth_gen {
union tools_open_tlv_type type;
};
+/* Description - */
+/* Size in bytes - 16 */
+struct tools_open_timestamp {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - fw_version */
+ /* 0.0 - 8.31 */
+ struct tools_open_fw_version fw_version;
+/*---------------- DWORD[2] (Offset 0x8) ----------------*/
+ /* Description - Timestamp */
+ /* 8.0 - 16.31 */
+ struct tools_open_ts_entry ts_entry;
+};
+
/* Description - */
/* Size in bytes - 8 */
struct tools_open_nv_hdr {
u_int8_t misc_cap;
};
+/* Description - */
+/* Size in bytes - 156 */
+struct tools_open_mnvgn {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - Pointer to the NV parameter */
+ /* 0.0 - 4.31 */
+ u_int32_t nv_pointer;
+/*---------------- DWORD[4] (Offset 0x10) ----------------*/
+ /* Description - */
+ /* 16.0 - 28.31 */
+ struct tools_open_nv_hdr_fifth_gen nv_hdr;
+/*---------------- DWORD[7] (Offset 0x1c) ----------------*/
+ /* Description - */
+ /* 28.24 - 156.23 */
+ u_int8_t nv_data[128];
+};
+
/* Description - */
/* Size in bytes - 20 */
struct tools_open_mvts {
/* Description - */
/* 0.0 - 20.31 */
struct tools_open_mvts mvts;
+ /* Description - */
+ /* 0.0 - 156.31 */
+ struct tools_open_mnvgn mnvgn;
+};
+
+/* Description - */
+/* Size in bytes - 4 */
+struct tools_open_lldp_nb_dcbx {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - */
+ /* 0.0 - 0.0 */
+ u_int8_t ieee_dcbx_en;
+ /* Description - */
+ /* 0.1 - 0.1 */
+ u_int8_t cee_dcbx_en;
+ /* Description - */
+ /* 0.2 - 0.2 */
+ u_int8_t dcbx_willing;
+};
+
+/* Description - */
+/* Size in bytes - 12 */
+struct tools_open_lldp_nb_cap {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - */
+ /* 0.27 - 0.27 */
+ u_int8_t lldp_nb_dcbx_en;
+ /* Description - */
+ /* 0.28 - 0.29 */
+ u_int8_t lldp_nb_rx_cap;
+ /* Description - */
+ /* 0.30 - 4.31 */
+ u_int8_t lldp_nb_tx_cap;
+};
+
+/* Description - */
+/* Size in bytes - 12 */
+struct tools_open_lldp_client_settings {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - */
+ /* 0.27 - 0.27 */
+ u_int8_t lldp_nb_dcbx;
+ /* Description - */
+ /* 0.28 - 0.29 */
+ u_int8_t lldp_nb_rx_mode;
+ /* Description - */
+ /* 0.30 - 4.31 */
+ u_int8_t lldp_nb_tx_mode;
+};
+
+/* Description - */
+/* Size in bytes - 12 */
+struct tools_open_qos_cap {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - */
+ /* 0.0 - 0.3 */
+ u_int8_t max_num_of_vl;
+ /* Description - */
+ /* 0.4 - 0.7 */
+ u_int8_t max_num_of_tc;
+};
+
+/* Description - */
+/* Size in bytes - 12 */
+struct tools_open_qos {
+/*---------------- DWORD[0] (Offset 0x0) ----------------*/
+ /* Description - */
+ /* 0.0 - 0.3 */
+ u_int8_t num_of_vl;
+ /* Description - */
+ /* 0.4 - 0.7 */
+ u_int8_t num_of_tc;
};
/* Description - */
u_int8_t allow_rd_counters;
};
-/* Description - */
-/* Size in bytes - 24 */
-struct tools_open_lldp_nb_capability {
-/*---------------- DWORD[0] (Offset 0x0) ----------------*/
- /* Description - Indicate if LLDP-NB is supported by this firmware
-Default: Enabled
- */
- /* 0.31 - 4.31 */
- u_int8_t lldp_nb_supported;
-/*---------------- DWORD[1] (Offset 0x4) ----------------*/
- /* Description - The overall (scratchpad) memory size for holding LLDP-TLVs. The memory is first filled with TLVs that the LLDP need to send (TX) the rest of the area is used for incoming TLVs
-
-Default: 3000 octets
- */
- /* 4.0 - 4.15 */
- u_int16_t max_total_lldp_tlv_len;
-/*---------------- DWORD[2] (Offset 0x8) ----------------*/
- /* Description - A bitmask saying which of the LLDP-TLV the client is capable of sending
-TBD: we think that this is redundant
- */
- /* 8.24 - 24.23 */
- u_int8_t supported_lldp_tx_tlv_mask[16];
-};
-
/* Description - */
/* Size in bytes - 28 */
struct tools_open_lldp_nb {
/* 60.0 - 60.16 */
u_int32_t min_time_between_cnps;
/*---------------- DWORD[16] (Offset 0x40) ----------------*/
- /* Description - The DiffServ Code Point of the generated CNP for this port
-Default: 0
- */
- /* 64.0 - 64.2 */
- u_int8_t cnp_dscp;
/* Description - The 802.1p priority value of the generated CNP for this port
Default: 7
*/
- /* 64.8 - 64.13 */
+ /* 64.0 - 64.2 */
u_int8_t cnp_802p_prio;
+ /* Description - The DiffServ Code Point of the generated CNP for this port
+Default: 0
+ */
+ /* 64.8 - 64.13 */
+ u_int8_t cnp_dscp;
};
/* Description - */
/* 0.0 - 28.31 */
struct tools_open_lldp_nb lldp_nb;
/* Description - */
- /* 0.0 - 24.31 */
- struct tools_open_lldp_nb_capability lldp_nb_capability;
- /* Description - */
/* 0.0 - 8.31 */
struct tools_open_external_port external_port;
/* Description - */
/* Description - */
/* 0.0 - 4.31 */
struct tools_open_option_rom_capability option_rom_capability;
+ /* Description - */
+ /* 0.0 - 12.31 */
+ struct tools_open_qos qos;
+ /* Description - */
+ /* 0.0 - 12.31 */
+ struct tools_open_qos_cap qos_cap;
+ /* Description - */
+ /* 0.0 - 12.31 */
+ struct tools_open_lldp_client_settings lldp_client_settings;
+ /* Description - */
+ /* 0.0 - 12.31 */
+ struct tools_open_lldp_nb_cap lldp_nb_cap;
+ /* Description - */
+ /* 0.0 - 4.31 */
+ struct tools_open_lldp_nb_dcbx lldp_nb_dcbx;
};
/* Description - */
union tools_open_misc_structs MiscStructs;
};
-/* Description - */
-/* Size in bytes - 8 */
-struct tools_open_uint64 {
-/*---------------- DWORD[0] (Offset 0x0) ----------------*/
- /* Description - */
- /* 0.0 - 4.31 */
- u_int32_t hi;
-/*---------------- DWORD[1] (Offset 0x4) ----------------*/
- /* Description - */
- /* 4.0 - 8.31 */
- u_int32_t lo;
-};
-
/*================= PACK/UNPACK/PRINT FUNCTIONS ======================*/
/* tlv_type_dw */
int tools_open_global_type_size(void);
#define TOOLS_OPEN_GLOBAL_TYPE_SIZE (0x4)
void tools_open_global_type_dump(const struct tools_open_global_type *ptr_struct, FILE* file);
+/* tlv_type */
+void tools_open_tlv_type_pack(const union tools_open_tlv_type *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_tlv_type_unpack(union tools_open_tlv_type *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_tlv_type_print(const union tools_open_tlv_type *ptr_struct, FILE* file, int indent_level);
+int tools_open_tlv_type_size(void);
+#define TOOLS_OPEN_TLV_TYPE_SIZE (0x4)
+void tools_open_tlv_type_dump(const union tools_open_tlv_type *ptr_struct, FILE* file);
/* ts_entry */
void tools_open_ts_entry_pack(const struct tools_open_ts_entry *ptr_struct, u_int8_t* ptr_buff);
void tools_open_ts_entry_unpack(struct tools_open_ts_entry *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_fw_version_size(void);
#define TOOLS_OPEN_FW_VERSION_SIZE (0x8)
void tools_open_fw_version_dump(const struct tools_open_fw_version *ptr_struct, FILE* file);
-/* tlv_type */
-void tools_open_tlv_type_pack(const union tools_open_tlv_type *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_tlv_type_unpack(union tools_open_tlv_type *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_tlv_type_print(const union tools_open_tlv_type *ptr_struct, FILE* file, int indent_level);
-int tools_open_tlv_type_size(void);
-#define TOOLS_OPEN_TLV_TYPE_SIZE (0x4)
-void tools_open_tlv_type_dump(const union tools_open_tlv_type *ptr_struct, FILE* file);
/* pmdio_addr_data */
void tools_open_pmdio_addr_data_pack(const struct tools_open_pmdio_addr_data *ptr_struct, u_int8_t* ptr_buff);
void tools_open_pmdio_addr_data_unpack(struct tools_open_pmdio_addr_data *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_pmdio_addr_data_size(void);
#define TOOLS_OPEN_PMDIO_ADDR_DATA_SIZE (0x4)
void tools_open_pmdio_addr_data_dump(const struct tools_open_pmdio_addr_data *ptr_struct, FILE* file);
-/* timestamp */
-void tools_open_timestamp_pack(const struct tools_open_timestamp *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_timestamp_unpack(struct tools_open_timestamp *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_timestamp_print(const struct tools_open_timestamp *ptr_struct, FILE* file, int indent_level);
-int tools_open_timestamp_size(void);
-#define TOOLS_OPEN_TIMESTAMP_SIZE (0x10)
-void tools_open_timestamp_dump(const struct tools_open_timestamp *ptr_struct, FILE* file);
/* nv_hdr_fifth_gen */
void tools_open_nv_hdr_fifth_gen_pack(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, u_int8_t* ptr_buff);
void tools_open_nv_hdr_fifth_gen_unpack(struct tools_open_nv_hdr_fifth_gen *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_nv_hdr_fifth_gen_size(void);
#define TOOLS_OPEN_NV_HDR_FIFTH_GEN_SIZE (0xc)
void tools_open_nv_hdr_fifth_gen_dump(const struct tools_open_nv_hdr_fifth_gen *ptr_struct, FILE* file);
+/* timestamp */
+void tools_open_timestamp_pack(const struct tools_open_timestamp *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_timestamp_unpack(struct tools_open_timestamp *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_timestamp_print(const struct tools_open_timestamp *ptr_struct, FILE* file, int indent_level);
+int tools_open_timestamp_size(void);
+#define TOOLS_OPEN_TIMESTAMP_SIZE (0x10)
+void tools_open_timestamp_dump(const struct tools_open_timestamp *ptr_struct, FILE* file);
/* nv_hdr */
void tools_open_nv_hdr_pack(const struct tools_open_nv_hdr *ptr_struct, u_int8_t* ptr_buff);
void tools_open_nv_hdr_unpack(struct tools_open_nv_hdr *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_pmdic_size(void);
#define TOOLS_OPEN_PMDIC_SIZE (0xc)
void tools_open_pmdic_dump(const struct tools_open_pmdic *ptr_struct, FILE* file);
+/* mnvgn */
+void tools_open_mnvgn_pack(const struct tools_open_mnvgn *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_mnvgn_unpack(struct tools_open_mnvgn *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_mnvgn_print(const struct tools_open_mnvgn *ptr_struct, FILE* file, int indent_level);
+int tools_open_mnvgn_size(void);
+#define TOOLS_OPEN_MNVGN_SIZE (0x9c)
+void tools_open_mnvgn_dump(const struct tools_open_mnvgn *ptr_struct, FILE* file);
/* mvts */
void tools_open_mvts_pack(const struct tools_open_mvts *ptr_struct, u_int8_t* ptr_buff);
void tools_open_mvts_unpack(struct tools_open_mvts *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_mnv_cfg_size(void);
#define TOOLS_OPEN_MNV_CFG_SIZE (0x100)
void tools_open_mnv_cfg_dump(const union tools_open_mnv_cfg *ptr_struct, FILE* file);
+/* lldp_nb_dcbx */
+void tools_open_lldp_nb_dcbx_pack(const struct tools_open_lldp_nb_dcbx *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_lldp_nb_dcbx_unpack(struct tools_open_lldp_nb_dcbx *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_lldp_nb_dcbx_print(const struct tools_open_lldp_nb_dcbx *ptr_struct, FILE* file, int indent_level);
+int tools_open_lldp_nb_dcbx_size(void);
+#define TOOLS_OPEN_LLDP_NB_DCBX_SIZE (0x4)
+void tools_open_lldp_nb_dcbx_dump(const struct tools_open_lldp_nb_dcbx *ptr_struct, FILE* file);
+/* lldp_nb_cap */
+void tools_open_lldp_nb_cap_pack(const struct tools_open_lldp_nb_cap *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_lldp_nb_cap_unpack(struct tools_open_lldp_nb_cap *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_lldp_nb_cap_print(const struct tools_open_lldp_nb_cap *ptr_struct, FILE* file, int indent_level);
+int tools_open_lldp_nb_cap_size(void);
+#define TOOLS_OPEN_LLDP_NB_CAP_SIZE (0xc)
+void tools_open_lldp_nb_cap_dump(const struct tools_open_lldp_nb_cap *ptr_struct, FILE* file);
+/* lldp_client_settings */
+void tools_open_lldp_client_settings_pack(const struct tools_open_lldp_client_settings *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_lldp_client_settings_unpack(struct tools_open_lldp_client_settings *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_lldp_client_settings_print(const struct tools_open_lldp_client_settings *ptr_struct, FILE* file, int indent_level);
+int tools_open_lldp_client_settings_size(void);
+#define TOOLS_OPEN_LLDP_CLIENT_SETTINGS_SIZE (0xc)
+void tools_open_lldp_client_settings_dump(const struct tools_open_lldp_client_settings *ptr_struct, FILE* file);
+/* qos_cap */
+void tools_open_qos_cap_pack(const struct tools_open_qos_cap *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_qos_cap_unpack(struct tools_open_qos_cap *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_qos_cap_print(const struct tools_open_qos_cap *ptr_struct, FILE* file, int indent_level);
+int tools_open_qos_cap_size(void);
+#define TOOLS_OPEN_QOS_CAP_SIZE (0xc)
+void tools_open_qos_cap_dump(const struct tools_open_qos_cap *ptr_struct, FILE* file);
+/* qos */
+void tools_open_qos_pack(const struct tools_open_qos *ptr_struct, u_int8_t* ptr_buff);
+void tools_open_qos_unpack(struct tools_open_qos *ptr_struct, const u_int8_t* ptr_buff);
+void tools_open_qos_print(const struct tools_open_qos *ptr_struct, FILE* file, int indent_level);
+int tools_open_qos_size(void);
+#define TOOLS_OPEN_QOS_SIZE (0xc)
+void tools_open_qos_dump(const struct tools_open_qos *ptr_struct, FILE* file);
/* option_rom_capability */
void tools_open_option_rom_capability_pack(const struct tools_open_option_rom_capability *ptr_struct, u_int8_t* ptr_buff);
void tools_open_option_rom_capability_unpack(struct tools_open_option_rom_capability *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_external_port_size(void);
#define TOOLS_OPEN_EXTERNAL_PORT_SIZE (0x8)
void tools_open_external_port_dump(const struct tools_open_external_port *ptr_struct, FILE* file);
-/* lldp_nb_capability */
-void tools_open_lldp_nb_capability_pack(const struct tools_open_lldp_nb_capability *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_lldp_nb_capability_unpack(struct tools_open_lldp_nb_capability *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_lldp_nb_capability_print(const struct tools_open_lldp_nb_capability *ptr_struct, FILE* file, int indent_level);
-int tools_open_lldp_nb_capability_size(void);
-#define TOOLS_OPEN_LLDP_NB_CAPABILITY_SIZE (0x18)
-void tools_open_lldp_nb_capability_dump(const struct tools_open_lldp_nb_capability *ptr_struct, FILE* file);
/* lldp_nb */
void tools_open_lldp_nb_pack(const struct tools_open_lldp_nb *ptr_struct, u_int8_t* ptr_buff);
void tools_open_lldp_nb_unpack(struct tools_open_lldp_nb *ptr_struct, const u_int8_t* ptr_buff);
int tools_open_tools_open_size(void);
#define TOOLS_OPEN_TOOLS_OPEN_SIZE (0x100000)
void tools_open_tools_open_dump(const union tools_open_tools_open *ptr_struct, FILE* file);
-/* uint64 */
-void tools_open_uint64_pack(const struct tools_open_uint64 *ptr_struct, u_int8_t* ptr_buff);
-void tools_open_uint64_unpack(struct tools_open_uint64 *ptr_struct, const u_int8_t* ptr_buff);
-void tools_open_uint64_print(const struct tools_open_uint64 *ptr_struct, FILE* file, int indent_level);
-int tools_open_uint64_size(void);
-#define TOOLS_OPEN_UINT64_SIZE (0x8)
-void tools_open_uint64_dump(const struct tools_open_uint64 *ptr_struct, FILE* file);
#ifdef __cplusplus
#include <common/compatibility.h>
#include <dev_mgt/tools_dev_types.h>
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
#include <mtcr_ib_res_mgt.h>
#endif
{0xa24f8}, // hw_sem_addr
0, // vsec_sem_supported
},
+ {
+ DeviceConnectX5, // dev_id
+ {0xe250c}, // hw_sem_addr
+ 1, // vsec_sem_supported
+ },
};
#define MAX_SEMAPHORE_ADDRES 8
return TRM_STS_OK;
}
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
/************************************
* Function: release_vs_mad_semaphore()
************************************/
memset((*trm_p), 0, sizeof(struct trm_t));
(*trm_p)->mf = mf;
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
u_int32_t dev_flags = 0;
if (!mget_mdevs_flags(mf, &dev_flags)) {
if ((dev_flags & MDEVS_IB) && mib_semaphore_lock_is_supported(mf) == 1) {
case TRM_RES_ICMD:
if (trm->dev_sem_info->vsec_sem_supported && mget_vsec_supp(trm->mf)) {
return lock_vsec_semaphore(trm->mf, g_vsec_sem_addr[TRM_RES_ICMD], max_retries);
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
} else if (trm->dev_sem_info->vsec_sem_supported && (dev_type & MDEVS_IB)) {
return lock_vs_mad_semaphore(trm, TRM_RES_ICMD, max_retries);
#endif
case TRM_RES_FLASH_PROGRAMING:
if (trm->dev_sem_info->vsec_sem_supported && mget_vsec_supp(trm->mf)) {
return lock_vsec_semaphore(trm->mf, g_vsec_sem_addr[TRM_RES_FLASH_PROGRAMING], max_retries);
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
} else if (trm->dev_sem_info->vsec_sem_supported && (dev_type & MDEVS_IB)) {
return lock_vs_mad_semaphore(trm, TRM_RES_FLASH_PROGRAMING, max_retries);
#endif
case TRM_RES_ICMD:
if (trm->dev_sem_info->vsec_sem_supported && mget_vsec_supp(trm->mf)) {
return unlock_vsec_semaphore(trm->mf, g_vsec_sem_addr[TRM_RES_ICMD]);
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
} else if (trm->dev_sem_info->vsec_sem_supported && (dev_type & MDEVS_IB)) {
return release_vs_mad_semaphore(trm, TRM_RES_ICMD);
#endif
case TRM_RES_FLASH_PROGRAMING:
if (trm->dev_sem_info->vsec_sem_supported && mget_vsec_supp(trm->mf)) {
return unlock_vsec_semaphore(trm->mf, g_vsec_sem_addr[TRM_RES_FLASH_PROGRAMING]);
-#if !defined(__FreeBSD__) && !defined(UEFI_BUILD) && !defined(NO_INBAND)
+#if !defined(__FreeBSD__) && !defined(UEFI_BUILD)
} else if (trm->dev_sem_info->vsec_sem_supported && (dev_type & MDEVS_IB)) {
return release_vs_mad_semaphore(trm, TRM_RES_FLASH_PROGRAMING);
#endif