Commit Graph

465 Commits

Author SHA1 Message Date
tsutsui 768601d6e6 Get width, height, and linebytes values from prom_getpropint(). 2009-03-29 07:24:56 +00:00
tsutsui f8fb75a405 Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html

Should be pulled up to netbsd-4 and netbsd-5.
2009-03-27 12:25:41 +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
dsl 7cc9af7d64 ANSIfy functions with function-pointer arguments 2009-03-16 23:11:09 +00:00
dsl 82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
yamt b1fea83762 remove extra semicolons. 2009-01-03 03:43:21 +00:00
he ecff12ce83 Sprinkle #if NTCTRL > 0 so that this builds again without
warning that some static function is defined but never used.
2008-12-26 22:37:29 +00:00
macallan efb62a12dd move callout_init(sc->sc_tick_ch) before we're trying to callout_stop()
the ticker.
2008-12-26 18:51:19 +00:00
christos 9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
macallan fc934dfa9a fix stride value returned by /dev/fb 2008-12-12 18:48:25 +00:00
macallan 20dab5963b device_t-ify 2008-12-12 18:46:41 +00:00
hauke b8c03f733b Fix warning about missing initializer that showed up in sparc64
builds, but, strangely enough, not in sparc builds.

Relevant for netbsd-{4,5} release branches.
2008-12-11 15:50:35 +00:00
jdc 7892af0d0c Read the chip revision from the Sbus register. 2008-11-20 20:56:56 +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
plunky c4df96ad44 change licence of my old code to two-clause BSD licence
remove my name from advertising list
2008-07-02 10:16:20 +00:00
cegger 708f88d69f use device_lookup_private to get softc 2008-06-12 23:06:14 +00:00
drochner 1a9e64b4a7 mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
2008-06-11 21:25:31 +00:00
cegger 96434039ad - use device_lookup_private to get softc
- ansify
fixes build errors about pointer type mismatches in assignment
2008-06-11 18:50:59 +00:00
mrg c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
ad 5e4b324300 Properly fix the "hanging in tty" bug that was worked around with cv_wakeup()
some time again.
2008-05-25 19:22:21 +00:00
macallan 84e564d335 device_t 2008-05-17 18:09:03 +00:00
macallan dcb185e70d unbork previous by actually using CFATTACH_DECL_NEW(). Doh. 2008-05-17 17:55:50 +00:00
macallan a4e1a9b84e magic number reduction - no functional change 2008-05-17 02:00:08 +00:00
macallan f0f02f069c don't map more video memory than we really need 2008-05-17 00:22:31 +00:00
macallan 0c74b4e4a7 struct device * -> device_t 2008-05-16 15:57:21 +00:00
macallan e3c6619b77 struct device * -> device_t 2008-05-16 15:38:20 +00:00
macallan 042c09add2 move to 2 clause license 2008-05-09 03:12:49 +00:00
jdc 93d3122a7c Add more initialisation steps (read reset register; pause; set burst size
in config register).

This fixes the continuous interrupt stream previously seen.  It is now
possible to run `ifconfig gem0 up`.  However, "gem0: device timeout"
messages appear and we don't appear to receive any interrupts.
2008-05-06 21:24:40 +00:00
xtraeme dd178c786e mii_dev is a device_t now. 2008-05-04 17:14:41 +00:00
ad bf6eb72289 Another compile fix. 2008-04-29 18:07:11 +00:00
martin cf6ae11aea Pass the "right" softc to the soft interrupt handler 2008-04-29 15:59:34 +00:00
martin 682d4acc5f Make it compile 2008-04-29 14:46:57 +00:00
ad cef4f8fa35 Use sparc_softintr to pass down device interrupt to the correct IPL.
MI slowpath softints are fine for notifications but have to much latency
to provide the card with the next block to play/record. PR kern/37540.
2008-04-29 14:10:00 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
jdc 313a56c040 Set (and display) the chip revision.
Set the GEM_SUN_GEM flag.
2008-04-28 20:07:39 +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
tsutsui 968ad4b4c3 Since device_t is split out from softc, we have to allocate struct device
separately after allocating struct lsi64854_softc to fake it. (untested)

"lsc->sc_dev is not initialized" is pointed out by martin@.
2008-04-23 13:37:19 +00:00
ad 185116891b Don't send signals from a hardware interrupt handler. XXX This is still
dodgy, because sc->sc_asyncproc can exit and we don't find out about
that.
2008-04-21 00:30:21 +00:00
tsutsui 78a1d236b6 Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
2008-04-13 04:55:52 +00:00
cegger 0f2aceb852 use device_xname() and get rid of isp_name 2008-04-07 19:21:55 +00:00
cegger 4c5fa20d1f use aprint_*_dev and device_xname 2008-04-05 18:35:31 +00:00
tsutsui d9941582bf Split device_t/softc for le(4) and variants and misc cosmetic changes. 2008-04-04 12:25:06 +00:00
jdc 479872d6de Check the "shared-pins" property for the value "serdes".
Makes SBUS GEM 1000Base-SX cards attach.
2008-03-22 23:37:32 +00:00
mjacob 0e65dd74d1 Checkpoint of some fairly major isp(4) rototilling.
Reintroduce more of a 'channel' concept in preparation for NP-IV support.
This gets rid of the chanA/chanB concept as the 2400 can have up to 128
virtual channels. Actually, with MID firmware you can also have the 2200
and 2300 support 'channels, but they do it with an FL-Port topology.
Because FC cards can now have 'channels', just about every support
function for fibre channel had to be redone to have a channel index
as well.  Rototill isp_ioctl.h for channel stuff as well.

Pick up a lot of work about fabric management (hopefully better) and keep
work in place that will allow for dynamic attachment/detachment of devices
(if I can figure out how to make the midlayer support it).

Merge the target code with external trees. Eventually it might even
be sorted out on NetBSD.

Update some firmware stuff.
2008-03-11 05:33:30 +00:00
mjacob f481874c89 Don't panic if you can't find the corresponding DMA device- just don't
configure the device.

It turns out that if you have a SUNW,fas card installed, the assumption
that dma devices pair with esp devices is then broken, but that's a problem
to fix another day.
2008-03-08 04:25:30 +00:00
nakayama 7817256e3e Fix previous.
sc_rsel and sc_wsel are in bpp_softc, not in lsi64854_softc.
2008-03-02 15:54:58 +00:00