Commit Graph

1523 Commits

Author SHA1 Message Date
Jonathan Lemon
b50c63121d Change the driver to allocate its own callout structure, and modify
the interface to use callout_* instead of timeout().  Also add an
IS_MPSAFE #define (currently off) which will mark the driver as mpsafe
to the upper layers.
2000-11-25 08:00:10 +00:00
Jonathan Lemon
df5e198723 Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue.  Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue.  An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
Jonathan Lemon
6e47e42f8d Don't attach the interface twice. While I'm here, add a driver
mutex.
2000-11-25 06:04:18 +00:00
Roger Hardiman
0eaa901ba7 Print a warning when we detect a Realtek 8139B chip
(identified by the IO map being 256 bytes long instead of 128)

This chip works very unreliably on my Lanner embedded PC with the rl driver.
Lots of watchdog timeouts or poor performance.

Forcing the media type to 10 Meg (ifconfig rl0 media 10baseT/UTP) is a good
workaround.

This looks very similar to the problem reported in PR kern/18790

It is interesting to note that the linux driver has lots of special
case code for this chip.
2000-11-24 17:36:07 +00:00
Bill Paul
bade6e5e6b Update the probe some more to deal with 16/32 bit issues. If the chip
is already in 32-bit mode, we need to be able to detect this and still
read the chip ID code. Detecting 32-bit mode is actually a little
tricky, since we want to avoid turning it on accidentally. The easiest
way to do it is to just try and read the PCI subsystem ID from the
bus control registers using 16-bit accesses and compare that with the
value read from PCI config space. If they match, then we know we're in
16-bit mode, otherwise we assume 32-bit mode.
2000-11-23 00:28:43 +00:00
Bill Paul
da6e4b77bb When checking the device code in the probe routine, leave the chip in
16-bit mode. Technically, pcn_probe() is destructive because once the
chip goes into 32-bit mode, the only way to get it out again is a
hardware reset. And once the device is in 32-bit mode, the lnc driver
won't be able to talk to it. So if pcn_probe() is called before the
lnc probe routine, and pcn_probe() rejects the chip as one it doesn't
support, the lnc driver will be SOL.

I don't like this. I think it's a design flaw that you can't switch
the chip out of 32-bit mode once it's selected. The only 'right'
solution is for the pcn driver to support all of the PCI devices
in 32-bit mode, however I don't have samples of all the PCnet series
cards for testing.
2000-11-16 19:56:09 +00:00
Bill Paul
fa167b8eaa Add support for the Accton EN2242 MiniPCI adapter. This is just an
ADMtek Centaur chip, so all we need is the PCI ID.

Submitted by:	Scott Lang <scottl@FreeBSD.org>
2000-11-14 19:35:22 +00:00
Bosko Milekic
b7db1f9818 Change MEXTADD usage to pass the two new arguments.
Reviewed by: jlemon
2000-11-11 23:08:22 +00:00
Pierre Beyssac
256de9e9ec Add missing delay after card reset.
This fixes randoms lockups when probing the card at boot time, when
more than 1 similar card is found in the machine.

Reviewed by:	semenu
2000-11-09 17:25:49 +00:00
MIHIRA Sanpei Yoshiro
c3e07515b7 add a couple ESS Technology products(pci device id only).
FreeBSD src/sys/dev/sound/pcm/solo.c
	NetBSD syssrc/sys/dev/pci/pcidevs
	OpenBSD src/sys/dev/pci/pcidevs
2000-11-08 14:43:40 +00:00
MIHIRA Sanpei Yoshiro
1cb0b89246 add Texas Instruments TSB12LV22 OHCI IEEE 1394 Host Controller
Obtained from:	OpenBSD  src/sys/dev/pci/pcidevs
2000-11-08 14:04:54 +00:00
MIHIRA Sanpei Yoshiro
3304019f5a add Aureal Inc. AU8820/AU8830 Audio controller
Obtained from:	OpenBSD src/sys/dev/pci/pcidevs
2000-11-08 13:33:23 +00:00
Kenjiro Cho
44b5247d95 newbusify the en atm driver. 2000-11-07 09:31:28 +00:00
Bruce Evans
f18c4450ac Added used include of <machine/bus.h> -- don't depend on evil namespace
pollution in <sys/mutex.h>.  This was half fixed in rev.1.3 of
midwayreg.h.  The pollution exposed the bug that this driver was using
toy versions of the bus space macros under FreeBSD.  Disabling the
toy versions made this driver compile but dependent on the pollution.
There was still a toy version of bus_space_read_1() in unreachable code.
2000-11-04 15:03:34 +00:00
Bill Paul
09aafe5402 Create a pcn_setfilt() routine that twiddles the promiscuous mode
and nobroadcast bits in the mode register and call it both from
pcn_init() and pcn_ioctl(). Sometimes we need to force the state
of the nobroadcast bit after switching out of promisc mode.
2000-11-03 00:37:45 +00:00
Bill Paul
3019f2bf08 Grrrr. Remember to bzero() the mediainfo structures after we allocate
them. If we leave garbage in them, the dc_apply_fixup() routine may
try to follow bogus pointers when applying the reset fixup.

Noticed by: Andrew Gallatin
2000-11-03 00:03:03 +00:00
MIHIRA Sanpei Yoshiro
defc432c55 add support for 3Com 3c575TX Fast Etherlink XL.
Device information for 3C575-TX is from NetBSD,
sys/dev/cardbus/if_ex_cardbus.c file.

Reviewed by:	wpaul, imp
2000-11-02 06:49:38 +00:00
Bill Paul
9c4d1b1c93 Fix a couple of cases where I tried to release the I/O space resource twice
(once as as an I/O space resource and once as an IRQ resource). There was
a problem with this in if_rl too, which is how I found it.
2000-11-02 00:00:30 +00:00
Bill Paul
57c19b2049 Fix 8-bit EEPROM breakage: compare against 0x8129, not 8129. 2000-11-01 23:56:46 +00:00
Mark Murray
f7261d9c5f Convert the de driver into a loadable module. Still missing is an
unload method. Lots of old cruft is removed.

Thanks to WPaul for large clue-injection and debugging services.

Reviewed by:	wpaul
2000-10-31 01:25:10 +00:00
Bill Paul
e99285a4f7 Call dc_apply_fixup() in dc_setcfg() for the MII case. 2000-10-31 00:06:39 +00:00
Bill Paul
5d801891d3 Grrr. The 'reg' variable in dc_apply_fixup() needs to be a u_int32_t, not
a u_int8_t. Pass the conical hat. This should fix certain cardbus 21143
cards that require SROM h0h0magic in order to enable their transceivers.
2000-10-30 23:51:39 +00:00
Bill Paul
78d2de28df Fix support for cardbus cards:
- Add DRIVER_MODULE() declaration to make this driver a
	  child of cardbus
	- Handle different width EEPROMs

The CIS parser still barfs when scanning this card, but it seems to
probe/attach correctly anyway. I can't do a traffic test just yet
since I don't have a proper crossover cable handy.
2000-10-30 07:54:38 +00:00
Andrew Gallatin
2ff04fe232 Unmask cypress ata controllers. This bug was hidden before
the addition of the serverworks isab support because the
cypress case was the last one in the switch
2000-10-29 16:27:40 +00:00
Poul-Henning Kamp
9f69a4578a Weaken a bogus dependency on <sys/proc.h> in <sys/buf.h> by #ifdef'ing
the offending inline function (BUF_KERNPROC) on it being #included
already.

I'm not sure BUF_KERNPROC() is even the right thing to do or in the
right place or implemented the right way (inline vs normal function).

Remove consequently unneeded #includes of <sys/proc.h>
2000-10-29 14:54:55 +00:00
Poul-Henning Kamp
53ce36d17a Remove unneeded #include <sys/proc.h> lines. 2000-10-29 13:57:19 +00:00
Darren Reed
72371ff249 fix warning compile error about unused variable 2000-10-29 10:07:43 +00:00
Poul-Henning Kamp
db4035961b Fix params passed to pci_porten() and pci_memen(). 2000-10-29 09:59:28 +00:00
Mike Smith
f53e8493fb Unconditionally turning on the I/O and memory enable bits in the PCI
command register is too aggressive.  Revert to the previous behaviour, but
leave the new behaviour available as an undocumented option.  It's not
clear what the Right, Right Thing is to do here, but the more conservative
approach is safer.
2000-10-28 23:07:13 +00:00
Peter Wemm
41fced74eb Fix typo s/DE_DEVICEID_FE2500/DC_DEVICEID_FE2500/ 2000-10-28 10:03:54 +00:00
Bill Paul
1d5e53109c Add PCI IDs for some additional cardbus cards. Yes, there really is
a RealTek 8139 cardbus device. Unfortunately it doesn't quite work yet
because the CIS parser barfs on it.

Submitted by msmith, with some small tweaks by me.
2000-10-28 09:00:20 +00:00
Mike Smith
011d43cdb3 Allow PCI busses to be connected to host bridges detected by ACPI as well. 2000-10-28 07:04:07 +00:00
Poul-Henning Kamp
46aa3347cb Convert all users of fldoff() to offsetof(). fldoff() is bad
because it only takes a struct tag which makes it impossible to
use unions, typedefs etc.

Define __offsetof() in <machine/ansi.h>

Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>

Remove myriad of local offsetof() definitions.

Remove includes of <stddef.h> in kernel code.

NB: Kernelcode should *never* include from /usr/include !

Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.

Deprecate <struct.h> with a warning.  The warning turns into an error on
01-12-2000 and the file gets removed entirely on 01-01-2001.

Paritials reviews by:   various.
Significant brucifications by:  bde
2000-10-27 11:45:49 +00:00
Bill Paul
0a46b1dccc Yet another bug fix/optimization for the Davicom DM9100/9102: increase
the PCI latency timer value to 0x80. Davicom's Linux driver does this,
and it drastically reduces the number of TX underruns in my tests. (Note:
this is done only for the Davicom chips. I'm not sure it's a good idea to
do it for all of them.)

Again, still waiting on confirmation before merging to stable.
2000-10-27 00:15:04 +00:00
Bill Paul
318a72d7b0 Set the DC_TX_INTR_ALWAYS and DC_TX_STORENFWD flags for the Davicom
DM9100/DM9102 chips. Do not set DC_TX_ONE. The DC_TX_USE_TX_INTR flag
causes dc_encap() to set the 'interrupt on TX completion' bit only
once every 64 packets. This is an attempt to reduce the number
of interrupts generated by the chip. You're supposed to get a 'no more
TX buffers left' interrupt once you hit the last packet whether you
ask for one or not, however it seems the Davicom chip doesn't generate
this interrupt, or at least it doesn't generate it under the same
circumstances. The result is that if you transmit n packets, where
n is less than 64, and then wait 5 seconds, you'll get a watchdog
timeout whether you want one or not. The DC_TX_INTR_ALWAYS causes
dc_encap() to request an interrupt for every frame.

I'm still waiting on confirmation from a couple of users to see if this
fixes their problems with the Davicom DM9102 before I merge this into
-stable, but this fixed the problem for me in my own testing so I'm
willing to make the change to -current right away.
2000-10-25 23:46:31 +00:00
Bill Paul
ee27ba8eae Add a missing SK_UNLOCK() to sk_attach_xmac(). 2000-10-25 23:36:45 +00:00
Matt Jacob
3395b0568a Whoops! Forgot to commit this when I committed the other (turnin on locks)
change. Sorry about that.
2000-10-25 04:40:49 +00:00
Poul-Henning Kamp
41f7aa55ba Make LINT compile again. 2000-10-22 16:09:12 +00:00
Warner Losh
869975bf96 Make usual 1-line cardbus support modification.
I'm committing this over an Intel PRO-100 CardBus II card.
2000-10-22 06:41:46 +00:00
Bosko Milekic
ca43854a66 (Introduce something sitting in my repo for 3 weeks now...)
Have if_ti stop "hiding" the softc pointer in the buffer region. Rather,
use the available void * passed to the free routine and pass the softc
pointer through there.

To note: in MEXTADD(), TI_JUMBO_FRAMELEN should probably be TI_JLEN. I left it
unchanged, because this way I'm sure to not damage anything in this respect...
2000-10-21 00:13:35 +00:00
Jonathan Chen
8d0e8723e1 remove old pccbb bridge code.
(argh, I thought I already did this in the original commmit)
2000-10-20 19:37:51 +00:00
Archie Cobbs
69ad30ba3a Add actual URL for XMAC II datasheet in comments. 2000-10-20 16:18:16 +00:00
Andrey A. Chernov
6fdfeafd1b Add i815 host to PCI bridge ID 2000-10-20 16:05:47 +00:00
Andrey A. Chernov
000fc03e87 Add i815 IDs 2000-10-20 15:12:57 +00:00
John Baldwin
35e0e5b311 Catch up to moving headers:
- machine/ipl.h -> sys/ipl.h
- machine/mutex.h -> sys/mutex.h
2000-10-20 07:58:15 +00:00
John Baldwin
36f8814a83 Remove unnecessary machine/mutex.h include. 2000-10-20 07:54:21 +00:00
Jonathan Chen
feb78939ee NEWCARD/Cardbus -
This commit adds support for Xircom X3201 based cardbus cards.
Support for the TDK 78Q2120 MII is also added.
IBM Etherjet, Intel and Xircom cards uses these chips.

Note that as a result of this commit, some Intel/DEC 21143 based cardbus
cards will also attach, but not get link.  That is being looked at.
2000-10-19 08:34:32 +00:00
Mike Smith
c7e95d0abe Write the routed interrupt back to PCI configuration space. 2000-10-19 08:07:23 +00:00
Peter Wemm
df58517066 This didn't compile. Fix typo: s/rmang_get_start/rman_get_start/ 2000-10-18 17:45:29 +00:00
Matthew N. Dodd
a4a64f2f0a Use appropriate resource management accessors instead of directly
referencing structure members.

Use rman_get_size() instead of end - start + 1.
2000-10-18 00:09:26 +00:00