Skip to content

Commit

Permalink
Merge branch 'master_devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGoldbergMellanox committed Feb 11, 2019
2 parents 305da35 + 2a7dbb7 commit 4f9b14a
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 22 deletions.
9 changes: 9 additions & 0 deletions flint/cmd_line_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ FlagMetaData::FlagMetaData()
_flags.push_back(new Flag("i", "image", 1));
_flags.push_back(new Flag("", "qq", 0));
_flags.push_back(new Flag("", "low_cpu", 0));
_flags.push_back(new Flag("", "next_boot_fw_ver", 0));
_flags.push_back(new Flag("", "nofs", 0));
_flags.push_back(new Flag("", "allow_psid_change", 0));
_flags.push_back(new Flag("", "allow_rom_change", 0));
Expand Down Expand Up @@ -508,6 +509,12 @@ void Flint::initCmdParser()
"When specified, cpu usage will be reduced. Run time might be increased\n"
"Commands affected: query");

AddOptions("next_boot_fw_ver",
' ',
"",
"When specified, only next boot fw version is fetched\n"
"Commands affected: query");

AddOptions("nofs",
' ',
"",
Expand Down Expand Up @@ -818,6 +825,8 @@ ParseStatus Flint::HandleOption(string name, string value)
_flintParams.skip_rom_query = true;
} else if (name == "low_cpu") {
_flintParams.low_cpu = true;
} else if (name == "next_boot_fw_ver") {
_flintParams.next_boot_fw_ver = true;
} else if (name == "nofs") {
_flintParams.nofs = true;
} else if (name == "allow_psid_change") {
Expand Down
2 changes: 2 additions & 0 deletions flint/flint_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ FlintParams::FlintParams()
blank_guids = false;
clear_semaphore = false;
quick_query = true; //should now be true by default
next_boot_fw_ver = false;
low_cpu = false;
skip_rom_query = false;
image_specified = false;
nofs = false;
Expand Down
1 change: 1 addition & 0 deletions flint/flint_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class FlintParams {
bool clear_semaphore;
bool quick_query;
bool low_cpu;
bool next_boot_fw_ver;
bool skip_rom_query;
bool image_specified;
string image;
Expand Down
17 changes: 17 additions & 0 deletions flint/subcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,9 @@ FlintStatus QuerySubCommand::printInfo(const fw_info_t& fwInfo, bool fullQuery)
snprintf(versionStr, 64, VERSION_FORMAT(fwInfo.fw_info.fw_ver[1]), fwInfo.fw_info.fw_ver[0], fwInfo.fw_info.fw_ver[1],
fwInfo.fw_info.fw_ver[2]);
printf("FW Version: %s\n", versionStr);
if (nextBootFwVer) {
return FLINT_SUCCESS;
}
if ((fwInfo.fw_info.running_fw_ver[0] || fwInfo.fw_info.running_fw_ver[1] || fwInfo.fw_info.running_fw_ver[2]) && \
(fwInfo.fw_info.running_fw_ver[0] != fwInfo.fw_info.fw_ver[0] || \
fwInfo.fw_info.running_fw_ver[1] != fwInfo.fw_info.fw_ver[1] || \
Expand All @@ -2246,6 +2249,17 @@ FlintStatus QuerySubCommand::printInfo(const fw_info_t& fwInfo, bool fullQuery)
printf("FW Version(Running): %s\n", versionStr);
}
}
else if (nextBootFwVer) {
char versionStr[64] = {0};
if (!fwInfo.fw_info.fw_ver[0] || fwInfo.fw_info.fw_ver[1] || fwInfo.fw_info.fw_ver[2]) {
snprintf(versionStr, 64, VERSION_FORMAT(fwInfo.fw_info.running_fw_ver[1]), fwInfo.fw_info.running_fw_ver[0], fwInfo.fw_info.running_fw_ver[1],
fwInfo.fw_info.running_fw_ver[2]);
printf("FW Version: %s\n", versionStr);
}
}
if (nextBootFwVer) {
return FLINT_SUCCESS;
}

if (fwInfo.fw_info.fw_rel_date[0] || fwInfo.fw_info.fw_rel_date[1] || fwInfo.fw_info.fw_rel_date[2]) {
printf("FW Release Date: %x.%x.%x\n", fwInfo.fw_info.fw_rel_date[0], fwInfo.fw_info.fw_rel_date[1], \
Expand Down Expand Up @@ -2396,6 +2410,9 @@ FlintStatus QuerySubCommand::executeCommand()
if (_flintParams.low_cpu) {
increase_poll_time = 1;
}
if (_flintParams.next_boot_fw_ver) {
nextBootFwVer = true;
}
if (preFwOps() == FLINT_FAILED) {
return FLINT_FAILED;
}
Expand Down
5 changes: 4 additions & 1 deletion fw_comps_mgr/fw_comps_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ void FwCompsMgr::extractRomInfo(tools_open_mgir *mgir, fwInfoT *fwQuery)
}
}

bool FwCompsMgr::queryFwInfo(fwInfoT *query)
bool FwCompsMgr::queryFwInfo(fwInfoT *query, bool next_boot_fw_ver)
{
if (!query) {
_lastError = FWCOMPS_BAD_PARAM;
Expand All @@ -962,6 +962,9 @@ bool FwCompsMgr::queryFwInfo(fwInfoT *query)
if (!getComponentVersion(FwComponent::COMPID_BOOT_IMG, false, &query->running_fw_version)) {
return false;
}
if (next_boot_fw_ver) {
return true;
}

if (query->running_fw_version.version_string_length &&
query->running_fw_version.version_string_length <= PRODUCT_VER_LEN) {
Expand Down
2 changes: 1 addition & 1 deletion fw_comps_mgr/fw_comps_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class FwCompsMgr {
bool pending,
component_version_st *cmpVer);

bool queryFwInfo(fwInfoT *query);
bool queryFwInfo(fwInfoT *query, bool next_boot_fw_ver = false);

bool forceRelease();
fw_comps_error_t getLastError() { return _lastError;};
Expand Down
2 changes: 1 addition & 1 deletion mlxfwops/lib/fs3_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ bool Fs3Operations::VerifyTOC(u_int32_t dtoc_addr, bool &bad_signature, VerifyCa
}
// 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]));
u_int8_t *buff = (u_int8_t *)(buffv.size() ? (&(buffv[0])) : NULL);
if (show_itoc) {
cibfw_itoc_entry_dump(&toc_entry, stdout);
if (!DumpFs3CRCCheck(toc_entry.type, phys_addr, entry_size_in_bytes, 0, 0, true, verifyCallBackFunc)) {
Expand Down
43 changes: 26 additions & 17 deletions mlxfwops/lib/fs4_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ bool Fs4Operations::verifyTocEntries(u_int32_t tocAddr, bool show_itoc, bool isD

do {
// Read toc entry
if (nextBootFwVer) {
section_index = 8;
}
entryAddr = tocAddr + TOC_HEADER_SIZE + section_index * TOC_ENTRY_SIZE;
READBUF((*_ioAccess), entryAddr, entryBuffer, TOC_ENTRY_SIZE, "TOC Entry");
Fs3UpdateImgCache(entryBuffer, entryAddr, TOC_ENTRY_SIZE);
Expand Down Expand Up @@ -473,7 +476,9 @@ bool Fs4Operations::verifyTocEntries(u_int32_t tocAddr, bool show_itoc, bool isD
entryBuffer, CX5FW_ITOC_ENTRY_SIZE);

}

if (nextBootFwVer) {
break;
}
section_index++;
} while (tocEntry.type != FS3_END);

Expand Down Expand Up @@ -522,39 +527,43 @@ bool Fs4Operations::FsVerifyAux(VerifyCallBack verifyCallBackFunc, bool show_ito
if (!getHWPtrs(verifyCallBackFunc)) {
return false;
}

if (!verifyToolsArea(verifyCallBackFunc)) {
return false;
}
if (!nextBootFwVer) {
if (!verifyToolsArea(verifyCallBackFunc)) {
return false;
}

// Update image cache till before boot2 header:
READALLOCBUF((*_ioAccess), _fwImgInfo.imgStart, buff, _boot2_ptr, "All Before Boot2");
Fs3UpdateImgCache(buff, 0, _boot2_ptr);
free(buff);
READALLOCBUF((*_ioAccess), _fwImgInfo.imgStart, buff, _boot2_ptr, "All Before Boot2");
Fs3UpdateImgCache(buff, 0, _boot2_ptr);
free(buff);

_ioAccess->set_address_convertor(_fwImgInfo.cntxLog2ChunkSize, _fwImgInfo.imgStart != 0);
_ioAccess->set_address_convertor(_fwImgInfo.cntxLog2ChunkSize, _fwImgInfo.imgStart != 0);

// Get BOOT2 -Get Only bootSize if quickQuery == true else read and check CRC of boot2 section as well
FS3_CHECKB2(0, _boot2_ptr, !queryOptions.quickQuery, PRE_CRC_OUTPUT, verifyCallBackFunc);
FS3_CHECKB2(0, _boot2_ptr, !queryOptions.quickQuery, PRE_CRC_OUTPUT, verifyCallBackFunc);

_fs4ImgInfo.firstItocArrayIsEmpty = false;
_fs4ImgInfo.itocArr.tocArrayAddr = _itoc_ptr;
_fs4ImgInfo.firstItocArrayIsEmpty = false;
_fs4ImgInfo.itocArr.tocArrayAddr = _itoc_ptr;

/*printf("\n-D-_ioAccess size=0x%x\n", _ioAccess->get_size());
printf("\n-D-dtoc_ptr=0x%x\n", dtoc_ptr);*/

if (!verifyTocHeader(_itoc_ptr, false, verifyCallBackFunc)) {
_itoc_ptr += FS4_DEFAULT_SECTOR_SIZE;
_fs4ImgInfo.itocArr.tocArrayAddr = _itoc_ptr;
_fs4ImgInfo.firstItocArrayIsEmpty = true;
if (!verifyTocHeader(_itoc_ptr, false, verifyCallBackFunc)) {
return errmsg(MLXFW_NO_VALID_ITOC_ERR, "No valid ITOC Header was found.");
_itoc_ptr += FS4_DEFAULT_SECTOR_SIZE;
_fs4ImgInfo.itocArr.tocArrayAddr = _itoc_ptr;
_fs4ImgInfo.firstItocArrayIsEmpty = true;
if (!verifyTocHeader(_itoc_ptr, false, verifyCallBackFunc)) {
return errmsg(MLXFW_NO_VALID_ITOC_ERR, "No valid ITOC Header was found.");
}
}
}
if (!verifyTocEntries(_itoc_ptr, show_itoc, false,
queryOptions, verifyCallBackFunc)) {
return false;
}
if (nextBootFwVer) {
return true;
}
if (ignoreDToc) {
return true;
}
Expand Down
5 changes: 4 additions & 1 deletion mlxfwops/lib/fsctrl_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void extractFwBuildTime(u_int16_t *fwRelDate, u_int32_t buildTime)
bool FsCtrlOperations::FsIntQuery()
{
fwInfoT fwQery;
if (!_fwCompsAccess->queryFwInfo(&fwQery)) {
if (!_fwCompsAccess->queryFwInfo(&fwQery, nextBootFwVer)) {
return errmsg(FwCompsErrToFwOpsErr(_fwCompsAccess->getLastError()), "Failed to query the FW - Err[%d] - %s", _fwCompsAccess->getLastError(), _fwCompsAccess->getLastErrMsg());
}
if (fwQery.pending_fw_valid) {
Expand All @@ -111,6 +111,9 @@ bool FsCtrlOperations::FsIntQuery()
if (fwQery.running_fw_version.version_string_length) {
strcpy(_fwImgInfo.ext_info.product_ver, fwQery.product_ver);
}
if (nextBootFwVer) {
return true;
}

_fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_mac.uid = fwQery.base_mac.uid;
_fsCtrlImgInfo.fs3_uids_info.cx4_uids.base_mac.num_allocated = fwQery.base_mac.num_allocated;
Expand Down
2 changes: 2 additions & 0 deletions mlxfwops/lib/fw_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ typedef fw_ver_info_t FwVerInfo;

typedef int (*PrintCallBackAdv) (int completion, char *str);

extern bool nextBootFwVer;

class MLXFWOP_API FwOperations : public FlintErrMsg {


Expand Down
2 changes: 2 additions & 0 deletions mlxfwops/lib/mlxfwops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

#define ERR_BUFF_SIZE 1024

bool nextBootFwVer = false;


MLXFWOP_API int MLXFWOPCALL mlxfw_open_device_adv(mlxfwops_t **mlxfwops_p, fwops_params_t* params)
{
Expand Down
5 changes: 4 additions & 1 deletion mtcr_ul/mtcr_ul_icmd_cif.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static int go(mfile *mf)
DBG_PRINTF("Busy-bit raised. Waiting for command to exec...\n");
char *icmd_sleep_env;
if (increase_poll_time) {
icmd_sleep_env = "70\0";
icmd_sleep_env = "10\0";
}
else {
icmd_sleep_env = getenv("MFT_CMD_SLEEP");
Expand Down Expand Up @@ -307,6 +307,9 @@ static int go(mfile *mf)
wait *= 2; // exponential backoff - up-to 8ms between polls
}
}
if(increase_poll_time) {
msleep(10);
}
} else {
if (i > 5) {
// after some iteration put sleeps bwtween busy-wait
Expand Down

0 comments on commit 4f9b14a

Please sign in to comment.