xref: /illumos-gate/usr/src/uts/common/io/e1000api/README.illumos (revision 42b53e0fbc5c05289c3d334bb864b784fafe5ce4)
175eba5b6SRobert Mustacchi#
275eba5b6SRobert Mustacchi# This file and its contents are supplied under the terms of the
375eba5b6SRobert Mustacchi# Common Development and Distribution License ("CDDL"), version 1.0.
475eba5b6SRobert Mustacchi# You may only use this file in accordance with the terms of version
575eba5b6SRobert Mustacchi# 1.0 of the CDDL.
675eba5b6SRobert Mustacchi#
775eba5b6SRobert Mustacchi# A full copy of the text of the CDDL should have accompanied this
875eba5b6SRobert Mustacchi# source.  A copy of the CDDL is also available via the Internet at
975eba5b6SRobert Mustacchi# http://www.illumos.org/license/CDDL.
1075eba5b6SRobert Mustacchi#
1175eba5b6SRobert Mustacchi
1275eba5b6SRobert Mustacchi#
1375eba5b6SRobert Mustacchi# Copyright (c) 2013 Joyent, Inc.  All rights reserved.
1475eba5b6SRobert Mustacchi#
1575eba5b6SRobert Mustacchi
1675eba5b6SRobert MustacchiHistorically e1000g and igb were maintained by two different teams at Sun and
1775eba5b6SRobert Mustacchithus while they used identical common code from Intel, they each only ever used
1875eba5b6SRobert Mustacchiportions of it and were not kept in sync with one another. To help make
1975eba5b6SRobert Mustacchimaintenance and the adding of new devices easier in illumos, we have gone
2075eba5b6SRobert Mustacchithrough and made it so that igb and e1000g rely on the same set of common code;
2175eba5b6SRobert Mustacchihowever, this code is not in its own module, each has its own copy of the code
2275eba5b6SRobert Mustacchicompiled into it for various reasons which will be laid out below.
2375eba5b6SRobert Mustacchi
2475eba5b6SRobert MustacchiAs part of the interface with the common code, the driver is required to define
2575eba5b6SRobert Mustacchian e1000_osdep.h. Currently each version of the driver defines its *own* version
2675eba5b6SRobert Mustacchiof this header file in their own driver specific directory. However, the code
2775eba5b6SRobert Mustacchithat implements this is different in each directory, specifically e1000g_osdep.c
2875eba5b6SRobert Mustacchiand igb_osdep.c. It's important that they have different names and not be called
2975eba5b6SRobert Mustacchithe same thing due to how the uts makefiles work.
3075eba5b6SRobert Mustacchi
3175eba5b6SRobert MustacchiDeviations from the common FreeBSD code:
3275eba5b6SRobert Mustacchi
3375eba5b6SRobert MustacchiWe have a few differences from the common version of the FreeBSD code that exist
3475eba5b6SRobert Mustacchiso that we can both gather firmware information and that have workarounds for
3575eba5b6SRobert Mustacchiolder chipsets. While, we would like to get that to be synced up and common, it
3675eba5b6SRobert Mustacchiis not currently.
3775eba5b6SRobert Mustacchi
3875eba5b6SRobert MustacchiEnergy Efficient Ethernet (EEE) is not enabled by default. This technology was
3975eba5b6SRobert Mustacchiintroduced with the I350 family of parts in the igb driver. However, there have
4075eba5b6SRobert Mustacchibeen issues seen with it in the wild and thus we opt to disable it by default
4175eba5b6SRobert Mustacchiuntil tests have proven that there are no longer problems.
4275eba5b6SRobert Mustacchi
4375eba5b6SRobert MustacchiTo help make that easier, we've documented here what these extra definitions
4475eba5b6SRobert Mustacchiare. DO NOT just blindly copy over new common code. There is more work that
4575eba5b6SRobert Mustacchineeds to be done in terms of changed interfaces and expectations for the
4675eba5b6SRobert Mustacchidrivers.
4775eba5b6SRobert Mustacchi
48f3682895SRobert Mustacchi# Support for Ice Lake, Cannon Lake, Tiger Lake, and the more recent I219 LM/V
495bb0bdfeSRobert Mustacchi
505bb0bdfeSRobert MustacchiDue to several changes that have been made to the core e1000 code in
515bb0bdfeSRobert MustacchiFreeBSD that's specific to changes for iflib, a whole sale update was
52f3682895SRobert Mustacchinot done and instead support was manually merged based on information from
53f3682895SRobert MustacchiIntel.
545bb0bdfeSRobert Mustacchi
5575eba5b6SRobert Mustacchi# e1000_defines.h
5675eba5b6SRobert Mustacchi
5775eba5b6SRobert MustacchiIn e1000_defines.h we add the following three definitions which are not
5875eba5b6SRobert Mustacchicurrently present. These definitions allow us to attach firware revisions and
5975eba5b6SRobert Mustacchiother information to the devinfo tree.
6075eba5b6SRobert Mustacchi
6175eba5b6SRobert Mustacchi#define		NVM_VERSION			0x0005
6275eba5b6SRobert Mustacchi#define		NVM_OEM_OFFSET_0		6
6375eba5b6SRobert Mustacchi#define		NVM_OEM_OFFSET_1		7
6475eba5b6SRobert Mustacchi
6575eba5b6SRobert Mustacchi# Workarounds for the 82541 and 82547
6675eba5b6SRobert Mustacchi
6775eba5b6SRobert MustacchiThere are various workarounds in place for the 82541 and 82547 due to errata
6875eba5b6SRobert Mustacchithat exist for these devices. This has traditionally been a part of the common
6975eba5b6SRobert Mustacchicode. Until this can get merged into the common code completely, we've spearted
7075eba5b6SRobert Mustacchiout the changes that are the actual C functions into
7175eba5b6SRobert Mustacchiuts/common/io/e1000g/e1000g_workarounds.c. However, this alone is not
7275eba5b6SRobert Mustacchisufficient. You must make sure that in e1000_hw.h that the struc
7375eba5b6SRobert Mustacchie1000_dev_spec_82541 actually looks like the following:
7475eba5b6SRobert Mustacchi
7575eba5b6SRobert Mustacchistruct e1000_dev_spec_82541 {
7675eba5b6SRobert Mustacchi	enum e1000_dsp_config dsp_config;
7775eba5b6SRobert Mustacchi	enum e1000_ffe_config ffe_config;
7875eba5b6SRobert Mustacchi	u32 tx_fifo_head;
7975eba5b6SRobert Mustacchi	u32 tx_fifo_start;
8075eba5b6SRobert Mustacchi	u32 tx_fifo_size;
8175eba5b6SRobert Mustacchi	u16 spd_default;
8275eba5b6SRobert Mustacchi	bool phy_init_script;
8375eba5b6SRobert Mustacchi	bool ttl_workaround;
8475eba5b6SRobert Mustacchi};
8575eba5b6SRobert Mustacchi
8675eba5b6SRobert Mustacchi# EEE
8775eba5b6SRobert Mustacchi
8875eba5b6SRobert MustacchiBy default we disable all support for EEE. To cause this to happen you must
8975eba5b6SRobert Mustacchimake the following change in e1000_82575.c's init_mac_params.
9075eba5b6SRobert Mustacchi
9175eba5b6SRobert MustacchiFrom:
9275eba5b6SRobert Mustacchi 394         /* Enable EEE default settings for EEE supported devices */
9375eba5b6SRobert Mustacchi 395         if (mac->type >= e1000_i350)
9475eba5b6SRobert Mustacchi 396                 dev_spec->eee_disable = FALSE;
9575eba5b6SRobert MustacchiTo:
9675eba5b6SRobert Mustacchi 394         /* Enable EEE default settings for EEE supported devices */
9775eba5b6SRobert Mustacchi 395         if (mac->type >= e1000_i350)
9875eba5b6SRobert Mustacchi 396                 dev_spec->eee_disable = TRUE;
9975eba5b6SRobert Mustacchi
10075eba5b6SRobert MustacchiFuture work:
10175eba5b6SRobert Mustacchi
10275eba5b6SRobert MustacchiThe next step here is to take the osdep portions and merge them. That would
10375eba5b6SRobert Mustacchiallow us to build one common misc module e1000api that both igb and e1000g
10475eba5b6SRobert Mustacchidepend on rather than building separate copies of the common code into each
10575eba5b6SRobert Mustacchidriver. Another potential option which may prove to have less value is to take
10675eba5b6SRobert Mustacchiall of the gld and ddi logic and have one driver export that leaving e1000g and
10775eba5b6SRobert Mustacchiigb as small stubs which depend on that. Note however, that the latter is not
10875eba5b6SRobert Mustacchihow our upstream is currently structuring their igb and em (FreeBSD's e1000g)
10975eba5b6SRobert Mustacchidrivers.
110*42b53e0fSRobert Mustacchi
111*42b53e0fSRobert Mustacchi# illumos specific files
112*42b53e0fSRobert Mustacchi
113*42b53e0fSRobert MustacchiThe files e1000_illumos.[ch] introduce code that is shared between the two
114*42b53e0fSRobert Mustacchidrivers so we can avoid copying and pasting some logic in multiple places. Any
115*42b53e0fSRobert Mustacchiupdates should not touch these unless the other definitions have changed as a
116*42b53e0fSRobert Mustacchiresult of the update.
117