Commit Graph

4276 Commits

Author SHA1 Message Date
drochner 46ed4b50c4 s/locdesc_t/int/g 2005-08-26 12:42:11 +00:00
drochner e6a178f21f kill a number of autoconf submatch functions which follow the
standard scheme:
if (<configured> != <wildcard> && <configured> != <real>)
	then fail
else
	ask device match function

This is handled by config_stdsubmatch() now.
2005-08-25 22:33:18 +00:00
drochner fa3cb84d62 replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
2005-08-25 18:35:38 +00:00
dyoung 0ca62afd93 Remove redundant ath_tsf_extend subroutine. Use ath_extend_tsf,
instead.  This reduces diffs with FreeBSD as a side-effect.
2005-08-21 00:25:51 +00:00
bouyer 90dd891d17 We can't free struct ahc_softc on NetBSD either, because it comes from
config(9). Fix a corruption on alldevs list when an ahc device fails to
initialise.
2005-08-19 17:08:59 +00:00
tacha 379d19f599 make CF on pcmcia works again.
Approved by bouyer.
closed kern/30998.
2005-08-17 22:41:33 +00:00
christos 055740c706 PR/31000: FUKAUMI Naoki: 2 bugs in ral driver:
- remove driver-private key allocators; use the default one instead
  so wpa keys are handled properly (if_ral.c, if_ural.c rev 1.9)

- remove local mods that snuck into rev 1.6 (if_ral.c rev 1.10)
2005-08-16 17:02:34 +00:00
joff 02e79f9fb1 4-line HD44780 LCD display support. Work needed for the NetBSD toaster port.
The HD44780 actually doesn't support 4 lines, but the 4 line displays
use two chips, one for the top two lines and one for the bottom
two lines.  The chips share the databus, register-select, and write
signals but have separate enable signals.
2005-08-14 02:56:06 +00:00
junyoung b0c452fd1f Make microcode loading work on big endian machines.
Reported and patch supplied by yongari@freebsd a long time ago.
2005-08-12 01:07:16 +00:00
christos c3766be38e Allow setting the MAC address via wiconfig -m (Lord Isildur) 2005-08-10 13:20:42 +00:00
bouyer 55cbfde80a Add missing declaration/initialisation of wdc.
Pointed out by Rui Paulo.
2005-08-10 13:15:42 +00:00
bouyer b1ce9b8a68 Also initialize wdc->reset in wdcprobe() if the bus back-end didn't provide
one. Prevent NULL pointer dereference when wdcprobe() is called.
2005-08-10 11:16:53 +00:00
bouyer 4d7691a538 The ATA/ATAPI IDENTIFY data were designed to be converted on the fly to
host byte order (eventually the byte swapping could be wired in hardware, on
the 16 bit data bus). This was keept when wdc_exec_command() was created,
and as a result wdc_exec_command() is doing 16bit conversion to host byte
order. This is fine for IDENTIFY but doesn't work for other opaque data
structure, such as the ones for SMART.
So change wdc_exec_command() to do the conversion to host byte order only for
WDCC_IDENTIFY and ATAPI_IDENTIFY_DEVICE. This fixes atactl smart status
on big-endian hosts.

While here change __wdccommand_intr() to only use wdc_data{in,out}_pio, there
is no gain in doing the 32bit data port stuff locally.
2005-08-09 22:08:16 +00:00
bouyer d1278fcba8 Add an optionnal controller callback for channel reset. If the callback
is set to NULL, use the generic reset code.
Use this to work around a bug in some Acer IDE controllers (like the
one found in some sparc systems) where a controller disable/enable
is required after a reset to avoid data corruption when Ultra-DMA is
used. Workaround from opensolaris, thanks to Hiroki Sato for testing.
2005-08-06 22:07:24 +00:00
mhitch 7bf06e6ec1 The handler for the periodic ENQUIRY command was not unmapping the ccb
data buffer, which left stale flags which caused Alpha ES40 crashes.  Add
the mlx_ccb_unmap() call and the ES40 now runs with > 1GB memory.
2005-07-30 17:37:11 +00:00
dyoung 810714086b Fix variable shadowing, sysctl attachment, ident(1) strings,
#includes so that the SampleRate rate-control algorithm will build
on NetBSD.
2005-07-28 02:08:04 +00:00
dyoung 89c0a98ceb Export ath_sysctl_instance for the SampleRate rate-control module
to use.

Also, add sysctl helper macro SYSCTL_PFX_INT (for SampleRate) that
prepends an arbitrary prefix to the sysctl name, instead of sc->sc_
like SYSCTL_INT.  Factor with SYSCTL_INT.
2005-07-28 02:05:20 +00:00
dyoung 1b19913947 A few fixes affecting user control of the transmit/receive antenna,
and antenna diversity:

Check the hardware capabilities---transmit power control (TPC),
antenna diversity---before setting up the sysctls that control
those capabilities.  Previously, the TPC and ant. diversity sysctls
were not setup because ath_sysctlattach was called before sc_hastpc
and sc_hasdiversity were initialized, so users could not view/control
antenna diversity or TPC settings, even on hardware with those
capabilities.

Obey the user's transmit-antenna selection even when sending IBSS
beacons on hardware with VEOL capability; for all other hardware/modes,
only switch transmit antennas after every four beacons if the user
has not selected a transmit antenna---i.e., they chose antenna 1
or 2 instead of 0 ("auto").
2005-07-27 21:22:57 +00:00
dyoung b496bd99a0 Cosmetic: remove an out-dated "note to self." 2005-07-27 21:13:32 +00:00
dyoung d2ba878019 Resolve conflicts. 2005-07-26 22:52:47 +00:00
drochner 53a6f78e01 disable SYSCTL_SETUP for _LKM until we have a plan how to deal with
it correctly
2005-07-23 16:09:39 +00:00
he d3fc666f98 Make tlp_idle() not be static, so that the newsmips version of the
driver can access that function again.

Approved by thorpej
2005-07-17 18:11:36 +00:00
macallan 71b0921a17 driver for the audio part of SUNW,DBRI ISDN/audio controllers 2005-07-16 18:58:49 +00:00
yamt d7714c3b58 #ifdef out an unused variable in the case of !WI_DEBUG. 2005-07-16 04:06:39 +00:00
dyoung 8e16397dbf Add a sysctl for turning wi(4) debugging on and off.
Do not print the number of tx commands outstanding on entrance to
wi_cmd_intr unless wi_debug > 1.
2005-07-15 22:33:29 +00:00
dyoung 1aeb04f480 Clear IEEE80211_F_DROPUNENC in ic_flags in operating states where
the NIC decryptes & decapsulates WEP frames before passing them to
the host.  "Remember" the state of IEEE80211_F_DROPUNENC in
sc_ic_flags, though, and try our best to honor it as we setup the
hardware state.

This is the second patch of this kind.  The previous patch was
badly broken because wi_mend_flags was basing its decision to clear
IEEE80211_F_DROPUNENC based on the operating state we were
transitioning FROM instead of the state we were transitioning TO.

This fixes a bug that Simon Burge reported, where dhclient wi0
would not get a lease unless and until you ran 'ifconfig wi0'
concurrently (which would frob the IEEE80211_F_DROPUNENC bit in
the right way).  This patch was tested by Simon with his Toshiba
Lucent-clone.
2005-07-14 00:28:51 +00:00
drochner a33487a69f fixes from FUKAUMI Naoki. Changes are
>   Enable WEP (software engine).
>   Add support for WPA[12].
>   Print modes and rates.
>   Add new devices.
>   And some small changes and bug fixes.
2005-07-12 12:13:00 +00:00
yamt d01f5b39f6 specify dma direction hints for bus_dmamap_load_mbuf. 2005-07-11 21:42:58 +00:00
dyoung 55512dd5b2 Add undefined variable 'ic' to rtw_attach. 2005-07-11 06:01:42 +00:00
dyoung ac7254c1e3 Cosmetic: the '_type' argument to ATH_LOCK_IMPL and family is more
properly called '_obj'.
2005-07-10 19:07:39 +00:00
dyoung c23eb30613 Bring an_newstate up-to-date with net80211 conventions. Now an(4)
works again.  Jonathan Perkins reported the bug and tested the
patch.
2005-07-10 19:04:00 +00:00
christos d39684a368 make the isdn drivers compile again with -Wconst, -Wshadow 2005-07-09 02:05:09 +00:00
thorpej 99c4ea1319 - Use ANSI function decls.
- Liberally apply static.
2005-07-08 05:07:31 +00:00
thorpej 9beb4d2c61 Remove the __packed__ attribute from these structures. Everything is
naturally aligned anyway, and __packed__ just causes the compiler to
generate slower code.
2005-07-07 19:02:11 +00:00
christos 66e17a310f add a missing const. 2005-07-07 12:57:03 +00:00
dyoung 86283b24c9 Don't write WEP keys to the chip unless it is enabled.
Suspend and restart the transmit/receive engines while writing WEP
keys.
2005-07-07 00:12:22 +00:00
dyoung 83a9bf2c5c Historically, an(4), ath(4), atw(4), rtw(4), and wi(4) have printed
out their modes and rates at boot.  Revert to the historical
behavior.
2005-07-06 23:58:14 +00:00
dyoung 707b2b4ae1 Avoid an unnecessary API difference between NetBSD and FreeBSD:
back out my change to ieee80211_crypto_encap that made it free its
mbuf argument on error.  I had thought it was a bug.  It was not.
It's the drivers that are broken.  Make an(4), atw(4), ipw(4),
iwi(4), ral(4), rtw(4), ural(4), and wi(4) free the mbuf when
ieee80211_crypto_encap returns NULL.  Also, return ath(4) to the
way it was---i.e., free the mbuf.

Thanks to Sam Leffler to pointing out my mistake.
2005-07-06 23:44:15 +00:00
dyoung 05cab81dd8 Don't write the WEP keys to the device if it is invalid (e.g.,
unplugged) or if it is not enabled.  Fixes kern/30592.
2005-07-06 06:49:25 +00:00
drochner 6d8bb016f7 update PCI/Cardbus ral wlan driver, and adapt to new FreeBSD/NetBSD
80211 framework, from FUKAUMI Naoki per mail to tech-net
2005-07-04 17:50:09 +00:00
dyoung c1446c092d Locking changes.
+ Synchronize ath_calibrate() with ATH_LOCK()/ATH_UNLOCK().  Thanks
  to Steve Woodford for suggesting this fix.  This patch stops
  ath(4) from generating messages "hardware error; resetting" while
  Steve's D-Link DWL-AG650 card is operating (kern/28385).  The
  MiniPCI wireless adapter on one of my Soekris boards also operates
  more reliably following this patch.

+ Use ATH_LOCK_IMPL() and family to synchronize access to the
  transmit queue, also.
2005-07-03 19:58:16 +00:00
dyoung f069ffb8c5 Create per-instance sysctl nodes for ath(4), e.g., hw.ath0.debug,
hw.ath1.debug.
2005-07-03 19:44:50 +00:00
dyoung 3ba3e0571b Bug fix: send all multicast data frames at the lowest possible data
rate, with short preamble turned *off*.  Fixes IBSS operation,
where multicast frames were sent at the highest possible rate with
short preamble turned *on*, so the likelihood of reception was
relatively low, and there was no chance for stations w/o short
preamble capability to receive the frames.

XXX This is a quick fix that I will revisit very soon.  Multicast
data frames are eligible to be sent with short preamble in
IEEE80211_M_STA, IEEE80211_M_HOSTAP modes.  An AP knows who all of
its peers are at all times, so it can make an intelligent decision.
Ditto the AP client.

XXX The rate adaptation should be involved in choosing short/long
preamble.  Also, we can make a reasonable choice of a higher
multicast data rate based on statistics gathered by the rate
adaptation module.
2005-07-03 19:42:10 +00:00
dyoung 967b5afe90 Cosmetic: repair indentation. 2005-07-03 19:31:03 +00:00
drochner c1834d85c2 add drivers for Ralink RT2500-based wireless adapters, written by
Damien Bergamini, ported and submitted by FUKAUMI Naoki per PR kern/30449
I've modified the USB "ural" driver for recent changes to the NetBSD
ieee80211 framework, possibly not completely, but with an ASUS wireless
adapter I'm getting some signs of life.
Didn't care about pci/cardbus for now, hopefully someone with hardware
will do it.
2005-07-01 20:06:56 +00:00
macallan 754d79402b Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.
2005-06-30 12:07:51 +00:00
dyoung 380ab420c3 Fix $FreeBSD$ RCS IDs, which gave me a real shock when their revision
numbers moved backwards.
2005-06-30 00:52:56 +00:00
dyoung dbad357b04 Here is a grotty hack that lets the RTL8180L handle WEP in the
receive direction, while software handles WEP in the transmit
direction.  When net80211 calls rtw's rtw_key_set with a WEP key,
I point the key's wk_cipher at our "fake" cipher, rtw_cipher_wep,
which is alike to ieee80211_cipher_wep except it provides a different
crypto-decapsulation routine, rtw_wep_decap.  rtw_wep_decap copies
the key passed to it by net80211, clears the key's SWCRYPT flag,
and then calls wep_decap.  Now wep_decap will decapsulate, but it
will *not* re-decrypt.

XXX I need to check whether the hardware supports 40-bit WEP,
XXX 104-bit WEP, or both, and act accordingly.
2005-06-28 07:19:33 +00:00
thorpej 77e4f4547b Remove some extern decls for PCI-specific stuff that are private to
the PCI front-end.
2005-06-28 00:32:27 +00:00
dyoung c0a74e44c8 rtw: Try to get hardware WEP to work. It seems to work in
the RX direction, but not in the TX direction.  The
	  net80211 crypto framework doesn't seem to cope very well
	  with the assymetry (I'm probably missing something), so
	  I will use software WEP for now.

net80211: In ieee80211_compute_duration, figure out whether to add
	  the WEP header to the packet overhead by checking the
	  WEP bit in the Frame Control field of the 802.11 header,
	  instead of checking the IEEE80211_F_PRIVACY flag.

	  Also, if the WEP bit is present, assume that the frame
	  described by (wh, len) has already already been WEP
	  encapsulated, and adjust the payload length accordingly.
	  XXX that's a grotty hack that I will have to revisit,
	  later.
2005-06-27 05:49:13 +00:00
erh 1b6f9cc263 Make sure there is a valid transmit key, before trying to use information
about it.  Fixes a crash when configuring wi0.
2005-06-26 21:51:37 +00:00
dyoung 7bcee8c697 Do not build AP support if 'options IEEE80211_NO_HOSTAP' is in the
kernel configuration.
2005-06-26 04:37:25 +00:00
dyoung 23304515e7 Bug fix: fix WEP by managing keys & crypto in the style of the new
net80211.  It was especially important to zero the IEEE80211_F_DROPUNENC
(discard unencrypted packets) flag in operating modes where the
firmware decrypts for us.  Otherwise, the 802.11 layer discarded
all received frames.  See wi_mend_flags.  From FreeBSD, with
improvements by me.

For better compliance with the "net80211 way":
set sc_cnfauthmode from ic->ic_bss->ni_authmode.  Enter
the RUN state through ieee80211_create_ibss instead of
ieee80211_new_state(IEEE80211_S_RUN).  To sync BSSID in ad hoc
mode, use ieee80211_sta_join() instead of
ieee80211_new_state(IEEE80211_S_RUN).  From FreeBSD.

Configure the firmware to obey IEEE80211_F_DROPUNENC.

As we change to state RUN in STA mode, generate a link-status
message on the routing socket with a call to ieee80211_notify_node_join()
instead of calling rt_ifmsg directly.

Run normal net80211 processing (ieee80211_newstate) on the ->RUN
transition.
2005-06-25 03:56:53 +00:00
dyoung 133d421bca Cosmetic: join lines. 2005-06-25 03:41:50 +00:00
rpaulo ec4e36b7c2 Add support for ASIX AX88140A/AX88141 chipsets using only
the 10/100 MII with inspiration from FreeBSD dc(4) driver.

Tested on i386 and macppc.

Reviewed by Jason Thorpe and ok'ed by Hubert Feyrer.
2005-06-23 23:51:41 +00:00
martin adc4b94498 Remove unused <atomic.h> include; add <sys/device.h> includes where
needed.
2005-06-22 22:07:48 +00:00
dyoung 9063402978 Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD.  Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]).  Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
2005-06-22 06:14:51 +00:00
dyoung d1f006118e Import FreeBSD's ath(4) of 2005-05-18 2005-06-21 20:37:47 +00:00
ws 9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
darcy 77a3cb4427 Fix another portability issue. Part of PR kern/30456. 2005-06-20 20:40:21 +00:00
darcy 67a10100f5 Fix some printf statements to make them more portable. Doesn't completely
fix PR kern/30456 but fixes part of it.
2005-06-20 11:37:47 +00:00
atatat df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
bouyer 3110d2fd7a In wdcprobe1(), wait 5s for the drive to deassert ready. In case of e.g.
pcmcia devices, the drive may still be doing its power-on reset.
XXX From the specs the delay could be up to 31s here, but we don't want to
    wait for 31s if we have a channel with no drives and pull-up resitors on
    the bus.
Based on patch submitted in kern/25659 by Steven M. Bellovin, part of fix for
kern/25659.
2005-06-19 18:14:27 +00:00
bouyer cf4b00e2e4 Remove a (wdc == NULL) test. We know wdc is not NULL at this point. 2005-06-16 20:15:04 +00:00
jmc 1e47a53b95 Constify return string 2005-06-13 20:32:58 +00:00
tls 4a43d21777 Revert the part of revision 1.228 that made HW_NO_TXPRELOAD the default:
it appears to break output on the Soekris net4501, which is a rather
popular platform.

This should fix PR kern/29612 -- if not, I will probably revert it again.
2005-06-12 21:10:47 +00:00
dyoung d485a761e3 Sprinkle __UNCONST() and rename variables to quiet uiet -Wcast-qual,
-Wshadow complaints.
2005-06-10 02:35:34 +00:00
he 5f0e107e63 Adapt to compiling with -Wcast-qual by adding const to some pointer casts. 2005-06-08 13:54:38 +00:00
skrll 51b20ca033 Fix typo. 2005-06-07 06:27:17 +00:00
pooka 7fe36dcdc1 Instead of writing the packet length in two 8bit pieces, use one
16bit write.  At least in certain environments this has the effect
of the latter 8bit write of the length to be not interpreted as
the first 16 bits of the packet contents and hence the interface
working.
2005-06-06 20:20:09 +00:00
he aafdb08c5a Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*".  Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>.  This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
2005-06-04 20:14:24 +00:00
tsutsui 0716f17835 Constify. 2005-06-03 21:20:51 +00:00
skrll 88aa783dd0 const fallout. 2005-06-03 07:03:22 +00:00
he 05721f8fb4 Adapt to -Wcast-qual by adding a const and using __UNVOLATILE() in
a couple of places where memcpy() is used.
2005-06-02 14:41:26 +00:00
christos 55479da63d simplify weird tests. 2005-06-02 14:32:12 +00:00
tsutsui 0a045d64d9 Add a const. Fixes part of PR kern/30403. 2005-06-02 14:03:20 +00:00
drochner 645c942f3b const fall-out, from Patrick Welche 2005-06-01 19:40:58 +00:00
drochner 10e0e927de add "const" where needed 2005-06-01 18:18:52 +00:00
drochner b10340ac93 quell cast-qual and shadow warnings 2005-06-01 18:07:04 +00:00
christos bf55d99961 revert previous and fix LLADDR instead. 2005-05-31 01:48:22 +00:00
christos 67f72d9fc5 use const cast. 2005-05-31 01:43:36 +00:00
christos 6b23a10118 avoid variable shadow. 2005-05-31 00:46:05 +00:00
christos 1475e6ed5c - add const
- avoid variable shadow
2005-05-31 00:45:52 +00:00
christos f381db6045 - add missing const
- fix variable shadowing
- remove unneeded casts
2005-05-30 04:43:46 +00:00
christos 74995e2a49 remove volatile that was being cast-away in all its references. 2005-05-30 04:41:57 +00:00
christos 80f7d2107b - sprinkle const.
- avoid variable shadowing.
2005-05-29 22:10:28 +00:00
christos 7cdea212c0 No 0x in front of %p... 2005-05-22 15:54:45 +00:00
briggs 947685c48e BUS_DMASYNC_* routines are from the point of view of the memory controller,
so BUS_DMASYNC_POSTREAD should follow a device->memory transfer (like for
the rx packet data.
Also, it would be good to do a BUS_DMASYNC_PREWRITE to ensure that packet
data is flushed to memory before the chip tries to transmit data.
Tested on a PowerPC system.
2005-05-19 20:11:24 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
bouyer 78b08b48da Pad small packets with a static buffer at the end of the S/G list.
Avoids leaking kernel memory when small packets are transmitted.
Tested on a ibook G4.
2005-05-16 15:56:38 +00:00
yamt f3bf234dc9 disable IFCAP_CSUM_IPv4_Tx and comment why. 2005-05-15 07:48:49 +00:00
augustss 3f7dbfe409 Let ahc_createdmamem() return -1 on error instead of an error code, since
the users of that function test on <0 to look for an error.
Again, from a person that wishes to remain anonymous.
2005-05-12 06:27:44 +00:00
scw 32bd2f7d95 Add a heuristic to test if an audio CODEC's AC97_REG_POWER register supports
the AC97_POWER_ANL bit.

The heuristic simply checks if AC97_REG_POWER's AC97_POWER_MIXER  bit can
be set, implying the CODEC can control power to its mixer. If the bit
reads back as zero after we set it, assume ANL is reserved.

Without this patch, some CODECs (e.g. Philips UCB1400) will experience long
delays during attach and resume while the driver waits for a bit which will
never set.

Thanks to jmcneill@ for reviewing this WRT AC97 modem power control.
2005-05-11 13:13:11 +00:00
yamt 330cc0a11e split IFCAP_CSUM_xxx to IFCAP_CSUM_xxx_Rx and IFCAP_CSUM_xxx_Tx. 2005-05-02 15:34:31 +00:00
tsutsui 8ed63e80db Avoid NULL pointer dereference on unexpected error cases. (from OpenBSD) 2005-04-30 02:18:43 +00:00
xtraeme 53eca961c3 Identify correctly ITE Super I/O chipsets by checking the core ID
register (only available in the model 8712F), if that fails we check
the vendor ID register as before.
2005-04-29 02:02:52 +00:00
jmcneill 212a4fdeb4 * Reduce timeout for codec powerup
* Return ENXIO from ac97_attach_type if the modem codec fails to power-on.
  This will prevent broken AC97 modems *cough*Conexant*cough* from giving
  the impression that they will actually work.
2005-04-12 21:11:43 +00:00
jmcneill 4f351ce9a0 Don't touch AC97_REG_RESET if we're dealing with a modem (modems use
AC97_REG_EXT_MODEM_ID instead). Also set the default audio rate to 8000;
12000 was a stupid choice since we don't actually support it in the driver
yet.
2005-04-12 17:28:02 +00:00
jmcneill c674ab7b1d Add ac97_attach_type(), to allow the hw driver to skip probes for audio or
modem devices. ac97_attach now calls ac97_attach_type() with
AC97_CODEC_TYPE_AUDIO, for backwords compatibility.
2005-04-11 18:26:48 +00:00
jmcneill a497249c37 Add AC'97 1.x 'Modem Line Codec support' capability bit definition. 2005-04-08 15:27:19 +00:00
jmcneill 702c19a270 Add identifiers for Intel ICH3 AC'97 modems and CXT33 modem codecs, from
Nicolas Joly <njoly _at_ pasteur _dot_ fr>.
2005-04-08 12:50:00 +00:00
jmcneill 0f32e1f4a6 AC'97 modems don't have the same mixer controls as audio devices. Treat
them differently. Mixers are built depending on the features returned
in the ext_mid -- any combination of LINE1, LINE2, and HANDSET.
2005-04-07 23:24:05 +00:00
jmcneill f1db07fc36 * Add more AC97 modem registers (from AC'97 revision 2.2)
* Add sysctls to control the modem's off-hook status (work in progress)
2005-04-04 18:52:30 +00:00
jmcneill c74eb31f21 * Add support for skipping either the modem or audio AC'97 probes
via host_flags: AC97_HOST_SKIP_AUDIO, AC97_HOST_SKIP_MODEM
* If we're dealing with a modem codec, print the extended modem
  capabilities.
* Add basic AC'97 modem initialization support.
* Add some (but not all) AC'97 modem registers. More will be added later.
2005-04-04 02:08:58 +00:00
jdolecek 8914aa326e white space cleanup, some KNF, long line wrapup 2005-04-03 11:36:32 +00:00
jdolecek 1c89179871 Add driver for MCA Tiara LANCard / Fujitsu mb86950 EtherStar. Driver provided
in PR kern/26899 by Dave Barnes.
2005-04-03 11:21:44 +00:00
jdolecek fc38d3f3ac Make it possible for attachment to specify that the 16bit access shouldn't
be toggled in WE_MEM_{ENABLE|DISABLE} when receiving or transmitting packets.
Use this to switch the toggle off for MCA cards, since it causes NIC resets
there.

Fixes PR kern/26895 by Dave Barnes.
2005-04-03 10:56:59 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
yamt e53142951c - use IFQ_POLL/DEQUEUE rather than IF_DEQUEUE/PREPEND.
- handle tx queue full correctly.
2005-03-30 11:38:06 +00:00
yamt d1238feea1 re_encap: set RTK_TDESC_CMD_IPCSUM if any of checksum offloading is requested.
otherwise, RTK_TDESC_CMD_TCPCSUM/UDPCSUM don't seem to make any effect.
2005-03-29 09:52:31 +00:00
fvdl 6bfe21f4e0 Reverse the cyl_lo and cyl_hi reads for the AT_READREG case; previously,
the cyl_lo information would have been thrown away.
2005-03-28 22:08:51 +00:00
dyoung 24f08f73c6 correct logic so we recognize timeout on alloc
Noticed by:     Coverity Prevent analysis tool

From FreeBSD.  Thanks Sam Leffler for bringing this to my attention.
2005-03-27 00:49:14 +00:00
cube 040e3b19e5 Add attimer(4) driver, with ISA and ACPI attachments.
attimer(4) is the new body of the part of pcppi(4) that mapped the TIMER1
register to set the pitch of the bell.  It was necessary to separate them
in order to have a working ACPI attachment (as the two appear as different
devices in the ACPI structures).
2005-03-25 23:06:19 +00:00
bouyer 091d59fa24 Don't assume all LUNs are probed before scsipi sets the mode, and always check
if lun_tagtbl needs to be allocated. Patch from john heasley in kern/29603.
2005-03-23 21:23:15 +00:00
yamt e012617b1e - restructure tx descriptor handling code to decouple
number of tx descriptors, number of rx descriptors, and number of mbufs.
- bump number of tx descriptors for rtl8169.  64 doesn't seem to be sufficient
  when doing TSO.
2005-03-23 20:23:08 +00:00
wiz ec30909ad0 Remove duplicate word in comment. From Rui Paulo in PR 29767. 2005-03-23 13:24:47 +00:00
rafal 08bbc8e180 Fix typo in HW checksum code -- check for TCP & UDP HW checksumming being
enabled rather than TCP twice.
2005-03-17 15:51:28 +00:00
yamt 42f5578ac9 move the code to drop packets in the previous version
from re_encap to re_start so that other rtk_tx_free checks are
also covered.
2005-03-14 10:08:17 +00:00
darcy 3b06c2c797 Add to XXX comment for future reference. 2005-03-12 10:35:29 +00:00
yamt 5ef6b21b78 re(4) driver:
- TSO support.
- fix some error handling.
- remove mysterious RTK_NTXSEGS and use more appropriate values
  for bus_dmamap_create.
- if we need more than all of our tx descriptors in order to transmit a packet,
  just drop it rather than retrying infinitely.
2005-03-12 08:01:51 +00:00
heas 37ea29ba5a Perform a s/w checksum for packets that are not the same length as the length
field of the IP header (ip->ip-len) indicates they should be.  This handles
the case where an ethernet frame has been padded to meet the minimum ethernet
frame length or erroneously (my cisco switch unnecessarily adds 4 bytes to its
SYN).  This padding will be included in the hardware checksum and may be
non-zero, thus making it incorrect.
Also, clear csum_flags when we want a s/w checksum, since we may have started
down the h/w checksum path and determined that it was not usable.

While here, clean-up a few WS nits and ifdef INET the hardware checksum code.
2005-03-05 18:36:23 +00:00
heas e7144a2c1a Perform a s/w checksum for packets that are not the same length as the length
field of the IP header (ip->ip-len) indicates they should be.  This handles
the case where an ethernet frame has been padded to meet the minimum ethernet
frame length or erroneously (my cisco switch unnecessarily adds 4 bytes to its
SYN).  This padding will be included in the hardware checksum and may be
non-zero, thus making it incorrect.
2005-03-05 18:32:59 +00:00
mycroft 1d50f417b8 Copyright maintenance. 2005-03-02 12:25:27 +00:00
dyoung 8125cd1769 Misc. changes to improve ad hoc mode and to enable hostap mode:
Fix the work-around for the NIC bug where it skips to rx
  descriptor 0.  The driver used to skip to rx descriptor 1.
  Hopefully this stops the out-of-order packet reception that
  Charles Hannum saw.
                                                                                  When debugging is enabled, print rx-descriptor status flags
  before printing the rx bit rate.

  Add a debug message for when a beacon tx buffer reclamation.

  Reset IFF_OACTIVE when we reset the transmitter.

  Pass the consolidated LED state, a struct rtw_led_state,
  to rtw_led_attach.

  Choose the bit-rate for management frames (1Mb/s) at the
  same place we choose for all other frames.

  Do not use the NIC's short preamble or RTS options for
  management frames.  Label beacons for the NIC.

  Following a Linux driver, take care not to zero arbitrary
  bits in the TPPOLL register.

  Use the new idiom for IBSS merges: disable transmitter,
  kick the state machine.
                                                                                  Add a second descriptor to the beacon ring.  The NIC seems
  to like this much better.
2005-03-02 05:20:43 +00:00
briggs 802400546d * Remove aif_get_mailboxstatus() from the aac_interface structure. Replace
with aif_get_mailbox().  Make it return uint32_t instead of 'int'.
* Add an AAC_GET_MAILBOX() macro and change AAC_GET_MAILBOXSTATUS() to use
  that.
* Update the Dell PERC 2QC quirk code to use AAC_GET_MAILBOX instead of the
  StrongARM-specific code.  While StrongARM access is correct for that card,
  it's a bad example of how to access the mailbox registers.
* Add the GETINFO command and use it to get and display the card's
  supported options at a verbose level during attachment.
2005-03-01 03:31:45 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
bsh 987bbd3089 ASIX AX88796 is an NE2000 compatible ethernet chip, but doesn't seem to
have "remote DMA complete bit" is ISR.  So, don't wait for ISR.RDC bit
after writing a packet.
2005-02-26 10:29:20 +00:00
yamt 779901b125 re_init: correct usage of bus_dma(9).
now re@pci works on my alpha, in the case of !RE_USEIOSPACE.
2005-02-23 09:20:46 +00:00
yamt c51fcf7423 remove unused macros. 2005-02-23 09:19:38 +00:00
thorpej 2f8e8079d1 Define M_CSUM_DATA_IPv4_IPHL() and M_CSUM_DATA_IPv4_OFFSET() macros
to extract data from csum_data, rather than just open-coding it.
2005-02-21 02:12:48 +00:00
thorpej df9803ce96 Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding.  Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes.  Place items described
by the SCSI Primary Commands document into scsi_spc.h.
2005-02-21 00:29:06 +00:00
heas 9bcc8b955c Have the MAC strip the ethernet FCS on rx so it is not included in the hardware
checksum and add code to support IPv4 TCP/UDP hardware checksums.
2005-02-20 18:29:00 +00:00
jdolecek 2a0d290c56 use VLAN_* macros for VLAN tag extraction/addition 2005-02-20 15:56:03 +00:00
tsutsui 11b735f28a u_intNN_t -> uintNN_t 2005-02-18 22:39:31 +00:00
tsutsui abb2f77dd5 Print newline in some error messages. 2005-02-18 17:56:57 +00:00
heas 981782a1d9 Adjust/add a few comments, add a few bitmask_snprintf formats, and add
register definitions for hardware checksums and the PCS (the fiber interface
version of a MII).
2005-02-18 01:39:18 +00:00
heas 9d624b89de Add handling for hardware TCP/UDP checksums. 2005-02-18 00:40:32 +00:00
heas 7056d7dd2a Handle interface IFF_DEBUG flags sooner in hme_ioctl and cache a copy of
sc_ethercom.ec_capenable such that we can properly adjust the max frame size
when vlan tagging is enabled/disabled.
2005-02-18 00:22:11 +00:00
tsutsui 13238da8a4 Account ifp->if_opackets and ifp->if_collisions. 2005-02-17 15:16:26 +00:00
tsutsui 6b5872e584 Add __attribute__((__packed__)) to structure declarations of DMA descriptors.
Checked on 712/60. (hmm, I wonder how does it work before...)
2005-02-17 14:56:37 +00:00
tsutsui 7989b67eb5 Add __attribute__((__packed__)) to DMA descriptor declarations. 2005-02-17 11:32:42 +00:00
tsutsui c1510a551c Allow MD attachments to override CTEST4 register value. 2005-02-17 11:30:58 +00:00
tsutsui a68fa671e6 Remove unneeded includes. 2005-02-17 11:23:36 +00:00
briggs 2847fb818d Be more verbose at attachment. Display kernel revision and add
the monitor revision and adapter serial number at a "verbose" level.
Add the total adapter RAM at "normal" level.
2005-02-15 12:29:33 +00:00
briggs 419d76c6a9 Identify Intel 80303 cpu variant. 2005-02-15 04:49:31 +00:00
heas aa8184693f Add register definitions for hardware checksums, comments, and formats for
various register bitmask_snprintfs.
2005-02-13 19:12:06 +00:00
jdolecek 4737695e07 don't call re_rxeof a second time when we've already done the work
pull common code out from if and else clauses

from FreeBSD if_re.c rev. 1.33
2005-02-13 16:04:18 +00:00
jdolecek ac81d6249a g/c debug printf 2005-02-13 15:43:33 +00:00
jdolecek daadf23af5 KNF 2005-02-13 15:33:20 +00:00
dyoung 6e9d895c23 Bug fix: use the MAC that the firmware tells us, resorting to the
CIS MAC only on error.

(NetBSD these days tries to read the MAC address from the PCMCIA
CIS.  Prism cards made by Senao set the MAC in every PCMCIA CIS to
00:02:6f:00:02:15.  In a network of Senao cards, this causes MAC
duplication.)
2005-02-13 07:33:06 +00:00
rearnsha 920296fb7f Add support for Artisea chips operating in DPA mode, which has a
16-bit view of the ATA command registers for extended commands.

Approved by briggs.
2005-02-11 21:11:15 +00:00
briggs fb9f110c8c Use aprint_*() instead of printf() at attach time. 2005-02-08 05:16:17 +00:00
skrll b48e30cb2e Initialize 'error' in all cases in ioctl handler, otherwise it doesn't
compile (and of course might return garbage).  [hi kim!]
2005-02-06 09:33:23 +00:00
kim f045f7096d If the interface is up and running, only modify the receive filter
when setting promiscuous or debug mode.  This avoids resetting the
chip unnecessarily.

Fixes PR kern/29126.
2005-02-06 03:15:14 +00:00
joff 5cc20bed82 Support wsdisplay(4) attachments of hd44780 LCD controllers 2005-02-04 05:58:44 +00:00
perry 18db93c7f6 de-__P 2005-02-04 02:10:35 +00:00
he edf90a4645 There is no need to define DS1687_NVRAM_START twice. 2005-02-01 16:16:22 +00:00
joff ccd1cf1023 Matrix keypad wskbd(4) support. Matrix keypads are cheap/rugged user input
devices found in many embedded systems.  They must be polled and
debounced in software.  Should be able to handle any size matrix keypad, but
only tested with a 4x4 (16-key) device attached to the TS-7200 ARM embedded
board via the DIO header.
2005-01-31 06:03:40 +00:00
simonb 3c8e1a4259 Fix a typo. 2005-01-31 04:58:02 +00:00
thorpej 67568419ee Eliminate use of M_HASFCS. 2005-01-31 03:04:25 +00:00
thorpej f3e948e11c Eliminate the use of M_HASFCS. 2005-01-31 03:02:27 +00:00
thorpej a0c36aaebd Eliminate use of M_HASFCS. 2005-01-31 02:51:17 +00:00
thorpej 586d85d4f2 Eliminate use of M_HASFCS. 2005-01-30 17:23:45 +00:00
dan 724df7bd2e attach rtk(4) as an event source to rnd(4)
patches from Sean Davis in PR/28547
(also added a detach hook)
2005-01-23 10:26:06 +00:00
dyoung 7f9c7dad5a For a proper IBSS merge, we have to discard the old beacon packet,
create and queue a new one that carries the new BSSID.  I mined
net80211 in FreeBSD for the solution, which is to make an
IEEE80211_S_RUN->IEEE80211_S_RUN state transition---ath_newstate
discards the old beacon packet creates a new one by calling
ath_beacon_alloc.

I tested the merge as follows.  Starting at my desk on the second
floor of the building where I work:

soekris% ifconfig ath0 mediaopt adhoc ssid zzz chan 11 down

powerbook% ifconfig rtw0 mediaopt adhoc ssid zzz chan 11 up

soekris% sleep 25; ifconfig ath0 up

I raced to the elevator with my Powerbook, pressed the "Down"
button, got in, and pressed "Floor 1."  At the first floor:

powerbook% ifconfig rtw0 | grep bssid
        bssid 02:p:p:p:p:p chan 11

I waited 25 seconds.  I pressed "Floor 2."  At Floor 2, I returned to my desk.
I checked to make sure that the Soekris console read:

soekris% ath0: creating bss 02:s:s:s:s:s
ath0: bss merge 02:s:s:s:s:s -> 02:p:p:p:p:p

0:s:s:s:s:s is the Soekris' WLAN MAC.  0:p:p:p:p:p is the Powerbook's
WLAN MAC.  Each created an ad hoc-mode BSSID from its WLAN MAC by
OR'ing 0x2 with the first octet.

My Powerbook created a network while the Soekris radio was off.
The Soekris radio turned on while I was in the 802.11-impervious
elevator with my Powerbook.  When I returned to the second floor,
the Soekris "heard" beacons from my Powerbook as the elevator door
opened.  Since the Powerbook's network was approximately 25 seconds
older than the Soekris', and since it had the same SSID (zzz) as
the Soekris', the Soekris merged with the Powerbook's network (by
setting its BSSID) as it should.
2005-01-19 04:56:42 +00:00
dyoung 1a198218b9 Delete an out-of-date comment. 2005-01-17 01:48:56 +00:00
dyoung 55940f7c4e Move the register access mode into struct rtw_regs. Change
rtw_set_access, rtw_set_access1 to match.

Add a subroutine for setting WEP keys.  WEP isn't quite finished,
because I have to add the WEP header to Tx packets.  Implement the
SIOCS80211NWKEY ioctl for setting WEP keys.

Program the LEDs based on operating state and packet activity.

 * On a Revision F RTL8180, blink LED1 at 1Hz to indicate
   scan/authenticate/associate states.  In the run state, turn LED1
   on.  In every state, blink LED1 at 5Hz to indicate non-beacon
   tx/rx activity.  I would like to use two LEDs, but in all my
   Rev. F instances, LED0 is not wired to an LED; instead, the
   first LED is wired to indicate that the card's power is on.

 * On a Revision D RTL8180, program the LEDs so that LED0 indicates
   Tx, and LED1 indicates Rx.  The Rx LED will blink annoyingly if
   there are beacons in the air, but at least the Tx LED is useful.

 * Store the hardware revision in the softc to support my futile
   attempt at programming LEDs for both Rev. D and Rev. F parts;
   I never did get Rev. D LEDs to work right.

 * Add a debug flag RTW_DEBUG_LED for the LED transitions.

Add RTW_TPPOLL_ALL, RTW_TPPOLL_SALL to start and stop, respectively,
all of the transmit rings.

In ad hoc mode, allocate a beacon and load it into the beacon ring.
Start the ring.  In one trial, the card re-transmitted the beacon
ring's contents several times before stopping.  More programming
and testing for ad hoc mode is necessary.  I'm not setting the
beacon flag in the transmit descriptor.

Revamp the transmit section to make better use of all the transmit
rings:  beacon queue, high-, low-, and medium-priority rings.  Put
beacon frames on the beacon ring.  All other management frames,
and data frames, go on the medium-priority ring.  Power-save data
frames go on the high-priority ring.  (Note that powersaving is
not implemented!)  This is a work in progress.

Send all 802.11 Management frames at 1Mbps.

After we put a packet on a transmit ring, tickle the right bit in
the TPPOLL to tell RTL8180.  Stop all rings on error and in rtw_stop.

Use the RF chip type, not the RTL8180 revision, to choose between
host- and MAC-controlled RF serial I/O.  Now the Netgear MA521
works.

Remove bogus definition of bit RTW_TPPOLL_FSWINT.
2005-01-16 11:50:43 +00:00
dyoung 500260511f It's necessary to stop DMA on the beacon ring and reconfigure the
beacon after an IBSS merge, or else beacons transmissions may not
resume like we expect.  From Sam Leffler.
2005-01-16 11:43:34 +00:00
kent 93293b9ec7 ansify and KNF 2005-01-15 15:19:51 +00:00
dyoung 7ce33f984e Fix two bugs: frames were bogusly discarded with the complaint
"oversize frame."  Also, some an(4) instances (esp. w/ firmware
version 5+) would not reliably interoperate with some Cisco APs.

Add a sysctl for enabling/disabling debugging.

The problem with Aironet AP interoperability was that the rx frame
'gap' will sometimes be loaded with the 802.2 SNAP header, and
sometimes omitted, when connected to a Cisco AP; an(4) was *always*
discarding the gap.  The problem with "oversize frames" was an
off-by-2 error in the frame-length arithmetic.

While we're here, pad some RIDs to the length that new firmware
really expects.

Thanks to Jim Miller for his valuable bug reports and testing, and
to Dheeraj Reddy for RID-length patches.  Some clues from various
Linux drivers for Cisco/Aironet cards led to the gap fix.
2005-01-15 11:01:46 +00:00
scw 36a24a9003 Cast away a couple of "assignment makes pointer from integer without a cast"
warnings.
2005-01-14 16:23:32 +00:00
dyoung f7a7696b57 Fix typos in TPPOLL register definition: stop the normal- &
low-priority queues with bit1 and bit0, not bit2 and bit2.
2005-01-14 10:13:55 +00:00
kanaoka 3e734f8e90 - Move re_diag() from bus independend code to PCI attachment code.
XXX: I tested cardbus device,but not PCI device.
2005-01-13 14:24:24 +00:00
briggs 9750b8741d In epshutdown(), do not attempt to disable the interface when stopping it
because we're about to write to it again (with a global reset).  Disable
the interface explicitly after the reset is written.
2005-01-11 04:16:27 +00:00
joff e1191d101f Replace hd44780_subr.h to hd44780var.h and install to userland. 2005-01-11 00:57:56 +00:00
kent 23b5d91433 merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

* struct audio_params
  - remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels.  Conversion information
is conveyed by stream_filter_list_t.
  - change the type of sample_rate: u_long -> u_int
  - add `validbits,' which represents the valid data size in
precision bits.  It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.

* audio_hw_if
 - add two parameters to set_params()
	stream_filter_list_t *pfil, stream_filter_list *rfil
   A HW driver should set filter recipes for requested formats
 - constify audio_params parameters of trigger_output() and
trigger_input().  They represent audio formats for the hardware.
 - make open() and close() optional
 - add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
 to round_blocksize()

* sw_code is replaced with stream_filter_t.
  stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
  converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t

* MI audio
 - audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
 - audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
 - audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
 - ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.

* add `struct device *' parameter to ac97_attach()

* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-10 22:01:36 +00:00
joff 838c742991 Handle (i.e. don't lock up the kernel in hd44780_busy_wait) the case of the
LCD not being there.
2005-01-09 15:43:56 +00:00
kanaoka dcccc9d794 sys/dev/ic/rtl8169.c:
- re_attach(): Use bus_dma* directly instead of calling re_alloc().
 - re_attach(): Free bus_dma* resources if attach fails.
 - re_detach(): Free bus_dma* resources.
 - re_newbuf(): Remove unnecessary error check.

sys/dev/ic/rtl81x9reg.h:
 - Define RTK_NTXSEGS.

sys/dev/ic/rtl81x9var.h:
 - Add new members to struct rtk_list_data for bus_dma*.
2005-01-09 12:25:25 +00:00
kanaoka 6488f7bcc4 - Use aprint_*.
- Remove unnecesarry code.
 - Changes some cosmetic.
2005-01-09 12:15:36 +00:00
joff 3d76a36e9e Change TIMEOUT_XXX to HD_TIMEOUT_XXX 2005-01-08 20:19:08 +00:00
joff 79ce2f10af Various improvements for connecting HD44780s using bit-banging style devices
o add sc_writereg and sc_readreg functions that get passed the hd44780_chip
  struct and RS (register-select) signal
o add sc_dev to struct hd44780_chip so upper level read/write routines can get
  back to their parent softc
o change TIMEOUT_XXX to HD_TIMEOUT_XXX
o remove sc_rread and sc_rwrite in favor of new sc_writereg and sc_readreg
o add new flag HD_UP to sc_flags that is set once 4bit/8bit mode selection
  has been finalized.
o remove sc_irwrite, MD readreg/writereg should check state of HD_UP instead
2005-01-08 20:17:22 +00:00
dyoung 00f3f1b613 In ad hoc mode, start the ath rate adaptation with the lowest, most
robust transmit bit rate.  From Greg Troxel.
2005-01-04 01:45:04 +00:00
dyoung e470ffcf3b Set initial conditions to guarantee that when read_seeprom toggles
Chip Select, it turns *on* rather than *off*.
2005-01-04 01:04:52 +00:00
dyoung 9a756f795b Add the logic for IBSS merges. 2005-01-04 01:00:30 +00:00
dyoung 5dc6377838 IBSS-merge clean-up, inspired by some Linux patches from Jon Anderson
(mail@janderson.ca): remove ieee80211_ibss_merge's TSFT argument.
Do the TSFT comparison in the drivers (ath, atw).  Remove a lot of
extraneous debug statements from ieee80211_ibss_merge.

Set the ieee80211_node's state to IEEE80211_STA_BSS after it's been
copied to the ic_bss, not before.

In struct ieee80211_node, make the ni_tstamp field a union of a
uint64_t and the 8 TSF octets so that it's easier to compare a
neighbor's TSF with the local TSF.

Log IBSS merges (Greg Troxel's suggestion).  Also log IBSS creation.
These are rare and important events that deserve to be logged.
2005-01-04 00:56:51 +00:00
dyoung 66e0c6fbb9 sys/dev/ic/rtw.c:
Cosmetic: remove two short ladders from rtw_init.  Fit the
        NIC registers print-out onto one line using the RTW_PRINT_REGS
        macro.

sys/dev/ic/rtwvar.h:

        Add RTW_PRINT_REGS wrapper macro for rtw_print_regs.  It
        is a null op unless defined(RTW_DEBUG).
2005-01-03 03:25:06 +00:00
dyoung 4903d25d90 In sys/dev/ic/rtw.c:
Use clue from rtk(4) and re(4) to fix the rtw(4) packet
	filter.  Previously, I was using the wrong CRC32 function
	to hash multicast addresses; to compensate, I set the
	multicast filter to all 1s.  Now that I hash the addresses
	correctly, I do not any longer set the filter to all 1s.

	In rtw_ioctl, avoid gratuitous re-initialization when the
	interface flags change.  If a !IFF_UP -> IFF_UP transition,
	call rtw_init(); otherwise, only reload the packet filter.

In sys/dev/ic/rtwreg.h:

	Put useful combinations of Receiver Control Register flags
	in RTW_RCR_PKTFILT_MASK, RTW_RCR_MONITOR, and
	RTW_RCR_PKTFILT_DEFAULT.  (XXX RTW_RCR_MONITOR should be
	called RTW_RCR_PKTFILT_MONITOR.)
2005-01-03 03:07:12 +00:00
tsutsui 290f8ccd57 - use ANSI function decls
- remove __P()
- u_intNN_t -> uintNN_t
2005-01-02 12:41:03 +00:00
tsutsui 1d25696d75 u_intNN_t -> uintNN_t 2005-01-02 12:22:18 +00:00
dyoung 1236e46cff Guess the meanings of most registers on the baseband processor.
Available documentation is incomplete, so the true meanings will
have to be found out by painstaking experimentation.
2005-01-02 04:29:36 +00:00
dyoung 37420795ec Cosmetic: change u_int{8,16,32,64}_t to C99-style uint{8,16,32,64}_t,
which is preferred.
2005-01-02 04:23:03 +00:00
bjh21 70c402ea14 Since I've got the datasheets in front of me, add #defines for the missing
registers in the supported MK48Txx chips.
2004-12-30 12:36:29 +00:00
bjh21 73c7ba9d59 If clock_ymdhms_to_secs() fails, return ERANGE. This gets my ELC with
a broken NVRAM to boot cleanly.
2004-12-29 21:33:42 +00:00
dyoung 23e8e34093 Remove the cut & pasted copyright and apply my copyright. 2004-12-29 19:43:27 +00:00
dyoung cef7a909d1 Add my copyright. 2004-12-29 19:41:54 +00:00
dyoung c3a19d4272 In rtw_detach, flag the rtw as "invalid" (RTW_F_INVALID). Do not
try to power-down the RF section of an invalid rtw.

The radiotap signal quality field is 16, not 8, bits wide.  Convert
the byte order.
2004-12-29 19:41:04 +00:00
dyoung c75b3dae43 Remove some dead code. 2004-12-29 01:13:07 +00:00
dyoung 9bd9e3df21 Remove unused rtw_softc variables and some other dead code. 2004-12-29 01:11:24 +00:00
dyoung c3b84ef737 I like the tlp/atw-style names for software descriptors, txsoft,
better than txctl.  Change from rtw_txctl/rtw_rxctl to
rtw_txsoft/rtw_rxsoft.  Change the descriptor blocks' names to
match: rtw_txctl_blk becomes rtw_txsoft_blk.  Change the member-name
prefixes for both software and hardware descriptors.
2004-12-29 01:06:52 +00:00
dyoung d07caa7269 Consolidate variables related to the rx ring in sc_rxdesc_blk,
which is a struct rtw_rxdesc_blk.

Put a copy of the DMA tag and the DMA map into the rx- and tx-ring
blocks so that I don't have to pass them to subroutines all of the
time.
2004-12-29 00:21:37 +00:00
dyoung f1fa0e7819 Add bpf(4) packet taps to rtw(4). Now you can tap DLT_EN10MB
(Ethernet II), DLT_IEEE802_11 (802.11), and DLT_IEEE802_11_RADIO
(radiotap + 802.11).
2004-12-28 22:30:07 +00:00
dyoung 88f91a4188 If defined(RTW_DEBUG), provide a sysctl (hw.rtw.rxbufs_limit) for
limiting the number of rx buffers an rtw may allocate.  Use this
sysctl to test the code that copes with buffer exhaustion.

Allocate at most RTW_RXQLEN rx buffers, stopping at the sysctl
limit.  Record in sc_nrxdesc how many were allocated, and put the
end-of-ring indication on sc_rxdesc[sc_nrxdesc - 1].  In rtw_init,
if no rx buffers could be allocated, log a complaint, clear
IFF_RUNNING, and exit with an error.

Many changes to accomodate a short rx ring, mainly of the "add a
rx-ring length argument" variety.  XXX I really should consolidate
all of the rx ring variables in one struct and pass that to the
rx-ring subroutines.

Bug fix: after calling MCLGET, use the (m->m_flags & M_EXT) idiom
to check for success, instead of m != NULL.

Bug fix: at the top of rtw_start, if IFF_RUNNING is not set, or
IFF_OACTIVE is, get out.
2004-12-28 22:21:15 +00:00
dyoung 05372fb8f4 Group receiver-related variables together: move sc_rxctl nearer to
sc_rxnext.

Add sc_nrxdesc, the number of receive descriptors that we are
actually able to use.  sc_nrxdesc will ordinarily equal RTW_RXQLEN.
If buffers are exhausted, sc_nrxdesc < RTW_RXQLEN.  My next commit
will change dev/ic/rtw.c to deal with buffer exhaustion.
2004-12-28 22:07:04 +00:00
dyoung 075143dca9 Use a table to convert the hardware's bit rates (0, 1, 2, 3) to
net80211 bit rates (2, 4, 11, 22).

Count input errors (if_ierrors++) for "DMA error/FIFO overflow"
and unknown bit rate.
2004-12-27 20:04:45 +00:00
dyoung 0da2ab9a37 Simplify the reset we do on a transmit timeout. Really, this could
be as simple as rtw_stop(, 0), rtw_init().
2004-12-27 19:49:16 +00:00
tsutsui b3090f536d Fix typo in comment. 2004-12-27 14:20:43 +00:00
mycroft 3b17804fc6 Use the last descriptor to count collisions and failed transmissions, too. 2004-12-27 10:17:38 +00:00
mycroft cbcc1cc53f When checking if a split packet is completed, check the *last* segment, not
the first.  Otherwise we can overwrite parts of the TX ring that we shouldn't.

Kluge the basic rate setting for now.

Minor simplification to the dequeueing logic.
2004-12-27 09:40:18 +00:00
mycroft 8de0a60775 Fix the BRSR macros. 2004-12-27 08:59:16 +00:00
dyoung 5ca7c3d3af Disconnect the "stop transmitter/receiver" function from the
"power-off NIC" function, by adding a 'disable' argument to ath_stop.
Pass disable=0 to ath_stop() at the top of ath_init, so that we
don't power-off the Cardbus slot before resetting the HAL.  Thanks
to Greg Troxel for his analysis of this bug.
2004-12-27 07:01:00 +00:00
dyoung e336b06e3b Remove useless debug sysctls.
For AP scanning, change the channel dwell time from 1 second to
1/5 second.
2004-12-27 06:12:28 +00:00
mycroft 06e4fe7f62 Replace d_plcp_svc with d_residue. The latter is the number of whole
empty/unused octets to fill out the data time slot.  The value is constrained
by math to 0 for <= 5.5Mb, 0-1 for 11Mb, and 0-2 for 22Mb.  It is used to
signal to the MAC that there is residue.
2004-12-27 01:51:49 +00:00
dyoung fd1b54b080 Make rtw(4) build w/o RTW_DEBUG. Thanks to Charles Hannum for
pointing out my oversight.
2004-12-26 22:59:41 +00:00
mycroft 1083cfb1dd Fix a compile error if no RTW_DEBUG. 2004-12-26 22:37:57 +00:00
kanaoka 9c2bc06a94 - Use ether_ioctl().
- Remove unnecessary re_init() in re_attach().
 - Remove notyet compile option.
2004-12-26 07:27:41 +00:00
kanaoka 38f5c9155e - Sync if_re.c(rev=1.6).
When adding/deleting multicast addresses, only whack the address
    filter if the interface is marked RUNNING.

    Fixes kern/27678.
2004-12-26 06:48:13 +00:00
jonathan 92e2e6b4b0 Add a forgotten change to rtl81x9var.hfor split re(4) driver
(sys/dev/ic/rtl8169.c): add `sc_rev' to generic 81x9 struct rtk_softc.
2004-12-25 17:24:01 +00:00
dyoung 1b319bfabc The rx descriptor ring bug happens quite often, so printf'ing
occurrences is annoying.  Only printf about it when rtw_debug
contains RTW_DEBUG_BUG.
2004-12-25 07:45:53 +00:00
dyoung 763f8db1c3 IMPORTANT: set m->m_pkthdr.rcvif on rx'd packets. Illegal memory
references abound without this fix.

In rtw_intr_rx, skip to the next rx packet earlier if the rx packet
length is too short.

Also in rtw_intr_rx, if a packet is rx'd with unknown rate, printf
a warning, drop the packet, recycle the rx buffer, skip to next rx
packet.
2004-12-25 07:24:17 +00:00
dyoung d2b4873c41 Change rtw_debug from a debug level to a debug mask. Add a lot of
debug flags.

From Linux: handle an RTL8180 bug.  Sometimes the NIC skips from
the middle of the ring to the 0th rx descriptor.  Now the driver
resynchronizes.

Handle a receive descriptor underrun or Rx FIFO overflow condition
in the way that the Linux driver does.  This kind of seems like
overkill, but whatever.

Protect rtw_ioctl with splnet().

Do not load a tx descriptor with a buffer shorter than 4 bytes.

Handle a transmit timeout less disruptively.
2004-12-25 06:58:37 +00:00
dyoung b24dd60cd6 Round up the number of h/w Rx descriptors to the number of h/w,
not s/w, descriptors in 256 bytes (the descriptor ring alignment).
2004-12-23 08:27:38 +00:00
jonathan 9d44c4d9b1 Snapshot of incomplete-but-working split of re(4) driver into a
bus-independent backend, with PCI and CardBus attachment code.
The committed code has two serious bugs:

1. The driver makes no attempt to recover resources when a (Cardbus)
instance is removed; bus resources are leaked.

2. In testing with a NetGear GA-511, the Cardbus card never responded
   to a reset/wakeup if the card is powered down after attachment.
   So for now, leave cardbus instances powered up at attachment
   (insertion, or at boot if a card is already present).

That aside, it acutally works on my GA-511. Committed as-is despite
the bugs, after repeated requests to make the code available for
further testing.  Also requires sys/dev/mii/miidevs rev 1.54 -> 1.55,
and consequent regen of miidevs{,_data}.h.
2004-12-23 06:26:30 +00:00
dyoung 4ebbc2c98c Oops, straggler from last commit: set the 802.11 Duration field
with the result from ieee80211_compute_duration.
2004-12-23 06:12:43 +00:00
dyoung 24ba04b962 Fix a bug in ieee80211_compute_duration: the 802.11 Duration field
in an 802.11 unicast data packet is equal to the duration of the
SIFS and Acknowledgement.  That is, the amount of time reserved
*after* the packet has finished transmitting.

Change the arguments to ieee80211_compute_duration: pass the entire
packet length, not just the payload length.  Add a 'debug' argument
to ieee80211_compute_duration and its helper subroutine,
ieee80211_compute_duration1.

If debug != 0, ieee80211_compute_duration printfs its arguments
and several local variables.

In rtw(4), load the 802.11 Duration field with the result from
ieee80211_compute_duration.
2004-12-23 06:08:52 +00:00
dyoung ce08175fd3 Bug fix: in rtw_rxbuf_alloc, unload the previous mbuf chain before
loading the new chain.
2004-12-23 06:03:09 +00:00
dyoung baea907e93 DMA-synchronize the Rx buffers before re-initializing them.
XXX not necessary?
2004-12-23 06:00:35 +00:00
dyoung 619095ce92 Add more comprehensive debug messages as we setup transmit descriptors.
Also, dump packets if IFF_DEBUG|IFF_LINK2.  Factor out a subroutine
for printing transmit-descriptor debug messages.
2004-12-23 05:57:18 +00:00
dyoung 0aac8a9404 Disable interrupts and stop transmit DMA before disabling the
transmitter and receiver.
2004-12-23 05:54:54 +00:00
dyoung ff88b7967a Shorten variables, s/txctl/ctl/. This is rtw_start, after all:
transmission is implied.
2004-12-23 05:52:27 +00:00
dyoung 8c17dbe77f Do not indicate to the NIC that the host has appended the CRC32 to
Tx frames.
2004-12-23 05:50:24 +00:00
dyoung c1cf79a56a When we set up the supported rates table, mark 1Mb/s, 2Mb/s as
basic rates.
2004-12-23 05:47:42 +00:00
dyoung 387106eafc Extract the transmission status from a tx descriptor, and convert
to host byte-order, once.
2004-12-23 05:44:39 +00:00
reinoud cca3038b40 Add convenience macro AC97_HAS_SPDIF to check if SPDIF output is supported
in the codec in the line of AC97_IS_4CH and AC97_IS_FIXED_RATE macro's.
2004-12-22 00:54:55 +00:00
dyoung e8cbfad366 The CRC bit in the Transmit Configuration Register seems to have
the meaning opposite to what I thought I read in the datasheet.
2004-12-21 09:07:23 +00:00
dyoung aecae5f227 Realtek sample sources are not consistent about the "Digital PHY"
bit in the SROM.  It seems as if it is set to 1 when the PHY is
*analog*, not *digital*.  Fix my sources.

In rtw_intr_rx, use units of 500kb/s instead of 100kb/s for rate,
to be consistent with net80211's expectations.  Polish up some
debugging ugly messages.  Dump raw 802.11 packets if IFF_DEBUG|IFF_LINK2
and RTW_DEBUG is defined.

Polish power-state (on/sleep/off) handling.  Especially improve
support for RFMD (totally untested) and Maxim.  For Philips, take
the Digital PHY property into account.

Call the net80211 watchdog function from rtw_watchdog, so that we
scan again if auth/assoc fails.

Be a little more cautious about writing register[RTW_TPPOLL], since
other drivers are....  Don't frob the high/low-priority queues
right now, since I don't use them.

Add rtw_join_bss which programs the card with the BSSID and other
properties of a BSS.  Use it on state transitions.  Factor out
rtw_set_nettype.

Make rtw_recv_beacon call ieee80211_recv_mgmt instead of dropping
beacons on the floor!  TBD IBSS merges.

Change some rtw_debug=2 printfs to rtw_debug=3 (RTW_DPRINTF3)
printfs so the console doesn't get spammed so badly at rtw_debug=2.
Change some debugging printfs to RTW_DPRINTFs.  E.g., print the
"RF programming method" only if debugging is enabled.
2004-12-20 23:05:41 +00:00
dyoung b9ff79c840 Fix bug in last commit: use &sc->sc_regs, regs is not defined. 2004-12-20 01:28:24 +00:00
dyoung aa6694402c Add some bus barriers. Remark where they are needed, e.g.,
read_eeprom.

Change some printfs to RTW_DPRINTF2s to quiet rtw(4) when debugging
is disabled.
2004-12-20 01:13:45 +00:00
dyoung 263bfa8e84 Get rid of the silly char (*dvname)[IFNAMSIZ] pattern. Replace it
with const char *dvname.  I'm not sure what I was thinking.
2004-12-20 00:28:02 +00:00
dyoung 3c88b36364 Assert that I'm DMA-syncing a non-negative number of transmit
descriptors.

As I free dirty transmit buffers, move them to the free list, not
back to the dirty list!

Add a 5-second transmit timeout.
2004-12-20 00:16:21 +00:00
dyoung 38e3126fe5 Add the transmit section of rtw(4): build up and tear down transmit
descriptor rings, move packets from the transmit queues to the
transmit rings, handle transmission-completed interrupts.  My
Linksys WPC11 ver. 4 with Maxim RF, generates interrupts like it
is successfully transmitting packets.  Clearly there are bugs: my
G4 Powerbook locks up hard.  I will debug tomorrow.
2004-12-19 08:19:25 +00:00
dyoung 31815c9d7a Remove from atw(4) all of the 802.11 duration #defines that I just
moved to sys/net80211/ieee80211.h.
2004-12-19 08:09:23 +00:00
dyoung ad16f31a1c In wi_stop, wait for transmit commands to complete. Extract
subroutine wi_txcmd_wait from wi_cmd and wi_stop.

This stops wi from griping, "wi0: command timed out, cmd=0x10b,
arg=0x0", when we down/up the interface.  Thanks to Pavel Cahyna
for reporting this bug.
2004-12-14 19:53:46 +00:00
dyoung 4a2df5a4d4 Bug fix: synchronize Transmit commands with all other commands.
Following Charles Hannum's wi(4) optimizations, there could be a
Transmit command outstanding after wi_tx_intr or wi_start returns.
The driver would blithely issue a second command [*] before the
first command was finished, taking the first command's WI_EV_CMD
indication to mean the second command had finished.  The driver
would be dreadfully confused when the second command's results did
not meet its expectations (e.g., a RID mismatch error would occur).
The packet transmit section of the code would never read the
WI_EV_CMD it expected, so transmissions would cease.

This patch counts the outstanding transmit commands (there can be
only one) and, if a transmit command is outstanding at the top of
wi_cmd(), wi_cmd waits for the command to complete.  If there was
a transmit command outstanding when wi_cmd begins, it calls
wi_cmd_intr() on its way out.

I have tested this on an Orinoco card.  Previously, the card would
stop transmitting or the kernel would panic as desynchronization
occurred.  Now it works beautifully.

[*] A second command could be issued by wi_ioctl or else by
    wi_intr->wi_info_intr->wi_newstate->wi_read_xrid->wi_read_rid.
2004-12-13 17:55:28 +00:00
dyoung 407495af6f In wi_tx_intr, be a little more explicit about which fields we're
reading from the Tx-Complete FID.
2004-12-13 17:24:09 +00:00
dyoung cdf3961f69 Refactor. wi_read_rid calls,
wi_read_rid(sc, rid, &val, &buflen) == 0 && buflen == sizeof(val),

become wi_read_xrid calls

  wi_read_xrid(sc, rid, &val, sizeof(val)) == 0.

If the actual RID length is different from the expected RID length,
wi_read_rid prints to the log.
2004-12-13 17:21:35 +00:00
dyoung 0842199905 Fix a typo, s/high/low/. 2004-12-13 01:15:07 +00:00
dyoung 87f615f34e At last, I have rtw w/ Philips RF receiving packets.
I added some sysctls to aid debugging:

  * hw.rtw.debug -- enable debugging

  * hw.rtw.flush_rfio -- Linux voodoo: possibly makes the MAC
    "flush" bits down the serial bus to the RF

  * hw.rtw.host_rfio: force the host to bang bits to the RF, instead
    of the MAC banging bits

  * hw.rtw.rfio_delay: after telling the MAC to bang bits to the
    RF front-end, delay rfio_delay microseconds.

  * hw.rtw.rfprog_fallback: there is this notion of the "RF
    programming method."  I believe the choice influences the
    polarity/timing of the serial bus used to program the RF
    front-end.  I know the correct choice for Intersil/RFMD/Philips
    front-ends, only.  For all other front-ends, I "fallback" to
    rfprog_fallback.

Make rtw_txdac_enable take an rtw_softc argument.  I will probably
revert this change.

Add some Linux voodoo to rtw_continuous_tx_enable.  I will probably
revert this change.

Important: add rtw_set_rfprog, which sets the correct RF programming
method.  This change and the following change are probably responsible
for making the Philips RF work.

Important: RTW_CONFIG1 is an 8-bit register, treat it that way!

Important: RTW_BRSR is 16-bit, RTW_CRCOUNT, RTW_PHYDELAY, and
RTW_MSR are 8-bit: treat them that way!

Vastly simplify rtw_resume_ticks.

Note to self: set the LED state to match the power state.

Hedge against the possibility that RTW_MSR is protected as
RTW_CONFIG[0123] are, meanwhile reworking that section of rtw_init
a little.

Add sc_anaparm, which isn't used, yet....
2004-12-13 00:48:02 +00:00
dyoung a534631ee7 Miscellaneous changes. Details below. Important changes flagged
with [].  Using the driver with my Linksys WPC11 ver. 4, it seems
to be receiving packets for a change.  The WPC11 ver. 4 has a Maxim
RF section.  My no-name rtw with Philips RF section still does not
receive any packets.

Keep access-level (analog params > config[0123] registers > none)
in sc_access.  Add rtw_set_access for changing the access level.

Make rtw_continuous_tx_enable and other subroutines use rtw_set_access
instead of rtw_config0123_enable and rtw_anaparm_enable.

Factor part of the chip-reset code into rtw_chip_reset1.

Change the 'struct foo (*bar)[N]'-style arguments to
'struct foo *bar'-style arguments.

Consolidate software/hardware Tx/Rx ring setup in rtw_hwring_setup,
rtw_swring_setup.

Add a new constant, SA2400_OPMODE_DEFAULTS, for the bits that we
*always* set in the SA2400 OPMODE register.

Factor some code out into rtw_sa2400_calibrate.  (Inspired by the
Linux driver.)

[] When the receiver goes into underrun/overflow state, call a new
   subroutine, rtw_kick() that stops the Rx/Tx processes, resets
   the chip, reinitializes the Tx/Rx rings, and restarts Rx/Tx
   processes.  (Inspired by the Linux driver.)

[] In rtw_intr_rx, check for too-short packets before calling
   ieee80211_find_rxnode.  I believe this will prevent a repeat of
   the MCHK exception I saw once on macppc.

[] Use seconds-elapased as well as microseconds-elapsed to set the
   next "due date" for the timeout interrupt.  This keeps the driver
   from programming the timeout to expire too early.

[] In rtw_intr, read RTW_ISR at most 10 times, then get out.  If
   the interface is not enabled (RTW_F_ENABLED), then get out.

[] In rtw_stop, get out if the interface is not enabled (RTW_F_ENABLED).
   Block IPL_NET interrupts.  Don't read/write any registers if
   the interface is invalid (RTW_F_INVALID).

[] Call rtw_stop in rtw_detach.
2004-12-12 06:37:59 +00:00
sketch 70f18ae0f6 Silence the 'receive process failed to idle' message on the Davicom DM9102A. 2004-12-11 09:31:42 +00:00
thorpej d5083f78be Use "struct scsipi_command" in internal command structures so that
we have enough space for 16-byte CDBs.
2004-12-07 22:23:45 +00:00