summaryrefslogtreecommitdiff
path: root/meta-google
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2022-02-08 01:15:07 +0300
committerWilliam A. Kennington III <wak@google.com>2022-02-08 02:28:03 +0300
commit8dcd45907e4df4d49697d1d524170e55b6ee4b46 (patch)
tree711c3011b44e2bffbdd4ab4c71b4113a1d54a963 /meta-google
parentff916a657cf783752f0df985306f305f15cdb277 (diff)
downloadopenbmc-8dcd45907e4df4d49697d1d524170e55b6ee4b46.tar.xz
meta-google: ipmi-fru-sh: Fix word width detection
Sometimes, the first value returned is not stable and not what is expected from the FRU. If we perform multiple queries we can get a stable reading and correctly detect word length. Change-Id: I73a88870bef231566f0249d0629c751be6a5002c Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google')
-rw-r--r--meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh b/meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh
index d02eeab478..29b8e7f25e 100644
--- a/meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh
+++ b/meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh
@@ -80,8 +80,19 @@ ipmi_fru_device_alloc() {
IPMI_FRU_EEPROM_FILE["$idx"]=/etc/fru/baseboard.fru.bin
else
local offset_bw=offset_2bw
- local rsp
- rsp=$(i2ctransfer -f -y ${busaddr[0]} $(offset_1bw ${busaddr[1]} 0) r1) || return
+ local last=0
+ local rsp=0x100
+ local start=$SECONDS
+ # Query the FRU multiple times to ensure the return value is stabilized
+ while (( last != rsp )); do
+ # It shouldn't take > 0.1s to stabilize, limit instability
+ if (( SECONDS - start >= 10 )); then
+ echo "Timed out determining offset for ${busaddr[0]}@${busaddr[1]}" >&2
+ return 1
+ fi
+ last=$rsp
+ rsp=$(i2ctransfer -f -y ${busaddr[0]} $(offset_1bw ${busaddr[1]} 0) r1) || return
+ done
# FRUs never start with 0xff bytes, so we can figure out addressing mode
if (( rsp != 0xff )); then
offset_bw=offset_1bw