xref: /titanic_52/usr/src/uts/common/io/e1000api/README.illumos (revision 42cc51e07cdbcad3b9aca8d9d991fc09b251feb7)
1*75eba5b6SRobert Mustacchi#
2*75eba5b6SRobert Mustacchi# This file and its contents are supplied under the terms of the
3*75eba5b6SRobert Mustacchi# Common Development and Distribution License ("CDDL"), version 1.0.
4*75eba5b6SRobert Mustacchi# You may only use this file in accordance with the terms of version
5*75eba5b6SRobert Mustacchi# 1.0 of the CDDL.
6*75eba5b6SRobert Mustacchi#
7*75eba5b6SRobert Mustacchi# A full copy of the text of the CDDL should have accompanied this
8*75eba5b6SRobert Mustacchi# source.  A copy of the CDDL is also available via the Internet at
9*75eba5b6SRobert Mustacchi# http://www.illumos.org/license/CDDL.
10*75eba5b6SRobert Mustacchi#
11*75eba5b6SRobert Mustacchi
12*75eba5b6SRobert Mustacchi#
13*75eba5b6SRobert Mustacchi# Copyright (c) 2013 Joyent, Inc.  All rights reserved.
14*75eba5b6SRobert Mustacchi#
15*75eba5b6SRobert Mustacchi
16*75eba5b6SRobert MustacchiHistorically e1000g and igb were maintained by two different teams at Sun and
17*75eba5b6SRobert Mustacchithus while they used identical common code from Intel, they each only ever used
18*75eba5b6SRobert Mustacchiportions of it and were not kept in sync with one another. To help make
19*75eba5b6SRobert Mustacchimaintenance and the adding of new devices easier in illumos, we have gone
20*75eba5b6SRobert Mustacchithrough and made it so that igb and e1000g rely on the same set of common code;
21*75eba5b6SRobert Mustacchihowever, this code is not in its own module, each has its own copy of the code
22*75eba5b6SRobert Mustacchicompiled into it for various reasons which will be laid out below.
23*75eba5b6SRobert Mustacchi
24*75eba5b6SRobert MustacchiAs part of the interface with the common code, the driver is required to define
25*75eba5b6SRobert Mustacchian e1000_osdep.h. Currently each version of the driver defines its *own* version
26*75eba5b6SRobert Mustacchiof this header file in their own driver specific directory. However, the code
27*75eba5b6SRobert Mustacchithat implements this is different in each directory, specifically e1000g_osdep.c
28*75eba5b6SRobert Mustacchiand igb_osdep.c. It's important that they have different names and not be called
29*75eba5b6SRobert Mustacchithe same thing due to how the uts makefiles work.
30*75eba5b6SRobert Mustacchi
31*75eba5b6SRobert MustacchiDeviations from the common FreeBSD code:
32*75eba5b6SRobert Mustacchi
33*75eba5b6SRobert MustacchiWe have a few differences from the common version of the FreeBSD code that exist
34*75eba5b6SRobert Mustacchiso that we can both gather firmware information and that have workarounds for
35*75eba5b6SRobert Mustacchiolder chipsets. While, we would like to get that to be synced up and common, it
36*75eba5b6SRobert Mustacchiis not currently.
37*75eba5b6SRobert Mustacchi
38*75eba5b6SRobert MustacchiEnergy Efficient Ethernet (EEE) is not enabled by default. This technology was
39*75eba5b6SRobert Mustacchiintroduced with the I350 family of parts in the igb driver. However, there have
40*75eba5b6SRobert Mustacchibeen issues seen with it in the wild and thus we opt to disable it by default
41*75eba5b6SRobert Mustacchiuntil tests have proven that there are no longer problems.
42*75eba5b6SRobert Mustacchi
43*75eba5b6SRobert MustacchiTo help make that easier, we've documented here what these extra definitions
44*75eba5b6SRobert Mustacchiare. DO NOT just blindly copy over new common code. There is more work that
45*75eba5b6SRobert Mustacchineeds to be done in terms of changed interfaces and expectations for the
46*75eba5b6SRobert Mustacchidrivers.
47*75eba5b6SRobert Mustacchi
48*75eba5b6SRobert Mustacchi# e1000_defines.h
49*75eba5b6SRobert Mustacchi
50*75eba5b6SRobert MustacchiIn e1000_defines.h we add the following three definitions which are not
51*75eba5b6SRobert Mustacchicurrently present. These definitions allow us to attach firware revisions and
52*75eba5b6SRobert Mustacchiother information to the devinfo tree.
53*75eba5b6SRobert Mustacchi
54*75eba5b6SRobert Mustacchi#define		NVM_VERSION			0x0005
55*75eba5b6SRobert Mustacchi#define		NVM_OEM_OFFSET_0		6
56*75eba5b6SRobert Mustacchi#define		NVM_OEM_OFFSET_1		7
57*75eba5b6SRobert Mustacchi
58*75eba5b6SRobert Mustacchi# Workarounds for the 82541 and 82547
59*75eba5b6SRobert Mustacchi
60*75eba5b6SRobert MustacchiThere are various workarounds in place for the 82541 and 82547 due to errata
61*75eba5b6SRobert Mustacchithat exist for these devices. This has traditionally been a part of the common
62*75eba5b6SRobert Mustacchicode. Until this can get merged into the common code completely, we've spearted
63*75eba5b6SRobert Mustacchiout the changes that are the actual C functions into
64*75eba5b6SRobert Mustacchiuts/common/io/e1000g/e1000g_workarounds.c. However, this alone is not
65*75eba5b6SRobert Mustacchisufficient. You must make sure that in e1000_hw.h that the struc
66*75eba5b6SRobert Mustacchie1000_dev_spec_82541 actually looks like the following:
67*75eba5b6SRobert Mustacchi
68*75eba5b6SRobert Mustacchistruct e1000_dev_spec_82541 {
69*75eba5b6SRobert Mustacchi	enum e1000_dsp_config dsp_config;
70*75eba5b6SRobert Mustacchi	enum e1000_ffe_config ffe_config;
71*75eba5b6SRobert Mustacchi	u32 tx_fifo_head;
72*75eba5b6SRobert Mustacchi	u32 tx_fifo_start;
73*75eba5b6SRobert Mustacchi	u32 tx_fifo_size;
74*75eba5b6SRobert Mustacchi	u16 spd_default;
75*75eba5b6SRobert Mustacchi	bool phy_init_script;
76*75eba5b6SRobert Mustacchi	bool ttl_workaround;
77*75eba5b6SRobert Mustacchi};
78*75eba5b6SRobert Mustacchi
79*75eba5b6SRobert Mustacchi# EEE
80*75eba5b6SRobert Mustacchi
81*75eba5b6SRobert MustacchiBy default we disable all support for EEE. To cause this to happen you must
82*75eba5b6SRobert Mustacchimake the following change in e1000_82575.c's init_mac_params.
83*75eba5b6SRobert Mustacchi
84*75eba5b6SRobert MustacchiFrom:
85*75eba5b6SRobert Mustacchi 394         /* Enable EEE default settings for EEE supported devices */
86*75eba5b6SRobert Mustacchi 395         if (mac->type >= e1000_i350)
87*75eba5b6SRobert Mustacchi 396                 dev_spec->eee_disable = FALSE;
88*75eba5b6SRobert MustacchiTo:
89*75eba5b6SRobert Mustacchi 394         /* Enable EEE default settings for EEE supported devices */
90*75eba5b6SRobert Mustacchi 395         if (mac->type >= e1000_i350)
91*75eba5b6SRobert Mustacchi 396                 dev_spec->eee_disable = TRUE;
92*75eba5b6SRobert Mustacchi
93*75eba5b6SRobert MustacchiFuture work:
94*75eba5b6SRobert Mustacchi
95*75eba5b6SRobert MustacchiThe next step here is to take the osdep portions and merge them. That would
96*75eba5b6SRobert Mustacchiallow us to build one common misc module e1000api that both igb and e1000g
97*75eba5b6SRobert Mustacchidepend on rather than building separate copies of the common code into each
98*75eba5b6SRobert Mustacchidriver. Another potential option which may prove to have less value is to take
99*75eba5b6SRobert Mustacchiall of the gld and ddi logic and have one driver export that leaving e1000g and
100*75eba5b6SRobert Mustacchiigb as small stubs which depend on that. Note however, that the latter is not
101*75eba5b6SRobert Mustacchihow our upstream is currently structuring their igb and em (FreeBSD's e1000g)
102*75eba5b6SRobert Mustacchidrivers.
103