From 760bc48e7ee4471fe04fa5fee89d00bf7d698ddb Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Thu, 28 May 2009 17:36:36 +0000 Subject: s/usb2_/usb_/ on all C structs for the USB stack. --- lib/libusb/libusb.3 | 4 +- lib/libusb/libusb20.c | 2 +- lib/libusb/libusb20.h | 4 +- lib/libusb/libusb20_int.h | 2 +- lib/libusb/libusb20_ugen20.c | 52 +-- sys/compat/ndis/subr_usbd.c | 34 +- sys/dev/ata/ata-usb.c | 50 +-- sys/dev/if_ndis/if_ndis_usb.c | 6 +- sys/dev/if_ndis/if_ndisvar.h | 4 +- sys/dev/sound/usb/uaudio.c | 130 +++---- sys/dev/sound/usb/uaudioreg.h | 2 +- sys/dev/usb/controller/at91dci.c | 130 +++---- sys/dev/usb/controller/at91dci.h | 16 +- sys/dev/usb/controller/atmegadci.c | 104 +++--- sys/dev/usb/controller/atmegadci.h | 18 +- sys/dev/usb/controller/atmegadci_atmelarm.c | 4 +- sys/dev/usb/controller/avr32dci.c | 106 +++--- sys/dev/usb/controller/avr32dci.h | 18 +- sys/dev/usb/controller/ehci.c | 170 ++++----- sys/dev/usb/controller/ehci.h | 48 +-- sys/dev/usb/controller/musb_otg.c | 136 +++---- sys/dev/usb/controller/musb_otg.h | 18 +- sys/dev/usb/controller/ohci.c | 148 ++++---- sys/dev/usb/controller/ohci.h | 46 +-- sys/dev/usb/controller/uhci.c | 158 ++++---- sys/dev/usb/controller/uhci.h | 56 +-- sys/dev/usb/controller/usb_controller.c | 54 +-- sys/dev/usb/controller/uss820dci.c | 134 +++---- sys/dev/usb/controller/uss820dci.h | 16 +- sys/dev/usb/input/uhid.c | 48 +-- sys/dev/usb/input/ukbd.c | 22 +- sys/dev/usb/input/ums.c | 28 +- sys/dev/usb/misc/udbp.c | 24 +- sys/dev/usb/misc/ufm.c | 16 +- sys/dev/usb/net/if_aue.c | 44 +-- sys/dev/usb/net/if_auereg.h | 4 +- sys/dev/usb/net/if_axe.c | 40 +-- sys/dev/usb/net/if_axereg.h | 4 +- sys/dev/usb/net/if_cdce.c | 42 +-- sys/dev/usb/net/if_cdcereg.h | 4 +- sys/dev/usb/net/if_cue.c | 46 +-- sys/dev/usb/net/if_cuereg.h | 4 +- sys/dev/usb/net/if_kue.c | 44 +-- sys/dev/usb/net/if_kuereg.h | 4 +- sys/dev/usb/net/if_rue.c | 40 +-- sys/dev/usb/net/if_ruereg.h | 4 +- sys/dev/usb/net/if_udav.c | 48 +-- sys/dev/usb/net/if_udavreg.h | 4 +- sys/dev/usb/net/usb_ethernet.c | 96 ++--- sys/dev/usb/net/usb_ethernet.h | 56 +-- sys/dev/usb/quirk/usb_quirk.c | 4 +- sys/dev/usb/serial/u3g.c | 70 ++-- sys/dev/usb/serial/uark.c | 56 +-- sys/dev/usb/serial/ubsa.c | 66 ++-- sys/dev/usb/serial/ubser.c | 52 +-- sys/dev/usb/serial/uchcom.c | 68 ++-- sys/dev/usb/serial/ucycom.c | 56 +-- sys/dev/usb/serial/ufoma.c | 132 +++---- sys/dev/usb/serial/uftdi.c | 76 ++-- sys/dev/usb/serial/ugensa.c | 40 +-- sys/dev/usb/serial/uipaq.c | 58 +-- sys/dev/usb/serial/ulpt.c | 60 ++-- sys/dev/usb/serial/umct.c | 68 ++-- sys/dev/usb/serial/umodem.c | 108 +++--- sys/dev/usb/serial/umoscom.c | 76 ++-- sys/dev/usb/serial/uplcom.c | 90 ++--- sys/dev/usb/serial/usb_serial.c | 124 +++---- sys/dev/usb/serial/usb_serial.h | 92 ++--- sys/dev/usb/serial/uslcom.c | 84 ++--- sys/dev/usb/serial/uvisor.c | 58 +-- sys/dev/usb/serial/uvscom.c | 80 ++--- sys/dev/usb/storage/umass.c | 102 +++--- sys/dev/usb/storage/urio.c | 50 +-- sys/dev/usb/storage/ustorage_fs.c | 26 +- sys/dev/usb/template/usb_template.c | 184 +++++----- sys/dev/usb/template/usb_template.h | 38 +- sys/dev/usb/template/usb_template_cdce.c | 34 +- sys/dev/usb/template/usb_template_msc.c | 18 +- sys/dev/usb/template/usb_template_mtp.c | 24 +- sys/dev/usb/usb.h | 88 ++--- sys/dev/usb/usb_bus.h | 44 +-- sys/dev/usb/usb_busdma.c | 106 +++--- sys/dev/usb/usb_busdma.h | 78 ++-- sys/dev/usb/usb_cdc.h | 16 +- sys/dev/usb/usb_compat_linux.c | 140 +++----- sys/dev/usb/usb_compat_linux.h | 128 ------- sys/dev/usb/usb_controller.h | 78 ++-- sys/dev/usb/usb_core.h | 136 +++---- sys/dev/usb/usb_debug.c | 14 +- sys/dev/usb/usb_debug.h | 18 +- sys/dev/usb/usb_dev.c | 186 +++++----- sys/dev/usb/usb_dev.h | 112 +++--- sys/dev/usb/usb_device.c | 256 ++++++------- sys/dev/usb/usb_device.h | 149 +++++--- sys/dev/usb/usb_dynamic.c | 12 +- sys/dev/usb/usb_dynamic.h | 18 +- sys/dev/usb/usb_generic.c | 396 ++++++++++----------- sys/dev/usb/usb_generic.h | 4 +- sys/dev/usb/usb_handle_request.c | 52 +-- sys/dev/usb/usb_hid.c | 14 +- sys/dev/usb/usb_hid.h | 12 +- sys/dev/usb/usb_hub.c | 130 +++---- sys/dev/usb/usb_hub.h | 34 +- sys/dev/usb/usb_ioctl.h | 100 +++--- sys/dev/usb/usb_lookup.c | 18 +- sys/dev/usb/usb_lookup.h | 16 +- sys/dev/usb/usb_mbuf.c | 6 +- sys/dev/usb/usb_mbuf.h | 14 +- sys/dev/usb/usb_msctest.c | 30 +- sys/dev/usb/usb_msctest.h | 2 +- sys/dev/usb/usb_parse.c | 50 +-- sys/dev/usb/usb_parse.h | 26 +- sys/dev/usb/usb_process.c | 32 +- sys/dev/usb/usb_process.h | 24 +- sys/dev/usb/usb_request.c | 172 ++++----- sys/dev/usb/usb_request.h | 84 ++--- sys/dev/usb/usb_transfer.c | 198 +++++------ sys/dev/usb/usb_transfer.h | 88 ++--- sys/dev/usb/usb_util.c | 8 +- sys/dev/usb/usbhid.h | 2 +- sys/dev/usb/wlan/if_rum.c | 24 +- sys/dev/usb/wlan/if_rumvar.h | 6 +- sys/dev/usb/wlan/if_uath.c | 20 +- sys/dev/usb/wlan/if_uathvar.h | 4 +- sys/dev/usb/wlan/if_upgt.c | 20 +- sys/dev/usb/wlan/if_upgtvar.h | 4 +- sys/dev/usb/wlan/if_ural.c | 28 +- sys/dev/usb/wlan/if_uralvar.h | 6 +- sys/dev/usb/wlan/if_urtw.c | 52 +-- sys/dev/usb/wlan/if_urtwvar.h | 6 +- sys/dev/usb/wlan/if_zyd.c | 26 +- sys/dev/usb/wlan/if_zydreg.h | 4 +- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 38 +- sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h | 4 +- sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 42 +-- 135 files changed, 3776 insertions(+), 3885 deletions(-) diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3 index 1ab432e9e66b..2fb717f5871e 100644 --- a/lib/libusb/libusb.3 +++ b/lib/libusb/libusb.3 @@ -109,7 +109,7 @@ USB access library (libusb -lusb) .Ft const char * .Fn libusb20_dev_get_backend_name "struct libusb20_device *" .Ft int -.Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb2_device_info *pinfo" +.Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb_device_info *pinfo" .Ft int .Fn libusb20_dev_get_iface_desc "struct libusb20_device *pdev" "uint8_t iface_index" "char *buf" "uint8_t len" .Ft const char * @@ -465,7 +465,7 @@ returns a zero terminated string describing the backend used. .Pp . .Fn libusb20_dev_get_info -retrives the BSD specific usb2_device_info structure into the memory location given by +retrives the BSD specific usb_device_info structure into the memory location given by .Fa pinfo . The USB device given by .Fa pdev diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 704480ab1ba7..0c80c8b8ce96 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -925,7 +925,7 @@ libusb20_dev_free(struct libusb20_device *pdev) int libusb20_dev_get_info(struct libusb20_device *pdev, - struct usb2_device_info *pinfo) + struct usb_device_info *pinfo) { if (pinfo == NULL) return (LIBUSB20_ERROR_INVALID_PARAM); diff --git a/lib/libusb/libusb20.h b/lib/libusb/libusb20.h index 5125f91f4086..8a46febe35f9 100644 --- a/lib/libusb/libusb20.h +++ b/lib/libusb/libusb20.h @@ -175,7 +175,7 @@ enum { LIBUSB20_POWER_RESUME, }; -struct usb2_device_info; +struct usb_device_info; struct libusb20_transfer; struct libusb20_backend; struct libusb20_backend_methods; @@ -253,7 +253,7 @@ int libusb20_dev_reset(struct libusb20_device *pdev); int libusb20_dev_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode); uint8_t libusb20_dev_get_power_mode(struct libusb20_device *pdev); int libusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); -int libusb20_dev_get_info(struct libusb20_device *pdev, struct usb2_device_info *pinfo); +int libusb20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo); int libusb20_dev_get_iface_desc(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len); struct LIBUSB20_DEVICE_DESC_DECODED *libusb20_dev_get_device_desc(struct libusb20_device *pdev); diff --git a/lib/libusb/libusb20_int.h b/lib/libusb/libusb20_int.h index 494aa6d7bf39..706f857e8567 100644 --- a/lib/libusb/libusb20_int.h +++ b/lib/libusb/libusb20_int.h @@ -49,7 +49,7 @@ typedef int (libusb20_root_get_quirk_name_t)(struct libusb20_backend *pbe, uint1 typedef int (libusb20_root_add_dev_quirk_t)(struct libusb20_backend *pbe, struct libusb20_quirk *pq); typedef int (libusb20_root_remove_dev_quirk_t)(struct libusb20_backend *pbe, struct libusb20_quirk *pq); typedef int (libusb20_close_device_t)(struct libusb20_device *pdev); -typedef int (libusb20_dev_get_info_t)(struct libusb20_device *pdev, struct usb2_device_info *pinfo); +typedef int (libusb20_dev_get_info_t)(struct libusb20_device *pdev, struct usb_device_info *pinfo); typedef int (libusb20_dev_get_iface_desc_t)(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len); typedef int (libusb20_init_backend_t)(struct libusb20_backend *pbe); typedef int (libusb20_open_device_t)(struct libusb20_device *pdev, uint16_t transfer_count_max); diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c index 1d97db66a65d..219e6e7e0769 100644 --- a/lib/libusb/libusb20_ugen20.c +++ b/lib/libusb/libusb20_ugen20.c @@ -126,8 +126,8 @@ static int ugen20_enumerate(struct libusb20_device *pdev, const char *id) { const char *tmp = id; - struct usb2_device_descriptor ddesc; - struct usb2_device_info devinfo; + struct usb_device_descriptor ddesc; + struct usb_device_info devinfo; uint32_t plugtime; char buf[64]; int f; @@ -213,7 +213,7 @@ done: } struct ugen20_urd_state { - struct usb2_read_dir urd; + struct usb_read_dir urd; uint32_t nparsed; int f; uint8_t *ptr; @@ -298,7 +298,7 @@ ugen20_init_backend(struct libusb20_backend *pbe) static void ugen20_tr_release(struct libusb20_device *pdev) { - struct usb2_fs_uninit fs_uninit; + struct usb_fs_uninit fs_uninit; if (pdev->nTransfer == 0) { return; @@ -316,8 +316,8 @@ ugen20_tr_release(struct libusb20_device *pdev) static int ugen20_tr_renew(struct libusb20_device *pdev) { - struct usb2_fs_init fs_init; - struct usb2_fs_endpoint *pfse; + struct usb_fs_init fs_init; + struct usb_fs_endpoint *pfse; int error; uint32_t size; uint16_t nMaxTransfer; @@ -419,7 +419,7 @@ done: static int ugen20_close_device(struct libusb20_device *pdev) { - struct usb2_fs_uninit fs_uninit; + struct usb_fs_uninit fs_uninit; if (pdev->privBeData) { memset(&fs_uninit, 0, sizeof(fs_uninit)); @@ -447,8 +447,8 @@ static int ugen20_get_config_desc_full(struct libusb20_device *pdev, uint8_t **ppbuf, uint16_t *plen, uint8_t cfg_index) { - struct usb2_gen_descriptor gen_desc; - struct usb2_config_descriptor cdesc; + struct usb_gen_descriptor gen_desc; + struct usb_config_descriptor cdesc; uint8_t *ptr; uint16_t len; int error; @@ -542,7 +542,7 @@ static int ugen20_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index) { - struct usb2_alt_interface alt_iface; + struct usb_alt_interface alt_iface; memset(&alt_iface, 0, sizeof(alt_iface)); @@ -663,7 +663,7 @@ ugen20_do_request_sync(struct libusb20_device *pdev, struct LIBUSB20_CONTROL_SETUP_DECODED *setup, void *data, uint16_t *pactlen, uint32_t timeout, uint8_t flags) { - struct usb2_ctl_request req; + struct usb_ctl_request req; memset(&req, 0, sizeof(req)); @@ -688,8 +688,8 @@ ugen20_do_request_sync(struct libusb20_device *pdev, static int ugen20_process(struct libusb20_device *pdev) { - struct usb2_fs_complete temp; - struct usb2_fs_endpoint *fsep; + struct usb_fs_complete temp; + struct usb_fs_endpoint *fsep; struct libusb20_transfer *xfer; while (1) { @@ -739,8 +739,8 @@ static int ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize, uint32_t MaxFrameCount, uint8_t ep_no) { - struct usb2_fs_open temp; - struct usb2_fs_endpoint *fsep; + struct usb_fs_open temp; + struct usb_fs_endpoint *fsep; memset(&temp, 0, sizeof(temp)); @@ -772,7 +772,7 @@ ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize, static int ugen20_tr_close(struct libusb20_transfer *xfer) { - struct usb2_fs_close temp; + struct usb_fs_close temp; memset(&temp, 0, sizeof(temp)); @@ -787,7 +787,7 @@ ugen20_tr_close(struct libusb20_transfer *xfer) static int ugen20_tr_clear_stall_sync(struct libusb20_transfer *xfer) { - struct usb2_fs_clear_stall_sync temp; + struct usb_fs_clear_stall_sync temp; memset(&temp, 0, sizeof(temp)); @@ -804,8 +804,8 @@ ugen20_tr_clear_stall_sync(struct libusb20_transfer *xfer) static void ugen20_tr_submit(struct libusb20_transfer *xfer) { - struct usb2_fs_start temp; - struct usb2_fs_endpoint *fsep; + struct usb_fs_start temp; + struct usb_fs_endpoint *fsep; memset(&temp, 0, sizeof(temp)); @@ -839,7 +839,7 @@ ugen20_tr_submit(struct libusb20_transfer *xfer) static void ugen20_tr_cancel_async(struct libusb20_transfer *xfer) { - struct usb2_fs_stop temp; + struct usb_fs_stop temp; memset(&temp, 0, sizeof(temp)); @@ -876,7 +876,7 @@ static int ugen20_dev_get_iface_desc(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len) { - struct usb2_gen_descriptor ugd; + struct usb_gen_descriptor ugd; memset(&ugd, 0, sizeof(ugd)); @@ -892,7 +892,7 @@ ugen20_dev_get_iface_desc(struct libusb20_device *pdev, static int ugen20_dev_get_info(struct libusb20_device *pdev, - struct usb2_device_info *pinfo) + struct usb_device_info *pinfo) { if (ioctl(pdev->file, USB_GET_DEVICEINFO, pinfo)) { return (LIBUSB20_ERROR_INVALID_PARAM); @@ -904,7 +904,7 @@ static int ugen20_root_get_dev_quirk(struct libusb20_backend *pbe, uint16_t quirk_index, struct libusb20_quirk *pq) { - struct usb2_gen_quirk q; + struct usb_gen_quirk q; int error; memset(&q, 0, sizeof(q)); @@ -931,7 +931,7 @@ static int ugen20_root_get_quirk_name(struct libusb20_backend *pbe, uint16_t quirk_index, struct libusb20_quirk *pq) { - struct usb2_gen_quirk q; + struct usb_gen_quirk q; int error; memset(&q, 0, sizeof(q)); @@ -954,7 +954,7 @@ static int ugen20_root_add_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq) { - struct usb2_gen_quirk q; + struct usb_gen_quirk q; int error; memset(&q, 0, sizeof(q)); @@ -978,7 +978,7 @@ static int ugen20_root_remove_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq) { - struct usb2_gen_quirk q; + struct usb_gen_quirk q; int error; memset(&q, 0, sizeof(q)); diff --git a/sys/compat/ndis/subr_usbd.c b/sys/compat/ndis/subr_usbd.c index bb7273245c0a..0680e41022d7 100644 --- a/sys/compat/ndis/subr_usbd.c +++ b/sys/compat/ndis/subr_usbd.c @@ -84,10 +84,10 @@ static usb2_callback_t usbd_ctrl_callback; #define USBD_CTRL_MAX_PIPE 2 #define USBD_CTRL_READ_BUFFER_SP 256 #define USBD_CTRL_READ_BUFFER_SIZE \ - (sizeof(struct usb2_device_request) + USBD_CTRL_READ_BUFFER_SP) + (sizeof(struct usb_device_request) + USBD_CTRL_READ_BUFFER_SP) #define USBD_CTRL_WRITE_BUFFER_SIZE \ - (sizeof(struct usb2_device_request)) -static struct usb2_config usbd_default_epconfig[USBD_CTRL_MAX_PIPE] = { + (sizeof(struct usb_device_request)) +static struct usb_config usbd_default_epconfig[USBD_CTRL_MAX_PIPE] = { [USBD_CTRL_READ_PIPE] = { .type = UE_CONTROL, .endpoint = 0x00, /* control pipe */ @@ -115,10 +115,10 @@ static int32_t usbd_func_vendorclass(irp *); static int32_t usbd_func_selconf(irp *); static int32_t usbd_func_abort_pipe(irp *); static usb2_error_t usbd_setup_endpoint(irp *, uint8_t, - struct usb2_endpoint_descriptor *); + struct usb_endpoint_descriptor *); static usb2_error_t usbd_setup_endpoint_default(irp *, uint8_t); static usb2_error_t usbd_setup_endpoint_one(irp *, uint8_t, - struct ndisusb_ep *, struct usb2_config *); + struct ndisusb_ep *, struct usb_config *); static int32_t usbd_func_getdesc(irp *); static union usbd_urb *usbd_geturb(irp *); static struct ndisusb_ep*usbd_get_ndisep(irp *, usb_endpoint_descriptor_t *); @@ -519,8 +519,8 @@ usbd_func_selconf(ip) device_t dev = IRP_NDIS_DEV(ip); int i, j; struct ndis_softc *sc = device_get_softc(dev); - struct usb2_device *udev = sc->ndisusb_dev; - struct usb2_pipe *p = NULL; + struct usb_device *udev = sc->ndisusb_dev; + struct usb_pipe *p = NULL; struct usbd_interface_information *intf; struct usbd_pipe_information *pipe; struct usbd_urb_select_configuration *selconf; @@ -597,11 +597,11 @@ usbd_setup_endpoint_one(ip, ifidx, ne, epconf) irp *ip; uint8_t ifidx; struct ndisusb_ep *ne; - struct usb2_config *epconf; + struct usb_config *epconf; { device_t dev = IRP_NDIS_DEV(ip); struct ndis_softc *sc = device_get_softc(dev); - struct usb2_xfer *xfer; + struct usb_xfer *xfer; usb2_error_t status; InitializeListHead(&ne->ne_active); @@ -647,13 +647,13 @@ static usb2_error_t usbd_setup_endpoint(ip, ifidx, ep) irp *ip; uint8_t ifidx; - struct usb2_endpoint_descriptor *ep; + struct usb_endpoint_descriptor *ep; { device_t dev = IRP_NDIS_DEV(ip); struct ndis_softc *sc = device_get_softc(dev); struct ndisusb_ep *ne; - struct usb2_config cfg; - struct usb2_xfer *xfer; + struct usb_config cfg; + struct usb_xfer *xfer; usb2_error_t status; /* check for non-supported transfer types */ @@ -670,7 +670,7 @@ usbd_setup_endpoint(ip, ifidx, ep) KeInitializeSpinLock(&ne->ne_lock); ne->ne_dirin = UE_GET_DIR(ep->bEndpointAddress) >> 7; - memset(&cfg, 0, sizeof(struct usb2_config)); + memset(&cfg, 0, sizeof(struct usb_config)); cfg.type = UE_GET_XFERTYPE(ep->bmAttributes); cfg.endpoint = UE_GET_ADDR(ep->bEndpointAddress); cfg.direction = UE_GET_DIR(ep->bEndpointAddress); @@ -853,7 +853,7 @@ usbd_aq_getfirst(struct ndis_softc *sc, struct ndisusb_ep *ne) } static void -usbd_non_isoc_callback(struct usb2_xfer *xfer) +usbd_non_isoc_callback(struct usb_xfer *xfer) { irp *ip; struct ndis_softc *sc = xfer->priv_sc; @@ -951,7 +951,7 @@ extra: } static void -usbd_ctrl_callback(struct usb2_xfer *xfer) +usbd_ctrl_callback(struct usb_xfer *xfer) { irp *ip; struct ndis_softc *sc = xfer->priv_sc; @@ -961,7 +961,7 @@ usbd_ctrl_callback(struct usb2_xfer *xfer) union usbd_urb *urb; struct usbd_urb_vendor_or_class_request *vcreq; uint8_t type = 0; - struct usb2_device_request req; + struct usb_device_request req; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -1434,7 +1434,7 @@ USBD_ParseConfigurationDescriptorEx(conf, start, intfnum, int32_t intfsubclass; int32_t intfproto; { - struct usb2_descriptor *next = NULL; + struct usb_descriptor *next = NULL; usb_interface_descriptor_t *desc; while ((next = usb2_desc_foreach(conf, next)) != NULL) { diff --git a/sys/dev/ata/ata-usb.c b/sys/dev/ata/ata-usb.c index 8fc1005b377d..ea6977073335 100644 --- a/sys/dev/ata/ata-usb.c +++ b/sys/dev/ata/ata-usb.c @@ -108,7 +108,7 @@ struct atausb2_softc { #define ATAUSB_T_MAX ATAUSB_T_BBB_MAX - struct usb2_xfer *xfer[ATAUSB_T_MAX]; + struct usb_xfer *xfer[ATAUSB_T_MAX]; caddr_t ata_data; device_t dev; @@ -145,7 +145,7 @@ static usb2_callback_t atausb2_tr_error; static void atausb2_cancel_request(struct atausb2_softc *sc); static void atausb2_transfer_start(struct atausb2_softc *sc, uint8_t xfer_no); -static void atausb2_t_bbb_data_clear_stall_callback(struct usb2_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer); +static void atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer); static int ata_usbchannel_begin_transaction(struct ata_request *request); static int ata_usbchannel_end_transaction(struct ata_request *request); @@ -160,13 +160,13 @@ static ata_locking_t ata_usbchannel_locking; * USB frontend part */ -struct usb2_config atausb2_config[ATAUSB_T_BBB_MAX] = { +struct usb_config atausb2_config[ATAUSB_T_BBB_MAX] = { [ATAUSB_T_BBB_RESET1] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), + .mh.bufsize = sizeof(struct usb_device_request), .mh.flags = {}, .mh.callback = &atausb2_t_bbb_reset1_callback, .mh.timeout = 5000, /* 5 seconds */ @@ -177,7 +177,7 @@ struct usb2_config atausb2_config[ATAUSB_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), + .mh.bufsize = sizeof(struct usb_device_request), .mh.flags = {}, .mh.callback = &atausb2_t_bbb_reset2_callback, .mh.timeout = 5000, /* 5 seconds */ @@ -188,7 +188,7 @@ struct usb2_config atausb2_config[ATAUSB_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), + .mh.bufsize = sizeof(struct usb_device_request), .mh.flags = {}, .mh.callback = &atausb2_t_bbb_reset3_callback, .mh.timeout = 5000, /* 5 seconds */ @@ -219,7 +219,7 @@ struct usb2_config atausb2_config[ATAUSB_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), + .mh.bufsize = sizeof(struct usb_device_request), .mh.flags = {}, .mh.callback = &atausb2_t_bbb_data_rd_cs_callback, .mh.timeout = 5000, /* 5 seconds */ @@ -239,7 +239,7 @@ struct usb2_config atausb2_config[ATAUSB_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), + .mh.bufsize = sizeof(struct usb_device_request), .mh.flags = {}, .mh.callback = &atausb2_t_bbb_data_wr_cs_callback, .mh.timeout = 5000, /* 5 seconds */ @@ -278,8 +278,8 @@ MODULE_VERSION(atausb, 1); static int atausb2_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface_descriptor *id; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface_descriptor *id; if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -318,10 +318,10 @@ static int atausb2_attach(device_t dev) { struct atausb2_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface_descriptor *id; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface_descriptor *id; const char *proto, *subclass; - struct usb2_device_request request; + struct usb_device_request request; device_t child; uint16_t i; uint8_t maxlun; @@ -467,10 +467,10 @@ atausb2_transfer_start(struct atausb2_softc *sc, uint8_t xfer_no) } static void -atausb2_t_bbb_reset1_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_reset1_callback(struct usb_xfer *xfer) { struct atausb2_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -500,21 +500,21 @@ atausb2_t_bbb_reset1_callback(struct usb2_xfer *xfer) } static void -atausb2_t_bbb_reset2_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_reset2_callback(struct usb_xfer *xfer) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_RESET3, ATAUSB_T_BBB_DATA_READ); } static void -atausb2_t_bbb_reset3_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_reset3_callback(struct usb_xfer *xfer) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_COMMAND, ATAUSB_T_BBB_DATA_WRITE); } static void -atausb2_t_bbb_data_clear_stall_callback(struct usb2_xfer *xfer, +atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer) { @@ -540,7 +540,7 @@ tr_transferred: } static void -atausb2_t_bbb_command_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_command_callback(struct usb_xfer *xfer) { struct atausb2_softc *sc = xfer->priv_sc; struct ata_request *request = sc->ata_request; @@ -590,7 +590,7 @@ atausb2_t_bbb_command_callback(struct usb2_xfer *xfer) } static void -atausb2_t_bbb_data_read_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_data_read_callback(struct usb_xfer *xfer) { struct atausb2_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -640,14 +640,14 @@ atausb2_t_bbb_data_read_callback(struct usb2_xfer *xfer) } static void -atausb2_t_bbb_data_rd_cs_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_data_rd_cs_callback(struct usb_xfer *xfer) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS, ATAUSB_T_BBB_DATA_READ); } static void -atausb2_t_bbb_data_write_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_data_write_callback(struct usb_xfer *xfer) { struct atausb2_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -693,14 +693,14 @@ atausb2_t_bbb_data_write_callback(struct usb2_xfer *xfer) } static void -atausb2_t_bbb_data_wr_cs_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_data_wr_cs_callback(struct usb_xfer *xfer) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS, ATAUSB_T_BBB_DATA_WRITE); } static void -atausb2_t_bbb_status_callback(struct usb2_xfer *xfer) +atausb2_t_bbb_status_callback(struct usb_xfer *xfer) { struct atausb2_softc *sc = xfer->priv_sc; struct ata_request *request = sc->ata_request; @@ -820,7 +820,7 @@ atausb2_cancel_request(struct atausb2_softc *sc) } static void -atausb2_tr_error(struct usb2_xfer *xfer) +atausb2_tr_error(struct usb_xfer *xfer) { struct atausb2_softc *sc = xfer->priv_sc; diff --git a/sys/dev/if_ndis/if_ndis_usb.c b/sys/dev/if_ndis/if_ndis_usb.c index 5e4895b1eb63..51441c172362 100644 --- a/sys/dev/if_ndis/if_ndis_usb.c +++ b/sys/dev/if_ndis/if_ndis_usb.c @@ -111,7 +111,7 @@ DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); static int ndisusb_devcompare(interface_type bustype, struct ndis_usb_type *t, device_t dev) { - struct usb2_attach_arg *uaa; + struct usb_attach_arg *uaa; if (bustype != PNPBus) return (FALSE); @@ -134,7 +134,7 @@ static int ndisusb_match(device_t self) { struct drvdb_ent *db; - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -159,7 +159,7 @@ ndisusb_attach(device_t self) { const struct drvdb_ent *db; struct ndisusb_softc *dummy = device_get_softc(self); - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); struct ndis_softc *sc; struct ndis_usb_type *t; driver_object *drv; diff --git a/sys/dev/if_ndis/if_ndisvar.h b/sys/dev/if_ndis/if_ndisvar.h index fc7ae4c4443c..c01af913f0e6 100644 --- a/sys/dev/if_ndis/if_ndisvar.h +++ b/sys/dev/if_ndis/if_ndisvar.h @@ -121,7 +121,7 @@ struct ndis_vap { #define NDISUSB_TX_TIMEOUT 10000 struct ndisusb_xfer; struct ndisusb_ep { - struct usb2_xfer *ne_xfer[1]; + struct usb_xfer *ne_xfer[1]; list_entry ne_active; list_entry ne_pending; kspin_lock ne_lock; @@ -225,7 +225,7 @@ struct ndis_softc { int ndis_tx_timer; int ndis_hang_timer; - struct usb2_device *ndisusb_dev; + struct usb_device *ndisusb_dev; struct mtx ndisusb_mtx; struct ndisusb_ep ndisusb_dread_ep; struct ndisusb_ep ndisusb_dwrite_ep; diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 8c7564a3fcab..2e14b8fcdd9f 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -135,11 +135,11 @@ struct uaudio_chan { struct pcmchan_caps pcm_cap; /* capabilities */ struct snd_dbuf *pcm_buf; - const struct usb2_config *usb2_cfg; + const struct usb_config *usb2_cfg; struct mtx *pcm_mtx; /* lock protecting this structure */ struct uaudio_softc *priv_sc; struct pcm_channel *pcm_ch; - struct usb2_xfer *xfer[UAUDIO_NCHANBUFS]; + struct usb_xfer *xfer[UAUDIO_NCHANBUFS]; const struct usb2_audio_streaming_interface_descriptor *p_asid; const struct usb2_audio_streaming_type1_descriptor *p_asf1d; const struct usb2_audio_streaming_endpoint_descriptor *p_sed; @@ -171,7 +171,7 @@ struct uaudio_chan { #define UMIDI_BULK_SIZE 1024 /* bytes */ struct umidi_sub_chan { - struct usb2_fifo_sc fifo; + struct usb_fifo_sc fifo; uint8_t *temp_cmd; uint8_t temp_0[4]; uint8_t temp_1[4]; @@ -194,7 +194,7 @@ struct umidi_chan { struct umidi_sub_chan sub[UMIDI_CABLES_MAX]; struct mtx mtx; - struct usb2_xfer *xfer[UMIDI_N_TRANSFER]; + struct usb_xfer *xfer[UMIDI_N_TRANSFER]; uint8_t iface_index; uint8_t iface_alt_index; @@ -218,8 +218,8 @@ struct uaudio_softc { struct uaudio_chan sc_play_chan; struct umidi_chan sc_midi_chan; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_mixer_xfer[1]; + struct usb_device *sc_udev; + struct usb_xfer *sc_mixer_xfer[1]; struct uaudio_mixer_node *sc_mixer_root; struct uaudio_mixer_node *sc_mixer_curr; @@ -251,7 +251,7 @@ struct uaudio_search_result { struct uaudio_terminal_node { union { - const struct usb2_descriptor *desc; + const struct usb_descriptor *desc; const struct usb2_audio_input_terminal *it; const struct usb2_audio_output_terminal *ot; const struct usb2_audio_mixer_unit_0 *mu; @@ -317,9 +317,9 @@ static usb2_callback_t umidi_write_clear_stall_callback; static usb2_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, - struct usb2_device *, uint32_t, uint16_t, uint8_t, uint8_t); + struct usb_device *, uint32_t, uint16_t, uint8_t, uint8_t); static void uaudio_chan_fill_info(struct uaudio_softc *, - struct usb2_device *); + struct usb_device *); static void uaudio_mixer_add_ctl_sub(struct uaudio_softc *, struct uaudio_mixer_node *); static void uaudio_mixer_add_ctl(struct uaudio_softc *, @@ -357,25 +357,25 @@ static void uaudio_mixer_find_inputs_sub(struct uaudio_terminal_node *, static void uaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *, uint8_t, uint8_t, struct uaudio_search_result *); static void uaudio_mixer_fill_info(struct uaudio_softc *, - struct usb2_device *, void *); -static uint16_t uaudio_mixer_get(struct usb2_device *, uint8_t, + struct usb_device *, void *); +static uint16_t uaudio_mixer_get(struct usb_device *, uint8_t, struct uaudio_mixer_node *); static void uaudio_mixer_ctl_set(struct uaudio_softc *, struct uaudio_mixer_node *, uint8_t, int32_t val); -static usb2_error_t uaudio_set_speed(struct usb2_device *, uint8_t, uint32_t); +static usb2_error_t uaudio_set_speed(struct usb_device *, uint8_t, uint32_t); static int uaudio_mixer_signext(uint8_t, int); static int uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val); static const void *uaudio_mixer_verify_desc(const void *, uint32_t); static void uaudio_mixer_init(struct uaudio_softc *); static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t); -static struct umidi_sub_chan *umidi_sub_by_fifo(struct usb2_fifo *); -static void umidi_start_read(struct usb2_fifo *); -static void umidi_stop_read(struct usb2_fifo *); -static void umidi_start_write(struct usb2_fifo *); -static void umidi_stop_write(struct usb2_fifo *); -static int umidi_open(struct usb2_fifo *, int); -static int umidi_ioctl(struct usb2_fifo *, u_long cmd, void *, int); -static void umidi_close(struct usb2_fifo *, int); +static struct umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *); +static void umidi_start_read(struct usb_fifo *); +static void umidi_stop_read(struct usb_fifo *); +static void umidi_start_write(struct usb_fifo *); +static void umidi_stop_write(struct usb_fifo *); +static int umidi_open(struct usb_fifo *, int); +static int umidi_ioctl(struct usb_fifo *, u_long cmd, void *, int); +static void umidi_close(struct usb_fifo *, int); static void umidi_init(device_t dev); static int32_t umidi_probe(device_t dev); static int32_t umidi_detach(device_t dev); @@ -388,7 +388,7 @@ static void uaudio_mixer_dump_cluster(uint8_t, static const char *uaudio_mixer_get_terminal_name(uint16_t); #endif -static const struct usb2_config +static const struct usb_config uaudio_cfg_record[UAUDIO_NCHANBUFS] = { [0] = { .type = UE_ISOCHRONOUS, @@ -411,7 +411,7 @@ static const struct usb2_config }, }; -static const struct usb2_config +static const struct usb_config uaudio_cfg_play[UAUDIO_NCHANBUFS] = { [0] = { .type = UE_ISOCHRONOUS, @@ -434,13 +434,13 @@ static const struct usb2_config }, }; -static const struct usb2_config +static const struct usb_config uaudio_mixer_config[1] = { [0] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = (sizeof(struct usb2_device_request) + 4), + .bufsize = (sizeof(struct usb_device_request) + 4), .callback = &uaudio_mixer_write_cfg_callback, .timeout = 1000, /* 1 second */ }, @@ -466,7 +466,7 @@ uint8_t umidi_cmd_to_len[16] = { [0xF] = 1, /* bytes */ }; -static const struct usb2_config +static const struct usb_config umidi_config[UMIDI_N_TRANSFER] = { [0] = { .type = UE_BULK, @@ -490,7 +490,7 @@ static const struct usb2_config .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .flags = {}, .callback = &umidi_write_clear_stall_callback, .timeout = 1000, /* 1 second */ @@ -501,7 +501,7 @@ static const struct usb2_config .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .flags = {}, .callback = &umidi_read_clear_stall_callback, .timeout = 1000, /* 1 second */ @@ -531,7 +531,7 @@ static driver_t uaudio_driver = { static int uaudio_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -554,9 +554,9 @@ uaudio_probe(device_t dev) static int uaudio_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uaudio_softc *sc = device_get_softc(dev); - struct usb2_interface_descriptor *id; + struct usb_interface_descriptor *id; device_t child; sc->sc_play_chan.priv_sc = sc; @@ -767,18 +767,18 @@ uaudio_chan_dump_ep_desc(const usb2_endpoint_descriptor_audio_t *ed) #endif static void -uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb2_device *udev, +uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, uint32_t rate, uint16_t fps, uint8_t channels, uint8_t bit_resolution) { - struct usb2_descriptor *desc = NULL; + struct usb_descriptor *desc = NULL; const struct usb2_audio_streaming_interface_descriptor *asid = NULL; const struct usb2_audio_streaming_type1_descriptor *asf1d = NULL; const struct usb2_audio_streaming_endpoint_descriptor *sed = NULL; const usb2_endpoint_descriptor_audio_t *ed1 = NULL; const usb2_endpoint_descriptor_audio_t *ed2 = NULL; - struct usb2_config_descriptor *cd = usb2_get_config_descriptor(udev); - struct usb2_interface_descriptor *id; + struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev); + struct usb_interface_descriptor *id; const struct uaudio_format *p_fmt; struct uaudio_chan *chan; uint16_t curidx = 0xFFFF; @@ -1049,7 +1049,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb2_device *udev, } static void -uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb2_device *udev) +uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb_device *udev) { uint32_t rate = uaudio_default_rate; uint32_t z; @@ -1098,7 +1098,7 @@ done: } static void -uaudio_chan_play_callback(struct usb2_xfer *xfer) +uaudio_chan_play_callback(struct usb_xfer *xfer) { struct uaudio_chan *ch = xfer->priv_sc; uint32_t *p_len = xfer->frlengths; @@ -1187,7 +1187,7 @@ tr_transferred: } static void -uaudio_chan_record_callback(struct usb2_xfer *xfer) +uaudio_chan_record_callback(struct usb_xfer *xfer) { struct uaudio_chan *ch = xfer->priv_sc; uint32_t *p_len = xfer->frlengths; @@ -1999,7 +1999,7 @@ uaudio_mixer_verify_desc(const void *arg, uint32_t len) const struct usb2_audio_processing_unit_1 *u1; union { - const struct usb2_descriptor *desc; + const struct usb_descriptor *desc; const struct usb2_audio_input_terminal *it; const struct usb2_audio_output_terminal *ot; const struct usb2_audio_mixer_unit_0 *mu; @@ -2151,7 +2151,7 @@ static struct usb2_audio_cluster uaudio_mixer_get_cluster(uint8_t id, const struct uaudio_terminal_node *iot) { struct usb2_audio_cluster r; - const struct usb2_descriptor *dp; + const struct usb_descriptor *dp; uint8_t i; for (i = 0; i < UAUDIO_RECURSE_LIMIT; i++) { /* avoid infinite loops */ @@ -2618,12 +2618,12 @@ uaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *root, uint8_t id, } static void -uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb2_device *udev, +uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb_device *udev, void *desc) { const struct usb2_audio_control_descriptor *acdp; - struct usb2_config_descriptor *cd = usb2_get_config_descriptor(udev); - const struct usb2_descriptor *dp; + struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev); + const struct usb_descriptor *dp; const struct usb2_audio_unit *au; struct uaudio_terminal_node *iot = NULL; uint16_t wTotalLen; @@ -2866,10 +2866,10 @@ done: } static uint16_t -uaudio_mixer_get(struct usb2_device *udev, uint8_t what, +uaudio_mixer_get(struct usb_device *udev, uint8_t what, struct uaudio_mixer_node *mc) { - struct usb2_device_request req; + struct usb_device_request req; uint16_t val; uint16_t len = MIX_SIZE(mc->type); uint8_t data[4]; @@ -2903,9 +2903,9 @@ uaudio_mixer_get(struct usb2_device *udev, uint8_t what, } static void -uaudio_mixer_write_cfg_callback(struct usb2_xfer *xfer) +uaudio_mixer_write_cfg_callback(struct usb_xfer *xfer) { - struct usb2_device_request req; + struct usb_device_request req; struct uaudio_softc *sc = xfer->priv_sc; struct uaudio_mixer_node *mc = sc->sc_mixer_curr; uint16_t len; @@ -2988,9 +2988,9 @@ tr_setup: } static usb2_error_t -uaudio_set_speed(struct usb2_device *udev, uint8_t endpt, uint32_t speed) +uaudio_set_speed(struct usb_device *udev, uint8_t endpt, uint32_t speed) { - struct usb2_device_request req; + struct usb_device_request req; uint8_t data[3]; DPRINTFN(6, "endpt=%d speed=%u\n", endpt, speed); @@ -3182,10 +3182,10 @@ uaudio_mixer_setrecsrc(struct uaudio_softc *sc, uint32_t src) *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb2_xfer *xfer) +umidi_read_clear_stall_callback(struct usb_xfer *xfer) { struct umidi_chan *chan = xfer->priv_sc; - struct usb2_xfer *xfer_other = chan->xfer[1]; + struct usb_xfer *xfer_other = chan->xfer[1]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -3195,7 +3195,7 @@ umidi_read_clear_stall_callback(struct usb2_xfer *xfer) } static void -umidi_bulk_read_callback(struct usb2_xfer *xfer) +umidi_bulk_read_callback(struct usb_xfer *xfer) { struct umidi_chan *chan = xfer->priv_sc; struct umidi_sub_chan *sub; @@ -3261,10 +3261,10 @@ tr_error: } static void -umidi_write_clear_stall_callback(struct usb2_xfer *xfer) +umidi_write_clear_stall_callback(struct usb_xfer *xfer) { struct umidi_chan *chan = xfer->priv_sc; - struct usb2_xfer *xfer_other = chan->xfer[0]; + struct usb_xfer *xfer_other = chan->xfer[0]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -3407,7 +3407,7 @@ umidi_convert_to_usb(struct umidi_sub_chan *sub, uint8_t cn, uint8_t b) } static void -umidi_bulk_write_callback(struct usb2_xfer *xfer) +umidi_bulk_write_callback(struct usb_xfer *xfer) { struct umidi_chan *chan = xfer->priv_sc; struct umidi_sub_chan *sub; @@ -3507,7 +3507,7 @@ umidi_bulk_write_callback(struct usb2_xfer *xfer) } static struct umidi_sub_chan * -umidi_sub_by_fifo(struct usb2_fifo *fifo) +umidi_sub_by_fifo(struct usb_fifo *fifo) { struct umidi_chan *chan = fifo->priv_sc0; struct umidi_sub_chan *sub; @@ -3521,14 +3521,14 @@ umidi_sub_by_fifo(struct usb2_fifo *fifo) } } - panic("%s:%d cannot find usb2_fifo!\n", + panic("%s:%d cannot find usb_fifo!\n", __FILE__, __LINE__); return (NULL); } static void -umidi_start_read(struct usb2_fifo *fifo) +umidi_start_read(struct usb_fifo *fifo) { struct umidi_chan *chan = fifo->priv_sc0; @@ -3536,7 +3536,7 @@ umidi_start_read(struct usb2_fifo *fifo) } static void -umidi_stop_read(struct usb2_fifo *fifo) +umidi_stop_read(struct usb_fifo *fifo) { struct umidi_chan *chan = fifo->priv_sc0; struct umidi_sub_chan *sub = umidi_sub_by_fifo(fifo); @@ -3555,7 +3555,7 @@ umidi_stop_read(struct usb2_fifo *fifo) } static void -umidi_start_write(struct usb2_fifo *fifo) +umidi_start_write(struct usb_fifo *fifo) { struct umidi_chan *chan = fifo->priv_sc0; @@ -3563,7 +3563,7 @@ umidi_start_write(struct usb2_fifo *fifo) } static void -umidi_stop_write(struct usb2_fifo *fifo) +umidi_stop_write(struct usb_fifo *fifo) { struct umidi_chan *chan = fifo->priv_sc0; struct umidi_sub_chan *sub = umidi_sub_by_fifo(fifo); @@ -3580,7 +3580,7 @@ umidi_stop_write(struct usb2_fifo *fifo) } static int -umidi_open(struct usb2_fifo *fifo, int fflags) +umidi_open(struct usb_fifo *fifo, int fflags) { struct umidi_chan *chan = fifo->priv_sc0; struct umidi_sub_chan *sub = umidi_sub_by_fifo(fifo); @@ -3612,7 +3612,7 @@ umidi_open(struct usb2_fifo *fifo, int fflags) } static void -umidi_close(struct usb2_fifo *fifo, int fflags) +umidi_close(struct usb_fifo *fifo, int fflags) { if (fflags & FREAD) { usb2_fifo_free_buffer(fifo); @@ -3624,7 +3624,7 @@ umidi_close(struct usb2_fifo *fifo, int fflags) static int -umidi_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data, +umidi_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags) { return (ENODEV); @@ -3639,7 +3639,7 @@ umidi_init(device_t dev) mtx_init(&chan->mtx, "umidi lock", NULL, MTX_DEF | MTX_RECURSE); } -static struct usb2_fifo_methods umidi_fifo_methods = { +static struct usb_fifo_methods umidi_fifo_methods = { .f_start_read = &umidi_start_read, .f_start_write = &umidi_start_write, .f_stop_read = &umidi_stop_read, @@ -3654,7 +3654,7 @@ static int32_t umidi_probe(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct umidi_chan *chan = &sc->sc_midi_chan; struct umidi_sub_chan *sub; int unit = device_get_unit(dev); diff --git a/sys/dev/sound/usb/uaudioreg.h b/sys/dev/sound/usb/uaudioreg.h index 6b814d0cff67..495f94a8b96c 100644 --- a/sys/dev/sound/usb/uaudioreg.h +++ b/sys/dev/sound/usb/uaudioreg.h @@ -47,7 +47,7 @@ #define UDESCSUB_AC_PROCESSING 7 #define UDESCSUB_AC_EXTENSION 8 -/* The first fields are identical to struct usb2_endpoint_descriptor */ +/* The first fields are identical to struct usb_endpoint_descriptor */ typedef struct { uByte bLength; uByte bDescriptorType; diff --git a/sys/dev/usb/controller/at91dci.c b/sys/dev/usb/controller/at91dci.c index 63a589af0e54..e50d8f9fd14b 100644 --- a/sys/dev/usb/controller/at91dci.c +++ b/sys/dev/usb/controller/at91dci.c @@ -82,19 +82,19 @@ SYSCTL_INT(_hw_usb_at91dci, OID_AUTO, debug, CTLFLAG_RW, /* prototypes */ -struct usb2_bus_methods at91dci_bus_methods; -struct usb2_pipe_methods at91dci_device_bulk_methods; -struct usb2_pipe_methods at91dci_device_ctrl_methods; -struct usb2_pipe_methods at91dci_device_intr_methods; -struct usb2_pipe_methods at91dci_device_isoc_fs_methods; +struct usb_bus_methods at91dci_bus_methods; +struct usb_pipe_methods at91dci_device_bulk_methods; +struct usb_pipe_methods at91dci_device_ctrl_methods; +struct usb_pipe_methods at91dci_device_intr_methods; +struct usb_pipe_methods at91dci_device_isoc_fs_methods; static at91dci_cmd_t at91dci_setup_rx; static at91dci_cmd_t at91dci_data_rx; static at91dci_cmd_t at91dci_data_tx; static at91dci_cmd_t at91dci_data_tx_sync; -static void at91dci_device_done(struct usb2_xfer *, usb2_error_t); -static void at91dci_do_poll(struct usb2_bus *); -static void at91dci_standard_done(struct usb2_xfer *); +static void at91dci_device_done(struct usb_xfer *, usb2_error_t); +static void at91dci_do_poll(struct usb_bus *); +static void at91dci_standard_done(struct usb_xfer *); static void at91dci_root_intr(struct at91dci_softc *sc); /* @@ -116,7 +116,7 @@ static void at91dci_root_intr(struct at91dci_softc *sc); * Here is a list of what the chip supports. * Probably it supports more than listed here! */ -static const struct usb2_hw_ep_profile +static const struct usb_hw_ep_profile at91dci_ep_profile[AT91_UDP_EP_MAX] = { [0] = { @@ -181,8 +181,8 @@ static const struct usb2_hw_ep_profile }; static void -at91dci_get_hw_ep_profile(struct usb2_device *udev, - const struct usb2_hw_ep_profile **ppf, uint8_t ep_addr) +at91dci_get_hw_ep_profile(struct usb_device *udev, + const struct usb_hw_ep_profile **ppf, uint8_t ep_addr) { if (ep_addr < AT91_UDP_EP_MAX) { *ppf = (at91dci_ep_profile + ep_addr); @@ -278,7 +278,7 @@ static uint8_t at91dci_setup_rx(struct at91dci_td *td) { struct at91dci_softc *sc; - struct usb2_device_request req; + struct usb_device_request req; uint32_t csr; uint32_t temp; uint16_t count; @@ -372,7 +372,7 @@ not_complete: static uint8_t at91dci_data_rx(struct at91dci_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint32_t csr; uint32_t temp; uint16_t count; @@ -499,7 +499,7 @@ repeat: static uint8_t at91dci_data_tx(struct at91dci_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint32_t csr; uint32_t temp; uint16_t count; @@ -643,7 +643,7 @@ not_complete: } static uint8_t -at91dci_xfer_do_fifo(struct usb2_xfer *xfer) +at91dci_xfer_do_fifo(struct usb_xfer *xfer) { struct at91dci_softc *sc; struct at91dci_td *td; @@ -706,7 +706,7 @@ done: static void at91dci_interrupt_poll(struct at91dci_softc *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -854,7 +854,7 @@ at91dci_setup_standard_chain_sub(struct at91dci_std_temp *temp) } static void -at91dci_setup_standard_chain(struct usb2_xfer *xfer) +at91dci_setup_standard_chain(struct usb_xfer *xfer) { struct at91dci_std_temp temp; struct at91dci_softc *sc; @@ -1015,7 +1015,7 @@ at91dci_setup_standard_chain(struct usb2_xfer *xfer) static void at91dci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -1026,7 +1026,7 @@ at91dci_timeout(void *arg) } static void -at91dci_start_standard_chain(struct usb2_xfer *xfer) +at91dci_start_standard_chain(struct usb_xfer *xfer) { DPRINTFN(9, "\n"); @@ -1071,7 +1071,7 @@ at91dci_root_intr(struct at91dci_softc *sc) } static usb2_error_t -at91dci_standard_done_sub(struct usb2_xfer *xfer) +at91dci_standard_done_sub(struct usb_xfer *xfer) { struct at91dci_td *td; uint32_t len; @@ -1135,7 +1135,7 @@ at91dci_standard_done_sub(struct usb2_xfer *xfer) } static void -at91dci_standard_done(struct usb2_xfer *xfer) +at91dci_standard_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1184,7 +1184,7 @@ done: * same USB transfer! *------------------------------------------------------------------------*/ static void -at91dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +at91dci_device_done(struct usb_xfer *xfer, usb2_error_t error) { struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint8_t ep_no; @@ -1207,8 +1207,8 @@ at91dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) } static void -at91dci_set_stall(struct usb2_device *udev, struct usb2_xfer *xfer, - struct usb2_pipe *pipe) +at91dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, + struct usb_pipe *pipe) { struct at91dci_softc *sc; uint32_t csr_val; @@ -1235,7 +1235,7 @@ static void at91dci_clear_stall_sub(struct at91dci_softc *sc, uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; uint32_t csr_val; uint32_t temp; uint8_t csr_reg; @@ -1328,10 +1328,10 @@ at91dci_clear_stall_sub(struct at91dci_softc *sc, uint8_t ep_no, } static void -at91dci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) +at91dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe) { struct at91dci_softc *sc; - struct usb2_endpoint_descriptor *ed; + struct usb_endpoint_descriptor *ed; DPRINTFN(5, "pipe=%p\n", pipe); @@ -1455,7 +1455,7 @@ at91dci_resume(struct at91dci_softc *sc) } static void -at91dci_do_poll(struct usb2_bus *bus) +at91dci_do_poll(struct usb_bus *bus) { struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); @@ -1468,32 +1468,32 @@ at91dci_do_poll(struct usb2_bus *bus) * at91dci bulk support *------------------------------------------------------------------------*/ static void -at91dci_device_bulk_open(struct usb2_xfer *xfer) +at91dci_device_bulk_open(struct usb_xfer *xfer) { return; } static void -at91dci_device_bulk_close(struct usb2_xfer *xfer) +at91dci_device_bulk_close(struct usb_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); } static void -at91dci_device_bulk_enter(struct usb2_xfer *xfer) +at91dci_device_bulk_enter(struct usb_xfer *xfer) { return; } static void -at91dci_device_bulk_start(struct usb2_xfer *xfer) +at91dci_device_bulk_start(struct usb_xfer *xfer) { /* setup TDs */ at91dci_setup_standard_chain(xfer); at91dci_start_standard_chain(xfer); } -struct usb2_pipe_methods at91dci_device_bulk_methods = +struct usb_pipe_methods at91dci_device_bulk_methods = { .open = at91dci_device_bulk_open, .close = at91dci_device_bulk_close, @@ -1505,32 +1505,32 @@ struct usb2_pipe_methods at91dci_device_bulk_methods = * at91dci control support *------------------------------------------------------------------------*/ static void -at91dci_device_ctrl_open(struct usb2_xfer *xfer) +at91dci_device_ctrl_open(struct usb_xfer *xfer) { return; } static void -at91dci_device_ctrl_close(struct usb2_xfer *xfer) +at91dci_device_ctrl_close(struct usb_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); } static void -at91dci_device_ctrl_enter(struct usb2_xfer *xfer) +at91dci_device_ctrl_enter(struct usb_xfer *xfer) { return; } static void -at91dci_device_ctrl_start(struct usb2_xfer *xfer) +at91dci_device_ctrl_start(struct usb_xfer *xfer) { /* setup TDs */ at91dci_setup_standard_chain(xfer); at91dci_start_standard_chain(xfer); } -struct usb2_pipe_methods at91dci_device_ctrl_methods = +struct usb_pipe_methods at91dci_device_ctrl_methods = { .open = at91dci_device_ctrl_open, .close = at91dci_device_ctrl_close, @@ -1542,32 +1542,32 @@ struct usb2_pipe_methods at91dci_device_ctrl_methods = * at91dci interrupt support *------------------------------------------------------------------------*/ static void -at91dci_device_intr_open(struct usb2_xfer *xfer) +at91dci_device_intr_open(struct usb_xfer *xfer) { return; } static void -at91dci_device_intr_close(struct usb2_xfer *xfer) +at91dci_device_intr_close(struct usb_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); } static void -at91dci_device_intr_enter(struct usb2_xfer *xfer) +at91dci_device_intr_enter(struct usb_xfer *xfer) { return; } static void -at91dci_device_intr_start(struct usb2_xfer *xfer) +at91dci_device_intr_start(struct usb_xfer *xfer) { /* setup TDs */ at91dci_setup_standard_chain(xfer); at91dci_start_standard_chain(xfer); } -struct usb2_pipe_methods at91dci_device_intr_methods = +struct usb_pipe_methods at91dci_device_intr_methods = { .open = at91dci_device_intr_open, .close = at91dci_device_intr_close, @@ -1579,19 +1579,19 @@ struct usb2_pipe_methods at91dci_device_intr_methods = * at91dci full speed isochronous support *------------------------------------------------------------------------*/ static void -at91dci_device_isoc_fs_open(struct usb2_xfer *xfer) +at91dci_device_isoc_fs_open(struct usb_xfer *xfer) { return; } static void -at91dci_device_isoc_fs_close(struct usb2_xfer *xfer) +at91dci_device_isoc_fs_close(struct usb_xfer *xfer) { at91dci_device_done(xfer, USB_ERR_CANCELLED); } static void -at91dci_device_isoc_fs_enter(struct usb2_xfer *xfer) +at91dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint32_t temp; @@ -1643,13 +1643,13 @@ at91dci_device_isoc_fs_enter(struct usb2_xfer *xfer) } static void -at91dci_device_isoc_fs_start(struct usb2_xfer *xfer) +at91dci_device_isoc_fs_start(struct usb_xfer *xfer) { /* start TD chain */ at91dci_start_standard_chain(xfer); } -struct usb2_pipe_methods at91dci_device_isoc_fs_methods = +struct usb_pipe_methods at91dci_device_isoc_fs_methods = { .open = at91dci_device_isoc_fs_open, .close = at91dci_device_isoc_fs_close, @@ -1663,8 +1663,8 @@ struct usb2_pipe_methods at91dci_device_isoc_fs_methods = * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static const struct usb2_device_descriptor at91dci_devd = { - .bLength = sizeof(struct usb2_device_descriptor), +static const struct usb_device_descriptor at91dci_devd = { + .bLength = sizeof(struct usb_device_descriptor), .bDescriptorType = UDESC_DEVICE, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1677,8 +1677,8 @@ static const struct usb2_device_descriptor at91dci_devd = { .bNumConfigurations = 1, }; -static const struct usb2_device_qualifier at91dci_odevd = { - .bLength = sizeof(struct usb2_device_qualifier), +static const struct usb_device_qualifier at91dci_odevd = { + .bLength = sizeof(struct usb_device_qualifier), .bDescriptorType = UDESC_DEVICE_QUALIFIER, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1690,7 +1690,7 @@ static const struct usb2_device_qualifier at91dci_odevd = { static const struct at91dci_config_desc at91dci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(at91dci_confd), .bNumInterface = 1, @@ -1700,7 +1700,7 @@ static const struct at91dci_config_desc at91dci_confd = { .bMaxPower = 0, }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -1708,7 +1708,7 @@ static const struct at91dci_config_desc at91dci_confd = { .bInterfaceProtocol = UIPROTO_HSHUBSTT, }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = (UE_DIR_IN | AT9100_DCI_INTR_ENDPT), .bmAttributes = UE_INTERRUPT, @@ -1717,7 +1717,7 @@ static const struct at91dci_config_desc at91dci_confd = { }, }; -static const struct usb2_hub_descriptor_min at91dci_hubd = { +static const struct usb_hub_descriptor_min at91dci_hubd = { .bDescLength = sizeof(at91dci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, @@ -1746,8 +1746,8 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, at91dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product); static usb2_error_t -at91dci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +at91dci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { struct at91dci_softc *sc = AT9100_DCI_BUS2SC(udev->bus); const void *ptr; @@ -2143,11 +2143,11 @@ done: } static void -at91dci_xfer_setup(struct usb2_setup_params *parm) +at91dci_xfer_setup(struct usb_setup_params *parm) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; struct at91dci_softc *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t n; @@ -2252,14 +2252,14 @@ at91dci_xfer_setup(struct usb2_setup_params *parm) } static void -at91dci_xfer_unsetup(struct usb2_xfer *xfer) +at91dci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -at91dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +at91dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { struct at91dci_softc *sc = AT9100_DCI_BUS2SC(udev->bus); @@ -2298,7 +2298,7 @@ at91dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *ede } } -struct usb2_bus_methods at91dci_bus_methods = +struct usb_bus_methods at91dci_bus_methods = { .pipe_init = &at91dci_pipe_init, .xfer_setup = &at91dci_xfer_setup, diff --git a/sys/dev/usb/controller/at91dci.h b/sys/dev/usb/controller/at91dci.h index 87cbc87e2408..2d9bdccc2cc1 100644 --- a/sys/dev/usb/controller/at91dci.h +++ b/sys/dev/usb/controller/at91dci.h @@ -141,7 +141,7 @@ struct at91dci_td { bus_space_handle_t io_hdl; struct at91dci_td *obj_next; at91dci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; uint32_t offset; uint32_t remainder; uint16_t max_packet_size; @@ -157,7 +157,7 @@ struct at91dci_td { struct at91dci_std_temp { at91dci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; struct at91dci_td *td; struct at91dci_td *td_next; uint32_t len; @@ -173,14 +173,14 @@ struct at91dci_std_temp { }; struct at91dci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union at91dci_hub_temp { uWord wValue; - struct usb2_port_status ps; + struct usb_port_status ps; }; struct at91dci_ep_flags { @@ -202,10 +202,10 @@ struct at91dci_flags { }; struct at91dci_softc { - struct usb2_bus sc_bus; + struct usb_bus sc_bus; union at91dci_hub_temp sc_hub_temp; - struct usb2_device *sc_devices[AT91_MAX_DEVICES]; + struct usb_device *sc_devices[AT91_MAX_DEVICES]; struct resource *sc_io_res; struct resource *sc_irq_res; void *sc_intr_hdl; diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index df1fe781672f..5cbd7ba7ee10 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -74,23 +74,23 @@ SYSCTL_INT(_hw_usb_atmegadci, OID_AUTO, debug, CTLFLAG_RW, /* prototypes */ -struct usb2_bus_methods atmegadci_bus_methods; -struct usb2_pipe_methods atmegadci_device_non_isoc_methods; -struct usb2_pipe_methods atmegadci_device_isoc_fs_methods; +struct usb_bus_methods atmegadci_bus_methods; +struct usb_pipe_methods atmegadci_device_non_isoc_methods; +struct usb_pipe_methods atmegadci_device_isoc_fs_methods; static atmegadci_cmd_t atmegadci_setup_rx; static atmegadci_cmd_t atmegadci_data_rx; static atmegadci_cmd_t atmegadci_data_tx; static atmegadci_cmd_t atmegadci_data_tx_sync; -static void atmegadci_device_done(struct usb2_xfer *, usb2_error_t); -static void atmegadci_do_poll(struct usb2_bus *); -static void atmegadci_standard_done(struct usb2_xfer *); +static void atmegadci_device_done(struct usb_xfer *, usb2_error_t); +static void atmegadci_do_poll(struct usb_bus *); +static void atmegadci_standard_done(struct usb_xfer *); static void atmegadci_root_intr(struct atmegadci_softc *sc); /* * Here is a list of what the chip supports: */ -static const struct usb2_hw_ep_profile +static const struct usb_hw_ep_profile atmegadci_ep_profile[2] = { [0] = { @@ -112,8 +112,8 @@ static const struct usb2_hw_ep_profile }; static void -atmegadci_get_hw_ep_profile(struct usb2_device *udev, - const struct usb2_hw_ep_profile **ppf, uint8_t ep_addr) +atmegadci_get_hw_ep_profile(struct usb_device *udev, + const struct usb_hw_ep_profile **ppf, uint8_t ep_addr) { if (ep_addr == 0) *ppf = atmegadci_ep_profile; @@ -223,7 +223,7 @@ static uint8_t atmegadci_setup_rx(struct atmegadci_td *td) { struct atmegadci_softc *sc; - struct usb2_device_request req; + struct usb_device_request req; uint16_t count; uint8_t temp; @@ -308,7 +308,7 @@ static uint8_t atmegadci_data_rx(struct atmegadci_td *td) { struct atmegadci_softc *sc; - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t count; uint8_t temp; uint8_t to; @@ -422,7 +422,7 @@ static uint8_t atmegadci_data_tx(struct atmegadci_td *td) { struct atmegadci_softc *sc; - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t count; uint8_t to; uint8_t temp; @@ -549,7 +549,7 @@ not_complete: } static uint8_t -atmegadci_xfer_do_fifo(struct usb2_xfer *xfer) +atmegadci_xfer_do_fifo(struct usb_xfer *xfer) { struct atmegadci_td *td; @@ -594,7 +594,7 @@ done: static void atmegadci_interrupt_poll(struct atmegadci_softc *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -757,7 +757,7 @@ atmegadci_setup_standard_chain_sub(struct atmegadci_std_temp *temp) } static void -atmegadci_setup_standard_chain(struct usb2_xfer *xfer) +atmegadci_setup_standard_chain(struct usb_xfer *xfer) { struct atmegadci_std_temp temp; struct atmegadci_softc *sc; @@ -910,7 +910,7 @@ atmegadci_setup_standard_chain(struct usb2_xfer *xfer) static void atmegadci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -921,7 +921,7 @@ atmegadci_timeout(void *arg) } static void -atmegadci_start_standard_chain(struct usb2_xfer *xfer) +atmegadci_start_standard_chain(struct usb_xfer *xfer) { DPRINTFN(9, "\n"); @@ -954,7 +954,7 @@ atmegadci_root_intr(struct atmegadci_softc *sc) } static usb2_error_t -atmegadci_standard_done_sub(struct usb2_xfer *xfer) +atmegadci_standard_done_sub(struct usb_xfer *xfer) { struct atmegadci_td *td; uint32_t len; @@ -1018,7 +1018,7 @@ atmegadci_standard_done_sub(struct usb2_xfer *xfer) } static void -atmegadci_standard_done(struct usb2_xfer *xfer) +atmegadci_standard_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1067,7 +1067,7 @@ done: * same USB transfer! *------------------------------------------------------------------------*/ static void -atmegadci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +atmegadci_device_done(struct usb_xfer *xfer, usb2_error_t error) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); uint8_t ep_no; @@ -1093,8 +1093,8 @@ atmegadci_device_done(struct usb2_xfer *xfer, usb2_error_t error) } static void -atmegadci_set_stall(struct usb2_device *udev, struct usb2_xfer *xfer, - struct usb2_pipe *pipe) +atmegadci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, + struct usb_pipe *pipe) { struct atmegadci_softc *sc; uint8_t ep_no; @@ -1178,10 +1178,10 @@ atmegadci_clear_stall_sub(struct atmegadci_softc *sc, uint8_t ep_no, } static void -atmegadci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) +atmegadci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe) { struct atmegadci_softc *sc; - struct usb2_endpoint_descriptor *ed; + struct usb_endpoint_descriptor *ed; DPRINTFN(5, "pipe=%p\n", pipe); @@ -1344,7 +1344,7 @@ atmegadci_resume(struct atmegadci_softc *sc) } static void -atmegadci_do_poll(struct usb2_bus *bus) +atmegadci_do_poll(struct usb_bus *bus) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(bus); @@ -1359,32 +1359,32 @@ atmegadci_do_poll(struct usb2_bus *bus) * at91dci interrupt support *------------------------------------------------------------------------*/ static void -atmegadci_device_non_isoc_open(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_open(struct usb_xfer *xfer) { return; } static void -atmegadci_device_non_isoc_close(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_close(struct usb_xfer *xfer) { atmegadci_device_done(xfer, USB_ERR_CANCELLED); } static void -atmegadci_device_non_isoc_enter(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_enter(struct usb_xfer *xfer) { return; } static void -atmegadci_device_non_isoc_start(struct usb2_xfer *xfer) +atmegadci_device_non_isoc_start(struct usb_xfer *xfer) { /* setup TDs */ atmegadci_setup_standard_chain(xfer); atmegadci_start_standard_chain(xfer); } -struct usb2_pipe_methods atmegadci_device_non_isoc_methods = +struct usb_pipe_methods atmegadci_device_non_isoc_methods = { .open = atmegadci_device_non_isoc_open, .close = atmegadci_device_non_isoc_close, @@ -1396,19 +1396,19 @@ struct usb2_pipe_methods atmegadci_device_non_isoc_methods = * at91dci full speed isochronous support *------------------------------------------------------------------------*/ static void -atmegadci_device_isoc_fs_open(struct usb2_xfer *xfer) +atmegadci_device_isoc_fs_open(struct usb_xfer *xfer) { return; } static void -atmegadci_device_isoc_fs_close(struct usb2_xfer *xfer) +atmegadci_device_isoc_fs_close(struct usb_xfer *xfer) { atmegadci_device_done(xfer, USB_ERR_CANCELLED); } static void -atmegadci_device_isoc_fs_enter(struct usb2_xfer *xfer) +atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); uint32_t temp; @@ -1464,13 +1464,13 @@ atmegadci_device_isoc_fs_enter(struct usb2_xfer *xfer) } static void -atmegadci_device_isoc_fs_start(struct usb2_xfer *xfer) +atmegadci_device_isoc_fs_start(struct usb_xfer *xfer) { /* start TD chain */ atmegadci_start_standard_chain(xfer); } -struct usb2_pipe_methods atmegadci_device_isoc_fs_methods = +struct usb_pipe_methods atmegadci_device_isoc_fs_methods = { .open = atmegadci_device_isoc_fs_open, .close = atmegadci_device_isoc_fs_close, @@ -1484,8 +1484,8 @@ struct usb2_pipe_methods atmegadci_device_isoc_fs_methods = * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static const struct usb2_device_descriptor atmegadci_devd = { - .bLength = sizeof(struct usb2_device_descriptor), +static const struct usb_device_descriptor atmegadci_devd = { + .bLength = sizeof(struct usb_device_descriptor), .bDescriptorType = UDESC_DEVICE, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1498,8 +1498,8 @@ static const struct usb2_device_descriptor atmegadci_devd = { .bNumConfigurations = 1, }; -static const struct usb2_device_qualifier atmegadci_odevd = { - .bLength = sizeof(struct usb2_device_qualifier), +static const struct usb_device_qualifier atmegadci_odevd = { + .bLength = sizeof(struct usb_device_qualifier), .bDescriptorType = UDESC_DEVICE_QUALIFIER, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1511,7 +1511,7 @@ static const struct usb2_device_qualifier atmegadci_odevd = { static const struct atmegadci_config_desc atmegadci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(atmegadci_confd), .bNumInterface = 1, @@ -1521,7 +1521,7 @@ static const struct atmegadci_config_desc atmegadci_confd = { .bMaxPower = 0, }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -1529,7 +1529,7 @@ static const struct atmegadci_config_desc atmegadci_confd = { .bInterfaceProtocol = UIPROTO_HSHUBSTT, }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = (UE_DIR_IN | ATMEGA_INTR_ENDPT), .bmAttributes = UE_INTERRUPT, @@ -1538,7 +1538,7 @@ static const struct atmegadci_config_desc atmegadci_confd = { }, }; -static const struct usb2_hub_descriptor_min atmegadci_hubd = { +static const struct usb_hub_descriptor_min atmegadci_hubd = { .bDescLength = sizeof(atmegadci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, @@ -1567,8 +1567,8 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, atmegadci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product); static usb2_error_t -atmegadci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +atmegadci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(udev->bus); const void *ptr; @@ -1995,11 +1995,11 @@ done: } static void -atmegadci_xfer_setup(struct usb2_setup_params *parm) +atmegadci_xfer_setup(struct usb_setup_params *parm) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; struct atmegadci_softc *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t n; @@ -2082,14 +2082,14 @@ atmegadci_xfer_setup(struct usb2_setup_params *parm) } static void -atmegadci_xfer_unsetup(struct usb2_xfer *xfer) +atmegadci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -atmegadci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +atmegadci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(udev->bus); @@ -2115,7 +2115,7 @@ atmegadci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *e } } -struct usb2_bus_methods atmegadci_bus_methods = +struct usb_bus_methods atmegadci_bus_methods = { .pipe_init = &atmegadci_pipe_init, .xfer_setup = &atmegadci_xfer_setup, diff --git a/sys/dev/usb/controller/atmegadci.h b/sys/dev/usb/controller/atmegadci.h index 8f5a538d5678..2e9e9f66762e 100644 --- a/sys/dev/usb/controller/atmegadci.h +++ b/sys/dev/usb/controller/atmegadci.h @@ -191,12 +191,12 @@ struct atmegadci_td; typedef uint8_t (atmegadci_cmd_t)(struct atmegadci_td *td); -typedef void (atmegadci_clocks_t)(struct usb2_bus *); +typedef void (atmegadci_clocks_t)(struct usb_bus *); struct atmegadci_td { struct atmegadci_td *obj_next; atmegadci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; uint32_t offset; uint32_t remainder; uint16_t max_packet_size; @@ -210,7 +210,7 @@ struct atmegadci_td { struct atmegadci_std_temp { atmegadci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; struct atmegadci_td *td; struct atmegadci_td *td_next; uint32_t len; @@ -226,14 +226,14 @@ struct atmegadci_std_temp { }; struct atmegadci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union atmegadci_hub_temp { uWord wValue; - struct usb2_port_status ps; + struct usb_port_status ps; }; struct atmegadci_flags { @@ -251,14 +251,14 @@ struct atmegadci_flags { }; struct atmegadci_softc { - struct usb2_bus sc_bus; + struct usb_bus sc_bus; union atmegadci_hub_temp sc_hub_temp; /* must be set by by the bus interface layer */ atmegadci_clocks_t *sc_clocks_on; atmegadci_clocks_t *sc_clocks_off; - struct usb2_device *sc_devices[ATMEGA_MAX_DEVICES]; + struct usb_device *sc_devices[ATMEGA_MAX_DEVICES]; struct resource *sc_irq_res; void *sc_intr_hdl; struct resource *sc_io_res; diff --git a/sys/dev/usb/controller/atmegadci_atmelarm.c b/sys/dev/usb/controller/atmegadci_atmelarm.c index df305ac96c39..641285151ab1 100644 --- a/sys/dev/usb/controller/atmegadci_atmelarm.c +++ b/sys/dev/usb/controller/atmegadci_atmelarm.c @@ -49,13 +49,13 @@ struct atmegadci_super_softc { }; static void -atmegadci_clocks_on(struct usb2_bus *bus) +atmegadci_clocks_on(struct usb_bus *bus) { /* TODO */ } static void -atmegadci_clocks_off(struct usb2_bus *bus) +atmegadci_clocks_off(struct usb_bus *bus) { /* TODO */ } diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index 1836589aa906..d54ff6f3ff98 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -74,23 +74,23 @@ SYSCTL_INT(_hw_usb_avr32dci, OID_AUTO, debug, CTLFLAG_RW, /* prototypes */ -struct usb2_bus_methods avr32dci_bus_methods; -struct usb2_pipe_methods avr32dci_device_non_isoc_methods; -struct usb2_pipe_methods avr32dci_device_isoc_fs_methods; +struct usb_bus_methods avr32dci_bus_methods; +struct usb_pipe_methods avr32dci_device_non_isoc_methods; +struct usb_pipe_methods avr32dci_device_isoc_fs_methods; static avr32dci_cmd_t avr32dci_setup_rx; static avr32dci_cmd_t avr32dci_data_rx; static avr32dci_cmd_t avr32dci_data_tx; static avr32dci_cmd_t avr32dci_data_tx_sync; -static void avr32dci_device_done(struct usb2_xfer *, usb2_error_t); -static void avr32dci_do_poll(struct usb2_bus *); -static void avr32dci_standard_done(struct usb2_xfer *); +static void avr32dci_device_done(struct usb_xfer *, usb2_error_t); +static void avr32dci_do_poll(struct usb_bus *); +static void avr32dci_standard_done(struct usb_xfer *); static void avr32dci_root_intr(struct avr32dci_softc *sc); /* * Here is a list of what the chip supports: */ -static const struct usb2_hw_ep_profile +static const struct usb_hw_ep_profile avr32dci_ep_profile[4] = { [0] = { @@ -134,8 +134,8 @@ static const struct usb2_hw_ep_profile }; static void -avr32dci_get_hw_ep_profile(struct usb2_device *udev, - const struct usb2_hw_ep_profile **ppf, uint8_t ep_addr) +avr32dci_get_hw_ep_profile(struct usb_device *udev, + const struct usb_hw_ep_profile **ppf, uint8_t ep_addr) { if (ep_addr == 0) *ppf = avr32dci_ep_profile; @@ -254,7 +254,7 @@ static uint8_t avr32dci_setup_rx(struct avr32dci_td *td) { struct avr32dci_softc *sc; - struct usb2_device_request req; + struct usb_device_request req; uint16_t count; uint32_t temp; @@ -329,7 +329,7 @@ static uint8_t avr32dci_data_rx(struct avr32dci_td *td) { struct avr32dci_softc *sc; - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t count; uint32_t temp; uint8_t to; @@ -429,7 +429,7 @@ static uint8_t avr32dci_data_tx(struct avr32dci_td *td) { struct avr32dci_softc *sc; - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t count; uint8_t to; uint32_t temp; @@ -538,7 +538,7 @@ not_complete: } static uint8_t -avr32dci_xfer_do_fifo(struct usb2_xfer *xfer) +avr32dci_xfer_do_fifo(struct usb_xfer *xfer) { struct avr32dci_td *td; @@ -583,7 +583,7 @@ done: static void avr32dci_interrupt_poll(struct avr32dci_softc *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -727,7 +727,7 @@ avr32dci_setup_standard_chain_sub(struct avr32dci_std_temp *temp) } static void -avr32dci_setup_standard_chain(struct usb2_xfer *xfer) +avr32dci_setup_standard_chain(struct usb_xfer *xfer) { struct avr32dci_std_temp temp; struct avr32dci_softc *sc; @@ -878,7 +878,7 @@ avr32dci_setup_standard_chain(struct usb2_xfer *xfer) static void avr32dci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -889,7 +889,7 @@ avr32dci_timeout(void *arg) } static void -avr32dci_start_standard_chain(struct usb2_xfer *xfer) +avr32dci_start_standard_chain(struct usb_xfer *xfer) { DPRINTFN(9, "\n"); @@ -925,7 +925,7 @@ avr32dci_root_intr(struct avr32dci_softc *sc) } static usb2_error_t -avr32dci_standard_done_sub(struct usb2_xfer *xfer) +avr32dci_standard_done_sub(struct usb_xfer *xfer) { struct avr32dci_td *td; uint32_t len; @@ -989,7 +989,7 @@ avr32dci_standard_done_sub(struct usb2_xfer *xfer) } static void -avr32dci_standard_done(struct usb2_xfer *xfer) +avr32dci_standard_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1038,7 +1038,7 @@ done: * same USB transfer! *------------------------------------------------------------------------*/ static void -avr32dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +avr32dci_device_done(struct usb_xfer *xfer, usb2_error_t error) { struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); uint8_t ep_no; @@ -1061,8 +1061,8 @@ avr32dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) } static void -avr32dci_set_stall(struct usb2_device *udev, struct usb2_xfer *xfer, - struct usb2_pipe *pipe) +avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, + struct usb_pipe *pipe) { struct avr32dci_softc *sc; uint8_t ep_no; @@ -1086,7 +1086,7 @@ static void avr32dci_clear_stall_sub(struct avr32dci_softc *sc, uint8_t ep_no, uint8_t ep_type, uint8_t ep_dir) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; uint32_t temp; uint32_t epsize; uint8_t n; @@ -1148,10 +1148,10 @@ avr32dci_clear_stall_sub(struct avr32dci_softc *sc, uint8_t ep_no, } static void -avr32dci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) +avr32dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe) { struct avr32dci_softc *sc; - struct usb2_endpoint_descriptor *ed; + struct usb_endpoint_descriptor *ed; DPRINTFN(5, "pipe=%p\n", pipe); @@ -1279,7 +1279,7 @@ avr32dci_resume(struct avr32dci_softc *sc) } static void -avr32dci_do_poll(struct usb2_bus *bus) +avr32dci_do_poll(struct usb_bus *bus) { struct avr32dci_softc *sc = AVR32_BUS2SC(bus); @@ -1294,32 +1294,32 @@ avr32dci_do_poll(struct usb2_bus *bus) * at91dci interrupt support *------------------------------------------------------------------------*/ static void -avr32dci_device_non_isoc_open(struct usb2_xfer *xfer) +avr32dci_device_non_isoc_open(struct usb_xfer *xfer) { return; } static void -avr32dci_device_non_isoc_close(struct usb2_xfer *xfer) +avr32dci_device_non_isoc_close(struct usb_xfer *xfer) { avr32dci_device_done(xfer, USB_ERR_CANCELLED); } static void -avr32dci_device_non_isoc_enter(struct usb2_xfer *xfer) +avr32dci_device_non_isoc_enter(struct usb_xfer *xfer) { return; } static void -avr32dci_device_non_isoc_start(struct usb2_xfer *xfer) +avr32dci_device_non_isoc_start(struct usb_xfer *xfer) { /* setup TDs */ avr32dci_setup_standard_chain(xfer); avr32dci_start_standard_chain(xfer); } -struct usb2_pipe_methods avr32dci_device_non_isoc_methods = +struct usb_pipe_methods avr32dci_device_non_isoc_methods = { .open = avr32dci_device_non_isoc_open, .close = avr32dci_device_non_isoc_close, @@ -1331,19 +1331,19 @@ struct usb2_pipe_methods avr32dci_device_non_isoc_methods = * at91dci full speed isochronous support *------------------------------------------------------------------------*/ static void -avr32dci_device_isoc_fs_open(struct usb2_xfer *xfer) +avr32dci_device_isoc_fs_open(struct usb_xfer *xfer) { return; } static void -avr32dci_device_isoc_fs_close(struct usb2_xfer *xfer) +avr32dci_device_isoc_fs_close(struct usb_xfer *xfer) { avr32dci_device_done(xfer, USB_ERR_CANCELLED); } static void -avr32dci_device_isoc_fs_enter(struct usb2_xfer *xfer) +avr32dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); uint32_t temp; @@ -1398,13 +1398,13 @@ avr32dci_device_isoc_fs_enter(struct usb2_xfer *xfer) } static void -avr32dci_device_isoc_fs_start(struct usb2_xfer *xfer) +avr32dci_device_isoc_fs_start(struct usb_xfer *xfer) { /* start TD chain */ avr32dci_start_standard_chain(xfer); } -struct usb2_pipe_methods avr32dci_device_isoc_fs_methods = +struct usb_pipe_methods avr32dci_device_isoc_fs_methods = { .open = avr32dci_device_isoc_fs_open, .close = avr32dci_device_isoc_fs_close, @@ -1418,8 +1418,8 @@ struct usb2_pipe_methods avr32dci_device_isoc_fs_methods = * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static const struct usb2_device_descriptor avr32dci_devd = { - .bLength = sizeof(struct usb2_device_descriptor), +static const struct usb_device_descriptor avr32dci_devd = { + .bLength = sizeof(struct usb_device_descriptor), .bDescriptorType = UDESC_DEVICE, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1432,8 +1432,8 @@ static const struct usb2_device_descriptor avr32dci_devd = { .bNumConfigurations = 1, }; -static const struct usb2_device_qualifier avr32dci_odevd = { - .bLength = sizeof(struct usb2_device_qualifier), +static const struct usb_device_qualifier avr32dci_odevd = { + .bLength = sizeof(struct usb_device_qualifier), .bDescriptorType = UDESC_DEVICE_QUALIFIER, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1445,7 +1445,7 @@ static const struct usb2_device_qualifier avr32dci_odevd = { static const struct avr32dci_config_desc avr32dci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(avr32dci_confd), .bNumInterface = 1, @@ -1455,7 +1455,7 @@ static const struct avr32dci_config_desc avr32dci_confd = { .bMaxPower = 0, }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -1463,7 +1463,7 @@ static const struct avr32dci_config_desc avr32dci_confd = { .bInterfaceProtocol = UIPROTO_HSHUBSTT, }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = (UE_DIR_IN | AVR32_INTR_ENDPT), .bmAttributes = UE_INTERRUPT, @@ -1472,7 +1472,7 @@ static const struct avr32dci_config_desc avr32dci_confd = { }, }; -static const struct usb2_hub_descriptor_min avr32dci_hubd = { +static const struct usb_hub_descriptor_min avr32dci_hubd = { .bDescLength = sizeof(avr32dci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, @@ -1501,8 +1501,8 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, avr32dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, avr32dci_product); static usb2_error_t -avr32dci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +avr32dci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { struct avr32dci_softc *sc = AVR32_BUS2SC(udev->bus); const void *ptr; @@ -1928,11 +1928,11 @@ done: } static void -avr32dci_xfer_setup(struct usb2_setup_params *parm) +avr32dci_xfer_setup(struct usb_setup_params *parm) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; struct avr32dci_softc *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t n; @@ -2019,14 +2019,14 @@ avr32dci_xfer_setup(struct usb2_setup_params *parm) } static void -avr32dci_xfer_unsetup(struct usb2_xfer *xfer) +avr32dci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -avr32dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +avr32dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { struct avr32dci_softc *sc = AVR32_BUS2SC(udev->bus); @@ -2053,7 +2053,7 @@ avr32dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *ed } } -struct usb2_bus_methods avr32dci_bus_methods = +struct usb_bus_methods avr32dci_bus_methods = { .pipe_init = &avr32dci_pipe_init, .xfer_setup = &avr32dci_xfer_setup, diff --git a/sys/dev/usb/controller/avr32dci.h b/sys/dev/usb/controller/avr32dci.h index 6a9895f2fff5..5e2daf56a0f0 100644 --- a/sys/dev/usb/controller/avr32dci.h +++ b/sys/dev/usb/controller/avr32dci.h @@ -157,12 +157,12 @@ struct avr32dci_td; typedef uint8_t (avr32dci_cmd_t)(struct avr32dci_td *td); -typedef void (avr32dci_clocks_t)(struct usb2_bus *); +typedef void (avr32dci_clocks_t)(struct usb_bus *); struct avr32dci_td { struct avr32dci_td *obj_next; avr32dci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; uint32_t offset; uint32_t remainder; uint16_t max_packet_size; @@ -176,7 +176,7 @@ struct avr32dci_td { struct avr32dci_std_temp { avr32dci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; struct avr32dci_td *td; struct avr32dci_td *td_next; uint32_t len; @@ -193,14 +193,14 @@ struct avr32dci_std_temp { }; struct avr32dci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union avr32dci_hub_temp { uWord wValue; - struct usb2_port_status ps; + struct usb_port_status ps; }; struct avr32dci_flags { @@ -218,14 +218,14 @@ struct avr32dci_flags { }; struct avr32dci_softc { - struct usb2_bus sc_bus; + struct usb_bus sc_bus; union avr32dci_hub_temp sc_hub_temp; /* must be set by by the bus interface layer */ avr32dci_clocks_t *sc_clocks_on; avr32dci_clocks_t *sc_clocks_off; - struct usb2_device *sc_devices[AVR32_MAX_DEVICES]; + struct usb_device *sc_devices[AVR32_MAX_DEVICES]; struct resource *sc_irq_res; void *sc_intr_hdl; struct resource *sc_io_res; diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c index c3b7ba4ca5bc..69889e7e0a6b 100644 --- a/sys/dev/usb/controller/ehci.c +++ b/sys/dev/usb/controller/ehci.c @@ -86,22 +86,22 @@ static void ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_t *sqh); #define EHCI_INTR_ENDPT 1 -extern struct usb2_bus_methods ehci_bus_methods; -extern struct usb2_pipe_methods ehci_device_bulk_methods; -extern struct usb2_pipe_methods ehci_device_ctrl_methods; -extern struct usb2_pipe_methods ehci_device_intr_methods; -extern struct usb2_pipe_methods ehci_device_isoc_fs_methods; -extern struct usb2_pipe_methods ehci_device_isoc_hs_methods; - -static void ehci_do_poll(struct usb2_bus *bus); -static void ehci_device_done(struct usb2_xfer *xfer, usb2_error_t error); -static uint8_t ehci_check_transfer(struct usb2_xfer *xfer); +extern struct usb_bus_methods ehci_bus_methods; +extern struct usb_pipe_methods ehci_device_bulk_methods; +extern struct usb_pipe_methods ehci_device_ctrl_methods; +extern struct usb_pipe_methods ehci_device_intr_methods; +extern struct usb_pipe_methods ehci_device_isoc_fs_methods; +extern struct usb_pipe_methods ehci_device_isoc_hs_methods; + +static void ehci_do_poll(struct usb_bus *bus); +static void ehci_device_done(struct usb_xfer *xfer, usb2_error_t error); +static uint8_t ehci_check_transfer(struct usb_xfer *xfer); static void ehci_timeout(void *arg); static void ehci_root_intr(ehci_softc_t *sc); struct ehci_std_temp { ehci_softc_t *sc; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; ehci_qtd_t *td; ehci_qtd_t *td_next; uint32_t average; @@ -115,7 +115,7 @@ struct ehci_std_temp { }; void -ehci_iterate_hw_softc(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *cb) +ehci_iterate_hw_softc(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *cb) { ehci_softc_t *sc = EHCI_BUS2SC(bus); uint32_t i; @@ -208,7 +208,7 @@ ehci_hcreset(ehci_softc_t *sc) usb2_error_t ehci_init(ehci_softc_t *sc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint32_t version; uint32_t sparams; uint32_t cparams; @@ -570,7 +570,7 @@ ehci_suspend(ehci_softc_t *sc) void ehci_resume(ehci_softc_t *sc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint32_t cmd; uint32_t hcr; uint8_t i; @@ -952,7 +952,7 @@ ehci_dump_isoc(ehci_softc_t *sc) #endif static void -ehci_transfer_intr_enqueue(struct usb2_xfer *xfer) +ehci_transfer_intr_enqueue(struct usb_xfer *xfer) { /* check for early completion */ if (ehci_check_transfer(xfer)) { @@ -1121,7 +1121,7 @@ _ehci_remove_qh(ehci_qh_t *sqh, ehci_qh_t *last) } static usb2_error_t -ehci_non_isoc_done_sub(struct usb2_xfer *xfer) +ehci_non_isoc_done_sub(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_qtd_t *td; @@ -1214,7 +1214,7 @@ ehci_non_isoc_done_sub(struct usb2_xfer *xfer) } static void -ehci_non_isoc_done(struct usb2_xfer *xfer) +ehci_non_isoc_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1272,9 +1272,9 @@ done: * Else: USB transfer is finished *------------------------------------------------------------------------*/ static uint8_t -ehci_check_transfer(struct usb2_xfer *xfer) +ehci_check_transfer(struct usb_xfer *xfer) { - struct usb2_pipe_methods *methods = xfer->pipe->methods; + struct usb_pipe_methods *methods = xfer->pipe->methods; ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint32_t status; @@ -1408,7 +1408,7 @@ ehci_pcd_enable(ehci_softc_t *sc) static void ehci_interrupt_poll(ehci_softc_t *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -1499,7 +1499,7 @@ done: static void ehci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -1510,7 +1510,7 @@ ehci_timeout(void *arg) } static void -ehci_do_poll(struct usb2_bus *bus) +ehci_do_poll(struct usb_bus *bus) { ehci_softc_t *sc = EHCI_BUS2SC(bus); @@ -1522,7 +1522,7 @@ ehci_do_poll(struct usb2_bus *bus) static void ehci_setup_standard_chain_sub(struct ehci_std_temp *temp) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; ehci_qtd_t *td; ehci_qtd_t *td_next; ehci_qtd_t *td_alt_next; @@ -1705,10 +1705,10 @@ restart: } static void -ehci_setup_standard_chain(struct usb2_xfer *xfer, ehci_qh_t **qh_last) +ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last) { struct ehci_std_temp temp; - struct usb2_pipe_methods *methods; + struct usb_pipe_methods *methods; ehci_qh_t *qh; ehci_qtd_t *td; uint32_t qh_endp; @@ -1990,7 +1990,7 @@ ehci_root_intr(ehci_softc_t *sc) } static void -ehci_isoc_fs_done(ehci_softc_t *sc, struct usb2_xfer *xfer) +ehci_isoc_fs_done(ehci_softc_t *sc, struct usb_xfer *xfer) { uint32_t nframes = xfer->nframes; uint32_t status; @@ -2043,7 +2043,7 @@ ehci_isoc_fs_done(ehci_softc_t *sc, struct usb2_xfer *xfer) } static void -ehci_isoc_hs_done(ehci_softc_t *sc, struct usb2_xfer *xfer) +ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_xfer *xfer) { uint32_t nframes = xfer->nframes; uint32_t status; @@ -2111,9 +2111,9 @@ ehci_isoc_hs_done(ehci_softc_t *sc, struct usb2_xfer *xfer) * from close and from interrupt */ static void -ehci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +ehci_device_done(struct usb_xfer *xfer, usb2_error_t error) { - struct usb2_pipe_methods *methods = xfer->pipe->methods; + struct usb_pipe_methods *methods = xfer->pipe->methods; ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -2162,25 +2162,25 @@ ehci_device_done(struct usb2_xfer *xfer, usb2_error_t error) * ehci bulk support *------------------------------------------------------------------------*/ static void -ehci_device_bulk_open(struct usb2_xfer *xfer) +ehci_device_bulk_open(struct usb_xfer *xfer) { return; } static void -ehci_device_bulk_close(struct usb2_xfer *xfer) +ehci_device_bulk_close(struct usb_xfer *xfer) { ehci_device_done(xfer, USB_ERR_CANCELLED); } static void -ehci_device_bulk_enter(struct usb2_xfer *xfer) +ehci_device_bulk_enter(struct usb_xfer *xfer) { return; } static void -ehci_device_bulk_start(struct usb2_xfer *xfer) +ehci_device_bulk_start(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint32_t temp; @@ -2200,7 +2200,7 @@ ehci_device_bulk_start(struct usb2_xfer *xfer) EOWRITE4(sc, EHCI_USBCMD, temp | EHCI_CMD_IAAD); } -struct usb2_pipe_methods ehci_device_bulk_methods = +struct usb_pipe_methods ehci_device_bulk_methods = { .open = ehci_device_bulk_open, .close = ehci_device_bulk_close, @@ -2212,25 +2212,25 @@ struct usb2_pipe_methods ehci_device_bulk_methods = * ehci control support *------------------------------------------------------------------------*/ static void -ehci_device_ctrl_open(struct usb2_xfer *xfer) +ehci_device_ctrl_open(struct usb_xfer *xfer) { return; } static void -ehci_device_ctrl_close(struct usb2_xfer *xfer) +ehci_device_ctrl_close(struct usb_xfer *xfer) { ehci_device_done(xfer, USB_ERR_CANCELLED); } static void -ehci_device_ctrl_enter(struct usb2_xfer *xfer) +ehci_device_ctrl_enter(struct usb_xfer *xfer) { return; } static void -ehci_device_ctrl_start(struct usb2_xfer *xfer) +ehci_device_ctrl_start(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); @@ -2241,7 +2241,7 @@ ehci_device_ctrl_start(struct usb2_xfer *xfer) ehci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ehci_device_ctrl_methods = +struct usb_pipe_methods ehci_device_ctrl_methods = { .open = ehci_device_ctrl_open, .close = ehci_device_ctrl_close, @@ -2253,7 +2253,7 @@ struct usb2_pipe_methods ehci_device_ctrl_methods = * ehci interrupt support *------------------------------------------------------------------------*/ static void -ehci_device_intr_open(struct usb2_xfer *xfer) +ehci_device_intr_open(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint16_t best; @@ -2306,7 +2306,7 @@ ehci_device_intr_open(struct usb2_xfer *xfer) } static void -ehci_device_intr_close(struct usb2_xfer *xfer) +ehci_device_intr_close(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); uint8_t slot; @@ -2320,13 +2320,13 @@ ehci_device_intr_close(struct usb2_xfer *xfer) } static void -ehci_device_intr_enter(struct usb2_xfer *xfer) +ehci_device_intr_enter(struct usb_xfer *xfer) { return; } static void -ehci_device_intr_start(struct usb2_xfer *xfer) +ehci_device_intr_start(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); @@ -2337,7 +2337,7 @@ ehci_device_intr_start(struct usb2_xfer *xfer) ehci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ehci_device_intr_methods = +struct usb_pipe_methods ehci_device_intr_methods = { .open = ehci_device_intr_open, .close = ehci_device_intr_close, @@ -2349,7 +2349,7 @@ struct usb2_pipe_methods ehci_device_intr_methods = * ehci full speed isochronous support *------------------------------------------------------------------------*/ static void -ehci_device_isoc_fs_open(struct usb2_xfer *xfer) +ehci_device_isoc_fs_open(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_sitd_t *td; @@ -2390,19 +2390,19 @@ ehci_device_isoc_fs_open(struct usb2_xfer *xfer) } static void -ehci_device_isoc_fs_close(struct usb2_xfer *xfer) +ehci_device_isoc_fs_close(struct usb_xfer *xfer) { ehci_device_done(xfer, USB_ERR_CANCELLED); } static void -ehci_device_isoc_fs_enter(struct usb2_xfer *xfer) +ehci_device_isoc_fs_enter(struct usb_xfer *xfer) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); - struct usb2_fs_isoc_schedule *fss_start; - struct usb2_fs_isoc_schedule *fss_end; - struct usb2_fs_isoc_schedule *fss; + struct usb_fs_isoc_schedule *fss_start; + struct usb_fs_isoc_schedule *fss_end; + struct usb_fs_isoc_schedule *fss; ehci_sitd_t *td; ehci_sitd_t *td_last = NULL; ehci_sitd_t **pp_last; @@ -2614,13 +2614,13 @@ ehci_device_isoc_fs_enter(struct usb2_xfer *xfer) } static void -ehci_device_isoc_fs_start(struct usb2_xfer *xfer) +ehci_device_isoc_fs_start(struct usb_xfer *xfer) { /* put transfer on interrupt queue */ ehci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ehci_device_isoc_fs_methods = +struct usb_pipe_methods ehci_device_isoc_fs_methods = { .open = ehci_device_isoc_fs_open, .close = ehci_device_isoc_fs_close, @@ -2632,7 +2632,7 @@ struct usb2_pipe_methods ehci_device_isoc_fs_methods = * ehci high speed isochronous support *------------------------------------------------------------------------*/ static void -ehci_device_isoc_hs_open(struct usb2_xfer *xfer) +ehci_device_isoc_hs_open(struct usb_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_itd_t *td; @@ -2679,15 +2679,15 @@ ehci_device_isoc_hs_open(struct usb2_xfer *xfer) } static void -ehci_device_isoc_hs_close(struct usb2_xfer *xfer) +ehci_device_isoc_hs_close(struct usb_xfer *xfer) { ehci_device_done(xfer, USB_ERR_CANCELLED); } static void -ehci_device_isoc_hs_enter(struct usb2_xfer *xfer) +ehci_device_isoc_hs_enter(struct usb_xfer *xfer) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); ehci_itd_t *td; ehci_itd_t *td_last = NULL; @@ -2880,13 +2880,13 @@ ehci_device_isoc_hs_enter(struct usb2_xfer *xfer) } static void -ehci_device_isoc_hs_start(struct usb2_xfer *xfer) +ehci_device_isoc_hs_start(struct usb_xfer *xfer) { /* put transfer on interrupt queue */ ehci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ehci_device_isoc_hs_methods = +struct usb_pipe_methods ehci_device_isoc_hs_methods = { .open = ehci_device_isoc_hs_open, .close = ehci_device_isoc_hs_close, @@ -2901,9 +2901,9 @@ struct usb2_pipe_methods ehci_device_isoc_hs_methods = *------------------------------------------------------------------------*/ static const -struct usb2_device_descriptor ehci_devd = +struct usb_device_descriptor ehci_devd = { - sizeof(struct usb2_device_descriptor), + sizeof(struct usb_device_descriptor), UDESC_DEVICE, /* type */ {0x00, 0x02}, /* USB version */ UDCLASS_HUB, /* class */ @@ -2916,9 +2916,9 @@ struct usb2_device_descriptor ehci_devd = }; static const -struct usb2_device_qualifier ehci_odevd = +struct usb_device_qualifier ehci_odevd = { - sizeof(struct usb2_device_qualifier), + sizeof(struct usb_device_qualifier), UDESC_DEVICE_QUALIFIER, /* type */ {0x00, 0x02}, /* USB version */ UDCLASS_HUB, /* class */ @@ -2931,7 +2931,7 @@ struct usb2_device_qualifier ehci_odevd = static const struct ehci_config_desc ehci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(ehci_confd), .bNumInterface = 1, @@ -2941,7 +2941,7 @@ static const struct ehci_config_desc ehci_confd = { .bMaxPower = 0 /* max power */ }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -2950,7 +2950,7 @@ static const struct ehci_config_desc ehci_confd = { 0 }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = UE_DIR_IN | EHCI_INTR_ENDPT, .bmAttributes = UE_INTERRUPT, @@ -2960,7 +2960,7 @@ static const struct ehci_config_desc ehci_confd = { }; static const -struct usb2_hub_descriptor ehci_hubd = +struct usb_hub_descriptor ehci_hubd = { 0, /* dynamic length */ UDESC_HUB, @@ -2985,8 +2985,8 @@ ehci_disown(ehci_softc_t *sc, uint16_t index, uint8_t lowspeed) } static usb2_error_t -ehci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +ehci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); const char *str_ptr; @@ -3378,12 +3378,12 @@ done: } static void -ehci_xfer_setup(struct usb2_setup_params *parm) +ehci_xfer_setup(struct usb_setup_params *parm) { - struct usb2_page_search page_info; - struct usb2_page_cache *pc; + struct usb_page_search page_info; + struct usb_page_cache *pc; ehci_softc_t *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t nqtd; uint32_t nqh; @@ -3629,14 +3629,14 @@ alloc_dma_set: } static void -ehci_xfer_unsetup(struct usb2_xfer *xfer) +ehci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -ehci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +ehci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); @@ -3688,7 +3688,7 @@ done: } static void -ehci_get_dma_delay(struct usb2_bus *bus, uint32_t *pus) +ehci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) { /* * Wait until the hardware has finished any possible use of @@ -3698,11 +3698,11 @@ ehci_get_dma_delay(struct usb2_bus *bus, uint32_t *pus) } static void -ehci_device_resume(struct usb2_device *udev) +ehci_device_resume(struct usb_device *udev) { ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); - struct usb2_xfer *xfer; - struct usb2_pipe_methods *methods; + struct usb_xfer *xfer; + struct usb_pipe_methods *methods; DPRINTF("\n"); @@ -3732,11 +3732,11 @@ ehci_device_resume(struct usb2_device *udev) } static void -ehci_device_suspend(struct usb2_device *udev) +ehci_device_suspend(struct usb_device *udev) { ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); - struct usb2_xfer *xfer; - struct usb2_pipe_methods *methods; + struct usb_xfer *xfer; + struct usb_pipe_methods *methods; DPRINTF("\n"); @@ -3766,7 +3766,7 @@ ehci_device_suspend(struct usb2_device *udev) } static void -ehci_set_hw_power(struct usb2_bus *bus) +ehci_set_hw_power(struct usb_bus *bus) { ehci_softc_t *sc = EHCI_BUS2SC(bus); uint32_t temp; @@ -3799,7 +3799,7 @@ ehci_set_hw_power(struct usb2_bus *bus) return; } -struct usb2_bus_methods ehci_bus_methods = +struct usb_bus_methods ehci_bus_methods = { .pipe_init = ehci_pipe_init, .xfer_setup = ehci_xfer_setup, diff --git a/sys/dev/usb/controller/ehci.h b/sys/dev/usb/controller/ehci.h index b8c59ef0cad5..f23be4e49b7e 100644 --- a/sys/dev/usb/controller/ehci.h +++ b/sys/dev/usb/controller/ehci.h @@ -253,7 +253,7 @@ struct ehci_itd { struct ehci_itd *next; struct ehci_itd *prev; struct ehci_itd *obj_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; } __aligned(EHCI_ITD_ALIGN); typedef struct ehci_itd ehci_itd_t; @@ -301,7 +301,7 @@ struct ehci_sitd { struct ehci_sitd *next; struct ehci_sitd *prev; struct ehci_sitd *obj_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; } __aligned(EHCI_SITD_ALIGN); typedef struct ehci_sitd ehci_sitd_t; @@ -347,7 +347,7 @@ struct ehci_qtd { */ struct ehci_qtd *alt_next; struct ehci_qtd *obj_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; uint32_t qtd_self; uint16_t len; } __aligned(EHCI_QTD_ALIGN); @@ -409,7 +409,7 @@ struct ehci_qh { struct ehci_qh *next; struct ehci_qh *prev; struct ehci_qh *obj_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; uint32_t qh_self; } __aligned(EHCI_QH_ALIGN); @@ -424,39 +424,39 @@ struct ehci_fstn { typedef struct ehci_fstn ehci_fstn_t; struct ehci_hw_softc { - struct usb2_page_cache pframes_pc; - struct usb2_page_cache async_start_pc; - struct usb2_page_cache intr_start_pc[EHCI_VIRTUAL_FRAMELIST_COUNT]; - struct usb2_page_cache isoc_hs_start_pc[EHCI_VIRTUAL_FRAMELIST_COUNT]; - struct usb2_page_cache isoc_fs_start_pc[EHCI_VIRTUAL_FRAMELIST_COUNT]; - - struct usb2_page pframes_pg; - struct usb2_page async_start_pg; - struct usb2_page intr_start_pg[EHCI_VIRTUAL_FRAMELIST_COUNT]; - struct usb2_page isoc_hs_start_pg[EHCI_VIRTUAL_FRAMELIST_COUNT]; - struct usb2_page isoc_fs_start_pg[EHCI_VIRTUAL_FRAMELIST_COUNT]; + struct usb_page_cache pframes_pc; + struct usb_page_cache async_start_pc; + struct usb_page_cache intr_start_pc[EHCI_VIRTUAL_FRAMELIST_COUNT]; + struct usb_page_cache isoc_hs_start_pc[EHCI_VIRTUAL_FRAMELIST_COUNT]; + struct usb_page_cache isoc_fs_start_pc[EHCI_VIRTUAL_FRAMELIST_COUNT]; + + struct usb_page pframes_pg; + struct usb_page async_start_pg; + struct usb_page intr_start_pg[EHCI_VIRTUAL_FRAMELIST_COUNT]; + struct usb_page isoc_hs_start_pg[EHCI_VIRTUAL_FRAMELIST_COUNT]; + struct usb_page isoc_fs_start_pg[EHCI_VIRTUAL_FRAMELIST_COUNT]; }; struct ehci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union ehci_hub_desc { - struct usb2_status stat; - struct usb2_port_status ps; - struct usb2_hub_descriptor hubd; + struct usb_status stat; + struct usb_port_status ps; + struct usb_hub_descriptor hubd; uint8_t temp[128]; }; typedef struct ehci_softc { struct ehci_hw_softc sc_hw; - struct usb2_bus sc_bus; /* base device */ - struct usb2_callout sc_tmo_pcd; + struct usb_bus sc_bus; /* base device */ + struct usb_callout sc_tmo_pcd; union ehci_hub_desc sc_hub_desc; - struct usb2_device *sc_devices[EHCI_MAX_DEVICES]; + struct usb_device *sc_devices[EHCI_MAX_DEVICES]; struct resource *sc_io_res; struct resource *sc_irq_res; struct ehci_qh *sc_async_p_last; diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index 6b867d5750c8..9001e699bd2c 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -74,11 +74,11 @@ SYSCTL_INT(_hw_usb_musbotg, OID_AUTO, debug, CTLFLAG_RW, /* prototypes */ -struct usb2_bus_methods musbotg_bus_methods; -struct usb2_pipe_methods musbotg_device_bulk_methods; -struct usb2_pipe_methods musbotg_device_ctrl_methods; -struct usb2_pipe_methods musbotg_device_intr_methods; -struct usb2_pipe_methods musbotg_device_isoc_methods; +struct usb_bus_methods musbotg_bus_methods; +struct usb_pipe_methods musbotg_device_bulk_methods; +struct usb_pipe_methods musbotg_device_ctrl_methods; +struct usb_pipe_methods musbotg_device_intr_methods; +struct usb_pipe_methods musbotg_device_isoc_methods; static musbotg_cmd_t musbotg_setup_rx; static musbotg_cmd_t musbotg_setup_data_rx; @@ -86,16 +86,16 @@ static musbotg_cmd_t musbotg_setup_data_tx; static musbotg_cmd_t musbotg_setup_status; static musbotg_cmd_t musbotg_data_rx; static musbotg_cmd_t musbotg_data_tx; -static void musbotg_device_done(struct usb2_xfer *, usb2_error_t); -static void musbotg_do_poll(struct usb2_bus *); -static void musbotg_standard_done(struct usb2_xfer *); +static void musbotg_device_done(struct usb_xfer *, usb2_error_t); +static void musbotg_do_poll(struct usb_bus *); +static void musbotg_standard_done(struct usb_xfer *); static void musbotg_interrupt_poll(struct musbotg_softc *); static void musbotg_root_intr(struct musbotg_softc *); /* * Here is a configuration that the chip supports. */ -static const struct usb2_hw_ep_profile musbotg_ep_profile[1] = { +static const struct usb_hw_ep_profile musbotg_ep_profile[1] = { [0] = { .max_in_frame_size = 64,/* fixed */ @@ -106,8 +106,8 @@ static const struct usb2_hw_ep_profile musbotg_ep_profile[1] = { }; static void -musbotg_get_hw_ep_profile(struct usb2_device *udev, - const struct usb2_hw_ep_profile **ppf, uint8_t ep_addr) +musbotg_get_hw_ep_profile(struct usb_device *udev, + const struct usb_hw_ep_profile **ppf, uint8_t ep_addr) { struct musbotg_softc *sc; @@ -228,7 +228,7 @@ static uint8_t musbotg_setup_rx(struct musbotg_td *td) { struct musbotg_softc *sc; - struct usb2_device_request req; + struct usb_device_request req; uint16_t count; uint8_t csr; @@ -337,7 +337,7 @@ not_complete: static uint8_t musbotg_setup_data_rx(struct musbotg_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct musbotg_softc *sc; uint16_t count; uint8_t csr; @@ -480,7 +480,7 @@ musbotg_setup_data_rx(struct musbotg_td *td) static uint8_t musbotg_setup_data_tx(struct musbotg_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct musbotg_softc *sc; uint16_t count; uint8_t csr; @@ -632,7 +632,7 @@ musbotg_setup_status(struct musbotg_td *td) static uint8_t musbotg_data_rx(struct musbotg_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct musbotg_softc *sc; uint16_t count; uint8_t csr; @@ -771,7 +771,7 @@ repeat: static uint8_t musbotg_data_tx(struct musbotg_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct musbotg_softc *sc; uint16_t count; uint8_t csr; @@ -887,7 +887,7 @@ repeat: } static uint8_t -musbotg_xfer_do_fifo(struct usb2_xfer *xfer) +musbotg_xfer_do_fifo(struct usb_xfer *xfer) { struct musbotg_softc *sc; struct musbotg_td *td; @@ -936,7 +936,7 @@ done: static void musbotg_interrupt_poll(struct musbotg_softc *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -1105,7 +1105,7 @@ musbotg_setup_standard_chain_sub(struct musbotg_std_temp *temp) } static void -musbotg_setup_standard_chain(struct usb2_xfer *xfer) +musbotg_setup_standard_chain(struct usb_xfer *xfer) { struct musbotg_std_temp temp; struct musbotg_softc *sc; @@ -1234,7 +1234,7 @@ musbotg_setup_standard_chain(struct usb2_xfer *xfer) static void musbotg_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTFN(1, "xfer=%p\n", xfer); @@ -1245,7 +1245,7 @@ musbotg_timeout(void *arg) } static void -musbotg_ep_int_set(struct usb2_xfer *xfer, uint8_t on) +musbotg_ep_int_set(struct usb_xfer *xfer, uint8_t on) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); uint16_t temp; @@ -1285,7 +1285,7 @@ musbotg_ep_int_set(struct usb2_xfer *xfer, uint8_t on) } static void -musbotg_start_standard_chain(struct usb2_xfer *xfer) +musbotg_start_standard_chain(struct usb_xfer *xfer) { DPRINTFN(8, "\n"); @@ -1322,7 +1322,7 @@ musbotg_root_intr(struct musbotg_softc *sc) } static usb2_error_t -musbotg_standard_done_sub(struct usb2_xfer *xfer) +musbotg_standard_done_sub(struct usb_xfer *xfer) { struct musbotg_td *td; uint32_t len; @@ -1386,7 +1386,7 @@ musbotg_standard_done_sub(struct usb2_xfer *xfer) } static void -musbotg_standard_done(struct usb2_xfer *xfer) +musbotg_standard_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1435,7 +1435,7 @@ done: * same USB transfer! *------------------------------------------------------------------------*/ static void -musbotg_device_done(struct usb2_xfer *xfer, usb2_error_t error) +musbotg_device_done(struct usb_xfer *xfer, usb2_error_t error) { USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -1453,8 +1453,8 @@ musbotg_device_done(struct usb2_xfer *xfer, usb2_error_t error) } static void -musbotg_set_stall(struct usb2_device *udev, struct usb2_xfer *xfer, - struct usb2_pipe *pipe) +musbotg_set_stall(struct usb_device *udev, struct usb_xfer *xfer, + struct usb_pipe *pipe) { struct musbotg_softc *sc; uint8_t ep_no; @@ -1636,10 +1636,10 @@ musbotg_clear_stall_sub(struct musbotg_softc *sc, uint16_t wMaxPacket, } static void -musbotg_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) +musbotg_clear_stall(struct usb_device *udev, struct usb_pipe *pipe) { struct musbotg_softc *sc; - struct usb2_endpoint_descriptor *ed; + struct usb_endpoint_descriptor *ed; DPRINTFN(4, "pipe=%p\n", pipe); @@ -1667,7 +1667,7 @@ musbotg_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) usb2_error_t musbotg_init(struct musbotg_softc *sc) { - struct usb2_hw_ep_profile *pf; + struct usb_hw_ep_profile *pf; uint8_t nrx; uint8_t ntx; uint8_t temp; @@ -1855,7 +1855,7 @@ musbotg_resume(struct musbotg_softc *sc) } static void -musbotg_do_poll(struct usb2_bus *bus) +musbotg_do_poll(struct usb_bus *bus) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(bus); @@ -1868,32 +1868,32 @@ musbotg_do_poll(struct usb2_bus *bus) * musbotg bulk support *------------------------------------------------------------------------*/ static void -musbotg_device_bulk_open(struct usb2_xfer *xfer) +musbotg_device_bulk_open(struct usb_xfer *xfer) { return; } static void -musbotg_device_bulk_close(struct usb2_xfer *xfer) +musbotg_device_bulk_close(struct usb_xfer *xfer) { musbotg_device_done(xfer, USB_ERR_CANCELLED); } static void -musbotg_device_bulk_enter(struct usb2_xfer *xfer) +musbotg_device_bulk_enter(struct usb_xfer *xfer) { return; } static void -musbotg_device_bulk_start(struct usb2_xfer *xfer) +musbotg_device_bulk_start(struct usb_xfer *xfer) { /* setup TDs */ musbotg_setup_standard_chain(xfer); musbotg_start_standard_chain(xfer); } -struct usb2_pipe_methods musbotg_device_bulk_methods = +struct usb_pipe_methods musbotg_device_bulk_methods = { .open = musbotg_device_bulk_open, .close = musbotg_device_bulk_close, @@ -1905,32 +1905,32 @@ struct usb2_pipe_methods musbotg_device_bulk_methods = * musbotg control support *------------------------------------------------------------------------*/ static void -musbotg_device_ctrl_open(struct usb2_xfer *xfer) +musbotg_device_ctrl_open(struct usb_xfer *xfer) { return; } static void -musbotg_device_ctrl_close(struct usb2_xfer *xfer) +musbotg_device_ctrl_close(struct usb_xfer *xfer) { musbotg_device_done(xfer, USB_ERR_CANCELLED); } static void -musbotg_device_ctrl_enter(struct usb2_xfer *xfer) +musbotg_device_ctrl_enter(struct usb_xfer *xfer) { return; } static void -musbotg_device_ctrl_start(struct usb2_xfer *xfer) +musbotg_device_ctrl_start(struct usb_xfer *xfer) { /* setup TDs */ musbotg_setup_standard_chain(xfer); musbotg_start_standard_chain(xfer); } -struct usb2_pipe_methods musbotg_device_ctrl_methods = +struct usb_pipe_methods musbotg_device_ctrl_methods = { .open = musbotg_device_ctrl_open, .close = musbotg_device_ctrl_close, @@ -1942,32 +1942,32 @@ struct usb2_pipe_methods musbotg_device_ctrl_methods = * musbotg interrupt support *------------------------------------------------------------------------*/ static void -musbotg_device_intr_open(struct usb2_xfer *xfer) +musbotg_device_intr_open(struct usb_xfer *xfer) { return; } static void -musbotg_device_intr_close(struct usb2_xfer *xfer) +musbotg_device_intr_close(struct usb_xfer *xfer) { musbotg_device_done(xfer, USB_ERR_CANCELLED); } static void -musbotg_device_intr_enter(struct usb2_xfer *xfer) +musbotg_device_intr_enter(struct usb_xfer *xfer) { return; } static void -musbotg_device_intr_start(struct usb2_xfer *xfer) +musbotg_device_intr_start(struct usb_xfer *xfer) { /* setup TDs */ musbotg_setup_standard_chain(xfer); musbotg_start_standard_chain(xfer); } -struct usb2_pipe_methods musbotg_device_intr_methods = +struct usb_pipe_methods musbotg_device_intr_methods = { .open = musbotg_device_intr_open, .close = musbotg_device_intr_close, @@ -1979,19 +1979,19 @@ struct usb2_pipe_methods musbotg_device_intr_methods = * musbotg full speed isochronous support *------------------------------------------------------------------------*/ static void -musbotg_device_isoc_open(struct usb2_xfer *xfer) +musbotg_device_isoc_open(struct usb_xfer *xfer) { return; } static void -musbotg_device_isoc_close(struct usb2_xfer *xfer) +musbotg_device_isoc_close(struct usb_xfer *xfer) { musbotg_device_done(xfer, USB_ERR_CANCELLED); } static void -musbotg_device_isoc_enter(struct usb2_xfer *xfer) +musbotg_device_isoc_enter(struct usb_xfer *xfer) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); uint32_t temp; @@ -2050,13 +2050,13 @@ musbotg_device_isoc_enter(struct usb2_xfer *xfer) } static void -musbotg_device_isoc_start(struct usb2_xfer *xfer) +musbotg_device_isoc_start(struct usb_xfer *xfer) { /* start TD chain */ musbotg_start_standard_chain(xfer); } -struct usb2_pipe_methods musbotg_device_isoc_methods = +struct usb_pipe_methods musbotg_device_isoc_methods = { .open = musbotg_device_isoc_open, .close = musbotg_device_isoc_close, @@ -2070,8 +2070,8 @@ struct usb2_pipe_methods musbotg_device_isoc_methods = * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static const struct usb2_device_descriptor musbotg_devd = { - .bLength = sizeof(struct usb2_device_descriptor), +static const struct usb_device_descriptor musbotg_devd = { + .bLength = sizeof(struct usb_device_descriptor), .bDescriptorType = UDESC_DEVICE, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -2084,8 +2084,8 @@ static const struct usb2_device_descriptor musbotg_devd = { .bNumConfigurations = 1, }; -static const struct usb2_device_qualifier musbotg_odevd = { - .bLength = sizeof(struct usb2_device_qualifier), +static const struct usb_device_qualifier musbotg_odevd = { + .bLength = sizeof(struct usb_device_qualifier), .bDescriptorType = UDESC_DEVICE_QUALIFIER, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -2097,7 +2097,7 @@ static const struct usb2_device_qualifier musbotg_odevd = { static const struct musbotg_config_desc musbotg_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(musbotg_confd), .bNumInterface = 1, @@ -2107,7 +2107,7 @@ static const struct musbotg_config_desc musbotg_confd = { .bMaxPower = 0, }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -2115,7 +2115,7 @@ static const struct musbotg_config_desc musbotg_confd = { .bInterfaceProtocol = UIPROTO_HSHUBSTT, }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = (UE_DIR_IN | MUSBOTG_INTR_ENDPT), .bmAttributes = UE_INTERRUPT, @@ -2124,7 +2124,7 @@ static const struct musbotg_config_desc musbotg_confd = { }, }; -static const struct usb2_hub_descriptor_min musbotg_hubd = { +static const struct usb_hub_descriptor_min musbotg_hubd = { .bDescLength = sizeof(musbotg_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, @@ -2154,8 +2154,8 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, musbotg_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, musbotg_product); static usb2_error_t -musbotg_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +musbotg_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(udev->bus); const void *ptr; @@ -2554,11 +2554,11 @@ done: } static void -musbotg_xfer_setup(struct usb2_setup_params *parm) +musbotg_xfer_setup(struct usb_setup_params *parm) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; struct musbotg_softc *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t n; @@ -2661,14 +2661,14 @@ musbotg_xfer_setup(struct usb2_setup_params *parm) } static void -musbotg_xfer_unsetup(struct usb2_xfer *xfer) +musbotg_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -musbotg_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +musbotg_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(udev->bus); @@ -2708,7 +2708,7 @@ musbotg_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *ede } } -struct usb2_bus_methods musbotg_bus_methods = +struct usb_bus_methods musbotg_bus_methods = { .pipe_init = &musbotg_pipe_init, .xfer_setup = &musbotg_xfer_setup, diff --git a/sys/dev/usb/controller/musb_otg.h b/sys/dev/usb/controller/musb_otg.h index f68792198d94..7bba73fdb474 100644 --- a/sys/dev/usb/controller/musb_otg.h +++ b/sys/dev/usb/controller/musb_otg.h @@ -305,7 +305,7 @@ struct musbotg_dma { struct musbotg_td { struct musbotg_td *obj_next; musbotg_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; uint32_t offset; uint32_t remainder; uint16_t max_frame_size; /* packet_size * mult */ @@ -320,7 +320,7 @@ struct musbotg_td { struct musbotg_std_temp { musbotg_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; struct musbotg_td *td; struct musbotg_td *td_next; uint32_t len; @@ -336,14 +336,14 @@ struct musbotg_std_temp { }; struct musbotg_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union musbotg_hub_temp { uWord wValue; - struct usb2_port_status ps; + struct usb_port_status ps; }; struct musbotg_flags { @@ -362,11 +362,11 @@ struct musbotg_flags { }; struct musbotg_softc { - struct usb2_bus sc_bus; + struct usb_bus sc_bus; union musbotg_hub_temp sc_hub_temp; - struct usb2_hw_ep_profile sc_hw_ep_profile[16]; + struct usb_hw_ep_profile sc_hw_ep_profile[16]; - struct usb2_device *sc_devices[MUSB2_MAX_DEVICES]; + struct usb_device *sc_devices[MUSB2_MAX_DEVICES]; struct resource *sc_io_res; struct resource *sc_irq_res; void *sc_intr_hdl; diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c index 4b407ab368f8..037717997428 100644 --- a/sys/dev/usb/controller/ohci.c +++ b/sys/dev/usb/controller/ohci.c @@ -87,20 +87,20 @@ static void ohci_dump_itds(ohci_itd_t *); #define OHCI_INTR_ENDPT 1 -extern struct usb2_bus_methods ohci_bus_methods; -extern struct usb2_pipe_methods ohci_device_bulk_methods; -extern struct usb2_pipe_methods ohci_device_ctrl_methods; -extern struct usb2_pipe_methods ohci_device_intr_methods; -extern struct usb2_pipe_methods ohci_device_isoc_methods; - -static void ohci_do_poll(struct usb2_bus *bus); -static void ohci_device_done(struct usb2_xfer *xfer, usb2_error_t error); +extern struct usb_bus_methods ohci_bus_methods; +extern struct usb_pipe_methods ohci_device_bulk_methods; +extern struct usb_pipe_methods ohci_device_ctrl_methods; +extern struct usb_pipe_methods ohci_device_intr_methods; +extern struct usb_pipe_methods ohci_device_isoc_methods; + +static void ohci_do_poll(struct usb_bus *bus); +static void ohci_device_done(struct usb_xfer *xfer, usb2_error_t error); static void ohci_timeout(void *arg); -static uint8_t ohci_check_transfer(struct usb2_xfer *xfer); +static uint8_t ohci_check_transfer(struct usb_xfer *xfer); static void ohci_root_intr(ohci_softc_t *sc); struct ohci_std_temp { - struct usb2_page_cache *pc; + struct usb_page_cache *pc; ohci_td_t *td; ohci_td_t *td_next; uint32_t average; @@ -120,7 +120,7 @@ ohci_get_hcca(ohci_softc_t *sc) } void -ohci_iterate_hw_softc(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *cb) +ohci_iterate_hw_softc(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *cb) { struct ohci_softc *sc = OHCI_BUS2SC(bus); uint32_t i; @@ -146,7 +146,7 @@ ohci_iterate_hw_softc(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *cb) static usb2_error_t ohci_controller_init(ohci_softc_t *sc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint32_t i; uint32_t ctl; uint32_t ival; @@ -273,9 +273,9 @@ reset: } static struct ohci_ed * -ohci_init_ed(struct usb2_page_cache *pc) +ohci_init_ed(struct usb_page_cache *pc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct ohci_ed *ed; usb2_get_page(pc, 0, &buf_res); @@ -292,7 +292,7 @@ ohci_init_ed(struct usb2_page_cache *pc) usb2_error_t ohci_init(ohci_softc_t *sc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t i; uint16_t bit; uint16_t x; @@ -653,7 +653,7 @@ ohci_dump_ed(ohci_ed_t *sed) #endif static void -ohci_transfer_intr_enqueue(struct usb2_xfer *xfer) +ohci_transfer_intr_enqueue(struct usb_xfer *xfer) { /* check for early completion */ if (ohci_check_transfer(xfer)) { @@ -731,7 +731,7 @@ _ohci_remove_qh(ohci_ed_t *sed, ohci_ed_t *last) } static void -ohci_isoc_done(struct usb2_xfer *xfer) +ohci_isoc_done(struct usb_xfer *xfer) { uint8_t nframes; uint32_t *plen = xfer->frlengths; @@ -813,7 +813,7 @@ static const char *const #endif static usb2_error_t -ohci_non_isoc_done_sub(struct usb2_xfer *xfer) +ohci_non_isoc_done_sub(struct usb_xfer *xfer) { ohci_td_t *td; ohci_td_t *td_alt_next; @@ -906,7 +906,7 @@ ohci_non_isoc_done_sub(struct usb2_xfer *xfer) } static void -ohci_non_isoc_done(struct usb2_xfer *xfer) +ohci_non_isoc_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -958,7 +958,7 @@ done: * ohci_check_transfer_sub *------------------------------------------------------------------------*/ static void -ohci_check_transfer_sub(struct usb2_xfer *xfer) +ohci_check_transfer_sub(struct usb_xfer *xfer) { ohci_td_t *td; ohci_ed_t *ed; @@ -1042,7 +1042,7 @@ ohci_check_transfer_sub(struct usb2_xfer *xfer) * Else: USB transfer is finished *------------------------------------------------------------------------*/ static uint8_t -ohci_check_transfer(struct usb2_xfer *xfer) +ohci_check_transfer(struct usb_xfer *xfer) { ohci_ed_t *ed; uint32_t ed_headp; @@ -1104,7 +1104,7 @@ ohci_rhsc_enable(ohci_softc_t *sc) static void ohci_interrupt_poll(ohci_softc_t *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -1240,7 +1240,7 @@ done: static void ohci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -1251,7 +1251,7 @@ ohci_timeout(void *arg) } static void -ohci_do_poll(struct usb2_bus *bus) +ohci_do_poll(struct usb_bus *bus) { struct ohci_softc *sc = OHCI_BUS2SC(bus); @@ -1263,7 +1263,7 @@ ohci_do_poll(struct usb2_bus *bus) static void ohci_setup_standard_chain_sub(struct ohci_std_temp *temp) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; ohci_td_t *td; ohci_td_t *td_next; ohci_td_t *td_alt_next; @@ -1405,10 +1405,10 @@ restart: } static void -ohci_setup_standard_chain(struct usb2_xfer *xfer, ohci_ed_t **ed_last) +ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last) { struct ohci_std_temp temp; - struct usb2_pipe_methods *methods; + struct usb_pipe_methods *methods; ohci_ed_t *ed; ohci_td_t *td; uint32_t ed_flags; @@ -1645,9 +1645,9 @@ ohci_root_intr(ohci_softc_t *sc) * from close and from interrupt */ static void -ohci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +ohci_device_done(struct usb_xfer *xfer, usb2_error_t error) { - struct usb2_pipe_methods *methods = xfer->pipe->methods; + struct usb_pipe_methods *methods = xfer->pipe->methods; ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); ohci_ed_t *ed; @@ -1684,25 +1684,25 @@ ohci_device_done(struct usb2_xfer *xfer, usb2_error_t error) * ohci bulk support *------------------------------------------------------------------------*/ static void -ohci_device_bulk_open(struct usb2_xfer *xfer) +ohci_device_bulk_open(struct usb_xfer *xfer) { return; } static void -ohci_device_bulk_close(struct usb2_xfer *xfer) +ohci_device_bulk_close(struct usb_xfer *xfer) { ohci_device_done(xfer, USB_ERR_CANCELLED); } static void -ohci_device_bulk_enter(struct usb2_xfer *xfer) +ohci_device_bulk_enter(struct usb_xfer *xfer) { return; } static void -ohci_device_bulk_start(struct usb2_xfer *xfer) +ohci_device_bulk_start(struct usb_xfer *xfer) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); @@ -1713,7 +1713,7 @@ ohci_device_bulk_start(struct usb2_xfer *xfer) ohci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ohci_device_bulk_methods = +struct usb_pipe_methods ohci_device_bulk_methods = { .open = ohci_device_bulk_open, .close = ohci_device_bulk_close, @@ -1725,25 +1725,25 @@ struct usb2_pipe_methods ohci_device_bulk_methods = * ohci control support *------------------------------------------------------------------------*/ static void -ohci_device_ctrl_open(struct usb2_xfer *xfer) +ohci_device_ctrl_open(struct usb_xfer *xfer) { return; } static void -ohci_device_ctrl_close(struct usb2_xfer *xfer) +ohci_device_ctrl_close(struct usb_xfer *xfer) { ohci_device_done(xfer, USB_ERR_CANCELLED); } static void -ohci_device_ctrl_enter(struct usb2_xfer *xfer) +ohci_device_ctrl_enter(struct usb_xfer *xfer) { return; } static void -ohci_device_ctrl_start(struct usb2_xfer *xfer) +ohci_device_ctrl_start(struct usb_xfer *xfer) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); @@ -1754,7 +1754,7 @@ ohci_device_ctrl_start(struct usb2_xfer *xfer) ohci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ohci_device_ctrl_methods = +struct usb_pipe_methods ohci_device_ctrl_methods = { .open = ohci_device_ctrl_open, .close = ohci_device_ctrl_close, @@ -1766,7 +1766,7 @@ struct usb2_pipe_methods ohci_device_ctrl_methods = * ohci interrupt support *------------------------------------------------------------------------*/ static void -ohci_device_intr_open(struct usb2_xfer *xfer) +ohci_device_intr_open(struct usb_xfer *xfer) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); uint16_t best; @@ -1799,7 +1799,7 @@ ohci_device_intr_open(struct usb2_xfer *xfer) } static void -ohci_device_intr_close(struct usb2_xfer *xfer) +ohci_device_intr_close(struct usb_xfer *xfer) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); @@ -1809,13 +1809,13 @@ ohci_device_intr_close(struct usb2_xfer *xfer) } static void -ohci_device_intr_enter(struct usb2_xfer *xfer) +ohci_device_intr_enter(struct usb_xfer *xfer) { return; } static void -ohci_device_intr_start(struct usb2_xfer *xfer) +ohci_device_intr_start(struct usb_xfer *xfer) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); @@ -1826,7 +1826,7 @@ ohci_device_intr_start(struct usb2_xfer *xfer) ohci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ohci_device_intr_methods = +struct usb_pipe_methods ohci_device_intr_methods = { .open = ohci_device_intr_open, .close = ohci_device_intr_close, @@ -1838,22 +1838,22 @@ struct usb2_pipe_methods ohci_device_intr_methods = * ohci isochronous support *------------------------------------------------------------------------*/ static void -ohci_device_isoc_open(struct usb2_xfer *xfer) +ohci_device_isoc_open(struct usb_xfer *xfer) { return; } static void -ohci_device_isoc_close(struct usb2_xfer *xfer) +ohci_device_isoc_close(struct usb_xfer *xfer) { /**/ ohci_device_done(xfer, USB_ERR_CANCELLED); } static void -ohci_device_isoc_enter(struct usb2_xfer *xfer) +ohci_device_isoc_enter(struct usb_xfer *xfer) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); struct ohci_hcca *hcca; uint32_t buf_offset; @@ -2028,13 +2028,13 @@ ohci_device_isoc_enter(struct usb2_xfer *xfer) } static void -ohci_device_isoc_start(struct usb2_xfer *xfer) +ohci_device_isoc_start(struct usb_xfer *xfer) { /* put transfer on interrupt queue */ ohci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods ohci_device_isoc_methods = +struct usb_pipe_methods ohci_device_isoc_methods = { .open = ohci_device_isoc_open, .close = ohci_device_isoc_close, @@ -2049,9 +2049,9 @@ struct usb2_pipe_methods ohci_device_isoc_methods = *------------------------------------------------------------------------*/ static const -struct usb2_device_descriptor ohci_devd = +struct usb_device_descriptor ohci_devd = { - sizeof(struct usb2_device_descriptor), + sizeof(struct usb_device_descriptor), UDESC_DEVICE, /* type */ {0x00, 0x01}, /* USB version */ UDCLASS_HUB, /* class */ @@ -2067,7 +2067,7 @@ static const struct ohci_config_desc ohci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(ohci_confd), .bNumInterface = 1, @@ -2077,7 +2077,7 @@ struct ohci_config_desc ohci_confd = .bMaxPower = 0, /* max power */ }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -2085,7 +2085,7 @@ struct ohci_config_desc ohci_confd = .bInterfaceProtocol = UIPROTO_FSHUB, }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = UE_DIR_IN | OHCI_INTR_ENDPT, .bmAttributes = UE_INTERRUPT, @@ -2095,7 +2095,7 @@ struct ohci_config_desc ohci_confd = }; static const -struct usb2_hub_descriptor ohci_hubd = +struct usb_hub_descriptor ohci_hubd = { 0, /* dynamic length */ UDESC_HUB, @@ -2107,8 +2107,8 @@ struct usb2_hub_descriptor ohci_hubd = }; static usb2_error_t -ohci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +ohci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { ohci_softc_t *sc = OHCI_BUS2SC(udev->bus); const void *ptr; @@ -2399,12 +2399,12 @@ done: } static void -ohci_xfer_setup(struct usb2_setup_params *parm) +ohci_xfer_setup(struct usb_setup_params *parm) { - struct usb2_page_search page_info; - struct usb2_page_cache *pc; + struct usb_page_search page_info; + struct usb_page_cache *pc; ohci_softc_t *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t nitd; @@ -2563,8 +2563,8 @@ alloc_dma_set: } static void -ohci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +ohci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { ohci_softc_t *sc = OHCI_BUS2SC(udev->bus); @@ -2603,13 +2603,13 @@ ohci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, } static void -ohci_xfer_unsetup(struct usb2_xfer *xfer) +ohci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -ohci_get_dma_delay(struct usb2_bus *bus, uint32_t *pus) +ohci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) { /* * Wait until hardware has finished any possible use of the @@ -2619,11 +2619,11 @@ ohci_get_dma_delay(struct usb2_bus *bus, uint32_t *pus) } static void -ohci_device_resume(struct usb2_device *udev) +ohci_device_resume(struct usb_device *udev) { struct ohci_softc *sc = OHCI_BUS2SC(udev->bus); - struct usb2_xfer *xfer; - struct usb2_pipe_methods *methods; + struct usb_xfer *xfer; + struct usb_pipe_methods *methods; ohci_ed_t *ed; DPRINTF("\n"); @@ -2657,11 +2657,11 @@ ohci_device_resume(struct usb2_device *udev) } static void -ohci_device_suspend(struct usb2_device *udev) +ohci_device_suspend(struct usb_device *udev) { struct ohci_softc *sc = OHCI_BUS2SC(udev->bus); - struct usb2_xfer *xfer; - struct usb2_pipe_methods *methods; + struct usb_xfer *xfer; + struct usb_pipe_methods *methods; ohci_ed_t *ed; DPRINTF("\n"); @@ -2693,7 +2693,7 @@ ohci_device_suspend(struct usb2_device *udev) } static void -ohci_set_hw_power(struct usb2_bus *bus) +ohci_set_hw_power(struct usb_bus *bus) { struct ohci_softc *sc = OHCI_BUS2SC(bus); uint32_t temp; @@ -2727,7 +2727,7 @@ ohci_set_hw_power(struct usb2_bus *bus) return; } -struct usb2_bus_methods ohci_bus_methods = +struct usb_bus_methods ohci_bus_methods = { .pipe_init = ohci_pipe_init, .xfer_setup = ohci_xfer_setup, diff --git a/sys/dev/usb/controller/ohci.h b/sys/dev/usb/controller/ohci.h index b4759aa8e57b..3f3537f4ac68 100644 --- a/sys/dev/usb/controller/ohci.h +++ b/sys/dev/usb/controller/ohci.h @@ -196,7 +196,7 @@ struct ohci_ed { struct ohci_ed *next; struct ohci_ed *prev; struct ohci_ed *obj_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; uint32_t ed_self; } __aligned(OHCI_ED_ALIGN); @@ -230,7 +230,7 @@ struct ohci_td { */ struct ohci_td *obj_next; struct ohci_td *alt_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; uint32_t td_self; uint16_t len; } __aligned(OHCI_TD_ALIGN); @@ -262,7 +262,7 @@ struct ohci_itd { * Extra information needed: */ struct ohci_itd *obj_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; uint32_t itd_self; uint8_t frames; } __aligned(OHCI_ITD_ALIGN); @@ -290,39 +290,39 @@ typedef struct ohci_itd ohci_itd_t; #define OHCI_NO_EDS (2*OHCI_NO_INTRS) struct ohci_hw_softc { - struct usb2_page_cache hcca_pc; - struct usb2_page_cache ctrl_start_pc; - struct usb2_page_cache bulk_start_pc; - struct usb2_page_cache isoc_start_pc; - struct usb2_page_cache intr_start_pc[OHCI_NO_EDS]; - - struct usb2_page hcca_pg; - struct usb2_page ctrl_start_pg; - struct usb2_page bulk_start_pg; - struct usb2_page isoc_start_pg; - struct usb2_page intr_start_pg[OHCI_NO_EDS]; + struct usb_page_cache hcca_pc; + struct usb_page_cache ctrl_start_pc; + struct usb_page_cache bulk_start_pc; + struct usb_page_cache isoc_start_pc; + struct usb_page_cache intr_start_pc[OHCI_NO_EDS]; + + struct usb_page hcca_pg; + struct usb_page ctrl_start_pg; + struct usb_page bulk_start_pg; + struct usb_page isoc_start_pg; + struct usb_page intr_start_pg[OHCI_NO_EDS]; }; struct ohci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union ohci_hub_desc { - struct usb2_status stat; - struct usb2_port_status ps; - struct usb2_hub_descriptor hubd; + struct usb_status stat; + struct usb_port_status ps; + struct usb_hub_descriptor hubd; uint8_t temp[128]; }; typedef struct ohci_softc { struct ohci_hw_softc sc_hw; - struct usb2_bus sc_bus; /* base device */ - struct usb2_callout sc_tmo_rhsc; + struct usb_bus sc_bus; /* base device */ + struct usb_callout sc_tmo_rhsc; union ohci_hub_desc sc_hub_desc; - struct usb2_device *sc_devices[OHCI_MAX_DEVICES]; + struct usb_device *sc_devices[OHCI_MAX_DEVICES]; struct resource *sc_io_res; struct resource *sc_irq_res; struct ohci_hcca *sc_hcca_p; diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c index 7a6ba1628b91..c145588ab215 100644 --- a/sys/dev/usb/controller/uhci.c +++ b/sys/dev/usb/controller/uhci.c @@ -100,11 +100,11 @@ static void uhci_dump_tds(uhci_td_t *td); struct uhci_mem_layout { - struct usb2_page_search buf_res; - struct usb2_page_search fix_res; + struct usb_page_search buf_res; + struct usb_page_search fix_res; - struct usb2_page_cache *buf_pc; - struct usb2_page_cache *fix_pc; + struct usb_page_cache *buf_pc; + struct usb_page_cache *fix_pc; uint32_t buf_offset; @@ -126,22 +126,22 @@ struct uhci_std_temp { uint8_t last_frame; }; -extern struct usb2_bus_methods uhci_bus_methods; -extern struct usb2_pipe_methods uhci_device_bulk_methods; -extern struct usb2_pipe_methods uhci_device_ctrl_methods; -extern struct usb2_pipe_methods uhci_device_intr_methods; -extern struct usb2_pipe_methods uhci_device_isoc_methods; +extern struct usb_bus_methods uhci_bus_methods; +extern struct usb_pipe_methods uhci_device_bulk_methods; +extern struct usb_pipe_methods uhci_device_ctrl_methods; +extern struct usb_pipe_methods uhci_device_intr_methods; +extern struct usb_pipe_methods uhci_device_isoc_methods; static uint8_t uhci_restart(uhci_softc_t *sc); -static void uhci_do_poll(struct usb2_bus *); -static void uhci_device_done(struct usb2_xfer *, usb2_error_t); -static void uhci_transfer_intr_enqueue(struct usb2_xfer *); +static void uhci_do_poll(struct usb_bus *); +static void uhci_device_done(struct usb_xfer *, usb2_error_t); +static void uhci_transfer_intr_enqueue(struct usb_xfer *); static void uhci_timeout(void *); -static uint8_t uhci_check_transfer(struct usb2_xfer *); +static uint8_t uhci_check_transfer(struct usb_xfer *); static void uhci_root_intr(uhci_softc_t *sc); void -uhci_iterate_hw_softc(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *cb) +uhci_iterate_hw_softc(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *cb) { struct uhci_softc *sc = UHCI_BUS2SC(bus); uint32_t i; @@ -178,7 +178,7 @@ uhci_iterate_hw_softc(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *cb) } static void -uhci_mem_layout_init(struct uhci_mem_layout *ml, struct usb2_xfer *xfer) +uhci_mem_layout_init(struct uhci_mem_layout *ml, struct usb_xfer *xfer) { ml->buf_pc = xfer->frbuffers + 0; ml->fix_pc = xfer->buf_fixup; @@ -255,7 +255,7 @@ uhci_mem_layout_fixup(struct uhci_mem_layout *ml, struct uhci_td *td) static uint8_t uhci_restart(uhci_softc_t *sc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -387,9 +387,9 @@ uhci_start(uhci_softc_t *sc) } static struct uhci_qh * -uhci_init_qh(struct usb2_page_cache *pc) +uhci_init_qh(struct usb_page_cache *pc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct uhci_qh *qh; usb2_get_page(pc, 0, &buf_res); @@ -406,9 +406,9 @@ uhci_init_qh(struct usb2_page_cache *pc) } static struct uhci_td * -uhci_init_td(struct usb2_page_cache *pc) +uhci_init_td(struct usb_page_cache *pc) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; struct uhci_td *td; usb2_get_page(pc, 0, &buf_res); @@ -591,7 +591,7 @@ uhci_init(uhci_softc_t *sc) td_lst->td_buffer = htole32(0); } if (1) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint32_t *pframes; usb2_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); @@ -896,7 +896,7 @@ uhci_rem_loop(uhci_softc_t *sc) } static void -uhci_transfer_intr_enqueue(struct usb2_xfer *xfer) +uhci_transfer_intr_enqueue(struct usb_xfer *xfer) { /* check for early completion */ if (uhci_check_transfer(xfer)) { @@ -1023,9 +1023,9 @@ _uhci_remove_qh(uhci_qh_t *sqh, uhci_qh_t *last) } static void -uhci_isoc_done(uhci_softc_t *sc, struct usb2_xfer *xfer) +uhci_isoc_done(uhci_softc_t *sc, struct usb_xfer *xfer) { - struct usb2_page_search res; + struct usb_page_search res; uint32_t nframes = xfer->nframes; uint32_t status; uint32_t offset = 0; @@ -1090,9 +1090,9 @@ uhci_isoc_done(uhci_softc_t *sc, struct usb2_xfer *xfer) } static usb2_error_t -uhci_non_isoc_done_sub(struct usb2_xfer *xfer) +uhci_non_isoc_done_sub(struct usb_xfer *xfer) { - struct usb2_page_search res; + struct usb_page_search res; uhci_td_t *td; uhci_td_t *td_alt_next; uint32_t status; @@ -1203,7 +1203,7 @@ uhci_non_isoc_done_sub(struct usb2_xfer *xfer) } static void -uhci_non_isoc_done(struct usb2_xfer *xfer) +uhci_non_isoc_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1261,7 +1261,7 @@ done: * in case it is wrong. *------------------------------------------------------------------------*/ static void -uhci_check_transfer_sub(struct usb2_xfer *xfer) +uhci_check_transfer_sub(struct usb_xfer *xfer) { uhci_qh_t *qh; uhci_td_t *td; @@ -1321,7 +1321,7 @@ skip: * Else: USB transfer is finished *------------------------------------------------------------------------*/ static uint8_t -uhci_check_transfer(struct usb2_xfer *xfer) +uhci_check_transfer(struct usb_xfer *xfer) { uint32_t status; uint32_t token; @@ -1419,7 +1419,7 @@ transferred: static void uhci_interrupt_poll(uhci_softc_t *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -1514,7 +1514,7 @@ done: static void uhci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -1525,7 +1525,7 @@ uhci_timeout(void *arg) } static void -uhci_do_poll(struct usb2_bus *bus) +uhci_do_poll(struct usb_bus *bus) { struct uhci_softc *sc = UHCI_BUS2SC(bus); @@ -1676,7 +1676,7 @@ restart: } static uhci_td_t * -uhci_setup_standard_chain(struct usb2_xfer *xfer) +uhci_setup_standard_chain(struct usb_xfer *xfer) { struct uhci_std_temp temp; uhci_td_t *td; @@ -1857,9 +1857,9 @@ uhci_setup_standard_chain(struct usb2_xfer *xfer) */ static void -uhci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +uhci_device_done(struct usb_xfer *xfer, usb2_error_t error) { - struct usb2_pipe_methods *methods = xfer->pipe->methods; + struct usb_pipe_methods *methods = xfer->pipe->methods; uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_qh_t *qh; @@ -1909,25 +1909,25 @@ uhci_device_done(struct usb2_xfer *xfer, usb2_error_t error) * uhci bulk support *------------------------------------------------------------------------*/ static void -uhci_device_bulk_open(struct usb2_xfer *xfer) +uhci_device_bulk_open(struct usb_xfer *xfer) { return; } static void -uhci_device_bulk_close(struct usb2_xfer *xfer) +uhci_device_bulk_close(struct usb_xfer *xfer) { uhci_device_done(xfer, USB_ERR_CANCELLED); } static void -uhci_device_bulk_enter(struct usb2_xfer *xfer) +uhci_device_bulk_enter(struct usb_xfer *xfer) { return; } static void -uhci_device_bulk_start(struct usb2_xfer *xfer) +uhci_device_bulk_start(struct usb_xfer *xfer) { uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_td_t *td; @@ -1954,7 +1954,7 @@ uhci_device_bulk_start(struct usb2_xfer *xfer) uhci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods uhci_device_bulk_methods = +struct usb_pipe_methods uhci_device_bulk_methods = { .open = uhci_device_bulk_open, .close = uhci_device_bulk_close, @@ -1966,25 +1966,25 @@ struct usb2_pipe_methods uhci_device_bulk_methods = * uhci control support *------------------------------------------------------------------------*/ static void -uhci_device_ctrl_open(struct usb2_xfer *xfer) +uhci_device_ctrl_open(struct usb_xfer *xfer) { return; } static void -uhci_device_ctrl_close(struct usb2_xfer *xfer) +uhci_device_ctrl_close(struct usb_xfer *xfer) { uhci_device_done(xfer, USB_ERR_CANCELLED); } static void -uhci_device_ctrl_enter(struct usb2_xfer *xfer) +uhci_device_ctrl_enter(struct usb_xfer *xfer) { return; } static void -uhci_device_ctrl_start(struct usb2_xfer *xfer) +uhci_device_ctrl_start(struct usb_xfer *xfer) { uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_qh_t *qh; @@ -2016,7 +2016,7 @@ uhci_device_ctrl_start(struct usb2_xfer *xfer) uhci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods uhci_device_ctrl_methods = +struct usb_pipe_methods uhci_device_ctrl_methods = { .open = uhci_device_ctrl_open, .close = uhci_device_ctrl_close, @@ -2028,7 +2028,7 @@ struct usb2_pipe_methods uhci_device_ctrl_methods = * uhci interrupt support *------------------------------------------------------------------------*/ static void -uhci_device_intr_open(struct usb2_xfer *xfer) +uhci_device_intr_open(struct usb_xfer *xfer) { uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uint16_t best; @@ -2061,7 +2061,7 @@ uhci_device_intr_open(struct usb2_xfer *xfer) } static void -uhci_device_intr_close(struct usb2_xfer *xfer) +uhci_device_intr_close(struct usb_xfer *xfer) { uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); @@ -2071,13 +2071,13 @@ uhci_device_intr_close(struct usb2_xfer *xfer) } static void -uhci_device_intr_enter(struct usb2_xfer *xfer) +uhci_device_intr_enter(struct usb_xfer *xfer) { return; } static void -uhci_device_intr_start(struct usb2_xfer *xfer) +uhci_device_intr_start(struct usb_xfer *xfer) { uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uhci_qh_t *qh; @@ -2103,7 +2103,7 @@ uhci_device_intr_start(struct usb2_xfer *xfer) uhci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods uhci_device_intr_methods = +struct usb_pipe_methods uhci_device_intr_methods = { .open = uhci_device_intr_open, .close = uhci_device_intr_close, @@ -2115,7 +2115,7 @@ struct usb2_pipe_methods uhci_device_intr_methods = * uhci isochronous support *------------------------------------------------------------------------*/ static void -uhci_device_isoc_open(struct usb2_xfer *xfer) +uhci_device_isoc_open(struct usb_xfer *xfer) { uhci_td_t *td; uint32_t td_token; @@ -2144,13 +2144,13 @@ uhci_device_isoc_open(struct usb2_xfer *xfer) } static void -uhci_device_isoc_close(struct usb2_xfer *xfer) +uhci_device_isoc_close(struct usb_xfer *xfer) { uhci_device_done(xfer, USB_ERR_CANCELLED); } static void -uhci_device_isoc_enter(struct usb2_xfer *xfer) +uhci_device_isoc_enter(struct usb_xfer *xfer) { struct uhci_mem_layout ml; uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); @@ -2305,13 +2305,13 @@ uhci_device_isoc_enter(struct usb2_xfer *xfer) } static void -uhci_device_isoc_start(struct usb2_xfer *xfer) +uhci_device_isoc_start(struct usb_xfer *xfer) { /* put transfer on interrupt queue */ uhci_transfer_intr_enqueue(xfer); } -struct usb2_pipe_methods uhci_device_isoc_methods = +struct usb_pipe_methods uhci_device_isoc_methods = { .open = uhci_device_isoc_open, .close = uhci_device_isoc_close, @@ -2326,9 +2326,9 @@ struct usb2_pipe_methods uhci_device_isoc_methods = *------------------------------------------------------------------------*/ static const -struct usb2_device_descriptor uhci_devd = +struct usb_device_descriptor uhci_devd = { - sizeof(struct usb2_device_descriptor), + sizeof(struct usb_device_descriptor), UDESC_DEVICE, /* type */ {0x00, 0x01}, /* USB version */ UDCLASS_HUB, /* class */ @@ -2342,7 +2342,7 @@ struct usb2_device_descriptor uhci_devd = static const struct uhci_config_desc uhci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(uhci_confd), .bNumInterface = 1, @@ -2352,7 +2352,7 @@ static const struct uhci_config_desc uhci_confd = { .bMaxPower = 0 /* max power */ }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -2360,7 +2360,7 @@ static const struct uhci_config_desc uhci_confd = { .bInterfaceProtocol = UIPROTO_FSHUB, }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = UE_DIR_IN | UHCI_INTR_ENDPT, .bmAttributes = UE_INTERRUPT, @@ -2370,7 +2370,7 @@ static const struct uhci_config_desc uhci_confd = { }; static const -struct usb2_hub_descriptor_min uhci_hubd_piix = +struct usb_hub_descriptor_min uhci_hubd_piix = { sizeof(uhci_hubd_piix), UDESC_HUB, @@ -2494,8 +2494,8 @@ done: } static usb2_error_t -uhci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +uhci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { uhci_softc_t *sc = UHCI_BUS2SC(udev->bus); const void *ptr; @@ -2847,12 +2847,12 @@ uhci_root_intr(uhci_softc_t *sc) } static void -uhci_xfer_setup(struct usb2_setup_params *parm) +uhci_xfer_setup(struct usb_setup_params *parm) { - struct usb2_page_search page_info; - struct usb2_page_cache *pc; + struct usb_page_search page_info; + struct usb_page_cache *pc; uhci_softc_t *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t nqh; @@ -3043,8 +3043,8 @@ alloc_dma_set: } static void -uhci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +uhci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { uhci_softc_t *sc = UHCI_BUS2SC(udev->bus); @@ -3083,13 +3083,13 @@ uhci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, } static void -uhci_xfer_unsetup(struct usb2_xfer *xfer) +uhci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -uhci_get_dma_delay(struct usb2_bus *bus, uint32_t *pus) +uhci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) { /* * Wait until hardware has finished any possible use of the @@ -3099,11 +3099,11 @@ uhci_get_dma_delay(struct usb2_bus *bus, uint32_t *pus) } static void -uhci_device_resume(struct usb2_device *udev) +uhci_device_resume(struct usb_device *udev) { struct uhci_softc *sc = UHCI_BUS2SC(udev->bus); - struct usb2_xfer *xfer; - struct usb2_pipe_methods *methods; + struct usb_xfer *xfer; + struct usb_pipe_methods *methods; uhci_qh_t *qh; DPRINTF("\n"); @@ -3141,11 +3141,11 @@ uhci_device_resume(struct usb2_device *udev) } static void -uhci_device_suspend(struct usb2_device *udev) +uhci_device_suspend(struct usb_device *udev) { struct uhci_softc *sc = UHCI_BUS2SC(udev->bus); - struct usb2_xfer *xfer; - struct usb2_pipe_methods *methods; + struct usb_xfer *xfer; + struct usb_pipe_methods *methods; uhci_qh_t *qh; DPRINTF("\n"); @@ -3185,7 +3185,7 @@ uhci_device_suspend(struct usb2_device *udev) } static void -uhci_set_hw_power(struct usb2_bus *bus) +uhci_set_hw_power(struct usb_bus *bus) { struct uhci_softc *sc = UHCI_BUS2SC(bus); uint32_t flags; @@ -3222,7 +3222,7 @@ uhci_set_hw_power(struct usb2_bus *bus) } -struct usb2_bus_methods uhci_bus_methods = +struct usb_bus_methods uhci_bus_methods = { .pipe_init = uhci_pipe_init, .xfer_setup = uhci_xfer_setup, diff --git a/sys/dev/usb/controller/uhci.h b/sys/dev/usb/controller/uhci.h index ae3e0e3e4785..ff4a64092412 100644 --- a/sys/dev/usb/controller/uhci.h +++ b/sys/dev/usb/controller/uhci.h @@ -174,8 +174,8 @@ struct uhci_td { struct uhci_td *next; struct uhci_td *prev; struct uhci_td *obj_next; - struct usb2_page_cache *page_cache; - struct usb2_page_cache *fix_pc; + struct usb_page_cache *page_cache; + struct usb_page_cache *fix_pc; uint32_t td_self; uint16_t len; } __aligned(UHCI_TD_ALIGN); @@ -213,7 +213,7 @@ struct uhci_qh { struct uhci_qh *h_prev; struct uhci_qh *obj_next; struct uhci_td *e_next; - struct usb2_page_cache *page_cache; + struct usb_page_cache *page_cache; uint32_t qh_self; uint16_t intr_pos; } __aligned(UHCI_QH_ALIGN); @@ -235,44 +235,44 @@ typedef struct uhci_qh uhci_qh_t; #endif struct uhci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union uhci_hub_desc { - struct usb2_status stat; - struct usb2_port_status ps; + struct usb_status stat; + struct usb_port_status ps; uint8_t temp[128]; }; struct uhci_hw_softc { - struct usb2_page_cache pframes_pc; - struct usb2_page_cache isoc_start_pc[UHCI_VFRAMELIST_COUNT]; - struct usb2_page_cache intr_start_pc[UHCI_IFRAMELIST_COUNT]; - struct usb2_page_cache ls_ctl_start_pc; - struct usb2_page_cache fs_ctl_start_pc; - struct usb2_page_cache bulk_start_pc; - struct usb2_page_cache last_qh_pc; - struct usb2_page_cache last_td_pc; - - struct usb2_page pframes_pg; - struct usb2_page isoc_start_pg[UHCI_VFRAMELIST_COUNT]; - struct usb2_page intr_start_pg[UHCI_IFRAMELIST_COUNT]; - struct usb2_page ls_ctl_start_pg; - struct usb2_page fs_ctl_start_pg; - struct usb2_page bulk_start_pg; - struct usb2_page last_qh_pg; - struct usb2_page last_td_pg; + struct usb_page_cache pframes_pc; + struct usb_page_cache isoc_start_pc[UHCI_VFRAMELIST_COUNT]; + struct usb_page_cache intr_start_pc[UHCI_IFRAMELIST_COUNT]; + struct usb_page_cache ls_ctl_start_pc; + struct usb_page_cache fs_ctl_start_pc; + struct usb_page_cache bulk_start_pc; + struct usb_page_cache last_qh_pc; + struct usb_page_cache last_td_pc; + + struct usb_page pframes_pg; + struct usb_page isoc_start_pg[UHCI_VFRAMELIST_COUNT]; + struct usb_page intr_start_pg[UHCI_IFRAMELIST_COUNT]; + struct usb_page ls_ctl_start_pg; + struct usb_page fs_ctl_start_pg; + struct usb_page bulk_start_pg; + struct usb_page last_qh_pg; + struct usb_page last_td_pg; }; typedef struct uhci_softc { struct uhci_hw_softc sc_hw; - struct usb2_bus sc_bus; /* base device */ + struct usb_bus sc_bus; /* base device */ union uhci_hub_desc sc_hub_desc; - struct usb2_callout sc_root_intr; + struct usb_callout sc_root_intr; - struct usb2_device *sc_devices[UHCI_MAX_DEVICES]; + struct usb_device *sc_devices[UHCI_MAX_DEVICES]; /* pointer to last TD for isochronous */ struct uhci_td *sc_isoc_p_last[UHCI_VFRAMELIST_COUNT]; /* pointer to last QH for interrupt */ diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c index 93e9c32e9db4..d9ee3e76d525 100644 --- a/sys/dev/usb/controller/usb_controller.c +++ b/sys/dev/usb/controller/usb_controller.c @@ -47,7 +47,7 @@ static device_probe_t usb2_probe; static device_attach_t usb2_attach; static device_detach_t usb2_detach; -static void usb2_attach_sub(device_t, struct usb2_bus *); +static void usb2_attach_sub(device_t, struct usb_bus *); static void usb2_post_init(void *); /* static variables */ @@ -104,7 +104,7 @@ usb2_probe(device_t dev) static int usb2_attach(device_t dev) { - struct usb2_bus *bus = device_get_ivars(dev); + struct usb_bus *bus = device_get_ivars(dev); DPRINTF("\n"); @@ -131,7 +131,7 @@ usb2_attach(device_t dev) static int usb2_detach(device_t dev) { - struct usb2_bus *bus = device_get_softc(dev); + struct usb_bus *bus = device_get_softc(dev); DPRINTF("\n"); @@ -182,12 +182,12 @@ usb2_detach(device_t dev) * This function is used to explore the device tree from the root. *------------------------------------------------------------------------*/ static void -usb2_bus_explore(struct usb2_proc_msg *pm) +usb2_bus_explore(struct usb_proc_msg *pm) { - struct usb2_bus *bus; - struct usb2_device *udev; + struct usb_bus *bus; + struct usb_device *udev; - bus = ((struct usb2_bus_msg *)pm)->bus; + bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; if (udev && udev->hub) { @@ -230,13 +230,13 @@ usb2_bus_explore(struct usb2_proc_msg *pm) * This function is used to detach the device tree from the root. *------------------------------------------------------------------------*/ static void -usb2_bus_detach(struct usb2_proc_msg *pm) +usb2_bus_detach(struct usb_proc_msg *pm) { - struct usb2_bus *bus; - struct usb2_device *udev; + struct usb_bus *bus; + struct usb_device *udev; device_t dev; - bus = ((struct usb2_bus_msg *)pm)->bus; + bus = ((struct usb_bus_msg *)pm)->bus; udev = bus->devices[USB_ROOT_HUB_ADDR]; dev = bus->bdev; /* clear the softc */ @@ -264,7 +264,7 @@ usb2_bus_detach(struct usb2_proc_msg *pm) static void usb2_power_wdog(void *arg) { - struct usb2_bus *bus = arg; + struct usb_bus *bus = arg; USB_BUS_LOCK_ASSERT(bus, MA_OWNED); @@ -284,15 +284,15 @@ usb2_power_wdog(void *arg) * This function attaches USB in context of the explore thread. *------------------------------------------------------------------------*/ static void -usb2_bus_attach(struct usb2_proc_msg *pm) +usb2_bus_attach(struct usb_proc_msg *pm) { - struct usb2_bus *bus; - struct usb2_device *child; + struct usb_bus *bus; + struct usb_device *child; device_t dev; usb2_error_t err; enum usb_dev_speed speed; - bus = ((struct usb2_bus_msg *)pm)->bus; + bus = ((struct usb_bus_msg *)pm)->bus; dev = bus->bdev; DPRINTF("\n"); @@ -382,7 +382,7 @@ usb2_bus_attach(struct usb2_proc_msg *pm) * "usb2_attach()" method. *------------------------------------------------------------------------*/ static void -usb2_attach_sub(device_t dev, struct usb2_bus *bus) +usb2_attach_sub(device_t dev, struct usb_bus *bus) { const char *pname = device_get_nameunit(dev); @@ -440,7 +440,7 @@ usb2_attach_sub(device_t dev, struct usb2_bus *bus) static void usb2_post_init(void *arg) { - struct usb2_bus *bus; + struct usb_bus *bus; devclass_t dc; device_t dev; int max; @@ -484,8 +484,8 @@ SYSUNINIT(usb2_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb2_bus_unload, NULL); *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA static void -usb2_bus_mem_flush_all_cb(struct usb2_bus *bus, struct usb2_page_cache *pc, - struct usb2_page *pg, uint32_t size, uint32_t align) +usb2_bus_mem_flush_all_cb(struct usb_bus *bus, struct usb_page_cache *pc, + struct usb_page *pg, uint32_t size, uint32_t align) { usb2_pc_cpu_flush(pc); } @@ -496,7 +496,7 @@ usb2_bus_mem_flush_all_cb(struct usb2_bus *bus, struct usb2_page_cache *pc, *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA void -usb2_bus_mem_flush_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb) +usb2_bus_mem_flush_all(struct usb_bus *bus, usb2_bus_mem_cb_t *cb) { if (cb) { cb(bus, &usb2_bus_mem_flush_all_cb); @@ -509,8 +509,8 @@ usb2_bus_mem_flush_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb) *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA static void -usb2_bus_mem_alloc_all_cb(struct usb2_bus *bus, struct usb2_page_cache *pc, - struct usb2_page *pg, uint32_t size, uint32_t align) +usb2_bus_mem_alloc_all_cb(struct usb_bus *bus, struct usb_page_cache *pc, + struct usb_page *pg, uint32_t size, uint32_t align) { /* need to initialize the page cache */ pc->tag_parent = bus->dma_parent_tag; @@ -529,7 +529,7 @@ usb2_bus_mem_alloc_all_cb(struct usb2_bus *bus, struct usb2_page_cache *pc, * Else: Failure *------------------------------------------------------------------------*/ uint8_t -usb2_bus_mem_alloc_all(struct usb2_bus *bus, bus_dma_tag_t dmat, +usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb2_bus_mem_cb_t *cb) { bus->alloc_failed = 0; @@ -569,8 +569,8 @@ usb2_bus_mem_alloc_all(struct usb2_bus *bus, bus_dma_tag_t dmat, *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA static void -usb2_bus_mem_free_all_cb(struct usb2_bus *bus, struct usb2_page_cache *pc, - struct usb2_page *pg, uint32_t size, uint32_t align) +usb2_bus_mem_free_all_cb(struct usb_bus *bus, struct usb_page_cache *pc, + struct usb_page *pg, uint32_t size, uint32_t align) { usb2_pc_free_mem(pc); } @@ -580,7 +580,7 @@ usb2_bus_mem_free_all_cb(struct usb2_bus *bus, struct usb2_page_cache *pc, * usb2_bus_mem_free_all - factored out code *------------------------------------------------------------------------*/ void -usb2_bus_mem_free_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb) +usb2_bus_mem_free_all(struct usb_bus *bus, usb2_bus_mem_cb_t *cb) { #if USB_HAVE_BUSDMA if (cb) { diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c index 05389c4f91f6..ce99746e42bc 100644 --- a/sys/dev/usb/controller/uss820dci.c +++ b/sys/dev/usb/controller/uss820dci.c @@ -71,20 +71,20 @@ SYSCTL_INT(_hw_usb_uss820dci, OID_AUTO, debug, CTLFLAG_RW, /* prototypes */ -struct usb2_bus_methods uss820dci_bus_methods; -struct usb2_pipe_methods uss820dci_device_bulk_methods; -struct usb2_pipe_methods uss820dci_device_ctrl_methods; -struct usb2_pipe_methods uss820dci_device_intr_methods; -struct usb2_pipe_methods uss820dci_device_isoc_fs_methods; +struct usb_bus_methods uss820dci_bus_methods; +struct usb_pipe_methods uss820dci_device_bulk_methods; +struct usb_pipe_methods uss820dci_device_ctrl_methods; +struct usb_pipe_methods uss820dci_device_intr_methods; +struct usb_pipe_methods uss820dci_device_isoc_fs_methods; static uss820dci_cmd_t uss820dci_setup_rx; static uss820dci_cmd_t uss820dci_data_rx; static uss820dci_cmd_t uss820dci_data_tx; static uss820dci_cmd_t uss820dci_data_tx_sync; -static void uss820dci_device_done(struct usb2_xfer *, usb2_error_t); -static void uss820dci_do_poll(struct usb2_bus *); -static void uss820dci_standard_done(struct usb2_xfer *); -static void uss820dci_intr_set(struct usb2_xfer *, uint8_t); +static void uss820dci_device_done(struct usb_xfer *, usb2_error_t); +static void uss820dci_do_poll(struct usb_bus *); +static void uss820dci_standard_done(struct usb_xfer *); +static void uss820dci_intr_set(struct usb_xfer *, uint8_t); static void uss820dci_update_shared_1(struct uss820dci_softc *, uint8_t, uint8_t, uint8_t); static void uss820dci_root_intr(struct uss820dci_softc *); @@ -94,7 +94,7 @@ static void uss820dci_root_intr(struct uss820dci_softc *); * limitation is that the sum of the buffer sizes must be less than * 1120 bytes. */ -static const struct usb2_hw_ep_profile +static const struct usb_hw_ep_profile uss820dci_ep_profile[] = { [0] = { @@ -149,8 +149,8 @@ uss820dci_update_shared_1(struct uss820dci_softc *sc, uint8_t reg, } static void -uss820dci_get_hw_ep_profile(struct usb2_device *udev, - const struct usb2_hw_ep_profile **ppf, uint8_t ep_addr) +uss820dci_get_hw_ep_profile(struct usb_device *udev, + const struct usb_hw_ep_profile **ppf, uint8_t ep_addr) { if (ep_addr == 0) { *ppf = uss820dci_ep_profile + 0; @@ -223,7 +223,7 @@ static uint8_t uss820dci_setup_rx(struct uss820dci_td *td) { struct uss820dci_softc *sc; - struct usb2_device_request req; + struct usb_device_request req; uint16_t count; uint8_t rx_stat; uint8_t temp; @@ -353,7 +353,7 @@ not_complete: static uint8_t uss820dci_data_rx(struct uss820dci_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t count; uint8_t rx_flag; uint8_t rx_stat; @@ -486,7 +486,7 @@ repeat: static uint8_t uss820dci_data_tx(struct uss820dci_td *td) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; uint16_t count; uint16_t count_copy; uint8_t rx_stat; @@ -640,7 +640,7 @@ uss820dci_data_tx_sync(struct uss820dci_td *td) } static uint8_t -uss820dci_xfer_do_fifo(struct usb2_xfer *xfer) +uss820dci_xfer_do_fifo(struct usb_xfer *xfer) { struct uss820dci_td *td; @@ -685,7 +685,7 @@ done: static void uss820dci_interrupt_poll(struct uss820dci_softc *sc) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { @@ -820,7 +820,7 @@ uss820dci_setup_standard_chain_sub(struct uss820_std_temp *temp) } static void -uss820dci_setup_standard_chain(struct usb2_xfer *xfer) +uss820dci_setup_standard_chain(struct usb_xfer *xfer) { struct uss820_std_temp temp; struct uss820dci_softc *sc; @@ -965,7 +965,7 @@ uss820dci_setup_standard_chain(struct usb2_xfer *xfer) static void uss820dci_timeout(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; DPRINTF("xfer=%p\n", xfer); @@ -976,7 +976,7 @@ uss820dci_timeout(void *arg) } static void -uss820dci_intr_set(struct usb2_xfer *xfer, uint8_t set) +uss820dci_intr_set(struct usb_xfer *xfer, uint8_t set) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); uint8_t ep_no = (xfer->endpoint & UE_ADDR); @@ -1015,7 +1015,7 @@ uss820dci_intr_set(struct usb2_xfer *xfer, uint8_t set) } static void -uss820dci_start_standard_chain(struct usb2_xfer *xfer) +uss820dci_start_standard_chain(struct usb_xfer *xfer) { DPRINTFN(9, "\n"); @@ -1055,7 +1055,7 @@ uss820dci_root_intr(struct uss820dci_softc *sc) } static usb2_error_t -uss820dci_standard_done_sub(struct usb2_xfer *xfer) +uss820dci_standard_done_sub(struct usb_xfer *xfer) { struct uss820dci_td *td; uint32_t len; @@ -1119,7 +1119,7 @@ uss820dci_standard_done_sub(struct usb2_xfer *xfer) } static void -uss820dci_standard_done(struct usb2_xfer *xfer) +uss820dci_standard_done(struct usb_xfer *xfer) { usb2_error_t err = 0; @@ -1168,7 +1168,7 @@ done: * same USB transfer! *------------------------------------------------------------------------*/ static void -uss820dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) +uss820dci_device_done(struct usb_xfer *xfer, usb2_error_t error) { USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -1183,8 +1183,8 @@ uss820dci_device_done(struct usb2_xfer *xfer, usb2_error_t error) } static void -uss820dci_set_stall(struct usb2_device *udev, struct usb2_xfer *xfer, - struct usb2_pipe *pipe) +uss820dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, + struct usb_pipe *pipe) { struct uss820dci_softc *sc; uint8_t ep_no; @@ -1271,10 +1271,10 @@ uss820dci_clear_stall_sub(struct uss820dci_softc *sc, } static void -uss820dci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) +uss820dci_clear_stall(struct usb_device *udev, struct usb_pipe *pipe) { struct uss820dci_softc *sc; - struct usb2_endpoint_descriptor *ed; + struct usb_endpoint_descriptor *ed; USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); @@ -1301,7 +1301,7 @@ uss820dci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe) usb2_error_t uss820dci_init(struct uss820dci_softc *sc) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; uint8_t n; uint8_t temp; @@ -1499,7 +1499,7 @@ uss820dci_resume(struct uss820dci_softc *sc) } static void -uss820dci_do_poll(struct usb2_bus *bus) +uss820dci_do_poll(struct usb_bus *bus) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(bus); @@ -1512,32 +1512,32 @@ uss820dci_do_poll(struct usb2_bus *bus) * at91dci bulk support *------------------------------------------------------------------------*/ static void -uss820dci_device_bulk_open(struct usb2_xfer *xfer) +uss820dci_device_bulk_open(struct usb_xfer *xfer) { return; } static void -uss820dci_device_bulk_close(struct usb2_xfer *xfer) +uss820dci_device_bulk_close(struct usb_xfer *xfer) { uss820dci_device_done(xfer, USB_ERR_CANCELLED); } static void -uss820dci_device_bulk_enter(struct usb2_xfer *xfer) +uss820dci_device_bulk_enter(struct usb_xfer *xfer) { return; } static void -uss820dci_device_bulk_start(struct usb2_xfer *xfer) +uss820dci_device_bulk_start(struct usb_xfer *xfer) { /* setup TDs */ uss820dci_setup_standard_chain(xfer); uss820dci_start_standard_chain(xfer); } -struct usb2_pipe_methods uss820dci_device_bulk_methods = +struct usb_pipe_methods uss820dci_device_bulk_methods = { .open = uss820dci_device_bulk_open, .close = uss820dci_device_bulk_close, @@ -1549,32 +1549,32 @@ struct usb2_pipe_methods uss820dci_device_bulk_methods = * at91dci control support *------------------------------------------------------------------------*/ static void -uss820dci_device_ctrl_open(struct usb2_xfer *xfer) +uss820dci_device_ctrl_open(struct usb_xfer *xfer) { return; } static void -uss820dci_device_ctrl_close(struct usb2_xfer *xfer) +uss820dci_device_ctrl_close(struct usb_xfer *xfer) { uss820dci_device_done(xfer, USB_ERR_CANCELLED); } static void -uss820dci_device_ctrl_enter(struct usb2_xfer *xfer) +uss820dci_device_ctrl_enter(struct usb_xfer *xfer) { return; } static void -uss820dci_device_ctrl_start(struct usb2_xfer *xfer) +uss820dci_device_ctrl_start(struct usb_xfer *xfer) { /* setup TDs */ uss820dci_setup_standard_chain(xfer); uss820dci_start_standard_chain(xfer); } -struct usb2_pipe_methods uss820dci_device_ctrl_methods = +struct usb_pipe_methods uss820dci_device_ctrl_methods = { .open = uss820dci_device_ctrl_open, .close = uss820dci_device_ctrl_close, @@ -1586,32 +1586,32 @@ struct usb2_pipe_methods uss820dci_device_ctrl_methods = * at91dci interrupt support *------------------------------------------------------------------------*/ static void -uss820dci_device_intr_open(struct usb2_xfer *xfer) +uss820dci_device_intr_open(struct usb_xfer *xfer) { return; } static void -uss820dci_device_intr_close(struct usb2_xfer *xfer) +uss820dci_device_intr_close(struct usb_xfer *xfer) { uss820dci_device_done(xfer, USB_ERR_CANCELLED); } static void -uss820dci_device_intr_enter(struct usb2_xfer *xfer) +uss820dci_device_intr_enter(struct usb_xfer *xfer) { return; } static void -uss820dci_device_intr_start(struct usb2_xfer *xfer) +uss820dci_device_intr_start(struct usb_xfer *xfer) { /* setup TDs */ uss820dci_setup_standard_chain(xfer); uss820dci_start_standard_chain(xfer); } -struct usb2_pipe_methods uss820dci_device_intr_methods = +struct usb_pipe_methods uss820dci_device_intr_methods = { .open = uss820dci_device_intr_open, .close = uss820dci_device_intr_close, @@ -1623,19 +1623,19 @@ struct usb2_pipe_methods uss820dci_device_intr_methods = * at91dci full speed isochronous support *------------------------------------------------------------------------*/ static void -uss820dci_device_isoc_fs_open(struct usb2_xfer *xfer) +uss820dci_device_isoc_fs_open(struct usb_xfer *xfer) { return; } static void -uss820dci_device_isoc_fs_close(struct usb2_xfer *xfer) +uss820dci_device_isoc_fs_close(struct usb_xfer *xfer) { uss820dci_device_done(xfer, USB_ERR_CANCELLED); } static void -uss820dci_device_isoc_fs_enter(struct usb2_xfer *xfer) +uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); uint32_t temp; @@ -1687,13 +1687,13 @@ uss820dci_device_isoc_fs_enter(struct usb2_xfer *xfer) } static void -uss820dci_device_isoc_fs_start(struct usb2_xfer *xfer) +uss820dci_device_isoc_fs_start(struct usb_xfer *xfer) { /* start TD chain */ uss820dci_start_standard_chain(xfer); } -struct usb2_pipe_methods uss820dci_device_isoc_fs_methods = +struct usb_pipe_methods uss820dci_device_isoc_fs_methods = { .open = uss820dci_device_isoc_fs_open, .close = uss820dci_device_isoc_fs_close, @@ -1707,8 +1707,8 @@ struct usb2_pipe_methods uss820dci_device_isoc_fs_methods = * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ -static const struct usb2_device_descriptor uss820dci_devd = { - .bLength = sizeof(struct usb2_device_descriptor), +static const struct usb_device_descriptor uss820dci_devd = { + .bLength = sizeof(struct usb_device_descriptor), .bDescriptorType = UDESC_DEVICE, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1721,8 +1721,8 @@ static const struct usb2_device_descriptor uss820dci_devd = { .bNumConfigurations = 1, }; -static const struct usb2_device_qualifier uss820dci_odevd = { - .bLength = sizeof(struct usb2_device_qualifier), +static const struct usb_device_qualifier uss820dci_odevd = { + .bLength = sizeof(struct usb_device_qualifier), .bDescriptorType = UDESC_DEVICE_QUALIFIER, .bcdUSB = {0x00, 0x02}, .bDeviceClass = UDCLASS_HUB, @@ -1734,7 +1734,7 @@ static const struct usb2_device_qualifier uss820dci_odevd = { static const struct uss820dci_config_desc uss820dci_confd = { .confd = { - .bLength = sizeof(struct usb2_config_descriptor), + .bLength = sizeof(struct usb_config_descriptor), .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(uss820dci_confd), .bNumInterface = 1, @@ -1744,7 +1744,7 @@ static const struct uss820dci_config_desc uss820dci_confd = { .bMaxPower = 0, }, .ifcd = { - .bLength = sizeof(struct usb2_interface_descriptor), + .bLength = sizeof(struct usb_interface_descriptor), .bDescriptorType = UDESC_INTERFACE, .bNumEndpoints = 1, .bInterfaceClass = UICLASS_HUB, @@ -1753,7 +1753,7 @@ static const struct uss820dci_config_desc uss820dci_confd = { }, .endpd = { - .bLength = sizeof(struct usb2_endpoint_descriptor), + .bLength = sizeof(struct usb_endpoint_descriptor), .bDescriptorType = UDESC_ENDPOINT, .bEndpointAddress = (UE_DIR_IN | USS820_DCI_INTR_ENDPT), .bmAttributes = UE_INTERRUPT, @@ -1762,7 +1762,7 @@ static const struct uss820dci_config_desc uss820dci_confd = { }, }; -static const struct usb2_hub_descriptor_min uss820dci_hubd = { +static const struct usb_hub_descriptor_min uss820dci_hubd = { .bDescLength = sizeof(uss820dci_hubd), .bDescriptorType = UDESC_HUB, .bNbrPorts = 1, @@ -1791,8 +1791,8 @@ USB_MAKE_STRING_DESC(STRING_VENDOR, uss820dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, uss820dci_product); static usb2_error_t -uss820dci_roothub_exec(struct usb2_device *udev, - struct usb2_device_request *req, const void **pptr, uint16_t *plength) +uss820dci_roothub_exec(struct usb_device *udev, + struct usb_device_request *req, const void **pptr, uint16_t *plength) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(udev->bus); const void *ptr; @@ -2179,11 +2179,11 @@ done: } static void -uss820dci_xfer_setup(struct usb2_setup_params *parm) +uss820dci_xfer_setup(struct usb_setup_params *parm) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; struct uss820dci_softc *sc; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; void *last_obj; uint32_t ntd; uint32_t n; @@ -2287,14 +2287,14 @@ uss820dci_xfer_setup(struct usb2_setup_params *parm) } static void -uss820dci_xfer_unsetup(struct usb2_xfer *xfer) +uss820dci_xfer_unsetup(struct usb_xfer *xfer) { return; } static void -uss820dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc, - struct usb2_pipe *pipe) +uss820dci_pipe_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, + struct usb_pipe *pipe) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(udev->bus); @@ -2333,7 +2333,7 @@ uss820dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *e } } -struct usb2_bus_methods uss820dci_bus_methods = +struct usb_bus_methods uss820dci_bus_methods = { .pipe_init = &uss820dci_pipe_init, .xfer_setup = &uss820dci_xfer_setup, diff --git a/sys/dev/usb/controller/uss820dci.h b/sys/dev/usb/controller/uss820dci.h index 08bbb6a463d4..8e51cafe81ca 100644 --- a/sys/dev/usb/controller/uss820dci.h +++ b/sys/dev/usb/controller/uss820dci.h @@ -270,7 +270,7 @@ struct uss820dci_td { bus_space_handle_t io_hdl; struct uss820dci_td *obj_next; uss820dci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; uint32_t offset; uint32_t remainder; uint16_t max_packet_size; @@ -285,7 +285,7 @@ struct uss820dci_td { struct uss820_std_temp { uss820dci_cmd_t *func; - struct usb2_page_cache *pc; + struct usb_page_cache *pc; struct uss820dci_td *td; struct uss820dci_td *td_next; uint32_t len; @@ -301,14 +301,14 @@ struct uss820_std_temp { }; struct uss820dci_config_desc { - struct usb2_config_descriptor confd; - struct usb2_interface_descriptor ifcd; - struct usb2_endpoint_descriptor endpd; + struct usb_config_descriptor confd; + struct usb_interface_descriptor ifcd; + struct usb_endpoint_descriptor endpd; } __packed; union uss820_hub_temp { uWord wValue; - struct usb2_port_status ps; + struct usb_port_status ps; }; struct uss820_flags { @@ -325,10 +325,10 @@ struct uss820_flags { }; struct uss820dci_softc { - struct usb2_bus sc_bus; + struct usb_bus sc_bus; union uss820_hub_temp sc_hub_temp; - struct usb2_device *sc_devices[USS820_MAX_DEVICES]; + struct usb_device *sc_devices[USS820_MAX_DEVICES]; struct resource *sc_io_res; struct resource *sc_irq_res; void *sc_intr_hdl; diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index da3b5a3473e5..d218a3031942 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -92,11 +92,11 @@ enum { }; struct uhid_softc { - struct usb2_fifo_sc sc_fifo; + struct usb_fifo_sc sc_fifo; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[UHID_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UHID_N_TRANSFER]; + struct usb_device *sc_udev; void *sc_repdesc_ptr; uint32_t sc_isize; @@ -138,7 +138,7 @@ static usb2_fifo_open_t uhid_open; static usb2_fifo_close_t uhid_close; static usb2_fifo_ioctl_t uhid_ioctl; -static struct usb2_fifo_methods uhid_fifo_methods = { +static struct usb_fifo_methods uhid_fifo_methods = { .f_open = &uhid_open, .f_close = &uhid_close, .f_ioctl = &uhid_ioctl, @@ -150,7 +150,7 @@ static struct usb2_fifo_methods uhid_fifo_methods = { }; static void -uhid_intr_callback(struct usb2_xfer *xfer) +uhid_intr_callback(struct usb_xfer *xfer) { struct uhid_softc *sc = xfer->priv_sc; @@ -189,7 +189,7 @@ re_submit: } static void -uhid_fill_set_report(struct usb2_device_request *req, uint8_t iface_no, +uhid_fill_set_report(struct usb_device_request *req, uint8_t iface_no, uint8_t type, uint8_t id, uint16_t size) { req->bmRequestType = UT_WRITE_CLASS_INTERFACE; @@ -201,7 +201,7 @@ uhid_fill_set_report(struct usb2_device_request *req, uint8_t iface_no, } static void -uhid_fill_get_report(struct usb2_device_request *req, uint8_t iface_no, +uhid_fill_get_report(struct usb_device_request *req, uint8_t iface_no, uint8_t type, uint8_t id, uint16_t size) { req->bmRequestType = UT_READ_CLASS_INTERFACE; @@ -213,10 +213,10 @@ uhid_fill_get_report(struct usb2_device_request *req, uint8_t iface_no, } static void -uhid_write_callback(struct usb2_xfer *xfer) +uhid_write_callback(struct usb_xfer *xfer) { struct uhid_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; uint32_t size = sc->sc_osize; uint32_t actlen; uint8_t id; @@ -275,10 +275,10 @@ tr_error: } static void -uhid_read_callback(struct usb2_xfer *xfer) +uhid_read_callback(struct usb_xfer *xfer) { struct uhid_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -310,7 +310,7 @@ uhid_read_callback(struct usb2_xfer *xfer) } } -static const struct usb2_config uhid_config[UHID_N_TRANSFER] = { +static const struct usb_config uhid_config[UHID_N_TRANSFER] = { [UHID_INTR_DT_RD] = { .type = UE_INTERRUPT, @@ -325,7 +325,7 @@ static const struct usb2_config uhid_config[UHID_N_TRANSFER] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request) + UHID_BSIZE, + .bufsize = sizeof(struct usb_device_request) + UHID_BSIZE, .callback = &uhid_write_callback, .timeout = 1000, /* 1 second */ }, @@ -334,14 +334,14 @@ static const struct usb2_config uhid_config[UHID_N_TRANSFER] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request) + UHID_BSIZE, + .bufsize = sizeof(struct usb_device_request) + UHID_BSIZE, .callback = &uhid_read_callback, .timeout = 1000, /* 1 second */ }, }; static void -uhid_start_read(struct usb2_fifo *fifo) +uhid_start_read(struct usb_fifo *fifo) { struct uhid_softc *sc = fifo->priv_sc0; @@ -353,7 +353,7 @@ uhid_start_read(struct usb2_fifo *fifo) } static void -uhid_stop_read(struct usb2_fifo *fifo) +uhid_stop_read(struct usb_fifo *fifo) { struct uhid_softc *sc = fifo->priv_sc0; @@ -362,7 +362,7 @@ uhid_stop_read(struct usb2_fifo *fifo) } static void -uhid_start_write(struct usb2_fifo *fifo) +uhid_start_write(struct usb_fifo *fifo) { struct uhid_softc *sc = fifo->priv_sc0; @@ -370,7 +370,7 @@ uhid_start_write(struct usb2_fifo *fifo) } static void -uhid_stop_write(struct usb2_fifo *fifo) +uhid_stop_write(struct usb_fifo *fifo) { struct uhid_softc *sc = fifo->priv_sc0; @@ -447,7 +447,7 @@ done: } static int -uhid_open(struct usb2_fifo *fifo, int fflags) +uhid_open(struct usb_fifo *fifo, int fflags) { struct uhid_softc *sc = fifo->priv_sc0; @@ -474,7 +474,7 @@ uhid_open(struct usb2_fifo *fifo, int fflags) } static void -uhid_close(struct usb2_fifo *fifo, int fflags) +uhid_close(struct usb_fifo *fifo, int fflags) { if (fflags & (FREAD | FWRITE)) { usb2_fifo_free_buffer(fifo); @@ -482,11 +482,11 @@ uhid_close(struct usb2_fifo *fifo, int fflags) } static int -uhid_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, +uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { struct uhid_softc *sc = fifo->priv_sc0; - struct usb2_gen_descriptor *ugd; + struct usb_gen_descriptor *ugd; uint32_t size; int error = 0; uint8_t id; @@ -595,7 +595,7 @@ uhid_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, static int uhid_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); DPRINTFN(11, "\n"); @@ -625,7 +625,7 @@ uhid_probe(device_t dev) static int uhid_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uhid_softc *sc = device_get_softc(dev); int unit = device_get_unit(dev); int error = 0; diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index d1961eafdb93..3c03da011700 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -129,13 +129,13 @@ struct ukbd_softc { fkeytab_t sc_fkeymap[UKBD_NFKEY]; struct hid_location sc_loc_apple_eject; struct hid_location sc_loc_apple_fn; - struct usb2_callout sc_callout; + struct usb_callout sc_callout; struct ukbd_data sc_ndata; struct ukbd_data sc_odata; - struct usb2_device *sc_udev; - struct usb2_interface *sc_iface; - struct usb2_xfer *sc_xfer[UKBD_N_TRANSFER]; + struct usb_device *sc_udev; + struct usb_interface *sc_iface; + struct usb_xfer *sc_xfer[UKBD_N_TRANSFER]; uint32_t sc_ntime[UKBD_NKEYCODE]; uint32_t sc_otime[UKBD_NKEYCODE]; @@ -480,7 +480,7 @@ ukbd_apple_swap(uint8_t keycode) { } static void -ukbd_intr_callback(struct usb2_xfer *xfer) +ukbd_intr_callback(struct usb_xfer *xfer) { struct ukbd_softc *sc = xfer->priv_sc; uint16_t len = xfer->actlen; @@ -587,9 +587,9 @@ tr_setup: } static void -ukbd_set_leds_callback(struct usb2_xfer *xfer) +ukbd_set_leds_callback(struct usb_xfer *xfer) { - struct usb2_device_request req; + struct usb_device_request req; uint8_t buf[2]; struct ukbd_softc *sc = xfer->priv_sc; @@ -633,7 +633,7 @@ ukbd_set_leds_callback(struct usb2_xfer *xfer) } } -static const struct usb2_config ukbd_config[UKBD_N_TRANSFER] = { +static const struct usb_config ukbd_config[UKBD_N_TRANSFER] = { [UKBD_INTR_DT] = { .type = UE_INTERRUPT, @@ -648,7 +648,7 @@ static const struct usb2_config ukbd_config[UKBD_N_TRANSFER] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request) + 8, + .bufsize = sizeof(struct usb_device_request) + 8, .callback = &ukbd_set_leds_callback, .timeout = 1000, /* 1 second */ }, @@ -658,7 +658,7 @@ static int ukbd_probe(device_t dev) { keyboard_switch_t *sw = kbd_get_switch(UKBD_DRIVER_NAME); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); DPRINTFN(11, "\n"); @@ -684,7 +684,7 @@ static int ukbd_attach(device_t dev) { struct ukbd_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); int32_t unit = device_get_unit(dev); keyboard_t *kbd = &sc->sc_kbd; void *hid_ptr = NULL; diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 9b7d1fd8699c..4998e9e4ad31 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -118,16 +118,16 @@ struct ums_info { }; struct ums_softc { - struct usb2_fifo_sc sc_fifo; + struct usb_fifo_sc sc_fifo; struct mtx sc_mtx; - struct usb2_callout sc_callout; + struct usb_callout sc_callout; struct ums_info sc_info[UMS_INFO_MAX]; mousehw_t sc_hw; mousemode_t sc_mode; mousestatus_t sc_status; - struct usb2_xfer *sc_xfer[UMS_N_TRANSFER]; + struct usb_xfer *sc_xfer[UMS_N_TRANSFER]; uint8_t sc_buttons; uint8_t sc_iid; @@ -150,7 +150,7 @@ static usb2_fifo_ioctl_t ums_ioctl; static void ums_put_queue(struct ums_softc *sc, int32_t dx, int32_t dy, int32_t dz, int32_t dt, int32_t buttons); -static struct usb2_fifo_methods ums_fifo_methods = { +static struct usb_fifo_methods ums_fifo_methods = { .f_open = &ums_open, .f_close = &ums_close, .f_ioctl = &ums_ioctl, @@ -170,7 +170,7 @@ ums_put_queue_timeout(void *__sc) } static void -ums_intr_callback(struct usb2_xfer *xfer) +ums_intr_callback(struct usb_xfer *xfer) { struct ums_softc *sc = xfer->priv_sc; struct ums_info *info = &sc->sc_info[0]; @@ -316,7 +316,7 @@ tr_setup: } } -static const struct usb2_config ums_config[UMS_N_TRANSFER] = { +static const struct usb_config ums_config[UMS_N_TRANSFER] = { [UMS_INTR_DT] = { .type = UE_INTERRUPT, @@ -331,8 +331,8 @@ static const struct usb2_config ums_config[UMS_N_TRANSFER] = { static int ums_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface_descriptor *id; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface_descriptor *id; void *d_ptr; int error; uint16_t d_len; @@ -467,7 +467,7 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, static int ums_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ums_softc *sc = device_get_softc(dev); struct ums_info *info; void *d_ptr = NULL; @@ -638,7 +638,7 @@ ums_detach(device_t self) } static void -ums_start_read(struct usb2_fifo *fifo) +ums_start_read(struct usb_fifo *fifo) { struct ums_softc *sc = fifo->priv_sc0; @@ -646,7 +646,7 @@ ums_start_read(struct usb2_fifo *fifo) } static void -ums_stop_read(struct usb2_fifo *fifo) +ums_stop_read(struct usb_fifo *fifo) { struct ums_softc *sc = fifo->priv_sc0; @@ -713,7 +713,7 @@ ums_reset_buf(struct ums_softc *sc) } static int -ums_open(struct usb2_fifo *fifo, int fflags) +ums_open(struct usb_fifo *fifo, int fflags) { struct ums_softc *sc = fifo->priv_sc0; @@ -740,7 +740,7 @@ ums_open(struct usb2_fifo *fifo, int fflags) } static void -ums_close(struct usb2_fifo *fifo, int fflags) +ums_close(struct usb_fifo *fifo, int fflags) { if (fflags & FREAD) { usb2_fifo_free_buffer(fifo); @@ -748,7 +748,7 @@ ums_close(struct usb2_fifo *fifo, int fflags) } static int -ums_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, int fflags) +ums_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { struct ums_softc *sc = fifo->priv_sc0; mousemode_t mode; diff --git a/sys/dev/usb/misc/udbp.c b/sys/dev/usb/misc/udbp.c index 1a7f8af5b024..5a738ed0498c 100644 --- a/sys/dev/usb/misc/udbp.c +++ b/sys/dev/usb/misc/udbp.c @@ -105,7 +105,7 @@ struct udbp_softc { struct ng_bt_mbufq sc_xmitq_hipri; /* hi-priority transmit queue */ struct ng_bt_mbufq sc_xmitq; /* low-priority transmit queue */ - struct usb2_xfer *sc_xfer[UDBP_T_MAX]; + struct usb_xfer *sc_xfer[UDBP_T_MAX]; node_p sc_node; /* back pointer to node */ hook_p sc_hook; /* pointer to the hook */ struct mbuf *sc_bulk_in_buffer; @@ -186,7 +186,7 @@ static struct ng_type ng_udbp_typestruct = { }; /* USB config */ -static const struct usb2_config udbp_config[UDBP_T_MAX] = { +static const struct usb_config udbp_config[UDBP_T_MAX] = { [UDBP_T_WR] = { .type = UE_BULK, @@ -211,7 +211,7 @@ static const struct usb2_config udbp_config[UDBP_T_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &udbp_bulk_write_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -221,7 +221,7 @@ static const struct usb2_config udbp_config[UDBP_T_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &udbp_bulk_read_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -277,7 +277,7 @@ udbp_modload(module_t mod, int event, void *data) static int udbp_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -313,7 +313,7 @@ udbp_probe(device_t dev) static int udbp_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct udbp_softc *sc = device_get_softc(dev); int error; @@ -395,7 +395,7 @@ udbp_detach(device_t dev) } static void -udbp_bulk_read_callback(struct usb2_xfer *xfer) +udbp_bulk_read_callback(struct usb_xfer *xfer) { struct udbp_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -451,10 +451,10 @@ tr_setup: } static void -udbp_bulk_read_clear_stall_callback(struct usb2_xfer *xfer) +udbp_bulk_read_clear_stall_callback(struct usb_xfer *xfer) { struct udbp_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[UDBP_T_RD]; + struct usb_xfer *xfer_other = sc->sc_xfer[UDBP_T_RD]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -504,7 +504,7 @@ done: } static void -udbp_bulk_write_callback(struct usb2_xfer *xfer) +udbp_bulk_write_callback(struct usb_xfer *xfer) { struct udbp_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -559,10 +559,10 @@ udbp_bulk_write_callback(struct usb2_xfer *xfer) } static void -udbp_bulk_write_clear_stall_callback(struct usb2_xfer *xfer) +udbp_bulk_write_clear_stall_callback(struct usb_xfer *xfer) { struct udbp_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[UDBP_T_WR]; + struct usb_xfer *xfer_other = sc->sc_xfer[UDBP_T_WR]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); diff --git a/sys/dev/usb/misc/ufm.c b/sys/dev/usb/misc/ufm.c index 08808bbb5824..68012325d88e 100644 --- a/sys/dev/usb/misc/ufm.c +++ b/sys/dev/usb/misc/ufm.c @@ -55,10 +55,10 @@ __FBSDID("$FreeBSD$"); #define UFM_CMD2 0x02 struct ufm_softc { - struct usb2_fifo_sc sc_fifo; + struct usb_fifo_sc sc_fifo; struct mtx sc_mtx; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; uint32_t sc_unit; uint32_t sc_freq; @@ -75,7 +75,7 @@ static device_detach_t ufm_detach; static usb2_fifo_ioctl_t ufm_ioctl; static usb2_fifo_open_t ufm_open; -static struct usb2_fifo_methods ufm_fifo_methods = { +static struct usb_fifo_methods ufm_fifo_methods = { .f_ioctl = &ufm_ioctl, .f_open = &ufm_open, .basename[0] = "ufm", @@ -110,7 +110,7 @@ MODULE_DEPEND(ufm, usb, 1, 1, 1); static int ufm_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -125,7 +125,7 @@ ufm_probe(device_t dev) static int ufm_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ufm_softc *sc = device_get_softc(dev); int error; @@ -166,7 +166,7 @@ ufm_detach(device_t dev) } static int -ufm_open(struct usb2_fifo *dev, int fflags) +ufm_open(struct usb_fifo *dev, int fflags) { if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) { return (EACCES); @@ -180,7 +180,7 @@ ufm_do_req(struct ufm_softc *sc, uint8_t request, { int error; - struct usb2_device_request req; + struct usb_device_request req; uint8_t buf[1]; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -296,7 +296,7 @@ ufm_get_stat(struct ufm_softc *sc, void *addr) } static int -ufm_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, +ufm_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { struct ufm_softc *sc = fifo->priv_sc0; diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c index 4902c1cd5d54..a384fc4ac8e2 100644 --- a/sys/dev/usb/net/if_aue.c +++ b/sys/dev/usb/net/if_aue.c @@ -97,7 +97,7 @@ SYSCTL_INT(_hw_usb_aue, OID_AUTO, debug, CTLFLAG_RW, &aue_debug, 0, /* * Various supported device vendors/products. */ -static const struct usb2_device_id aue_devs[] = { +static const struct usb_device_id aue_devs[] = { {USB_VPI(USB_VENDOR_3COM, USB_PRODUCT_3COM_3C460B, AUE_FLAG_PII)}, {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_DSB650TX_PNA, 0)}, {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_UFE1000, AUE_FLAG_LSYS)}, @@ -202,7 +202,7 @@ static void aue_reset_pegasus_II(struct aue_softc *); static int aue_ifmedia_upd(struct ifnet *); static void aue_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static const struct usb2_config aue_config[AUE_N_TRANSFER] = { +static const struct usb_config aue_config[AUE_N_TRANSFER] = { [AUE_BULK_DT_WR] = { .type = UE_BULK, @@ -266,7 +266,7 @@ MODULE_DEPEND(aue, usb, 1, 1, 1); MODULE_DEPEND(aue, ether, 1, 1, 1); MODULE_DEPEND(aue, miibus, 1, 1, 1); -static const struct usb2_ether_methods aue_ue_methods = { +static const struct usb_ether_methods aue_ue_methods = { .ue_attach_post = aue_attach_post, .ue_start = aue_start, .ue_init = aue_init, @@ -287,7 +287,7 @@ static const struct usb2_ether_methods aue_ue_methods = { static uint8_t aue_csr_read_1(struct aue_softc *sc, uint16_t reg) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint8_t val; @@ -306,7 +306,7 @@ aue_csr_read_1(struct aue_softc *sc, uint16_t reg) static uint16_t aue_csr_read_2(struct aue_softc *sc, uint16_t reg) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint16_t val; @@ -325,7 +325,7 @@ aue_csr_read_2(struct aue_softc *sc, uint16_t reg) static void aue_csr_write_1(struct aue_softc *sc, uint16_t reg, uint8_t val) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = AUE_UR_WRITEREG; @@ -342,7 +342,7 @@ aue_csr_write_1(struct aue_softc *sc, uint16_t reg, uint8_t val) static void aue_csr_write_2(struct aue_softc *sc, uint16_t reg, uint16_t val) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = AUE_UR_WRITEREG; @@ -518,7 +518,7 @@ aue_miibus_statchg(device_t dev) #define AUE_BITS 6 static void -aue_setmulti(struct usb2_ether *ue) +aue_setmulti(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -609,7 +609,7 @@ aue_reset(struct aue_softc *sc) } static void -aue_attach_post(struct usb2_ether *ue) +aue_attach_post(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); @@ -626,7 +626,7 @@ aue_attach_post(struct usb2_ether *ue) static int aue_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -654,9 +654,9 @@ aue_probe(device_t dev) static int aue_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct aue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; uint8_t iface_index; int error; @@ -701,7 +701,7 @@ static int aue_detach(device_t dev) { struct aue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; usb2_transfer_unsetup(sc->sc_xfer, AUE_N_TRANSFER); usb2_ether_ifdetach(ue); @@ -711,7 +711,7 @@ aue_detach(device_t dev) } static void -aue_intr_callback(struct usb2_xfer *xfer) +aue_intr_callback(struct usb_xfer *xfer) { struct aue_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -749,10 +749,10 @@ tr_setup: } static void -aue_bulk_read_callback(struct usb2_xfer *xfer) +aue_bulk_read_callback(struct usb_xfer *xfer) { struct aue_softc *sc = xfer->priv_sc; - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; struct ifnet *ifp = usb2_ether_getifp(ue); struct aue_rxpkt stat; @@ -811,7 +811,7 @@ tr_setup: } static void -aue_bulk_write_callback(struct usb2_xfer *xfer) +aue_bulk_write_callback(struct usb_xfer *xfer) { struct aue_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -893,7 +893,7 @@ tr_setup: } static void -aue_tick(struct usb2_ether *ue) +aue_tick(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); struct mii_data *mii = GET_MII(sc); @@ -910,7 +910,7 @@ aue_tick(struct usb2_ether *ue) } static void -aue_start(struct usb2_ether *ue) +aue_start(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); @@ -923,7 +923,7 @@ aue_start(struct usb2_ether *ue) } static void -aue_init(struct usb2_ether *ue) +aue_init(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -958,7 +958,7 @@ aue_init(struct usb2_ether *ue) } static void -aue_setpromisc(struct usb2_ether *ue) +aue_setpromisc(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -1015,7 +1015,7 @@ aue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) * RX and TX lists. */ static void -aue_stop(struct usb2_ether *ue) +aue_stop(struct usb_ether *ue) { struct aue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); diff --git a/sys/dev/usb/net/if_auereg.h b/sys/dev/usb/net/if_auereg.h index 249c9137c762..f1f73985d572 100644 --- a/sys/dev/usb/net/if_auereg.h +++ b/sys/dev/usb/net/if_auereg.h @@ -202,9 +202,9 @@ struct aue_rxpkt { } __packed; struct aue_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[AUE_N_TRANSFER]; + struct usb_xfer *sc_xfer[AUE_N_TRANSFER]; int sc_flags; #define AUE_FLAG_LSYS 0x0001 /* use Linksys reset */ diff --git a/sys/dev/usb/net/if_axe.c b/sys/dev/usb/net/if_axe.c index f720c4ec3ca0..99fb7e3e2695 100644 --- a/sys/dev/usb/net/if_axe.c +++ b/sys/dev/usb/net/if_axe.c @@ -120,7 +120,7 @@ SYSCTL_INT(_hw_usb_axe, OID_AUTO, debug, CTLFLAG_RW, &axe_debug, 0, /* * Various supported device vendors/products. */ -static const struct usb2_device_id axe_devs[] = { +static const struct usb_device_id axe_devs[] = { {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_UF200, 0)}, {USB_VPI(USB_VENDOR_ACERCM, USB_PRODUCT_ACERCM_EP1427X2, 0)}, {USB_VPI(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_ETHERNET, AXE_FLAG_772)}, @@ -175,7 +175,7 @@ static void axe_ax88178_init(struct axe_softc *); static void axe_ax88772_init(struct axe_softc *); static int axe_get_phyno(struct axe_softc *, int); -static const struct usb2_config axe_config[AXE_N_TRANSFER] = { +static const struct usb_config axe_config[AXE_N_TRANSFER] = { [AXE_BULK_DT_WR] = { .type = UE_BULK, @@ -243,7 +243,7 @@ MODULE_DEPEND(axe, usb, 1, 1, 1); MODULE_DEPEND(axe, ether, 1, 1, 1); MODULE_DEPEND(axe, miibus, 1, 1, 1); -static const struct usb2_ether_methods axe_ue_methods = { +static const struct usb_ether_methods axe_ue_methods = { .ue_attach_post = axe_attach_post, .ue_start = axe_start, .ue_init = axe_init, @@ -258,7 +258,7 @@ static const struct usb2_ether_methods axe_ue_methods = { static int axe_cmd(struct axe_softc *sc, int cmd, int index, int val, void *buf) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; AXE_LOCK_ASSERT(sc, MA_OWNED); @@ -440,7 +440,7 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) } static void -axe_setmulti(struct usb2_ether *ue) +axe_setmulti(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -599,7 +599,7 @@ axe_ax88772_init(struct axe_softc *sc) static void axe_reset(struct axe_softc *sc) { - struct usb2_config_descriptor *cd; + struct usb_config_descriptor *cd; usb2_error_t err; cd = usb2_get_config_descriptor(sc->sc_ue.ue_udev); @@ -614,7 +614,7 @@ axe_reset(struct axe_softc *sc) } static void -axe_attach_post(struct usb2_ether *ue) +axe_attach_post(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); @@ -660,7 +660,7 @@ axe_attach_post(struct usb2_ether *ue) static int axe_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -679,9 +679,9 @@ axe_probe(device_t dev) static int axe_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct axe_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; uint8_t iface_index; int error; @@ -721,7 +721,7 @@ static int axe_detach(device_t dev) { struct axe_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; usb2_transfer_unsetup(sc->sc_xfer, AXE_N_TRANSFER); usb2_ether_ifdetach(ue); @@ -731,7 +731,7 @@ axe_detach(device_t dev) } static void -axe_intr_callback(struct usb2_xfer *xfer) +axe_intr_callback(struct usb_xfer *xfer) { switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -756,10 +756,10 @@ tr_setup: #endif static void -axe_bulk_read_callback(struct usb2_xfer *xfer) +axe_bulk_read_callback(struct usb_xfer *xfer) { struct axe_softc *sc = xfer->priv_sc; - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; struct ifnet *ifp = usb2_ether_getifp(ue); struct axe_sframe_hdr hdr; int error, pos, len, adjust; @@ -838,7 +838,7 @@ tr_setup: #endif static void -axe_bulk_write_callback(struct usb2_xfer *xfer) +axe_bulk_write_callback(struct usb_xfer *xfer) { struct axe_softc *sc = xfer->priv_sc; struct axe_sframe_hdr hdr; @@ -935,7 +935,7 @@ tr_setup: } static void -axe_tick(struct usb2_ether *ue) +axe_tick(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); struct mii_data *mii = GET_MII(sc); @@ -951,7 +951,7 @@ axe_tick(struct usb2_ether *ue) } static void -axe_start(struct usb2_ether *ue) +axe_start(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); @@ -964,7 +964,7 @@ axe_start(struct usb2_ether *ue) } static void -axe_init(struct usb2_ether *ue) +axe_init(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -1017,7 +1017,7 @@ axe_init(struct usb2_ether *ue) } static void -axe_setpromisc(struct usb2_ether *ue) +axe_setpromisc(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -1039,7 +1039,7 @@ axe_setpromisc(struct usb2_ether *ue) } static void -axe_stop(struct usb2_ether *ue) +axe_stop(struct usb_ether *ue) { struct axe_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); diff --git a/sys/dev/usb/net/if_axereg.h b/sys/dev/usb/net/if_axereg.h index dc063e3c40c8..075dd24f9ccf 100644 --- a/sys/dev/usb/net/if_axereg.h +++ b/sys/dev/usb/net/if_axereg.h @@ -177,9 +177,9 @@ enum { }; struct axe_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[AXE_N_TRANSFER]; + struct usb_xfer *sc_xfer[AXE_N_TRANSFER]; int sc_phyno; int sc_flags; diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 0c1e4c1dc35a..9032042aa078 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -93,7 +93,7 @@ SYSCTL_INT(_hw_usb_cdce, OID_AUTO, debug, CTLFLAG_RW, &cdce_debug, 0, "Debug level"); #endif -static const struct usb2_config cdce_config[CDCE_N_TRANSFER] = { +static const struct usb_config cdce_config[CDCE_N_TRANSFER] = { [CDCE_BULK_RX] = { .type = UE_BULK, @@ -174,7 +174,7 @@ MODULE_DEPEND(cdce, uether, 1, 1, 1); MODULE_DEPEND(cdce, usb, 1, 1, 1); MODULE_DEPEND(cdce, ether, 1, 1, 1); -static const struct usb2_ether_methods cdce_ue_methods = { +static const struct usb_ether_methods cdce_ue_methods = { .ue_attach_post = cdce_attach_post, .ue_start = cdce_start, .ue_init = cdce_init, @@ -183,7 +183,7 @@ static const struct usb2_ether_methods cdce_ue_methods = { .ue_setpromisc = cdce_setpromisc, }; -static const struct usb2_device_id cdce_devs[] = { +static const struct usb_device_id cdce_devs[] = { {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)}, {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)}, @@ -205,13 +205,13 @@ static const struct usb2_device_id cdce_devs[] = { static int cdce_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); return (usb2_lookup_id_by_uaa(cdce_devs, sizeof(cdce_devs), uaa)); } static void -cdce_attach_post(struct usb2_ether *ue) +cdce_attach_post(struct usb_ether *ue) { /* no-op */ return; @@ -221,12 +221,12 @@ static int cdce_attach(device_t dev) { struct cdce_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface *iface; - const struct usb2_cdc_union_descriptor *ud; - const struct usb2_interface_descriptor *id; - const struct usb2_cdc_ethernet_descriptor *ued; + struct usb_ether *ue = &sc->sc_ue; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface *iface; + const struct usb_cdc_union_descriptor *ud; + const struct usb_interface_descriptor *id; + const struct usb_cdc_ethernet_descriptor *ued; int error; uint8_t i; char eaddr_str[5 * ETHER_ADDR_LEN]; /* approx */ @@ -391,7 +391,7 @@ static int cdce_detach(device_t dev) { struct cdce_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; /* stop all USB transfers first */ usb2_transfer_unsetup(sc->sc_xfer, CDCE_N_TRANSFER); @@ -402,7 +402,7 @@ cdce_detach(device_t dev) } static void -cdce_start(struct usb2_ether *ue) +cdce_start(struct usb_ether *ue) { struct cdce_softc *sc = usb2_ether_getsc(ue); @@ -426,7 +426,7 @@ cdce_free_queue(struct mbuf **ppm, uint8_t n) } static void -cdce_bulk_write_callback(struct usb2_xfer *xfer) +cdce_bulk_write_callback(struct usb_xfer *xfer) { struct cdce_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -540,7 +540,7 @@ cdce_m_crc32(struct mbuf *m, uint32_t src_offset, uint32_t src_len) } static void -cdce_init(struct usb2_ether *ue) +cdce_init(struct usb_ether *ue) { struct cdce_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -561,7 +561,7 @@ cdce_init(struct usb2_ether *ue) } static void -cdce_stop(struct usb2_ether *ue) +cdce_stop(struct usb_ether *ue) { struct cdce_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -580,14 +580,14 @@ cdce_stop(struct usb2_ether *ue) } static void -cdce_setmulti(struct usb2_ether *ue) +cdce_setmulti(struct usb_ether *ue) { /* no-op */ return; } static void -cdce_setpromisc(struct usb2_ether *ue) +cdce_setpromisc(struct usb_ether *ue) { /* no-op */ return; @@ -608,7 +608,7 @@ cdce_resume(device_t dev) } static void -cdce_bulk_read_callback(struct usb2_xfer *xfer) +cdce_bulk_read_callback(struct usb_xfer *xfer) { struct cdce_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -684,7 +684,7 @@ tr_stall: } static void -cdce_intr_read_callback(struct usb2_xfer *xfer) +cdce_intr_read_callback(struct usb_xfer *xfer) { ; /* style fix */ switch (USB_GET_STATE(xfer)) { @@ -713,7 +713,7 @@ tr_setup: } static void -cdce_intr_write_callback(struct usb2_xfer *xfer) +cdce_intr_write_callback(struct usb_xfer *xfer) { ; /* style fix */ switch (USB_GET_STATE(xfer)) { diff --git a/sys/dev/usb/net/if_cdcereg.h b/sys/dev/usb/net/if_cdcereg.h index 0bcdde77352e..367e1677a3ee 100644 --- a/sys/dev/usb/net/if_cdcereg.h +++ b/sys/dev/usb/net/if_cdcereg.h @@ -47,9 +47,9 @@ enum { }; struct cdce_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[CDCE_N_TRANSFER]; + struct usb_xfer *sc_xfer[CDCE_N_TRANSFER]; struct mbuf *sc_rx_buf[CDCE_FRAMES_MAX]; struct mbuf *sc_tx_buf[CDCE_FRAMES_MAX]; diff --git a/sys/dev/usb/net/if_cue.c b/sys/dev/usb/net/if_cue.c index f5bb9aca20d9..3eba24d7d1c2 100644 --- a/sys/dev/usb/net/if_cue.c +++ b/sys/dev/usb/net/if_cue.c @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); /* Belkin F5U111 adapter covered by NETMATE entry */ -static const struct usb2_device_id cue_devs[] = { +static const struct usb_device_id cue_devs[] = { {USB_VPI(USB_VENDOR_CATC, USB_PRODUCT_CATC_NETMATE, 0)}, {USB_VPI(USB_VENDOR_CATC, USB_PRODUCT_CATC_NETMATE2, 0)}, {USB_VPI(USB_VENDOR_SMARTBRIDGES, USB_PRODUCT_SMARTBRIDGES_SMARTLINK, 0)}, @@ -114,7 +114,7 @@ SYSCTL_INT(_hw_usb_cue, OID_AUTO, debug, CTLFLAG_RW, &cue_debug, 0, "Debug level"); #endif -static const struct usb2_config cue_config[CUE_N_TRANSFER] = { +static const struct usb_config cue_config[CUE_N_TRANSFER] = { [CUE_BULK_DT_WR] = { .type = UE_BULK, @@ -158,7 +158,7 @@ MODULE_DEPEND(cue, uether, 1, 1, 1); MODULE_DEPEND(cue, usb, 1, 1, 1); MODULE_DEPEND(cue, ether, 1, 1, 1); -static const struct usb2_ether_methods cue_ue_methods = { +static const struct usb_ether_methods cue_ue_methods = { .ue_attach_post = cue_attach_post, .ue_start = cue_start, .ue_init = cue_init, @@ -177,7 +177,7 @@ static const struct usb2_ether_methods cue_ue_methods = { static uint8_t cue_csr_read_1(struct cue_softc *sc, uint16_t reg) { - struct usb2_device_request req; + struct usb_device_request req; uint8_t val; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -195,7 +195,7 @@ cue_csr_read_1(struct cue_softc *sc, uint16_t reg) static uint16_t cue_csr_read_2(struct cue_softc *sc, uint8_t reg) { - struct usb2_device_request req; + struct usb_device_request req; uint16_t val; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -211,7 +211,7 @@ cue_csr_read_2(struct cue_softc *sc, uint8_t reg) static int cue_csr_write_1(struct cue_softc *sc, uint16_t reg, uint16_t val) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = CUE_CMD_WRITEREG; @@ -225,7 +225,7 @@ cue_csr_write_1(struct cue_softc *sc, uint16_t reg, uint16_t val) static int cue_mem(struct cue_softc *sc, uint8_t cmd, uint16_t addr, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; if (cmd == CUE_CMD_READSRAM) req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -242,7 +242,7 @@ cue_mem(struct cue_softc *sc, uint8_t cmd, uint16_t addr, void *buf, int len) static int cue_getmac(struct cue_softc *sc, void *buf) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = CUE_CMD_GET_MACADDR; @@ -267,7 +267,7 @@ cue_mchash(const uint8_t *addr) } static void -cue_setpromisc(struct usb2_ether *ue) +cue_setpromisc(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -285,7 +285,7 @@ cue_setpromisc(struct usb2_ether *ue) } static void -cue_setmulti(struct usb2_ether *ue) +cue_setmulti(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -329,7 +329,7 @@ cue_setmulti(struct usb2_ether *ue) static void cue_reset(struct cue_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = CUE_CMD_RESET; @@ -348,7 +348,7 @@ cue_reset(struct cue_softc *sc) } static void -cue_attach_post(struct usb2_ether *ue) +cue_attach_post(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); @@ -358,7 +358,7 @@ cue_attach_post(struct usb2_ether *ue) static int cue_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -377,9 +377,9 @@ cue_probe(device_t dev) static int cue_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct cue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; uint8_t iface_index; int error; @@ -416,7 +416,7 @@ static int cue_detach(device_t dev) { struct cue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; usb2_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER); usb2_ether_ifdetach(ue); @@ -426,10 +426,10 @@ cue_detach(device_t dev) } static void -cue_bulk_read_callback(struct usb2_xfer *xfer) +cue_bulk_read_callback(struct usb_xfer *xfer) { struct cue_softc *sc = xfer->priv_sc; - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; struct ifnet *ifp = usb2_ether_getifp(ue); uint8_t buf[2]; int len; @@ -470,7 +470,7 @@ tr_setup: } static void -cue_bulk_write_callback(struct usb2_xfer *xfer) +cue_bulk_write_callback(struct usb_xfer *xfer) { struct cue_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -531,7 +531,7 @@ tr_setup: } static void -cue_tick(struct usb2_ether *ue) +cue_tick(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -547,7 +547,7 @@ cue_tick(struct usb2_ether *ue) } static void -cue_start(struct usb2_ether *ue) +cue_start(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); @@ -559,7 +559,7 @@ cue_start(struct usb2_ether *ue) } static void -cue_init(struct usb2_ether *ue) +cue_init(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -609,7 +609,7 @@ cue_init(struct usb2_ether *ue) * RX and TX lists. */ static void -cue_stop(struct usb2_ether *ue) +cue_stop(struct usb_ether *ue) { struct cue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); diff --git a/sys/dev/usb/net/if_cuereg.h b/sys/dev/usb/net/if_cuereg.h index ca3a816e1a4e..1782c2167ffa 100644 --- a/sys/dev/usb/net/if_cuereg.h +++ b/sys/dev/usb/net/if_cuereg.h @@ -119,9 +119,9 @@ enum { }; struct cue_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[CUE_N_TRANSFER]; + struct usb_xfer *sc_xfer[CUE_N_TRANSFER]; int sc_flags; #define CUE_FLAG_LINK 0x0001 /* got a link */ diff --git a/sys/dev/usb/net/if_kue.c b/sys/dev/usb/net/if_kue.c index 91b25b3ca27a..137f90ec5580 100644 --- a/sys/dev/usb/net/if_kue.c +++ b/sys/dev/usb/net/if_kue.c @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); /* * Various supported device vendors/products. */ -static const struct usb2_device_id kue_devs[] = { +static const struct usb_device_id kue_devs[] = { {USB_VPI(USB_VENDOR_3COM, USB_PRODUCT_3COM_3C19250, 0)}, {USB_VPI(USB_VENDOR_3COM, USB_PRODUCT_3COM_3C460, 0)}, {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_URE450, 0)}, @@ -141,7 +141,7 @@ static usb2_ether_fn_t kue_setmulti; static usb2_ether_fn_t kue_setpromisc; static int kue_do_request(struct kue_softc *, - struct usb2_device_request *, void *); + struct usb_device_request *, void *); static int kue_setword(struct kue_softc *, uint8_t, uint16_t); static int kue_ctl(struct kue_softc *, uint8_t, uint8_t, uint16_t, void *, int); @@ -156,7 +156,7 @@ SYSCTL_INT(_hw_usb_kue, OID_AUTO, debug, CTLFLAG_RW, &kue_debug, 0, "Debug level"); #endif -static const struct usb2_config kue_config[KUE_N_TRANSFER] = { +static const struct usb_config kue_config[KUE_N_TRANSFER] = { [KUE_BULK_DT_WR] = { .type = UE_BULK, @@ -201,7 +201,7 @@ MODULE_DEPEND(kue, uether, 1, 1, 1); MODULE_DEPEND(kue, usb, 1, 1, 1); MODULE_DEPEND(kue, ether, 1, 1, 1); -static const struct usb2_ether_methods kue_ue_methods = { +static const struct usb_ether_methods kue_ue_methods = { .ue_attach_post = kue_attach_post, .ue_start = kue_start, .ue_init = kue_init, @@ -218,7 +218,7 @@ static const struct usb2_ether_methods kue_ue_methods = { * than the default timeout. */ static int -kue_do_request(struct kue_softc *sc, struct usb2_device_request *req, +kue_do_request(struct kue_softc *sc, struct usb_device_request *req, void *data) { usb2_error_t err; @@ -231,7 +231,7 @@ kue_do_request(struct kue_softc *sc, struct usb2_device_request *req, static int kue_setword(struct kue_softc *sc, uint8_t breq, uint16_t word) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = breq; @@ -246,7 +246,7 @@ static int kue_ctl(struct kue_softc *sc, uint8_t rw, uint8_t breq, uint16_t val, void *data, int len) { - struct usb2_device_request req; + struct usb_device_request req; if (rw == KUE_CTL_WRITE) req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -265,7 +265,7 @@ kue_ctl(struct kue_softc *sc, uint8_t rw, uint8_t breq, static int kue_load_fw(struct kue_softc *sc) { - struct usb2_device_descriptor *dd; + struct usb_device_descriptor *dd; uint16_t hwrev; usb2_error_t err; @@ -320,7 +320,7 @@ kue_load_fw(struct kue_softc *sc) } static void -kue_setpromisc(struct usb2_ether *ue) +kue_setpromisc(struct usb_ether *ue) { struct kue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -336,7 +336,7 @@ kue_setpromisc(struct usb2_ether *ue) } static void -kue_setmulti(struct usb2_ether *ue) +kue_setmulti(struct usb_ether *ue) { struct kue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -390,7 +390,7 @@ kue_setmulti(struct usb2_ether *ue) static void kue_reset(struct kue_softc *sc) { - struct usb2_config_descriptor *cd; + struct usb_config_descriptor *cd; usb2_error_t err; cd = usb2_get_config_descriptor(sc->sc_ue.ue_udev); @@ -405,7 +405,7 @@ kue_reset(struct kue_softc *sc) } static void -kue_attach_post(struct usb2_ether *ue) +kue_attach_post(struct usb_ether *ue) { struct kue_softc *sc = usb2_ether_getsc(ue); int error; @@ -434,7 +434,7 @@ kue_attach_post(struct usb2_ether *ue) static int kue_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -453,9 +453,9 @@ kue_probe(device_t dev) static int kue_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct kue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; uint8_t iface_index; int error; @@ -499,7 +499,7 @@ static int kue_detach(device_t dev) { struct kue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; usb2_transfer_unsetup(sc->sc_xfer, KUE_N_TRANSFER); usb2_ether_ifdetach(ue); @@ -514,10 +514,10 @@ kue_detach(device_t dev) * the higher level protocols. */ static void -kue_bulk_read_callback(struct usb2_xfer *xfer) +kue_bulk_read_callback(struct usb_xfer *xfer) { struct kue_softc *sc = xfer->priv_sc; - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; struct ifnet *ifp = usb2_ether_getifp(ue); uint8_t buf[2]; int len; @@ -558,7 +558,7 @@ tr_setup: } static void -kue_bulk_write_callback(struct usb2_xfer *xfer) +kue_bulk_write_callback(struct usb_xfer *xfer) { struct kue_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -628,7 +628,7 @@ tr_setup: } static void -kue_start(struct usb2_ether *ue) +kue_start(struct usb_ether *ue) { struct kue_softc *sc = usb2_ether_getsc(ue); @@ -640,7 +640,7 @@ kue_start(struct usb2_ether *ue) } static void -kue_init(struct usb2_ether *ue) +kue_init(struct usb_ether *ue) { struct kue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -671,7 +671,7 @@ kue_init(struct usb2_ether *ue) } static void -kue_stop(struct usb2_ether *ue) +kue_stop(struct usb_ether *ue) { struct kue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); diff --git a/sys/dev/usb/net/if_kuereg.h b/sys/dev/usb/net/if_kuereg.h index 865068750379..16ad044d07ef 100644 --- a/sys/dev/usb/net/if_kuereg.h +++ b/sys/dev/usb/net/if_kuereg.h @@ -124,10 +124,10 @@ enum { }; struct kue_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; struct kue_ether_desc sc_desc; - struct usb2_xfer *sc_xfer[KUE_N_TRANSFER]; + struct usb_xfer *sc_xfer[KUE_N_TRANSFER]; uint8_t *sc_mcfilters; int sc_flags; diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c index 645177934ae1..68d7bb37123f 100644 --- a/sys/dev/usb/net/if_rue.c +++ b/sys/dev/usb/net/if_rue.c @@ -95,7 +95,7 @@ SYSCTL_INT(_hw_usb_rue, OID_AUTO, debug, CTLFLAG_RW, * Various supported device vendors/products. */ -static const struct usb2_device_id rue_devs[] = { +static const struct usb_device_id rue_devs[] = { {USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUAKTX, 0)}, {USB_VPI(USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_USBKR100, 0)}, }; @@ -134,7 +134,7 @@ static void rue_reset(struct rue_softc *); static int rue_ifmedia_upd(struct ifnet *); static void rue_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static const struct usb2_config rue_config[RUE_N_TRANSFER] = { +static const struct usb_config rue_config[RUE_N_TRANSFER] = { [RUE_BULK_DT_WR] = { .type = UE_BULK, @@ -199,7 +199,7 @@ MODULE_DEPEND(rue, usb, 1, 1, 1); MODULE_DEPEND(rue, ether, 1, 1, 1); MODULE_DEPEND(rue, miibus, 1, 1, 1); -static const struct usb2_ether_methods rue_ue_methods = { +static const struct usb_ether_methods rue_ue_methods = { .ue_attach_post = rue_attach_post, .ue_start = rue_start, .ue_init = rue_init, @@ -220,7 +220,7 @@ static const struct usb2_ether_methods rue_ue_methods = { static int rue_read_mem(struct rue_softc *sc, uint16_t addr, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = UR_SET_ADDRESS; @@ -234,7 +234,7 @@ rue_read_mem(struct rue_softc *sc, uint16_t addr, void *buf, int len) static int rue_write_mem(struct rue_softc *sc, uint16_t addr, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UR_SET_ADDRESS; @@ -434,7 +434,7 @@ rue_miibus_statchg(device_t dev) } static void -rue_setpromisc(struct usb2_ether *ue) +rue_setpromisc(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -452,7 +452,7 @@ rue_setpromisc(struct usb2_ether *ue) * Program the 64-bit multicast hash filter. */ static void -rue_setmulti(struct usb2_ether *ue) +rue_setmulti(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -527,7 +527,7 @@ rue_reset(struct rue_softc *sc) } static void -rue_attach_post(struct usb2_ether *ue) +rue_attach_post(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); @@ -544,7 +544,7 @@ rue_attach_post(struct usb2_ether *ue) static int rue_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -563,9 +563,9 @@ rue_probe(device_t dev) static int rue_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct rue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; uint8_t iface_index; int error; @@ -603,7 +603,7 @@ static int rue_detach(device_t dev) { struct rue_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; usb2_transfer_unsetup(sc->sc_xfer, RUE_N_TRANSFER); usb2_ether_ifdetach(ue); @@ -613,7 +613,7 @@ rue_detach(device_t dev) } static void -rue_intr_callback(struct usb2_xfer *xfer) +rue_intr_callback(struct usb_xfer *xfer) { struct rue_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -649,10 +649,10 @@ tr_setup: } static void -rue_bulk_read_callback(struct usb2_xfer *xfer) +rue_bulk_read_callback(struct usb_xfer *xfer) { struct rue_softc *sc = xfer->priv_sc; - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; struct ifnet *ifp = usb2_ether_getifp(ue); uint16_t status; @@ -696,7 +696,7 @@ tr_setup: } static void -rue_bulk_write_callback(struct usb2_xfer *xfer) +rue_bulk_write_callback(struct usb_xfer *xfer) { struct rue_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -768,7 +768,7 @@ tr_setup: } static void -rue_tick(struct usb2_ether *ue) +rue_tick(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); struct mii_data *mii = GET_MII(sc); @@ -785,7 +785,7 @@ rue_tick(struct usb2_ether *ue) } static void -rue_start(struct usb2_ether *ue) +rue_start(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); @@ -798,7 +798,7 @@ rue_start(struct usb2_ether *ue) } static void -rue_init(struct usb2_ether *ue) +rue_init(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); @@ -874,7 +874,7 @@ rue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) } static void -rue_stop(struct usb2_ether *ue) +rue_stop(struct usb_ether *ue) { struct rue_softc *sc = usb2_ether_getsc(ue); struct ifnet *ifp = usb2_ether_getifp(ue); diff --git a/sys/dev/usb/net/if_ruereg.h b/sys/dev/usb/net/if_ruereg.h index a94d45aafcfc..edfa3d3b8c94 100644 --- a/sys/dev/usb/net/if_ruereg.h +++ b/sys/dev/usb/net/if_ruereg.h @@ -170,9 +170,9 @@ enum { }; struct rue_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[RUE_N_TRANSFER]; + struct usb_xfer *sc_xfer[RUE_N_TRANSFER]; int sc_flags; #define RUE_FLAG_LINK 0x0001 diff --git a/sys/dev/usb/net/if_udav.c b/sys/dev/usb/net/if_udav.c index 3d3a05802fec..50ba41652573 100644 --- a/sys/dev/usb/net/if_udav.c +++ b/sys/dev/usb/net/if_udav.c @@ -94,7 +94,7 @@ static miibus_readreg_t udav_miibus_readreg; static miibus_writereg_t udav_miibus_writereg; static miibus_statchg_t udav_miibus_statchg; -static const struct usb2_config udav_config[UDAV_N_TRANSFER] = { +static const struct usb_config udav_config[UDAV_N_TRANSFER] = { [UDAV_BULK_DT_WR] = { .type = UE_BULK, @@ -159,7 +159,7 @@ MODULE_DEPEND(udav, usb, 1, 1, 1); MODULE_DEPEND(udav, ether, 1, 1, 1); MODULE_DEPEND(udav, miibus, 1, 1, 1); -static const struct usb2_ether_methods udav_ue_methods = { +static const struct usb_ether_methods udav_ue_methods = { .ue_attach_post = udav_attach_post, .ue_start = udav_start, .ue_init = udav_init, @@ -185,7 +185,7 @@ SYSCTL_INT(_hw_usb_udav, OID_AUTO, debug, CTLFLAG_RW, &udav_debug, 0, #define UDAV_CLRBIT(sc, reg, x) \ udav_csr_write1(sc, reg, udav_csr_read1(sc, reg) & ~(x)) -static const struct usb2_device_id udav_devs[] = { +static const struct usb_device_id udav_devs[] = { /* ShanTou DM9601 USB NIC */ {USB_VPI(USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_DM9601, 0)}, /* ShanTou ST268 USB NIC */ @@ -195,7 +195,7 @@ static const struct usb2_device_id udav_devs[] = { }; static void -udav_attach_post(struct usb2_ether *ue) +udav_attach_post(struct usb_ether *ue) { struct udav_softc *sc = usb2_ether_getsc(ue); @@ -209,7 +209,7 @@ udav_attach_post(struct usb2_ether *ue) static int udav_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -224,9 +224,9 @@ udav_probe(device_t dev) static int udav_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct udav_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; uint8_t iface_index; int error; @@ -267,7 +267,7 @@ static int udav_detach(device_t dev) { struct udav_softc *sc = device_get_softc(dev); - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; usb2_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER); usb2_ether_ifdetach(ue); @@ -281,7 +281,7 @@ static int udav_mem_read(struct udav_softc *sc, uint16_t offset, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; len &= 0xff; @@ -298,7 +298,7 @@ static int udav_mem_write(struct udav_softc *sc, uint16_t offset, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; len &= 0xff; @@ -315,7 +315,7 @@ static int udav_mem_write1(struct udav_softc *sc, uint16_t offset, uint8_t ch) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UDAV_REQ_MEM_WRITE1; @@ -330,7 +330,7 @@ udav_mem_write1(struct udav_softc *sc, uint16_t offset, static int udav_csr_read(struct udav_softc *sc, uint16_t offset, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; len &= 0xff; @@ -346,7 +346,7 @@ udav_csr_read(struct udav_softc *sc, uint16_t offset, void *buf, int len) static int udav_csr_write(struct udav_softc *sc, uint16_t offset, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; offset &= 0xff; len &= 0xff; @@ -373,7 +373,7 @@ static int udav_csr_write1(struct udav_softc *sc, uint16_t offset, uint8_t ch) { - struct usb2_device_request req; + struct usb_device_request req; offset &= 0xff; @@ -387,7 +387,7 @@ udav_csr_write1(struct udav_softc *sc, uint16_t offset, } static void -udav_init(struct usb2_ether *ue) +udav_init(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -459,7 +459,7 @@ udav_reset(struct udav_softc *sc) #define UDAV_BITS 6 static void -udav_setmulti(struct usb2_ether *ue) +udav_setmulti(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -499,7 +499,7 @@ udav_setmulti(struct usb2_ether *ue) } static void -udav_setpromisc(struct usb2_ether *ue) +udav_setpromisc(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -518,7 +518,7 @@ udav_setpromisc(struct usb2_ether *ue) } static void -udav_start(struct usb2_ether *ue) +udav_start(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; @@ -531,7 +531,7 @@ udav_start(struct usb2_ether *ue) } static void -udav_bulk_write_callback(struct usb2_xfer *xfer) +udav_bulk_write_callback(struct usb_xfer *xfer) { struct udav_softc *sc = xfer->priv_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -614,10 +614,10 @@ tr_setup: } static void -udav_bulk_read_callback(struct usb2_xfer *xfer) +udav_bulk_read_callback(struct usb_xfer *xfer) { struct udav_softc *sc = xfer->priv_sc; - struct usb2_ether *ue = &sc->sc_ue; + struct usb_ether *ue = &sc->sc_ue; struct ifnet *ifp = usb2_ether_getifp(ue); struct udav_rxpkt stat; int len; @@ -665,7 +665,7 @@ tr_setup: } static void -udav_intr_callback(struct usb2_xfer *xfer) +udav_intr_callback(struct usb_xfer *xfer) { switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -686,7 +686,7 @@ tr_setup: } static void -udav_stop(struct usb2_ether *ue) +udav_stop(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; struct ifnet *ifp = usb2_ether_getifp(&sc->sc_ue); @@ -739,7 +739,7 @@ udav_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr) } static void -udav_tick(struct usb2_ether *ue) +udav_tick(struct usb_ether *ue) { struct udav_softc *sc = ue->ue_sc; struct mii_data *mii = GET_MII(sc); diff --git a/sys/dev/usb/net/if_udavreg.h b/sys/dev/usb/net/if_udavreg.h index d652f5b48844..6dba64c34865 100644 --- a/sys/dev/usb/net/if_udavreg.h +++ b/sys/dev/usb/net/if_udavreg.h @@ -152,9 +152,9 @@ enum { }; struct udav_softc { - struct usb2_ether sc_ue; + struct usb_ether sc_ue; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[UDAV_N_TRANSFER]; + struct usb_xfer *sc_xfer[UDAV_N_TRANSFER]; int sc_flags; #define UDAV_FLAG_LINK 0x0001 diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c index 6bd5320e4baf..3d0c18dc5f97 100644 --- a/sys/dev/usb/net/usb_ethernet.c +++ b/sys/dev/usb/net/usb_ethernet.c @@ -67,7 +67,7 @@ static void ue_watchdog(void *); * Else: device has been detached */ uint8_t -usb2_ether_pause(struct usb2_ether *ue, unsigned int _ticks) +usb2_ether_pause(struct usb_ether *ue, unsigned int _ticks) { if (usb2_proc_is_gone(&ue->ue_tq)) { /* nothing to do */ @@ -78,11 +78,11 @@ usb2_ether_pause(struct usb2_ether *ue, unsigned int _ticks) } static void -ue_queue_command(struct usb2_ether *ue, +ue_queue_command(struct usb_ether *ue, usb2_proc_callback_t *fn, - struct usb2_proc_msg *t0, struct usb2_proc_msg *t1) + struct usb_proc_msg *t0, struct usb_proc_msg *t1) { - struct usb2_ether_cfg_task *task; + struct usb_ether_cfg_task *task; UE_LOCK_ASSERT(ue, MA_OWNED); @@ -94,7 +94,7 @@ ue_queue_command(struct usb2_ether *ue, * "sc_mtx" mutex. It is safe to update fields in the message * structure after that the message got queued. */ - task = (struct usb2_ether_cfg_task *) + task = (struct usb_ether_cfg_task *) usb2_proc_msignal(&ue->ue_tq, t0, t1); /* Setup callback and self pointers */ @@ -109,19 +109,19 @@ ue_queue_command(struct usb2_ether *ue, } struct ifnet * -usb2_ether_getifp(struct usb2_ether *ue) +usb2_ether_getifp(struct usb_ether *ue) { return (ue->ue_ifp); } struct mii_data * -usb2_ether_getmii(struct usb2_ether *ue) +usb2_ether_getmii(struct usb_ether *ue) { return (device_get_softc(ue->ue_miibus)); } void * -usb2_ether_getsc(struct usb2_ether *ue) +usb2_ether_getsc(struct usb_ether *ue) { return (ue->ue_sc); } @@ -129,7 +129,7 @@ usb2_ether_getsc(struct usb2_ether *ue) static int ue_sysctl_parent(SYSCTL_HANDLER_ARGS) { - struct usb2_ether *ue = arg1; + struct usb_ether *ue = arg1; const char *name; name = device_get_nameunit(ue->ue_dev); @@ -137,7 +137,7 @@ ue_sysctl_parent(SYSCTL_HANDLER_ARGS) } int -usb2_ether_ifattach(struct usb2_ether *ue) +usb2_ether_ifattach(struct usb_ether *ue) { int error; @@ -167,11 +167,11 @@ error: } static void -ue_attach_post_task(struct usb2_proc_msg *_task) +ue_attach_post_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; struct ifnet *ifp; int error; char num[14]; /* sufficient for 32 bits */ @@ -244,7 +244,7 @@ error: } void -usb2_ether_ifdetach(struct usb2_ether *ue) +usb2_ether_ifdetach(struct usb_ether *ue) { struct ifnet *ifp; @@ -289,7 +289,7 @@ usb2_ether_ifdetach(struct usb2_ether *ue) } uint8_t -usb2_ether_is_gone(struct usb2_ether *ue) +usb2_ether_is_gone(struct usb_ether *ue) { return (usb2_proc_is_gone(&ue->ue_tq)); } @@ -297,7 +297,7 @@ usb2_ether_is_gone(struct usb2_ether *ue) static void ue_init(void *arg) { - struct usb2_ether *ue = arg; + struct usb_ether *ue = arg; UE_LOCK(ue); ue_queue_command(ue, ue_start_task, @@ -307,11 +307,11 @@ ue_init(void *arg) } static void -ue_start_task(struct usb2_proc_msg *_task) +ue_start_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; struct ifnet *ifp = ue->ue_ifp; UE_LOCK_ASSERT(ue, MA_OWNED); @@ -326,11 +326,11 @@ ue_start_task(struct usb2_proc_msg *_task) } static void -ue_stop_task(struct usb2_proc_msg *_task) +ue_stop_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; UE_LOCK_ASSERT(ue, MA_OWNED); @@ -342,7 +342,7 @@ ue_stop_task(struct usb2_proc_msg *_task) static void ue_start(struct ifnet *ifp) { - struct usb2_ether *ue = ifp->if_softc; + struct usb_ether *ue = ifp->if_softc; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; @@ -353,21 +353,21 @@ ue_start(struct ifnet *ifp) } static void -ue_promisc_task(struct usb2_proc_msg *_task) +ue_promisc_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; ue->ue_methods->ue_setpromisc(ue); } static void -ue_setmulti_task(struct usb2_proc_msg *_task) +ue_setmulti_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; ue->ue_methods->ue_setmulti(ue); } @@ -375,7 +375,7 @@ ue_setmulti_task(struct usb2_proc_msg *_task) static int ue_ifmedia_upd(struct ifnet *ifp) { - struct usb2_ether *ue = ifp->if_softc; + struct usb_ether *ue = ifp->if_softc; /* Defer to process context */ UE_LOCK(ue); @@ -388,11 +388,11 @@ ue_ifmedia_upd(struct ifnet *ifp) } static void -ue_ifmedia_task(struct usb2_proc_msg *_task) +ue_ifmedia_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; struct ifnet *ifp = ue->ue_ifp; ue->ue_methods->ue_mii_upd(ifp); @@ -401,7 +401,7 @@ ue_ifmedia_task(struct usb2_proc_msg *_task) static void ue_watchdog(void *arg) { - struct usb2_ether *ue = arg; + struct usb_ether *ue = arg; struct ifnet *ifp = ue->ue_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -415,11 +415,11 @@ ue_watchdog(void *arg) } static void -ue_tick_task(struct usb2_proc_msg *_task) +ue_tick_task(struct usb_proc_msg *_task) { - struct usb2_ether_cfg_task *task = - (struct usb2_ether_cfg_task *)_task; - struct usb2_ether *ue = task->ue; + struct usb_ether_cfg_task *task = + (struct usb_ether_cfg_task *)_task; + struct usb_ether *ue = task->ue; struct ifnet *ifp = ue->ue_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -431,7 +431,7 @@ ue_tick_task(struct usb2_proc_msg *_task) int usb2_ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { - struct usb2_ether *ue = ifp->if_softc; + struct usb_ether *ue = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii; int error = 0; @@ -514,7 +514,7 @@ usb2_ether_newbuf(void) } int -usb2_ether_rxmbuf(struct usb2_ether *ue, struct mbuf *m, +usb2_ether_rxmbuf(struct usb_ether *ue, struct mbuf *m, unsigned int len) { struct ifnet *ifp = ue->ue_ifp; @@ -532,7 +532,7 @@ usb2_ether_rxmbuf(struct usb2_ether *ue, struct mbuf *m, } int -usb2_ether_rxbuf(struct usb2_ether *ue, struct usb2_page_cache *pc, +usb2_ether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset, unsigned int len) { struct ifnet *ifp = ue->ue_ifp; @@ -562,7 +562,7 @@ usb2_ether_rxbuf(struct usb2_ether *ue, struct usb2_page_cache *pc, } void -usb2_ether_rxflush(struct usb2_ether *ue) +usb2_ether_rxflush(struct usb_ether *ue) { struct ifnet *ifp = ue->ue_ifp; struct mbuf *m; diff --git a/sys/dev/usb/net/usb_ethernet.h b/sys/dev/usb/net/usb_ethernet.h index 3eaafede4d4d..9b63efd29a78 100644 --- a/sys/dev/usb/net/usb_ethernet.h +++ b/sys/dev/usb/net/usb_ethernet.h @@ -49,12 +49,12 @@ #include #include -struct usb2_ether; -struct usb2_device_request; +struct usb_ether; +struct usb_device_request; -typedef void (usb2_ether_fn_t)(struct usb2_ether *); +typedef void (usb2_ether_fn_t)(struct usb_ether *); -struct usb2_ether_methods { +struct usb_ether_methods { usb2_ether_fn_t *ue_attach_post; usb2_ether_fn_t *ue_start; usb2_ether_fn_t *ue_init; @@ -69,31 +69,31 @@ struct usb2_ether_methods { }; -struct usb2_ether_cfg_task { - struct usb2_proc_msg hdr; - struct usb2_ether *ue; +struct usb_ether_cfg_task { + struct usb_proc_msg hdr; + struct usb_ether *ue; }; -struct usb2_ether { +struct usb_ether { /* NOTE: the "ue_ifp" pointer must be first --hps */ struct ifnet *ue_ifp; struct mtx *ue_mtx; - const struct usb2_ether_methods *ue_methods; + const struct usb_ether_methods *ue_methods; struct sysctl_oid *ue_sysctl_oid; void *ue_sc; - struct usb2_device *ue_udev; /* used by usb2_ether_do_request() */ + struct usb_device *ue_udev; /* used by usb2_ether_do_request() */ device_t ue_dev; device_t ue_miibus; - struct usb2_process ue_tq; + struct usb_process ue_tq; struct sysctl_ctx_list ue_sysctl_ctx; struct ifqueue ue_rxq; - struct usb2_callout ue_watchdog; - struct usb2_ether_cfg_task ue_sync_task[2]; - struct usb2_ether_cfg_task ue_media_task[2]; - struct usb2_ether_cfg_task ue_multi_task[2]; - struct usb2_ether_cfg_task ue_promisc_task[2]; - struct usb2_ether_cfg_task ue_tick_task[2]; + struct usb_callout ue_watchdog; + struct usb_ether_cfg_task ue_sync_task[2]; + struct usb_ether_cfg_task ue_media_task[2]; + struct usb_ether_cfg_task ue_multi_task[2]; + struct usb_ether_cfg_task ue_promisc_task[2]; + struct usb_ether_cfg_task ue_tick_task[2]; int ue_unit; @@ -104,19 +104,19 @@ struct usb2_ether { #define usb2_ether_do_request(ue,req,data,timo) \ usb2_do_request_proc((ue)->ue_udev,&(ue)->ue_tq,req,data,0,NULL,timo) -uint8_t usb2_ether_pause(struct usb2_ether *, unsigned int); -struct ifnet *usb2_ether_getifp(struct usb2_ether *); -struct mii_data *usb2_ether_getmii(struct usb2_ether *); -void *usb2_ether_getsc(struct usb2_ether *); -int usb2_ether_ifattach(struct usb2_ether *); -void usb2_ether_ifdetach(struct usb2_ether *); +uint8_t usb2_ether_pause(struct usb_ether *, unsigned int); +struct ifnet *usb2_ether_getifp(struct usb_ether *); +struct mii_data *usb2_ether_getmii(struct usb_ether *); +void *usb2_ether_getsc(struct usb_ether *); +int usb2_ether_ifattach(struct usb_ether *); +void usb2_ether_ifdetach(struct usb_ether *); int usb2_ether_ioctl(struct ifnet *, u_long, caddr_t); struct mbuf *usb2_ether_newbuf(void); -int usb2_ether_rxmbuf(struct usb2_ether *, struct mbuf *, +int usb2_ether_rxmbuf(struct usb_ether *, struct mbuf *, unsigned int); -int usb2_ether_rxbuf(struct usb2_ether *, - struct usb2_page_cache *, +int usb2_ether_rxbuf(struct usb_ether *, + struct usb_page_cache *, unsigned int, unsigned int); -void usb2_ether_rxflush(struct usb2_ether *); -uint8_t usb2_ether_is_gone(struct usb2_ether *); +void usb2_ether_rxflush(struct usb_ether *); +uint8_t usb2_ether_is_gone(struct usb_ether *); #endif /* _USB2_ETHERNET_H_ */ diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index bc1b5270ccd9..fa7ab11d7ebd 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -156,7 +156,7 @@ usb2_quirkstr(uint16_t quirk) * Else: Quirk found *------------------------------------------------------------------------*/ static uint8_t -usb2_test_quirk_by_info(const struct usb2_lookup_info *info, uint16_t quirk) +usb2_test_quirk_by_info(const struct usb_lookup_info *info, uint16_t quirk) { uint16_t x; uint16_t y; @@ -249,7 +249,7 @@ static int usb2_quirk_ioctl(unsigned long cmd, caddr_t data, int fflag, struct thread *td) { - struct usb2_gen_quirk *pgq; + struct usb_gen_quirk *pgq; struct usb2_quirk_entry *pqe; uint32_t x; uint32_t y; diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 72a406a8e333..826a090836b1 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -83,11 +83,11 @@ enum { }; struct u3g_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom[U3G_MAXPORTS]; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom[U3G_MAXPORTS]; - struct usb2_xfer *sc_xfer[U3G_MAXPORTS][U3G_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[U3G_MAXPORTS][U3G_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint8_t sc_lsr; /* local status register */ @@ -102,14 +102,14 @@ static device_detach_t u3g_detach; static usb2_callback_t u3g_write_callback; static usb2_callback_t u3g_read_callback; -static void u3g_start_read(struct usb2_com_softc *ucom); -static void u3g_stop_read(struct usb2_com_softc *ucom); -static void u3g_start_write(struct usb2_com_softc *ucom); -static void u3g_stop_write(struct usb2_com_softc *ucom); +static void u3g_start_read(struct ucom_softc *ucom); +static void u3g_stop_read(struct ucom_softc *ucom); +static void u3g_start_write(struct ucom_softc *ucom); +static void u3g_stop_write(struct ucom_softc *ucom); static int u3g_driver_loaded(struct module *mod, int what, void *arg); -static const struct usb2_config u3g_config[U3G_N_TRANSFER] = { +static const struct usb_config u3g_config[U3G_N_TRANSFER] = { [U3G_BULK_WR] = { .type = UE_BULK, @@ -130,7 +130,7 @@ static const struct usb2_config u3g_config[U3G_N_TRANSFER] = { }, }; -static const struct usb2_com_callback u3g_callback = { +static const struct ucom_callback u3g_callback = { .usb2_com_start_read = &u3g_start_read, .usb2_com_stop_read = &u3g_stop_read, .usb2_com_start_write = &u3g_start_write, @@ -156,7 +156,7 @@ DRIVER_MODULE(u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); MODULE_DEPEND(u3g, ucom, 1, 1, 1); MODULE_DEPEND(u3g, usb, 1, 1, 1); -static const struct usb2_device_id u3g_devs[] = { +static const struct usb_device_id u3g_devs[] = { #define U3G_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } /* OEM: Option */ U3G_DEV(OPTION, GT3G, 0), @@ -226,9 +226,9 @@ static const struct usb2_device_id u3g_devs[] = { }; static void -u3g_sierra_init(struct usb2_device *udev) +u3g_sierra_init(struct usb_device *udev) { - struct usb2_device_request req; + struct usb_device_request req; DPRINTFN(0, "\n"); @@ -246,9 +246,9 @@ u3g_sierra_init(struct usb2_device *udev) } static void -u3g_huawei_init(struct usb2_device *udev) +u3g_huawei_init(struct usb_device *udev) { - struct usb2_device_request req; + struct usb_device_request req; DPRINTFN(0, "\n"); @@ -266,7 +266,7 @@ u3g_huawei_init(struct usb2_device *udev) } static void -u3g_sael_m460_init(struct usb2_device *udev) +u3g_sael_m460_init(struct usb_device *udev) { static const uint8_t setup[][24] = { { 0x41, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @@ -298,7 +298,7 @@ u3g_sael_m460_init(struct usb2_device *udev) { 0x41, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }, }; - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint16_t len; uint8_t buf[0x300]; @@ -346,7 +346,7 @@ u3g_sael_m460_init(struct usb2_device *udev) } static int -u3g_lookup_huawei(struct usb2_attach_arg *uaa) +u3g_lookup_huawei(struct usb_attach_arg *uaa) { /* Calling the lookup function will also set the driver info! */ return (usb2_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)); @@ -359,11 +359,11 @@ u3g_lookup_huawei(struct usb2_attach_arg *uaa) * to a modem. */ static usb2_error_t -u3g_test_huawei_autoinst(struct usb2_device *udev, - struct usb2_attach_arg *uaa) +u3g_test_huawei_autoinst(struct usb_device *udev, + struct usb_attach_arg *uaa) { - struct usb2_interface *iface; - struct usb2_interface_descriptor *id; + struct usb_interface *iface; + struct usb_interface_descriptor *id; uint32_t flags; if (udev == NULL) { @@ -419,7 +419,7 @@ u3g_driver_loaded(struct module *mod, int what, void *arg) static int u3g_probe(device_t self) { - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -436,11 +436,11 @@ u3g_probe(device_t self) static int u3g_attach(device_t dev) { - struct usb2_config u3g_config_tmp[U3G_N_TRANSFER]; - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_config u3g_config_tmp[U3G_N_TRANSFER]; + struct usb_attach_arg *uaa = device_get_ivars(dev); struct u3g_softc *sc = device_get_softc(dev); - struct usb2_interface *iface; - struct usb2_interface_descriptor *id; + struct usb_interface *iface; + struct usb_interface_descriptor *id; uint32_t iface_valid; int error, flags, nports; int ep, n; @@ -550,7 +550,7 @@ u3g_detach(device_t dev) } static void -u3g_start_read(struct usb2_com_softc *ucom) +u3g_start_read(struct ucom_softc *ucom) { struct u3g_softc *sc = ucom->sc_parent; @@ -560,7 +560,7 @@ u3g_start_read(struct usb2_com_softc *ucom) } static void -u3g_stop_read(struct usb2_com_softc *ucom) +u3g_stop_read(struct ucom_softc *ucom) { struct u3g_softc *sc = ucom->sc_parent; @@ -570,7 +570,7 @@ u3g_stop_read(struct usb2_com_softc *ucom) } static void -u3g_start_write(struct usb2_com_softc *ucom) +u3g_start_write(struct ucom_softc *ucom) { struct u3g_softc *sc = ucom->sc_parent; @@ -579,7 +579,7 @@ u3g_start_write(struct usb2_com_softc *ucom) } static void -u3g_stop_write(struct usb2_com_softc *ucom) +u3g_stop_write(struct ucom_softc *ucom) { struct u3g_softc *sc = ucom->sc_parent; @@ -588,9 +588,9 @@ u3g_stop_write(struct usb2_com_softc *ucom) } static void -u3g_write_callback(struct usb2_xfer *xfer) +u3g_write_callback(struct usb_xfer *xfer) { - struct usb2_com_softc *ucom = xfer->priv_sc; + struct ucom_softc *ucom = xfer->priv_sc; uint32_t actlen; switch (USB_GET_STATE(xfer)) { @@ -616,9 +616,9 @@ tr_setup: } static void -u3g_read_callback(struct usb2_xfer *xfer) +u3g_read_callback(struct usb_xfer *xfer) { - struct usb2_com_softc *ucom = xfer->priv_sc; + struct ucom_softc *ucom = xfer->priv_sc; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: diff --git a/sys/dev/usb/serial/uark.c b/sys/dev/usb/serial/uark.c index 4ea6dbdfe903..5d8ffae868d6 100644 --- a/sys/dev/usb/serial/uark.c +++ b/sys/dev/usb/serial/uark.c @@ -68,11 +68,11 @@ enum { }; struct uark_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UARK_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UARK_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint8_t sc_msr; @@ -88,18 +88,18 @@ static device_detach_t uark_detach; static usb2_callback_t uark_bulk_write_callback; static usb2_callback_t uark_bulk_read_callback; -static void uark_start_read(struct usb2_com_softc *); -static void uark_stop_read(struct usb2_com_softc *); -static void uark_start_write(struct usb2_com_softc *); -static void uark_stop_write(struct usb2_com_softc *); -static int uark_pre_param(struct usb2_com_softc *, struct termios *); -static void uark_cfg_param(struct usb2_com_softc *, struct termios *); -static void uark_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void uark_start_read(struct ucom_softc *); +static void uark_stop_read(struct ucom_softc *); +static void uark_start_write(struct ucom_softc *); +static void uark_stop_write(struct ucom_softc *); +static int uark_pre_param(struct ucom_softc *, struct termios *); +static void uark_cfg_param(struct ucom_softc *, struct termios *); +static void uark_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static void uark_cfg_set_break(struct usb2_com_softc *, uint8_t); +static void uark_cfg_set_break(struct ucom_softc *, uint8_t); static void uark_cfg_write(struct uark_softc *, uint16_t, uint16_t); -static const struct usb2_config +static const struct usb_config uark_xfer_config[UARK_N_TRANSFER] = { [UARK_BULK_DT_WR] = { @@ -121,7 +121,7 @@ static const struct usb2_config }, }; -static const struct usb2_com_callback uark_callback = { +static const struct ucom_callback uark_callback = { .usb2_com_cfg_get_status = &uark_cfg_get_status, .usb2_com_cfg_set_break = &uark_cfg_set_break, .usb2_com_cfg_param = &uark_cfg_param, @@ -152,14 +152,14 @@ DRIVER_MODULE(uark, uhub, uark_driver, uark_devclass, NULL, 0); MODULE_DEPEND(uark, ucom, 1, 1, 1); MODULE_DEPEND(uark, usb, 1, 1, 1); -static const struct usb2_device_id uark_devs[] = { +static const struct usb_device_id uark_devs[] = { {USB_VPI(USB_VENDOR_ARKMICRO, USB_PRODUCT_ARKMICRO_ARK3116, 0)}, }; static int uark_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -176,7 +176,7 @@ uark_probe(device_t dev) static int uark_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uark_softc *sc = device_get_softc(dev); int32_t error; uint8_t iface_index; @@ -228,7 +228,7 @@ uark_detach(device_t dev) } static void -uark_bulk_write_callback(struct usb2_xfer *xfer) +uark_bulk_write_callback(struct usb_xfer *xfer) { struct uark_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -256,7 +256,7 @@ tr_setup: } static void -uark_bulk_read_callback(struct usb2_xfer *xfer) +uark_bulk_read_callback(struct usb_xfer *xfer) { struct uark_softc *sc = xfer->priv_sc; @@ -282,7 +282,7 @@ tr_setup: } static void -uark_start_read(struct usb2_com_softc *ucom) +uark_start_read(struct ucom_softc *ucom) { struct uark_softc *sc = ucom->sc_parent; @@ -290,7 +290,7 @@ uark_start_read(struct usb2_com_softc *ucom) } static void -uark_stop_read(struct usb2_com_softc *ucom) +uark_stop_read(struct ucom_softc *ucom) { struct uark_softc *sc = ucom->sc_parent; @@ -298,7 +298,7 @@ uark_stop_read(struct usb2_com_softc *ucom) } static void -uark_start_write(struct usb2_com_softc *ucom) +uark_start_write(struct ucom_softc *ucom) { struct uark_softc *sc = ucom->sc_parent; @@ -306,7 +306,7 @@ uark_start_write(struct usb2_com_softc *ucom) } static void -uark_stop_write(struct usb2_com_softc *ucom) +uark_stop_write(struct ucom_softc *ucom) { struct uark_softc *sc = ucom->sc_parent; @@ -314,7 +314,7 @@ uark_stop_write(struct usb2_com_softc *ucom) } static int -uark_pre_param(struct usb2_com_softc *ucom, struct termios *t) +uark_pre_param(struct ucom_softc *ucom, struct termios *t) { if ((t->c_ospeed < 300) || (t->c_ospeed > 115200)) return (EINVAL); @@ -322,7 +322,7 @@ uark_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uark_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +uark_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct uark_softc *sc = ucom->sc_parent; uint32_t speed = t->c_ospeed; @@ -372,7 +372,7 @@ uark_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uark_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +uark_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct uark_softc *sc = ucom->sc_parent; @@ -381,7 +381,7 @@ uark_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -uark_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uark_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uark_softc *sc = ucom->sc_parent; @@ -393,7 +393,7 @@ uark_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) static void uark_cfg_write(struct uark_softc *sc, uint16_t index, uint16_t value) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; req.bmRequestType = UARK_WRITE; diff --git a/sys/dev/usb/serial/ubsa.c b/sys/dev/usb/serial/ubsa.c index 78b0fd5822e9..c0c1965b0cee 100644 --- a/sys/dev/usb/serial/ubsa.c +++ b/sys/dev/usb/serial/ubsa.c @@ -148,11 +148,11 @@ enum { }; struct ubsa_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UBSA_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UBSA_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint8_t sc_iface_no; /* interface number */ @@ -170,19 +170,19 @@ static usb2_callback_t ubsa_read_callback; static usb2_callback_t ubsa_intr_callback; static void ubsa_cfg_request(struct ubsa_softc *, uint8_t, uint16_t); -static void ubsa_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void ubsa_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void ubsa_cfg_set_break(struct usb2_com_softc *, uint8_t); -static int ubsa_pre_param(struct usb2_com_softc *, struct termios *); -static void ubsa_cfg_param(struct usb2_com_softc *, struct termios *); -static void ubsa_start_read(struct usb2_com_softc *); -static void ubsa_stop_read(struct usb2_com_softc *); -static void ubsa_start_write(struct usb2_com_softc *); -static void ubsa_stop_write(struct usb2_com_softc *); -static void ubsa_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void ubsa_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void ubsa_cfg_set_rts(struct ucom_softc *, uint8_t); +static void ubsa_cfg_set_break(struct ucom_softc *, uint8_t); +static int ubsa_pre_param(struct ucom_softc *, struct termios *); +static void ubsa_cfg_param(struct ucom_softc *, struct termios *); +static void ubsa_start_read(struct ucom_softc *); +static void ubsa_stop_read(struct ucom_softc *); +static void ubsa_start_write(struct ucom_softc *); +static void ubsa_stop_write(struct ucom_softc *); +static void ubsa_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = { +static const struct usb_config ubsa_config[UBSA_N_TRANSFER] = { [UBSA_BULK_DT_WR] = { .type = UE_BULK, @@ -212,7 +212,7 @@ static const struct usb2_config ubsa_config[UBSA_N_TRANSFER] = { }, }; -static const struct usb2_com_callback ubsa_callback = { +static const struct ucom_callback ubsa_callback = { .usb2_com_cfg_get_status = &ubsa_cfg_get_status, .usb2_com_cfg_set_dtr = &ubsa_cfg_set_dtr, .usb2_com_cfg_set_rts = &ubsa_cfg_set_rts, @@ -225,7 +225,7 @@ static const struct usb2_com_callback ubsa_callback = { .usb2_com_stop_write = &ubsa_stop_write, }; -static const struct usb2_device_id ubsa_devs[] = { +static const struct usb_device_id ubsa_devs[] = { /* AnyData ADU-500A */ {USB_VPI(USB_VENDOR_ANYDATA, USB_PRODUCT_ANYDATA_ADU_500A, 0)}, /* AnyData ADU-E100A/H */ @@ -266,7 +266,7 @@ MODULE_DEPEND(ubsa, usb, 1, 1, 1); static int ubsa_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -283,7 +283,7 @@ ubsa_probe(device_t dev) static int ubsa_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ubsa_softc *sc = device_get_softc(dev); int error; @@ -339,7 +339,7 @@ ubsa_detach(device_t dev) static void ubsa_cfg_request(struct ubsa_softc *sc, uint8_t index, uint16_t value) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -358,7 +358,7 @@ ubsa_cfg_request(struct ubsa_softc *sc, uint8_t index, uint16_t value) } static void -ubsa_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +ubsa_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct ubsa_softc *sc = ucom->sc_parent; @@ -368,7 +368,7 @@ ubsa_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -ubsa_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +ubsa_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct ubsa_softc *sc = ucom->sc_parent; @@ -378,7 +378,7 @@ ubsa_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static void -ubsa_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +ubsa_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct ubsa_softc *sc = ucom->sc_parent; @@ -388,7 +388,7 @@ ubsa_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static int -ubsa_pre_param(struct usb2_com_softc *ucom, struct termios *t) +ubsa_pre_param(struct ucom_softc *ucom, struct termios *t) { struct ubsa_softc *sc = ucom->sc_parent; @@ -415,7 +415,7 @@ ubsa_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -ubsa_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +ubsa_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct ubsa_softc *sc = ucom->sc_parent; uint16_t value = 0; @@ -486,7 +486,7 @@ ubsa_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -ubsa_start_read(struct usb2_com_softc *ucom) +ubsa_start_read(struct ucom_softc *ucom) { struct ubsa_softc *sc = ucom->sc_parent; @@ -498,7 +498,7 @@ ubsa_start_read(struct usb2_com_softc *ucom) } static void -ubsa_stop_read(struct usb2_com_softc *ucom) +ubsa_stop_read(struct ucom_softc *ucom) { struct ubsa_softc *sc = ucom->sc_parent; @@ -510,7 +510,7 @@ ubsa_stop_read(struct usb2_com_softc *ucom) } static void -ubsa_start_write(struct usb2_com_softc *ucom) +ubsa_start_write(struct ucom_softc *ucom) { struct ubsa_softc *sc = ucom->sc_parent; @@ -518,7 +518,7 @@ ubsa_start_write(struct usb2_com_softc *ucom) } static void -ubsa_stop_write(struct usb2_com_softc *ucom) +ubsa_stop_write(struct ucom_softc *ucom) { struct ubsa_softc *sc = ucom->sc_parent; @@ -526,7 +526,7 @@ ubsa_stop_write(struct usb2_com_softc *ucom) } static void -ubsa_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +ubsa_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct ubsa_softc *sc = ucom->sc_parent; @@ -537,7 +537,7 @@ ubsa_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -ubsa_write_callback(struct usb2_xfer *xfer) +ubsa_write_callback(struct usb_xfer *xfer) { struct ubsa_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -566,7 +566,7 @@ tr_setup: } static void -ubsa_read_callback(struct usb2_xfer *xfer) +ubsa_read_callback(struct usb_xfer *xfer) { struct ubsa_softc *sc = xfer->priv_sc; @@ -592,7 +592,7 @@ tr_setup: } static void -ubsa_intr_callback(struct usb2_xfer *xfer) +ubsa_intr_callback(struct usb_xfer *xfer) { struct ubsa_softc *sc = xfer->priv_sc; uint8_t buf[4]; diff --git a/sys/dev/usb/serial/ubser.c b/sys/dev/usb/serial/ubser.c index 74100b481eff..b4a8d899f1f2 100644 --- a/sys/dev/usb/serial/ubser.c +++ b/sys/dev/usb/serial/ubser.c @@ -116,11 +116,11 @@ enum { }; struct ubser_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom[UBSER_UNIT_MAX]; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom[UBSER_UNIT_MAX]; - struct usb2_xfer *sc_xfer[UBSER_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UBSER_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint16_t sc_tx_size; @@ -141,16 +141,16 @@ static device_detach_t ubser_detach; static usb2_callback_t ubser_write_callback; static usb2_callback_t ubser_read_callback; -static int ubser_pre_param(struct usb2_com_softc *, struct termios *); -static void ubser_cfg_set_break(struct usb2_com_softc *, uint8_t); -static void ubser_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static int ubser_pre_param(struct ucom_softc *, struct termios *); +static void ubser_cfg_set_break(struct ucom_softc *, uint8_t); +static void ubser_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static void ubser_start_read(struct usb2_com_softc *); -static void ubser_stop_read(struct usb2_com_softc *); -static void ubser_start_write(struct usb2_com_softc *); -static void ubser_stop_write(struct usb2_com_softc *); +static void ubser_start_read(struct ucom_softc *); +static void ubser_stop_read(struct ucom_softc *); +static void ubser_start_write(struct ucom_softc *); +static void ubser_stop_write(struct ucom_softc *); -static const struct usb2_config ubser_config[UBSER_N_TRANSFER] = { +static const struct usb_config ubser_config[UBSER_N_TRANSFER] = { [UBSER_BULK_DT_WR] = { .type = UE_BULK, @@ -171,7 +171,7 @@ static const struct usb2_config ubser_config[UBSER_N_TRANSFER] = { }, }; -static const struct usb2_com_callback ubser_callback = { +static const struct ucom_callback ubser_callback = { .usb2_com_cfg_set_break = &ubser_cfg_set_break, .usb2_com_cfg_get_status = &ubser_cfg_get_status, .usb2_com_pre_param = &ubser_pre_param, @@ -203,7 +203,7 @@ MODULE_DEPEND(ubser, usb, 1, 1, 1); static int ubser_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -220,9 +220,9 @@ ubser_probe(device_t dev) static int ubser_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ubser_softc *sc = device_get_softc(dev); - struct usb2_device_request req; + struct usb_device_request req; uint8_t n; int error; @@ -309,7 +309,7 @@ ubser_detach(device_t dev) } static int -ubser_pre_param(struct usb2_com_softc *ucom, struct termios *t) +ubser_pre_param(struct ucom_softc *ucom, struct termios *t) { DPRINTF("\n"); @@ -367,7 +367,7 @@ ubser_inc_tx_unit(struct ubser_softc *sc) } static void -ubser_write_callback(struct usb2_xfer *xfer) +ubser_write_callback(struct usb_xfer *xfer) { struct ubser_softc *sc = xfer->priv_sc; uint8_t buf[1]; @@ -412,7 +412,7 @@ tr_setup: } static void -ubser_read_callback(struct usb2_xfer *xfer) +ubser_read_callback(struct usb_xfer *xfer) { struct ubser_softc *sc = xfer->priv_sc; uint8_t buf[1]; @@ -450,11 +450,11 @@ tr_setup: } static void -ubser_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +ubser_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct ubser_softc *sc = ucom->sc_parent; uint8_t x = ucom->sc_portno; - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; if (onoff) { @@ -477,7 +477,7 @@ ubser_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -ubser_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +ubser_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { /* fake status bits */ *lsr = 0; @@ -485,7 +485,7 @@ ubser_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -ubser_start_read(struct usb2_com_softc *ucom) +ubser_start_read(struct ucom_softc *ucom) { struct ubser_softc *sc = ucom->sc_parent; @@ -493,7 +493,7 @@ ubser_start_read(struct usb2_com_softc *ucom) } static void -ubser_stop_read(struct usb2_com_softc *ucom) +ubser_stop_read(struct ucom_softc *ucom) { struct ubser_softc *sc = ucom->sc_parent; @@ -501,7 +501,7 @@ ubser_stop_read(struct usb2_com_softc *ucom) } static void -ubser_start_write(struct usb2_com_softc *ucom) +ubser_start_write(struct ucom_softc *ucom) { struct ubser_softc *sc = ucom->sc_parent; @@ -509,7 +509,7 @@ ubser_start_write(struct usb2_com_softc *ucom) } static void -ubser_stop_write(struct usb2_com_softc *ucom) +ubser_stop_write(struct ucom_softc *ucom) { struct ubser_softc *sc = ucom->sc_parent; diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c index 58cf12554826..6859c6ea79e1 100644 --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -153,11 +153,11 @@ enum { }; struct uchcom_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UCHCOM_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UCHCOM_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint8_t sc_dtr; /* local copy */ @@ -192,23 +192,23 @@ static const struct uchcom_divider_record dividers[] = #define NUM_DIVIDERS (sizeof (dividers) / sizeof (dividers[0])) -static const struct usb2_device_id uchcom_devs[] = { +static const struct usb_device_id uchcom_devs[] = { {USB_VPI(USB_VENDOR_WCH, USB_PRODUCT_WCH_CH341SER, 0)}, }; /* protypes */ -static int uchcom_pre_param(struct usb2_com_softc *, struct termios *); -static void uchcom_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static int uchcom_pre_param(struct ucom_softc *, struct termios *); +static void uchcom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static void uchcom_cfg_param(struct usb2_com_softc *, struct termios *); -static void uchcom_cfg_set_break(struct usb2_com_softc *, uint8_t); -static void uchcom_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void uchcom_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void uchcom_start_read(struct usb2_com_softc *); -static void uchcom_start_write(struct usb2_com_softc *); -static void uchcom_stop_read(struct usb2_com_softc *); -static void uchcom_stop_write(struct usb2_com_softc *); +static void uchcom_cfg_param(struct ucom_softc *, struct termios *); +static void uchcom_cfg_set_break(struct ucom_softc *, uint8_t); +static void uchcom_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void uchcom_cfg_set_rts(struct ucom_softc *, uint8_t); +static void uchcom_start_read(struct ucom_softc *); +static void uchcom_start_write(struct ucom_softc *); +static void uchcom_stop_read(struct ucom_softc *); +static void uchcom_stop_write(struct ucom_softc *); static void uchcom_update_version(struct uchcom_softc *); static void uchcom_convert_status(struct uchcom_softc *, uint8_t); static void uchcom_update_status(struct uchcom_softc *); @@ -227,7 +227,7 @@ static usb2_callback_t uchcom_intr_callback; static usb2_callback_t uchcom_write_callback; static usb2_callback_t uchcom_read_callback; -static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = { +static const struct usb_config uchcom_config_data[UCHCOM_N_TRANSFER] = { [UCHCOM_BULK_DT_WR] = { .type = UE_BULK, @@ -257,7 +257,7 @@ static const struct usb2_config uchcom_config_data[UCHCOM_N_TRANSFER] = { }, }; -struct usb2_com_callback uchcom_callback = { +struct ucom_callback uchcom_callback = { .usb2_com_cfg_get_status = &uchcom_cfg_get_status, .usb2_com_cfg_set_dtr = &uchcom_cfg_set_dtr, .usb2_com_cfg_set_rts = &uchcom_cfg_set_rts, @@ -277,7 +277,7 @@ struct usb2_com_callback uchcom_callback = { static int uchcom_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); DPRINTFN(11, "\n"); @@ -297,7 +297,7 @@ static int uchcom_attach(device_t dev) { struct uchcom_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); int error; uint8_t iface_index; @@ -379,7 +379,7 @@ static void uchcom_ctrl_write(struct uchcom_softc *sc, uint8_t reqno, uint16_t value, uint16_t index) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = reqno; @@ -395,7 +395,7 @@ static void uchcom_ctrl_read(struct uchcom_softc *sc, uint8_t reqno, uint16_t value, uint16_t index, void *buf, uint16_t buflen) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = reqno; @@ -517,7 +517,7 @@ uchcom_set_dtrrts(struct uchcom_softc *sc) } static void -uchcom_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uchcom_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uchcom_softc *sc = ucom->sc_parent; uint8_t brk1; @@ -667,7 +667,7 @@ uchcom_reset_chip(struct uchcom_softc *sc) * methods for ucom */ static void -uchcom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +uchcom_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct uchcom_softc *sc = ucom->sc_parent; @@ -678,7 +678,7 @@ uchcom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -uchcom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +uchcom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct uchcom_softc *sc = ucom->sc_parent; @@ -689,7 +689,7 @@ uchcom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uchcom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +uchcom_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct uchcom_softc *sc = ucom->sc_parent; @@ -700,7 +700,7 @@ uchcom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static int -uchcom_pre_param(struct usb2_com_softc *ucom, struct termios *t) +uchcom_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uchcom_divider dv; @@ -720,7 +720,7 @@ uchcom_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uchcom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +uchcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct uchcom_softc *sc = ucom->sc_parent; @@ -729,7 +729,7 @@ uchcom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uchcom_start_read(struct usb2_com_softc *ucom) +uchcom_start_read(struct ucom_softc *ucom) { struct uchcom_softc *sc = ucom->sc_parent; @@ -741,7 +741,7 @@ uchcom_start_read(struct usb2_com_softc *ucom) } static void -uchcom_stop_read(struct usb2_com_softc *ucom) +uchcom_stop_read(struct ucom_softc *ucom) { struct uchcom_softc *sc = ucom->sc_parent; @@ -753,7 +753,7 @@ uchcom_stop_read(struct usb2_com_softc *ucom) } static void -uchcom_start_write(struct usb2_com_softc *ucom) +uchcom_start_write(struct ucom_softc *ucom) { struct uchcom_softc *sc = ucom->sc_parent; @@ -761,7 +761,7 @@ uchcom_start_write(struct usb2_com_softc *ucom) } static void -uchcom_stop_write(struct usb2_com_softc *ucom) +uchcom_stop_write(struct ucom_softc *ucom) { struct uchcom_softc *sc = ucom->sc_parent; @@ -772,7 +772,7 @@ uchcom_stop_write(struct usb2_com_softc *ucom) * callback when the modem status is changed. */ static void -uchcom_intr_callback(struct usb2_xfer *xfer) +uchcom_intr_callback(struct usb_xfer *xfer) { struct uchcom_softc *sc = xfer->priv_sc; uint8_t buf[UCHCOM_INTR_LEAST]; @@ -810,7 +810,7 @@ tr_setup: } static void -uchcom_write_callback(struct usb2_xfer *xfer) +uchcom_write_callback(struct usb_xfer *xfer) { struct uchcom_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -841,7 +841,7 @@ tr_setup: } static void -uchcom_read_callback(struct usb2_xfer *xfer) +uchcom_read_callback(struct usb_xfer *xfer) { struct uchcom_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/serial/ucycom.c b/sys/dev/usb/serial/ucycom.c index 28ebbb8cfc9f..5302673bc55d 100644 --- a/sys/dev/usb/serial/ucycom.c +++ b/sys/dev/usb/serial/ucycom.c @@ -66,11 +66,11 @@ enum { }; struct ucycom_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_xfer[UCYCOM_N_TRANSFER]; + struct usb_device *sc_udev; + struct usb_xfer *sc_xfer[UCYCOM_N_TRANSFER]; struct mtx sc_mtx; uint32_t sc_model; @@ -105,22 +105,22 @@ static device_detach_t ucycom_detach; static usb2_callback_t ucycom_ctrl_write_callback; static usb2_callback_t ucycom_intr_read_callback; -static void ucycom_cfg_open(struct usb2_com_softc *); -static void ucycom_start_read(struct usb2_com_softc *); -static void ucycom_stop_read(struct usb2_com_softc *); -static void ucycom_start_write(struct usb2_com_softc *); -static void ucycom_stop_write(struct usb2_com_softc *); +static void ucycom_cfg_open(struct ucom_softc *); +static void ucycom_start_read(struct ucom_softc *); +static void ucycom_stop_read(struct ucom_softc *); +static void ucycom_start_write(struct ucom_softc *); +static void ucycom_stop_write(struct ucom_softc *); static void ucycom_cfg_write(struct ucycom_softc *, uint32_t, uint8_t); -static int ucycom_pre_param(struct usb2_com_softc *, struct termios *); -static void ucycom_cfg_param(struct usb2_com_softc *, struct termios *); +static int ucycom_pre_param(struct ucom_softc *, struct termios *); +static void ucycom_cfg_param(struct ucom_softc *, struct termios *); -static const struct usb2_config ucycom_config[UCYCOM_N_TRANSFER] = { +static const struct usb_config ucycom_config[UCYCOM_N_TRANSFER] = { [UCYCOM_CTRL_RD] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = (sizeof(struct usb2_device_request) + UCYCOM_MAX_IOLEN), + .bufsize = (sizeof(struct usb_device_request) + UCYCOM_MAX_IOLEN), .callback = &ucycom_ctrl_write_callback, .timeout = 1000, /* 1 second */ }, @@ -135,7 +135,7 @@ static const struct usb2_config ucycom_config[UCYCOM_N_TRANSFER] = { }, }; -static const struct usb2_com_callback ucycom_callback = { +static const struct ucom_callback ucycom_callback = { .usb2_com_cfg_param = &ucycom_cfg_param, .usb2_com_cfg_open = &ucycom_cfg_open, .usb2_com_pre_param = &ucycom_pre_param, @@ -167,7 +167,7 @@ MODULE_DEPEND(ucycom, usb, 1, 1, 1); /* * Supported devices */ -static const struct usb2_device_id ucycom_devs[] = { +static const struct usb_device_id ucycom_devs[] = { {USB_VPI(USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE, MODEL_CY7C64013)}, }; @@ -177,7 +177,7 @@ static const struct usb2_device_id ucycom_devs[] = { static int ucycom_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -194,7 +194,7 @@ ucycom_probe(device_t dev) static int ucycom_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ucycom_softc *sc = device_get_softc(dev); void *urd_ptr = NULL; int32_t error; @@ -288,7 +288,7 @@ ucycom_detach(device_t dev) } static void -ucycom_cfg_open(struct usb2_com_softc *ucom) +ucycom_cfg_open(struct ucom_softc *ucom) { struct ucycom_softc *sc = ucom->sc_parent; @@ -297,7 +297,7 @@ ucycom_cfg_open(struct usb2_com_softc *ucom) } static void -ucycom_start_read(struct usb2_com_softc *ucom) +ucycom_start_read(struct ucom_softc *ucom) { struct ucycom_softc *sc = ucom->sc_parent; @@ -305,7 +305,7 @@ ucycom_start_read(struct usb2_com_softc *ucom) } static void -ucycom_stop_read(struct usb2_com_softc *ucom) +ucycom_stop_read(struct ucom_softc *ucom) { struct ucycom_softc *sc = ucom->sc_parent; @@ -313,7 +313,7 @@ ucycom_stop_read(struct usb2_com_softc *ucom) } static void -ucycom_start_write(struct usb2_com_softc *ucom) +ucycom_start_write(struct ucom_softc *ucom) { struct ucycom_softc *sc = ucom->sc_parent; @@ -321,7 +321,7 @@ ucycom_start_write(struct usb2_com_softc *ucom) } static void -ucycom_stop_write(struct usb2_com_softc *ucom) +ucycom_stop_write(struct ucom_softc *ucom) { struct ucycom_softc *sc = ucom->sc_parent; @@ -329,10 +329,10 @@ ucycom_stop_write(struct usb2_com_softc *ucom) } static void -ucycom_ctrl_write_callback(struct usb2_xfer *xfer) +ucycom_ctrl_write_callback(struct usb_xfer *xfer) { struct ucycom_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; uint8_t data[2]; uint8_t offset; uint32_t actlen; @@ -399,7 +399,7 @@ tr_transferred: static void ucycom_cfg_write(struct ucycom_softc *sc, uint32_t baud, uint8_t cfg) { - struct usb2_device_request req; + struct usb_device_request req; uint16_t len; usb2_error_t err; @@ -431,7 +431,7 @@ ucycom_cfg_write(struct ucycom_softc *sc, uint32_t baud, uint8_t cfg) } static int -ucycom_pre_param(struct usb2_com_softc *ucom, struct termios *t) +ucycom_pre_param(struct ucom_softc *ucom, struct termios *t) { switch (t->c_ospeed) { case 600: @@ -459,7 +459,7 @@ ucycom_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -ucycom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +ucycom_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct ucycom_softc *sc = ucom->sc_parent; uint8_t cfg; @@ -494,7 +494,7 @@ ucycom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -ucycom_intr_read_callback(struct usb2_xfer *xfer) +ucycom_intr_read_callback(struct usb_xfer *xfer) { struct ucycom_softc *sc = xfer->priv_sc; uint8_t buf[2]; diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c index fb27061b554e..6bf2934decc6 100644 --- a/sys/dev/usb/serial/ufoma.c +++ b/sys/dev/usb/serial/ufoma.c @@ -157,16 +157,16 @@ enum { }; struct ufoma_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; struct cv sc_cv; struct mtx sc_mtx; - struct usb2_xfer *sc_ctrl_xfer[UFOMA_CTRL_ENDPT_MAX]; - struct usb2_xfer *sc_bulk_xfer[UFOMA_BULK_ENDPT_MAX]; + struct usb_xfer *sc_ctrl_xfer[UFOMA_CTRL_ENDPT_MAX]; + struct usb_xfer *sc_bulk_xfer[UFOMA_BULK_ENDPT_MAX]; uint8_t *sc_modetable; device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; uint32_t sc_unit; @@ -199,25 +199,25 @@ static usb2_callback_t ufoma_intr_callback; static usb2_callback_t ufoma_bulk_write_callback; static usb2_callback_t ufoma_bulk_read_callback; -static void *ufoma_get_intconf(struct usb2_config_descriptor *, - struct usb2_interface_descriptor *, uint8_t, uint8_t); +static void *ufoma_get_intconf(struct usb_config_descriptor *, + struct usb_interface_descriptor *, uint8_t, uint8_t); static void ufoma_cfg_link_state(struct ufoma_softc *); static void ufoma_cfg_activate_state(struct ufoma_softc *, uint16_t); -static void ufoma_cfg_open(struct usb2_com_softc *); -static void ufoma_cfg_close(struct usb2_com_softc *); -static void ufoma_cfg_set_break(struct usb2_com_softc *, uint8_t); -static void ufoma_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void ufoma_cfg_open(struct ucom_softc *); +static void ufoma_cfg_close(struct ucom_softc *); +static void ufoma_cfg_set_break(struct ucom_softc *, uint8_t); +static void ufoma_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static void ufoma_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void ufoma_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static int ufoma_pre_param(struct usb2_com_softc *, struct termios *); -static void ufoma_cfg_param(struct usb2_com_softc *, struct termios *); +static void ufoma_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void ufoma_cfg_set_rts(struct ucom_softc *, uint8_t); +static int ufoma_pre_param(struct ucom_softc *, struct termios *); +static void ufoma_cfg_param(struct ucom_softc *, struct termios *); static int ufoma_modem_setup(device_t, struct ufoma_softc *, - struct usb2_attach_arg *); -static void ufoma_start_read(struct usb2_com_softc *); -static void ufoma_stop_read(struct usb2_com_softc *); -static void ufoma_start_write(struct usb2_com_softc *); -static void ufoma_stop_write(struct usb2_com_softc *); + struct usb_attach_arg *); +static void ufoma_start_read(struct ucom_softc *); +static void ufoma_stop_read(struct ucom_softc *); +static void ufoma_start_write(struct ucom_softc *); +static void ufoma_stop_write(struct ucom_softc *); /*sysctl stuff*/ static int ufoma_sysctl_support(SYSCTL_HANDLER_ARGS); @@ -225,7 +225,7 @@ static int ufoma_sysctl_current(SYSCTL_HANDLER_ARGS); static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS); -static const struct usb2_config +static const struct usb_config ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = { [UFOMA_CTRL_ENDPT_INTR] = { @@ -233,7 +233,7 @@ static const struct usb2_config .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .bufsize = sizeof(struct usb2_cdc_notification), + .bufsize = sizeof(struct usb_cdc_notification), .callback = &ufoma_intr_callback, }, @@ -241,7 +241,7 @@ static const struct usb2_config .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = (sizeof(struct usb2_device_request) + UFOMA_CMD_BUF_SIZE), + .bufsize = (sizeof(struct usb_device_request) + UFOMA_CMD_BUF_SIZE), .flags = {.short_xfer_ok = 1,}, .callback = &ufoma_ctrl_read_callback, .timeout = 1000, /* 1 second */ @@ -251,13 +251,13 @@ static const struct usb2_config .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = (sizeof(struct usb2_device_request) + 1), + .bufsize = (sizeof(struct usb_device_request) + 1), .callback = &ufoma_ctrl_write_callback, .timeout = 1000, /* 1 second */ }, }; -static const struct usb2_config +static const struct usb_config ufoma_bulk_config[UFOMA_BULK_ENDPT_MAX] = { [UFOMA_BULK_ENDPT_WRITE] = { @@ -279,7 +279,7 @@ static const struct usb2_config }, }; -static const struct usb2_com_callback ufoma_callback = { +static const struct ucom_callback ufoma_callback = { .usb2_com_cfg_get_status = &ufoma_cfg_get_status, .usb2_com_cfg_set_dtr = &ufoma_cfg_set_dtr, .usb2_com_cfg_set_rts = &ufoma_cfg_set_rts, @@ -317,9 +317,9 @@ MODULE_DEPEND(ufoma, usb, 1, 1, 1); static int ufoma_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface_descriptor *id; - struct usb2_config_descriptor *cd; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface_descriptor *id; + struct usb_config_descriptor *cd; usb2_mcpc_acm_descriptor *mad; if (uaa->usb_mode != USB_MODE_HOST) { @@ -350,10 +350,10 @@ ufoma_probe(device_t dev) static int ufoma_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ufoma_softc *sc = device_get_softc(dev); - struct usb2_config_descriptor *cd; - struct usb2_interface_descriptor *id; + struct usb_config_descriptor *cd; + struct usb_interface_descriptor *id; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; @@ -481,10 +481,10 @@ ufoma_detach(device_t dev) } static void * -ufoma_get_intconf(struct usb2_config_descriptor *cd, struct usb2_interface_descriptor *id, +ufoma_get_intconf(struct usb_config_descriptor *cd, struct usb_interface_descriptor *id, uint8_t type, uint8_t subtype) { - struct usb2_descriptor *desc = (void *)id; + struct usb_descriptor *desc = (void *)id; while ((desc = usb2_desc_foreach(cd, desc))) { @@ -502,7 +502,7 @@ ufoma_get_intconf(struct usb2_config_descriptor *cd, struct usb2_interface_descr static void ufoma_cfg_link_state(struct ufoma_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; int32_t error; req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; @@ -524,7 +524,7 @@ ufoma_cfg_link_state(struct ufoma_softc *sc) static void ufoma_cfg_activate_state(struct ufoma_softc *sc, uint16_t state) { - struct usb2_device_request req; + struct usb_device_request req; int32_t error; req.bmRequestType = UT_WRITE_VENDOR_INTERFACE; @@ -544,10 +544,10 @@ ufoma_cfg_activate_state(struct ufoma_softc *sc, uint16_t state) } static void -ufoma_ctrl_read_callback(struct usb2_xfer *xfer) +ufoma_ctrl_read_callback(struct usb_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -594,10 +594,10 @@ tr_setup: } static void -ufoma_ctrl_write_callback(struct usb2_xfer *xfer) +ufoma_ctrl_write_callback(struct usb_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; uint32_t actlen; switch (USB_GET_STATE(xfer)) { @@ -639,10 +639,10 @@ tr_setup: } static void -ufoma_intr_callback(struct usb2_xfer *xfer) +ufoma_intr_callback(struct usb_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_cdc_notification pkt; + struct usb_cdc_notification pkt; uint16_t wLen; uint16_t temp; uint8_t mstatus; @@ -745,7 +745,7 @@ tr_setup: } static void -ufoma_bulk_write_callback(struct usb2_xfer *xfer) +ufoma_bulk_write_callback(struct usb_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -772,7 +772,7 @@ tr_setup: } static void -ufoma_bulk_read_callback(struct usb2_xfer *xfer) +ufoma_bulk_read_callback(struct usb_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; @@ -798,7 +798,7 @@ tr_setup: } static void -ufoma_cfg_open(struct usb2_com_softc *ucom) +ufoma_cfg_open(struct ucom_softc *ucom) { struct ufoma_softc *sc = ucom->sc_parent; @@ -816,7 +816,7 @@ ufoma_cfg_open(struct usb2_com_softc *ucom) } static void -ufoma_cfg_close(struct usb2_com_softc *ucom) +ufoma_cfg_close(struct ucom_softc *ucom) { struct ufoma_softc *sc = ucom->sc_parent; @@ -824,10 +824,10 @@ ufoma_cfg_close(struct usb2_com_softc *ucom) } static void -ufoma_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +ufoma_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct ufoma_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t wValue; if (sc->sc_nobulk || @@ -851,7 +851,7 @@ ufoma_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -ufoma_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +ufoma_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct ufoma_softc *sc = ucom->sc_parent; @@ -862,7 +862,7 @@ ufoma_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) static void ufoma_cfg_set_line_state(struct ufoma_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; /* Don't send line state emulation request for OBEX port */ if (sc->sc_currentmode == UMCPC_ACM_MODE_OBEX) { @@ -880,7 +880,7 @@ ufoma_cfg_set_line_state(struct ufoma_softc *sc) } static void -ufoma_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +ufoma_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct ufoma_softc *sc = ucom->sc_parent; @@ -896,7 +896,7 @@ ufoma_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -ufoma_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +ufoma_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct ufoma_softc *sc = ucom->sc_parent; @@ -912,17 +912,17 @@ ufoma_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static int -ufoma_pre_param(struct usb2_com_softc *ucom, struct termios *t) +ufoma_pre_param(struct ucom_softc *ucom, struct termios *t) { return (0); /* we accept anything */ } static void -ufoma_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +ufoma_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct ufoma_softc *sc = ucom->sc_parent; - struct usb2_device_request req; - struct usb2_cdc_line_state ls; + struct usb_device_request req; + struct usb_cdc_line_state ls; if (sc->sc_nobulk || (sc->sc_currentmode == UMCPC_ACM_MODE_OBEX)) { @@ -978,13 +978,13 @@ ufoma_cfg_param(struct usb2_com_softc *ucom, struct termios *t) static int ufoma_modem_setup(device_t dev, struct ufoma_softc *sc, - struct usb2_attach_arg *uaa) + struct usb_attach_arg *uaa) { - struct usb2_config_descriptor *cd; - struct usb2_cdc_acm_descriptor *acm; - struct usb2_cdc_cm_descriptor *cmd; - struct usb2_interface_descriptor *id; - struct usb2_interface *iface; + struct usb_config_descriptor *cd; + struct usb_cdc_acm_descriptor *acm; + struct usb_cdc_cm_descriptor *cmd; + struct usb_interface_descriptor *id; + struct usb_interface *iface; uint8_t i; int32_t error; @@ -1048,7 +1048,7 @@ ufoma_modem_setup(device_t dev, struct ufoma_softc *sc, } static void -ufoma_start_read(struct usb2_com_softc *ucom) +ufoma_start_read(struct ucom_softc *ucom) { struct ufoma_softc *sc = ucom->sc_parent; @@ -1064,7 +1064,7 @@ ufoma_start_read(struct usb2_com_softc *ucom) } static void -ufoma_stop_read(struct usb2_com_softc *ucom) +ufoma_stop_read(struct ucom_softc *ucom) { struct ufoma_softc *sc = ucom->sc_parent; @@ -1080,7 +1080,7 @@ ufoma_stop_read(struct usb2_com_softc *ucom) } static void -ufoma_start_write(struct usb2_com_softc *ucom) +ufoma_start_write(struct ucom_softc *ucom) { struct ufoma_softc *sc = ucom->sc_parent; @@ -1092,7 +1092,7 @@ ufoma_start_write(struct usb2_com_softc *ucom) } static void -ufoma_stop_write(struct usb2_com_softc *ucom) +ufoma_stop_write(struct ucom_softc *ucom) { struct ufoma_softc *sc = ucom->sc_parent; diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index f79922fc075a..f409a6bae0c9 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -90,11 +90,11 @@ enum { }; struct uftdi_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_xfer[UFTDI_N_TRANSFER]; + struct usb_device *sc_udev; + struct usb_xfer *sc_xfer[UFTDI_N_TRANSFER]; device_t sc_dev; struct mtx sc_mtx; @@ -128,23 +128,23 @@ static device_detach_t uftdi_detach; static usb2_callback_t uftdi_write_callback; static usb2_callback_t uftdi_read_callback; -static void uftdi_cfg_open(struct usb2_com_softc *); -static void uftdi_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void uftdi_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void uftdi_cfg_set_break(struct usb2_com_softc *, uint8_t); +static void uftdi_cfg_open(struct ucom_softc *); +static void uftdi_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void uftdi_cfg_set_rts(struct ucom_softc *, uint8_t); +static void uftdi_cfg_set_break(struct ucom_softc *, uint8_t); static int uftdi_set_parm_soft(struct termios *, struct uftdi_param_config *, uint8_t); -static int uftdi_pre_param(struct usb2_com_softc *, struct termios *); -static void uftdi_cfg_param(struct usb2_com_softc *, struct termios *); -static void uftdi_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static int uftdi_pre_param(struct ucom_softc *, struct termios *); +static void uftdi_cfg_param(struct ucom_softc *, struct termios *); +static void uftdi_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static void uftdi_start_read(struct usb2_com_softc *); -static void uftdi_stop_read(struct usb2_com_softc *); -static void uftdi_start_write(struct usb2_com_softc *); -static void uftdi_stop_write(struct usb2_com_softc *); +static void uftdi_start_read(struct ucom_softc *); +static void uftdi_stop_read(struct ucom_softc *); +static void uftdi_start_write(struct ucom_softc *); +static void uftdi_stop_write(struct ucom_softc *); static uint8_t uftdi_8u232am_getrate(uint32_t, uint16_t *); -static const struct usb2_config uftdi_config[UFTDI_N_TRANSFER] = { +static const struct usb_config uftdi_config[UFTDI_N_TRANSFER] = { [UFTDI_BULK_DT_WR] = { .type = UE_BULK, @@ -165,7 +165,7 @@ static const struct usb2_config uftdi_config[UFTDI_N_TRANSFER] = { }, }; -static const struct usb2_com_callback uftdi_callback = { +static const struct ucom_callback uftdi_callback = { .usb2_com_cfg_get_status = &uftdi_cfg_get_status, .usb2_com_cfg_set_dtr = &uftdi_cfg_set_dtr, .usb2_com_cfg_set_rts = &uftdi_cfg_set_rts, @@ -200,7 +200,7 @@ DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); -static struct usb2_device_id uftdi_devs[] = { +static struct usb_device_id uftdi_devs[] = { {USB_VPI(USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_STK541, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_WIRELESSHANDHELDTERMINAL, UFTDI_TYPE_8U232AM)}, @@ -238,7 +238,7 @@ static struct usb2_device_id uftdi_devs[] = { static int uftdi_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -254,7 +254,7 @@ uftdi_probe(device_t dev) static int uftdi_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uftdi_softc *sc = device_get_softc(dev); int error; @@ -332,11 +332,11 @@ uftdi_detach(device_t dev) } static void -uftdi_cfg_open(struct usb2_com_softc *ucom) +uftdi_cfg_open(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; uint16_t wIndex = ucom->sc_portno; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF(""); @@ -368,7 +368,7 @@ uftdi_cfg_open(struct usb2_com_softc *ucom) } static void -uftdi_write_callback(struct usb2_xfer *xfer) +uftdi_write_callback(struct usb_xfer *xfer) { struct uftdi_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -403,7 +403,7 @@ tr_setup: } static void -uftdi_read_callback(struct usb2_xfer *xfer) +uftdi_read_callback(struct usb_xfer *xfer) { struct uftdi_softc *sc = xfer->priv_sc; uint8_t buf[2]; @@ -466,12 +466,12 @@ tr_setup: } static void -uftdi_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +uftdi_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct uftdi_softc *sc = ucom->sc_parent; uint16_t wIndex = ucom->sc_portno; uint16_t wValue; - struct usb2_device_request req; + struct usb_device_request req; wValue = onoff ? FTDI_SIO_SET_DTR_HIGH : FTDI_SIO_SET_DTR_LOW; @@ -485,12 +485,12 @@ uftdi_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uftdi_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +uftdi_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct uftdi_softc *sc = ucom->sc_parent; uint16_t wIndex = ucom->sc_portno; uint16_t wValue; - struct usb2_device_request req; + struct usb_device_request req; wValue = onoff ? FTDI_SIO_SET_RTS_HIGH : FTDI_SIO_SET_RTS_LOW; @@ -504,12 +504,12 @@ uftdi_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uftdi_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uftdi_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uftdi_softc *sc = ucom->sc_parent; uint16_t wIndex = ucom->sc_portno; uint16_t wValue; - struct usb2_device_request req; + struct usb_device_request req; if (onoff) { sc->sc_last_lcr |= FTDI_SIO_SET_BREAK; @@ -626,7 +626,7 @@ uftdi_set_parm_soft(struct termios *t, } static int -uftdi_pre_param(struct usb2_com_softc *ucom, struct termios *t) +uftdi_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uftdi_softc *sc = ucom->sc_parent; struct uftdi_param_config cfg; @@ -637,12 +637,12 @@ uftdi_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uftdi_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +uftdi_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct uftdi_softc *sc = ucom->sc_parent; uint16_t wIndex = ucom->sc_portno; struct uftdi_param_config cfg; - struct usb2_device_request req; + struct usb_device_request req; if (uftdi_set_parm_soft(t, &cfg, sc->sc_type)) { /* should not happen */ @@ -678,7 +678,7 @@ uftdi_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uftdi_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +uftdi_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct uftdi_softc *sc = ucom->sc_parent; @@ -690,7 +690,7 @@ uftdi_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -uftdi_start_read(struct usb2_com_softc *ucom) +uftdi_start_read(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; @@ -698,7 +698,7 @@ uftdi_start_read(struct usb2_com_softc *ucom) } static void -uftdi_stop_read(struct usb2_com_softc *ucom) +uftdi_stop_read(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; @@ -706,7 +706,7 @@ uftdi_stop_read(struct usb2_com_softc *ucom) } static void -uftdi_start_write(struct usb2_com_softc *ucom) +uftdi_start_write(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; @@ -714,7 +714,7 @@ uftdi_start_write(struct usb2_com_softc *ucom) } static void -uftdi_stop_write(struct usb2_com_softc *ucom) +uftdi_stop_write(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; diff --git a/sys/dev/usb/serial/ugensa.c b/sys/dev/usb/serial/ugensa.c index 483a2dc2ac43..ecff81b70a12 100644 --- a/sys/dev/usb/serial/ugensa.c +++ b/sys/dev/usb/serial/ugensa.c @@ -72,13 +72,13 @@ enum { }; struct ugensa_sub_softc { - struct usb2_com_softc *sc_usb2_com_ptr; - struct usb2_xfer *sc_xfer[UGENSA_N_TRANSFER]; + struct ucom_softc *sc_usb2_com_ptr; + struct usb_xfer *sc_xfer[UGENSA_N_TRANSFER]; }; struct ugensa_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom[UGENSA_IFACE_MAX]; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom[UGENSA_IFACE_MAX]; struct ugensa_sub_softc sc_sub[UGENSA_IFACE_MAX]; struct mtx sc_mtx; @@ -94,12 +94,12 @@ static device_detach_t ugensa_detach; static usb2_callback_t ugensa_bulk_write_callback; static usb2_callback_t ugensa_bulk_read_callback; -static void ugensa_start_read(struct usb2_com_softc *); -static void ugensa_stop_read(struct usb2_com_softc *); -static void ugensa_start_write(struct usb2_com_softc *); -static void ugensa_stop_write(struct usb2_com_softc *); +static void ugensa_start_read(struct ucom_softc *); +static void ugensa_stop_read(struct ucom_softc *); +static void ugensa_start_write(struct ucom_softc *); +static void ugensa_stop_write(struct ucom_softc *); -static const struct usb2_config +static const struct usb_config ugensa_xfer_config[UGENSA_N_TRANSFER] = { [UGENSA_BULK_DT_WR] = { @@ -121,7 +121,7 @@ static const struct usb2_config }, }; -static const struct usb2_com_callback ugensa_callback = { +static const struct ucom_callback ugensa_callback = { .usb2_com_start_read = &ugensa_start_read, .usb2_com_stop_read = &ugensa_stop_read, .usb2_com_start_write = &ugensa_start_write, @@ -148,7 +148,7 @@ DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); MODULE_DEPEND(ugensa, ucom, 1, 1, 1); MODULE_DEPEND(ugensa, usb, 1, 1, 1); -static const struct usb2_device_id ugensa_devs[] = { +static const struct usb_device_id ugensa_devs[] = { {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 0)}, {USB_VPI(USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CDMA_MODEM1, 0)}, {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 0)}, @@ -159,7 +159,7 @@ static const struct usb2_device_id ugensa_devs[] = { static int ugensa_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -176,10 +176,10 @@ ugensa_probe(device_t dev) static int ugensa_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ugensa_softc *sc = device_get_softc(dev); struct ugensa_sub_softc *ssc; - struct usb2_interface *iface; + struct usb_interface *iface; int32_t error; uint8_t iface_index; int x, cnt; @@ -264,7 +264,7 @@ ugensa_detach(device_t dev) } static void -ugensa_bulk_write_callback(struct usb2_xfer *xfer) +ugensa_bulk_write_callback(struct usb_xfer *xfer) { struct ugensa_sub_softc *ssc = xfer->priv_sc; uint32_t actlen; @@ -291,7 +291,7 @@ tr_setup: } static void -ugensa_bulk_read_callback(struct usb2_xfer *xfer) +ugensa_bulk_read_callback(struct usb_xfer *xfer) { struct ugensa_sub_softc *ssc = xfer->priv_sc; @@ -317,7 +317,7 @@ tr_setup: } static void -ugensa_start_read(struct usb2_com_softc *ucom) +ugensa_start_read(struct ucom_softc *ucom) { struct ugensa_softc *sc = ucom->sc_parent; struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; @@ -326,7 +326,7 @@ ugensa_start_read(struct usb2_com_softc *ucom) } static void -ugensa_stop_read(struct usb2_com_softc *ucom) +ugensa_stop_read(struct ucom_softc *ucom) { struct ugensa_softc *sc = ucom->sc_parent; struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; @@ -335,7 +335,7 @@ ugensa_stop_read(struct usb2_com_softc *ucom) } static void -ugensa_start_write(struct usb2_com_softc *ucom) +ugensa_start_write(struct ucom_softc *ucom) { struct ugensa_softc *sc = ucom->sc_parent; struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; @@ -344,7 +344,7 @@ ugensa_start_write(struct usb2_com_softc *ucom) } static void -ugensa_stop_write(struct usb2_com_softc *ucom) +ugensa_stop_write(struct ucom_softc *ucom) { struct ugensa_softc *sc = ucom->sc_parent; struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno; diff --git a/sys/dev/usb/serial/uipaq.c b/sys/dev/usb/serial/uipaq.c index 97480475a5b6..600a916314a1 100644 --- a/sys/dev/usb/serial/uipaq.c +++ b/sys/dev/usb/serial/uipaq.c @@ -81,11 +81,11 @@ enum { }; struct uipaq_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UIPAQ_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UIPAQ_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint16_t sc_line; @@ -101,15 +101,15 @@ static device_detach_t uipaq_detach; static usb2_callback_t uipaq_write_callback; static usb2_callback_t uipaq_read_callback; -static void uipaq_start_read(struct usb2_com_softc *); -static void uipaq_stop_read(struct usb2_com_softc *); -static void uipaq_start_write(struct usb2_com_softc *); -static void uipaq_stop_write(struct usb2_com_softc *); -static void uipaq_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void uipaq_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void uipaq_cfg_set_break(struct usb2_com_softc *, uint8_t); +static void uipaq_start_read(struct ucom_softc *); +static void uipaq_stop_read(struct ucom_softc *); +static void uipaq_start_write(struct ucom_softc *); +static void uipaq_stop_write(struct ucom_softc *); +static void uipaq_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void uipaq_cfg_set_rts(struct ucom_softc *, uint8_t); +static void uipaq_cfg_set_break(struct ucom_softc *, uint8_t); -static const struct usb2_config uipaq_config_data[UIPAQ_N_TRANSFER] = { +static const struct usb_config uipaq_config_data[UIPAQ_N_TRANSFER] = { [UIPAQ_BULK_DT_WR] = { .type = UE_BULK, @@ -130,7 +130,7 @@ static const struct usb2_config uipaq_config_data[UIPAQ_N_TRANSFER] = { }, }; -static const struct usb2_com_callback uipaq_callback = { +static const struct ucom_callback uipaq_callback = { .usb2_com_cfg_set_dtr = &uipaq_cfg_set_dtr, .usb2_com_cfg_set_rts = &uipaq_cfg_set_rts, .usb2_com_cfg_set_break = &uipaq_cfg_set_break, @@ -145,7 +145,7 @@ static const struct usb2_com_callback uipaq_callback = { * support the same hardware. Numeric values are used where no usbdevs * entries exist. */ -static const struct usb2_device_id uipaq_devs[] = { +static const struct usb_device_id uipaq_devs[] = { /* Socket USB Sync */ {USB_VPI(0x0104, 0x00be, 0)}, /* USB Sync 0301 */ @@ -1078,7 +1078,7 @@ MODULE_DEPEND(uipaq, usb, 1, 1, 1); static int uipaq_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -1095,8 +1095,8 @@ uipaq_probe(device_t dev) static int uipaq_attach(device_t dev) { - struct usb2_device_request req; - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_device_request req; + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uipaq_softc *sc = device_get_softc(dev); int error; uint8_t iface_index; @@ -1165,7 +1165,7 @@ uipaq_detach(device_t dev) } static void -uipaq_start_read(struct usb2_com_softc *ucom) +uipaq_start_read(struct ucom_softc *ucom) { struct uipaq_softc *sc = ucom->sc_parent; @@ -1174,7 +1174,7 @@ uipaq_start_read(struct usb2_com_softc *ucom) } static void -uipaq_stop_read(struct usb2_com_softc *ucom) +uipaq_stop_read(struct ucom_softc *ucom) { struct uipaq_softc *sc = ucom->sc_parent; @@ -1183,7 +1183,7 @@ uipaq_stop_read(struct usb2_com_softc *ucom) } static void -uipaq_start_write(struct usb2_com_softc *ucom) +uipaq_start_write(struct ucom_softc *ucom) { struct uipaq_softc *sc = ucom->sc_parent; @@ -1191,7 +1191,7 @@ uipaq_start_write(struct usb2_com_softc *ucom) } static void -uipaq_stop_write(struct usb2_com_softc *ucom) +uipaq_stop_write(struct ucom_softc *ucom) { struct uipaq_softc *sc = ucom->sc_parent; @@ -1199,10 +1199,10 @@ uipaq_stop_write(struct usb2_com_softc *ucom) } static void -uipaq_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +uipaq_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct uipaq_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("onoff=%d\n", onoff); @@ -1223,10 +1223,10 @@ uipaq_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uipaq_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +uipaq_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct uipaq_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("onoff=%d\n", onoff); @@ -1247,10 +1247,10 @@ uipaq_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uipaq_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uipaq_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uipaq_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t temp; temp = onoff ? UCDC_BREAK_ON : UCDC_BREAK_OFF; @@ -1267,7 +1267,7 @@ uipaq_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uipaq_write_callback(struct usb2_xfer *xfer) +uipaq_write_callback(struct usb_xfer *xfer) { struct uipaq_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -1294,7 +1294,7 @@ tr_setup: } static void -uipaq_read_callback(struct usb2_xfer *xfer) +uipaq_read_callback(struct usb_xfer *xfer) { struct uipaq_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/serial/ulpt.c b/sys/dev/usb/serial/ulpt.c index 80df2ce57a0e..e78c78aa4138 100644 --- a/sys/dev/usb/serial/ulpt.c +++ b/sys/dev/usb/serial/ulpt.c @@ -94,15 +94,15 @@ enum { }; struct ulpt_softc { - struct usb2_fifo_sc sc_fifo; - struct usb2_fifo_sc sc_fifo_noreset; + struct usb_fifo_sc sc_fifo; + struct usb_fifo_sc sc_fifo_noreset; struct mtx sc_mtx; - struct usb2_callout sc_watchdog; + struct usb_callout sc_watchdog; device_t sc_dev; - struct usb2_device *sc_udev; - struct usb2_fifo *sc_fifo_open[2]; - struct usb2_xfer *sc_xfer[ULPT_N_TRANSFER]; + struct usb_device *sc_udev; + struct usb_fifo *sc_fifo_open[2]; + struct usb_xfer *sc_xfer[ULPT_N_TRANSFER]; int sc_fflags; /* current open flags, FREAD and * FWRITE */ @@ -134,7 +134,7 @@ static usb2_fifo_ioctl_t ulpt_ioctl; static usb2_fifo_open_t ulpt_open; static usb2_fifo_open_t unlpt_open; -static struct usb2_fifo_methods ulpt_fifo_methods = { +static struct usb_fifo_methods ulpt_fifo_methods = { .f_close = &ulpt_close, .f_ioctl = &ulpt_ioctl, .f_open = &ulpt_open, @@ -145,7 +145,7 @@ static struct usb2_fifo_methods ulpt_fifo_methods = { .basename[0] = "ulpt", }; -static struct usb2_fifo_methods unlpt_fifo_methods = { +static struct usb_fifo_methods unlpt_fifo_methods = { .f_close = &ulpt_close, .f_ioctl = &ulpt_ioctl, .f_open = &unlpt_open, @@ -159,7 +159,7 @@ static struct usb2_fifo_methods unlpt_fifo_methods = { static void ulpt_reset(struct ulpt_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; DPRINTFN(2, "\n"); @@ -189,10 +189,10 @@ ulpt_reset(struct ulpt_softc *sc) } static void -ulpt_write_callback(struct usb2_xfer *xfer) +ulpt_write_callback(struct usb_xfer *xfer) { struct ulpt_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo_open[USB_FIFO_TX]; + struct usb_fifo *f = sc->sc_fifo_open[USB_FIFO_TX]; uint32_t actlen; if (f == NULL) { @@ -225,10 +225,10 @@ tr_setup: } static void -ulpt_read_callback(struct usb2_xfer *xfer) +ulpt_read_callback(struct usb_xfer *xfer) { struct ulpt_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo_open[USB_FIFO_RX]; + struct usb_fifo *f = sc->sc_fifo_open[USB_FIFO_RX]; if (f == NULL) { /* should not happen */ @@ -281,10 +281,10 @@ tr_setup: } static void -ulpt_status_callback(struct usb2_xfer *xfer) +ulpt_status_callback(struct usb_xfer *xfer) { struct ulpt_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; uint8_t cur_status; uint8_t new_status; @@ -333,7 +333,7 @@ ulpt_status_callback(struct usb2_xfer *xfer) } } -static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = { +static const struct usb_config ulpt_config[ULPT_N_TRANSFER] = { [ULPT_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -356,14 +356,14 @@ static const struct usb2_config ulpt_config[ULPT_N_TRANSFER] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request) + 1, + .bufsize = sizeof(struct usb_device_request) + 1, .callback = &ulpt_status_callback, .timeout = 1000, /* 1 second */ }, }; static void -ulpt_start_read(struct usb2_fifo *fifo) +ulpt_start_read(struct usb_fifo *fifo) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -371,7 +371,7 @@ ulpt_start_read(struct usb2_fifo *fifo) } static void -ulpt_stop_read(struct usb2_fifo *fifo) +ulpt_stop_read(struct usb_fifo *fifo) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -379,7 +379,7 @@ ulpt_stop_read(struct usb2_fifo *fifo) } static void -ulpt_start_write(struct usb2_fifo *fifo) +ulpt_start_write(struct usb_fifo *fifo) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -387,7 +387,7 @@ ulpt_start_write(struct usb2_fifo *fifo) } static void -ulpt_stop_write(struct usb2_fifo *fifo) +ulpt_stop_write(struct usb_fifo *fifo) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -395,7 +395,7 @@ ulpt_stop_write(struct usb2_fifo *fifo) } static int -ulpt_open(struct usb2_fifo *fifo, int fflags) +ulpt_open(struct usb_fifo *fifo, int fflags) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -408,7 +408,7 @@ ulpt_open(struct usb2_fifo *fifo, int fflags) } static int -unlpt_open(struct usb2_fifo *fifo, int fflags) +unlpt_open(struct usb_fifo *fifo, int fflags) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -446,7 +446,7 @@ unlpt_open(struct usb2_fifo *fifo, int fflags) } static void -ulpt_close(struct usb2_fifo *fifo, int fflags) +ulpt_close(struct usb_fifo *fifo, int fflags) { struct ulpt_softc *sc = fifo->priv_sc0; @@ -458,7 +458,7 @@ ulpt_close(struct usb2_fifo *fifo, int fflags) } static int -ulpt_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data, +ulpt_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags) { return (ENODEV); @@ -467,7 +467,7 @@ ulpt_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data, static int ulpt_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); DPRINTFN(11, "\n"); @@ -487,9 +487,9 @@ ulpt_probe(device_t dev) static int ulpt_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ulpt_softc *sc = device_get_softc(dev); - struct usb2_interface_descriptor *id; + struct usb_interface_descriptor *id; int unit = device_get_unit(dev); int error; uint8_t iface_index = uaa->info.bIfaceIndex; @@ -566,8 +566,8 @@ found: * UHCI and less often with OHCI. *sigh* */ { - struct usb2_config_descriptor *cd = usb2_get_config_descriptor(dev); - struct usb2_device_request req; + struct usb_config_descriptor *cd = usb2_get_config_descriptor(dev); + struct usb_device_request req; int len, alen; req.bmRequestType = UT_READ_CLASS_INTERFACE; diff --git a/sys/dev/usb/serial/umct.c b/sys/dev/usb/serial/umct.c index b72943b92638..483a97c457c2 100644 --- a/sys/dev/usb/serial/umct.c +++ b/sys/dev/usb/serial/umct.c @@ -87,11 +87,11 @@ enum { }; struct umct_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_xfer[UMCT_N_TRANSFER]; + struct usb_device *sc_udev; + struct usb_xfer *sc_xfer[UMCT_N_TRANSFER]; struct mtx sc_mtx; uint32_t sc_unit; @@ -118,20 +118,20 @@ static usb2_callback_t umct_read_callback; static void umct_cfg_do_request(struct umct_softc *sc, uint8_t request, uint16_t len, uint32_t value); -static void umct_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void umct_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static void umct_cfg_set_break(struct usb2_com_softc *, uint8_t); -static void umct_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void umct_cfg_set_rts(struct usb2_com_softc *, uint8_t); +static void umct_cfg_set_break(struct ucom_softc *, uint8_t); +static void umct_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void umct_cfg_set_rts(struct ucom_softc *, uint8_t); static uint8_t umct_calc_baud(uint32_t); -static int umct_pre_param(struct usb2_com_softc *, struct termios *); -static void umct_cfg_param(struct usb2_com_softc *, struct termios *); -static void umct_start_read(struct usb2_com_softc *); -static void umct_stop_read(struct usb2_com_softc *); -static void umct_start_write(struct usb2_com_softc *); -static void umct_stop_write(struct usb2_com_softc *); +static int umct_pre_param(struct ucom_softc *, struct termios *); +static void umct_cfg_param(struct ucom_softc *, struct termios *); +static void umct_start_read(struct ucom_softc *); +static void umct_stop_read(struct ucom_softc *); +static void umct_start_write(struct ucom_softc *); +static void umct_stop_write(struct ucom_softc *); -static const struct usb2_config umct_config[UMCT_N_TRANSFER] = { +static const struct usb_config umct_config[UMCT_N_TRANSFER] = { [UMCT_BULK_DT_WR] = { .type = UE_BULK, @@ -163,7 +163,7 @@ static const struct usb2_config umct_config[UMCT_N_TRANSFER] = { }, }; -static const struct usb2_com_callback umct_callback = { +static const struct ucom_callback umct_callback = { .usb2_com_cfg_get_status = &umct_cfg_get_status, .usb2_com_cfg_set_dtr = &umct_cfg_set_dtr, .usb2_com_cfg_set_rts = &umct_cfg_set_rts, @@ -176,7 +176,7 @@ static const struct usb2_com_callback umct_callback = { .usb2_com_stop_write = &umct_stop_write, }; -static const struct usb2_device_id umct_devs[] = { +static const struct usb_device_id umct_devs[] = { {USB_VPI(USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232, 0)}, {USB_VPI(USB_VENDOR_MCT, USB_PRODUCT_MCT_SITECOM_USB232, 0)}, {USB_VPI(USB_VENDOR_MCT, USB_PRODUCT_MCT_DU_H3SP_USB232, 0)}, @@ -206,7 +206,7 @@ MODULE_DEPEND(umct, usb, 1, 1, 1); static int umct_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -223,7 +223,7 @@ umct_probe(device_t dev) static int umct_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct umct_softc *sc = device_get_softc(dev); int32_t error; uint16_t maxp; @@ -259,7 +259,7 @@ umct_attach(device_t dev) /* guessed wrong - switch around endpoints */ - struct usb2_xfer *temp = sc->sc_xfer[UMCT_INTR_DT_RD]; + struct usb_xfer *temp = sc->sc_xfer[UMCT_INTR_DT_RD]; sc->sc_xfer[UMCT_INTR_DT_RD] = sc->sc_xfer[UMCT_BULK_DT_RD]; sc->sc_xfer[UMCT_BULK_DT_RD] = temp; @@ -302,7 +302,7 @@ static void umct_cfg_do_request(struct umct_softc *sc, uint8_t request, uint16_t len, uint32_t value) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint8_t temp[4]; @@ -326,7 +326,7 @@ umct_cfg_do_request(struct umct_softc *sc, uint8_t request, } static void -umct_intr_callback(struct usb2_xfer *xfer) +umct_intr_callback(struct usb_xfer *xfer) { struct umct_softc *sc = xfer->priv_sc; uint8_t buf[2]; @@ -361,7 +361,7 @@ tr_setup: } static void -umct_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +umct_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct umct_softc *sc = ucom->sc_parent; @@ -370,7 +370,7 @@ umct_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -umct_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +umct_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct umct_softc *sc = ucom->sc_parent; @@ -383,7 +383,7 @@ umct_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umct_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +umct_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct umct_softc *sc = ucom->sc_parent; @@ -396,7 +396,7 @@ umct_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umct_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +umct_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct umct_softc *sc = ucom->sc_parent; @@ -439,13 +439,13 @@ umct_calc_baud(uint32_t baud) } static int -umct_pre_param(struct usb2_com_softc *ucom, struct termios *t) +umct_pre_param(struct ucom_softc *ucom, struct termios *t) { return (0); /* we accept anything */ } static void -umct_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +umct_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct umct_softc *sc = ucom->sc_parent; uint32_t value; @@ -486,7 +486,7 @@ umct_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -umct_start_read(struct usb2_com_softc *ucom) +umct_start_read(struct ucom_softc *ucom) { struct umct_softc *sc = ucom->sc_parent; @@ -498,7 +498,7 @@ umct_start_read(struct usb2_com_softc *ucom) } static void -umct_stop_read(struct usb2_com_softc *ucom) +umct_stop_read(struct ucom_softc *ucom) { struct umct_softc *sc = ucom->sc_parent; @@ -510,7 +510,7 @@ umct_stop_read(struct usb2_com_softc *ucom) } static void -umct_start_write(struct usb2_com_softc *ucom) +umct_start_write(struct ucom_softc *ucom) { struct umct_softc *sc = ucom->sc_parent; @@ -518,7 +518,7 @@ umct_start_write(struct usb2_com_softc *ucom) } static void -umct_stop_write(struct usb2_com_softc *ucom) +umct_stop_write(struct ucom_softc *ucom) { struct umct_softc *sc = ucom->sc_parent; @@ -526,7 +526,7 @@ umct_stop_write(struct usb2_com_softc *ucom) } static void -umct_write_callback(struct usb2_xfer *xfer) +umct_write_callback(struct usb_xfer *xfer) { struct umct_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -554,7 +554,7 @@ tr_setup: } static void -umct_read_callback(struct usb2_xfer *xfer) +umct_read_callback(struct usb_xfer *xfer) { struct umct_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c index 785ac9b3e25f..df1c2db5ce39 100644 --- a/sys/dev/usb/serial/umodem.c +++ b/sys/dev/usb/serial/umodem.c @@ -108,7 +108,7 @@ SYSCTL_INT(_hw_usb_umodem, OID_AUTO, debug, CTLFLAG_RW, &umodem_debug, 0, "Debug level"); #endif -static const struct usb2_device_id umodem_devs[] = { +static const struct usb_device_id umodem_devs[] = { /* Generic Modem class match */ {USB_IFACE_CLASS(UICLASS_CDC), USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL), @@ -137,11 +137,11 @@ enum { #define UMODEM_MODVER 1 /* module version */ struct umodem_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UMODEM_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UMODEM_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint16_t sc_line; @@ -164,25 +164,25 @@ static usb2_callback_t umodem_intr_callback; static usb2_callback_t umodem_write_callback; static usb2_callback_t umodem_read_callback; -static void umodem_start_read(struct usb2_com_softc *); -static void umodem_stop_read(struct usb2_com_softc *); -static void umodem_start_write(struct usb2_com_softc *); -static void umodem_stop_write(struct usb2_com_softc *); -static void umodem_get_caps(struct usb2_attach_arg *, uint8_t *, uint8_t *); -static void umodem_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void umodem_start_read(struct ucom_softc *); +static void umodem_stop_read(struct ucom_softc *); +static void umodem_start_write(struct ucom_softc *); +static void umodem_stop_write(struct ucom_softc *); +static void umodem_get_caps(struct usb_attach_arg *, uint8_t *, uint8_t *); +static void umodem_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); -static int umodem_pre_param(struct usb2_com_softc *, struct termios *); -static void umodem_cfg_param(struct usb2_com_softc *, struct termios *); -static int umodem_ioctl(struct usb2_com_softc *, uint32_t, caddr_t, int, +static int umodem_pre_param(struct ucom_softc *, struct termios *); +static void umodem_cfg_param(struct ucom_softc *, struct termios *); +static int umodem_ioctl(struct ucom_softc *, uint32_t, caddr_t, int, struct thread *); -static void umodem_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void umodem_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void umodem_cfg_set_break(struct usb2_com_softc *, uint8_t); -static void *umodem_get_desc(struct usb2_attach_arg *, uint8_t, uint8_t); -static usb2_error_t umodem_set_comm_feature(struct usb2_device *, uint8_t, +static void umodem_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void umodem_cfg_set_rts(struct ucom_softc *, uint8_t); +static void umodem_cfg_set_break(struct ucom_softc *, uint8_t); +static void *umodem_get_desc(struct usb_attach_arg *, uint8_t, uint8_t); +static usb2_error_t umodem_set_comm_feature(struct usb_device *, uint8_t, uint16_t, uint16_t); -static const struct usb2_config umodem_config[UMODEM_N_TRANSFER] = { +static const struct usb_config umodem_config[UMODEM_N_TRANSFER] = { [UMODEM_BULK_WR] = { .type = UE_BULK, @@ -215,7 +215,7 @@ static const struct usb2_config umodem_config[UMODEM_N_TRANSFER] = { }, }; -static const struct usb2_com_callback umodem_callback = { +static const struct ucom_callback umodem_callback = { .usb2_com_cfg_get_status = &umodem_cfg_get_status, .usb2_com_cfg_set_dtr = &umodem_cfg_set_dtr, .usb2_com_cfg_set_rts = &umodem_cfg_set_rts, @@ -252,7 +252,7 @@ MODULE_VERSION(umodem, UMODEM_MODVER); static int umodem_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); int error; DPRINTFN(11, "\n"); @@ -267,10 +267,10 @@ umodem_probe(device_t dev) static int umodem_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct umodem_softc *sc = device_get_softc(dev); - struct usb2_cdc_cm_descriptor *cmd; - struct usb2_cdc_union_descriptor *cud; + struct usb_cdc_cm_descriptor *cmd; + struct usb_cdc_union_descriptor *cud; uint8_t i; int error; @@ -312,8 +312,8 @@ umodem_attach(device_t dev) /* get the data interface too */ for (i = 0;; i++) { - struct usb2_interface *iface; - struct usb2_interface_descriptor *id; + struct usb_interface *iface; + struct usb_interface_descriptor *id; iface = usb2_get_iface(uaa->device, i); @@ -370,7 +370,7 @@ detach: } static void -umodem_start_read(struct usb2_com_softc *ucom) +umodem_start_read(struct ucom_softc *ucom) { struct umodem_softc *sc = ucom->sc_parent; @@ -382,7 +382,7 @@ umodem_start_read(struct usb2_com_softc *ucom) } static void -umodem_stop_read(struct usb2_com_softc *ucom) +umodem_stop_read(struct ucom_softc *ucom) { struct umodem_softc *sc = ucom->sc_parent; @@ -394,7 +394,7 @@ umodem_stop_read(struct usb2_com_softc *ucom) } static void -umodem_start_write(struct usb2_com_softc *ucom) +umodem_start_write(struct ucom_softc *ucom) { struct umodem_softc *sc = ucom->sc_parent; @@ -402,7 +402,7 @@ umodem_start_write(struct usb2_com_softc *ucom) } static void -umodem_stop_write(struct usb2_com_softc *ucom) +umodem_stop_write(struct ucom_softc *ucom) { struct umodem_softc *sc = ucom->sc_parent; @@ -410,10 +410,10 @@ umodem_stop_write(struct usb2_com_softc *ucom) } static void -umodem_get_caps(struct usb2_attach_arg *uaa, uint8_t *cm, uint8_t *acm) +umodem_get_caps(struct usb_attach_arg *uaa, uint8_t *cm, uint8_t *acm) { - struct usb2_cdc_cm_descriptor *cmd; - struct usb2_cdc_acm_descriptor *cad; + struct usb_cdc_cm_descriptor *cmd; + struct usb_cdc_acm_descriptor *cad; cmd = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if ((cmd == NULL) || (cmd->bLength < sizeof(*cmd))) { @@ -431,7 +431,7 @@ umodem_get_caps(struct usb2_attach_arg *uaa, uint8_t *cm, uint8_t *acm) } static void -umodem_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +umodem_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct umodem_softc *sc = ucom->sc_parent; @@ -442,17 +442,17 @@ umodem_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static int -umodem_pre_param(struct usb2_com_softc *ucom, struct termios *t) +umodem_pre_param(struct ucom_softc *ucom, struct termios *t) { return (0); /* we accept anything */ } static void -umodem_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +umodem_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct umodem_softc *sc = ucom->sc_parent; - struct usb2_cdc_line_state ls; - struct usb2_device_request req; + struct usb_cdc_line_state ls; + struct usb_device_request req; DPRINTF("sc=%p\n", sc); @@ -498,7 +498,7 @@ umodem_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static int -umodem_ioctl(struct usb2_com_softc *ucom, uint32_t cmd, caddr_t data, +umodem_ioctl(struct ucom_softc *ucom, uint32_t cmd, caddr_t data, int flag, struct thread *td) { struct umodem_softc *sc = ucom->sc_parent; @@ -527,10 +527,10 @@ umodem_ioctl(struct usb2_com_softc *ucom, uint32_t cmd, caddr_t data, } static void -umodem_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +umodem_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct umodem_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("onoff=%d\n", onoff); @@ -551,10 +551,10 @@ umodem_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umodem_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +umodem_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct umodem_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("onoff=%d\n", onoff); @@ -575,10 +575,10 @@ umodem_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umodem_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +umodem_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct umodem_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t temp; DPRINTF("onoff=%d\n", onoff); @@ -600,9 +600,9 @@ umodem_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umodem_intr_callback(struct usb2_xfer *xfer) +umodem_intr_callback(struct usb_xfer *xfer) { - struct usb2_cdc_notification pkt; + struct usb_cdc_notification pkt; struct umodem_softc *sc = xfer->priv_sc; uint16_t wLen; @@ -687,7 +687,7 @@ tr_setup: } static void -umodem_write_callback(struct usb2_xfer *xfer) +umodem_write_callback(struct usb_xfer *xfer) { struct umodem_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -715,7 +715,7 @@ tr_setup: } static void -umodem_read_callback(struct usb2_xfer *xfer) +umodem_read_callback(struct usb_xfer *xfer) { struct umodem_softc *sc = xfer->priv_sc; @@ -744,18 +744,18 @@ tr_setup: } static void * -umodem_get_desc(struct usb2_attach_arg *uaa, uint8_t type, uint8_t subtype) +umodem_get_desc(struct usb_attach_arg *uaa, uint8_t type, uint8_t subtype) { return (usb2_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, type, 0 - 1, subtype, 0 - 1)); } static usb2_error_t -umodem_set_comm_feature(struct usb2_device *udev, uint8_t iface_no, +umodem_set_comm_feature(struct usb_device *udev, uint8_t iface_no, uint16_t feature, uint16_t state) { - struct usb2_device_request req; - struct usb2_cdc_abstract_state ast; + struct usb_device_request req; + struct usb_cdc_abstract_state ast; DPRINTF("feature=%d state=%d\n", feature, state); diff --git a/sys/dev/usb/serial/umoscom.c b/sys/dev/usb/serial/umoscom.c index a6549e553d0a..b1b6f68dbe2a 100644 --- a/sys/dev/usb/serial/umoscom.c +++ b/sys/dev/usb/serial/umoscom.c @@ -161,11 +161,11 @@ enum { }; struct umoscom_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UMOSCOM_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UMOSCOM_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint8_t sc_mcr; @@ -182,23 +182,23 @@ static usb2_callback_t umoscom_write_callback; static usb2_callback_t umoscom_read_callback; static usb2_callback_t umoscom_intr_callback; -static void umoscom_cfg_open(struct usb2_com_softc *); -static void umoscom_cfg_close(struct usb2_com_softc *); -static void umoscom_cfg_set_break(struct usb2_com_softc *, uint8_t); -static void umoscom_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void umoscom_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static int umoscom_pre_param(struct usb2_com_softc *, struct termios *); -static void umoscom_cfg_param(struct usb2_com_softc *, struct termios *); -static void umoscom_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void umoscom_cfg_open(struct ucom_softc *); +static void umoscom_cfg_close(struct ucom_softc *); +static void umoscom_cfg_set_break(struct ucom_softc *, uint8_t); +static void umoscom_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void umoscom_cfg_set_rts(struct ucom_softc *, uint8_t); +static int umoscom_pre_param(struct ucom_softc *, struct termios *); +static void umoscom_cfg_param(struct ucom_softc *, struct termios *); +static void umoscom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); static void umoscom_cfg_write(struct umoscom_softc *, uint16_t, uint16_t); static uint8_t umoscom_cfg_read(struct umoscom_softc *, uint16_t); -static void umoscom_start_read(struct usb2_com_softc *); -static void umoscom_stop_read(struct usb2_com_softc *); -static void umoscom_start_write(struct usb2_com_softc *); -static void umoscom_stop_write(struct usb2_com_softc *); +static void umoscom_start_read(struct ucom_softc *); +static void umoscom_stop_read(struct ucom_softc *); +static void umoscom_start_write(struct ucom_softc *); +static void umoscom_stop_write(struct ucom_softc *); -static const struct usb2_config umoscom_config_data[UMOSCOM_N_TRANSFER] = { +static const struct usb_config umoscom_config_data[UMOSCOM_N_TRANSFER] = { [UMOSCOM_BULK_DT_WR] = { .type = UE_BULK, @@ -228,7 +228,7 @@ static const struct usb2_config umoscom_config_data[UMOSCOM_N_TRANSFER] = { }, }; -static const struct usb2_com_callback umoscom_callback = { +static const struct ucom_callback umoscom_callback = { /* configuration callbacks */ .usb2_com_cfg_get_status = &umoscom_cfg_get_status, .usb2_com_cfg_set_dtr = &umoscom_cfg_set_dtr, @@ -265,14 +265,14 @@ DRIVER_MODULE(umoscom, uhub, umoscom_driver, umoscom_devclass, NULL, 0); MODULE_DEPEND(umoscom, ucom, 1, 1, 1); MODULE_DEPEND(umoscom, usb, 1, 1, 1); -static const struct usb2_device_id umoscom_devs[] = { +static const struct usb_device_id umoscom_devs[] = { {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7703, 0)} }; static int umoscom_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -289,7 +289,7 @@ umoscom_probe(device_t dev) static int umoscom_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct umoscom_softc *sc = device_get_softc(dev); int error; uint8_t iface_index; @@ -343,7 +343,7 @@ umoscom_detach(device_t dev) } static void -umoscom_cfg_open(struct usb2_com_softc *ucom) +umoscom_cfg_open(struct ucom_softc *ucom) { struct umoscom_softc *sc = ucom->sc_parent; @@ -369,13 +369,13 @@ umoscom_cfg_open(struct usb2_com_softc *ucom) } static void -umoscom_cfg_close(struct usb2_com_softc *ucom) +umoscom_cfg_close(struct ucom_softc *ucom) { return; } static void -umoscom_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +umoscom_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct umoscom_softc *sc = ucom->sc_parent; uint16_t val; @@ -388,7 +388,7 @@ umoscom_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umoscom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +umoscom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct umoscom_softc *sc = ucom->sc_parent; @@ -401,7 +401,7 @@ umoscom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -umoscom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +umoscom_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct umoscom_softc *sc = ucom->sc_parent; @@ -414,7 +414,7 @@ umoscom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static int -umoscom_pre_param(struct usb2_com_softc *ucom, struct termios *t) +umoscom_pre_param(struct ucom_softc *ucom, struct termios *t) { if ((t->c_ospeed <= 1) || (t->c_ospeed > 115200)) return (EINVAL); @@ -423,7 +423,7 @@ umoscom_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -umoscom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +umoscom_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct umoscom_softc *sc = ucom->sc_parent; uint16_t data; @@ -478,7 +478,7 @@ umoscom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -umoscom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *p_lsr, uint8_t *p_msr) +umoscom_cfg_get_status(struct ucom_softc *ucom, uint8_t *p_lsr, uint8_t *p_msr) { struct umoscom_softc *sc = ucom->sc_parent; uint8_t lsr; @@ -509,7 +509,7 @@ umoscom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *p_lsr, uint8_t *p_m static void umoscom_cfg_write(struct umoscom_softc *sc, uint16_t reg, uint16_t val) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UMOSCOM_WRITE; @@ -524,7 +524,7 @@ umoscom_cfg_write(struct umoscom_softc *sc, uint16_t reg, uint16_t val) static uint8_t umoscom_cfg_read(struct umoscom_softc *sc, uint16_t reg) { - struct usb2_device_request req; + struct usb_device_request req; uint8_t val; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -542,7 +542,7 @@ umoscom_cfg_read(struct umoscom_softc *sc, uint16_t reg) } static void -umoscom_start_read(struct usb2_com_softc *ucom) +umoscom_start_read(struct ucom_softc *ucom) { struct umoscom_softc *sc = ucom->sc_parent; @@ -555,7 +555,7 @@ umoscom_start_read(struct usb2_com_softc *ucom) } static void -umoscom_stop_read(struct usb2_com_softc *ucom) +umoscom_stop_read(struct ucom_softc *ucom) { struct umoscom_softc *sc = ucom->sc_parent; @@ -567,7 +567,7 @@ umoscom_stop_read(struct usb2_com_softc *ucom) } static void -umoscom_start_write(struct usb2_com_softc *ucom) +umoscom_start_write(struct ucom_softc *ucom) { struct umoscom_softc *sc = ucom->sc_parent; @@ -575,7 +575,7 @@ umoscom_start_write(struct usb2_com_softc *ucom) } static void -umoscom_stop_write(struct usb2_com_softc *ucom) +umoscom_stop_write(struct ucom_softc *ucom) { struct umoscom_softc *sc = ucom->sc_parent; @@ -583,7 +583,7 @@ umoscom_stop_write(struct usb2_com_softc *ucom) } static void -umoscom_write_callback(struct usb2_xfer *xfer) +umoscom_write_callback(struct usb_xfer *xfer) { struct umoscom_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -614,7 +614,7 @@ tr_setup: } static void -umoscom_read_callback(struct usb2_xfer *xfer) +umoscom_read_callback(struct usb_xfer *xfer) { struct umoscom_softc *sc = xfer->priv_sc; @@ -643,7 +643,7 @@ tr_setup: } static void -umoscom_intr_callback(struct usb2_xfer *xfer) +umoscom_intr_callback(struct usb_xfer *xfer) { struct umoscom_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c index f01f7448ac0e..4f26c07394be 100644 --- a/sys/dev/usb/serial/uplcom.c +++ b/sys/dev/usb/serial/uplcom.c @@ -140,11 +140,11 @@ enum { }; struct uplcom_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UPLCOM_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UPLCOM_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint16_t sc_line; @@ -159,18 +159,18 @@ struct uplcom_softc { /* prototypes */ -static usb2_error_t uplcom_reset(struct uplcom_softc *, struct usb2_device *); -static int uplcom_pl2303x_init(struct usb2_device *); -static void uplcom_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void uplcom_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void uplcom_cfg_set_break(struct usb2_com_softc *, uint8_t); -static int uplcom_pre_param(struct usb2_com_softc *, struct termios *); -static void uplcom_cfg_param(struct usb2_com_softc *, struct termios *); -static void uplcom_start_read(struct usb2_com_softc *); -static void uplcom_stop_read(struct usb2_com_softc *); -static void uplcom_start_write(struct usb2_com_softc *); -static void uplcom_stop_write(struct usb2_com_softc *); -static void uplcom_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static usb2_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *); +static int uplcom_pl2303x_init(struct usb_device *); +static void uplcom_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void uplcom_cfg_set_rts(struct ucom_softc *, uint8_t); +static void uplcom_cfg_set_break(struct ucom_softc *, uint8_t); +static int uplcom_pre_param(struct ucom_softc *, struct termios *); +static void uplcom_cfg_param(struct ucom_softc *, struct termios *); +static void uplcom_start_read(struct ucom_softc *); +static void uplcom_stop_read(struct ucom_softc *); +static void uplcom_start_write(struct ucom_softc *); +static void uplcom_stop_write(struct ucom_softc *); +static void uplcom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); static device_probe_t uplcom_probe; @@ -181,7 +181,7 @@ static usb2_callback_t uplcom_intr_callback; static usb2_callback_t uplcom_write_callback; static usb2_callback_t uplcom_read_callback; -static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = { +static const struct usb_config uplcom_config_data[UPLCOM_N_TRANSFER] = { [UPLCOM_BULK_DT_WR] = { .type = UE_BULK, @@ -214,7 +214,7 @@ static const struct usb2_config uplcom_config_data[UPLCOM_N_TRANSFER] = { }, }; -struct usb2_com_callback uplcom_callback = { +struct ucom_callback uplcom_callback = { .usb2_com_cfg_get_status = &uplcom_cfg_get_status, .usb2_com_cfg_set_dtr = &uplcom_cfg_set_dtr, .usb2_com_cfg_set_rts = &uplcom_cfg_set_rts, @@ -231,7 +231,7 @@ struct usb2_com_callback uplcom_callback = { USB_VENDOR(v), USB_PRODUCT(p), USB_DEV_BCD_GTEQ(rl), \ USB_DEV_BCD_LTEQ(rh), USB_DRIVER_INFO(t) -static const struct usb2_device_id uplcom_devs[] = { +static const struct usb_device_id uplcom_devs[] = { /* Belkin F5U257 */ {USB_UPL(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U257, 0, 0xFFFF, TYPE_PL2303X)}, /* I/O DATA USB-RSAQ */ @@ -302,7 +302,7 @@ MODULE_VERSION(uplcom, UPLCOM_MODVER); static int uplcom_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); DPRINTFN(11, "\n"); @@ -321,10 +321,10 @@ uplcom_probe(device_t dev) static int uplcom_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uplcom_softc *sc = device_get_softc(dev); - struct usb2_interface *iface; - struct usb2_interface_descriptor *id; + struct usb_interface *iface; + struct usb_interface_descriptor *id; int error; DPRINTFN(11, "\n"); @@ -430,9 +430,9 @@ uplcom_detach(device_t dev) } static usb2_error_t -uplcom_reset(struct uplcom_softc *sc, struct usb2_device *udev) +uplcom_reset(struct uplcom_softc *sc, struct usb_device *udev) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; @@ -471,9 +471,9 @@ static const struct pl2303x_init pl2303x[] = { #define N_PL2302X_INIT (sizeof(pl2303x)/sizeof(pl2303x[0])) static int -uplcom_pl2303x_init(struct usb2_device *udev) +uplcom_pl2303x_init(struct usb_device *udev) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint8_t buf[4]; uint8_t i; @@ -495,10 +495,10 @@ uplcom_pl2303x_init(struct usb2_device *udev) } static void -uplcom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +uplcom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct uplcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("onoff = %d\n", onoff); @@ -519,10 +519,10 @@ uplcom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uplcom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +uplcom_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct uplcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("onoff = %d\n", onoff); @@ -543,10 +543,10 @@ uplcom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uplcom_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uplcom_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uplcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t temp; DPRINTF("onoff = %d\n", onoff); @@ -577,7 +577,7 @@ static const int32_t uplcom_rates[] = { #define N_UPLCOM_RATES (sizeof(uplcom_rates)/sizeof(uplcom_rates[0])) static int -uplcom_pre_param(struct usb2_com_softc *ucom, struct termios *t) +uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { uint8_t i; @@ -601,11 +601,11 @@ uplcom_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uplcom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct uplcom_softc *sc = ucom->sc_parent; - struct usb2_cdc_line_state ls; - struct usb2_device_request req; + struct usb_cdc_line_state ls; + struct usb_device_request req; DPRINTF("sc = %p\n", sc); @@ -685,7 +685,7 @@ uplcom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uplcom_start_read(struct usb2_com_softc *ucom) +uplcom_start_read(struct ucom_softc *ucom) { struct uplcom_softc *sc = ucom->sc_parent; @@ -697,7 +697,7 @@ uplcom_start_read(struct usb2_com_softc *ucom) } static void -uplcom_stop_read(struct usb2_com_softc *ucom) +uplcom_stop_read(struct ucom_softc *ucom) { struct uplcom_softc *sc = ucom->sc_parent; @@ -709,7 +709,7 @@ uplcom_stop_read(struct usb2_com_softc *ucom) } static void -uplcom_start_write(struct usb2_com_softc *ucom) +uplcom_start_write(struct ucom_softc *ucom) { struct uplcom_softc *sc = ucom->sc_parent; @@ -717,7 +717,7 @@ uplcom_start_write(struct usb2_com_softc *ucom) } static void -uplcom_stop_write(struct usb2_com_softc *ucom) +uplcom_stop_write(struct ucom_softc *ucom) { struct uplcom_softc *sc = ucom->sc_parent; @@ -725,7 +725,7 @@ uplcom_stop_write(struct usb2_com_softc *ucom) } static void -uplcom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +uplcom_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct uplcom_softc *sc = ucom->sc_parent; @@ -736,7 +736,7 @@ uplcom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -uplcom_intr_callback(struct usb2_xfer *xfer) +uplcom_intr_callback(struct usb_xfer *xfer) { struct uplcom_softc *sc = xfer->priv_sc; uint8_t buf[9]; @@ -783,7 +783,7 @@ tr_setup: } static void -uplcom_write_callback(struct usb2_xfer *xfer) +uplcom_write_callback(struct usb_xfer *xfer) { struct uplcom_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -813,7 +813,7 @@ tr_setup: } static void -uplcom_read_callback(struct usb2_xfer *xfer) +uplcom_read_callback(struct usb_xfer *xfer) { struct uplcom_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c index 99ec4d6b9927..b5222708a7a6 100644 --- a/sys/dev/usb/serial/usb_serial.c +++ b/sys/dev/usb/serial/usb_serial.c @@ -101,15 +101,15 @@ static usb2_proc_callback_t usb2_com_cfg_param; static uint8_t usb2_com_units_alloc(uint32_t, uint32_t *); static void usb2_com_units_free(uint32_t, uint32_t); -static int usb2_com_attach_tty(struct usb2_com_softc *, uint32_t); -static void usb2_com_detach_tty(struct usb2_com_softc *); -static void usb2_com_queue_command(struct usb2_com_softc *, +static int usb2_com_attach_tty(struct ucom_softc *, uint32_t); +static void usb2_com_detach_tty(struct ucom_softc *); +static void usb2_com_queue_command(struct ucom_softc *, usb2_proc_callback_t *, struct termios *pt, - struct usb2_proc_msg *t0, struct usb2_proc_msg *t1); -static void usb2_com_shutdown(struct usb2_com_softc *); -static void usb2_com_break(struct usb2_com_softc *, uint8_t); -static void usb2_com_dtr(struct usb2_com_softc *, uint8_t); -static void usb2_com_rts(struct usb2_com_softc *, uint8_t); + struct usb_proc_msg *t0, struct usb_proc_msg *t1); +static void usb2_com_shutdown(struct ucom_softc *); +static void usb2_com_break(struct ucom_softc *, uint8_t); +static void usb2_com_dtr(struct ucom_softc *, uint8_t); +static void usb2_com_rts(struct ucom_softc *, uint8_t); static tsw_open_t usb2_com_open; static tsw_close_t usb2_com_close; @@ -215,9 +215,9 @@ usb2_com_units_free(uint32_t root_unit, uint32_t sub_units) * before calling into the ucom-layer! */ int -usb2_com_attach(struct usb2_com_super_softc *ssc, struct usb2_com_softc *sc, +usb2_com_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, uint32_t sub_units, void *parent, - const struct usb2_com_callback *callback, struct mtx *mtx) + const struct ucom_callback *callback, struct mtx *mtx) { uint32_t n; uint32_t root_unit; @@ -265,7 +265,7 @@ usb2_com_attach(struct usb2_com_super_softc *ssc, struct usb2_com_softc *sc, * the structure pointed to by "ssc" and "sc" is zero. */ void -usb2_com_detach(struct usb2_com_super_softc *ssc, struct usb2_com_softc *sc, +usb2_com_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc, uint32_t sub_units) { uint32_t n; @@ -287,7 +287,7 @@ usb2_com_detach(struct usb2_com_super_softc *ssc, struct usb2_com_softc *sc, } static int -usb2_com_attach_tty(struct usb2_com_softc *sc, uint32_t sub_units) +usb2_com_attach_tty(struct ucom_softc *sc, uint32_t sub_units) { struct tty *tp; int error = 0; @@ -335,7 +335,7 @@ done: } static void -usb2_com_detach_tty(struct usb2_com_softc *sc) +usb2_com_detach_tty(struct ucom_softc *sc) { struct tty *tp = sc->sc_tty; @@ -374,12 +374,12 @@ usb2_com_detach_tty(struct usb2_com_softc *sc) } static void -usb2_com_queue_command(struct usb2_com_softc *sc, +usb2_com_queue_command(struct ucom_softc *sc, usb2_proc_callback_t *fn, struct termios *pt, - struct usb2_proc_msg *t0, struct usb2_proc_msg *t1) + struct usb_proc_msg *t0, struct usb_proc_msg *t1) { - struct usb2_com_super_softc *ssc = sc->sc_super; - struct usb2_com_param_task *task; + struct ucom_super_softc *ssc = sc->sc_super; + struct ucom_param_task *task; mtx_assert(sc->sc_mtx, MA_OWNED); @@ -392,7 +392,7 @@ usb2_com_queue_command(struct usb2_com_softc *sc, * "sc_mtx" mutex. It is safe to update fields in the message * structure after that the message got queued. */ - task = (struct usb2_com_param_task *) + task = (struct ucom_param_task *) usb2_proc_msignal(&ssc->sc_tq, t0, t1); /* Setup callback and softc pointers */ @@ -421,7 +421,7 @@ usb2_com_queue_command(struct usb2_com_softc *sc, } static void -usb2_com_shutdown(struct usb2_com_softc *sc) +usb2_com_shutdown(struct ucom_softc *sc) { struct tty *tp = sc->sc_tty; @@ -443,19 +443,19 @@ usb2_com_shutdown(struct usb2_com_softc *sc) * else: taskqueue is draining or gone */ uint8_t -usb2_com_cfg_is_gone(struct usb2_com_softc *sc) +usb2_com_cfg_is_gone(struct ucom_softc *sc) { - struct usb2_com_super_softc *ssc = sc->sc_super; + struct ucom_super_softc *ssc = sc->sc_super; return (usb2_proc_is_gone(&ssc->sc_tq)); } static void -usb2_com_cfg_start_transfers(struct usb2_proc_msg *_task) +usb2_com_cfg_start_transfers(struct usb_proc_msg *_task) { - struct usb2_com_cfg_task *task = - (struct usb2_com_cfg_task *)_task; - struct usb2_com_softc *sc = task->sc; + struct ucom_cfg_task *task = + (struct ucom_cfg_task *)_task; + struct ucom_softc *sc = task->sc; if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { return; @@ -477,7 +477,7 @@ usb2_com_cfg_start_transfers(struct usb2_proc_msg *_task) } static void -usb2_com_start_transfers(struct usb2_com_softc *sc) +usb2_com_start_transfers(struct ucom_softc *sc) { if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { return; @@ -495,11 +495,11 @@ usb2_com_start_transfers(struct usb2_com_softc *sc) } static void -usb2_com_cfg_open(struct usb2_proc_msg *_task) +usb2_com_cfg_open(struct usb_proc_msg *_task) { - struct usb2_com_cfg_task *task = - (struct usb2_com_cfg_task *)_task; - struct usb2_com_softc *sc = task->sc; + struct ucom_cfg_task *task = + (struct ucom_cfg_task *)_task; + struct ucom_softc *sc = task->sc; DPRINTF("\n"); @@ -523,7 +523,7 @@ usb2_com_cfg_open(struct usb2_proc_msg *_task) static int usb2_com_open(struct tty *tp) { - struct usb2_com_softc *sc = tty_softc(tp); + struct ucom_softc *sc = tty_softc(tp); int error; mtx_assert(sc->sc_mtx, MA_OWNED); @@ -580,11 +580,11 @@ usb2_com_open(struct tty *tp) } static void -usb2_com_cfg_close(struct usb2_proc_msg *_task) +usb2_com_cfg_close(struct usb_proc_msg *_task) { - struct usb2_com_cfg_task *task = - (struct usb2_com_cfg_task *)_task; - struct usb2_com_softc *sc = task->sc; + struct ucom_cfg_task *task = + (struct ucom_cfg_task *)_task; + struct ucom_softc *sc = task->sc; DPRINTF("\n"); @@ -600,7 +600,7 @@ usb2_com_cfg_close(struct usb2_proc_msg *_task) static void usb2_com_close(struct tty *tp) { - struct usb2_com_softc *sc = tty_softc(tp); + struct ucom_softc *sc = tty_softc(tp); mtx_assert(sc->sc_mtx, MA_OWNED); @@ -626,7 +626,7 @@ usb2_com_close(struct tty *tp) static int usb2_com_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) { - struct usb2_com_softc *sc = tty_softc(tp); + struct ucom_softc *sc = tty_softc(tp); int error; mtx_assert(sc->sc_mtx, MA_OWNED); @@ -660,7 +660,7 @@ usb2_com_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) static int usb2_com_modem(struct tty *tp, int sigon, int sigoff) { - struct usb2_com_softc *sc = tty_softc(tp); + struct ucom_softc *sc = tty_softc(tp); uint8_t onoff; mtx_assert(sc->sc_mtx, MA_OWNED); @@ -712,11 +712,11 @@ usb2_com_modem(struct tty *tp, int sigon, int sigoff) } static void -usb2_com_cfg_line_state(struct usb2_proc_msg *_task) +usb2_com_cfg_line_state(struct usb_proc_msg *_task) { - struct usb2_com_cfg_task *task = - (struct usb2_com_cfg_task *)_task; - struct usb2_com_softc *sc = task->sc; + struct ucom_cfg_task *task = + (struct ucom_cfg_task *)_task; + struct ucom_softc *sc = task->sc; uint8_t notch_bits; uint8_t any_bits; uint8_t prev_value; @@ -771,7 +771,7 @@ usb2_com_cfg_line_state(struct usb2_proc_msg *_task) } static void -usb2_com_line_state(struct usb2_com_softc *sc, +usb2_com_line_state(struct ucom_softc *sc, uint8_t set_bits, uint8_t clear_bits) { mtx_assert(sc->sc_mtx, MA_OWNED); @@ -795,7 +795,7 @@ usb2_com_line_state(struct usb2_com_softc *sc, } static void -usb2_com_break(struct usb2_com_softc *sc, uint8_t onoff) +usb2_com_break(struct ucom_softc *sc, uint8_t onoff) { DPRINTF("onoff = %d\n", onoff); @@ -806,7 +806,7 @@ usb2_com_break(struct usb2_com_softc *sc, uint8_t onoff) } static void -usb2_com_dtr(struct usb2_com_softc *sc, uint8_t onoff) +usb2_com_dtr(struct ucom_softc *sc, uint8_t onoff) { DPRINTF("onoff = %d\n", onoff); @@ -817,7 +817,7 @@ usb2_com_dtr(struct usb2_com_softc *sc, uint8_t onoff) } static void -usb2_com_rts(struct usb2_com_softc *sc, uint8_t onoff) +usb2_com_rts(struct ucom_softc *sc, uint8_t onoff) { DPRINTF("onoff = %d\n", onoff); @@ -828,11 +828,11 @@ usb2_com_rts(struct usb2_com_softc *sc, uint8_t onoff) } static void -usb2_com_cfg_status_change(struct usb2_proc_msg *_task) +usb2_com_cfg_status_change(struct usb_proc_msg *_task) { - struct usb2_com_cfg_task *task = - (struct usb2_com_cfg_task *)_task; - struct usb2_com_softc *sc = task->sc; + struct ucom_cfg_task *task = + (struct ucom_cfg_task *)_task; + struct ucom_softc *sc = task->sc; struct tty *tp; uint8_t new_msr; uint8_t new_lsr; @@ -875,7 +875,7 @@ usb2_com_cfg_status_change(struct usb2_proc_msg *_task) } void -usb2_com_status_change(struct usb2_com_softc *sc) +usb2_com_status_change(struct ucom_softc *sc) { mtx_assert(sc->sc_mtx, MA_OWNED); @@ -890,11 +890,11 @@ usb2_com_status_change(struct usb2_com_softc *sc) } static void -usb2_com_cfg_param(struct usb2_proc_msg *_task) +usb2_com_cfg_param(struct usb_proc_msg *_task) { - struct usb2_com_param_task *task = - (struct usb2_com_param_task *)_task; - struct usb2_com_softc *sc = task->sc; + struct ucom_param_task *task = + (struct ucom_param_task *)_task; + struct ucom_softc *sc = task->sc; if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { return; @@ -912,7 +912,7 @@ usb2_com_cfg_param(struct usb2_proc_msg *_task) static int usb2_com_param(struct tty *tp, struct termios *t) { - struct usb2_com_softc *sc = tty_softc(tp); + struct ucom_softc *sc = tty_softc(tp); uint8_t opened; int error; @@ -986,7 +986,7 @@ done: static void usb2_com_outwakeup(struct tty *tp) { - struct usb2_com_softc *sc = tty_softc(tp); + struct ucom_softc *sc = tty_softc(tp); mtx_assert(sc->sc_mtx, MA_OWNED); @@ -1007,10 +1007,10 @@ usb2_com_outwakeup(struct tty *tp) * Else: Data is available. *------------------------------------------------------------------------*/ uint8_t -usb2_com_get_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc, +usb2_com_get_data(struct ucom_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t len, uint32_t *actlen) { - struct usb2_page_search res; + struct usb_page_search res; struct tty *tp = sc->sc_tty; uint32_t cnt; uint32_t offset_orig; @@ -1054,10 +1054,10 @@ usb2_com_get_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc, } void -usb2_com_put_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc, +usb2_com_put_data(struct ucom_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t len) { - struct usb2_page_search res; + struct usb_page_search res; struct tty *tp = sc->sc_tty; char *buf; uint32_t cnt; @@ -1113,7 +1113,7 @@ usb2_com_put_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc, static void usb2_com_free(void *xsc) { - struct usb2_com_softc *sc = xsc; + struct ucom_softc *sc = xsc; mtx_lock(sc->sc_mtx); sc->sc_ttyfreed = 1; diff --git a/sys/dev/usb/serial/usb_serial.h b/sys/dev/usb/serial/usb_serial.h index ddbb65b33e64..6f896ce461e0 100644 --- a/sys/dev/usb/serial/usb_serial.h +++ b/sys/dev/usb/serial/usb_serial.h @@ -79,9 +79,9 @@ #define UCOM_PREFVER UCOM_MODVER #define UCOM_MAXVER 1 -struct usb2_device; -struct usb2_com_softc; -struct usb2_device_request; +struct usb_device; +struct ucom_softc; +struct usb_device_request; struct thread; /* @@ -89,22 +89,22 @@ struct thread; * be called after "usb2_com_cfg_open()" if the device is detached * while it is open! */ -struct usb2_com_callback { - void (*usb2_com_cfg_get_status) (struct usb2_com_softc *, uint8_t *plsr, uint8_t *pmsr); - void (*usb2_com_cfg_set_dtr) (struct usb2_com_softc *, uint8_t); - void (*usb2_com_cfg_set_rts) (struct usb2_com_softc *, uint8_t); - void (*usb2_com_cfg_set_break) (struct usb2_com_softc *, uint8_t); - void (*usb2_com_cfg_param) (struct usb2_com_softc *, struct termios *); - void (*usb2_com_cfg_open) (struct usb2_com_softc *); - void (*usb2_com_cfg_close) (struct usb2_com_softc *); - int (*usb2_com_pre_open) (struct usb2_com_softc *); - int (*usb2_com_pre_param) (struct usb2_com_softc *, struct termios *); - int (*usb2_com_ioctl) (struct usb2_com_softc *, uint32_t, caddr_t, int, struct thread *); - void (*usb2_com_start_read) (struct usb2_com_softc *); - void (*usb2_com_stop_read) (struct usb2_com_softc *); - void (*usb2_com_start_write) (struct usb2_com_softc *); - void (*usb2_com_stop_write) (struct usb2_com_softc *); - void (*usb2_com_tty_name) (struct usb2_com_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit); +struct ucom_callback { + void (*usb2_com_cfg_get_status) (struct ucom_softc *, uint8_t *plsr, uint8_t *pmsr); + void (*usb2_com_cfg_set_dtr) (struct ucom_softc *, uint8_t); + void (*usb2_com_cfg_set_rts) (struct ucom_softc *, uint8_t); + void (*usb2_com_cfg_set_break) (struct ucom_softc *, uint8_t); + void (*usb2_com_cfg_param) (struct ucom_softc *, struct termios *); + void (*usb2_com_cfg_open) (struct ucom_softc *); + void (*usb2_com_cfg_close) (struct ucom_softc *); + int (*usb2_com_pre_open) (struct ucom_softc *); + int (*usb2_com_pre_param) (struct ucom_softc *, struct termios *); + int (*usb2_com_ioctl) (struct ucom_softc *, uint32_t, caddr_t, int, struct thread *); + void (*usb2_com_start_read) (struct ucom_softc *); + void (*usb2_com_stop_read) (struct ucom_softc *); + void (*usb2_com_start_write) (struct ucom_softc *); + void (*usb2_com_stop_write) (struct ucom_softc *); + void (*usb2_com_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit); }; /* Line status register */ @@ -118,22 +118,22 @@ struct usb2_com_callback { #define ULSR_RXRDY 0x01 /* Byte ready in Receive Buffer */ #define ULSR_RCV_MASK 0x1f /* Mask for incoming data or error */ -struct usb2_com_cfg_task { - struct usb2_proc_msg hdr; - struct usb2_com_softc *sc; +struct ucom_cfg_task { + struct usb_proc_msg hdr; + struct ucom_softc *sc; }; -struct usb2_com_param_task { - struct usb2_proc_msg hdr; - struct usb2_com_softc *sc; +struct ucom_param_task { + struct usb_proc_msg hdr; + struct ucom_softc *sc; struct termios termios_copy; }; -struct usb2_com_super_softc { - struct usb2_process sc_tq; +struct ucom_super_softc { + struct usb_process sc_tq; }; -struct usb2_com_softc { +struct ucom_softc { /* * NOTE: To avoid loosing level change information we use two * tasks instead of one for all commands. @@ -145,17 +145,17 @@ struct usb2_com_softc { * OPEN->CLOSE * CLOSE->OPEN */ - struct usb2_com_cfg_task sc_start_task[2]; - struct usb2_com_cfg_task sc_open_task[2]; - struct usb2_com_cfg_task sc_close_task[2]; - struct usb2_com_cfg_task sc_line_state_task[2]; - struct usb2_com_cfg_task sc_status_task[2]; - struct usb2_com_param_task sc_param_task[2]; + struct ucom_cfg_task sc_start_task[2]; + struct ucom_cfg_task sc_open_task[2]; + struct ucom_cfg_task sc_close_task[2]; + struct ucom_cfg_task sc_line_state_task[2]; + struct ucom_cfg_task sc_status_task[2]; + struct ucom_param_task sc_param_task[2]; struct cv sc_cv; /* Used to set "UCOM_FLAG_GP_DATA" flag: */ - struct usb2_proc_msg *sc_last_start_xfer; - const struct usb2_com_callback *sc_callback; - struct usb2_com_super_softc *sc_super; + struct usb_proc_msg *sc_last_start_xfer; + const struct ucom_callback *sc_callback; + struct ucom_super_softc *sc_super; struct tty *sc_tty; struct mtx *sc_mtx; void *sc_parent; @@ -185,15 +185,15 @@ struct usb2_com_softc { #define usb2_com_cfg_do_request(udev,com,req,ptr,flags,timo) \ usb2_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) -int usb2_com_attach(struct usb2_com_super_softc *, - struct usb2_com_softc *, uint32_t, void *, - const struct usb2_com_callback *callback, struct mtx *); -void usb2_com_detach(struct usb2_com_super_softc *, - struct usb2_com_softc *, uint32_t); -void usb2_com_status_change(struct usb2_com_softc *); -uint8_t usb2_com_get_data(struct usb2_com_softc *, struct usb2_page_cache *, +int usb2_com_attach(struct ucom_super_softc *, + struct ucom_softc *, uint32_t, void *, + const struct ucom_callback *callback, struct mtx *); +void usb2_com_detach(struct ucom_super_softc *, + struct ucom_softc *, uint32_t); +void usb2_com_status_change(struct ucom_softc *); +uint8_t usb2_com_get_data(struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t, uint32_t *); -void usb2_com_put_data(struct usb2_com_softc *, struct usb2_page_cache *, +void usb2_com_put_data(struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t); -uint8_t usb2_com_cfg_is_gone(struct usb2_com_softc *); +uint8_t usb2_com_cfg_is_gone(struct ucom_softc *); #endif /* _USB2_SERIAL_H_ */ diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c index f09a4706fa38..530519d8c3f6 100644 --- a/sys/dev/usb/serial/uslcom.c +++ b/sys/dev/usb/serial/uslcom.c @@ -91,11 +91,11 @@ enum { }; struct uslcom_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[USLCOM_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[USLCOM_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint8_t sc_msr; @@ -109,20 +109,20 @@ static device_detach_t uslcom_detach; static usb2_callback_t uslcom_write_callback; static usb2_callback_t uslcom_read_callback; -static void uslcom_open(struct usb2_com_softc *); -static void uslcom_close(struct usb2_com_softc *); -static void uslcom_set_dtr(struct usb2_com_softc *, uint8_t); -static void uslcom_set_rts(struct usb2_com_softc *, uint8_t); -static void uslcom_set_break(struct usb2_com_softc *, uint8_t); -static int uslcom_pre_param(struct usb2_com_softc *, struct termios *); -static void uslcom_param(struct usb2_com_softc *, struct termios *); -static void uslcom_get_status(struct usb2_com_softc *, uint8_t *, uint8_t *); -static void uslcom_start_read(struct usb2_com_softc *); -static void uslcom_stop_read(struct usb2_com_softc *); -static void uslcom_start_write(struct usb2_com_softc *); -static void uslcom_stop_write(struct usb2_com_softc *); - -static const struct usb2_config uslcom_config[USLCOM_N_TRANSFER] = { +static void uslcom_open(struct ucom_softc *); +static void uslcom_close(struct ucom_softc *); +static void uslcom_set_dtr(struct ucom_softc *, uint8_t); +static void uslcom_set_rts(struct ucom_softc *, uint8_t); +static void uslcom_set_break(struct ucom_softc *, uint8_t); +static int uslcom_pre_param(struct ucom_softc *, struct termios *); +static void uslcom_param(struct ucom_softc *, struct termios *); +static void uslcom_get_status(struct ucom_softc *, uint8_t *, uint8_t *); +static void uslcom_start_read(struct ucom_softc *); +static void uslcom_stop_read(struct ucom_softc *); +static void uslcom_start_write(struct ucom_softc *); +static void uslcom_stop_write(struct ucom_softc *); + +static const struct usb_config uslcom_config[USLCOM_N_TRANSFER] = { [USLCOM_BULK_DT_WR] = { .type = UE_BULK, @@ -143,7 +143,7 @@ static const struct usb2_config uslcom_config[USLCOM_N_TRANSFER] = { }, }; -struct usb2_com_callback uslcom_callback = { +struct ucom_callback uslcom_callback = { .usb2_com_cfg_open = &uslcom_open, .usb2_com_cfg_close = &uslcom_close, .usb2_com_cfg_get_status = &uslcom_get_status, @@ -158,7 +158,7 @@ struct usb2_com_callback uslcom_callback = { .usb2_com_stop_write = &uslcom_stop_write, }; -static const struct usb2_device_id uslcom_devs[] = { +static const struct usb_device_id uslcom_devs[] = { { USB_VPI(USB_VENDOR_BALTECH, USB_PRODUCT_BALTECH_CARDREADER, 0) }, { USB_VPI(USB_VENDOR_DYNASTREAM, USB_PRODUCT_DYNASTREAM_ANTDEVBOARD, 0) }, { USB_VPI(USB_VENDOR_JABLOTRON, USB_PRODUCT_JABLOTRON_PC60B, 0) }, @@ -202,7 +202,7 @@ MODULE_VERSION(uslcom, 1); static int uslcom_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); DPRINTFN(11, "\n"); @@ -221,7 +221,7 @@ uslcom_probe(device_t dev) static int uslcom_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uslcom_softc *sc = device_get_softc(dev); int error; @@ -273,10 +273,10 @@ uslcom_detach(device_t dev) } static void -uslcom_open(struct usb2_com_softc *ucom) +uslcom_open(struct ucom_softc *ucom) { struct uslcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; @@ -291,10 +291,10 @@ uslcom_open(struct usb2_com_softc *ucom) } static void -uslcom_close(struct usb2_com_softc *ucom) +uslcom_close(struct ucom_softc *ucom) { struct uslcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; @@ -309,10 +309,10 @@ uslcom_close(struct usb2_com_softc *ucom) } static void -uslcom_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +uslcom_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct uslcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t ctl; DPRINTF("onoff = %d\n", onoff); @@ -333,10 +333,10 @@ uslcom_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uslcom_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +uslcom_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct uslcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t ctl; DPRINTF("onoff = %d\n", onoff); @@ -357,7 +357,7 @@ uslcom_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static int -uslcom_pre_param(struct usb2_com_softc *ucom, struct termios *t) +uslcom_pre_param(struct ucom_softc *ucom, struct termios *t) { if (t->c_ospeed <= 0 || t->c_ospeed > 921600) return (EINVAL); @@ -365,10 +365,10 @@ uslcom_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uslcom_param(struct usb2_com_softc *ucom, struct termios *t) +uslcom_param(struct ucom_softc *ucom, struct termios *t) { struct uslcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t data; DPRINTF("\n"); @@ -424,7 +424,7 @@ uslcom_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uslcom_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +uslcom_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct uslcom_softc *sc = ucom->sc_parent; @@ -435,10 +435,10 @@ uslcom_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) } static void -uslcom_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uslcom_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uslcom_softc *sc = ucom->sc_parent; - struct usb2_device_request req; + struct usb_device_request req; uint16_t brk = onoff ? USLCOM_BREAK_ON : USLCOM_BREAK_OFF; req.bmRequestType = USLCOM_WRITE; @@ -454,7 +454,7 @@ uslcom_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uslcom_write_callback(struct usb2_xfer *xfer) +uslcom_write_callback(struct usb_xfer *xfer) { struct uslcom_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -484,7 +484,7 @@ tr_setup: } static void -uslcom_read_callback(struct usb2_xfer *xfer) +uslcom_read_callback(struct usb_xfer *xfer) { struct uslcom_softc *sc = xfer->priv_sc; @@ -509,7 +509,7 @@ tr_setup: } static void -uslcom_start_read(struct usb2_com_softc *ucom) +uslcom_start_read(struct ucom_softc *ucom) { struct uslcom_softc *sc = ucom->sc_parent; @@ -518,7 +518,7 @@ uslcom_start_read(struct usb2_com_softc *ucom) } static void -uslcom_stop_read(struct usb2_com_softc *ucom) +uslcom_stop_read(struct ucom_softc *ucom) { struct uslcom_softc *sc = ucom->sc_parent; @@ -527,7 +527,7 @@ uslcom_stop_read(struct usb2_com_softc *ucom) } static void -uslcom_start_write(struct usb2_com_softc *ucom) +uslcom_start_write(struct ucom_softc *ucom) { struct uslcom_softc *sc = ucom->sc_parent; @@ -535,7 +535,7 @@ uslcom_start_write(struct usb2_com_softc *ucom) } static void -uslcom_stop_write(struct usb2_com_softc *ucom) +uslcom_stop_write(struct ucom_softc *ucom) { struct uslcom_softc *sc = ucom->sc_parent; diff --git a/sys/dev/usb/serial/uvisor.c b/sys/dev/usb/serial/uvisor.c index efab25f23d7d..3a9fea58252e 100644 --- a/sys/dev/usb/serial/uvisor.c +++ b/sys/dev/usb/serial/uvisor.c @@ -155,11 +155,11 @@ enum { }; struct uvisor_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UVISOR_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UVISOR_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint16_t sc_flag; @@ -181,16 +181,16 @@ static device_detach_t uvisor_detach; static usb2_callback_t uvisor_write_callback; static usb2_callback_t uvisor_read_callback; -static usb2_error_t uvisor_init(struct uvisor_softc *, struct usb2_device *, - struct usb2_config *); -static void uvisor_cfg_open(struct usb2_com_softc *); -static void uvisor_cfg_close(struct usb2_com_softc *); -static void uvisor_start_read(struct usb2_com_softc *); -static void uvisor_stop_read(struct usb2_com_softc *); -static void uvisor_start_write(struct usb2_com_softc *); -static void uvisor_stop_write(struct usb2_com_softc *); +static usb2_error_t uvisor_init(struct uvisor_softc *, struct usb_device *, + struct usb_config *); +static void uvisor_cfg_open(struct ucom_softc *); +static void uvisor_cfg_close(struct ucom_softc *); +static void uvisor_start_read(struct ucom_softc *); +static void uvisor_stop_read(struct ucom_softc *); +static void uvisor_start_write(struct ucom_softc *); +static void uvisor_stop_write(struct ucom_softc *); -static const struct usb2_config uvisor_config[UVISOR_N_TRANSFER] = { +static const struct usb_config uvisor_config[UVISOR_N_TRANSFER] = { [UVISOR_BULK_DT_WR] = { .type = UE_BULK, @@ -211,7 +211,7 @@ static const struct usb2_config uvisor_config[UVISOR_N_TRANSFER] = { }, }; -static const struct usb2_com_callback uvisor_callback = { +static const struct ucom_callback uvisor_callback = { .usb2_com_cfg_open = &uvisor_cfg_open, .usb2_com_cfg_close = &uvisor_cfg_close, .usb2_com_start_read = &uvisor_start_read, @@ -239,7 +239,7 @@ DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0); MODULE_DEPEND(uvisor, ucom, 1, 1, 1); MODULE_DEPEND(uvisor, usb, 1, 1, 1); -static const struct usb2_device_id uvisor_devs[] = { +static const struct usb_device_id uvisor_devs[] = { {USB_VPI(USB_VENDOR_ACEECA, USB_PRODUCT_ACEECA_MEZ1000, UVISOR_FLAG_PALM4)}, {USB_VPI(USB_VENDOR_GARMIN, USB_PRODUCT_GARMIN_IQUE_3600, UVISOR_FLAG_PALM4)}, {USB_VPI(USB_VENDOR_FOSSIL, USB_PRODUCT_FOSSIL_WRISTPDA, UVISOR_FLAG_PALM4)}, @@ -271,7 +271,7 @@ static const struct usb2_device_id uvisor_devs[] = { static int uvisor_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -288,9 +288,9 @@ uvisor_probe(device_t dev) static int uvisor_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uvisor_softc *sc = device_get_softc(dev); - struct usb2_config uvisor_config_copy[UVISOR_N_TRANSFER]; + struct usb_config uvisor_config_copy[UVISOR_N_TRANSFER]; int error; DPRINTF("sc=%p\n", sc); @@ -356,10 +356,10 @@ uvisor_detach(device_t dev) } static usb2_error_t -uvisor_init(struct uvisor_softc *sc, struct usb2_device *udev, struct usb2_config *config) +uvisor_init(struct uvisor_softc *sc, struct usb_device *udev, struct usb_config *config) { usb2_error_t err = 0; - struct usb2_device_request req; + struct usb_device_request req; struct uvisor_connection_info coninfo; struct uvisor_palm_connection_info pconinfo; uint16_t actlen; @@ -502,17 +502,17 @@ done: } static void -uvisor_cfg_open(struct usb2_com_softc *ucom) +uvisor_cfg_open(struct ucom_softc *ucom) { return; } static void -uvisor_cfg_close(struct usb2_com_softc *ucom) +uvisor_cfg_close(struct ucom_softc *ucom) { struct uvisor_softc *sc = ucom->sc_parent; uint8_t buffer[UVISOR_CONNECTION_INFO_SIZE]; - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; req.bmRequestType = UT_READ_VENDOR_ENDPOINT; /* XXX read? */ @@ -530,7 +530,7 @@ uvisor_cfg_close(struct usb2_com_softc *ucom) } static void -uvisor_start_read(struct usb2_com_softc *ucom) +uvisor_start_read(struct ucom_softc *ucom) { struct uvisor_softc *sc = ucom->sc_parent; @@ -538,7 +538,7 @@ uvisor_start_read(struct usb2_com_softc *ucom) } static void -uvisor_stop_read(struct usb2_com_softc *ucom) +uvisor_stop_read(struct ucom_softc *ucom) { struct uvisor_softc *sc = ucom->sc_parent; @@ -546,7 +546,7 @@ uvisor_stop_read(struct usb2_com_softc *ucom) } static void -uvisor_start_write(struct usb2_com_softc *ucom) +uvisor_start_write(struct ucom_softc *ucom) { struct uvisor_softc *sc = ucom->sc_parent; @@ -554,7 +554,7 @@ uvisor_start_write(struct usb2_com_softc *ucom) } static void -uvisor_stop_write(struct usb2_com_softc *ucom) +uvisor_stop_write(struct ucom_softc *ucom) { struct uvisor_softc *sc = ucom->sc_parent; @@ -562,7 +562,7 @@ uvisor_stop_write(struct usb2_com_softc *ucom) } static void -uvisor_write_callback(struct usb2_xfer *xfer) +uvisor_write_callback(struct usb_xfer *xfer) { struct uvisor_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -590,7 +590,7 @@ tr_setup: } static void -uvisor_read_callback(struct usb2_xfer *xfer) +uvisor_read_callback(struct usb_xfer *xfer) { struct uvisor_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/serial/uvscom.c b/sys/dev/usb/serial/uvscom.c index a784ec47aabb..0fb7792902c8 100644 --- a/sys/dev/usb/serial/uvscom.c +++ b/sys/dev/usb/serial/uvscom.c @@ -130,11 +130,11 @@ enum { }; struct uvscom_softc { - struct usb2_com_super_softc sc_super_ucom; - struct usb2_com_softc sc_ucom; + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom; - struct usb2_xfer *sc_xfer[UVSCOM_N_TRANSFER]; - struct usb2_device *sc_udev; + struct usb_xfer *sc_xfer[UVSCOM_N_TRANSFER]; + struct usb_device *sc_udev; struct mtx sc_mtx; uint16_t sc_line; /* line control register */ @@ -156,24 +156,24 @@ static usb2_callback_t uvscom_write_callback; static usb2_callback_t uvscom_read_callback; static usb2_callback_t uvscom_intr_callback; -static void uvscom_cfg_set_dtr(struct usb2_com_softc *, uint8_t); -static void uvscom_cfg_set_rts(struct usb2_com_softc *, uint8_t); -static void uvscom_cfg_set_break(struct usb2_com_softc *, uint8_t); -static int uvscom_pre_param(struct usb2_com_softc *, struct termios *); -static void uvscom_cfg_param(struct usb2_com_softc *, struct termios *); -static int uvscom_pre_open(struct usb2_com_softc *); -static void uvscom_cfg_open(struct usb2_com_softc *); -static void uvscom_cfg_close(struct usb2_com_softc *); -static void uvscom_start_read(struct usb2_com_softc *); -static void uvscom_stop_read(struct usb2_com_softc *); -static void uvscom_start_write(struct usb2_com_softc *); -static void uvscom_stop_write(struct usb2_com_softc *); -static void uvscom_cfg_get_status(struct usb2_com_softc *, uint8_t *, +static void uvscom_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void uvscom_cfg_set_rts(struct ucom_softc *, uint8_t); +static void uvscom_cfg_set_break(struct ucom_softc *, uint8_t); +static int uvscom_pre_param(struct ucom_softc *, struct termios *); +static void uvscom_cfg_param(struct ucom_softc *, struct termios *); +static int uvscom_pre_open(struct ucom_softc *); +static void uvscom_cfg_open(struct ucom_softc *); +static void uvscom_cfg_close(struct ucom_softc *); +static void uvscom_start_read(struct ucom_softc *); +static void uvscom_stop_read(struct ucom_softc *); +static void uvscom_start_write(struct ucom_softc *); +static void uvscom_stop_write(struct ucom_softc *); +static void uvscom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); static void uvscom_cfg_write(struct uvscom_softc *, uint8_t, uint16_t); static uint16_t uvscom_cfg_read_status(struct uvscom_softc *); -static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = { +static const struct usb_config uvscom_config[UVSCOM_N_TRANSFER] = { [UVSCOM_BULK_DT_WR] = { .type = UE_BULK, @@ -203,7 +203,7 @@ static const struct usb2_config uvscom_config[UVSCOM_N_TRANSFER] = { }, }; -static const struct usb2_com_callback uvscom_callback = { +static const struct ucom_callback uvscom_callback = { .usb2_com_cfg_get_status = &uvscom_cfg_get_status, .usb2_com_cfg_set_dtr = &uvscom_cfg_set_dtr, .usb2_com_cfg_set_rts = &uvscom_cfg_set_rts, @@ -219,7 +219,7 @@ static const struct usb2_com_callback uvscom_callback = { .usb2_com_stop_write = &uvscom_stop_write, }; -static const struct usb2_device_id uvscom_devs[] = { +static const struct usb_device_id uvscom_devs[] = { /* SUNTAC U-Cable type A4 */ {USB_VPI(USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_AS144L4, 0)}, /* SUNTAC U-Cable type D2 */ @@ -255,7 +255,7 @@ MODULE_VERSION(uvscom, UVSCOM_MODVER); static int uvscom_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -272,7 +272,7 @@ uvscom_probe(device_t dev) static int uvscom_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct uvscom_softc *sc = device_get_softc(dev); int error; @@ -338,7 +338,7 @@ uvscom_detach(device_t dev) } static void -uvscom_write_callback(struct usb2_xfer *xfer) +uvscom_write_callback(struct usb_xfer *xfer) { struct uvscom_softc *sc = xfer->priv_sc; uint32_t actlen; @@ -366,7 +366,7 @@ tr_setup: } static void -uvscom_read_callback(struct usb2_xfer *xfer) +uvscom_read_callback(struct usb_xfer *xfer) { struct uvscom_softc *sc = xfer->priv_sc; @@ -391,7 +391,7 @@ tr_setup: } static void -uvscom_intr_callback(struct usb2_xfer *xfer) +uvscom_intr_callback(struct usb_xfer *xfer) { struct uvscom_softc *sc = xfer->priv_sc; uint8_t buf[2]; @@ -444,7 +444,7 @@ tr_setup: } static void -uvscom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) +uvscom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { struct uvscom_softc *sc = ucom->sc_parent; @@ -459,7 +459,7 @@ uvscom_cfg_set_dtr(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uvscom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) +uvscom_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) { struct uvscom_softc *sc = ucom->sc_parent; @@ -474,7 +474,7 @@ uvscom_cfg_set_rts(struct usb2_com_softc *ucom, uint8_t onoff) } static void -uvscom_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) +uvscom_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) { struct uvscom_softc *sc = ucom->sc_parent; @@ -489,7 +489,7 @@ uvscom_cfg_set_break(struct usb2_com_softc *ucom, uint8_t onoff) } static int -uvscom_pre_param(struct usb2_com_softc *ucom, struct termios *t) +uvscom_pre_param(struct ucom_softc *ucom, struct termios *t) { switch (t->c_ospeed) { case B150: @@ -510,7 +510,7 @@ uvscom_pre_param(struct usb2_com_softc *ucom, struct termios *t) } static void -uvscom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) +uvscom_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct uvscom_softc *sc = ucom->sc_parent; uint16_t value; @@ -592,7 +592,7 @@ uvscom_cfg_param(struct usb2_com_softc *ucom, struct termios *t) } static int -uvscom_pre_open(struct usb2_com_softc *ucom) +uvscom_pre_open(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -608,7 +608,7 @@ uvscom_pre_open(struct usb2_com_softc *ucom) } static void -uvscom_cfg_open(struct usb2_com_softc *ucom) +uvscom_cfg_open(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -618,7 +618,7 @@ uvscom_cfg_open(struct usb2_com_softc *ucom) } static void -uvscom_cfg_close(struct usb2_com_softc *ucom) +uvscom_cfg_close(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -628,7 +628,7 @@ uvscom_cfg_close(struct usb2_com_softc *ucom) } static void -uvscom_start_read(struct usb2_com_softc *ucom) +uvscom_start_read(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -636,7 +636,7 @@ uvscom_start_read(struct usb2_com_softc *ucom) } static void -uvscom_stop_read(struct usb2_com_softc *ucom) +uvscom_stop_read(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -644,7 +644,7 @@ uvscom_stop_read(struct usb2_com_softc *ucom) } static void -uvscom_start_write(struct usb2_com_softc *ucom) +uvscom_start_write(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -652,7 +652,7 @@ uvscom_start_write(struct usb2_com_softc *ucom) } static void -uvscom_stop_write(struct usb2_com_softc *ucom) +uvscom_stop_write(struct ucom_softc *ucom) { struct uvscom_softc *sc = ucom->sc_parent; @@ -660,7 +660,7 @@ uvscom_stop_write(struct usb2_com_softc *ucom) } static void -uvscom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) +uvscom_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct uvscom_softc *sc = ucom->sc_parent; @@ -671,7 +671,7 @@ uvscom_cfg_get_status(struct usb2_com_softc *ucom, uint8_t *lsr, uint8_t *msr) static void uvscom_cfg_write(struct uvscom_softc *sc, uint8_t index, uint16_t value) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -691,7 +691,7 @@ uvscom_cfg_write(struct uvscom_softc *sc, uint8_t index, uint16_t value) static uint16_t uvscom_cfg_read_status(struct uvscom_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint8_t data[2]; diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index f66573b62a81..84ad48d40be8 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -973,9 +973,9 @@ struct umass_softc { umass_cbi_sbl_t sbl; /* status block */ device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; struct cam_sim *sc_sim; /* SCSI Interface Module */ - struct usb2_xfer *sc_xfer[UMASS_T_MAX]; + struct usb_xfer *sc_xfer[UMASS_T_MAX]; /* * The command transform function is used to convert the SCSI @@ -1032,13 +1032,13 @@ static usb2_callback_t umass_t_cbi_status_callback; static void umass_cancel_ccb(struct umass_softc *); static void umass_init_shuttle(struct umass_softc *); static void umass_reset(struct umass_softc *); -static void umass_t_bbb_data_clear_stall_callback(struct usb2_xfer *, +static void umass_t_bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); static void umass_command_start(struct umass_softc *, uint8_t, void *, uint32_t, uint32_t, umass_callback_t *, union ccb *); static uint8_t umass_bbb_get_max_lun(struct umass_softc *); static void umass_cbi_start_status(struct umass_softc *); -static void umass_t_cbi_data_clear_stall_callback(struct usb2_xfer *, +static void umass_t_cbi_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); static int umass_cam_attach_sim(struct umass_softc *); static void umass_cam_rescan_callback(struct cam_periph *, union ccb *); @@ -1070,13 +1070,13 @@ static void umass_dump_buffer(struct umass_softc *, uint8_t *, uint32_t, uint32_t); #endif -struct usb2_config umass_bbb_config[UMASS_T_BBB_MAX] = { +struct usb_config umass_bbb_config[UMASS_T_BBB_MAX] = { [UMASS_T_BBB_RESET1] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_bbb_reset1_callback, .timeout = 5000, /* 5 seconds */ .interval = 500, /* 500 milliseconds */ @@ -1086,7 +1086,7 @@ struct usb2_config umass_bbb_config[UMASS_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_bbb_reset2_callback, .timeout = 5000, /* 5 seconds */ .interval = 50, /* 50 milliseconds */ @@ -1096,7 +1096,7 @@ struct usb2_config umass_bbb_config[UMASS_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_bbb_reset3_callback, .timeout = 5000, /* 5 seconds */ .interval = 50, /* 50 milliseconds */ @@ -1125,7 +1125,7 @@ struct usb2_config umass_bbb_config[UMASS_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_bbb_data_rd_cs_callback, .timeout = 5000, /* 5 seconds */ }, @@ -1144,7 +1144,7 @@ struct usb2_config umass_bbb_config[UMASS_T_BBB_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_bbb_data_wr_cs_callback, .timeout = 5000, /* 5 seconds */ }, @@ -1160,13 +1160,13 @@ struct usb2_config umass_bbb_config[UMASS_T_BBB_MAX] = { }, }; -struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { +struct usb_config umass_cbi_config[UMASS_T_CBI_MAX] = { [UMASS_T_CBI_RESET1] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = (sizeof(struct usb2_device_request) + + .bufsize = (sizeof(struct usb_device_request) + UMASS_CBI_DIAGNOSTIC_CMDLEN), .callback = &umass_t_cbi_reset1_callback, .timeout = 5000, /* 5 seconds */ @@ -1177,7 +1177,7 @@ struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_cbi_reset2_callback, .timeout = 5000, /* 5 seconds */ .interval = 50, /* 50 milliseconds */ @@ -1187,7 +1187,7 @@ struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_cbi_reset3_callback, .timeout = 5000, /* 5 seconds */ .interval = 50, /* 50 milliseconds */ @@ -1197,7 +1197,7 @@ struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = (sizeof(struct usb2_device_request) + + .bufsize = (sizeof(struct usb_device_request) + UMASS_MAX_CMDLEN), .callback = &umass_t_cbi_command_callback, .timeout = 5000, /* 5 seconds */ @@ -1217,7 +1217,7 @@ struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_cbi_data_rd_cs_callback, .timeout = 5000, /* 5 seconds */ }, @@ -1236,7 +1236,7 @@ struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_cbi_data_wr_cs_callback, .timeout = 5000, /* 5 seconds */ }, @@ -1255,7 +1255,7 @@ struct usb2_config umass_cbi_config[UMASS_T_CBI_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &umass_t_cbi_reset4_callback, .timeout = 5000, /* ms */ }, @@ -1295,9 +1295,9 @@ MODULE_DEPEND(umass, cam, 1, 1, 1); */ static uint16_t -umass_get_proto(struct usb2_interface *iface) +umass_get_proto(struct usb_interface *iface) { - struct usb2_interface_descriptor *id; + struct usb_interface_descriptor *id; uint16_t retval; retval = 0; @@ -1351,7 +1351,7 @@ done: * devices supported. */ static struct umass_probe_proto -umass_probe_proto(device_t dev, struct usb2_attach_arg *uaa) +umass_probe_proto(device_t dev, struct usb_attach_arg *uaa) { const struct umass_devdescr *udd = umass_devdescr; struct umass_probe_proto ret; @@ -1425,7 +1425,7 @@ done: static int umass_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct umass_probe_proto temp; if (uaa->usb_mode != USB_MODE_HOST) { @@ -1444,9 +1444,9 @@ static int umass_attach(device_t dev) { struct umass_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct umass_probe_proto temp = umass_probe_proto(dev, uaa); - struct usb2_interface_descriptor *id; + struct usb_interface_descriptor *id; int32_t err; /* @@ -1635,7 +1635,7 @@ umass_detach(device_t dev) static void umass_init_shuttle(struct umass_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint8_t status[2] = {0, 0}; @@ -1704,7 +1704,7 @@ umass_cancel_ccb(struct umass_softc *sc) } static void -umass_tr_error(struct usb2_xfer *xfer) +umass_tr_error(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; @@ -1721,10 +1721,10 @@ umass_tr_error(struct usb2_xfer *xfer) */ static void -umass_t_bbb_reset1_callback(struct usb2_xfer *xfer) +umass_t_bbb_reset1_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -1770,21 +1770,21 @@ umass_t_bbb_reset1_callback(struct usb2_xfer *xfer) } static void -umass_t_bbb_reset2_callback(struct usb2_xfer *xfer) +umass_t_bbb_reset2_callback(struct usb_xfer *xfer) { umass_t_bbb_data_clear_stall_callback(xfer, UMASS_T_BBB_RESET3, UMASS_T_BBB_DATA_READ); } static void -umass_t_bbb_reset3_callback(struct usb2_xfer *xfer) +umass_t_bbb_reset3_callback(struct usb_xfer *xfer) { umass_t_bbb_data_clear_stall_callback(xfer, UMASS_T_BBB_COMMAND, UMASS_T_BBB_DATA_WRITE); } static void -umass_t_bbb_data_clear_stall_callback(struct usb2_xfer *xfer, +umass_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer) { @@ -1810,7 +1810,7 @@ tr_transferred: } static void -umass_t_bbb_command_callback(struct usb2_xfer *xfer) +umass_t_bbb_command_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; union ccb *ccb = sc->sc_transfer.ccb; @@ -1892,7 +1892,7 @@ umass_t_bbb_command_callback(struct usb2_xfer *xfer) } static void -umass_t_bbb_data_read_callback(struct usb2_xfer *xfer) +umass_t_bbb_data_read_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -1943,14 +1943,14 @@ umass_t_bbb_data_read_callback(struct usb2_xfer *xfer) } static void -umass_t_bbb_data_rd_cs_callback(struct usb2_xfer *xfer) +umass_t_bbb_data_rd_cs_callback(struct usb_xfer *xfer) { umass_t_bbb_data_clear_stall_callback(xfer, UMASS_T_BBB_STATUS, UMASS_T_BBB_DATA_READ); } static void -umass_t_bbb_data_write_callback(struct usb2_xfer *xfer) +umass_t_bbb_data_write_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -2001,14 +2001,14 @@ umass_t_bbb_data_write_callback(struct usb2_xfer *xfer) } static void -umass_t_bbb_data_wr_cs_callback(struct usb2_xfer *xfer) +umass_t_bbb_data_wr_cs_callback(struct usb_xfer *xfer) { umass_t_bbb_data_clear_stall_callback(xfer, UMASS_T_BBB_STATUS, UMASS_T_BBB_DATA_WRITE); } static void -umass_t_bbb_status_callback(struct usb2_xfer *xfer) +umass_t_bbb_status_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; union ccb *ccb = sc->sc_transfer.ccb; @@ -2156,7 +2156,7 @@ umass_command_start(struct umass_softc *sc, uint8_t dir, static uint8_t umass_bbb_get_max_lun(struct umass_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t err; uint8_t buf = 0; @@ -2202,10 +2202,10 @@ umass_cbi_start_status(struct umass_softc *sc) } static void -umass_t_cbi_reset1_callback(struct usb2_xfer *xfer) +umass_t_cbi_reset1_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; uint8_t buf[UMASS_CBI_DIAGNOSTIC_CMDLEN]; uint8_t i; @@ -2268,14 +2268,14 @@ umass_t_cbi_reset1_callback(struct usb2_xfer *xfer) } static void -umass_t_cbi_reset2_callback(struct usb2_xfer *xfer) +umass_t_cbi_reset2_callback(struct usb_xfer *xfer) { umass_t_cbi_data_clear_stall_callback(xfer, UMASS_T_CBI_RESET3, UMASS_T_CBI_DATA_READ); } static void -umass_t_cbi_reset3_callback(struct usb2_xfer *xfer) +umass_t_cbi_reset3_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; @@ -2287,14 +2287,14 @@ umass_t_cbi_reset3_callback(struct usb2_xfer *xfer) } static void -umass_t_cbi_reset4_callback(struct usb2_xfer *xfer) +umass_t_cbi_reset4_callback(struct usb_xfer *xfer) { umass_t_cbi_data_clear_stall_callback(xfer, UMASS_T_CBI_COMMAND, UMASS_T_CBI_STATUS); } static void -umass_t_cbi_data_clear_stall_callback(struct usb2_xfer *xfer, +umass_t_cbi_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer) { @@ -2324,11 +2324,11 @@ tr_transferred: } static void -umass_t_cbi_command_callback(struct usb2_xfer *xfer) +umass_t_cbi_command_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; union ccb *ccb = sc->sc_transfer.ccb; - struct usb2_device_request req; + struct usb_device_request req; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -2386,7 +2386,7 @@ umass_t_cbi_command_callback(struct usb2_xfer *xfer) } static void -umass_t_cbi_data_read_callback(struct usb2_xfer *xfer) +umass_t_cbi_data_read_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -2438,14 +2438,14 @@ umass_t_cbi_data_read_callback(struct usb2_xfer *xfer) } static void -umass_t_cbi_data_rd_cs_callback(struct usb2_xfer *xfer) +umass_t_cbi_data_rd_cs_callback(struct usb_xfer *xfer) { umass_t_cbi_data_clear_stall_callback(xfer, UMASS_T_CBI_STATUS, UMASS_T_CBI_DATA_READ); } static void -umass_t_cbi_data_write_callback(struct usb2_xfer *xfer) +umass_t_cbi_data_write_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -2497,14 +2497,14 @@ umass_t_cbi_data_write_callback(struct usb2_xfer *xfer) } static void -umass_t_cbi_data_wr_cs_callback(struct usb2_xfer *xfer) +umass_t_cbi_data_wr_cs_callback(struct usb_xfer *xfer) { umass_t_cbi_data_clear_stall_callback(xfer, UMASS_T_CBI_STATUS, UMASS_T_CBI_DATA_WRITE); } static void -umass_t_cbi_status_callback(struct usb2_xfer *xfer) +umass_t_cbi_status_callback(struct usb_xfer *xfer) { struct umass_softc *sc = xfer->priv_sc; union ccb *ccb = sc->sc_transfer.ccb; diff --git a/sys/dev/usb/storage/urio.c b/sys/dev/usb/storage/urio.c index 3064d223d906..e4baecd76e3a 100644 --- a/sys/dev/usb/storage/urio.c +++ b/sys/dev/usb/storage/urio.c @@ -82,11 +82,11 @@ SYSCTL_INT(_hw_usb_urio, OID_AUTO, debug, CTLFLAG_RW, #define URIO_IFQ_MAXLEN 2 /* units */ struct urio_softc { - struct usb2_fifo_sc sc_fifo; + struct usb_fifo_sc sc_fifo; struct mtx sc_mtx; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_xfer[URIO_T_MAX]; + struct usb_device *sc_udev; + struct usb_xfer *sc_xfer[URIO_T_MAX]; uint8_t sc_flags; #define URIO_FLAG_READ_STALL 0x01 /* read transfer stalled */ @@ -114,7 +114,7 @@ static usb2_fifo_cmd_t urio_stop_write; static usb2_fifo_ioctl_t urio_ioctl; static usb2_fifo_open_t urio_open; -static struct usb2_fifo_methods urio_fifo_methods = { +static struct usb_fifo_methods urio_fifo_methods = { .f_close = &urio_close, .f_ioctl = &urio_ioctl, .f_open = &urio_open, @@ -125,7 +125,7 @@ static struct usb2_fifo_methods urio_fifo_methods = { .basename[0] = "urio", }; -static const struct usb2_config urio_config[URIO_T_MAX] = { +static const struct usb_config urio_config[URIO_T_MAX] = { [URIO_T_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -148,7 +148,7 @@ static const struct usb2_config urio_config[URIO_T_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &urio_write_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -158,7 +158,7 @@ static const struct usb2_config urio_config[URIO_T_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &urio_read_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -187,7 +187,7 @@ MODULE_DEPEND(urio, usb, 1, 1, 1); static int urio_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -205,7 +205,7 @@ urio_probe(device_t dev) static int urio_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct urio_softc *sc = device_get_softc(dev); int error; @@ -242,10 +242,10 @@ detach: } static void -urio_write_callback(struct usb2_xfer *xfer) +urio_write_callback(struct usb_xfer *xfer) { struct urio_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo.fp[USB_FIFO_TX]; + struct usb_fifo *f = sc->sc_fifo.fp[USB_FIFO_TX]; uint32_t actlen; switch (USB_GET_STATE(xfer)) { @@ -274,10 +274,10 @@ urio_write_callback(struct usb2_xfer *xfer) } static void -urio_write_clear_stall_callback(struct usb2_xfer *xfer) +urio_write_clear_stall_callback(struct usb_xfer *xfer) { struct urio_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[URIO_T_WR]; + struct usb_xfer *xfer_other = sc->sc_xfer[URIO_T_WR]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -287,10 +287,10 @@ urio_write_clear_stall_callback(struct usb2_xfer *xfer) } static void -urio_read_callback(struct usb2_xfer *xfer) +urio_read_callback(struct usb_xfer *xfer) { struct urio_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo.fp[USB_FIFO_RX]; + struct usb_fifo *f = sc->sc_fifo.fp[USB_FIFO_RX]; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -319,10 +319,10 @@ urio_read_callback(struct usb2_xfer *xfer) } static void -urio_read_clear_stall_callback(struct usb2_xfer *xfer) +urio_read_clear_stall_callback(struct usb_xfer *xfer) { struct urio_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[URIO_T_RD]; + struct usb_xfer *xfer_other = sc->sc_xfer[URIO_T_RD]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -332,7 +332,7 @@ urio_read_clear_stall_callback(struct usb2_xfer *xfer) } static void -urio_start_read(struct usb2_fifo *fifo) +urio_start_read(struct usb_fifo *fifo) { struct urio_softc *sc = fifo->priv_sc0; @@ -340,7 +340,7 @@ urio_start_read(struct usb2_fifo *fifo) } static void -urio_stop_read(struct usb2_fifo *fifo) +urio_stop_read(struct usb_fifo *fifo) { struct urio_softc *sc = fifo->priv_sc0; @@ -349,7 +349,7 @@ urio_stop_read(struct usb2_fifo *fifo) } static void -urio_start_write(struct usb2_fifo *fifo) +urio_start_write(struct usb_fifo *fifo) { struct urio_softc *sc = fifo->priv_sc0; @@ -357,7 +357,7 @@ urio_start_write(struct usb2_fifo *fifo) } static void -urio_stop_write(struct usb2_fifo *fifo) +urio_stop_write(struct usb_fifo *fifo) { struct urio_softc *sc = fifo->priv_sc0; @@ -366,7 +366,7 @@ urio_stop_write(struct usb2_fifo *fifo) } static int -urio_open(struct usb2_fifo *fifo, int fflags) +urio_open(struct usb_fifo *fifo, int fflags) { struct urio_softc *sc = fifo->priv_sc0; @@ -399,7 +399,7 @@ urio_open(struct usb2_fifo *fifo, int fflags) } static void -urio_close(struct usb2_fifo *fifo, int fflags) +urio_close(struct usb_fifo *fifo, int fflags) { if (fflags & (FREAD | FWRITE)) { usb2_fifo_free_buffer(fifo); @@ -407,10 +407,10 @@ urio_close(struct usb2_fifo *fifo, int fflags) } static int -urio_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, +urio_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { - struct usb2_ctl_request ur; + struct usb_ctl_request ur; struct RioCommand *rio_cmd; int error; diff --git a/sys/dev/usb/storage/ustorage_fs.c b/sys/dev/usb/storage/ustorage_fs.c index 02a21aeda1df..1e4c3740f2c0 100644 --- a/sys/dev/usb/storage/ustorage_fs.c +++ b/sys/dev/usb/storage/ustorage_fs.c @@ -186,8 +186,8 @@ struct ustorage_fs_softc { } sc_transfer; device_t sc_dev; - struct usb2_device *sc_udev; - struct usb2_xfer *sc_xfer[USTORAGE_FS_T_BBB_MAX]; + struct usb_device *sc_udev; + struct usb_xfer *sc_xfer[USTORAGE_FS_T_BBB_MAX]; uint8_t sc_iface_no; /* interface number */ uint8_t sc_last_lun; @@ -254,7 +254,7 @@ DRIVER_MODULE(ustorage_fs, uhub, ustorage_fs_driver, ustorage_fs_devclass, NULL, MODULE_VERSION(ustorage_fs, 0); MODULE_DEPEND(ustorage_fs, usb, 1, 1, 1); -struct usb2_config ustorage_fs_bbb_config[USTORAGE_FS_T_BBB_MAX] = { +struct usb_config ustorage_fs_bbb_config[USTORAGE_FS_T_BBB_MAX] = { [USTORAGE_FS_T_BBB_COMMAND] = { .type = UE_BULK, @@ -314,8 +314,8 @@ struct usb2_config ustorage_fs_bbb_config[USTORAGE_FS_T_BBB_MAX] = { static int ustorage_fs_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface_descriptor *id; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface_descriptor *id; if (uaa->usb_mode != USB_MODE_DEVICE) { return (ENXIO); @@ -339,8 +339,8 @@ static int ustorage_fs_attach(device_t dev) { struct ustorage_fs_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_interface_descriptor *id; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface_descriptor *id; int err; int unit; @@ -463,7 +463,7 @@ ustorage_fs_handle_request(device_t dev, uint16_t offset, uint8_t is_complete) { struct ustorage_fs_softc *sc = device_get_softc(dev); - const struct usb2_device_request *req = preq; + const struct usb_device_request *req = preq; if (!is_complete) { if ((req->bmRequestType == UT_WRITE_CLASS_INTERFACE) && @@ -491,7 +491,7 @@ ustorage_fs_handle_request(device_t dev, } static void -ustorage_fs_t_bbb_command_callback(struct usb2_xfer *xfer) +ustorage_fs_t_bbb_command_callback(struct usb_xfer *xfer) { struct ustorage_fs_softc *sc = xfer->priv_sc; uint32_t tag; @@ -621,7 +621,7 @@ tr_setup: } static void -ustorage_fs_t_bbb_data_dump_callback(struct usb2_xfer *xfer) +ustorage_fs_t_bbb_data_dump_callback(struct usb_xfer *xfer) { struct ustorage_fs_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -673,7 +673,7 @@ tr_setup: } static void -ustorage_fs_t_bbb_data_read_callback(struct usb2_xfer *xfer) +ustorage_fs_t_bbb_data_read_callback(struct usb_xfer *xfer) { struct ustorage_fs_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -726,7 +726,7 @@ tr_setup: } static void -ustorage_fs_t_bbb_data_write_callback(struct usb2_xfer *xfer) +ustorage_fs_t_bbb_data_write_callback(struct usb_xfer *xfer) { struct ustorage_fs_softc *sc = xfer->priv_sc; uint32_t max_bulk = xfer->max_data_length; @@ -788,7 +788,7 @@ tr_setup: } static void -ustorage_fs_t_bbb_status_callback(struct usb2_xfer *xfer) +ustorage_fs_t_bbb_status_callback(struct usb_xfer *xfer) { struct ustorage_fs_softc *sc = xfer->priv_sc; diff --git a/sys/dev/usb/template/usb_template.c b/sys/dev/usb/template/usb_template.c index de704ffa1b36..66c211210e1d 100644 --- a/sys/dev/usb/template/usb_template.c +++ b/sys/dev/usb/template/usb_template.c @@ -54,39 +54,39 @@ MODULE_VERSION(usb_template, 1); /* function prototypes */ -static void usb2_make_raw_desc(struct usb2_temp_setup *, const uint8_t *); -static void usb2_make_endpoint_desc(struct usb2_temp_setup *, - const struct usb2_temp_endpoint_desc *); -static void usb2_make_interface_desc(struct usb2_temp_setup *, - const struct usb2_temp_interface_desc *); -static void usb2_make_config_desc(struct usb2_temp_setup *, - const struct usb2_temp_config_desc *); -static void usb2_make_device_desc(struct usb2_temp_setup *, - const struct usb2_temp_device_desc *); -static uint8_t usb2_hw_ep_match(const struct usb2_hw_ep_profile *, uint8_t, +static void usb2_make_raw_desc(struct usb_temp_setup *, const uint8_t *); +static void usb2_make_endpoint_desc(struct usb_temp_setup *, + const struct usb_temp_endpoint_desc *); +static void usb2_make_interface_desc(struct usb_temp_setup *, + const struct usb_temp_interface_desc *); +static void usb2_make_config_desc(struct usb_temp_setup *, + const struct usb_temp_config_desc *); +static void usb2_make_device_desc(struct usb_temp_setup *, + const struct usb_temp_device_desc *); +static uint8_t usb2_hw_ep_match(const struct usb_hw_ep_profile *, uint8_t, uint8_t); -static uint8_t usb2_hw_ep_find_match(struct usb2_hw_ep_scratch *, - struct usb2_hw_ep_scratch_sub *, uint8_t); -static uint8_t usb2_hw_ep_get_needs(struct usb2_hw_ep_scratch *, uint8_t, +static uint8_t usb2_hw_ep_find_match(struct usb_hw_ep_scratch *, + struct usb_hw_ep_scratch_sub *, uint8_t); +static uint8_t usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *, uint8_t, uint8_t); -static usb2_error_t usb2_hw_ep_resolve(struct usb2_device *, - struct usb2_descriptor *); -static const struct usb2_temp_device_desc *usb2_temp_get_tdd(struct usb2_device *); -static void *usb2_temp_get_device_desc(struct usb2_device *); -static void *usb2_temp_get_qualifier_desc(struct usb2_device *); -static void *usb2_temp_get_config_desc(struct usb2_device *, uint16_t *, +static usb2_error_t usb2_hw_ep_resolve(struct usb_device *, + struct usb_descriptor *); +static const struct usb_temp_device_desc *usb2_temp_get_tdd(struct usb_device *); +static void *usb2_temp_get_device_desc(struct usb_device *); +static void *usb2_temp_get_qualifier_desc(struct usb_device *); +static void *usb2_temp_get_config_desc(struct usb_device *, uint16_t *, uint8_t); -static const void *usb2_temp_get_string_desc(struct usb2_device *, uint16_t, +static const void *usb2_temp_get_string_desc(struct usb_device *, uint16_t, uint8_t); -static const void *usb2_temp_get_vendor_desc(struct usb2_device *, - const struct usb2_device_request *); -static const void *usb2_temp_get_hub_desc(struct usb2_device *); -static usb2_error_t usb2_temp_get_desc(struct usb2_device *, - struct usb2_device_request *, const void **, uint16_t *); -static usb2_error_t usb2_temp_setup(struct usb2_device *, - const struct usb2_temp_device_desc *); -static void usb2_temp_unsetup(struct usb2_device *); -static usb2_error_t usb2_temp_setup_by_index(struct usb2_device *, +static const void *usb2_temp_get_vendor_desc(struct usb_device *, + const struct usb_device_request *); +static const void *usb2_temp_get_hub_desc(struct usb_device *); +static usb2_error_t usb2_temp_get_desc(struct usb_device *, + struct usb_device_request *, const void **, uint16_t *); +static usb2_error_t usb_temp_setup(struct usb_device *, + const struct usb_temp_device_desc *); +static void usb2_temp_unsetup(struct usb_device *); +static usb2_error_t usb2_temp_setup_by_index(struct usb_device *, uint16_t index); static void usb2_temp_init(void *); @@ -97,7 +97,7 @@ static void usb2_temp_init(void *); * USB configuration. *------------------------------------------------------------------------*/ static void -usb2_make_raw_desc(struct usb2_temp_setup *temp, +usb2_make_raw_desc(struct usb_temp_setup *temp, const uint8_t *raw) { void *dst; @@ -114,10 +114,10 @@ usb2_make_raw_desc(struct usb2_temp_setup *temp, /* check if we have got a CDC union descriptor */ - if ((raw[0] >= sizeof(struct usb2_cdc_union_descriptor)) && + if ((raw[0] >= sizeof(struct usb_cdc_union_descriptor)) && (raw[1] == UDESC_CS_INTERFACE) && (raw[2] == UDESCSUB_CDC_UNION)) { - struct usb2_cdc_union_descriptor *ud = (void *)dst; + struct usb_cdc_union_descriptor *ud = (void *)dst; /* update the interface numbers */ @@ -139,10 +139,10 @@ usb2_make_raw_desc(struct usb2_temp_setup *temp, * the USB configuration. *------------------------------------------------------------------------*/ static void -usb2_make_endpoint_desc(struct usb2_temp_setup *temp, - const struct usb2_temp_endpoint_desc *ted) +usb2_make_endpoint_desc(struct usb_temp_setup *temp, + const struct usb_temp_endpoint_desc *ted) { - struct usb2_endpoint_descriptor *ed; + struct usb_endpoint_descriptor *ed; const void **rd; uint16_t old_size; uint16_t mps; @@ -239,11 +239,11 @@ usb2_make_endpoint_desc(struct usb2_temp_setup *temp, * into the USB configuration. *------------------------------------------------------------------------*/ static void -usb2_make_interface_desc(struct usb2_temp_setup *temp, - const struct usb2_temp_interface_desc *tid) +usb2_make_interface_desc(struct usb_temp_setup *temp, + const struct usb_temp_interface_desc *tid) { - struct usb2_interface_descriptor *id; - const struct usb2_temp_endpoint_desc **ted; + struct usb_interface_descriptor *id; + const struct usb_temp_endpoint_desc **ted; const void **rd; uint16_t old_size; @@ -310,11 +310,11 @@ usb2_make_interface_desc(struct usb2_temp_setup *temp, * configuration. *------------------------------------------------------------------------*/ static void -usb2_make_config_desc(struct usb2_temp_setup *temp, - const struct usb2_temp_config_desc *tcd) +usb2_make_config_desc(struct usb_temp_setup *temp, + const struct usb_temp_config_desc *tcd) { - struct usb2_config_descriptor *cd; - const struct usb2_temp_interface_desc **tid; + struct usb_config_descriptor *cd; + const struct usb_temp_interface_desc **tid; uint16_t old_size; /* Reserve memory */ @@ -371,11 +371,11 @@ usb2_make_config_desc(struct usb2_temp_setup *temp, * given USB template device descriptor. *------------------------------------------------------------------------*/ static void -usb2_make_device_desc(struct usb2_temp_setup *temp, - const struct usb2_temp_device_desc *tdd) +usb2_make_device_desc(struct usb_temp_setup *temp, + const struct usb_temp_device_desc *tdd) { - struct usb2_temp_data *utd; - const struct usb2_temp_config_desc **tcd; + struct usb_temp_data *utd; + const struct usb_temp_config_desc **tcd; uint16_t old_size; /* Reserve memory */ @@ -467,7 +467,7 @@ usb2_make_device_desc(struct usb2_temp_setup *temp, * Else: The endpoint profile matches the criterias *------------------------------------------------------------------------*/ static uint8_t -usb2_hw_ep_match(const struct usb2_hw_ep_profile *pf, +usb2_hw_ep_match(const struct usb_hw_ep_profile *pf, uint8_t ep_type, uint8_t ep_dir_in) { if (ep_type == UE_CONTROL) { @@ -496,10 +496,10 @@ usb2_hw_ep_match(const struct usb2_hw_ep_profile *pf, * Else: Failure. No match. *------------------------------------------------------------------------*/ static uint8_t -usb2_hw_ep_find_match(struct usb2_hw_ep_scratch *ues, - struct usb2_hw_ep_scratch_sub *ep, uint8_t is_simplex) +usb2_hw_ep_find_match(struct usb_hw_ep_scratch *ues, + struct usb_hw_ep_scratch_sub *ep, uint8_t is_simplex) { - const struct usb2_hw_ep_profile *pf; + const struct usb_hw_ep_profile *pf; uint16_t distance; uint16_t temp; uint16_t max_frame_size; @@ -611,17 +611,17 @@ usb2_hw_ep_find_match(struct usb2_hw_ep_scratch *ues, * Else: Failure. *------------------------------------------------------------------------*/ static uint8_t -usb2_hw_ep_get_needs(struct usb2_hw_ep_scratch *ues, +usb2_hw_ep_get_needs(struct usb_hw_ep_scratch *ues, uint8_t ep_type, uint8_t is_complete) { - const struct usb2_hw_ep_profile *pf; - struct usb2_hw_ep_scratch_sub *ep_iface; - struct usb2_hw_ep_scratch_sub *ep_curr; - struct usb2_hw_ep_scratch_sub *ep_max; - struct usb2_hw_ep_scratch_sub *ep_end; - struct usb2_descriptor *desc; - struct usb2_interface_descriptor *id; - struct usb2_endpoint_descriptor *ed; + const struct usb_hw_ep_profile *pf; + struct usb_hw_ep_scratch_sub *ep_iface; + struct usb_hw_ep_scratch_sub *ep_curr; + struct usb_hw_ep_scratch_sub *ep_max; + struct usb_hw_ep_scratch_sub *ep_end; + struct usb_descriptor *desc; + struct usb_interface_descriptor *id; + struct usb_endpoint_descriptor *ed; enum usb_dev_speed speed; uint16_t wMaxPacketSize; uint16_t temp; @@ -781,14 +781,14 @@ handle_endpoint_desc: * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -usb2_hw_ep_resolve(struct usb2_device *udev, - struct usb2_descriptor *desc) +usb2_hw_ep_resolve(struct usb_device *udev, + struct usb_descriptor *desc) { - struct usb2_hw_ep_scratch *ues; - struct usb2_hw_ep_scratch_sub *ep; - const struct usb2_hw_ep_profile *pf; - struct usb2_bus_methods *methods; - struct usb2_device_descriptor *dd; + struct usb_hw_ep_scratch *ues; + struct usb_hw_ep_scratch_sub *ep; + const struct usb_hw_ep_profile *pf; + struct usb_bus_methods *methods; + struct usb_device_descriptor *dd; uint16_t mps; if (desc == NULL) { @@ -912,8 +912,8 @@ usb2_hw_ep_resolve(struct usb2_device *udev, * NULL: No USB template device descriptor found. * Else: Pointer to the USB template device descriptor. *------------------------------------------------------------------------*/ -static const struct usb2_temp_device_desc * -usb2_temp_get_tdd(struct usb2_device *udev) +static const struct usb_temp_device_desc * +usb2_temp_get_tdd(struct usb_device *udev) { if (udev->usb2_template_ptr == NULL) { return (NULL); @@ -929,9 +929,9 @@ usb2_temp_get_tdd(struct usb2_device *udev) * Else: Pointer to USB device descriptor. *------------------------------------------------------------------------*/ static void * -usb2_temp_get_device_desc(struct usb2_device *udev) +usb2_temp_get_device_desc(struct usb_device *udev) { - struct usb2_device_descriptor *dd; + struct usb_device_descriptor *dd; if (udev->usb2_template_ptr == NULL) { return (NULL); @@ -952,9 +952,9 @@ usb2_temp_get_device_desc(struct usb2_device *udev) * Else: Pointer to USB device_qualifier descriptor. *------------------------------------------------------------------------*/ static void * -usb2_temp_get_qualifier_desc(struct usb2_device *udev) +usb2_temp_get_qualifier_desc(struct usb_device *udev) { - struct usb2_device_qualifier *dq; + struct usb_device_qualifier *dq; if (udev->usb2_template_ptr == NULL) { return (NULL); @@ -975,11 +975,11 @@ usb2_temp_get_qualifier_desc(struct usb2_device *udev) * Else: Pointer to USB config descriptor having index "index". *------------------------------------------------------------------------*/ static void * -usb2_temp_get_config_desc(struct usb2_device *udev, +usb2_temp_get_config_desc(struct usb_device *udev, uint16_t *pLength, uint8_t index) { - struct usb2_device_descriptor *dd; - struct usb2_config_descriptor *cd; + struct usb_device_descriptor *dd; + struct usb_config_descriptor *cd; uint16_t temp; if (udev->usb2_template_ptr == NULL) { @@ -1015,10 +1015,10 @@ usb2_temp_get_config_desc(struct usb2_device *udev, * Else: Pointer to a vendor descriptor. *------------------------------------------------------------------------*/ static const void * -usb2_temp_get_vendor_desc(struct usb2_device *udev, - const struct usb2_device_request *req) +usb2_temp_get_vendor_desc(struct usb_device *udev, + const struct usb_device_request *req) { - const struct usb2_temp_device_desc *tdd; + const struct usb_temp_device_desc *tdd; tdd = usb2_temp_get_tdd(udev); if (tdd == NULL) { @@ -1038,10 +1038,10 @@ usb2_temp_get_vendor_desc(struct usb2_device *udev, * Else: Pointer to a string descriptor. *------------------------------------------------------------------------*/ static const void * -usb2_temp_get_string_desc(struct usb2_device *udev, +usb2_temp_get_string_desc(struct usb_device *udev, uint16_t lang_id, uint8_t string_index) { - const struct usb2_temp_device_desc *tdd; + const struct usb_temp_device_desc *tdd; tdd = usb2_temp_get_tdd(udev); if (tdd == NULL) { @@ -1061,7 +1061,7 @@ usb2_temp_get_string_desc(struct usb2_device *udev, * Else: Pointer to a USB HUB descriptor. *------------------------------------------------------------------------*/ static const void * -usb2_temp_get_hub_desc(struct usb2_device *udev) +usb2_temp_get_hub_desc(struct usb_device *udev) { return (NULL); /* needs to be implemented */ } @@ -1073,7 +1073,7 @@ usb2_temp_get_hub_desc(struct usb2_device *udev) * endpoint requests. *------------------------------------------------------------------------*/ static usb2_error_t -usb2_temp_get_desc(struct usb2_device *udev, struct usb2_device_request *req, +usb2_temp_get_desc(struct usb_device *udev, struct usb_device_request *req, const void **pPtr, uint16_t *pLength) { const uint8_t *buf; @@ -1166,7 +1166,7 @@ tr_stalled: } /*------------------------------------------------------------------------* - * usb2_temp_setup + * usb_temp_setup * * This function generates USB descriptors according to the given USB * template device descriptor. It will also try to figure out the best @@ -1177,10 +1177,10 @@ tr_stalled: * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -usb2_temp_setup(struct usb2_device *udev, - const struct usb2_temp_device_desc *tdd) +usb_temp_setup(struct usb_device *udev, + const struct usb_temp_device_desc *tdd) { - struct usb2_temp_setup *uts; + struct usb_temp_setup *uts; void *buf; uint8_t n; @@ -1267,7 +1267,7 @@ error: * setup template, if any. *------------------------------------------------------------------------*/ static void -usb2_temp_unsetup(struct usb2_device *udev) +usb2_temp_unsetup(struct usb_device *udev) { if (udev->usb2_template_ptr) { @@ -1278,19 +1278,19 @@ usb2_temp_unsetup(struct usb2_device *udev) } static usb2_error_t -usb2_temp_setup_by_index(struct usb2_device *udev, uint16_t index) +usb2_temp_setup_by_index(struct usb_device *udev, uint16_t index) { usb2_error_t err; switch (index) { case 0: - err = usb2_temp_setup(udev, &usb2_template_msc); + err = usb_temp_setup(udev, &usb2_template_msc); break; case 1: - err = usb2_temp_setup(udev, &usb2_template_cdce); + err = usb_temp_setup(udev, &usb2_template_cdce); break; case 2: - err = usb2_temp_setup(udev, &usb2_template_mtp); + err = usb_temp_setup(udev, &usb2_template_mtp); break; default: return (USB_ERR_INVAL); diff --git a/sys/dev/usb/template/usb_template.h b/sys/dev/usb/template/usb_template.h index 8c36dcecb117..60f733bae142 100644 --- a/sys/dev/usb/template/usb_template.h +++ b/sys/dev/usb/template/usb_template.h @@ -31,20 +31,20 @@ #define _USB_TEMPLATE_H_ typedef const void *(usb2_temp_get_string_desc_t)(uint16_t lang_id, uint8_t string_index); -typedef const void *(usb2_temp_get_vendor_desc_t)(const struct usb2_device_request *req); +typedef const void *(usb2_temp_get_vendor_desc_t)(const struct usb_device_request *req); -struct usb2_temp_packet_size { +struct usb_temp_packet_size { uint16_t mps[USB_SPEED_MAX]; }; -struct usb2_temp_interval { +struct usb_temp_interval { uint8_t bInterval[USB_SPEED_MAX]; }; -struct usb2_temp_endpoint_desc { +struct usb_temp_endpoint_desc { const void **ppRawDesc; - const struct usb2_temp_packet_size *pPacketSize; - const struct usb2_temp_interval *pIntervals; + const struct usb_temp_packet_size *pPacketSize; + const struct usb_temp_interval *pIntervals; /* * If (bEndpointAddress & UE_ADDR) is non-zero the endpoint number * is pre-selected for this endpoint descriptor. Else an endpoint @@ -54,9 +54,9 @@ struct usb2_temp_endpoint_desc { uint8_t bmAttributes; }; -struct usb2_temp_interface_desc { +struct usb_temp_interface_desc { const void **ppRawDesc; - const struct usb2_temp_endpoint_desc **ppEndpoints; + const struct usb_temp_endpoint_desc **ppEndpoints; uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; @@ -64,17 +64,17 @@ struct usb2_temp_interface_desc { uint8_t isAltInterface; }; -struct usb2_temp_config_desc { - const struct usb2_temp_interface_desc **ppIfaceDesc; +struct usb_temp_config_desc { + const struct usb_temp_interface_desc **ppIfaceDesc; uint8_t bmAttributes; uint8_t bMaxPower; uint8_t iConfiguration; }; -struct usb2_temp_device_desc { +struct usb_temp_device_desc { usb2_temp_get_string_desc_t *getStringDesc; usb2_temp_get_vendor_desc_t *getVendorDesc; - const struct usb2_temp_config_desc **ppConfigDesc; + const struct usb_temp_config_desc **ppConfigDesc; uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; @@ -86,17 +86,17 @@ struct usb2_temp_device_desc { uint8_t iSerialNumber; }; -struct usb2_temp_data { - const struct usb2_temp_device_desc *tdd; - struct usb2_device_descriptor udd; /* device descriptor */ - struct usb2_device_qualifier udq; /* device qualifier */ +struct usb_temp_data { + const struct usb_temp_device_desc *tdd; + struct usb_device_descriptor udd; /* device descriptor */ + struct usb_device_qualifier udq; /* device qualifier */ }; /* prototypes */ -extern const struct usb2_temp_device_desc usb2_template_cdce; -extern const struct usb2_temp_device_desc usb2_template_msc; /* Mass Storage Class */ -extern const struct usb2_temp_device_desc usb2_template_mtp; /* Message Transfer +extern const struct usb_temp_device_desc usb2_template_cdce; +extern const struct usb_temp_device_desc usb2_template_msc; /* Mass Storage Class */ +extern const struct usb_temp_device_desc usb2_template_mtp; /* Message Transfer * Protocol */ #endif /* _USB_TEMPLATE_H_ */ diff --git a/sys/dev/usb/template/usb_template_cdce.c b/sys/dev/usb/template/usb_template_cdce.c index 8377348d81cc..b8e0f8a2a821 100644 --- a/sys/dev/usb/template/usb_template_cdce.c +++ b/sys/dev/usb/template/usb_template_cdce.c @@ -118,7 +118,7 @@ USB_MAKE_STRING_DESC(STRING_ETH_SERIAL, string_eth_serial); static usb2_temp_get_string_desc_t eth_get_string_desc; -static const struct usb2_cdc_union_descriptor eth_union_desc = { +static const struct usb_cdc_union_descriptor eth_union_desc = { .bLength = sizeof(eth_union_desc), .bDescriptorType = UDESC_CS_INTERFACE, .bDescriptorSubtype = UDESCSUB_CDC_UNION, @@ -126,7 +126,7 @@ static const struct usb2_cdc_union_descriptor eth_union_desc = { .bSlaveInterface[0] = 1, /* this is automatically updated */ }; -static const struct usb2_cdc_header_descriptor eth_header_desc = { +static const struct usb_cdc_header_descriptor eth_header_desc = { .bLength = sizeof(eth_header_desc), .bDescriptorType = UDESC_CS_INTERFACE, .bDescriptorSubtype = UDESCSUB_CDC_HEADER, @@ -134,7 +134,7 @@ static const struct usb2_cdc_header_descriptor eth_header_desc = { .bcdCDC[1] = 0x01, }; -static const struct usb2_cdc_ethernet_descriptor eth_enf_desc = { +static const struct usb_cdc_ethernet_descriptor eth_enf_desc = { .bLength = sizeof(eth_enf_desc), .bDescriptorType = UDESC_CS_INTERFACE, .bDescriptorSubtype = UDESCSUB_CDC_ENF, @@ -152,17 +152,17 @@ static const void *eth_control_if_desc[] = { NULL, }; -static const struct usb2_temp_packet_size bulk_mps = { +static const struct usb_temp_packet_size bulk_mps = { .mps[USB_SPEED_FULL] = 64, .mps[USB_SPEED_HIGH] = 512, }; -static const struct usb2_temp_packet_size intr_mps = { +static const struct usb_temp_packet_size intr_mps = { .mps[USB_SPEED_FULL] = 8, .mps[USB_SPEED_HIGH] = 8, }; -static const struct usb2_temp_endpoint_desc bulk_in_ep = { +static const struct usb_temp_endpoint_desc bulk_in_ep = { .pPacketSize = &bulk_mps, #ifdef USB_HIP_IN_EP_0 .bEndpointAddress = USB_HIP_IN_EP_0, @@ -172,7 +172,7 @@ static const struct usb2_temp_endpoint_desc bulk_in_ep = { .bmAttributes = UE_BULK, }; -static const struct usb2_temp_endpoint_desc bulk_out_ep = { +static const struct usb_temp_endpoint_desc bulk_out_ep = { .pPacketSize = &bulk_mps, #ifdef USB_HIP_OUT_EP_0 .bEndpointAddress = USB_HIP_OUT_EP_0, @@ -182,18 +182,18 @@ static const struct usb2_temp_endpoint_desc bulk_out_ep = { .bmAttributes = UE_BULK, }; -static const struct usb2_temp_endpoint_desc intr_in_ep = { +static const struct usb_temp_endpoint_desc intr_in_ep = { .pPacketSize = &intr_mps, .bEndpointAddress = UE_DIR_IN, .bmAttributes = UE_INTERRUPT, }; -static const struct usb2_temp_endpoint_desc *eth_intr_endpoints[] = { +static const struct usb_temp_endpoint_desc *eth_intr_endpoints[] = { &intr_in_ep, NULL, }; -static const struct usb2_temp_interface_desc eth_control_interface = { +static const struct usb_temp_interface_desc eth_control_interface = { .ppEndpoints = eth_intr_endpoints, .ppRawDesc = eth_control_if_desc, .bInterfaceClass = UICLASS_CDC, @@ -202,13 +202,13 @@ static const struct usb2_temp_interface_desc eth_control_interface = { .iInterface = STRING_ETH_CONTROL_INDEX, }; -static const struct usb2_temp_endpoint_desc *eth_data_endpoints[] = { +static const struct usb_temp_endpoint_desc *eth_data_endpoints[] = { &bulk_in_ep, &bulk_out_ep, NULL, }; -static const struct usb2_temp_interface_desc eth_data_null_interface = { +static const struct usb_temp_interface_desc eth_data_null_interface = { .ppEndpoints = NULL, /* no endpoints */ .bInterfaceClass = UICLASS_CDC_DATA, .bInterfaceSubClass = 0, @@ -216,7 +216,7 @@ static const struct usb2_temp_interface_desc eth_data_null_interface = { .iInterface = STRING_ETH_DATA_INDEX, }; -static const struct usb2_temp_interface_desc eth_data_interface = { +static const struct usb_temp_interface_desc eth_data_interface = { .ppEndpoints = eth_data_endpoints, .bInterfaceClass = UICLASS_CDC_DATA, .bInterfaceSubClass = UISUBCLASS_DATA, @@ -225,26 +225,26 @@ static const struct usb2_temp_interface_desc eth_data_interface = { .isAltInterface = 1, /* this is an alternate setting */ }; -static const struct usb2_temp_interface_desc *eth_interfaces[] = { +static const struct usb_temp_interface_desc *eth_interfaces[] = { ð_control_interface, ð_data_null_interface, ð_data_interface, NULL, }; -static const struct usb2_temp_config_desc eth_config_desc = { +static const struct usb_temp_config_desc eth_config_desc = { .ppIfaceDesc = eth_interfaces, .bmAttributes = UC_BUS_POWERED, .bMaxPower = 25, /* 50 mA */ .iConfiguration = STRING_ETH_CONFIG_INDEX, }; -static const struct usb2_temp_config_desc *eth_configs[] = { +static const struct usb_temp_config_desc *eth_configs[] = { ð_config_desc, NULL, }; -const struct usb2_temp_device_desc usb2_template_cdce = { +const struct usb_temp_device_desc usb2_template_cdce = { .getStringDesc = ð_get_string_desc, .ppConfigDesc = eth_configs, .idVendor = 0x0001, diff --git a/sys/dev/usb/template/usb_template_msc.c b/sys/dev/usb/template/usb_template_msc.c index 0e043fbf8c6e..8f2e7ba07098 100644 --- a/sys/dev/usb/template/usb_template_msc.c +++ b/sys/dev/usb/template/usb_template_msc.c @@ -97,12 +97,12 @@ USB_MAKE_STRING_DESC(STRING_MSC_SERIAL, string_msc_serial); static usb2_temp_get_string_desc_t msc_get_string_desc; -static const struct usb2_temp_packet_size bulk_mps = { +static const struct usb_temp_packet_size bulk_mps = { .mps[USB_SPEED_FULL] = 64, .mps[USB_SPEED_HIGH] = 512, }; -static const struct usb2_temp_endpoint_desc bulk_in_ep = { +static const struct usb_temp_endpoint_desc bulk_in_ep = { .pPacketSize = &bulk_mps, #ifdef USB_HIP_IN_EP_0 .bEndpointAddress = USB_HIP_IN_EP_0, @@ -112,7 +112,7 @@ static const struct usb2_temp_endpoint_desc bulk_in_ep = { .bmAttributes = UE_BULK, }; -static const struct usb2_temp_endpoint_desc bulk_out_ep = { +static const struct usb_temp_endpoint_desc bulk_out_ep = { .pPacketSize = &bulk_mps, #ifdef USB_HIP_OUT_EP_0 .bEndpointAddress = USB_HIP_OUT_EP_0, @@ -122,13 +122,13 @@ static const struct usb2_temp_endpoint_desc bulk_out_ep = { .bmAttributes = UE_BULK, }; -static const struct usb2_temp_endpoint_desc *msc_data_endpoints[] = { +static const struct usb_temp_endpoint_desc *msc_data_endpoints[] = { &bulk_in_ep, &bulk_out_ep, NULL, }; -static const struct usb2_temp_interface_desc msc_data_interface = { +static const struct usb_temp_interface_desc msc_data_interface = { .ppEndpoints = msc_data_endpoints, .bInterfaceClass = UICLASS_MASS, .bInterfaceSubClass = UISUBCLASS_SCSI, @@ -136,24 +136,24 @@ static const struct usb2_temp_interface_desc msc_data_interface = { .iInterface = STRING_MSC_DATA_INDEX, }; -static const struct usb2_temp_interface_desc *msc_interfaces[] = { +static const struct usb_temp_interface_desc *msc_interfaces[] = { &msc_data_interface, NULL, }; -static const struct usb2_temp_config_desc msc_config_desc = { +static const struct usb_temp_config_desc msc_config_desc = { .ppIfaceDesc = msc_interfaces, .bmAttributes = UC_BUS_POWERED, .bMaxPower = 25, /* 50 mA */ .iConfiguration = STRING_MSC_CONFIG_INDEX, }; -static const struct usb2_temp_config_desc *msc_configs[] = { +static const struct usb_temp_config_desc *msc_configs[] = { &msc_config_desc, NULL, }; -const struct usb2_temp_device_desc usb2_template_msc = { +const struct usb_temp_device_desc usb2_template_msc = { .getStringDesc = &msc_get_string_desc, .ppConfigDesc = msc_configs, .idVendor = 0x0001, diff --git a/sys/dev/usb/template/usb_template_mtp.c b/sys/dev/usb/template/usb_template_mtp.c index c536eeabd241..1cb694f94b6b 100644 --- a/sys/dev/usb/template/usb_template_mtp.c +++ b/sys/dev/usb/template/usb_template_mtp.c @@ -103,17 +103,17 @@ USB_MAKE_STRING_DESC(STRING_MTP_SERIAL, string_mtp_serial); static usb2_temp_get_string_desc_t mtp_get_string_desc; static usb2_temp_get_vendor_desc_t mtp_get_vendor_desc; -static const struct usb2_temp_packet_size bulk_mps = { +static const struct usb_temp_packet_size bulk_mps = { .mps[USB_SPEED_FULL] = 64, .mps[USB_SPEED_HIGH] = 512, }; -static const struct usb2_temp_packet_size intr_mps = { +static const struct usb_temp_packet_size intr_mps = { .mps[USB_SPEED_FULL] = 64, .mps[USB_SPEED_HIGH] = 64, }; -static const struct usb2_temp_endpoint_desc bulk_out_ep = { +static const struct usb_temp_endpoint_desc bulk_out_ep = { .pPacketSize = &bulk_mps, #ifdef USB_HIP_OUT_EP_0 .bEndpointAddress = USB_HIP_OUT_EP_0, @@ -123,13 +123,13 @@ static const struct usb2_temp_endpoint_desc bulk_out_ep = { .bmAttributes = UE_BULK, }; -static const struct usb2_temp_endpoint_desc intr_in_ep = { +static const struct usb_temp_endpoint_desc intr_in_ep = { .pPacketSize = &intr_mps, .bEndpointAddress = UE_DIR_IN, .bmAttributes = UE_INTERRUPT, }; -static const struct usb2_temp_endpoint_desc bulk_in_ep = { +static const struct usb_temp_endpoint_desc bulk_in_ep = { .pPacketSize = &bulk_mps, #ifdef USB_HIP_IN_EP_0 .bEndpointAddress = USB_HIP_IN_EP_0, @@ -139,14 +139,14 @@ static const struct usb2_temp_endpoint_desc bulk_in_ep = { .bmAttributes = UE_BULK, }; -static const struct usb2_temp_endpoint_desc *mtp_data_endpoints[] = { +static const struct usb_temp_endpoint_desc *mtp_data_endpoints[] = { &bulk_in_ep, &bulk_out_ep, &intr_in_ep, NULL, }; -static const struct usb2_temp_interface_desc mtp_data_interface = { +static const struct usb_temp_interface_desc mtp_data_interface = { .ppEndpoints = mtp_data_endpoints, .bInterfaceClass = UICLASS_IMAGE, .bInterfaceSubClass = UISUBCLASS_SIC, /* Still Image Class */ @@ -154,24 +154,24 @@ static const struct usb2_temp_interface_desc mtp_data_interface = { .iInterface = STRING_MTP_DATA_INDEX, }; -static const struct usb2_temp_interface_desc *mtp_interfaces[] = { +static const struct usb_temp_interface_desc *mtp_interfaces[] = { &mtp_data_interface, NULL, }; -static const struct usb2_temp_config_desc mtp_config_desc = { +static const struct usb_temp_config_desc mtp_config_desc = { .ppIfaceDesc = mtp_interfaces, .bmAttributes = UC_BUS_POWERED, .bMaxPower = 25, /* 50 mA */ .iConfiguration = STRING_MTP_CONFIG_INDEX, }; -static const struct usb2_temp_config_desc *mtp_configs[] = { +static const struct usb_temp_config_desc *mtp_configs[] = { &mtp_config_desc, NULL, }; -const struct usb2_temp_device_desc usb2_template_mtp = { +const struct usb_temp_device_desc usb2_template_mtp = { .getStringDesc = &mtp_get_string_desc, .getVendorDesc = &mtp_get_vendor_desc, .ppConfigDesc = mtp_configs, @@ -194,7 +194,7 @@ const struct usb2_temp_device_desc usb2_template_mtp = { * Else: Success. Pointer to vendor descriptor is returned. *------------------------------------------------------------------------*/ static const void * -mtp_get_vendor_desc(const struct usb2_device_request *req) +mtp_get_vendor_desc(const struct usb_device_request *req) { static const uint8_t dummy_desc[0x28] = { 0x28, 0, 0, 0, 0, 1, 4, 0, diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 3d9dcc38c804..ff5e40ec7c4c 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -102,14 +102,14 @@ /* Declaration of USB records */ -struct usb2_device_request { +struct usb_device_request { uByte bmRequestType; uByte bRequest; uWord wValue; uWord wIndex; uWord wLength; } __packed; -typedef struct usb2_device_request usb_device_request_t; +typedef struct usb_device_request usb_device_request_t; #define UT_WRITE 0x00 #define UT_READ 0x80 @@ -226,14 +226,14 @@ typedef struct usb2_device_request usb_device_request_t; #define UHF_C_BH_PORT_RESET 29 #define UHF_FORCE_LINKPM_ACCEPT 30 -struct usb2_descriptor { +struct usb_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; } __packed; -typedef struct usb2_descriptor usb_descriptor_t; +typedef struct usb_descriptor usb_descriptor_t; -struct usb2_device_descriptor { +struct usb_device_descriptor { uByte bLength; uByte bDescriptorType; uWord bcdUSB; @@ -254,19 +254,19 @@ struct usb2_device_descriptor { uByte iSerialNumber; uByte bNumConfigurations; } __packed; -typedef struct usb2_device_descriptor usb_device_descriptor_t; +typedef struct usb_device_descriptor usb_device_descriptor_t; /* Binary Device Object Store (BOS) */ -struct usb2_bos_descriptor { +struct usb_bos_descriptor { uByte bLength; uByte bDescriptorType; uWord wTotalLength; uByte bNumDeviceCaps; } __packed; -typedef struct usb2_bos_descriptor usb_bos_descriptor_t; +typedef struct usb_bos_descriptor usb_bos_descriptor_t; /* Binary Device Object Store Capability */ -struct usb2_bos_cap_descriptor { +struct usb_bos_cap_descriptor { uByte bLength; uByte bDescriptorType; uByte bDevCapabilityType; @@ -277,18 +277,18 @@ struct usb2_bos_cap_descriptor { #define USB_DEVCAP_CONTAINER_ID 0x04 /* data ... */ } __packed; -typedef struct usb2_bos_cap_descriptor usb_bos_cap_descriptor_t; +typedef struct usb_bos_cap_descriptor usb_bos_cap_descriptor_t; -struct usb2_devcap_usb2ext_descriptor { +struct usb_devcap_usb2ext_descriptor { uByte bLength; uByte bDescriptorType; uByte bDevCapabilityType; uByte bmAttributes; #define USB_V2EXT_LPM 0x02 } __packed; -typedef struct usb2_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t; +typedef struct usb_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t; -struct usb2_devcap_ss_descriptor { +struct usb_devcap_ss_descriptor { uByte bLength; uByte bDescriptorType; uByte bDevCapabilityType; @@ -298,16 +298,16 @@ struct usb2_devcap_ss_descriptor { uByte bU1DevExitLat; uByte bU2DevExitLat; } __packed; -typedef struct usb2_devcap_ss_descriptor usb_devcap_ss_descriptor_t; +typedef struct usb_devcap_ss_descriptor usb_devcap_ss_descriptor_t; -struct usb2_devcap_container_id_descriptor { +struct usb_devcap_container_id_descriptor { uByte bLength; uByte bDescriptorType; uByte bDevCapabilityType; uByte bReserved; uByte ContainerID; } __packed; -typedef struct usb2_devcap_container_id_descriptor +typedef struct usb_devcap_container_id_descriptor usb_devcap_container_id_descriptor_t; /* Device class codes */ @@ -324,7 +324,7 @@ typedef struct usb2_devcap_container_id_descriptor #define UDPROTO_BLUETOOTH 0x01 #define UDCLASS_VENDOR 0xff -struct usb2_config_descriptor { +struct usb_config_descriptor { uByte bLength; uByte bDescriptorType; uWord wTotalLength; @@ -339,9 +339,9 @@ struct usb2_config_descriptor { uByte bMaxPower; /* max current in 2 mA units */ #define UC_POWER_FACTOR 2 } __packed; -typedef struct usb2_config_descriptor usb_config_descriptor_t; +typedef struct usb_config_descriptor usb_config_descriptor_t; -struct usb2_interface_descriptor { +struct usb_interface_descriptor { uByte bLength; uByte bDescriptorType; uByte bInterfaceNumber; @@ -352,9 +352,9 @@ struct usb2_interface_descriptor { uByte bInterfaceProtocol; uByte iInterface; } __packed; -typedef struct usb2_interface_descriptor usb_interface_descriptor_t; +typedef struct usb_interface_descriptor usb_interface_descriptor_t; -struct usb2_interface_assoc_descriptor { +struct usb_interface_assoc_descriptor { uByte bLength; uByte bDescriptorType; uByte bFirstInterface; @@ -364,7 +364,7 @@ struct usb2_interface_assoc_descriptor { uByte bFunctionProtocol; uByte iFunction; } __packed; -typedef struct usb2_interface_assoc_descriptor usb_interface_assoc_descriptor_t; +typedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t; /* Interface class codes */ #define UICLASS_UNSPEC 0x00 @@ -455,7 +455,7 @@ typedef struct usb2_interface_assoc_descriptor usb_interface_assoc_descriptor_t; #define UISUBCLASS_XBOX360_CONTROLLER 0x5d #define UIPROTO_XBOX360_GAMEPAD 0x01 -struct usb2_endpoint_descriptor { +struct usb_endpoint_descriptor { uByte bLength; uByte bDescriptorType; uByte bEndpointAddress; @@ -487,25 +487,25 @@ struct usb2_endpoint_descriptor { #define UE_ZERO_MPS 0xFFFF /* for internal use only */ uByte bInterval; } __packed; -typedef struct usb2_endpoint_descriptor usb_endpoint_descriptor_t; +typedef struct usb_endpoint_descriptor usb_endpoint_descriptor_t; -struct usb2_endpoint_ss_comp_descriptor { +struct usb_endpoint_ss_comp_descriptor { uByte bLength; uByte bDescriptorType; uWord bMaxBurst; uByte bmAttributes; uWord wBytesPerInterval; } __packed; -typedef struct usb2_endpoint_ss_comp_descriptor +typedef struct usb_endpoint_ss_comp_descriptor usb_endpoint_ss_comp_descriptor_t; -struct usb2_string_descriptor { +struct usb_string_descriptor { uByte bLength; uByte bDescriptorType; uWord bString[126]; uByte bUnused; } __packed; -typedef struct usb2_string_descriptor usb_string_descriptor_t; +typedef struct usb_string_descriptor usb_string_descriptor_t; #define USB_MAKE_STRING_DESC(m,name) \ struct name { \ @@ -519,7 +519,7 @@ static const struct name name = { \ .bData = { m }, \ } -struct usb2_hub_descriptor { +struct usb_hub_descriptor { uByte bDescLength; uByte bDescriptorType; uByte bNbrPorts; @@ -547,9 +547,9 @@ struct usb2_hub_descriptor { (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1) uByte PortPowerCtrlMask[1]; /* deprecated */ } __packed; -typedef struct usb2_hub_descriptor usb_hub_descriptor_t; +typedef struct usb_hub_descriptor usb_hub_descriptor_t; -struct usb2_hub_ss_descriptor { +struct usb_hub_ss_descriptor { uByte bDescLength; uByte bDescriptorType; uByte bNbrPorts; /* max 15 */ @@ -560,10 +560,10 @@ struct usb2_hub_ss_descriptor { uWord wHubDelay; uByte DeviceRemovable[2]; /* max 15 ports */ } __packed; -typedef struct usb2_hub_ss_descriptor usb_hub_ss_descriptor_t; +typedef struct usb_hub_ss_descriptor usb_hub_ss_descriptor_t; /* minimum HUB descriptor (8-ports maximum) */ -struct usb2_hub_descriptor_min { +struct usb_hub_descriptor_min { uByte bDescLength; uByte bDescriptorType; uByte bNbrPorts; @@ -573,9 +573,9 @@ struct usb2_hub_descriptor_min { uByte DeviceRemovable[1]; uByte PortPowerCtrlMask[1]; } __packed; -typedef struct usb2_hub_descriptor_min usb_hub_descriptor_min_t; +typedef struct usb_hub_descriptor_min usb_hub_descriptor_min_t; -struct usb2_device_qualifier { +struct usb_device_qualifier { uByte bLength; uByte bDescriptorType; uWord bcdUSB; @@ -586,23 +586,23 @@ struct usb2_device_qualifier { uByte bNumConfigurations; uByte bReserved; } __packed; -typedef struct usb2_device_qualifier usb_device_qualifier_t; +typedef struct usb_device_qualifier usb_device_qualifier_t; -struct usb2_otg_descriptor { +struct usb_otg_descriptor { uByte bLength; uByte bDescriptorType; uByte bmAttributes; #define UOTG_SRP 0x01 #define UOTG_HNP 0x02 } __packed; -typedef struct usb2_otg_descriptor usb_otg_descriptor_t; +typedef struct usb_otg_descriptor usb_otg_descriptor_t; /* OTG feature selectors */ #define UOTG_B_HNP_ENABLE 3 #define UOTG_A_HNP_SUPPORT 4 #define UOTG_A_ALT_HNP_SUPPORT 5 -struct usb2_status { +struct usb_status { uWord wStatus; /* Device status flags */ #define UDS_SELF_POWERED 0x0001 @@ -610,17 +610,17 @@ struct usb2_status { /* Endpoint status flags */ #define UES_HALT 0x0001 } __packed; -typedef struct usb2_status usb_status_t; +typedef struct usb_status usb_status_t; -struct usb2_hub_status { +struct usb_hub_status { uWord wHubStatus; #define UHS_LOCAL_POWER 0x0001 #define UHS_OVER_CURRENT 0x0002 uWord wHubChange; } __packed; -typedef struct usb2_hub_status usb_hub_status_t; +typedef struct usb_hub_status usb_hub_status_t; -struct usb2_port_status { +struct usb_port_status { uWord wPortStatus; #define UPS_CURRENT_CONNECT_STATUS 0x0001 #define UPS_PORT_ENABLED 0x0002 @@ -640,6 +640,6 @@ struct usb2_port_status { #define UPS_C_OVERCURRENT_INDICATOR 0x0008 #define UPS_C_PORT_RESET 0x0010 } __packed; -typedef struct usb2_port_status usb_port_status_t; +typedef struct usb_port_status usb_port_status_t; #endif /* _USB2_STANDARD_H_ */ diff --git a/sys/dev/usb/usb_bus.h b/sys/dev/usb/usb_bus.h index 66c2fac3934d..7ad7a2e649a1 100644 --- a/sys/dev/usb/usb_bus.h +++ b/sys/dev/usb/usb_bus.h @@ -32,15 +32,15 @@ * explore process. */ -struct usb2_bus_msg { - struct usb2_proc_msg hdr; - struct usb2_bus *bus; +struct usb_bus_msg { + struct usb_proc_msg hdr; + struct usb_bus *bus; }; /* * The following structure defines the USB statistics structure. */ -struct usb2_bus_stat { +struct usb_bus_stat { uint32_t uds_requests[4]; }; @@ -48,43 +48,43 @@ struct usb2_bus_stat { * The following structure defines an USB BUS. There is one USB BUS * for every Host or Device controller. */ -struct usb2_bus { - struct usb2_bus_stat stats_err; - struct usb2_bus_stat stats_ok; +struct usb_bus { + struct usb_bus_stat stats_err; + struct usb_bus_stat stats_ok; struct root_hold_token *bus_roothold; /* * There are two callback processes. One for Giant locked * callbacks. One for non-Giant locked callbacks. This should * avoid congestion and reduce response time in most cases. */ - struct usb2_process giant_callback_proc; - struct usb2_process non_giant_callback_proc; + struct usb_process giant_callback_proc; + struct usb_process non_giant_callback_proc; /* Explore process */ - struct usb2_process explore_proc; + struct usb_process explore_proc; /* Control request process */ - struct usb2_process control_xfer_proc; + struct usb_process control_xfer_proc; - struct usb2_bus_msg explore_msg[2]; - struct usb2_bus_msg detach_msg[2]; - struct usb2_bus_msg attach_msg[2]; + struct usb_bus_msg explore_msg[2]; + struct usb_bus_msg detach_msg[2]; + struct usb_bus_msg attach_msg[2]; /* * This mutex protects the USB hardware: */ struct mtx bus_mtx; - struct usb2_xfer_queue intr_q; - struct usb2_callout power_wdog; /* power management */ + struct usb_xfer_queue intr_q; + struct usb_callout power_wdog; /* power management */ device_t parent; device_t bdev; /* filled by HC driver */ #if USB_HAVE_BUSDMA - struct usb2_dma_parent_tag dma_parent_tag[1]; - struct usb2_dma_tag dma_tags[USB_BUS_DMA_TAG_MAX]; + struct usb_dma_parent_tag dma_parent_tag[1]; + struct usb_dma_tag dma_tags[USB_BUS_DMA_TAG_MAX]; #endif - struct usb2_bus_methods *methods; /* filled by HC driver */ - struct usb2_device **devices; + struct usb_bus_methods *methods; /* filled by HC driver */ + struct usb_device **devices; usb2_power_mask_t hw_power_state; /* see USB_HW_POWER_XXX */ usb2_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; @@ -99,8 +99,8 @@ struct usb2_bus { uint8_t do_probe; /* set if USB BUS should be re-probed */ union { - struct usb2_hw_ep_scratch hw_ep_scratch[1]; - struct usb2_temp_setup temp_setup[1]; + struct usb_hw_ep_scratch hw_ep_scratch[1]; + struct usb_temp_setup temp_setup[1]; uint8_t data[128]; } scratch[1]; }; diff --git a/sys/dev/usb/usb_busdma.c b/sys/dev/usb/usb_busdma.c index a20dd9da30a0..17f20385cfab 100644 --- a/sys/dev/usb/usb_busdma.c +++ b/sys/dev/usb/usb_busdma.c @@ -42,8 +42,8 @@ #include #if USB_HAVE_BUSDMA -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 *); +static void usb2_dma_tag_create(struct usb_dma_tag *, usb2_size_t, usb2_size_t); +static void usb2_dma_tag_destroy(struct usb_dma_tag *); static void usb2_dma_lock_cb(void *, bus_dma_lock_op_t); static void usb2_pc_alloc_mem_cb(void *, bus_dma_segment_t *, int, int); static void usb2_pc_load_mem_cb(void *, bus_dma_segment_t *, int, int); @@ -58,10 +58,10 @@ static void usb2_pc_common_mem_cb(void *, bus_dma_segment_t *, int, int, * been properly initialized ! *------------------------------------------------------------------------*/ void -usb2_get_page(struct usb2_page_cache *pc, usb2_frlength_t offset, - struct usb2_page_search *res) +usb2_get_page(struct usb_page_cache *pc, usb2_frlength_t offset, + struct usb_page_search *res) { - struct usb2_page *page; + struct usb_page *page; #if USB_HAVE_BUSDMA if (pc->page_start) { @@ -114,10 +114,10 @@ usb2_get_page(struct usb2_page_cache *pc, usb2_frlength_t offset, * usb2_copy_in - copy directly to DMA-able memory *------------------------------------------------------------------------*/ void -usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset, +usb2_copy_in(struct usb_page_cache *cache, usb2_frlength_t offset, const void *ptr, usb2_frlength_t len) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; while (len != 0) { @@ -143,10 +143,10 @@ usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset, *------------------------------------------------------------------------*/ #if USB_HAVE_USER_IO int -usb2_copy_in_user(struct usb2_page_cache *cache, usb2_frlength_t offset, +usb2_copy_in_user(struct usb_page_cache *cache, usb2_frlength_t offset, const void *ptr, usb2_frlength_t len) { - struct usb2_page_search buf_res; + struct usb_page_search buf_res; int error; while (len != 0) { @@ -173,7 +173,7 @@ usb2_copy_in_user(struct usb2_page_cache *cache, usb2_frlength_t offset, *------------------------------------------------------------------------*/ #if USB_HAVE_MBUF struct usb2_m_copy_in_arg { - struct usb2_page_cache *cache; + struct usb_page_cache *cache; usb2_frlength_t dst_offset; }; @@ -188,7 +188,7 @@ usb2_m_copy_in_cb(void *arg, void *src, uint32_t count) } void -usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset, +usb2_m_copy_in(struct usb_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}; @@ -203,10 +203,10 @@ usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset, *------------------------------------------------------------------------*/ #if USB_HAVE_USER_IO int -usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio, +usb2_uiomove(struct usb_page_cache *pc, struct uio *uio, usb2_frlength_t pc_offset, usb2_frlength_t len) { - struct usb2_page_search res; + struct usb_page_search res; int error = 0; while (len != 0) { @@ -236,10 +236,10 @@ usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio, * usb2_copy_out - copy directly from DMA-able memory *------------------------------------------------------------------------*/ void -usb2_copy_out(struct usb2_page_cache *cache, usb2_frlength_t offset, +usb2_copy_out(struct usb_page_cache *cache, usb2_frlength_t offset, void *ptr, usb2_frlength_t len) { - struct usb2_page_search res; + struct usb_page_search res; while (len != 0) { @@ -265,10 +265,10 @@ usb2_copy_out(struct usb2_page_cache *cache, usb2_frlength_t offset, *------------------------------------------------------------------------*/ #if USB_HAVE_USER_IO int -usb2_copy_out_user(struct usb2_page_cache *cache, usb2_frlength_t offset, +usb2_copy_out_user(struct usb_page_cache *cache, usb2_frlength_t offset, void *ptr, usb2_frlength_t len) { - struct usb2_page_search res; + struct usb_page_search res; int error; while (len != 0) { @@ -294,10 +294,10 @@ usb2_copy_out_user(struct usb2_page_cache *cache, usb2_frlength_t offset, * usb2_bzero - zero DMA-able memory *------------------------------------------------------------------------*/ void -usb2_bzero(struct usb2_page_cache *cache, usb2_frlength_t offset, +usb2_bzero(struct usb_page_cache *cache, usb2_frlength_t offset, usb2_frlength_t len) { - struct usb2_page_search res; + struct usb_page_search res; while (len != 0) { @@ -331,7 +331,7 @@ usb2_dma_lock_cb(void *arg, bus_dma_lock_op_t op) * allow multi-segment mappings. Else all mappings are single-segment. *------------------------------------------------------------------------*/ static void -usb2_dma_tag_create(struct usb2_dma_tag *udt, +usb2_dma_tag_create(struct usb_dma_tag *udt, usb2_size_t size, usb2_size_t align) { bus_dma_tag_t tag; @@ -362,7 +362,7 @@ usb2_dma_tag_create(struct usb2_dma_tag *udt, * usb2_dma_tag_free - free a DMA tag *------------------------------------------------------------------------*/ static void -usb2_dma_tag_destroy(struct usb2_dma_tag *udt) +usb2_dma_tag_destroy(struct usb_dma_tag *udt) { bus_dma_tag_destroy(udt->tag); } @@ -394,9 +394,9 @@ static void usb2_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error, uint8_t isload) { - struct usb2_dma_parent_tag *uptag; - struct usb2_page_cache *pc; - struct usb2_page *pg; + struct usb_dma_parent_tag *uptag; + struct usb_page_cache *pc; + struct usb_page *pg; usb2_size_t rem; uint8_t owned; @@ -459,11 +459,11 @@ done: * Else: Failure *------------------------------------------------------------------------*/ uint8_t -usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg, +usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg, usb2_size_t size, usb2_size_t align) { - struct usb2_dma_parent_tag *uptag; - struct usb2_dma_tag *utag; + struct usb_dma_parent_tag *uptag; + struct usb_dma_tag *utag; bus_dmamap_t map; void *ptr; int err; @@ -563,7 +563,7 @@ error: * This function is NULL safe. *------------------------------------------------------------------------*/ void -usb2_pc_free_mem(struct usb2_page_cache *pc) +usb2_pc_free_mem(struct usb_page_cache *pc) { if (pc && pc->buffer) { @@ -583,7 +583,7 @@ usb2_pc_free_mem(struct usb2_page_cache *pc) * Else: Error *------------------------------------------------------------------------*/ uint8_t -usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync) +usb2_pc_load_mem(struct usb_page_cache *pc, usb2_size_t size, uint8_t sync) { /* setup page cache */ pc->page_offset_buf = 0; @@ -594,7 +594,7 @@ usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync) if (size > 0) { if (sync) { - struct usb2_dma_parent_tag *uptag; + struct usb_dma_parent_tag *uptag; int err; uptag = pc->tag_parent; @@ -652,7 +652,7 @@ usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync) * usb2_pc_cpu_invalidate - invalidate CPU cache *------------------------------------------------------------------------*/ void -usb2_pc_cpu_invalidate(struct usb2_page_cache *pc) +usb2_pc_cpu_invalidate(struct usb_page_cache *pc) { if (pc->page_offset_end == pc->page_offset_buf) { /* nothing has been loaded into this page cache! */ @@ -666,7 +666,7 @@ usb2_pc_cpu_invalidate(struct usb2_page_cache *pc) * usb2_pc_cpu_flush - flush CPU cache *------------------------------------------------------------------------*/ void -usb2_pc_cpu_flush(struct usb2_page_cache *pc) +usb2_pc_cpu_flush(struct usb_page_cache *pc) { if (pc->page_offset_end == pc->page_offset_buf) { /* nothing has been loaded into this page cache! */ @@ -684,10 +684,10 @@ usb2_pc_cpu_flush(struct usb2_page_cache *pc) * Else: Failure *------------------------------------------------------------------------*/ uint8_t -usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size) +usb2_pc_dmamap_create(struct usb_page_cache *pc, usb2_size_t size) { - struct usb2_xfer_root *info; - struct usb2_dma_tag *utag; + struct usb_xfer_root *info; + struct usb_dma_tag *utag; /* get info */ info = USB_DMATAG_TO_XROOT(pc->tag_parent); @@ -719,7 +719,7 @@ error: * This function is NULL safe. *------------------------------------------------------------------------*/ void -usb2_pc_dmamap_destroy(struct usb2_page_cache *pc) +usb2_pc_dmamap_destroy(struct usb_page_cache *pc) { if (pc && pc->tag) { bus_dmamap_destroy(pc->tag, pc->map); @@ -731,11 +731,11 @@ usb2_pc_dmamap_destroy(struct usb2_page_cache *pc) /*------------------------------------------------------------------------* * usb2_dma_tag_find - factored out code *------------------------------------------------------------------------*/ -struct usb2_dma_tag * -usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt, +struct usb_dma_tag * +usb2_dma_tag_find(struct usb_dma_parent_tag *udpt, usb2_size_t size, usb2_size_t align) { - struct usb2_dma_tag *udt; + struct usb_dma_tag *udt; uint8_t nudt; USB_ASSERT(align > 0, ("Invalid parameter align = 0!\n")); @@ -767,8 +767,8 @@ usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt, * usb2_dma_tag_setup - initialise USB DMA tags *------------------------------------------------------------------------*/ void -usb2_dma_tag_setup(struct usb2_dma_parent_tag *udpt, - struct usb2_dma_tag *udt, bus_dma_tag_t dmat, +usb2_dma_tag_setup(struct usb_dma_parent_tag *udpt, + struct usb_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx, usb2_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt) { @@ -803,9 +803,9 @@ usb2_dma_tag_setup(struct usb2_dma_parent_tag *udpt, * usb2_bus_tag_unsetup - factored out code *------------------------------------------------------------------------*/ void -usb2_dma_tag_unsetup(struct usb2_dma_parent_tag *udpt) +usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt) { - struct usb2_dma_tag *udt; + struct usb_dma_tag *udt; uint8_t nudt; udt = udpt->utag_first; @@ -834,10 +834,10 @@ usb2_dma_tag_unsetup(struct usb2_dma_parent_tag *udpt) * only called when "dma_refcount" is zero. *------------------------------------------------------------------------*/ void -usb2_bdma_work_loop(struct usb2_xfer_queue *pq) +usb2_bdma_work_loop(struct usb_xfer_queue *pq) { - struct usb2_xfer_root *info; - struct usb2_xfer *xfer; + struct usb_xfer_root *info; + struct usb_xfer *xfer; usb2_frcount_t nframes; xfer = pq->curr; @@ -853,7 +853,7 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq) return; } if (!xfer->flags_int.bdma_setup) { - struct usb2_page *pg; + struct usb_page *pg; usb2_frlength_t frlength_0; uint8_t isread; @@ -961,9 +961,9 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq) * into DMA, if any. *------------------------------------------------------------------------*/ void -usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt) +usb2_bdma_done_event(struct usb_dma_parent_tag *udpt) { - struct usb2_xfer_root *info; + struct usb_xfer_root *info; info = USB_DMATAG_TO_XROOT(udpt); @@ -984,9 +984,9 @@ usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt) * an USB transfer is started. *------------------------------------------------------------------------*/ void -usb2_bdma_pre_sync(struct usb2_xfer *xfer) +usb2_bdma_pre_sync(struct usb_xfer *xfer) { - struct usb2_page_cache *pc; + struct usb_page_cache *pc; usb2_frcount_t nframes; if (xfer->flags_int.isochronous_xfr) { @@ -1017,9 +1017,9 @@ usb2_bdma_pre_sync(struct usb2_xfer *xfer) * an USB transfer is complete. *------------------------------------------------------------------------*/ void -usb2_bdma_post_sync(struct usb2_xfer *xfer) +usb2_bdma_post_sync(struct usb_xfer *xfer) { - struct usb2_page_cache *pc; + struct usb_page_cache *pc; usb2_frcount_t nframes; if (xfer->flags_int.isochronous_xfr) { diff --git a/sys/dev/usb/usb_busdma.h b/sys/dev/usb/usb_busdma.h index 5f198d23532a..3999edb09b3a 100644 --- a/sys/dev/usb/usb_busdma.h +++ b/sys/dev/usb/usb_busdma.h @@ -44,21 +44,21 @@ /* structure prototypes */ -struct usb2_xfer_root; -struct usb2_dma_parent_tag; -struct usb2_dma_tag; +struct usb_xfer_root; +struct usb_dma_parent_tag; +struct usb_dma_tag; /* * The following typedef defines the USB DMA load done callback. */ -typedef void (usb2_dma_callback_t)(struct usb2_dma_parent_tag *udpt); +typedef void (usb2_dma_callback_t)(struct usb_dma_parent_tag *udpt); /* * The following structure defines physical and non kernel virtual * address of a memory page having size USB_PAGE_SIZE. */ -struct usb2_page { +struct usb_page { #if USB_HAVE_BUSDMA bus_size_t physaddr; void *buffer; /* non Kernel Virtual Address */ @@ -70,7 +70,7 @@ struct usb2_page { * pointer and the physical address belonging to an offset in an USB * page cache. */ -struct usb2_page_search { +struct usb_page_search { void *buffer; #if USB_HAVE_BUSDMA bus_size_t physaddr; @@ -82,14 +82,14 @@ struct usb2_page_search { * The following structure is used to keep information about a DMA * memory allocation. */ -struct usb2_page_cache { +struct usb_page_cache { #if USB_HAVE_BUSDMA bus_dma_tag_t tag; bus_dmamap_t map; - struct usb2_page *page_start; + struct usb_page *page_start; #endif - struct usb2_dma_parent_tag *tag_parent; /* always set */ + struct usb_dma_parent_tag *tag_parent; /* always set */ void *buffer; /* virtual buffer pointer */ #if USB_HAVE_BUSDMA usb2_size_t page_offset_buf; @@ -105,71 +105,71 @@ struct usb2_page_cache { * The following structure describes the parent USB DMA tag. */ #if USB_HAVE_BUSDMA -struct usb2_dma_parent_tag { +struct usb_dma_parent_tag { struct cv cv[1]; /* internal condition variable */ bus_dma_tag_t tag; /* always set */ struct mtx *mtx; /* private mutex, always set */ usb2_dma_callback_t *func; /* load complete callback function */ - struct usb2_dma_tag *utag_first;/* pointer to first USB DMA tag */ + struct usb_dma_tag *utag_first;/* pointer to first USB DMA tag */ uint8_t dma_error; /* set if DMA load operation failed */ uint8_t dma_bits; /* number of DMA address lines */ uint8_t utag_max; /* number of USB DMA tags */ }; #else -struct usb2_dma_parent_tag {}; /* empty struct */ +struct usb_dma_parent_tag {}; /* empty struct */ #endif /* * The following structure describes an USB DMA tag. */ #if USB_HAVE_BUSDMA -struct usb2_dma_tag { - struct usb2_dma_parent_tag *tag_parent; +struct usb_dma_tag { + struct usb_dma_parent_tag *tag_parent; bus_dma_tag_t tag; usb2_size_t align; usb2_size_t size; }; #else -struct usb2_dma_tag {}; /* empty struct */ +struct usb_dma_tag {}; /* empty struct */ #endif /* function prototypes */ -int usb2_uiomove(struct usb2_page_cache *pc, struct uio *uio, +int usb2_uiomove(struct usb_page_cache *pc, struct uio *uio, usb2_frlength_t pc_offset, usb2_frlength_t len); -struct usb2_dma_tag *usb2_dma_tag_find(struct usb2_dma_parent_tag *udpt, +struct usb_dma_tag *usb2_dma_tag_find(struct usb_dma_parent_tag *udpt, usb2_size_t size, usb2_size_t align); -uint8_t usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg, +uint8_t usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg, 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 usb2_pc_dmamap_create(struct usb_page_cache *pc, usb2_size_t size); +uint8_t usb2_pc_load_mem(struct usb_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, usb2_frlength_t offset, +void usb2_bdma_done_event(struct usb_dma_parent_tag *udpt); +void usb2_bdma_post_sync(struct usb_xfer *xfer); +void usb2_bdma_pre_sync(struct usb_xfer *xfer); +void usb2_bdma_work_loop(struct usb_xfer_queue *pq); +void usb2_bzero(struct usb_page_cache *cache, usb2_frlength_t offset, usb2_frlength_t len); -void usb2_copy_in(struct usb2_page_cache *cache, usb2_frlength_t offset, +void usb2_copy_in(struct usb_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, +int usb2_copy_in_user(struct usb_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 usb2_copy_out(struct usb_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, +int usb2_copy_out_user(struct usb_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, +void usb2_dma_tag_setup(struct usb_dma_parent_tag *udpt, + struct usb_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, usb2_frlength_t offset, - struct usb2_page_search *res); -void usb2_m_copy_in(struct usb2_page_cache *cache, usb2_frlength_t dst_offset, +void usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt); +void usb2_get_page(struct usb_page_cache *pc, usb2_frlength_t offset, + struct usb_page_search *res); +void usb2_m_copy_in(struct usb_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); -void usb2_pc_free_mem(struct usb2_page_cache *pc); +void usb2_pc_cpu_flush(struct usb_page_cache *pc); +void usb2_pc_cpu_invalidate(struct usb_page_cache *pc); +void usb2_pc_dmamap_destroy(struct usb_page_cache *pc); +void usb2_pc_free_mem(struct usb_page_cache *pc); #endif /* _USB2_BUSDMA_H_ */ diff --git a/sys/dev/usb/usb_cdc.h b/sys/dev/usb/usb_cdc.h index d1e3dcbe7b2b..f6e312c99a52 100644 --- a/sys/dev/usb/usb_cdc.h +++ b/sys/dev/usb/usb_cdc.h @@ -59,14 +59,14 @@ #define UDESCSUB_CDC_ENF 15 #define UDESCSUB_CDC_ANF 16 -struct usb2_cdc_header_descriptor { +struct usb_cdc_header_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; uWord bcdCDC; } __packed; -struct usb2_cdc_cm_descriptor { +struct usb_cdc_cm_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; @@ -76,7 +76,7 @@ struct usb2_cdc_cm_descriptor { uByte bDataInterface; } __packed; -struct usb2_cdc_acm_descriptor { +struct usb_cdc_acm_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; @@ -87,7 +87,7 @@ struct usb2_cdc_acm_descriptor { #define USB_CDC_ACM_HAS_NETWORK_CONN 0x08 } __packed; -struct usb2_cdc_union_descriptor { +struct usb_cdc_union_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; @@ -95,7 +95,7 @@ struct usb2_cdc_union_descriptor { uByte bSlaveInterface[1]; } __packed; -struct usb2_cdc_ethernet_descriptor { +struct usb_cdc_ethernet_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; @@ -122,7 +122,7 @@ struct usb2_cdc_ethernet_descriptor { #define UCDC_BREAK_ON 0xffff #define UCDC_BREAK_OFF 0x0000 -struct usb2_cdc_abstract_state { +struct usb_cdc_abstract_state { uWord wState; #define UCDC_IDLE_SETTING 0x0001 #define UCDC_DATA_MULTIPLEXED 0x0002 @@ -130,7 +130,7 @@ struct usb2_cdc_abstract_state { #define UCDC_ABSTRACT_STATE_LENGTH 2 -struct usb2_cdc_line_state { +struct usb_cdc_line_state { uDWord dwDTERate; uByte bCharFormat; #define UCDC_STOP_BIT_1 0 @@ -147,7 +147,7 @@ struct usb2_cdc_line_state { #define UCDC_LINE_STATE_LENGTH 7 -struct usb2_cdc_notification { +struct usb_cdc_notification { uByte bmRequestType; #define UCDC_NOTIFICATION 0xa1 uByte bNotification; diff --git a/sys/dev/usb/usb_compat_linux.c b/sys/dev/usb/usb_compat_linux.c index c7906c2be657..9e7f1117e2d2 100644 --- a/sys/dev/usb/usb_compat_linux.c +++ b/sys/dev/usb/usb_compat_linux.c @@ -48,7 +48,7 @@ struct usb_linux_softc { LIST_ENTRY(usb_linux_softc) sc_attached_list; device_t sc_fbsd_dev; - struct usb2_device *sc_fbsd_udev; + struct usb_device *sc_fbsd_udev; struct usb_interface *sc_ui; struct usb_driver *sc_udrv; }; @@ -68,13 +68,12 @@ 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 *, usb2_timeout_t, uint16_t *); static const struct usb_device_id *usb_linux_lookup_id( - const struct usb_device_id *, struct usb2_attach_arg *); + const struct usb_device_id *, struct usb_attach_arg *); static struct usb_driver *usb_linux_get_usb_driver(struct usb_linux_softc *); -static struct usb_device *usb_linux_create_usb_device(struct usb2_device *, - device_t); +static int usb_linux_create_usb_device(struct usb_device *, device_t); static void usb_linux_cleanup_interface(struct usb_device *, struct usb_interface *); -static void usb_linux_complete(struct usb2_xfer *); +static void usb_linux_complete(struct usb_xfer *); static int usb_unlink_urb_sub(struct urb *, uint8_t); /*------------------------------------------------------------------------* @@ -109,12 +108,12 @@ DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, NULL, 0); * usb_linux_lookup_id * * This functions takes an array of "struct usb_device_id" and tries - * to match the entries with the information in "struct usb2_attach_arg". + * to match the entries with the information in "struct usb_attach_arg". * If it finds a match the matching entry will be returned. * Else "NULL" will be returned. *------------------------------------------------------------------------*/ static const struct usb_device_id * -usb_linux_lookup_id(const struct usb_device_id *id, struct usb2_attach_arg *uaa) +usb_linux_lookup_id(const struct usb_device_id *id, struct usb_attach_arg *uaa) { if (id == NULL) { goto done; @@ -190,7 +189,7 @@ done: static int usb_linux_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct usb_driver *udrv; int err = ENXIO; @@ -237,10 +236,9 @@ usb_linux_get_usb_driver(struct usb_linux_softc *sc) static int usb_linux_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct usb_linux_softc *sc = device_get_softc(dev); struct usb_driver *udrv; - struct usb_device *p_dev; const struct usb_device_id *id = NULL; mtx_lock(&Giant); @@ -254,24 +252,14 @@ usb_linux_attach(device_t dev) if (id == NULL) { return (ENXIO); } - /* - * Save some memory and only create the Linux compat structure when - * needed: - */ - p_dev = uaa->device->linux_dev; - if (p_dev == NULL) { - p_dev = usb_linux_create_usb_device(uaa->device, dev); - if (p_dev == NULL) { - return (ENOMEM); - } - uaa->device->linux_dev = p_dev; - } + if (usb_linux_create_usb_device(uaa->device, dev) != 0) + return (ENOMEM); device_set_usb2_desc(dev); sc->sc_fbsd_udev = uaa->device; sc->sc_fbsd_dev = dev; sc->sc_udrv = udrv; - sc->sc_ui = usb_ifnum_to_if(p_dev, uaa->info.bIfaceNum); + sc->sc_ui = usb_ifnum_to_if(uaa->device, uaa->info.bIfaceNum); if (sc->sc_ui == NULL) { return (EINVAL); } @@ -317,7 +305,7 @@ usb_linux_detach(device_t dev) * this Linux "usb_interface", hence they will most likely not be * needed any more. */ - usb_linux_cleanup_interface(sc->sc_fbsd_udev->linux_dev, sc->sc_ui); + usb_linux_cleanup_interface(sc->sc_fbsd_udev, sc->sc_ui); return (0); } @@ -371,7 +359,7 @@ static uint16_t usb_max_isoc_frames(struct usb_device *dev) { ; /* indent fix */ - switch (usb2_get_speed(dev->bsd_udev)) { + switch (usb2_get_speed(dev)) { case USB_SPEED_LOW: case USB_SPEED_FULL: return (USB_MAX_FULL_SPEED_ISOC_FRAMES); @@ -438,7 +426,7 @@ usb_unlink_urb(struct urb *urb) } static void -usb_unlink_bsd(struct usb2_xfer *xfer, +usb_unlink_bsd(struct usb_xfer *xfer, struct urb *urb, uint8_t drain) { if (xfer && @@ -510,8 +498,8 @@ usb_unlink_urb_sub(struct urb *urb, uint8_t drain) int usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe) { - struct usb2_config cfg[1]; - struct usb2_pipe *pipe; + struct usb_config cfg[1]; + struct usb_pipe *pipe; uint8_t type; uint8_t addr; @@ -527,11 +515,11 @@ usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe) cfg[0].endpoint = addr & UE_ADDR; cfg[0].direction = addr & (UE_DIR_OUT | UE_DIR_IN); - pipe = usb2_get_pipe(dev->bsd_udev, uhe->bsd_iface_index, cfg); + pipe = usb2_get_pipe(dev, uhe->bsd_iface_index, cfg); if (pipe == NULL) return (-EINVAL); - usb2_clear_data_toggle(dev->bsd_udev, pipe); + usb2_clear_data_toggle(dev, pipe); return (usb_control_msg(dev, &dev->ep0, UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT, @@ -603,7 +591,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe, uint16_t value, uint16_t index, void *data, uint16_t size, usb2_timeout_t timeout) { - struct usb2_device_request req; + struct usb_device_request req; struct urb *urb; int err; uint16_t actlen; @@ -630,7 +618,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe, * The FreeBSD USB stack supports standard control * transfers on control endpoint zero: */ - err = usb2_do_request_flags(dev->bsd_udev, + err = usb2_do_request_flags(dev, &Giant, &req, data, USB_SHORT_XFER_OK, &actlen, timeout); if (err) { @@ -640,7 +628,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe, } return (err); } - if (dev->bsd_udev->flags.usb_mode != USB_MODE_HOST) { + if (dev->flags.usb_mode != USB_MODE_HOST) { /* not supported */ return (-EINVAL); } @@ -701,7 +689,7 @@ usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index) if (alt_index >= p_ui->num_altsetting) return (-EINVAL); usb_linux_cleanup_interface(dev, p_ui); - err = -usb2_set_alt_interface_index(dev->bsd_udev, + err = -usb2_set_alt_interface_index(dev, p_ui->bsd_iface_index, alt_index); if (err == 0) { p_ui->cur_altsetting = p_ui->altsetting + alt_index; @@ -724,7 +712,7 @@ int usb_setup_endpoint(struct usb_device *dev, struct usb_host_endpoint *uhe, usb2_size_t bufsize) { - struct usb2_config cfg[2]; + struct usb_config cfg[2]; uint8_t type = uhe->desc.bmAttributes & UE_XFERTYPE; uint8_t addr = uhe->desc.bEndpointAddress; @@ -771,7 +759,7 @@ usb_setup_endpoint(struct usb_device *dev, /* Allocate and setup two generic FreeBSD USB transfers */ - if (usb2_transfer_setup(dev->bsd_udev, &uhe->bsd_iface_index, + if (usb2_transfer_setup(dev, &uhe->bsd_iface_index, uhe->bsd_xfer, cfg, 2, uhe, &Giant)) { return (-EINVAL); } @@ -791,7 +779,7 @@ usb_setup_endpoint(struct usb_device *dev, cfg[0].flags.proxy_buffer = 1; cfg[0].flags.short_xfer_ok = 1; - if (usb2_transfer_setup(dev->bsd_udev, &uhe->bsd_iface_index, + if (usb2_transfer_setup(dev, &uhe->bsd_iface_index, uhe->bsd_xfer, cfg, 1, uhe, &Giant)) { return (-EINVAL); } @@ -806,14 +794,13 @@ usb_setup_endpoint(struct usb_device *dev, * structure tree, that mimics the Linux one. The root structure * is returned by this function. *------------------------------------------------------------------------*/ -static struct usb_device * -usb_linux_create_usb_device(struct usb2_device *udev, device_t dev) +static int +usb_linux_create_usb_device(struct usb_device *udev, device_t dev) { - struct usb2_config_descriptor *cd = usb2_get_config_descriptor(udev); - struct usb2_descriptor *desc; - struct usb2_interface_descriptor *id; - struct usb2_endpoint_descriptor *ed; - struct usb_device *p_ud = NULL; + struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev); + struct usb_descriptor *desc; + struct usb_interface_descriptor *id; + struct usb_endpoint_descriptor *ed; struct usb_interface *p_ui = NULL; struct usb_host_interface *p_uhi = NULL; struct usb_host_endpoint *p_uhe = NULL; @@ -887,7 +874,7 @@ usb_linux_create_usb_device(struct usb2_device *udev, device_t dev) p_ui->cur_altsetting = p_uhi - 1; p_ui->num_altsetting = 1; p_ui->bsd_iface_index = iface_index; - p_ui->linux_udev = p_ud; + p_ui->linux_udev = udev; p_ui++; } iface_no_curr = iface_no; @@ -906,37 +893,26 @@ usb_linux_create_usb_device(struct usb2_device *udev, device_t dev) if (pass == 0) { - size = ((sizeof(*p_ud) * 1) + - (sizeof(*p_uhe) * nedesc) + + size = (sizeof(*p_uhe) * nedesc) + (sizeof(*p_ui) * iface_index) + - (sizeof(*p_uhi) * niface_total)); + (sizeof(*p_uhi) * niface_total); - p_ud = malloc(size, M_USBDEV, M_WAITOK | M_ZERO); - if (p_ud == NULL) { - goto done; - } - p_uhe = (void *)(p_ud + 1); + p_uhe = malloc(size, M_USBDEV, M_WAITOK | M_ZERO); p_ui = (void *)(p_uhe + nedesc); p_uhi = (void *)(p_ui + iface_index); - p_ud->product = ""; - p_ud->manufacturer = ""; - p_ud->serial = ""; - p_ud->speed = usb2_get_speed(udev); - p_ud->bsd_udev = udev; - p_ud->bsd_iface_start = p_ui; - p_ud->bsd_iface_end = p_ui + iface_index; - p_ud->bsd_endpoint_start = p_uhe; - p_ud->bsd_endpoint_end = p_uhe + nedesc; - p_ud->devnum = device_get_unit(dev); - bcopy(&udev->ddesc, &p_ud->descriptor, - sizeof(p_ud->descriptor)); - bcopy(udev->default_pipe.edesc, &p_ud->ep0.desc, - sizeof(p_ud->ep0.desc)); + udev->linux_iface_start = p_ui; + udev->linux_iface_end = p_ui + iface_index; + udev->linux_endpoint_start = p_uhe; + udev->linux_endpoint_end = p_uhe + nedesc; + udev->devnum = device_get_unit(dev); + bcopy(&udev->ddesc, &udev->descriptor, + sizeof(udev->descriptor)); + bcopy(udev->default_pipe.edesc, &udev->ep0.desc, + sizeof(udev->ep0.desc)); } } -done: - return (p_ud); + return (0); } /*------------------------------------------------------------------------* @@ -959,7 +935,7 @@ usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags) * FreeBSD specific magic value to ask for control transfer * memory allocation: */ - size = sizeof(*urb) + sizeof(struct usb2_device_request) + mem_flags; + size = sizeof(*urb) + sizeof(struct usb_device_request) + mem_flags; } else { size = sizeof(*urb) + (iso_packets * sizeof(urb->iso_frame_desc[0])); } @@ -971,7 +947,7 @@ usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags) if (iso_packets == 0xFFFF) { urb->setup_packet = (void *)(urb + 1); urb->transfer_buffer = (void *)(urb->setup_packet + - sizeof(struct usb2_device_request)); + sizeof(struct usb_device_request)); } else { urb->number_of_packets = iso_packets; } @@ -1013,8 +989,8 @@ usb_find_host_endpoint(struct usb_device *dev, uint8_t type, uint8_t ep) * Iterate over all the interfaces searching the selected alternate * setting only, and all belonging endpoints. */ - for (ui = dev->bsd_iface_start; - ui != dev->bsd_iface_end; + for (ui = dev->linux_iface_start; + ui != dev->linux_iface_end; ui++) { uhi = ui->cur_altsetting; if (uhi) { @@ -1068,8 +1044,8 @@ usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no) { struct usb_interface *p_ui; - for (p_ui = dev->bsd_iface_start; - p_ui != dev->bsd_iface_end; + for (p_ui = dev->linux_iface_start; + p_ui != dev->linux_iface_end; p_ui++) { if ((p_ui->num_altsetting > 0) && (p_ui->altsetting->desc.bInterfaceNumber == iface_no)) { @@ -1160,14 +1136,14 @@ usb_linux_free_device(struct usb_device *dev) struct usb_host_endpoint *uhe_end; int err; - uhe = dev->bsd_endpoint_start; - uhe_end = dev->bsd_endpoint_end; + uhe = dev->linux_endpoint_start; + uhe_end = dev->linux_endpoint_end; while (uhe != uhe_end) { err = usb_setup_endpoint(dev, uhe, 0); uhe++; } err = usb_setup_endpoint(dev, &dev->ep0, 0); - free(dev, M_USBDEV); + free(uhe, M_USBDEV); } /*------------------------------------------------------------------------* @@ -1285,7 +1261,7 @@ usb_linux_wait_complete(struct urb *urb) * usb_linux_complete *------------------------------------------------------------------------*/ static void -usb_linux_complete(struct usb2_xfer *xfer) +usb_linux_complete(struct usb_xfer *xfer) { struct urb *urb; @@ -1305,7 +1281,7 @@ usb_linux_complete(struct usb2_xfer *xfer) * used. *------------------------------------------------------------------------*/ static void -usb_linux_isoc_callback(struct usb2_xfer *xfer) +usb_linux_isoc_callback(struct usb_xfer *xfer) { usb2_frlength_t max_frame = xfer->max_frame_size; usb2_frlength_t offset; @@ -1473,10 +1449,10 @@ tr_setup: * callback is called. *------------------------------------------------------------------------*/ static void -usb_linux_non_isoc_callback(struct usb2_xfer *xfer) +usb_linux_non_isoc_callback(struct usb_xfer *xfer) { enum { - REQ_SIZE = sizeof(struct usb2_device_request) + REQ_SIZE = sizeof(struct usb_device_request) }; struct urb *urb = xfer->priv_fifo; struct usb_host_endpoint *uhe = xfer->priv_sc; diff --git a/sys/dev/usb/usb_compat_linux.h b/sys/dev/usb/usb_compat_linux.h index 44db8e2b7c2b..6f3e1e8401e9 100644 --- a/sys/dev/usb/usb_compat_linux.h +++ b/sys/dev/usb/usb_compat_linux.h @@ -117,66 +117,6 @@ struct usb_driver { SYSINIT(id,SI_SUB_KLD,SI_ORDER_FIRST,usb_linux_register,p_usb_drv); \ SYSUNINIT(id,SI_SUB_KLD,SI_ORDER_ANY,usb_linux_deregister,p_usb_drv) -/* - * The following structure is the same as "usb_device_descriptor_t" - * except that 16-bit values are "uint16_t" and not an array of "uint8_t". - * It is used by Linux USB device drivers. - */ -struct usb_device_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - - uint16_t bcdUSB; - uint8_t bDeviceClass; - uint8_t bDeviceSubClass; - uint8_t bDeviceProtocol; - uint8_t bMaxPacketSize0; - uint16_t idVendor; - uint16_t idProduct; - uint16_t bcdDevice; - uint8_t iManufacturer; - uint8_t iProduct; - uint8_t iSerialNumber; - uint8_t bNumConfigurations; -} __packed; - -/* - * The following structure is the same as - * "usb_interface_descriptor_t". It is used by - * Linux USB device drivers. - */ -struct usb_interface_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - - uint8_t bInterfaceNumber; - uint8_t bAlternateSetting; - uint8_t bNumEndpoints; - uint8_t bInterfaceClass; - uint8_t bInterfaceSubClass; - uint8_t bInterfaceProtocol; - uint8_t iInterface; -} __packed; - -/* - * The following structure is the same as "usb_endpoint_descriptor_t" - * except that 16-bit values are "uint16_t" and not an array of "uint8_t". - * It is used by Linux USB device drivers. - */ -struct usb_endpoint_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - - uint8_t bEndpointAddress; - uint8_t bmAttributes; - uint16_t wMaxPacketSize; - uint8_t bInterval; - - /* extension for audio endpoints only: */ - uint8_t bRefresh; - uint8_t bSynchAddress; -} __packed; - #define USB_DT_ENDPOINT_SIZE 7 #define USB_DT_ENDPOINT_AUDIO_SIZE 9 @@ -305,74 +245,6 @@ struct usb_endpoint_descriptor { #define usb_rcvintpipe(dev,endpoint) \ usb_find_host_endpoint(dev, PIPE_INTERRUPT, (endpoint) | USB_DIR_IN) -/* The following four structures makes up a tree, where we have the - * leaf structure, "usb_host_endpoint", first, and the root structure, - * "usb_device", last. The four structures below mirror the structure - * of the USB descriptors belonging to an USB configuration. Please - * refer to the USB specification for a definition of "endpoints" and - * "interfaces". - */ -struct usb_host_endpoint { - struct usb_endpoint_descriptor desc; - - TAILQ_HEAD(, urb) bsd_urb_list; - - struct usb2_xfer *bsd_xfer[2]; - - uint8_t *extra; /* Extra descriptors */ - - usb2_frlength_t fbsd_buf_size; - - uint16_t extralen; - - uint8_t bsd_iface_index; -} __aligned(USB_HOST_ALIGN); - -struct usb_host_interface { - struct usb_interface_descriptor desc; - - /* the following array has size "desc.bNumEndpoint" */ - struct usb_host_endpoint *endpoint; - - const char *string; /* iInterface string, if present */ - uint8_t *extra; /* Extra descriptors */ - - uint16_t extralen; - - uint8_t bsd_iface_index; -} __aligned(USB_HOST_ALIGN); - -struct usb_interface { - /* array of alternate settings for this interface */ - struct usb_host_interface *altsetting; - struct usb_host_interface *cur_altsetting; - struct usb_device *linux_udev; - void *bsd_priv_sc; /* device specific information */ - - uint8_t num_altsetting; /* number of alternate settings */ - uint8_t bsd_iface_index; -} __aligned(USB_HOST_ALIGN); - -struct usb_device { - struct usb_device_descriptor descriptor; - struct usb_host_endpoint ep0; - - struct usb2_device *bsd_udev; - struct usb_interface *bsd_iface_start; - struct usb_interface *bsd_iface_end; - struct usb_host_endpoint *bsd_endpoint_start; - struct usb_host_endpoint *bsd_endpoint_end; - - /* static strings from the device */ - const char *product; /* iProduct string, if present */ - const char *manufacturer; /* iManufacturer string, if present */ - const char *serial; /* iSerialNumber string, if present */ - - uint16_t devnum; - - enum usb_dev_speed speed; /* USB_SPEED_XXX */ -} __aligned(USB_HOST_ALIGN); - /* * The following structure is used to extend "struct urb" when we are * dealing with an isochronous endpoint. It contains information about diff --git a/sys/dev/usb/usb_controller.h b/sys/dev/usb/usb_controller.h index 48c20cbefce4..0cd4a0786d69 100644 --- a/sys/dev/usb/usb_controller.h +++ b/sys/dev/usb/usb_controller.h @@ -33,38 +33,38 @@ /* structure prototypes */ -struct usb2_bus; -struct usb2_page; -struct usb2_pipe; -struct usb2_page_cache; -struct usb2_setup_params; -struct usb2_hw_ep_profile; -struct usb2_fs_isoc_schedule; -struct usb2_config_descriptor; -struct usb2_endpoint_descriptor; +struct usb_bus; +struct usb_page; +struct usb_pipe; +struct usb_page_cache; +struct usb_setup_params; +struct usb_hw_ep_profile; +struct usb_fs_isoc_schedule; +struct usb_config_descriptor; +struct usb_endpoint_descriptor; /* typedefs */ -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); +typedef void (usb2_bus_mem_sub_cb_t)(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb2_size_t size, usb2_size_t align); +typedef void (usb2_bus_mem_cb_t)(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *scb); /* * The following structure is used to define all the USB BUS * callbacks. */ -struct usb2_bus_methods { +struct usb_bus_methods { /* USB Device and Host mode - Mandatory */ usb2_handle_request_t *roothub_exec; - void (*pipe_init) (struct usb2_device *, struct usb2_endpoint_descriptor *, struct usb2_pipe *); - void (*xfer_setup) (struct usb2_setup_params *); - void (*xfer_unsetup) (struct usb2_xfer *); - void (*get_dma_delay) (struct usb2_bus *, uint32_t *); - void (*device_suspend) (struct usb2_device *); - void (*device_resume) (struct usb2_device *); - void (*set_hw_power) (struct usb2_bus *); + void (*pipe_init) (struct usb_device *, struct usb_endpoint_descriptor *, struct usb_pipe *); + void (*xfer_setup) (struct usb_setup_params *); + void (*xfer_unsetup) (struct usb_xfer *); + void (*get_dma_delay) (struct usb_bus *, uint32_t *); + void (*device_suspend) (struct usb_device *); + void (*device_resume) (struct usb_device *); + void (*set_hw_power) (struct usb_bus *); /* * The following flag is set if one or more control transfers are @@ -94,9 +94,9 @@ struct usb2_bus_methods { /* USB Device mode only - Mandatory */ - void (*get_hw_ep_profile) (struct usb2_device *udev, const struct usb2_hw_ep_profile **ppf, uint8_t ep_addr); - void (*set_stall) (struct usb2_device *udev, struct usb2_xfer *xfer, struct usb2_pipe *pipe); - void (*clear_stall) (struct usb2_device *udev, struct usb2_pipe *pipe); + void (*get_hw_ep_profile) (struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr); + void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_pipe *pipe); + void (*clear_stall) (struct usb_device *udev, struct usb_pipe *pipe); }; @@ -104,7 +104,7 @@ struct usb2_bus_methods { * The following structure is used to define all the USB pipe * callbacks. */ -struct usb2_pipe_methods { +struct usb_pipe_methods { /* Mandatory USB Device and Host mode callbacks: */ @@ -123,7 +123,7 @@ struct usb2_pipe_methods { * The following structure keeps information about what a hardware USB * endpoint supports. */ -struct usb2_hw_ep_profile { +struct usb_hw_ep_profile { uint16_t max_in_frame_size; /* IN-token direction */ uint16_t max_out_frame_size; /* OUT-token direction */ uint8_t is_simplex:1; @@ -140,8 +140,8 @@ struct usb2_hw_ep_profile { * The following structure is used when trying to allocate hardware * endpoints for an USB configuration in USB device side mode. */ -struct usb2_hw_ep_scratch_sub { - const struct usb2_hw_ep_profile *pf; +struct usb_hw_ep_scratch_sub { + const struct usb_hw_ep_profile *pf; uint16_t max_frame_size; uint8_t hw_endpoint_out; uint8_t hw_endpoint_in; @@ -154,12 +154,12 @@ struct usb2_hw_ep_scratch_sub { * The following structure is used when trying to allocate hardware * endpoints for an USB configuration in USB device side mode. */ -struct usb2_hw_ep_scratch { - struct usb2_hw_ep_scratch_sub ep[USB_EP_MAX]; - struct usb2_hw_ep_scratch_sub *ep_max; - struct usb2_config_descriptor *cd; - struct usb2_device *udev; - struct usb2_bus_methods *methods; +struct usb_hw_ep_scratch { + struct usb_hw_ep_scratch_sub ep[USB_EP_MAX]; + struct usb_hw_ep_scratch_sub *ep_max; + struct usb_config_descriptor *cd; + struct usb_device *udev; + struct usb_bus_methods *methods; uint8_t bmOutAlloc[(USB_EP_MAX + 15) / 16]; uint8_t bmInAlloc[(USB_EP_MAX + 15) / 16]; }; @@ -168,7 +168,7 @@ struct usb2_hw_ep_scratch { * The following structure is used when generating USB descriptors * from USB templates. */ -struct usb2_temp_setup { +struct usb_temp_setup { void *buf; usb2_size_t size; enum usb_dev_speed usb_speed; @@ -182,11 +182,11 @@ struct usb2_temp_setup { /* prototypes */ -void usb2_bus_mem_flush_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb); -uint8_t usb2_bus_mem_alloc_all(struct usb2_bus *bus, bus_dma_tag_t dmat, usb2_bus_mem_cb_t *cb); -void usb2_bus_mem_free_all(struct usb2_bus *bus, usb2_bus_mem_cb_t *cb); -uint16_t usb2_isoc_time_expand(struct usb2_bus *bus, uint16_t isoc_time_curr); -uint16_t usb2_fs_isoc_schedule_isoc_time_expand(struct usb2_device *udev, struct usb2_fs_isoc_schedule **pp_start, struct usb2_fs_isoc_schedule **pp_end, uint16_t isoc_time); -uint8_t usb2_fs_isoc_schedule_alloc(struct usb2_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); +void usb2_bus_mem_flush_all(struct usb_bus *bus, usb2_bus_mem_cb_t *cb); +uint8_t usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb2_bus_mem_cb_t *cb); +void usb2_bus_mem_free_all(struct usb_bus *bus, usb2_bus_mem_cb_t *cb); +uint16_t usb2_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr); +uint16_t usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time); +uint8_t usb2_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len); #endif /* _USB2_CONTROLLER_H_ */ diff --git a/sys/dev/usb/usb_core.h b/sys/dev/usb/usb_core.h index 8a7e021094af..6847454619e4 100644 --- a/sys/dev/usb/usb_core.h +++ b/sys/dev/usb/usb_core.h @@ -256,17 +256,17 @@ /* structure prototypes */ struct file; -struct usb2_bus; -struct usb2_device; -struct usb2_device_request; -struct usb2_page; -struct usb2_page_cache; -struct usb2_xfer; -struct usb2_xfer_root; +struct usb_bus; +struct usb_device; +struct usb_device_request; +struct usb_page; +struct usb_page_cache; +struct usb_xfer; +struct usb_xfer_root; /* typedefs */ -typedef void (usb2_callback_t)(struct usb2_xfer *); +typedef void (usb2_callback_t)(struct usb_xfer *); #ifndef USB_HAVE_USB_ERROR_T typedef uint8_t usb2_error_t; /* see "USB_ERR_XXX" */ @@ -296,18 +296,18 @@ typedef uint32_t usb2_ticks_t; /* system defined */ typedef uint16_t usb2_power_mask_t; /* see "USB_HW_POWER_XXX" */ #endif -typedef usb2_error_t (usb2_handle_request_t)(struct usb2_device *, - struct usb2_device_request *, const void **, uint16_t *); +typedef usb2_error_t (usb2_handle_request_t)(struct usb_device *, + struct usb_device_request *, const void **, uint16_t *); /* structures */ /* * Common queue structure for USB transfers. */ -struct usb2_xfer_queue { - TAILQ_HEAD(, usb2_xfer) head; - struct usb2_xfer *curr; /* current USB transfer processed */ - void (*command) (struct usb2_xfer_queue *pq); +struct usb_xfer_queue { + TAILQ_HEAD(, usb_xfer) head; + struct usb_xfer *curr; /* current USB transfer processed */ + void (*command) (struct usb_xfer_queue *pq); uint8_t recurse_1:1; uint8_t recurse_2:1; }; @@ -316,14 +316,14 @@ struct usb2_xfer_queue { * The following is a wrapper for the callout structure to ease * porting the code to other platforms. */ -struct usb2_callout { +struct usb_callout { struct callout co; }; /* * The following structure defines a set of USB transfer flags. */ -struct usb2_xfer_flags { +struct usb_xfer_flags { uint8_t force_short_xfer:1; /* force a short transmit transfer * last */ uint8_t short_xfer_ok:1; /* allow short receive transfers */ @@ -345,7 +345,7 @@ struct usb2_xfer_flags { * The following structure defines a set of internal USB transfer * flags. */ -struct usb2_xfer_flags_int { +struct usb_xfer_flags_int { enum usb_hc_mode usb_mode; /* shadow copy of "udev->usb_mode" */ uint16_t control_rem; /* remainder in bytes */ @@ -385,14 +385,14 @@ struct usb2_xfer_flags_int { * The following structure define an USB configuration, that basically * is used when setting up an USB transfer. */ -struct usb2_config { +struct usb_config { usb2_callback_t *callback; /* USB transfer callback */ 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 usb2_timeout_t timeout; /* transfer timeout in milliseconds */ - struct usb2_xfer_flags flags; /* transfer flags */ + struct usb_xfer_flags flags; /* transfer flags */ enum usb_hc_mode usb_mode; /* host or device mode */ uint8_t type; /* pipe type */ uint8_t endpoint; /* pipe number */ @@ -404,16 +404,16 @@ struct usb2_config { /* * The following structure defines an USB transfer. */ -struct usb2_xfer { - struct usb2_callout timeout_handle; - TAILQ_ENTRY(usb2_xfer) wait_entry; /* used at various places */ +struct usb_xfer { + struct usb_callout timeout_handle; + TAILQ_ENTRY(usb_xfer) wait_entry; /* used at various places */ - struct usb2_page_cache *buf_fixup; /* fixup buffer(s) */ - struct usb2_xfer_queue *wait_queue; /* pointer to queue that we + struct usb_page_cache *buf_fixup; /* fixup buffer(s) */ + struct usb_xfer_queue *wait_queue; /* pointer to queue that we * are waiting on */ - struct usb2_page *dma_page_ptr; - struct usb2_pipe *pipe; /* our USB pipe */ - struct usb2_xfer_root *xroot; /* used by HC driver */ + struct usb_page *dma_page_ptr; + struct usb_pipe *pipe; /* our USB pipe */ + struct usb_xfer_root *xroot; /* used by HC driver */ void *qh_start[2]; /* used by HC driver */ void *td_start[2]; /* used by HC driver */ void *td_transfer_first; /* used by HC driver */ @@ -423,7 +423,7 @@ struct usb2_xfer { void *priv_fifo; /* device driver data pointer 2 */ void *local_buffer; usb2_frlength_t *frlengths; - struct usb2_page_cache *frbuffers; + struct usb_page_cache *frbuffers; usb2_callback_t *callback; usb2_frlength_t max_hc_frame_size; @@ -456,15 +456,15 @@ struct usb2_xfer { usb2_error_t error; - struct usb2_xfer_flags flags; - struct usb2_xfer_flags_int flags_int; + struct usb_xfer_flags flags; + struct usb_xfer_flags_int flags_int; }; /* * The following structure keeps information that is used to match - * against an array of "usb2_device_id" elements. + * against an array of "usb_device_id" elements. */ -struct usb2_lookup_info { +struct usb_lookup_info { uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; @@ -482,12 +482,12 @@ struct usb2_lookup_info { /* Structure used by probe and attach */ -struct usb2_attach_arg { - struct usb2_lookup_info info; +struct usb_attach_arg { + struct usb_lookup_info info; device_t temp_dev; /* for internal use */ const void *driver_info; /* for internal use */ - struct usb2_device *device; /* current device */ - struct usb2_interface *iface; /* current interface */ + struct usb_device *device; /* current device */ + struct usb_interface *iface; /* current interface */ enum usb_hc_mode usb_mode; /* host or device mode */ uint8_t port; uint8_t use_generic; /* hint for generic drivers */ @@ -509,43 +509,43 @@ typedef struct malloc_type *usb2_malloc_type; const char *usb2_errstr(usb2_error_t error); const char *usb2_statestr(enum usb_dev_state state); -struct usb2_config_descriptor *usb2_get_config_descriptor( - struct usb2_device *udev); -struct usb2_device_descriptor *usb2_get_device_descriptor( - struct usb2_device *udev); -struct usb2_interface *usb2_get_iface(struct usb2_device *udev, +struct usb_config_descriptor *usb2_get_config_descriptor( + struct usb_device *udev); +struct usb_device_descriptor *usb2_get_device_descriptor( + struct usb_device *udev); +struct usb_interface *usb2_get_iface(struct usb_device *udev, uint8_t iface_index); -struct usb2_interface_descriptor *usb2_get_interface_descriptor( - struct usb2_interface *iface); -uint8_t usb2_clear_stall_callback(struct usb2_xfer *xfer1, - struct usb2_xfer *xfer2); -uint8_t usb2_get_interface_altindex(struct usb2_interface *iface); -usb2_error_t usb2_set_alt_interface_index(struct usb2_device *udev, +struct usb_interface_descriptor *usb2_get_interface_descriptor( + struct usb_interface *iface); +uint8_t usb2_clear_stall_callback(struct usb_xfer *xfer1, + struct usb_xfer *xfer2); +uint8_t usb2_get_interface_altindex(struct usb_interface *iface); +usb2_error_t usb2_set_alt_interface_index(struct usb_device *udev, uint8_t iface_index, uint8_t alt_index); -enum usb_hc_mode usb2_get_mode(struct usb2_device *udev); -enum usb_dev_speed usb2_get_speed(struct usb2_device *udev); -uint32_t usb2_get_isoc_fps(struct usb2_device *udev); -usb2_error_t usb2_transfer_setup(struct usb2_device *udev, - const uint8_t *ifaces, struct usb2_xfer **pxfer, - const struct usb2_config *setup_start, uint16_t n_setup, +enum usb_hc_mode usb2_get_mode(struct usb_device *udev); +enum usb_dev_speed usb2_get_speed(struct usb_device *udev); +uint32_t usb2_get_isoc_fps(struct usb_device *udev); +usb2_error_t usb2_transfer_setup(struct usb_device *udev, + const uint8_t *ifaces, struct usb_xfer **pxfer, + const struct usb_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, +void usb2_set_frame_data(struct usb_xfer *xfer, void *ptr, usb2_frcount_t frindex); -void usb2_set_frame_offset(struct usb2_xfer *xfer, usb2_frlength_t offset, +void usb2_set_frame_offset(struct usb_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); -void usb2_transfer_set_stall(struct usb2_xfer *xfer); -uint8_t usb2_transfer_pending(struct usb2_xfer *xfer); -void usb2_transfer_start(struct usb2_xfer *xfer); -void usb2_transfer_stop(struct usb2_xfer *xfer); -void usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup); -void usb2_set_parent_iface(struct usb2_device *udev, uint8_t iface_index, +void usb2_start_hardware(struct usb_xfer *xfer); +void usb2_transfer_clear_stall(struct usb_xfer *xfer); +void usb2_transfer_drain(struct usb_xfer *xfer); +void usb2_transfer_set_stall(struct usb_xfer *xfer); +uint8_t usb2_transfer_pending(struct usb_xfer *xfer); +void usb2_transfer_start(struct usb_xfer *xfer); +void usb2_transfer_stop(struct usb_xfer *xfer); +void usb2_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup); +void usb2_set_parent_iface(struct usb_device *udev, uint8_t iface_index, uint8_t parent_index); -uint8_t usb2_get_bus_index(struct usb2_device *udev); -uint8_t usb2_get_device_index(struct usb2_device *udev); -void usb2_set_power_mode(struct usb2_device *udev, uint8_t power_mode); -uint8_t usb2_device_attached(struct usb2_device *udev); +uint8_t usb2_get_bus_index(struct usb_device *udev); +uint8_t usb2_get_device_index(struct usb_device *udev); +void usb2_set_power_mode(struct usb_device *udev, uint8_t power_mode); +uint8_t usb2_device_attached(struct usb_device *udev); #endif /* _USB2_CORE_H_ */ diff --git a/sys/dev/usb/usb_debug.c b/sys/dev/usb/usb_debug.c index de75f8933500..3e86b20b7270 100644 --- a/sys/dev/usb/usb_debug.c +++ b/sys/dev/usb/usb_debug.c @@ -49,7 +49,7 @@ SYSCTL_INT(_hw_usb, OID_AUTO, debug, CTLFLAG_RW, * This function dumps information about an USB interface. *------------------------------------------------------------------------*/ void -usb2_dump_iface(struct usb2_interface *iface) +usb2_dump_iface(struct usb_interface *iface) { printf("usb2_dump_iface: iface=%p\n", iface); if (iface == NULL) { @@ -65,7 +65,7 @@ usb2_dump_iface(struct usb2_interface *iface) * This function dumps information about an USB device. *------------------------------------------------------------------------*/ void -usb2_dump_device(struct usb2_device *udev) +usb2_dump_device(struct usb_device *udev) { printf("usb2_dump_device: dev=%p\n", udev); if (udev == NULL) { @@ -85,9 +85,9 @@ usb2_dump_device(struct usb2_device *udev) * This function dumps the USB transfer that are queued up on an USB pipe. *------------------------------------------------------------------------*/ void -usb2_dump_queue(struct usb2_pipe *pipe) +usb2_dump_queue(struct usb_pipe *pipe) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; printf("usb2_dump_queue: pipe=%p xfer: ", pipe); TAILQ_FOREACH(xfer, &pipe->pipe_q.head, wait_entry) { @@ -102,7 +102,7 @@ usb2_dump_queue(struct usb2_pipe *pipe) * This function dumps information about an USB pipe. *------------------------------------------------------------------------*/ void -usb2_dump_pipe(struct usb2_pipe *pipe) +usb2_dump_pipe(struct usb_pipe *pipe) { if (pipe) { printf("usb2_dump_pipe: pipe=%p", pipe); @@ -127,9 +127,9 @@ usb2_dump_pipe(struct usb2_pipe *pipe) * This function dumps information about an USB transfer. *------------------------------------------------------------------------*/ void -usb2_dump_xfer(struct usb2_xfer *xfer) +usb2_dump_xfer(struct usb_xfer *xfer) { - struct usb2_device *udev; + struct usb_device *udev; printf("usb2_dump_xfer: xfer=%p\n", xfer); if (xfer == NULL) { return; diff --git a/sys/dev/usb/usb_debug.h b/sys/dev/usb/usb_debug.h index 9ddd597ed2b0..38869bca8d06 100644 --- a/sys/dev/usb/usb_debug.h +++ b/sys/dev/usb/usb_debug.h @@ -51,15 +51,15 @@ extern int usb2_debug; #endif #endif -struct usb2_interface; -struct usb2_device; -struct usb2_pipe; -struct usb2_xfer; +struct usb_interface; +struct usb_device; +struct usb_pipe; +struct usb_xfer; -void usb2_dump_iface(struct usb2_interface *iface); -void usb2_dump_device(struct usb2_device *udev); -void usb2_dump_queue(struct usb2_pipe *pipe); -void usb2_dump_pipe(struct usb2_pipe *pipe); -void usb2_dump_xfer(struct usb2_xfer *xfer); +void usb2_dump_iface(struct usb_interface *iface); +void usb2_dump_device(struct usb_device *udev); +void usb2_dump_queue(struct usb_pipe *pipe); +void usb2_dump_pipe(struct usb_pipe *pipe); +void usb2_dump_xfer(struct usb_xfer *xfer); #endif /* _USB2_DEBUG_H_ */ diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index e20c31e7064c..8d13d80ff908 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -73,24 +73,24 @@ SYSCTL_INT(_hw_usb_dev, OID_AUTO, debug, CTLFLAG_RW, /* prototypes */ -static int usb2_fifo_open(struct usb2_cdev_privdata *, - struct usb2_fifo *, int); -static void usb2_fifo_close(struct usb2_fifo *, int); +static int usb2_fifo_open(struct usb_cdev_privdata *, + struct usb_fifo *, int); +static void usb2_fifo_close(struct usb_fifo *, int); static void usb2_dev_init(void *); static void usb2_dev_init_post(void *); static void usb2_dev_uninit(void *); -static int usb2_fifo_uiomove(struct usb2_fifo *, void *, int, +static int usb2_fifo_uiomove(struct usb_fifo *, void *, int, struct uio *); -static void usb2_fifo_check_methods(struct usb2_fifo_methods *); -static struct usb2_fifo *usb2_fifo_alloc(void); -static struct usb2_pipe *usb2_dev_get_pipe(struct usb2_device *, uint8_t, +static void usb2_fifo_check_methods(struct usb_fifo_methods *); +static struct usb_fifo *usb2_fifo_alloc(void); +static struct usb_pipe *usb2_dev_get_pipe(struct usb_device *, uint8_t, uint8_t); -static void usb2_loc_fill(struct usb2_fs_privdata *, - struct usb2_cdev_privdata *); +static void usb2_loc_fill(struct usb_fs_privdata *, + struct usb_cdev_privdata *); static void usb2_close(void *); -static usb2_error_t usb2_ref_device(struct usb2_cdev_privdata *, int); -static usb2_error_t usb2_usb_ref_device(struct usb2_cdev_privdata *); -static void usb2_unref_device(struct usb2_cdev_privdata *); +static usb2_error_t usb2_ref_device(struct usb_cdev_privdata *, int); +static usb2_error_t usb2_usb_ref_device(struct usb_cdev_privdata *); +static void usb2_unref_device(struct usb_cdev_privdata *); static d_open_t usb2_open; static d_ioctl_t usb2_ioctl; @@ -126,7 +126,7 @@ struct cdevsw usb2_static_devsw = { .d_name = "usb" }; -static TAILQ_HEAD(, usb2_symlink) usb2_sym_head; +static TAILQ_HEAD(, usb_symlink) usb2_sym_head; static struct sx usb2_sym_lock; struct mtx usb2_ref_lock; @@ -134,11 +134,11 @@ struct mtx usb2_ref_lock; /*------------------------------------------------------------------------* * usb2_loc_fill * - * This is used to fill out a usb2_cdev_privdata structure based on the - * device's address as contained in usb2_fs_privdata. + * This is used to fill out a usb_cdev_privdata structure based on the + * device's address as contained in usb_fs_privdata. *------------------------------------------------------------------------*/ static void -usb2_loc_fill(struct usb2_fs_privdata* pd, struct usb2_cdev_privdata *cpd) +usb2_loc_fill(struct usb_fs_privdata* pd, struct usb_cdev_privdata *cpd) { cpd->bus_index = pd->bus_index; cpd->dev_index = pd->dev_index; @@ -158,10 +158,10 @@ usb2_loc_fill(struct usb2_fs_privdata* pd, struct usb2_cdev_privdata *cpd) * Else: Failure. *------------------------------------------------------------------------*/ usb2_error_t -usb2_ref_device(struct usb2_cdev_privdata* cpd, int need_uref) +usb2_ref_device(struct usb_cdev_privdata* cpd, int need_uref) { - struct usb2_fifo **ppf; - struct usb2_fifo *f; + struct usb_fifo **ppf; + struct usb_fifo *f; DPRINTFN(2, "usb2_ref_device, cpd=%p need uref=%d\n", cpd, need_uref); @@ -287,7 +287,7 @@ error: * Else: Failure. *------------------------------------------------------------------------*/ static usb2_error_t -usb2_usb_ref_device(struct usb2_cdev_privdata *cpd) +usb2_usb_ref_device(struct usb_cdev_privdata *cpd) { /* * Check if we already got an USB reference on this location: @@ -311,7 +311,7 @@ usb2_usb_ref_device(struct usb2_cdev_privdata *cpd) * given USB device. *------------------------------------------------------------------------*/ void -usb2_unref_device(struct usb2_cdev_privdata *cpd) +usb2_unref_device(struct usb_cdev_privdata *cpd) { if (cpd->is_uref) { mtx_unlock(&Giant); /* XXX */ @@ -339,10 +339,10 @@ usb2_unref_device(struct usb2_cdev_privdata *cpd) mtx_unlock(&usb2_ref_lock); } -static struct usb2_fifo * +static struct usb_fifo * usb2_fifo_alloc(void) { - struct usb2_fifo *f; + struct usb_fifo *f; f = malloc(sizeof(*f), M_USBDEV, M_WAITOK | M_ZERO); if (f) { @@ -357,11 +357,11 @@ usb2_fifo_alloc(void) * usb2_fifo_create *------------------------------------------------------------------------*/ static int -usb2_fifo_create(struct usb2_cdev_privdata *cpd) +usb2_fifo_create(struct usb_cdev_privdata *cpd) { - struct usb2_device *udev = cpd->udev; - struct usb2_fifo *f; - struct usb2_pipe *pipe; + struct usb_device *udev = cpd->udev; + struct usb_fifo *f; + struct usb_pipe *pipe; uint8_t n; uint8_t is_tx; uint8_t is_rx; @@ -531,7 +531,7 @@ usb2_fifo_create(struct usb2_cdev_privdata *cpd) } void -usb2_fifo_free(struct usb2_fifo *f) +usb2_fifo_free(struct usb_fifo *f) { uint8_t n; @@ -587,10 +587,10 @@ usb2_fifo_free(struct usb2_fifo *f) free(f, M_USBDEV); } -static struct usb2_pipe * -usb2_dev_get_pipe(struct usb2_device *udev, uint8_t ep_index, uint8_t dir) +static struct usb_pipe * +usb2_dev_get_pipe(struct usb_device *udev, uint8_t ep_index, uint8_t dir) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; uint8_t ep_dir; if (ep_index == 0) { @@ -631,8 +631,8 @@ usb2_dev_get_pipe(struct usb2_device *udev, uint8_t ep_index, uint8_t dir) * Else: Failure *------------------------------------------------------------------------*/ static int -usb2_fifo_open(struct usb2_cdev_privdata *cpd, - struct usb2_fifo *f, int fflags) +usb2_fifo_open(struct usb_cdev_privdata *cpd, + struct usb_fifo *f, int fflags) { int err; @@ -703,9 +703,9 @@ done: * usb2_fifo_reset *------------------------------------------------------------------------*/ void -usb2_fifo_reset(struct usb2_fifo *f) +usb2_fifo_reset(struct usb_fifo *f) { - struct usb2_mbuf *m; + struct usb_mbuf *m; if (f == NULL) { return; @@ -724,7 +724,7 @@ usb2_fifo_reset(struct usb2_fifo *f) * usb2_fifo_close *------------------------------------------------------------------------*/ static void -usb2_fifo_close(struct usb2_fifo *f, int fflags) +usb2_fifo_close(struct usb_fifo *f, int fflags) { int err; @@ -805,8 +805,8 @@ usb2_fifo_close(struct usb2_fifo *f, int fflags) static int usb2_open(struct cdev *dev, int fflags, int devtype, struct thread *td) { - struct usb2_fs_privdata* pd = (struct usb2_fs_privdata*)dev->si_drv1; - struct usb2_cdev_privdata *cpd; + struct usb_fs_privdata* pd = (struct usb_fs_privdata*)dev->si_drv1; + struct usb_cdev_privdata *cpd; int err, ep; DPRINTFN(2, "%s fflags=0x%08x\n", dev->si_name, fflags); @@ -872,7 +872,7 @@ usb2_open(struct cdev *dev, int fflags, int devtype, struct thread *td) static void usb2_close(void *arg) { - struct usb2_cdev_privdata *cpd = arg; + struct usb_cdev_privdata *cpd = arg; int err; DPRINTFN(2, "cpd=%p\n", cpd); @@ -938,7 +938,7 @@ usb2_dev_uninit(void *arg) SYSUNINIT(usb2_dev_uninit, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb2_dev_uninit, NULL); static int -usb2_ioctl_f_sub(struct usb2_fifo *f, u_long cmd, void *addr, +usb2_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr, struct thread *td) { int error = 0; @@ -988,8 +988,8 @@ usb2_ioctl_f_sub(struct usb2_fifo *f, u_long cmd, void *addr, static int usb2_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int fflag, struct thread* td) { - struct usb2_cdev_privdata* cpd; - struct usb2_fifo *f; + struct usb_cdev_privdata* cpd; + struct usb_fifo *f; int fflags; int err; @@ -1046,9 +1046,9 @@ done: static int usb2_poll(struct cdev* dev, int events, struct thread* td) { - struct usb2_cdev_privdata* cpd; - struct usb2_fifo *f; - struct usb2_mbuf *m; + struct usb_cdev_privdata* cpd; + struct usb_fifo *f; + struct usb_mbuf *m; int fflags, revents; if (devfs_get_cdevpriv((void **)&cpd) != 0 || @@ -1150,9 +1150,9 @@ usb2_poll(struct cdev* dev, int events, struct thread* td) static int usb2_read(struct cdev *dev, struct uio *uio, int ioflag) { - struct usb2_cdev_privdata* cpd; - struct usb2_fifo *f; - struct usb2_mbuf *m; + struct usb_cdev_privdata* cpd; + struct usb_fifo *f; + struct usb_mbuf *m; int fflags; int resid; int io_len; @@ -1271,9 +1271,9 @@ done: static int usb2_write(struct cdev *dev, struct uio *uio, int ioflag) { - struct usb2_cdev_privdata* cpd; - struct usb2_fifo *f; - struct usb2_mbuf *m; + struct usb_cdev_privdata* cpd; + struct usb_fifo *f; + struct usb_mbuf *m; int fflags; int resid; int io_len; @@ -1386,7 +1386,7 @@ usb2_static_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { union { - struct usb2_read_dir *urd; + struct usb_read_dir *urd; void* data; } u; int err = ENOTTY; @@ -1417,7 +1417,7 @@ usb2_static_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, } static int -usb2_fifo_uiomove(struct usb2_fifo *f, void *cp, +usb2_fifo_uiomove(struct usb_fifo *f, void *cp, int n, struct uio *uio) { int error; @@ -1436,7 +1436,7 @@ usb2_fifo_uiomove(struct usb2_fifo *f, void *cp, } int -usb2_fifo_wait(struct usb2_fifo *f) +usb2_fifo_wait(struct usb_fifo *f) { int err; @@ -1458,7 +1458,7 @@ usb2_fifo_wait(struct usb2_fifo *f) } void -usb2_fifo_signal(struct usb2_fifo *f) +usb2_fifo_signal(struct usb_fifo *f) { if (f->flag_sleeping) { f->flag_sleeping = 0; @@ -1467,7 +1467,7 @@ usb2_fifo_signal(struct usb2_fifo *f) } void -usb2_fifo_wakeup(struct usb2_fifo *f) +usb2_fifo_wakeup(struct usb_fifo *f) { usb2_fifo_signal(f); @@ -1483,31 +1483,31 @@ usb2_fifo_wakeup(struct usb2_fifo *f) } static int -usb2_fifo_dummy_open(struct usb2_fifo *fifo, int fflags) +usb2_fifo_dummy_open(struct usb_fifo *fifo, int fflags) { return (0); } static void -usb2_fifo_dummy_close(struct usb2_fifo *fifo, int fflags) +usb2_fifo_dummy_close(struct usb_fifo *fifo, int fflags) { return; } static int -usb2_fifo_dummy_ioctl(struct usb2_fifo *fifo, u_long cmd, void *addr, int fflags) +usb2_fifo_dummy_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { return (ENOIOCTL); } static void -usb2_fifo_dummy_cmd(struct usb2_fifo *fifo) +usb2_fifo_dummy_cmd(struct usb_fifo *fifo) { fifo->flag_flushing = 0; /* not flushing */ } static void -usb2_fifo_check_methods(struct usb2_fifo_methods *pm) +usb2_fifo_check_methods(struct usb_fifo_methods *pm) { /* check that all callback functions are OK */ @@ -1546,16 +1546,16 @@ usb2_fifo_check_methods(struct usb2_fifo_methods *pm) * Else: Failure. *------------------------------------------------------------------------*/ int -usb2_fifo_attach(struct usb2_device *udev, void *priv_sc, - struct mtx *priv_mtx, struct usb2_fifo_methods *pm, - struct usb2_fifo_sc *f_sc, uint16_t unit, uint16_t subunit, +usb2_fifo_attach(struct usb_device *udev, void *priv_sc, + struct mtx *priv_mtx, struct usb_fifo_methods *pm, + struct usb_fifo_sc *f_sc, uint16_t unit, uint16_t subunit, uint8_t iface_index, uid_t uid, gid_t gid, int mode) { - struct usb2_fifo *f_tx; - struct usb2_fifo *f_rx; + struct usb_fifo *f_tx; + struct usb_fifo *f_rx; char devname[32]; uint8_t n; - struct usb2_fs_privdata* pd; + struct usb_fs_privdata* pd; f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; @@ -1657,7 +1657,7 @@ usb2_fifo_attach(struct usb2_device *udev, void *priv_sc, * Initialize device private data - this is used to find the * actual USB device itself. */ - pd = malloc(sizeof(struct usb2_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); + pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); pd->bus_index = device_get_unit(udev->bus->bdev); pd->dev_index = udev->device_index; pd->ep_addr = -1; /* not an endpoint */ @@ -1683,7 +1683,7 @@ usb2_fifo_attach(struct usb2_device *udev, void *priv_sc, * Else failure *------------------------------------------------------------------------*/ int -usb2_fifo_alloc_buffer(struct usb2_fifo *f, usb2_size_t bufsize, +usb2_fifo_alloc_buffer(struct usb_fifo *f, usb2_size_t bufsize, uint16_t nbuf) { usb2_fifo_free_buffer(f); @@ -1708,7 +1708,7 @@ usb2_fifo_alloc_buffer(struct usb2_fifo *f, usb2_size_t bufsize, * function can be called multiple times in a row. *------------------------------------------------------------------------*/ void -usb2_fifo_free_buffer(struct usb2_fifo *f) +usb2_fifo_free_buffer(struct usb_fifo *f) { if (f->queue_data) { /* free old buffer */ @@ -1728,7 +1728,7 @@ usb2_fifo_cleanup(void* ptr) } void -usb2_fifo_detach(struct usb2_fifo_sc *f_sc) +usb2_fifo_detach(struct usb_fifo_sc *f_sc) { if (f_sc == NULL) { return; @@ -1749,9 +1749,9 @@ usb2_fifo_detach(struct usb2_fifo_sc *f_sc) } usb2_size_t -usb2_fifo_put_bytes_max(struct usb2_fifo *f) +usb2_fifo_put_bytes_max(struct usb_fifo *f) { - struct usb2_mbuf *m; + struct usb_mbuf *m; usb2_size_t len; USB_IF_POLL(&f->free_q, m); @@ -1772,10 +1772,10 @@ usb2_fifo_put_bytes_max(struct usb2_fifo *f) * 1 - set last packet flag to enforce framing *------------------------------------------------------------------------*/ void -usb2_fifo_put_data(struct usb2_fifo *f, struct usb2_page_cache *pc, +usb2_fifo_put_data(struct usb_fifo *f, struct usb_page_cache *pc, usb2_frlength_t offset, usb2_frlength_t len, uint8_t what) { - struct usb2_mbuf *m; + struct usb_mbuf *m; usb2_frlength_t io_len; while (len || (what == 1)) { @@ -1810,10 +1810,10 @@ usb2_fifo_put_data(struct usb2_fifo *f, struct usb2_page_cache *pc, } void -usb2_fifo_put_data_linear(struct usb2_fifo *f, void *ptr, +usb2_fifo_put_data_linear(struct usb_fifo *f, void *ptr, usb2_size_t len, uint8_t what) { - struct usb2_mbuf *m; + struct usb_mbuf *m; usb2_size_t io_len; while (len || (what == 1)) { @@ -1848,9 +1848,9 @@ usb2_fifo_put_data_linear(struct usb2_fifo *f, void *ptr, } uint8_t -usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, usb2_size_t len) +usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb2_size_t len) { - struct usb2_mbuf *m; + struct usb_mbuf *m; USB_IF_DEQUEUE(&f->free_q, m); @@ -1865,7 +1865,7 @@ usb2_fifo_put_data_buffer(struct usb2_fifo *f, void *ptr, usb2_size_t len) } void -usb2_fifo_put_data_error(struct usb2_fifo *f) +usb2_fifo_put_data_error(struct usb_fifo *f) { f->flag_iserror = 1; usb2_fifo_wakeup(f); @@ -1876,18 +1876,18 @@ usb2_fifo_put_data_error(struct usb2_fifo *f) * * what: * 0 - normal operation - * 1 - only get one "usb2_mbuf" + * 1 - only get one "usb_mbuf" * * returns: * 0 - no more data * 1 - data in buffer *------------------------------------------------------------------------*/ uint8_t -usb2_fifo_get_data(struct usb2_fifo *f, struct usb2_page_cache *pc, +usb2_fifo_get_data(struct usb_fifo *f, struct usb_page_cache *pc, usb2_frlength_t offset, usb2_frlength_t len, usb2_frlength_t *actlen, uint8_t what) { - struct usb2_mbuf *m; + struct usb_mbuf *m; usb2_frlength_t io_len; uint8_t tr_data = 0; @@ -1949,10 +1949,10 @@ usb2_fifo_get_data(struct usb2_fifo *f, struct usb2_page_cache *pc, } uint8_t -usb2_fifo_get_data_linear(struct usb2_fifo *f, void *ptr, +usb2_fifo_get_data_linear(struct usb_fifo *f, void *ptr, usb2_size_t len, usb2_size_t *actlen, uint8_t what) { - struct usb2_mbuf *m; + struct usb_mbuf *m; usb2_size_t io_len; uint8_t tr_data = 0; @@ -2014,9 +2014,9 @@ usb2_fifo_get_data_linear(struct usb2_fifo *f, void *ptr, } uint8_t -usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, usb2_size_t *plen) +usb2_fifo_get_data_buffer(struct usb_fifo *f, void **pptr, usb2_size_t *plen) { - struct usb2_mbuf *m; + struct usb_mbuf *m; USB_IF_POLL(&f->used_q, m); @@ -2030,7 +2030,7 @@ usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, usb2_size_t *plen) } void -usb2_fifo_get_data_error(struct usb2_fifo *f) +usb2_fifo_get_data_error(struct usb_fifo *f) { f->flag_iserror = 1; usb2_fifo_wakeup(f); @@ -2043,10 +2043,10 @@ usb2_fifo_get_data_error(struct usb2_fifo *f) * NULL: Failure * Else: Pointer to symlink entry *------------------------------------------------------------------------*/ -struct usb2_symlink * +struct usb_symlink * usb2_alloc_symlink(const char *target) { - struct usb2_symlink *ps; + struct usb_symlink *ps; ps = malloc(sizeof(*ps), M_USBDEV, M_WAITOK); if (ps == NULL) { @@ -2068,7 +2068,7 @@ usb2_alloc_symlink(const char *target) * usb2_free_symlink *------------------------------------------------------------------------*/ void -usb2_free_symlink(struct usb2_symlink *ps) +usb2_free_symlink(struct usb_symlink *ps) { if (ps == NULL) { return; @@ -2090,7 +2090,7 @@ usb2_free_symlink(struct usb2_symlink *ps) int usb2_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len) { - struct usb2_symlink *ps; + struct usb_symlink *ps; uint32_t temp; uint32_t delta = 0; uint8_t len; @@ -2182,7 +2182,7 @@ usb2_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len) } void -usb2_fifo_set_close_zlp(struct usb2_fifo *f, uint8_t onoff) +usb2_fifo_set_close_zlp(struct usb_fifo *f, uint8_t onoff) { if (f == NULL) return; diff --git a/sys/dev/usb/usb_dev.h b/sys/dev/usb/usb_dev.h index af252c56ec70..da3966ab496d 100644 --- a/sys/dev/usb/usb_dev.h +++ b/sys/dev/usb/usb_dev.h @@ -38,17 +38,17 @@ #define USB_FIFO_TX 0 #define USB_FIFO_RX 1 -struct usb2_fifo; -struct usb2_mbuf; +struct usb_fifo; +struct usb_mbuf; -typedef int (usb2_fifo_open_t)(struct usb2_fifo *fifo, int fflags); -typedef void (usb2_fifo_close_t)(struct usb2_fifo *fifo, int fflags); -typedef int (usb2_fifo_ioctl_t)(struct usb2_fifo *fifo, u_long cmd, void *addr, int fflags); -typedef void (usb2_fifo_cmd_t)(struct usb2_fifo *fifo); -typedef void (usb2_fifo_filter_t)(struct usb2_fifo *fifo, struct usb2_mbuf *m); +typedef int (usb2_fifo_open_t)(struct usb_fifo *fifo, int fflags); +typedef void (usb2_fifo_close_t)(struct usb_fifo *fifo, int fflags); +typedef int (usb2_fifo_ioctl_t)(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags); +typedef void (usb2_fifo_cmd_t)(struct usb_fifo *fifo); +typedef void (usb2_fifo_filter_t)(struct usb_fifo *fifo, struct usb_mbuf *m); -struct usb2_symlink { - TAILQ_ENTRY(usb2_symlink) sym_entry; +struct usb_symlink { + TAILQ_ENTRY(usb_symlink) sym_entry; char src_path[32]; /* Source path - including terminating * zero */ char dst_path[32]; /* Destination path - including @@ -62,7 +62,7 @@ struct usb2_symlink { * "usb2_fifo_cmd_t" and "usb2_fifo_filter_t" functions are called * locked. The others are called unlocked. */ -struct usb2_fifo_methods { +struct usb_fifo_methods { usb2_fifo_open_t *f_open; usb2_fifo_close_t *f_close; usb2_fifo_ioctl_t *f_ioctl; @@ -84,12 +84,12 @@ struct usb2_fifo_methods { /* * Private per-device information. */ -struct usb2_cdev_privdata { - struct usb2_bus *bus; - struct usb2_device *udev; - struct usb2_interface *iface; - struct usb2_fifo *rxfifo; - struct usb2_fifo *txfifo; +struct usb_cdev_privdata { + struct usb_bus *bus; + struct usb_device *udev; + struct usb_interface *iface; + struct usb_fifo *rxfifo; + struct usb_fifo *txfifo; int bus_index; /* bus index */ int dev_index; /* device index */ int ep_addr; /* endpoint address */ @@ -101,7 +101,7 @@ struct usb2_cdev_privdata { uint8_t is_usbfs; /* USB-FS is active */ }; -struct usb2_fs_privdata { +struct usb_fs_privdata { int bus_index; int dev_index; int ep_addr; @@ -109,29 +109,29 @@ struct usb2_fs_privdata { int fifo_index; struct cdev *cdev; - LIST_ENTRY(usb2_fs_privdata) pd_next; + LIST_ENTRY(usb_fs_privdata) pd_next; }; /* - * Most of the fields in the "usb2_fifo" structure are used by the + * Most of the fields in the "usb_fifo" structure are used by the * generic USB access layer. */ -struct usb2_fifo { - struct usb2_ifqueue free_q; - struct usb2_ifqueue used_q; +struct usb_fifo { + struct usb_ifqueue free_q; + struct usb_ifqueue used_q; struct selinfo selinfo; struct cv cv_io; struct cv cv_drain; - struct usb2_fifo_methods *methods; - struct usb2_symlink *symlink[2];/* our symlinks */ + struct usb_fifo_methods *methods; + struct usb_symlink *symlink[2];/* our symlinks */ struct proc *async_p; /* process that wants SIGIO */ - struct usb2_fs_endpoint *fs_ep_ptr; - struct usb2_device *udev; - struct usb2_xfer *xfer[2]; - struct usb2_xfer **fs_xfer; + struct usb_fs_endpoint *fs_ep_ptr; + struct usb_device *udev; + struct usb_xfer *xfer[2]; + struct usb_xfer **fs_xfer; struct mtx *priv_mtx; /* client data */ /* set if FIFO is opened by a FILE: */ - struct usb2_cdev_privdata *curr_cpd; + struct usb_cdev_privdata *curr_cpd; void *priv_sc0; /* client data */ void *priv_sc1; /* client data */ void *queue_data; @@ -149,53 +149,53 @@ struct usb2_fifo { uint8_t flag_stall; /* set if clear stall should be run */ uint8_t iface_index; /* set to the interface we belong to */ uint8_t fifo_index; /* set to the FIFO index in "struct - * usb2_device" */ + * usb_device" */ uint8_t fs_ep_max; uint8_t fifo_zlp; /* zero length packet count */ uint8_t refcount; #define USB_FIFO_REF_MAX 0xFF }; -struct usb2_fifo_sc { - struct usb2_fifo *fp[2]; +struct usb_fifo_sc { + struct usb_fifo *fp[2]; struct cdev* dev; }; extern struct cdevsw usb2_devsw; -int usb2_fifo_wait(struct usb2_fifo *fifo); -void usb2_fifo_signal(struct usb2_fifo *fifo); -int usb2_fifo_alloc_buffer(struct usb2_fifo *f, uint32_t bufsize, +int usb2_fifo_wait(struct usb_fifo *fifo); +void usb2_fifo_signal(struct usb_fifo *fifo); +int usb2_fifo_alloc_buffer(struct usb_fifo *f, uint32_t bufsize, uint16_t nbuf); -void usb2_fifo_free_buffer(struct usb2_fifo *f); -int usb2_fifo_attach(struct usb2_device *udev, void *priv_sc, - struct mtx *priv_mtx, struct usb2_fifo_methods *pm, - struct usb2_fifo_sc *f_sc, uint16_t unit, uint16_t subunit, +void usb2_fifo_free_buffer(struct usb_fifo *f); +int usb2_fifo_attach(struct usb_device *udev, void *priv_sc, + struct mtx *priv_mtx, struct usb_fifo_methods *pm, + struct usb_fifo_sc *f_sc, uint16_t unit, uint16_t subunit, uint8_t iface_index, uid_t uid, gid_t gid, int mode); -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, +void usb2_fifo_detach(struct usb_fifo_sc *f_sc); +uint32_t usb2_fifo_put_bytes_max(struct usb_fifo *fifo); +void usb2_fifo_put_data(struct usb_fifo *fifo, struct usb_page_cache *pc, usb2_frlength_t offset, usb2_frlength_t len, uint8_t what); -void usb2_fifo_put_data_linear(struct usb2_fifo *fifo, void *ptr, +void usb2_fifo_put_data_linear(struct usb_fifo *fifo, void *ptr, 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, +uint8_t usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb2_size_t len); +void usb2_fifo_put_data_error(struct usb_fifo *fifo); +uint8_t usb2_fifo_get_data(struct usb_fifo *fifo, struct usb_page_cache *pc, 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, +uint8_t usb2_fifo_get_data_linear(struct usb_fifo *fifo, void *ptr, usb2_size_t len, usb2_size_t *actlen, uint8_t what); -uint8_t usb2_fifo_get_data_buffer(struct usb2_fifo *f, void **pptr, +uint8_t usb2_fifo_get_data_buffer(struct usb_fifo *f, void **pptr, usb2_size_t *plen); -void usb2_fifo_get_data_error(struct usb2_fifo *fifo); -uint8_t usb2_fifo_opened(struct usb2_fifo *fifo); -void usb2_fifo_free(struct usb2_fifo *f); -void usb2_fifo_reset(struct usb2_fifo *f); -void usb2_fifo_wakeup(struct usb2_fifo *f); -struct usb2_symlink *usb2_alloc_symlink(const char *target); -void usb2_free_symlink(struct usb2_symlink *ps); +void usb2_fifo_get_data_error(struct usb_fifo *fifo); +uint8_t usb2_fifo_opened(struct usb_fifo *fifo); +void usb2_fifo_free(struct usb_fifo *f); +void usb2_fifo_reset(struct usb_fifo *f); +void usb2_fifo_wakeup(struct usb_fifo *f); +struct usb_symlink *usb2_alloc_symlink(const char *target); +void usb2_free_symlink(struct usb_symlink *ps); int usb2_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len); -void usb2_fifo_set_close_zlp(struct usb2_fifo *, uint8_t); +void usb2_fifo_set_close_zlp(struct usb_fifo *, uint8_t); #endif /* _USB2_DEV_H_ */ diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c index d201a6593041..32d65ba00bea 100644 --- a/sys/dev/usb/usb_device.c +++ b/sys/dev/usb/usb_device.c @@ -57,27 +57,27 @@ /* function prototypes */ -static void usb2_init_pipe(struct usb2_device *, uint8_t, - struct usb2_endpoint_descriptor *, struct usb2_pipe *); -static void usb2_unconfigure(struct usb2_device *, uint8_t); -static void usb2_detach_device(struct usb2_device *, uint8_t, uint8_t); -static void usb2_detach_device_sub(struct usb2_device *, device_t *, +static void usb2_init_pipe(struct usb_device *, uint8_t, + struct usb_endpoint_descriptor *, struct usb_pipe *); +static void usb2_unconfigure(struct usb_device *, uint8_t); +static void usb2_detach_device(struct usb_device *, uint8_t, uint8_t); +static void usb2_detach_device_sub(struct usb_device *, device_t *, uint8_t); -static uint8_t usb2_probe_and_attach_sub(struct usb2_device *, - struct usb2_attach_arg *); -static void usb2_init_attach_arg(struct usb2_device *, - struct usb2_attach_arg *); -static void usb2_suspend_resume_sub(struct usb2_device *, device_t, +static uint8_t usb2_probe_and_attach_sub(struct usb_device *, + struct usb_attach_arg *); +static void usb2_init_attach_arg(struct usb_device *, + struct usb_attach_arg *); +static void usb2_suspend_resume_sub(struct usb_device *, device_t, uint8_t); -static void usb2_clear_stall_proc(struct usb2_proc_msg *_pm); -usb2_error_t usb2_config_parse(struct usb2_device *, uint8_t, uint8_t); -static void usb2_set_device_strings(struct usb2_device *); +static void usb2_clear_stall_proc(struct usb_proc_msg *_pm); +usb2_error_t usb2_config_parse(struct usb_device *, uint8_t, uint8_t); +static void usb2_set_device_strings(struct usb_device *); #if USB_HAVE_UGEN -static void usb2_notify_addq(const char *type, struct usb2_device *); -static void usb2_fifo_free_wrap(struct usb2_device *, uint8_t, uint8_t); -static struct cdev *usb2_make_dev(struct usb2_device *, int, int); -static void usb2_cdev_create(struct usb2_device *); -static void usb2_cdev_free(struct usb2_device *); +static void usb2_notify_addq(const char *type, struct usb_device *); +static void usb2_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); +static struct cdev *usb2_make_dev(struct usb_device *, int, int); +static void usb2_cdev_create(struct usb_device *); +static void usb2_cdev_free(struct usb_device *); static void usb2_cdev_cleanup(void *); #endif @@ -112,11 +112,11 @@ usb2_statestr(enum usb_dev_state state) * NULL: Failure * Else: Success *------------------------------------------------------------------------*/ -struct usb2_pipe * -usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val) +struct usb_pipe * +usb2_get_pipe_by_addr(struct usb_device *udev, uint8_t ea_val) { - struct usb2_pipe *pipe = udev->pipes; - struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max; + struct usb_pipe *pipe = udev->pipes; + struct usb_pipe *pipe_end = udev->pipes + udev->pipes_max; enum { EA_MASK = (UE_DIR_IN | UE_DIR_OUT | UE_ADDR), }; @@ -160,18 +160,18 @@ found: * usb2_get_pipe * * This function searches for an USB pipe based on the information - * given by the passed "struct usb2_config" pointer. + * given by the passed "struct usb_config" pointer. * * Return values: * NULL: No match. - * Else: Pointer to "struct usb2_pipe". + * Else: Pointer to "struct usb_pipe". *------------------------------------------------------------------------*/ -struct usb2_pipe * -usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index, - const struct usb2_config *setup) +struct usb_pipe * +usb2_get_pipe(struct usb_device *udev, uint8_t iface_index, + const struct usb_config *setup) { - struct usb2_pipe *pipe = udev->pipes; - struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max; + struct usb_pipe *pipe = udev->pipes; + struct usb_pipe *pipe_end = udev->pipes + udev->pipes_max; uint8_t index = setup->ep_index; uint8_t ea_mask; uint8_t ea_val; @@ -288,7 +288,7 @@ found: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_interface_count(struct usb2_device *udev, uint8_t *count) +usb2_interface_count(struct usb_device *udev, uint8_t *count) { if (udev->cdesc == NULL) { *count = 0; @@ -307,10 +307,10 @@ usb2_interface_count(struct usb2_device *udev, uint8_t *count) * zeroed before calling this function. *------------------------------------------------------------------------*/ static void -usb2_init_pipe(struct usb2_device *udev, uint8_t iface_index, - struct usb2_endpoint_descriptor *edesc, struct usb2_pipe *pipe) +usb2_init_pipe(struct usb_device *udev, uint8_t iface_index, + struct usb_endpoint_descriptor *edesc, struct usb_pipe *pipe) { - struct usb2_bus_methods *methods; + struct usb_bus_methods *methods; methods = udev->bus->methods; @@ -344,10 +344,10 @@ usb2_init_pipe(struct usb2_device *udev, uint8_t iface_index, * NULL: End of USB pipes * Else: Pointer to next USB pipe *------------------------------------------------------------------------*/ -struct usb2_pipe * -usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe) +struct usb_pipe * +usb2_pipe_foreach(struct usb_device *udev, struct usb_pipe *pipe) { - struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max; + struct usb_pipe *pipe_end = udev->pipes + udev->pipes_max; /* be NULL safe */ if (udev == NULL) @@ -377,7 +377,7 @@ usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe) * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ static void -usb2_unconfigure(struct usb2_device *udev, uint8_t flag) +usb2_unconfigure(struct usb_device *udev, uint8_t flag) { uint8_t do_unlock; @@ -404,9 +404,9 @@ usb2_unconfigure(struct usb2_device *udev, uint8_t flag) #if USB_HAVE_COMPAT_LINUX /* free Linux compat device, if any */ - if (udev->linux_dev) { - usb_linux_free_device(udev->linux_dev); - udev->linux_dev = NULL; + if (udev->linux_endpoint_start) { + usb_linux_free_device(udev); + udev->linux_endpoint_start = NULL; } #endif @@ -439,10 +439,10 @@ usb2_unconfigure(struct usb2_device *udev, uint8_t flag) * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_set_config_index(struct usb2_device *udev, uint8_t index) +usb2_set_config_index(struct usb_device *udev, uint8_t index) { - struct usb2_status ds; - struct usb2_config_descriptor *cdp; + struct usb_status ds; + struct usb_config_descriptor *cdp; uint16_t power; uint16_t max_power; uint8_t selfpowered; @@ -589,13 +589,13 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_config_parse(struct usb2_device *udev, uint8_t iface_index, uint8_t cmd) +usb2_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd) { - struct usb2_idesc_parse_state ips; - struct usb2_interface_descriptor *id; - struct usb2_endpoint_descriptor *ed; - struct usb2_interface *iface; - struct usb2_pipe *pipe; + struct usb_idesc_parse_state ips; + struct usb_interface_descriptor *id; + struct usb_endpoint_descriptor *ed; + struct usb_interface *iface; + struct usb_pipe *pipe; usb2_error_t err; uint8_t ep_curr; uint8_t ep_max; @@ -698,7 +698,7 @@ usb2_config_parse(struct usb2_device *udev, uint8_t iface_index, uint8_t cmd) DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints); - ed = (struct usb2_endpoint_descriptor *)id; + ed = (struct usb_endpoint_descriptor *)id; temp = ep_curr; @@ -722,7 +722,7 @@ usb2_config_parse(struct usb2_device *udev, uint8_t iface_index, uint8_t cmd) ep_max = temp; /* optimalisation */ - id = (struct usb2_interface_descriptor *)ed; + id = (struct usb_interface_descriptor *)ed; } } @@ -795,10 +795,10 @@ cleanup: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_set_alt_interface_index(struct usb2_device *udev, +usb2_set_alt_interface_index(struct usb_device *udev, uint8_t iface_index, uint8_t alt_index) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_interface *iface = usb2_get_iface(udev, iface_index); usb2_error_t err; uint8_t do_unlock; @@ -859,10 +859,10 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_set_endpoint_stall(struct usb2_device *udev, struct usb2_pipe *pipe, +usb2_set_endpoint_stall(struct usb_device *udev, struct usb_pipe *pipe, uint8_t do_stall) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; uint8_t et; uint8_t was_stalled; @@ -935,10 +935,10 @@ usb2_set_endpoint_stall(struct usb2_device *udev, struct usb2_pipe *pipe, * usb2_reset_iface_endpoints - used in USB device side mode *------------------------------------------------------------------------*/ usb2_error_t -usb2_reset_iface_endpoints(struct usb2_device *udev, uint8_t iface_index) +usb2_reset_iface_endpoints(struct usb_device *udev, uint8_t iface_index) { - struct usb2_pipe *pipe; - struct usb2_pipe *pipe_end; + struct usb_pipe *pipe; + struct usb_pipe *pipe_end; usb2_error_t err; pipe = udev->pipes; @@ -968,7 +968,7 @@ usb2_reset_iface_endpoints(struct usb2_device *udev, uint8_t iface_index) * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ static void -usb2_detach_device_sub(struct usb2_device *udev, device_t *ppdev, +usb2_detach_device_sub(struct usb_device *udev, device_t *ppdev, uint8_t flag) { device_t dev; @@ -1024,10 +1024,10 @@ error: * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ void -usb2_detach_device(struct usb2_device *udev, uint8_t iface_index, +usb2_detach_device(struct usb_device *udev, uint8_t iface_index, uint8_t flag) { - struct usb2_interface *iface; + struct usb_interface *iface; uint8_t i; if (udev == NULL) { @@ -1073,10 +1073,10 @@ usb2_detach_device(struct usb2_device *udev, uint8_t iface_index, * Else: Failure *------------------------------------------------------------------------*/ static uint8_t -usb2_probe_and_attach_sub(struct usb2_device *udev, - struct usb2_attach_arg *uaa) +usb2_probe_and_attach_sub(struct usb_device *udev, + struct usb_attach_arg *uaa) { - struct usb2_interface *iface; + struct usb_interface *iface; device_t dev; int err; @@ -1158,10 +1158,10 @@ usb2_probe_and_attach_sub(struct usb2_device *udev, * locked. *------------------------------------------------------------------------*/ void -usb2_set_parent_iface(struct usb2_device *udev, uint8_t iface_index, +usb2_set_parent_iface(struct usb_device *udev, uint8_t iface_index, uint8_t parent_index) { - struct usb2_interface *iface; + struct usb_interface *iface; iface = usb2_get_iface(udev, iface_index); if (iface) { @@ -1170,8 +1170,8 @@ usb2_set_parent_iface(struct usb2_device *udev, uint8_t iface_index, } static void -usb2_init_attach_arg(struct usb2_device *udev, - struct usb2_attach_arg *uaa) +usb2_init_attach_arg(struct usb_device *udev, + struct usb_attach_arg *uaa) { bzero(uaa, sizeof(*uaa)); @@ -1200,10 +1200,10 @@ usb2_init_attach_arg(struct usb2_device *udev, * Else: A control transfer failed *------------------------------------------------------------------------*/ usb2_error_t -usb2_probe_and_attach(struct usb2_device *udev, uint8_t iface_index) +usb2_probe_and_attach(struct usb_device *udev, uint8_t iface_index) { - struct usb2_attach_arg uaa; - struct usb2_interface *iface; + struct usb_attach_arg uaa; + struct usb_interface *iface; uint8_t i; uint8_t j; uint8_t do_unlock; @@ -1309,7 +1309,7 @@ done: * be executed on an USB device. *------------------------------------------------------------------------*/ static void -usb2_suspend_resume_sub(struct usb2_device *udev, device_t dev, uint8_t do_suspend) +usb2_suspend_resume_sub(struct usb_device *udev, device_t dev, uint8_t do_suspend) { int err; @@ -1340,9 +1340,9 @@ usb2_suspend_resume_sub(struct usb2_device *udev, device_t dev, uint8_t do_suspe * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_suspend_resume(struct usb2_device *udev, uint8_t do_suspend) +usb2_suspend_resume(struct usb_device *udev, uint8_t do_suspend) { - struct usb2_interface *iface; + struct usb_interface *iface; uint8_t i; if (udev == NULL) { @@ -1383,10 +1383,10 @@ usb2_suspend_resume(struct usb2_device *udev, uint8_t do_suspend) * This function performs generic USB clear stall operations. *------------------------------------------------------------------------*/ static void -usb2_clear_stall_proc(struct usb2_proc_msg *_pm) +usb2_clear_stall_proc(struct usb_proc_msg *_pm) { - struct usb2_clear_stall_msg *pm = (void *)_pm; - struct usb2_device *udev = pm->udev; + struct usb_clear_stall_msg *pm = (void *)_pm; + struct usb_device *udev = pm->udev; /* Change lock */ USB_BUS_UNLOCK(udev->bus); @@ -1412,15 +1412,15 @@ usb2_clear_stall_proc(struct usb2_proc_msg *_pm) * 0: Failure * Else: Success *------------------------------------------------------------------------*/ -struct usb2_device * -usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus, - struct usb2_device *parent_hub, uint8_t depth, uint8_t port_index, +struct usb_device * +usb2_alloc_device(device_t parent_dev, struct usb_bus *bus, + struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode) { - struct usb2_attach_arg uaa; - struct usb2_device *udev; - struct usb2_device *adev; - struct usb2_device *hub; + struct usb_attach_arg uaa; + struct usb_device *udev; + struct usb_device *adev; + struct usb_device *hub; uint8_t *scratch_ptr; uint32_t scratch_size; usb2_error_t err; @@ -1796,13 +1796,13 @@ done: #if USB_HAVE_UGEN static struct cdev * -usb2_make_dev(struct usb2_device *udev, int ep, int mode) +usb2_make_dev(struct usb_device *udev, int ep, int mode) { - struct usb2_fs_privdata* pd; + struct usb_fs_privdata* pd; char devname[20]; /* Store information to locate ourselves again later */ - pd = malloc(sizeof(struct usb2_fs_privdata), M_USBDEV, + pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); pd->bus_index = device_get_unit(udev->bus->bdev); pd->dev_index = udev->device_index; @@ -1820,12 +1820,12 @@ usb2_make_dev(struct usb2_device *udev, int ep, int mode) } static void -usb2_cdev_create(struct usb2_device *udev) +usb2_cdev_create(struct usb_device *udev) { - struct usb2_config_descriptor *cd; - struct usb2_endpoint_descriptor *ed; - struct usb2_descriptor *desc; - struct usb2_fs_privdata* pd; + struct usb_config_descriptor *cd; + struct usb_endpoint_descriptor *ed; + struct usb_descriptor *desc; + struct usb_fs_privdata* pd; struct cdev *dev; int inmode, outmode, inmask, outmask, mode; uint8_t ep; @@ -1855,7 +1855,7 @@ usb2_cdev_create(struct usb2_device *udev) /* filter out all endpoint descriptors */ if ((desc->bDescriptorType == UDESC_ENDPOINT) && (desc->bLength >= sizeof(*ed))) { - ed = (struct usb2_endpoint_descriptor *)desc; + ed = (struct usb_endpoint_descriptor *)desc; /* update masks */ ep = ed->bEndpointAddress; @@ -1880,9 +1880,9 @@ usb2_cdev_create(struct usb2_device *udev) } static void -usb2_cdev_free(struct usb2_device *udev) +usb2_cdev_free(struct usb_device *udev) { - struct usb2_fs_privdata* pd; + struct usb_fs_privdata* pd; DPRINTFN(2, "Freeing device nodes\n"); @@ -1910,9 +1910,9 @@ usb2_cdev_cleanup(void* arg) * Flag values, see "USB_UNCFG_FLAG_XXX". *------------------------------------------------------------------------*/ void -usb2_free_device(struct usb2_device *udev, uint8_t flag) +usb2_free_device(struct usb_device *udev, uint8_t flag) { - struct usb2_bus *bus; + struct usb_bus *bus; if (udev == NULL) return; /* already freed */ @@ -2003,10 +2003,10 @@ usb2_free_device(struct usb2_device *udev, uint8_t flag) * NULL: Interface not present. * Else: Pointer to USB interface structure. *------------------------------------------------------------------------*/ -struct usb2_interface * -usb2_get_iface(struct usb2_device *udev, uint8_t iface_index) +struct usb_interface * +usb2_get_iface(struct usb_device *udev, uint8_t iface_index) { - struct usb2_interface *iface = udev->ifaces + iface_index; + struct usb_interface *iface = udev->ifaces + iface_index; if (iface_index >= udev->ifaces_max) return (NULL); @@ -2029,13 +2029,13 @@ usb2_get_iface(struct usb2_device *udev, uint8_t iface_index) * Else: A descriptor matching the criteria *------------------------------------------------------------------------*/ void * -usb2_find_descriptor(struct usb2_device *udev, void *id, uint8_t iface_index, +usb2_find_descriptor(struct usb_device *udev, void *id, uint8_t iface_index, uint8_t type, uint8_t type_mask, uint8_t subtype, uint8_t subtype_mask) { - struct usb2_descriptor *desc; - struct usb2_config_descriptor *cd; - struct usb2_interface *iface; + struct usb_descriptor *desc; + struct usb_config_descriptor *cd; + struct usb_interface *iface; cd = usb2_get_config_descriptor(udev); if (cd == NULL) { @@ -2075,9 +2075,9 @@ usb2_find_descriptor(struct usb2_device *udev, void *id, uint8_t iface_index, * including the terminating zero. *------------------------------------------------------------------------*/ void -usb2_devinfo(struct usb2_device *udev, char *dst_ptr, uint16_t dst_len) +usb2_devinfo(struct usb_device *udev, char *dst_ptr, uint16_t dst_len) { - struct usb2_device_descriptor *udd = &udev->ddesc; + struct usb_device_descriptor *udd = &udev->ddesc; uint16_t bcdDevice; uint16_t bcdUSB; @@ -2121,9 +2121,9 @@ struct usb_knowndev { #endif /* USB_VERBOSE */ static void -usb2_set_device_strings(struct usb2_device *udev) +usb2_set_device_strings(struct usb_device *udev) { - struct usb2_device_descriptor *udd = &udev->ddesc; + struct usb_device_descriptor *udd = &udev->ddesc; #if USB_VERBOSE const struct usb_knowndev *kdp; #endif @@ -2194,7 +2194,7 @@ usb2_set_device_strings(struct usb2_device *udev) * See: USB_MODE_XXX */ enum usb_hc_mode -usb2_get_mode(struct usb2_device *udev) +usb2_get_mode(struct usb_device *udev) { return (udev->flags.usb_mode); } @@ -2204,13 +2204,13 @@ usb2_get_mode(struct usb2_device *udev) * See: USB_SPEED_XXX */ enum usb_dev_speed -usb2_get_speed(struct usb2_device *udev) +usb2_get_speed(struct usb_device *udev) { return (udev->speed); } uint32_t -usb2_get_isoc_fps(struct usb2_device *udev) +usb2_get_isoc_fps(struct usb_device *udev) { ; /* indent fix */ switch (udev->speed) { @@ -2222,16 +2222,16 @@ usb2_get_isoc_fps(struct usb2_device *udev) } } -struct usb2_device_descriptor * -usb2_get_device_descriptor(struct usb2_device *udev) +struct usb_device_descriptor * +usb2_get_device_descriptor(struct usb_device *udev) { if (udev == NULL) return (NULL); /* be NULL safe */ return (&udev->ddesc); } -struct usb2_config_descriptor * -usb2_get_config_descriptor(struct usb2_device *udev) +struct usb_config_descriptor * +usb2_get_config_descriptor(struct usb_device *udev) { if (udev == NULL) return (NULL); /* be NULL safe */ @@ -2246,7 +2246,7 @@ usb2_get_config_descriptor(struct usb2_device *udev) * Else: The USB device has the given quirk. *------------------------------------------------------------------------*/ uint8_t -usb2_test_quirk(const struct usb2_attach_arg *uaa, uint16_t quirk) +usb2_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; @@ -2254,8 +2254,8 @@ usb2_test_quirk(const struct usb2_attach_arg *uaa, uint16_t quirk) return (found); } -struct usb2_interface_descriptor * -usb2_get_interface_descriptor(struct usb2_interface *iface) +struct usb_interface_descriptor * +usb2_get_interface_descriptor(struct usb_interface *iface) { if (iface == NULL) return (NULL); /* be NULL safe */ @@ -2263,19 +2263,19 @@ usb2_get_interface_descriptor(struct usb2_interface *iface) } uint8_t -usb2_get_interface_altindex(struct usb2_interface *iface) +usb2_get_interface_altindex(struct usb_interface *iface) { return (iface->alt_index); } uint8_t -usb2_get_bus_index(struct usb2_device *udev) +usb2_get_bus_index(struct usb_device *udev) { return ((uint8_t)device_get_unit(udev->bus->bdev)); } uint8_t -usb2_get_device_index(struct usb2_device *udev) +usb2_get_device_index(struct usb_device *udev) { return (udev->device_index); } @@ -2287,7 +2287,7 @@ usb2_get_device_index(struct usb2_device *udev) * This function will generate events for dev. *------------------------------------------------------------------------*/ static void -usb2_notify_addq(const char *type, struct usb2_device *udev) +usb2_notify_addq(const char *type, struct usb_device *udev) { char *data = NULL; struct malloc_type *mt; @@ -2343,10 +2343,10 @@ usb2_notify_addq(const char *type, struct usb2_device *udev) * "USB_IFACE_INDEX_ANY" the flag has no effect. *------------------------------------------------------------------------*/ static void -usb2_fifo_free_wrap(struct usb2_device *udev, +usb2_fifo_free_wrap(struct usb_device *udev, uint8_t iface_index, uint8_t flag) { - struct usb2_fifo *f; + struct usb_fifo *f; uint16_t i; /* @@ -2397,9 +2397,9 @@ usb2_fifo_free_wrap(struct usb2_device *udev, * Else: Peer can do resume signalling. *------------------------------------------------------------------------*/ uint8_t -usb2_peer_can_wakeup(struct usb2_device *udev) +usb2_peer_can_wakeup(struct usb_device *udev) { - const struct usb2_config_descriptor *cdp; + const struct usb_config_descriptor *cdp; cdp = udev->cdesc; if ((cdp != NULL) && (udev->flags.usb_mode == USB_MODE_HOST)) { @@ -2409,7 +2409,7 @@ usb2_peer_can_wakeup(struct usb2_device *udev) } void -usb2_set_device_state(struct usb2_device *udev, enum usb_dev_state state) +usb2_set_device_state(struct usb_device *udev, enum usb_dev_state state) { KASSERT(state < USB_STATE_MAX, ("invalid udev state")); @@ -2420,7 +2420,7 @@ usb2_set_device_state(struct usb2_device *udev, enum usb_dev_state state) } uint8_t -usb2_device_attached(struct usb2_device *udev) +usb2_device_attached(struct usb_device *udev) { return (udev->state > USB_STATE_DETACHED); } diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h index 647757111c16..2a5f163427f6 100644 --- a/sys/dev/usb/usb_device.h +++ b/sys/dev/usb/usb_device.h @@ -27,7 +27,7 @@ #ifndef _USB2_DEVICE_H_ #define _USB2_DEVICE_H_ -struct usb2_symlink; /* UGEN */ +struct usb_symlink; /* UGEN */ struct usb_device; /* linux compat */ #define USB_DEFAULT_XFER_MAX 2 @@ -44,20 +44,47 @@ struct usb_device; /* linux compat */ #define USB_UNCFG_FLAG_FREE_SUBDEV 0x01 /* subdevices are freed */ #define USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */ -struct usb2_clear_stall_msg { - struct usb2_proc_msg hdr; - struct usb2_device *udev; +struct usb_clear_stall_msg { + struct usb_proc_msg hdr; + struct usb_device *udev; }; +/* The following four structures makes up a tree, where we have the + * leaf structure, "usb_host_endpoint", first, and the root structure, + * "usb_device", last. The four structures below mirror the structure + * of the USB descriptors belonging to an USB configuration. Please + * refer to the USB specification for a definition of "endpoints" and + * "interfaces". + */ +struct usb_host_endpoint { + struct usb_endpoint_descriptor desc; + TAILQ_HEAD(, urb) bsd_urb_list; + struct usb_xfer *bsd_xfer[2]; + uint8_t *extra; /* Extra descriptors */ + usb2_frlength_t fbsd_buf_size; + uint16_t extralen; + uint8_t bsd_iface_index; +} __aligned(USB_HOST_ALIGN); + +struct usb_host_interface { + struct usb_interface_descriptor desc; + /* the following array has size "desc.bNumEndpoint" */ + struct usb_host_endpoint *endpoint; + const char *string; /* iInterface string, if present */ + uint8_t *extra; /* Extra descriptors */ + uint16_t extralen; + uint8_t bsd_iface_index; +} __aligned(USB_HOST_ALIGN); + /* * The following structure defines an USB pipe which is equal to an * USB endpoint. */ -struct usb2_pipe { - struct usb2_xfer_queue pipe_q; /* queue of USB transfers */ +struct usb_pipe { + struct usb_xfer_queue pipe_q; /* queue of USB transfers */ - struct usb2_endpoint_descriptor *edesc; - struct usb2_pipe_methods *methods; /* set by HC driver */ + struct usb_endpoint_descriptor *edesc; + struct usb_pipe_methods *methods; /* set by HC driver */ uint16_t isoc_next; uint16_t refcount; @@ -72,17 +99,25 @@ struct usb2_pipe { /* * The following structure defines an USB interface. */ -struct usb2_interface { - struct usb2_interface_descriptor *idesc; +struct usb_interface { + struct usb_interface_descriptor *idesc; device_t subdev; uint8_t alt_index; uint8_t parent_iface_index; + + /* Linux compat */ + struct usb_host_interface *altsetting; + struct usb_host_interface *cur_altsetting; + struct usb_device *linux_udev; + void *bsd_priv_sc; /* device specific information */ + uint8_t num_altsetting; /* number of alternate settings */ + uint8_t bsd_iface_index; }; /* * The following structure defines the USB device flags. */ -struct usb2_device_flags { +struct usb_device_flags { enum usb_hc_mode usb_mode; /* host or device mode */ uint8_t self_powered:1; /* set if USB device is self powered */ uint8_t no_strings:1; /* set if USB device does not support @@ -103,7 +138,7 @@ struct usb2_device_flags { * The following structure is used for power-save purposes. The data * in this structure is protected by the USB BUS lock. */ -struct usb2_power_save { +struct usb_power_save { usb2_ticks_t last_xfer_time; /* copy of "ticks" */ usb2_size_t type_refs[4]; /* transfer reference count */ usb2_size_t read_refs; /* data read references */ @@ -114,33 +149,30 @@ struct usb2_power_save { * The following structure defines an USB device. There exists one of * these structures for every USB device. */ -struct usb2_device { - struct usb2_clear_stall_msg cs_msg[2]; /* generic clear stall +struct usb_device { + struct usb_clear_stall_msg cs_msg[2]; /* generic clear stall * messages */ struct sx default_sx[2]; struct mtx default_mtx[1]; struct cv default_cv[2]; - struct usb2_interface *ifaces; - struct usb2_pipe default_pipe; /* Control Endpoint 0 */ - struct usb2_pipe *pipes; - struct usb2_power_save pwr_save;/* power save data */ - struct usb2_bus *bus; /* our USB BUS */ + struct usb_interface *ifaces; + struct usb_pipe default_pipe; /* Control Endpoint 0 */ + struct usb_pipe *pipes; + struct usb_power_save pwr_save;/* power save data */ + struct usb_bus *bus; /* our USB BUS */ device_t parent_dev; /* parent device */ - struct usb2_device *parent_hub; - struct usb2_device *parent_hs_hub; /* high-speed parent HUB */ - struct usb2_config_descriptor *cdesc; /* full config descr */ - struct usb2_hub *hub; /* only if this is a hub */ -#if USB_HAVE_COMPAT_LINUX - struct usb_device *linux_dev; -#endif - struct usb2_xfer *default_xfer[USB_DEFAULT_XFER_MAX]; - struct usb2_temp_data *usb2_template_ptr; - struct usb2_pipe *pipe_curr; /* current clear stall pipe */ + struct usb_device *parent_hub; + struct usb_device *parent_hs_hub; /* high-speed parent HUB */ + struct usb_config_descriptor *cdesc; /* full config descr */ + struct usb_hub *hub; /* only if this is a hub */ + struct usb_xfer *default_xfer[USB_DEFAULT_XFER_MAX]; + struct usb_temp_data *usb2_template_ptr; + struct usb_pipe *pipe_curr; /* current clear stall pipe */ #if USB_HAVE_UGEN - struct usb2_fifo *fifo[USB_FIFO_MAX]; - struct usb2_symlink *ugen_symlink; /* our generic symlink */ + struct usb_fifo *fifo[USB_FIFO_MAX]; + struct usb_symlink *ugen_symlink; /* our generic symlink */ struct cdev *default_dev; /* Control Endpoint 0 device node */ - LIST_HEAD(,usb2_fs_privdata) pd_list; + LIST_HEAD(,usb_fs_privdata) pd_list; char ugen_name[20]; /* name of ugenX.X device */ #endif usb2_ticks_t plugtime; /* copy of "ticks" */ @@ -169,14 +201,25 @@ struct usb2_device { /* the "flags" field is write-protected by "bus->mtx" */ - struct usb2_device_flags flags; + struct usb_device_flags flags; - struct usb2_endpoint_descriptor default_ep_desc; /* for pipe 0 */ - struct usb2_device_descriptor ddesc; /* device descriptor */ + struct usb_endpoint_descriptor default_ep_desc; /* for pipe 0 */ + struct usb_device_descriptor ddesc; /* device descriptor */ char *serial; /* serial number */ char *manufacturer; /* manufacturer string */ char *product; /* product string */ + +#if USB_HAVE_COMPAT_LINUX + /* Linux compat */ + struct usb_device_descriptor descriptor; + struct usb_host_endpoint ep0; + struct usb_interface *linux_iface_start; + struct usb_interface *linux_iface_end; + struct usb_host_endpoint *linux_endpoint_start; + struct usb_host_endpoint *linux_endpoint_end; + uint16_t devnum; +#endif }; /* globals */ @@ -185,32 +228,32 @@ extern int usb2_template; /* function prototypes */ -struct usb2_device *usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus, - struct usb2_device *parent_hub, uint8_t depth, +struct usb_device *usb2_alloc_device(device_t parent_dev, struct usb_bus *bus, + struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode); -struct usb2_pipe *usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index, - const struct usb2_config *setup); -struct usb2_pipe *usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val); -usb2_error_t usb2_interface_count(struct usb2_device *udev, uint8_t *count); -usb2_error_t usb2_probe_and_attach(struct usb2_device *udev, +struct usb_pipe *usb2_get_pipe(struct usb_device *udev, uint8_t iface_index, + const struct usb_config *setup); +struct usb_pipe *usb2_get_pipe_by_addr(struct usb_device *udev, uint8_t ea_val); +usb2_error_t usb2_interface_count(struct usb_device *udev, uint8_t *count); +usb2_error_t usb2_probe_and_attach(struct usb_device *udev, uint8_t iface_index); -usb2_error_t usb2_reset_iface_endpoints(struct usb2_device *udev, +usb2_error_t usb2_reset_iface_endpoints(struct usb_device *udev, uint8_t iface_index); -usb2_error_t usb2_set_config_index(struct usb2_device *udev, uint8_t index); -usb2_error_t usb2_set_endpoint_stall(struct usb2_device *udev, - struct usb2_pipe *pipe, uint8_t do_stall); -usb2_error_t usb2_suspend_resume(struct usb2_device *udev, +usb2_error_t usb2_set_config_index(struct usb_device *udev, uint8_t index); +usb2_error_t usb2_set_endpoint_stall(struct usb_device *udev, + struct usb_pipe *pipe, uint8_t do_stall); +usb2_error_t usb2_suspend_resume(struct usb_device *udev, uint8_t do_suspend); -void usb2_devinfo(struct usb2_device *udev, char *dst_ptr, uint16_t dst_len); -void usb2_free_device(struct usb2_device *, uint8_t); -void *usb2_find_descriptor(struct usb2_device *udev, void *id, +void usb2_devinfo(struct usb_device *udev, char *dst_ptr, uint16_t dst_len); +void usb2_free_device(struct usb_device *, uint8_t); +void *usb2_find_descriptor(struct usb_device *udev, void *id, uint8_t iface_index, uint8_t type, uint8_t type_mask, uint8_t subtype, uint8_t subtype_mask); void usb_linux_free_device(struct usb_device *dev); -uint8_t usb2_peer_can_wakeup(struct usb2_device *udev); -struct usb2_pipe *usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe); -void usb2_set_device_state(struct usb2_device *udev, +uint8_t usb2_peer_can_wakeup(struct usb_device *udev); +struct usb_pipe *usb2_pipe_foreach(struct usb_device *udev, struct usb_pipe *pipe); +void usb2_set_device_state(struct usb_device *udev, enum usb_dev_state state); #endif /* _USB2_DEVICE_H_ */ diff --git a/sys/dev/usb/usb_dynamic.c b/sys/dev/usb/usb_dynamic.c index 94095cecc8e9..e06379d2196c 100644 --- a/sys/dev/usb/usb_dynamic.c +++ b/sys/dev/usb/usb_dynamic.c @@ -51,13 +51,13 @@ usb2_quirk_ioctl_t *usb2_quirk_ioctl_p = &usb2_quirk_ioctl_w; devclass_t usb2_devclass_ptr = NULL; static usb2_error_t -usb2_temp_setup_by_index_w(struct usb2_device *udev, uint16_t index) +usb2_temp_setup_by_index_w(struct usb_device *udev, uint16_t index) { return (USB_ERR_INVAL); } static uint8_t -usb2_test_quirk_w(const struct usb2_lookup_info *info, uint16_t quirk) +usb2_test_quirk_w(const struct usb_lookup_info *info, uint16_t quirk) { return (0); /* no match */ } @@ -69,14 +69,14 @@ usb2_quirk_ioctl_w(unsigned long cmd, caddr_t data, int fflag, struct thread *td } static usb2_error_t -usb2_temp_get_desc_w(struct usb2_device *udev, struct usb2_device_request *req, const void **pPtr, uint16_t *pLength) +usb2_temp_get_desc_w(struct usb_device *udev, struct usb_device_request *req, const void **pPtr, uint16_t *pLength) { /* stall */ return (USB_ERR_STALLED); } static void -usb2_temp_unsetup_w(struct usb2_device *udev) +usb2_temp_unsetup_w(struct usb_device *udev) { if (udev->usb2_template_ptr) { @@ -87,8 +87,8 @@ usb2_temp_unsetup_w(struct usb2_device *udev) } static uint8_t -usb2_test_huawei_autoinst_w(struct usb2_device *udev, - struct usb2_attach_arg *uaa) +usb2_test_huawei_autoinst_w(struct usb_device *udev, + struct usb_attach_arg *uaa) { return (USB_ERR_INVAL); } diff --git a/sys/dev/usb/usb_dynamic.h b/sys/dev/usb/usb_dynamic.h index 4ca62af9c158..88876797d401 100644 --- a/sys/dev/usb/usb_dynamic.h +++ b/sys/dev/usb/usb_dynamic.h @@ -29,21 +29,21 @@ /* prototypes */ -struct usb2_device; -struct usb2_lookup_info; -struct usb2_device_request; +struct usb_device; +struct usb_lookup_info; +struct usb_device_request; /* typedefs */ -typedef usb2_error_t (usb2_temp_setup_by_index_t)(struct usb2_device *udev, +typedef usb2_error_t (usb2_temp_setup_by_index_t)(struct usb_device *udev, uint16_t index); -typedef usb2_error_t (usb2_test_huawei_autoinst_t)(struct usb2_device *udev, - struct usb2_attach_arg *uaa); -typedef uint8_t (usb2_test_quirk_t)(const struct usb2_lookup_info *info, +typedef usb2_error_t (usb2_test_huawei_autoinst_t)(struct usb_device *udev, + struct usb_attach_arg *uaa); +typedef uint8_t (usb2_test_quirk_t)(const struct usb_lookup_info *info, uint16_t quirk); typedef int (usb2_quirk_ioctl_t)(unsigned long cmd, caddr_t data, int fflag, struct thread *td); -typedef void (usb2_temp_unsetup_t)(struct usb2_device *udev); +typedef void (usb2_temp_unsetup_t)(struct usb_device *udev); /* global function pointers */ @@ -62,6 +62,6 @@ void usb2_temp_unload(void *); void usb2_quirk_unload(void *); void usb2_bus_unload(void *); -uint8_t usb2_test_quirk(const struct usb2_attach_arg *uaa, uint16_t quirk); +uint8_t usb2_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk); #endif /* _USB2_DYNAMIC_H_ */ diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index a57211361185..308c66692362 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -73,25 +73,25 @@ static usb2_fifo_cmd_t ugen_start_read; static usb2_fifo_cmd_t ugen_start_write; static usb2_fifo_cmd_t ugen_stop_io; -static int ugen_transfer_setup(struct usb2_fifo *, - const struct usb2_config *, uint8_t); -static int ugen_open_pipe_write(struct usb2_fifo *); -static int ugen_open_pipe_read(struct usb2_fifo *); -static int ugen_set_config(struct usb2_fifo *, uint8_t); -static int ugen_set_interface(struct usb2_fifo *, uint8_t, uint8_t); -static int ugen_get_cdesc(struct usb2_fifo *, struct usb2_gen_descriptor *); -static int ugen_get_sdesc(struct usb2_fifo *, struct usb2_gen_descriptor *); -static int ugen_get_iface_driver(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd); -static int usb2_gen_fill_deviceinfo(struct usb2_fifo *, - struct usb2_device_info *); -static int ugen_re_enumerate(struct usb2_fifo *); -static int ugen_iface_ioctl(struct usb2_fifo *, u_long, void *, int); -static uint8_t ugen_fs_get_complete(struct usb2_fifo *, uint8_t *); -static int ugen_fs_uninit(struct usb2_fifo *f); +static int ugen_transfer_setup(struct usb_fifo *, + const struct usb_config *, uint8_t); +static int ugen_open_pipe_write(struct usb_fifo *); +static int ugen_open_pipe_read(struct usb_fifo *); +static int ugen_set_config(struct usb_fifo *, uint8_t); +static int ugen_set_interface(struct usb_fifo *, uint8_t, uint8_t); +static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *); +static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *); +static int ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd); +static int usb2_gen_fill_deviceinfo(struct usb_fifo *, + struct usb_device_info *); +static int ugen_re_enumerate(struct usb_fifo *); +static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int); +static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *); +static int ugen_fs_uninit(struct usb_fifo *f); /* structures */ -struct usb2_fifo_methods usb2_ugen_methods = { +struct usb_fifo_methods usb2_ugen_methods = { .f_open = &ugen_open, .f_close = &ugen_close, .f_ioctl = &ugen_ioctl, @@ -114,11 +114,11 @@ SYSCTL_INT(_hw_usb_ugen, OID_AUTO, debug, CTLFLAG_RW, &ugen_debug, /* prototypes */ static int -ugen_transfer_setup(struct usb2_fifo *f, - const struct usb2_config *setup, uint8_t n_setup) +ugen_transfer_setup(struct usb_fifo *f, + const struct usb_config *setup, uint8_t n_setup) { - struct usb2_pipe *pipe = f->priv_sc0; - struct usb2_device *udev = f->udev; + struct usb_pipe *pipe = f->priv_sc0; + struct usb_device *udev = f->udev; uint8_t iface_index = pipe->iface_index; int error; @@ -150,10 +150,10 @@ ugen_transfer_setup(struct usb2_fifo *f, } static int -ugen_open(struct usb2_fifo *f, int fflags) +ugen_open(struct usb_fifo *f, int fflags) { - struct usb2_pipe *pipe = f->priv_sc0; - struct usb2_endpoint_descriptor *ed = pipe->edesc; + struct usb_pipe *pipe = f->priv_sc0; + struct usb_endpoint_descriptor *ed = pipe->edesc; uint8_t type; DPRINTFN(6, "flag=0x%x\n", fflags); @@ -184,7 +184,7 @@ ugen_open(struct usb2_fifo *f, int fflags) } static void -ugen_close(struct usb2_fifo *f, int fflags) +ugen_close(struct usb_fifo *f, int fflags) { DPRINTFN(6, "flag=0x%x\n", fflags); @@ -205,11 +205,11 @@ ugen_close(struct usb2_fifo *f, int fflags) } static int -ugen_open_pipe_write(struct usb2_fifo *f) +ugen_open_pipe_write(struct usb_fifo *f) { - struct usb2_config usb2_config[2]; - struct usb2_pipe *pipe = f->priv_sc0; - struct usb2_endpoint_descriptor *ed = pipe->edesc; + struct usb_config usb_config[2]; + struct usb_pipe *pipe = f->priv_sc0; + struct usb_endpoint_descriptor *ed = pipe->edesc; mtx_assert(f->priv_mtx, MA_OWNED); @@ -217,35 +217,35 @@ ugen_open_pipe_write(struct usb2_fifo *f) /* transfers are already opened */ return (0); } - bzero(usb2_config, sizeof(usb2_config)); + bzero(usb_config, sizeof(usb_config)); - usb2_config[1].type = UE_CONTROL; - usb2_config[1].endpoint = 0; - usb2_config[1].direction = UE_DIR_ANY; - usb2_config[1].timeout = 1000; /* 1 second */ - usb2_config[1].interval = 50;/* 50 milliseconds */ - usb2_config[1].bufsize = sizeof(struct usb2_device_request); - usb2_config[1].callback = &ugen_write_clear_stall_callback; - usb2_config[1].usb_mode = USB_MODE_HOST; + usb_config[1].type = UE_CONTROL; + usb_config[1].endpoint = 0; + usb_config[1].direction = UE_DIR_ANY; + usb_config[1].timeout = 1000; /* 1 second */ + usb_config[1].interval = 50;/* 50 milliseconds */ + usb_config[1].bufsize = sizeof(struct usb_device_request); + usb_config[1].callback = &ugen_write_clear_stall_callback; + usb_config[1].usb_mode = USB_MODE_HOST; - usb2_config[0].type = ed->bmAttributes & UE_XFERTYPE; - usb2_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; - usb2_config[0].direction = UE_DIR_TX; - usb2_config[0].interval = USB_DEFAULT_INTERVAL; - usb2_config[0].flags.proxy_buffer = 1; - usb2_config[0].usb_mode = USB_MODE_DUAL; /* both modes */ + usb_config[0].type = ed->bmAttributes & UE_XFERTYPE; + usb_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; + usb_config[0].direction = UE_DIR_TX; + usb_config[0].interval = USB_DEFAULT_INTERVAL; + usb_config[0].flags.proxy_buffer = 1; + usb_config[0].usb_mode = USB_MODE_DUAL; /* both modes */ switch (ed->bmAttributes & UE_XFERTYPE) { case UE_INTERRUPT: case UE_BULK: if (f->flag_short) { - usb2_config[0].flags.force_short_xfer = 1; + usb_config[0].flags.force_short_xfer = 1; } - usb2_config[0].callback = &ugen_default_write_callback; - usb2_config[0].timeout = f->timeout; - usb2_config[0].frames = 1; - usb2_config[0].bufsize = f->bufsize; - if (ugen_transfer_setup(f, usb2_config, 2)) { + usb_config[0].callback = &ugen_default_write_callback; + usb_config[0].timeout = f->timeout; + usb_config[0].frames = 1; + usb_config[0].bufsize = f->bufsize; + if (ugen_transfer_setup(f, usb_config, 2)) { return (EIO); } /* first transfer does not clear stall */ @@ -253,16 +253,16 @@ ugen_open_pipe_write(struct usb2_fifo *f) break; case UE_ISOCHRONOUS: - usb2_config[0].flags.short_xfer_ok = 1; - usb2_config[0].bufsize = 0; /* use default */ - usb2_config[0].frames = f->nframes; - usb2_config[0].callback = &ugen_isoc_write_callback; - usb2_config[0].timeout = 0; + usb_config[0].flags.short_xfer_ok = 1; + usb_config[0].bufsize = 0; /* use default */ + usb_config[0].frames = f->nframes; + usb_config[0].callback = &ugen_isoc_write_callback; + usb_config[0].timeout = 0; /* clone configuration */ - usb2_config[1] = usb2_config[0]; + usb_config[1] = usb_config[0]; - if (ugen_transfer_setup(f, usb2_config, 2)) { + if (ugen_transfer_setup(f, usb_config, 2)) { return (EIO); } break; @@ -273,11 +273,11 @@ ugen_open_pipe_write(struct usb2_fifo *f) } static int -ugen_open_pipe_read(struct usb2_fifo *f) +ugen_open_pipe_read(struct usb_fifo *f) { - struct usb2_config usb2_config[2]; - struct usb2_pipe *pipe = f->priv_sc0; - struct usb2_endpoint_descriptor *ed = pipe->edesc; + struct usb_config usb_config[2]; + struct usb_pipe *pipe = f->priv_sc0; + struct usb_endpoint_descriptor *ed = pipe->edesc; mtx_assert(f->priv_mtx, MA_OWNED); @@ -285,36 +285,36 @@ ugen_open_pipe_read(struct usb2_fifo *f) /* transfers are already opened */ return (0); } - bzero(usb2_config, sizeof(usb2_config)); + bzero(usb_config, sizeof(usb_config)); - usb2_config[1].type = UE_CONTROL; - usb2_config[1].endpoint = 0; - usb2_config[1].direction = UE_DIR_ANY; - usb2_config[1].timeout = 1000; /* 1 second */ - usb2_config[1].interval = 50;/* 50 milliseconds */ - usb2_config[1].bufsize = sizeof(struct usb2_device_request); - usb2_config[1].callback = &ugen_read_clear_stall_callback; - usb2_config[1].usb_mode = USB_MODE_HOST; + usb_config[1].type = UE_CONTROL; + usb_config[1].endpoint = 0; + usb_config[1].direction = UE_DIR_ANY; + usb_config[1].timeout = 1000; /* 1 second */ + usb_config[1].interval = 50;/* 50 milliseconds */ + usb_config[1].bufsize = sizeof(struct usb_device_request); + usb_config[1].callback = &ugen_read_clear_stall_callback; + usb_config[1].usb_mode = USB_MODE_HOST; - usb2_config[0].type = ed->bmAttributes & UE_XFERTYPE; - usb2_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; - usb2_config[0].direction = UE_DIR_RX; - usb2_config[0].interval = USB_DEFAULT_INTERVAL; - usb2_config[0].flags.proxy_buffer = 1; - usb2_config[0].usb_mode = USB_MODE_DUAL; /* both modes */ + usb_config[0].type = ed->bmAttributes & UE_XFERTYPE; + usb_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; + usb_config[0].direction = UE_DIR_RX; + usb_config[0].interval = USB_DEFAULT_INTERVAL; + usb_config[0].flags.proxy_buffer = 1; + usb_config[0].usb_mode = USB_MODE_DUAL; /* both modes */ switch (ed->bmAttributes & UE_XFERTYPE) { case UE_INTERRUPT: case UE_BULK: if (f->flag_short) { - usb2_config[0].flags.short_xfer_ok = 1; + usb_config[0].flags.short_xfer_ok = 1; } - usb2_config[0].timeout = f->timeout; - usb2_config[0].frames = 1; - usb2_config[0].callback = &ugen_default_read_callback; - usb2_config[0].bufsize = f->bufsize; + usb_config[0].timeout = f->timeout; + usb_config[0].frames = 1; + usb_config[0].callback = &ugen_default_read_callback; + usb_config[0].bufsize = f->bufsize; - if (ugen_transfer_setup(f, usb2_config, 2)) { + if (ugen_transfer_setup(f, usb_config, 2)) { return (EIO); } /* first transfer does not clear stall */ @@ -322,16 +322,16 @@ ugen_open_pipe_read(struct usb2_fifo *f) break; case UE_ISOCHRONOUS: - usb2_config[0].flags.short_xfer_ok = 1; - usb2_config[0].bufsize = 0; /* use default */ - usb2_config[0].frames = f->nframes; - usb2_config[0].callback = &ugen_isoc_read_callback; - usb2_config[0].timeout = 0; + usb_config[0].flags.short_xfer_ok = 1; + usb_config[0].bufsize = 0; /* use default */ + usb_config[0].frames = f->nframes; + usb_config[0].callback = &ugen_isoc_read_callback; + usb_config[0].timeout = 0; /* clone configuration */ - usb2_config[1] = usb2_config[0]; + usb_config[1] = usb_config[0]; - if (ugen_transfer_setup(f, usb2_config, 2)) { + if (ugen_transfer_setup(f, usb_config, 2)) { return (EIO); } break; @@ -343,7 +343,7 @@ ugen_open_pipe_read(struct usb2_fifo *f) } static void -ugen_start_read(struct usb2_fifo *f) +ugen_start_read(struct usb_fifo *f) { /* check that pipes are open */ if (ugen_open_pipe_read(f)) { @@ -356,7 +356,7 @@ ugen_start_read(struct usb2_fifo *f) } static void -ugen_start_write(struct usb2_fifo *f) +ugen_start_write(struct usb_fifo *f) { /* check that pipes are open */ if (ugen_open_pipe_write(f)) { @@ -369,7 +369,7 @@ ugen_start_write(struct usb2_fifo *f) } static void -ugen_stop_io(struct usb2_fifo *f) +ugen_stop_io(struct usb_fifo *f) { /* stop transfers */ usb2_transfer_stop(f->xfer[0]); @@ -377,10 +377,10 @@ ugen_stop_io(struct usb2_fifo *f) } static void -ugen_default_read_callback(struct usb2_xfer *xfer) +ugen_default_read_callback(struct usb_xfer *xfer) { - struct usb2_fifo *f = xfer->priv_sc; - struct usb2_mbuf *m; + struct usb_fifo *f = xfer->priv_sc; + struct usb_mbuf *m; DPRINTFN(4, "actlen=%u, aframes=%u\n", xfer->actlen, xfer->aframes); @@ -429,9 +429,9 @@ ugen_default_read_callback(struct usb2_xfer *xfer) } static void -ugen_default_write_callback(struct usb2_xfer *xfer) +ugen_default_write_callback(struct usb_xfer *xfer) { - struct usb2_fifo *f = xfer->priv_sc; + struct usb_fifo *f = xfer->priv_sc; usb2_frlength_t actlen; DPRINTFN(4, "actlen=%u, aframes=%u\n", xfer->actlen, xfer->aframes); @@ -467,10 +467,10 @@ ugen_default_write_callback(struct usb2_xfer *xfer) } static void -ugen_read_clear_stall_callback(struct usb2_xfer *xfer) +ugen_read_clear_stall_callback(struct usb_xfer *xfer) { - struct usb2_fifo *f = xfer->priv_sc; - struct usb2_xfer *xfer_other = f->xfer[0]; + struct usb_fifo *f = xfer->priv_sc; + struct usb_xfer *xfer_other = f->xfer[0]; if (f->flag_stall == 0) { /* nothing to do */ @@ -484,10 +484,10 @@ ugen_read_clear_stall_callback(struct usb2_xfer *xfer) } static void -ugen_write_clear_stall_callback(struct usb2_xfer *xfer) +ugen_write_clear_stall_callback(struct usb_xfer *xfer) { - struct usb2_fifo *f = xfer->priv_sc; - struct usb2_xfer *xfer_other = f->xfer[0]; + struct usb_fifo *f = xfer->priv_sc; + struct usb_xfer *xfer_other = f->xfer[0]; if (f->flag_stall == 0) { /* nothing to do */ @@ -501,9 +501,9 @@ ugen_write_clear_stall_callback(struct usb2_xfer *xfer) } static void -ugen_isoc_read_callback(struct usb2_xfer *xfer) +ugen_isoc_read_callback(struct usb_xfer *xfer) { - struct usb2_fifo *f = xfer->priv_sc; + struct usb_fifo *f = xfer->priv_sc; usb2_frlength_t offset; usb2_frcount_t n; @@ -540,9 +540,9 @@ tr_setup: } static void -ugen_isoc_write_callback(struct usb2_xfer *xfer) +ugen_isoc_write_callback(struct usb_xfer *xfer) { - struct usb2_fifo *f = xfer->priv_sc; + struct usb_fifo *f = xfer->priv_sc; usb2_frlength_t actlen; usb2_frlength_t offset; usb2_frcount_t n; @@ -580,7 +580,7 @@ tr_setup: } static int -ugen_set_config(struct usb2_fifo *f, uint8_t index) +ugen_set_config(struct usb_fifo *f, uint8_t index) { DPRINTFN(2, "index %u\n", index); @@ -610,7 +610,7 @@ ugen_set_config(struct usb2_fifo *f, uint8_t index) } static int -ugen_set_interface(struct usb2_fifo *f, +ugen_set_interface(struct usb_fifo *f, uint8_t iface_index, uint8_t alt_index) { DPRINTFN(2, "%u, %u\n", iface_index, alt_index); @@ -643,10 +643,10 @@ ugen_set_interface(struct usb2_fifo *f, * at the given index. *------------------------------------------------------------------------*/ static int -ugen_get_cdesc(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd) +ugen_get_cdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { - struct usb2_config_descriptor *cdesc; - struct usb2_device *udev = f->udev; + struct usb_config_descriptor *cdesc; + struct usb_device *udev = f->udev; int error; uint16_t len; uint8_t free_data; @@ -692,7 +692,7 @@ ugen_get_cdesc(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd) } static int -ugen_get_sdesc(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd) +ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { void *ptr = f->udev->bus->scratch[0].data; uint16_t size = sizeof(f->udev->bus->scratch[0].data); @@ -727,10 +727,10 @@ ugen_get_sdesc(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd) * Else: Failure *------------------------------------------------------------------------*/ static int -ugen_get_iface_driver(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd) +ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { - struct usb2_device *udev = f->udev; - struct usb2_interface *iface; + struct usb_device *udev = f->udev; + struct usb_interface *iface; const char *ptr; const char *desc; unsigned int len; @@ -789,10 +789,10 @@ ugen_get_iface_driver(struct usb2_fifo *f, struct usb2_gen_descriptor *ugd) * Else: Failure *------------------------------------------------------------------------*/ static int -usb2_gen_fill_deviceinfo(struct usb2_fifo *f, struct usb2_device_info *di) +usb2_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di) { - struct usb2_device *udev; - struct usb2_device *hub; + struct usb_device *udev; + struct usb_device *hub; udev = f->udev; @@ -837,9 +837,9 @@ usb2_gen_fill_deviceinfo(struct usb2_fifo *f, struct usb2_device_info *di) * Else: No access *------------------------------------------------------------------------*/ static int -ugen_check_request(struct usb2_device *udev, struct usb2_device_request *req) +ugen_check_request(struct usb_device *udev, struct usb_device_request *req) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; int error; /* @@ -879,7 +879,7 @@ ugen_check_request(struct usb2_device *udev, struct usb2_device_request *req) } int -ugen_do_request(struct usb2_fifo *f, struct usb2_ctl_request *ur) +ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur) { int error; uint16_t len; @@ -915,9 +915,9 @@ ugen_do_request(struct usb2_fifo *f, struct usb2_ctl_request *ur) * ugen_re_enumerate *------------------------------------------------------------------------*/ static int -ugen_re_enumerate(struct usb2_fifo *f) +ugen_re_enumerate(struct usb_fifo *f) { - struct usb2_device *udev = f->udev; + struct usb_device *udev = f->udev; int error; /* @@ -949,7 +949,7 @@ ugen_re_enumerate(struct usb2_fifo *f) } int -ugen_fs_uninit(struct usb2_fifo *f) +ugen_fs_uninit(struct usb_fifo *f) { if (f->fs_xfer == NULL) { return (EINVAL); @@ -965,9 +965,9 @@ ugen_fs_uninit(struct usb2_fifo *f) } static uint8_t -ugen_fs_get_complete(struct usb2_fifo *f, uint8_t *pindex) +ugen_fs_get_complete(struct usb_fifo *f, uint8_t *pindex) { - struct usb2_mbuf *m; + struct usb_mbuf *m; USB_IF_DEQUEUE(&f->used_q, m); @@ -987,9 +987,9 @@ ugen_fs_get_complete(struct usb2_fifo *f, uint8_t *pindex) } static void -ugen_fs_set_complete(struct usb2_fifo *f, uint8_t index) +ugen_fs_set_complete(struct usb_fifo *f, uint8_t index) { - struct usb2_mbuf *m; + struct usb_mbuf *m; USB_IF_DEQUEUE(&f->free_q, m); @@ -1010,11 +1010,11 @@ ugen_fs_set_complete(struct usb2_fifo *f, uint8_t index) } static int -ugen_fs_copy_in(struct usb2_fifo *f, uint8_t ep_index) +ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index) { - struct usb2_device_request *req; - struct usb2_xfer *xfer; - struct usb2_fs_endpoint fs_ep; + struct usb_device_request *req; + struct usb_xfer *xfer; + struct usb_fs_endpoint fs_ep; void *uaddr; /* userland pointer */ void *kaddr; usb2_frlength_t offset; @@ -1186,12 +1186,12 @@ complete: } static int -ugen_fs_copy_out(struct usb2_fifo *f, uint8_t ep_index) +ugen_fs_copy_out(struct usb_fifo *f, uint8_t ep_index) { - struct usb2_device_request *req; - struct usb2_xfer *xfer; - struct usb2_fs_endpoint fs_ep; - struct usb2_fs_endpoint *fs_ep_uptr; /* userland ptr */ + struct usb_device_request *req; + struct usb_xfer *xfer; + struct usb_fs_endpoint fs_ep; + struct usb_fs_endpoint *fs_ep_uptr; /* userland ptr */ void *uaddr; /* userland ptr */ void *kaddr; usb2_frlength_t offset; @@ -1339,10 +1339,10 @@ done: } static uint8_t -ugen_fifo_in_use(struct usb2_fifo *f, int fflags) +ugen_fifo_in_use(struct usb_fifo *f, int fflags) { - struct usb2_fifo *f_rx; - struct usb2_fifo *f_tx; + struct usb_fifo *f_rx; + struct usb_fifo *f_tx; f_rx = f->udev->fifo[(f->fifo_index & ~1) + USB_FIFO_RX]; f_tx = f->udev->fifo[(f->fifo_index & ~1) + USB_FIFO_TX]; @@ -1359,21 +1359,21 @@ ugen_fifo_in_use(struct usb2_fifo *f, int fflags) } static int -ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) +ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags) { - struct usb2_config usb2_config[1]; - struct usb2_device_request req; + struct usb_config usb_config[1]; + struct usb_device_request req; union { - struct usb2_fs_complete *pcomp; - struct usb2_fs_start *pstart; - struct usb2_fs_stop *pstop; - struct usb2_fs_open *popen; - struct usb2_fs_close *pclose; - struct usb2_fs_clear_stall_sync *pstall; + struct usb_fs_complete *pcomp; + struct usb_fs_start *pstart; + struct usb_fs_stop *pstop; + struct usb_fs_open *popen; + struct usb_fs_close *pclose; + struct usb_fs_clear_stall_sync *pstall; void *addr; } u; - struct usb2_pipe *pipe; - struct usb2_endpoint_descriptor *ed; + struct usb_pipe *pipe; + struct usb_endpoint_descriptor *ed; int error = 0; uint8_t iface_index; uint8_t isread; @@ -1449,27 +1449,27 @@ ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) } iface_index = pipe->iface_index; - bzero(usb2_config, sizeof(usb2_config)); + bzero(usb_config, sizeof(usb_config)); - usb2_config[0].type = ed->bmAttributes & UE_XFERTYPE; - usb2_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; - usb2_config[0].direction = ed->bEndpointAddress & (UE_DIR_OUT | UE_DIR_IN); - usb2_config[0].interval = USB_DEFAULT_INTERVAL; - usb2_config[0].flags.proxy_buffer = 1; - usb2_config[0].callback = &ugen_default_fs_callback; - usb2_config[0].timeout = 0; /* no timeout */ - usb2_config[0].frames = u.popen->max_frames; - usb2_config[0].bufsize = u.popen->max_bufsize; - usb2_config[0].usb_mode = USB_MODE_DUAL; /* both modes */ + usb_config[0].type = ed->bmAttributes & UE_XFERTYPE; + usb_config[0].endpoint = ed->bEndpointAddress & UE_ADDR; + usb_config[0].direction = ed->bEndpointAddress & (UE_DIR_OUT | UE_DIR_IN); + usb_config[0].interval = USB_DEFAULT_INTERVAL; + usb_config[0].flags.proxy_buffer = 1; + usb_config[0].callback = &ugen_default_fs_callback; + usb_config[0].timeout = 0; /* no timeout */ + usb_config[0].frames = u.popen->max_frames; + usb_config[0].bufsize = u.popen->max_bufsize; + usb_config[0].usb_mode = USB_MODE_DUAL; /* both modes */ - if (usb2_config[0].type == UE_CONTROL) { + if (usb_config[0].type == UE_CONTROL) { if (f->udev->flags.usb_mode != USB_MODE_HOST) { error = EINVAL; break; } } else { - isread = ((usb2_config[0].endpoint & + isread = ((usb_config[0].endpoint & (UE_DIR_IN | UE_DIR_OUT)) == UE_DIR_IN); if (f->udev->flags.usb_mode != USB_MODE_HOST) { @@ -1489,7 +1489,7 @@ ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) } } error = usb2_transfer_setup(f->udev, &iface_index, - f->fs_xfer + u.popen->ep_index, usb2_config, 1, + f->fs_xfer + u.popen->ep_index, usb_config, 1, f, f->priv_mtx); if (error == 0) { /* update maximums */ @@ -1565,7 +1565,7 @@ ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) } static int -ugen_set_short_xfer(struct usb2_fifo *f, void *addr) +ugen_set_short_xfer(struct usb_fifo *f, void *addr) { uint8_t t; @@ -1587,7 +1587,7 @@ ugen_set_short_xfer(struct usb2_fifo *f, void *addr) } static int -ugen_set_timeout(struct usb2_fifo *f, void *addr) +ugen_set_timeout(struct usb_fifo *f, void *addr) { f->timeout = *(int *)addr; if (f->timeout > 65535) { @@ -1598,7 +1598,7 @@ ugen_set_timeout(struct usb2_fifo *f, void *addr) } static int -ugen_get_frame_size(struct usb2_fifo *f, void *addr) +ugen_get_frame_size(struct usb_fifo *f, void *addr) { if (f->xfer[0]) { *(int *)addr = f->xfer[0]->max_frame_size; @@ -1609,7 +1609,7 @@ ugen_get_frame_size(struct usb2_fifo *f, void *addr) } static int -ugen_set_buffer_size(struct usb2_fifo *f, void *addr) +ugen_set_buffer_size(struct usb_fifo *f, void *addr) { usb2_frlength_t t; @@ -1633,17 +1633,17 @@ ugen_set_buffer_size(struct usb2_fifo *f, void *addr) } static int -ugen_get_buffer_size(struct usb2_fifo *f, void *addr) +ugen_get_buffer_size(struct usb_fifo *f, void *addr) { *(int *)addr = f->bufsize; return (0); } static int -ugen_get_iface_desc(struct usb2_fifo *f, - struct usb2_interface_descriptor *idesc) +ugen_get_iface_desc(struct usb_fifo *f, + struct usb_interface_descriptor *idesc) { - struct usb2_interface *iface; + struct usb_interface *iface; iface = usb2_get_iface(f->udev, f->iface_index); if (iface && iface->idesc) { @@ -1655,10 +1655,10 @@ ugen_get_iface_desc(struct usb2_fifo *f, } static int -ugen_get_endpoint_desc(struct usb2_fifo *f, - struct usb2_endpoint_descriptor *ed) +ugen_get_endpoint_desc(struct usb_fifo *f, + struct usb_endpoint_descriptor *ed) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; pipe = f->priv_sc0; @@ -1671,9 +1671,9 @@ ugen_get_endpoint_desc(struct usb2_fifo *f, } static int -ugen_set_power_mode(struct usb2_fifo *f, int mode) +ugen_set_power_mode(struct usb_fifo *f, int mode) { - struct usb2_device *udev = f->udev; + struct usb_device *udev = f->udev; int err; uint8_t old_mode; @@ -1743,9 +1743,9 @@ ugen_set_power_mode(struct usb2_fifo *f, int mode) } static int -ugen_get_power_mode(struct usb2_fifo *f) +ugen_get_power_mode(struct usb_fifo *f) { - struct usb2_device *udev = f->udev; + struct usb_device *udev = f->udev; if ((udev == NULL) || (udev->parent_hub == NULL)) { @@ -1755,11 +1755,11 @@ ugen_get_power_mode(struct usb2_fifo *f) } static int -ugen_do_port_feature(struct usb2_fifo *f, uint8_t port_no, +ugen_do_port_feature(struct usb_fifo *f, uint8_t port_no, uint8_t set, uint16_t feature) { - struct usb2_device *udev = f->udev; - struct usb2_hub *hub; + struct usb_device *udev = f->udev; + struct usb_hub *hub; int err; err = priv_check(curthread, PRIV_DRIVER); @@ -1792,10 +1792,10 @@ ugen_do_port_feature(struct usb2_fifo *f, uint8_t port_no, } static int -ugen_iface_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) +ugen_iface_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags) { - struct usb2_fifo *f_rx; - struct usb2_fifo *f_tx; + struct usb_fifo *f_rx; + struct usb_fifo *f_tx; int error = 0; f_rx = f->udev->fifo[(f->fifo_index & ~1) + USB_FIFO_RX]; @@ -1934,23 +1934,23 @@ ugen_iface_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) } static int -ugen_ioctl_post(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) +ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags) { union { - struct usb2_interface_descriptor *idesc; - struct usb2_alt_interface *ai; - struct usb2_device_descriptor *ddesc; - struct usb2_config_descriptor *cdesc; - struct usb2_device_stats *stat; - struct usb2_fs_init *pinit; - struct usb2_fs_uninit *puninit; + struct usb_interface_descriptor *idesc; + struct usb_alt_interface *ai; + struct usb_device_descriptor *ddesc; + struct usb_config_descriptor *cdesc; + struct usb_device_stats *stat; + struct usb_fs_init *pinit; + struct usb_fs_uninit *puninit; uint32_t *ptime; void *addr; int *pint; } u; - struct usb2_device_descriptor *dtemp; - struct usb2_config_descriptor *ctemp; - struct usb2_interface *iface; + struct usb_device_descriptor *dtemp; + struct usb_config_descriptor *ctemp; + struct usb_interface *iface; int error = 0; uint8_t n; @@ -2162,7 +2162,7 @@ ugen_ioctl_post(struct usb2_fifo *f, u_long cmd, void *addr, int fflags) } static void -ugen_default_fs_callback(struct usb2_xfer *xfer) +ugen_default_fs_callback(struct usb_xfer *xfer) { ; /* workaround for a bug in "indent" */ diff --git a/sys/dev/usb/usb_generic.h b/sys/dev/usb/usb_generic.h index 3a4e7c940ea4..96b9d1d4aa01 100644 --- a/sys/dev/usb/usb_generic.h +++ b/sys/dev/usb/usb_generic.h @@ -27,7 +27,7 @@ #ifndef _USB2_GENERIC_H_ #define _USB2_GENERIC_H_ -extern struct usb2_fifo_methods usb2_ugen_methods; -int ugen_do_request(struct usb2_fifo *f, struct usb2_ctl_request *ur); +extern struct usb_fifo_methods usb2_ugen_methods; +int ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur); #endif /* _USB2_GENERIC_H_ */ diff --git a/sys/dev/usb/usb_handle_request.c b/sys/dev/usb/usb_handle_request.c index b74939a656b4..5f73154d7a14 100644 --- a/sys/dev/usb/usb_handle_request.c +++ b/sys/dev/usb/usb_handle_request.c @@ -51,14 +51,14 @@ enum { /* function prototypes */ -static uint8_t usb2_handle_get_stall(struct usb2_device *, uint8_t); -static usb2_error_t usb2_handle_remote_wakeup(struct usb2_xfer *, uint8_t); -static usb2_error_t usb2_handle_request(struct usb2_xfer *); -static usb2_error_t usb2_handle_set_config(struct usb2_xfer *, uint8_t); -static usb2_error_t usb2_handle_set_stall(struct usb2_xfer *, uint8_t, +static uint8_t usb2_handle_get_stall(struct usb_device *, uint8_t); +static usb2_error_t usb2_handle_remote_wakeup(struct usb_xfer *, uint8_t); +static usb2_error_t usb2_handle_request(struct usb_xfer *); +static usb2_error_t usb2_handle_set_config(struct usb_xfer *, uint8_t); +static usb2_error_t usb2_handle_set_stall(struct usb_xfer *, uint8_t, uint8_t); -static usb2_error_t usb2_handle_iface_request(struct usb2_xfer *, void **, - uint16_t *, struct usb2_device_request, uint16_t, +static usb2_error_t usb2_handle_iface_request(struct usb_xfer *, void **, + uint16_t *, struct usb_device_request, uint16_t, uint8_t); /*------------------------------------------------------------------------* @@ -68,7 +68,7 @@ static usb2_error_t usb2_handle_iface_request(struct usb2_xfer *, void **, * transfers. *------------------------------------------------------------------------*/ void -usb2_handle_request_callback(struct usb2_xfer *xfer) +usb2_handle_request_callback(struct usb_xfer *xfer) { usb2_error_t err; @@ -107,7 +107,7 @@ usb2_handle_request_callback(struct usb2_xfer *xfer) return; tr_restart: - xfer->frlengths[0] = sizeof(struct usb2_device_request); + xfer->frlengths[0] = sizeof(struct usb_device_request); xfer->nframes = 1; xfer->flags.manual_status = 1; xfer->flags.force_short_xfer = 0; @@ -123,9 +123,9 @@ tr_restart: * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -usb2_handle_set_config(struct usb2_xfer *xfer, uint8_t conf_no) +usb2_handle_set_config(struct usb_xfer *xfer, uint8_t conf_no) { - struct usb2_device *udev = xfer->xroot->udev; + struct usb_device *udev = xfer->xroot->udev; usb2_error_t err = 0; /* @@ -171,13 +171,13 @@ done: * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -usb2_handle_iface_request(struct usb2_xfer *xfer, +usb2_handle_iface_request(struct usb_xfer *xfer, void **ppdata, uint16_t *plen, - struct usb2_device_request req, uint16_t off, uint8_t state) + struct usb_device_request req, uint16_t off, uint8_t state) { - struct usb2_interface *iface; - struct usb2_interface *iface_parent; /* parent interface */ - struct usb2_device *udev = xfer->xroot->udev; + struct usb_interface *iface; + struct usb_interface *iface_parent; /* parent interface */ + struct usb_device *udev = xfer->xroot->udev; int error; uint8_t iface_index; @@ -334,9 +334,9 @@ tr_stalled: * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -usb2_handle_set_stall(struct usb2_xfer *xfer, uint8_t ep, uint8_t do_stall) +usb2_handle_set_stall(struct usb_xfer *xfer, uint8_t ep, uint8_t do_stall) { - struct usb2_device *udev = xfer->xroot->udev; + struct usb_device *udev = xfer->xroot->udev; usb2_error_t err; USB_XFER_UNLOCK(xfer); @@ -354,9 +354,9 @@ usb2_handle_set_stall(struct usb2_xfer *xfer, uint8_t ep, uint8_t do_stall) * Else: Failure *------------------------------------------------------------------------*/ static uint8_t -usb2_handle_get_stall(struct usb2_device *udev, uint8_t ea_val) +usb2_handle_get_stall(struct usb_device *udev, uint8_t ea_val) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; uint8_t halted; pipe = usb2_get_pipe_by_addr(udev, ea_val); @@ -379,10 +379,10 @@ usb2_handle_get_stall(struct usb2_device *udev, uint8_t ea_val) * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -usb2_handle_remote_wakeup(struct usb2_xfer *xfer, uint8_t is_on) +usb2_handle_remote_wakeup(struct usb_xfer *xfer, uint8_t is_on) { - struct usb2_device *udev; - struct usb2_bus *bus; + struct usb_device *udev; + struct usb_bus *bus; udev = xfer->xroot->udev; bus = udev->bus; @@ -414,10 +414,10 @@ usb2_handle_remote_wakeup(struct usb2_xfer *xfer, uint8_t is_on) * Else: Stall current transfer, if any *------------------------------------------------------------------------*/ static usb2_error_t -usb2_handle_request(struct usb2_xfer *xfer) +usb2_handle_request(struct usb_xfer *xfer) { - struct usb2_device_request req; - struct usb2_device *udev; + struct usb_device_request req; + struct usb_device *udev; const void *src_zcopy; /* zero-copy source pointer */ const void *src_mcopy; /* non zero-copy source pointer */ uint16_t off; /* data offset */ diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c index 52efa6777908..e24df1c5d3df 100644 --- a/sys/dev/usb/usb_hid.c +++ b/sys/dev/usb/usb_hid.c @@ -650,11 +650,11 @@ hid_is_collection(const void *desc, usb2_size_t size, uint32_t usage) * NULL: No more HID descriptors. * Else: Pointer to HID descriptor. *------------------------------------------------------------------------*/ -struct usb2_hid_descriptor * -hid_get_descriptor_from_usb(struct usb2_config_descriptor *cd, - struct usb2_interface_descriptor *id) +struct usb_hid_descriptor * +hid_get_descriptor_from_usb(struct usb_config_descriptor *cd, + struct usb_interface_descriptor *id) { - struct usb2_descriptor *desc = (void *)id; + struct usb_descriptor *desc = (void *)id; if (desc == NULL) { return (NULL); @@ -682,12 +682,12 @@ hid_get_descriptor_from_usb(struct usb2_config_descriptor *cd, * Else: Success. The pointer should eventually be passed to free(). *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_hid_desc(struct usb2_device *udev, struct mtx *mtx, +usb2_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, void **descp, uint16_t *sizep, usb2_malloc_type mem, uint8_t iface_index) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_hid_descriptor *hid; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_hid_descriptor *hid; usb2_error_t err; if ((iface == NULL) || (iface->idesc == NULL)) { diff --git a/sys/dev/usb/usb_hid.h b/sys/dev/usb/usb_hid.h index 8febc4e29b34..d32e73d7ec9e 100644 --- a/sys/dev/usb/usb_hid.h +++ b/sys/dev/usb/usb_hid.h @@ -29,8 +29,8 @@ #ifndef _USB2_CORE_HID_H_ #define _USB2_CORE_HID_H_ -struct usb2_hid_descriptor; -struct usb2_config_descriptor; +struct usb_hid_descriptor; +struct usb_config_descriptor; enum hid_kind { hid_input, hid_output, hid_feature, hid_collection, hid_endcollection @@ -85,10 +85,10 @@ int hid_locate(const void *desc, usb2_size_t size, uint32_t usage, uint32_t hid_get_data(const uint8_t *buf, usb2_size_t len, struct hid_location *loc); int hid_is_collection(const void *desc, usb2_size_t size, uint32_t usage); -struct usb2_hid_descriptor *hid_get_descriptor_from_usb( - struct usb2_config_descriptor *cd, - struct usb2_interface_descriptor *id); -usb2_error_t usb2_req_get_hid_desc(struct usb2_device *udev, struct mtx *mtx, +struct usb_hid_descriptor *hid_get_descriptor_from_usb( + struct usb_config_descriptor *cd, + struct usb_interface_descriptor *id); +usb2_error_t usb2_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, void **descp, uint16_t *sizep, usb2_malloc_type mem, uint8_t iface_index); diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index e4cfc839104d..75b19c81abec 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -77,8 +77,8 @@ struct uhub_current_state { struct uhub_softc { struct uhub_current_state sc_st;/* current state */ device_t sc_dev; /* base device */ - struct usb2_device *sc_udev; /* USB device */ - struct usb2_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ + struct usb_device *sc_udev; /* USB device */ + struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ uint8_t sc_flags; #define UHUB_FLAG_DID_EXPLORE 0x01 char sc_name[32]; @@ -102,10 +102,10 @@ static bus_child_pnpinfo_str_t uhub_child_pnpinfo_string; static usb2_callback_t uhub_intr_callback; -static void usb2_dev_resume_peer(struct usb2_device *udev); -static void usb2_dev_suspend_peer(struct usb2_device *udev); +static void usb2_dev_resume_peer(struct usb_device *udev); +static void usb2_dev_suspend_peer(struct usb_device *udev); -static const struct usb2_config uhub_config[UHUB_N_TRANSFER] = { +static const struct usb_config uhub_config[UHUB_N_TRANSFER] = { [0] = { .type = UE_INTERRUPT, @@ -149,7 +149,7 @@ DRIVER_MODULE(uhub, usbus, uhub_driver, uhub_devclass, 0, 0); DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, NULL, 0); static void -uhub_intr_callback(struct usb2_xfer *xfer) +uhub_intr_callback(struct usb_xfer *xfer) { struct uhub_softc *sc = xfer->priv_sc; @@ -192,10 +192,10 @@ uhub_intr_callback(struct usb2_xfer *xfer) * Else: A control transaction failed *------------------------------------------------------------------------*/ static usb2_error_t -uhub_explore_sub(struct uhub_softc *sc, struct usb2_port *up) +uhub_explore_sub(struct uhub_softc *sc, struct usb_port *up) { - struct usb2_bus *bus; - struct usb2_device *child; + struct usb_bus *bus; + struct usb_device *child; uint8_t refcount; usb2_error_t err; @@ -241,7 +241,7 @@ done: static usb2_error_t uhub_read_port_status(struct uhub_softc *sc, uint8_t portno) { - struct usb2_port_status ps; + struct usb_port_status ps; usb2_error_t err; err = usb2_req_get_port_status( @@ -271,8 +271,8 @@ uhub_read_port_status(struct uhub_softc *sc, uint8_t portno) static usb2_error_t uhub_reattach_port(struct uhub_softc *sc, uint8_t portno) { - struct usb2_device *child; - struct usb2_device *udev; + struct usb_device *child; + struct usb_device *udev; enum usb_dev_speed speed; enum usb_hc_mode mode; usb2_error_t err; @@ -449,8 +449,8 @@ error: static usb2_error_t uhub_suspend_resume_port(struct uhub_softc *sc, uint8_t portno) { - struct usb2_device *child; - struct usb2_device *udev; + struct usb_device *child; + struct usb_device *udev; uint8_t is_suspend; usb2_error_t err; @@ -510,7 +510,7 @@ done: * packet. This function is called having the "bus_mtx" locked. *------------------------------------------------------------------------*/ void -uhub_root_intr(struct usb2_bus *bus, const uint8_t *ptr, uint8_t len) +uhub_root_intr(struct usb_bus *bus, const uint8_t *ptr, uint8_t len) { USB_BUS_LOCK_ASSERT(bus, MA_OWNED); @@ -525,11 +525,11 @@ uhub_root_intr(struct usb2_bus *bus, const uint8_t *ptr, uint8_t len) * Else: Failure *------------------------------------------------------------------------*/ static usb2_error_t -uhub_explore(struct usb2_device *udev) +uhub_explore(struct usb_device *udev) { - struct usb2_hub *hub; + struct usb_hub *hub; struct uhub_softc *sc; - struct usb2_port *up; + struct usb_port *up; usb2_error_t err; uint8_t portno; uint8_t x; @@ -636,7 +636,7 @@ uhub_explore(struct usb2_device *udev) static int uhub_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -656,11 +656,11 @@ static int uhub_attach(device_t dev) { struct uhub_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); - struct usb2_device *udev = uaa->device; - struct usb2_device *parent_hub = udev->parent_hub; - struct usb2_hub *hub; - struct usb2_hub_descriptor hubdesc; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_device *udev = uaa->device; + struct usb_device *parent_hub = udev->parent_hub; + struct usb_hub *hub; + struct usb_hub_descriptor hubdesc; uint16_t pwrdly; uint8_t x; uint8_t nports; @@ -798,7 +798,7 @@ uhub_attach(device_t dev) for (x = 0; x != nports; x++) { /* set up data structures */ - struct usb2_port *up = hub->ports + x; + struct usb_port *up = hub->ports + x; up->device_index = 0; up->restartcnt = 0; @@ -860,8 +860,8 @@ static int uhub_detach(device_t dev) { struct uhub_softc *sc = device_get_softc(dev); - struct usb2_hub *hub = sc->sc_udev->hub; - struct usb2_device *child; + struct usb_hub *hub = sc->sc_udev->hub; + struct usb_device *child; uint8_t x; /* detach all children first */ @@ -915,17 +915,17 @@ uhub_driver_added(device_t dev, driver_t *driver) } struct hub_result { - struct usb2_device *udev; + struct usb_device *udev; uint8_t portno; uint8_t iface_index; }; static void -uhub_find_iface_index(struct usb2_hub *hub, device_t child, +uhub_find_iface_index(struct usb_hub *hub, device_t child, struct hub_result *res) { - struct usb2_interface *iface; - struct usb2_device *udev; + struct usb_interface *iface; + struct usb_device *udev; uint8_t nports; uint8_t x; uint8_t i; @@ -958,7 +958,7 @@ uhub_child_location_string(device_t parent, device_t child, char *buf, size_t buflen) { struct uhub_softc *sc = device_get_softc(parent); - struct usb2_hub *hub = sc->sc_udev->hub; + struct usb_hub *hub = sc->sc_udev->hub; struct hub_result res; mtx_lock(&Giant); @@ -983,8 +983,8 @@ uhub_child_pnpinfo_string(device_t parent, device_t child, char *buf, size_t buflen) { struct uhub_softc *sc = device_get_softc(parent); - struct usb2_hub *hub = sc->sc_udev->hub; - struct usb2_interface *iface; + struct usb_hub *hub = sc->sc_udev->hub; + struct usb_interface *iface; struct hub_result res; mtx_lock(&Giant); @@ -1090,10 +1090,10 @@ usb2_intr_find_best_slot(usb2_size_t *ptr, uint8_t start, uint8_t end) * The slot on which the bandwidth update was done. *------------------------------------------------------------------------*/ uint8_t -usb2_intr_schedule_adjust(struct usb2_device *udev, int16_t len, uint8_t slot) +usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot) { - struct usb2_bus *bus = udev->bus; - struct usb2_hub *hub; + struct usb_bus *bus = udev->bus; + struct usb_hub *hub; enum usb_dev_speed speed; USB_BUS_LOCK_ASSERT(bus, MA_OWNED); @@ -1140,7 +1140,7 @@ usb2_intr_schedule_adjust(struct usb2_device *udev, int16_t len, uint8_t slot) *------------------------------------------------------------------------*/ #if USB_HAVE_TT_SUPPORT static void -usb2_fs_isoc_schedule_init_sub(struct usb2_fs_isoc_schedule *fss) +usb2_fs_isoc_schedule_init_sub(struct usb_fs_isoc_schedule *fss) { fss->total_bytes = (USB_FS_ISOC_UFRAME_MAX * USB_FS_BYTES_PER_HS_UFRAME); @@ -1157,9 +1157,9 @@ usb2_fs_isoc_schedule_init_sub(struct usb2_fs_isoc_schedule *fss) *------------------------------------------------------------------------*/ #if USB_HAVE_TT_SUPPORT void -usb2_fs_isoc_schedule_init_all(struct usb2_fs_isoc_schedule *fss) +usb2_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss) { - struct usb2_fs_isoc_schedule *fss_end = fss + USB_ISOC_TIME_MAX; + struct usb_fs_isoc_schedule *fss_end = fss + USB_ISOC_TIME_MAX; while (fss != fss_end) { usb2_fs_isoc_schedule_init_sub(fss); @@ -1177,7 +1177,7 @@ usb2_fs_isoc_schedule_init_all(struct usb2_fs_isoc_schedule *fss) * 16-bit isochronous time counter. *------------------------------------------------------------------------*/ uint16_t -usb2_isoc_time_expand(struct usb2_bus *bus, uint16_t isoc_time_curr) +usb2_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr) { uint16_t rem; @@ -1216,15 +1216,15 @@ usb2_isoc_time_expand(struct usb2_bus *bus, uint16_t isoc_time_curr) *------------------------------------------------------------------------*/ #if USB_HAVE_TT_SUPPORT uint16_t -usb2_fs_isoc_schedule_isoc_time_expand(struct usb2_device *udev, - struct usb2_fs_isoc_schedule **pp_start, - struct usb2_fs_isoc_schedule **pp_end, +usb2_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, + struct usb_fs_isoc_schedule **pp_start, + struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time) { - struct usb2_fs_isoc_schedule *fss_end; - struct usb2_fs_isoc_schedule *fss_a; - struct usb2_fs_isoc_schedule *fss_b; - struct usb2_hub *hs_hub; + struct usb_fs_isoc_schedule *fss_end; + struct usb_fs_isoc_schedule *fss_a; + struct usb_fs_isoc_schedule *fss_b; + struct usb_hub *hs_hub; isoc_time = usb2_isoc_time_expand(udev->bus, isoc_time); @@ -1278,7 +1278,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(struct usb2_device *udev, *------------------------------------------------------------------------*/ #if USB_HAVE_TT_SUPPORT uint8_t -usb2_fs_isoc_schedule_alloc(struct usb2_fs_isoc_schedule *fss, +usb2_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len) { uint8_t slot = fss->frame_slot; @@ -1316,8 +1316,8 @@ usb2_fs_isoc_schedule_alloc(struct usb2_fs_isoc_schedule *fss, * * This function is NULL safe. *------------------------------------------------------------------------*/ -struct usb2_device * -usb2_bus_port_get_device(struct usb2_bus *bus, struct usb2_port *up) +struct usb_device * +usb2_bus_port_get_device(struct usb_bus *bus, struct usb_port *up) { if ((bus == NULL) || (up == NULL)) { /* be NULL safe */ @@ -1336,8 +1336,8 @@ usb2_bus_port_get_device(struct usb2_bus *bus, struct usb2_port *up) * This function is NULL safe. *------------------------------------------------------------------------*/ void -usb2_bus_port_set_device(struct usb2_bus *bus, struct usb2_port *up, - struct usb2_device *udev, uint8_t device_index) +usb2_bus_port_set_device(struct usb_bus *bus, struct usb_port *up, + struct usb_device *udev, uint8_t device_index) { if (bus == NULL) { /* be NULL safe */ @@ -1379,7 +1379,7 @@ usb2_bus_port_set_device(struct usb2_bus *bus, struct usb2_port *up, * This functions is called when the USB event thread needs to run. *------------------------------------------------------------------------*/ void -usb2_needs_explore(struct usb2_bus *bus, uint8_t do_probe) +usb2_needs_explore(struct usb_bus *bus, uint8_t do_probe) { uint8_t do_unlock; @@ -1421,7 +1421,7 @@ usb2_needs_explore(struct usb2_bus *bus, uint8_t do_probe) void usb2_needs_explore_all(void) { - struct usb2_bus *bus; + struct usb_bus *bus; devclass_t dc; device_t dev; int max; @@ -1458,7 +1458,7 @@ usb2_needs_explore_all(void) *------------------------------------------------------------------------*/ #if USB_HAVE_POWERD void -usb2_bus_power_update(struct usb2_bus *bus) +usb2_bus_power_update(struct usb_bus *bus) { usb2_needs_explore(bus, 0 /* no probe */ ); } @@ -1473,7 +1473,7 @@ usb2_bus_power_update(struct usb2_bus *bus) *------------------------------------------------------------------------*/ #if USB_HAVE_POWERD void -usb2_transfer_power_ref(struct usb2_xfer *xfer, int val) +usb2_transfer_power_ref(struct usb_xfer *xfer, int val) { static const usb2_power_mask_t power_mask[4] = { [UE_CONTROL] = USB_HW_POWER_CONTROL, @@ -1481,7 +1481,7 @@ usb2_transfer_power_ref(struct usb2_xfer *xfer, int val) [UE_INTERRUPT] = USB_HW_POWER_INTERRUPT, [UE_ISOCHRONOUS] = USB_HW_POWER_ISOC, }; - struct usb2_device *udev; + struct usb_device *udev; uint8_t needs_explore; uint8_t needs_hw_power; uint8_t xfer_type; @@ -1552,9 +1552,9 @@ usb2_transfer_power_ref(struct usb2_xfer *xfer, int val) *------------------------------------------------------------------------*/ #if USB_HAVE_POWERD void -usb2_bus_powerd(struct usb2_bus *bus) +usb2_bus_powerd(struct usb_bus *bus) { - struct usb2_device *udev; + struct usb_device *udev; usb2_ticks_t temp; usb2_ticks_t limit; usb2_ticks_t mintime; @@ -1683,9 +1683,9 @@ usb2_bus_powerd(struct usb2_bus *bus) * signalling to get an USB device out of the suspended state. *------------------------------------------------------------------------*/ static void -usb2_dev_resume_peer(struct usb2_device *udev) +usb2_dev_resume_peer(struct usb_device *udev) { - struct usb2_bus *bus; + struct usb_bus *bus; int err; /* be NULL safe */ @@ -1780,9 +1780,9 @@ usb2_dev_resume_peer(struct usb2_device *udev) * signalling to get an USB device into the suspended state. *------------------------------------------------------------------------*/ static void -usb2_dev_suspend_peer(struct usb2_device *udev) +usb2_dev_suspend_peer(struct usb_device *udev) { - struct usb2_device *child; + struct usb_device *child; int err; uint8_t x; uint8_t nports; @@ -1875,7 +1875,7 @@ repeat: * USB device. *------------------------------------------------------------------------*/ void -usb2_set_power_mode(struct usb2_device *udev, uint8_t power_mode) +usb2_set_power_mode(struct usb_device *udev, uint8_t power_mode) { /* filter input argument */ if ((power_mode != USB_POWER_MODE_ON) && diff --git a/sys/dev/usb/usb_hub.h b/sys/dev/usb/usb_hub.h index 74df2b959202..7d656a340677 100644 --- a/sys/dev/usb/usb_hub.h +++ b/sys/dev/usb/usb_hub.h @@ -30,7 +30,7 @@ /* * The following structure defines an USB port. */ -struct usb2_port { +struct usb_port { uint8_t restartcnt; #define USB_RESTART_MAX 5 uint8_t device_index; /* zero means not valid */ @@ -41,7 +41,7 @@ struct usb2_port { * The following structure defines how many bytes are * left in an 1ms USB time slot. */ -struct usb2_fs_isoc_schedule { +struct usb_fs_isoc_schedule { uint16_t total_bytes; uint8_t frame_bytes; uint8_t frame_slot; @@ -50,33 +50,33 @@ struct usb2_fs_isoc_schedule { /* * The following structure defines an USB HUB. */ -struct usb2_hub { +struct usb_hub { #if USB_HAVE_TT_SUPPORT - struct usb2_fs_isoc_schedule fs_isoc_schedule[USB_ISOC_TIME_MAX]; + struct usb_fs_isoc_schedule fs_isoc_schedule[USB_ISOC_TIME_MAX]; #endif - struct usb2_device *hubudev; /* the HUB device */ - usb2_error_t (*explore) (struct usb2_device *hub); + struct usb_device *hubudev; /* the HUB device */ + usb2_error_t (*explore) (struct usb_device *hub); void *hubsoftc; usb2_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; uint16_t portpower; /* mA per USB port */ uint8_t isoc_last_time; uint8_t nports; - struct usb2_port ports[0]; + struct usb_port ports[0]; }; /* function prototypes */ -uint8_t usb2_intr_schedule_adjust(struct usb2_device *udev, int16_t len, +uint8_t usb2_intr_schedule_adjust(struct usb_device *udev, int16_t len, uint8_t slot); -void usb2_fs_isoc_schedule_init_all(struct usb2_fs_isoc_schedule *fss); -void usb2_bus_port_set_device(struct usb2_bus *bus, struct usb2_port *up, - struct usb2_device *udev, uint8_t device_index); -struct usb2_device *usb2_bus_port_get_device(struct usb2_bus *bus, - struct usb2_port *up); -void usb2_needs_explore(struct usb2_bus *bus, uint8_t do_probe); +void usb2_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss); +void usb2_bus_port_set_device(struct usb_bus *bus, struct usb_port *up, + struct usb_device *udev, uint8_t device_index); +struct usb_device *usb2_bus_port_get_device(struct usb_bus *bus, + struct usb_port *up); +void usb2_needs_explore(struct usb_bus *bus, uint8_t do_probe); void usb2_needs_explore_all(void); -void usb2_bus_power_update(struct usb2_bus *bus); -void usb2_bus_powerd(struct usb2_bus *bus); -void uhub_root_intr(struct usb2_bus *, const uint8_t *, uint8_t); +void usb2_bus_power_update(struct usb_bus *bus); +void usb2_bus_powerd(struct usb_bus *bus); +void uhub_root_intr(struct usb_bus *, const uint8_t *, uint8_t); #endif /* _USB2_HUB_H_ */ diff --git a/sys/dev/usb/usb_ioctl.h b/sys/dev/usb/usb_ioctl.h index 81e2c466dec7..a59cb120c33e 100644 --- a/sys/dev/usb/usb_ioctl.h +++ b/sys/dev/usb/usb_ioctl.h @@ -40,13 +40,13 @@ #define USB_DEVICE_DIR "usb" #define USB_GENERIC_NAME "ugen" -struct usb2_read_dir { +struct usb_read_dir { void *urd_data; uint32_t urd_startentry; uint32_t urd_maxlen; }; -struct usb2_ctl_request { +struct usb_ctl_request { void *ucr_data; uint16_t ucr_flags; #define USB_SHORT_XFER_OK 0x0004 /* allow short reads */ @@ -54,15 +54,15 @@ struct usb2_ctl_request { #define USB_USER_DATA_PTR 0x0020 /* internal flag */ uint16_t ucr_actlen; /* actual length transferred */ uint8_t ucr_addr; /* zero - currently not used */ - struct usb2_device_request ucr_request; + struct usb_device_request ucr_request; }; -struct usb2_alt_interface { +struct usb_alt_interface { uint8_t uai_interface_index; uint8_t uai_alt_index; }; -struct usb2_gen_descriptor { +struct usb_gen_descriptor { void *ugd_data; uint16_t ugd_lang_id; uint16_t ugd_maxlen; @@ -77,7 +77,7 @@ struct usb2_gen_descriptor { uint8_t reserved[8]; }; -struct usb2_device_info { +struct usb_device_info { uint16_t udi_productNo; uint16_t udi_vendorNo; uint16_t udi_releaseNo; @@ -106,25 +106,25 @@ struct usb2_device_info { char udi_release[8]; }; -struct usb2_device_stats { +struct usb_device_stats { uint32_t uds_requests_ok[4]; /* Indexed by transfer type UE_XXX */ uint32_t uds_requests_fail[4]; /* Indexed by transfer type UE_XXX */ }; -struct usb2_fs_start { +struct usb_fs_start { uint8_t ep_index; }; -struct usb2_fs_stop { +struct usb_fs_stop { uint8_t ep_index; }; -struct usb2_fs_complete { +struct usb_fs_complete { uint8_t ep_index; }; /* This structure is used for all endpoint types */ -struct usb2_fs_endpoint { +struct usb_fs_endpoint { /* * NOTE: isochronous USB transfer only use one buffer, but can have * multiple frame lengths ! @@ -151,18 +151,18 @@ struct usb2_fs_endpoint { uint8_t status; /* see USB_ERR_XXX */ }; -struct usb2_fs_init { +struct usb_fs_init { /* userland pointer to endpoints structure */ - struct usb2_fs_endpoint *pEndpoints; + struct usb_fs_endpoint *pEndpoints; /* maximum number of endpoints */ uint8_t ep_index_max; }; -struct usb2_fs_uninit { +struct usb_fs_uninit { uint8_t dummy; /* zero */ }; -struct usb2_fs_open { +struct usb_fs_open { #define USB_FS_MAX_BUFSIZE (1 << 18) uint32_t max_bufsize; #define USB_FS_MAX_FRAMES (1 << 12) @@ -173,15 +173,15 @@ struct usb2_fs_open { uint8_t ep_no; /* bEndpointNumber */ }; -struct usb2_fs_close { +struct usb_fs_close { uint8_t ep_index; }; -struct usb2_fs_clear_stall_sync { +struct usb_fs_clear_stall_sync { uint8_t ep_index; }; -struct usb2_gen_quirk { +struct usb_gen_quirk { uint16_t index; /* Quirk Index */ uint16_t vid; /* Vendor ID */ uint16_t pid; /* Product ID */ @@ -196,33 +196,33 @@ struct usb2_gen_quirk { }; /* USB controller */ -#define USB_REQUEST _IOWR('U', 1, struct usb2_ctl_request) +#define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request) #define USB_SETDEBUG _IOW ('U', 2, int) #define USB_DISCOVER _IO ('U', 3) -#define USB_DEVICEINFO _IOWR('U', 4, struct usb2_device_info) -#define USB_DEVICESTATS _IOR ('U', 5, struct usb2_device_stats) +#define USB_DEVICEINFO _IOWR('U', 4, struct usb_device_info) +#define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats) #define USB_DEVICEENUMERATE _IOW ('U', 6, int) /* Generic HID device */ -#define USB_GET_REPORT_DESC _IOWR('U', 21, struct usb2_gen_descriptor) +#define USB_GET_REPORT_DESC _IOWR('U', 21, struct usb_gen_descriptor) #define USB_SET_IMMED _IOW ('U', 22, int) -#define USB_GET_REPORT _IOWR('U', 23, struct usb2_gen_descriptor) -#define USB_SET_REPORT _IOW ('U', 24, struct usb2_gen_descriptor) +#define USB_GET_REPORT _IOWR('U', 23, struct usb_gen_descriptor) +#define USB_SET_REPORT _IOW ('U', 24, struct usb_gen_descriptor) #define USB_GET_REPORT_ID _IOR ('U', 25, int) /* Generic USB device */ #define USB_GET_CONFIG _IOR ('U', 100, int) #define USB_SET_CONFIG _IOW ('U', 101, int) -#define USB_GET_ALTINTERFACE _IOWR('U', 102, struct usb2_alt_interface) -#define USB_SET_ALTINTERFACE _IOWR('U', 103, struct usb2_alt_interface) -#define USB_GET_DEVICE_DESC _IOR ('U', 105, struct usb2_device_descriptor) -#define USB_GET_CONFIG_DESC _IOR ('U', 106, struct usb2_config_descriptor) -#define USB_GET_RX_INTERFACE_DESC _IOR ('U', 107, struct usb2_interface_descriptor) -#define USB_GET_RX_ENDPOINT_DESC _IOR ('U', 108, struct usb2_endpoint_descriptor) -#define USB_GET_FULL_DESC _IOWR('U', 109, struct usb2_gen_descriptor) -#define USB_GET_STRING_DESC _IOWR('U', 110, struct usb2_gen_descriptor) -#define USB_DO_REQUEST _IOWR('U', 111, struct usb2_ctl_request) -#define USB_GET_DEVICEINFO _IOR ('U', 112, struct usb2_device_info) +#define USB_GET_ALTINTERFACE _IOWR('U', 102, struct usb_alt_interface) +#define USB_SET_ALTINTERFACE _IOWR('U', 103, struct usb_alt_interface) +#define USB_GET_DEVICE_DESC _IOR ('U', 105, struct usb_device_descriptor) +#define USB_GET_CONFIG_DESC _IOR ('U', 106, struct usb_config_descriptor) +#define USB_GET_RX_INTERFACE_DESC _IOR ('U', 107, struct usb_interface_descriptor) +#define USB_GET_RX_ENDPOINT_DESC _IOR ('U', 108, struct usb_endpoint_descriptor) +#define USB_GET_FULL_DESC _IOWR('U', 109, struct usb_gen_descriptor) +#define USB_GET_STRING_DESC _IOWR('U', 110, struct usb_gen_descriptor) +#define USB_DO_REQUEST _IOWR('U', 111, struct usb_ctl_request) +#define USB_GET_DEVICEINFO _IOR ('U', 112, struct usb_device_info) #define USB_SET_RX_SHORT_XFER _IOW ('U', 113, int) #define USB_SET_RX_TIMEOUT _IOW ('U', 114, int) #define USB_GET_RX_FRAME_SIZE _IOR ('U', 115, int) @@ -230,21 +230,21 @@ struct usb2_gen_quirk { #define USB_SET_RX_BUFFER_SIZE _IOW ('U', 118, int) #define USB_SET_RX_STALL_FLAG _IOW ('U', 119, int) #define USB_SET_TX_STALL_FLAG _IOW ('U', 120, int) -#define USB_GET_IFACE_DRIVER _IOWR('U', 121, struct usb2_gen_descriptor) +#define USB_GET_IFACE_DRIVER _IOWR('U', 121, struct usb_gen_descriptor) #define USB_CLAIM_INTERFACE _IOW ('U', 122, int) #define USB_RELEASE_INTERFACE _IOW ('U', 123, int) #define USB_IFACE_DRIVER_ACTIVE _IOW ('U', 124, int) #define USB_IFACE_DRIVER_DETACH _IOW ('U', 125, int) #define USB_GET_PLUGTIME _IOR ('U', 126, uint32_t) -#define USB_READ_DIR _IOW ('U', 127, struct usb2_read_dir) +#define USB_READ_DIR _IOW ('U', 127, struct usb_read_dir) /* 128 - 135 unused */ #define USB_SET_TX_FORCE_SHORT _IOW ('U', 136, int) #define USB_SET_TX_TIMEOUT _IOW ('U', 137, int) #define USB_GET_TX_FRAME_SIZE _IOR ('U', 138, int) #define USB_GET_TX_BUFFER_SIZE _IOR ('U', 139, int) #define USB_SET_TX_BUFFER_SIZE _IOW ('U', 140, int) -#define USB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb2_interface_descriptor) -#define USB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb2_endpoint_descriptor) +#define USB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb_interface_descriptor) +#define USB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb_endpoint_descriptor) #define USB_SET_PORT_ENABLE _IOW ('U', 143, int) #define USB_SET_PORT_DISABLE _IOW ('U', 144, int) #define USB_SET_POWER_MODE _IOW ('U', 145, int) @@ -257,19 +257,19 @@ struct usb2_gen_quirk { #define USB_SET_CM_OVER_DATA _IOW ('U', 181, int) /* USB file system interface */ -#define USB_FS_START _IOW ('U', 192, struct usb2_fs_start) -#define USB_FS_STOP _IOW ('U', 193, struct usb2_fs_stop) -#define USB_FS_COMPLETE _IOR ('U', 194, struct usb2_fs_complete) -#define USB_FS_INIT _IOW ('U', 195, struct usb2_fs_init) -#define USB_FS_UNINIT _IOW ('U', 196, struct usb2_fs_uninit) -#define USB_FS_OPEN _IOWR('U', 197, struct usb2_fs_open) -#define USB_FS_CLOSE _IOW ('U', 198, struct usb2_fs_close) -#define USB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb2_fs_clear_stall_sync) +#define USB_FS_START _IOW ('U', 192, struct usb_fs_start) +#define USB_FS_STOP _IOW ('U', 193, struct usb_fs_stop) +#define USB_FS_COMPLETE _IOR ('U', 194, struct usb_fs_complete) +#define USB_FS_INIT _IOW ('U', 195, struct usb_fs_init) +#define USB_FS_UNINIT _IOW ('U', 196, struct usb_fs_uninit) +#define USB_FS_OPEN _IOWR('U', 197, struct usb_fs_open) +#define USB_FS_CLOSE _IOW ('U', 198, struct usb_fs_close) +#define USB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb_fs_clear_stall_sync) /* USB quirk system interface */ -#define USB_DEV_QUIRK_GET _IOWR('Q', 0, struct usb2_gen_quirk) -#define USB_QUIRK_NAME_GET _IOWR('Q', 1, struct usb2_gen_quirk) -#define USB_DEV_QUIRK_ADD _IOW ('Q', 2, struct usb2_gen_quirk) -#define USB_DEV_QUIRK_REMOVE _IOW ('Q', 3, struct usb2_gen_quirk) +#define USB_DEV_QUIRK_GET _IOWR('Q', 0, struct usb_gen_quirk) +#define USB_QUIRK_NAME_GET _IOWR('Q', 1, struct usb_gen_quirk) +#define USB_DEV_QUIRK_ADD _IOW ('Q', 2, struct usb_gen_quirk) +#define USB_DEV_QUIRK_REMOVE _IOW ('Q', 3, struct usb_gen_quirk) #endif /* _USB2_IOCTL_H_ */ diff --git a/sys/dev/usb/usb_lookup.c b/sys/dev/usb/usb_lookup.c index 6c707ce9d7b2..9827bdd9abb7 100644 --- a/sys/dev/usb/usb_lookup.c +++ b/sys/dev/usb/usb_lookup.c @@ -30,22 +30,22 @@ /*------------------------------------------------------------------------* * usb2_lookup_id_by_info * - * This functions takes an array of "struct usb2_device_id" and tries - * to match the entries with the information in "struct usb2_lookup_info". + * This functions takes an array of "struct usb_device_id" and tries + * to match the entries with the information in "struct usb_lookup_info". * * NOTE: The "sizeof_id" parameter must be a multiple of the - * usb2_device_id structure size. Else the behaviour of this function + * usb_device_id structure size. Else the behaviour of this function * is undefined. * * Return values: * NULL: No match found. * Else: Pointer to matching entry. *------------------------------------------------------------------------*/ -const struct usb2_device_id * -usb2_lookup_id_by_info(const struct usb2_device_id *id, usb2_size_t sizeof_id, - const struct usb2_lookup_info *info) +const struct usb_device_id * +usb2_lookup_id_by_info(const struct usb_device_id *id, usb2_size_t sizeof_id, + const struct usb_lookup_info *info) { - const struct usb2_device_id *id_end; + const struct usb_device_id *id_end; if (id == NULL) { goto done; @@ -121,8 +121,8 @@ done: * Else: Failure *------------------------------------------------------------------------*/ int -usb2_lookup_id_by_uaa(const struct usb2_device_id *id, usb2_size_t sizeof_id, - struct usb2_attach_arg *uaa) +usb2_lookup_id_by_uaa(const struct usb_device_id *id, usb2_size_t sizeof_id, + struct usb_attach_arg *uaa) { id = usb2_lookup_id_by_info(id, sizeof_id, &uaa->info); if (id) { diff --git a/sys/dev/usb/usb_lookup.h b/sys/dev/usb/usb_lookup.h index 74d02e5072fa..81d4f0c6119b 100644 --- a/sys/dev/usb/usb_lookup.h +++ b/sys/dev/usb/usb_lookup.h @@ -27,14 +27,14 @@ #ifndef _USB2_LOOKUP_H_ #define _USB2_LOOKUP_H_ -struct usb2_attach_arg; +struct usb_attach_arg; /* * The following structure is used when looking up an USB driver for * an USB device. It is inspired by the Linux structure called - * "usb2_device_id". + * "usb_device_id". */ -struct usb2_device_id { +struct usb_device_id { /* Hook for driver specific information */ const void *driver_info; @@ -113,10 +113,10 @@ struct usb2_device_id { #define USB_GET_DRIVER_INFO(did) \ (((const uint8_t *)((did)->driver_info)) - ((const uint8_t *)0)) -const struct usb2_device_id *usb2_lookup_id_by_info( - const struct usb2_device_id *id, usb2_size_t sizeof_id, - const struct usb2_lookup_info *info); -int usb2_lookup_id_by_uaa(const struct usb2_device_id *id, - usb2_size_t sizeof_id, struct usb2_attach_arg *uaa); +const struct usb_device_id *usb2_lookup_id_by_info( + const struct usb_device_id *id, usb2_size_t sizeof_id, + const struct usb_lookup_info *info); +int usb2_lookup_id_by_uaa(const struct usb_device_id *id, + usb2_size_t sizeof_id, struct usb_attach_arg *uaa); #endif /* _USB2_LOOKUP_H_ */ diff --git a/sys/dev/usb/usb_mbuf.c b/sys/dev/usb/usb_mbuf.c index e4d92b6375a6..fdf42fda9a20 100644 --- a/sys/dev/usb/usb_mbuf.c +++ b/sys/dev/usb/usb_mbuf.c @@ -35,10 +35,10 @@ * should be released. *------------------------------------------------------------------------*/ void * -usb2_alloc_mbufs(struct malloc_type *type, struct usb2_ifqueue *ifq, +usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq, usb2_size_t block_size, uint16_t nblocks) { - struct usb2_mbuf *m_ptr; + struct usb_mbuf *m_ptr; uint8_t *data_ptr; void *free_ptr = NULL; usb2_size_t alloc_size; @@ -48,7 +48,7 @@ usb2_alloc_mbufs(struct malloc_type *type, struct usb2_ifqueue *ifq, if (nblocks && block_size) { - alloc_size = (block_size + sizeof(struct usb2_mbuf)) * nblocks; + alloc_size = (block_size + sizeof(struct usb_mbuf)) * nblocks; free_ptr = malloc(alloc_size, type, M_WAITOK | M_ZERO); diff --git a/sys/dev/usb/usb_mbuf.h b/sys/dev/usb/usb_mbuf.h index c748dbc79a93..e8c39d60c9cc 100644 --- a/sys/dev/usb/usb_mbuf.h +++ b/sys/dev/usb/usb_mbuf.h @@ -31,11 +31,11 @@ * The following structure defines a minimum re-implementation of the * mbuf system in the kernel. */ -struct usb2_mbuf { +struct usb_mbuf { uint8_t *cur_data_ptr; uint8_t *min_data_ptr; - struct usb2_mbuf *usb2_nextpkt; - struct usb2_mbuf *usb2_next; + struct usb_mbuf *usb2_nextpkt; + struct usb_mbuf *usb2_next; usb2_size_t cur_data_len; usb2_size_t max_data_len; @@ -47,9 +47,9 @@ struct usb2_mbuf { * The following structure defines a minimum re-implementation of the * ifqueue structure in the kernel. */ -struct usb2_ifqueue { - struct usb2_mbuf *ifq_head; - struct usb2_mbuf *ifq_tail; +struct usb_ifqueue { + struct usb_mbuf *ifq_head; + struct usb_mbuf *ifq_tail; usb2_size_t ifq_len; usb2_size_t ifq_maxlen; @@ -96,7 +96,7 @@ struct usb2_ifqueue { } while (0) /* prototypes */ -void *usb2_alloc_mbufs(struct malloc_type *type, struct usb2_ifqueue *ifq, +void *usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq, usb2_size_t block_size, uint16_t nblocks); #endif /* _USB2_MBUF_H_ */ diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c index 960cd95a38db..db258bfd922b 100644 --- a/sys/dev/usb/usb_msctest.c +++ b/sys/dev/usb/usb_msctest.c @@ -105,7 +105,7 @@ struct bbb_transfer { struct bbb_cbw cbw; struct bbb_csw csw; - struct usb2_xfer *xfer[ST_MAX]; + struct usb_xfer *xfer[ST_MAX]; uint8_t *data_ptr; @@ -131,7 +131,7 @@ static usb2_callback_t bbb_data_write_callback; static usb2_callback_t bbb_data_wr_cs_callback; static usb2_callback_t bbb_status_callback; -static const struct usb2_config bbb_config[ST_MAX] = { +static const struct usb_config bbb_config[ST_MAX] = { [ST_COMMAND] = { .type = UE_BULK, @@ -156,7 +156,7 @@ static const struct usb2_config bbb_config[ST_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &bbb_data_rd_cs_callback, .timeout = 1 * USB_MS_HZ, /* 1 second */ }, @@ -175,7 +175,7 @@ static const struct usb2_config bbb_config[ST_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &bbb_data_wr_cs_callback, .timeout = 1 * USB_MS_HZ, /* 1 second */ }, @@ -194,7 +194,7 @@ static const struct usb2_config bbb_config[ST_MAX] = { static void bbb_done(struct bbb_transfer *sc, uint8_t error) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; xfer = sc->xfer[sc->state]; @@ -225,7 +225,7 @@ bbb_transfer_start(struct bbb_transfer *sc, uint8_t xfer_index) } static void -bbb_data_clear_stall_callback(struct usb2_xfer *xfer, +bbb_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer) { struct bbb_transfer *sc = xfer->priv_sc; @@ -244,7 +244,7 @@ bbb_data_clear_stall_callback(struct usb2_xfer *xfer, } static void -bbb_command_callback(struct usb2_xfer *xfer) +bbb_command_callback(struct usb_xfer *xfer) { struct bbb_transfer *sc = xfer->priv_sc; uint32_t tag; @@ -283,7 +283,7 @@ bbb_command_callback(struct usb2_xfer *xfer) } static void -bbb_data_read_callback(struct usb2_xfer *xfer) +bbb_data_read_callback(struct usb_xfer *xfer) { struct bbb_transfer *sc = xfer->priv_sc; usb2_frlength_t max_bulk = xfer->max_data_length; @@ -327,14 +327,14 @@ bbb_data_read_callback(struct usb2_xfer *xfer) } static void -bbb_data_rd_cs_callback(struct usb2_xfer *xfer) +bbb_data_rd_cs_callback(struct usb_xfer *xfer) { bbb_data_clear_stall_callback(xfer, ST_STATUS, ST_DATA_RD); } static void -bbb_data_write_callback(struct usb2_xfer *xfer) +bbb_data_write_callback(struct usb_xfer *xfer) { struct bbb_transfer *sc = xfer->priv_sc; usb2_frlength_t max_bulk = xfer->max_data_length; @@ -379,14 +379,14 @@ bbb_data_write_callback(struct usb2_xfer *xfer) } static void -bbb_data_wr_cs_callback(struct usb2_xfer *xfer) +bbb_data_wr_cs_callback(struct usb_xfer *xfer) { bbb_data_clear_stall_callback(xfer, ST_STATUS, ST_DATA_WR); } static void -bbb_status_callback(struct usb2_xfer *xfer) +bbb_status_callback(struct usb_xfer *xfer) { struct bbb_transfer *sc = xfer->priv_sc; @@ -463,11 +463,11 @@ bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, * Else: Not an auto install disk. *------------------------------------------------------------------------*/ usb2_error_t -usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index, +usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index, uint8_t do_eject) { - struct usb2_interface *iface; - struct usb2_interface_descriptor *id; + struct usb_interface *iface; + struct usb_interface_descriptor *id; usb2_error_t err; uint8_t timeout; uint8_t sid_type; diff --git a/sys/dev/usb/usb_msctest.h b/sys/dev/usb/usb_msctest.h index 5bf64d0bb277..f3bbfb10c74e 100644 --- a/sys/dev/usb/usb_msctest.h +++ b/sys/dev/usb/usb_msctest.h @@ -27,7 +27,7 @@ #ifndef _USB2_MSCTEST_H_ #define _USB2_MSCTEST_H_ -usb2_error_t usb2_test_autoinstall(struct usb2_device *udev, +usb2_error_t usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index, uint8_t do_eject); #endif /* _USB2_MSCTEST_H_ */ diff --git a/sys/dev/usb/usb_parse.c b/sys/dev/usb/usb_parse.c index 710d8fa073d7..c6b3cca4c6a5 100644 --- a/sys/dev/usb/usb_parse.c +++ b/sys/dev/usb/usb_parse.c @@ -42,9 +42,9 @@ * NULL: End of descriptors * Else: Next descriptor after "desc" *------------------------------------------------------------------------*/ -struct usb2_descriptor * -usb2_desc_foreach(struct usb2_config_descriptor *cd, - struct usb2_descriptor *_desc) +struct usb_descriptor * +usb2_desc_foreach(struct usb_config_descriptor *cd, + struct usb_descriptor *_desc) { uint8_t *desc_next; uint8_t *start; @@ -80,7 +80,7 @@ usb2_desc_foreach(struct usb2_config_descriptor *cd, return (NULL); /* too short descriptor */ /* Return start of next descriptor. */ - return ((struct usb2_descriptor *)desc); + return ((struct usb_descriptor *)desc); } /*------------------------------------------------------------------------* @@ -94,21 +94,21 @@ usb2_desc_foreach(struct usb2_config_descriptor *cd, * NULL: End of descriptors * Else: A valid interface descriptor *------------------------------------------------------------------------*/ -struct usb2_interface_descriptor * -usb2_idesc_foreach(struct usb2_config_descriptor *cd, - struct usb2_idesc_parse_state *ps) +struct usb_interface_descriptor * +usb2_idesc_foreach(struct usb_config_descriptor *cd, + struct usb_idesc_parse_state *ps) { - struct usb2_interface_descriptor *id; + struct usb_interface_descriptor *id; uint8_t new_iface; /* retrieve current descriptor */ - id = (struct usb2_interface_descriptor *)ps->desc; + id = (struct usb_interface_descriptor *)ps->desc; /* default is to start a new interface */ new_iface = 1; while (1) { - id = (struct usb2_interface_descriptor *) - usb2_desc_foreach(cd, (struct usb2_descriptor *)id); + id = (struct usb_interface_descriptor *) + usb2_desc_foreach(cd, (struct usb_descriptor *)id); if (id == NULL) break; if ((id->bDescriptorType == UDESC_INTERFACE) && @@ -132,7 +132,7 @@ usb2_idesc_foreach(struct usb2_config_descriptor *cd, } /* store and return current descriptor */ - ps->desc = (struct usb2_descriptor *)id; + ps->desc = (struct usb_descriptor *)id; return (id); } @@ -147,13 +147,13 @@ usb2_idesc_foreach(struct usb2_config_descriptor *cd, * NULL: End of descriptors * Else: A valid endpoint descriptor *------------------------------------------------------------------------*/ -struct usb2_endpoint_descriptor * -usb2_edesc_foreach(struct usb2_config_descriptor *cd, - struct usb2_endpoint_descriptor *ped) +struct usb_endpoint_descriptor * +usb2_edesc_foreach(struct usb_config_descriptor *cd, + struct usb_endpoint_descriptor *ped) { - struct usb2_descriptor *desc; + struct usb_descriptor *desc; - desc = ((struct usb2_descriptor *)ped); + desc = ((struct usb_descriptor *)ped); while ((desc = usb2_desc_foreach(cd, desc))) { if (desc->bDescriptorType == UDESC_INTERFACE) { @@ -164,7 +164,7 @@ usb2_edesc_foreach(struct usb2_config_descriptor *cd, /* endpoint index is invalid */ break; } - return ((struct usb2_endpoint_descriptor *)desc); + return ((struct usb_endpoint_descriptor *)desc); } } return (NULL); @@ -177,9 +177,9 @@ usb2_edesc_foreach(struct usb2_config_descriptor *cd, * configuration descriptor of type "type". *------------------------------------------------------------------------*/ uint8_t -usb2_get_no_descriptors(struct usb2_config_descriptor *cd, uint8_t type) +usb2_get_no_descriptors(struct usb_config_descriptor *cd, uint8_t type) { - struct usb2_descriptor *desc = NULL; + struct usb_descriptor *desc = NULL; uint8_t count = 0; while ((desc = usb2_desc_foreach(cd, desc))) { @@ -199,21 +199,21 @@ usb2_get_no_descriptors(struct usb2_config_descriptor *cd, uint8_t type) * Number of alternate settings for the given interface descriptor pointer. *------------------------------------------------------------------------*/ uint8_t -usb2_get_no_alts(struct usb2_config_descriptor *cd, - struct usb2_interface_descriptor *id) +usb2_get_no_alts(struct usb_config_descriptor *cd, + struct usb_interface_descriptor *id) { - struct usb2_descriptor *desc; + struct usb_descriptor *desc; uint8_t n = 0; uint8_t ifaceno; ifaceno = id->bInterfaceNumber; - desc = (struct usb2_descriptor *)id; + desc = (struct usb_descriptor *)id; while ((desc = usb2_desc_foreach(cd, desc))) { if ((desc->bDescriptorType == UDESC_INTERFACE) && (desc->bLength >= sizeof(*id))) { - id = (struct usb2_interface_descriptor *)desc; + id = (struct usb_interface_descriptor *)desc; if (id->bInterfaceNumber == ifaceno) { n++; if (n == 0xFF) diff --git a/sys/dev/usb/usb_parse.h b/sys/dev/usb/usb_parse.h index b836b570ef4f..4f3661810049 100644 --- a/sys/dev/usb/usb_parse.h +++ b/sys/dev/usb/usb_parse.h @@ -29,8 +29,8 @@ /* structures */ -struct usb2_idesc_parse_state { - struct usb2_descriptor *desc; +struct usb_idesc_parse_state { + struct usb_descriptor *desc; uint8_t iface_index; /* current interface index */ uint8_t iface_no_last; uint8_t iface_index_alt; /* current alternate setting */ @@ -38,17 +38,17 @@ struct usb2_idesc_parse_state { /* prototypes */ -struct usb2_descriptor *usb2_desc_foreach(struct usb2_config_descriptor *cd, - struct usb2_descriptor *desc); -struct usb2_interface_descriptor *usb2_idesc_foreach( - struct usb2_config_descriptor *cd, - struct usb2_idesc_parse_state *ps); -struct usb2_endpoint_descriptor *usb2_edesc_foreach( - struct usb2_config_descriptor *cd, - struct usb2_endpoint_descriptor *ped); -uint8_t usb2_get_no_descriptors(struct usb2_config_descriptor *cd, +struct usb_descriptor *usb2_desc_foreach(struct usb_config_descriptor *cd, + struct usb_descriptor *desc); +struct usb_interface_descriptor *usb2_idesc_foreach( + struct usb_config_descriptor *cd, + struct usb_idesc_parse_state *ps); +struct usb_endpoint_descriptor *usb2_edesc_foreach( + struct usb_config_descriptor *cd, + struct usb_endpoint_descriptor *ped); +uint8_t usb2_get_no_descriptors(struct usb_config_descriptor *cd, uint8_t type); -uint8_t usb2_get_no_alts(struct usb2_config_descriptor *cd, - struct usb2_interface_descriptor *id); +uint8_t usb2_get_no_alts(struct usb_config_descriptor *cd, + struct usb_interface_descriptor *id); #endif /* _USB2_PARSE_H_ */ diff --git a/sys/dev/usb/usb_process.c b/sys/dev/usb/usb_process.c index 86882d2d0125..eba450b7adce 100644 --- a/sys/dev/usb/usb_process.c +++ b/sys/dev/usb/usb_process.c @@ -61,15 +61,15 @@ SYSCTL_INT(_hw_usb_proc, OID_AUTO, debug, CTLFLAG_RW, &usb2_proc_debug, 0, #endif /*------------------------------------------------------------------------* - * usb2_process + * usb_process * * This function is the USB process dispatcher. *------------------------------------------------------------------------*/ static void -usb2_process(void *arg) +usb_process(void *arg) { - struct usb2_process *up = arg; - struct usb2_proc_msg *pm; + struct usb_process *up = arg; + struct usb_proc_msg *pm; struct thread *td; /* adjust priority */ @@ -177,7 +177,7 @@ usb2_process(void *arg) * Else: failure *------------------------------------------------------------------------*/ int -usb2_proc_create(struct usb2_process *up, struct mtx *p_mtx, +usb2_proc_create(struct usb_process *up, struct mtx *p_mtx, const char *pmesg, uint8_t prio) { up->up_mtx = p_mtx; @@ -188,7 +188,7 @@ usb2_proc_create(struct usb2_process *up, struct mtx *p_mtx, usb2_cv_init(&up->up_cv, "wmsg"); usb2_cv_init(&up->up_drain, "dmsg"); - if (USB_THREAD_CREATE(&usb2_process, up, + if (USB_THREAD_CREATE(&usb_process, up, &up->up_ptr, pmesg)) { DPRINTFN(0, "Unable to create USB process."); up->up_ptr = NULL; @@ -211,7 +211,7 @@ error: * removed nor called. *------------------------------------------------------------------------*/ void -usb2_proc_free(struct usb2_process *up) +usb2_proc_free(struct usb_process *up) { /* check if not initialised */ if (up->up_mtx == NULL) @@ -238,11 +238,11 @@ usb2_proc_free(struct usb2_process *up) * at a time. The message that was queued is returned. *------------------------------------------------------------------------*/ void * -usb2_proc_msignal(struct usb2_process *up, void *_pm0, void *_pm1) +usb2_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1) { - struct usb2_proc_msg *pm0 = _pm0; - struct usb2_proc_msg *pm1 = _pm1; - struct usb2_proc_msg *pm2; + struct usb_proc_msg *pm0 = _pm0; + struct usb_proc_msg *pm1 = _pm1; + struct usb_proc_msg *pm2; usb2_size_t d; uint8_t t; @@ -321,7 +321,7 @@ usb2_proc_msignal(struct usb2_process *up, void *_pm0, void *_pm1) * Else: USB process is tearing down *------------------------------------------------------------------------*/ uint8_t -usb2_proc_is_gone(struct usb2_process *up) +usb2_proc_is_gone(struct usb_process *up) { if (up->up_gone) return (1); @@ -338,10 +338,10 @@ usb2_proc_is_gone(struct usb2_process *up) * having "up->up_mtx" locked. *------------------------------------------------------------------------*/ void -usb2_proc_mwait(struct usb2_process *up, void *_pm0, void *_pm1) +usb2_proc_mwait(struct usb_process *up, void *_pm0, void *_pm1) { - struct usb2_proc_msg *pm0 = _pm0; - struct usb2_proc_msg *pm1 = _pm1; + struct usb_proc_msg *pm0 = _pm0; + struct usb_proc_msg *pm1 = _pm1; /* check if gone */ if (up->up_gone) @@ -380,7 +380,7 @@ usb2_proc_mwait(struct usb2_process *up, void *_pm0, void *_pm1) * this function does nothing. *------------------------------------------------------------------------*/ void -usb2_proc_drain(struct usb2_process *up) +usb2_proc_drain(struct usb_process *up) { /* check if not initialised */ if (up->up_mtx == NULL) diff --git a/sys/dev/usb/usb_process.h b/sys/dev/usb/usb_process.h index c151f66b70e9..88e0b1b3bc87 100644 --- a/sys/dev/usb/usb_process.h +++ b/sys/dev/usb/usb_process.h @@ -39,17 +39,17 @@ /* structure prototypes */ -struct usb2_proc_msg; +struct usb_proc_msg; /* typedefs */ -typedef void (usb2_proc_callback_t)(struct usb2_proc_msg *hdr); +typedef void (usb2_proc_callback_t)(struct usb_proc_msg *hdr); /* * The following structure defines the USB process message header. */ -struct usb2_proc_msg { - TAILQ_ENTRY(usb2_proc_msg) pm_qentry; +struct usb_proc_msg { + TAILQ_ENTRY(usb_proc_msg) pm_qentry; usb2_proc_callback_t *pm_callback; usb2_size_t pm_num; }; @@ -57,8 +57,8 @@ struct usb2_proc_msg { /* * The following structure defines the USB process. */ -struct usb2_process { - TAILQ_HEAD(, usb2_proc_msg) up_qhead; +struct usb_process { + TAILQ_HEAD(, usb_proc_msg) up_qhead; struct cv up_cv; struct cv up_drain; @@ -77,12 +77,12 @@ struct usb2_process { /* prototypes */ -uint8_t usb2_proc_is_gone(struct usb2_process *up); -int usb2_proc_create(struct usb2_process *up, struct mtx *p_mtx, +uint8_t usb2_proc_is_gone(struct usb_process *up); +int usb2_proc_create(struct usb_process *up, struct mtx *p_mtx, const char *pmesg, uint8_t prio); -void usb2_proc_drain(struct usb2_process *up); -void usb2_proc_mwait(struct usb2_process *up, void *pm0, void *pm1); -void usb2_proc_free(struct usb2_process *up); -void *usb2_proc_msignal(struct usb2_process *up, void *pm0, void *pm1); +void usb2_proc_drain(struct usb_process *up); +void usb2_proc_mwait(struct usb_process *up, void *pm0, void *pm1); +void usb2_proc_free(struct usb_process *up); +void *usb2_proc_msignal(struct usb_process *up, void *pm0, void *pm1); #endif /* _USB2_PROCESS_H_ */ diff --git a/sys/dev/usb/usb_request.c b/sys/dev/usb/usb_request.c index 6eeb59dd3349..d8a120206bb0 100644 --- a/sys/dev/usb/usb_request.c +++ b/sys/dev/usb/usb_request.c @@ -68,7 +68,7 @@ SYSCTL_INT(_hw_usb, OID_AUTO, ss_delay, CTLFLAG_RW, * transfers. *------------------------------------------------------------------------*/ void -usb2_do_request_callback(struct usb2_xfer *xfer) +usb2_do_request_callback(struct usb_xfer *xfer) { ; /* workaround for a bug in "indent" */ @@ -90,13 +90,13 @@ usb2_do_request_callback(struct usb2_xfer *xfer) * This function is the USB callback for generic clear stall requests. *------------------------------------------------------------------------*/ void -usb2_do_clear_stall_callback(struct usb2_xfer *xfer) +usb2_do_clear_stall_callback(struct usb_xfer *xfer) { - struct usb2_device_request req; - struct usb2_device *udev; - struct usb2_pipe *pipe; - struct usb2_pipe *pipe_end; - struct usb2_pipe *pipe_first; + struct usb_device_request req; + struct usb_device *udev; + struct usb_pipe *pipe; + struct usb_pipe *pipe_end; + struct usb_pipe *pipe_first; uint8_t to; udev = xfer->xroot->udev; @@ -173,7 +173,7 @@ tr_setup: } static usb2_handle_request_t * -usb2_get_hr_func(struct usb2_device *udev) +usb2_get_hr_func(struct usb_device *udev) { /* figure out if there is a Handle Request function */ if (udev->flags.usb_mode == USB_MODE_DEVICE) @@ -189,7 +189,7 @@ usb2_get_hr_func(struct usb2_device *udev) * * Description of arguments passed to these functions: * - * "udev" - this is the "usb2_device" structure pointer on which the + * "udev" - this is the "usb_device" structure pointer on which the * request should be performed. It is possible to call this function * in both Host Side mode and Device Side mode. * @@ -240,12 +240,12 @@ usb2_get_hr_func(struct usb2_device *udev) * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx, - struct usb2_device_request *req, void *data, uint16_t flags, +usb2_do_request_flags(struct usb_device *udev, struct mtx *mtx, + struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb2_timeout_t timeout) { usb2_handle_request_t *hr_func; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; const void *desc; int err = 0; usb2_ticks_t start_ticks; @@ -533,8 +533,8 @@ done: * when calling this function. *------------------------------------------------------------------------*/ usb2_error_t -usb2_do_request_proc(struct usb2_device *udev, struct usb2_process *pproc, - struct usb2_device_request *req, void *data, uint16_t flags, +usb2_do_request_proc(struct usb_device *udev, struct usb_process *pproc, + struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb2_timeout_t timeout) { usb2_error_t err; @@ -577,9 +577,9 @@ done: * disabled. *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_reset_port(struct usb2_device *udev, struct mtx *mtx, uint8_t port) +usb2_req_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port) { - struct usb2_port_status ps; + struct usb_port_status ps; usb2_error_t err; uint16_t n; @@ -685,13 +685,13 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_desc(struct usb2_device *udev, +usb2_req_get_desc(struct usb_device *udev, struct mtx *mtx, uint16_t *actlen, void *desc, uint16_t min_len, uint16_t max_len, uint16_t id, uint8_t type, uint8_t index, uint8_t retries) { - struct usb2_device_request req; + struct usb_device_request req; uint8_t *buf; usb2_error_t err; @@ -776,7 +776,7 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_string_any(struct usb2_device *udev, struct mtx *mtx, char *buf, +usb2_req_get_string_any(struct usb_device *udev, struct mtx *mtx, char *buf, uint16_t len, uint8_t string_index) { char *s; @@ -871,7 +871,7 @@ usb2_req_get_string_any(struct usb2_device *udev, struct mtx *mtx, char *buf, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_string_desc(struct usb2_device *udev, struct mtx *mtx, void *sdesc, +usb2_req_get_string_desc(struct usb_device *udev, struct mtx *mtx, void *sdesc, uint16_t max_len, uint16_t lang_id, uint8_t string_index) { @@ -891,10 +891,10 @@ usb2_req_get_string_desc(struct usb2_device *udev, struct mtx *mtx, void *sdesc, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_descriptor_ptr(struct usb2_device *udev, - struct usb2_config_descriptor **ppcd, uint16_t wValue) +usb2_req_get_descriptor_ptr(struct usb_device *udev, + struct usb_config_descriptor **ppcd, uint16_t wValue) { - struct usb2_device_request req; + struct usb_device_request req; usb2_handle_request_t *hr_func; const void *ptr; uint16_t len; @@ -924,7 +924,7 @@ usb2_req_get_descriptor_ptr(struct usb2_device *udev, else if (ptr == NULL) err = USB_ERR_INVAL; - *ppcd = __DECONST(struct usb2_config_descriptor *, ptr); + *ppcd = __DECONST(struct usb_config_descriptor *, ptr); return (err); } @@ -937,8 +937,8 @@ usb2_req_get_descriptor_ptr(struct usb2_device *udev, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_config_desc(struct usb2_device *udev, struct mtx *mtx, - struct usb2_config_descriptor *d, uint8_t conf_index) +usb2_req_get_config_desc(struct usb_device *udev, struct mtx *mtx, + struct usb_config_descriptor *d, uint8_t conf_index) { usb2_error_t err; @@ -968,12 +968,12 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_config_desc_full(struct usb2_device *udev, struct mtx *mtx, - struct usb2_config_descriptor **ppcd, struct malloc_type *mtype, +usb2_req_get_config_desc_full(struct usb_device *udev, struct mtx *mtx, + struct usb_config_descriptor **ppcd, struct malloc_type *mtype, uint8_t index) { - struct usb2_config_descriptor cd; - struct usb2_config_descriptor *cdesc; + struct usb_config_descriptor cd; + struct usb_config_descriptor *cdesc; uint16_t len; usb2_error_t err; @@ -1017,8 +1017,8 @@ usb2_req_get_config_desc_full(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_device_desc(struct usb2_device *udev, struct mtx *mtx, - struct usb2_device_descriptor *d) +usb2_req_get_device_desc(struct usb_device *udev, struct mtx *mtx, + struct usb_device_descriptor *d) { DPRINTFN(4, "\n"); return (usb2_req_get_desc(udev, mtx, NULL, d, sizeof(*d), @@ -1033,11 +1033,11 @@ usb2_req_get_device_desc(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_alt_interface_no(struct usb2_device *udev, struct mtx *mtx, +usb2_req_get_alt_interface_no(struct usb_device *udev, struct mtx *mtx, uint8_t *alt_iface_no, uint8_t iface_index) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); @@ -1059,11 +1059,11 @@ usb2_req_get_alt_interface_no(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_alt_interface_no(struct usb2_device *udev, struct mtx *mtx, +usb2_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t alt_no) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); @@ -1086,10 +1086,10 @@ usb2_req_set_alt_interface_no(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_device_status(struct usb2_device *udev, struct mtx *mtx, - struct usb2_status *st) +usb2_req_get_device_status(struct usb_device *udev, struct mtx *mtx, + struct usb_status *st) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_STATUS; @@ -1107,10 +1107,10 @@ usb2_req_get_device_status(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_hub_descriptor(struct usb2_device *udev, struct mtx *mtx, - struct usb2_hub_descriptor *hd, uint8_t nports) +usb2_req_get_hub_descriptor(struct usb_device *udev, struct mtx *mtx, + struct usb_hub_descriptor *hd, uint8_t nports) { - struct usb2_device_request req; + struct usb_device_request req; uint16_t len = (nports + 7 + (8 * 8)) / 8; req.bmRequestType = UT_READ_CLASS_DEVICE; @@ -1129,16 +1129,16 @@ usb2_req_get_hub_descriptor(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_hub_status(struct usb2_device *udev, struct mtx *mtx, - struct usb2_hub_status *st) +usb2_req_get_hub_status(struct usb_device *udev, struct mtx *mtx, + struct usb_hub_status *st) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_CLASS_DEVICE; req.bRequest = UR_GET_STATUS; USETW(req.wValue, 0); USETW(req.wIndex, 0); - USETW(req.wLength, sizeof(struct usb2_hub_status)); + USETW(req.wLength, sizeof(struct usb_hub_status)); return (usb2_do_request(udev, mtx, &req, st)); } @@ -1153,9 +1153,9 @@ usb2_req_get_hub_status(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_address(struct usb2_device *udev, struct mtx *mtx, uint16_t addr) +usb2_req_set_address(struct usb_device *udev, struct mtx *mtx, uint16_t addr) { - struct usb2_device_request req; + struct usb_device_request req; DPRINTFN(6, "setting device address=%d\n", addr); @@ -1178,10 +1178,10 @@ usb2_req_set_address(struct usb2_device *udev, struct mtx *mtx, uint16_t addr) * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_port_status(struct usb2_device *udev, struct mtx *mtx, - struct usb2_port_status *ps, uint8_t port) +usb2_req_get_port_status(struct usb_device *udev, struct mtx *mtx, + struct usb_port_status *ps, uint8_t port) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_CLASS_OTHER; req.bRequest = UR_GET_STATUS; @@ -1200,10 +1200,10 @@ usb2_req_get_port_status(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_clear_hub_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_req_clear_hub_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_CLASS_DEVICE; req.bRequest = UR_CLEAR_FEATURE; @@ -1221,10 +1221,10 @@ usb2_req_clear_hub_feature(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_hub_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_CLASS_DEVICE; req.bRequest = UR_SET_FEATURE; @@ -1242,10 +1242,10 @@ usb2_req_set_hub_feature(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_clear_port_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_req_clear_port_feature(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint16_t sel) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_CLASS_OTHER; req.bRequest = UR_CLEAR_FEATURE; @@ -1264,10 +1264,10 @@ usb2_req_clear_port_feature(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_port_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_req_set_port_feature(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint16_t sel) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_CLASS_OTHER; req.bRequest = UR_SET_FEATURE; @@ -1286,11 +1286,11 @@ usb2_req_set_port_feature(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_protocol(struct usb2_device *udev, struct mtx *mtx, +usb2_req_set_protocol(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint16_t report) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); @@ -1315,11 +1315,11 @@ usb2_req_set_protocol(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_report(struct usb2_device *udev, struct mtx *mtx, void *data, uint16_t len, +usb2_req_set_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); @@ -1343,11 +1343,11 @@ usb2_req_set_report(struct usb2_device *udev, struct mtx *mtx, void *data, uint1 * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_report(struct usb2_device *udev, struct mtx *mtx, void *data, +usb2_req_get_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL) || (id == 0)) { return (USB_ERR_INVAL); @@ -1371,11 +1371,11 @@ usb2_req_get_report(struct usb2_device *udev, struct mtx *mtx, void *data, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_idle(struct usb2_device *udev, struct mtx *mtx, +usb2_req_set_idle(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t duration, uint8_t id) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); @@ -1399,11 +1399,11 @@ usb2_req_set_idle(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_report_descriptor(struct usb2_device *udev, struct mtx *mtx, +usb2_req_get_report_descriptor(struct usb_device *udev, struct mtx *mtx, void *d, uint16_t size, uint8_t iface_index) { - struct usb2_interface *iface = usb2_get_iface(udev, iface_index); - struct usb2_device_request req; + struct usb_interface *iface = usb2_get_iface(udev, iface_index); + struct usb_device_request req; if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); @@ -1429,9 +1429,9 @@ usb2_req_get_report_descriptor(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_config(struct usb2_device *udev, struct mtx *mtx, uint8_t conf) +usb2_req_set_config(struct usb_device *udev, struct mtx *mtx, uint8_t conf) { - struct usb2_device_request req; + struct usb_device_request req; DPRINTF("setting config %d\n", conf); @@ -1454,9 +1454,9 @@ usb2_req_set_config(struct usb2_device *udev, struct mtx *mtx, uint8_t conf) * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_get_config(struct usb2_device *udev, struct mtx *mtx, uint8_t *pconf) +usb2_req_get_config(struct usb_device *udev, struct mtx *mtx, uint8_t *pconf) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_CONFIG; @@ -1478,9 +1478,9 @@ usb2_req_get_config(struct usb2_device *udev, struct mtx *mtx, uint8_t *pconf) * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_re_enumerate(struct usb2_device *udev, struct mtx *mtx) +usb2_req_re_enumerate(struct usb_device *udev, struct mtx *mtx) { - struct usb2_device *parent_hub; + struct usb_device *parent_hub; usb2_error_t err; uint8_t old_addr; uint8_t do_retry = 1; @@ -1563,10 +1563,10 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_clear_device_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_req_clear_device_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_CLEAR_FEATURE; @@ -1584,10 +1584,10 @@ usb2_req_clear_device_feature(struct usb2_device *udev, struct mtx *mtx, * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_req_set_device_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_req_set_device_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_SET_FEATURE; diff --git a/sys/dev/usb/usb_request.h b/sys/dev/usb/usb_request.h index a29b0b43f2f4..6e621ef53fa4 100644 --- a/sys/dev/usb/usb_request.h +++ b/sys/dev/usb/usb_request.h @@ -27,78 +27,78 @@ #ifndef _USB2_REQUEST_H_ #define _USB2_REQUEST_H_ -struct usb2_process; +struct usb_process; -usb2_error_t usb2_do_request_flags(struct usb2_device *udev, struct mtx *mtx, - struct usb2_device_request *req, void *data, uint16_t flags, +usb2_error_t usb2_do_request_flags(struct usb_device *udev, struct mtx *mtx, + struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb2_timeout_t timeout); -usb2_error_t usb2_do_request_proc(struct usb2_device *udev, struct usb2_process *pproc, - struct usb2_device_request *req, void *data, uint16_t flags, +usb2_error_t usb2_do_request_proc(struct usb_device *udev, struct usb_process *pproc, + struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb2_timeout_t timeout); -usb2_error_t usb2_req_clear_hub_feature(struct usb2_device *udev, +usb2_error_t usb2_req_clear_hub_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel); -usb2_error_t usb2_req_clear_port_feature(struct usb2_device *udev, +usb2_error_t usb2_req_clear_port_feature(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint16_t sel); -usb2_error_t usb2_req_get_alt_interface_no(struct usb2_device *udev, +usb2_error_t usb2_req_get_alt_interface_no(struct usb_device *udev, struct mtx *mtx, uint8_t *alt_iface_no, uint8_t iface_index); -usb2_error_t usb2_req_get_config(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_get_config(struct usb_device *udev, struct mtx *mtx, uint8_t *pconf); -usb2_error_t usb2_req_get_descriptor_ptr(struct usb2_device *udev, - struct usb2_config_descriptor **ppcd, uint16_t wValue); -usb2_error_t usb2_req_get_config_desc(struct usb2_device *udev, struct mtx *mtx, - struct usb2_config_descriptor *d, uint8_t conf_index); -usb2_error_t usb2_req_get_config_desc_full(struct usb2_device *udev, - struct mtx *mtx, struct usb2_config_descriptor **ppcd, +usb2_error_t usb2_req_get_descriptor_ptr(struct usb_device *udev, + struct usb_config_descriptor **ppcd, uint16_t wValue); +usb2_error_t usb2_req_get_config_desc(struct usb_device *udev, struct mtx *mtx, + struct usb_config_descriptor *d, uint8_t conf_index); +usb2_error_t usb2_req_get_config_desc_full(struct usb_device *udev, + struct mtx *mtx, struct usb_config_descriptor **ppcd, struct malloc_type *mtype, uint8_t conf_index); -usb2_error_t usb2_req_get_desc(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_get_desc(struct usb_device *udev, struct mtx *mtx, uint16_t *actlen, void *desc, uint16_t min_len, uint16_t max_len, uint16_t id, uint8_t type, uint8_t index, uint8_t retries); -usb2_error_t usb2_req_get_device_desc(struct usb2_device *udev, struct mtx *mtx, - struct usb2_device_descriptor *d); -usb2_error_t usb2_req_get_device_status(struct usb2_device *udev, - struct mtx *mtx, struct usb2_status *st); -usb2_error_t usb2_req_get_hub_descriptor(struct usb2_device *udev, - struct mtx *mtx, struct usb2_hub_descriptor *hd, +usb2_error_t usb2_req_get_device_desc(struct usb_device *udev, struct mtx *mtx, + struct usb_device_descriptor *d); +usb2_error_t usb2_req_get_device_status(struct usb_device *udev, + struct mtx *mtx, struct usb_status *st); +usb2_error_t usb2_req_get_hub_descriptor(struct usb_device *udev, + struct mtx *mtx, struct usb_hub_descriptor *hd, uint8_t nports); -usb2_error_t usb2_req_get_hub_status(struct usb2_device *udev, struct mtx *mtx, - struct usb2_hub_status *st); -usb2_error_t usb2_req_get_port_status(struct usb2_device *udev, struct mtx *mtx, - struct usb2_port_status *ps, uint8_t port); -usb2_error_t usb2_req_get_report(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_get_hub_status(struct usb_device *udev, struct mtx *mtx, + struct usb_hub_status *st); +usb2_error_t usb2_req_get_port_status(struct usb_device *udev, struct mtx *mtx, + struct usb_port_status *ps, uint8_t port); +usb2_error_t usb2_req_get_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id); -usb2_error_t usb2_req_get_report_descriptor(struct usb2_device *udev, +usb2_error_t usb2_req_get_report_descriptor(struct usb_device *udev, struct mtx *mtx, void *d, uint16_t size, uint8_t iface_index); -usb2_error_t usb2_req_get_string_any(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_get_string_any(struct usb_device *udev, struct mtx *mtx, char *buf, uint16_t len, uint8_t string_index); -usb2_error_t usb2_req_get_string_desc(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_get_string_desc(struct usb_device *udev, struct mtx *mtx, void *sdesc, uint16_t max_len, uint16_t lang_id, uint8_t string_index); -usb2_error_t usb2_req_reset_port(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port); -usb2_error_t usb2_req_set_address(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_set_address(struct usb_device *udev, struct mtx *mtx, uint16_t addr); -usb2_error_t usb2_req_set_alt_interface_no(struct usb2_device *udev, +usb2_error_t usb2_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t alt_no); -usb2_error_t usb2_req_set_config(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_set_config(struct usb_device *udev, struct mtx *mtx, uint8_t conf); -usb2_error_t usb2_req_set_hub_feature(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel); -usb2_error_t usb2_req_set_idle(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_set_idle(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t duration, uint8_t id); -usb2_error_t usb2_req_set_port_feature(struct usb2_device *udev, +usb2_error_t usb2_req_set_port_feature(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint16_t sel); -usb2_error_t usb2_req_set_protocol(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_set_protocol(struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint16_t report); -usb2_error_t usb2_req_set_report(struct usb2_device *udev, struct mtx *mtx, +usb2_error_t usb2_req_set_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id); -usb2_error_t usb2_req_re_enumerate(struct usb2_device *udev, struct mtx *mtx); -usb2_error_t usb2_req_clear_device_feature(struct usb2_device *udev, struct mtx *mtx, uint16_t sel); -usb2_error_t usb2_req_set_device_feature(struct usb2_device *udev, struct mtx *mtx, uint16_t sel); +usb2_error_t usb2_req_re_enumerate(struct usb_device *udev, struct mtx *mtx); +usb2_error_t usb2_req_clear_device_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel); +usb2_error_t usb2_req_set_device_feature(struct usb_device *udev, struct mtx *mtx, uint16_t sel); #define usb2_do_request(u,m,r,d) \ usb2_do_request_flags(u,m,r,d,0,NULL,USB_DEFAULT_TIMEOUT) diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index 304edd5d28bf..ed911c498dd8 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -52,7 +52,7 @@ struct usb2_std_packet_size { static usb2_callback_t usb2_request_callback; -static const struct usb2_config usb2_control_ep_cfg[USB_DEFAULT_XFER_MAX] = { +static const struct usb_config usb2_control_ep_cfg[USB_DEFAULT_XFER_MAX] = { /* This transfer is used for generic control endpoint transfers */ @@ -72,7 +72,7 @@ static const struct usb2_config usb2_control_ep_cfg[USB_DEFAULT_XFER_MAX] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, - .bufsize = sizeof(struct usb2_device_request), + .bufsize = sizeof(struct usb_device_request), .callback = &usb2_do_clear_stall_callback, .timeout = 1000, /* 1 second */ .interval = 50, /* 50ms */ @@ -82,16 +82,16 @@ static const struct usb2_config usb2_control_ep_cfg[USB_DEFAULT_XFER_MAX] = { /* function prototypes */ -static void usb2_update_max_frame_size(struct usb2_xfer *); -static void usb2_transfer_unsetup_sub(struct usb2_xfer_root *, uint8_t); -static void usb2_control_transfer_init(struct usb2_xfer *); -static uint8_t usb2_start_hardware_sub(struct usb2_xfer *); -static void usb2_callback_proc(struct usb2_proc_msg *); -static void usb2_callback_ss_done_defer(struct usb2_xfer *); -static void usb2_callback_wrapper(struct usb2_xfer_queue *); +static void usb2_update_max_frame_size(struct usb_xfer *); +static void usb2_transfer_unsetup_sub(struct usb_xfer_root *, uint8_t); +static void usb2_control_transfer_init(struct usb_xfer *); +static uint8_t usb2_start_hardware_sub(struct usb_xfer *); +static void usb2_callback_proc(struct usb_proc_msg *); +static void usb2_callback_ss_done_defer(struct usb_xfer *); +static void usb2_callback_wrapper(struct usb_xfer_queue *); static void usb2_dma_delay_done_cb(void *); static void usb2_transfer_start_cb(void *); -static uint8_t usb2_callback_wrapper_sub(struct usb2_xfer *); +static uint8_t usb2_callback_wrapper_sub(struct usb_xfer *); static void usb2_get_std_packet_size(struct usb2_std_packet_size *ptr, uint8_t type, enum usb_dev_speed speed); @@ -99,7 +99,7 @@ static void usb2_get_std_packet_size(struct usb2_std_packet_size *ptr, * usb2_request_callback *------------------------------------------------------------------------*/ static void -usb2_request_callback(struct usb2_xfer *xfer) +usb2_request_callback(struct usb_xfer *xfer) { if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) usb2_handle_request_callback(xfer); @@ -114,7 +114,7 @@ usb2_request_callback(struct usb2_xfer *xfer) * can transfer multiple consecutive packets. *------------------------------------------------------------------------*/ static void -usb2_update_max_frame_size(struct usb2_xfer *xfer) +usb2_update_max_frame_size(struct usb_xfer *xfer) { /* compute maximum frame size */ @@ -138,7 +138,7 @@ usb2_update_max_frame_size(struct usb2_xfer *xfer) * Else: milliseconds of DMA delay *------------------------------------------------------------------------*/ usb2_timeout_t -usb2_get_dma_delay(struct usb2_bus *bus) +usb2_get_dma_delay(struct usb_bus *bus) { uint32_t temp = 0; @@ -167,12 +167,12 @@ usb2_get_dma_delay(struct usb2_bus *bus) *------------------------------------------------------------------------*/ #if USB_HAVE_BUSDMA uint8_t -usb2_transfer_setup_sub_malloc(struct usb2_setup_params *parm, - struct usb2_page_cache **ppc, usb2_size_t size, usb2_size_t align, +usb2_transfer_setup_sub_malloc(struct usb_setup_params *parm, + struct usb_page_cache **ppc, usb2_size_t size, usb2_size_t align, usb2_size_t count) { - struct usb2_page_cache *pc; - struct usb2_page *pg; + struct usb_page_cache *pc; + struct usb_page *pg; void *buf; usb2_size_t n_dma_pc; usb2_size_t n_obj; @@ -284,19 +284,19 @@ usb2_transfer_setup_sub_malloc(struct usb2_setup_params *parm, * This function must be called from the "xfer_setup" callback of the * USB Host or Device controller driver when setting up an USB * transfer. This function will setup correct packet sizes, buffer - * sizes, flags and more, that are stored in the "usb2_xfer" + * sizes, flags and more, that are stored in the "usb_xfer" * structure. *------------------------------------------------------------------------*/ void -usb2_transfer_setup_sub(struct usb2_setup_params *parm) +usb2_transfer_setup_sub(struct usb_setup_params *parm) { enum { REQ_SIZE = 8, MIN_PKT = 8, }; - struct usb2_xfer *xfer = parm->curr_xfer; - const struct usb2_config *setup = parm->curr_setup; - struct usb2_endpoint_descriptor *edesc; + struct usb_xfer *xfer = parm->curr_xfer; + const struct usb_config *setup = parm->curr_setup; + struct usb_endpoint_descriptor *edesc; struct usb2_std_packet_size std_size; usb2_frcount_t n_frlengths; usb2_frcount_t n_frbuffers; @@ -628,7 +628,7 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm) * * Assume there are three USB frames having length "a", "b" and * "c". These USB frames will at maximum need "z" - * "usb2_page" structures. "z" is given by: + * "usb_page" structures. "z" is given by: * * z = ((a / USB_PAGE_SIZE) + 2) + ((b / USB_PAGE_SIZE) + 2) + * ((c / USB_PAGE_SIZE) + 2); @@ -714,18 +714,18 @@ done: * Else: Failure *------------------------------------------------------------------------*/ usb2_error_t -usb2_transfer_setup(struct usb2_device *udev, - const uint8_t *ifaces, struct usb2_xfer **ppxfer, - const struct usb2_config *setup_start, uint16_t n_setup, +usb2_transfer_setup(struct usb_device *udev, + const uint8_t *ifaces, struct usb_xfer **ppxfer, + const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx) { - struct usb2_xfer dummy; - struct usb2_setup_params parm; - const struct usb2_config *setup_end = setup_start + n_setup; - const struct usb2_config *setup; - struct usb2_pipe *pipe; - struct usb2_xfer_root *info; - struct usb2_xfer *xfer; + struct usb_xfer dummy; + struct usb_setup_params parm; + const struct usb_config *setup_end = setup_start + n_setup; + const struct usb_config *setup; + struct usb_pipe *pipe; + struct usb_xfer_root *info; + struct usb_xfer *xfer; void *buf = NULL; uint16_t n; uint16_t refcount; @@ -784,7 +784,7 @@ usb2_transfer_setup(struct usb2_device *udev, if (buf) { /* - * Initialize the "usb2_xfer_root" structure, + * Initialize the "usb_xfer_root" structure, * which is common for all our USB transfers. */ info = USB_ADD_BYTES(buf, 0); @@ -874,7 +874,7 @@ usb2_transfer_setup(struct usb2_device *udev, if (buf) { /* * Common initialization of the - * "usb2_xfer" structure. + * "usb_xfer" structure. */ xfer = USB_ADD_BYTES(buf, parm.size[0]); xfer->address = udev->address; @@ -886,7 +886,7 @@ usb2_transfer_setup(struct usb2_device *udev, } else { /* * Setup a dummy xfer, hence we are - * writing to the "usb2_xfer" + * writing to the "usb_xfer" * structure pointed to by "xfer" * before we have allocated any * memory: @@ -1050,9 +1050,9 @@ done: * usb2_transfer_unsetup_sub - factored out code *------------------------------------------------------------------------*/ static void -usb2_transfer_unsetup_sub(struct usb2_xfer_root *info, uint8_t needs_delay) +usb2_transfer_unsetup_sub(struct usb_xfer_root *info, uint8_t needs_delay) { - struct usb2_page_cache *pc; + struct usb_page_cache *pc; USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED); @@ -1106,10 +1106,10 @@ usb2_transfer_unsetup_sub(struct usb2_xfer_root *info, uint8_t needs_delay) * returns. *------------------------------------------------------------------------*/ void -usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup) +usb2_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup) { - struct usb2_xfer *xfer; - struct usb2_xfer_root *info; + struct usb_xfer *xfer; + struct usb_xfer_root *info; uint8_t needs_delay = 0; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, @@ -1181,7 +1181,7 @@ usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup) * usb2_control_transfer_init - factored out code * * In USB Device Mode we have to wait for the SETUP packet which - * containst the "struct usb2_device_request" structure, before we can + * containst the "struct usb_device_request" structure, before we can * transfer any data. In USB Host Mode we already have the SETUP * packet at the moment the USB transfer is started. This leads us to * having to setup the USB transfer at two different places in @@ -1189,9 +1189,9 @@ usb2_transfer_unsetup(struct usb2_xfer **pxfer, uint16_t n_setup) * initialisation code, so that we don't duplicate the code. *------------------------------------------------------------------------*/ static void -usb2_control_transfer_init(struct usb2_xfer *xfer) +usb2_control_transfer_init(struct usb_xfer *xfer) { - struct usb2_device_request req; + struct usb_device_request req; /* copy out the USB request header */ @@ -1220,7 +1220,7 @@ usb2_control_transfer_init(struct usb2_xfer *xfer) * Else: Failure *------------------------------------------------------------------------*/ static uint8_t -usb2_start_hardware_sub(struct usb2_xfer *xfer) +usb2_start_hardware_sub(struct usb_xfer *xfer) { usb2_frlength_t len; @@ -1272,10 +1272,10 @@ usb2_start_hardware_sub(struct usb2_xfer *xfer) /* the size of the SETUP structure is hardcoded ! */ - if (xfer->frlengths[0] != sizeof(struct usb2_device_request)) { + if (xfer->frlengths[0] != sizeof(struct usb_device_request)) { DPRINTFN(0, "Wrong framelength %u != %zu\n", xfer->frlengths[0], sizeof(struct - usb2_device_request)); + usb_device_request)); goto error; } /* check USB mode */ @@ -1310,7 +1310,7 @@ usb2_start_hardware_sub(struct usb2_xfer *xfer) /* get data length */ - len = (xfer->sumlen - sizeof(struct usb2_device_request)); + len = (xfer->sumlen - sizeof(struct usb_device_request)); } /* check if there is a length mismatch */ @@ -1367,10 +1367,10 @@ error: * This function should only be called from the USB callback. *------------------------------------------------------------------------*/ void -usb2_start_hardware(struct usb2_xfer *xfer) +usb2_start_hardware(struct usb_xfer *xfer) { - struct usb2_xfer_root *info; - struct usb2_bus *bus; + struct usb_xfer_root *info; + struct usb_bus *bus; usb2_frcount_t x; info = xfer->xroot; @@ -1555,9 +1555,9 @@ usb2_start_hardware(struct usb2_xfer *xfer) * usb2_pipe_enter - factored out code *------------------------------------------------------------------------*/ void -usb2_pipe_enter(struct usb2_xfer *xfer) +usb2_pipe_enter(struct usb_xfer *xfer) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; USB_XFER_LOCK_ASSERT(xfer, MA_OWNED); @@ -1593,7 +1593,7 @@ usb2_pipe_enter(struct usb2_xfer *xfer) * completes. *------------------------------------------------------------------------*/ void -usb2_transfer_start(struct usb2_xfer *xfer) +usb2_transfer_start(struct usb_xfer *xfer) { if (xfer == NULL) { /* transfer is gone */ @@ -1626,9 +1626,9 @@ usb2_transfer_start(struct usb2_xfer *xfer) * reuse any DMA buffers. See "usb2_transfer_drain()". *------------------------------------------------------------------------*/ void -usb2_transfer_stop(struct usb2_xfer *xfer) +usb2_transfer_stop(struct usb_xfer *xfer) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; if (xfer == NULL) { /* transfer is gone */ @@ -1710,10 +1710,10 @@ usb2_transfer_stop(struct usb2_xfer *xfer) * 1: Pending: The USB transfer will receive a callback in the future. *------------------------------------------------------------------------*/ uint8_t -usb2_transfer_pending(struct usb2_xfer *xfer) +usb2_transfer_pending(struct usb_xfer *xfer) { - struct usb2_xfer_root *info; - struct usb2_xfer_queue *pq; + struct usb_xfer_root *info; + struct usb_xfer_queue *pq; if (xfer == NULL) { /* transfer is gone */ @@ -1753,7 +1753,7 @@ usb2_transfer_pending(struct usb2_xfer *xfer) * function has returned. *------------------------------------------------------------------------*/ void -usb2_transfer_drain(struct usb2_xfer *xfer) +usb2_transfer_drain(struct usb_xfer *xfer) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "usb2_transfer_drain can sleep!"); @@ -1789,7 +1789,7 @@ usb2_transfer_drain(struct usb2_xfer *xfer) * than zero gives undefined results! *------------------------------------------------------------------------*/ void -usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr, usb2_frcount_t frindex) +usb2_set_frame_data(struct usb_xfer *xfer, void *ptr, usb2_frcount_t frindex) { /* set virtual address to load and length */ xfer->frbuffers[frindex].buffer = ptr; @@ -1802,7 +1802,7 @@ usb2_set_frame_data(struct usb2_xfer *xfer, void *ptr, usb2_frcount_t frindex) * of the USB DMA buffer allocated for this USB transfer. *------------------------------------------------------------------------*/ void -usb2_set_frame_offset(struct usb2_xfer *xfer, usb2_frlength_t offset, +usb2_set_frame_offset(struct usb_xfer *xfer, usb2_frlength_t offset, usb2_frcount_t frindex) { USB_ASSERT(!xfer->flags.ext_buffer, ("Cannot offset data frame " @@ -1819,10 +1819,10 @@ usb2_set_frame_offset(struct usb2_xfer *xfer, usb2_frlength_t offset, * This function performs USB callbacks. *------------------------------------------------------------------------*/ static void -usb2_callback_proc(struct usb2_proc_msg *_pm) +usb2_callback_proc(struct usb_proc_msg *_pm) { - struct usb2_done_msg *pm = (void *)_pm; - struct usb2_xfer_root *info = pm->xroot; + struct usb_done_msg *pm = (void *)_pm; + struct usb_xfer_root *info = pm->xroot; /* Change locking order */ USB_BUS_UNLOCK(info->bus); @@ -1848,10 +1848,10 @@ usb2_callback_proc(struct usb2_proc_msg *_pm) * correct thread. *------------------------------------------------------------------------*/ static void -usb2_callback_ss_done_defer(struct usb2_xfer *xfer) +usb2_callback_ss_done_defer(struct usb_xfer *xfer) { - struct usb2_xfer_root *info = xfer->xroot; - struct usb2_xfer_queue *pq = &info->done_q; + struct usb_xfer_root *info = xfer->xroot; + struct usb_xfer_queue *pq = &info->done_q; USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -1886,10 +1886,10 @@ usb2_callback_ss_done_defer(struct usb2_xfer *xfer) * interrupt process. *------------------------------------------------------------------------*/ static void -usb2_callback_wrapper(struct usb2_xfer_queue *pq) +usb2_callback_wrapper(struct usb_xfer_queue *pq) { - struct usb2_xfer *xfer = pq->curr; - struct usb2_xfer_root *info = xfer->xroot; + struct usb_xfer *xfer = pq->curr; + struct usb_xfer_root *info = xfer->xroot; USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED); if (!mtx_owned(info->xfer_mtx)) { @@ -2007,7 +2007,7 @@ done: static void usb2_dma_delay_done_cb(void *arg) { - struct usb2_xfer *xfer = arg; + struct usb_xfer *xfer = arg; USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -2026,9 +2026,9 @@ usb2_dma_delay_done_cb(void *arg) * - This function can be called multiple times in a row. *------------------------------------------------------------------------*/ void -usb2_transfer_dequeue(struct usb2_xfer *xfer) +usb2_transfer_dequeue(struct usb_xfer *xfer) { - struct usb2_xfer_queue *pq; + struct usb_xfer_queue *pq; pq = xfer->wait_queue; if (pq) { @@ -2046,7 +2046,7 @@ usb2_transfer_dequeue(struct usb2_xfer *xfer) * - This function can be called multiple times in a row. *------------------------------------------------------------------------*/ void -usb2_transfer_enqueue(struct usb2_xfer_queue *pq, struct usb2_xfer *xfer) +usb2_transfer_enqueue(struct usb_xfer_queue *pq, struct usb_xfer *xfer) { /* * Insert the USB transfer into the queue, if it is not @@ -2070,7 +2070,7 @@ usb2_transfer_enqueue(struct usb2_xfer_queue *pq, struct usb2_xfer *xfer) * - This function is used to stop any USB transfer timeouts. *------------------------------------------------------------------------*/ void -usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error) +usb2_transfer_done(struct usb_xfer *xfer, usb2_error_t error) { USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -2100,7 +2100,7 @@ usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error) #if USB_HAVE_BUSDMA if (mtx_owned(xfer->xroot->xfer_mtx)) { - struct usb2_xfer_queue *pq; + struct usb_xfer_queue *pq; /* * If the private USB lock is not locked, then we assume @@ -2137,8 +2137,8 @@ usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error) static void usb2_transfer_start_cb(void *arg) { - struct usb2_xfer *xfer = arg; - struct usb2_pipe *pipe = xfer->pipe; + struct usb_xfer *xfer = arg; + struct usb_pipe *pipe = xfer->pipe; USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -2163,7 +2163,7 @@ usb2_transfer_start_cb(void *arg) * callback. This function is NULL safe. *------------------------------------------------------------------------*/ void -usb2_transfer_set_stall(struct usb2_xfer *xfer) +usb2_transfer_set_stall(struct usb_xfer *xfer) { if (xfer == NULL) { /* tearing down */ @@ -2186,7 +2186,7 @@ usb2_transfer_set_stall(struct usb2_xfer *xfer) * callback. This function is NULL safe. *------------------------------------------------------------------------*/ void -usb2_transfer_clear_stall(struct usb2_xfer *xfer) +usb2_transfer_clear_stall(struct usb_xfer *xfer) { if (xfer == NULL) { /* tearing down */ @@ -2208,10 +2208,10 @@ usb2_transfer_clear_stall(struct usb2_xfer *xfer) * This function is used to add an USB transfer to the pipe transfer list. *------------------------------------------------------------------------*/ void -usb2_pipe_start(struct usb2_xfer_queue *pq) +usb2_pipe_start(struct usb_xfer_queue *pq) { - struct usb2_pipe *pipe; - struct usb2_xfer *xfer; + struct usb_pipe *pipe; + struct usb_xfer *xfer; uint8_t type; xfer = pq->curr; @@ -2238,8 +2238,8 @@ usb2_pipe_start(struct usb2_xfer_queue *pq) type = (pipe->edesc->bmAttributes & UE_XFERTYPE); if ((type == UE_BULK) || (type == UE_INTERRUPT)) { - struct usb2_device *udev; - struct usb2_xfer_root *info; + struct usb_device *udev; + struct usb_xfer_root *info; info = xfer->xroot; udev = info->udev; @@ -2315,7 +2315,7 @@ usb2_pipe_start(struct usb2_xfer_queue *pq) * "cb" will get called after "ms" milliseconds. *------------------------------------------------------------------------*/ void -usb2_transfer_timeout_ms(struct usb2_xfer *xfer, +usb2_transfer_timeout_ms(struct usb_xfer *xfer, void (*cb) (void *arg), usb2_timeout_t ms) { USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); @@ -2343,9 +2343,9 @@ usb2_transfer_timeout_ms(struct usb2_xfer *xfer, * Else: The callback has been deferred. *------------------------------------------------------------------------*/ static uint8_t -usb2_callback_wrapper_sub(struct usb2_xfer *xfer) +usb2_callback_wrapper_sub(struct usb_xfer *xfer) { - struct usb2_pipe *pipe; + struct usb_pipe *pipe; usb2_frcount_t x; if ((!xfer->flags_int.open) && @@ -2499,7 +2499,7 @@ done: * transfer. *------------------------------------------------------------------------*/ void -usb2_command_wrapper(struct usb2_xfer_queue *pq, struct usb2_xfer *xfer) +usb2_command_wrapper(struct usb_xfer_queue *pq, struct usb_xfer *xfer) { if (xfer) { /* @@ -2560,9 +2560,9 @@ usb2_command_wrapper(struct usb2_xfer_queue *pq, struct usb2_xfer *xfer) * transfer. *------------------------------------------------------------------------*/ void -usb2_default_transfer_setup(struct usb2_device *udev) +usb2_default_transfer_setup(struct usb_device *udev) { - struct usb2_xfer *xfer; + struct usb_xfer *xfer; uint8_t no_resetup; uint8_t iface_index; @@ -2633,7 +2633,7 @@ repeat: * data toggle. *------------------------------------------------------------------------*/ void -usb2_clear_data_toggle(struct usb2_device *udev, struct usb2_pipe *pipe) +usb2_clear_data_toggle(struct usb_device *udev, struct usb_pipe *pipe) { DPRINTFN(5, "udev=%p pipe=%p\n", udev, pipe); @@ -2657,12 +2657,12 @@ usb2_clear_data_toggle(struct usb2_device *udev, struct usb2_pipe *pipe) * * Clear stall config example: * - * static const struct usb2_config my_clearstall = { + * static const struct usb_config my_clearstall = { * .type = UE_CONTROL, * .endpoint = 0, * .direction = UE_DIR_ANY, * .interval = 50, //50 milliseconds - * .bufsize = sizeof(struct usb2_device_request), + * .bufsize = sizeof(struct usb_device_request), * .timeout = 1000, //1.000 seconds * .callback = &my_clear_stall_callback, // ** * .usb_mode = USB_MODE_HOST, @@ -2672,10 +2672,10 @@ usb2_clear_data_toggle(struct usb2_device *udev, struct usb2_pipe *pipe) * passing the correct parameters. *------------------------------------------------------------------------*/ uint8_t -usb2_clear_stall_callback(struct usb2_xfer *xfer1, - struct usb2_xfer *xfer2) +usb2_clear_stall_callback(struct usb_xfer *xfer1, + struct usb_xfer *xfer2) { - struct usb2_device_request req; + struct usb_device_request req; if (xfer2 == NULL) { /* looks like we are tearing down */ @@ -2734,7 +2734,7 @@ usb2_clear_stall_callback(struct usb2_xfer *xfer1, } void -usb2_do_poll(struct usb2_xfer **ppxfer, uint16_t max) +usb2_do_poll(struct usb_xfer **ppxfer, uint16_t max) { static uint8_t once = 0; /* polling is currently not supported */ diff --git a/sys/dev/usb/usb_transfer.h b/sys/dev/usb/usb_transfer.h index c385dd822d1f..eca641fe1f82 100644 --- a/sys/dev/usb/usb_transfer.h +++ b/sys/dev/usb/usb_transfer.h @@ -31,41 +31,41 @@ * The following structure defines the messages that is used to signal * the "done_p" USB process. */ -struct usb2_done_msg { - struct usb2_proc_msg hdr; - struct usb2_xfer_root *xroot; +struct usb_done_msg { + struct usb_proc_msg hdr; + struct usb_xfer_root *xroot; }; #define USB_DMATAG_TO_XROOT(dpt) \ - ((struct usb2_xfer_root *)( \ + ((struct usb_xfer_root *)( \ ((uint8_t *)(dpt)) - \ - ((uint8_t *)&((struct usb2_xfer_root *)0)->dma_parent_tag))) + ((uint8_t *)&((struct usb_xfer_root *)0)->dma_parent_tag))) /* * The following structure is used to keep information about memory * that should be automatically freed at the moment all USB transfers * have been freed. */ -struct usb2_xfer_root { - struct usb2_dma_parent_tag dma_parent_tag; +struct usb_xfer_root { + struct usb_dma_parent_tag dma_parent_tag; #if USB_HAVE_BUSDMA - struct usb2_xfer_queue dma_q; + struct usb_xfer_queue dma_q; #endif - struct usb2_xfer_queue done_q; - struct usb2_done_msg done_m[2]; + struct usb_xfer_queue done_q; + struct usb_done_msg done_m[2]; struct cv cv_drain; - struct usb2_process *done_p; /* pointer to callback process */ + struct usb_process *done_p; /* pointer to callback process */ void *memory_base; struct mtx *xfer_mtx; /* cannot be changed during operation */ #if USB_HAVE_BUSDMA - struct usb2_page_cache *dma_page_cache_start; - struct usb2_page_cache *dma_page_cache_end; + struct usb_page_cache *dma_page_cache_start; + struct usb_page_cache *dma_page_cache_end; #endif - struct usb2_page_cache *xfer_page_cache_start; - struct usb2_page_cache *xfer_page_cache_end; - struct usb2_bus *bus; /* pointer to USB bus (cached) */ - struct usb2_device *udev; /* pointer to USB device */ + struct usb_page_cache *xfer_page_cache_start; + struct usb_page_cache *xfer_page_cache_end; + struct usb_bus *bus; /* pointer to USB bus (cached) */ + struct usb_device *udev; /* pointer to USB device */ usb2_size_t memory_size; usb2_size_t setup_refcount; @@ -83,17 +83,17 @@ struct usb2_xfer_root { * The following structure is used when setting up an array of USB * transfers. */ -struct usb2_setup_params { - struct usb2_dma_tag *dma_tag_p; - struct usb2_page *dma_page_ptr; - struct usb2_page_cache *dma_page_cache_ptr; /* these will be +struct usb_setup_params { + struct usb_dma_tag *dma_tag_p; + struct usb_page *dma_page_ptr; + struct usb_page_cache *dma_page_cache_ptr; /* these will be * auto-freed */ - struct usb2_page_cache *xfer_page_cache_ptr; /* these will not be + struct usb_page_cache *xfer_page_cache_ptr; /* these will not be * auto-freed */ - struct usb2_device *udev; - struct usb2_xfer *curr_xfer; - const struct usb2_config *curr_setup; - const struct usb2_pipe_methods *methods; + struct usb_device *udev; + struct usb_xfer *curr_xfer; + const struct usb_config *curr_setup; + const struct usb_pipe_methods *methods; void *buf; usb2_frlength_t *xfer_length_ptr; @@ -111,28 +111,28 @@ struct usb2_setup_params { /* function prototypes */ -uint8_t usb2_transfer_setup_sub_malloc(struct usb2_setup_params *parm, - struct usb2_page_cache **ppc, usb2_size_t size, usb2_size_t align, +uint8_t usb2_transfer_setup_sub_malloc(struct usb_setup_params *parm, + struct usb_page_cache **ppc, usb2_size_t size, usb2_size_t align, usb2_size_t count); -void usb2_command_wrapper(struct usb2_xfer_queue *pq, - struct usb2_xfer *xfer); -void usb2_pipe_enter(struct usb2_xfer *xfer); -void usb2_pipe_start(struct usb2_xfer_queue *pq); -void usb2_transfer_dequeue(struct usb2_xfer *xfer); -void usb2_transfer_done(struct usb2_xfer *xfer, usb2_error_t error); -void usb2_transfer_enqueue(struct usb2_xfer_queue *pq, - struct usb2_xfer *xfer); -void usb2_transfer_setup_sub(struct usb2_setup_params *parm); -void usb2_default_transfer_setup(struct usb2_device *udev); -void usb2_clear_data_toggle(struct usb2_device *udev, - struct usb2_pipe *pipe); -void usb2_do_poll(struct usb2_xfer **ppxfer, uint16_t max); +void usb2_command_wrapper(struct usb_xfer_queue *pq, + struct usb_xfer *xfer); +void usb2_pipe_enter(struct usb_xfer *xfer); +void usb2_pipe_start(struct usb_xfer_queue *pq); +void usb2_transfer_dequeue(struct usb_xfer *xfer); +void usb2_transfer_done(struct usb_xfer *xfer, usb2_error_t error); +void usb2_transfer_enqueue(struct usb_xfer_queue *pq, + struct usb_xfer *xfer); +void usb2_transfer_setup_sub(struct usb_setup_params *parm); +void usb2_default_transfer_setup(struct usb_device *udev); +void usb2_clear_data_toggle(struct usb_device *udev, + struct usb_pipe *pipe); +void usb2_do_poll(struct usb_xfer **ppxfer, uint16_t max); usb2_callback_t usb2_do_request_callback; usb2_callback_t usb2_handle_request_callback; usb2_callback_t usb2_do_clear_stall_callback; -void usb2_transfer_timeout_ms(struct usb2_xfer *xfer, +void usb2_transfer_timeout_ms(struct usb_xfer *xfer, void (*cb) (void *arg), usb2_timeout_t ms); -usb2_timeout_t usb2_get_dma_delay(struct usb2_bus *bus); -void usb2_transfer_power_ref(struct usb2_xfer *xfer, int val); +usb2_timeout_t usb2_get_dma_delay(struct usb_bus *bus); +void usb2_transfer_power_ref(struct usb_xfer *xfer, int val); #endif /* _USB2_TRANSFER_H_ */ diff --git a/sys/dev/usb/usb_util.c b/sys/dev/usb/usb_util.c index d4dc2ab33986..8ab91db70a5c 100644 --- a/sys/dev/usb/usb_util.c +++ b/sys/dev/usb/usb_util.c @@ -78,9 +78,9 @@ device_delete_all_children(device_t dev) void device_set_usb2_desc(device_t dev) { - struct usb2_attach_arg *uaa; - struct usb2_device *udev; - struct usb2_interface *iface; + struct usb_attach_arg *uaa; + struct usb_device *udev; + struct usb_interface *iface; char *temp_p; usb2_error_t err; @@ -202,7 +202,7 @@ usb2_trim_spaces(char *p) uint8_t usb2_make_str_desc(void *ptr, uint16_t max_len, const char *s) { - struct usb2_string_descriptor *p = ptr; + struct usb_string_descriptor *p = ptr; uint8_t totlen; int j; diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 0e93b1a0f66a..1cffe3c3ae0b 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -43,7 +43,7 @@ #define UR_GET_PROTOCOL 0x03 #define UR_SET_PROTOCOL 0x0b -struct usb2_hid_descriptor { +struct usb_hid_descriptor { uByte bLength; uByte bDescriptorType; uWord bcdHID; diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c index 5fa08992bbb5..a116d7a4b858 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -90,7 +90,7 @@ SYSCTL_INT(_hw_usb_rum, OID_AUTO, debug, CTLFLAG_RW, &rum_debug, 0, "Debug level"); #endif -static const struct usb2_device_id rum_devs[] = { +static const struct usb_device_id rum_devs[] = { { USB_VP(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_HWU54DM) }, { USB_VP(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_RT2573_2) }, { USB_VP(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_RT2573_3) }, @@ -153,7 +153,7 @@ static usb2_callback_t rum_bulk_read_callback; static usb2_callback_t rum_bulk_write_callback; static usb2_error_t rum_do_request(struct rum_softc *sc, - struct usb2_device_request *req, void *data); + struct usb_device_request *req, void *data); static struct ieee80211vap *rum_vap_create(struct ieee80211com *, const char name[IFNAMSIZ], int unit, int opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], @@ -386,7 +386,7 @@ static const struct rfprog { { 165, 0x00b33, 0x012ad, 0x2e014, 0x30285 } }; -static const struct usb2_config rum_config[RUM_N_TRANSFER] = { +static const struct usb_config rum_config[RUM_N_TRANSFER] = { [RUM_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -409,7 +409,7 @@ static const struct usb2_config rum_config[RUM_N_TRANSFER] = { static int rum_match(device_t self) { - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -424,7 +424,7 @@ rum_match(device_t self) static int rum_attach(device_t self) { - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); struct rum_softc *sc = device_get_softc(self); struct ieee80211com *ic; struct ifnet *ifp; @@ -566,7 +566,7 @@ rum_detach(device_t self) static usb2_error_t rum_do_request(struct rum_softc *sc, - struct usb2_device_request *req, void *data) + struct usb_device_request *req, void *data) { usb2_error_t err; int ntries = 10; @@ -764,7 +764,7 @@ rum_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) } static void -rum_bulk_write_callback(struct usb2_xfer *xfer) +rum_bulk_write_callback(struct usb_xfer *xfer) { struct rum_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -852,7 +852,7 @@ tr_setup: } static void -rum_bulk_read_callback(struct usb2_xfer *xfer) +rum_bulk_read_callback(struct usb_xfer *xfer) { struct rum_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -1339,7 +1339,7 @@ rum_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) static void rum_eeprom_read(struct rum_softc *sc, uint16_t addr, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -1368,7 +1368,7 @@ rum_read(struct rum_softc *sc, uint16_t reg) static void rum_read_multi(struct rum_softc *sc, uint16_t reg, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -1396,7 +1396,7 @@ rum_write(struct rum_softc *sc, uint16_t reg, uint32_t val) static usb2_error_t rum_write_multi(struct rum_softc *sc, uint16_t reg, void *buf, size_t len) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -2068,7 +2068,7 @@ rum_stop(struct rum_softc *sc) static void rum_load_microcode(struct rum_softc *sc, const uint8_t *ucode, size_t size) { - struct usb2_device_request req; + struct usb_device_request req; uint16_t reg = RT2573_MCU_CODE_BASE; usb2_error_t err; diff --git a/sys/dev/usb/wlan/if_rumvar.h b/sys/dev/usb/wlan/if_rumvar.h index 13b84f7ee1aa..82bb117b7ce7 100644 --- a/sys/dev/usb/wlan/if_rumvar.h +++ b/sys/dev/usb/wlan/if_rumvar.h @@ -77,7 +77,7 @@ struct rum_vap { struct ieee80211vap vap; struct ieee80211_beacon_offsets bo; struct ieee80211_amrr amrr; - struct usb2_callout amrr_ch; + struct usb_callout amrr_ch; struct task amrr_task; int (*newstate)(struct ieee80211vap *, @@ -94,9 +94,9 @@ enum { struct rum_softc { struct ifnet *sc_ifp; device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; - struct usb2_xfer *sc_xfer[RUM_N_TRANSFER]; + struct usb_xfer *sc_xfer[RUM_N_TRANSFER]; uint8_t rf_rev; uint8_t rffreq; diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c index 34acd52bc0c2..38f0d9b966b9 100644 --- a/sys/dev/usb/wlan/if_uath.c +++ b/sys/dev/usb/wlan/if_uath.c @@ -172,7 +172,7 @@ enum { (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24))) /* recognized device vendors/products */ -static const struct usb2_device_id uath_devs[] = { +static const struct usb_device_id uath_devs[] = { #define UATH_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } UATH_DEV(ATHEROS, AR5523), UATH_DEV(ATHEROS2, AR5523_1), @@ -204,7 +204,7 @@ static usb2_callback_t uath_intr_tx_callback; static usb2_callback_t uath_bulk_rx_callback; static usb2_callback_t uath_bulk_tx_callback; -static const struct usb2_config uath_usbconfig[UATH_N_XFERS] = { +static const struct usb_config uath_usbconfig[UATH_N_XFERS] = { [UATH_INTR_RX] = { .type = UE_BULK, .endpoint = 0x1, @@ -327,7 +327,7 @@ static void uath_sysctl_node(struct uath_softc *); static int uath_match(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -343,7 +343,7 @@ static int uath_attach(device_t dev) { struct uath_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ieee80211com *ic; struct ifnet *ifp; uint8_t bands, iface_index = UATH_IFACE_INDEX; /* XXX */ @@ -2380,7 +2380,7 @@ uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cmd) } static void -uath_intr_rx_callback(struct usb2_xfer *xfer) +uath_intr_rx_callback(struct usb_xfer *xfer) { struct uath_softc *sc = xfer->priv_sc; struct uath_cmd *cmd; @@ -2416,7 +2416,7 @@ setup: } static void -uath_intr_tx_callback(struct usb2_xfer *xfer) +uath_intr_tx_callback(struct usb_xfer *xfer) { struct uath_softc *sc = xfer->priv_sc; struct uath_cmd *cmd; @@ -2502,7 +2502,7 @@ uath_update_rxstat(struct uath_softc *sc, uint32_t status) } static struct mbuf * -uath_data_rxeof(struct usb2_xfer *xfer, struct uath_data *data, +uath_data_rxeof(struct usb_xfer *xfer, struct uath_data *data, struct uath_rx_desc **pdesc) { struct uath_softc *sc = xfer->priv_sc; @@ -2672,7 +2672,7 @@ uath_data_rxeof(struct usb2_xfer *xfer, struct uath_data *data, } static void -uath_bulk_rx_callback(struct usb2_xfer *xfer) +uath_bulk_rx_callback(struct usb_xfer *xfer) { struct uath_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -2753,7 +2753,7 @@ setup: } static void -uath_data_txeof(struct usb2_xfer *xfer, struct uath_data *data) +uath_data_txeof(struct usb_xfer *xfer, struct uath_data *data) { struct uath_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -2784,7 +2784,7 @@ uath_data_txeof(struct usb2_xfer *xfer, struct uath_data *data) } static void -uath_bulk_tx_callback(struct usb2_xfer *xfer) +uath_bulk_tx_callback(struct usb_xfer *xfer) { struct uath_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; diff --git a/sys/dev/usb/wlan/if_uathvar.h b/sys/dev/usb/wlan/if_uathvar.h index 9b0a12694e55..6e58d93a893d 100644 --- a/sys/dev/usb/wlan/if_uathvar.h +++ b/sys/dev/usb/wlan/if_uathvar.h @@ -185,7 +185,7 @@ struct uath_vap { struct uath_softc { struct ifnet *sc_ifp; device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; struct mtx sc_mtx; uint32_t sc_debug; @@ -193,7 +193,7 @@ struct uath_softc { int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int); - struct usb2_xfer *sc_xfer[UATH_N_XFERS]; + struct usb_xfer *sc_xfer[UATH_N_XFERS]; struct uath_cmd sc_cmd[UATH_CMD_LIST_COUNT]; uath_cmdhead sc_cmd_active; uath_cmdhead sc_cmd_inactive; diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c index 0a7d0a48c0ab..55463fff13fb 100644 --- a/sys/dev/usb/wlan/if_upgt.c +++ b/sys/dev/usb/wlan/if_upgt.c @@ -121,10 +121,10 @@ static int upgt_fw_load(struct upgt_softc *); static int upgt_fw_copy(const uint8_t *, char *, int); static uint32_t upgt_crc32_le(const void *, size_t); static struct mbuf * - upgt_rxeof(struct usb2_xfer *, struct upgt_data *, int *); + upgt_rxeof(struct usb_xfer *, struct upgt_data *, int *); static struct mbuf * upgt_rx(struct upgt_softc *, uint8_t *, int, int *); -static void upgt_txeof(struct usb2_xfer *, struct upgt_data *); +static void upgt_txeof(struct usb_xfer *, struct upgt_data *); static int upgt_eeprom_read(struct upgt_softc *); static int upgt_eeprom_parse(struct upgt_softc *); static void upgt_eeprom_parse_hwrx(struct upgt_softc *, uint8_t *); @@ -175,7 +175,7 @@ static int upgt_tx_start(struct upgt_softc *, struct mbuf *, static const char *upgt_fwname = "upgt-gw3887"; -static const struct usb2_device_id upgt_devs_2[] = { +static const struct usb_device_id upgt_devs_2[] = { #define UPGT_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } /* version 2 devices */ UPGT_DEV(ACCTON, PRISM_GT), @@ -199,7 +199,7 @@ static const struct usb2_device_id upgt_devs_2[] = { static usb2_callback_t upgt_bulk_rx_callback; static usb2_callback_t upgt_bulk_tx_callback; -static const struct usb2_config upgt_config[UPGT_N_XFERS] = { +static const struct usb_config upgt_config[UPGT_N_XFERS] = { [UPGT_BULK_TX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -230,7 +230,7 @@ static const struct usb2_config upgt_config[UPGT_N_XFERS] = { static int upgt_match(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -249,7 +249,7 @@ upgt_attach(device_t dev) struct ieee80211com *ic; struct ifnet *ifp; struct upgt_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); uint8_t bands, iface_index = UPGT_IFACE_INDEX; sc->sc_dev = dev; @@ -391,7 +391,7 @@ fail1: mtx_destroy(&sc->sc_mtx); } static void -upgt_txeof(struct usb2_xfer *xfer, struct upgt_data *data) +upgt_txeof(struct usb_xfer *xfer, struct upgt_data *data) { struct upgt_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -1383,7 +1383,7 @@ upgt_eeprom_read(struct upgt_softc *sc) * When a rx data came in the function returns a mbuf and a rssi values. */ static struct mbuf * -upgt_rxeof(struct usb2_xfer *xfer, struct upgt_data *data, int *rssi) +upgt_rxeof(struct usb_xfer *xfer, struct upgt_data *data, int *rssi) { struct mbuf *m = NULL; struct upgt_softc *sc = xfer->priv_sc; @@ -2244,7 +2244,7 @@ done: } static void -upgt_bulk_rx_callback(struct usb2_xfer *xfer) +upgt_bulk_rx_callback(struct usb_xfer *xfer) { struct upgt_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -2316,7 +2316,7 @@ setup: } static void -upgt_bulk_tx_callback(struct usb2_xfer *xfer) +upgt_bulk_tx_callback(struct usb_xfer *xfer) { struct upgt_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; diff --git a/sys/dev/usb/wlan/if_upgtvar.h b/sys/dev/usb/wlan/if_upgtvar.h index 719d8c29186d..68d5d2be720c 100644 --- a/sys/dev/usb/wlan/if_upgtvar.h +++ b/sys/dev/usb/wlan/if_upgtvar.h @@ -421,7 +421,7 @@ struct upgt_vap { struct upgt_softc { device_t sc_dev; struct ifnet *sc_ifp; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; struct mtx sc_mtx; struct upgt_stat sc_stat; int sc_flags; @@ -459,7 +459,7 @@ struct upgt_softc { uint8_t sc_eeprom_freq6_settings; /* RX/TX */ - struct usb2_xfer *sc_xfer[UPGT_N_XFERS]; + struct usb_xfer *sc_xfer[UPGT_N_XFERS]; int sc_rx_no; int sc_tx_no; struct upgt_data sc_rx_data[UPGT_RX_MAXCOUNT]; diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index 7ff6a5e2bd4b..3b836b8cc9a3 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -97,7 +97,7 @@ SYSCTL_INT(_hw_usb_ural, OID_AUTO, debug, CTLFLAG_RW, &ural_debug, 0, ((rssi) - (RAL_NOISE_FLOOR + RAL_RSSI_CORR)) : 0) /* various supported device vendors/products */ -static const struct usb2_device_id ural_devs[] = { +static const struct usb_device_id ural_devs[] = { { USB_VP(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_WL167G) }, { USB_VP(USB_VENDOR_ASUS, USB_PRODUCT_RALINK_RT2570) }, { USB_VP(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D7050) }, @@ -133,7 +133,7 @@ static usb2_callback_t ural_bulk_read_callback; static usb2_callback_t ural_bulk_write_callback; static usb2_error_t ural_do_request(struct ural_softc *sc, - struct usb2_device_request *req, void *data); + struct usb_device_request *req, void *data); static struct ieee80211vap *ural_vap_create(struct ieee80211com *, const char name[IFNAMSIZ], int unit, int opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], @@ -363,7 +363,7 @@ static const struct { { 161, 0x08808, 0x0242f, 0x00281 } }; -static const struct usb2_config ural_config[URAL_N_TRANSFER] = { +static const struct usb_config ural_config[URAL_N_TRANSFER] = { [URAL_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -412,7 +412,7 @@ MODULE_DEPEND(ural, wlan_amrr, 1, 1, 1); static int ural_match(device_t self) { - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -427,7 +427,7 @@ ural_match(device_t self) static int ural_attach(device_t self) { - struct usb2_attach_arg *uaa = device_get_ivars(self); + struct usb_attach_arg *uaa = device_get_ivars(self); struct ural_softc *sc = device_get_softc(self); struct ifnet *ifp; struct ieee80211com *ic; @@ -557,7 +557,7 @@ ural_detach(device_t self) static usb2_error_t ural_do_request(struct ural_softc *sc, - struct usb2_device_request *req, void *data) + struct usb_device_request *req, void *data) { usb2_error_t err; int ntries = 10; @@ -777,7 +777,7 @@ ural_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) static void -ural_bulk_write_callback(struct usb2_xfer *xfer) +ural_bulk_write_callback(struct usb_xfer *xfer) { struct ural_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -865,7 +865,7 @@ tr_setup: } static void -ural_bulk_read_callback(struct usb2_xfer *xfer) +ural_bulk_read_callback(struct usb_xfer *xfer) { struct ural_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -1391,7 +1391,7 @@ ural_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) static void ural_set_testmode(struct ural_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -1410,7 +1410,7 @@ ural_set_testmode(struct ural_softc *sc) static void ural_eeprom_read(struct ural_softc *sc, uint16_t addr, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -1429,7 +1429,7 @@ ural_eeprom_read(struct ural_softc *sc, uint16_t addr, void *buf, int len) static uint16_t ural_read(struct ural_softc *sc, uint16_t reg) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; uint16_t val; @@ -1452,7 +1452,7 @@ ural_read(struct ural_softc *sc, uint16_t reg) static void ural_read_multi(struct ural_softc *sc, uint16_t reg, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -1471,7 +1471,7 @@ ural_read_multi(struct ural_softc *sc, uint16_t reg, void *buf, int len) static void ural_write(struct ural_softc *sc, uint16_t reg, uint16_t val) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -1490,7 +1490,7 @@ ural_write(struct ural_softc *sc, uint16_t reg, uint16_t val) static void ural_write_multi(struct ural_softc *sc, uint16_t reg, void *buf, int len) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; diff --git a/sys/dev/usb/wlan/if_uralvar.h b/sys/dev/usb/wlan/if_uralvar.h index 663e0c178d6a..5d9c5821a5a7 100644 --- a/sys/dev/usb/wlan/if_uralvar.h +++ b/sys/dev/usb/wlan/if_uralvar.h @@ -81,7 +81,7 @@ struct ural_vap { struct ieee80211vap vap; struct ieee80211_beacon_offsets bo; struct ieee80211_amrr amrr; - struct usb2_callout amrr_ch; + struct usb_callout amrr_ch; struct task amrr_task; int (*newstate)(struct ieee80211vap *, @@ -98,12 +98,12 @@ enum { struct ural_softc { struct ifnet *sc_ifp; device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; uint32_t asic_rev; uint8_t rf_rev; - struct usb2_xfer *sc_xfer[URAL_N_TRANSFER]; + struct usb_xfer *sc_xfer[URAL_N_TRANSFER]; struct ural_tx_data tx_data[RAL_TX_LIST_COUNT]; ural_txdhead tx_q; diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c index 0124023d45f8..aec8cc471646 100644 --- a/sys/dev/usb/wlan/if_urtw.c +++ b/sys/dev/usb/wlan/if_urtw.c @@ -107,7 +107,7 @@ TUNABLE_INT("hw.usb.urtw.preamble_mode", &urtw_preamble_mode); { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, URTW_REV_RTL8187L) } #define URTW_REV_RTL8187B 0 #define URTW_REV_RTL8187L 1 -static const struct usb2_device_id urtw_devs[] = { +static const struct usb_device_id urtw_devs[] = { { USB_VPI(USB_VENDOR_BELKIN, 0x705e, URTW_REV_RTL8187B) }, { USB_VPI(USB_VENDOR_REALTEK, 0x8189, URTW_REV_RTL8187B) }, { USB_VPI(USB_VENDOR_REALTEK, 0x8197, URTW_REV_RTL8187B) }, @@ -483,7 +483,7 @@ static const uint8_t urtw_8187b_reg_table[][3] = { static usb2_callback_t urtw_bulk_rx_callback; static usb2_callback_t urtw_bulk_tx_callback; -static const struct usb2_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = { +static const struct usb_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = { [URTW_8187B_BULK_RX] = { .type = UE_BULK, .endpoint = 0x83, @@ -563,7 +563,7 @@ static const struct usb2_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = { } }; -static const struct usb2_config urtw_8187l_usbconfig[URTW_8187L_N_XFERS] = { +static const struct usb_config urtw_8187l_usbconfig[URTW_8187L_N_XFERS] = { [URTW_8187L_BULK_RX] = { .type = UE_BULK, .endpoint = 0x81, @@ -711,7 +711,7 @@ static usb2_error_t urtw_write16_i(struct urtw_softc *, int, uint16_t, int); static usb2_error_t urtw_write8_i(struct urtw_softc *, int, uint8_t, int); static usb2_error_t urtw_write32_i(struct urtw_softc *, int, uint32_t, int); static usb2_error_t urtw_do_request(struct urtw_softc *, - struct usb2_device_request *, void *); + struct usb_device_request *, void *); static usb2_error_t urtw_8225v2b_set_txpwrlvl(struct urtw_softc *, int); static usb2_error_t urtw_led_off(struct urtw_softc *, int); static void urtw_abort_xfers(struct urtw_softc *); @@ -721,7 +721,7 @@ static struct urtw_data * static int urtw_match(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -736,10 +736,10 @@ urtw_match(device_t dev) static int urtw_attach(device_t dev) { - const struct usb2_config *setup_start; + const struct usb_config *setup_start; int ret = ENXIO; struct urtw_softc *sc = device_get_softc(dev); - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ieee80211com *ic; struct ifnet *ifp; uint8_t bands, iface_index = URTW_IFACE_INDEX; /* XXX */ @@ -1337,7 +1337,7 @@ fail: static usb2_error_t urtw_write16_i(struct urtw_softc *sc, int val, uint16_t data, int idx) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; @@ -1350,7 +1350,7 @@ urtw_write16_i(struct urtw_softc *sc, int val, uint16_t data, int idx) static usb2_error_t urtw_do_request(struct urtw_softc *sc, - struct usb2_device_request *req, void *data) + struct usb_device_request *req, void *data) { usb2_error_t err; int ntries = 10; @@ -1374,7 +1374,7 @@ urtw_do_request(struct urtw_softc *sc, static usb2_error_t urtw_write8_i(struct urtw_softc *sc, int val, uint8_t data, int idx) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; @@ -1388,7 +1388,7 @@ urtw_write8_i(struct urtw_softc *sc, int val, uint8_t data, int idx) static usb2_error_t urtw_write32_i(struct urtw_softc *sc, int val, uint32_t data, int idx) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; @@ -1745,13 +1745,13 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = ni->ni_vap; struct urtw_8187b_txhdr *hdr; - struct usb2_xfer *rtl8187b_pipes[URTW_8187B_TXPIPE_MAX] = { + struct usb_xfer *rtl8187b_pipes[URTW_8187B_TXPIPE_MAX] = { sc->sc_xfer[URTW_8187B_BULK_TX_BE], sc->sc_xfer[URTW_8187B_BULK_TX_BK], sc->sc_xfer[URTW_8187B_BULK_TX_VI], sc->sc_xfer[URTW_8187B_BULK_TX_VO] }; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; usb2_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2053,7 +2053,7 @@ fail: static usb2_error_t urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2071,7 +2071,7 @@ urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) static usb2_error_t urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2089,7 +2089,7 @@ urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data) static usb2_error_t urtw_read32_c(struct urtw_softc *sc, int val, uint32_t *data) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2107,7 +2107,7 @@ urtw_read32_c(struct urtw_softc *sc, int val, uint32_t *data) static usb2_error_t urtw_write8_c(struct urtw_softc *sc, int val, uint8_t data) { - struct usb2_device_request req; + struct usb_device_request req; URTW_ASSERT_LOCKED(sc); @@ -2123,7 +2123,7 @@ urtw_write8_c(struct urtw_softc *sc, int val, uint8_t data) static usb2_error_t urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data) { - struct usb2_device_request req; + struct usb_device_request req; URTW_ASSERT_LOCKED(sc); @@ -2139,7 +2139,7 @@ urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data) static usb2_error_t urtw_write32_c(struct urtw_softc *sc, int val, uint32_t data) { - struct usb2_device_request req; + struct usb_device_request req; URTW_ASSERT_LOCKED(sc); @@ -2734,7 +2734,7 @@ urtw_8225_write_s16(struct urtw_softc *sc, uint8_t addr, int index, { uint8_t *buf; uint16_t data16; - struct usb2_device_request *req; + struct usb_device_request *req; usb2_error_t error = 0; data16 = *data; @@ -3445,7 +3445,7 @@ fail: static usb2_error_t urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -3461,7 +3461,7 @@ urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) static usb2_error_t urtw_write8e(struct urtw_softc *sc, int val, uint8_t data) { - struct usb2_device_request req; + struct usb_device_request req; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = URTW_8187_SETREGS_REQ; @@ -3932,7 +3932,7 @@ fail: } static struct mbuf * -urtw_rxeof(struct usb2_xfer *xfer, struct urtw_data *data, int *rssi_p, +urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *data, int *rssi_p, int8_t *nf_p) { int actlen, flen, len, nf = -95, rssi; @@ -4023,7 +4023,7 @@ urtw_rxeof(struct usb2_xfer *xfer, struct urtw_data *data, int *rssi_p, } static void -urtw_bulk_rx_callback(struct usb2_xfer *xfer) +urtw_bulk_rx_callback(struct usb_xfer *xfer) { struct urtw_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -4096,7 +4096,7 @@ setup: } static void -urtw_txeof(struct usb2_xfer *xfer, struct urtw_data *data) +urtw_txeof(struct usb_xfer *xfer, struct urtw_data *data) { struct urtw_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -4127,7 +4127,7 @@ urtw_txeof(struct usb2_xfer *xfer, struct urtw_data *data) } static void -urtw_bulk_tx_callback(struct usb2_xfer *xfer) +urtw_bulk_tx_callback(struct usb_xfer *xfer) { struct urtw_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; diff --git a/sys/dev/usb/wlan/if_urtwvar.h b/sys/dev/usb/wlan/if_urtwvar.h index 0835659647fe..7f1305132cb3 100644 --- a/sys/dev/usb/wlan/if_urtwvar.h +++ b/sys/dev/usb/wlan/if_urtwvar.h @@ -89,7 +89,7 @@ struct urtw_vap { struct urtw_softc { struct ifnet *sc_ifp; device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; struct mtx sc_mtx; int sc_debug; @@ -121,7 +121,7 @@ struct urtw_softc { uint32_t sc_max_sens; uint32_t sc_sens; /* for LED */ - struct usb2_callout sc_led_ch; + struct usb_callout sc_led_ch; struct task sc_led_task; uint8_t sc_psr; uint8_t sc_strategy; @@ -133,7 +133,7 @@ struct urtw_softc { uint8_t sc_gpio_blinktime; uint8_t sc_gpio_blinkstate; /* RX/TX */ - struct usb2_xfer *sc_xfer[URTW_8187B_N_XFERS]; + struct usb_xfer *sc_xfer[URTW_8187B_N_XFERS]; #define URTW_PRIORITY_LOW 0 #define URTW_PRIORITY_NORMAL 1 #define URTW_DATA_TIMEOUT 10000 /* 10 sec */ diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index e08bcd0b604a..44f95b406e6e 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -156,7 +156,7 @@ static void zyd_update_mcast(struct ifnet *); static int zyd_set_rxfilter(struct zyd_softc *); static void zyd_set_chan(struct zyd_softc *, struct ieee80211_channel *); static int zyd_set_beacon_interval(struct zyd_softc *, int); -static void zyd_rx_data(struct usb2_xfer *, int, uint16_t); +static void zyd_rx_data(struct usb_xfer *, int, uint16_t); static int zyd_tx_mgt(struct zyd_softc *, struct mbuf *, struct ieee80211_node *); static int zyd_tx_data(struct zyd_softc *, struct mbuf *, @@ -204,7 +204,7 @@ static const struct zyd_phy_pair zyd_def_phyB[] = ZYD_DEF_PHYB; #define ZYD_ZD1211 0 #define ZYD_ZD1211B 1 -static const struct usb2_device_id zyd_devs[] = { +static const struct usb_device_id zyd_devs[] = { /* ZYD_ZD1211 */ {USB_VPI(USB_VENDOR_3COM2, USB_PRODUCT_3COM2_3CRUSB10075, ZYD_ZD1211)}, {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_WL54, ZYD_ZD1211)}, @@ -255,7 +255,7 @@ static const struct usb2_device_id zyd_devs[] = { {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_G220V2, ZYD_ZD1211B)}, }; -static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = { +static const struct usb_config zyd_config[ZYD_N_TRANSFER] = { [ZYD_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -318,7 +318,7 @@ static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = { static int zyd_match(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -333,7 +333,7 @@ zyd_match(device_t dev) static int zyd_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct zyd_softc *sc = device_get_softc(dev); struct ifnet *ifp; struct ieee80211com *ic; @@ -629,7 +629,7 @@ fail: * Callback handler for interrupt transfer */ static void -zyd_intr_read_callback(struct usb2_xfer *xfer) +zyd_intr_read_callback(struct usb_xfer *xfer) { struct zyd_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -734,7 +734,7 @@ tr_setup: } static void -zyd_intr_write_callback(struct usb2_xfer *xfer) +zyd_intr_write_callback(struct usb_xfer *xfer) { struct zyd_softc *sc = xfer->priv_sc; struct zyd_rq *rqp; @@ -1876,7 +1876,7 @@ fail: static int zyd_get_macaddr(struct zyd_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; usb2_error_t error; req.bmRequestType = UT_READ_VENDOR_DEVICE; @@ -2124,7 +2124,7 @@ fail: } static void -zyd_rx_data(struct usb2_xfer *xfer, int offset, uint16_t len) +zyd_rx_data(struct usb_xfer *xfer, int offset, uint16_t len) { struct zyd_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -2200,7 +2200,7 @@ zyd_rx_data(struct usb2_xfer *xfer, int offset, uint16_t len) } static void -zyd_bulk_read_callback(struct usb2_xfer *xfer) +zyd_bulk_read_callback(struct usb_xfer *xfer) { struct zyd_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -2424,7 +2424,7 @@ zyd_tx_mgt(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) } static void -zyd_bulk_write_callback(struct usb2_xfer *xfer) +zyd_bulk_write_callback(struct usb_xfer *xfer) { struct zyd_softc *sc = xfer->priv_sc; struct ifnet *ifp = sc->sc_ifp; @@ -2709,7 +2709,7 @@ zyd_init_locked(struct zyd_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; - struct usb2_config_descriptor *cd; + struct usb_config_descriptor *cd; int error; uint32_t val; @@ -2868,7 +2868,7 @@ fail: static int zyd_loadfirmware(struct zyd_softc *sc) { - struct usb2_device_request req; + struct usb_device_request req; size_t size; u_char *fw; uint8_t stat; diff --git a/sys/dev/usb/wlan/if_zydreg.h b/sys/dev/usb/wlan/if_zydreg.h index cd605933c794..3b9839802048 100644 --- a/sys/dev/usb/wlan/if_zydreg.h +++ b/sys/dev/usb/wlan/if_zydreg.h @@ -1257,9 +1257,9 @@ enum { struct zyd_softc { struct ifnet *sc_ifp; device_t sc_dev; - struct usb2_device *sc_udev; + struct usb_device *sc_udev; - struct usb2_xfer *sc_xfer[ZYD_N_TRANSFER]; + struct usb_xfer *sc_xfer[ZYD_N_TRANSFER]; int sc_flags; #define ZYD_FLAG_FWLOADED (1 << 0) diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index b140639aca57..b8281ddd03c2 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -246,7 +246,7 @@ static usb2_callback_t ubt_isoc_read_callback; static usb2_callback_t ubt_isoc_write_callback; static int ubt_fwd_mbuf_up(ubt_softc_p, struct mbuf **); -static int ubt_isoc_read_one_frame(struct usb2_xfer *, int); +static int ubt_isoc_read_one_frame(struct usb_xfer *, int); /* * USB config @@ -263,7 +263,7 @@ static int ubt_isoc_read_one_frame(struct usb2_xfer *, int); * 2) Isochronous OUT endpoint to send SCO data */ -static const struct usb2_config ubt_config[UBT_N_TRANSFER] = +static const struct usb_config ubt_config[UBT_N_TRANSFER] = { /* * Interface #0 @@ -370,14 +370,14 @@ static const struct usb2_config ubt_config[UBT_N_TRANSFER] = * where VENDOR_ID and PRODUCT_ID are hex numbers. */ -static const struct usb2_device_id ubt_ignore_devs[] = +static const struct usb_device_id ubt_ignore_devs[] = { /* AVM USB Bluetooth-Adapter BlueFritz! v1.0 */ { USB_VPI(USB_VENDOR_AVM, 0x2200, 0) }, }; /* List of supported bluetooth devices */ -static const struct usb2_device_id ubt_devs[] = +static const struct usb_device_id ubt_devs[] = { /* Generic Bluetooth class devices */ { USB_IFACE_CLASS(UDCLASS_WIRELESS), @@ -396,7 +396,7 @@ static const struct usb2_device_id ubt_devs[] = static int ubt_probe(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -422,10 +422,10 @@ ubt_probe(device_t dev) static int ubt_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ubt_softc *sc = device_get_softc(dev); - struct usb2_endpoint_descriptor *ed; - struct usb2_interface_descriptor *id; + struct usb_endpoint_descriptor *ed; + struct usb_interface_descriptor *id; uint16_t wMaxPacketSize; uint8_t alt_index, i, j; uint8_t iface_index[2] = { 0, 1 }; @@ -502,13 +502,13 @@ ubt_attach(device_t dev) * Search through all the descriptors looking for the largest * packet size: */ - while ((ed = (struct usb2_endpoint_descriptor *)usb2_desc_foreach( + while ((ed = (struct usb_endpoint_descriptor *)usb2_desc_foreach( usb2_get_config_descriptor(uaa->device), - (struct usb2_descriptor *)ed))) { + (struct usb_descriptor *)ed))) { if ((ed->bDescriptorType == UDESC_INTERFACE) && (ed->bLength >= sizeof(*id))) { - id = (struct usb2_interface_descriptor *)ed; + id = (struct usb_interface_descriptor *)ed; i = id->bInterfaceNumber; j = id->bAlternateSetting; } @@ -597,10 +597,10 @@ ubt_detach(device_t dev) */ static void -ubt_ctrl_write_callback(struct usb2_xfer *xfer) +ubt_ctrl_write_callback(struct usb_xfer *xfer) { struct ubt_softc *sc = xfer->priv_sc; - struct usb2_device_request req; + struct usb_device_request req; struct mbuf *m; switch (USB_GET_STATE(xfer)) { @@ -664,7 +664,7 @@ send_next: */ static void -ubt_intr_read_callback(struct usb2_xfer *xfer) +ubt_intr_read_callback(struct usb_xfer *xfer) { struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -759,7 +759,7 @@ submit_next: */ static void -ubt_bulk_read_callback(struct usb2_xfer *xfer) +ubt_bulk_read_callback(struct usb_xfer *xfer) { struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -855,7 +855,7 @@ submit_next: */ static void -ubt_bulk_write_callback(struct usb2_xfer *xfer) +ubt_bulk_write_callback(struct usb_xfer *xfer) { struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -918,7 +918,7 @@ send_next: */ static void -ubt_isoc_read_callback(struct usb2_xfer *xfer) +ubt_isoc_read_callback(struct usb_xfer *xfer) { struct ubt_softc *sc = xfer->priv_sc; int n; @@ -956,7 +956,7 @@ read_next: */ static int -ubt_isoc_read_one_frame(struct usb2_xfer *xfer, int frame_no) +ubt_isoc_read_one_frame(struct usb_xfer *xfer, int frame_no) { struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; @@ -1039,7 +1039,7 @@ ubt_isoc_read_one_frame(struct usb2_xfer *xfer, int frame_no) */ static void -ubt_isoc_write_callback(struct usb2_xfer *xfer) +ubt_isoc_write_callback(struct usb_xfer *xfer) { struct ubt_softc *sc = xfer->priv_sc; struct mbuf *m; diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h index 721e2f15b4ee..10063c4a90a9 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h @@ -90,13 +90,13 @@ struct ubt_softc { /* USB device specific */ struct mtx sc_if_mtx; /* interfaces lock */ - struct usb2_xfer *sc_xfer[UBT_N_TRANSFER]; + struct usb_xfer *sc_xfer[UBT_N_TRANSFER]; struct mtx sc_ng_mtx; /* lock for shared NG data */ /* HCI commands */ struct ng_bt_mbufq sc_cmdq; /* HCI command queue */ -#define UBT_CTRL_BUFFER_SIZE (sizeof(struct usb2_device_request) + \ +#define UBT_CTRL_BUFFER_SIZE (sizeof(struct usb_device_request) + \ sizeof(ng_hci_cmd_pkt_t) + NG_HCI_CMD_PKT_SIZE) #define UBT_INTR_BUFFER_SIZE (MCLBYTES-1) /* reserve 1 byte for ID-tag */ diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index 2c53e8259b79..116e3d835c34 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -65,10 +65,10 @@ enum { }; struct ubtbcmfw_softc { - struct usb2_device *sc_udev; + struct usb_device *sc_udev; struct mtx sc_mtx; - struct usb2_xfer *sc_xfer[UBTBCMFW_N_TRANSFER]; - struct usb2_fifo_sc sc_fifo; + struct usb_xfer *sc_xfer[UBTBCMFW_N_TRANSFER]; + struct usb_fifo_sc sc_fifo; }; /* @@ -90,7 +90,7 @@ static usb2_fifo_cmd_t ubtbcmfw_stop_write; static usb2_fifo_ioctl_t ubtbcmfw_ioctl; static usb2_fifo_open_t ubtbcmfw_open; -static struct usb2_fifo_methods ubtbcmfw_fifo_methods = +static struct usb_fifo_methods ubtbcmfw_fifo_methods = { .f_close = &ubtbcmfw_close, .f_ioctl = &ubtbcmfw_ioctl, @@ -111,7 +111,7 @@ static struct usb2_fifo_methods ubtbcmfw_fifo_methods = * Device's config structure */ -static const struct usb2_config ubtbcmfw_config[UBTBCMFW_N_TRANSFER] = +static const struct usb_config ubtbcmfw_config[UBTBCMFW_N_TRANSFER] = { [UBTBCMFW_BULK_DT_WR] = { .type = UE_BULK, @@ -167,12 +167,12 @@ MODULE_DEPEND(ubtbcmfw, usb, 1, 1, 1); static int ubtbcmfw_probe(device_t dev) { - const struct usb2_device_id devs[] = { + const struct usb_device_id devs[] = { /* Broadcom BCM2033 devices only */ { USB_VPI(USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033, 0) }, }; - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -190,7 +190,7 @@ ubtbcmfw_probe(device_t dev) static int ubtbcmfw_attach(device_t dev) { - struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct usb_attach_arg *uaa = device_get_ivars(dev); struct ubtbcmfw_softc *sc = device_get_softc(dev); uint8_t iface_index; int error; @@ -252,10 +252,10 @@ ubtbcmfw_detach(device_t dev) */ static void -ubtbcmfw_write_callback(struct usb2_xfer *xfer) +ubtbcmfw_write_callback(struct usb_xfer *xfer) { struct ubtbcmfw_softc *sc = xfer->priv_sc; - struct usb2_fifo *f = sc->sc_fifo.fp[USB_FIFO_TX]; + struct usb_fifo *f = sc->sc_fifo.fp[USB_FIFO_TX]; uint32_t actlen; switch (USB_GET_STATE(xfer)) { @@ -284,10 +284,10 @@ setup_next: */ static void -ubtbcmfw_read_callback(struct usb2_xfer *xfer) +ubtbcmfw_read_callback(struct usb_xfer *xfer) { struct ubtbcmfw_softc *sc = xfer->priv_sc; - struct usb2_fifo *fifo = sc->sc_fifo.fp[USB_FIFO_RX]; + struct usb_fifo *fifo = sc->sc_fifo.fp[USB_FIFO_RX]; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -317,7 +317,7 @@ setup_next: */ static void -ubtbcmfw_start_read(struct usb2_fifo *fifo) +ubtbcmfw_start_read(struct usb_fifo *fifo) { struct ubtbcmfw_softc *sc = fifo->priv_sc0; @@ -329,7 +329,7 @@ ubtbcmfw_start_read(struct usb2_fifo *fifo) */ static void -ubtbcmfw_stop_read(struct usb2_fifo *fifo) +ubtbcmfw_stop_read(struct usb_fifo *fifo) { struct ubtbcmfw_softc *sc = fifo->priv_sc0; @@ -342,7 +342,7 @@ ubtbcmfw_stop_read(struct usb2_fifo *fifo) */ static void -ubtbcmfw_start_write(struct usb2_fifo *fifo) +ubtbcmfw_start_write(struct usb_fifo *fifo) { struct ubtbcmfw_softc *sc = fifo->priv_sc0; @@ -354,7 +354,7 @@ ubtbcmfw_start_write(struct usb2_fifo *fifo) */ static void -ubtbcmfw_stop_write(struct usb2_fifo *fifo) +ubtbcmfw_stop_write(struct usb_fifo *fifo) { struct ubtbcmfw_softc *sc = fifo->priv_sc0; @@ -366,10 +366,10 @@ ubtbcmfw_stop_write(struct usb2_fifo *fifo) */ static int -ubtbcmfw_open(struct usb2_fifo *fifo, int fflags) +ubtbcmfw_open(struct usb_fifo *fifo, int fflags) { struct ubtbcmfw_softc *sc = fifo->priv_sc0; - struct usb2_xfer *xfer; + struct usb_xfer *xfer; /* * f_open fifo method can only be called with either FREAD @@ -395,7 +395,7 @@ ubtbcmfw_open(struct usb2_fifo *fifo, int fflags) */ static void -ubtbcmfw_close(struct usb2_fifo *fifo, int fflags) +ubtbcmfw_close(struct usb_fifo *fifo, int fflags) { if (fflags & (FREAD | FWRITE)) usb2_fifo_free_buffer(fifo); @@ -406,7 +406,7 @@ ubtbcmfw_close(struct usb2_fifo *fifo, int fflags) */ static int -ubtbcmfw_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data, +ubtbcmfw_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags) { struct ubtbcmfw_softc *sc = fifo->priv_sc0; @@ -415,7 +415,7 @@ ubtbcmfw_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data, switch (cmd) { case USB_GET_DEVICE_DESC: memcpy(data, usb2_get_device_descriptor(sc->sc_udev), - sizeof(struct usb2_device_descriptor)); + sizeof(struct usb_device_descriptor)); break; default: -- cgit v1.2.3