Commit Graph

43 Commits

Author SHA1 Message Date
jmmv 7660ca07d8 Now that the driver goes through the mii_ifmedia_change indirection
instead of directly calling the pcn_79c970_mediachange function, we
must initialize sc->sc_mii.mii_ifp so that this last function is
passed a valid parameter.

Fixes a panic in pcn_79c970_mediachange that arose immediately when
trying to use this interface due to a NULL pointer dereference.
Hi dyoung@!
2008-01-20 11:28:12 +00:00
dyoung b480b62270 Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange().  Check for
a non-ENXIO error return from mii_mediachg().  (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines.  There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
        on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run.  I have compiled macppc, sparc64, i386.  I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
2008-01-19 22:10:14 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
dyoung f59a11881a Constify: LLADDR() -> CLLADDR(). 2007-08-29 22:33:42 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
jdarrow 4f776e54e8 Fix typo (enaddr[3] should be enaddr[2]), and add note to comment,
both in VMware bug-workaround section.
2006-11-15 03:21:54 +00:00
thorpej 3cea1a3abd Detect if we're talking to a VMware virtual interface, and, if so,
limit the number of Tx segments to 8 to work around a VMware bug.
2006-11-01 06:42:12 +00:00
thorpej f347528e49 In the pcn driver:
- Remove the PCN_NO_PROM option.  Instead, query the am79c970-no-eeprom
  property, and read the MAC address from the CSRs if that property is TRUE.

In the ibmnws port:
- Implement device_register().
- In device_register(), set the am79c970-no-eeprom property for the
  built-in Ethernet.
2006-10-31 14:04:29 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos 63bbcb495a re-factor the pci powestate api. reviewed by gimpy 2006-06-17 23:34:26 +00:00
tsutsui c41536fb3f Call pcn_reset() in pcn_shutdown() so that my 7248 (prep) firmware
can netboot even after reboot without powercycle.
2006-06-14 13:30:35 +00:00
garbled 5c869c790e IBM makes a pcn card that shows up as:
Trident Microsystems 4DWAVE DX (ethernet network, revision 0x25)
Unfortunately, this is an autri sound card.  Special case the match routines
for both drivers so if_pcn properly picks it up, and autri doesn't.
2006-02-22 02:57:26 +00:00
perry 93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
is a284d19884 As discussed on tech-net: don't suppress any PHYs to enable multiple
external PHYs. The internal PHY at MII (nr 31) will be the last instance,
so it won't be the default instance when external PHYs are present.
2005-05-07 09:15:44 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
thorpej e9818f5b5e When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
2004-10-30 18:08:34 +00:00
thorpej d17a849385 Use ANSI function decls and make use of static. 2004-08-21 22:48:18 +00:00
christos 125ccd91b1 Fix uninitialized variable warnings 2003-10-25 18:29:12 +00:00
matt 3642aa4ccc Add PCN_NO_PROM flag. (read the macaddr from the chip assuming the "BIOS"
has properly written it).  From John Gordon.
2003-10-19 03:32:25 +00:00
jdolecek 98a5f82f01 add rnd hooks 2003-07-21 08:38:56 +00:00
jdolecek 3f1816bf46 sprinkle some const qualifiers 2003-03-30 19:20:37 +00:00
tsutsui 238efe4697 Replace magic numbers for power management control with PCI_PMCSR* macros.
XXX Should we use pci_get_powerstate() and pci_set_powerstate() in pci.c?
2002-12-23 02:58:36 +00:00
perry 43ed640ca5 fix lint warnings about things being stringified under cpp -traditional 2002-10-23 01:50:11 +00:00
thorpej 3e6493c448 Fix typos in media configuration register init. From patch posted
to tech-kern by Erik Anggard <erik.anggard@packetfront.com>.

May address PR 16346.
2002-10-22 16:13:44 +00:00
fair 2104199dc3 Change the "dontcare bits" argument to ifmedia_init() to IFM_IMASK
so that it is possible select PHY instances other than the first
one (instance zero), if there is more than one PHY attached.
2002-10-21 23:38:10 +00:00
thorpej b75a007d9f Add trailing ; to CFATTACH_DECL. 2002-10-02 16:51:16 +00:00
thorpej 387fc6dc87 Use CFATTACH_DECL(). 2002-09-30 20:37:04 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
thorpej 467482eee8 Add support for memory-mapped PCnet-PCI chips. 2002-09-04 01:36:07 +00:00
thorpej 0cb8f6797b Fix a typo which caused the wrong register to be updated when
the media is not full-duplex.
2002-08-02 01:12:32 +00:00
thorpej 317ab784d9 Bump the number of Tx DMA segments from 8 to 16 (the zero-copy socket
code sometimes sees more than 8).
2002-05-03 00:07:02 +00:00
nisimura 5060825752 DANAS (disable autonegotiation) bit of BCR32 takes its effect when
set, not cleared.
2002-01-29 04:45:47 +00:00
thorpej 33bfd7be53 Fix typo in copyright notice. 2001-11-29 17:15:44 +00:00
onoe afdb23ddea Set ONES (must be ones) bits in tmd1 of tx descriptors.
This fix avoids VMware 3.0/WinXP to crash.
2001-11-27 13:49:03 +00:00
lukem 9048aaae21 add RCSID 2001-11-13 07:48:40 +00:00
enami 26ea33d355 Fix an obvious typo found while reading the source. 2001-09-02 13:17:54 +00:00
thorpej 14f612c5b3 - Swap the bytes OR'd into init_ladrf[], for big-endian machines.
- Make sure to sync the init block.

Pointed out by Izumi Tsutsui.
2001-08-28 15:22:30 +00:00
thorpej fdb02063d2 Print "auto-FDX" for the second "autoselect" instance. Pointed out
by Izumi Tsutsui.
2001-08-28 14:15:18 +00:00
thorpej 1930fec887 New driver for the AMD PCnet-PCI family of Ethernet chips. This
driver uses direct DMA to mbufs (like other PCI network drivers,
and unlike the old "le at pci" driver), and also supports communication
with the MII-connected PHYs on the 10/100 boards.
2001-08-27 19:42:18 +00:00