summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_pcn.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused variables.phk2003-05-311-5/+0
| | | | | | | Remove now unused pointer to ether header. Remove break after return Found by: FlexeLint
* Use newly minted device_is_attached rather than device_is_alive to seeimp2003-04-211-1/+1
| | | | | | | | | if attach succeeded. device_is_alive just tells us that probe succeeded. Since we were using it to do things like detach net interfaces, this caused problems when there were errors in the attach routine. Symptoms of problem reported by: martin blapp
* Explicitly declare 'int' parameters.obrien2003-04-211-0/+2
|
* Revise attach/detach resource cleanupnjl2003-04-171-6/+15
| | | | | | | | | | | | | | | - Unconditionally call *_stop() if device is in the tree. This is to prevent callouts from happening after the device is gone. Checks for bus_child_present() should be added in the future to keep from touching potentially non-existent hardware in *_detach(). Found by iedowse@. - Always check for and free miibus children, even if the device is not in the tree since some failure cases could have gotten here. - Call ether_ifdetach() in the irq setup failure case - ti(4), xl(4): move ifmedia_init() calls to the beginning of attach so that ifmedia_removeall() can be unconditionally called on detach. There is no way to detect whether ifmedia has been initialized without using a separate variable (as tl(4) does). - Add comments to indicate assumptions of code path
* Remove another unused variable.jhb2003-04-161-1/+0
|
* Remove some code that managed to escape from my local repository.mdodd2003-04-161-6/+0
|
* - Don't call pci_enable_io() in drivers (unless needed for resume).mdodd2003-04-161-16/+5
| | | | | - Don't test memory/port status and emit an error message; the PCI bus code will do this now.
* - Express hard dependencies on bus (pci, isa, pccard) andmdodd2003-04-151-1/+3
| | | | | | | | network layer (ether). - Don't abuse module names to facilitate ifconfig module loading; such abuse isn't really needed. (And if we do need type information associated with a module then we should make it explicit and not use hacks.)
* Use __FBSDID rather than rcsid[].obrien2003-04-031-11/+3
|
* Add missing ()'s so that these drivers all compile again.jhb2003-03-311-1/+1
| | | | | Noticed by: jake Tested on: i386 (compile)
* Clean up locking and resource management for pci/if_*njl2003-03-311-33/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove locking of the softc in the attach method, instead depending on bus_setup_intr being at the end of attach (delaying interrupt enable until after ether_ifattach is called) - Call *_detach directly in the error case of attach, depending on checking in detach to only free resources that were allocated. This puts all resource freeing in one place, avoiding thinkos that lead to memory leaks. - Add bus_child_present check to calls to *_stop in the detach method to be sure hw is present before touching its registers. - Remove bzero softc calls since device_t should do this for us. - dc: move interrupt allocation back where it was before. It was unnecessary to move it. This reverts part of 1.88 - rl: move irq allocation before ether_ifattach. Problems might have been caused by allocating the irq after enabling interrupts on the card. - rl: call rl_stop before ether_ifdetach - sf: call sf_stop before ether_ifdetach - sis: add missed free of sis_tag - sis: check errors from tag creation - sis: move dmamem_alloc and dmamap_load to happen at same time as tag creation - sk: remove duplicate initialization of sk_dev - ste: add missed bus_generic_detach - ti: call ti_stop before ether_ifdetach - ti: add missed error setting in ti_rdata alloc failure - vr: add missed error setting in I/O, memory mapping cases - xl: add missed error setting in I/O, memory mapping cases - xl: remove multi-level goto on attach failure - xl: move dmamem_alloc and dmamap_load to happen at same time as tag creation - Calls to free(9) are unconditional because it is valid to call free with a null pointer. Reviewed by: imp, mdodd
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Fix an oversight in some code I added to the last commit.mdodd2003-02-081-1/+1
|
* - Remove duplicate call to callout_handle_init() in pcn_attach().mdodd2003-02-081-2/+5
| | | | | | | - Conditionalize mtx_destroy() in pcn_attach(). - Assert driver lock in pcn_intr(). Submitted by: Hiten Pandya <hiten@unixdaemons.com>
* Turn off interrupts in pcn_stop().mdodd2003-02-071-0/+4
|
* Consolidate resource release code on error condition.mdodd2003-02-061-9/+8
|
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* o track either_ifattach/ether_ifdetach API changessam2002-11-141-13/+5
| | | | | | | | | | | o use if_input for input packet processing o don't strip the Ethernet header for input packets o use BPF_* macros bpf tapping o call ether_ioctl to handle default ioctl case o track vlan changes Reviewed by: many Approved by: re
* style:alfred2002-08-231-32/+64
| | | | | put return values on a line by themselves. fix some paste issues where whitespace was used instead of tabs.
* Fix if_timer logic to make sure that there is always a timeoutluigi2002-06-301-7/+5
| | | | | | | | pending if there are packets queued for transmission. Several drivers still have the same problem. MFC after: 3 days
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-041-2/+4
| | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
* Remove __P.alfred2002-03-201-37/+37
|
* Remove printf's on mbuf/cluster allocation failures. There are nowluigi2001-12-141-6/+1
| | | | | | | equivalent and less dangerous (rate limited) messages in the mbuf allocation code. MFC after: 3 days
* Do not call mii_pollstat() from within device tick routines; the statusjlemon2001-09-291-7/+7
| | | | | | information is updated by mii_tick(). Pointed out by: wpaul (a while back)
* Apply patch supplied by Jonathan Chen: use the correct arguments towpaul2001-07-091-2/+2
| | | | | pci_enable_io(). We need to use SYS_RES_IOPORT/SYS_RES_MEMORY instead of PCIM_CMD_PORTEN/PCIM_CMD_MEMEN.
* Fix mindo:wpaul2001-06-051-1/+1
| | | | | | | | | | | | | PCN_BCR_CLRBIT(sc, PCN_BCR_MIICTL, PCN_MIICTL_DANAS); should be: PCN_BCR_SETBIT(sc, PCN_BCR_MIICTL, PCN_MIICTL_DANAS); Turning this bit on is what disables MII autoneg, not turning it off. Without this, manually setting the media doesn't work. Noticed by: Jim Browne <jbrowne@jbrowne.com>
* Workaround to prevent VMware from melting down. The pseudo PCnet interfacewpaul2001-02-261-1/+9
| | | | | | | | | | in VMware reports 0x00000000 in the PCI subsystem ID register, but 0x10001000 when you read the mirror registers in I/O space. This causes pcn_probe() to think it's found a card in 32-bit mode, and performing a 32-bit I/O access makes on a 16-bit port makes VMware go boom. Special case the 0x10001000 value until somebody at VMware grows a clue. Finally discovered by: Andrew Gallatin
* Big round of minor updates:wpaul2001-02-211-27/+21
| | | | | | | | | | | | | | - Use pci_get_powerstate()/pci_set_powerstate() in all the other drivers that need them so we don't have to fiddle with the PCI power management registers directly. - Use pci_enable_busmaster()/pci_enable_io() to turn on busmastering and PIO/memory mapped accesses. - Add support to the RealTek driver for the D-Link DFE-530TX+ which has a RealTek 8139 with its own PCI ID. (Submitted by Jason Wright) - Have the SiS 900/National DP83815 driver be sure to disable PME mode in sis_reset(). This apparently fixes a problem on some motherboards where the DP83815 chip fails to receive packets. (Submitted by Chuck McCrobie <mccrobie@cablespeed.com>)
* Convert if_multiaddrs from LIST to TAILQ so that it can be traversedphk2001-02-061-1/+1
| | | | | | backwards in the three drivers which want to do that. Reviewed by: mikeh
* Another round of the <sys/queue.h> FOREACH transmogriffer.phk2001-02-041-2/+1
| | | | | Created with: sed(1) Reviewed by: md5(1)
* Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead ofphk2001-02-031-2/+1
| | | | | | | <sys/queue.h> implementation details. Created with: /usr/sbin/sed Reviewed with: /sbin/md5
* Implement MTX_RECURSE flag for mtx_init().bmilekic2001-01-191-1/+1
| | | | | | | | | | | | | | | | | | | All calls to mtx_init() for mutexes that recurse must now include the MTX_RECURSE bit in the flag argument variable. This change is in preparation for an upcoming (further) mutex API cleanup. The witness code will call panic() if a lock is found to recurse but the MTX_RECURSE bit was not set during the lock's initialization. The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to MTX_RECURSED, which is more appropriate given its meaning. The following locks have been made "recursive," thus far: eventhandler, Giant, callout, sched_lock, possibly some others declared in the architecture-specific code, all of the network card driver locks in pci/, as well as some other locks in dev/ stuff that I've found to be recursive. Reviewed by: jhb
* Initialize/grab the mutex earlier in the attach phase, so thatwpaul2000-12-041-4/+4
| | | | | bailing out to the fail: label where we release/destroy the mutex will work without exploding.
* Update the probe some more to deal with 16/32 bit issues. If the chipwpaul2000-11-231-2/+31
| | | | | | | | | | 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.
* When checking the device code in the probe routine, leave the chip inwpaul2000-11-161-3/+22
| | | | | | | | | | | | | | | 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.
* Create a pcn_setfilt() routine that twiddles the promiscuous modewpaul2000-11-031-17/+29
| | | | | | 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.
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Use device_get_nameunit(dev) as the mutex string when callingwpaul2000-10-131-2/+3
| | | | | mtx_init() instead of hard-coded string constant. Also remember to do the mutex changes to the ste driver, which I forgot in the first commit.
* First round of converting network drivers from spls to mutexes. Thiswpaul2000-10-131-21/+43
| | | | | | | | takes care of all the 10/100 and gigE PCI drivers that I've done. Next will be the wireless drivers, then the USB ones. I may pick up some stragglers along the way. I'm sort of playing this by ear: if anyone spots any places where I've screwed up horribly, please let me know.
* When leaving suspend mode after enabling/disabling the promisc mode bit,wpaul2000-10-061-0/+4
| | | | | | make sure the chip is restarted by issuing a start command to the command register. Sometimes the receiver doesn't restart after leaving suspend mode.
* Add the card ID for the Am79c975 PCnet/FAST III card. This is a variantwpaul2000-10-051-0/+1
| | | | | | of the Am79c973 with "AlertIT Technology," whatever that is. Also mention support for the PCnet/FAST III cards in the documentation. The PCnet/FAST III chips have integrated 10/100 PHYs.
* Add support for the AMD Am79c976 PCnet/PRO controller chip. For nowwpaul2000-10-031-1/+9
| | | | | | | | | this just involves adding the chip ID to the supported list: the PCnet/PRO is compatible with the PCnet/FAST+ and friends and should "just work" with this driver. Also try to handle mbuf allocation failures in the receive handler more gracefully.
* Typo in comment (decent performances -> decent performance).wpaul2000-09-221-1/+1
|
* Make pcn_miibus_readreg() latch onto the first PHY that it finds (aswpaul2000-09-221-1/+4
| | | | | | | | | a result of mii_phy_probe()) and use that rather than hardcoding a constant. The hardcoded way was too specific to the particular card I had and caused PHY probing to fail on at least one laptop with a built-in AMD chip. Reported by: rjk@grauel.com (Richard J Kuhns)
* Remove one debug line that snuck in by accident.wpaul2000-09-201-1/+0
|
* Add a new driver for the AMD PCnet/FAST, FAST+ and Home PCI adapters.wpaul2000-09-201-0/+1340
Previously, these cards were supported by the lnc driver (and they still are, but the pcn driver will claim them first), which is fine except the lnc driver runs them in 16-bit LANCE compatibility mode. The pcn driver runs these chips in 32-bit mode and uses the RX alignment feature to achieve zero-copy receive. (Which puts it in the same class as the xl, fxp and tl chipsets.) This driver is also MI, so it will work on the x86 and alpha platforms. (The lnc driver is still needed to support non-PCI cards. At some point, I'll need to newbusify it so that it too will me MI.) The Am79c978 HomePNA adapter is also supported.
OpenPOWER on IntegriCloud