summaryrefslogtreecommitdiffstats
path: root/sys/pci
Commit message (Collapse)AuthorAgeFilesLines
* intpm: add ATI IXP400 pci idavg2012-04-161-0/+3
| | | | | | | PR: kern/136762 Submitted by: Aurelien Mere <freebsd@amc-os.com> Tested by: Jens Link <jens.link@gmx.de> MFC after: 5 days
* intpm: return only SMB bus error codes from SMB methodsavg2012-04-081-3/+3
| | | | | PR: kern/25733 MFC after: 5 days
* intpm: reflect the fact that SB800 and later AMD chipsets are not supportedavg2012-04-081-0/+3
| | | | | | | | They do not have compatible configuration registers in PCI configuration space. Instead their configuration resides in AMD "PM I/O" space (accessed via a pair of I/O space registers). MFC after: 5 days
* Use correct Config registers for RTL8139 family. Unlike RTL8168 andyongari2012-02-252-14/+37
| | | | | | | | | | | | | RTL810x family , RTL8139 has different register map for Config registers. While here, follow the lead of re(4) in WOL configuration. - Disable WOL_UCAST and WOL_MCAST capabilities by default. - Config5 register write does not need to unlock EEPROM access on RTL8139 family but unlocking EEPROM access does not affect its operation and make it consistent with re(4). Reported by: Matt Renzelmann mjr <> cs dot wisc dot edu
* To save more power, switch to 10/100Mbps link when controller isyongari2011-11-231-0/+1
| | | | | | | | put into suspend/shutdown. Old PCI controllers performed that operation in firmware but for RTL8111C or newer controllers, it's responsibility of driver. It's not clear whether the firmware of RTL8111B still downgrades its speed to 10/100Mbps so leave it as it was.
* Make sure to stop TX MAC before freeing queued TX frames.yongari2011-11-231-16/+19
| | | | | | For RTL8111DP, check if the TX MAC is active by reading RL_GTXSTART register. For RTL8402/8168E-VL/8168F/8411, wait until TX queue is empty.
* - There's no need to overwrite the default device method with the defaultmarius2011-11-223-13/+4
| | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
* Add preliminary support for RTL8168/8111F PCIe Gigabit ethernet.yongari2011-11-171-0/+1
| | | | H/W donated by: RealTek Semiconductor Corp.
* Add preliminary support for second generation RTL8105E PCIeyongari2011-11-171-0/+1
| | | | | | FastEthernet. H/W donated by: RealTek Semiconductor Corp.
* Disable PCIe ASPM (Active State Power Management) for allyongari2011-11-161-0/+1
| | | | | | | | | controllers. More and more RealTek controllers started to implement EEE feature. Vendor driver seems to load a kind of firmware for EEE with additional PHY fixups. It is known that the EEE feature may need ASPM support. Unfortunately there is no documentation for EEE of the controller so enabling ASPM may cause more problems.
* Add preliminary support for RTL8411 PCIe Gigabit ethernet withyongari2011-11-161-0/+1
| | | | | | integrated card reader. H/W donated by: RealTek Semiconductor Corp.
* Add preliminary support for RTL8402 PCIe FastEthernet withyongari2011-11-161-0/+1
| | | | | | integrated card reader. H/W donated by: RealTek Semiconductor Corp.
* - Import the common MII bitbang'ing code from NetBSD and convert drivers tomarius2011-11-012-201/+52
| | | | | | | | | | | | | | | | | | | | | | | | take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 4k. The only potential in-tree user left unconverted is xe(4), which generally should be changed to use miibus(4) instead of implementing PHY handling on its own, as otherwise it makes not much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just for the MII bitbang'ing code. The common MII bitbang'ing code also is useful in the embedded space for using GPIO pins to implement MII access. - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the MII bitbang read and write functions of the other drivers converted in order to ensure the intended ordering. Given that register access via an index register as well as register bank/window switching is subject to the same problem, also add bus barriers to the respective functions of smc(4), tl(4) and xl(4). - Sprinkle some const. Thanks to the following testers: Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4)) Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4). Reviewed by: yongari (subset of drivers) Obtained from: NetBSD (partially)
* Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.yongari2011-10-171-1/+1
| | | | | | | | Because driver is accessing a common MII structure in mii_pollstat(), updating user supplied structure should be done before dropping a driver lock. Reported by: Karim (fodillemlinkarimi <> gmail dot com)
* Add new device id of D-Link DGE-530T Rev. C controller. DGE-503Tyongari2011-07-301-0/+1
| | | | | | | | Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Approved by: re (kib)
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls tojhb2011-03-231-3/+3
| | | | pci_find_cap() instead.
* Add initial support for RTL8401E PCIe Fast Ethernet.yongari2011-02-161-0/+1
| | | | PR: 154789
* Add support for RTL8105E PCIe Fast Ethernet controller. It seemsyongari2011-01-261-0/+1
| | | | | | | | | | | | | | the controller has a kind of embedded controller/memory and vendor applies a large set of magic code via undocumented PHY registers in device initialization stage. I guess it's a firmware image for the embedded controller in RTL8105E since the code is too big compared to other DSP fixups. However I have no idea what that magic code does and what's purpose of the embedded controller. Fortunately driver seems to still work without loading the firmware. While I'm here change device description of RTL810xE controller. H/W donated by: Realtek Semiconductor Corp.
* Do not use interrupt taskqueue on controllers with MSI/MSI-Xyongari2011-01-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | capability. One of reason using interrupt taskqueue in re(4) was to reduce number of TX/RX interrupts under load because re(4) controllers have no good TX/RX interrupt moderation mechanism. Basic TX interrupt moderation is done by hardware for most controllers but RX interrupt moderation through undocumented register showed poor RX performance so it was disabled in r215025. Using taskqueue to handle RX interrupt greatly reduced number of interrupts but re(4) consumed all available CPU cycles to run the taskqueue under high TX/RX network load. This can happen even with RTL810x fast ethernet controller and I believe this is not acceptable for most systems. To mitigate the issue, use one-shot timer register to moderate RX interrupts. The timer register provides programmable one-shot timer and can be used to suppress interrupt generation. The timer runs at 125MHZ on PCIe controllers so the minimum time allowed for the timer is 8ns. Data sheet says the register is 32 bits but experimentation shows only lower 13 bits are valid so maximum time that can be programmed is 65.528us. This yields theoretical maximum number of RX interrupts that could be generated per second is about 15260. Combined with TX completion interrupts re(4) shall generate less than 20k interrupts. This number is still slightly high compared to other intelligent ethernet controllers but system is very responsive even under high network load. Introduce sysctl variable dev.re.%d.int_rx_mod that controls amount of time to delay RX interrupt processing in units of us. Value 0 completely disables RX interrupt moderation. To provide old behavior for controllers that have MSI/MSI-X capability, introduce a new tunable hw.re.intr_filter. If the tunable is set to non-zero value, driver will use interrupt taskqueue. The default value of the tunable is 0. This tunable has no effect on controllers that has no MSI/MSI-X capability or if MSI/MSI-X is explicitly disabled by administrator. While I'm here cleanup interrupt setup/teardown since re(4) uses single MSI/MSI-X message at this moment.
* Remove TX taskqueue and directly invoke re_start in interrupt task.yongari2011-01-251-1/+0
|
* Prefer MSI-X to MSI on controllers that support MSI-X. Allyongari2011-01-251-0/+2
| | | | | | | recent PCIe controllers(RTL8102E or later and RTL8168/8111C or later) supports either 2 or 4 MSI-X messages. Unfortunately vendor did not publicly release RSS related information yet. However switching to MSI-X is one-step forward to support RSS.
* Change model names of controller RTL_HWREV_8168_SPIN[123] to real ones.yongari2011-01-181-3/+3
| | | | | | | s/RL_HWREV_8168_SPIN1/RL_HWREV_8168B_SPIN1/g s/RL_HWREV_8168_SPIN2/RL_HWREV_8168B_SPIN2/g s/RL_HWREV_8168_SPIN3/RL_HWREV_8168B_SPIN3/g No functional changes.
* Implement initial jumbo frame support for RTL8168/8111 C/D/E PCIeyongari2011-01-171-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | GbE controllers. It seems these controllers no longer support multi-fragmented RX buffers such that driver have to allocate physically contiguous buffers. o Retire RL_FLAG_NOJUMBO flag and introduce RL_FLAG_JUMBOV2 to mark controllers that use new jumbo frame scheme. o Configure PCIe max read request size to 4096 for standard frames and reduce it to 512 for jumbo frames. o TSO/checksum offloading is not supported for jumbo frames on these controllers. Reflect it to ioctl handler and driver initialization. o Remove unused rl_stats_no_timeout in softc. o Embed a pointer to structure rl_hwrev into softc to keep track of controller MTU limitation and remove rl_hwrev in softc since that information is available through a pointer to structure rl_hwrev. Special thanks to Realtek for donating sample hardwares which made this possible. H/W donated by: Realtek Semiconductor Corp.
* Add initial support for RTL8168E/8111E-VL PCIe GbE.yongari2011-01-171-0/+1
| | | | H/W donated by: Realtek Semiconductor Corp.
* Implement TSO on RealTek RTL8168/8111 C or later controllers.yongari2011-01-101-0/+2
| | | | | | | | | | | | RealTek changed TX descriptor format for later controllers so these controllers require MSS configuration in different location of TX descriptor. TSO is enabled by default for controllers that use new descriptor format. For old controllers, TSO is still disabled by default due to broken frames under certain conditions but users can enable it. Special thanks to Hayes Wang at RealTek. MFC after: 2 weeks
* Remove standard PCI configuration space register definitions.yongari2010-11-081-35/+0
|
* Remove trailing white spaces.yongari2010-11-081-7/+7
|
* Consistently use tab character instead of using space character.yongari2010-11-081-500/+500
| | | | No functional changes.
* Follow the lead of vendor's interrupt moderation mechanism.yongari2010-11-081-1/+2
| | | | | | | | | | | | | | It seems RTL8169/RTL8168/RTL810xE has a kind of interrupt moderation mechanism but it is not documented at all. The magic value dramatically reduced number of interrupts without noticeable performance drops so apply it to all RTL8169/RTL8169 controllers. Vendor's FreeBSD driver also applies it to RTL810xE controllers but their Linux driver explicitly cleared the register, so do not enable interrupt moderation for RTL810xE controllers. While I'm here sort 8169 specific registers. Obtained from: RealTek FreeBSD driver
* Add simple MAC statistics counter reading support. Unfortunatelyyongari2010-11-051-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | useful counters like rl_missed_pkts is 16 bits quantity which is too small to hold meaningful information happened in a second. This means driver should frequently read these counters in order not to lose accuracy and that approach is too inefficient in driver's view. Moreover it seems there is no way to trigger an interrupt to detect counter near-full or wraparound event as well as lacking clearing the MAC counters. Another limitation of reading the counters from RealTek controllers is lack of interrupt firing at the end of DMA cycle of MAC counter read request such that driver have to poll the end of the DMA which is a time consuming process as well as inefficient. The more severe issue of the MAC counter read request is it takes too long to complete the DMA. All these limitation made maintaining MAC counters in driver impractical. For now, just provide simple sysctl interface to trigger reading the MAC counters. These counters could be used to track down driver issues. Users can read MAC counters maintained in controller with the following command. #sysctl dev.re.0.stats=1 While I'm here add check for validity of dma map and allocated memory before unloading/freeing them. Tested by: rmacklem
* Convert the PHY drivers to honor the mii_flags passed down and convertmarius2010-10-151-13/+10
| | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari
* Rewrite interrupt handler to give fairness for both RX and TX.yongari2010-10-131-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously rl(4) continuously checked whether there are RX events or TX completions in forever loop. This caused TX starvation under high RX load as well as consuming too much CPU cycles in the interrupt handler. If interrupt was shared with other devices which may be always true due to USB devices in these days, rl(4) also tried to process the interrupt. This means polling(4) was the only way to mitigate the these issues. To address these issues, rl(4) now disables interrupts when it knows the interrupt is ours and limit the number of iteration of the loop to 16. The interrupt would be enabled again before exiting interrupt handler if the driver is still running. Because RX buffer is 64KB in size, the number of iterations in the loop has nothing to do with number of RX packets being processed. This change ensures sending TX frames under high RX load. RX handler drops a driver lock to pass received frames to upper stack such that there is a window that user can down the interface. So rl(4) now checks whether driver is still running before serving RX or TX completion in the loop. While I'm here, exit interrupt handler when driver initialized controller. With this change, now rl(4) can send frames under high RX load even though the TX performance is still not good(rl(4) controllers can't queue more than 4 frames at a time so low TX performance was one of design issue of rl(4) controllers). It's much better than previous TX starvation and you should not notice RX performance drop with this change. Controller still shows poor performance under high network load but for many cases it's now usable without resorting to polling(4). MFC after: 2 weeks
* Rename rl_setmulti() to rl_rxfilter() as rl_rxfilter() will handleyongari2010-09-301-66/+42
| | | | | | | | | | | | | | | | | | | | IFF_ALLMULTI/IFF_PROMISC as well as multicast filter configuration. Rewrite RX filter logic to reduce number of register accesses and make it handle promiscuous/allmulti toggling without controller reinitialization. Previously rl(4) counted on controller reinitialization to reprogram promiscuous configuration but r211767 resulted in avoiding controller reinitialization whenever promiscuous mode is toggled. To address this, keep track of driver's view of interface state and handle IFF_ALLMULTI/IFF_PROMISC changes without reinitializing controller. This should fix a regression introduced in r211267. While I'm here remove unnecessary variable reassignment in ioctl handler. PR: kern/151079 MFC after: 1 week
* Remove unnecessary controller reinitialization.yongari2010-08-241-2/+12
| | | | PR: kern/87506
* It seems some newer RTL8139 controllers provides only memory spaceyongari2010-08-221-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | register mapping. I'm not sure whether it comes from the fact that controllers live behind certain PCI brdge(PLX PCI 6152 33BC) and the bridge has some issues in handling I/O space register mapping. Unfortunately it's not possible to narrow down to an exact controller that shows this issue because RealTek used the same PCI device/revision id again. In theory, it's possible to check parent PCI bridge device and change rl(4) to use memory space register mapping if the parent PCI bridge is PLX PCI 6152. But I didn't try to do that and we wouldn't get much benefit with added complexity. Blindly switching to use memory space register mapping for rl(4) may make most old controllers not to work. At least, I don't want to take potential risk from such change. So use I/O space register mapping by default but give users chance to override it via a tunable. The tunable to use memory space register mapping would be given by adding the following line to /boot/loader.conf file. dev.rl.%d.prefer_iomap="0" This change makes P811B quad-port work with this tunable. Tested by: Nikola Kalpazanov ( n.kalpazanov <> gmail dot com ) MFC after: 1 week
* Implement WOL. WOL is supported on RTL8139B or newer controllers.yongari2010-07-191-2/+139
| | | | PR: kern/148013
* Add new tunable 'net.link.ifqmaxlen' to set default send interfacesobomax2010-05-031-2/+2
| | | | | | | | | | queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month
* Consistently use capital letters.yongari2010-04-091-2/+2
|
* Add preliminary support for 8168E/8111E PCIe controller.yongari2010-04-091-0/+3
| | | | | | | While I'm here simplify device description string. Tested by: Michael Beckmann < michael <> apfel dot de > MFC after: 5 days
* Add initial support for RTL8103E PCIe fastethernet.yongari2010-01-271-0/+1
| | | | PR: kern/142974
* Add support for four more nfsmb controllers, shipping on at least thegavin2010-01-241-0/+12
| | | | | | | | | ASUS Atom ION boards. PR: kern/142571 Submitted by: oliver Approved by: ed (mentor) MFC after: 1 week
* Remove extraneous semicolons, no functional changes.mbr2010-01-071-1/+1
| | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week
* intpm/sb700: force polling mode if configured interrupt is SMIavg2009-09-191-0/+6
| | | | instead of failing to attach
* intpm: add support for smbus controller found in AMD SB700avg2009-09-122-13/+43
| | | | | | | | | | | | | | | | According to the specifications AMD/ATI SMBus controller is very similar to SMBus controller found in PIIX4. Some notable differences: o different bit for enabling/signalling regular interrupt mode o in practice seems to support only polling mode Thus, intpm driver is modified to support polling-only mode and to recognize SB700 PCI ID and differences. Tested on: SB700 and PIIX4E platforms Reviewed by: jhb MFC after: 2 weeks X-Perhaps-ToDo: rename the driver to reflect its function and supported hardware
* Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" toyongari2009-08-241-0/+1
| | | | | | | | the description of RTL8168D as RL_HWREV_8168D can be either RTL8168D or RTL8111D. PR: kern/137672 MFC after: 3 days
* Adding hardware ID for RTL810x PCIe found on HP Pavilion DV2-1022AX.avatar2009-07-141-0/+1
| | | | | Reviewed by: yongari Approved by: re (kib, kensmith)
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/rwatson2009-06-261-2/+2
| | | | | | | | | | | | | IF_ADDR_UNLOCK() across network device drivers when accessing the per-interface multicast address list, if_multiaddrs. This will allow us to change the locking strategy without affecting our driver programming interface or binary interface. For two wireless drivers, remove unnecessary locking, since they don't actually access the multicast address list. Approved by: re (kib) MFC after: 6 weeks
* When user_frac in the polling subsystem is low it is going to busy theattilio2009-05-301-10/+17
| | | | | | | | | | | | | | | | | | | | | CPU for too long period than necessary. Additively, interfaces are kept polled (in the tick) even if no more packets are available. In order to avoid such situations a new generic mechanism can be implemented in proactive way, keeping track of the time spent on any packet and fragmenting the time for any tick, stopping the processing as soon as possible. In order to implement such mechanism, the polling handler needs to change, returning the number of packets processed. While the intended logic is not part of this patch, the polling KPI is broken by this commit, adding an int return value and the new flag IFCAP_POLLING_NOCOUNT (which will signal that the return value is meaningless for the installed handler and checking should be skipped). Bump __FreeBSD_version in order to signal such situation. Reviewed by: emaste Sponsored by: Sandvine Incorporated
* For RTL8139C+ controllers, have controller handle padding shortyongari2009-04-201-0/+1
| | | | | | | | | | | | | checksum offload frames. Software workaround used for broken controllers(RTL8169, RTL8168, RTL8168B) seem to cause watchdog timeouts on RTL8139C+. Introduce a new flag RL_FLAG_AUTOPAD to mark automatic padding feature of controller and set it for RTL8139C+ and controllers that use new descriptor format. This fixes watchdog timeouts seen on RTL8139C+. Reported by: Dimitri Rodis < DimitriR <> integritasystems dot com > Tested by: Dimitri Rodis < DimitriR <> integritasystems dot com >
* intpm: minor enhancementsavg2009-03-161-8/+8
| | | | | | | | | | | 1. fix nointr check in intsmb_start, matters only if ENABLE_ALART is defined (by default, it is not); 2. drop unnecessary inspection/reporting of power-management io registers base address; 3. in verbose mode report errors from SMBus host controller and their mapping to smbus(4) errors; Approved by: jhb (mentor)
OpenPOWER on IntegriCloud