<sys/device.h> now requires <sys/mutex.h> for struct device_lock, and
<machine/mutex.h> requires <machine/intr.h> for ipl_cookie_t, so
including <sys/device.h> from <machine/intr.h> causes recursive dependency.
elansc_attach().
Let us detach gpio0 at elansc0.
Let us re-attach pci0 at elansc0.
Reduce code duplication between elansc_rescan() and elansc_attach():
call _rescan() from _attach() to attach elanpex0, elanpar0, gpio0, and
pci0.
Thomas Klausner.
Do not compile in the local variable "mba" in mainbus_rescan unless
NPNPBIOS > 0 || NACPI > 0 || NIPMI > 0 || NMCA > 0. This fixes the
build on systems such as Soekris where none of those options apply.
devices that attach at acpi(4).
Begin deriving an acpi(4) device-detachment hook, acpi_detach(), from
acpi_attach(). The code between #if 0 and #endif still needs to be
turned to the opposite calls (enables to disables, maps to unmaps,
attaches to detaches), which should be run in the opposite order.
Somebody with deep ACPI knowledge can probably finish this off without
too much trouble.
corresponding attimer(4) resource is not perpetually busy: now it
is possible to detach and to reattach pcppi(4). Make attimer(4)'s
device-detachment hook return EBUSY if pcppi(4) is still attached, so
that pcppi(4) cannot end up with a dangling pointer to attimer(4).
Extract code from mainbus_attach() to create a rescan hook,
mainbus_rescan(). Call mainbus_rescan(, "acpibus"/"ipmibus"/..., ) from
mainbus_attach() in the precise places where we used to attach acpi0,
ipmi0, pnpbios0, and mca0. This allows, for example, ipmi0 to detach
and re-attach:
# drvctl -d ipmi0
ipmi0: detached
# drvctl -r -a ipmibus mainbus0
ipmi0 at mainbus0
#
Future work will let us detach & re-attach CPUs and the ISA/PCI/EISA
buses at mainbus0.
- Fix SWDPIN(1)'s polarity on some chips.
- Fix flow control stuff (includes PR#32009).
- Stop RXCFG storm. It ocours easily.
- And more fix about autonego.
Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
- Fix panic in mediachange.
- Fix SWDPIN(1)'s polarity on some chips.
- Fix flow control stuff (includes PR#32009).
- Stop RXCFG storm. It ocours easily.
- And more fix about autonego.
Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
entire image.
Benefits:
* the whole image does not need to fit into VA
* a core dump is not of gargantuan proportions
Performance is pretty close to one whopping mmap. I'll finetune
the parameters later, although the current ones seem pretty good
in initial testing.
don't forget to set m_len to 0. Otherwise whatever will compute the size
of this chain (including s_split() itself if called again on this chain)
will get it wrong, leading to various issues.
Bug exposed by the NFS server code with linux clients using TCP mounts.
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.
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)
context (reported on various mailing-lists, and part of PR kern/41114,
causing panic in pf(4) and possibly ipf(4) when BRIDGE_IPF is used).
Defer bridge_forward() to a software interrupt; bridge_input() enqueues
mbufs to ifp->if_snd which is handled in bridge_forward().
- 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().
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().
dirent is no longer cached in lookup and we do the lookup ourselves
in rename, we are most definitely not allowed to assert that it
matches the source vnode passed as an argument. In case the source
node does not exist or has been replaced, punt with ENOENT.
Also, nuke some misleading prehistoric comments which haven't been
valid in over a year.
Fixes PR kern/41128 by Nicolas Joly
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.
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.
RT_ prefix and use them appropriately, instead of making copies. Make
pppd use the RT_ROUNDUP macro; fixes proxyarp setting on 64 bit hosts.
XXX: All this should be pulled up to 5.0
provided is "too large" (log10(2^64) = 19).
(It can still overflow if the input value is close to 2^64 but I don't
consider this a problem.)
fixes nonsense displayed as "total memory" on boot
panic described in PR kern/40948.
As usual, all the error branches in rename live based on an unholy
amalgamation of prayer and the blood of cute, furry and tasty
quadrupeds, so I won't even attempt to audit the rest.
And this wapbl rename really really needs to be merged with the
standard rename. That should be a fun PhD thesis topic ....
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.
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.
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.
Note the vlan interface does not see updates to the parents capabilities
so if, for example, TSO is on in both, then turned off in the parent it
will remain on in the vlan interface.
1) invoke objcopy with --preserve-dates or it will update all the
dates in the .a file to the present date.
2) add an invocation of ar-as-ranlib or the object file index ends up
with the date in it. (it might also end up with an incorrect
index.)
The broken probe was causing the VIA padlock driver to never attach!
Now we can see that its AES appears to be broken -- it makes FAST_IPSEC
ESP not work, on systems where it works fine with cryptosoft.
Rework code to detect and (if necessary) enable VIA crypto and RNG.
Add RNG support to VIA padlock driver. In the process, have a quick
go at debugging the AES support but no luck thus far.
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.
revision 1.17
date: 2009/03/29 19:50:17; author: mrg; state: Exp; lines: +7 -7
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.
yay! this takes care of one of the XXX's. still not quite working.
- fix a DEBUG message
- apply from sys/dev:
revision 1.20
date: 2009/01/18 10:04:35; author: mrg; state: Exp; lines: +6 -2
Don't attempt to unload a DRM device that's in use. (Note:
Unloading doesn't work right in any case -- it doesn't clean up the
sysctl tree, among other things. This code needs Work, but at least
this prevents it crashing randomly due to autounload while X is
running.) Also, fix the dependency list for radeondrm.
contributed anonymously.
revision 1.11
date: 2009/03/29 19:50:17; author: mrg; state: Exp; lines: +9 -6
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.
however, this doesn't get radeon working on amd64 here :(
revision 1.14
date: 2009/03/29 19:39:10; author: mrg; state: Exp; lines: +4 -3
include the size in a falled allocation message.
- use BUS_DMA_ALLOCNOW in bus_dmamap_create() call
- remove a redundant check for NULL
revision 1.33
date: 2009/03/29 17:00:50; author: mrg; state: Exp; lines: +12 -4
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.)
also:
- use IPL_VM for now
- use a lot of bus_space
- struct drm_device now has a pointer to the device_t
revision 1.12
date: 2009/03/29 19:37:25; author: mrg; state: Exp; lines: +9 -3
XXX: for now, add the DRM_NETBSD_HANDLE2ADDR() hack in a few places.
update a debug message.
- 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.
* 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.)
- atime updates were not being synced.
ffs_sync:
- In some cases the sync vnode was acting like now dead /usr/sbin/update.
It was examining vnodes that it should have ignored.
- It would find dirty inodes and try to flush them. Often ffs_fsync()
cheerfully ignored the flush request due to the fsync bug. Such inodes
remained dirty and were repeatedly re-examined by the syncer until
vnode reclaim or system shutdown.
- We were marking our place in the per-mount vnode list even though in
most cases there was not flush to perform. While not a bug, this wasted
CPU cycles because a TAILQ_NEXT would have sufficed.
This will be used to support TLS. The MD method must match the ELF TLS spec
for that CPU architecture (if there is a spec).
At this time it is only implemented for i386, where it means setting the
per-thread base address for %gs. Please implement this for your platform!
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.
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?)
signals (i.e. SA_KILL), just if SIGKILL (or SIGCONT). Improve comments.
Make some functions static, remove unused sigrealloc() prototype.
Fixes PR/39814. Similar patch reviewed by <ad>.
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)