summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_xl.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean up locking and resource management for pci/if_*njl2003-03-311-113/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Fix up the long mbuf chain recovery code to use m_defrag; the oldsilby2003-03-291-19/+8
| | | | | | | code messed up on B & C chipsets because it lost the packet header and therefore the flag indicating the need for hardware checksums. MFC after: 2 weeks
* Make sure to free the correct resources when the card fails to attachsilby2003-03-191-0/+8
| | | | | | properly. (Broken in the previous commit.) Noticed by: "Niels Chr. Bank-Pedersen" <ncbp@bank-pedersen.dk>
* Instead of relying on a compile time define to determine whether the xlsilby2003-03-181-37/+33
| | | | | | | | | driver should use port or memory based IO, determine it dynamically at runtime, preferring MMIO where possible. This helps us support newer arches which dislike port based access better. Tested on i386 & sparc64, with 3c900, 905, 905b, and 905C cards. (in varying combinations by both jake and myself)
* Fix bug introduced in 1.130. For the < MHLEN case, we shouldbmilekic2003-03-041-1/+1
| | | | | | | be doing a m_gethdr(), not an m_get(). Pointed out by: Hiten Pandya <hiten@unixdaemons.com> Pointy hat to: Me
* Make xl use m_getcl() to allocate an mbuf and a cluster in one shot,bmilekic2003-02-221-19/+5
| | | | | | | | | | | | as opposed to one after the other. This is faster in both -CURRENT and -STABLE. Additionally, there is less code duplication for error-checking. One thing to note is that this code seems to return(1) when no buffers are available; perhaps ENOBUFS should be the correct return value? Partially submitted & tested by: Hiten Pandya <hiten@unixdaemons.com> MFC after: 1 week
* Fix panic on sparc64 introduced in my last commit. I reallymux2003-02-191-5/+6
| | | | | | | | | | | wish the busdma APIs were more consistent accross architectures. We should probably move all the other DMA map creations in xl_attach() where we can really handle them failing, since xl_init() is void and shouldn't fail. Pointy hat to: mux Tested by: Anders Andersson <anders@hack.org>
* Back out M_* changes, per decision of the TRB.imp2003-02-191-5/+5
| | | | Approved by: trb
* - Fix mbuf leak when we successfully allocate a new mbuf but fail tomux2003-02-181-6/+17
| | | | | | | | | bus_dmamap_load() it. - Make it so reusing mbufs when we can't allocate (or map) new ones actually works. We were previously trying to reuse a mbuf which was already bus_dmamap_unload()'ed. Reviewed by: silby
* Remove the now unused sys/malloc.h header.mux2003-01-241-1/+0
|
* Correctly identify the 3C920B chipset; although it may ship with some Nforce2silby2003-01-221-4/+4
| | | | | | boards, it's definitely not an Nvidia chip. Info from: Nvidia's Linux Network driver & pciids.sourceforge.net
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-5/+5
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Complete the support of the on-board xl(4) on nVidia nForce2 mobo's.obrien2003-01-191-0/+3
| | | | Submitted by: Mikko S. Hyvarinen <morphy@morphy.iki.fi>
* Make the xl driver work on sparc64:tmm2003-01-191-67/+99
| | | | | | | | | | | | | | | | - Add conversions to/from little endian for fields that the NIC accesses by DMA as required. - Add some bus_dmamap_sync() calls, and correct some existing ones. - Read the receiver information from the EEPROM in an endian-neutral manner. - Load all RX and TX descriptors in a single DMA map up front, and get the bus addresses of individual descriptors by address arithmetic; this fixes multiple use of the descriptor tags, which would have undesired effects. It seems that xl still does not work on e250 boxen, for reasons which are not clear yet. Reviewed by: mux
* Partial support for the nVidia nForce2 chipset's on-board Broadcom/Altima PHYobrien2003-01-121-0/+2
| | | | | | | and 3com MAC. Specifications for the Altima PHY are available at: http://www.altimacom.com/products/ac101L.html Submitted by: Mikko S. Hyvarinen <morphy@morphy.iki.fi>
* When reading PHY regs over the i2c bus, the turnaround ACK bitmbr2003-01-101-1/+1
| | | | | | | | | | is read one clock edge too late. This bit is driven low by slave (as any other input data bits from slave) when the clock is LOW. The current code did read the bit after the clock was driven high again. Reviewed by: luoqi MFC after: 2 weeks
* o Only try to recopy the mbuf into an mbuf cluster ifmux2003-01-071-13/+22
| | | | | | | | bus_dmamap_load_mbuf() returned EFBIG. o Fix mbuf leaks in an error (rare) code path. o Reuse the TX descriptor if xl_encap() failed instead of just picking the next one. o Better error messages.
* Ooops, use the full name of XL_FLAG_EEPROM_OFFSET_30silby2003-01-061-1/+1
| | | | Noticed by: Niels Chr. Bank-Pedersen <ncbp@bank-pedersen.dk>
* Add support for the 3c555 miniPCI chipset.silby2003-01-061-1/+8
| | | | | | Submitted by: johannes <johannes@paradise.net.nz> PR: 46603 MFC after: 3 days
* Add two MII_SETs to provide a bit more time between operations insilby2003-01-061-0/+2
| | | | | | xl_sync; this appears to be necessary with certain systems. Requested by: Michael Class <michael_class@gmx.net>
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,schweikh2003-01-011-1/+1
| | | | especially in troff files.
* Leave only one of the two $FreeBSD$ tag, and use __FBSDID().mux2002-12-301-6/+3
|
* Fix bug with 3c90xB cards and newer. We weren't trying tomux2002-12-181-39/+14
| | | | | | copy the mbuf chain into an mbuf cluster when there is more than 63 mbufs in the chain. We were trying with older cards though.
* Convert the xl(4) driver to the busdma API. This should makemux2002-12-171-139/+279
| | | | | | | it possible to use this driver under ia64, sparc64 (though there may be endianness issues with this one) and other archs. Tested on: i386, alpha (gallatin)
* o track either_ifattach/ether_ifdetach API changessam2002-11-141-18/+7
| | | | | | | | | | | 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
* Add some magic bits necessary to turn the transmitter on for somesilby2002-10-221-0/+7
| | | | | | | | | (newer) 556B chips. Requested & tested by: Dinesh Nambisan <dinesh@nambisan.net> Magic bits found by: Dave Dribin & Donald Becker MFC After: 3 days
* Be consistent about functions being static.phk2002-10-161-2/+2
| | | | | | Properly put macro args in (). Spotted by: FlexeLint.
* Fix two misindents.phk2002-10-011-1/+1
| | | | Spotted by: FlexeLint
* Remove all DELAY(1) calls around MII operations in the XL driver.silby2002-09-221-17/+0
| | | | | | | | | | | According to the MII specification, the delay produced by our reads alone are sufficient for correct operation. This reduces the time mii_tick takes from 10ms to ~1ms here. That's still a lot, but much better than before. Submitted by: Harti Brandt <brandt@fokus.gmd.de> MFC after: 3 weeks
* add missing \n to printfticso2002-09-091-3/+3
| | | | Approved by: gallatin (mentor)
* style: put return types on a line by themselves.alfred2002-08-241-42/+84
|
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-041-1/+2
| | | | | | | 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-56/+54
|
* Fix a problem where stats overflow interrupts would causesilby2001-12-171-1/+1
| | | | | | | | | | a major slowdown, and re-enable stats overflow interrupts. For future reference, the bug was in our code, and not some bug in the 3com chips. Reviewed by: wpaul MFC after: 2 days
* 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
* Add suspend/resume hooks to this driver; necessary to overcomeguido2001-12-051-0/+38
| | | | | | problems on HP Omnibook 500. MFC after: 1 week
* Implement TCP/IP checksum off-loading on send for the 3c905B and lateralc2001-10-221-1/+12
| | | | generation cards.
* Implement TCP/IP checksum off-loading on receive. Announcealc2001-09-231-3/+21
| | | | | | rxcsum capabilities. Reviewed by: wpaul
* Add support for the 3c656B cardbus adapter. This is one half of awpaul2001-08-281-5/+20
| | | | | | | | | | | dual function card. It needs pretty much the same flags as the 656C, except that it seems to need both the INVERT_MII_PWR and INVERT_LED_PWR flags set. Tested with cardbus in -current as of today. Also added support for the 3c656, which looks to be the same as the 656B, except it doesn't need the EEPROM_8BIT flag. I think. This one is untested, but the added support should not break any of the other cards.
* Pacify users who get all bent out of shape when they see the "xl%d: commandwpaul2001-07-271-2/+7
| | | | | | | | | | | never completed" message. The RX reset takes longer complete than it used to, a lot longer in fact than xl_wait() is prepared to wait. When we do the RX reset in xl_reset(), this cases xl_wait() to time out and whine. We wait a little extra time now after the RX reset, which should silence the warning. Thanks to obrien for finally getting me a box with a NIC that causes this problem for me to tinker with.
* 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.
* Grrr. Fix PR 27742 correctly this time. (At least I got -stable right.)wpaul2001-06-011-11/+2
|
* Close PR #27742: allow the xl driver to receive VLAN tagged frames bywpaul2001-05-311-2/+14
| | | | | | | | | | | | | | | setting the 'max packet size' register in window 3. This only works for cards based on the cyclone or newer chipsets (i.e. it won't work with the original 3c905/boomerang cards). There is a trick which will work with the boomerang, which is to turn on the 'large packets ok' bit in the MAC control register, however this lets the chip accept any frame up to 4K in length, which is larger than the mbuf cluster buffers we use to receive frames. If somebody sends us such a frame and the chip DMAs it to us, it could write past the end of the cluster buffer and clobber something. PR: kern/27742
* Big round of minor updates:wpaul2001-02-211-3/+3
| | | | | | | | | | | | | | - 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-2/+2
| | | | | | backwards in the three drivers which want to do that. Reviewed by: mikeh
* Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead ofphk2001-02-031-4/+2
| | | | | | | <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
* Use pci_get_powerstate()/pci_set_powerstate() which now exists in thewpaul2000-12-181-23/+19
| | | | | | | | PCI code. This saves each driver from having to grovel around looking for the right registers to twiddle. I should eventually convert the other PCI drivers to do this; for now, these three are ones which I know need power state handling.
* Initialize/grab the mutex earlier in the attach phase, so thatwpaul2000-12-041-3/+3
| | | | | bailing out to the fail: label where we release/destroy the mutex will work without exploding.
* Add device ID for the 3c565C card. I followed exactly the 3c575c, butimp2000-12-011-1/+8
| | | | | further tweaks may be necessary down the road. This does nothing with the serial side of the card.
OpenPOWER on IntegriCloud