Commit Graph

25156 Commits

Author SHA1 Message Date
haad
57fb98e3bf Fix build on amd64. Patch sent by dieter roelants. 2009-04-06 22:48:26 +00:00
mkirby
ff12b9febc Add a Czech (QWERTY) keyboard layout, and teach wscons about latin 2 characters.
Original code from Lubomir Kundrak, adapted to current and cleaned up by me.

Fixes PR kern/16216

ok agc@ jdc@
2009-04-06 17:32:09 +00:00
cegger
56ce1b94f8 buildfix: include <sys/device.h> for device_t 2009-04-05 09:56:16 +00:00
cegger
b61989a8ff buildfix: include <sys/selinfo.h> for struct selinfo. 2009-04-05 08:33:04 +00:00
uwe
6a2ffc8f1b Provide pmf(9) hooks that do what dopowerhooks(9) hook does.
XXX: Do NOT call pmf_class_network_register() yet, b/c db8320.c
doesn't provide if_stop method!
2009-04-05 03:37:07 +00:00
uwe
4e37bb5a9c Register with pmf(9), tell it we don't need anything. 2009-04-05 02:29:40 +00:00
uwe
b22b1f73c6 Register with pmf(9), tell it we don't need anything. 2009-04-05 02:17:18 +00:00
uwe
fd239c627a Register with pmf(9). Thus we register with both dopowerhooks(9) and
pmf(9), but they are mutually exclusive (apm(4) vs apmdev(4)).

Express pmf(9) hooks in terms of dopowerhooks(9) hook - the reverse
would be more natural, but pmf hook signature is hidden behind
PMF_FN_ARGS/PMF_FN_CALL, so just go the least intrusive way for now.
2009-04-05 02:14:41 +00:00
uwe
2ec6410a85 Register with pmf(9), tell it we don't need anything. 2009-04-05 02:04:40 +00:00
uwe
12a9718711 Split device_t and softc. 2009-04-05 01:48:47 +00:00
uwe
fe0f5148ae Register with pmf(9), tell it we don't need anything.
btnmgr(4) is just a hub for other devices to plug into with
config_hook(9), there is no real hardware to manage.
2009-04-05 00:34:42 +00:00
ad
c6367674d6 Add fileops::fo_drain(), to be called from fd_close() when there is more
than one active reference to a file descriptor. It should dislodge threads
sleeping while holding a reference to the descriptor. Implemented only for
sockets but should be extended to pipes, fifos, etc.

Fixes the case of a multithreaded process doing something like the
following, which would have hung until the process got a signal.

thr0	accept(fd, ...)
thr1	close(fd)
2009-04-04 10:12:51 +00:00
ad
481ff5ace4 Fix problems with ccd:
- Pending async I/O was tossed on unconfigure (should not happen, but..)
- It could exhaust memory under heavy I/O load.
- If memory allocation failed, disk transfers could stall.
- v_numoutput was updated without v_interlock held.

Additionally:

- Make it MPSAFE.
- Use kmem_alloc().
2009-04-04 08:29:39 +00:00
dyoung
211e21b653 Stop dereferencing a dangling device_t pointer and crashing: skip the
drives flagged DRIVE_ATAPI in atabus_activate(,DVACT_DEACTIVATE) just as
we skip them in atabus_detach() and in atabus_childdetched().

Make atabus_detach() parallel attachment more closely by calling
config_detach() on the child chp->ata_drives[i] instead of on
chp->ch_drive[i].drv_softc.  Assert that ata_drives[i] and
ch_drive[i].drv_softc are equal, and set them both to NULL in
atabus_childdetached().
2009-04-03 21:31:08 +00:00
sborrill
5547ed1734 Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
2009-04-03 16:23:41 +00:00
uwe
30f9f983a3 Use dev/apm/files.apm for APM options in opt_apm.h.
Now both apm and apmdev files.apm can be included so you can switch
from apmdev0 to apm0 at hpcapm0 in your kernel config easily.
2009-04-03 05:01:09 +00:00
uwe
82442fe367 Treat OAPM_IOC_GETPOWER as APM_IOC_GETPOWER - from apmdev(4). 2009-04-03 04:25:40 +00:00
uwe
c03d662b39 Config glue for attaching apm at apmdevif.
Unfortunately dev/apm/files.apm and dev/hpc/apm/files.apm cannot be
included both at the same time (they define same options and config(1)
complains), so you need to comment out old code and uncomment new code
to be able to replace "apmdev0 at hpcapm0" with "apm0 at hpcapm0" in
your kernel config.
2009-04-03 04:21:51 +00:00
uwe
ea06597b80 Attachment glue to attach apm0 at hpcapm0.
Tested on Jornada 690.
2009-04-03 04:17:03 +00:00
uwe
9a25b0cb7f Switch apmdev to use apm(4) structures from dev/apm/apmvar.h.
Add batteryid argument to aa_get_powstat method implementations.
2009-04-03 04:13:17 +00:00
uwe
7cbde2c0d5 Further reduce diffs to dev/apm/apm.c.
Bring over remaining bits of logic not picked up in the first round.
Main semantic difference between the two that ramins is now basically
powerhooks vs. pmf.

Cosmetics to reduce diff noise: split apmattach into apmdevattach and
apm_attach, where the latter matches its counterpart in the real
apm.c.  Change local macros names from APMDEV* to APM*

Now that apmdev.c is demonstrably congruent to apm.c it should be
easier to switch hpc* and zaurus ports to apm.c from apmdev.c.
apmdev.c is one of the only two remaining drivers that call
dopowerhooks(9), the other one being arch/arm/xscale/pxa2x0_apm.c.

Ideally I would prefer for them to be interchangeable to smooth the
transition (in pmf world order *all* devices must have pmf hooks
registered), but they are attached differently - apmdev is separate
from its backend device (like hpcapm), while apm.c backends are
attachment glue, not separate devices.
2009-04-03 02:08:38 +00:00
dyoung
8f20e30696 Fix SIOCSIFFLAGS. Mark as safe to detach at shutdown. 2009-04-03 00:14:42 +00:00
dyoung
30156f20e6 Cosmetic changes, only, to clarify and to save a couple of lines: return
a constant, 0, instead of returning ret when it is always 0.  Wait to
initialize ret until we really need to.
2009-04-02 01:06:49 +00:00
dyoung
b783d8bd8c Add the WEP capability to our net80211 capability flags, since we do
sort of support hardware WEP.  Only change the WEP key index in a Tx
descriptor from 0 if the type of our transmit key is _WEP, not _TKIP:
i.e., only if we're really doing WEP crypto in the hardware.

Ignore a watchdog timeout on any Tx ring if we can collect some packets
from that ring.  Restart both the receiver and the transmitter when a
watchdog timeout occurs instead of restarting only the transmitter.
2009-04-02 00:57:20 +00:00
dyoung
726f95dae4 I find myself making a lot of changes in this code to keep it compiling
and (let us hope) working in the 21st century, so I have put it through
unifdef -D__NetBSD__ -U__FreeBSD__ so that it is less of a chore to read
and to maintain.
2009-04-02 00:39:37 +00:00
dyoung
0d1ba3e899 During shutdown, detach devices in an orderly fashion.
Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks.  For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown.  Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags.  Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag.  The default for kern.detachall is 0.  SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress.  In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs.  Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
2009-04-02 00:09:32 +00:00
reinoud
42726265fe Implement MMC_TRACKINFO_DATA and MMC_TRACKINFO_AUDIO detection for cdrom and
dvdrom devices. These two compatibility codes were forgotten when those were
introduced.
2009-04-01 12:19:04 +00:00
drochner
0785c6f16e avoid tsleep also during shutdown (and in particular ACPI poweroff),
should fix PR kern/39141 by Takahiro Kambe and PR port-i386/41110
by Reinoud Zandijk
2009-03-31 17:17:47 +00:00
darran
d4dd9a671a Missed a small but important change to enable hardware VLAN support. 2009-03-31 06:58:55 +00:00
darran
0b4bf6c76b Enable the vlan code that thorpej@NetBSD.org added, and fix a bug where
the vlan tag was read from the rx descriptor after it was reinitialized
(and hence was always 0).  Hardware vlan support looks good tested
between two vmware clients.
With support from tls@NetBSD.org.
2009-03-31 04:16:57 +00:00
uwe
1cfa6cdc4e Split device_t and softc, use aprint_*, rename/reformat stuff to
minimize diffs to dev/apm/apm.c (even at the cost of uglification).

Tested on Jornada 690 (hpcsh).
2009-03-30 06:22:25 +00:00
uwe
e4d63225a1 Fix battery_state vs. battery_flags confusion.
Fill all fields of struct apm_power_info in hpcapm_get_powstat.
2009-03-30 06:17:39 +00:00
mrg
ac009d4632 drm_addmap():
- for _DRM_CONSISTENT mappings, keep the handle.
- use DRM_HANDLE_NEEDS_MASK()

drm_mapbufs():
- use DRM_HANDLE_NEEDS_MASK()

drm_mmap():
- use DRM_HANDLE_NEEDS_MASK()
- for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the
  adjusted offset. XXX


this is gets radeon working on amd64 with an older PCI 9250 card.

XXX: need to excise vtophys() usage.
XXX: need to finish porting these fixes to external.
2009-03-29 19:50:17 +00:00
mrg
7216702ebd add a radeon-x1550 (works as well as other rv5xx i guess.) 2009-03-29 19:39:50 +00:00
mrg
44475ef083 include the size in a falled allocation message. 2009-03-29 19:39:10 +00:00
mrg
4d1ad63f2e XXX: for now, add the DRM_NETBSD_HANDLE2ADDR() hack in a few places.
update a debug message.
2009-03-29 19:37:25 +00:00
mrg
b9bbc2157f add a comment explaining DRM_NETBSD_ADDR2HANDLE/DRM_NETBSD_HANDLE2ADDR:
* This hack strips the top bit from amd64 addresses, which avoid
 * udv_attach() returning NULL for "negative" offset.
 * A better hack would be to encode the offset of some kernel data
 * structure..

add a new DRM_HANDLE_NEEDS_MASK macro to check whether the above need to
be applied for various mapping types (_DRM_SHM and _DRM_SCATTER_GATHER.)
2009-03-29 17:00:50 +00:00
msaitoh
60500a38d2 Add workaround for 82543GC.
We need to force speed and duplex on the MAC equal to what the PHY
speed and duplex configuration is. Fixes PR#36430.
2009-03-29 16:22:17 +00:00
tsutsui
2273829d51 Don't assume all RX packets have VLAN headers even if vlanif is configured.
Instead, always check ether_type and use appropriate offsets to adjust
the hardware RX sum value.

XXX: vlan(4) doesn't seem to use csum_data and csum_flags in mbufs anyway.
2009-03-29 07:33:52 +00:00
tsutsui
768601d6e6 Get width, height, and linebytes values from prom_getpropint(). 2009-03-29 07:24:56 +00:00
dholland
3781289e95 Merge patch from PR 12605, which tidies up allocation of transmit DMA maps.
Generalize it to also tidy up allocation of receive DMA maps. And change a
few of the symbol names involved to (1) make sure all uses have been fixed
and (2) make it clearer what's actually going on.

Previously the driver was using DMA maps off the free list without fully
allocating them, apparently in order to save two or three lines releasing
them on error paths. According to the submitter of the PR (H.Saito) this
was causing it to reuse a map already in use when under load, resulting
in panics.

I'm not sure if that ought to have been possible or if it reflected an
interrupt handling bug somewhere else, but the change is an improvement
regardless, so we'll go with it.

Compile-tested only, but I've crosschecked the diffs and all that and it's
a pretty noninvasive change.

(Is anyone actually using this driver rather than tlp?)
2009-03-29 05:26:43 +00:00
tsutsui
0ab04c94e6 Fix another botch in hwcsum changes for PR kern/40955:
8168/8111/8168B/8111B doesn't have DESCV2.

Problem reported by Arto Huusko on current-users@.
2009-03-28 22:16:08 +00:00
dyoung
858d3b857c If a sip(4) is powered down, then so is its PHY, so don't try to read
media status from the PHY.
2009-03-27 16:45:53 +00:00
dyoung
590c39d0f3 For legibility, unifdef -U__FreeBSD__ -D__NetBSD__. This compiles, but
it is not run-tested.
2009-03-27 16:15:24 +00:00
dyoung
7377de8f1d Make this build on -current. 2009-03-27 16:10:50 +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
tsutsui
030266c11f Check a correct bit for ip4csum-rx. Reported privately on PR kern/40955. 2009-03-27 12:19:17 +00:00
dholland
c963cec011 Add the other three PCI ids for the nvidia MCP65 SATA controller to
the quirk table. This way they attach as ahcisata and work, instead of
attaching as viaide and failing miserably.

Fixes PR kern/37826.

XXX: There are a bunch of additional MCP67 and MCP73 PCI ids that
XXX: should probably be added also, but I don't want to do that without
XXX: further investigation and testing.
2009-03-27 06:36:49 +00:00
cegger
8c5327a270 use auto-negotiation for manual media type selection.
This should fix establishment of 10/100Mbps link on L1E.
Helpful to reduce watchdog timeout problems on L1 (age(4)) reported by Jochen Kunz.
From FreeBSD via OpenBSD.
2009-03-27 04:42:50 +00:00
dyoung
b63bf39017 It is only by chance that this gets the prop_array_t definition that it
needs, so explicitly #include <prop/proplib.h>.
2009-03-25 23:35:54 +00:00