summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_rl.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove explicit cardbus attachments from drivers where this is identicaldfr2003-11-031-1/+0
| | | | | | | to the pci attachment. Cardbus is a derived class of pci so all pci drivers are automatically available for matching against cardbus devices. Reviewed by: imp
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-2/+1
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Re-enable VLAN_MTU capability for this driver. (Got reverted whenwpaul2003-09-111-0/+1
| | | | I pulled out the C+/8169 bits.)
* Add a PHY driver to support the built-in gigE PHY in the 8169S/8110Swpaul2003-09-111-1/+2
| | | | | | | | | | | | | | | | | | ethernet chips. This driver is pretty simple, however it contains special DSP initialization code which is needed in order to get the chip to negotiate a gigE link. (This special initialization may not be needed in subsequent chip revs.) Also: - Fix typo in if_rlreg.h (RL_GMEDIASTAT_1000MPS -> RL_GMEDIASTAT_1000MBPS) - Deal with shared interrupts in re_intr(): if interface isn't up, return. - Fix another bug in re_gmii_writereg() (properly apply data field mask) - Allow PHY driver to read the RL_GMEDIASTAT register via the re_gmii_readreg() register (this is register needed to determine real time link/media status).
* Teach rl(4) about new hwrev codes.wpaul2003-09-101-1/+2
|
* Fix path of pci #includes that I botched.wpaul2003-09-081-2/+2
| | | | Also pointed out by: Larry Rosenman
* Take the support for the 8139C+/8169/8169S/8110S chips out of thewpaul2003-09-081-1219/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rl(4) driver and put it in a new re(4) driver. The re(4) driver shares the if_rlreg.h file with rl(4) but is a separate module. (Ultimately I may change this. For now, it's convenient.) rl(4) has been modified so that it will never attach to an 8139C+ chip, leaving it to re(4) instead. Only re(4) has the PCI IDs to match the 8169/8169S/8110S gigE chips. if_re.c contains the same basic code that was originally bolted onto if_rl.c, with the following updates: - Added support for jumbo frames. Currently, there seems to be a limit of approximately 6200 bytes for jumbo frames on transmit. (This was determined via experimentation.) The 8169S/8110S chips apparently are limited to 7.5K frames on transmit. This may require some more work, though the framework to handle jumbo frames on RX is in place: the re_rxeof() routine will gather up frames than span multiple 2K clusters into a single mbuf list. - Fixed bug in re_txeof(): if we reap some of the TX buffers, but there are still some pending, re-arm the timer before exiting re_txeof() so that another timeout interrupt will be generated, just in case re_start() doesn't do it for us. - Handle the 'link state changed' interrupt - Fix a detach bug. If re(4) is loaded as a module, and you do tcpdump -i re0, then you do 'kldunload if_re,' the system will panic after a few seconds. This happens because ether_ifdetach() ends up calling the BPF detach code, which notices the interface is in promiscuous mode and tries to switch promisc mode off while detaching the BPF listner. This ultimately results in a call to re_ioctl() (due to SIOCSIFFLAGS), which in turn calls re_init() to handle the IFF_PROMISC flag change. Unfortunately, calling re_init() here turns the chip back on and restarts the 1-second timeout loop that drives re_tick(). By the time the timeout fires, if_re.ko has been unloaded, which results in a call to invalid code and blows up the system. To fix this, I cleared the IFF_UP flag before calling ether_ifdetach(), which stops the ioctl routine from trying to reset the chip. - Modified comments in re_rxeof() relating to the difference in RX descriptor status bit layout between the 8139C+ and the gigE chips. The layout is different because the frame length field was expanded from 12 bits to 13, and they got rid of one of the status bits to make room. - Add diagnostic code (re_diag()) to test for the case where a user has installed a broken 32-bit 8169 PCI NIC in a 64-bit slot. Some NICs have the REQ64# and ACK64# lines connected even though the board is 32-bit only (in this case, they should be pulled high). This fools the chip into doing 64-bit DMA transfers even though there is no 64-bit data path. To detect this, re_diag() puts the chip into digital loopback mode and sets the receiver to promiscuous mode, then initiates a single 64-byte packet transmission. The frame is echoed back to the host, and if the frame contents are intact, we know DMA is working correctly, otherwise we complain loudly on the console and abort the device attach. (At the moment, I don't know of any way to work around the problem other than physically modifying the board, so until/unless I can think of a software workaround, this will have do to.) - Created re(4) man page - Modified rlphy.c to allow re(4) to attach as well as rl(4). Note that this code works for the sample 8169/Marvell 88E1000 NIC that I have, but probably won't work for the 8169S/8110S chips. RealTek has sent me some sample NICs, but they haven't arrived yet. I will probably need to add an rlgphy driver to handle the on-board PHY in the 8169S/8110S (it needs special DSP initialization).
* Use stream bus space accesses to program the ID (station address)tmm2003-09-041-2/+4
| | | | | registers; otherwise, the byte order of the address is changed on big-endian machines.
* Use PCIR_BAR(x) instead of PCIR_MAPS.jhb2003-09-021-2/+2
| | | | | Glanced over by: imp, gibbs Tested by: i386 LINT
* Prefer new location of pci include files (which have only been in theimp2003-08-221-2/+2
| | | | | tree for two or more years now), except in a few places where there's code to be compatible with older versions of FreeBSD.
* Argh. Last commit only had the __FBSDID() fix. Really add the device IDwpaul2003-08-151-0/+2
| | | | for the 8100 this time.
* It appears in some configurations with an on-board RTL8100 chip (in thiswpaul2003-08-151-2/+0
| | | | | | | | | | case, a "Vortex86" mini PC), the PCI device ID value in the EEPROM (0x8100) does not agree with the PCI device ID returned by pci_get_device() (0x8139). This means that while rl_probe() matches the device, rl_attach() doesn't. Work around this by adding an entry to the rl_devs table for the 8100 with a device ID of 0x8100. Also, get rid of extra instance of __FBSDID(). One is enough.
* Set the TX hardware checksum offload bits on all the descriptors of awpaul2003-08-131-17/+22
| | | | | | | multi-fragment transmission. I'm not sure if this is a bug or a requirement that I overlooked with going through the documentation, but the sample 8169 NIC that I have seems to require it at least some of the time or else it botches TCP checksums on segments that span multiple descriptors.
* Grrr. There is a gratuitous difference in the RX descriptor statuswpaul2003-08-101-0/+18
| | | | | | | | | | | | word between the 8139C+ and the 8169. The 8139C+ has a 'frame alignment error bit' (bit 27) but the 8169 does not. Rather than simply mark this bit as reserved, RealTek removed it completely and shifted the remaining status bits one space to the left. This was causing rl_rxeofcplus() to misparse the error and checksum bits. To workaround this, rl_rxeofcplus() now shifts the rxstat word one bit to the right before testing any of the status bits (but after the frame length has been extracted).
* - Update some comments regarding hardware details of the 8169 andwpaul2003-08-101-37/+54
| | | | | | | | | | | | | | | | | note the existence of the 8169S and 8110S components. (The 8169 is just a MAC, the 8169S and 8110S contain both a MAC and PHY.) - Properly handle list and buffer addresses as 64-bit. The RX and TX DMA list addresses should be bus_addr_t's. Added RL_ADDR_HI() and RL_ADDR_LO() macros to obtain values for writing into chip registers. - Set a slightly different TIMERINT value for 8169 NICs for improved performance. - Change left out of previous commit log: added some additional hardware rev codes for other 10/100 chips and for the 8169S/8110S 'rev C' gigE MACs.
* Add preliminary support for the RealTek 8169 gigE chip. Changes:wpaul2003-08-071-4/+96
| | | | | | | | | | | | | | | | | | | | | - Fix a bug in rl_dma_map_desc(): set the 'end of ring' bit in the right descriptor (DESC_CNT - 1, not DESC_CNT). The 8139C+ is limited to 64 descriptors and automatically wraps at 64 descriptors even if the EOR bit isn't set, but the 8169 NIC can have up to 1024 descriptors per ring, so we must set the wrap point in the right place. - RealTek moved the RL_TIMERINT register from offset 0x54 to 0x58 in the 8169 -- account for this. - Added rl_gmii_readreg() and rl_gmii_writereg() routines. - Fix rl_probe() to deal with the case where the base type is not RL_8139. The next step is to add jumbo buffer support. Tested with the Xterasys XN-152 NIC (hard to beat $29 for a gigE NIC).
* Use the BUS_DMA_ZERO flag.mux2003-07-271-6/+2
|
* Fix a busdma bogon:wpaul2003-07-181-3/+3
| | | | | | Some of the calls to bus_dmamap_sync() were syncing the DMA descriptor ring maps using the mbuf tag, when they should have been using the descriptor ring tag instead.
* Add support for the 8139C+ chipset. Unlike the other chips in the 8139wpaul2003-07-101-108/+1139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | series, the 8139C+ has a descriptor-based DMA mechanism, and its performance is actually pretty respectable. Note: the 8139D chip does not support C+ mode. Only the 8139C+ and 8169 gigE chips support C+ mode. Supported features: - RX and TX checksum offload - hardware VLAN tag insertion/extraction - TX interrupt moderation using the 8139's on-board timer Everything should be properly busdma'ed and endian-independent, so things should work ok on non-x86 platforms. Unfortunately, my call for testers on this code was met with deafening silence, and I don't have access to any non-x86 FreeBSD boxes at the moment, so this is speculation. The device detection code has been cleaned up a little as well (thanks to Michal Mertl) for the patches. There are also updates to the rl(4) man page (which I accidentally checked in before when I updated the dc(4) man page. Oops.) Todo: finish support for the 8169 gigabit ethernet chip. This mainly requires writing an rlgphy driver to handle the 8169's built-in PHY. This will have to wait until I actually get my hands on an 8169 card for testing though. (I still can't find a source for one in the U.S. Suggestions/pointers welcome.)
* Due to extreme bogusness in the pci bus layer, these drivers wereimp2003-07-031-2/+2
| | | | | | | | | forced to do slightly bogus power state manipulation. However, this is one of those features that is preventing further progress, so mark them as BURN_BIRDGES like I did for the drivers in sys/dev/... This, like the other change, are a no-op unless you have BURN_BRIDGES in your kernel.
* Mega busdma API commit.scottl2003-07-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg. Lockfunc allows a driver to provide a function for managing its locking semantics while using busdma. At the moment, this is used for the asynchronous busdma_swi and callback mechanism. Two lockfunc implementations are provided: busdma_lock_mutex() performs standard mutex operations on the mutex that is specified from lockfuncarg. dftl_lock() is a panic implementation and is defaulted to when NULL, NULL are passed to bus_dma_tag_create(). The only time that NULL, NULL should ever be used is when the driver ensures that bus_dmamap_load() will not be deferred. Drivers that do not provide their own locking can pass busdma_lock_mutex,&Giant args in order to preserve the former behaviour. sparc64 and powerpc do not provide real busdma_swi functions, so this is largely a noop on those platforms. The busdma_swi on is64 is not properly locked yet, so warnings will be emitted on this platform when busdma callback deferrals happen. If anyone gets panics or warnings from dflt_lock() being called, please let me know right away. Reviewed by: tmm, gibbs
* In order to set the MAC address on RealTek NICs, you must flip WRITECFGwpaul2003-06-291-5/+9
| | | | | | | | | | bit in the EEPROM mode register on. Also, the address must be written in two 32-bit register accesses instead of 6 8-bit accesses. Tested with my 8139B cardbus NIC. PR: kern/35900 Submitted by: Mark Kettenis <kettenis@chello.nl>
* Use __FBSDID().obrien2003-06-111-0/+3
|
* Remove break after return;phk2003-05-311-2/+0
| | | | 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
* Revise attach/detach resource cleanupnjl2003-04-171-4/+14
| | | | | | | | | | | | | | | - 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
* - Don't call pci_enable_io() in drivers (unless needed for resume).mdodd2003-04-161-18/+0
| | | | | - 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-2/+4
| | | | | | | | 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.)
* Rework the rl_encap failure case. Previously, we would stuff thesilby2003-04-151-3/+3
| | | | | | | | | | | | | unencapsulated packet back into the IFQ. Unfortunately, the only reason rl_encap would fail was due to m_defrag failing, which should only happen when we're low on mbufs. Hence, it was possible for us to end up with an IFQ full of packets which could never clear the queue because they could never be defragmented because they were themselves taking up all the mbufs. To solve this, take if_xl's approach to the problem of encapsulation failure: drop the packet. MFC after: 3 days
* Quick fix so that the watchdog timer is not set unless packets aresilby2003-04-081-4/+5
| | | | | | | actually queued for transmission. Without this, a low memory situation would trigger false watchdog timeouts. MFC after: 1 week
* 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-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Switch rl_encap over to using m_defrag.silby2003-03-301-11/+1
| | | | | | | No functional change, the previous rl_encap was correct wrt long mbuf chains; this just reduces code duplication. MFC after: 2 weeks
* Add support for Planex FNW-3800-TX(CardBus 100M/10M).sanpei2003-03-181-1/+4
| | | | | Submitted by: Kunihiro Arai <araik@attglobal.net> Obtained from: [bsd-nomads:16625]
* Add support for Peppercon ROL-F Card.dan2003-02-231-0/+2
| | | | | Submitted by: Sascha Holzeiter <sascha@root-login.org> PR: 48559
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Clean up exit path from rl_attach() to remove multiple returnsnjl2003-02-091-3/+3
|
* 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.
* FBSDIDize and clean up whitespace nits.des2003-01-111-30/+25
|
* Read sanpei's mind, and unbreak the build.des2003-01-111-2/+3
|
* Add support for Corega FEtherII CB-TXD (CardBus 100M/10M).sanpei2003-01-111-2/+5
| | | | Fix typo (Coreaga->Corega)
* 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
* Tweaks to make if_rl work on sparc64.jake2003-01-051-4/+10
| | | | | Mostly submitted by: tmm Tested on: i386, sparc64
* o track either_ifattach/ether_ifdetach API changessam2002-11-141-16/+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
* Don't take out the rl_mtx lock in the attach routine. The only wayimp2002-10-291-19/+15
| | | | | we'd need it is if we're interrupted. So, register the interrupt last in the attach routine.
* 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
* Add support for Corega FEther CB-TXD (CardBus 100M/10M).iwasaki2002-09-061-1/+3
|
* 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.
* Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoidsobomax2002-08-181-3/+3
| | | | | | | breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's. Reviewed by: -hackers, -net
OpenPOWER on IntegriCloud