aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/dc
Commit message (Collapse)AuthorAgeFilesLines
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-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@ Notes: svn path=/head/; revision=166901
* Fix a bug originally introduced in rev. 1.74; don't reloaded theMarius Strobl2006-12-201-1/+2
| | | | | | | | | | | | | watchdog timer in dc_txeof() in case there are still unhandled descriptors as dc_poll() invokes dc_poll() unconditionally. Otherwise this would result in the watchdog timer constantly being being reloaded and thus circumvent that the watchdog ever fires in the DEVICE_POLLING case. Pointed out by: bde Notes: svn path=/head/; revision=165365
* - Use our own callout (the dc_tick() callout uses varying periodsMarius Strobl2006-12-062-27/+35
| | | | | | | | | | | | depending on the NIC and isn't used at all with HomePNA links) instead of if_slowtimo() for driving dc_watchdog() in order to avoid races accessing if_timer. - Use bus_get_dma_tag() so dc(4) works on platforms requiring it. - Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that. - Remove an alpha remnant in dc_softc. Notes: svn path=/head/; revision=164930
* Remove <sys/types.h>; including both <sys/param.h> and <sys/types.h>Marius Strobl2006-11-021-1/+0
| | | | | | | violates style(9). Notes: svn path=/head/; revision=163892
* - Wrap code optimized for architectures without alignment constraintsMarius Strobl2006-10-291-16/+22
| | | | | | | | | | | | | | | | | | | | | in #ifdef __NO_STRICT_ALIGNMENT rather than #ifdef __i386__. This means that amd64 now also uses the optimized code. [1] While at it, fix a nearby style(9) bug. - Remove the hw.dc_quick SYSCTL, which allowed to turn off the above mentioned optimization, as like the equivalent and already removed - In dc_setcfg() suppress printing a warning when forcing the receiver and transceiver to idle state times out for chips where the status bits in question just never change (observed in detail with DM9102A) and therefore the warning would be highly likely false positive. [2] - In dc_ifmedia_sts() add a missing DC_UNLOCK(). Tested by: Hans-Joerg Sirtl on amd64 [1] PR: 82681 [2] Obtained from: NetBSD tlp(4) [2] MFC after: 1 week Notes: svn path=/head/; revision=163774
* - Consistently use if_printf() only in interface methods: if_start(),Gleb Smirnoff2006-09-152-6/+8
| | | | | | | | | | | if_watchdog, etc., or in functions used only in these methods. In all other functions in the driver use device_printf(). - Use __func__ instead of typing function name. Submitted by: Alex Lyashkov <umka sevcity.net> Notes: svn path=/head/; revision=162321
* Replace hard-coded magic constants to system defined constantsPyun YongHyeon2006-08-022-2/+2
| | | | | | | | | (BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc). These pseudo PHY drivers were forgotten from the conversion due to the repo copy to dc driver location. Notes: svn path=/head/; revision=160907
* Fix the last commit.Gleb Smirnoff2006-06-082-3/+8
| | | | | | | | Submitted by: jhb Pointy hat to: glebius Notes: svn path=/head/; revision=159393
* Add device IDs for Linksys PCMPC200 Cardbus card.Gleb Smirnoff2006-06-072-0/+12
| | | | | | | | PR: kern/75582 Submitted by: Gary Palmer Notes: svn path=/head/; revision=159372
* - Switch on the full 32-bit device ID to avoid collisions between theJohn Baldwin2006-06-032-205/+94
| | | | | | | | | | | | | | | | vendor-specific device ids across vendors. - Include the revision in the dc_devs[] array instead of special casing the revid handling in dc_devtype(). - Use PCI bus accessors to read registers instead of pci_read_config() where possible. - Use an 8-bit write to update the latency timer. - Use PCIR_xxx constants and remove unused DC_xxx related to standard PCI config registers. MFC after: 1 week Notes: svn path=/head/; revision=159202
* Use PCI bus accessors rather than reading config registers directly toJohn Baldwin2006-06-031-2/+3
| | | | | | | get the subvendor device id. Notes: svn path=/head/; revision=159201
* Remove various bits of conditional Alpha code and fixup a few comments.John Baldwin2006-05-121-48/+1
| | | | Notes: svn path=/head/; revision=158471
* Add device-id for the Neteasy DRP-32TXD cardbus 10/100 card. It's anotherJohn Baldwin2006-03-162-0/+13
| | | | | | | | | | ADMTek AN985 clone. MFC after: 3 days Tested by: Lila liladude at aruba dot it Notes: svn path=/head/; revision=156785
* Do not touch ifp->if_baudrate in miibus aware drivers.Gleb Smirnoff2006-02-141-1/+0
| | | | Notes: svn path=/head/; revision=155671
* Add missing parens.Gleb Smirnoff2005-12-281-1/+1
| | | | | | | Submitted by: njl Notes: svn path=/head/; revision=153800
* Check for IFF_DRV_RUNNING in the interrupt loop.Gleb Smirnoff2005-12-281-2/+3
| | | | | | | Reported & tested by: Martin P. Hansen <mph lima.dyndns.dk> Notes: svn path=/head/; revision=153792
* - Rev. 1.175 fixed compilation on sparc64 but also backed out zeroing ofMarius Strobl2005-12-051-5/+2
| | | | | | | | | | | | | | | | | the eaddr array (introduced in rev. 1.174) prior to writing to it. As dc_read_eeprom() is told to write only 3 16-bit words to eaddr but eaddr in fact is somewhat larger removal of the zeroing defeated the check whether the MAC address is all zero as there can be some random garbage in eaddr past the 3 words written to it and the check verifys all bits in eaddr. Solve this by changing the check to verify only the 3 words (happenning to be ETHER_ADDR_LEN bytes) written to eaddr. - While here change the notation of "FCode" in a nearby comment to the official way. Ok'ed by: marcel, ru Notes: svn path=/head/; revision=153111
* Fix on sparc64.Ruslan Ermilov2005-12-041-6/+2
| | | | Notes: svn path=/head/; revision=153077
* Fix the misalignment bugs differently than was done in the previousMarcel Moolenaar2005-12-022-23/+33
| | | | | | | | | | | | commit. Copy the ethernet address into a local buffer, which we know is sufficiently aligned for the width of the memory accesses that we do. This also eliminates all suspicious and potentionally harmful casts. In collaboration with: ru Notes: svn path=/head/; revision=153003
* Resolve misalignment traps caused by changes to IF_LLADDR().Marcel Moolenaar2005-11-222-8/+8
| | | | | | | | | | | | Use de16dec() and le16dec() to fetch the link-level address from struct ifnet. Tested on: alpha Reviewed by: jhb See also: de(4) Notes: svn path=/head/; revision=152671
* - Store pointer to the link-level address right in "struct ifnet"Ruslan Ermilov2005-11-111-10/+10
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=152315
* Make dc compile after repo-copy.Warner Losh2005-10-183-5/+6
| | | | Notes: svn path=/head/; revision=151435
* - Don't pollute opt_global.h with DEVICE_POLLING and introduceGleb Smirnoff2005-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 Notes: svn path=/head/; revision=150968
* Big polling(4) cleanup.Gleb Smirnoff2005-10-011-28/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=150789
* Use ansi function definitions in preference to K&R to reduce diffsWarner Losh2005-09-302-24/+10
| | | | | | | with NetBSD (and cause it looks cooler). Notes: svn path=/head/; revision=150763
* Fix "struct ifnet" leaks when attach() fails in the middle, e.g.Ruslan Ermilov2005-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. Notes: svn path=/head/; revision=150213
* When bus_alloc_resource_any() fails, dc_detach() is called and itGiorgos Keramidas2005-09-151-5/+11
| | | | | | | | | | | | | attempts to deallocate busdma tags and resources that haven't been allocated yet, causing a panic every time a dc interface fails to attach. Fix by checking that we really have something to dealloc before calling bus_dma*() functions. Approved by: jhb MFC after: 1 week Notes: svn path=/head/; revision=150174
* Better commentWarner Losh2005-08-291-1/+4
| | | | Notes: svn path=/head/; revision=149595
* Fix another instance of old info re: miibusWarner Losh2005-08-291-1/+1
| | | | Notes: svn path=/head/; revision=149588
* Fixup locking and mark MPSAFE:John Baldwin2005-08-181-70/+77
| | | | | | | | | | | | | | | | - Add locked versions of start and init. The SRM_MEDIA code in dc_init() stayed in dc_init() instead of moving to dc_init_locked() to make the locking saner. - Use callout_init_mtx(). - Fixup locking in detach and ioctl. - Lock the driver in the ifmedia callouts. - Don't recurse on the driver lock. - De-spl. MFC after: 3 days Notes: svn path=/head/; revision=149249
* Use device_printf() and if_printf() and remove dc_unit from softc.John Baldwin2005-08-102-36/+31
| | | | Notes: svn path=/head/; revision=148948
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andRobert Watson2005-08-091-12/+13
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=148887
* Modify device drivers supporting multicast addresses to lock if_addr_mtxRobert Watson2005-08-031-0/+8
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=148654
* Stop embedding struct ifnet at the top of driver softcs. Instead theBrooks Davis2005-06-102-25/+31
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=147256
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-293-6/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* Fix newer Xircom CBE2-100 cards that were reportingWarner Losh2005-04-181-13/+14
| | | | | | | | | | | dc0: MII without any PHY! We have to enable the connection to the MII first. Doing so fixes the problem cards without breaking the older, working cards. Bad card provided by: deischen Notes: svn path=/head/; revision=145219
* Bugger, wiped out a needed comma in the previous commit.Scott Long2005-03-091-1/+1
| | | | Notes: svn path=/head/; revision=143309
* The DC driver asks for an alignment of PAGE_SIZE for data buffers, but alsoScott Long2005-03-081-3/+3
| | | | | | | | | | | | | asks that each buffer be (2048 * 256) bytes long. I suspect that alignment isn't a real requirement since busdma only recently started honoring it. The size is also bogus. Fix both of these and stop busdma from trying to exhaust the system memory pool with bounce pages. Submitted by: Kevin Oberman MFC After: 7 days Notes: svn path=/head/; revision=143307
* Fix style(9) issues with __P removal.Warner Losh2005-02-241-64/+60
| | | | | | | Noticed by: bde Notes: svn path=/head/; revision=142407
* Return BUS_PROBE_DEFAULT instead of 0.Warner Losh2005-02-241-1/+1
| | | | Notes: svn path=/head/; revision=142398
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-072-2/+2
| | | | Notes: svn path=/head/; revision=139825
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Read the MAC address in the EEPROM in the correct byte order. ThisMaxime Henrion2004-10-011-4/+4
| | | | | | | | | | | | | is a no-op on little endian architectures, but fixes getting the MAC address for some dc(4) cards on big endian architectures. This is a RELENG_5 candidate. Tested by: gallatin (powerpc), marius (sparc64) First version of the patch written by: gallatin Notes: svn path=/head/; revision=136026
* Add ALTQ support for dc(4), based upon a mostly-working patch from mlaier.Brian Feldman2004-10-011-15/+21
| | | | Notes: svn path=/head/; revision=136016
* Conditionalize IFF_NEEDSGIANT, like everything else here, on IS_MPSAFE.Brian Feldman2004-10-011-2/+3
| | | | | | | | The driver doesn't look any less safe without Giant than with, and works with IS_MPSAFE set to 1 here, so others should probably test it as such. Notes: svn path=/head/; revision=136015
* if_dc includes locking, but that locking is disabled by a #ifdefRobert Watson2004-08-251-1/+2
| | | | | | | | | | | by default. As such, mark if_dc as IFF_NEEDSGIANT until such time as appropriate locking review and testing can take place, and the locking can be enabled by default. RELENG_5 candidate. Notes: svn path=/head/; revision=134285
* - Make OF_getetheraddr() honour the "local-mac-address?" system configMarius Strobl2004-08-141-1/+1
| | | | | | | | | | | | | | | | | | variable. If set to "true" OF_getetheraddr() will now return the unique MAC address stored in the "local-mac-address" property of the device's OFW node if present and the host address/system default MAC address if the node doesn't doesn't have such a property. If set to "false" the host address will be returned for all devices like before this change. This brings the behaviour of device drivers for NICs with OFW support/ FCode, i.e. dc(4) for on-board DM9102A on Sun machines, gem(4) and hme(4), regarding "local-mac-address?" in line with NetBSD and Solaris. The man pages of the respective drivers will be updated separately to reflect this change. - Remove OF_getetheraddr2() which was used as a stopgap in dc(4). Its functionality is now part of OF_getetheraddr(). Notes: svn path=/head/; revision=133728
* Whitespace nitsBruce M Simpson2004-07-051-6/+6
| | | | Notes: svn path=/head/; revision=131652
* Remove saved_* from dc_softc. They are now no longer needed.Warner Losh2004-06-291-5/+0
| | | | | | | Submitted by: Marius Strobl Notes: svn path=/head/; revision=131289
* Remove burn bridges code that saved/restored the pci config registersWarner Losh2004-06-281-63/+3
| | | | | | | | that are now handled in the pci bus layer. They are no longer necessary. Notes: svn path=/head/; revision=131253