Author: jhibbits
Date: Sun Nov 10 04:24:36 2019
New Revision: 354584
URL: https://svnweb.freebsd.org/changeset/base/354584

Log:
  powerpc64/powernv: Use OPAL call for non-POWER8 PCI TCE reset
  
  According to the OPAL documentation, only the POWER8 (PHB3) should use
  the register write TCE reset method.  All others should use the OPAL
  call.
  
  On POWER9 the call is semantically identical to the register write, with
  a wait for completion.

Modified:
  head/sys/powerpc/powernv/opal.h
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal.h
==============================================================================
--- head/sys/powerpc/powernv/opal.h     Sun Nov 10 03:45:16 2019        
(r354583)
+++ head/sys/powerpc/powernv/opal.h     Sun Nov 10 04:24:36 2019        
(r354584)
@@ -129,6 +129,11 @@ int opal_call(uint64_t token, ...);
 #define        OPAL_IGNORE_RID_FUNC_NUMBER     0
 #define        OPAL_COMPARE_RID_FUNC_NUMBER    1
 
+/* For OPAL_PCI_TCE_KILL */
+#define        OPAL_PCI_TCE_KILL_PAGE          0
+#define        OPAL_PCI_TCE_KILL_PE            1
+#define        OPAL_PCI_TCE_KILL_ALL           2
+
 #define        OPAL_SUCCESS                    0
 #define        OPAL_PARAMETER                  -1
 #define        OPAL_BUSY                       -2

Modified: head/sys/powerpc/powernv/opal_pci.c
==============================================================================
--- head/sys/powerpc/powernv/opal_pci.c Sun Nov 10 03:45:16 2019        
(r354583)
+++ head/sys/powerpc/powernv/opal_pci.c Sun Nov 10 04:24:36 2019        
(r354584)
@@ -409,10 +409,12 @@ opalpci_attach(device_t dev)
 
        /*
         * Invalidate all previous TCE entries.
-        *
-        * TODO: add support for other PHBs than PHB3
         */
-       pci_phb3_tce_invalidate_entire(sc);
+       if (ofw_bus_is_compatible(dev, "power8-pciex"))
+               pci_phb3_tce_invalidate_entire(sc);
+       else
+               opal_call(OPAL_PCI_TCE_KILL, sc->phb_id, OPAL_PCI_TCE_KILL_ALL,
+                   OPAL_PCI_DEFAULT_PE, 0, 0, 0);
 
        /*
         * Get MSI properties
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to