svn commit: r351917 - stable/11/sys/dev/pci

Warner Losh imp at FreeBSD.org
Fri Sep 6 00:06:55 UTC 2019


Author: imp
Date: Fri Sep  6 00:06:55 2019
New Revision: 351917
URL: https://svnweb.freebsd.org/changeset/base/351917

Log:
  MFC r349845:
  
    Work around devices which return all zeros for reads of existing MSI-X table
    VCTRL registers.
  
  PR: 211713

Modified:
  stable/11/sys/dev/pci/pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/pci/pci.c
==============================================================================
--- stable/11/sys/dev/pci/pci.c	Fri Sep  6 00:00:13 2019	(r351916)
+++ stable/11/sys/dev/pci/pci.c	Fri Sep  6 00:06:55 2019	(r351917)
@@ -1656,10 +1656,13 @@ pci_mask_msix(device_t dev, u_int index)
 	KASSERT(msix->msix_msgnum > index, ("bogus index"));
 	offset = msix->msix_table_offset + index * 16 + 12;
 	val = bus_read_4(msix->msix_table_res, offset);
-	if (!(val & PCIM_MSIX_VCTRL_MASK)) {
-		val |= PCIM_MSIX_VCTRL_MASK;
-		bus_write_4(msix->msix_table_res, offset, val);
-	}
+	val |= PCIM_MSIX_VCTRL_MASK;
+
+	/*
+	 * Some devices (e.g. Samsung PM961) do not support reads of this
+	 * register, so always write the new value.
+	 */
+	bus_write_4(msix->msix_table_res, offset, val);
 }
 
 void
@@ -1672,10 +1675,13 @@ pci_unmask_msix(device_t dev, u_int index)
 	KASSERT(msix->msix_table_len > index, ("bogus index"));
 	offset = msix->msix_table_offset + index * 16 + 12;
 	val = bus_read_4(msix->msix_table_res, offset);
-	if (val & PCIM_MSIX_VCTRL_MASK) {
-		val &= ~PCIM_MSIX_VCTRL_MASK;
-		bus_write_4(msix->msix_table_res, offset, val);
-	}
+	val &= ~PCIM_MSIX_VCTRL_MASK;
+
+	/*
+	 * Some devices (e.g. Samsung PM961) do not support reads of this
+	 * register, so always write the new value.
+	 */
+	bus_write_4(msix->msix_table_res, offset, val);
 }
 
 int


More information about the svn-src-all mailing list