Date: Tue, 11 Apr 2006 06:16:46 GMT From: John-Mark Gurney <jmg@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94972 for review Message-ID: <200604110616.k3B6GkUx033605@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94972 Change 94972 by jmg@jmg_carbon-60 on 2006/04/11 06:15:49 remove duplicate define.. use _getmap to get the ra of the mapping for syncing.. we need to store the offset so we can index into the page... Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hviommu.c#9 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hviommu.c#9 (text+ko) ==== @@ -368,6 +368,7 @@ dvmend = dvmaddr + size; if (dvmend <= BDR_END(r)) { r->dr_used = dvmend - BDR_START(r); + r->dr_offset = voffs; return (dvmaddr); } } @@ -529,8 +530,6 @@ } #define IOTTE_CNT 64 -#define HVIOMMU_TSBID(him, dvmaddr) \ - (((dvmaddr) - (him)->him_dvmabase) >> IO_PAGE_SHIFT) static void hviommu_map_pages(struct hviommu *him, bus_addr_t dvmaddr, uint64_t *iottes, pages_t iottecnt) @@ -547,7 +546,7 @@ /* push tte's */ cntdone = 0; while (cntdone < iottecnt) { - if ((err = hvio_iommu_map(him->him_handle, HVIOMMU_TSBID(him, + if ((err = hvio_iommu_map(him->him_handle, VA_TO_TSBID(him, dvmaddr), iottecnt, PCI_MAP_ATTR_READ | PCI_MAP_ATTR_WRITE, (io_page_list_t *)pmap_kextract((vm_offset_t)&iotteaddr[0]), &mapcnt))) { @@ -884,7 +883,9 @@ vm_offset_t va; vm_size_t len; size_t synced; + bus_addr_t ra; uint64_t err; + uint32_t ioattr; io_sync_direction_t iodir; if ((map->dm_flags & DMF_LOADED) == 0) @@ -900,11 +901,17 @@ membar(Sync); HIM_LOCK(him); SLIST_FOREACH(r, &map->dm_reslist, dr_link) { - va = (vm_offset_t)BDR_START(r); + va = (vm_offset_t)BDR_START(r) + r->dr_offset; len = r->dr_used; while (len > 0) { - if ((err = hvio_dma_sync(him->him_handle, va, len, iodir, - &synced))) { + if ((err = hvio_iommu_getmap(him->him_handle, + VA_TO_TSBID(him, va), &ra, &ioattr))) { + printf("failed to _getmap: err: %ld, handle: %#lx, tsbid: %#lx", err, him->him_handle, VA_TO_TSBID(him, va)); + continue; + } + if ((err = hvio_dma_sync(him->him_handle, ra, + min(len, (trunc_io_page(ra) + IO_PAGE_SIZE) - ra), + iodir, &synced))) { printf("failed to dma_sync: err: %ld, handle: %#lx, va: %#lx, len: %#lx, dir: %d\n", err, him->him_handle, va, len, iodir); synced = 1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604110616.k3B6GkUx033605>