Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641876 > unrolled thread

[PATCH 2/2] switchtec: fix minor bug with partition id register

Started byLogan Gunthorpe <logang@deltatee.com>
First post2017-05-15 18:50 +0200
Last post2017-05-15 18:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] switchtec: fix minor bug with partition id register Logan Gunthorpe <logang@deltatee.com> - 2017-05-15 18:50 +0200

#1641876 — [PATCH 2/2] switchtec: fix minor bug with partition id register

FromLogan Gunthorpe <logang@deltatee.com>
Date2017-05-15 18:50 +0200
Subject[PATCH 2/2] switchtec: fix minor bug with partition id register
Message-ID<tHrm1-29A-1@gated-at.bofh.it>
When a switch endpoind is configured without NTB the mmio_ntb registers
will read all zeros. However, in corner case configurations where the
partition ID is not zero and NTB is not enabled then the code will have
the wrong partition ID and this causes the driver to use the wrong
set of drivers. To fix this we simply take the partition ID from the
system info region.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reported-by: Dingbao Chen <dingbao.chen@microsemi.com>
---
 drivers/pci/switch/switchtec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index abaa227a..f6a6340 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -1441,12 +1441,15 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
 	stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET;
 	stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET;
 	stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET;
-	stdev->partition = ioread8(&stdev->mmio_ntb->partition_id);
+	stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id);
 	stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count);
 	stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET;
 	stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition];
 	stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET;
 
+	if (stdev->partition_count < 1)
+		stdev->partition_count = 1;
+
 	init_pff(stdev);
 
 	pci_set_drvdata(pdev, stdev);
-- 
2.1.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web