Commit Graph

35 Commits

Author SHA1 Message Date
Hans Petter Selasky
23ab08715c Provide one global language string descriptor for
american english instead of giving each module its
own.

Submitted by:	Christoph Mallon
2013-01-30 15:46:26 +00:00
Hans Petter Selasky
a5cf1aaaff Add support for the so-called streams feature of BULK endpoints
in SUPER-speed mode, USB 3.0.

This feature has not been tested yet, due to lack of hardware.

This feature is useful when implementing protocols like UASP,
USB attached SCSI which promises higher USB mass storage throughput.

This patch also implements support for hardware processing of endpoints
for increased performance. The switching to hardware processing
of an endpoint is done via a callback to the USB controller driver. The
stream feature is implemented like a variant of a hardware USB protocol.

USB controller drivers implementing device mode needs to be updated to
implement the new "xfer_stall" USB controller method and remove the
"xfer" argument from the "set_stall" method.

The API's toward existing USB drivers are preserved. To setup a USB transfer
in stream mode, set the "stream_id" field of the USB config structure to
the desired value.

The maximum number of BULK streams is currently hardcoded and limited to 8
via a define in usb_freebsd.h.

All USB drivers should be re-compiled after this change.

LibUSB will be updated next week to support streams mode. A new IOCTL to
setup BULK streams as already been implemented. The ugen device nodes
currently only supports stream ID zero.

The FreeBSD version has been bumped.

MFC after:	2 weeks
2012-08-12 17:53:06 +00:00
Andrew Thompson
f12c6c2913 Improve High Speed slot allocation mechanism by moving the computation to the
endpoint rather than per xfer and provide functions around get/free of resources.

Submitted by:	Hans Petter Selasky
2009-11-22 21:16:43 +00:00
Andrew Thompson
883bb30022 improve support for high speed isochronous endpoints which does not run 1:1,
but needs intervalling 1:2, 1:4 or 1:8

Submitted by:	Hans Petter Selasky
2009-11-08 20:54:03 +00:00
Andrew Thompson
bb9c7a8b22 Fix a corner case where usbd_transfer_drain() can return too early if the
callback has dropped the mutex, leading to a panic.

Submitted by:	HPS
MFC after:	3 days
2009-11-01 21:44:37 +00:00
Andrew Thompson
ed6d949afd - Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just   usb.h and usbdi.h
2009-06-23 02:19:59 +00:00
Andrew Thompson
759736470c Fix _USB2_* refernces in the header protection defines. 2009-06-15 01:09:19 +00:00
Andrew Thompson
a593f6b8de s/usb2_/usb_|usbd_/ on all function names for the USB stack. 2009-06-15 01:02:43 +00:00
Andrew Thompson
8437751d86 Remove usb2_cv_* and just use the kernel condvar implementation, it was needed
earlier since condition variables didnt work with Giant but this was fixed 10
months ago.
2009-06-15 00:33:18 +00:00
Andrew Thompson
a755d548b7 Minor device side improvement. Make sure a not complete state gets paired with
a complete state in device side mode for the default control endpoint.

Submitted by:	Hans Petter Selasky
2009-06-12 15:58:55 +00:00
Andrew Thompson
ed96654f20 Change driver_info to a ulong as it always stores a number and remove the only
diff of the usb_device_id struct to Linux.

Reviewed by:	HPS
2009-06-08 18:09:51 +00:00
Andrew Thompson
ae60fdfba2 Rename usb pipes to endpoints as it better represents what they are, and struct
usb_pipe may be used for a different purpose later on.
2009-06-07 19:41:11 +00:00
Andrew Thompson
f9cb546c23 Revert the size_t part of the last commit for the moment, this blows up the
USB_ADD_BYTES macro.
2009-05-30 00:22:57 +00:00
Andrew Thompson
e0a69b51ac s/usb2_/usb_/ on all typedefs for the USB stack. 2009-05-29 18:46:57 +00:00
Andrew Thompson
760bc48e7e s/usb2_/usb_/ on all C structs for the USB stack. 2009-05-28 17:36:36 +00:00
Andrew Thompson
c86aead66c Allocate the usb serial, manufacturer and product strings rather than use char
arrays in the usb_device struct. This also eliminates USB_HAVE_STRINGS.
2009-05-27 23:12:02 +00:00
Andrew Thompson
476183df94 Improve device mode (gadget) stall handling.
Some hardware easily comes out of sync with regard to whether the current or
the next control transfer should be stalled, if a stall command is always
issued before receiving the SETUP packet. After this patch the stall command
will only be issued when a transfer should actually be stalled.

Submitted by:	Hans Petter Selasky
2009-05-21 17:39:21 +00:00
Andrew Thompson
8d2dd5dd85 Use enums for speed and rev data types. 2009-05-21 01:05:21 +00:00
Andrew Thompson
f29a072444 - rename usb2_mode to usb_mode [1]
- change variable types to use the enum

Submitted by:	Hans Petter Selasky [1]
2009-05-21 00:04:17 +00:00
Andrew Thompson
8ea86e467f Add parenthesis around the xfer macro argument.
Submitted by:	Hans Petter Selasky
2009-05-13 18:25:14 +00:00
Andrew Thompson
ec8f31275d Revert part of r191494 which used the udev state to mark suspending, this needs
to be set via two variables (peer_suspended and self_suspended) and can not be
merged into one.

Submitted by:	Hans Petter Selasky
Pointy hat:	me
2009-05-05 15:36:23 +00:00
Andrew Thompson
4d4fa6edd4 Make the state string descriptions public. 2009-04-25 21:25:52 +00:00
Andrew Thompson
bd21677868 Track the usb device state as its powered on, addressed and configured. This helps
to avoid touching the device when it is not going to respond and would otherwise
timeout.

Implement the suspend tracking as a udev state too.
2009-04-25 21:10:06 +00:00
Andrew Thompson
459d369ee2 MFp4 //depot/projects/usb@160930
Change the roothub exec functions to take the usb request and data pointers
directly rather than placing them on the parent bus struct.

Submitted by:	Hans Petter Selasky
2009-04-22 17:08:16 +00:00
Andrew Thompson
fde875265f Provide a better commit log for r190735, forced by making a whitespace change.
Refactor how we interface with the root HUB. This is achieved by making a
direct call from usb2_do_request to the host controller for root hub requests,
this call will perform the controller specific register read/writes and return
the error code.

This cuts out a lot of code in the host controller files and saves one thread
per USB bus.

Submitted by:	Hans Petter Selasky
2009-04-06 00:22:49 +00:00
Andrew Thompson
3930731567 MFp4 //depot/projects/usb@159922
Refactor how we interface with the root HUB. This cuts around 1200 lines of
code totally and saves one thread per USB bus.

Submitted by:	Hans Petter Selasky
2009-04-05 18:20:49 +00:00
Andrew Thompson
4eae601ebd MFp4 //depot/projects/usb@159909
- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
  "usb2_config" has a new field called "usb_mode" which select for which mode
  the current xfer entry is active. Options are: a) Device mode only b) Host
  mode only (default-by-zero) c) Both modes.  This change was scripted using
  the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
  the code for the function uses less memory than the table itself.

Submitted by:	Hans Petter Selasky
2009-04-05 18:20:38 +00:00
Andrew Thompson
bafdb74c0b MFp4 //depot/projects/usb
Sync usb_core.h after header changes.

Submitted by:	Hans Petter Selasky
2009-03-20 22:04:33 +00:00
Andrew Thompson
578d0eff90 MFp4 //depot/projects/usb @159431,159437,159438
- start using the new USB typedefs in the USB core
- Remove usage of USB_ADD_BYTES()

Submitted by:	Hans Petter Selasky
2009-03-20 21:50:54 +00:00
Andrew Thompson
bdc081c60f MFp4 //depot/projects/usb@159392
Add ifdefs for making parts of usb conditional.

Submitted by:	Hans Petter Selasky
2009-03-20 21:48:11 +00:00
Andrew Thompson
ab42e8b2df MFp4 //depot/projects/usb @159430
- Move tunable defines into usb_core.h and dependancy towards usb_defs.h
- Leave hardcoded defines in "usb_defs.h".
- Allow overriding all tunable defines.
- Add more customisable typedefs.
- Correct maximum device number.

Submitted by:	Hans Petter Selasky
2009-03-20 19:04:31 +00:00
Andrew Thompson
0f6e8f934f MFp4 //depot/projects/usb 158942,158948
Allow USB to be compiled without ugen support.

Submitted by:	Hans Petter Selasky
2009-03-09 20:08:08 +00:00
Andrew Thompson
ee3e3ff5c2 Change USB over to make_dev() for all device nodes, previously it hooked into
the devfs clone handler to open the (invisible) devices on the fly.

The /dev entries are layed out as follows,

 /dev/usbctl      = master device
 /dev/usb/0.1.0.5 = usb device, (<bus>.<dev>.<iface>.<endpoint>)
 /dev/ugen0.1 -> usb/0.1.0.0 = ugen link to ctrl endpoint

This also removes the custom permissions model from USB.  Bump
__FreeBSD_version to 800066.

Submitted by:	rink (earlier version)
2009-02-27 17:27:16 +00:00
Andrew Thompson
4a35cda731 MFp4 //depot/projects/usb@157853
Clean up old way of polling the USB hardware.  The existing polling support was
a bit hackish.

Submitted by:	Hans Petter Selasky
2009-02-24 03:39:13 +00:00
Andrew Thompson
02ac645488 Move the new USB stack into its new home. 2009-02-23 18:31:00 +00:00