[PATCH 3/6] ntb_hw_switchtec: AND with the part_map for a valid tpart_vec

From: Kelvin Cao
Date: Thu Dec 23 2021 - 20:25:20 EST


From: Jeremy Pallotta <jmpallotta@xxxxxxxxx>

Some firmware versions return 1 in the target partition vector for
undefined partitions. AND with the part_map to give a valid tpart_vec.

Signed-off-by: Jeremy Pallotta <jmpallotta@xxxxxxxxx>
Signed-off-by: Kelvin Cao <kelvin.cao@xxxxxxxxxxxxx>
---
drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
index ec9cb6c81eda..25302a384a7d 100644
--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
+++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
@@ -858,6 +858,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev)
tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low);

part_map = ioread64(&sndev->mmio_ntb->ep_map);
+ tpart_vec &= part_map;
part_map &= ~(1 << sndev->self_partition);

if (!tpart_vec) {
--
2.25.1