Commit Graph

1535 Commits

Author SHA1 Message Date
Mike Smith
bb0d0a8efc Next phase in the PCI subsystem cleanup.
- Move PCI core code to dev/pci.
 - Split bridge code out into separate modules.
 - Remove the descriptive strings from the bridge drivers.  If you
   want to know what a device is, use pciconf.  Add support for
   broadly identifying devices based on class/subclass, and for
   parsing a preloaded device identification database so that if
   you want to waste the memory, you can identify *anything* we know
   about.
 - Remove machine-dependant code from the core PCI code.  APIC interrupt
   mapping is performed by shadowing the intline register in machine-
   dependant code.
 - Bring interrupt routing support to the Alpha
   (although many platforms don't yet support routing or mapping
   interrupts entirely correctly).  This resulted in spamming
   <sys/bus.h> into more places than it really should have gone.
 - Put sys/dev on the kernel/modules include path.  This avoids
   having to change *all* the pci*.h includes.
2000-12-08 22:11:23 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
Poul-Henning Kamp
959b7375ed Staticize some malloc M_ instances. 2000-12-08 20:09:00 +00:00
Matt Jacob
61e1a8f478 Restore a sense of cleanly supporting multiple platforms. That is,
place the LOCKing macros within the areas within if_wxvar.h that
is set aside for them. Put any platform specific data also in those
areas.

For ease of maintenance purposes, merge in the OpenBSD version codebase here.
2000-12-06 00:52:28 +00:00
Matt Jacob
5c43d35fd7 Move $FreeBSD id up to top of file for multi-OS ease of support reasons. 2000-12-06 00:50:53 +00:00
Matt Jacob
f7dddf8a54 Remove more printfs and use either isp_prt or device_printf. Remember
to set ISP_LOGINFO if bootverbose is set.
2000-12-05 07:38:41 +00:00
Bill Paul
031fc810ab Initialize/grab the mutex earlier in the attach phase, so that
bailing out to the fail: label where we release/destroy the mutex
will work without exploding.
2000-12-04 22:46:50 +00:00
Nick Sayer
305501d329 We now have the ability to assign the correct IRQ when PNP-OS is turned
on. So stop failing the attach if the IRQ is unassigned. With this
patch, I can now boot with PNP-OS YES in my BIOS no differently than
PNP-OS NO (which is a good thing since Windows hangs with PNP-OS NO).

Obtained from:	msmith
2000-12-03 17:07:19 +00:00
Warner Losh
303b52daac Add device ID for the 3c565C card. I followed exactly the 3c575c, but
further tweaks may be necessary down the road.  This does nothing with
the serial side of the card.
2000-12-01 19:41:14 +00:00
Jonathan Lemon
c0d06cc717 Add identifier for Compaq HotPlug host->pci bridge.
Submitted by: Steve Harrington <sgh@home.com>
2000-12-01 17:34:55 +00:00
Andrew Gallatin
689634a3ea Convert the pcib_{read,write}_config args from signed to unsigned,
like the args to the config space accessors these functions replaced.

This reduces the likelyhood of overflow when the args are used in
macros on the alpha.  This prevents memory management faults when
probing the pci bus on sables, multias and nonames.

Approved by: dfr
Tested by: Bernd Walter <ticso@cicely8.cicely.de>
2000-12-01 15:27:48 +00:00
Matthew N. Dodd
1581afb38d Reduce code duplication by using the GET_RESOURCE_LIST bus method and related
generic resource_list management functions.

I'll deal with the EISA bits later.

Not objected to by:	 new-bus
2000-11-28 07:12:12 +00:00
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