summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_vr.c
Commit message (Collapse)AuthorAgeFilesLines
* vr(4) was repocopied to src/sys/dev/vr.yongari2008-03-111-1605/+0
|
* Fix function prototype for device_shutdown method.yongari2007-11-221-2/+4
|
* Not all VIA Rhine chips support 256 register space. So touchingyongari2007-10-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VR_STICKHW register would result in unexpected results on these hardwares. wpaul said the following for the issue. The vr_attach() routine unconditionally does this for all supported chips: /* * Windows may put the chip in suspend mode when it * shuts down. Be sure to kick it in the head to wake it * up again. */ VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1)); The problem is, the VR_STICKHW register is not valid on all Rhine devices. The VT86C100A chip, which is present on the D-Link DFE-530TX boards, doesn't support power management, and its register space is only 128 bytes wide. The VR_STICKHW register offset falls outside this range. This may go unnoticed in most scenarios, but if you happen to have another PCI device in your system which is assigned the register space immediately after that of the Rhine, the vr(4) driver will incorrectly stomp it. In my case, the BIOS on my test board decided to put the register space for my PRO/100 ethernet board right next to the Rhine, and the Rhine driver ended up clobbering the IMR register of the PRO/100 device. (Long story short: the board kept locking up on boot. Took me the better part of the morning suss out why.) The strictly correct thing to do would be to check the PCI config space to make sure the device supports the power management capability and only write to the VR_STICKHW register if it does. Instead of inspecting chip revision numbers for the availability of VR_STICKHW register, check the existence of power management capability of the hardware as wpaul suggested. Reported by: wpaul Suggested by: wpaul OK'ed by: jhb
* Add VLAN capability.phk2007-04-231-0/+1
| | | | Submitted by: Slawa Olhovchenkov <slw@zxy.spb.ru>
* Remove the old software bit-banging MII interface, we started usingphk2007-04-221-167/+1
| | | | the Rhines shiftregisters in four years ago (1.60).
* Remove further cobwebs: Two layers of pointless substructures.phk2007-04-221-72/+67
|
* Initialize the physical next pointer in the tx descriptors when wephk2007-04-221-7/+8
| | | | initialize instead of in the start routine.
* Don't rename fields with #define.phk2007-04-221-14/+14
| | | | | Collapse two semantically identical structs. Add missing vr_ prefix.
* Run if_vr(4) through FlexeLint and clean some of the cobwebs found.phk2007-04-221-63/+59
|
* Add support for hw-assisted checksums on 6105M.phk2007-04-171-16/+61
| | | | Sponsored by: Soekris Engineering
* No need to throw tag+handle around on the stack.phk2007-04-171-3/+0
|
* Improve the if_vr driver ever so slightly.phk2007-04-171-86/+107
| | | | | | | | | | | | | The 6105M and 6102 does not have the DWORD alignment problem, so don't m_defrag() every packet in the transmit path for those. More stringent usage of tx-descriptor ring and its flags. Tested on 6102 and 6105M, other chips may also be able to run without the m_defrag() but I have neither hardware nor docs to find out. Sponsored by: Soekris Engineering
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-1/+1
| | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
* Consistently use if_printf() only in interface methods: if_start,glebius2006-09-151-9/+11
| | | | | | | | | | if_ioctl, if_watchdog, etc, or in functions that are used by these methods only. In all other cases use device_printf(). This also fixes several panics, when if_printf() is called before softc->ifp was initialized. Submitted by: Alex Lyashkov <umka sevcity.net>
* Do not touch ifp->if_baudrate in miibus aware drivers.glebius2006-02-141-1/+0
|
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-1/+1
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* - Use callout_*() to manage the callout and make it MPSAFE.jhb2005-10-311-15/+10
| | | | | | | - Fix locking in detach(), we only need to lock across vr_stop(). Tested by: Mike Tancsa mike at sentex dot net MFC after: 1 week
* - Use if_printf() and device_printf() and remove vr_unit from the softc.jhb2005-10-271-52/+44
| | | | | | I had to initialize the ifnet a bit earlier in attach so that the if_printf()'s in vr_reset() didn't explode with a page fault. - Use M_ZERO with contigmalloc() rather than an explicit bzero.
* Replace FreeBSD 3.x syntax (controller miibus0) with 4.x syntaximp2005-10-221-1/+1
| | | | (device miibus) in time for 7.0 :-)
* In detach method, move if_free() after bus_teardown_intr().ru2005-10-131-2/+3
|
* - Don't pollute opt_global.h with DEVICE_POLLING and introduceglebius2005-10-051-0/+4
| | | | | | | | | opt_device_polling.h - Include opt_device_polling.h into appropriate files. - Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that can be compiled as loadable modules. Reviewed by: bde
* Big polling(4) cleanup.glebius2005-10-011-31/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Axe poll in trap. o Axe IFF_POLLING flag from if_flags. o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling. o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt. o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig. Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed. Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts. Reviewed by: ru, sam, jhb
* Fix "struct ifnet" leaks when attach() fails in the middle, e.g.ru2005-09-161-2/+2
| | | | | | when mii_phy_probe() or bus_setup_intr() fails. For drivers that call their detach() in this case, call if_free() there to cover this case too.
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-7/+7
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* Modify device drivers supporting multicast addresses to lock if_addr_mtxrwatson2005-08-031-0/+2
| | | | | | | | over iteration of their multicast address lists when synchronizing the hardware address filter with the network stack-maintained list. Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca> MFC after: 1 week
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-11/+18
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-291-2/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Fix style(9) issues with __P removal.imp2005-02-241-38/+36
| | | | Noticed by: bde
* Return BUS_PROBE_DEFAULT instead of 0.imp2005-02-241-1/+1
|
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Forcibly disable interrupts, if we find ourselves servicing one whenbms2004-10-271-1/+8
| | | | | | | | | | | | | | | | | the device is suspended or shutting down. This will need to be rethought slightly if we implement suspend/resume support within vr(4). This appears to fix the vr_shutdown() panic on SMP machines. My theory here is there's a race somewhere during vr_detach() with vr_intr() in the SMP case which was sometimes being triggered, although quite why this was happening is unclear (vr_stop() also explicitly disables interrupts by writing to the IMR register). MFC-to-RELENG_5* candidate. PR: kern/62889 Tested by: seb at struchtrup dot com MFC after: 10 days
* Workaround for a recursive acquisition of the driver mutex during devicebms2004-10-261-0/+2
| | | | | | | | detach; triggered by ether_ifdetach() -> if_delmulti() -> vr_ioctl(). MFC candidate. PR: kern/62889 MFC after: 3 days
* Really really fix typo this time.bms2004-10-191-1/+0
|
* Fix typo sc -> dev.bms2004-10-191-1/+1
|
* Detach the Rhine completely on shutdown, rather than merely stopping itbms2004-10-191-3/+1
| | | | | | | | as the original logic did. This fixes a race with vr_intr() which was masked on UP systems and manifested on SMP systems. PR: kern/62889 MFC after: 1 day
* Revert rev 1.93 and replace it by grabbing the vr lock before callingscottl2004-08-111-2/+2
| | | | | | mii_pollstat(). The previous was causing the vr lock to recurse. PR: kern/70189
* Acquire vr lock before entering vr_setcfg() in vr_miibus_statchg(),rwatson2004-08-071-0/+2
| | | | | | since vr_setcfg() expects it. Reported by: Mike Bristow <mike@urgle.com>
* Unbreak DEVICE_POLLING build / LINT. Sorry!mlaier2004-08-021-1/+1
| | | | Submitted by: roam
* Second part of ALTQ driver modifications, covering:mlaier2004-08-011-5/+7
| | | | | | | | | | an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4) Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/ Tested by: Vaidas Damosevicius (an, ath, wi) Roman Divacky (vr) Submitted by: yongari (hme)
* Further locking improvements for vr(4):bms2004-07-091-46/+69
| | | | | | | | | | | | - Add *_locked() entry points as needed to avoid unnecessary lock thrashing. - Use these entry points wisely. - Only acquire the lock once when servicing an interrupt. - Check 'suspended' on interrupt to avoid racing detach. - Correct a mis-spelled comment. - Don't take the lock in vr_reset() to avoid lock thrashing in attach. - Comment this. Reviewed by: -net (silence)
* SMPng locking cleanup for vr(4).bms2004-07-031-66/+58
| | | | | | | | | | | | | | | - Remove recursive locking situations. Remove the MTX_RECURSE bit. - Take the lock for any routine which is not called from within if_vr.c itself; this includes entry points called by newbus, ifnet, callout, ifmedia, and polling subsystems. - Remove spl references from the code added to miibus callbacks in rev 1.60. - Add the INTR_MPSAFE bit. - Tidy up some assignments; locks are not needed for taking the address of something at a known offset, for example. - Tested on the machine this was committed from. Tested on: UP only, !debug.mpsafenet && debug.mpsafenet Reviewed by: rwatson
* - Another whitespace pass; make locking calls more obvious.bms2004-07-031-12/+10
| | | | - Use C99 types for vr_miibus_readreg().
* style(9) compliance.bms2004-07-021-276/+164
| | | | | | | | | Put some braces around the busy-wait loop in vr_rxeoc() to make the no-op semicolon more obvious. No functional changes. Running on the machine I am committing from without problems. Reviewed by: jmallett
* Remove burn bridges code that saved/restored the pci config registersimp2004-06-281-24/+0
| | | | | that are now handled in the pci bus layer. They are no longer necessary.
* Replace handrolled CRC calculation with ether_crc32_[lb]e().naddy2004-06-091-29/+2
|
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Implemented per-interface polling(4) control.ru2004-04-111-1/+13
|
* - Rewritten TX to use only two pointers to track producer/consumer.ru2004-04-051-124/+156
| | | | | | - Added polling(4) support! - Bugfix: don't forget to set IFF_OACTIVE when TX list is full. - Minor: tidy up vr_encap().
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-3/+2
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-5/+0
|
OpenPOWER on IntegriCloud