From 9d903cf258c7152aeb91ccb923233df9c9017c86 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 21 May 2007 21:43:51 +0000 Subject: Make iommu_dvmamap_unload cleanup properly. --- sys/arch/hppa/dev/astro.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/arch/hppa/dev/astro.c b/sys/arch/hppa/dev/astro.c index b163f89edf1..3a15fb6ffad 100644 --- a/sys/arch/hppa/dev/astro.c +++ b/sys/arch/hppa/dev/astro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: astro.c,v 1.1 2007/05/21 19:33:09 kettenis Exp $ */ +/* $OpenBSD: astro.c,v 1.2 2007/05/21 21:43:50 kettenis Exp $ */ /* * Copyright (c) 2007 Mark Kettenis @@ -310,7 +310,7 @@ iommu_dvmamap_destroy(void *v, bus_dmamap_t map) * map to be unloaded before it is destroyed. */ if (map->dm_nsegs) - bus_dmamap_unload(sc->sc_dmat, map); + iommu_dvmamap_unload(sc, map); if (map->_dm_cookie) iommu_iomap_destroy(map->_dm_cookie); @@ -439,15 +439,15 @@ iommu_dvmamap_unload(void *v, bus_dmamap_t map) struct iommu_page_entry *e; int err, i, s; - bus_dmamap_unload(sc->sc_dmat, map); - - /* XXX */ - if (ims->ims_dvmasize == 0) - return; - + /* Remove the IOMMU entries. */ for (i = 0, e = ipm->ipm_map; i < ipm->ipm_pagecnt; ++i, ++e) iommu_remove(sc, e->ipe_dva); + /* Clear the iomap. */ + iommu_iomap_clear_pages(ims); + + bus_dmamap_unload(sc->sc_dmat, map); + s = splhigh(); err = extent_free(sc->sc_dvmamap, ims->ims_dvmastart, ims->ims_dvmasize, EX_NOWAIT); -- cgit v1.2.3