From d380bd1c8bd04f9461df8414f51b69a40798d690 Mon Sep 17 00:00:00 2001 From: JimmyHuang777 Date: Fri, 19 Jul 2024 11:12:31 -0700 Subject: [PATCH] =?UTF-8?q?GTI:=20fw-util:=20fix=20the=20exception=20when?= =?UTF-8?q?=20the=20kv=20file=20swb=5Fnic=5Fpresent=20is=20m=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: …issing # Description The kv file "swb_nic_present" was writed when swb bic is ready. Considering the manufacturing w/o swb tray, we should init the kv file to avoid the exception. X-link: https://github.com/facebookexternal/openbmc.quanta/pull/4377 Test Plan: Build and test pass on GTI system // Remove the kv file and check fw-util is work root@bmc-oob:~# rm /tmp/cache_store/swb_nic_present Reviewed By: amithash Differential Revision: D59952577 fbshipit-source-id: 5178f91857961d63a009c899ef11dc14389f728d --- .../fw-util/files/swb_cover.cpp | 24 +++++++++++-------- .../plat-utils/files/setup-common-dev.sh | 6 +++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/meta-facebook/meta-grandteton/meta-inspirationpoint/recipes-inspirationpoint/fw-util/files/swb_cover.cpp b/meta-facebook/meta-grandteton/meta-inspirationpoint/recipes-inspirationpoint/fw-util/files/swb_cover.cpp index c5c9e95cd61e..305f2584316d 100644 --- a/meta-facebook/meta-grandteton/meta-inspirationpoint/recipes-inspirationpoint/fw-util/files/swb_cover.cpp +++ b/meta-facebook/meta-grandteton/meta-inspirationpoint/recipes-inspirationpoint/fw-util/files/swb_cover.cpp @@ -5,16 +5,20 @@ SwbBicFwRecoveryComponent bic_recovery("swb", "bic_recovery", 3, 0x0A, BIC_COMP) class swb_cover_config { public: swb_cover_config() { - std::string present = kv::get("swb_nic_present", kv::region::temp); - if (present == "0") { - static SwbPLDMNicComponent swb_nic0("swb", "swb_nic0", "SWB_NIC0", 0x10, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic1("swb", "swb_nic1", "SWB_NIC1", 0x11, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic2("swb", "swb_nic2", "SWB_NIC2", 0x12, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic3("swb", "swb_nic3", "SWB_NIC3", 0x13, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic4("swb", "swb_nic4", "SWB_NIC4", 0x14, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic5("swb", "swb_nic5", "SWB_NIC5", 0x15, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic6("swb", "swb_nic6", "SWB_NIC6", 0x16, SWB_BUS_ID); - static SwbPLDMNicComponent swb_nic7("swb", "swb_nic7", "SWB_NIC7", 0x17, SWB_BUS_ID); + try { + std::string present = kv::get("swb_nic_present", kv::region::temp); + if (present == "0") { + static SwbPLDMNicComponent swb_nic0("swb", "swb_nic0", "SWB_NIC0", 0x10, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic1("swb", "swb_nic1", "SWB_NIC1", 0x11, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic2("swb", "swb_nic2", "SWB_NIC2", 0x12, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic3("swb", "swb_nic3", "SWB_NIC3", 0x13, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic4("swb", "swb_nic4", "SWB_NIC4", 0x14, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic5("swb", "swb_nic5", "SWB_NIC5", 0x15, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic6("swb", "swb_nic6", "SWB_NIC6", 0x16, SWB_BUS_ID); + static SwbPLDMNicComponent swb_nic7("swb", "swb_nic7", "SWB_NIC7", 0x17, SWB_BUS_ID); + } + } + catch (const std::exception& err) { } } }; diff --git a/meta-facebook/meta-grandteton/recipes-grandteton/plat-utils/files/setup-common-dev.sh b/meta-facebook/meta-grandteton/recipes-grandteton/plat-utils/files/setup-common-dev.sh index 90e0f25a4302..f194cb8fc945 100755 --- a/meta-facebook/meta-grandteton/recipes-grandteton/plat-utils/files/setup-common-dev.sh +++ b/meta-facebook/meta-grandteton/recipes-grandteton/plat-utils/files/setup-common-dev.sh @@ -260,9 +260,11 @@ if [ "$bic_ready" -eq 0 ]; then break fi done +fi - # SWB NIC - kv set swb_nic_present 1 +# SWB NIC +kv set swb_nic_present 1 +if [ $(gpio_get SWB_HSC_PWRGD_ISO_R) -eq 1 ]; then for i in {8..15} do output=$(i2cget -y -f 32 0x13 $i | tr -d ' \t\n\r')