Commit Graph

14099 Commits

Author SHA1 Message Date
Damien Bergamini
08403499e7 o Force the sending of an extra URB if there is less than 2 bytes left
at the end of the last URB (URB = USB Request Block = 64 bytes).
o Free the AMRR reserved xfer in detach.
o Minor tweaks.

MFC after:	1 week
2005-11-24 21:31:39 +00:00
Olivier Houchard
5498dbb282 Remember the bus_dmamap_t where we loaded the mbuf, and sync this map instead
of tx_buffer->map, or we could end up syncing the wrong map.
2005-11-24 15:13:47 +00:00
Nate Lawson
1f6e47a324 Only copy out the battery status/info if there was no error. 2005-11-24 05:23:56 +00:00
Gleb Smirnoff
7ddd4e4126 Merge in new driver version from Intel - 3.2.18.
The most important change is support for adapters based on
82571 and 82572 chips.

Tested on:	82547EI on i386
Tested on:	82540EM on sparc64
2005-11-24 01:44:49 +00:00
John Baldwin
b05223a327 Add locking and mark MPSAFE:
- Add locked variants of start, init, and ifmedia_upd.
- Add a mutex to the softc and remove spl calls.
- Use callout(9) rather than timeout(9).
- Setup interrupt handler last in attach.
- Use M_ZERO rather than bzero.

MFC after:	1 week
Tested by:	wpaul
2005-11-23 18:51:34 +00:00
Damien Bergamini
8ea9781eed Optimize PLCP length field computation for 802.11b rates. 2005-11-23 17:32:57 +00:00
John Baldwin
ef2cda76c0 - Quiet the pci_link(4) devices so that they don't show up in dmesg now.
- Improve panic message if we fail to read the PCI bus number from a bridge
  device.
- Don't try to lookup a BIOS IRQ for a link unless the link is routed via
  an ISA IRQ since BIOSen currently only route PCI link devices via ISA
  IRQs.

Tested by:	Mathieu Prevot bsdhack at club-internet dot fr
MFC after:	1 week
2005-11-23 16:36:13 +00:00
Nate Lawson
2010798dab Try to fix problems with periodic hangs by never directly calling _BIF.
Instead, re-evaluate _BIF only when we get a notify and use the cached
results.  We also still evaluate _BIF once on boot.  Also, optimize the
init loop a little by only querying for a particular info if it's not valid.

MFC after:	2 days
2005-11-23 00:57:51 +00:00
Nate Lawson
f08e63dc4d Simplify checks for valid battery info via DeMorgan's Rule. No
functional change.
2005-11-23 00:53:01 +00:00
Marius Strobl
bba6f0a901 - Add a new method ofw_bus_default_get_devinfo() that allows to retrieve
a newly introduced struct ofw_bus_devinfo which can hold the OFW info
  of a device recallable via the ofw_bus KOBJ interface. Introduce a set
  of functions ofw_bus_gen_get_*() which use ofw_bus_default_get_devinfo()
  to provide generic subroutines for implementing the rest of the ofw_bus
  KOBJ interface in a bus driver.
  This is inspired by bus_get_resource_list() and bus_generic_rl_*_resource()
  and allows to reduce code duplication in bus drivers as they only have
  to provide an ofw_bus_default_get_devinfo() implementation in order to
  provide the ofw_bus KOBJ interface via ofw_bus_gen_get_*().
- While here add a comment to ofw_bus_if.m describing the intention of
  the ofw_bus KOBJ interface.

Reviewed by:	marcel
2005-11-22 16:37:45 +00:00
Marius Strobl
933b731c67 Remove unused function and variables. 2005-11-22 14:21:03 +00:00
Gleb Smirnoff
a9fe9149a8 Check IFF_DRV_RUNNING in the re_intr() loop. It can disappear,
since re_rxeof() drops the lock for some time.

Reported & tested by:	XueFeng Deng <dsnofe yahoo.com.cn>
2005-11-22 12:46:15 +00:00
Hajimu UMEMOTO
4796860760 Cache the result of battery info retrieval from smbat as well
as cmbat.

Reviewed by:	njl
MFC after:	3 days
2005-11-22 03:34:09 +00:00
Marcel Moolenaar
829733d045 Resolve misalignment traps caused by changes to IF_LLADDR().
Use de16dec() and le16dec() to fetch the link-level address
from struct ifnet.

Tested on: alpha
Reviewed by: jhb
See also: de(4)
2005-11-22 01:51:57 +00:00
John Baldwin
aed0e2071f Overhaul nve(4) locking to make it more like other ethernet drivers in
the tree.
- Add locked variants of nve_start(), nve_init(), and nve_ifmedia_upd().
- Use callout_* to manage callouts rather than timeout(9).
- Mark interrupt handler MPSAFE (IFF_NEEDGIANT was already clear).
- Lock the driver lock in driver entry points such as the interrupt
  handler, if_start, and if_init rather than locking the driver mutex
  in the various work functions called by the binary blob.  The spin lock
  used by the binary block can probably be stubbed out now.
- Use IFQ_DRV_IS_EMPTY() macro rather than doing it by hand.
- Fix locking in detach.
- Remove some unused fields from the softc.

Tested by:	cognet
MFC after:	2 weeks
2005-11-21 22:14:49 +00:00
John Baldwin
a4104d1c3b Fix the code to look up the BIOS IRQ for a given link device by reading
the IRQ set by the BIOS in existing devices to actually get the correct
bus number of the child PCI bus.  I was not reading the bus number from
the bridge device correctly.  The __BUS_ACCESSOR() macros (from which
pcib_get_bus() is built) assume that the passed in argument is a child
device.  However, at the time I'm reading the bus there is no child
device yet, so I was passing in the pcib device as the child device.
The parent of the pcib device probably returned an error in the case of
a host bridge, thus resulting in random stack garbage for the bus number.
For PCI-PCI bridges, the bus number being used was actually the subvendor
of the PCI-PCI bridge device itself.

MFC after:	1 week
2005-11-21 22:01:16 +00:00
John Baldwin
f5e19c7342 Various fixes to make de(4) not panic after ru@'s IF_LLADDR() changes:
- Don't call tulip_addr_filter() to reset the RX address filter in
  tulip_reset() since that gets called before ether_ifattach().  Just
  call it in tulip_init_locked().
- Use be16dec() and le16dec() to parse MAC addresses when programming
  the RX filter.
- Let ether_ioctl() handle SIOCSIFMTU since we were doing the exact same
  thing with the added bonus that we leaked the driver lock if the MTU
  was > ETHERMTU in the homerolled version.  This part will be MFC'd.

Clue from:	wpaul (1)
Stolen from:	marcel (2 via patch for dc(4))
MFC after:	1 week
2005-11-21 21:50:07 +00:00
John Baldwin
7417e80b4e Don't enable PUC_FASTINTR by default in the source. Instead, enable it
via the DEFAULTS kernel configs.  This allows folks to turn it that option
off in the kernel configs if desired without having to hack the source.
This is especially useful since PUC_FASTINTR hangs the kernel boot on my
ultra60 which has two uart(4) devices hung off of a puc(4) device.

I did not enable PUC_FASTINTR by default on powerpc since powerpc does not
currently allow sharing of INTR_FAST with non-INTR_FAST like the other
archs.
2005-11-21 20:22:35 +00:00
Ruslan Ermilov
95ec61c094 Fix mysterious build failures (with parallel make) early in
buildkernel: provide a real but dummy name to ${DEPENDFILE}
so that the relevant exists() check in bsd.prog.mk fails and
ensures that ${GENHDRS} are built before any other objects.

MFC after:	3 days
2005-11-21 14:41:10 +00:00
Pyun YongHyeon
77805d0e09 busdma cleanup for em(4).
- don't force busdma to pre-allocate bounce pages for parent tag.
 - use system supplied roundup2 macro instead of rolling its own version.
 - TX/RX decriptor length should be multiple of 128. There is no
   no need to expand the size with the multiple of 4096.
 - don't create/destroy DMA maps in TX/RX handlers. Use pre-allocated
   DMA maps. Since creating DMA maps on sparc64 is time consuming
   operations(resource mananger overhead), this change should boost
   performance on sparc64. I could get > 2x speedup on Ultra60.
 - TX/RX descriptors could be aligned on 128 boundary. Aligning them
   on PAGE_SIZE is waste of resource.
 - don't blindly create TX DMA tag with size of MCLBYTES * 8. The size
   is only valid under jumbo frame environments. Instead of using the
   hardcoded value, re-compute necessary size on the fly.
 - RX side bus_dmamap_load_mbuf_sg(9) support.
 - remove unused macro EM_ROUNDUP and constant EM_MMBA.

Reviewed by:	scottl
Tested by:	glebius
2005-11-21 04:17:43 +00:00
Pyun YongHyeon
d0ddbe88db Add a hack to ignore PCR bit for 6300ESB, 82801[D-G]B chips. It seems
that enabling busmastering would result in PCR bit ON after codec
reset.
While I'm here add DELAY(1) to codec access routine to give reasonable
time to codec operation. Without the delay, it would cause problems on
super-fast machines(> 2GHz). Also enable legacy audio for all 6300ESB,
82801[D-G]B chips. Previously, it enabled legacy audio for 82801DB(ICH4)
chip only.

Reported by:    Maxim Maximov mcsi AT mcsi DOT pp DOT ru
		Andrew Bliznak andriko.b AT gmail DOT com
Tested by:	brueffer, Maxim Maximov, Andrew Bliznak
2005-11-21 03:37:43 +00:00
Damien Bergamini
3afda804ab Use memcpy/memset consistently accross ipw and iwi instead of bcopy/bzero. 2005-11-20 16:13:00 +00:00
Damien Bergamini
a4f5ae8ad6 Don't use /etc/firmware. /etc is for configuration files only.
Use /boot to store firmware files instead.

Requested by:	Daniel O'Connor, Scott Long
2005-11-20 16:02:04 +00:00
Scott Long
e1000b3617 Fix compile on 64-bit platforms. 2005-11-20 04:27:24 +00:00
Warner Losh
e2bf685dd4 Return 0 if we are a network card and do match. Previously, we'd bogusly
fail and the card wouldn't be detected.

Submitted by: Bryan Blackburn
2005-11-19 23:26:57 +00:00
Damien Bergamini
408146ed57 Load firmware images directly from the filesystem (looks into /etc/firmware
directory by default) without requiring the user to load them by hand using
e.g iwicontrol.  Get rid of the old ioctl crud.
Updated iwi-firmware port coming soon.

Obtained from:	OpenBSD
2005-11-19 16:54:55 +00:00
Damien Bergamini
72bae85020 Minor tweaks. 2005-11-19 15:08:05 +00:00
Damien Bergamini
8403bb96a2 Second part of the AMRR commit.
Enable automatic rate adaptation in BSS operating mode.
Works great here.  Will need a lot of testing though.
2005-11-18 21:37:02 +00:00
Paul Saab
e8fbd4a86d Add support for a new/unreleased Pentium-M.
Reviewed by:	jkoshy
2005-11-18 16:47:24 +00:00
Gleb Smirnoff
7f4f47d3fa - Backout last change, since it is memory overkill for a non busy host or
for a notebook with em(4) adapter.
- Introduce tunables em.hw.txd and em.hw.rxd, which allow administrator
  to configure number of transmit and receive descriptors.
- Check em.hw.txd and em.hw.rxd against hardware limits [*] and require
  them to be multiple of 128.

[*] According to comments in if_em.h the 82540EM/82541ER chips can handle
    more than 256 descriptors. Since we don't have this hardware to test,
    we decided to mimic NetBSD wm(4) driver, that limits these chips to
    256 descriptors.

In collaboration with:	yongari
2005-11-17 10:13:18 +00:00
Warner Losh
1c570dff3d this is no longer needed. 2005-11-16 20:58:35 +00:00
Damien Bergamini
903c939fd5 Add some initial bits (currently unused) for upcoming AMRR support.
AMRR = Adaptive Multi Rate Retry algorithm
More information: http://www-sop.inria.fr/rapports/sophia/RR-5208.html

More to come.
2005-11-15 17:58:16 +00:00
Damien Bergamini
8fe21ac40a Add some initial bits (currently unused) for upcoming AMRR support.
AMRR = Adaptive Multi Rate Retry algorithm
More information: http://www-sop.inria.fr/rapports/sophia/RR-5208.html
2005-11-15 17:48:49 +00:00
Damien Bergamini
43b60fd47d Optimize and clean TX time computation.
Avoid a test and a modulus operation.

MFC after:	2 weeks
2005-11-15 17:17:15 +00:00
Gleb Smirnoff
560c167070 Recognize Broadcom BCM5752 chip, that can be found in HP DC7600.
PR:		kern/88940
Submitted by:	Alexander Hausner
2005-11-15 14:43:22 +00:00
Sam Leffler
de66ac4427 nuke special handling to extend cts when bursting; it was race prone
MFC after:	7 days
2005-11-15 05:49:02 +00:00
Sam Leffler
0ae09ec575 bandaid inconsistent state handling: the rate index map may be
stale when called to reset rate control state causing us to
pickup an invalid index, check for this and skip 'em (things
will eventually get fixed up so this is not harmful)
2005-11-15 05:47:20 +00:00
Alexander Kabaev
fcf97578ff Unbreak kernel builds.
Submitted by:	arr
2005-11-15 04:19:27 +00:00
Alexander Kabaev
5cc0208a75 Keep track of volumes in non-optimal state and expose a simple count
of volumes that might need administrator attention through device
specific sysctl to simplify device monitoring.

Submitted by:	Deomid Ryabkov <myself at rojer dot pp dot ru>
2005-11-15 02:38:35 +00:00
Jung-uk Kim
5c0619a7f0 0xb1881106 seems to be an AGP bridge and some BIOSes incorrectly handle
the bridge.  Therefore, we give the same treatment as we did for nForce3-250
and ULi chipsets.  VIA AGPv3 code was copied from agp_via.c.
2005-11-14 21:54:20 +00:00
Ariff Abdullah
720289b2cd Update my email address, so people know where the exact /
proper / correct place to bug me.

Approved by:	netchild (mentor)
2005-11-14 18:37:59 +00:00
Ariff Abdullah
bd2ce91cdc From luigi:
This one simply tries to simplify the logic to select the
	buffer sizes. I am not sure it is necessary but the code
	seems a bit more readable to me. And at least i have tried
	to document how the buffer sizes are computed.

Thanks to luigi for deciphering one of the most cryptic part of
sound driver.

Submitted by:	luigi
Approved by:	netchild (mentor)
2005-11-14 18:21:23 +00:00
Ariff Abdullah
ee43f8a667 From luigi:
In SNDCTL_DSP_SETFRAGMENT, if you specify both read and
	write channels, the existing code first acts on the
	read channel, but as a side effect it updates the
	arguments (maxfrags, fragsz) passed by the caller according
	to acceptable values for the read channel, and then uses the
	modified values to act on the write channel.
	The problem with this approach is that, given a
	(maxfrags, fragsz) user-specified value, the actual
	values computed by the read and write channels may differ:
	e.g. the read channel might want to allocate more fragments
	than what the user specified because it has no side-effects
	on the delay and it helps in case of slow readers,
	whereas the write channel needs to use as few fragments
	as possible to keep the audio latency low (very important
	with telephony apps).

	This patch stores the values computed by the read channel
	into temproary variables so the write channel will use
	the actual arguments of the ioctl.

	This patch is very helpful with telephony apps such as asterisk.

Submitted by:	luigi
Approved by:	netchild (mentor)
2005-11-14 18:20:47 +00:00
Ariff Abdullah
801389376f ac97.c:
- Added new codec id for CX20468-21 and VIA1617A.
   Submitted by:	Chen Lihong <lihong.chen@gmail.com>
 - Re-enable SOUND_MIXER_IGAIN, but set the default level as 0 (mute)
   Suggested by:	luigi

mixer.c:
 - Set default value for SOUND_MIXER_IGAIN as 0 (mute) to avoid
   feedback problems on some laptops (was disabled by jhb during
   ac97.c revision 1.42).

Approved by:	netchild (mentor)
2005-11-14 18:19:33 +00:00
Ariff Abdullah
7810d8e256 Fix a long standing unhandled interrupt bug which can cause
erratic system slowdown (beaten to a pulp) and possible panic. This
issue has bugged me for as long as I could remember, until I
realized that it is possible for register base offset to hold zero
value which is definitely a "FALSE".

Approved by:	netchild (mentor)
2005-11-14 18:18:52 +00:00
Ariff Abdullah
6a728ce536 - Added few more Intel HDA ids (ICH 6/7) which does have backward
compatible AC97 codec.
- As the driver supports so many variants, create a table ids for
  ease of probing and maintenance.
  Submitted by:		yongari
  Reviewed/Tested by:	multimedia@
- From luigi:
	The code to compute fragment sizes in the ich driver almost
	invariably ends up using the full buffer available, no matter
	how the user specifies fragment size and number.
	With audio telephony (8khz, 16bit-stereo) and the 16k buffer
	size this results in an unbearable 500ms delay.
	This patch makes sure that we never use more than 4 fragments,
	(i don't think we need more unless there are huge interrupt
	servicing latencies), and obey to the requested fragment size,
	so that latency is acceptable.
  Based on this (and after much regression tests), I can conclude
  that this driver works best with 2 fragments, thus solving various
  long standing issues of ICH driver not capable to flush or play
  short files perfectly.
  Suggested by:		luigi (the idea of smaller fragments)
- MPSAFE conversion.

Approved by:	netchild (mentor)
2005-11-14 18:18:12 +00:00
Ariff Abdullah
0ae68fd446 Use both (enabled by default) DAC1 and DAC2 to provide 2
distinct hardware playback channels. DAC configuration can be
accessed through kernel hint - hint.pcm.<unit>.dac="val" with
following possible values:

   0 = Enable both DACs (default)
   1 = Enable single DAC (DAC1)
   2 = Enable single DAC (DAC2)
   3 = Enable both DACs, swap position (DAC2 comes first instead
       of DAC1)

Special case for ES1370:
   Unlike ES1371,2,3/CT5880, volume for each DAC 1 and 2 can be
   controlled indepedently (synth for DAC1, pcm for DAC2). It is
   possible that user will confuse by this behaviour, since both
   DACs are enabled by default. Thus, provide a knob through sysctl
   hw.snd.pcm<unit>.single_pcm_mixer:
     0 = each DACs will be controlled separately (synth/pcm).
     1 = combine both DACs volume mixer controller into a single
         "pcm" (default)
   As a side note, fixed rate operation (provided by previous
   commit) is not a mandatory if the configuration space does not
   involve DAC2 (perhaps disabled by user through the above kernel
   hint). Unlike DAC2, DAC1 has its own register / control space,
   not affected by the speed settings of ADC.

Tested by:	multimedia@
Approved by:	netchild (mentor)
2005-11-14 18:17:31 +00:00
Ariff Abdullah
33291bca01 Fix left/right channel mixed-up during recording by splitting recdev
mask to recdev_l and recdev_r, since each have its own unique mask.

Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
Approved by:	netchild (mentor)
2005-11-14 18:16:59 +00:00
Damien Bergamini
81e6343c3d Fix endianness issues. iwi now works on big endian architectures too.
Obtained from:	NetBSD (scw@)
MFC after:	2 weeks
2005-11-13 17:38:02 +00:00
Jens Schweikhardt
3a5c0f9218 Remove the unused AAC_DRIVER_BUILD_DATE macro.
Nuke whitespace at EOL while I'm here.

Approved by:	scottl (MAINTAINER)
2005-11-13 17:26:36 +00:00