Date: Sun, 25 Nov 2007 13:59:38 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 129506 for review Message-ID: <200711251359.lAPDxcoA099173@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=129506 Change 129506 by hselasky@hselasky_laptop001 on 2007/11/25 13:58:45 Temporary patches to get loading for virtual buffers working. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#56 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#61 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#56 (text+ko) ==== @@ -2088,7 +2088,7 @@ uint32_t alignment = (1 << align_power); void *ptr; - tag = usbd_dma_tag_alloc(parent, size, alignment, size); + tag = usbd_dma_tag_alloc(parent, size, alignment, size, 1); if (tag == NULL) { return (NULL); @@ -2127,12 +2127,11 @@ bus_dmamap_load_callback(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - *((bus_size_t *)arg) = nseg ? segs->ds_addr : 0; + __KASSERT(nseg == 1, ("Invalid number of segments, %d!\n", nseg)); + __KASSERT(error == 0, ("Could not load memory into DMA!\n")); + + *((bus_size_t *)arg) = segs->ds_addr; - if (error) { - printf("%s: %s: error=%d\n", - __FILE__, __FUNCTION__, error); - } return; } @@ -2141,7 +2140,7 @@ *------------------------------------------------------------------------*/ bus_dma_tag_t usbd_dma_tag_alloc(bus_dma_tag_t parent, uint32_t seg_size, - uint32_t alignment, uint32_t max_size) + uint32_t alignment, uint32_t max_size, uint8_t single_seg) { bus_dma_tag_t tag; @@ -2154,7 +2153,7 @@ /* filter */ NULL, /* filterarg */ NULL, /* maxsize */ max_size, - /* nsegments */ 1, + /* nsegments */ (single_seg ? 1 : ((16 * 1024 * 1024) / USB_PAGE_SIZE)), /* maxsegsz */ seg_size, /* flags */ 0, /* lock */ NULL, @@ -2352,6 +2351,9 @@ mtx_lock(xfer->priv_mtx); if (error) { + printf("%s: %s: error=%d\n", + __FILE__, __FUNCTION__, error); + xfer->flags_int.bdma_error = 1; } else { __KASSERT(nseg > 0, ("Invalid number of segments!\n")); @@ -2450,7 +2452,7 @@ bus_dma_tag_t usbd_dma_tag_alloc(bus_dma_tag_t parent, uint32_t seg_size, - uint32_t alignment, uint32_t max_size) + uint32_t alignment, uint32_t max_size, uint8_t single_seg) { /* FreeBSD specific */ return (parent); @@ -3141,15 +3143,14 @@ } } bus->dma_tag_1b = - usbd_dma_tag_alloc(parent_tag, USB_PAGE_SIZE, 1, - 0 - 1); + usbd_dma_tag_alloc(parent_tag, USB_PAGE_SIZE, 1, 0 - 1, 0); if (bus->dma_tag_1b == NULL) { goto error; } bus->dma_tag_ps = - usbd_dma_tag_alloc(parent_tag, USB_PAGE_SIZE, USB_PAGE_SIZE, - USB_PAGE_SIZE); + usbd_dma_tag_alloc(parent_tag, USB_PAGE_SIZE, + USB_PAGE_SIZE, USB_PAGE_SIZE, 1); if (bus->dma_tag_ps == NULL) { goto error; ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#61 (text+ko) ==== @@ -706,7 +706,7 @@ uint32_t usbd_page_fit_obj(uint32_t size, uint32_t obj_len); void *usbd_mem_alloc(bus_dma_tag_t parent, struct usbd_page *page, uint32_t size, uint8_t align_power); void usbd_mem_free(struct usbd_page *page); -bus_dma_tag_t usbd_dma_tag_alloc(bus_dma_tag_t parent, uint32_t seg_size, uint32_t alignment, uint32_t max_size); +bus_dma_tag_t usbd_dma_tag_alloc(bus_dma_tag_t parent, uint32_t seg_size, uint32_t alignment, uint32_t max_size, uint8_t single_seg); void usbd_dma_tag_free(bus_dma_tag_t tag); void *usbd_mem_alloc_sub(bus_dma_tag_t tag, struct usbd_page *page, uint32_t size, uint32_t alignment); void usbd_mem_free_sub(struct usbd_page *page);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711251359.lAPDxcoA099173>