Date: Fri, 20 Mar 2009 21:50:54 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r190181 - in head/sys/dev/usb: . controller storage Message-ID: <200903202150.n2KLosLI014640@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: thompsa Date: Fri Mar 20 21:50:54 2009 New Revision: 190181 URL: http://svn.freebsd.org/changeset/base/190181 Log: MFp4 //depot/projects/usb @159431,159437,159438 - start using the new USB typedefs in the USB core - Remove usage of USB_ADD_BYTES() Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/storage/ustorage_fs.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_busdma.c head/sys/dev/usb/usb_busdma.h head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_compat_linux.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_dev.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_hid.c head/sys/dev/usb/usb_hid.h head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_hub.h head/sys/dev/usb/usb_lookup.c head/sys/dev/usb/usb_lookup.h head/sys/dev/usb/usb_mbuf.c head/sys/dev/usb/usb_mbuf.h head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/usb_process.c head/sys/dev/usb/usb_process.h head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_request.h head/sys/dev/usb/usb_sw_transfer.c head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usb_transfer.h Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/controller/at91dci.c Fri Mar 20 21:50:54 2009 (r190181) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #define AT9100_DCI_BUS2SC(bus) \ ((struct at91dci_softc *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((struct at91dci_softc *)0)->sc_bus)))) + ((uint8_t *)&(((struct at91dci_softc *)0)->sc_bus)))) #define AT9100_DCI_PC2SC(pc) \ AT9100_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/controller/atmegadci.c Fri Mar 20 21:50:54 2009 (r190181) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #define ATMEGA_BUS2SC(bus) \ ((struct atmegadci_softc *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((struct atmegadci_softc *)0)->sc_bus)))) + ((uint8_t *)&(((struct atmegadci_softc *)0)->sc_bus)))) #define ATMEGA_PC2SC(pc) \ ATMEGA_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/controller/ehci.c Fri Mar 20 21:50:54 2009 (r190181) @@ -66,8 +66,9 @@ __FBSDID("$FreeBSD$"); #include <dev/usb/usb_bus.h> #include <dev/usb/controller/ehci.h> -#define EHCI_BUS2SC(bus) ((ehci_softc_t *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((ehci_softc_t *)0)->sc_bus)))) +#define EHCI_BUS2SC(bus) \ + ((ehci_softc_t *)(((uint8_t *)(bus)) - \ + ((uint8_t *)&(((ehci_softc_t *)0)->sc_bus)))) #if USB_DEBUG static int ehcidebug = 0; @@ -1729,7 +1730,7 @@ ehci_setup_standard_chain(struct usb2_xf xfer->address, UE_GET_ADDR(xfer->endpoint), xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); - temp.average = xfer->max_usb2_frame_size; + temp.average = xfer->max_hc_frame_size; temp.max_frame_size = xfer->max_frame_size; temp.sc = EHCI_BUS2SC(xfer->xroot->bus); @@ -3563,7 +3564,7 @@ ehci_xfer_setup(struct usb2_setup_params nqh = 1; nqtd = ((2 * xfer->nframes) + 1 /* STATUS */ - + (xfer->max_data_length / xfer->max_usb2_frame_size)); + + (xfer->max_data_length / xfer->max_hc_frame_size)); } else if (parm->methods == &ehci_device_bulk_methods) { @@ -3576,7 +3577,7 @@ ehci_xfer_setup(struct usb2_setup_params nqh = 1; nqtd = ((2 * xfer->nframes) - + (xfer->max_data_length / xfer->max_usb2_frame_size)); + + (xfer->max_data_length / xfer->max_hc_frame_size)); } else if (parm->methods == &ehci_device_intr_methods) { @@ -3598,7 +3599,7 @@ ehci_xfer_setup(struct usb2_setup_params nqh = 1; nqtd = ((2 * xfer->nframes) - + (xfer->max_data_length / xfer->max_usb2_frame_size)); + + (xfer->max_data_length / xfer->max_hc_frame_size)); } else if (parm->methods == &ehci_device_isoc_fs_methods) { Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/controller/ohci.c Fri Mar 20 21:50:54 2009 (r190181) @@ -55,8 +55,9 @@ __FBSDID("$FreeBSD$"); #include <dev/usb/usb_bus.h> #include <dev/usb/controller/ohci.h> -#define OHCI_BUS2SC(bus) ((ohci_softc_t *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((ohci_softc_t *)0)->sc_bus)))) +#define OHCI_BUS2SC(bus) \ + ((ohci_softc_t *)(((uint8_t *)(bus)) - \ + ((uint8_t *)&(((ohci_softc_t *)0)->sc_bus)))) #if USB_DEBUG static int ohcidebug = 0; @@ -1410,7 +1411,7 @@ ohci_setup_standard_chain(struct usb2_xf xfer->address, UE_GET_ADDR(xfer->endpoint), xfer->sumlen, usb2_get_speed(xfer->xroot->udev)); - temp.average = xfer->max_usb2_frame_size; + temp.average = xfer->max_hc_frame_size; temp.max_frame_size = xfer->max_frame_size; /* toggle the DMA set we are using */ @@ -2528,7 +2529,7 @@ ohci_xfer_setup(struct usb2_setup_params nitd = 0; ntd = ((2 * xfer->nframes) + 1 /* STATUS */ - + (xfer->max_data_length / xfer->max_usb2_frame_size)); + + (xfer->max_data_length / xfer->max_hc_frame_size)); nqh = 1; } else if (parm->methods == &ohci_device_bulk_methods) { @@ -2538,7 +2539,7 @@ ohci_xfer_setup(struct usb2_setup_params nitd = 0; ntd = ((2 * xfer->nframes) - + (xfer->max_data_length / xfer->max_usb2_frame_size)); + + (xfer->max_data_length / xfer->max_hc_frame_size)); nqh = 1; } else if (parm->methods == &ohci_device_intr_methods) { @@ -2548,7 +2549,7 @@ ohci_xfer_setup(struct usb2_setup_params nitd = 0; ntd = ((2 * xfer->nframes) - + (xfer->max_data_length / xfer->max_usb2_frame_size)); + + (xfer->max_data_length / xfer->max_hc_frame_size)); nqh = 1; } else if (parm->methods == &ohci_device_isoc_methods) { Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/controller/uhci.c Fri Mar 20 21:50:54 2009 (r190181) @@ -59,8 +59,9 @@ __FBSDID("$FreeBSD$"); #include <dev/usb/controller/uhci.h> #define alt_next next -#define UHCI_BUS2SC(bus) ((uhci_softc_t *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((uhci_softc_t *)0)->sc_bus)))) +#define UHCI_BUS2SC(bus) \ + ((uhci_softc_t *)(((uint8_t *)(bus)) - \ + ((uint8_t *)&(((uhci_softc_t *)0)->sc_bus)))) #if USB_DEBUG static int uhcidebug = 0; Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/controller/uss820dci.c Fri Mar 20 21:50:54 2009 (r190181) @@ -55,7 +55,7 @@ #define USS820_DCI_BUS2SC(bus) \ ((struct uss820dci_softc *)(((uint8_t *)(bus)) - \ - USB_P2U(&(((struct uss820dci_softc *)0)->sc_bus)))) + ((uint8_t *)&(((struct uss820dci_softc *)0)->sc_bus)))) #define USS820_DCI_PC2SC(pc) \ USS820_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/storage/ustorage_fs.c Fri Mar 20 21:50:54 2009 (r190181) @@ -59,8 +59,11 @@ SYSCTL_INT(_hw_usb2_ustorage_fs, OID_AUT /* Define some limits */ -#define USTORAGE_FS_BULK_SIZE (1UL << 17) -#define USTORAGE_FS_MAX_LUN 8 +#ifndef USTORAGE_FS_BULK_SIZE +#define USTORAGE_FS_BULK_SIZE (1UL << 17) /* bytes */ +#endif + +#define USTORAGE_FS_MAX_LUN 8 /* units */ /* * The SCSI ID string must be exactly 28 characters long @@ -136,7 +139,7 @@ typedef struct { struct ustorage_fs_lun { - void *memory_image; + uint8_t *memory_image; uint32_t num_sectors; uint32_t sense_data; @@ -1370,8 +1373,7 @@ ustorage_fs_read(struct ustorage_fs_soft file_offset = lba; file_offset <<= 9; - sc->sc_transfer.data_ptr = - USB_ADD_BYTES(currlun->memory_image, (uint32_t)file_offset); + sc->sc_transfer.data_ptr = currlun->memory_image + file_offset; return (0); } @@ -1435,8 +1437,7 @@ ustorage_fs_write(struct ustorage_fs_sof file_offset = lba; file_offset <<= 9; - sc->sc_transfer.data_ptr = - USB_ADD_BYTES(currlun->memory_image, (uint32_t)file_offset); + sc->sc_transfer.data_ptr = currlun->memory_image + file_offset; return (0); } Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_bus.h Fri Mar 20 21:50:54 2009 (r190181) @@ -81,9 +81,9 @@ struct usb2_bus { struct usb2_bus_methods *methods; /* filled by HC driver */ struct usb2_device **devices; - uint32_t hw_power_state; /* see USB_HW_POWER_XXX */ - uint32_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; - uint32_t transfer_count[4]; + usb2_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ + usb2_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; + uint16_t isoc_time_last; /* in milliseconds */ uint8_t alloc_failed; /* Set if memory allocation failed. */ Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_busdma.c Fri Mar 20 21:50:54 2009 (r190181) @@ -42,7 +42,7 @@ #include <dev/usb/usb_bus.h> #if USB_HAVE_BUSDMA -static void usb2_dma_tag_create(struct usb2_dma_tag *, uint32_t, uint32_t); +static void usb2_dma_tag_create(struct usb2_dma_tag *, usb2_size_t, usb2_size_t); static void usb2_dma_tag_destroy(struct usb2_dma_tag *); #endif @@ -66,7 +66,7 @@ static void usb2_pc_common_mem_cb(struct * been properly initialized ! *------------------------------------------------------------------------*/ void -usb2_get_page(struct usb2_page_cache *pc, uint32_t offset, +usb2_get_page(struct usb2_page_cache *pc, usb2_frlength_t offset, struct usb2_page_search *res) { struct usb2_page *page; @@ -122,8 +122,8 @@ usb2_get_page(struct usb2_page_cache *pc * usb2_copy_in - copy directly to DMA-able memory *------------------------------------------------------------------------*/ void -usb2_copy_in(struct usb2_page_cache *cache, uint32_t offset, - const void *ptr, uint32_t len) +usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset, + const void *ptr, usb2_frlength_t len) { struct usb2_page_search buf_res; @@ -151,8 +151,8 @@ usb2_copy_in(struct usb2_page_cache *cac *------------------------------------------------------------------------*/ #if USB_HAVE_USER_IO int -usb2_copy_in_user(struct usb2_page_cache *cache, uint32_t offset, - const void *ptr, uint32_t len) +usb2_copy_in_user(struct usb2_page_cache *cache, usb2_frlength_t offset, + const void *ptr, usb2_frlength_t len) { struct usb2_page_search buf_res; int error; @@ -182,10 +182,10 @@ usb2_copy_in_user(struct usb2_page_cache #if USB_HAVE_MBUF struct usb2_m_copy_in_arg { struct usb2_page_cache *cache; - uint32_t dst_offset; + usb2_frlength_t dst_offset; }; -static int32_t +static int #ifdef __FreeBSD__ usb2_m_copy_in_cb(void *arg, void *src, uint32_t count) #else @@ -200,11 +200,11 @@ usb2_m_copy_in_cb(void *arg, caddr_t src } void -usb2_m_copy_in(struct usb2_page_cache *cache, uint32_t dst_offset, - struct mbuf *m, uint32_t src_offset, uint32_t src_len) +usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset, + struct mbuf *m, usb2_size_t src_offset, usb2_frlength_t src_len) { struct usb2_m_copy_in_arg arg = {cache, dst_offset}; - register int error; + int error; error = m_apply(m, src_offset, src_len, &usb2_m_copy_in_cb, &arg); } @@ -216,7 +216,7 @@ usb2_m_copy_in(struct usb2_page_cache *c #if USB_HAVE_USER_IO int usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio, - uint32_t pc_offset, uint32_t len) + usb2_frlength_t pc_offset, usb2_frlength_t len) { struct usb2_page_search res; int error = 0; @@ -248,8 +248,8 @@ usb2_uiomove(struct usb2_page_cache *pc, * usb2_copy_out - copy directly from DMA-able memory *------------------------------------------------------------------------*/ void -usb2_copy_out(struct usb2_page_cache *cache, uint32_t offset, - void *ptr, uint32_t len) +usb2_copy_out(struct usb2_page_cache *cache, usb2_frlength_t offset, + void *ptr, usb2_frlength_t len) { struct usb2_page_search res; @@ -277,8 +277,8 @@ usb2_copy_out(struct usb2_page_cache *ca *------------------------------------------------------------------------*/ #if USB_HAVE_USER_IO int -usb2_copy_out_user(struct usb2_page_cache *cache, uint32_t offset, - void *ptr, uint32_t len) +usb2_copy_out_user(struct usb2_page_cache *cache, usb2_frlength_t offset, + void *ptr, usb2_frlength_t len) { struct usb2_page_search res; int error; @@ -306,7 +306,8 @@ usb2_copy_out_user(struct usb2_page_cach * usb2_bzero - zero DMA-able memory *------------------------------------------------------------------------*/ void -usb2_bzero(struct usb2_page_cache *cache, uint32_t offset, uint32_t len) +usb2_bzero(struct usb2_page_cache *cache, usb2_frlength_t offset, + usb2_frlength_t len) { struct usb2_page_search res; @@ -343,7 +344,7 @@ usb2_dma_lock_cb(void *arg, bus_dma_lock *------------------------------------------------------------------------*/ static void usb2_dma_tag_create(struct usb2_dma_tag *udt, - uint32_t size, uint32_t align) + usb2_size_t size, usb2_size_t align) { bus_dma_tag_t tag; @@ -408,7 +409,7 @@ usb2_pc_common_mem_cb(void *arg, bus_dma struct usb2_dma_parent_tag *uptag; struct usb2_page_cache *pc; struct usb2_page *pg; - uint32_t rem; + usb2_size_t rem; uint8_t owned; pc = arg; @@ -471,7 +472,7 @@ done: *------------------------------------------------------------------------*/ uint8_t usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg, - uint32_t size, uint32_t align) + usb2_size_t size, usb2_size_t align) { struct usb2_dma_parent_tag *uptag; struct usb2_dma_tag *utag; @@ -594,7 +595,7 @@ usb2_pc_free_mem(struct usb2_page_cache * Else: Error *------------------------------------------------------------------------*/ uint8_t -usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size, uint8_t sync) +usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync) { /* setup page cache */ pc->page_offset_buf = 0; @@ -695,7 +696,7 @@ usb2_pc_cpu_flush(struct usb2_page_cache * Else: Failure *------------------------------------------------------------------------*/ uint8_t -usb2_pc_dmamap_create(struct usb2_page_cache *pc, uint32_t size) +usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size) { struct usb2_xfer_root *info; struct usb2_dma_tag *utag; @@ -751,9 +752,9 @@ usb2_pc_dmamap_destroy(struct usb2_page_ *------------------------------------------------------------------------*/ static void usb2_dma_tag_create(struct usb2_dma_tag *udt, - uint32_t size, uint32_t align) + usb2_size_t size, usb2_size_t align) { - uint32_t nseg; + usb2_size_t nseg; if (align == 1) { nseg = (2 + (size / USB_PAGE_SIZE)); @@ -789,7 +790,7 @@ usb2_pc_common_mem_cb(struct usb2_page_c { struct usb2_dma_parent_tag *uptag; struct usb2_page *pg; - uint32_t rem; + usb2_size_t rem; uint8_t ext_seg; /* extend last segment */ uptag = pc->tag_parent; @@ -855,7 +856,7 @@ done: *------------------------------------------------------------------------*/ uint8_t usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg, - uint32_t size, uint32_t align) + usb2_size_t size, usb2_size_t align) { struct usb2_dma_parent_tag *uptag; struct usb2_dma_tag *utag; @@ -978,7 +979,7 @@ usb2_pc_free_mem(struct usb2_page_cache * Else: Error *------------------------------------------------------------------------*/ uint8_t -usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size, uint8_t sync) +usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync) { int error; @@ -1028,7 +1029,7 @@ usb2_pc_load_mem(struct usb2_page_cache void usb2_pc_cpu_invalidate(struct usb2_page_cache *pc) { - uint32_t len; + usb2_size_t len; len = pc->page_offset_end - pc->page_offset_buf; @@ -1046,7 +1047,7 @@ usb2_pc_cpu_invalidate(struct usb2_page_ void usb2_pc_cpu_flush(struct usb2_page_cache *pc) { - uint32_t len; + usb2_size_t len; len = pc->page_offset_end - pc->page_offset_buf; @@ -1066,7 +1067,7 @@ usb2_pc_cpu_flush(struct usb2_page_cache * Else: Failure *------------------------------------------------------------------------*/ uint8_t -usb2_pc_dmamap_create(struct usb2_page_cache *pc, uint32_t size) +usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size) { struct usb2_xfer_root *info; struct usb2_dma_tag *utag; @@ -1123,7 +1124,7 @@ usb2_pc_dmamap_destroy(struct usb2_page_ *------------------------------------------------------------------------*/ struct usb2_dma_tag * usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt, - uint32_t size, uint32_t align) + usb2_size_t size, usb2_size_t align) { struct usb2_dma_tag *udt; uint8_t nudt; @@ -1232,7 +1233,7 @@ usb2_bdma_work_loop(struct usb2_xfer_que { struct usb2_xfer_root *info; struct usb2_xfer *xfer; - uint32_t nframes; + usb2_frcount_t nframes; xfer = pq->curr; info = xfer->xroot; @@ -1248,7 +1249,7 @@ usb2_bdma_work_loop(struct usb2_xfer_que } if (!xfer->flags_int.bdma_setup) { struct usb2_page *pg; - uint32_t frlength_0; + usb2_frlength_t frlength_0; uint8_t isread; xfer->flags_int.bdma_setup = 1; @@ -1381,7 +1382,7 @@ void usb2_bdma_pre_sync(struct usb2_xfer *xfer) { struct usb2_page_cache *pc; - uint32_t nframes; + usb2_frcount_t nframes; if (xfer->flags_int.isochronous_xfr) { /* only one frame buffer */ @@ -1414,7 +1415,7 @@ void usb2_bdma_post_sync(struct usb2_xfer *xfer) { struct usb2_page_cache *pc; - uint32_t nframes; + usb2_frcount_t nframes; if (xfer->flags_int.isochronous_xfr) { /* only one frame buffer */ Modified: head/sys/dev/usb/usb_busdma.h ============================================================================== --- head/sys/dev/usb/usb_busdma.h Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_busdma.h Fri Mar 20 21:50:54 2009 (r190181) @@ -76,7 +76,7 @@ struct usb2_page_search { #if USB_HAVE_BUSDMA bus_size_t physaddr; #endif - uint32_t length; + usb2_size_t length; }; /* @@ -103,8 +103,8 @@ struct usb2_page_cache { int n_seg; #endif #if USB_HAVE_BUSDMA - uint32_t page_offset_buf; - uint32_t page_offset_end; + usb2_size_t page_offset_buf; + usb2_size_t page_offset_end; uint8_t isread:1; /* set if we are currently reading * from the memory. Else write. */ uint8_t ismultiseg:1; /* set if we can have multiple @@ -142,47 +142,47 @@ struct usb2_dma_tag { struct usb2_dma_parent_tag *tag_parent; bus_dma_tag_t tag; - uint32_t align; - uint32_t size; + usb2_size_t align; + usb2_size_t size; #endif #if USB_HAVE_BUSDMA && defined(__NetBSD__) - uint32_t n_seg; + usb2_size_t n_seg; #endif }; /* function prototypes */ int usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio, - uint32_t pc_offset, uint32_t len); + usb2_frlength_t pc_offset, usb2_frlength_t len); struct usb2_dma_tag *usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt, - uint32_t size, uint32_t align); + usb2_size_t size, usb2_size_t align); uint8_t usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg, - uint32_t size, uint32_t align); -uint8_t usb2_pc_dmamap_create(struct usb2_page_cache *pc, uint32_t size); -uint8_t usb2_pc_load_mem(struct usb2_page_cache *pc, uint32_t size, + usb2_size_t size, usb2_size_t align); +uint8_t usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size); +uint8_t usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync); void usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt); void usb2_bdma_post_sync(struct usb2_xfer *xfer); void usb2_bdma_pre_sync(struct usb2_xfer *xfer); void usb2_bdma_work_loop(struct usb2_xfer_queue *pq); -void usb2_bzero(struct usb2_page_cache *cache, uint32_t offset, - uint32_t len); -void usb2_copy_in(struct usb2_page_cache *cache, uint32_t offset, - const void *ptr, uint32_t len); -int usb2_copy_in_user(struct usb2_page_cache *cache, uint32_t offset, - const void *ptr, uint32_t len); -void usb2_copy_out(struct usb2_page_cache *cache, uint32_t offset, - void *ptr, uint32_t len); -int usb2_copy_out_user(struct usb2_page_cache *cache, uint32_t offset, - void *ptr, uint32_t len); +void usb2_bzero(struct usb2_page_cache *cache, usb2_frlength_t offset, + usb2_frlength_t len); +void usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset, + const void *ptr, usb2_frlength_t len); +int usb2_copy_in_user(struct usb2_page_cache *cache, usb2_frlength_t offset, + const void *ptr, usb2_frlength_t len); +void usb2_copy_out(struct usb2_page_cache *cache, usb2_frlength_t offset, + void *ptr, usb2_frlength_t len); +int usb2_copy_out_user(struct usb2_page_cache *cache, usb2_frlength_t offset, + void *ptr, usb2_frlength_t len); void usb2_dma_tag_setup(struct usb2_dma_parent_tag *udpt, struct usb2_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx, usb2_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt); void usb2_dma_tag_unsetup(struct usb2_dma_parent_tag *udpt); -void usb2_get_page(struct usb2_page_cache *pc, uint32_t offset, +void usb2_get_page(struct usb2_page_cache *pc, usb2_frlength_t offset, struct usb2_page_search *res); -void usb2_m_copy_in(struct usb2_page_cache *cache, uint32_t dst_offset, - struct mbuf *m, uint32_t src_offset, uint32_t src_len); +void usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset, + struct mbuf *m, usb2_size_t src_offset, usb2_frlength_t src_len); void usb2_pc_cpu_flush(struct usb2_page_cache *pc); void usb2_pc_cpu_invalidate(struct usb2_page_cache *pc); void usb2_pc_dmamap_destroy(struct usb2_page_cache *pc); Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_compat_linux.c Fri Mar 20 21:50:54 2009 (r190181) @@ -67,7 +67,7 @@ static usb2_callback_t usb_linux_non_iso static usb_complete_t usb_linux_wait_complete; static uint16_t usb_max_isoc_frames(struct usb_device *); -static int usb_start_wait_urb(struct urb *, uint32_t, uint16_t *); +static int usb_start_wait_urb(struct urb *, usb2_timeout_t, uint16_t *); static const struct usb_device_id *usb_linux_lookup_id( const struct usb_device_id *, struct usb2_attach_arg *); static struct usb_driver *usb_linux_get_usb_driver(struct usb_linux_softc *); @@ -564,7 +564,7 @@ usb_clear_halt(struct usb_device *dev, s * Linux USB transfers. *------------------------------------------------------------------------*/ static int -usb_start_wait_urb(struct urb *urb, uint32_t timeout, uint16_t *p_actlen) +usb_start_wait_urb(struct urb *urb, usb2_timeout_t timeout, uint16_t *p_actlen) { int err; @@ -620,7 +620,7 @@ int usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe, uint8_t request, uint8_t requesttype, uint16_t value, uint16_t index, void *data, - uint16_t size, uint32_t timeout) + uint16_t size, usb2_timeout_t timeout) { struct usb2_device_request req; struct urb *urb; @@ -741,7 +741,7 @@ usb_set_interface(struct usb_device *dev *------------------------------------------------------------------------*/ int usb_setup_endpoint(struct usb_device *dev, - struct usb_host_endpoint *uhe, uint32_t bufsize) + struct usb_host_endpoint *uhe, usb2_size_t bufsize) { struct usb2_config cfg[2]; uint8_t type = uhe->desc.bmAttributes & UE_XFERTYPE; @@ -836,7 +836,7 @@ usb_linux_create_usb_device(struct usb2_ struct usb_interface *p_ui = NULL; struct usb_host_interface *p_uhi = NULL; struct usb_host_endpoint *p_uhe = NULL; - uint32_t size; + usb2_size_t size; uint16_t niface_total; uint16_t nedesc; uint16_t iface_no_curr; @@ -971,7 +971,7 @@ struct urb * usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags) { struct urb *urb; - uint32_t size; + usb2_size_t size; if (iso_packets == 0xFFFF) { /* @@ -1102,7 +1102,7 @@ usb_ifnum_to_if(struct usb_device *dev, * usb_buffer_alloc *------------------------------------------------------------------------*/ void * -usb_buffer_alloc(struct usb_device *dev, uint32_t size, uint16_t mem_flags, uint8_t *dma_addr) +usb_buffer_alloc(struct usb_device *dev, usb2_size_t size, uint16_t mem_flags, uint8_t *dma_addr) { return (malloc(size, M_USBDEV, M_WAITOK | M_ZERO)); } @@ -1193,7 +1193,7 @@ usb_linux_free_device(struct usb_device * usb_buffer_free *------------------------------------------------------------------------*/ void -usb_buffer_free(struct usb_device *dev, uint32_t size, +usb_buffer_free(struct usb_device *dev, usb2_size_t size, void *addr, uint8_t dma_addr) { free(addr, M_USBDEV); @@ -1326,9 +1326,9 @@ usb_linux_complete(struct usb2_xfer *xfe static void usb_linux_isoc_callback(struct usb2_xfer *xfer) { - uint32_t max_frame = xfer->max_frame_size; - uint32_t offset; - uint16_t x; + usb2_frlength_t max_frame = xfer->max_frame_size; + usb2_frlength_t offset; + usb2_frcount_t x; struct urb *urb = xfer->priv_fifo; struct usb_host_endpoint *uhe = xfer->priv_sc; struct usb_iso_packet_descriptor *uipd; @@ -1500,7 +1500,7 @@ usb_linux_non_isoc_callback(struct usb2_ struct urb *urb = xfer->priv_fifo; struct usb_host_endpoint *uhe = xfer->priv_sc; uint8_t *ptr; - uint32_t max_bulk = xfer->max_data_length; + usb2_frlength_t max_bulk = xfer->max_data_length; uint8_t data_frame = xfer->flags_int.control_xfr ? 1 : 0; DPRINTF("\n"); Modified: head/sys/dev/usb/usb_compat_linux.h ============================================================================== --- head/sys/dev/usb/usb_compat_linux.h Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_compat_linux.h Fri Mar 20 21:50:54 2009 (r190181) @@ -321,7 +321,7 @@ struct usb_host_endpoint { uint8_t *extra; /* Extra descriptors */ - uint32_t fbsd_buf_size; + usb2_frlength_t fbsd_buf_size; uint16_t extralen; @@ -406,10 +406,10 @@ struct urb { void *context; /* (in) context for completion */ usb_complete_t *complete; /* (in) completion routine */ - uint32_t transfer_buffer_length;/* (in) data buffer length */ - uint32_t actual_length; /* (return) actual transfer length */ - uint32_t bsd_length_rem; - uint32_t timeout; /* FreeBSD specific */ + usb2_size_t transfer_buffer_length;/* (in) data buffer length */ + usb2_size_t bsd_length_rem; + usb2_size_t actual_length; /* (return) actual transfer length */ + usb2_timeout_t timeout; /* FreeBSD specific */ uint16_t transfer_flags; /* (in) */ #define URB_SHORT_NOT_OK 0x0001 /* report short transfers like errors */ @@ -420,8 +420,8 @@ struct urb { #define URB_WAIT_WAKEUP 0x0010 /* custom flags */ #define URB_IS_SLEEPING 0x0020 /* custom flags */ - uint16_t start_frame; /* (modify) start frame (ISO) */ - uint16_t number_of_packets; /* (in) number of ISO packets */ + usb2_frcount_t start_frame; /* (modify) start frame (ISO) */ + usb2_frcount_t number_of_packets; /* (in) number of ISO packets */ uint16_t interval; /* (modify) transfer interval * (INT/ISO) */ uint16_t error_count; /* (return) number of ISO errors */ @@ -441,11 +441,11 @@ int usb_unlink_urb(struct urb *urb); int usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe); int usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *pipe, uint8_t request, uint8_t requesttype, uint16_t value, - uint16_t index, void *data, uint16_t size, uint32_t timeout); + uint16_t index, void *data, uint16_t size, usb2_timeout_t timeout); int usb_set_interface(struct usb_device *dev, uint8_t ifnum, uint8_t alternate); int usb_setup_endpoint(struct usb_device *dev, - struct usb_host_endpoint *uhe, uint32_t bufsize); + struct usb_host_endpoint *uhe, usb2_frlength_t bufsize); struct usb_host_endpoint *usb_find_host_endpoint(struct usb_device *dev, uint8_t type, uint8_t ep); @@ -454,11 +454,11 @@ struct usb_host_interface *usb_altnum_to const struct usb_interface *intf, uint8_t alt_index); struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no); -void *usb_buffer_alloc(struct usb_device *dev, uint32_t size, +void *usb_buffer_alloc(struct usb_device *dev, usb2_size_t size, uint16_t mem_flags, uint8_t *dma_addr); void *usb_get_intfdata(struct usb_interface *intf); -void usb_buffer_free(struct usb_device *dev, uint32_t size, void *addr, uint8_t dma_addr); +void usb_buffer_free(struct usb_device *dev, usb2_size_t size, void *addr, uint8_t dma_addr); void usb_free_urb(struct urb *urb); void usb_init_urb(struct urb *urb); void usb_kill_urb(struct urb *urb); Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_controller.h Fri Mar 20 21:50:54 2009 (r190181) @@ -45,7 +45,7 @@ struct usb2_endpoint_descriptor; /* typedefs */ -typedef void (usb2_bus_mem_sub_cb_t)(struct usb2_bus *bus, struct usb2_page_cache *pc, struct usb2_page *pg, uint32_t size, uint32_t align); +typedef void (usb2_bus_mem_sub_cb_t)(struct usb2_bus *bus, struct usb2_page_cache *pc, struct usb2_page *pg, usb2_size_t size, usb2_size_t align); typedef void (usb2_bus_mem_cb_t)(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *scb); /* @@ -175,7 +175,7 @@ struct usb2_hw_ep_scratch { */ struct usb2_temp_setup { void *buf; - uint32_t size; + usb2_size_t size; uint8_t usb2_speed; uint8_t self_powered; uint8_t bNumEndpoints; Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_core.h Fri Mar 20 21:50:54 2009 (r190181) @@ -163,6 +163,10 @@ * data packet */ #define USB_HUB_MAX_DEPTH 5 +#ifndef USB_EP0_BUFSIZE +#define USB_EP0_BUFSIZE 1024 /* bytes */ +#endif + /* USB transfer states */ #define USB_ST_SETUP 0 @@ -229,30 +233,26 @@ typedef uint8_t usb2_error_t; /* see "U typedef uint32_t usb2_timeout_t; /* milliseconds */ #endif -#ifndef USB_HAVE_LENGTH_T -typedef uint32_t usb2_length_t; /* bytes */ -#endif - -#ifndef USB_HAVE_FRAMES_T -typedef uint32_t usb2_frames_t; /* units */ +#ifndef USB_HAVE_FRLENGTH_T +typedef uint32_t usb2_frlength_t; /* bytes */ #endif -#ifndef USB_HAVE_INTERVAL_T -typedef uint32_t usb2_interval_t; /* milliseconds */ +#ifndef USB_HAVE_FRCOUNT_T +typedef uint32_t usb2_frcount_t; /* units */ #endif #ifndef USB_HAVE_SIZE_T typedef uint32_t usb2_size_t; /* bytes */ #endif -#ifndef USB_HAVE_REFS_T -typedef uint32_t usb2_refs_t; /* units */ -#endif - #ifndef USB_HAVE_TICKS_T typedef uint32_t usb2_ticks_t; /* system defined */ #endif +#ifndef USB_HAVE_POWER_MASK_T +typedef uint32_t usb2_power_mask_t; /* see "USB_HW_POWER_XXX" */ +#endif + /* structures */ /* @@ -339,11 +339,11 @@ struct usb2_xfer_flags_int { */ struct usb2_config_sub { usb2_callback_t *callback; /* USB transfer callback */ - uint32_t bufsize; /* total pipe buffer size in bytes */ - uint32_t frames; /* maximum number of USB frames */ - uint16_t interval; /* interval in milliseconds */ + usb2_frlength_t bufsize; /* total pipe buffer size in bytes */ + usb2_frcount_t frames; /* maximum number of USB frames */ + usb2_timeout_t interval; /* interval in milliseconds */ #define USB_DEFAULT_INTERVAL 0 - uint16_t timeout; /* transfer timeout in milliseconds */ + usb2_timeout_t timeout; /* transfer timeout in milliseconds */ struct usb2_xfer_flags flags; /* transfer flags */ }; @@ -382,29 +382,29 @@ struct usb2_xfer { void *priv_sc; /* device driver data pointer 1 */ void *priv_fifo; /* device driver data pointer 2 */ void *local_buffer; - uint32_t *frlengths; + usb2_frlength_t *frlengths; struct usb2_page_cache *frbuffers; usb2_callback_t *callback; - uint32_t max_usb2_frame_size; - uint32_t max_data_length; - uint32_t sumlen; /* sum of all lengths in bytes */ - uint32_t actlen; /* actual length in bytes */ - uint32_t timeout; /* milliseconds */ + usb2_frlength_t max_hc_frame_size; + usb2_frlength_t max_data_length; + usb2_frlength_t sumlen; /* sum of all lengths in bytes */ + usb2_frlength_t actlen; /* actual length in bytes */ + usb2_timeout_t timeout; /* milliseconds */ #define USB_NO_TIMEOUT 0 #define USB_DEFAULT_TIMEOUT 5000 /* 5000 ms = 5 seconds */ - uint32_t max_frame_count; /* initial value of "nframes" after + usb2_frcount_t max_frame_count; /* initial value of "nframes" after * setup */ - uint32_t nframes; /* number of USB frames to transfer */ - uint32_t aframes; /* actual number of USB frames + usb2_frcount_t nframes; /* number of USB frames to transfer */ + usb2_frcount_t aframes; /* actual number of USB frames * transferred */ uint16_t max_packet_size; uint16_t max_frame_size; uint16_t qh_pos; uint16_t isoc_time_complete; /* in ms */ - uint16_t interval; /* milliseconds */ + usb2_timeout_t interval; /* milliseconds */ uint8_t address; /* physical USB address */ uint8_t endpoint; /* physical USB endpoint */ @@ -489,9 +489,9 @@ usb2_error_t usb2_transfer_setup(struct const struct usb2_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *priv_mtx); void usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr, - uint32_t frindex); -void usb2_set_frame_offset(struct usb2_xfer *xfer, uint32_t offset, - uint32_t frindex); + usb2_frcount_t frindex); +void usb2_set_frame_offset(struct usb2_xfer *xfer, usb2_frlength_t offset, + usb2_frcount_t frindex); void usb2_start_hardware(struct usb2_xfer *xfer); void usb2_transfer_clear_stall(struct usb2_xfer *xfer); void usb2_transfer_drain(struct usb2_xfer *xfer); Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_dev.c Fri Mar 20 21:50:54 2009 (r190181) @@ -1688,7 +1688,7 @@ usb2_fifo_attach(struct usb2_device *ude * Else failure *------------------------------------------------------------------------*/ int -usb2_fifo_alloc_buffer(struct usb2_fifo *f, uint32_t bufsize, +usb2_fifo_alloc_buffer(struct usb2_fifo *f, usb2_size_t bufsize, uint16_t nbuf) { usb2_fifo_free_buffer(f); @@ -1753,11 +1753,11 @@ usb2_fifo_detach(struct usb2_fifo_sc *f_ DPRINTFN(2, "detached %p\n", f_sc); } -uint32_t +usb2_size_t usb2_fifo_put_bytes_max(struct usb2_fifo *f) { struct usb2_mbuf *m; - uint32_t len; + usb2_size_t len; USB_IF_POLL(&f->free_q, m); @@ -1778,10 +1778,10 @@ usb2_fifo_put_bytes_max(struct usb2_fifo *------------------------------------------------------------------------*/ void usb2_fifo_put_data(struct usb2_fifo *f, struct usb2_page_cache *pc, - uint32_t offset, uint32_t len, uint8_t what) + usb2_frlength_t offset, usb2_frlength_t len, uint8_t what) { struct usb2_mbuf *m; - uint32_t io_len; + usb2_frlength_t io_len; while (len || (what == 1)) { @@ -1816,10 +1816,10 @@ usb2_fifo_put_data(struct usb2_fifo *f, void usb2_fifo_put_data_linear(struct usb2_fifo *f, void *ptr, - uint32_t len, uint8_t what) + usb2_size_t len, uint8_t what) { struct usb2_mbuf *m; - uint32_t io_len; + usb2_size_t io_len; while (len || (what == 1)) { @@ -1853,7 +1853,7 @@ usb2_fifo_put_data_linear(struct usb2_fi } uint8_t -usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, uint32_t len) +usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, usb2_size_t len) { struct usb2_mbuf *m; @@ -1889,11 +1889,11 @@ usb2_fifo_put_data_error(struct usb2_fif *------------------------------------------------------------------------*/ uint8_t usb2_fifo_get_data(struct usb2_fifo *f, struct usb2_page_cache *pc, - uint32_t offset, uint32_t len, uint32_t *actlen, + usb2_frlength_t offset, usb2_frlength_t len, usb2_frlength_t *actlen, uint8_t what) { struct usb2_mbuf *m; - uint32_t io_len; + usb2_frlength_t io_len; uint8_t tr_data = 0; actlen[0] = 0; @@ -1955,10 +1955,10 @@ usb2_fifo_get_data(struct usb2_fifo *f, uint8_t usb2_fifo_get_data_linear(struct usb2_fifo *f, void *ptr, - uint32_t len, uint32_t *actlen, uint8_t what) + usb2_size_t len, usb2_size_t *actlen, uint8_t what) { struct usb2_mbuf *m; - uint32_t io_len; + usb2_size_t io_len; uint8_t tr_data = 0; actlen[0] = 0; @@ -2019,7 +2019,7 @@ usb2_fifo_get_data_linear(struct usb2_fi } uint8_t -usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, uint32_t *plen) +usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, usb2_size_t *plen) { struct usb2_mbuf *m; Modified: head/sys/dev/usb/usb_dev.h ============================================================================== --- head/sys/dev/usb/usb_dev.h Fri Mar 20 21:48:11 2009 (r190180) +++ head/sys/dev/usb/usb_dev.h Fri Mar 20 21:50:54 2009 (r190181) @@ -135,9 +135,9 @@ struct usb2_fifo { void *priv_sc0; /* client data */ void *priv_sc1; /* client data */ void *queue_data; - uint32_t timeout; /* timeout in milliseconds */ - uint32_t bufsize; /* BULK and INTERRUPT buffer size */ - uint16_t nframes; /* for isochronous mode */ + usb2_timeout_t timeout; /* timeout in milliseconds */ + usb2_frlength_t bufsize; /* BULK and INTERRUPT buffer size */ + usb2_frcount_t nframes; /* for isochronous mode */ uint16_t dev_ep_index; /* our device endpoint index */ uint8_t flag_sleeping; /* set if FIFO is sleeping */ uint8_t flag_iscomplete; /* set if a USB transfer is complete */ @@ -175,17 +175,18 @@ int usb2_fifo_attach(struct usb2_device void usb2_fifo_detach(struct usb2_fifo_sc *f_sc); uint32_t usb2_fifo_put_bytes_max(struct usb2_fifo *fifo); void usb2_fifo_put_data(struct usb2_fifo *fifo, struct usb2_page_cache *pc, - uint32_t offset, uint32_t len, uint8_t what); + usb2_frlength_t offset, usb2_frlength_t len, uint8_t what); void usb2_fifo_put_data_linear(struct usb2_fifo *fifo, void *ptr, - uint32_t len, uint8_t what); -uint8_t usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, uint32_t len); + usb2_size_t len, uint8_t what); +uint8_t usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, usb2_size_t len); void usb2_fifo_put_data_error(struct usb2_fifo *fifo); uint8_t usb2_fifo_get_data(struct usb2_fifo *fifo, struct usb2_page_cache *pc, - uint32_t offset, uint32_t len, uint32_t *actlen, uint8_t what); + usb2_frlength_t offset, usb2_frlength_t len, usb2_frlength_t *actlen, + uint8_t what); uint8_t usb2_fifo_get_data_linear(struct usb2_fifo *fifo, void *ptr, - uint32_t len, uint32_t *actlen, uint8_t what); + usb2_size_t len, usb2_size_t *actlen, uint8_t what); uint8_t usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, - uint32_t *plen); + usb2_size_t *plen); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903202150.n2KLosLI014640>