Date: Fri, 14 Nov 2008 09:15:17 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: Perforce Change Reviews <perforce@freebsd.org> Cc: Alexander Motin <mav@freebsd.org> Subject: Re: PERFORCE change 152649 for review - busdma problem Message-ID: <200811140915.18846.hselasky@c2i.net> In-Reply-To: <200811080910.mA89AgTZ048172@repoman.freebsd.org> References: <200811080910.mA89AgTZ048172@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Alexander, I am going to revert this patch and suggest a new one. I am not sure how to best implement it, but will it be Ok if I make the offset adjustment only for alignment <= 1 byte ? Is there any documentation or specification that needs to be updated? --HPS On Saturday 08 November 2008, Hans Petter Selasky wrote: > http://perforce.freebsd.org/chv.cgi?CH=152649 > > Change 152649 by hselasky@hselasky_laptop001 on 2008/11/08 09:09:50 > > > Fix a serious BUSDMA bug: The initial virtual page offset is > not retained on the bounce pages, which is what the EHCI and > the OHCI expects. > > Affected files ... > > .. //depot/projects/usb/src/sys/i386/i386/busdma_machdep.c#10 edit > > Differences ... > > ==== //depot/projects/usb/src/sys/i386/i386/busdma_machdep.c#10 (text+ko) > ==== > > @@ -938,7 +938,8 @@ > if (op & BUS_DMASYNC_PREWRITE) { > while (bpage != NULL) { > bcopy((void *)bpage->datavaddr, > - (void *)bpage->vaddr, > + (void *)(bpage->vaddr + > + ((vm_offset_t)(bpage->datavaddr) & PAGE_MASK)), > bpage->datacount); > bpage = STAILQ_NEXT(bpage, links); > } > @@ -947,7 +948,8 @@ > > if (op & BUS_DMASYNC_POSTREAD) { > while (bpage != NULL) { > - bcopy((void *)bpage->vaddr, > + bcopy((void *)(bpage->vaddr + > + ((vm_offset_t)(bpage->datavaddr) & PAGE_MASK)), > (void *)bpage->datavaddr, > bpage->datacount); > bpage = STAILQ_NEXT(bpage, links); > @@ -1149,7 +1151,7 @@ > bpage->datavaddr = vaddr; > bpage->datacount = size; > STAILQ_INSERT_TAIL(&(map->bpages), bpage, links); > - return (bpage->busaddr); > + return (bpage->busaddr + ((vm_offset_t)vaddr & PAGE_MASK)); > } > > static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811140915.18846.hselasky>