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
This commit is contained in:
hselasky 2013-01-27 18:01:03 +00:00
parent 0f7cb9fb67
commit 43f43dc8e9

View File

@ -440,7 +440,6 @@ usb_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs,
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_segment_t *segs,
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_segment_t *segs,
segs++;
off = 0;
rem = 0;
if (nseg == 0)
break;
}
pg++;
pg->physaddr = (segs->ds_addr + off) & ~(USB_PAGE_SIZE - 1);