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)
- 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().
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.
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.
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.
- 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.)
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?)
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.
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.
-Add some known CHIPID entries.
-Add a code for BCM5906 into bge_chipinit(). We have to do more work for
BCM5906.
-Fix the case of setting a flag in BGE_PCI_DMA_RW_CTL (on conventional PCI).
attach pcmcia devices before interrupts are enabled. This is unclean
because pcmcia drivers use tsleep(9) in the attach code path but it
worked all the time and it is too late to change this on the 5.0 branch.
So just tolerate it.
Fixes a regression on hpcsh reported by Valeriy E. Ushakov.
per device info taken from FreeBSD driver. Tested by snj@ on 8111C.
Should closes PR kern/40955.
Note on old 8169 chips IP hw csum must be enabled to use TCP/UDP hw csums,
but I'm not sure if these newer chips still have the same restriction.
so check for a non-NULL configuration descriptor before dereferencing.
Should fix a crash reported by Nicolas Joly per PR kern/41048.
(It still doesn't look good that the ioctl which unconfigures the device
returns EIO -- either it is legitimate or it isn't -- but since this
is a pullup candidate I don't dare to change user visible behaviour.)
z8530sc.c:
Check pending interrupts in a loop until all requests are handled.
The old comments said it would cause horrible latency to sun3x floppy etc,
but serial ports should have higher priority than disks anyway.
z8530tty.c:
Don't enable and disable TX interrupts on each transmit start and completion
because it could cause possible race conditions.
Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
as other kbd drivers attached at zs(4).
Tested on cobalt, macppc, news68k, sparc, and sun3.
device will remain in a wait-for-more-stuff-to-be-written state delaying other
SCSI calls, esp. some read-size or read-layout calls, until its told there is
no more comming.
To fix this, on last close explicitly flush the caches releasing the device
from this mode and allowing other SCSI commands to reach it.
This fixes PR 40528
> Fix a bug in calculation of checksum deduction:
> - To get 16 bit one's complement value from uint32_t variable,
> higher 16 bits should be ignored.
> - RFC 1624 describes methods to recalculate checksum field in headers,
> i.e. one's complement of one's complement sum that could be 0x0000,
> but we don't have to use the strategy to deduct one's complement sum
> itself which won't be zero but should be 0xffff.
- To get 16 bit one's complement value from uint32_t variable,
higher 16 bits should be ignored.
- RFC 1624 describes methods to recalculate checksum field in headers,
i.e. one's complement of one's complement sum that could be 0x0000,
but we don't have to use the strategy to deduct one's complement sum
itself which won't be zero but should be 0xffff.
Found on debugging mec(4) on sgimips O2.
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.)
- bus_dmamap fixes, with checks against NULL
- move the rings' allocation code later in iwi_attach() to avoid NULL pointer
dereference if allocation fails
- avoid double free() in case of failure during attach. If an allocation fails,
do not free the ring directly, as it is handled by iwi_detach()
- only set ring->count for RX/TX rings when ring allocation is successful, or
else the for loop during detach will fail with a NULL dereference.
- call pci_intr_disestablish() if iwi_reset() fails during attach; driver is
in an incoherent state, interrupt handler should not be used.
Proposed by me on tech-net@, approved by christos@. Compiled and tested
with GENERIC and XEN3_DOM0 kernels.
in IP headers, so we have to deduct not only IP option headers but all
IP headers. But in TCP/UDP layer we can assume the IP header is valid
and a sum of the IP header part should be 0xffff, so we don't have to
bother to deduct it from the computed checksum.
which don't have EXT_RFA and IPCB support. From hme(4) driver and
FreeBSD's fxp(4). Tested on i82559.
XXX: Probably we should have a common function to parse RX packet headers
XXX: to handle a raw checksum value and share it among hme(4) and gem(4) etc.
already powered down. This change prevents PCI bus exceptions
(indicated by NMI) when, for example, I detach the whole device
tree on a Soekris net4521:
com1: detached
NMI ... going to debugger
Stopped in pid 0.1 (system) at netbsd:sipcom_stop+0x4d: pushl $0
db{0}> continue
NMI ... going to debugger
Stopped in pid 0.1 (system) at netbsd:sipcom_stop+0x149: addl $0x10,%e
sp
db{0}> continue
sip0: detached
(On the AMD Elan SC520, the NMI occurs at the instruction after
the write or, if the write was posted, at either that instruction
or some later one.)
enabled:
- don't enable interrupts before calling uhci_run()
- check if the controller's interrupt is enabled in uhci_intr()
The issue is that uhci_run() may tsleep(), uhci_intr1() may be called before
uhci_run() is complete and disable it because it found it halted.
Now a uhci controller can be successfully exported to a NetBSD Xen domU :)
not 82550, so don't set FXPF_EXT_RFA (available only on 82550/82551)
for those variants.
Tested on Intel PRO/100 VM with 82562EM/EX PHY by ISHII Kimio
on current-users, and should also fix PR kern/40431.
because EXT_RFA for RX cksum is always available with IPCB for TX cksum
but i82558 and i82559 have only EXT_TXCB without IPCB.
Tested on the following fxp cards:
fxp0 at pci0 dev 14 function 0: Intel i82557 Ethernet, rev 2
fxp0 at pci0 dev 14 function 0: i82559 Ethernet, rev 8
fxp0 at pci0 dev 14 function 0: i82550 Ethernet, rev 12
when bus_dmamap_create fails, then the map pointer is undefined.
age_dma_free() assumes, the map pointer is NULL. Make the assumption
always true by setting the map pointer to NULL in bus_dmamap_create()
error path in order to prevent age_dma_free() to call bus_dmamap_destroy()
on an invalid map.
to 2 for now. strategy routine must be written, for now only parsing and
support routines are available. This is work in progress code and should be
taken very carefully.
interrupt map, interrupt handler and dma maps.
Also prevent call to bus_dmamap_destroy() when bus_dmamap_create() failed.
The nfe_free_* routines assume, the map pointers are NULL but they
are actually undefined. Make the assumption true by making them NULL
in the error path of bus_dmamap_create().
All together, this fixes crashes when nfe_attach() fails.
ok martin@
disk queue is being held. Work around this by dropping the lock before
bdev_strategy(), and re-grabbing the lock afterwards. This is a
temporary measure until I get to gutting this queue locking code.
There has been some success with this in addressing PR#39993.
This patch is from Antti Kantee. Thanks!
via ECDT, we would print:
acpiec0 at acpi0 (EC, PHP0C09-0): ACPI Embedded Controller (disabled)
The embedded controller isn't actually disabled, but instead this driver
instance, so change the message to read:
acpiec0 at acpi0 (EC, PHP0C09-0): using acpiecdt0
Not directly related to the PR but this bug was discovered while testing.
In azalia_stream_halt, invalidate the intr ptr to prevent a race condition
where azalia_stream_intr can jump off into lala land during stream shutdown.
based on cgsix). Original commit message:
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
monstrous if-then-else-if constructs.
2. Display module capacity in GB if it is at least 1GB.
3. Indicate if a memory module is "registered".
4. For DDR3, indicate if a temp-sensor is present.
Inspired by similar changes in OpenBSD's spdmem(4).
conditional on FXPF_EXT_TXCB, so, replace all uses with that
- for the pci frontend, reestablish some flags lost the the prior
changes and simplify one of the cases
this fixes PR 40677 and may fix PR 40431.
resources on the same line as autoconf messages. Things like:
pcppi1 at acpi0 (SPKR, PNP0800)
pcppi1: io 0x61
become:
pcppi1 at acpi0 (SPKR, PNP0800): io 0x61
IEEE 802.3 Annex 28B.3 specifies the following relative
priorities of the technologies supported by
802.3 Selector Field value:
1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T
Our drivers give 100BASE-T4 a higher priority than
100BASE-TX full duplex.
Fix this. This patch is based on changes in FreeBSD and OpenBSD.
Patch presented on tech-kern and tech-net:
http://mail-index.netbsd.org/tech-kern/2009/02/15/msg004397.htmlhttp://mail-index.netbsd.org/tech-net/2009/02/15/msg001064.html
got no comments, no objections.
bus driver's match function to return a higher confidence (so it can
beat out vga(4), for example). genfb needs-flag so md code can determine
if the genfb driver is present.
wsmouse(4) can attach directly at arckbd(4) and I can dispose of the
ugly arcwsmouse(4) and arcwskbd(4) interpositions. Do that, and purge
them from the documentation as well.
Old:
piixpm0 at pci0 dev 20 function 0
piixpm0: ATI Technologies SB600/SB700/SB800 SMBus Controller (rev. 0x13)
piixpm0: interrupting at SMIpiixpm0: polling
New:
piixpm0 at pci0 dev 20 function 0
piixpm0: ATI Technologies SB600/SB700/SB800 SMBus Controller (rev. 0x13)
piixpm0: interrupting at SMI, polling
Cosmetic change only, no functional changes intended.
to the device's cache anyway and so cmdh_prdbc reports a completed
transfer. If we use it to update ata_bio->bcount this has 2 conseqences:
- the automatic LBA48 workaround doesn't qick in because bcount is used
to compute the last sector of the transfer (wd(4) part of kern/40569)
- wd(4) will report a B_ERROR buffer with a b_resid of 0, which panics
a DIAGNOSTIC kernel
Fix by ignoring cmdh_prdbc if we had a write with errors, and in this case
leave ata_bio->bcount at its initial value.
While there use NOERROR instead of 0 for ata_bio->error (cosmetic).
thanks to Matthias Scheler for tests.
we need to account for that. Failure to do so means we can end up
waiting forever for writes we think are outstanding, but which have
already completed.
Addresses the RAIDframe part of PR#40569. Thanks to Matthias Scheler
for reporting the issue and verifying the fix.
LBA 48 work around. The first entry will watch the Seagate ST3160815AS
(and similar models), the second one HP's OEM version of the same drive.
This avoids the RAID rebuild problems described in PR kern/40569.
can be called _before_ we've identified the chip. Ensure that sc_chip
is initialized to NULL before chip is identified, and if it is NULL or
ADM1027, use the less-efficient send_byte/receive_byte.
While here, don't attempt to release the i2c bus if we failed to acquire
it. This would cause a panic on a LOCKDEBUG kernel.
Thanks to Nicholas Joly for pointing out both of these bugs.
device doesn't support flushing the cache. Fixes an issue (reported
privately) where ST39120A drives are not capable of flushing the
cache, and RAIDFrame was incessantly complaining.
- renamed to MEMORY_DISK_RBFLAGS to better fit the rest of the
MEMORY_DISK options(4)
- change default value to RB_AUTOBOOT instead of RB_SINGLE, and adapt
the config(5) files accordingly
- document this option inside options(4)
See also http://mail-index.netbsd.org/tech-kern/2008/12/25/msg003924.html
Reviewed by abs@ in private mail.
shutting down -- this is only supposed to happen from the pcmcia
kernel thread while the system is running
-in wd_shutdown, call ata_addref first, so that the adapter is either
active or we know that it isn't
This fixes a hang on shutdown-p reported by Dennis den Brok per
PR kern/40531. Verified by by Dennis and me.
(reported against 5.0-Beta, so this is a pullup candidate)
handler for them.
Don't override the latency timer set for us by the CardBus code.
Add a bit of debug code for the Function Event Registers, #if 0'd
out for now.
Cosmetic: remove gratuitous parenthesization of return statements.
Change the indentation of the struct atw_pci_softc definition.
Use a more meaningful variable name, et cetera.