Commit Graph

309 Commits

Author SHA1 Message Date
uebayasi dff67e454b Include dependencies directly. 2010-11-14 15:47:20 +00:00
cegger 31b69ed482 do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach
2010-09-07 07:26:54 +00:00
cegger f8af7a09a8 convert tsleep to kpause 2010-09-07 07:19:45 +00:00
cegger 06b4e82a5b fix grammar in error message 2010-08-29 21:15:26 +00:00
cegger 6bb3ec6d99 Confilict -> Conflict 2010-08-29 21:14:16 +00:00
cegger 0fd1c01632 don't call tsleep() with any mutexes hold 2010-08-26 12:48:19 +00:00
cegger e6026ef12c fix crash when detaching/re-attaching a cable where three firewire devices are on the bus. 2010-08-26 08:56:15 +00:00
cegger 0d3d36a951 - print expected crc when it does not match
- add and print secondary text leaf. This prints the model name of my webcam.
- add csr keys that are printed as 'unknown' otherwise
2010-08-26 07:36:53 +00:00
cegger d546ccf4b9 do not hold mutexes when calling tsleep(9).
Fixes LOCKDEBUG panics
2010-08-16 06:05:07 +00:00
jym f3fb0a5620 Fix some code paths where pointers are dereferenced after checking that
they are NULL (oops?)

XXX pull-ups for NetBSD-4 and NetBSD-5.
2010-08-14 18:28:59 +00:00
cegger 0bf9ca9c59 Fix sbp attach/detach.
When plugging a firewire webcam, sbp attaches.
sbpattach() calls sbp_alloc_target().
In sbp_alloc_target, crom_search_key() fails and sbp_alloc_target() returns NULL.
Move mutex and list initializations up in sbpattach() and in sbp_alloc_target()
so that destroyal of them through sbpdetach() does not cause
LOCKDEBUG panics when unplugging the firewire webcam.
2010-08-14 10:39:33 +00:00
christos 32e80c5d9d Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
2010-05-23 18:56:58 +00:00
christos f651b8a7c3 Don't allocate sid scratch memory from an interrupt context:
fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2  0 cpl 6 rsp fffffff
f80fafb68
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
fwohci_intr() at netbsd:fwohci_intr+0xbe2
...

I will send-pr for the next one... Looks like someone did not use DIAGNOSTIC
when made the changes.
2010-05-23 02:25:50 +00:00
christos e9c888b9ca don't allocate rom scratch memory from an interrupt context:
fwohci0: BUS reset
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2  0 cpl 6 rsp fffffff
f80fafb08
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
kmem_zalloc() at netbsd:kmem_zalloc+0xf
fw_busreset() at netbsd:fw_busreset+0x23b
fwohci_intr() at netbsd:fwohci_intr+0xa56
...
2010-05-23 02:24:40 +00:00
kiyohara 5c2c106932 Add mutex.h. 2010-05-15 10:42:51 +00:00
kiyohara 931a85be79 May be easy to understand 'pay_len > 0' more than 'paylaod != NULL'. 2010-05-14 12:25:19 +00:00
kiyohara 0f5342ae85 Use kmem(9) instead of malloc(9). 2010-05-14 12:10:07 +00:00
kiyohara f8bb8301ce Use kmem(9) instead of malloc(9). 2010-05-10 12:17:32 +00:00
kiyohara c9cf6da04a Call malloc(M_ZERO) instead of malloc() and memset(). 2010-04-29 06:56:00 +00:00
kiyohara fc309475a3 Remove unnecessary cast. 2010-04-29 06:53:48 +00:00
kiyohara 198c196230 + Fix typo.
+ Call aprint_error_dev() instead of aprint_error().
2010-04-29 06:53:13 +00:00
kiyohara afe5433875 + Use structs scsipi_inquiry_data/scsi_sense_data instead of scsi3_inquiry_data/
scsi3_sense_data.
+ s/switch()/switch ()/.
+ Change args for printf().  ("FUNCNAME ...") -> ("%s ...\n", __func__, ...)
+ Indent.
+ Remove unnecessary cast.
2010-04-29 06:51:26 +00:00
cegger 6eacba31fd ANSIfy, KNF 2010-04-24 21:34:29 +00:00
kiyohara dcbb04ec40 Fix a bug.
STAILQ is not NULL termination.
2010-04-19 07:00:58 +00:00
reinoud 1819dce19c KASSERT(FALSE) to enter the debugger on this check. When DDB is not defined
but KGDB is, this would result in cpu_Debugger() dont being defined! Please be
kind to developers that use KGDB instead of DDB! :)
2010-04-06 10:45:15 +00:00
kiyohara b22c29ccbf Remove more my debugging code. 2010-03-29 07:34:02 +00:00
kiyohara d5a3582188 Remove debugging process. 2010-03-29 03:42:15 +00:00
kiyohara af09db112b Bye-bye fw_port.h. 2010-03-29 03:05:27 +00:00
mrg ebc9e23316 various aprint_* fixes. 2010-03-11 03:54:56 +00:00
dyoung c2a519975e Simplify device-activation hook. 2009-12-06 22:56:56 +00:00
dyoung cb637e784d unifdef -U__FreeBSD__ -D__NetBSD__, et cetera. 2009-08-07 00:10:53 +00:00
dyoung 59d9a6b60c unifdef -U__DragonFlyBSD__ -U__FreeBSD__ -D__NetBSD__.
XXX Compiles, but untested.
2009-06-20 20:18:32 +00:00
cegger ffb0a63a57 buildfix: don't redefine MIN and MAX. They are defined in <sys/param.h>. 2009-06-20 09:40:52 +00:00
cegger 32c4940900 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 12:10:29 +00:00
mschuett 0d53a16d76 Add queue macros SLIST_FOREACH_SAFE, STAILQ_FOREACH_SAFE, STAILQ_LAST,
SIMPLEQ_CONCAT, and SIMPLEQ_LAST.

Remove seperate definitions outside of queue.h.
2009-04-20 09:56:07 +00:00
tsutsui d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
cegger e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger 35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger a1f5aecf36 buildfix: undo previous 2009-03-18 10:41:46 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
yamt b1fea83762 remove extra semicolons. 2009-01-03 03:43:21 +00:00
ad 0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
dyoung de87fe677d *** Summary ***
When a link-layer address changes (e.g., ifconfig ex0 link
02🇩🇪ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address.  (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior.  Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability.  KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR.  In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr.  That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR.  In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR.  For example, pull ..._init() out of any switch
statement that looks like this:

        switch (...->sa_family) {
        case ...:
                ..._init();
                ...
                break;
        ...
        default:
                ..._init();
                ...
                break;
        }

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

        switch (x & (IFF_UP|IFF_RUNNING)) {
        case 0:
                ...
                break;
        case IFF_RUNNING:
                ...
                break;
        case IFF_UP:
                ...
                break;
        case IFF_UP|IFF_RUNNING:
                ...
                break;
        }

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure.  Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls.  In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source.  In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively.  Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset.  Delete unnecessary casts to void *.  Use
sockaddr_in_init() and sockaddr_in6_init().  Compare pointers with
NULL instead of "testing truth".  Replace some instances of (type
*)0 with NULL.  Change some K&R prototypes to ANSI C, and join
lines.
2008-11-07 00:20:01 +00:00
gmcgarry 0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
gmcgarry b8d5478df6 Replace gcc extension of comma-elimination variadic macros with aprint_debug_ifnet(). 2008-06-24 10:13:51 +00:00
gmcgarry 8f786d7556 Digraphs as lvalues must return the same type. 2008-06-24 10:12:42 +00:00
jmcneill 2b7bb9303a Use aprint 2008-05-10 13:56:54 +00:00
xtraeme 5a38da5ccf Constify, so that usr.sbin/fwctl can be built with WARNS=4. 2008-05-02 19:50:04 +00:00