Skip to content

Commit

Permalink
GTI: fw-util: fix the exception when the kv file swb_nic_present is m…
Browse files Browse the repository at this point in the history
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: facebookexternal/openbmc.quanta#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
  • Loading branch information
JimmyHuang777 authored and facebook-github-bot committed Jul 19, 2024
1 parent 38d193b commit d380bd1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit d380bd1

Please sign in to comment.