Commit Graph

4059 Commits

Author SHA1 Message Date
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