Commit Graph

161 Commits

Author SHA1 Message Date
skrll
5d519ff7b6 Get the iManufacturer, iProduct, and iSerialNumber strings before probing
for drivers and cache them for later use.  This reduces bus transactions
and fixes attachment for at least two of my umass(4)s.
2016-01-06 22:12:49 +00:00
mrg
4810df2dff eliminate USBHIST as a define/option. it was entangled with USB_DEBUG
and only referenced a handful of times.  rename any usage in configs.

fixes recent build problems i introduced with the previous files.usb
change.
2015-10-29 00:15:48 +00:00
skrll
d5d53603df Make the non-USBHIST case compile 2015-05-30 06:41:08 +00:00
skrll
f9a9593515 Add missing KERNHIST_LINK_STATIC(usbhist). Pointed out by t-hash. 2015-05-30 06:10:38 +00:00
skrll
8735b6f026 Static initialise usbhist - it can be used by controller drivers, i.e.
before usb attaches.
2015-05-28 09:06:36 +00:00
skrll
7c2a9a0993 Improve USB debugging with USBHIST based on KERNHIST.
Convert some DPRINTFs to USBHIST_LOG and allow usbdebug, ehcidebug and
umassdebug to be changed via sysctl.

Remove the #define mess in usb.h.

This was started by mrg@ and updated by reinoud@
2014-09-12 16:40:38 +00:00
skrll
be08e709ea Some USB3 / SS support - baby steps. From Takahiro HAYASHI. 2014-08-12 13:36:40 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
riastradh
4af1928aa9 Remove (harmless) redundant assignment of task->queue in usb_add_task. 2014-07-22 23:06:29 +00:00
riastradh
598514d2bc Need <sys/atomic.h> for atomic_cas_uint. 2014-07-17 19:23:40 +00:00
riastradh
6be38beda3 Don't touch task after calling it. 2014-07-17 18:53:34 +00:00
riastradh
071b7abfaa Fix usb task queue locking. 2014-07-17 18:42:37 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
skrll
feb9eaed64 Whitespace 2013-11-09 07:52:22 +00:00
skrll
6324a6ab1f bus->lock is always available now. Remove the old code that helped when
it wasn't always available.
2013-11-07 06:54:48 +00:00
christos
12ef409576 move compat var in compat code. 2013-10-18 19:54:56 +00:00
christos
11beb626a3 Pass the device name in, so we can debug what deferred drivers did not work. 2013-10-12 16:49:00 +00:00
jakllsch
79ce8a4c50 Allow USB_DEVICEINFO on address 0. Needed for the xhci(4) root hub device. 2013-09-14 14:06:40 +00:00
jakllsch
f6ecf6bbf1 Establish host controller softint earlier, in usb_attach rather than
usb_doattach.
2013-09-13 23:42:12 +00:00
jakllsch
1e56cde11f Use usbd_errstr instead of printing non-errno(2) error code. 2013-08-21 18:11:31 +00:00
jakllsch
b63489d8e2 Use NULL instead of 0 as appropriate. 2013-08-21 17:59:40 +00:00
jmcneill
7c64a30e85 - Add a USBD_MPSAFE flag to usbd_open_pipe. If not set, acquire KERNEL_LOCK
before invoking xfer callbacks on this pipe.
- Add an extra flags parameter to usb_init_task. If USBD_TASKQ_MPSAFE is not
  present, acquire KERNEL_LOCK before invoking the task callback.
2013-01-22 12:40:42 +00:00
skrll
c06b153885 Improve a comment slightly 2013-01-08 06:47:45 +00:00
christos
38f4ff5bf5 fix debug variables.
- include opt_usb.h in usb.h so that USB_DEBUG gets set properly in it.
- normalize and sort debugging variables
2013-01-05 23:34:16 +00:00
christos
3039e3a5a7 - need opt_usb.h if depending on USB_DEBUG
- remove trailing whitespace
- add missing KERNEL_RCSID
2013-01-05 01:30:15 +00:00
mrg
b136469b73 since usb task add/remove is supposed to be callable in any usb
context, make sure the lock is OK for such.  ie, not a sleeping lock.
fixes PR#47244.
2012-11-27 04:54:58 +00:00
mrg
d6a35d155a now that the task threads are created earlier, move the call to
usb_create_event_thread() back into usb_doattach(), so that eg,
usb_discover() never operates when the root_hub is not setup.

fixes a crash joerg@ reported.
2012-07-20 23:18:02 +00:00
mrg
ed08188f7a usb task fixes, from jared and myself:
- create the task/event threads in usb_attach() so they're more likely
  to be ready when usb_doattach() runs

- move the task thread creation into usb_once_init(), instead of having
  some other method of only creating them once
2012-07-20 07:31:14 +00:00
christos
a29c93ee4f don't access memory outside the array bounds. 2012-07-20 02:23:35 +00:00
cegger
ce5a3d3562 revert previous. testing queue number requires lock held. 2012-07-17 10:33:46 +00:00
cegger
2329b7a5d5 Do not mutex_enter() a usb_taskq[-1].
Fixes LOCKDEBUG panic.
2012-07-17 10:18:43 +00:00
mrg
dc74fbbf85 merge the jmcneill-usbmp branch. many thanks to jared for the
initial work, and every one else who has tested things for me.
this is largely my fault at this point :-)

the main changes are something like:

        - usbd_bus_methods{} gains a get_lock() to enable the
          host controller to provide a lock for the USB code.
          if the lock isn't provided, old-style protection is
          (partially) applied.

        - ehci/ohci/uhci have been converted to the new
          interfaces, including mutex/cv/etc conversion.

        - usbdivar.h contains a discussion about locking and
          what locks are held for which method calls.  more
          to come for usbdi(9) here.

        - audio drivers (uaudio, umidi, auvitek) have been
          properly SMPified now that USB is ready.

        - scsi drivers have been modified to take the kernel
          lock explicitly before calling into scsi code.

        - usb pipes are associated with a lock, that is the
          same as the controller lock.  (this could be split
          up further in the future.)

        - several usbfoo_locked() or usbfoo_unlocked()
          functions have been added to the usbdi(9) to
          enable functionality with or without the USB
          lock (per controller) already being held.

the TODO.usbmp file has specific details on what is left to
do, including what device-specific changes should be done now
that the whole framework is ready.
2012-06-10 06:15:52 +00:00
mrg
d87bfdaff5 minor cleanups from usbmp:
- move usbd_delay_ms() into usbdivar.h in the usb_subr.c section
- minor rcsid fixes
- copyright maintenence
2012-03-11 01:06:06 +00:00
mrg
574ae8c2d4 pull down from usbmp:
kill the !USE_USE_SOFTINTR code.
2012-03-06 02:49:02 +00:00
jakllsch
71fd84843e Revert previous due to active usbmp branch(es). 2011-12-23 00:51:43 +00:00
jakllsch
7f2b9b9ad4 Adjust-away inconsistent and trailing whitespace. 2011-12-22 20:06:59 +00:00
matt
39d427883c Move EHCI_DEBUG, OHCI_DEBUG, UHCI_DEBUG, USB_DEBUG, UHUB_DEBUG to opt_usb.h
(ya dependencies).
Cleanup usb_mem.c a little more and add block tracking code.  Help find
corruption problems.
Comment out the SPEED check for ETTF.  XXX why doesn't that work right?
2011-06-09 19:08:31 +00:00
joerg
a66d2b0d4c Don't use the name of the task queue as format string 2011-05-23 21:50:44 +00:00
dyoung
49337c8880 Stop using the compatibility macros USB_ATTACH(), USB_DETACH(),
USB_MATCH(), et cetera.  These files produce the same assembly
(according to objdump -d) before and after the change
2010-11-03 22:34:23 +00:00
pgoyette
579b659f6c Update usbverbose module to use module_autoload() rather than module_load().
Load the module right before each attempt to use its features, and let the
module subsystem handle unloading.
2010-06-06 18:58:26 +00:00
pgoyette
3f79fb26a7 Extract USBVERBOSE into a kernel module. The module can be builtin
by defining 'options USBVERBOSE' in the kernel config file (no change
from current behavior), or it can be loaded at boot time on those
architectures that support the boot loader's "load" command.

The module is built for all architectures, whether or not USB support
exists.
2010-05-29 01:14:29 +00:00
pooka
e46bf87952 Don't impose a compile-time dependency on the kernel containing
ohci/uhci just for the sake of setting a debug variable.
2009-12-19 11:41:56 +00:00
dyoung
af7d639aad Re-order operations in usb_detach() so that if a usb(4) instance's
children will not detach, the instance is not left in an inconsistent
state.

If uhub(4) port is disconnected, forcefully detach the children on
that port.

Simplify detachment hooks.  (sc_dying must die!)

Pass along and respect detachment flags, esp. DETACH_FORCE,
throughout.
2009-11-12 20:11:35 +00:00
dyoung
7fdb86195d Use device_t instead of device_ptr_t. Stop using USB_MATCH() and
USB_ATTACH().
2009-06-16 19:42:44 +00:00
cegger
d16a259fe3 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 13:15:24 +00:00
dyoung
227c03169a Detach uhub(4) and usb(4) at shutdown. 2009-04-07 18:15:45 +00:00
drochner
736f4fcd27 some cleanup:
-unifdef
-since the roothub attach doesn't use locators, don't call
 config_stdsubmatch() -- it is a no-op in that case
-ifsubmatch has configuration and interface always set to useful values,
 remove unnecessary checks
-remove now unused locator definitions from shared header
2008-05-26 18:00:33 +00:00
drochner
f8b26260d9 -make the list of USB child devices a (possibly sparse) array rather
than a zero-terminated list; this makes the code simpler and also
 hopefully fixes the recent "childdet" botch, see PR kern/38528
-handle the root hub specially a bit earlier, this allows to kick out
 the "submatch" functions completely which needed to second-guess
 from the port number (where "0" meant root hub")
 (we could handle the root hub specially even earlier, but as done
 now big parts of the hub emulation code are exercised regularely,
 this would bitrot otherwise)
2008-05-25 21:41:35 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00