Date: Fri, 7 Feb 2014 07:31:55 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r261580 - stable/9/sys/dev/usb Message-ID: <201402070731.s177VtVG084591@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Feb 7 07:31:54 2014 New Revision: 261580 URL: http://svnweb.freebsd.org/changeset/base/261580 Log: MFC r244535, r245995, r261505 and r258961: - Use a boundary of zero, hence a PAGE_SIZE boundary is implied by all memory allocations. - Fix an external compiler warning about write-only assigned variable. Modified: stable/9/sys/dev/usb/usb_busdma.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb_busdma.c ============================================================================== --- stable/9/sys/dev/usb/usb_busdma.c Fri Feb 7 07:18:52 2014 (r261579) +++ stable/9/sys/dev/usb/usb_busdma.c Fri Feb 7 07:31:54 2014 (r261580) @@ -211,9 +211,7 @@ usbd_m_copy_in(struct usb_page_cache *ca struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len) { struct usb_m_copy_in_arg arg = {cache, dst_offset}; - int error; - - error = m_apply(m, src_offset, src_len, &usbd_m_copy_in_cb, &arg); + (void) m_apply(m, src_offset, src_len, &usbd_m_copy_in_cb, &arg); } #endif @@ -358,8 +356,7 @@ usb_dma_tag_create(struct usb_dma_tag *u if (bus_dma_tag_create ( /* parent */ udt->tag_parent->tag, /* alignment */ align, - /* boundary */ (align == 1) ? - USB_PAGE_SIZE : 0, + /* boundary */ 0, /* lowaddr */ (2ULL << (udt->tag_parent->dma_bits - 1)) - 1, /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, @@ -418,6 +415,7 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ struct usb_page_cache *pc; struct usb_page *pg; usb_size_t rem; + bus_size_t off; uint8_t owned; pc = arg; @@ -433,12 +431,13 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ if (error) { goto done; } + + off = 0; pg = pc->page_start; pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1); rem = segs->ds_addr & (USB_PAGE_SIZE - 1); pc->page_offset_buf = rem; pc->page_offset_end += rem; - nseg--; #ifdef USB_DEBUG if (rem != (USB_P2U(pc->buffer) & (USB_PAGE_SIZE - 1))) { /* @@ -449,11 +448,19 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ goto done; } #endif - while (nseg > 0) { - nseg--; - segs++; + while (pc->ismultiseg) { + off += USB_PAGE_SIZE; + if (off >= (segs->ds_len + rem)) { + /* page crossing */ + nseg--; + segs++; + off = 0; + rem = 0; + if (nseg == 0) + break; + } pg++; - pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1); + pg->physaddr = (segs->ds_addr + off) & ~(USB_PAGE_SIZE - 1); } done:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402070731.s177VtVG084591>