Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_msk.c
RevisionDateAuthorComments
 1.119  24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.118  20-Sep-2021  jmcneill Use coherent DMA mappings when possible.
 1.117  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.116  08-May-2021  thorpej branches: 1.116.6;
Use pci_compatible_match().
 1.115  24-Apr-2021  thorpej branches: 1.115.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.114  04-Oct-2020  jakllsch branches: 1.114.4;
device_printf() instead of aprint_error_dev() where appropriate
 1.113  11-May-2020  jakllsch msk(4): ack Status BMU IRQ only if we're (apparently) caught up with it

Possibility for acking an unprocessed Status BMU IRQ still exists, and
remains handled by the watchdog. Nevertheless this should reduce the
likelyhood that path is taken.
 1.112  11-May-2020  jakllsch msk(4): simplify interrupt return value creation

This also corrects a problem where we would not claim we handled an
interrupt that was ours.
 1.111  11-May-2020  jakllsch msk(4): moderate no interrupts globally

The global interrupt moderator on mskc(4) is mostly redundant with the Status Unit's tx and rx interrupt coalescing for our purpouses

Revisits interrupt moderation change in 1.108.
 1.110  08-May-2020  jakllsch Use sysctl_teardown() upon detach of mskc(4).
 1.109  08-May-2020  jakllsch msk(4): Simplify setting the first List Element owner-bit last.

We don't actually need to do this, as the BMU won't proceed to the new
descriptor until we advance the ring-end pointer on the chip, but perhaps
it has value as paranoia.
 1.108  30-Apr-2020  jakllsch msk(4): actually moderate interrupts from the Yukon 2 Status BMU

Previously the interrupt moderation enable register was being programmed
with sk(4)-style enable bits, none of which matched the significant
interrupt sources of the Yukon 2 we enable.
 1.107  30-Apr-2020  jakllsch msk(4): during attach print intrstr only once
 1.106  30-Apr-2020  jakllsch msk(4): rework rx descriptor loading to support multiple segments

This paves the way to replace the driver-internal jumbo frame rx buffer
with other recieve buffers (for example MCLGET/MEXTMALLOC) in the future.
 1.105  29-Apr-2020  jakllsch msk(4): Simply keep a ring of (tx) dmamaps, rather than a linked list
 1.104  29-Apr-2020  jakllsch msk(4): don't keep array of pointers to each ring descriptor

With 512 descriptors each in 2 rings this saves 4KiB (LP32) or 8KiB (LP64)
per interface.
 1.103  28-Apr-2020  jakllsch Use correct-semantic byteorder(9) functions to provide letoh*() in msk(4)
 1.102  28-Apr-2020  jakllsch Remove unused cargo cult include of <dev/mii/brgphyreg.h> in if_msk.c.
 1.101  26-Apr-2020  jakllsch Remove written-only sk_next member of struct (m)sk_chain.
 1.100  22-Apr-2020  jdolecek show the 'interrupting at ...' info on boot
 1.99  18-Apr-2020  jakllsch msk(4): Avoid bus_dmamap_destroy() in msk_stop()

bus_dmamap_destroy() can not be executed in soft interrupt context,
and msk_stop() can be called in soft interrupt context.

As such, move creation and destruction of tx dmamaps to attach() and
detach() functions.
 1.98  04-Feb-2020  thorpej branches: 1.98.4;
Use ifmedia_fini().
 1.97  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.96  01-Dec-2019  maxv branches: 1.96.2;
minor adjustments, to avoid warnings on debug builds
 1.95  28-Nov-2019  maxv localify
 1.94  15-Nov-2019  msaitoh Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.
 1.93  10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.92  17-Oct-2019  msaitoh Fix order of m_freem(). Found by kASan. OK'd by jdolecek and mrg.
 1.91  03-Jun-2019  msaitoh branches: 1.91.2;
I think it's not required to call msk_init_yukon() in msk_attach().
Fixes PR kern/54261 reported by David shao.
 1.90  28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.89  23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.88  23-May-2019  msaitoh No functional change:
- Simplify MII structure initialization and reference.
- u_int*_t -> uint*_t.
- KNF
 1.87  11-Apr-2019  msaitoh Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.86  03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.85  27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.84  22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.83  08-Jan-2019  msaitoh KNF. No functional change.
 1.82  27-Dec-2018  mrg - initialise sk_rx_hiaddr and sk_tx_hiaddr
- use MSK_ADDR_LO() and MSK_ADDR_HI()
- expand a debug message
- remove unused softc members
 1.81  08-Dec-2018  bouyer Don't try to handle interrupts for a detached device. Should fix
panic on shutdown reported by Stefan Hertenberger on current-users.
 1.80  13-Nov-2018  jdolecek whitespace fix, NFC
 1.79  21-Oct-2018  jmcneill Enable MSI support where available.
 1.78  14-Sep-2018  jakllsch msk(4): add 64-bit DMA support

portions of this change set provided by mrg@
 1.77  12-Sep-2018  jakllsch if_msk: detach/reattach fixes

- Fill in sc->sk_bsize upon pci_mapreg_map() so that we'll correctly
bus_space_unmap() on detach.
- Clear sc->sk_intrhand after interrupt disestablish, to prevent
disestablishing unestablished interrupt.
 1.76  23-Aug-2018  maxv Fix buffer overflow, detected by kASan.

[ 1.044878] kASan: Unauthorized Access In 0xffffffff804ec7e2: Addr 0xffffffff818a51e4 [2 bytes, read]
[ 1.044878] #0 0xffffffff804ec7e2 in mskc_probe <netbsd>
[ 1.044878] #1 0xffffffff80e92a77 in mapply <netbsd>
[ 1.044878] #2 0xffffffff80e92e5f in config_search_loc <netbsd>
[ 1.044878] #3 0xffffffff80e93fb5 in config_found_sm_loc <netbsd>
[ 1.044878] #4 0xffffffff802ca9ea in pci_probe_device <netbsd>
[ 1.044878] #5 0xffffffff802cad97 in pci_enumerate_bus <netbsd>
[ 1.044878] #6 0xffffffff802caf00 in pcirescan <netbsd>
[ 1.044878] #7 0xffffffff802cb1ee in pciattach <netbsd>
[ 1.044878] #8 0xffffffff80e93e5b in config_attach_loc <netbsd>
[ 1.044878] #9 0xffffffff80e93fce in config_found_sm_loc <netbsd>
[ 1.044878] #10 0xffffffff80271212 in mp_pci_scan <netbsd>
[ 1.044878] #11 0xffffffff8022d9ee in mainbus_attach <netbsd>
[ 1.044878] #12 0xffffffff80e93e5b in config_attach_loc <netbsd>
[ 1.044878] #13 0xffffffff8021e38b in cpu_configure <netbsd>
[ 1.044878] #14 0xffffffff814a7068 in main <netbsd>
 1.75  10-Jul-2018  jdolecek replace code using SK_WA_4109 workaround flag by explicit conditional
on affected type ids and revisions, so it's properly applied whenever
new types are added; taken with FreeBSD

contrary to FreeBSD, keep the IWM workaround for all XL revs - my XL rev. A3
seems to consistently have slightly (~2%) better Rx performance with the 0x04
value
 1.74  10-Jul-2018  jdolecek minor fix for earlier sync with OpenBSD if_msk.c; remove duplicit
COMA handling, add also workaround code for Yukon EC Ultra and EX, and
remove a write-only assignment
 1.73  10-Jul-2018  jdolecek fix comment typo
 1.72  10-Jul-2018  jdolecek add callout for re-filling RX ring - it's invoked when the RX refill
code can't get enough buffers; fixes possible stall when the RXSTAT
interrupt arrives while no buffers are available

idea from OpenBSD if_msk.c rev. 1.131

as part of this remove the confusingly commented re-fill code from
msk_jfree() and instead just invoke the callout if needed; also
refill in msk_intr() only when running low instead of every RX intr;
this simplifies the code, and gives small RX performance boost on
my hardware (6%: ~38 MB/s -> ~40 MB/s)

tested on SK-9E22 (Yukon-2 XL rev. A3) by me, and 88E8071 (Yukon-2
Extreme rev. B0) by Jogn Halfpenny; unfortunately still doesn't
resolve the PR kern/53301 stall
 1.71  04-Jul-2018  jdolecek use pci_intr_establish_xname()
 1.70  03-Jul-2018  jdolecek fix detach code and do it on shutdown
 1.69  03-Jul-2018  jdolecek attach the rnd source only once even with dual-port adapters
 1.68  02-Jul-2018  jdolecek sync OpenBSD if_msk.c revs 1.66-1.79 skipping framework changes and already
present changes:
- Make Yukon-2 FE+ (88E8040, 88E8042) work
- 88E8057 is a Yukon 2 Ultra 2, and this might make it work on a little
shiny green box in Japan
- Prevent null pointer dereference that could happen when we process an RX
interrupt that was queued while stopping the interface.
- Remove holdover XMAC II writes/reads inherited from sk as
they aren't required and cause problems like the 88E8072
hard locking a system when enabling macsec bypass.
- Bypass macsec on extreme/supreme based chips.
Makes my 88E8072 work.
- Add detach support to a few more drivers, and in others do the neccessary
operations in the detach function in the right order.

towards resolution of PR kern/53301 but will need more work

tested by John Halfpenny on another 8040/Yukon-2 FE+ and reported
improving behaviour (system hang to stall) so committing as stopgap; also
tested on my SK-9E22 (Yukon-2 XL), there works without any issues both before
and after
 1.67  26-Jun-2018  msaitoh branches: 1.67.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.66  21-Jun-2018  msaitoh Simplify & white space fix. No functional change.
 1.65  14-Jun-2018  msaitoh Remove extra tabs. No functional change.
 1.64  13-Jun-2018  jdolecek fix device name in printf when not matched
 1.63  13-Jun-2018  jdolecek sync and adapt with OpenBSD if_msk.c rev. 1.43-1.65 (modulo some
cosmetics, stuff we already had, or stuff which does not apply due
to different frameworks):

- Add support for fiber on 88E8021/22
- Avoid unnecessary resets. This should make fiber 88E8021/22 work completely
- Only probe phy's at address 0; gets rid of bogus phy's on the
Marvell Yukon 88E8036
- Remove an unused function msk_setfilt() which was copied from sk(4)
- Make msk(4) detachable
- Simplify the combination use of pci_mapreg_type()/pci_mapreg_map()
 1.62  13-Jun-2018  jdolecek revert rev. 1.29 'Only tick mii if the phy had a status change', as neither
OpenBSD nor FreeBSD drivers have this conditional
 1.61  12-Jun-2018  jdolecek move SK_HASH_BITS to if_skreg.h and reuse in if_msk.c (from OpenBSD)
 1.60  12-Jun-2018  jdolecek match three more variants - DGE550T_B1, 8040T, 8042

sync more sk_type conditionals from OpenBSD
 1.59  12-Jun-2018  jdolecek fix whitespace
 1.58  11-Jun-2018  jdolecek Factual correction: actually old code also used number of octents, but set
sc_if->sk_tx_ramend to invalid value, and assumed 128k buffer when
SK_EPROM0 read returned zero

(no code change)
 1.57  11-Jun-2018  jdolecek adopt tx/rx buffer size computation from OpenBSD rev. 1.51 to fix
"random" msk failures

the crucial fix is that the start/end adresses are computed and
written to hw registers in number of octets (i.e. size /
sizeof(u_int64_t)), as that is actually what the hardware expects

fixes PR kern/36454 (which had fix which highlighted the trouble),
and seems likely to also fix kern/35711 and port-i386/42514
 1.56  09-Jun-2018  jdolecek port basic match support for several more Yukon variants from OpenBSD, together
with some basic conditionals I've found in that driver; only compile-tested, so
very likely needs further work to actually work

adresses also PR kern/43507
 1.55  20-Oct-2017  christos branches: 1.55.2;
update entry for Marvel Yukon 8058, and fix URL for pci ids (Rocky Hotas)
 1.54  15-Dec-2016  ozaki-r branches: 1.54.8;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.53  08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.52  06-Nov-2016  christos msk_init is too heavyweight and loses link. Provide a specialized way to
enter and exit promiscuous mode so that we don't lose seconds of traffic
each time we run tcpdump.
 1.51  10-Jun-2016  ozaki-r branches: 1.51.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.50  01-Jun-2016  pgoyette Commit patch from t-hash in PR kern/48309
 1.49  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.48  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.47  10-Oct-2014  christos branches: 1.47.2;
PR/49270: Hauke Fath: Samsung NC10 Marvell Yukon ethernet not supported
 1.46  10-Aug-2014  tls Merge tls-earlyentropy branch into HEAD.
 1.45  29-Mar-2014  christos branches: 1.45.2;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.44  25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.43  30-Mar-2013  christos branches: 1.43.4;
remove trailing whitespace
 1.42  04-Aug-2012  riastradh branches: 1.42.2;
Fix null pointer dereference in msk_rxeof.

This triggers when processing an RX interrupt that was queued while
stopping the interface, which caused my machine to panic last night.
In this case, just drop the packet.

From OpenBSD's if_msk.c rev. 1.71.
 1.41  22-Jul-2012  matt Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
 1.40  02-Jun-2012  dsl Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.39  02-Feb-2012  tls branches: 1.39.2;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.38  24-Apr-2011  plunky branches: 1.38.4; 1.38.8;
use static inline for msk_rxvalid(), it is not referenced elsewhere

(avoids C99 vs GNU semantics for external inline functions)
 1.37  16-Apr-2011  jakllsch Make previous compile.
 1.36  16-Apr-2011  jakllsch Ensure PCI_COMMAND_MASTER_ENABLE.
 1.35  05-Apr-2010  joerg branches: 1.35.2;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.34  30-Mar-2010  tnn yinterrupt -> interrupt
 1.33  24-Feb-2010  dyoung branches: 1.33.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.32  19-Jan-2010  pooka branches: 1.32.2;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.31  08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.30  24-Dec-2009  christos - split the sk_dev
- don't program the interrupt mitigation to 0, only to set it to 1000 later.
- don't be verbose when setting the interrupt mitigation during reset, it
messes up the attach line and does not convey useful information.
 1.29  14-Dec-2009  matt Only tick mii if the phy had a status change.
 1.28  05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.27  12-May-2009  cegger use device_private().
"looks good" ad@
XXX for the device_t/softc split, please check the driver that no cases have been missed.
 1.26  06-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.25  06-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.24  18-Mar-2009  cegger bzero -> memset
 1.23  18-Mar-2009  cegger bcmp -> memcmp
 1.22  18-Nov-2008  chris branches: 1.22.4;
Fix Yukon EC Ultra cold power up issue.

For the EC Ultra it is necessary to update some extra registers during
reset. Without doing so causes the system to hang at boot. The only
workaround I found was to PXE boot before booting into NetBSD.

This change is based on the code from FreeBSD's if_msk.c. Specifically the
msk_phy_power function.

Also add an splnet/splx across mii_tick. This matches most other network
drivers.

Change posted for review on 3rd Oct 2008 to tech-net. No feedback
received.
 1.21  20-Jun-2008  cube branches: 1.21.2; 1.21.4; 1.21.6;
Apply a similar patch as what was just applied to sk(4):

> Use a mutex instead of splvm() to protect the list of jubo-ready mbufs, as
> done with nfe(4) a while ago.
>
> Issue reported by Gary Duzan, who kindly fixed the patch I had sent him.

Lars Nordlund noted that such a change made things a lot better with his
msk(4).
 1.20  28-May-2008  joerg branches: 1.20.2;
Add PMF hooks. Fixes PR 38675.
 1.19  27-May-2008  dyoung For all controllers but type SK_YUKON_FE, set the jumbo frames
capability, ETHERCAP_JUMBO_MTU. Rely on ether_ioctl() to enforce
the MTU range implied by the ethernet capabilities. Should fix
kern/38748.

While I'm here, use some standard ethernet constants instead of
msk-specific constants.
 1.18  10-Apr-2008  cegger branches: 1.18.2; 1.18.4; 1.18.6;
use aprint_*_dev and device_xname
 1.17  28-Mar-2008  kiyohara The status buffer must synchronize. If your CPU is cache writeback,
synchronous processing is necessary. However, the size of a status
buffer will overwrite the memory while synchronously processing it
because it is very small. We clear the flag SK_Y2_STOPC_OWN at more
late.
 1.16  07-Feb-2008  dyoung branches: 1.16.6;
Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs. This will ease extending the kernel and sharing of code
between drivers.

First steps: Make the signature of ifioctl_common() match struct
ifinet->if_ioctl. Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
 1.15  19-Jan-2008  dyoung 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.
 1.14  11-Dec-2007  lukem use __KERNEL_RCSID()
 1.13  15-Nov-2007  manu branches: 1.13.2; 1.13.4; 1.13.6;
It's 88C055, not 88CO55.
 1.12  07-Nov-2007  ad Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.11  22-Oct-2007  manu branches: 1.11.2;
Add support for Marvell 88CO55. Newer iMacs come with that chip.
 1.10  19-Jul-2007  dsl branches: 1.10.4; 1.10.6; 1.10.10; 1.10.12;
include sys/cdefs.h
 1.9  09-Jul-2007  ad branches: 1.9.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.8  04-Mar-2007  christos branches: 1.8.2; 1.8.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7  31-Jan-2007  msaitoh branches: 1.7.2;
Apply OpenBSD's rev. 1.14 via patch:
> remove another Yukon Lite workaround.
 1.6  30-Jan-2007  msaitoh apply some patches from FreeBSD

o fix device timeout
o add some workaround
o TX underrun bug (grr...)
o and some bugs
 1.5  30-Jan-2007  msaitoh sync with OpenBSD-current (many bugfixes, add some devices)

if_msk.c: rev. 1.42
if_mskvar.h rev. 1.3
if_skreg.h rev. 1.41
 1.4  05-Jan-2007  msaitoh Apply OpenBSD's rev. 1.33 to shut up "msk0: phy write timed out"

Original commit message:
> In msk_marv_miibus_writereg, wait for busy flag to clear instead of
> continuing when busy flag set.
 1.3  16-Nov-2006  christos branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
__unused removal on arguments; approved by core.
 1.2  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.1  09-Sep-2006  riz branches: 1.1.2; 1.1.4; 1.1.6;
Add msk(4), a driver for Marvell Yukon 2 gigabit ethernet chips,
from Mark Kettenis of OpenBSD. There are still some outstanding
issues with this driver, namely:

- Checksum offload is unsupported
- There is a significant amount of code duplication from sk(4)
- There remain some 'magic numbers'
- Performance is not heavily tested, and likely to be lower than
the chip is capable of in some cases. Syncing some of the
aforementioned 'magic numbers' with the Marvell FreeBSD driver
should help here.

Tested on a motherboard with Marvell 88E8053 ethernet, under NetBSD/i386
and NetBSD/amd64.
 1.1.6.2  10-Dec-2006  yamt sync with head.
 1.1.6.1  22-Oct-2006  yamt sync with head
 1.1.4.1  15-Sep-2006  tron Pull up following revision(s) (requested by riz in ticket #153):
sys/dev/pci/if_skreg.h: revision 1.8
sys/dev/pci/if_msk.c: revision 1.1
sys/dev/pci/files.pci: revision 1.268
sys/dev/pci/if_mskvar.h: revision 1.1
Add msk(4), a driver for Marvell Yukon 2 gigabit ethernet chips,
from Mark Kettenis of OpenBSD. There are still some outstanding
issues with this driver, namely:
- Checksum offload is unsupported
- There is a significant amount of code duplication from sk(4)
- There remain some 'magic numbers'
- Performance is not heavily tested, and likely to be lower than
the chip is capable of in some cases. Syncing some of the
aforementioned 'magic numbers' with the Marvell FreeBSD driver
should help here.
Tested on a motherboard with Marvell 88E8053 ethernet, under NetBSD/i386
and NetBSD/amd64.
 1.1.2.2  14-Sep-2006  yamt sync with head.
 1.1.2.1  09-Sep-2006  yamt file if_msk.c was added on branch yamt-pdpolicy on 2006-09-14 12:31:33 +0000
 1.3.8.2  06-Jan-2008  wrstuden Catch up to netbsd-4.0 release.
 1.3.8.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.3.6.8  11-Feb-2008  yamt sync with head.
 1.3.6.7  21-Jan-2008  yamt sync with head
 1.3.6.6  15-Nov-2007  yamt sync with head.
 1.3.6.5  27-Oct-2007  yamt sync with head.
 1.3.6.4  03-Sep-2007  yamt sync with head.
 1.3.6.3  26-Feb-2007  yamt sync with head.
 1.3.6.2  30-Dec-2006  yamt sync with head.
 1.3.6.1  16-Nov-2006  yamt file if_msk.c was added on branch yamt-lazymbuf on 2006-12-30 20:48:45 +0000
 1.3.4.4  15-Nov-2007  pavel Backout accidental commit to the release branch.
 1.3.4.3  15-Nov-2007  manu It's not 88CO55, it's 88C055
 1.3.4.2  04-Nov-2007  xtraeme Pull up following revision(s) (requested by manu in ticket #954):
sys/dev/pci/pcidevs_data.h: patch
sys/dev/pci/pcidevs.h: patch
sys/dev/pci/if_msk.c: revision 1.11
sys/dev/pci/pcidevs: revision 1.907

Add support for Marvell 88CO55. Newer iMacs come with that chip.
 1.3.4.1  26-Aug-2007  liamjfoy Pull up following revision(s) (requested by riz in ticket #816):
sys/dev/pci/if_skreg.h: revision 1.10
sys/dev/pci/if_skreg.h: revision 1.11
sys/dev/pci/pcidevs: revision 1.866
sys/dev/pci/if_skreg.h: revision 1.9
sys/dev/pci/if_sk.c: revision 1.36
sys/dev/pci/if_msk.c: revision 1.4
sys/dev/pci/if_msk.c: revision 1.5
sys/dev/pci/if_msk.c: revision 1.6
sys/dev/pci/if_msk.c: revision 1.7
sys/dev/pci/if_mskvar.h: revision 1.2
sys/dev/pci/if_mskvar.h: revision 1.3
Apply OpenBSD's rev. 1.33 to shut up "msk0: phy write timed out"
Original commit message:
> In msk_marv_miibus_writereg, wait for busy flag to clear instead of
> continuing when busy flag set.

add some msk devices

sync with OpenBSD-current (many bugfixes, add some devices)
if_msk.c: rev. 1.42
if_mskvar.h rev. 1.3
if_skreg.h rev. 1.41

sync with if_skreg.h rev. 1.41
need more work?

apply some patches from FreeBSD
o fix device timeout
o add some workaround
o TX underrun bug (grr...)
o and some bugs

fix bit definitions for the RX FIFO Flush mode

Apply OpenBSD's rev. 1.14 via patch:
> remove another Yukon Lite workaround.
 1.3.2.4  01-Feb-2007  ad Sync with head.
 1.3.2.3  12-Jan-2007  ad Sync with head.
 1.3.2.2  18-Nov-2006  ad Sync with head.
 1.3.2.1  16-Nov-2006  ad file if_msk.c was added on branch newlock2 on 2006-11-18 21:34:30 +0000
 1.7.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.8.4.1  11-Jul-2007  mjf Sync with head.
 1.8.2.3  01-Sep-2007  ad Update for pool_cache API changes.
 1.8.2.2  20-Aug-2007  ad Sync with HEAD.
 1.8.2.1  01-Jul-2007  ad Adapt to callout API change.
 1.9.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.10.12.2  19-Jul-2007  dsl include sys/cdefs.h
 1.10.12.1  19-Jul-2007  dsl file if_msk.c was added on branch matt-mips64 on 2007-07-19 22:04:23 +0000
 1.10.10.3  18-Nov-2007  bouyer Sync with HEAD
 1.10.10.2  13-Nov-2007  bouyer Sync with HEAD
 1.10.10.1  25-Oct-2007  bouyer Sync with HEAD.
 1.10.6.4  23-Mar-2008  matt sync with HEAD
 1.10.6.3  09-Jan-2008  matt sync with HEAD
 1.10.6.2  08-Nov-2007  matt sync with -HEAD
 1.10.6.1  06-Nov-2007  matt sync with HEAD
 1.10.4.3  21-Nov-2007  joerg Sync with HEAD.
 1.10.4.2  11-Nov-2007  joerg Sync with HEAD.
 1.10.4.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.11.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.11.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.11.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.13.6.2  20-Jan-2008  bouyer Sync with HEAD
 1.13.6.1  13-Dec-2007  bouyer Sync with HEAD
 1.13.4.1  11-Dec-2007  yamt sync with head.
 1.13.2.1  26-Dec-2007  ad Sync with head.
 1.16.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.16.6.3  29-Jun-2008  mjf Sync with HEAD.
 1.16.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.16.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.18.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.4.5  11-Aug-2010  yamt sync with head.
 1.18.4.4  11-Mar-2010  yamt sync with head
 1.18.4.3  16-Sep-2009  yamt sync with head
 1.18.4.2  16-May-2009  yamt sync with head
 1.18.4.1  04-May-2009  yamt sync with head.
 1.18.2.1  04-Jun-2008  yamt sync with head
 1.20.2.1  27-Jun-2008  simonb Sync with head.
 1.21.6.1  20-Nov-2008  snj branches: 1.21.6.1.4;
Pull up following revision(s) (requested by chris in ticket #84):
sys/dev/pci/if_skreg.h: revision 1.13
sys/dev/pci/if_msk.c: revision 1.22
Fix Yukon EC Ultra cold power up issue.
For the EC Ultra it is necessary to update some extra registers during
reset. Without doing so causes the system to hang at boot. The only
workaround I found was to PXE boot before booting into NetBSD.
This change is based on the code from FreeBSD's if_msk.c. Specifically the
msk_phy_power function.
Also add an splnet/splx across mii_tick. This matches most other network
drivers.
Change posted for review on 3rd Oct 2008 to tech-net. No feedback
received.
 1.21.6.1.4.1  09-Nov-2009  cliff - in msk_tick, only call mii_tick() if status has changed
 1.21.4.2  28-Apr-2009  skrll Sync with HEAD.
 1.21.4.1  19-Jan-2009  skrll Sync with HEAD.
 1.21.2.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.33.2.3  31-May-2011  rmind sync with head
 1.33.2.2  21-Apr-2011  rmind sync with head
 1.33.2.1  30-May-2010  rmind sync with head
 1.35.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.38.8.1  18-Feb-2012  mrg merge to -current.
 1.38.4.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.4.2  30-Oct-2012  yamt sync with head
 1.38.4.1  17-Apr-2012  yamt sync with head
 1.39.2.1  12-Aug-2012  martin Pull up following revision(s) (requested by riastradh in ticket #480):
sys/dev/pci/if_msk.c: revision 1.42
Fix null pointer dereference in msk_rxeof.
This triggers when processing an RX interrupt that was queued while
stopping the interface, which caused my machine to panic last night.
In this case, just drop the packet.
From OpenBSD's if_msk.c rev. 1.71.
 1.42.2.3  03-Dec-2017  jdolecek update from HEAD
 1.42.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.2.1  23-Jun-2013  tls resync from head
 1.43.4.1  18-May-2014  rmind sync with head
 1.45.2.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.47.2.5  05-Feb-2017  skrll Sync with HEAD
 1.47.2.4  05-Dec-2016  skrll Sync with HEAD
 1.47.2.3  09-Jul-2016  skrll Sync with HEAD
 1.47.2.2  19-Mar-2016  skrll Sync with HEAD
 1.47.2.1  06-Jun-2015  skrll Sync with HEAD
 1.51.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.54.8.2  13-May-2019  martin Pull up the following, via patch, requested by msaitoh in ticket #1263:

sys/dev/mii/brgphy.c 1.84
sys/dev/mii/ciphy.c 1.33 via patch
sys/dev/mii/rgephy.c 1.53
sys/arch/arm/imx/if_enet.c 1.18
sys/arch/mips/adm5120/dev/if_admsw.c 1.19-1.20
sys/dev/pci/if_bge.c 1.329
sys/dev/pci/if_bnx.c 1.81
sys/dev/pci/if_et.c 1.21
sys/dev/pci/if_lii.c 1.22
sys/dev/pci/if_msk.c 1.87
sys/dev/pci/if_nfe.c 1.68
sys/dev/pci/if_sk.c 1.95
sys/dev/pci/if_ti.c 1.107
sys/dev/pci/if_txp.c 1.52
sys/dev/pci/if_vge.c 1.69
sys/dev/usb/if_axen.c 1.38
sys/dev/usb/if_aue.c 1.149

Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.54.8.1  08-Mar-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #616):
sys/dev/pci/if_msk.c: revision 1.55
sys/dev/pci/pcidevs: revision 1.1299
update entry for Marvel Yukon 8058, and fix URL for pci ids (Rocky Hotas)
 1.55.2.8  26-Jan-2019  pgoyette Sync with HEAD
 1.55.2.7  18-Jan-2019  pgoyette Synch with HEAD
 1.55.2.6  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.55.2.5  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.55.2.4  30-Sep-2018  pgoyette Ssync with HEAD
 1.55.2.3  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.55.2.2  28-Jul-2018  pgoyette Sync with HEAD
 1.55.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.67.2.4  21-Apr-2020  martin Sync with HEAD
 1.67.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.67.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.67.2.1  10-Jun-2019  christos Sync with HEAD
 1.91.2.2  19-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #450):

sys/dev/pci/if_msk.c: revision 1.94
sys/dev/pci/if_skreg.h: revision 1.27

Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.
 1.91.2.1  24-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #374):

sys/dev/pci/if_msk.c: revision 1.92

Fix order of m_freem(). Found by kASan. OK'd by jdolecek and mrg.
 1.96.2.1  29-Feb-2020  ad Sync with head.
 1.98.4.2  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.98.4.1  20-Apr-2020  bouyer Sync with HEAD
 1.114.4.1  21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.115.2.1  13-May-2021  thorpej Sync with HEAD.
 1.116.6.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed