Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Nov 2019 04:24:36 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354584 - head/sys/powerpc/powernv
Message-ID:  <201911100424.xAA4OaPb083810@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911100424.xAA4OaPb083810>