Date: Sun, 27 Jan 2013 18:01:03 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245995 - head/sys/dev/usb Message-ID: <201301271801.r0RI13rU031844@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Sun Jan 27 18:01:03 2013 New Revision: 245995 URL: http://svnweb.freebsd.org/changeset/base/245995 Log: Fix regression issue after r244500 and r244503: If a BUSDMA load operation results in a single segment which is greater than the PAGE_SIZE, the USB computed physical addresses will not be correct. Make sure that the first segment is unfolded like the sub-sequent segments are into USB_PAGE_SIZE big ranges. Found by: Alexander Nedotsukov MFC after: 1 week Modified: head/sys/dev/usb/usb_busdma.c Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Sun Jan 27 17:41:29 2013 (r245994) +++ head/sys/dev/usb/usb_busdma.c Sun Jan 27 18:01:03 2013 (r245995) @@ -440,7 +440,6 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ 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))) { /* @@ -451,7 +450,7 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ goto done; } #endif - while (nseg > 0) { + while (1) { off += USB_PAGE_SIZE; if (off >= (segs->ds_len + rem)) { /* page crossing */ @@ -459,6 +458,8 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ segs++; off = 0; rem = 0; + if (nseg == 0) + break; } pg++; pg->physaddr = (segs->ds_addr + off) & ~(USB_PAGE_SIZE - 1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301271801.r0RI13rU031844>