Commit Graph

118 Commits

Author SHA1 Message Date
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
drochner 42de29841b restore error handling in usbopen() (accidentally removed in a recent
commit), should fix a crash reported by Arto Huusko
2008-04-03 14:07:01 +00:00
ad 3e4bd28ac8 Defer USB configuration until interrupts are enabled. 2008-03-30 15:37:49 +00:00
drochner fd0ded75ed split device/softc for USB host controllers and the usb (control)
device,
this is hairy stuff, and I've only tested with uhci/ehci at pci,
please test the rest and report problems
2008-03-28 17:14:45 +00:00
ws 27973cf78e Don't leak information from kernel to userland.
(Well, the first 2 changes wouldn't really be neccessary,
however, IMHO this makes it clearer why we don't leak.)
2008-03-08 18:46:18 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
dyoung 0b1dce29ae Use device_t and its accessor functions.
Register _childdetached methods with drivers that attach children.
Wait to set child references to NULL there, instead of doing that
in the detach method.

Replace many uses of USB_DECLARE_DRIVER() with CFATTACH_DECL2().
2008-02-18 05:24:24 +00:00
smb 0cb6d977ab Add calls to pmf_deregister on detach. 2008-01-04 03:56:47 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
pooka 4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
jmcneill 4fbe23fdd0 aprintify 2007-12-01 04:50:50 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
ad 46ed8f7d77 Use the softint API. 2007-10-08 16:18:02 +00:00
kiyohara 2db72b9118 * splsoftusb, IPL_SOFTUSB, and IPL_HARDUSB defines in usbdi.h
-> the current names are confusing (didn't change other drivers)
* fix invalid memory access in usbd_transfer (kern/24636)
-> needed for this driver
* fix USB HC detach race condition (kern/32011)
-> main patch needed for this driver, sc_dying changes in other drivers
not necessary but seem right to me

Patch from Matthew Orgass.
  http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
2007-08-15 04:00:33 +00:00
ad bba99c25aa Generic soft interrupts are mandatory. 2007-07-14 21:02:36 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
drochner 515beb215f g/c calls to usbd_init()/usbd_finish() which don't have an effect 2007-02-26 13:38:09 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
christos 682562feb0 fix compilation issues. 2006-12-05 17:35:35 +00:00
pavel 9b8e4189e5 Restore compatibility of USB_DEVICEINFO ioctl and reads from /dev/usb with
NetBSD 3.x. Patch from Stephan Thesing provided in
http://mail-index.netbsd.org/current-users/2006/03/21/0002.html, with some
modifications by me.
See also
http://mail-index.netbsd.org/current-users/2006/08/29/0017.html

The code is conditionally compiled depending on COMPAT_30.

Also fix a leak of struct usb_event in usbread() introduced while converting
on-stack variables to dynamic allocation.

Reviewed by martin@.
2006-12-03 22:34:58 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
joerg 8934eeb830 Split the USB task queue into two parts, one for normal device tasks and
one for tasks of the host controllers. This is needed for drivers like
ural(4) that want to do synchronous USB transfers from the task handler.
Before the split timeouts could not be handled correctly as the task
thread was still blocked. From FreeBSD.
2006-10-31 20:43:31 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos ad4f70a8e8 add missing initializer. 2006-09-03 21:30:24 +00:00
christos de34bda8ec stack police: don't allocate usb_events on the stack, malloc them directly.
this saves stack and an extra copy.
2006-06-09 21:33:42 +00:00
thorpej 2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
drochner fd6c232a7a Allow a NULL pointer as argument to usb_get_next_event(), and don't
allocate a "struct usb_event" on stack in usb_add_event().
This gives just enough breathing space that the box doesn't die
immediately from stack overflow when I insert a
ohci0 at cardbus0 dev 0 function 0: Acer Labs M5237 USB 1.1 Host Controller
2005-09-09 12:04:30 +00:00
ws 9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
joff 9a12dd0ebe Implementation requirements of usb_needs_reattach(), from OpenBSD and required
for atu(4) to do a USB reconnect after firmware upload.
2005-01-24 01:30:38 +00:00
wiz 6a2ed83373 URL updates, from Jared Yanovich and jmc@openbsd, forwarded by the latter. 2003-11-07 17:03:25 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
thorpej 72a7af27b0 Use aprint_normal() in cfprint routines. 2003-01-01 00:10:15 +00:00
dsainty 3d3cc353c3 extern references to debugging globals that really exist elsewhere 2002-12-30 02:44:32 +00:00
christos 514f7047e4 si_ -> sel_ 2002-11-26 18:49:40 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
simonb 4e3613273b Remove breaks after returns, unreachable returns and returns after
returns(!).
2002-09-23 05:51:10 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
lukem 06de426449 SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field).  whilst it's O(n),
  this mirrors the functionality of SLIST_REMOVE() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
2002-06-01 23:50:52 +00:00
augustss 2acf4c8462 Use callout init macro. 2002-05-09 21:54:32 +00:00
augustss 0405958cec Check for write permission for some ioctls. 2002-04-23 06:34:11 +00:00