scripts/get-pmr: Return failure if neither CMB/PMR buf is found

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I7d7b12ee7c5b081bda52659706e9aed8cefbd5a4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14820
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Michal Berger 2022-10-02 13:10:56 +02:00 committed by Tomasz Zawadzki
parent 4978c4fe32
commit 29756d4c69

View File

@ -61,7 +61,13 @@ info() {
bar4=$(get_bar "$dev" 0x20)
bar5=$(get_bar "$dev" 0x24)
# QEMU uses 64-bit BARs
# QEMU uses 64-bit BARs. If there is no CMB or PMR present, report
# that to the user and signal failure.
if ((!(bar2 & 1 << 2) && !(bar4 & 1 << 2))); then
echo "No CMB|PMR present under $dev" >&2
return 1
fi
if ((bar2 & 1 << 2)); then
bar_type2=pmr
if [[ -e $nvme/cmb ]]; then
@ -70,14 +76,16 @@ info() {
base_addr2=$(((bar2 & ~0xf) + (bar3 << 32)))
print_info "$bar2" "$base_addr2" "$bar_type2"
fi
# QEMU uses 64-bit BARs
if ((bar4 & 1 << 2)); then
base_addr4=$(((bar4 & ~0xf) + (bar5 << 32)))
print_info "$bar4" "$base_addr4" pmr
fi
}
missing_buf=0
for nvme in /sys/class/nvme/nvme*; do
pci=$(readlink -f "$nvme/device") pci=${pci##*/}
info "$pci"
info "$pci" || ((++missing_buf))
done
((missing_buf == 0))