date: 2000/02/29 21:37:01; author: augustss; state: Exp;
Distinguish between device and interface classes.
(I finally found a document that said that they were different.)
In order of importance:
* Make ugen use updated frlengths.
* More tests for NULL pipes.
* Generate better error codes on bulk write.
* Error messages in general.
sense, and mode select into their 10 byte equivalents. Eventually the
da(4) driver will become more intelligent about this, or at least allow
umass(4) to pass quirks in directly. However, this is a functional
workaround until a better fix is implemented.
- Use the 6 to 10 conversion function to allow the ATAPI and UFI command
sets to emulate 6 byte commands with 10 byte commands.
- Use the ATAPI command set rather than UFI for the ScanLogic SL11R-IDE
as it supports the SYNCH_CACHE command.
- Enable ATAPI command set support.
- Pass READ/WRITE_12 commands through for UFI support as the UFI spec
says they should be supported.
- Update a comment in the UFI translation function since we handle
MODE_SELECT.
the UFI command set. Even with this patch, it's incredibly slow on my
laptop, but at least now it works.
Note that the drive is reported to CAM with the vendor and device IDs from
the device itself, forcing the user to patch the da(4) quirk table
manually.
signature, but otherwise behaves just like a normal USB mass-storage
device. Add a new quirk to cover this case, and enable it for C-1
cameras. The quirk enables translation from the C-1 signature to
the normal CSWSIGNATURE value.
Reviewed by: n_hibma
Actually this porting supports Pegasus II chip so I guess some other
devices supported by NetBSD also work. But the devices list are not
included because I cannot confirm if they work.
Obtained from: NetBSD
MFC after: 3 weeks
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
events. Otherwise you would see unexpected results if shift or
locking keys are defined to give different actions depending
on other shift/locking keys' state.
Please keep the ukbd module and the kernel in sync, otherwise
the USB keyboard won't work after this change.
MFC after: 10 days
that device add/remove will work without usbd running. usbd is still
used for execing stuff, but that is all now. Ideally it could be replaced
by a devd some day. Until now, usbd had to be running so that the
USB_DISCOVER ioctl could be called to walk the tree when an attachment
status change was noticed.
Among the changes:
- when a detach happens, remove any pending 'attach' messages or the system
suffers from whiplash from exec moused / kill moused loops if you do lots
of attach/detach and later start usbd.
- tweaks related to kthread differences
- disable the select handler for the old interface (never return success).
I have not removed it yet or old usbd's will abort. That can get removed
later once usbd is cleaned up and things have stabilized for a few weeks.
- get Giant in the kthread.
- a couple of minor potential bug fixes (usb_nevents vs malloc failure etc)
Pre-approved by: n_hibma (ages and ages ago)
other "system" header files.
Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.
Sort sys/*.h includes where possible in affected files.
OK'ed by: bde (with reservations)
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.
Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
interrupt threads to run with it always >= 1, so that malloc can
detect M_WAITOK from "interrupt" context. This is also necessary
in order to context switch from sched_ithd() directly.
Reviewed By: peter
All calls to mtx_init() for mutexes that recurse must now include
the MTX_RECURSE bit in the flag argument variable. This change is in
preparation for an upcoming (further) mutex API cleanup.
The witness code will call panic() if a lock is found to recurse but
the MTX_RECURSE bit was not set during the lock's initialization.
The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to
MTX_RECURSED, which is more appropriate given its meaning.
The following locks have been made "recursive," thus far:
eventhandler, Giant, callout, sched_lock, possibly some others declared
in the architecture-specific code, all of the network card driver locks
in pci/, as well as some other locks in dev/ stuff that I've found to
be recursive.
Reviewed by: jhb
Add the entry for the Yano U640MO-03 MO drive. (ifdef-0-ed out for now)
Fix a hack were an original buffer was modified instead of copied
(cmd[] -> (*rcmd)[])
Submitted by: Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>
instead of the requested length. Otherwise all transfers look like 0 byte
transfers to CAM.
Submitted by: Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>
2) Finalise the command in the case of CBI transfers with CCI (command
completion interrupt).
3) Remove a redundant bzero of a buffer.
This version is functional and is aproaching solid..
notice I said APROACHING. There are many node types I cannot test
I have tested: echo hole ppp socket vjc iface tee bpf async tty
The rest compile and "Look" right. More changes to follow.
DEBUGGING is enabled in this code to help if people have problems.
format version number. (userland programs should not need to be
recompiled when the netgraph kernel internal ABI is changed.
Also fix modules that don;t handle the fact that a caller may not supply
a return message pointer. (benign at the moment because the calling code
checks, but that will change)
This clears out my outstanding netgraph changes.
There is a netgraph change of design in the offing and this is to some
extent a superset of soem of the new functionality and some of the old
functionality that may be removed.
This code works as before, but allows some new features that I want to
work with and evaluate. It is the basis for a version of netgraph
with integral locking for SMP use.
This is running on my test machine with no new problems :-)
USB WebCams, using a patch from Peter Housel.
With this change ugen, and with Peter's 'vid' program
in ports/graphics/vid, we can capture single images from USB Cameras
using the OmniVision OV511 chipset (including some models of the
Creative WebCam 3)
NetBSD merged in Peter's patch to their ugen.c file
several months ago, so this brings us back in line.
Submitted by: Peter Housel <housel@acm.org>
http://members.home.com/housel/
Approved by: Nick Hibma
Change a few indentations to tabs.
Change the functions to use ANSI sytle parameters.
This lowers the diffs between our copy of ugen.c and NetBSD's copy
Approved by: Nick Hibma
on. So stop failing the attach if the IRQ is unassigned. With this
patch, I can now boot with PNP-OS YES in my BIOS no differently than
PNP-OS NO (which is a good thing since Windows hangs with PNP-OS NO).
Obtained from: msmith
before adding/removing packets from the queue. Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.
IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue. An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.
Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
When the printer is turned off the pipe write will cause and error,
which causes lpd to close the device and reopen it to clear the error.
After a short while the device will disappear from the bus but lpd will
have opened the ulpt0 port by then. ulpt_status will check for status
without checking the sc->dying flag and panic the kernel when the device
finally disappears from the bus.
Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
multicast filter on the Pegasus chip. Since IPv6 depends a lot
on multicasting, this caused several failures for people trying to
use IPv6 with Pegasus USB ethernet devices.
Submitted by: Jun Kuriyama <kuriyama@FreeBSD.org>
<sys/proc.h> to <sys/systm.h>.
Correctly document the #includes needed in the manpage.
Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.
the offending inline function (BUF_KERNPROC) on it being #included
already.
I'm not sure BUF_KERNPROC() is even the right thing to do or in the
right place or implemented the right way (inline vs normal function).
Remove consequently unneeded #includes of <sys/proc.h>
usb_ethersubr.c. This module maintains two queues for packets which
are each protected with one mutex. These are all the changes I can
do for now. Removing the USBD_NO_TSLEEP flag doesn't work yet: when
I tried it, the system would usually freeze up after a NIC had been
operating for a while. The usb_ethersubr module itself ought to
go away; this is the next thing I need to test.
length of the data properly. This should be moved into a tty_subr
function.
Also, disanle the setting of the CDC_CM_OVER_DATA flag. It breaks some
modems. I don't think that ther actually is a modem that needs this.
Submitted by: Brad Karp <bkarp@ICSI.Berkeley.EDU>
Replace all in-tree uses with <sys/mouse.h> which repo-copied a few
moments ago from src/sys/i386/include/mouse.h by peter.
This is also the appropriate fix for exo-tree sources.
Put warnings in <machine/mouse.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/mouse.h> files will be removed.
Replace all in-tree uses with necessary subset of <sys/{fb,kb,cons}io.h>.
This is also the appropriate fix for exo-tree sources.
Put warnings in <machine/console.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/console.h> files will be removed.
attached by the pnaphy driver. This seems to work fine with my sample
ADMtek adapter (which has both 10/100 ethernet and homePNA connectors
and hardware).
Make the umass driver depend on this module.
Makes it possible to compile the kernel without SCSI support and load it
when for example a USB floppy is conencted.
Make it possible to move a device to its unconfigured state by
using config #0.
Add some comments.
Change error reporting in port reset function.
usbd_devinfo_vp(): search the know devs array also if the device doesn't
return product description (e.g. Kye's Genius NetScroll mouse returns
vendor, but not product); the strings returned by device are still
preferred to those in the array, though
from the SCSI id it has. (this avoids the confusing umass-sim32 device. It
should have been umass-sim0 all along (there is only one), and if it is
spoken to as a SCSI device the sim should be umass32.
Make the rescan actually work. We need to fill in a target and lun wildcard
and not the SCSI id of the SIM.
Add a seatbelt.
cases the registers are not correctly set on resume.
This solves the problem of USB failing after resuming a machine.
Submitted by: mike+fbsd@medianstrip.net
PR: 18261
modules to depend on modules in the same file (uhub depends on usb) or
even on themselves (usb on usb, makes the define in usb_port.h a lot
less convoluted).
Use ANSI prototypes.
There is a number of devices that are compliant, of which the 3Com 5605 is
has been verified to work.
The driver is not perfect yet, but should be able to get you somewhere.
The driver was originally written by Lennart Augustsson, but Mike Smith
and Mike Meyer <mwm@mired.org> did the porting.
ether_ifdetach().
The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.
Reviewed by: julian, freebsd-net
routines from foo_watchdog() because foo_watchdog() is called at
interrupt context, and that's a no-no due to the way the USB stack
is currently set up.
What we do now is call the TX end of frame handler manually to clear
the completed transmission, then check the send queue and send off
any frames that are pending.
Also turned off the interrupt pipe stuff in if_aue, since it appears
to tickle a bug in the USB stack that I haven't found yet.
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.
The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.
The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.
Reviewed by: freebsd-net
ums driver (mouse) and get the usb driver at the same time.
This also shows that
MODULE_VERSION(usb, 1);
MODULE_DEPEND(usb, usb, 1, 1, 1);
in the same module in one source file works.
<sys/bio.h>.
<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.
Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.
Still a few bogus uses of struct buf to track down.
Repocopy by: peter
ioccom.h defines only implementation detail, and should therefore
only be included from the #include which defines the ioctl tags,
in other words: never include it from *.c
are two supported chips, the NetChip 1080 (only prototypes available)
and the EzLink cable. Any other cable should be supported however as they
are all very much alike (there is a difference between them wrt
performance).
It uses Netgraph.
This driver was mostly written by Doug Ambrisko and Julian Elischer and
I would like to thank Whistle for yet another contribution. And my
aplogies to them for me sitting on the driver for so long (2 months).
Also, many thanks to Reid Augustin from NetChip for providing me with a
prototype of their 1080 chip.
Be aware of the fact that this driver is very immature and has only been
tested very lightly. If someone feels like learning about Netgraph however
this is an excellent driver to start playing with.
Note that if_aue doesn't strictly depend on usb because it uses the
method interface for calls rather than using internal symbols, and
because it's a child driver of usb and therefore will not try and do
anything unless the parent usb code is loaded at some point. if_aue does
strictly depend on miibus as it will fail to link if it is missing.
(which is actually a CATC Netmate).
Gee. I don't know why people make such a fuss over supporting USB ethernet
NICs. This is easier than collecting graft.
Update the license in the rio_usb.h (now rio500_usb.h) to not be GPL.
Sorry for committing that file in the first place. The change of license
was agreed to by the original author.
non-device code.
* Re-implement the method dispatch to improve efficiency. The new system
takes about 40ns for a method dispatch on a 300Mhz PII which is only
10ns slower than a direct function call on the same hardware.
This changes the new-bus ABI slightly so make sure you re-compile any
driver modules which you use.
- Request the maximum number of LUNs on a device if it is
a Bulk-Only device.
- Handle NO_TEST_UNIT_READY case for SCSI
- Add NO_START_STOP quirk for LS-120
- Fix a KASSERT which was the wrong way around.
- Kickstart the LS-120 with the infamous LS-120 specific command of
which no one knows what it doesn, apart from the fact that it appeared
in the Linux code someday.
kernel. Justin agress that there is no other reasonable alternative to
do automatic rescans on connect.
The problem is that when a new device attaches to a SIM (SCSI host
controller) we need to send a XPT_SCAN_BUS command to the SIM using
xpt_action. This requires however that there is a peripheral available
to take the command (otherwise xpt_done and later bomb). The RESCAN
ioctl uses the same periph.
This enables a USB mass storage drive to do an automatic rescan on
connection of the drive.
The automatic dropping of a CAM entry on disconnection was already
working (asynchronous event).
The next thing to do is find someone to commit a change to vpo to do the
same thing. Just port umass_cam_rescan and friends across to that
driver.
Approved by: gibbs
unit numbers all wrong. This did not show up because most of them where
zero anyway.
Use a separate buffer for command transforms instead of fiddling with
the existing cdb_bytes.
Take CAM_CDB_POINTER into account. Nobody is using it, but someone might
in the future.
Be more picky about what to accept in the UFI command set.
First attempt at implementing the ATAPI command protocol transforms.
This should at least make Imation Superdisk and other e-Shuttle based
devices show as attached. Maybe they even work to some extent.
contains the ADMtek Pegasus AN986 USB chipset. The
adapter supports both 10BaseT and 100BaseT (including
full-duplex). The product code for these adapters is
0x2206.
and has not been loaded via a kldload,
running usbd(8) will autoload the "usb.ko" kld.
thanks to Peter Wemm for enlightening me on the
differences between kldfind(2) and modfind(2).
to be based on the transfer speed, but I got it all wrong. The by far
biggest factor in the timeout is the start of a removable device, which
is about 2 seconds anyway.
Prodded by: Lennart Augustsson
This makes it possible to handle the done queue even when the end of tail
TD has ended up on the done queue as well (the xfer in this case is NULL
but the next field is valid, so we simply skip that element.
Make sure we mark all the handled transfers as handled.
Stop using powerhooks. They are a NetBSD-ism.
from panicing when disconnecting a USB Wacom Graphire tablet.
jhk approved the fix some time ago, but I forgot to actually commit the
thing.
Reported by: Dirk van Gulik <dirkx@webweaving.org>
Approved by: jhk
problem was basically (for offset > 4096):
vtophys(addr) + offset != vtophys(addr + offset)
Also, use TD's with a maximum size of 4k instead of 8kb for OHCI
controllers.
This problem occurs in drivers that use large transfer sizes:
umass, host2host and ethernet with jumbo frames.
is initialised by usb_init.
This might solve problems with some controllers not being initiliased
properly, because a delay was effectively a tsleep that returned
immediately.
Approved by: jhk
the PIRQD bit.
This fixes the problem of uhub0 hanging forever during boot when USB
keyboard support is switched on in the BIOS on motherboards with Intel
chipsets (UHCI).
Approved by: The Sheep
bus_delete_resource.
Fixes a problem when the probe succeeded, but the attach failed. The
release of the resources was done inproperly.
Approved by: jkh
Some controllers submit bogus pointers to the Done queue.
ohci_hash_find_td fails to find these in its hash and panics. Instead of
panicing we now assume the whole done queue is lost and let the timeout
code to clean up the mess after us.
uhci_check_intr() routine needs to be more careful about deciding when
the end of a transfer has been detected.
This allows me to remove the nasty workaround code from if_aue and if_cue.
Receive performance is now much better for these adapters (500KB/sec
vs. 350KB/sec).
Also removed unused KUE_CUTOFF define from if_kuereg.h.
Submitted by: Lennart Augustsson
Reviewed by: n_hibma