Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Nov 2013 20:11:21 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r257897 - projects/altix2/sys/kern
Message-ID:  <201311092011.rA9KBLLK022449@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sat Nov  9 20:11:21 2013
New Revision: 257897
URL: http://svnweb.freebsd.org/changeset/base/257897

Log:
  Fix busdma_md_unload() to recursively call devices up the
  device tree. When we map we start at the root and recurse
  down to the leaf device. When we unmap, we go the reverse
  direction.
  
  This fix actually has us call the unmap function of the
  PCI bridge, which means we now free up I/O MMU mappings.
  
  This and previous few commits were all done from the Altix
  itself. Looking good...

Modified:
  projects/altix2/sys/kern/subr_busdma.c

Modified: projects/altix2/sys/kern/subr_busdma.c
==============================================================================
--- projects/altix2/sys/kern/subr_busdma.c	Sat Nov  9 20:09:02 2013	(r257896)
+++ projects/altix2/sys/kern/subr_busdma.c	Sat Nov  9 20:11:21 2013	(r257897)
@@ -445,10 +445,15 @@ _busdma_iommu_unmap(device_t dev, struct
 	device_t bus;
 	int error;
 
-	bus = device_get_parent(dev);
 	error = 0;
 	TAILQ_FOREACH(seg, &md->md_seg, mds_chain) {
-		error = BUSDMA_IOMMU_UNMAP(bus, dev, md, seg->mds_idx);
+		bus = device_get_parent(dev);
+		while (bus != root_bus) {
+			error = BUSDMA_IOMMU_UNMAP(bus, dev, md, seg->mds_idx);
+			if (error)
+				break;
+			bus = device_get_parent(bus);
+		}
 		if (error)
 			break;
 	}



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