History log of /freebsd-10.1-release/sys/dev/hme/
Revision Date Author Comments
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


253134 10-Jul-2013 yongari

Avoid controller reinitialization which could be triggered by
dhclient(8) or alias addresses are added.

Tested by: dcx dcy <dcbsdx@hotmail.com>


243857 04-Dec-2012 glebius

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


227843 22-Nov-2011 marius

- There's no need to overwrite the default device method with the default
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.


221407 03-May-2011 marius

- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP
(reporting IFM_LOOP based on BMCR_LOOP is left in place though as
it might provide useful for debugging). For most mii(4) drivers it
was unclear whether the PHYs driven by them actually support
loopback or not. Moreover, typically loopback mode also needs to
be activated on the MAC, which none of the Ethernet drivers using
mii(4) implements. Given that loopback media has no real use (and
obviously hardly had a chance to actually work) besides for driver
development (which just loopback mode should be sufficient for
though, i.e one doesn't necessary need support for loopback media)
support for it is just dropped as both NetBSD and OpenBSD already
did quite some time ago.
- Let mii_phy_add_media() also announce the support of IFM_NONE.
- Restructure the PHY entry points to use a structure of entry points
instead of discrete function pointers, and extend this to include
a "reset" entry point. Make sure any PHY-specific reset routine is
always used, and provide one for lxtphy(4) which disables MII
interrupts (as is done for a few other PHYs we have drivers for).
This includes changing NIC drivers which previously just called the
generic mii_phy_reset() to now actually call the PHY-specific reset
routine, which might be crucial in some cases. While at it, the
redundant checks in these NIC drivers for mii->mii_instance not being
zero before calling the reset routines were removed because as soon
as one PHY driver attaches mii->mii_instance is incremented and we
hardly can end up in their media change callbacks etc if no PHY driver
has attached as mii_attach() would have failed in that case and not
attach a miibus(4) instance.
Consequently, NIC drivers now no longer should call mii_phy_reset()
directly, so it was removed from EXPORT_SYMS.
- Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe().
The purpose of that function is to perform the common steps to attach
a PHY driver instance and to hook it up to the miibus(4) instance and to
optionally also handle the probing, addition and initialization of the
supported media. So all a PHY driver without any special requirements
has to do in its bus attach method is to call mii_phy_dev_attach()
along with PHY-specific MIIF_* flags, a pointer to its PHY functions
and the add_media set to one. All PHY drivers were updated to take
advantage of mii_phy_dev_attach() as appropriate. Along with these
changes the capability mask was added to the mii_softc structure so
PHY drivers taking advantage of mii_phy_dev_attach() but still
handling media on their own do not need to fiddle with the MII attach
arguments anyway.
- Keep track of the PHY offset in the mii_softc structure. This is done
for compatibility with NetBSD/OpenBSD.
- Keep track of the PHY's OUI, model and revision in the mii_softc
structure. Several PHY drivers require this information also after
attaching and previously had to wrap their own softc around mii_softc.
NetBSD/OpenBSD also keep track of the model and revision on their
mii_softc structure. All PHY drivers were updated to take advantage
as appropriate.
- Convert the mebers of the MII data structure to unsigned where
appropriate. This is partly inspired by NetBSD/OpenBSD.
- According to IEEE 802.3-2002 the bits actually have to be reversed
when mapping an OUI to the MII ID registers. All PHY drivers and
miidevs where changed as necessary. Actually this now again allows to
largely share miidevs with NetBSD, which fixed this problem already
9 years ago. Consequently miidevs was synced as far as possible.
- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that
weren't explicitly converted to support flow control before. It's
unclear whether flow control actually works with these but typically
it should and their net behavior should be more correct with these
changes in place than without if the MAC driver sets MIIF_DOPAUSE.

Obtained from: NetBSD (partially)
Reviewed by: yongari (earlier version), silence on arch@ and net@


220940 22-Apr-2011 marius

Correct spelling in comments.

Submitted by: brucec


213893 15-Oct-2010 marius

Convert the PHY drivers to honor the mii_flags passed down and convert
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


210334 21-Jul-2010 attilio

KTR_CTx are long time aliased by existing classes so they can't serve
their purpose anymore. Axe them out.

Sponsored by: Sandvine Incorporated
Discussed with: jhb, emaste
Possible MFC: TBD


204646 03-Mar-2010 joel

The NetBSD Foundation has granted permission to remove clause 3 and 4 from
the software.

Obtained from: NetBSD


195049 26-Jun-2009 rwatson

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
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


178589 26-Apr-2008 marius

- Use the revamped code from the gem(4) PCI front-end, which
doesn't require parts of the Expansion ROM to be copied around,
for obtaining the MAC address on !OFW platforms.
- Don't unnecessarily cache bus space tag and handle nor RIDs
in the softcs of the front-ends.
- Don't use function calls in initializers.
- Let the SBus front-end depend on sbus(4).


178470 24-Apr-2008 marius

o Disable HMEDEBUG by default.
o Add CTASSERTs ensuring that HME_NRXDESC and HME_NTXDESC are set to
legal values.
o Use appropriate maxsize, nsegments and maxsegsize parameters when
creating DMA tags and correct some comments related to them.
o The FreeBSD bus_dmamap_sync(9) supports ored together flags for quite
some time now so collapse calls accordingly.
o Add missing BUS_DMASYNC_PREREAD when syncing the control DMA maps in
hme_rint() and hme_start_locked().
o Keep state of the link state and use it to enable or disable the MAC
in hme_mii_statchg() accordingly as well as to return early from
hme_start_locked() in case the link is down.
o Introduce a sc_flags and use it to replace individual members like
sc_pci.
o Add bus_barrier(9) calls to hme_mac_bitflip(), hme_mii_readreg(),
hme_mii_writereg() and hme_stop() to ensure the respective bit
has been written before we starting polling on it and for the right
bits to change.
o Rather just returning in case hme_mac_bitflip() fails and leaving us
in an undefined state report the problem and move on; chances are
the requested configuration will become active shortly after.
o Don't call hme_start_locked() in hme_init_locked() unconditionally
but only after calls to hme_init_locked() when it's appropriate, i.e.
in hme_watchdog().
o Add a KASSERT which asserts nsegs is valid also to hme_load_txmbuf().
o In hme_load_txmbuf():
- use a maximum of the newly introduced HME_NTXSEGS segments instead
of the incorrect HME_NTXQ, which reflects the maximum TX queue
length, for loading the mbufs and put the DMA segments back onto
the stack instead of the softc as 16 should be ok there.
- use the common errno(2) return values instead of homegrown ones,
- given that hme_load_txmbuf() is allowed to fail resulting in a
packet drop for quite some time now implement the functionality of
hme_txcksum() by means of m_pullup(9), which de-obfuscates the code
and allows to always retrieve the correct length of the IP header, [1]
- also add a KASSERT which asserts nsegs is valid,
- take advantage of m_collapse(9) instead of m_defrag(9) for
performance reasons.
o Don't bother to check whether the interface is running or whether its
queue is empty before calling hme_start_locked() in hme_tint(), the
former will check these anyway.
o In hme_intr() call hme_rint() before hme_tint() as gem_tint() may
take quite a while to return when it calls hme_start_locked().
o Get rid of sc_debug and just check if_flags for IFF_DEBUG directly.
o Add a shadow sc_ifflags so we don't reset the chip when unnecessary.
o Handle IFF_ALLMULTI correctly. [2]
o Use PCIR_BAR instead of a homegrown macro.
o Replace sc_enaddr[6] with sc_enaddr[ETHER_ADDR_LEN].
o Use the maximum of 256 TX descriptors for better performance as using
all of them has no additional static cost rather than using just half
of them.

Reported by: rwatson [2]
Suggested by: yongari [1]
Reviewed by: yongari
MFC after: 1 month


169166 01-May-2007 marius

Remove invalid BUS_DMA_ALLOCNOW when creating a tag which is used for
a "static" memory allocation only.


166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
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@


164932 06-Dec-2006 marius

- Use the hme_tick() callout instead of if_slowtimo() for driving
hme_watchdog() in order to avoid races accessing if_timer.
- Use bus_get_dma_tag() so hme(4) works on platforms requiring it.
- Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that.


164866 04-Dec-2006 marius

Remove the HME_LOCK_ASSERT() in hme_mifinit(), which was added in the
previous revision; it's actually ok when invoking hme_mifinit() from
hme_config() without the lock held.


164864 04-Dec-2006 marius

- In hme_stop() mask all interrupts.
- In hme_eint() print MIF register contents on MIF interrupts.
- In hme_mifinit() don't bother to preserve the previous MIF config.
This was mainly done in order to preserve the PHY select bit (external
or internal PHY) but which only needs to be set as appropriate when
reading from or writing to the desired PHY in hme_mii_{read,write}reg().
Similarly don't bother to set the PHY select bit in hme_mii_statchg().
- In hme_mii_{read,write}reg() ignore requests to PHYs other than the
external and internal PHY one.
- Move enabling/disabling the MII drivers of the external transceiver
from hme_init_locked() and based on the sheer presence of an external
to hme_mifinit() and based on the currently selected media, defaulting
to the internal transceiver when the media hasn't been set, yet.
Invoke hme_mifinit() from the newly added hme_mediachange_locked() so
the setting of the MII drivers is updated when changing media.
These changes keep the MII bus from wedging (which manifests in the HME
and the PHYs no longer being able to communicate with each other) when
the PHY device drivers isolate the unused PHY in two-PHY configurations
as present in f.e. Netra t1 100 while changing media, either from
hme_init_locked() (see also below) or via ifconfig(8). They also allow
for using both transceivers/PHYs.
- In the newly added hme_mediachange_locked() also reset the PHYs in two-
PHY configurations before invoking mii_mediachg(). This is required
for successfully unisolating the previously unused PHY when switching
between PHYs.
- Now that changing media should no longer cause problems back out rev.
1.27 and re-enable setting the current media in hme_init_locked() (see
the commit message of rev. 1.23 for more info).

These changes are roughly a merge of NetBSD gem.c rev. 1.32 - 1.35 (1.30
was already fixed differently in our 1.36; 1.31 and 1.32 were wrong) with
some parts reworked and things that don't make sense like setting the MII
drivers and restoring the previous MIF and XIF settings in hme_mii_{read,
write}reg() omitted.

MFC after: 2 weeks


161234 12-Aug-2006 yongari

Fix invalid reference of mbuf chains.
Use proper pointer dereference to inform modified mbuf chains to
caller.

While I'm here perform checksum offload setup after loading DMA
maps as m_defrag(9) can return new mbuf chains.

In collaboration with: glebius


158973 27-May-2006 simon

Fix typo in printf string.

MFC after: 1 week
Approved by: cperciva (mentor)


156945 21-Mar-2006 yongari

Backout rev. 1.46. It caused Rx checksum offload breakage on little
endian systems.

Reported by: joerg
Tested by: joerg


154449 17-Jan-2006 yongari

fix Rx checksum computation on little endian systems.

Reported & Tested by: brad@OpenBSD


152315 11-Nov-2005 ru

- Store pointer to the link-level address right in "struct ifnet"
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.


151639 25-Oct-2005 yongari

- Convert hme(4) to use TX side bus_dmamap_load_mbuf_sg(9).
- Move hardware counter reading/zeroing to hme_tick(). This saves
8 register access per interrupt. [1]
- Use imax macro for getting max. argument between two integers.
- Invoke bus_dmamap_sync(9) first before freeing mbuf.
- Check driver queue first to reduce locking operation in hme_start_locked()
and interrupt handler.
- Simplyfy watchdog timer setup in interrupt handler.
- Don't log normal errors such as RX overrun. If we have DMA stuck
condition, reinitialize the driver and log it.

Reviewed by: marius
Obtained from: OpenBSD [1]


149877 08-Sep-2005 kensmith

Move hme_stop() after ether_ifdetach() and if_free() to prevent a
memory-referenced-after-free panic if the hme interface fails to
attach.

Patch obtained from: marius
Suggested same thing: brooks

MFC after: 3 days


149438 24-Aug-2005 jhb

- Remove redundant assertions that the driver lock is not held in attach()
and detach() since mtx_lock() will assert that already since the driver
lock is not recursive.
- Move the call to callout_init_mtx() before hme_stop() so that the
callout_stop() in hme_stop() doesn't operate on an uninitialized callout
structure during attach.

Reported by: yongari (2)
MFC after: 3 days


149203 17-Aug-2005 jhb

Add callout_drain()'s to foo_detach() after calling foo_stop() to make sure
that if softclock is running on another CPU and is blocked on our driver
lock, we will wait until it has acquired the lock, seen that it was
cancelled, dropped the lock, and awakened us so that we can safely destroy
the mutex.

MFC after: 3 days


148944 10-Aug-2005 jhb

- Use callout_init_mtx() to close races between hme_stop() and hme_tick().
- Use the driver lock instead of Giant in a bus dma callback.
- Clear IFF_DRV_(RUNNING|OACTIVE) in hme_stop() instead of just clearing
RUNNING in hme_ioctl() to be more like other ethernet drivers.
- Lock the driver lock around mii operations.
- Remove spls.
- Cleanup locking in hme_ioctl().

MFC after: 1 week


148887 09-Aug-2005 rwatson

Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
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


148654 03-Aug-2005 rwatson

Modify device drivers supporting multicast addresses to lock if_addr_mtx
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


147878 10-Jul-2005 marius

Add a missing mtx_destroy() in hme_pci_detach().

Reviewed by: yongari
Approved by: re (scottl)


147256 10-Jun-2005 brooks

Stop embedding struct ifnet at the top of driver softcs. Instead the
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


146513 23-May-2005 yongari

According to STP2002QFP User's Guide, it seems that driver should
program RXMAC to discard frames with SA field matching the stations's
MAC address. Experimentation shows that HME receives its own frames
when it operates at 10Mbps half-duplex. With this change HME runs at
10Mbps half-duplx should work with IPv6.
(No more "DAD detected duplicate IPv6 address".)

Reported by: jacques brierre <jbrierre AT bellsouth DOT net>
Reviewed by: marius


144676 05-Apr-2005 marius

Release the IRQ resource on detach. This fixes repeatedly loading and
unloading the hme(4) module in case it attaches to sbus(4).

MFC after: 1 week


143161 05-Mar-2005 imp

Use BUS_PROBE_DEFAULT for pci probe return value


142964 02-Mar-2005 marius

- Fix braino introduced in rev. 1.17, unlike the X1032A (HME-ISP1040-combo)
and the X1034A (quad HME; QFE) cards the X1033A (single HME) don't have a
PCI-PCI-bridge so we can't rely on the PCI slot number being useable as
index for the network address to read from the VPD on the latter. Use
the end tag to determine whether it is a QFE VPD with 4 NAs and only use
the slot number as index in this case.
- Remove a useless check.

Prodded by: joerg
Additional testing by: joerg
MFC after: 1 day


142117 20-Feb-2005 marius

Add a note that all four HME chips on a SUNW,qfe card share the same PROM,
making it a bit more clear why we can read four NAs from the VPD.

MFC after: 1 day


141134 02-Feb-2005 yongari

Fix "Duplicate mbuf free panic".
The cause of "Duplicate mbuf free panic" is in the programming
error of hme_load_txmbuf(). The code path of the panic is the
following.

1. Due to unknown reason DMA engine was freezed. So TX descritors
of HME become full and the last failed attempt to transmit a
packet had set its associated mbuf address to hme_txdesc
structure. Also the failed packet is requeued into interface
queue structure in order to retrasmit it when there are more
available TX descritors.

2. Since DMA engine was freezed, if_timer starts to decrement its
counter. When if_timer expires it tries to reset HME. During
the reset phase, hme_meminit() is called and it frees all
associated mbuf with descriptors. The last failed mbuf is also
freed here.

3. After HME reset completed, HME starts to retransmit packets
by dequeing the first packet in interface queue.(Note! the
packet was already freed in hme_meminit()!)

4. When a TX completion interrupt is posted by the HME, driver
tries to free the successfylly transmitted mbuf. Since the
mbuf was freed in step2, now we get "Duplicate mbuf free panic".

However, the real cause is in DMA engine freeze. Since no fatal
errors reported via interrupts, there might be other cause of
the freeze. I tried hard to understand the cause of DMA engine
freeze but couldn't find any clues. It seems that the freeze
happens under very high network loads(e.g. 7.5-8.0 MB/s TX speed).

Though this fix is not enough to eliminate DMA engine freeze it's
better than panic.

Reported by: jhb via sparc64 ML


140338 16-Jan-2005 obrien

Fix kernel builds with INVARIANTS.


140324 15-Jan-2005 scottl

Use bus_dmamap_load_mbuf_sg() for loading rx buffers.


138712 12-Dec-2004 marius

Some changes related to reading the MAC-address from the VPD on systems
without Open Firmware:
- The PCI data structure of some HME PROMs contains a non-zero interface
revision in the class code. Thus remove the checks for matching class
code and PCI data structure length and revsion. These were pretty much
useless anyway as we only really need the pointer to the VPD which is
located before the structure length and revision fields.
- On Sun QFE (Quad FastEthernet) cards read the Nth MAC-address for the
Nth HME controller instead of always the first one for all four HMEs. [1]
- Improve the comment describing the used VPD format to better reflect
reality.
- Minor clean-up.

Prodded by: joerg [1]


137982 22-Nov-2004 yongari

Make hme(4) mpsafe
- Let hme_start()/hme_init() acquire lock and then call
hme_start_locked()/hme_init_locked() respectivly.
- Teardown interrupt handler before hme_detach().
- Remove IFF_NEEDSGIANT flag and mark interrupt handler INTR_MPSAFE.
- Set callout handler to CALLOUT_MPSAFE.
- Add locks in hme MII interface.

Reviewed by: jake
Tested by: Julian C. Dunn <jdunn at opentrend dot net>
MFC after: 2 weeks


133731 14-Aug-2004 marius

Make hme(4), i.e. the PCI-variant, MI by reading the MAC address on sytems
without Open Firmware directly instead of using OF_getetheraddr(). This is
a bit painful though, as the MAC address is contained in the NA field of
the VPD of the EBus bridge, which is is another function of the same chip.
To make it worse, the VPD of the EBus bridge can't be accessed via the PCI
capability pointer but has to be digged out from the Boot PROM and has a
non-standard format.
The PCI VPD struct and macros used here should be part of the FreeBSD PCI
code nevertheless.

Approved by: tmm
Based on: NetBSD
Tested with: Sun X1032A (hme(4)-isp(4)-combo card) on alpha and i386


133688 13-Aug-2004 rwatson

Since if_hme doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.


133599 12-Aug-2004 marius

- Use bus_space_subregion() rather than arithmetic on bus_space_handle_t. [1]
- Properly use the error variable and return it on failure in the attach-
routines.

Reviewed by: tmm
Inspired by: NetBSD [1]


133589 12-Aug-2004 marius

- Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
properties in drivers for devices on Open Firmware supported busses. The
standard properties "reg", "interrupts" und "address" are not covered by
this interface because they are only of interest in the respective bridge
code. There's a remaining standard property "status" which is unclear how
to support properly but which also isn't used in FreeBSD at present.
This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
This in turn allows to simplify and remove code-duplication in drivers for
devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
drivers for their children to use the ofw_bus kobj-interface. The IVAR-
interfaces of the Central, EBus and FHC are entirely replaced by this. The
PCI bus driver used its own kobj-interface and now also uses the ofw_bus
one. The IVARs special to the SBus, e.g. for retrieving the burst size,
remain.
Beware: this causes an ABI-breakage for modules of drivers which used the
IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
recompiled.
The style-inconsistencies introduced in some of the bus drivers will be
fixed by tmm@ in a generic clean-up of the respective drivers later (he
requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
use the ofw_bus kobj-interface. This invloves removing the IVARs related
to the "reg" property which were unused and a leftover from the NetBSD
origini of the code. There's no ABI-breakage caused by this because none
of these driver are currently built as modules.
There are other powerpc bus drivers which can be converted to the ofw_bus
kobj-interface, e.g. the PCI bus driver, which should be done together
with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
advantage of the ofw_bus kobj-interface and simplify them a bit.

Reviewed by: grehan, tmm
Approved by: re (scottl)
Discussed with: tmm
Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386


133149 05-Aug-2004 yongari

Implement TCP/UDP Transmit/Receive checksum offload.
Since HME doesn't compensate the checksum for UDP datagram which
can yield to 0x0, UDP transmit checksum offload is disabled by
default. The UDP Transmit checksum offload can be reactivated
by setting special link option link0 with ifconfig(8).

Approved by: jake (mentor)
Reviewed by: tmm
Tested by: Herve Boulouis <amon@sockar.homeip.net>


132986 01-Aug-2004 mlaier

Second part of ALTQ driver modifications, covering:
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)


130369 12-Jun-2004 marius

Back out 1.23 until I figure out why it causes Netra t1 100 to no longer
pass any traffic. Unfortunately this means no full-duplex link with auto-
negotiation on hme(4) using DP83840A PHYs again.
I really thought I had tested this also on a Netra t1 100...


130290 10-Jun-2004 marius

- Add a LLADDR() forgotten in the conversion to ether_crc32_le().
- Remove a variable no longer used after the conversion.
- While here, save on another one no longer really necessary after the
conversion.


130270 09-Jun-2004 naddy

Replace handrolled CRC calculation with ether_crc32_[lb]e().


130026 03-Jun-2004 phk

Add missing <sys/module.h> includes currently relying on nested include
in <sys/kernel.h>


129847 29-May-2004 marius

In hme_init() call mii_mediachg() to make sure the current media is set.

This is part 2/2 of fixing autonegotiation on hme(4) using DP83840A PHYs.
It appears to also fix the occasional problems to establish a link on
hme(4) using LU6612 PHYs and shouldn't hurt on those using QS6612 PHYs.

Obtained from: NetBSD


129801 28-May-2004 scottl

Remove a redundant include directive


129631 23-May-2004 yar

Mark the VLAN_MTU capability as initially enabled since it's
hardcoded to "ON" for these interfaces.


129616 23-May-2004 mux

We don't need to initialize if_output, ether_ifattach() does it
for us.


129570 22-May-2004 marius

Spelling and style fixes.

Obtained from: NetBSD


129006 06-May-2004 joerg

The Sun hme hardware supposedly supports Tx frames up to 65535 octets,
and Rx frames up to 8191 octets, so it is perfectly capable of supporting
vlan(4)-style VLAN natively.

Thus, make it support VLAN `oversize' frames.

Reviewed by: tmm


127238 20-Mar-2004 mdodd

Let ether_ifattach() announce our MAC address.

Submitted by: Marius Strobl <marius@alchemy.franken.de>


127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


121816 31-Oct-2003 brooks

Replace the if_name and if_unit members of struct ifnet with new members
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)


119696 02-Sep-2003 marcel

Preparatory commit to allow prototypes in ofw_machdep.h to contain
both newbus types and OFW types. This involves either including
<machine/bus.h> or <dev/ofw/openfirm.h>.

Reviewed by: jake, jmg, tmm


119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


119351 23-Aug-2003 marcel

s#<foo/bar.h>#<dev/foo/bar.h>#g


119338 23-Aug-2003 imp

s=include <ofw/=include <dev/ofw/= to reflect removal of -I$S/dev


119280 22-Aug-2003 imp

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


117126 01-Jul-2003 scottl

Mega busdma API commit.

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


117116 01-Jul-2003 tmm

Some gem and hme hardware bogusly has the intpin register hardwired to
0; detect this case and correct it. While being there, clean up nearby
comments.


113545 16-Apr-2003 mdodd

- Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
bus code will do this now.


113506 15-Apr-2003 mdodd

- Express hard dependencies on bus (pci, isa, pccard) and
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.)


111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


109649 21-Jan-2003 tmm

bus_dmamap_sync() overhaul:
- Remove NetBSD-style or-ed together BUS_DMASYNC operations, in some
cases relaxing the (intended) syncing operation a bit.
- Add syncs before reading the descriptor rings.
- Try to combine syncs where possible to avoid overhead.
- Sync all maps before unloading them.


109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


108976 09-Jan-2003 tmm

Add detach, shutdown, suspend and resume methods.

Tested by: jake


108960 08-Jan-2003 obrien

Fix module dependancy name.

PR: 46871
Submitted by: Hartmut Brandt <brandt@fokus.gmd.de>


108834 06-Jan-2003 tmm

Convert to use bus_dmamap_load_mbuf(); decouple software TX descriptors
from the hardware descriptors to avoid the overhead of having a DMA
map for each of them. Bump the number of hardware descriptors to 128,
and use half as many software descriptors for now.
Some minor cleanups.


106937 14-Nov-2002 sam

network interface driver changes:

o don't strip the Ethernet header from inbound packets; pass packets
up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by: many
Approved by: re


100980 30-Jul-2002 fenner

Call bpf_mtap() on output, to catch outgoing packets for e.g. tcpdump .


99954 14-Jul-2002 tmm

Miscellaneous fixes:
- always reinitialize the rx descriptors, even if the mbuf is kept.
This should fix the hangs on ifconfig that were observed
- on an rx overflow, reinitialize the descriptor so that the interface
will not hang
- correct some bus_dmamap_sync() calls
- correct some debug messages
- some minor nits


97869 05-Jun-2002 tmm

Don't treat statistics counter wrap-overs as errors.


95533 26-Apr-2002 mike

Move the new byte order function prototypes from <sys/param.h> to
<sys/endian.h>. This puts us in line with NetBSD and OpenBSD.


93043 23-Mar-2002 tmm

Assorted fixes:
- remove some useless code from the status change handler that was intended
to enable the the MII drivers for external phys; this is already done
during interface initialization, and the deleted code made some
assumptions about phy addresses that do not seem to hold true on newer
cards. This should get at least one of the two hmes of newer Netra t1
machines working.
- correct the interrupt resource allocation
- bump the number of RX descriptors, lower values cause promblems on some
machines


92046 11-Mar-2002 tmm

Use the pci_enable_* functions instead of manually fiddling with the
command register.

Pointed out by: msmith


91962 09-Mar-2002 tmm

Fix some bugs in the handling of the case of not enough tx descriptors
being free to send a packet.


91396 27-Feb-2002 tmm

Add a driver for the Sun HME PCI/SBus ethernet adaptor, which is onboard
in most machines of the Sun Ultra series. This is a port of the NetBSD
driver which I enhanced to make use of the gather functionality and the
configurable RX buffer offset to avoid copying all received/sent packet
(instead, packets will be directly DMAd from mbuf chains and into mbuf
clusters now).