Commit graph

13781 commits

Author SHA1 Message Date
Warner Losh ad4f426ef6 Make sure that we call if_free(ifp) after bus_teardown_intr. Since we
could get an interrupt after we free the ifp, and the interrupt
handler depended on the ifp being still alive, this could, in theory,
cause a crash.  Eliminate this possibility by moving the if_free to
after the bus_teardown_intr() call.
2005-09-19 03:10:21 +00:00
Warner Losh 62e428c42e MFp4:
o eliminate the ED_NO_MIIBUS option.  Now, you need miibus to use ed with
  pccard.  If you have an old ISA or PCI card w/o a miibus, then you'll still
  be able to use the ed driver w/o miibus in the kernel.  If you have pccard
  you'll need mii now.  Most pccards these days have miibus, and many
  cards have ISSUES if you don't attach miibus.  issues I don't want to
  constantly rediagnose.
  - Add new media_ioctl, mediachg and tick function pointers.  The core
    driver will call these if they aren't NULL, or return an error if they
    are.
  - migrate remaining mii code into if_ed_pccard.
o include some notes from my datasheet fishing.  this may allow us to
  get media status from some pccards.
o Fix one bug that's common to many drivers.  call if_free(ifp) after
  we tear down the interrupt.  ed_intr() depends on ifp being there and
  freeing it while interrupts can still happen is, ummm, bad.
2005-09-18 20:51:34 +00:00
Olivier Houchard 30ce1aad9c Slightly change the API for the SNPSTTY ioctl so that the userland now
provides a file descriptor instead of a dev_t.

Discussed with:	phk
MFC after: 3 days
2005-09-18 19:23:35 +00:00
Alexander Leidinger edffb4c891 Add the KLD to the sndstat info. 2005-09-18 15:38:40 +00:00
Alexander Leidinger c61957b5fb Merge NetBSD fixes (except for 1.97 there should be no functional change):
1.94: ansify and KNF (NetBSD KNF).
	1.95: Fix DPRINTF (bug from change in 1.94).
	1.96: NetBSD specific.
	1.97: Fix memory leak reported by Ted Unangst as bug #3 on tech-kern.

Obtained from:	NetBSD
2005-09-18 15:13:06 +00:00
Marius Strobl 1f317bf968 - In gem_ioctl() move the call to ether_ioctl() to the default case of
the switch statement in order to make this driver more like other
  Ethernet NIC drivers.
- In gem_attach() call gem_stop() in addition to gem_reset() to make
  sure the chip actually is stopped and not just reset.
- In gem_stop() also stop the gem_rint_timeout() callout in case the
  driver is compiled with GEM_RINT_TIMEOUT defined.

Merge some locking improvements from hme(4):
- Use callout_init_mtx() to close races between gem_stop() and gem_tick()
  as weel as gem_stop() and gem_rint() in case the driver is compiled
  with GEM_RINT_TIMEOUT defined.
- Use the driver lock instead of Giant in a bus dma callback.
- Lock the driver lock around mii operations.
- Cleanup locking in gem_ioctl().
- Remove redundant assertions that the driver lock is not held in
  gem_attach() and gem_detach() since mtx_lock() will assert that
  already since the driver lock is not recursive.
- Add callout_drain()'s to gem_detach() after calling gem_stop() to make
  sure that if softclock is running on another CPU and is blocked on our
  driver lock, we will wait until it has acquired the lock, seen that it
  was cancelled, dropped the lock, and awakened us so that we can safely
  destroy the mutex.
2005-09-18 13:23:19 +00:00
Alexander Leidinger d4c4f2c099 ehcivar.h:
Synchronise with NetBSD upto rev 1.19:
		- Allow 32 chars in the saved vendor string.
		- Some NetBSD-only changes.
		- Some missing parts (define, variable).

ehci_pci.c:
	Add vendor ids for ATI and Philips.

	Add identification strings for the following:
		o ALi's M5239
		o AMD 8111
		o ATI SB200, SB400
		o Intel 6300ESB, ICH4, ICH5, ICH7
		o NVIDIA nForce 2, nForce 3, nForce 4
		o Philips ISP156x

ehcireg.h:
	We're at the same level as rev 1.18 from NetBSD.

usb_port.h:
	NetBSD/OpenBSD specific things

Obtained from:		NetBSD via DragonFly
No comment from:	usb@
2005-09-18 11:45:39 +00:00
Damien Bergamini 0b74a28506 o Add initial bits for IBSS support.
o Allow association with APs that do not broadcast SSID (with hints from
  Nick Hudson and Hajimu Umemoto).
o IFQ_DRV_PREPEND mbuf when h/w ring is full so it can be sent later.
o Increment if_oerrors when appropriate.
o Did some cleanup while I'm here.

MFC after:	1 day
2005-09-17 12:41:05 +00:00
Eric Anholt e3e1ac8615 Add a new AGP driver for ATI IGP chipsets. The driver is based on reading of
the Linux driver, since specs are unavailable.  Many thanks to Adam Kirchhoff
for multiple useful testing cycles, and Ralf Wostrack for the final fix to get
it working.

PR:		i386/75251
Submitted by:	anholt
2005-09-17 03:36:47 +00:00
Eric Anholt 695b15ca91 Fix agp_nvidia.c to behave more like the linux driver, fixing DRI on Radeon
9200 according to one responder.  The primary issue was not setting some bits
to say that the entries were active, but also fix one place where some memory
wasn't being used as volatile as it should.  While here, change some use of ffs
to a relatively short case statement, to make it more obvious what's going on.

PR:		kern/71638, kern/72372, kern/71547?
Submitted by:	Andrew J. Caines <A.J.Caines@halplant.com>,
		Robin Schoonover <end@endif.cjb.net>,
		Jason Henson <jason@ec.rr.com>
2005-09-16 22:59:47 +00:00
Ruslan Ermilov fead0681ed Fix "struct ifnet" leak if attach() fails in the middle. 2005-09-16 12:49:06 +00:00
Ruslan Ermilov 330fd412b5 Avoid deferencing NULL in if_free(). 2005-09-16 12:17:12 +00:00
Ruslan Ermilov ad61f89618 Fix "struct ifnet" leaks when attach() fails in the middle. 2005-09-16 11:25:19 +00:00
Ruslan Ermilov 3badacee8c Fix "struct ifnet" leaks when attach() fails in the middle, e.g.
when mii_phy_probe() or bus_setup_intr() fails.  For drivers that
call their detach() in this case, call if_free() there to cover
this case too.
2005-09-16 11:11:51 +00:00
Ruslan Ermilov c4c6f08f68 Fix "struct ifnet" leak on detach. 2005-09-16 10:09:23 +00:00
Ruslan Ermilov 4180ad4d15 Add missing mtx_destroy() when if_alloc() fails.
Add missing if_free() when mii_phy_probe() fails.
Put if_free() into the correct #ifdef in detach().
2005-09-16 09:20:58 +00:00
Ruslan Ermilov 94a7d18b08 Add missing if_free() in rue_detach(). 2005-09-16 09:16:46 +00:00
Warner Losh dca2069084 Commit a workaround to a problem with resource allocation. This helps
with some Dell servers that booted w/o a problem[*] on 5.4, but failed
with 6.0-BETA.

On the PCI bus, when we do lazy resource allocation, we narrow the
range requested as we pass through bridges to reflect how the bridges
are programmed and what addresses they pass.  However, when we're
doing an allocation on a bus that's directly connected to a host
bridge, no such translation can take place.  We already had a fallback
range for memory requests, but none for ioports.  As such, provide a
fallback for I/O ports so we don't allocate location 0, which will
have undesired side effects when the resources are actually used.

This fixes a problem with booting a Dell server with usb in the
kernel.  However, it is an unsatisfying solution.  I don't like the
hard coded value, and I think we should start narrowing the resources
returned to not be in the so-called isa alias area (where the ranage &
0x0300 must be 0 iirc).  Doing such filtering will have to wait for
another day.

This may be a good 6 candidate, maybe after its had a chance to be
refined.

Tested by: glebius@
2005-09-16 07:02:29 +00:00
Ruslan Ermilov 5ae7c95cc3 Add two missing if_free() calls. 2005-09-15 20:06:44 +00:00
Ruslan Ermilov 35fb201bbe Fixed a diagnostic message. 2005-09-15 19:41:03 +00:00
Ruslan Ermilov 68485ac9b4 Spell "destroy" correctly. 2005-09-15 19:34:12 +00:00
Ruslan Ermilov 72293673f0 Don't recommend re_detach() (like in vr(4)) as another
possible method to prevent panicing in interrupt handler
after re_shutdown(), sometimes seen on SMP systems.
This would work here only because re_detach() clears
IFF_UP (to prevent another race) and it was demonstrated
that it's not enough to call vr_detach() in vr_shutdown()
to prevent a panic.
2005-09-15 19:07:10 +00:00
Ruslan Ermilov 525e6a870e re_detach() fixes:
- Fixed if_free() logic screw-up that can either result
  in freeing a NULL pointer or leaking "struct ifnet".
- Move if_free() after re_stop(); the latter accesses
  "struct ifnet".  This bug was masked by a previous bug.
- Restore the fix for a panic on detach caused by racing
  with BPF detach code by Bill by moving ether_ifdetach()
  after re_stop() and resetting IFF_UP; this got screwed
  up in revs. 1.30 and 1.36.
2005-09-15 18:59:34 +00:00
Giorgos Keramidas 4f867c2d17 When bus_alloc_resource_any() fails, dc_detach() is called and it
attempts to deallocate busdma tags and resources that haven't been
allocated yet, causing a panic every time a dc interface fails to
attach.  Fix by checking that we really have something to dealloc
before calling bus_dma*() functions.

Approved by:	jhb
MFC after:	1 week
2005-09-15 17:51:39 +00:00
Poul-Henning Kamp aed1189d1f First cut at a driver for National Instruments PCI-GPIB hardware.
Hardware donated by:	"Greg Maciejewski" <gregm@serverpit.com>
2005-09-15 13:27:16 +00:00
Poul-Henning Kamp f6a157fb88 Allocate unit numbers with unr, implement detach function. 2005-09-15 13:07:38 +00:00
Warner Losh 4062f4e78e When stopping the card, and returning to page 0, it is best if you do
that with the NIC set of registers rather than the ASIC registers.  I
believe this was a harmless oversight, since we set ED_P0_CR to the
same value 5ms later, but just to be safe...
2005-09-15 04:05:09 +00:00
Ruslan Ermilov 9abf4b7a1d Make device_detach methods really work. 2005-09-14 19:03:14 +00:00
Andre Oppermann fb2c9853a7 Increase boot-time DigiBIOS initialization timeout to allow
for a larger number of chained port modules.

PR:		kern/55018
Submitted by:	Cyrill Shevchuk <cyrill at cyrills.net>
2005-09-14 15:18:12 +00:00
Søren Schmidt 0387836deb Harden the hotplug support for SATA devices.
This also fixes a few races that was present in the timeout/detach code.

Sponsored by: pair.com
2005-09-14 12:45:06 +00:00
Ruslan Ermilov 5e6e79f718 Fix "Memory modified after free" panic on detach, caused by accessing
already freed struct ifnet.
2005-09-14 10:28:01 +00:00
Scott Long 552d343294 Bring aac_cam into line with using time_uptime instead of time_second. 2005-09-14 05:49:34 +00:00
Scott Long 2b3b0f1721 Use time_uptime for timing commands instead of time_second. This is a bit
risky because the "current time" is supposed to be fed to the card during
initialization, and the current time is supposed to be put into each command
that is sent to the card.  Hopefully either the card doesn't actually care
about the timestamps, or it doesn't care about the absolute values so long
and the relative values are consistent.  Not an MFC candidate until more
thorough testing can be done.
2005-09-14 05:46:28 +00:00
Pyun YongHyeon 005a5d42fa Fix module unload panic which was caused by missing sx lock release.
While I'm here add KASSERT(9) to notify failure of SYSUNINIT handler.

Reported by:	Ben Kaduk < minimarmot AT gmail DOT com >
Tested by:	Ben Kaduk < minimarmot AT gmail DOT com >
2005-09-14 01:34:13 +00:00
Warner Losh 60d47f2c0a MFp4: Migrate from CARD_CIS_SCAN to pccard_cis_scan 2005-09-13 19:56:07 +00:00
Warner Losh c7dc9b92a5 MFp4:
o Use pccard_cis_scan
o use pccard_attr_write_1
o Update comments
2005-09-13 19:54:14 +00:00
Warner Losh d21d33847c MFp4: Omnibus ed changes
o Attach AX88x90's MII bus to system, and require its presence.
o Reorg the mii code a little, and move more of it into pccard attachment.
o Eliminate ed_pccard_{read,write}_attrmem in favor of a more appropriate
  function in the pccard layer.
o Update comments to reflect knowledge gained.
o Update how re recognize a NE-2000 ROM.  I found a couple of different
  datasheets that define the structure of the PROM data, so the code's
  old heuristics have been removed, and comments updated to reflect the
  structure.
o Eliminate work around for EC2T.  It is no longer needed, and was wrong
  headed since the EC2T has a Winbound 82C926C in it, not a AX88x90.
o Add copyright to if_ed_pccard.c, since I believe I've re-written more than
  3/4 of it.

# With these changes, all of my 20-odd ed based cards work, except for the
# NetGear FA-410, and I'm pretty sure that's a MII/PHY problem.
2005-09-13 19:47:44 +00:00
Warner Losh ff1de32e3b MFp4:
o Move to new pccard_cis_scan convenience function.
o Remove compat layer goo.
2005-09-13 19:28:03 +00:00
Warner Losh 14ea0b7d32 Use new convenience function to read CIS rather than the older, harder to
use version.
2005-09-13 19:25:30 +00:00
Warner Losh 5098c3916e MFp4: Minor formatting nits in pccard table. 2005-09-13 19:09:57 +00:00
Warner Losh c3ee3aa526 Use smaller names. The "NE2000 PCI Ethernet" is largerly redundant
with edX at pciY.  This removes 8*22 bytes from the strings. Not a
huge win, but a cheap one.
2005-09-13 19:07:00 +00:00
Warner Losh e88c48fefc Add the olicom OC2231 and OC2232 to the list of cards that we should
attach to.  These cards are combo cards (in that they have a modem
inside of them), but not true MFC cards.  Full support of these cards
will have to wait until we can pick the config to use and for the PFC
support that I have brewing.
2005-09-13 18:55:28 +00:00
Warner Losh fe364ce963 Add a few new functions interfaces to allow reading/writing attribute
memory, the CCR and a tweak to cis_scan.
2005-09-13 17:56:36 +00:00
Warner Losh 395fee2331 Define and use PCCARD_MEM_PAGE_SIZE. 2005-09-13 17:49:47 +00:00
Warner Losh 8d4f90a457 MFp4: Remove stale functions. 2005-09-13 17:41:48 +00:00
Pyun YongHyeon 7535accf91 Unlock driver lock before calling resource_int_value(9).
This should fix LOR(in fact it's not LOR) in device attach.
2005-09-13 10:12:28 +00:00
Alexander Leidinger 831a62e7e5 - Fix the locking in dsp.c to prevent a LOR (AFAIK not on the LOR page).
- Remove an assertion in sound.c, it's not needed (and causes a panic now).
  From the conversation via mail between glebius and Ariff:
  ---snip---
  > Well, but which mutex protects now? Do we own anything else
  > in pcm_chnalloc()? I see some queue(4) macros in pcm_chnalloc(),
  > they should be protected, shouldn't they?
  Queue insertion/removal occur during
     1) driver loading (which is pretty much single thread /
        sequential) or unloading (mutex protected, bail out if there is
        any channel with refcount > 0 or busy).
     2) vchan_create()/destroy(), (which is *sigh* quite complicated), but
        somehow protected by 'master'/parent channel mutex. Other
        thread cannot add/remove vchan (or even continue traversing
        that queue) unless it can acquire parent channel mutex.
---snip---

Fix the locking in dsp.c to prevent a LOR (AFAIK not on the LOR page).

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested with:	INVARIANTS[1] and DIAGNOSTICS[2]
Tested by:	netchild [1,2], David Reid <david@jetnet.co.uk> [1]
2005-09-12 18:33:33 +00:00
Joseph Koshy bebaef4a3d Process one NMI interrupt per handler invocation as the processor
'buffers' pending NMIs from multiple interrupting PMCs and delivers
them serially.

Reported by:	 Olivier Crameri <olivier.crameri@epfl.ch>
MFC after:	3 days
2005-09-12 15:55:44 +00:00
Yoshihiro Takahashi 8621e8a737 more #ifndef PC98. This really fix the pc98 tinderbox. 2005-09-12 13:40:10 +00:00
Warner Losh 5c4f7048b8 This appears to be good for some folks, but really bad for others.
Until we know why, back out 1.127.
2005-09-12 05:35:11 +00:00