Import Upstream version 5.4
This commit is contained in:
commit
2998e39677
|
@ -0,0 +1,9 @@
|
|||
David Miller <davem@redhat.com>
|
||||
Jakub Jelinek <jj@ultra.linux.cz>
|
||||
Jeff Garzik <jgarzik@pobox.com>
|
||||
Tim Hockin <thockin@sun.com>
|
||||
Eli Kupermann <eli.kupermann@intel.com>
|
||||
Chris Leech <christopher.leech@intel.com>
|
||||
Scott Feldman <scott.feldman@intel.com>
|
||||
Andi Kleen
|
||||
Ben Hutchings <ben@decadent.org.uk>
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,353 @@
|
|||
The changelog after March 2005 can be obtained from the git repository
|
||||
at <git://git.kernel.org/pub/scm/network/ethtool/ethtool.git>.
|
||||
|
||||
The changelog after version 2 up to March 2005 can be obtained from the
|
||||
BitKeeper repository at <bk://gkernel.bkbits.net/ethtool>.
|
||||
|
||||
|
||||
Tue Aug 17 2004 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* NEWS, configure.ac: Release version 2
|
||||
|
||||
Fri Jul 2 2004 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
Merged
|
||||
* fec_8xx.c, ethtool-util.h, Makefile.am: Add fec_8xx register dump.
|
||||
Contributed by Pantelis Antoniou <panto@intracom.gr>
|
||||
|
||||
* Update ethtool.c to iterate through a list of drivers
|
||||
* Fixed fec_8xx.c warnings on 64-bit
|
||||
|
||||
Fri Jul 2 2004 Jim Lewis <jim@jklewis.com>
|
||||
|
||||
* pcnet32.c, ethtool-util.h, Makefile.am: Add pcnet32 register dump.
|
||||
|
||||
Fri Apr 9 2004 Jason Lunz <lunz@reflexsecurity.com>
|
||||
|
||||
* ethtool.c: Remove incorrect restriction on ethernet interface
|
||||
names.
|
||||
|
||||
Fri Apr 9 2004 OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
|
||||
|
||||
* ethtool.c: This fixes the bogus tail backslash that I did.
|
||||
|
||||
Fri Apr 9 2004 Jim Lewis <jim@jklewis.com>
|
||||
|
||||
* ethtool.c: Return results of self-test back to OS,
|
||||
via exit(2).
|
||||
|
||||
Fri Apr 9 2004 Jeb Cramer <cramerj@intel.com>
|
||||
|
||||
* e1000.c: Update device id list and add printout of phy type in
|
||||
register dump. Set default mac_type to 82543 since register offsets
|
||||
haven't changed.
|
||||
|
||||
Fri Apr 9 2004 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.ac, Makefile.am, ethtool.c, etc.:
|
||||
convert to more recent autoconf.
|
||||
|
||||
Sat Aug 30 2003 OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
|
||||
|
||||
* ethtool.8, ethtool.c: ethtool register dump raw mode
|
||||
|
||||
Sat Jul 19 2003 Scott Feldman <scott.feldman@intel.com>
|
||||
|
||||
* ethtool.8, ethtool.c, ethtool-copy.h:
|
||||
Add support for TSO get/set. Corresponds to NETIF_F_TSO.
|
||||
Extended -k|K option to included tso, and changed meaning from
|
||||
just "checksum/sg" to more general "offload". Now covers Rx/Tx
|
||||
csum, SG, and TSO.
|
||||
|
||||
Thu May 28 2003 Ganesh Venkatesan <ganesh.venkatesan@intel.com>
|
||||
|
||||
* ethtool-copy.h: new definitions for 10GbE
|
||||
|
||||
Thu May 28 2003 Scott Feldman <scott.feldman@intel.com>
|
||||
|
||||
* ethtool.c: Add ethtool -E to write EEPROM byte.
|
||||
* e100.c: Added MDI/MDI-X status to register dump.
|
||||
|
||||
Thu May 28 2003 Reeja John <reeja.john@amd.com>
|
||||
|
||||
* amd8111e.c: new file, support for AMD-8111e NICs
|
||||
* ethtool.c: properly set ecmd.advertising
|
||||
|
||||
Sat Mar 29 2003 OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
|
||||
|
||||
* realtek.c: clean up chip enumeration, support additional chips
|
||||
|
||||
Fri Mar 28 2003 Jeb Cramer <cramerj@intel.com>
|
||||
|
||||
* e1000.c: Update supported devices (82541 & 82547). Add bus type,
|
||||
speed and width to register dump printout.
|
||||
* ethtool.c (show_usage): Add -S to printout of supported commands.
|
||||
|
||||
Tue Jan 22 2003 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* natsemi.c (PRINT_INTR, __print_intr): Decompose PRINT_INTR
|
||||
macro into macro abuse and function call portions. Move the
|
||||
actual function body to new static functoin __print_intr.
|
||||
|
||||
This eliminates the annoying build warning :)
|
||||
|
||||
Thu Jan 16 2003 Jeb Cramer <jeb.j.cramer@intel.com>
|
||||
|
||||
* ethtool.c (do_regs, dump_eeprom): Fix memory leaks on failed
|
||||
operations. Add error handling of dump_regs(). Modify printout of
|
||||
eeprom dump to accomodate larger eeproms.
|
||||
* e1000.c: Update supported devices. Add error conditions for
|
||||
unsupported devices.
|
||||
|
||||
Mon Oct 21 2002 Ben Collins <bcollins@debian.org>
|
||||
|
||||
* ethtool.c: Add new parameters to -e, for raw EEPROM output, and
|
||||
offset and length options.
|
||||
* natsemi.c (natsemi_dump_eeprom): Show correct offset using new
|
||||
offset feature above.
|
||||
* tg3.c: New file, implements tg3_dump_eeprom.
|
||||
* Makefile.am: Add it to the build sources.
|
||||
* ethtool-util.h: Prototype tg3_dump_eeprom.
|
||||
* ethtool.8: Document new -e options.
|
||||
|
||||
Thu Oct 17 2002 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* ethtool.c: make calls to strtol() use base 0
|
||||
|
||||
Wed Sep 18 2002 Scott Feldman <scott.feldman@intel.com>
|
||||
|
||||
* ethtool.c (dump_regs): call e100_dump_regs if e100
|
||||
* e100.c: new file
|
||||
* ethtool-util.h: prototype e100_dump_regs
|
||||
|
||||
Thu Jun 20 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool.8: document new -S stats dump argument
|
||||
* configure.in, NEWS: release version 1.6
|
||||
|
||||
Fri Jun 14 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* realtek.c (realtek_dump_regs): dump legacy 8139 registers
|
||||
* ethtool.c (do_gstats, doit, parse_cmdline):
|
||||
support dumping of NIC-specific statistics
|
||||
|
||||
Fri Jun 14 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* realtek.c (realtek_dump_regs): dump RTL8139C+ registers
|
||||
|
||||
Fri Jun 14 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* realtek.c: new file, dumps RealTek RTL8169 PCI NIC's registers
|
||||
* Makefile.am, ethtool.c, ethtool-util.h: use it
|
||||
|
||||
Tue Jun 11 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* NEWS: list new commands added recently
|
||||
* ethtool.c (do_gcoalesce, do_scoalesce, dump_coalesce): new
|
||||
(parse_cmdline, doit): handle get/set coalesce parameters (-c,-C)
|
||||
(do_[gs]*): convert to use table-driven cmd line parsing
|
||||
* ethtool.8: document -c and -C
|
||||
|
||||
Tue Jun 11 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool.c (do_gring, do_sring, dump_ring,
|
||||
parse_ring_cmdline): new functions
|
||||
(parse_cmdline, doit): handle get/set ring parameters (-g,-G)
|
||||
(do_spause): fix off-by-one bugs
|
||||
* ethtool.8: document -g and -G
|
||||
|
||||
Tue Jun 11 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool.c (do_gpause, do_spause, dump_pause,
|
||||
parse_pause_cmdline): new functions
|
||||
(parse_cmdline, doit): handle get/set pause parameters (-a,-A)
|
||||
* ethtool.8: document -a, -A, -e, and -p
|
||||
|
||||
Wed May 22 2002 Chris Leech <christopher.leech@intel.com>
|
||||
Scott Feldman <scott.feldman@intel.com>
|
||||
|
||||
* ethtool-copy.h: add support for ETHTOOL_PHYS_ID function.
|
||||
* ethtool.c: add support for ETHTOOL_PHYS_ID function, add
|
||||
support for e1000 reg dump.
|
||||
* Makefile.am: add e1000.c
|
||||
* e1000.c: reg dump support for Intel(R) PRO/1000 adapters.
|
||||
* ethtool-util.h: add e1000 reg dump support.
|
||||
|
||||
Sat May 11 2002 Eli Kupermann <eli.kupermann@intel.com>
|
||||
|
||||
* ethtool.c (do_test): add support for online/offline test modes
|
||||
Elsewhere: document "-t" arg usage, and handle usage
|
||||
|
||||
Sat May 11 2002 Jes Sorensen <jes@wildopensource.com>
|
||||
|
||||
* ethtool.c (dump_ecmd): If unknown value is
|
||||
encountered in speed, duplex, or port ETHTOOL_GSET
|
||||
return data, print the numeric value returned.
|
||||
|
||||
Wed May 1 2002 Eli Kupermann <eli.kupermann@intel.com>
|
||||
|
||||
* ethtool.8: document new -t test option
|
||||
|
||||
Wed May 1 2002 Christoph Hellwig <hch@lst.de>
|
||||
|
||||
* Makefile.am (dist-hook): Use $(top-srcdir) for refering to sources.
|
||||
|
||||
Mon Apr 29 2002 Christoph Hellwig <hch@lst.de>
|
||||
|
||||
* Makefile.am (SUBDIRS): Remove.
|
||||
(RPMSRCS): Likewise.
|
||||
(TMPDIR): Likewise.
|
||||
(rpm): Likewise.
|
||||
(EXTRA_DIST): Add ethtool.spec.in.
|
||||
(dist-hook): New rule. Create rpm specfile.
|
||||
* configure.in (AC_OUTPUT): Add ethtool.spec.
|
||||
* ethtool.spec.in: New file. Rpm specfile template.
|
||||
* redhat/ethtool.spec.in: Removed.
|
||||
* redhat/Makefile.am: Removed.
|
||||
|
||||
Wed Mar 20 2002 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool-copy.h: Merge coalescing param, ring
|
||||
param, and pause param ioctl structs from kernel 2.5.7.
|
||||
Merge ethtool_test changes fromkernel 2.5.7.
|
||||
* ethtool: Update for ethtool_test cleanups.
|
||||
|
||||
Wed Mar 20 2002 Eli Kupermann <eli.kupermann@intel.com>
|
||||
|
||||
* ethtool.c: (do_test): new function
|
||||
Elsewhere: add support for 'perform test' function,
|
||||
via a new "-t" arg, by calling do_test.
|
||||
|
||||
Sun Mar 3 2002 Brad Hards <bhards@bigpond.net.au>
|
||||
|
||||
* ethtool.c (parse_cmdline): Support "usb"
|
||||
as well as "eth" network interfaces. USB networking
|
||||
uses a different prefix.
|
||||
|
||||
Fri Feb 8 2002 "Noam, Amir" <amir.noam@intel.com>,
|
||||
"Kupermann, Eli" <eli.kupermann@intel.com>
|
||||
|
||||
* ethtool.c (dump_advertised): new function.
|
||||
(dump_ecmd): Call it.
|
||||
Elsewhere: reformat code.
|
||||
|
||||
Wed Nov 28 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* configure.in, Makefile.am, redhat/Makefile.am:
|
||||
make sure redhat spec is included in dist tarball.
|
||||
|
||||
Tue Nov 27 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* natsemi.c: strings changes
|
||||
* ethtool.c: print messagelevel as hex (netif_msg_* shows better :)
|
||||
|
||||
Sun Nov 18 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* NEWS: update with recent changes
|
||||
* ethtool.8: phy address can be used if implemented in the
|
||||
driver, so remove "Not used yet" remark.
|
||||
|
||||
Sun Nov 18 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* Makefile.am, de2104x.c, ethtool-util.h, ethtool.c:
|
||||
Support register dumps for de2104x driver.
|
||||
|
||||
Tue Nov 13 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* natsemi.c, ethtool.c: use u8 data for ethtool_regs
|
||||
* ethtool-copy.h: latest from kernel
|
||||
* natsemi.c, ethtool.c: support ETHTOOL_GEEPROM via -e param
|
||||
|
||||
Mon Nov 12 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* natsemi.c: check version, conditionally print RFCR-indexed data
|
||||
|
||||
Wed Nov 07 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* ethtool.c: print less errors for unsupported ioctl()s
|
||||
* ethtool.c: warn if all ioctl()s are unsupported or failed
|
||||
* ethtool.c: change autoneg-restart mechanism to -r (as per jgarzik)
|
||||
* ethtool.c: check for "eth" in devicename (per jg)
|
||||
* ethtool.c: remove 'extraneous' braces
|
||||
|
||||
Wed Nov 07 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool.c, ethtool.8: support bnc port/media
|
||||
|
||||
Tue Nov 06 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* ethtool.c: clean up output for unhandled register dumps
|
||||
* natsemi.c: finish pretty-printing register dumps
|
||||
* ethtool.8: document -d option
|
||||
* various: add copyright info, where applicable
|
||||
* ethtool.c: be nicer about unsupported ioctl()s where possible
|
||||
and be more verbose where nice is not an option.
|
||||
|
||||
Mon Nov 05 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* natsemi.c: first cut at 'pretty-printing' register dumps
|
||||
|
||||
Fri Nov 02 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* ethtool.c: add support for ETHTOOL_GREGS via -d (dump) flag
|
||||
* ethtool.c: add support for device-specific dumps for known devices
|
||||
* ethtool.c: make mode-specific handling allocate ifr_data
|
||||
* Makefile.am: import ChangeLog to rpm specfile
|
||||
* natsemi.c: added
|
||||
* ethtool-util.h: added
|
||||
|
||||
Thu Nov 01 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* ethtool.c: add support for ETHTOOL_GLINK in output
|
||||
* ethtool.c: add support for ETHTOOL_NWAY_RST via 'autoneg restart'
|
||||
* ethtool.c: add support for ETHTOOL_[GS]MSGLVL via 'msglvl' param
|
||||
* ethtool.8: add documentation for above
|
||||
* ethtool-copy.h: updated to sync with kernel
|
||||
|
||||
Fri Oct 26 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool.8: Update contributors list, home page URL.
|
||||
* ethtool.8: Much cleanup, no content change.
|
||||
Contributed by Andre Majorel.
|
||||
* ethtool.c: Clean up '-h' usage message.
|
||||
Contributed by Andre Majorel.
|
||||
|
||||
Fri Oct 26 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* Configure.in: bump version to 1.4cvs
|
||||
* Makefile.am: include ethtool-copy.h in list of sources
|
||||
* ethtool-copy.h:
|
||||
Import ethtool.h from kernel 2.4.13.
|
||||
* ethtool.c:
|
||||
Define SIOCETHTOOL if it is missing,
|
||||
trim trailing whitespace.
|
||||
* NEWS: update for these changes
|
||||
|
||||
Wed Sep 19 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* ethtool.c, ethtool-copy.h:
|
||||
Import copy of kernel 2.4.10-pre12's ethtool.h.
|
||||
|
||||
Wed Sep 19 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* Makefile.am, redhat/ethtool.spec.in:
|
||||
Basic "make rpm" support.
|
||||
|
||||
Wed Sep 19 2001 Tim Hockin <thockin@sun.com>
|
||||
|
||||
* AUTHORS, NEWS, ethtool.8, ethtool.c:
|
||||
Wake-on-LAN support.
|
||||
|
||||
Thu May 17 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* configure.in, NEWS, README: Version 1.2 release
|
||||
|
||||
* ethtool.c: Support ETHTOOL_GDRVINFO.
|
||||
* ethtool.8: Document it.
|
||||
|
||||
Fri Mar 20 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||||
|
||||
* Makefile.am, configure.in, autogen.sh, NEWS,
|
||||
ChangeLog, AUTHORS, README:
|
||||
Add autoconf/automake support.
|
||||
|
|
@ -0,0 +1,370 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command `./configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX `make' updates targets which have the same time stamps as
|
||||
their prerequisites, which makes it generally unusable when shipped
|
||||
generated files such as `configure' are involved. Use GNU `make'
|
||||
instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf limitation. Until the limitation is lifted, you can use
|
||||
this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
|
@ -0,0 +1,3 @@
|
|||
ethtool is available under the terms of the GNU Public License version 2.
|
||||
|
||||
See COPYING for details.
|
|
@ -0,0 +1,34 @@
|
|||
AM_CFLAGS = -Wall
|
||||
LDADD = -lm
|
||||
|
||||
man_MANS = ethtool.8
|
||||
EXTRA_DIST = LICENSE ethtool.8 ethtool.spec.in aclocal.m4 ChangeLog autogen.sh
|
||||
|
||||
sbin_PROGRAMS = ethtool
|
||||
ethtool_SOURCES = ethtool.c ethtool-copy.h internal.h net_tstamp-copy.h \
|
||||
rxclass.c
|
||||
if ETHTOOL_ENABLE_PRETTY_DUMP
|
||||
ethtool_SOURCES += \
|
||||
amd8111e.c de2104x.c dsa.c e100.c e1000.c et131x.c igb.c \
|
||||
fec.c fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c \
|
||||
pcnet32.c realtek.c tg3.c marvell.c vioc.c \
|
||||
smsc911x.c at76c50x-usb.c sfc.c stmmac.c \
|
||||
sff-common.c sff-common.h sfpid.c sfpdiag.c \
|
||||
ixgbevf.c tse.c vmxnet3.c qsfp.c qsfp.h fjes.c lan78xx.c
|
||||
endif
|
||||
|
||||
if ENABLE_BASH_COMPLETION
|
||||
bashcompletiondir = $(BASH_COMPLETION_DIR)
|
||||
dist_bashcompletion_DATA = shell-completion/bash/ethtool
|
||||
endif
|
||||
|
||||
TESTS = test-cmdline test-features
|
||||
check_PROGRAMS = test-cmdline test-features
|
||||
test_cmdline_SOURCES = test-cmdline.c test-common.c $(ethtool_SOURCES)
|
||||
test_cmdline_CFLAGS = -DTEST_ETHTOOL
|
||||
test_features_SOURCES = test-features.c test-common.c $(ethtool_SOURCES)
|
||||
test_features_CFLAGS = -DTEST_ETHTOOL
|
||||
|
||||
dist-hook:
|
||||
cp $(top_srcdir)/ethtool.spec $(distdir)
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,539 @@
|
|||
Version 5.4 - January 10, 2020
|
||||
|
||||
* Feature: ethtool: implement support for Energy Detect Power Down
|
||||
* Fix: fix arithmetic on pointer to void is a GNU extension warning
|
||||
* Fix: fix unused parameter warnings in do_version() and show_usage()
|
||||
* Fix: fix unused parameter warning in find_option()
|
||||
* Fix: fix unused parameter warning in dump_eeprom()
|
||||
* Fix: fix unused parameter warning in altera_tse_dump_regs()
|
||||
* Fix: fix unused parameter warning in sfc_dump_regs()
|
||||
* Fix: fix unused parameter warning in print_simple_table()
|
||||
* Fix: fix unused parameter warning in natsemi_dump_regs()
|
||||
* Fix: fix unused parameter warning in netsemi_dump_eeprom()
|
||||
* Fix: fix unused parameter warning in ixgbe_dump_regs()
|
||||
* Fix: fix unused parameter warning in realtek_dump_regs()
|
||||
* Fix: fix unused parameter warning in lan78xx_dump_regs()
|
||||
* Fix: fix unused parameter warning in {skge, sky2}_dump_regs()
|
||||
* Fix: fix unused parameter warning in dsa_dump_regs()
|
||||
* Fix: fix unused parameter warning in vmxnet3_dump_regs()
|
||||
* Fix: fix unused parameter warning in st_{mac100, gmac}_dump_regs()
|
||||
* Fix: fix unused parameter warning in ixgbevf_dump_regs()
|
||||
* Fix: fix unused parameter warning in fec_8xx_dump_regs()
|
||||
* Fix: fix unused parameter warning in tg3_dump_{eeprom, regs}()
|
||||
* Fix: fix unused parameter warning in vioc_dump_regs()
|
||||
* Fix: fix unused parameter warning in e100_dump_regs()
|
||||
* Fix: fix unused parameter warning in de2104[01]_dump_regs()
|
||||
* Fix: fix unused parameter warning in igb_dump_regs()
|
||||
* Fix: fix unused parameter warning in e1000_dump_regs()
|
||||
* Fix: fix unused parameter warning in smsc911x_dump_regs()
|
||||
* Fix: fix unused parameter warning in at76c50x_usb_dump_regs()
|
||||
* Fix: fix unused parameter warning in fec_dump_regs()
|
||||
* Fix: fix unused parameter warning in amd8111e_dump_regs()
|
||||
* Fix: fix unused parameter warning in et131x_dump_regs()
|
||||
* Fix: fix unused parameter warning in ibm_emac_dump_regs()
|
||||
* Fix: fix unused parameter warning in ixgb_dump_regs()
|
||||
* Fix: fix unused parameter warning in fjes_dump_regs()
|
||||
* Fix: fix unused parameter warning in e1000_get_mac_type()
|
||||
* Fix: ethtool: correctly interpret bitrate of 255
|
||||
* Fix: ethtool: mark 10G Base-ER as SFF-8472 revision 10.4 onwards
|
||||
* Fix: ethtool: add 0x16 and 0x1c extended compliance codes
|
||||
|
||||
Version 5.3 - September 23, 2019
|
||||
* Feature: igb: dump RR2DCDELAY register
|
||||
* Feature: dump nested registers
|
||||
|
||||
Version 5.2 - July 25, 2019
|
||||
* Feature: Add 100BaseT1 and 1000BaseT1 link modes
|
||||
* Feature: Use standard file location macros in ethtool.spec
|
||||
|
||||
Version 5.1 - May 17, 2019
|
||||
* Feature: Add support for 200Gbps (50Gbps per lane) link mode
|
||||
* Feature: simplify handling of PHY tunable downshift
|
||||
* Feature: add support for PHY tunable Fast Link Down
|
||||
* Feature: add PHY Fast Link Down tunable to man page
|
||||
* Feature: Add a 'start N' option when specifying the Rx flow hash indirection table.
|
||||
* Feature: Add bash-completion script
|
||||
* Feature: add 10000baseR_FEC link mode name
|
||||
* Fix: qsfp: fix special value comparison
|
||||
* Feature: move option parsing related code into function
|
||||
* Feature: move cmdline_coalesce out of do_scoalesce
|
||||
* Feature: introduce new ioctl for per-queue settings
|
||||
* Feature: support per-queue sub command --show-coalesce
|
||||
* Feature: support per-queue sub command --coalesce
|
||||
* Fix: fix up dump_coalesce output to match actual option names
|
||||
* Feature: fec: add pretty dump
|
||||
|
||||
Version 5.0 - March 13, 2019
|
||||
* Feature: don't report UFO on kernels v4.14 and above
|
||||
* Fix: zero initialize coalesce struct
|
||||
* Feature: dsa: add pretty dump
|
||||
* Feature: dsa: mv88e6xxx: add pretty dump
|
||||
* Feature: dsa: mv88e6xxx: add pretty dump for 88E6185
|
||||
* Feature: dsa: mv88e6xxx: add pretty dump for 88E6161
|
||||
* Feature: dsa: mv88e6xxx: add pretty dump for 88E6352
|
||||
* Feature: dsa: mv88e6xxx: add pretty dump for 88E6390
|
||||
* Feature: dsa: mv88e6xxx: add pretty dump for others
|
||||
|
||||
Version 4.19 - November 2, 2018
|
||||
* Feature: support combinations of FEC modes
|
||||
* Feature: better syntax for combinations of FEC modes
|
||||
* Fix: Fix uninitialized variable use at qsfp dump
|
||||
|
||||
Version 4.18 - August 24, 2018
|
||||
* Feature: Add support for WAKE_FILTER (WoL using filters)
|
||||
* Feature: Add support for action value -2 (wake-up filter)
|
||||
* Fix: document WoL filters option also in help message
|
||||
* Feature: ixgbe dump strings for security registers
|
||||
|
||||
Version 4.17 - June 15, 2018
|
||||
|
||||
* Fix: In ethtool.8, remove superfluous and incorrect \c.
|
||||
* Fix: fix uninitialized return value
|
||||
* Fix: fix RING_VF assignment
|
||||
* Fix: remove unused global variable
|
||||
* Fix: several fixes in do_gregs()
|
||||
* Fix: correctly free hkey when get_stringset() fails
|
||||
* Fix: remove unreachable code
|
||||
* Fix: fix stack clash in do_get_phy_tunable and do_set_phy_tunable
|
||||
* Feature: Add register dump support for MICROCHIP LAN78xx
|
||||
|
||||
Version 4.16 - April 13, 2018
|
||||
|
||||
* Feature: add support for extra RSS contexts and RSS steering filters
|
||||
* Feature: Document RSS context control and RSS filters
|
||||
* Fix: don't fall back to grxfhindir when context was specified
|
||||
* Fix: correct display of VF when showing vf/queue filters
|
||||
* Fix: show VF and queue in the help for -N
|
||||
* Fix: correct VF index values for the ring_cookie parameter
|
||||
* Feature: Add SFF 8636 date code parsing support
|
||||
|
||||
Version 4.15 - February 1, 2018
|
||||
|
||||
* Feature: Support for FEC encoding control
|
||||
* Fix: Fix coding style warnings and errors reported by checkpatch
|
||||
* Feature: Add extended compliance codes parsing to sfp modules
|
||||
* Fix: Revert "ethtool: Add DMA Coalescing support"
|
||||
* Feature: Add ETHTOOL_RESET support via --reset command
|
||||
* Fix: fix MFLCN register dump for 82599 and newer
|
||||
|
||||
Version 4.13 - October 27, 2017
|
||||
|
||||
* Fix: Do not return error code if no changes were attempted.
|
||||
* Fix: Fix formatting of advertise bitmask
|
||||
* Feature: Document 56000 advertise link modes
|
||||
* Fix: fix the rx vs tx mixup in set channel message
|
||||
* Feature: add support for HWTSTAMP_FILTER_NTP_ALL
|
||||
* Feature: Add DMA Coalescing support
|
||||
* Feature: Remove UDP Fragmentation Offload error prints
|
||||
* Feature: stmmac: Add macros for number of registers
|
||||
* Feature: stmmac: Add DMA HW Feature Register
|
||||
|
||||
Version 4.11 - June 2, 2017
|
||||
|
||||
* Feature: Support for configurable RSS hash function
|
||||
* Feature: support queue and VF fields for rxclass filters
|
||||
* Feature: Add support for 2500baseT/5000baseT link modes
|
||||
* Fix: Fix SFF 8079 cable technology bit parsing
|
||||
* Fix: sync help output for -x/-X with man page
|
||||
|
||||
Version 4.10 - March 24, 2017
|
||||
|
||||
* Fix: Fix the "advertise" parameter logic.
|
||||
* Feature: Implement ETHTOOL_PHY_GTUNABLE/ETHTOOL_PHY_STUNABLE and PHY downshift
|
||||
* Feature: add register dump support for fjes driver (-d option)
|
||||
|
||||
Version 4.8 - October 3, 2016
|
||||
|
||||
* Feature: QSFP Plus/QSFP28 Diagnostics Information Support
|
||||
* Feature: Enhancing link mode bits to support 25G/50G/100G
|
||||
* Feature: add support for 1000BaseX and missing 10G link mode
|
||||
* Fixes: address Coverity issues 1363118 - 1363125
|
||||
|
||||
Version 4.6 - June 26, 2016
|
||||
|
||||
* Feature: Support register dump on Intel X550 NICs (-d option)
|
||||
* Fix: Correct some reported register offsets on Intel 10GbE NICs
|
||||
(-d option)
|
||||
* Feature: Add IPv6 support to NFC (-n, -N, -u and -U options)
|
||||
* Feature: Add support for ETHTOOL_xLINKSETTINGS ioctls (no option
|
||||
and -s option)
|
||||
* Feature: Use netlink socket when AF_INET not available
|
||||
|
||||
Version 4.5 - March 14, 2016
|
||||
|
||||
* Tests: Fix missing function declarations when building tests
|
||||
* Tests: Fix return type of test_free() prorotype
|
||||
* Feature: Add PHY statistics support (--phy-statistics option)
|
||||
* Doc: Properly indent sub-options in man page
|
||||
* Feature: Support setting default Rx flow indirection table
|
||||
(-X option)
|
||||
* Fix: Use 'sane' kernel type definitions on 64-bit architectures
|
||||
* Fix: Don't ignore fread() return value (-d option)
|
||||
* Fix: Heap corruption when dumping registers from a file (-d option)
|
||||
* Fix: Stricter input validation for EEPROM setting (-E option)
|
||||
* Fix: Fix strict-aliasing compiler warnings in marvell.c
|
||||
* Tests: Fix use of uninitialised variable in test_realloc()
|
||||
* Tests: Fix compiler warning in test-features.c
|
||||
|
||||
Version 4.2 - October 9, 2015
|
||||
|
||||
* Feature: Support soldered-on modules in module EEPROM dump (-m option)
|
||||
* Feature: Add register dump support for VMware vmxnet3 (-d option)
|
||||
* Feature: Update register dump support for IBM EMAC (-d option)
|
||||
(requires Linux 4.3 or a future stable update to 4.1 or 4.2)
|
||||
* Doc: Fix typo in man page
|
||||
|
||||
Version 4.0 - May 31, 2015
|
||||
|
||||
* Fix: Formatting of RX flow hash indirection table when size not
|
||||
divisible by 8 (-x option)
|
||||
* Fix: Add missing Advertised speeds (no option and -s option)
|
||||
* Feature: Add support to get expansion ROM version (-i option)
|
||||
* Feature: Include SFP serial number and date in EEPROM dump
|
||||
(-m option)
|
||||
|
||||
Version 3.18 - December 14, 2014
|
||||
|
||||
* Fix: Lookup of SFP Tx bias in SFF-8472 module diagnostics (-m option)
|
||||
* Fix: Build with musl by using more common typedefs
|
||||
|
||||
Version 3.16 - September 22, 2014
|
||||
|
||||
* Feature: Support for configurable RSS hash key (-x/-X options)
|
||||
|
||||
Version 3.15 - July 20, 2014
|
||||
|
||||
* Feature: Add register dump support for Altera Triple Speed Ethernet
|
||||
(-d option)
|
||||
|
||||
Version 3.14 - April 21, 2014
|
||||
|
||||
* Fix: Report Backplane as supported port (no option)
|
||||
* Feature: Allow building a smaller executable without pretty-
|
||||
printing of register/EEPROM dumps (./configure --disable-pretty-dump)
|
||||
* Fix: Typo in channel parameter format in an error message (-L option)
|
||||
|
||||
Version 3.13 - January 27, 2014
|
||||
|
||||
* Doc: Update GPL text to include current address of the FSF
|
||||
* Fix: Spelling fixes
|
||||
* Doc: Fix advertising flag values in manual page for 20G link modes,
|
||||
and add missing 1G, 10G and 40G link modes
|
||||
|
||||
Version 3.12.1 - November 8, 2013
|
||||
|
||||
* Fix: Memory corruption when applying external calibration to
|
||||
SFF-8472 module diagnostics (-m option)
|
||||
* Feature: Add Intel 82599 and x540 DCB registers to dump
|
||||
(-d option)
|
||||
|
||||
Version 3.12 - November 7, 2013
|
||||
|
||||
* Fix: Remove alternate method to check for VLAN tag offload on Linux
|
||||
< 2.6.37 (-k/-K options)
|
||||
* Fix: Hide state of VLAN tag offload and LRO if the kernel is too old
|
||||
for us to reliably detect them (-k option)
|
||||
* Feature: Add register dump support for Solarflare SFC9100 family
|
||||
(-d option)
|
||||
|
||||
Version 3.11 - September 12, 2013
|
||||
|
||||
* Feature: Update Realtek chip list for register dump to match
|
||||
r8169 driver in Linux 3.11 (-d option)
|
||||
* Feature: Add ixgbevf support for register dump (-d option)
|
||||
* Feature: Filter ixgbe register dump according to the specific chip
|
||||
(-d option)
|
||||
|
||||
Version 3.10 - July 1, 2013
|
||||
|
||||
* Feature: Beautify private flags print (--show-priv-flags option)
|
||||
|
||||
Version 3.9 - April 30, 2013
|
||||
|
||||
* Feature: Display support for 10000BASE-KR link mode (no options)
|
||||
* Feature: Add support for new versions of ixgbe register dump
|
||||
(-d dump)
|
||||
|
||||
Version 3.8 - February 28, 2013
|
||||
|
||||
* Feature: Allow setting destination MAC address in L3/L4 flow spec
|
||||
rules (-N/-U option)
|
||||
* Fix: Show full 64 bits of user-data (-n/-u option)
|
||||
* Fix: Add version check for et131x regs (-d option)
|
||||
* Doc: Improve description of -f, -t, -s, -N/-U, -W options in man page
|
||||
* Fix: Restore 20000baseKR2 cap display (no options)
|
||||
|
||||
Version 3.7 - December 13, 2012
|
||||
|
||||
* Fix: Gracefully handle failure of register pretty-printer (-d option)
|
||||
* Feature: Add support for et131x registers (-d option)
|
||||
* Feature: Basic optical diagnostics for SFF-8472 modules (-m option)
|
||||
|
||||
Version 3.6 - October 5, 2012
|
||||
|
||||
* Feature: Allow setting MDI-X state (-s option)
|
||||
* Fix: Preserve pause advertising bits when setting speed and
|
||||
duplex with autoneg on (-s option)
|
||||
* Fix: Don't call ioctl to set EEE parameters if they are the same
|
||||
as the current parameters (--set-eee option)
|
||||
|
||||
Version 3.5 - August 2, 2012
|
||||
|
||||
* Feature: Display support for 1000BASE-KX and 10GBASE-KX4 link modes
|
||||
* Feature: Energy-Efficient Ethernet (EEE) configuration
|
||||
(--show-eee and --set-eee options)
|
||||
* Fix: Don't trust drivers to null-terminate strings
|
||||
* Feature: Display support for 40G link modes
|
||||
* Package: Update RPM summary, description and URL
|
||||
* Package: Exclude redundant documentation from RPM
|
||||
|
||||
Version 3.4.2 - July 16, 2012
|
||||
|
||||
* Fix: Fix regression in RX NFC rule insertion for drivers that do
|
||||
not select rule locations (-N/-U option)
|
||||
* Fix: Remove bogus error message when changing offload settings
|
||||
on Linux < 2.6.39 (-K option)
|
||||
* Fix: Use alternate method to check for VLAN tag offload on Linux
|
||||
< 2.6.37 (-k option)
|
||||
|
||||
Version 3.4.1 - June 13, 2012
|
||||
|
||||
* Fix: Work around failure of ETHTOOL_GSSET_INFO for unprivileged
|
||||
users (-k option)
|
||||
* Fix: Report any unexpected error code from ETHTOOL_GSSET_INFO
|
||||
(-k and -K options)
|
||||
* Doc: Fix the date of the man page to match the last update
|
||||
|
||||
Version 3.4 - June 8, 2012
|
||||
|
||||
* Cleanup: Merge RX NFC options
|
||||
* Doc: Improve description of RX NFC options
|
||||
* Doc: Add ntuple to the -K option in the man page
|
||||
* Feature: Show time stamping capabilities (-T option)
|
||||
* Feature: Dump plug-in module EEPROM (-m option)
|
||||
* Feature: Show and change all generic net device features
|
||||
(-k and -K options)
|
||||
|
||||
Version 3.2 - January 12, 2012
|
||||
|
||||
* Feature: Add support for querying and setting private flags
|
||||
(--show-priv-flags, --set-priv-flags options)
|
||||
* Feature: Omit zero values in Solarflare register tables (-d option)
|
||||
* Feature: Allow driver to select RX NFC rule location (-U option)
|
||||
* Fix: Correct register dump offsets for Intel 82575 chipsets
|
||||
(-d option)
|
||||
|
||||
Version 3.1 - November 16, 2011
|
||||
|
||||
* Fix: Show all non-zero registers for tg3 (-d option)
|
||||
* Feature: Add support for external loopback test (-t option)
|
||||
* Fix: Show correct flow control registers for Intel 82599 (-d option)
|
||||
* Feature: Add support for reporting and configuring numbers of
|
||||
channels/queues (-l and -L options)
|
||||
* Feature: Report pause frame autonegotiation result (-a option)
|
||||
* Doc: Change device name metavariable from 'ethX' to 'devname'
|
||||
* Doc: Fix various layout problems
|
||||
* Cleanup: Reorganise and add test cases for argument parsing
|
||||
* Fix: Strictly check for extraneous or missing arguments; in
|
||||
particular, fail if the device name is missing
|
||||
|
||||
Version 3.0 - August 4, 2011
|
||||
|
||||
* Feature: Report supported pause frame modes
|
||||
* Feature: Support firmware dump (-w and -W options)
|
||||
* Feature: Report advertised and supported 20G link modes
|
||||
* Feature: Add an 'l4data' option for ip4 filters (-U option)
|
||||
* Fix: Correct swapped h_source and h_dest fields for ether filters
|
||||
(-U option)
|
||||
* Fix: Set ip_ver field correctly for ip4 filters (-U option)
|
||||
* Fix: Correct parameter validation for -e and -E options; in
|
||||
particular, treat the 'magic' value as unsigned
|
||||
|
||||
Version 2.6.39 - June 1, 2011
|
||||
|
||||
* Feature: Report some driver features (-i option)
|
||||
* Doc: Remove misleading 'Auto' advertising mask from manual page
|
||||
* Doc: Improve table formatting on manual page, using tbl
|
||||
* Doc: Remove initial blank page in printed manual page
|
||||
* Doc: Fix line-wrapping of options
|
||||
* Feature: Add support for ESP as a separate protocol from AH
|
||||
(-n, -N, -u and -U options)
|
||||
* Cleanup: Remove support for showing RX n-tuple settings
|
||||
(-u option), which was never implemented correctly in the kernel
|
||||
* Feature: Add support for RX network flow classifier (NFC)
|
||||
(-u and -U options)
|
||||
* Feature: Add support for e1000 M88 PHY registers (-d option)
|
||||
* Cleanup: Change bug-address to netdev
|
||||
|
||||
Version 2.6.38 - March 15, 2011
|
||||
|
||||
* Doc: Fix spelling and spacing in online help
|
||||
* Doc: Update date, version and web site reference in manual page
|
||||
* Doc: Fix spelling, capitalisation, consistency and style in
|
||||
manual page
|
||||
* Doc: Generalise some references to network devices rather than
|
||||
Ethernet devices
|
||||
* Fix: Don't silently ignore speed/duplex when autoneg is on
|
||||
* Fix: Report an error (rather than full usage information) if
|
||||
given an unrecognised option
|
||||
* Feature: Add --version option
|
||||
|
||||
Version 2.6.37 - January 5, 2011
|
||||
|
||||
* Fix: Build fix for distributions with kernel headers from
|
||||
Linux 2.6.9 or earlier
|
||||
|
||||
Version 2.6.36 - November 16, 2010
|
||||
|
||||
* Fix: RX n-tuple masks and documentation
|
||||
* Feature: Ethernet-level RX n-tuple filtering and 'clear' action
|
||||
* Feature: stmmac register dump support
|
||||
* Feature: get permanent address (-P) option
|
||||
* Feature: VLAN acceleration control
|
||||
|
||||
Version 2.6.35 - August 10, 2010
|
||||
|
||||
* Feature: sfc register dump support
|
||||
* Feature: improve cmd line parsing of ints, IPv4 addresses
|
||||
* Feature: support ethtool named flags, messaging types
|
||||
* Feature: minor man page fixes
|
||||
* Feature: control RX flow hash indirection
|
||||
|
||||
Version 2.6.34 - May 26, 2010
|
||||
|
||||
* Feature: Support n-tuple filter programming
|
||||
* Feature: Support rx hashing, v2 (targetted for 2.6.35)
|
||||
* Feature: Add names of newer Marvell chips
|
||||
|
||||
Version 2.6.33 - February 24, 2010
|
||||
|
||||
This version introduces a new release numbering scheme, based
|
||||
on the latest upstream kernel interface supported.
|
||||
|
||||
* Fix: several man page corrections
|
||||
* Feature: rx flow hash configuration
|
||||
* Feature: report 10000baseT support, where available
|
||||
* Feature: report MDI-X status, pause auto-neg, link partner adverts
|
||||
* Feature: support additional port types
|
||||
* Feature: support arbitrary speeds, faster than 65535 Mb
|
||||
* Feature: large and generic receive offload (LRO, GRO) support
|
||||
* Feature: option to flash firmware image from specified file
|
||||
* Feature: support for block writing of EEPROMs
|
||||
* Feature: marvell register dump update
|
||||
* Feature: at76c50x-usb, e1000e, igb, ixgbe, r8169 register dump support
|
||||
* Cleanup: remove support for RX hashing by port (was removed in
|
||||
kernel by 59089d8d162ddcb5c434672e915331964d38a754)
|
||||
* Doc: Explicitly ship GPLv2 license, rather than relying
|
||||
on autotools to supply it for us (autotools started auto-installing
|
||||
GPLv3 recently)
|
||||
|
||||
Version 6 - July 26, 2007
|
||||
|
||||
* Fix/security: Fix handling of statistics where the label
|
||||
is exactly 32 bytes (ETH_GSTRING_LEN).
|
||||
* Feature: Add ability to change the advertised speed/duplex
|
||||
to a different range of values, rather than all-or-one.
|
||||
* Feature: ixgb register dump support
|
||||
* Feature: sky2 register dump support
|
||||
* Feature: Fabric7 VIOC register dump support
|
||||
* Feature: Decode raw register dump stored in a file
|
||||
* Feature: Add ability to force hex register dump, if desired
|
||||
* Feature: update e1000 register dump
|
||||
* Feature: Additional 10Gbps support
|
||||
* Feature: Add 2.5G support
|
||||
* Feature: Update r8169 register dump
|
||||
* Feature: SMSC LAN911x/LAN921x register dump support
|
||||
* Cleanup: Update internal ethtool.h copy to match upstream
|
||||
kernel 2.6.23-rc1 version of ethtool.h.
|
||||
|
||||
Version 5 - September 1, 2006
|
||||
|
||||
* Security: Avoid potential buffer overflow
|
||||
* Feature: GSO support
|
||||
* Feature: skge register dump
|
||||
|
||||
Version 4 - July 18, 2006
|
||||
|
||||
* Feature: UFO support
|
||||
* Feature: support long options
|
||||
* Features: e1000, pcnet32, tg3 updates
|
||||
* Feature: added PPC4xx EMAC support
|
||||
* Feature: Use hexdump instead of single values for register dump
|
||||
|
||||
Version 3 - January 27, 2005
|
||||
|
||||
* Feature: r8159 register dump support
|
||||
* Feature / bug fix: Support advertising gigabit ethernet
|
||||
* Bug fix: make sure to advertise 10baseT-HD
|
||||
* Other minor bug fixes.
|
||||
|
||||
Version 2 - August 17, 2004
|
||||
|
||||
* Feature: ethtool register dump raw mode
|
||||
* Feature: return results of self-test back to OS via exit(2)
|
||||
* Feature: add verbose register dump for pcnet32, fec_8xx
|
||||
* Maintenance: update to more recent autoconf
|
||||
* Maintenance: minor updates to e1000-specific module
|
||||
* Bug fix: Remove silly restriction on ethernet interface naming
|
||||
|
||||
Version 1.8 - July 19, 2003
|
||||
|
||||
* Feature: Support amd8111e register dumps
|
||||
* Feature: Support TSO enable/disable
|
||||
* Feature: Support 10 gigabit ethernet
|
||||
* Feature: Support writing EEPROM data
|
||||
* Feature: Output e100 MDI/MDI-x status in register dump
|
||||
* Feature: Clean up RealTek (RTL) chip output, support new chips.
|
||||
* Feature: More supported e1000 devices.
|
||||
* Bug fix: Properly set ecmd.advertising
|
||||
* Bug fix: Fix leaks, handle some error conditions better.
|
||||
|
||||
Version 1.7 - October 21, 2002
|
||||
|
||||
* Feature: Support e100 register dumps
|
||||
* Feature: Support tg3 eeprom dumps
|
||||
* Feature: Support partial eeprom dumps (with non-zero offsets)
|
||||
* Feature: Support decimal/octal/hex numbers transparently,
|
||||
at the user's discretion.
|
||||
|
||||
Version 1.6 - June 20, 2002
|
||||
|
||||
* Feature: Support e1000 register dumps
|
||||
* Feature: Support RealTek RTL-8139C+ and RTL-8169 register dumps
|
||||
* Feature: Support coalescing config (ETHTOOL_[GS]COALESCE)
|
||||
* Feature: Support ring param config (ETHTOOL_[GS]RINGPARAM)
|
||||
* Feature: Support pause param config (ETHTOOL_[GS]PAUSEPARAM)
|
||||
* Feature: Support physical NIC identification (ETHTOOL_PHYS_ID)
|
||||
* Feature: Support NIC self-testing (ETHTOOL_TEST)
|
||||
* Feature: Support NIC checksum/scatter-gather configuration
|
||||
(ETHTOOL_[GS]RXCSUM, ETHTOOL_[GS]TXCSUM, ETHTOOL_[GS]SG)
|
||||
|
||||
Version 1.5 - Mar 4, 2002
|
||||
|
||||
* Fix: support usb network interfaces
|
||||
* Fix: include redhat spec file in autoconf build system
|
||||
* Fix: minor fixes to natsemi register dump
|
||||
* Feature: report advertised as well as supported media,
|
||||
when printing device settings.
|
||||
|
||||
Version 1.4 - Nov 19, 2001
|
||||
|
||||
* Support builds on configurations missing SIOCETHTOOL constant.
|
||||
* Import ethtool.h from kernel 2.4.15-pre6.
|
||||
* Support retrieval/setting of per-driver debug levels
|
||||
(ETHTOOL G/SMSGLVL)
|
||||
* Support pretty-printing register dumps on natsemi, de2104x
|
||||
(ETHTOOL GREGS)
|
||||
* Support restarting autonegotiation (ETHTOOL NWAY_RST)
|
||||
* Support obtaining link status (ETHTOOL GLINK)
|
||||
|
||||
Version 1.3 - Aug 02, 2001
|
||||
|
||||
* Support Wake-on-LAN (ETHTOOL GWOL and ETHTOOL SWOL ioctl).
|
||||
|
||||
Version 1.2 - May 17, 2001
|
||||
|
||||
* Support ETHTOOL_GDRVINFO ioctl, which obtains
|
||||
information from the ethernet driver associated
|
||||
with the specified interface.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ethtool is a small utility for examining and tuning your ethernet-based
|
||||
network interface. See the man page for more details.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,306 @@
|
|||
|
||||
/* Copyright (C) 2003 Advanced Micro Devices Inc. */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
typedef enum {
|
||||
/* VAL2 */
|
||||
RDMD0 = (1 << 16),
|
||||
/* VAL1 */
|
||||
TDMD3 = (1 << 11),
|
||||
TDMD2 = (1 << 10),
|
||||
TDMD1 = (1 << 9),
|
||||
TDMD0 = (1 << 8),
|
||||
/* VAL0 */
|
||||
UINTCMD = (1 << 6),
|
||||
RX_FAST_SPND = (1 << 5),
|
||||
TX_FAST_SPND = (1 << 4),
|
||||
RX_SPND = (1 << 3),
|
||||
TX_SPND = (1 << 2),
|
||||
INTREN = (1 << 1),
|
||||
RUN = (1 << 0),
|
||||
|
||||
CMD0_CLEAR = 0x000F0F7F, /* Command style register */
|
||||
|
||||
}CMD0_BITS;
|
||||
typedef enum {
|
||||
|
||||
/* VAL3 */
|
||||
CONDUIT_MODE = (1 << 29),
|
||||
/* VAL2 */
|
||||
RPA = (1 << 19),
|
||||
DRCVPA = (1 << 18),
|
||||
DRCVBC = (1 << 17),
|
||||
PROM = (1 << 16),
|
||||
/* VAL1 */
|
||||
ASTRP_RCV = (1 << 13),
|
||||
RCV_DROP0 = (1 << 12),
|
||||
EMBA = (1 << 11),
|
||||
DXMT2PD = (1 << 10),
|
||||
LTINTEN = (1 << 9),
|
||||
DXMTFCS = (1 << 8),
|
||||
/* VAL0 */
|
||||
APAD_XMT = (1 << 6),
|
||||
DRTY = (1 << 5),
|
||||
INLOOP = (1 << 4),
|
||||
EXLOOP = (1 << 3),
|
||||
REX_RTRY = (1 << 2),
|
||||
REX_UFLO = (1 << 1),
|
||||
REX_LCOL = (1 << 0),
|
||||
|
||||
CMD2_CLEAR = 0x3F7F3F7F, /* Command style register */
|
||||
|
||||
}CMD2_BITS;
|
||||
typedef enum {
|
||||
|
||||
/* VAL3 */
|
||||
ASF_INIT_DONE_ALIAS = (1 << 29),
|
||||
/* VAL2 */
|
||||
JUMBO = (1 << 21),
|
||||
VSIZE = (1 << 20),
|
||||
VLONLY = (1 << 19),
|
||||
VL_TAG_DEL = (1 << 18),
|
||||
/* VAL1 */
|
||||
EN_PMGR = (1 << 14),
|
||||
INTLEVEL = (1 << 13),
|
||||
FORCE_FULL_DUPLEX = (1 << 12),
|
||||
FORCE_LINK_STATUS = (1 << 11),
|
||||
APEP = (1 << 10),
|
||||
MPPLBA = (1 << 9),
|
||||
/* VAL0 */
|
||||
RESET_PHY_PULSE = (1 << 2),
|
||||
RESET_PHY = (1 << 1),
|
||||
PHY_RST_POL = (1 << 0),
|
||||
|
||||
}CMD3_BITS;
|
||||
typedef enum {
|
||||
|
||||
INTR = (1 << 31),
|
||||
PCSINT = (1 << 28),
|
||||
LCINT = (1 << 27),
|
||||
APINT5 = (1 << 26),
|
||||
APINT4 = (1 << 25),
|
||||
APINT3 = (1 << 24),
|
||||
TINT_SUM = (1 << 23),
|
||||
APINT2 = (1 << 22),
|
||||
APINT1 = (1 << 21),
|
||||
APINT0 = (1 << 20),
|
||||
MIIPDTINT = (1 << 19),
|
||||
MCCINT = (1 << 17),
|
||||
MREINT = (1 << 16),
|
||||
RINT_SUM = (1 << 15),
|
||||
SPNDINT = (1 << 14),
|
||||
MPINT = (1 << 13),
|
||||
SINT = (1 << 12),
|
||||
TINT3 = (1 << 11),
|
||||
TINT2 = (1 << 10),
|
||||
TINT1 = (1 << 9),
|
||||
TINT0 = (1 << 8),
|
||||
UINT = (1 << 7),
|
||||
STINT = (1 << 4),
|
||||
RINT0 = (1 << 0),
|
||||
|
||||
}INT0_BITS;
|
||||
typedef enum {
|
||||
|
||||
/* VAL3 */
|
||||
LCINTEN = (1 << 27),
|
||||
APINT5EN = (1 << 26),
|
||||
APINT4EN = (1 << 25),
|
||||
APINT3EN = (1 << 24),
|
||||
/* VAL2 */
|
||||
APINT2EN = (1 << 22),
|
||||
APINT1EN = (1 << 21),
|
||||
APINT0EN = (1 << 20),
|
||||
MIIPDTINTEN = (1 << 19),
|
||||
MCCIINTEN = (1 << 18),
|
||||
MCCINTEN = (1 << 17),
|
||||
MREINTEN = (1 << 16),
|
||||
/* VAL1 */
|
||||
SPNDINTEN = (1 << 14),
|
||||
MPINTEN = (1 << 13),
|
||||
TINTEN3 = (1 << 11),
|
||||
SINTEN = (1 << 12),
|
||||
TINTEN2 = (1 << 10),
|
||||
TINTEN1 = (1 << 9),
|
||||
TINTEN0 = (1 << 8),
|
||||
/* VAL0 */
|
||||
STINTEN = (1 << 4),
|
||||
RINTEN0 = (1 << 0),
|
||||
|
||||
INTEN0_CLEAR = 0x1F7F7F1F, /* Command style register */
|
||||
|
||||
}INTEN0_BITS;
|
||||
|
||||
typedef enum {
|
||||
|
||||
PMAT_DET = (1 << 12),
|
||||
MP_DET = (1 << 11),
|
||||
LC_DET = (1 << 10),
|
||||
SPEED_MASK = (1 << 9)|(1 << 8)|(1 << 7),
|
||||
FULL_DPLX = (1 << 6),
|
||||
LINK_STATS = (1 << 5),
|
||||
AUTONEG_COMPLETE = (1 << 4),
|
||||
MIIPD = (1 << 3),
|
||||
RX_SUSPENDED = (1 << 2),
|
||||
TX_SUSPENDED = (1 << 1),
|
||||
RUNNING = (1 << 0),
|
||||
|
||||
}STAT0_BITS;
|
||||
|
||||
#define PHY_SPEED_10 0x2
|
||||
#define PHY_SPEED_100 0x3
|
||||
|
||||
|
||||
int amd8111e_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
|
||||
u32 *reg_buff = (u32 *)regs->data;
|
||||
u32 reg;
|
||||
|
||||
fprintf(stdout, "Descriptor Registers\n");
|
||||
fprintf(stdout, "---------------------\n");
|
||||
|
||||
/* Transmit descriptor base address register */
|
||||
reg = reg_buff[0];
|
||||
fprintf(stdout,
|
||||
"0x00100: Transmit descriptor base address register %08X\n",reg);
|
||||
|
||||
/* Transmit descriptor length register */
|
||||
reg = reg_buff[1];
|
||||
fprintf(stdout,
|
||||
"0x00140: Transmit descriptor length register 0x%08X\n",reg);
|
||||
|
||||
/* Receive descriptor base address register */
|
||||
reg = reg_buff[2];
|
||||
fprintf(stdout,
|
||||
"0x00120: Receive descriptor base address register %08X\n",reg);
|
||||
|
||||
/* Receive descriptor length register */
|
||||
reg = reg_buff[3];
|
||||
fprintf(stdout,
|
||||
"0x00150: Receive descriptor length register 0x%08X\n",reg);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
|
||||
fprintf(stdout, "Command Registers\n");
|
||||
fprintf(stdout, "-------------------\n");
|
||||
|
||||
/* Command 0 Register */
|
||||
reg = reg_buff[4];
|
||||
fprintf(stdout,
|
||||
"0x00048: Command 0 register 0x%08X\n"
|
||||
" Interrupts: %s\n"
|
||||
" Device: %s\n",
|
||||
reg,
|
||||
reg & INTREN ? "Enabled" : "Disabled",
|
||||
reg & RUN ? "Running" : "Stopped");
|
||||
|
||||
/* Command 2 Register */
|
||||
reg = reg_buff[5];
|
||||
fprintf(stdout,
|
||||
"0x00050: Command 2 register 0x%08X\n"
|
||||
" Promiscuous mode: %s\n"
|
||||
" Retransmit on underflow: %s\n",
|
||||
reg,
|
||||
reg & PROM ? "Enabled" : "Disabled",
|
||||
reg & REX_UFLO ? "Enabled" : "Disabled");
|
||||
/* Command 3 Register */
|
||||
reg = reg_buff[6];
|
||||
fprintf(stdout,
|
||||
"0x00054: Command 3 register 0x%08X\n"
|
||||
" Jumbo frame: %s\n"
|
||||
" Admit only VLAN frame: %s\n"
|
||||
" Delete VLAN tag: %s\n",
|
||||
reg,
|
||||
reg & JUMBO ? "Enabled" : "Disabled",
|
||||
reg & VLONLY ? "Yes" : "No",
|
||||
reg & VL_TAG_DEL ? "Yes" : "No");
|
||||
|
||||
/* Command 7 Register */
|
||||
reg = reg_buff[7];
|
||||
fprintf(stdout,
|
||||
"0x00064: Command 7 register 0x%08X\n",
|
||||
reg);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "Interrupt Registers\n");
|
||||
fprintf(stdout, "-------------------\n");
|
||||
|
||||
/* Interrupt 0 Register */
|
||||
reg = reg_buff[8];
|
||||
fprintf(stdout,
|
||||
"0x00038: Interrupt register 0x%08X\n"
|
||||
" Any interrupt is set: %s\n"
|
||||
" Link change interrupt: %s\n"
|
||||
" Register 0 auto-poll interrupt: %s\n"
|
||||
" Transmit interrupt: %s\n"
|
||||
" Software timer interrupt: %s\n"
|
||||
" Receive interrupt: %s\n",
|
||||
reg,
|
||||
reg & INTR ? "Yes" : "No",
|
||||
reg & LCINT ? "Yes" : "No",
|
||||
reg & APINT0 ? "Yes" : "No",
|
||||
reg & TINT0 ? "Yes" : "No",
|
||||
reg & STINT ? "Yes" : "No",
|
||||
reg & RINT0 ? "Yes" : "No"
|
||||
);
|
||||
/* Interrupt 0 enable Register */
|
||||
reg = reg_buff[9];
|
||||
fprintf(stdout,
|
||||
"0x00040: Interrupt enable register 0x%08X\n"
|
||||
" Link change interrupt: %s\n"
|
||||
" Register 0 auto-poll interrupt: %s\n"
|
||||
" Transmit interrupt: %s\n"
|
||||
" Software timer interrupt: %s\n"
|
||||
" Receive interrupt: %s\n",
|
||||
reg,
|
||||
reg & LCINTEN ? "Enabled" : "Disabled",
|
||||
reg & APINT0EN ? "Enabled" : "Disabled",
|
||||
reg & TINTEN0 ? "Enabled" : "Disabled",
|
||||
reg & STINTEN ? "Enabled" : "Disabled",
|
||||
reg & RINTEN0 ? "Enabled" : "Disabled"
|
||||
);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "Logical Address Filter Register\n");
|
||||
fprintf(stdout, "-------------------\n");
|
||||
|
||||
/* Logical Address Filter Register */
|
||||
fprintf(stdout,
|
||||
"0x00168: Logical address filter register 0x%08X%08X\n",
|
||||
reg_buff[11],reg_buff[10]);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "Link status Register\n");
|
||||
fprintf(stdout, "-------------------\n");
|
||||
|
||||
/* Status 0 Register */
|
||||
reg = reg_buff[12];
|
||||
if(reg & LINK_STATS){
|
||||
fprintf(stdout,
|
||||
"0x00030: Link status register 0x%08X\n"
|
||||
" Link status: %s\n"
|
||||
" Auto negotiation complete %s\n"
|
||||
" Duplex %s\n"
|
||||
" Speed %s\n",
|
||||
reg,
|
||||
reg & LINK_STATS ? "Valid" : "Invalid",
|
||||
reg & AUTONEG_COMPLETE ? "Yes" : "No",
|
||||
reg & FULL_DPLX ? "Full" : "Half",
|
||||
((reg & SPEED_MASK) >> 7 == PHY_SPEED_10) ? "10Mbits/ Sec":
|
||||
"100Mbits/Sec");
|
||||
|
||||
}
|
||||
else{
|
||||
fprintf(stdout,
|
||||
"0x00030: Link status register 0x%08X\n"
|
||||
" Link status: %s\n",
|
||||
reg,
|
||||
reg & LINK_STATS ? "Valid" : "Invalid");
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
static char *hw_versions[] = {
|
||||
"503_ISL3861",
|
||||
"503_ISL3863",
|
||||
" 503",
|
||||
" 503_ACC",
|
||||
" 505",
|
||||
" 505_2958",
|
||||
" 505A",
|
||||
" 505AMX",
|
||||
};
|
||||
|
||||
int at76c50x_usb_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
u8 rev_id = (u8)(regs->version);
|
||||
char *ver_string;
|
||||
|
||||
if (version != 0)
|
||||
return -1;
|
||||
|
||||
ver_string = hw_versions[rev_id];
|
||||
fprintf(stdout,
|
||||
"Hardware Version %s\n",
|
||||
ver_string);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
# You need autoconf 2.5x, preferably 2.57 or later
|
||||
# You need automake 1.7 or later. 1.6 might work.
|
||||
|
||||
set -e
|
||||
|
||||
aclocal
|
||||
autoheader
|
||||
automake --gnu --add-missing --copy
|
||||
autoconf
|
|
@ -0,0 +1,347 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,70 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(ethtool, 5.4, netdev@vger.kernel.org)
|
||||
AC_PREREQ(2.52)
|
||||
AC_CONFIG_SRCDIR([ethtool.c])
|
||||
AM_INIT_AUTOMAKE([gnu])
|
||||
AC_CONFIG_HEADERS([ethtool-config.h])
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AM_PROG_CC_C_O
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_MSG_CHECKING([whether <linux/types.h> defines big-endian types])
|
||||
AC_TRY_COMPILE([#include <linux/types.h>],
|
||||
[__be16 foo;__be32 bar;],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_BE_TYPES], [1],
|
||||
[Define to 1 if <linux/types.h> defines big-endian types])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_FUNCS(socket strtol)
|
||||
|
||||
dnl Check for options
|
||||
AC_ARG_ENABLE(pretty-dump,
|
||||
[ --enable-pretty-dump enable registers, EEPROM and SFP pretty dumps (enabled by default)],
|
||||
,
|
||||
enable_pretty_dump=yes)
|
||||
if test x$enable_pretty_dump = xyes; then
|
||||
AC_DEFINE(ETHTOOL_ENABLE_PRETTY_DUMP, 1,
|
||||
[Define this to enable register, EEPROM and SFP pretty dumps.])
|
||||
fi
|
||||
AM_CONDITIONAL([ETHTOOL_ENABLE_PRETTY_DUMP], [test x$enable_pretty_dump = xyes])
|
||||
|
||||
AC_ARG_WITH([bash-completion-dir],
|
||||
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
|
||||
[Install the bash-completion script in this directory. @<:@default=yes@:>@]),
|
||||
[],
|
||||
[with_bash_completion_dir=yes])
|
||||
AS_IF([test "x$with_bash_completion_dir" = xyes],
|
||||
[AC_MSG_CHECKING([for bash-completion directory])
|
||||
dnl Attempt to use pkg-config completionsdir variable with given $prefix.
|
||||
dnl This matches distcheck expectation that all files install to $prefix.
|
||||
dnl It works with /usr and /usr/local (for default $XDG_DATA_DIRS) but
|
||||
dnl may install to directory not used by bash-completion in other cases.
|
||||
dnl See: https://lore.kernel.org/netdev/20190417025333.GA28674@kevinolos/
|
||||
AS_IF([test "x$PKG_CONFIG" != x \
|
||||
&& bash_completion_prefix=`"$PKG_CONFIG" --print-errors --variable=prefix bash-completion 2>&AS_MESSAGE_LOG_FD` \
|
||||
&& bash_completion_dir=`"$PKG_CONFIG" --print-errors --variable=completionsdir bash-completion 2>&AS_MESSAGE_LOG_FD`],
|
||||
[bash_completion_dir="${bash_completion_dir#"$bash_completion_prefix"}"
|
||||
bash_completion_dir="${bash_completion_dir#/}"
|
||||
BASH_COMPLETION_DIR='${prefix}'/"$bash_completion_dir"],
|
||||
[BASH_COMPLETION_DIR='${datadir}/bash-completion/completions'])
|
||||
AC_MSG_RESULT([$BASH_COMPLETION_DIR])],
|
||||
[BASH_COMPLETION_DIR="$with_bash_completion_dir"])
|
||||
AC_SUBST([BASH_COMPLETION_DIR])
|
||||
AM_CONDITIONAL([ENABLE_BASH_COMPLETION],
|
||||
[test "x$with_bash_completion_dir" != xno])
|
||||
|
||||
AC_CONFIG_FILES([Makefile ethtool.spec ethtool.8])
|
||||
AC_OUTPUT
|
|
@ -0,0 +1,783 @@
|
|||
/* Copyright 2001 Sun Microsystems (thockin@sun.com) */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
static const char * const csr0_tap[4] = {
|
||||
"No transmit automatic polling",
|
||||
"Transmit automatic polling every 200 seconds",
|
||||
"Transmit automatic polling every 800 seconds",
|
||||
"Transmit automatic polling every 1.6 milliseconds",
|
||||
};
|
||||
|
||||
static const char * const csr0_cache_al[4] = {
|
||||
"not used",
|
||||
"8-longword boundary alignment",
|
||||
"16-longword boundary alignment",
|
||||
"32-longword boundary alignment",
|
||||
};
|
||||
|
||||
static const char * const csr5_buserr[8] = {
|
||||
" Bus error: parity",
|
||||
" Bus error: master abort",
|
||||
" Bus error: target abort",
|
||||
" Bus error: (unknown code, reserved)",
|
||||
" Bus error: (unknown code, reserved)",
|
||||
" Bus error: (unknown code, reserved)",
|
||||
" Bus error: (unknown code, reserved)",
|
||||
" Bus error: (unknown code, reserved)",
|
||||
};
|
||||
|
||||
static const int csr6_tx_thresh[4] = {
|
||||
72,
|
||||
96,
|
||||
128,
|
||||
160,
|
||||
};
|
||||
|
||||
static const char * const csr6_om[4] = {
|
||||
"normal",
|
||||
"internal loopback",
|
||||
"external loopback",
|
||||
"unknown (not used)",
|
||||
};
|
||||
|
||||
static const char * const csr5_tx_state[8] = {
|
||||
"stopped",
|
||||
"running: fetch desc",
|
||||
"running: wait xmit end",
|
||||
"running: read buf",
|
||||
"unknown (reserved)",
|
||||
"running: setup packet",
|
||||
"suspended",
|
||||
"running: close desc",
|
||||
};
|
||||
|
||||
static const char * const csr5_rx_state[8] = {
|
||||
"stopped",
|
||||
"running: fetch desc",
|
||||
"running: chk pkt end",
|
||||
"running: wait for pkt",
|
||||
"suspended",
|
||||
"running: close",
|
||||
"running: flush",
|
||||
"running: queue",
|
||||
};
|
||||
|
||||
static const char * const csr12_nway_state[8] = {
|
||||
"Autonegotiation disable",
|
||||
"Transmit disable",
|
||||
"Ability detect",
|
||||
"Acknowledge detect",
|
||||
"Complete acknowledge",
|
||||
"FLP link good, nway complete",
|
||||
"Link check",
|
||||
"unknown (reserved)",
|
||||
};
|
||||
|
||||
static const char * const csr14_tp_comp[4] = {
|
||||
"Compensation Disabled Mode",
|
||||
"Compensation Disabled Mode",
|
||||
"High Power Mode",
|
||||
"Normal Compensation Mode",
|
||||
};
|
||||
|
||||
static void
|
||||
print_ring_addresses(u32 csr3, u32 csr4)
|
||||
{
|
||||
fprintf(stdout,
|
||||
"0x18: CSR3 (Rx Ring Base Address) 0x%08x\n"
|
||||
"0x20: CSR4 (Tx Ring Base Address) 0x%08x\n"
|
||||
,
|
||||
csr3,
|
||||
csr4);
|
||||
}
|
||||
|
||||
static void
|
||||
print_rx_missed(u32 csr8)
|
||||
{
|
||||
fprintf(stdout,
|
||||
"0x40: CSR8 (Missed Frames Counter) 0x%08x\n", csr8);
|
||||
if (csr8 & (1 << 16))
|
||||
fprintf(stdout,
|
||||
" Counter overflow\n");
|
||||
else {
|
||||
unsigned int rx_missed = csr8 & 0xffff;
|
||||
if (!rx_missed)
|
||||
fprintf(stdout,
|
||||
" No missed frames\n");
|
||||
else
|
||||
fprintf(stdout,
|
||||
" %u missed frames\n", rx_missed);
|
||||
}
|
||||
}
|
||||
|
||||
static void de21040_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 tmp, v, *data = (u32 *)regs->data;
|
||||
|
||||
fprintf(stdout, "21040 Registers\n");
|
||||
fprintf(stdout, "---------------\n");
|
||||
|
||||
/*
|
||||
* CSR0
|
||||
*/
|
||||
v = data[0];
|
||||
fprintf(stdout,
|
||||
"0x00: CSR0 (Bus Mode) 0x%08x\n"
|
||||
" %s\n"
|
||||
" %s address space\n"
|
||||
" Cache alignment: %s\n"
|
||||
,
|
||||
v,
|
||||
csr0_tap[(v >> 17) & 3],
|
||||
v & (1 << 16) ? "Diagnostic" : "Standard",
|
||||
csr0_cache_al[(v >> 14) & 3]);
|
||||
tmp = (v >> 8) & 0x3f;
|
||||
if (tmp == 0)
|
||||
fprintf(stdout, " Programmable burst length unlimited\n");
|
||||
else
|
||||
fprintf(stdout,
|
||||
" Programmable burst length %d longwords\n",
|
||||
tmp);
|
||||
fprintf(stdout,
|
||||
" %s endian data buffers\n"
|
||||
" Descriptor skip length %d longwords\n"
|
||||
" %s bus arbitration scheme\n"
|
||||
,
|
||||
v & (1 << 7) ? "Big" : "Little",
|
||||
(v >> 2) & 0x1f,
|
||||
v & (1 << 1) ? "Round-robin" : "RX-has-priority");
|
||||
if (v & (1 << 0))
|
||||
fprintf(stdout, " Software reset asserted\n");
|
||||
|
||||
/*
|
||||
* CSR3, 4
|
||||
*/
|
||||
print_ring_addresses(data[3], data[4]);
|
||||
|
||||
/*
|
||||
* CSR5
|
||||
*/
|
||||
v = data[5];
|
||||
fprintf(stdout,
|
||||
"0x28: CSR5 (Status) 0x%08x\n"
|
||||
"%s"
|
||||
" Transmit process %s\n"
|
||||
" Receive process %s\n"
|
||||
" Link %s\n"
|
||||
,
|
||||
v,
|
||||
v & (1 << 13) ? csr5_buserr[(v >> 23) & 0x7] : "",
|
||||
csr5_tx_state[(v >> 20) & 0x7],
|
||||
csr5_rx_state[(v >> 17) & 0x7],
|
||||
v & (1 << 12) ? "fail" : "OK");
|
||||
if (v & (1 << 16))
|
||||
fprintf(stdout,
|
||||
" Normal interrupts: %s%s%s\n"
|
||||
,
|
||||
v & (1 << 0) ? "TxOK " : "",
|
||||
v & (1 << 2) ? "TxNoBufs " : "",
|
||||
v & (1 << 6) ? "RxOK" : "");
|
||||
if (v & (1 << 15))
|
||||
fprintf(stdout,
|
||||
" Abnormal intr: %s%s%s%s%s%s%s%s\n"
|
||||
,
|
||||
v & (1 << 1) ? "TxStop " : "",
|
||||
v & (1 << 3) ? "TxJabber " : "",
|
||||
v & (1 << 5) ? "TxUnder " : "",
|
||||
v & (1 << 7) ? "RxNoBufs " : "",
|
||||
v & (1 << 8) ? "RxStopped " : "",
|
||||
v & (1 << 9) ? "RxTimeout " : "",
|
||||
v & (1 << 10) ? "AUI_TP " : "",
|
||||
v & (1 << 11) ? "FD_Short " : "");
|
||||
|
||||
/*
|
||||
* CSR6
|
||||
*/
|
||||
v = data[6];
|
||||
fprintf(stdout,
|
||||
"0x30: CSR6 (Operating Mode) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
" Transmit threshold %d bytes\n"
|
||||
" Transmit DMA %sabled\n"
|
||||
"%s"
|
||||
" Operating mode: %s\n"
|
||||
" %s duplex\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" Receive DMA %sabled\n"
|
||||
" %s filtering mode\n"
|
||||
,
|
||||
v,
|
||||
v & (1<<17) ? " Capture effect enabled\n" : "",
|
||||
v & (1<<16) ? " Back pressure enabled\n" : "",
|
||||
csr6_tx_thresh[(v >> 14) & 3],
|
||||
v & (1<<13) ? "en" : "dis",
|
||||
v & (1<<12) ? " Forcing collisions\n" : "",
|
||||
csr6_om[(v >> 10) & 3],
|
||||
v & (1<<9) ? "Full" : "Half",
|
||||
v & (1<<8) ? " Flaky oscillator disable\n" : "",
|
||||
v & (1<<7) ? " Pass All Multicast\n" : "",
|
||||
v & (1<<6) ? " Promisc Mode\n" : "",
|
||||
v & (1<<5) ? " Start/Stop Backoff Counter\n" : "",
|
||||
v & (1<<4) ? " Inverse Filtering\n" : "",
|
||||
v & (1<<3) ? " Pass Bad Frames\n" : "",
|
||||
v & (1<<2) ? " Hash-only Filtering\n" : "",
|
||||
v & (1<<1) ? "en" : "dis",
|
||||
v & (1<<0) ? "Hash" : "Perfect");
|
||||
|
||||
/*
|
||||
* CSR7
|
||||
*/
|
||||
v = data[7];
|
||||
fprintf(stdout,
|
||||
"0x38: CSR7 (Interrupt Mask) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<16) ? " Normal interrupt summary\n" : "",
|
||||
v & (1<<15) ? " Abnormal interrupt summary\n" : "",
|
||||
v & (1<<13) ? " System error\n" : "",
|
||||
v & (1<<12) ? " Link fail\n" : "",
|
||||
v & (1<<11) ? " Full duplex\n" : "",
|
||||
v & (1<<10) ? " AUI_TP pin\n" : "",
|
||||
v & (1<<9) ? " Receive watchdog timeout\n" : "",
|
||||
v & (1<<8) ? " Receive stopped\n" : "",
|
||||
v & (1<<7) ? " Receive buffer unavailable\n" : "",
|
||||
v & (1<<6) ? " Receive interrupt\n" : "",
|
||||
v & (1<<5) ? " Transmit underflow\n" : "",
|
||||
v & (1<<3) ? " Transmit jabber timeout\n" : "",
|
||||
v & (1<<2) ? " Transmit buffer unavailable\n" : "",
|
||||
v & (1<<1) ? " Transmit stopped\n" : "",
|
||||
v & (1<<0) ? " Transmit interrupt\n" : "");
|
||||
|
||||
/*
|
||||
* CSR8
|
||||
*/
|
||||
print_rx_missed(data[8]);
|
||||
|
||||
/*
|
||||
* CSR9
|
||||
*/
|
||||
v = data[9];
|
||||
fprintf(stdout,
|
||||
"0x48: CSR9 (Ethernet Address ROM) 0x%08x\n", v);
|
||||
|
||||
/*
|
||||
* CSR11
|
||||
*/
|
||||
v = data[11];
|
||||
fprintf(stdout,
|
||||
"0x58: CSR11 (Full Duplex Autoconfig) 0x%08x\n", v);
|
||||
|
||||
/*
|
||||
* CSR12
|
||||
*/
|
||||
v = data[12];
|
||||
fprintf(stdout,
|
||||
"0x60: CSR12 (SIA Status) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" AUI_TP pin: %s\n"
|
||||
,
|
||||
v,
|
||||
v & (1<<7) ? " PLL sampler high\n" : "",
|
||||
v & (1<<6) ? " PLL sampler low\n" : "",
|
||||
v & (1<<5) ? " PLL self-test pass\n" : "",
|
||||
v & (1<<4) ? " PLL self-test done\n" : "",
|
||||
v & (1<<3) ? " Autopolarity state\n" : "",
|
||||
v & (1<<2) ? " Link fail\n" : "",
|
||||
v & (1<<1) ? " Network connection error\n" : "",
|
||||
v & (1<<0) ? "AUI" : "TP");
|
||||
|
||||
/*
|
||||
* CSR13
|
||||
*/
|
||||
v = data[13];
|
||||
fprintf(stdout,
|
||||
"0x68: CSR13 (SIA Connectivity) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" External port output multiplexer select: %u%u%u%u\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" %s interface selected\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<15) ? " Enable pins 5, 6, 7\n" : "",
|
||||
v & (1<<14) ? " Enable pins 2, 4\n" : "",
|
||||
v & (1<<13) ? " Enable pins 1, 3\n" : "",
|
||||
v & (1<<12) ? " Input enable\n" : "",
|
||||
v & (1<<11) ? 1 : 0,
|
||||
v & (1<<10) ? 1 : 0,
|
||||
v & (1<<9) ? 1 : 0,
|
||||
v & (1<<8) ? 1 : 0,
|
||||
v & (1<<7) ? " APLL start\n" : "",
|
||||
v & (1<<6) ? " Serial interface input multiplexer\n" : "",
|
||||
v & (1<<5) ? " Encoder input multiplexer\n" : "",
|
||||
v & (1<<4) ? " SIA PLL external input enable\n" : "",
|
||||
v & (1<<3) ? "AUI" : "10base-T",
|
||||
v & (1<<2) ? " CSR autoconfiguration\n" : "",
|
||||
v & (1<<1) ? " AUI_TP pin autoconfiguration\n" : "",
|
||||
v & (1<<0) ? " SIA reset\n" : "");
|
||||
|
||||
/*
|
||||
* CSR14
|
||||
*/
|
||||
v = data[14];
|
||||
fprintf(stdout,
|
||||
"0x70: CSR14 (SIA Transmit and Receive) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" %s\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<14) ? " Set polarity plus\n" : "",
|
||||
v & (1<<13) ? " Autopolarity enable\n" : "",
|
||||
v & (1<<12) ? " Link test enable\n" : "",
|
||||
v & (1<<11) ? " Heartbeat enable\n" : "",
|
||||
v & (1<<10) ? " Collision detect enable\n" : "",
|
||||
v & (1<<9) ? " Collision squelch enable\n" : "",
|
||||
v & (1<<8) ? " Receive squelch enable\n" : "",
|
||||
csr14_tp_comp[(v >> 4) & 0x3],
|
||||
v & (1<<3) ? " Link pulse send enable\n" : "",
|
||||
v & (1<<2) ? " Driver enable\n" : "",
|
||||
v & (1<<1) ? " Loopback enable\n" : "",
|
||||
v & (1<<0) ? " Encoder enable\n" : "");
|
||||
|
||||
/*
|
||||
* CSR15
|
||||
*/
|
||||
v = data[15];
|
||||
fprintf(stdout,
|
||||
"0x78: CSR15 (SIA General) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<13) ? " Force receiver low\n" : "",
|
||||
v & (1<<12) ? " PLL self-test start\n" : "",
|
||||
v & (1<<11) ? " Force link fail\n" : "",
|
||||
v & (1<<9) ? " Force unsquelch\n" : "",
|
||||
v & (1<<8) ? " Test clock\n" : "",
|
||||
v & (1<<5) ? " Receive watchdog release\n" : "",
|
||||
v & (1<<4) ? " Receive watchdog disable\n" : "",
|
||||
v & (1<<2) ? " Jabber clock\n" : "",
|
||||
v & (1<<1) ? " Host unjab\n" : "",
|
||||
v & (1<<0) ? " Jabber disable\n" : "");
|
||||
}
|
||||
|
||||
static void de21041_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 tmp, v, *data = (u32 *)regs->data;
|
||||
|
||||
fprintf(stdout, "21041 Registers\n");
|
||||
fprintf(stdout, "---------------\n");
|
||||
|
||||
/*
|
||||
* CSR0
|
||||
*/
|
||||
v = data[0];
|
||||
fprintf(stdout,
|
||||
"0x00: CSR0 (Bus Mode) 0x%08x\n"
|
||||
" %s endian descriptors\n"
|
||||
" %s\n"
|
||||
" %s address space\n"
|
||||
" Cache alignment: %s\n"
|
||||
,
|
||||
v,
|
||||
v & (1 << 20) ? "Big" : "Little",
|
||||
csr0_tap[(v >> 17) & 3],
|
||||
v & (1 << 16) ? "Diagnostic" : "Standard",
|
||||
csr0_cache_al[(v >> 14) & 3]);
|
||||
tmp = (v >> 8) & 0x3f;
|
||||
if (tmp == 0)
|
||||
fprintf(stdout, " Programmable burst length unlimited\n");
|
||||
else
|
||||
fprintf(stdout,
|
||||
" Programmable burst length %d longwords\n",
|
||||
tmp);
|
||||
fprintf(stdout,
|
||||
" %s endian data buffers\n"
|
||||
" Descriptor skip length %d longwords\n"
|
||||
" %s bus arbitration scheme\n"
|
||||
,
|
||||
v & (1 << 7) ? "Big" : "Little",
|
||||
(v >> 2) & 0x1f,
|
||||
v & (1 << 1) ? "Round-robin" : "RX-has-priority");
|
||||
if (v & (1 << 0))
|
||||
fprintf(stdout, " Software reset asserted\n");
|
||||
|
||||
/*
|
||||
* CSR3, 4
|
||||
*/
|
||||
print_ring_addresses(data[3], data[4]);
|
||||
|
||||
/*
|
||||
* CSR5
|
||||
*/
|
||||
v = data[5];
|
||||
fprintf(stdout,
|
||||
"0x28: CSR5 (Status) 0x%08x\n"
|
||||
"%s"
|
||||
" Transmit process %s\n"
|
||||
" Receive process %s\n"
|
||||
" Link %s\n"
|
||||
,
|
||||
v,
|
||||
v & (1 << 13) ? csr5_buserr[(v >> 23) & 0x7] : "",
|
||||
csr5_tx_state[(v >> 20) & 0x7],
|
||||
csr5_rx_state[(v >> 17) & 0x7],
|
||||
v & (1 << 12) ? "fail" : "OK");
|
||||
if (v & (1 << 16))
|
||||
fprintf(stdout,
|
||||
" Normal interrupts: %s%s%s%s%s\n"
|
||||
,
|
||||
v & (1 << 0) ? "TxOK " : "",
|
||||
v & (1 << 2) ? "TxNoBufs " : "",
|
||||
v & (1 << 6) ? "RxOK" : "",
|
||||
v & (1 << 11) ? "TimerExp " : "",
|
||||
v & (1 << 14) ? "EarlyRx " : "");
|
||||
if (v & (1 << 15))
|
||||
fprintf(stdout,
|
||||
" Abnormal intr: %s%s%s%s%s%s%s\n"
|
||||
,
|
||||
v & (1 << 1) ? "TxStop " : "",
|
||||
v & (1 << 3) ? "TxJabber " : "",
|
||||
v & (1 << 4) ? "ANC " : "",
|
||||
v & (1 << 5) ? "TxUnder " : "",
|
||||
v & (1 << 7) ? "RxNoBufs " : "",
|
||||
v & (1 << 8) ? "RxStopped " : "",
|
||||
v & (1 << 9) ? "RxTimeout " : "");
|
||||
|
||||
/*
|
||||
* CSR6
|
||||
*/
|
||||
v = data[6];
|
||||
fprintf(stdout,
|
||||
"0x30: CSR6 (Operating Mode) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
" Transmit threshold %d bytes\n"
|
||||
" Transmit DMA %sabled\n"
|
||||
"%s"
|
||||
" Operating mode: %s\n"
|
||||
" %s duplex\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" Receive DMA %sabled\n"
|
||||
" %s filtering mode\n"
|
||||
,
|
||||
v,
|
||||
v & (1<<31) ? " Special capture effect enabled\n" : "",
|
||||
v & (1<<17) ? " Capture effect enabled\n" : "",
|
||||
csr6_tx_thresh[(v >> 14) & 3],
|
||||
v & (1<<13) ? "en" : "dis",
|
||||
v & (1<<12) ? " Forcing collisions\n" : "",
|
||||
csr6_om[(v >> 10) & 3],
|
||||
v & (1<<9) ? "Full" : "Half",
|
||||
v & (1<<8) ? " Flaky oscillator disable\n" : "",
|
||||
v & (1<<7) ? " Pass All Multicast\n" : "",
|
||||
v & (1<<6) ? " Promisc Mode\n" : "",
|
||||
v & (1<<5) ? " Start/Stop Backoff Counter\n" : "",
|
||||
v & (1<<4) ? " Inverse Filtering\n" : "",
|
||||
v & (1<<3) ? " Pass Bad Frames\n" : "",
|
||||
v & (1<<2) ? " Hash-only Filtering\n" : "",
|
||||
v & (1<<1) ? "en" : "dis",
|
||||
v & (1<<0) ? "Hash" : "Perfect");
|
||||
|
||||
/*
|
||||
* CSR7
|
||||
*/
|
||||
v = data[7];
|
||||
fprintf(stdout,
|
||||
"0x38: CSR7 (Interrupt Mask) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<16) ? " Normal interrupt summary\n" : "",
|
||||
v & (1<<15) ? " Abnormal interrupt summary\n" : "",
|
||||
v & (1<<14) ? " Early receive interrupt\n" : "",
|
||||
v & (1<<13) ? " System error\n" : "",
|
||||
v & (1<<12) ? " Link fail\n" : "",
|
||||
v & (1<<11) ? " Timer expired\n" : "",
|
||||
v & (1<<9) ? " Receive watchdog timeout\n" : "",
|
||||
v & (1<<8) ? " Receive stopped\n" : "",
|
||||
v & (1<<7) ? " Receive buffer unavailable\n" : "",
|
||||
v & (1<<6) ? " Receive interrupt\n" : "",
|
||||
v & (1<<5) ? " Transmit underflow\n" : "",
|
||||
v & (1<<4) ? " Link pass\n" : "",
|
||||
v & (1<<3) ? " Transmit jabber timeout\n" : "",
|
||||
v & (1<<2) ? " Transmit buffer unavailable\n" : "",
|
||||
v & (1<<1) ? " Transmit stopped\n" : "",
|
||||
v & (1<<0) ? " Transmit interrupt\n" : "");
|
||||
|
||||
/*
|
||||
* CSR8
|
||||
*/
|
||||
print_rx_missed(data[8]);
|
||||
|
||||
/*
|
||||
* CSR9
|
||||
*/
|
||||
v = data[9];
|
||||
fprintf(stdout,
|
||||
"0x48: CSR9 (Boot and Ethernet ROMs) 0x%08x\n"
|
||||
" Select bits: %s%s%s%s%s%s\n"
|
||||
" Data: %d%d%d%d%d%d%d%d\n"
|
||||
,
|
||||
v,
|
||||
v & (1<<15) ? "Mode " : "",
|
||||
v & (1<<14) ? "Read " : "",
|
||||
v & (1<<13) ? "Write " : "",
|
||||
v & (1<<12) ? "BootROM " : "",
|
||||
v & (1<<11) ? "SROM " : "",
|
||||
v & (1<<10) ? "ExtReg " : "",
|
||||
v & (1<<7) ? 1 : 0,
|
||||
v & (1<<6) ? 1 : 0,
|
||||
v & (1<<5) ? 1 : 0,
|
||||
v & (1<<4) ? 1 : 0,
|
||||
v & (1<<3) ? 1 : 0,
|
||||
v & (1<<2) ? 1 : 0,
|
||||
v & (1<<1) ? 1 : 0,
|
||||
v & (1<<0) ? 1 : 0);
|
||||
|
||||
/*
|
||||
* CSR10
|
||||
*/
|
||||
v = data[10];
|
||||
fprintf(stdout,
|
||||
"0x50: CSR10 (Boot ROM Address) 0x%08x\n", v);
|
||||
|
||||
/*
|
||||
* CSR11
|
||||
*/
|
||||
v = data[11];
|
||||
fprintf(stdout,
|
||||
"0x58: CSR11 (General Purpose Timer) 0x%08x\n"
|
||||
"%s"
|
||||
" Timer value: %u cycles\n"
|
||||
,
|
||||
v,
|
||||
v & (1<<16) ? " Continuous mode\n" : "",
|
||||
v & 0xffff);
|
||||
|
||||
/*
|
||||
* CSR12
|
||||
*/
|
||||
v = data[12];
|
||||
fprintf(stdout,
|
||||
"0x60: CSR12 (SIA Status) 0x%08x\n"
|
||||
" Link partner code word 0x%04x\n"
|
||||
"%s"
|
||||
" NWay state: %s\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v >> 16,
|
||||
v & (1<<15) ? " Link partner negotiable\n" : "",
|
||||
csr12_nway_state[(v >> 12) & 0x7],
|
||||
v & (1<<11) ? " Transmit remote fault\n" : "",
|
||||
v & (1<<10) ? " Unstable NLP detected\n" : "",
|
||||
v & (1<<9) ? " Non-selected port receive activity\n" : "",
|
||||
v & (1<<8) ? " Selected port receive activity\n" : "",
|
||||
v & (1<<7) ? " PLL sampler high\n" : "",
|
||||
v & (1<<6) ? " PLL sampler low\n" : "",
|
||||
v & (1<<5) ? " PLL self-test pass\n" : "",
|
||||
v & (1<<4) ? " PLL self-test done\n" : "",
|
||||
v & (1<<3) ? " Autopolarity state\n" : "",
|
||||
v & (1<<2) ? " Link fail\n" : "",
|
||||
v & (1<<1) ? " Network connection error\n" : "");
|
||||
|
||||
/*
|
||||
* CSR13
|
||||
*/
|
||||
v = data[13];
|
||||
fprintf(stdout,
|
||||
"0x68: CSR13 (SIA Connectivity) 0x%08x\n"
|
||||
" SIA Diagnostic Mode 0x%04x\n"
|
||||
" %s\n"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
(v >> 4) & 0xfff,
|
||||
v & (1<<3) ? "AUI/BNC port" : "10base-T port",
|
||||
v & (1<<2) ? " CSR autoconfiguration enabled\n" : "",
|
||||
v & (1<<0) ? " SIA register reset asserted\n" : "");
|
||||
|
||||
/*
|
||||
* CSR14
|
||||
*/
|
||||
v = data[14];
|
||||
fprintf(stdout,
|
||||
"0x70: CSR14 (SIA Transmit and Receive) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" %s\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<15) ? " 10base-T/AUI autosensing\n" : "",
|
||||
v & (1<<14) ? " Set polarity plus\n" : "",
|
||||
v & (1<<13) ? " Autopolarity enable\n" : "",
|
||||
v & (1<<12) ? " Link test enable\n" : "",
|
||||
v & (1<<11) ? " Heartbeat enable\n" : "",
|
||||
v & (1<<10) ? " Collision detect enable\n" : "",
|
||||
v & (1<<9) ? " Collision squelch enable\n" : "",
|
||||
v & (1<<8) ? " Receive squelch enable\n" : "",
|
||||
v & (1<<7) ? " Autonegotiation enable\n" : "",
|
||||
v & (1<<6) ? " Must Be One\n" : "",
|
||||
csr14_tp_comp[(v >> 4) & 0x3],
|
||||
v & (1<<3) ? " Link pulse send enable\n" : "",
|
||||
v & (1<<2) ? " Driver enable\n" : "",
|
||||
v & (1<<1) ? " Loopback enable\n" : "",
|
||||
v & (1<<0) ? " Encoder enable\n" : "");
|
||||
|
||||
/*
|
||||
* CSR15
|
||||
*/
|
||||
v = data[15];
|
||||
fprintf(stdout,
|
||||
"0x78: CSR15 (SIA General) 0x%08x\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
" %s port selected\n"
|
||||
"%s"
|
||||
"%s"
|
||||
"%s"
|
||||
,
|
||||
v,
|
||||
v & (1<<15) ? " GP LED2 on\n" : "",
|
||||
v & (1<<14) ? " GP LED2 enable\n" : "",
|
||||
v & (1<<13) ? " Force receiver low\n" : "",
|
||||
v & (1<<12) ? " PLL self-test start\n" : "",
|
||||
v & (1<<11) ? " LED stretch disable\n" : "",
|
||||
v & (1<<10) ? " Force link fail\n" : "",
|
||||
v & (1<<9) ? " Force unsquelch\n" : "",
|
||||
v & (1<<8) ? " Test clock\n" : "",
|
||||
v & (1<<7) ? " GP LED1 on\n" : "",
|
||||
v & (1<<6) ? " GP LED1 enable\n" : "",
|
||||
v & (1<<5) ? " Receive watchdog release\n" : "",
|
||||
v & (1<<4) ? " Receive watchdog disable\n" : "",
|
||||
v & (1<<3) ? "AUI" : "BNC",
|
||||
v & (1<<2) ? " Jabber clock\n" : "",
|
||||
v & (1<<1) ? " Host unjab\n" : "",
|
||||
v & (1<<0) ? " Jabber disable\n" : "");
|
||||
}
|
||||
|
||||
int
|
||||
de2104x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
|
||||
{
|
||||
unsigned int de21040 = regs->version & 1;
|
||||
|
||||
if (de21040)
|
||||
de21040_dump_regs(info, regs);
|
||||
else
|
||||
de21041_dump_regs(info, regs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,791 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,686 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/* Macros and dump functions for the 16-bit mv88e6xxx per-port registers */
|
||||
|
||||
#define REG(_reg, _name, _val) \
|
||||
printf("%.02u: %-38.38s 0x%.4x\n", _reg, _name, _val)
|
||||
|
||||
#define FIELD(_name, _fmt, ...) \
|
||||
printf(" %-36.36s " _fmt "\n", _name, ##__VA_ARGS__)
|
||||
|
||||
#define FIELD_BITMAP(_name, _val) \
|
||||
FIELD(_name, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", \
|
||||
((_val) & 0x0001) ? "0 " : "", \
|
||||
((_val) & 0x0002) ? "1 " : "", \
|
||||
((_val) & 0x0004) ? "2 " : "", \
|
||||
((_val) & 0x0008) ? "3 " : "", \
|
||||
((_val) & 0x0010) ? "4 " : "", \
|
||||
((_val) & 0x0020) ? "5 " : "", \
|
||||
((_val) & 0x0040) ? "6 " : "", \
|
||||
((_val) & 0x0080) ? "7 " : "", \
|
||||
((_val) & 0x0100) ? "8 " : "", \
|
||||
((_val) & 0x0200) ? "9 " : "", \
|
||||
((_val) & 0x0400) ? "10 " : "", \
|
||||
((_val) & 0x0800) ? "11 " : "", \
|
||||
((_val) & 0x1000) ? "12 " : "", \
|
||||
((_val) & 0x2000) ? "13 " : "", \
|
||||
((_val) & 0x4000) ? "14 " : "", \
|
||||
((_val) & 0x8000) ? "15 " : "")
|
||||
|
||||
static void dsa_mv88e6161(int reg, u16 val)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0:
|
||||
REG(reg, "Port Status", val);
|
||||
FIELD("Pause Enabled", "%u", !!(val & 0x8000));
|
||||
FIELD("My Pause", "%u", !!(val & 0x4000));
|
||||
FIELD("Half-duplex Flow Control", "%u", !!(val & 0x2000));
|
||||
FIELD("802.3 PHY Detected", "%u", !!(val & 0x1000));
|
||||
FIELD("Link Status", "%s", val & 0x0800 ? "Up" : "Down");
|
||||
FIELD("Duplex", "%s", val & 0x0400 ? "Full" : "Half");
|
||||
FIELD("Speed", "%s",
|
||||
(val & 0x0300) == 0x0000 ? "10 Mbps" :
|
||||
(val & 0x0300) == 0x0100 ? "100 Mbps" :
|
||||
(val & 0x0300) == 0x0200 ? "1000 Mbps" :
|
||||
(val & 0x0300) == 0x0300 ? "Reserved" : "?");
|
||||
FIELD("Auto-Media Detect Disable", "%u", !!(val & 0x0040));
|
||||
FIELD("Transmitter Paused", "%u", !!(val & 0x0020));
|
||||
FIELD("Flow Control", "%u", !!(val & 0x0010));
|
||||
FIELD("Config Duplex", "%s", val & 0x0008 ? "Full" : "Half");
|
||||
FIELD("Config Mode", "0x%x", val & 0x0007);
|
||||
break;
|
||||
case 1:
|
||||
REG(reg, "PCS Control", val);
|
||||
FIELD("Flow Control's Forced value", "%u", !!(val & 0x0080));
|
||||
FIELD("Force Flow Control", "%u", !!(val & 0x0040));
|
||||
FIELD("Link's Forced value", "%s", val & 0x0020 ? "Up" : "Down");
|
||||
FIELD("Force Link", "%u", !!(val & 0x0010));
|
||||
FIELD("Duplex's Forced value", "%s", val & 0x0008 ? "Full" : "Half");
|
||||
FIELD("Force Duplex", "%u", !!(val & 0x0004));
|
||||
FIELD("Force Speed", "%s",
|
||||
(val & 0x0003) == 0x0000 ? "10 Mbps" :
|
||||
(val & 0x0003) == 0x0001 ? "100 Mbps" :
|
||||
(val & 0x0003) == 0x0002 ? "1000 Mbps" :
|
||||
(val & 0x0003) == 0x0003 ? "Not forced" : "?");
|
||||
break;
|
||||
case 2:
|
||||
REG(reg, "Jamming Control", val);
|
||||
break;
|
||||
case 3:
|
||||
REG(reg, "Switch Identifier", val);
|
||||
break;
|
||||
case 4:
|
||||
REG(reg, "Port Control", val);
|
||||
FIELD("Source Address Filtering controls", "%s",
|
||||
(val & 0xc000) == 0x0000 ? "Disabled" :
|
||||
(val & 0xc000) == 0x4000 ? "Drop On Lock" :
|
||||
(val & 0xc000) == 0x8000 ? "Drop On Unlock" :
|
||||
(val & 0xc000) == 0xc000 ? "Drop to CPU" : "?");
|
||||
FIELD("Egress Mode", "%s",
|
||||
(val & 0x3000) == 0x0000 ? "Unmodified" :
|
||||
(val & 0x3000) == 0x1000 ? "Untagged" :
|
||||
(val & 0x3000) == 0x2000 ? "Tagged" :
|
||||
(val & 0x3000) == 0x3000 ? "Reserved" : "?");
|
||||
FIELD("Ingress & Egress Header Mode", "%u", !!(val & 0x0800));
|
||||
FIELD("IGMP and MLD Snooping", "%u", !!(val & 0x0400));
|
||||
FIELD("Frame Mode", "%s",
|
||||
(val & 0x0300) == 0x0000 ? "Normal" :
|
||||
(val & 0x0300) == 0x0100 ? "DSA" :
|
||||
(val & 0x0300) == 0x0200 ? "Provider" :
|
||||
(val & 0x0300) == 0x0300 ? "Ether Type DSA" : "?");
|
||||
FIELD("VLAN Tunnel", "%u", !!(val & 0x0080));
|
||||
FIELD("TagIfBoth", "%u", !!(val & 0x0040));
|
||||
FIELD("Initial Priority assignment", "%s",
|
||||
(val & 0x0030) == 0x0000 ? "Defaults" :
|
||||
(val & 0x0030) == 0x0010 ? "Tag Priority" :
|
||||
(val & 0x0030) == 0x0020 ? "IP Priority" :
|
||||
(val & 0x0030) == 0x0030 ? "Tag & IP Priority" : "?");
|
||||
FIELD("Egress Flooding mode", "%s",
|
||||
(val & 0x000c) == 0x0000 ? "No unknown DA" :
|
||||
(val & 0x000c) == 0x0004 ? "No unknown multicast DA" :
|
||||
(val & 0x000c) == 0x0008 ? "No unknown unicast DA" :
|
||||
(val & 0x000c) == 0x000c ? "Allow unknown DA" : "?");
|
||||
FIELD("Port State", "%s",
|
||||
(val & 0x0003) == 0x0000 ? "Disabled" :
|
||||
(val & 0x0003) == 0x0001 ? "Blocking/Listening" :
|
||||
(val & 0x0003) == 0x0002 ? "Learning" :
|
||||
(val & 0x0003) == 0x0003 ? "Forwarding" : "?");
|
||||
break;
|
||||
case 5:
|
||||
REG(reg, "Port Control 1", val);
|
||||
FIELD("Message Port", "%u", !!(val & 0x8000));
|
||||
FIELD("Trunk Port", "%u", !!(val & 0x4000));
|
||||
FIELD("Trunk ID", "%u", (val & 0x0f00) >> 8);
|
||||
FIELD("FID[5:4]", "0x%.2x", (val & 0x0003) << 4);
|
||||
break;
|
||||
case 6:
|
||||
REG(reg, "Port Base VLAN Map (Header)", val);
|
||||
FIELD("FID[3:0]", "0x%.2x", (val & 0xf000) >> 12);
|
||||
FIELD_BITMAP("VLANTable", val & 0x003f);
|
||||
break;
|
||||
case 7:
|
||||
REG(reg, "Default VLAN ID & Priority", val);
|
||||
FIELD("Default Priority", "0x%x", (val & 0xe000) >> 13);
|
||||
FIELD("Force to use Default VID", "%u", !!(val & 0x1000));
|
||||
FIELD("Default VLAN Identifier", "%u", val & 0x0fff);
|
||||
break;
|
||||
case 8:
|
||||
REG(reg, "Port Control 2", val);
|
||||
FIELD("Force good FCS in the frame", "%u", !!(val & 0x8000));
|
||||
FIELD("Jumbo Mode", "%s",
|
||||
(val & 0x3000) == 0x0000 ? "1522" :
|
||||
(val & 0x3000) == 0x1000 ? "2048" :
|
||||
(val & 0x3000) == 0x2000 ? "10240" :
|
||||
(val & 0x3000) == 0x3000 ? "Reserved" : "?");
|
||||
FIELD("802.1QMode", "%s",
|
||||
(val & 0x0c00) == 0x0000 ? "Disabled" :
|
||||
(val & 0x0c00) == 0x0400 ? "Fallback" :
|
||||
(val & 0x0c00) == 0x0800 ? "Check" :
|
||||
(val & 0x0c00) == 0x0c00 ? "Secure" : "?");
|
||||
FIELD("Discard Tagged Frames", "%u", !!(val & 0x0200));
|
||||
FIELD("Discard Untagged Frames", "%u", !!(val & 0x0100));
|
||||
FIELD("Map using DA hits", "%u", !!(val & 0x0080));
|
||||
FIELD("ARP Mirror enable", "%u", !!(val & 0x0040));
|
||||
FIELD("Egress Monitor Source Port", "%u", !!(val & 0x0020));
|
||||
FIELD("Ingress Monitor Source Port", "%u", !!(val & 0x0010));
|
||||
break;
|
||||
case 9:
|
||||
REG(reg, "Egress Rate Control", val);
|
||||
break;
|
||||
case 10:
|
||||
REG(reg, "Egress Rate Control 2", val);
|
||||
break;
|
||||
case 11:
|
||||
REG(reg, "Port Association Vector", val);
|
||||
break;
|
||||
case 12:
|
||||
REG(reg, "Port ATU Control", val);
|
||||
break;
|
||||
case 13:
|
||||
REG(reg, "Priority Override", val);
|
||||
break;
|
||||
case 15:
|
||||
REG(reg, "PortEType", val);
|
||||
break;
|
||||
case 16:
|
||||
REG(reg, "InDiscardsLo Frame Counter", val);
|
||||
break;
|
||||
case 17:
|
||||
REG(reg, "InDiscardsHi Frame Counter", val);
|
||||
break;
|
||||
case 18:
|
||||
REG(reg, "InFiltered Frame Counter", val);
|
||||
break;
|
||||
case 19:
|
||||
REG(reg, "OutFiltered Frame Counter", val);
|
||||
break;
|
||||
case 24:
|
||||
REG(reg, "Tag Remap 0-3", val);
|
||||
break;
|
||||
case 25:
|
||||
REG(reg, "Tag Remap 4-7", val);
|
||||
break;
|
||||
case 27:
|
||||
REG(reg, "Queue Counters", val);
|
||||
break;
|
||||
default:
|
||||
REG(reg, "Reserved", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void dsa_mv88e6185(int reg, u16 val)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0:
|
||||
REG(reg, "Port Status", val);
|
||||
break;
|
||||
case 1:
|
||||
REG(reg, "PCS Control", val);
|
||||
break;
|
||||
case 3:
|
||||
REG(reg, "Switch Identifier", val);
|
||||
break;
|
||||
case 4:
|
||||
REG(reg, "Port Control", val);
|
||||
break;
|
||||
case 5:
|
||||
REG(reg, "Port Control 1", val);
|
||||
break;
|
||||
case 6:
|
||||
REG(reg, "Port Base VLAN Map (Header)", val);
|
||||
break;
|
||||
case 7:
|
||||
REG(reg, "Default VLAN ID & Priority", val);
|
||||
break;
|
||||
case 8:
|
||||
REG(reg, "Port Control 2", val);
|
||||
break;
|
||||
case 9:
|
||||
REG(reg, "Rate Control", val);
|
||||
break;
|
||||
case 10:
|
||||
REG(reg, "Rate Control 2", val);
|
||||
break;
|
||||
case 11:
|
||||
REG(reg, "Port Association Vector", val);
|
||||
break;
|
||||
case 16:
|
||||
REG(reg, "InDiscardsLo Frame Counter", val);
|
||||
break;
|
||||
case 17:
|
||||
REG(reg, "InDiscardsHi Frame Counter", val);
|
||||
break;
|
||||
case 18:
|
||||
REG(reg, "InFiltered Frame Counter", val);
|
||||
break;
|
||||
case 19:
|
||||
REG(reg, "OutFiltered Frame Counter", val);
|
||||
break;
|
||||
case 24:
|
||||
REG(reg, "Tag Remap 0-3", val);
|
||||
break;
|
||||
case 25:
|
||||
REG(reg, "Tag Remap 4-7", val);
|
||||
break;
|
||||
default:
|
||||
REG(reg, "Reserved", val);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
static void dsa_mv88e6352(int reg, u16 val)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0:
|
||||
REG(reg, "Port Status", val);
|
||||
FIELD("Pause Enabled", "%u", !!(val & 0x8000));
|
||||
FIELD("My Pause", "%u", !!(val & 0x4000));
|
||||
FIELD("802.3 PHY Detected", "%u", !!(val & 0x1000));
|
||||
FIELD("Link Status", "%s", val & 0x0800 ? "Up" : "Down");
|
||||
FIELD("Duplex", "%s", val & 0x0400 ? "Full" : "Half");
|
||||
FIELD("Speed", "%s",
|
||||
(val & 0x0300) == 0x0000 ? "10 Mbps" :
|
||||
(val & 0x0300) == 0x0100 ? "100 or 200 Mbps" :
|
||||
(val & 0x0300) == 0x0200 ? "1000 Mbps" :
|
||||
(val & 0x0300) == 0x0300 ? "Reserved" : "?");
|
||||
FIELD("EEE Enabled", "%u", !!(val & 0x0040));
|
||||
FIELD("Transmitter Paused", "%u", !!(val & 0x0020));
|
||||
FIELD("Flow Control", "%u", !!(val & 0x0010));
|
||||
FIELD("Config Mode", "0x%x", val & 0x000f);
|
||||
break;
|
||||
case 1:
|
||||
REG(reg, "Physical Control", val);
|
||||
FIELD("RGMII Receive Timing Control", "%s", val & 0x8000 ? "Delay" : "Default");
|
||||
FIELD("RGMII Transmit Timing Control", "%s", val & 0x4000 ? "Delay" : "Default");
|
||||
FIELD("200 BASE Mode", "%s", val & 0x1000 ? "200" : "100");
|
||||
FIELD("Flow Control's Forced value", "%u", !!(val & 0x0080));
|
||||
FIELD("Force Flow Control", "%u", !!(val & 0x0040));
|
||||
FIELD("Link's Forced value", "%s", val & 0x0020 ? "Up" : "Down");
|
||||
FIELD("Force Link", "%u", !!(val & 0x0010));
|
||||
FIELD("Duplex's Forced value", "%s", val & 0x0008 ? "Full" : "Half");
|
||||
FIELD("Force Duplex", "%u", !!(val & 0x0004));
|
||||
FIELD("Force Speed", "%s",
|
||||
(val & 0x0003) == 0x0000 ? "10 Mbps" :
|
||||
(val & 0x0003) == 0x0001 ? "100 or 200 Mbps" :
|
||||
(val & 0x0003) == 0x0002 ? "1000 Mbps" :
|
||||
(val & 0x0003) == 0x0003 ? "Not forced" : "?");
|
||||
break;
|
||||
case 2:
|
||||
REG(reg, "Jamming Control", val);
|
||||
break;
|
||||
case 3:
|
||||
REG(reg, "Switch Identifier", val);
|
||||
break;
|
||||
case 4:
|
||||
REG(reg, "Port Control", val);
|
||||
FIELD("Source Address Filtering controls", "%s",
|
||||
(val & 0xc000) == 0x0000 ? "Disabled" :
|
||||
(val & 0xc000) == 0x4000 ? "Drop On Lock" :
|
||||
(val & 0xc000) == 0x8000 ? "Drop On Unlock" :
|
||||
(val & 0xc000) == 0xc000 ? "Drop to CPU" : "?");
|
||||
FIELD("Egress Mode", "%s",
|
||||
(val & 0x3000) == 0x0000 ? "Unmodified" :
|
||||
(val & 0x3000) == 0x1000 ? "Untagged" :
|
||||
(val & 0x3000) == 0x2000 ? "Tagged" :
|
||||
(val & 0x3000) == 0x3000 ? "Reserved" : "?");
|
||||
FIELD("Ingress & Egress Header Mode", "%u", !!(val & 0x0800));
|
||||
FIELD("IGMP and MLD Snooping", "%u", !!(val & 0x0400));
|
||||
FIELD("Frame Mode", "%s",
|
||||
(val & 0x0300) == 0x0000 ? "Normal" :
|
||||
(val & 0x0300) == 0x0100 ? "DSA" :
|
||||
(val & 0x0300) == 0x0200 ? "Provider" :
|
||||
(val & 0x0300) == 0x0300 ? "Ether Type DSA" : "?");
|
||||
FIELD("VLAN Tunnel", "%u", !!(val & 0x0080));
|
||||
FIELD("TagIfBoth", "%u", !!(val & 0x0040));
|
||||
FIELD("Initial Priority assignment", "%s",
|
||||
(val & 0x0030) == 0x0000 ? "Defaults" :
|
||||
(val & 0x0030) == 0x0010 ? "Tag Priority" :
|
||||
(val & 0x0030) == 0x0020 ? "IP Priority" :
|
||||
(val & 0x0030) == 0x0030 ? "Tag & IP Priority" : "?");
|
||||
FIELD("Egress Flooding mode", "%s",
|
||||
(val & 0x000c) == 0x0000 ? "No unknown DA" :
|
||||
(val & 0x000c) == 0x0004 ? "No unknown multicast DA" :
|
||||
(val & 0x000c) == 0x0008 ? "No unknown unicast DA" :
|
||||
(val & 0x000c) == 0x000c ? "Allow unknown DA" : "?");
|
||||
FIELD("Port State", "%s",
|
||||
(val & 0x0003) == 0x0000 ? "Disabled" :
|
||||
(val & 0x0003) == 0x0001 ? "Blocking/Listening" :
|
||||
(val & 0x0003) == 0x0002 ? "Learning" :
|
||||
(val & 0x0003) == 0x0003 ? "Forwarding" : "?");
|
||||
break;
|
||||
case 5:
|
||||
REG(reg, "Port Control 1", val);
|
||||
FIELD("Message Port", "%u", !!(val & 0x8000));
|
||||
FIELD("Trunk Port", "%u", !!(val & 0x4000));
|
||||
FIELD("Trunk ID", "%u", (val & 0x0f00) >> 8);
|
||||
FIELD("FID[11:4]", "0x%.3x", (val & 0x00ff) << 4);
|
||||
break;
|
||||
case 6:
|
||||
REG(reg, "Port Base VLAN Map (Header)", val);
|
||||
FIELD("FID[3:0]", "0x%.3x", (val & 0xf000) >> 12);
|
||||
FIELD_BITMAP("VLANTable", val & 0x007f);
|
||||
break;
|
||||
case 7:
|
||||
REG(reg, "Default VLAN ID & Priority", val);
|
||||
FIELD("Default Priority", "0x%x", (val & 0xe000) >> 13);
|
||||
FIELD("Force to use Default VID", "%u", !!(val & 0x1000));
|
||||
FIELD("Default VLAN Identifier", "%u", val & 0x0fff);
|
||||
break;
|
||||
case 8:
|
||||
REG(reg, "Port Control 2", val);
|
||||
FIELD("Force good FCS in the frame", "%u", !!(val & 0x8000));
|
||||
FIELD("Jumbo Mode", "%s",
|
||||
(val & 0x3000) == 0x0000 ? "1522" :
|
||||
(val & 0x3000) == 0x1000 ? "2048" :
|
||||
(val & 0x3000) == 0x2000 ? "10240" :
|
||||
(val & 0x3000) == 0x3000 ? "Reserved" : "?");
|
||||
FIELD("802.1QMode", "%s",
|
||||
(val & 0x0c00) == 0x0000 ? "Disabled" :
|
||||
(val & 0x0c00) == 0x0400 ? "Fallback" :
|
||||
(val & 0x0c00) == 0x0800 ? "Check" :
|
||||
(val & 0x0c00) == 0x0c00 ? "Secure" : "?");
|
||||
FIELD("Discard Tagged Frames", "%u", !!(val & 0x0200));
|
||||
FIELD("Discard Untagged Frames", "%u", !!(val & 0x0100));
|
||||
FIELD("Map using DA hits", "%u", !!(val & 0x0080));
|
||||
FIELD("ARP Mirror enable", "%u", !!(val & 0x0040));
|
||||
FIELD("Egress Monitor Source Port", "%u", !!(val & 0x0020));
|
||||
FIELD("Ingress Monitor Source Port", "%u", !!(val & 0x0010));
|
||||
FIELD("Use Default Queue Priority", "%u", !!(val & 0x0008));
|
||||
FIELD("Default Queue Priority", "0x%x", (val & 0x0006) >> 1);
|
||||
break;
|
||||
case 9:
|
||||
REG(reg, "Egress Rate Control", val);
|
||||
break;
|
||||
case 10:
|
||||
REG(reg, "Egress Rate Control 2", val);
|
||||
break;
|
||||
case 11:
|
||||
REG(reg, "Port Association Vector", val);
|
||||
break;
|
||||
case 12:
|
||||
REG(reg, "Port ATU Control", val);
|
||||
break;
|
||||
case 13:
|
||||
REG(reg, "Override", val);
|
||||
break;
|
||||
case 14:
|
||||
REG(reg, "Policy Control", val);
|
||||
break;
|
||||
case 15:
|
||||
REG(reg, "Port Ether Type", val);
|
||||
break;
|
||||
case 16:
|
||||
REG(reg, "InDiscardsLo Frame Counter", val);
|
||||
break;
|
||||
case 17:
|
||||
REG(reg, "InDiscardsHi Frame Counter", val);
|
||||
break;
|
||||
case 18:
|
||||
REG(reg, "InFiltered/TcamCtr Frame Counter", val);
|
||||
break;
|
||||
case 19:
|
||||
REG(reg, "Rx Frame Counter", val);
|
||||
break;
|
||||
case 22:
|
||||
REG(reg, "LED Control", val);
|
||||
break;
|
||||
case 24:
|
||||
REG(reg, "Tag Remap 0-3", val);
|
||||
break;
|
||||
case 25:
|
||||
REG(reg, "Tag Remap 4-7", val);
|
||||
break;
|
||||
case 27:
|
||||
REG(reg, "Queue Counters", val);
|
||||
break;
|
||||
default:
|
||||
REG(reg, "Reserved", val);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
static void dsa_mv88e6390(int reg, u16 val)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0:
|
||||
REG(reg, "Port Status", val);
|
||||
FIELD("Transmit Pause Enable bit", "%u", !!(val & 0x8000));
|
||||
FIELD("Receive Pause Enable bit", "%u", !!(val & 0x4000));
|
||||
FIELD("802.3 PHY Detected", "%u", !!(val & 0x1000));
|
||||
FIELD("Link Status", "%s", val & 0x0800 ? "Up" : "Down");
|
||||
FIELD("Duplex", "%s", val & 0x0400 ? "Full" : "Half");
|
||||
FIELD("Speed", "%s",
|
||||
(val & 0x0300) == 0x0000 ? "10 Mbps" :
|
||||
(val & 0x0300) == 0x0100 ? "100 or 200 Mbps" :
|
||||
(val & 0x0300) == 0x0200 ? "1000 Mbps" :
|
||||
(val & 0x0300) == 0x0300 ? "10 Gb or 2500 Mbps" : "?");
|
||||
FIELD("Duplex Fixed", "%u", !!(val & 0x0080));
|
||||
FIELD("EEE Enabled", "%u", !!(val & 0x0040));
|
||||
FIELD("Transmitter Paused", "%u", !!(val & 0x0020));
|
||||
FIELD("Flow Control", "%u", !!(val & 0x0010));
|
||||
FIELD("Config Mode", "0x%x", val & 0x000f);
|
||||
break;
|
||||
case 1:
|
||||
REG(reg, "Physical Control", val);
|
||||
FIELD("RGMII Receive Timing Control", "%s", val & 0x8000 ? "Delay" : "Default");
|
||||
FIELD("RGMII Transmit Timing Control", "%s", val & 0x4000 ? "Delay" : "Default");
|
||||
FIELD("Force Speed", "%u", !!(val & 0x2000));
|
||||
FIELD("Alternate Speed Mode", "%s", val & 0x1000 ? "Alternate" : "Normal");
|
||||
FIELD("MII PHY Mode", "%s", val & 0x0800 ? "PHY" : "MAC");
|
||||
FIELD("EEE force value", "%u", !!(val & 0x0200));
|
||||
FIELD("Force EEE", "%u", !!(val & 0x0100));
|
||||
FIELD("Link's Forced value", "%s", val & 0x0020 ? "Up" : "Down");
|
||||
FIELD("Force Link", "%u", !!(val & 0x0010));
|
||||
FIELD("Duplex's Forced value", "%s", val & 0x0008 ? "Full" : "Half");
|
||||
FIELD("Force Duplex", "%u", !!(val & 0x0004));
|
||||
FIELD("Force Speed", "%s",
|
||||
(val & 0x0003) == 0x0000 ? "10 Mbps" :
|
||||
(val & 0x0003) == 0x0001 ? "100 or 200 Mbps" :
|
||||
(val & 0x0003) == 0x0002 ? "1000 Mbps" :
|
||||
(val & 0x0003) == 0x0003 ? "10 Gb or 2500 Mbps" : "?");
|
||||
break;
|
||||
case 2:
|
||||
REG(reg, "Flow Control", val);
|
||||
break;
|
||||
case 3:
|
||||
REG(reg, "Switch Identifier", val);
|
||||
break;
|
||||
case 4:
|
||||
REG(reg, "Port Control", val);
|
||||
FIELD("Source Address Filtering controls", "%s",
|
||||
(val & 0xc000) == 0x0000 ? "Disabled" :
|
||||
(val & 0xc000) == 0x4000 ? "Drop On Lock" :
|
||||
(val & 0xc000) == 0x8000 ? "Drop On Unlock" :
|
||||
(val & 0xc000) == 0xc000 ? "Drop to CPU" : "?");
|
||||
FIELD("Egress Mode", "%s",
|
||||
(val & 0x3000) == 0x0000 ? "Unmodified" :
|
||||
(val & 0x3000) == 0x1000 ? "Untagged" :
|
||||
(val & 0x3000) == 0x2000 ? "Tagged" :
|
||||
(val & 0x3000) == 0x3000 ? "Reserved" : "?");
|
||||
FIELD("Ingress & Egress Header Mode", "%u", !!(val & 0x0800));
|
||||
FIELD("IGMP and MLD Snooping", "%u", !!(val & 0x0400));
|
||||
FIELD("Frame Mode", "%s",
|
||||
(val & 0x0300) == 0x0000 ? "Normal" :
|
||||
(val & 0x0300) == 0x0100 ? "DSA" :
|
||||
(val & 0x0300) == 0x0200 ? "Provider" :
|
||||
(val & 0x0300) == 0x0300 ? "Ether Type DSA" : "?");
|
||||
FIELD("VLAN Tunnel", "%u", !!(val & 0x0080));
|
||||
FIELD("TagIfBoth", "%u", !!(val & 0x0040));
|
||||
FIELD("Initial Priority assignment", "%s",
|
||||
(val & 0x0030) == 0x0000 ? "Defaults" :
|
||||
(val & 0x0030) == 0x0010 ? "Tag Priority" :
|
||||
(val & 0x0030) == 0x0020 ? "IP Priority" :
|
||||
(val & 0x0030) == 0x0030 ? "Tag & IP Priority" : "?");
|
||||
FIELD("Egress Flooding mode", "%s",
|
||||
(val & 0x000c) == 0x0000 ? "No unknown DA" :
|
||||
(val & 0x000c) == 0x0004 ? "No unknown multicast DA" :
|
||||
(val & 0x000c) == 0x0008 ? "No unknown unicast DA" :
|
||||
(val & 0x000c) == 0x000c ? "Allow unknown DA" : "?");
|
||||
FIELD("Port State", "%s",
|
||||
(val & 0x0003) == 0x0000 ? "Disabled" :
|
||||
(val & 0x0003) == 0x0001 ? "Blocking/Listening" :
|
||||
(val & 0x0003) == 0x0002 ? "Learning" :
|
||||
(val & 0x0003) == 0x0003 ? "Forwarding" : "?");
|
||||
break;
|
||||
case 5:
|
||||
REG(reg, "Port Control 1", val);
|
||||
FIELD("Message Port", "%u", !!(val & 0x8000));
|
||||
FIELD("LAG Port", "%u", !!(val & 0x4000));
|
||||
FIELD("VTU Page", "%u", !!(val & 0x2000));
|
||||
FIELD("LAG ID", "%u", (val & 0x0f00) >> 8);
|
||||
FIELD("FID[11:4]", "0x%.3x", (val & 0x00ff) << 4);
|
||||
break;
|
||||
case 6:
|
||||
REG(reg, "Port Base VLAN Map (Header)", val);
|
||||
FIELD("FID[3:0]", "0x%.3x", (val & 0xf000) >> 12);
|
||||
FIELD("Force Mapping", "%u", !!(val & 0x0800));
|
||||
FIELD_BITMAP("VLANTable", val & 0x007ff);
|
||||
break;
|
||||
case 7:
|
||||
REG(reg, "Default VLAN ID & Priority", val);
|
||||
FIELD("Default Priority", "0x%x", (val & 0xe000) >> 13);
|
||||
FIELD("Force to use Default VID", "%u", !!(val & 0x1000));
|
||||
FIELD("Default VLAN Identifier", "%u", val & 0x0fff);
|
||||
break;
|
||||
case 8:
|
||||
REG(reg, "Port Control 2", val);
|
||||
FIELD("Force good FCS in the frame", "%u", !!(val & 0x8000));
|
||||
FIELD("Allow bad FCS", "%u", !!(val & 0x4000));
|
||||
FIELD("Jumbo Mode", "%s",
|
||||
(val & 0x3000) == 0x0000 ? "1522" :
|
||||
(val & 0x3000) == 0x1000 ? "2048" :
|
||||
(val & 0x3000) == 0x2000 ? "10240" :
|
||||
(val & 0x3000) == 0x3000 ? "Reserved" : "?");
|
||||
FIELD("802.1QMode", "%s",
|
||||
(val & 0x0c00) == 0x0000 ? "Disabled" :
|
||||
(val & 0x0c00) == 0x0400 ? "Fallback" :
|
||||
(val & 0x0c00) == 0x0800 ? "Check" :
|
||||
(val & 0x0c00) == 0x0c00 ? "Secure" : "?");
|
||||
FIELD("Discard Tagged Frames", "%u", !!(val & 0x0200));
|
||||
FIELD("Discard Untagged Frames", "%u", !!(val & 0x0100));
|
||||
FIELD("Map using DA hits", "%u", !!(val & 0x0080));
|
||||
FIELD("ARP Mirror enable", "%u", !!(val & 0x0040));
|
||||
FIELD("Egress Monitor Source Port", "%u", !!(val & 0x0020));
|
||||
FIELD("Ingress Monitor Source Port", "%u", !!(val & 0x0010));
|
||||
FIELD("Allow VID of Zero", "%u", !!(val & 0x0008));
|
||||
FIELD("Default Queue Priority", "0x%x", val & 0x0007);
|
||||
break;
|
||||
case 9:
|
||||
REG(reg, "Egress Rate Control", val);
|
||||
break;
|
||||
case 10:
|
||||
REG(reg, "Egress Rate Control 2", val);
|
||||
break;
|
||||
case 11:
|
||||
REG(reg, "Port Association Vector", val);
|
||||
break;
|
||||
case 12:
|
||||
REG(reg, "Port ATU Control", val);
|
||||
break;
|
||||
case 13:
|
||||
REG(reg, "Override", val);
|
||||
break;
|
||||
case 14:
|
||||
REG(reg, "Policy Control", val);
|
||||
break;
|
||||
case 15:
|
||||
REG(reg, "Port Ether Type", val);
|
||||
break;
|
||||
case 22:
|
||||
REG(reg, "LED Control", val);
|
||||
break;
|
||||
case 23:
|
||||
REG(reg, "IP Priority Mapping Table", val);
|
||||
break;
|
||||
case 24:
|
||||
REG(reg, "IEEE Priority Mapping Table", val);
|
||||
break;
|
||||
case 25:
|
||||
REG(reg, "Port Control 3", val);
|
||||
break;
|
||||
case 27:
|
||||
REG(reg, "Queue Counters", val);
|
||||
break;
|
||||
case 28:
|
||||
REG(reg, "Queue Control", val);
|
||||
break;
|
||||
case 30:
|
||||
REG(reg, "Cut Through Control", val);
|
||||
break;
|
||||
case 31:
|
||||
REG(reg, "Debug Counters", val);
|
||||
break;
|
||||
default:
|
||||
REG(reg, "Reserved", val);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
struct dsa_mv88e6xxx_switch {
|
||||
void (*dump)(int reg, u16 val);
|
||||
const char *name;
|
||||
u16 id;
|
||||
};
|
||||
|
||||
static const struct dsa_mv88e6xxx_switch dsa_mv88e6xxx_switches[] = {
|
||||
{ .id = 0x04a0, .name = "88E6085 ", .dump = NULL },
|
||||
{ .id = 0x0950, .name = "88E6095 ", .dump = NULL },
|
||||
{ .id = 0x0990, .name = "88E6097 ", .dump = NULL },
|
||||
{ .id = 0x0a00, .name = "88E6190X", .dump = dsa_mv88e6390 },
|
||||
{ .id = 0x0a10, .name = "88E6390X", .dump = dsa_mv88e6390 },
|
||||
{ .id = 0x1060, .name = "88E6131 ", .dump = NULL },
|
||||
{ .id = 0x1150, .name = "88E6320 ", .dump = NULL },
|
||||
{ .id = 0x1210, .name = "88E6123 ", .dump = dsa_mv88e6161 },
|
||||
{ .id = 0x1610, .name = "88E6161 ", .dump = dsa_mv88e6161 },
|
||||
{ .id = 0x1650, .name = "88E6165 ", .dump = NULL },
|
||||
{ .id = 0x1710, .name = "88E6171 ", .dump = NULL },
|
||||
{ .id = 0x1720, .name = "88E6172 ", .dump = dsa_mv88e6352 },
|
||||
{ .id = 0x1750, .name = "88E6175 ", .dump = NULL },
|
||||
{ .id = 0x1760, .name = "88E6176 ", .dump = dsa_mv88e6352 },
|
||||
{ .id = 0x1900, .name = "88E6190 ", .dump = dsa_mv88e6390 },
|
||||
{ .id = 0x1910, .name = "88E6191 ", .dump = NULL },
|
||||
{ .id = 0x1a70, .name = "88E6185 ", .dump = dsa_mv88e6185 },
|
||||
{ .id = 0x2400, .name = "88E6240 ", .dump = dsa_mv88e6352 },
|
||||
{ .id = 0x2900, .name = "88E6290 ", .dump = dsa_mv88e6390 },
|
||||
{ .id = 0x3100, .name = "88E6321 ", .dump = NULL },
|
||||
{ .id = 0x3400, .name = "88E6141 ", .dump = NULL },
|
||||
{ .id = 0x3410, .name = "88E6341 ", .dump = NULL },
|
||||
{ .id = 0x3520, .name = "88E6352 ", .dump = dsa_mv88e6352 },
|
||||
{ .id = 0x3710, .name = "88E6350 ", .dump = NULL },
|
||||
{ .id = 0x3750, .name = "88E6351 ", .dump = NULL },
|
||||
{ .id = 0x3900, .name = "88E6390 ", .dump = dsa_mv88e6390 },
|
||||
};
|
||||
|
||||
static int dsa_mv88e6xxx_dump_regs(struct ethtool_regs *regs)
|
||||
{
|
||||
const struct dsa_mv88e6xxx_switch *sw = NULL;
|
||||
const u16 *data = (u16 *)regs->data;
|
||||
u16 id;
|
||||
int i;
|
||||
|
||||
/* Marvell chips have 32 per-port 16-bit registers */
|
||||
if (regs->len < 32 * 2)
|
||||
return 1;
|
||||
|
||||
id = regs->version & 0xfff0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dsa_mv88e6xxx_switches); i++) {
|
||||
if (id == dsa_mv88e6xxx_switches[i].id) {
|
||||
sw = &dsa_mv88e6xxx_switches[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sw)
|
||||
return 1;
|
||||
|
||||
printf("%s Switch Port Registers\n", sw->name);
|
||||
printf("------------------------------\n");
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
if (sw->dump)
|
||||
sw->dump(i, data[i]);
|
||||
else
|
||||
REG(i, "", data[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef FIELD_BITMAP
|
||||
#undef FIELD
|
||||
#undef REG
|
||||
|
||||
int dsa_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
/* DSA per-driver register dump */
|
||||
if (!dsa_mv88e6xxx_dump_regs(regs))
|
||||
return 0;
|
||||
|
||||
/* Fallback to hexdump */
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/* Copyright (c) 2002 Intel Corporation */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define D102_REV_ID 12
|
||||
|
||||
#define MDI_MDIX_CONFIG_IS_OK 0x0010
|
||||
#define MDI_MDIX_STATUS 0x0020
|
||||
|
||||
#define SOFT_INT 0x0200 /* Generate a S/W interrupt */
|
||||
|
||||
/* Interrupt masks */
|
||||
#define ALL_INT_MASK 0x0100 /* Mask interrupts */
|
||||
#define FCP_INT_MASK 0x0400 /* Flow Control Pause */
|
||||
#define ER_INT_MASK 0x0800 /* Early Receive */
|
||||
#define RNR_INT_MASK 0x1000 /* RU Not Ready */
|
||||
#define CNA_INT_MASK 0x2000 /* CU Not Active */
|
||||
#define FR_INT_MASK 0x4000 /* Frame Received */
|
||||
#define CX_INT_MASK 0x8000 /* CU eXecution w/ I-bit done */
|
||||
|
||||
/* Interrupts pending */
|
||||
#define FCP_INT_PENDING 0x0100 /* Flow Control Pause */
|
||||
#define ER_INT_PENDING 0x0200 /* Early Receive */
|
||||
#define SWI_INT_PENDING 0x0400 /* S/W generated interrupt */
|
||||
#define MDI_INT_PENDING 0x0800 /* MDI read or write done */
|
||||
#define RNR_INT_PENDING 0x1000 /* RU Became Not Ready */
|
||||
#define CNA_INT_PENDING 0x2000 /* CU Became Inactive (IDLE) */
|
||||
#define FR_INT_PENDING 0x4000 /* RU Received A Frame */
|
||||
#define CX_INT_PENDING 0x8000 /* CU Completed Action Cmd */
|
||||
|
||||
/* Status */
|
||||
#define CU_STATUS 0x00C0
|
||||
#define RU_STATUS 0x003C
|
||||
|
||||
/* Commands */
|
||||
#define CU_CMD 0x00F0
|
||||
#define RU_CMD 0x0007
|
||||
|
||||
int e100_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
u8 rev_id = (u8)(regs->version);
|
||||
u8 regs_len = regs->len / sizeof(u32);
|
||||
u32 reg;
|
||||
u16 scb_status, scb_cmd;
|
||||
|
||||
if (version != 1)
|
||||
return -1;
|
||||
|
||||
reg = regs_buff[0];
|
||||
scb_status = reg & 0x0000ffff;
|
||||
scb_cmd = reg >> 16;
|
||||
fprintf(stdout,
|
||||
"SCB Status Word (Lower Word) 0x%04X\n",
|
||||
scb_status);
|
||||
|
||||
switch ((scb_status & RU_STATUS) >> 2) {
|
||||
case 0:
|
||||
fprintf(stdout,
|
||||
" RU Status: Idle\n");
|
||||
break;
|
||||
case 1:
|
||||
fprintf(stdout,
|
||||
" RU Status: Suspended\n");
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stdout,
|
||||
" RU Status: No Resources\n");
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stdout,
|
||||
" RU Status: Ready\n");
|
||||
break;
|
||||
case 9:
|
||||
fprintf(stdout,
|
||||
" RU Status: Suspended with no more RBDs\n");
|
||||
break;
|
||||
case 10:
|
||||
fprintf(stdout,
|
||||
" RU Status: No Resources due to no more RBDs\n");
|
||||
break;
|
||||
case 12:
|
||||
fprintf(stdout,
|
||||
" RU Status: Ready with no RBDs present\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout,
|
||||
" RU Status: Unknown State\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((scb_status & CU_STATUS) >> 6) {
|
||||
case 0:
|
||||
fprintf(stdout,
|
||||
" CU Status: Idle\n");
|
||||
break;
|
||||
case 1:
|
||||
fprintf(stdout,
|
||||
" CU Status: Suspended\n");
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stdout,
|
||||
" CU Status: Active\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout,
|
||||
" CU Status: Unknown State\n");
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stdout,
|
||||
" ---- Interrupts Pending ----\n"
|
||||
" Flow Control Pause: %s\n"
|
||||
" Early Receive: %s\n"
|
||||
" Software Generated Interrupt: %s\n"
|
||||
" MDI Done: %s\n"
|
||||
" RU Not In Ready State: %s\n"
|
||||
" CU Not in Active State: %s\n"
|
||||
" RU Received Frame: %s\n"
|
||||
" CU Completed Command: %s\n",
|
||||
scb_status & FCP_INT_PENDING ? "yes" : "no",
|
||||
scb_status & ER_INT_PENDING ? "yes" : "no",
|
||||
scb_status & SWI_INT_PENDING ? "yes" : "no",
|
||||
scb_status & MDI_INT_PENDING ? "yes" : "no",
|
||||
scb_status & RNR_INT_PENDING ? "yes" : "no",
|
||||
scb_status & CNA_INT_PENDING ? "yes" : "no",
|
||||
scb_status & FR_INT_PENDING ? "yes" : "no",
|
||||
scb_status & CX_INT_PENDING ? "yes" : "no");
|
||||
|
||||
fprintf(stdout,
|
||||
"SCB Command Word (Upper Word) 0x%04X\n",
|
||||
scb_cmd);
|
||||
|
||||
switch (scb_cmd & RU_CMD) {
|
||||
case 0:
|
||||
fprintf(stdout,
|
||||
" RU Command: No Command\n");
|
||||
break;
|
||||
case 1:
|
||||
fprintf(stdout,
|
||||
" RU Command: RU Start\n");
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stdout,
|
||||
" RU Command: RU Resume\n");
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stdout,
|
||||
" RU Command: RU Abort\n");
|
||||
break;
|
||||
case 6:
|
||||
fprintf(stdout,
|
||||
" RU Command: Load RU Base\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout,
|
||||
" RU Command: Unknown\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((scb_cmd & CU_CMD) >> 4) {
|
||||
case 0:
|
||||
fprintf(stdout,
|
||||
" CU Command: No Command\n");
|
||||
break;
|
||||
case 1:
|
||||
fprintf(stdout,
|
||||
" CU Command: CU Start\n");
|
||||
break;
|
||||
case 2:
|
||||
fprintf(stdout,
|
||||
" CU Command: CU Resume\n");
|
||||
break;
|
||||
case 4:
|
||||
fprintf(stdout,
|
||||
" CU Command: Load Dump Counters Address\n");
|
||||
break;
|
||||
case 5:
|
||||
fprintf(stdout,
|
||||
" CU Command: Dump Counters\n");
|
||||
break;
|
||||
case 6:
|
||||
fprintf(stdout,
|
||||
" CU Command: Load CU Base\n");
|
||||
break;
|
||||
case 7:
|
||||
fprintf(stdout,
|
||||
" CU Command: Dump & Reset Counters\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout,
|
||||
" CU Command: Unknown\n");
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stdout,
|
||||
" Software Generated Interrupt: %s\n",
|
||||
scb_cmd & SOFT_INT ? "yes" : "no");
|
||||
|
||||
fprintf(stdout,
|
||||
" ---- Interrupts Masked ----\n"
|
||||
" ALL Interrupts: %s\n"
|
||||
" Flow Control Pause: %s\n"
|
||||
" Early Receive: %s\n"
|
||||
" RU Not In Ready State: %s\n"
|
||||
" CU Not in Active State: %s\n"
|
||||
" RU Received Frame: %s\n"
|
||||
" CU Completed Command: %s\n",
|
||||
scb_cmd & ALL_INT_MASK ? "yes" : "no",
|
||||
scb_cmd & FCP_INT_MASK ? "yes" : "no",
|
||||
scb_cmd & ER_INT_MASK ? "yes" : "no",
|
||||
scb_cmd & RNR_INT_MASK ? "yes" : "no",
|
||||
scb_cmd & CNA_INT_MASK ? "yes" : "no",
|
||||
scb_cmd & FR_INT_MASK ? "yes" : "no",
|
||||
scb_cmd & CX_INT_MASK ? "yes" : "no");
|
||||
|
||||
if(regs_len > 1) {
|
||||
fprintf(stdout, "MDI/MDI-X Status: ");
|
||||
if(rev_id < D102_REV_ID)
|
||||
fprintf(stdout, "MDI\n");
|
||||
else {
|
||||
u16 ctrl_reg = regs_buff[1];
|
||||
|
||||
if(ctrl_reg & MDI_MDIX_CONFIG_IS_OK) {
|
||||
if(ctrl_reg & MDI_MDIX_STATUS)
|
||||
fprintf(stdout, "MDI-X\n");
|
||||
else
|
||||
fprintf(stdout, "MDI\n");
|
||||
} else
|
||||
fprintf(stdout, "Unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,640 @@
|
|||
/* Copyright (c) 2002 Intel Corporation */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
/* Register Bit Masks */
|
||||
/* Device Control */
|
||||
#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */
|
||||
#define E1000_CTRL_BEM 0x00000002 /* Endian Mode.0=little,1=big */
|
||||
#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */
|
||||
#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */
|
||||
#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */
|
||||
#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */
|
||||
#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */
|
||||
#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */
|
||||
#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */
|
||||
#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */
|
||||
#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */
|
||||
#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */
|
||||
#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */
|
||||
#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */
|
||||
#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */
|
||||
#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */
|
||||
#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */
|
||||
#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */
|
||||
#define E1000_CTRL_SWDPIN2 0x00100000 /* SWDPIN 2 value */
|
||||
#define E1000_CTRL_SWDPIN3 0x00200000 /* SWDPIN 3 value */
|
||||
#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */
|
||||
#define E1000_CTRL_SWDPIO1 0x00800000 /* SWDPIN 1 input or output */
|
||||
#define E1000_CTRL_SWDPIO2 0x01000000 /* SWDPIN 2 input or output */
|
||||
#define E1000_CTRL_SWDPIO3 0x02000000 /* SWDPIN 3 input or output */
|
||||
#define E1000_CTRL_RST 0x04000000 /* Global reset */
|
||||
#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */
|
||||
#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */
|
||||
#define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */
|
||||
#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */
|
||||
#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */
|
||||
|
||||
/* Device Status */
|
||||
#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
|
||||
#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
|
||||
#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */
|
||||
#define E1000_STATUS_FUNC_0 0x00000000 /* Function 0 */
|
||||
#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */
|
||||
#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */
|
||||
#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */
|
||||
#define E1000_STATUS_SPEED_MASK 0x000000C0
|
||||
#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */
|
||||
#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
|
||||
#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
|
||||
#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */
|
||||
#define E1000_STATUS_MTXCKOK 0x00000400 /* MTX clock running OK */
|
||||
#define E1000_STATUS_PCI66 0x00000800 /* In 66Mhz slot */
|
||||
#define E1000_STATUS_BUS64 0x00001000 /* In 64 bit slot */
|
||||
#define E1000_STATUS_PCIX_MODE 0x00002000 /* PCI-X mode */
|
||||
#define E1000_STATUS_PCIX_SPEED 0x0000C000 /* PCI-X bus speed */
|
||||
|
||||
/* Constants used to intrepret the masked PCI-X bus speed. */
|
||||
#define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus speed 50-66 MHz */
|
||||
#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed 66-100 MHz */
|
||||
#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus speed 100-133 MHz */
|
||||
|
||||
/* Receive Control */
|
||||
#define E1000_RCTL_RST 0x00000001 /* Software reset */
|
||||
#define E1000_RCTL_EN 0x00000002 /* enable */
|
||||
#define E1000_RCTL_SBP 0x00000004 /* store bad packet */
|
||||
#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */
|
||||
#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */
|
||||
#define E1000_RCTL_LPE 0x00000020 /* long packet enable */
|
||||
#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */
|
||||
#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */
|
||||
#define E1000_RCTL_LBM_SLP 0x00000080 /* serial link loopback mode */
|
||||
#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */
|
||||
#define E1000_RCTL_RDMTS 0x00000300 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */
|
||||
#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 11:0 */
|
||||
#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 12:1 */
|
||||
#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 13:2 */
|
||||
#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */
|
||||
#define E1000_RCTL_MDR 0x00004000 /* multicast desc ring 0 */
|
||||
#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */
|
||||
#define E1000_RCTL_SZ 0x00030000 /* rx buffer size */
|
||||
/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */
|
||||
#define E1000_RCTL_SZ_2048 0x00000000 /* rx buffer size 2048 */
|
||||
#define E1000_RCTL_SZ_1024 0x00010000 /* rx buffer size 1024 */
|
||||
#define E1000_RCTL_SZ_512 0x00020000 /* rx buffer size 512 */
|
||||
#define E1000_RCTL_SZ_256 0x00030000 /* rx buffer size 256 */
|
||||
/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */
|
||||
#define E1000_RCTL_SZ_16384 0x00010000 /* rx buffer size 16384 */
|
||||
#define E1000_RCTL_SZ_8192 0x00020000 /* rx buffer size 8192 */
|
||||
#define E1000_RCTL_SZ_4096 0x00030000 /* rx buffer size 4096 */
|
||||
#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */
|
||||
#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */
|
||||
#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */
|
||||
#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */
|
||||
#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */
|
||||
#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */
|
||||
|
||||
/* Transmit Control */
|
||||
#define E1000_TCTL_RST 0x00000001 /* software reset */
|
||||
#define E1000_TCTL_EN 0x00000002 /* enable tx */
|
||||
#define E1000_TCTL_BCE 0x00000004 /* busy check enable */
|
||||
#define E1000_TCTL_PSP 0x00000008 /* pad short packets */
|
||||
#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */
|
||||
#define E1000_TCTL_COLD 0x003ff000 /* collision distance */
|
||||
#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */
|
||||
#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */
|
||||
#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */
|
||||
#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */
|
||||
|
||||
/* M88E1000 PHY Specific Status Register */
|
||||
#define M88_PSSR_JABBER 0x0001 /* 1=Jabber */
|
||||
#define M88_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */
|
||||
#define M88_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */
|
||||
#define M88_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */
|
||||
#define M88_PSSR_CABLE_LENGTH 0x0380 /* 0=<50M;1=50-80M;2=80-110M;
|
||||
* 3=110-140M;4=>140M */
|
||||
#define M88_PSSR_LINK 0x0400 /* 1=Link up, 0=Link down */
|
||||
#define M88_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */
|
||||
#define M88_PSSR_PAGE_RCVD 0x1000 /* 1=Page received */
|
||||
#define M88_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */
|
||||
#define M88_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */
|
||||
#define M88_PSSR_10MBS 0x0000 /* 00=10Mbs */
|
||||
#define M88_PSSR_100MBS 0x4000 /* 01=100Mbs */
|
||||
#define M88_PSSR_1000MBS 0x8000 /* 10=1000Mbs */
|
||||
|
||||
#define M88_PSSR_CL_0_50 (0<<7)
|
||||
#define M88_PSSR_CL_50_80 (1<<7)
|
||||
#define M88_PSSR_CL_80_110 (2<<7)
|
||||
#define M88_PSSR_CL_110_140 (3<<7)
|
||||
#define M88_PSSR_CL_140_PLUS (4<<7)
|
||||
|
||||
/* M88E1000 PHY Specific Control Register */
|
||||
#define M88_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */
|
||||
#define M88_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */
|
||||
#define M88_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */
|
||||
#define M88_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low,
|
||||
* 0=CLK125 toggling
|
||||
*/
|
||||
#define M88_PSCR_MDI_MASK 0x0060
|
||||
#define M88_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */
|
||||
/* Manual MDI configuration */
|
||||
#define M88_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */
|
||||
#define M88_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover,
|
||||
* 100BASE-TX/10BASE-T:
|
||||
* MDI Mode
|
||||
*/
|
||||
#define M88_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled
|
||||
* all speeds.
|
||||
*/
|
||||
#define M88_PSCR_10BT_EXT_DIST_ENABLE 0x0080
|
||||
/* 1=Enable Extended 10BASE-T distance
|
||||
* (Lower 10BASE-T RX Threshold)
|
||||
* 0=Normal 10BASE-T RX Threshold */
|
||||
#define M88_PSCR_MII_5BIT_ENABLE 0x0100
|
||||
/* 1=5-Bit interface in 100BASE-TX
|
||||
* 0=MII interface in 100BASE-TX */
|
||||
#define M88_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */
|
||||
#define M88_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */
|
||||
#define M88_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */
|
||||
|
||||
#define M88_PSCR_POLARITY_REVERSAL_SHIFT 1
|
||||
#define M88_PSCR_AUTO_X_MODE_SHIFT 5
|
||||
#define M88_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7
|
||||
|
||||
/* PCI Device IDs */
|
||||
#define E1000_DEV_ID_82542 0x1000
|
||||
#define E1000_DEV_ID_82543GC_FIBER 0x1001
|
||||
#define E1000_DEV_ID_82543GC_COPPER 0x1004
|
||||
#define E1000_DEV_ID_82544EI_COPPER 0x1008
|
||||
#define E1000_DEV_ID_82544EI_FIBER 0x1009
|
||||
#define E1000_DEV_ID_82544GC_COPPER 0x100C
|
||||
#define E1000_DEV_ID_82544GC_LOM 0x100D
|
||||
#define E1000_DEV_ID_82540EM 0x100E
|
||||
#define E1000_DEV_ID_82540EM_LOM 0x1015
|
||||
#define E1000_DEV_ID_82540EP_LOM 0x1016
|
||||
#define E1000_DEV_ID_82540EP 0x1017
|
||||
#define E1000_DEV_ID_82540EP_LP 0x101E
|
||||
#define E1000_DEV_ID_82545EM_COPPER 0x100F
|
||||
#define E1000_DEV_ID_82545EM_FIBER 0x1011
|
||||
#define E1000_DEV_ID_82545GM_COPPER 0x1026
|
||||
#define E1000_DEV_ID_82545GM_FIBER 0x1027
|
||||
#define E1000_DEV_ID_82545GM_SERDES 0x1028
|
||||
#define E1000_DEV_ID_82546EB_COPPER 0x1010
|
||||
#define E1000_DEV_ID_82546EB_FIBER 0x1012
|
||||
#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D
|
||||
#define E1000_DEV_ID_82546GB_COPPER 0x1079
|
||||
#define E1000_DEV_ID_82546GB_FIBER 0x107A
|
||||
#define E1000_DEV_ID_82546GB_SERDES 0x107B
|
||||
#define E1000_DEV_ID_82546GB_PCIE 0x108A
|
||||
#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099
|
||||
#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5
|
||||
#define E1000_DEV_ID_82541EI 0x1013
|
||||
#define E1000_DEV_ID_82541EI_MOBILE 0x1018
|
||||
#define E1000_DEV_ID_82541ER_LOM 0x1014
|
||||
#define E1000_DEV_ID_82541ER 0x1078
|
||||
#define E1000_DEV_ID_82541GI 0x1076
|
||||
#define E1000_DEV_ID_82541GI_LF 0x107C
|
||||
#define E1000_DEV_ID_82541GI_MOBILE 0x1077
|
||||
#define E1000_DEV_ID_82547EI 0x1019
|
||||
#define E1000_DEV_ID_82547EI_MOBILE 0x101A
|
||||
#define E1000_DEV_ID_82547GI 0x1075
|
||||
#define E1000_DEV_ID_82571EB_COPPER 0x105E
|
||||
#define E1000_DEV_ID_82571EB_FIBER 0x105F
|
||||
#define E1000_DEV_ID_82571EB_SERDES 0x1060
|
||||
#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
|
||||
#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
|
||||
#define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC
|
||||
#define E1000_DEV_ID_82572EI_COPPER 0x107D
|
||||
#define E1000_DEV_ID_82572EI_FIBER 0x107E
|
||||
#define E1000_DEV_ID_82572EI_SERDES 0x107F
|
||||
#define E1000_DEV_ID_82572EI 0x10B9
|
||||
#define E1000_DEV_ID_82573E 0x108B
|
||||
#define E1000_DEV_ID_82573E_IAMT 0x108C
|
||||
#define E1000_DEV_ID_82573L 0x109A
|
||||
#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
|
||||
#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
|
||||
#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA
|
||||
#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB
|
||||
#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049
|
||||
#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A
|
||||
#define E1000_DEV_ID_ICH8_IGP_C 0x104B
|
||||
#define E1000_DEV_ID_ICH8_IFE 0x104C
|
||||
#define E1000_DEV_ID_ICH8_IFE_GT 0x10C4
|
||||
#define E1000_DEV_ID_ICH8_IFE_G 0x10C5
|
||||
#define E1000_DEV_ID_ICH8_IGP_M 0x104D
|
||||
|
||||
#define E1000_82542_2_0_REV_ID 2
|
||||
#define E1000_82542_2_1_REV_ID 3
|
||||
|
||||
/* Enumerated types specific to the e1000 hardware */
|
||||
/* Media Access Controlers */
|
||||
enum e1000_mac_type {
|
||||
e1000_undefined = 0,
|
||||
e1000_82542,
|
||||
e1000_82543,
|
||||
e1000_82544,
|
||||
e1000_82540,
|
||||
e1000_82545,
|
||||
e1000_82545_rev_3,
|
||||
e1000_82546,
|
||||
e1000_82546_rev_3,
|
||||
e1000_82541,
|
||||
e1000_82541_rev_2,
|
||||
e1000_82547,
|
||||
e1000_82547_rev_2,
|
||||
e1000_82571,
|
||||
e1000_82572,
|
||||
e1000_82573,
|
||||
e1000_80003es2lan,
|
||||
e1000_ich8lan,
|
||||
e1000_num_macs
|
||||
};
|
||||
|
||||
static enum e1000_mac_type e1000_get_mac_type(u16 device_id)
|
||||
{
|
||||
enum e1000_mac_type mac_type = e1000_undefined;
|
||||
|
||||
switch (device_id) {
|
||||
case E1000_DEV_ID_82542:
|
||||
mac_type = e1000_82542;
|
||||
break;
|
||||
case E1000_DEV_ID_82543GC_FIBER:
|
||||
case E1000_DEV_ID_82543GC_COPPER:
|
||||
mac_type = e1000_82543;
|
||||
break;
|
||||
case E1000_DEV_ID_82544EI_COPPER:
|
||||
case E1000_DEV_ID_82544EI_FIBER:
|
||||
case E1000_DEV_ID_82544GC_COPPER:
|
||||
case E1000_DEV_ID_82544GC_LOM:
|
||||
mac_type = e1000_82544;
|
||||
break;
|
||||
case E1000_DEV_ID_82540EM:
|
||||
case E1000_DEV_ID_82540EM_LOM:
|
||||
case E1000_DEV_ID_82540EP:
|
||||
case E1000_DEV_ID_82540EP_LOM:
|
||||
case E1000_DEV_ID_82540EP_LP:
|
||||
mac_type = e1000_82540;
|
||||
break;
|
||||
case E1000_DEV_ID_82545EM_COPPER:
|
||||
case E1000_DEV_ID_82545EM_FIBER:
|
||||
mac_type = e1000_82545;
|
||||
break;
|
||||
case E1000_DEV_ID_82545GM_COPPER:
|
||||
case E1000_DEV_ID_82545GM_FIBER:
|
||||
case E1000_DEV_ID_82545GM_SERDES:
|
||||
mac_type = e1000_82545_rev_3;
|
||||
break;
|
||||
case E1000_DEV_ID_82546EB_COPPER:
|
||||
case E1000_DEV_ID_82546EB_FIBER:
|
||||
case E1000_DEV_ID_82546EB_QUAD_COPPER:
|
||||
mac_type = e1000_82546;
|
||||
break;
|
||||
case E1000_DEV_ID_82546GB_COPPER:
|
||||
case E1000_DEV_ID_82546GB_FIBER:
|
||||
case E1000_DEV_ID_82546GB_SERDES:
|
||||
case E1000_DEV_ID_82546GB_PCIE:
|
||||
case E1000_DEV_ID_82546GB_QUAD_COPPER:
|
||||
case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
|
||||
mac_type = e1000_82546_rev_3;
|
||||
break;
|
||||
case E1000_DEV_ID_82541EI:
|
||||
case E1000_DEV_ID_82541EI_MOBILE:
|
||||
case E1000_DEV_ID_82541ER_LOM:
|
||||
mac_type = e1000_82541;
|
||||
break;
|
||||
case E1000_DEV_ID_82541ER:
|
||||
case E1000_DEV_ID_82541GI:
|
||||
case E1000_DEV_ID_82541GI_LF:
|
||||
case E1000_DEV_ID_82541GI_MOBILE:
|
||||
mac_type = e1000_82541_rev_2;
|
||||
break;
|
||||
case E1000_DEV_ID_82547EI:
|
||||
case E1000_DEV_ID_82547EI_MOBILE:
|
||||
mac_type = e1000_82547;
|
||||
break;
|
||||
case E1000_DEV_ID_82547GI:
|
||||
mac_type = e1000_82547_rev_2;
|
||||
break;
|
||||
case E1000_DEV_ID_82571EB_COPPER:
|
||||
case E1000_DEV_ID_82571EB_FIBER:
|
||||
case E1000_DEV_ID_82571EB_SERDES:
|
||||
case E1000_DEV_ID_82571EB_QUAD_COPPER:
|
||||
case E1000_DEV_ID_82571EB_QUAD_FIBER:
|
||||
case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
|
||||
mac_type = e1000_82571;
|
||||
break;
|
||||
case E1000_DEV_ID_82572EI:
|
||||
case E1000_DEV_ID_82572EI_COPPER:
|
||||
case E1000_DEV_ID_82572EI_FIBER:
|
||||
case E1000_DEV_ID_82572EI_SERDES:
|
||||
mac_type = e1000_82572;
|
||||
break;
|
||||
case E1000_DEV_ID_82573E:
|
||||
case E1000_DEV_ID_82573E_IAMT:
|
||||
case E1000_DEV_ID_82573L:
|
||||
mac_type = e1000_82573;
|
||||
break;
|
||||
case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
|
||||
case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
|
||||
case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
|
||||
case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
|
||||
mac_type = e1000_80003es2lan;
|
||||
break;
|
||||
case E1000_DEV_ID_ICH8_IFE:
|
||||
case E1000_DEV_ID_ICH8_IFE_GT:
|
||||
case E1000_DEV_ID_ICH8_IFE_G:
|
||||
case E1000_DEV_ID_ICH8_IGP_M:
|
||||
case E1000_DEV_ID_ICH8_IGP_M_AMT:
|
||||
case E1000_DEV_ID_ICH8_IGP_AMT:
|
||||
case E1000_DEV_ID_ICH8_IGP_C:
|
||||
mac_type = e1000_ich8lan;
|
||||
break;
|
||||
default:
|
||||
/* assume old nic and attempt so user can get limited
|
||||
* functionality */
|
||||
mac_type = e1000_82543;
|
||||
break;
|
||||
}
|
||||
|
||||
return mac_type;
|
||||
}
|
||||
|
||||
int e1000_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
u16 hw_device_id = (u16)regs->version;
|
||||
/* u8 hw_revision_id = (u8)(regs->version >> 16); */
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
enum e1000_mac_type mac_type;
|
||||
u32 reg;
|
||||
|
||||
if (version != 1)
|
||||
return -1;
|
||||
|
||||
mac_type = e1000_get_mac_type(hw_device_id);
|
||||
|
||||
if(mac_type == e1000_undefined)
|
||||
return -1;
|
||||
|
||||
fprintf(stdout, "MAC Registers\n");
|
||||
fprintf(stdout, "-------------\n");
|
||||
|
||||
/* Device control register */
|
||||
reg = regs_buff[0];
|
||||
fprintf(stdout,
|
||||
"0x00000: CTRL (Device control register) 0x%08X\n"
|
||||
" Endian mode (buffers): %s\n"
|
||||
" Link reset: %s\n"
|
||||
" Set link up: %s\n"
|
||||
" Invert Loss-Of-Signal: %s\n"
|
||||
" Receive flow control: %s\n"
|
||||
" Transmit flow control: %s\n"
|
||||
" VLAN mode: %s\n",
|
||||
reg,
|
||||
reg & E1000_CTRL_BEM ? "big" : "little",
|
||||
reg & E1000_CTRL_LRST ? "reset" : "normal",
|
||||
reg & E1000_CTRL_SLU ? "1" : "0",
|
||||
reg & E1000_CTRL_ILOS ? "yes" : "no",
|
||||
reg & E1000_CTRL_RFCE ? "enabled" : "disabled",
|
||||
reg & E1000_CTRL_TFCE ? "enabled" : "disabled",
|
||||
reg & E1000_CTRL_VME ? "enabled" : "disabled");
|
||||
if(mac_type >= e1000_82543) {
|
||||
fprintf(stdout,
|
||||
" Auto speed detect: %s\n"
|
||||
" Speed select: %s\n"
|
||||
" Force speed: %s\n"
|
||||
" Force duplex: %s\n",
|
||||
reg & E1000_CTRL_ASDE ? "enabled" : "disabled",
|
||||
(reg & E1000_CTRL_SPD_SEL) == E1000_CTRL_SPD_10 ? "10Mb/s" :
|
||||
(reg & E1000_CTRL_SPD_SEL) == E1000_CTRL_SPD_100 ? "100Mb/s" :
|
||||
(reg & E1000_CTRL_SPD_SEL) == E1000_CTRL_SPD_1000 ? "1000Mb/s" :
|
||||
"not used",
|
||||
reg & E1000_CTRL_FRCSPD ? "yes" : "no",
|
||||
reg & E1000_CTRL_FRCDPX ? "yes" : "no");
|
||||
}
|
||||
|
||||
/* Device status register */
|
||||
reg = regs_buff[1];
|
||||
fprintf(stdout,
|
||||
"0x00008: STATUS (Device status register) 0x%08X\n"
|
||||
" Duplex: %s\n"
|
||||
" Link up: %s\n",
|
||||
reg,
|
||||
reg & E1000_STATUS_FD ? "full" : "half",
|
||||
reg & E1000_STATUS_LU ? "link config" : "no link config");
|
||||
if (mac_type >= e1000_82571) {
|
||||
fprintf(stdout,
|
||||
" TBI mode: %s\n"
|
||||
" Link speed: %s\n"
|
||||
" Bus type: %s\n"
|
||||
" Port number: %s\n",
|
||||
reg & E1000_STATUS_TBIMODE ? "enabled" : "disabled",
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_10 ?
|
||||
"10Mb/s" :
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_100 ?
|
||||
"100Mb/s" :
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_1000 ?
|
||||
"1000Mb/s" : "not used",
|
||||
"PCI Express",
|
||||
(reg & E1000_STATUS_FUNC_MASK) == 0 ? "0" : "1");
|
||||
}
|
||||
else if (mac_type >= e1000_82543) {
|
||||
fprintf(stdout,
|
||||
" TBI mode: %s\n"
|
||||
" Link speed: %s\n"
|
||||
" Bus type: %s\n"
|
||||
" Bus speed: %s\n"
|
||||
" Bus width: %s\n",
|
||||
reg & E1000_STATUS_TBIMODE ? "enabled" : "disabled",
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_10 ?
|
||||
"10Mb/s" :
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_100 ?
|
||||
"100Mb/s" :
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_1000 ?
|
||||
"1000Mb/s" : "not used",
|
||||
(reg & E1000_STATUS_PCIX_MODE) ? "PCI-X" : "PCI",
|
||||
(reg & E1000_STATUS_PCIX_MODE) ?
|
||||
((reg & E1000_STATUS_PCIX_SPEED_133) ? "133MHz" :
|
||||
(reg & E1000_STATUS_PCIX_SPEED_100) ? "100MHz" :
|
||||
"66MHz") :
|
||||
((reg & E1000_STATUS_PCI66) ? "66MHz" : "33MHz"),
|
||||
(reg & E1000_STATUS_BUS64) ? "64-bit" : "32-bit");
|
||||
}
|
||||
|
||||
/* Receive control register */
|
||||
reg = regs_buff[2];
|
||||
fprintf(stdout,
|
||||
"0x00100: RCTL (Receive control register) 0x%08X\n"
|
||||
" Receiver: %s\n"
|
||||
" Store bad packets: %s\n"
|
||||
" Unicast promiscuous: %s\n"
|
||||
" Multicast promiscuous: %s\n"
|
||||
" Long packet: %s\n"
|
||||
" Descriptor minimum threshold size: %s\n"
|
||||
" Broadcast accept mode: %s\n"
|
||||
" VLAN filter: %s\n"
|
||||
" Canonical form indicator: %s\n"
|
||||
" Discard pause frames: %s\n"
|
||||
" Pass MAC control frames: %s\n",
|
||||
reg,
|
||||
reg & E1000_RCTL_EN ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_SBP ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_UPE ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_MPE ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_LPE ? "enabled" : "disabled",
|
||||
(reg & E1000_RCTL_RDMTS) == E1000_RCTL_RDMTS_HALF ? "1/2" :
|
||||
(reg & E1000_RCTL_RDMTS) == E1000_RCTL_RDMTS_QUAT ? "1/4" :
|
||||
(reg & E1000_RCTL_RDMTS) == E1000_RCTL_RDMTS_EIGTH ? "1/8" :
|
||||
"reserved",
|
||||
reg & E1000_RCTL_BAM ? "accept" : "ignore",
|
||||
reg & E1000_RCTL_VFE ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_CFIEN ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_DPF ? "ignored" : "filtered",
|
||||
reg & E1000_RCTL_PMCF ? "pass" : "don't pass");
|
||||
if(mac_type >= e1000_82543) {
|
||||
fprintf(stdout,
|
||||
" Receive buffer size: %s\n",
|
||||
reg & E1000_RCTL_BSEX ?
|
||||
((reg & E1000_RCTL_SZ)==E1000_RCTL_SZ_16384 ? "16384" :
|
||||
(reg & E1000_RCTL_SZ)==E1000_RCTL_SZ_8192 ? "8192" :
|
||||
(reg & E1000_RCTL_SZ)==E1000_RCTL_SZ_4096 ? "4096" :
|
||||
"reserved") :
|
||||
((reg & E1000_RCTL_SZ)==E1000_RCTL_SZ_2048 ? "2048" :
|
||||
(reg & E1000_RCTL_SZ)==E1000_RCTL_SZ_1024 ? "1024" :
|
||||
(reg & E1000_RCTL_SZ)==E1000_RCTL_SZ_512 ? "512" :
|
||||
"256"));
|
||||
} else {
|
||||
fprintf(stdout,
|
||||
" Receive buffer size: %s\n",
|
||||
(reg & E1000_RCTL_SZ) == E1000_RCTL_SZ_2048 ? "2048" :
|
||||
(reg & E1000_RCTL_SZ) == E1000_RCTL_SZ_1024 ? "1024" :
|
||||
(reg & E1000_RCTL_SZ) == E1000_RCTL_SZ_512 ? "512" :
|
||||
"256");
|
||||
}
|
||||
|
||||
/* Receive descriptor registers */
|
||||
fprintf(stdout,
|
||||
"0x02808: RDLEN (Receive desc length) 0x%08X\n",
|
||||
regs_buff[3]);
|
||||
fprintf(stdout,
|
||||
"0x02810: RDH (Receive desc head) 0x%08X\n",
|
||||
regs_buff[4]);
|
||||
fprintf(stdout,
|
||||
"0x02818: RDT (Receive desc tail) 0x%08X\n",
|
||||
regs_buff[5]);
|
||||
fprintf(stdout,
|
||||
"0x02820: RDTR (Receive delay timer) 0x%08X\n",
|
||||
regs_buff[6]);
|
||||
|
||||
/* Transmit control register */
|
||||
reg = regs_buff[7];
|
||||
fprintf(stdout,
|
||||
"0x00400: TCTL (Transmit ctrl register) 0x%08X\n"
|
||||
" Transmitter: %s\n"
|
||||
" Pad short packets: %s\n"
|
||||
" Software XOFF Transmission: %s\n",
|
||||
reg,
|
||||
reg & E1000_TCTL_EN ? "enabled" : "disabled",
|
||||
reg & E1000_TCTL_PSP ? "enabled" : "disabled",
|
||||
reg & E1000_TCTL_SWXOFF ? "enabled" : "disabled");
|
||||
if(mac_type >= e1000_82543) {
|
||||
fprintf(stdout,
|
||||
" Re-transmit on late collision: %s\n",
|
||||
reg & E1000_TCTL_RTLC ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
/* Transmit descriptor registers */
|
||||
fprintf(stdout,
|
||||
"0x03808: TDLEN (Transmit desc length) 0x%08X\n",
|
||||
regs_buff[8]);
|
||||
fprintf(stdout,
|
||||
"0x03810: TDH (Transmit desc head) 0x%08X\n",
|
||||
regs_buff[9]);
|
||||
fprintf(stdout,
|
||||
"0x03818: TDT (Transmit desc tail) 0x%08X\n",
|
||||
regs_buff[10]);
|
||||
fprintf(stdout,
|
||||
"0x03820: TIDV (Transmit delay timer) 0x%08X\n",
|
||||
regs_buff[11]);
|
||||
|
||||
/* PHY type */
|
||||
fprintf(stdout,
|
||||
"PHY type: %s\n",
|
||||
regs_buff[12] == 0 ? "M88" :
|
||||
regs_buff[12] == 1 ? "IGP" :
|
||||
regs_buff[12] == 2 ? "IGP2" : "unknown" );
|
||||
|
||||
if (0 == regs_buff[12]) {
|
||||
reg = regs_buff[13];
|
||||
fprintf(stdout,
|
||||
"M88 PHY STATUS REGISTER: 0x%08X\n"
|
||||
" Jabber: %s\n"
|
||||
" Polarity: %s\n"
|
||||
" Downshifted: %s\n"
|
||||
" MDI/MDIX: %s\n"
|
||||
" Cable Length Estimate: %s meters\n"
|
||||
" Link State: %s\n"
|
||||
" Speed & Duplex Resolved: %s\n"
|
||||
" Page Received: %s\n"
|
||||
" Duplex: %s\n"
|
||||
" Speed: %s mbps\n",
|
||||
reg,
|
||||
reg & M88_PSSR_JABBER ? "yes" : "no",
|
||||
reg & M88_PSSR_REV_POLARITY ? "reverse" : "normal",
|
||||
reg & M88_PSSR_DOWNSHIFT ? "yes" : "no",
|
||||
reg & M88_PSSR_MDIX ? "MDIX" : "MDI",
|
||||
((reg & M88_PSSR_CABLE_LENGTH)==M88_PSSR_CL_0_50 ? "0-50"
|
||||
: (reg & M88_PSSR_CABLE_LENGTH)==M88_PSSR_CL_50_80 ? "50-80"
|
||||
: (reg & M88_PSSR_CABLE_LENGTH)==M88_PSSR_CL_80_110 ? "80-110"
|
||||
: (reg & M88_PSSR_CABLE_LENGTH)==M88_PSSR_CL_110_140? "110-140"
|
||||
: (reg & M88_PSSR_CABLE_LENGTH)==M88_PSSR_CL_140_PLUS ? "140+"
|
||||
: "unknown"),
|
||||
reg & M88_PSSR_LINK ? "Up" : "Down",
|
||||
reg & M88_PSSR_SPD_DPLX_RESOLVED ? "Yes" : "No",
|
||||
reg & M88_PSSR_PAGE_RCVD ? "Yes" : "No",
|
||||
reg & M88_PSSR_DPLX ? "Full" : "Half",
|
||||
((reg & M88_PSSR_SPEED)==M88_PSSR_10MBS ? "10"
|
||||
: (reg & M88_PSSR_SPEED)==M88_PSSR_100MBS ? "100"
|
||||
: (reg & M88_PSSR_SPEED)==M88_PSSR_1000MBS ? "1000"
|
||||
: "unknown")
|
||||
);
|
||||
|
||||
reg = regs_buff[17];
|
||||
fprintf(stdout,
|
||||
"M88 PHY CONTROL REGISTER: 0x%08X\n"
|
||||
" Jabber function: %s\n"
|
||||
" Auto-polarity: %s\n"
|
||||
" SQE Test: %s\n"
|
||||
" CLK125: %s\n"
|
||||
" Auto-MDIX: %s\n"
|
||||
" Extended 10Base-T Distance: %s\n"
|
||||
" 100Base-TX Interface: %s\n"
|
||||
" Scrambler: %s\n"
|
||||
" Force Link Good: %s\n"
|
||||
" Assert CRS on Transmit: %s\n",
|
||||
reg,
|
||||
reg & M88_PSCR_JABBER_DISABLE ? "disabled" : "enabled",
|
||||
reg & M88_PSCR_POLARITY_REVERSAL ? "enabled" : "disabled",
|
||||
reg & M88_PSCR_SQE_TEST ? "enabled" : "disabled",
|
||||
reg & M88_PSCR_CLK125_DISABLE ? "disabled" : "enabled",
|
||||
((reg & M88_PSCR_MDI_MASK)==M88_PSCR_MDI_MANUAL_MODE ? "force MDI"
|
||||
: (reg & M88_PSCR_MDI_MASK)==M88_PSCR_MDIX_MANUAL_MODE ? "force MDIX"
|
||||
: (reg & M88_PSCR_MDI_MASK)==M88_PSCR_AUTO_X_1000T ? "1000 auto, 10/100 MDI"
|
||||
: (reg & M88_PSCR_MDI_MASK)==M88_PSCR_AUTO_X_MODE ? "auto"
|
||||
: "wtf"),
|
||||
reg & M88_PSCR_10BT_EXT_DIST_ENABLE ? "enabled" : "disabled",
|
||||
reg & M88_PSCR_MII_5BIT_ENABLE ? "5-bit" : "MII",
|
||||
reg & M88_PSCR_SCRAMBLER_DISABLE ? "disabled" : "enabled",
|
||||
reg & M88_PSCR_FORCE_LINK_GOOD ? "forced" : "disabled",
|
||||
reg & M88_PSCR_ASSERT_CRS_ON_TX ? "enabled" : "disabled"
|
||||
);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal.h"
|
||||
|
||||
int et131x_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
u32 *reg = (u32 *)regs->data;
|
||||
|
||||
if (version != 1)
|
||||
return -1;
|
||||
|
||||
fprintf(stdout, "PHY Registers\n");
|
||||
fprintf(stdout, "0x0, Basic Control Reg = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1, Basic Status Reg = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x2, PHY identifier 1 = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x3, PHY identifier 2 = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x4, Auto Neg Advertisement = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x5, Auto Neg L Partner Ability = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x6, Auto Neg Expansion = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x7, Reserved = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x8, Reserved = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x9, 1000T Control = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xA, 1000T Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xB, Reserved = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xC, Reserved = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xD, MMD Access Control = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xE, MMD access Data = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xF, Extended Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x10, Phy Index = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x11, Phy Data = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x12, MPhy Control = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x13, Phy Loopback Control1 = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x14, Phy Loopback Control2 = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x15, Register Management = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x16, Phy Config = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x17, Phy Phy Control = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x18, Phy Interrupt Mask = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x19, Phy Interrupt Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1A, Phy Phy Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1B, Phy LED1 = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1C, Phy LED2 = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "JAGCore Global Registers\n");
|
||||
fprintf(stdout, "0x0, TXQ Start Address = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1, TXQ End Address = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x2, RXQ Start Address = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x3, RXQ End Address = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x4, Power Management Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x5, Interrupt Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x6, Interrupt Mask = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x7, Int Alias Clear Mask = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x8, Int Status Alias = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x9, Software Reset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xA, SLV Timer = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xB, MSI Config = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xC, Loopback = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xD, Watchdog Timer = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "TXDMA Registers\n");
|
||||
fprintf(stdout, "0x0, Control Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1, Packet Ring Base Addr (Hi) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x2, Packet Ring Base Addr (Lo) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x3, Packet Ring Num Descrs = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x4, TX Queue Write Address = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x5, TX Queue Write Address Ext = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x6, TX Queue Read Address = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x7, Status Writeback Addr (Hi) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x8, Status Writeback Addr (Lo) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x9, Service Request = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xA, Service Complete = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xB, Cache Read Index = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xC, Cache Write Index = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xD, TXDMA Error = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xE, Descriptor Abort Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xF, Payload Abort Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x10, Writeback Abort Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x11, Descriptor Timeout Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x12, Payload Timeout Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x13, Writeback Timeout Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x14, Descriptor Error Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x15, Payload Error Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x16, Writeback Error Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x17, Dropped TLP Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x18, New service Complete = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1A, Ethernet Packet Count = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "RXDMA Registers\n");
|
||||
fprintf(stdout, "0x0, Control Status = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1, Writeback Addr (Hi) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x2, Writeback Addr (Lo) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x3, Num Packets Done = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x4, Max Packet Time = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x5, RX Queue Read Addr = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x6, RX Queue Read Address Ext = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x7, RX Queue Write Addr = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x8, Packet Ring Base Addr (Hi) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x9, Packet Ring Base Addr (Lo) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xA, Packet Ring Num Descrs = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xE, Packet Ring Avail Offset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0xF, Packet Ring Full Offset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x10, Packet Ring Access Index = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x11, Packet Ring Min Descrip = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x12, FBR0 Address (Lo) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x13, FBR0 Address (Hi) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x14, FBR0 Num Descriptors = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x15, FBR0 Available Offset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x16, FBR0 Full Offset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x17, FBR0 Read Index = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x18, FBR0 Minimum Descriptors = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x19, FBR1 Address (Lo) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1A, FBR1 Address (Hi) = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1B, FBR1 Num Descriptors = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1C, FBR1 Available Offset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1D, FBR1 Full Offset = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1E, FBR1 Read Index = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "0x1F, FBR1 Minimum Descriptors = 0x%04X\n", *reg++);
|
||||
fprintf(stdout, "\n");
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/* ethtool-config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define this to enable register, EEPROM and SFP pretty dumps. */
|
||||
#undef ETHTOOL_ENABLE_PRETTY_DUMP
|
||||
|
||||
/* Define to 1 if <linux/types.h> defines big-endian types */
|
||||
#undef HAVE_BE_TYPES
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have the `strtol' function. */
|
||||
#undef HAVE_STRTOL
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,40 @@
|
|||
Name : ethtool
|
||||
Version : 5.4
|
||||
Release : 1
|
||||
Group : Utilities
|
||||
|
||||
Summary : Settings tool for Ethernet and other network devices
|
||||
|
||||
License : GPL
|
||||
URL : https://ftp.kernel.org/pub/software/network/ethtool/
|
||||
|
||||
Buildroot : %{_tmppath}/%{name}-%{version}
|
||||
Source : %{name}-%{version}.tar.gz
|
||||
|
||||
|
||||
%description
|
||||
This utility allows querying and changing settings such as speed,
|
||||
port, auto-negotiation, PCI locations and checksum offload on many
|
||||
network devices, especially Ethernet devices.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
|
||||
%build
|
||||
CFLAGS="${RPM_OPT_FLAGS}" ./configure --prefix=%{_prefix} --mandir=%{_mandir}
|
||||
make
|
||||
|
||||
|
||||
%install
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/ethtool
|
||||
%{_mandir}/man8/ethtool.8*
|
||||
%doc AUTHORS COPYING NEWS README
|
||||
|
||||
|
||||
%changelog
|
|
@ -0,0 +1,40 @@
|
|||
Name : @PACKAGE@
|
||||
Version : @VERSION@
|
||||
Release : 1
|
||||
Group : Utilities
|
||||
|
||||
Summary : Settings tool for Ethernet and other network devices
|
||||
|
||||
License : GPL
|
||||
URL : https://ftp.kernel.org/pub/software/network/ethtool/
|
||||
|
||||
Buildroot : %{_tmppath}/%{name}-%{version}
|
||||
Source : %{name}-%{version}.tar.gz
|
||||
|
||||
|
||||
%description
|
||||
This utility allows querying and changing settings such as speed,
|
||||
port, auto-negotiation, PCI locations and checksum offload on many
|
||||
network devices, especially Ethernet devices.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
|
||||
%build
|
||||
CFLAGS="${RPM_OPT_FLAGS}" ./configure --prefix=%{_prefix} --mandir=%{_mandir}
|
||||
make
|
||||
|
||||
|
||||
%install
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/ethtool
|
||||
%{_mandir}/man8/ethtool.8*
|
||||
%doc AUTHORS COPYING NEWS README
|
||||
|
||||
|
||||
%changelog
|
|
@ -0,0 +1,220 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/* Macros and dump functions for the 32-bit "fec" driver registers */
|
||||
|
||||
#define REG(_reg, _name, _val) \
|
||||
printf("0x%.03x: %-44.44s 0x%.8x\n", _reg, _name, _val)
|
||||
|
||||
#define FIELD(_name, _fmt, ...) \
|
||||
printf(" %-47.47s " _fmt "\n", _name, ##__VA_ARGS__)
|
||||
|
||||
static void fec_dump_reg_v1(int reg, u32 val)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0x000: /* FEC_ECNTRL */
|
||||
case 0x004: /* FEC_IEVENT */
|
||||
case 0x008: /* FEC_IMASK */
|
||||
case 0x00c: /* FEC_IVEC */
|
||||
case 0x010: /* FEC_R_DES_ACTIVE_0 */
|
||||
case 0x014: /* FEC_X_DES_ACTIVE_0 */
|
||||
case 0x040: /* FEC_MII_DATA */
|
||||
case 0x044: /* FEC_MII_SPEED */
|
||||
case 0x08c: /* FEC_R_BOUND */
|
||||
case 0x090: /* FEC_R_FSTART */
|
||||
case 0x0a4: /* FEC_X_WMRK */
|
||||
case 0x0ac: /* FEC_X_FSTART */
|
||||
case 0x104: /* FEC_R_CNTRL */
|
||||
case 0x108: /* FEC_MAX_FRM_LEN */
|
||||
case 0x144: /* FEC_X_CNTRL */
|
||||
case 0x3c0: /* FEC_ADDR_LOW */
|
||||
case 0x3c4: /* FEC_ADDR_HIGH */
|
||||
case 0x3c8: /* FEC_GRP_HASH_TABLE_HIGH */
|
||||
case 0x3cc: /* FEC_GRP_HASH_TABLE_LOW */
|
||||
case 0x3d0: /* FEC_R_DES_START_0 */
|
||||
case 0x3d4: /* FEC_X_DES_START_0 */
|
||||
case 0x3d8: /* FEC_R_BUFF_SIZE_0 */
|
||||
REG(reg, "", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void fec_dump_reg_v2(int reg, u32 val)
|
||||
{
|
||||
switch (reg) {
|
||||
case 0x084: /* FEC_R_CNTRL */
|
||||
REG(reg, "RCR (Receive Control Register)", val);
|
||||
FIELD("MAX_FL (Maximum frame length)", "%u", (val & 0x07ff0000) >> 16);
|
||||
FIELD("FCE (Flow control enable)", "%u", !!(val & 0x00000020));
|
||||
FIELD("BC_REJ (Broadcast frame reject)", "%u", !!(val & 0x00000010));
|
||||
FIELD("PROM (Promiscuous mode)", "%u", !!(val & 0x00000008));
|
||||
FIELD("DRT (Disable receive on transmit)", "%u", !!(val & 0x00000002));
|
||||
FIELD("LOOP (Internal loopback)", "%u", !!(val & 0x00000001));
|
||||
break;
|
||||
case 0x0c4: /* FEC_X_CNTRL */
|
||||
REG(reg, "TCR (Transmit Control Register)", val);
|
||||
FIELD("RFC_PAUSE (Receive frame control pause)", "%u", !!(val & 0x00000010));
|
||||
FIELD("TFC_PAUSE (Transmit frame control pause)", "%u", !!(val & 0x00000008));
|
||||
FIELD("FDEN (Full duplex enable)", "%u", !!(val & 0x00000004));
|
||||
FIELD("HBC (Heartbeat control)", "%u", !!(val & 0x00000002));
|
||||
FIELD("GTS (Graceful transmit stop)", "%u", !!(val & 0x00000001));
|
||||
break;
|
||||
case 0x118: /* FEC_HASH_TABLE_HIGH */
|
||||
REG(reg, "IAUR (Individual Address Upper Register)", val);
|
||||
FIELD("IADDR1", "0x%.16llx", (u64)((u64)val) << 32);
|
||||
break;
|
||||
case 0x11c: /* FEC_HASH_TABLE_LOW */
|
||||
REG(reg, "IALR (Individual Address Lower Register)", val);
|
||||
FIELD("IADDR2", "0x%.16x", val);
|
||||
break;
|
||||
case 0x120: /* FEC_GRP_HASH_TABLE_HIGH */
|
||||
REG(reg, "GAUR (Group Address Upper Register)", val);
|
||||
FIELD("GADDR1", "0x%.16llx", (u64)((u64)val) << 32);
|
||||
break;
|
||||
case 0x124: /* FEC_GRP_HASH_TABLE_LOW */
|
||||
REG(reg, "GALR (Group Address Lower Register)", val);
|
||||
FIELD("GADDR2", "0x%.16x", val);
|
||||
break;
|
||||
case 0x144: /* FEC_X_WMRK */
|
||||
REG(reg, "TFWR (Transmit FIFO Watermark Register)", val);
|
||||
FIELD("X_WMRK", "%s",
|
||||
(val & 0x00000003) == 0x00000000 ? "64 bytes" :
|
||||
(val & 0x00000003) == 0x00000002 ? "128 bytes" :
|
||||
(val & 0x00000003) == 0x00000003 ? "192 bytes" : "?");
|
||||
break;
|
||||
case 0x14c: /* FEC_R_BOUND */
|
||||
REG(reg, "FRBR (FIFO Receive Bound Register)", val);
|
||||
FIELD("R_BOUND (Highest valid FIFO RAM address)", "0x%.2x", (val & 0x000003fc) >> 2);
|
||||
break;
|
||||
case 0x188: /* FEC_R_BUFF_SIZE_0 */
|
||||
REG(reg, "EMRBR (Maximum Receive Buffer Size)", val);
|
||||
FIELD("R_BUF_SIZE (Receive buffer size)", "%u", (val & 0x000007f0) >> 4);
|
||||
break;
|
||||
case 0x004: /* FEC_IEVENT */
|
||||
case 0x008: /* FEC_IMASK */
|
||||
case 0x010: /* FEC_R_DES_ACTIVE_0 */
|
||||
case 0x014: /* FEC_X_DES_ACTIVE_0 */
|
||||
case 0x024: /* FEC_ECNTRL */
|
||||
case 0x040: /* FEC_MII_DATA */
|
||||
case 0x044: /* FEC_MII_SPEED */
|
||||
case 0x064: /* FEC_MIB_CTRLSTAT */
|
||||
case 0x0e4: /* FEC_ADDR_LOW */
|
||||
case 0x0e8: /* FEC_ADDR_HIGH */
|
||||
case 0x0ec: /* FEC_OPD */
|
||||
case 0x0f0: /* FEC_TXIC0 */
|
||||
case 0x0f4: /* FEC_TXIC1 */
|
||||
case 0x0f8: /* FEC_TXIC2 */
|
||||
case 0x100: /* FEC_RXIC0 */
|
||||
case 0x104: /* FEC_RXIC1 */
|
||||
case 0x108: /* FEC_RXIC2 */
|
||||
case 0x150: /* FEC_R_FSTART */
|
||||
case 0x160: /* FEC_R_DES_START_1 */
|
||||
case 0x164: /* FEC_X_DES_START_1 */
|
||||
case 0x168: /* FEC_R_BUFF_SIZE_1 */
|
||||
case 0x16c: /* FEC_R_DES_START_2 */
|
||||
case 0x170: /* FEC_X_DES_START_2 */
|
||||
case 0x174: /* FEC_R_BUFF_SIZE_2 */
|
||||
case 0x180: /* FEC_R_DES_START_0 */
|
||||
case 0x184: /* FEC_X_DES_START_0 */
|
||||
case 0x190: /* FEC_R_FIFO_RSFL */
|
||||
case 0x194: /* FEC_R_FIFO_RSEM */
|
||||
case 0x198: /* FEC_R_FIFO_RAEM */
|
||||
case 0x19c: /* FEC_R_FIFO_RAFL */
|
||||
case 0x1c4: /* FEC_RACC */
|
||||
case 0x1c8: /* FEC_RCMR_1 */
|
||||
case 0x1cc: /* FEC_RCMR_2 */
|
||||
case 0x1d8: /* FEC_DMA_CFG_1 */
|
||||
case 0x1dc: /* FEC_DMA_CFG_2 */
|
||||
case 0x1e0: /* FEC_R_DES_ACTIVE_1 */
|
||||
case 0x1e4: /* FEC_X_DES_ACTIVE_1 */
|
||||
case 0x1e8: /* FEC_R_DES_ACTIVE_2 */
|
||||
case 0x1ec: /* FEC_X_DES_ACTIVE_2 */
|
||||
case 0x1f0: /* FEC_QOS_SCHEME */
|
||||
case 0x200: /* RMON_T_DROP */
|
||||
case 0x204: /* RMON_T_PACKETS */
|
||||
case 0x208: /* RMON_T_BC_PKT */
|
||||
case 0x20c: /* RMON_T_MC_PKT */
|
||||
case 0x210: /* RMON_T_CRC_ALIGN */
|
||||
case 0x214: /* RMON_T_UNDERSIZE */
|
||||
case 0x218: /* RMON_T_OVERSIZE */
|
||||
case 0x21c: /* RMON_T_FRAG */
|
||||
case 0x220: /* RMON_T_JAB */
|
||||
case 0x224: /* RMON_T_COL */
|
||||
case 0x228: /* RMON_T_P64 */
|
||||
case 0x22c: /* RMON_T_P65TO127 */
|
||||
case 0x230: /* RMON_T_P128TO255 */
|
||||
case 0x234: /* RMON_T_P256TO511 */
|
||||
case 0x238: /* RMON_T_P512TO1023 */
|
||||
case 0x23c: /* RMON_T_P1024TO2047 */
|
||||
case 0x240: /* RMON_T_P_GTE2048 */
|
||||
case 0x244: /* RMON_T_OCTETS */
|
||||
case 0x248: /* IEEE_T_DROP */
|
||||
case 0x24c: /* IEEE_T_FRAME_OK */
|
||||
case 0x250: /* IEEE_T_1COL */
|
||||
case 0x254: /* IEEE_T_MCOL */
|
||||
case 0x258: /* IEEE_T_DEF */
|
||||
case 0x25c: /* IEEE_T_LCOL */
|
||||
case 0x260: /* IEEE_T_EXCOL */
|
||||
case 0x264: /* IEEE_T_MACERR */
|
||||
case 0x268: /* IEEE_T_CSERR */
|
||||
case 0x26c: /* IEEE_T_SQE */
|
||||
case 0x270: /* IEEE_T_FDXFC */
|
||||
case 0x274: /* IEEE_T_OCTETS_OK */
|
||||
case 0x284: /* RMON_R_PACKETS */
|
||||
case 0x288: /* RMON_R_BC_PKT */
|
||||
case 0x28c: /* RMON_R_MC_PKT */
|
||||
case 0x290: /* RMON_R_CRC_ALIGN */
|
||||
case 0x294: /* RMON_R_UNDERSIZE */
|
||||
case 0x298: /* RMON_R_OVERSIZE */
|
||||
case 0x29c: /* RMON_R_FRAG */
|
||||
case 0x2a0: /* RMON_R_JAB */
|
||||
case 0x2a4: /* RMON_R_RESVD_O */
|
||||
case 0x2a8: /* RMON_R_P64 */
|
||||
case 0x2ac: /* RMON_R_P65TO127 */
|
||||
case 0x2b0: /* RMON_R_P128TO255 */
|
||||
case 0x2b4: /* RMON_R_P256TO511 */
|
||||
case 0x2b8: /* RMON_R_P512TO1023 */
|
||||
case 0x2bc: /* RMON_R_P1024TO2047 */
|
||||
case 0x2c0: /* RMON_R_P_GTE2048 */
|
||||
case 0x2c4: /* RMON_R_OCTETS */
|
||||
case 0x2c8: /* IEEE_R_DROP */
|
||||
case 0x2cc: /* IEEE_R_FRAME_OK */
|
||||
case 0x2d0: /* IEEE_R_CRC */
|
||||
case 0x2d4: /* IEEE_R_ALIGN */
|
||||
case 0x2d8: /* IEEE_R_MACERR */
|
||||
case 0x2dc: /* IEEE_R_FDXFC */
|
||||
case 0x2e0: /* IEEE_R_OCTETS_OK */
|
||||
REG(reg, "", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#undef FIELD
|
||||
#undef REG
|
||||
|
||||
int fec_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
const u32 *data = (u32 *)regs->data;
|
||||
int offset;
|
||||
u32 val;
|
||||
|
||||
for (offset = 0; offset < regs->len; offset += 4) {
|
||||
val = data[offset / 4];
|
||||
|
||||
switch (regs->version) {
|
||||
case 1:
|
||||
fec_dump_reg_v1(offset, val);
|
||||
break;
|
||||
case 2:
|
||||
fec_dump_reg_v2(offset, val);
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (C) 2004 Intracom S.A.
|
||||
* Pantelis Antoniou <panto@intracom.gr>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
struct fec {
|
||||
uint32_t addr_low; /* lower 32 bits of station address */
|
||||
uint32_t addr_high; /* upper 16 bits of station address||0 */
|
||||
uint32_t hash_table_high;/* upper 32-bits of hash table */
|
||||
uint32_t hash_table_low; /* lower 32-bits of hash table */
|
||||
uint32_t r_des_start; /* beginning of Rx descriptor ring */
|
||||
uint32_t x_des_start; /* beginning of Tx descriptor ring */
|
||||
uint32_t r_buff_size; /* Rx buffer size */
|
||||
uint32_t res2[9]; /* reserved */
|
||||
uint32_t ecntrl; /* ethernet control register */
|
||||
uint32_t ievent; /* interrupt event register */
|
||||
uint32_t imask; /* interrupt mask register */
|
||||
uint32_t ivec; /* interrupt level and vector status */
|
||||
uint32_t r_des_active; /* Rx ring updated flag */
|
||||
uint32_t x_des_active; /* Tx ring updated flag */
|
||||
uint32_t res3[10]; /* reserved */
|
||||
uint32_t mii_data; /* MII data register */
|
||||
uint32_t mii_speed; /* MII speed control register */
|
||||
uint32_t res4[17]; /* reserved */
|
||||
uint32_t r_bound; /* end of RAM (read-only) */
|
||||
uint32_t r_fstart; /* Rx FIFO start address */
|
||||
uint32_t res5[6]; /* reserved */
|
||||
uint32_t x_fstart; /* Tx FIFO start address */
|
||||
uint32_t res6[17]; /* reserved */
|
||||
uint32_t fun_code; /* fec SDMA function code */
|
||||
uint32_t res7[3]; /* reserved */
|
||||
uint32_t r_cntrl; /* Rx control register */
|
||||
uint32_t r_hash; /* Rx hash register */
|
||||
uint32_t res8[14]; /* reserved */
|
||||
uint32_t x_cntrl; /* Tx control register */
|
||||
uint32_t res9[0x1e]; /* reserved */
|
||||
};
|
||||
|
||||
#define DUMP_REG(f, x) fprintf(stdout, \
|
||||
"0x%04lx: %-16s 0x%08x\n", \
|
||||
(unsigned long)(offsetof(struct fec, x)), \
|
||||
#x, f->x)
|
||||
|
||||
int fec_8xx_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
struct fec *f = (struct fec *)regs->data;
|
||||
|
||||
fprintf(stdout, "Descriptor Registers\n");
|
||||
fprintf(stdout, "---------------------\n");
|
||||
|
||||
DUMP_REG(f, addr_low);
|
||||
DUMP_REG(f, addr_high);
|
||||
DUMP_REG(f, hash_table_high);
|
||||
DUMP_REG(f, hash_table_low);
|
||||
DUMP_REG(f, r_des_start);
|
||||
DUMP_REG(f, x_des_start);
|
||||
DUMP_REG(f, r_buff_size);
|
||||
DUMP_REG(f, ecntrl);
|
||||
DUMP_REG(f, ievent);
|
||||
DUMP_REG(f, imask);
|
||||
DUMP_REG(f, ivec);
|
||||
DUMP_REG(f, r_des_active);
|
||||
DUMP_REG(f, x_des_active);
|
||||
DUMP_REG(f, mii_data);
|
||||
DUMP_REG(f, mii_speed);
|
||||
DUMP_REG(f, r_bound);
|
||||
DUMP_REG(f, r_fstart);
|
||||
DUMP_REG(f, x_fstart);
|
||||
DUMP_REG(f, fun_code);
|
||||
DUMP_REG(f, r_cntrl);
|
||||
DUMP_REG(f, r_hash);
|
||||
DUMP_REG(f, x_cntrl);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/* Copyright (c) 2016 FUJITSU LIMITED */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
int fjes_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
|
||||
if (regs->version != 1)
|
||||
return -1;
|
||||
|
||||
/* Information registers */
|
||||
fprintf(stdout,
|
||||
"0x0000: OWNER_EPID (Owner EPID) 0x%08X\n",
|
||||
regs_buff[0]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0004: MAX_EP (Maximum EP) 0x%08X\n",
|
||||
regs_buff[1]);
|
||||
|
||||
/* Device Control registers */
|
||||
fprintf(stdout,
|
||||
"0x0010: DCTL (Device Control) 0x%08X\n",
|
||||
regs_buff[4]);
|
||||
|
||||
/* Command Control registers */
|
||||
fprintf(stdout,
|
||||
"0x0020: CR (Command request) 0x%08X\n",
|
||||
regs_buff[8]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0024: CS (Command status) 0x%08X\n",
|
||||
regs_buff[9]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0028: SHSTSAL (Share status address Low) 0x%08X\n",
|
||||
regs_buff[10]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x002C: SHSTSAH (Share status address High) 0x%08X\n",
|
||||
regs_buff[11]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0034: REQBL (Request Buffer length) 0x%08X\n",
|
||||
regs_buff[13]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0038: REQBAL (Request Buffer Address Low) 0x%08X\n",
|
||||
regs_buff[14]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x003C: REQBAH (Request Buffer Address High) 0x%08X\n",
|
||||
regs_buff[15]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0044: RESPBL (Response Buffer Length) 0x%08X\n",
|
||||
regs_buff[17]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0048: RESPBAL (Response Buffer Address Low) 0x%08X\n",
|
||||
regs_buff[18]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x004C: RESPBAH (Response Buffer Address High) 0x%08X\n",
|
||||
regs_buff[19]);
|
||||
|
||||
/* Interrupt Control registers */
|
||||
fprintf(stdout,
|
||||
"0x0080: IS (Interrupt status) 0x%08X\n",
|
||||
regs_buff[32]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0084: IMS (Interrupt mask set) 0x%08X\n",
|
||||
regs_buff[33]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0088: IMC (Interrupt mask clear) 0x%08X\n",
|
||||
regs_buff[34]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x008C: IG (Interrupt generator) 0x%08X\n",
|
||||
regs_buff[35]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0090: ICTL (Interrupt control) 0x%08X\n",
|
||||
regs_buff[36]);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,334 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 2005 Zultys Technologies
|
||||
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/* Ethtool get_regs complex data.
|
||||
* we want to get not just EMAC registers, but also MAL, ZMII, RGMII, TAH
|
||||
* when available.
|
||||
*
|
||||
* Returned BLOB consists of the ibm_emac_ethtool_regs_hdr,
|
||||
* MAL registers, EMAC registers and optional ZMII, RGMII, TAH registers.
|
||||
* Each register component is preceded with emac_ethtool_regs_subhdr.
|
||||
* Order of the optional headers follows their relative bit posititions
|
||||
* in emac_ethtool_regs_hdr.components
|
||||
*/
|
||||
#define EMAC_ETHTOOL_REGS_ZMII 0x00000001
|
||||
#define EMAC_ETHTOOL_REGS_RGMII 0x00000002
|
||||
#define EMAC_ETHTOOL_REGS_TAH 0x00000004
|
||||
|
||||
#define EMAC_VERSION 3
|
||||
#define EMAC4_VERSION 4
|
||||
#define EMAC4SYNC_VERSION 5
|
||||
|
||||
struct emac_ethtool_regs_hdr {
|
||||
u32 components;
|
||||
};
|
||||
|
||||
struct emac_ethtool_regs_subhdr {
|
||||
u32 version;
|
||||
u32 index;
|
||||
};
|
||||
|
||||
struct emac_regs {
|
||||
/* Common registers across all EMAC implementations. */
|
||||
u32 mr0; /* Special */
|
||||
u32 mr1; /* Reset */
|
||||
u32 tmr0; /* Special */
|
||||
u32 tmr1; /* Special */
|
||||
u32 rmr; /* Reset */
|
||||
u32 isr; /* Always */
|
||||
u32 iser; /* Reset */
|
||||
u32 iahr; /* Reset, R, T */
|
||||
u32 ialr; /* Reset, R, T */
|
||||
u32 vtpid; /* Reset, R, T */
|
||||
u32 vtci; /* Reset, R, T */
|
||||
u32 ptr; /* Reset, T */
|
||||
union {
|
||||
/* Registers unique to EMAC4 implementations */
|
||||
struct {
|
||||
u32 iaht1; /* Reset, R */
|
||||
u32 iaht2; /* Reset, R */
|
||||
u32 iaht3; /* Reset, R */
|
||||
u32 iaht4; /* Reset, R */
|
||||
u32 gaht1; /* Reset, R */
|
||||
u32 gaht2; /* Reset, R */
|
||||
u32 gaht3; /* Reset, R */
|
||||
u32 gaht4; /* Reset, R */
|
||||
} emac4;
|
||||
/* Registers unique to EMAC4SYNC implementations */
|
||||
struct {
|
||||
u32 mahr; /* Reset, R, T */
|
||||
u32 malr; /* Reset, R, T */
|
||||
u32 mmahr; /* Reset, R, T */
|
||||
u32 mmalr; /* Reset, R, T */
|
||||
u32 rsvd0[4];
|
||||
} emac4sync;
|
||||
} u0;
|
||||
/* Common registers across all EMAC implementations. */
|
||||
u32 lsah;
|
||||
u32 lsal;
|
||||
u32 ipgvr; /* Reset, T */
|
||||
u32 stacr; /* Special */
|
||||
u32 trtr; /* Special */
|
||||
u32 rwmr; /* Reset */
|
||||
u32 octx;
|
||||
u32 ocrx;
|
||||
union {
|
||||
/* Registers unique to EMAC4 implementations */
|
||||
struct {
|
||||
u32 ipcr;
|
||||
} emac4;
|
||||
/* Registers unique to EMAC4SYNC implementations */
|
||||
struct {
|
||||
u32 rsvd1;
|
||||
u32 revid;
|
||||
u32 rsvd2[2];
|
||||
u32 iaht1; /* Reset, R */
|
||||
u32 iaht2; /* Reset, R */
|
||||
u32 iaht3; /* Reset, R */
|
||||
u32 iaht4; /* Reset, R */
|
||||
u32 iaht5; /* Reset, R */
|
||||
u32 iaht6; /* Reset, R */
|
||||
u32 iaht7; /* Reset, R */
|
||||
u32 iaht8; /* Reset, R */
|
||||
u32 gaht1; /* Reset, R */
|
||||
u32 gaht2; /* Reset, R */
|
||||
u32 gaht3; /* Reset, R */
|
||||
u32 gaht4; /* Reset, R */
|
||||
u32 gaht5; /* Reset, R */
|
||||
u32 gaht6; /* Reset, R */
|
||||
u32 gaht7; /* Reset, R */
|
||||
u32 gaht8; /* Reset, R */
|
||||
u32 tpc; /* Reset, T */
|
||||
} emac4sync;
|
||||
} u1;
|
||||
};
|
||||
|
||||
struct mal_regs {
|
||||
u32 tx_count;
|
||||
u32 rx_count;
|
||||
|
||||
u32 cfg;
|
||||
u32 esr;
|
||||
u32 ier;
|
||||
u32 tx_casr;
|
||||
u32 tx_carr;
|
||||
u32 tx_eobisr;
|
||||
u32 tx_deir;
|
||||
u32 rx_casr;
|
||||
u32 rx_carr;
|
||||
u32 rx_eobisr;
|
||||
u32 rx_deir;
|
||||
u32 tx_ctpr[32];
|
||||
u32 rx_ctpr[32];
|
||||
u32 rcbs[32];
|
||||
};
|
||||
|
||||
struct zmii_regs {
|
||||
u32 fer;
|
||||
u32 ssr;
|
||||
u32 smiisr;
|
||||
};
|
||||
|
||||
struct rgmii_regs {
|
||||
u32 fer;
|
||||
u32 ssr;
|
||||
};
|
||||
|
||||
struct tah_regs {
|
||||
u32 revid;
|
||||
u32 pad[3];
|
||||
u32 mr;
|
||||
u32 ssr0;
|
||||
u32 ssr1;
|
||||
u32 ssr2;
|
||||
u32 ssr3;
|
||||
u32 ssr4;
|
||||
u32 ssr5;
|
||||
u32 tsr;
|
||||
};
|
||||
|
||||
static void *print_emac_regs(void *buf)
|
||||
{
|
||||
struct emac_ethtool_regs_subhdr *hdr = buf;
|
||||
struct emac_regs *p = (struct emac_regs *)(hdr + 1);
|
||||
void *res = p + 1;
|
||||
|
||||
if (!((hdr->version == EMAC_VERSION) ||
|
||||
(hdr->version == EMAC4_VERSION) ||
|
||||
(hdr->version == EMAC4SYNC_VERSION)))
|
||||
{
|
||||
printf("This driver version doesn't support information\n"
|
||||
" output for EMAC area, please update it or use older\n"
|
||||
" ethtool version\n");
|
||||
return res;
|
||||
}
|
||||
|
||||
printf("EMAC%d Registers\n", hdr->index);
|
||||
printf("-----------------\n");
|
||||
printf("MR0 = 0x%08x MR1 = 0x%08x RMR = 0x%08x\n"
|
||||
"ISR = 0x%08x ISER = 0x%08x\n"
|
||||
"TMR0 = 0x%08x TMR1 = 0x%08x\n"
|
||||
"TRTR = 0x%08x RWMR = 0x%08x\n"
|
||||
"IAR = %04x%08x\n"
|
||||
"LSA = %04x%08x\n"
|
||||
"VTPID = 0x%04x VTCI = 0x%04x\n"
|
||||
"IPGVR = 0x%04x STACR = 0x%08x\n"
|
||||
"OCTX = 0x%08x OCRX = 0x%08x\n",
|
||||
p->mr0, p->mr1, p->rmr,
|
||||
p->isr, p->iser,
|
||||
p->tmr0, p->tmr1,
|
||||
p->trtr, p->rwmr,
|
||||
p->iahr, p->ialr,
|
||||
p->lsah, p->lsal,
|
||||
p->vtpid, p->vtci,
|
||||
p->ipgvr, p->stacr, p->octx, p->ocrx);
|
||||
|
||||
if (hdr->version == EMAC4SYNC_VERSION) {
|
||||
printf("MAHR = 0x%08x MALR = 0x%08x MMAHR = 0x%08x\n"
|
||||
"MMALR = 0x%08x REVID = 0x%08x\n",
|
||||
p->u0.emac4sync.mahr, p->u0.emac4sync.malr,
|
||||
p->u0.emac4sync.mmahr, p->u0.emac4sync.mmalr,
|
||||
p->u1.emac4sync.revid);
|
||||
|
||||
printf("IAHT = 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u1.emac4sync.iaht1, p->u1.emac4sync.iaht2,
|
||||
p->u1.emac4sync.iaht3, p->u1.emac4sync.iaht4);
|
||||
printf(" 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u1.emac4sync.iaht5, p->u1.emac4sync.iaht6,
|
||||
p->u1.emac4sync.iaht7, p->u1.emac4sync.iaht8);
|
||||
|
||||
|
||||
printf("GAHT = 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u1.emac4sync.gaht1, p->u1.emac4sync.gaht2,
|
||||
p->u1.emac4sync.gaht3, p->u1.emac4sync.gaht4);
|
||||
printf(" 0x%04x 0x%04x 0x%04x 0x%04x\n\n",
|
||||
p->u1.emac4sync.gaht5, p->u1.emac4sync.gaht6,
|
||||
p->u1.emac4sync.gaht7, p->u1.emac4sync.gaht8);
|
||||
|
||||
} else if (hdr->version == EMAC4_VERSION) {
|
||||
printf("IAHT = 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u0.emac4.iaht1, p->u0.emac4.iaht2,
|
||||
p->u0.emac4.iaht3, p->u0.emac4.iaht4);
|
||||
|
||||
printf("GAHT = 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u0.emac4.gaht1, p->u0.emac4.gaht2,
|
||||
p->u0.emac4.gaht3, p->u0.emac4.gaht4);
|
||||
|
||||
printf(" IPCR = 0x%08x\n\n", p->u1.emac4.ipcr);
|
||||
} else if (hdr->version == EMAC_VERSION) {
|
||||
printf("IAHT = 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u0.emac4.iaht1, p->u0.emac4.iaht2,
|
||||
p->u0.emac4.iaht3, p->u0.emac4.iaht4);
|
||||
|
||||
printf("GAHT = 0x%04x 0x%04x 0x%04x 0x%04x\n",
|
||||
p->u0.emac4.gaht1, p->u0.emac4.gaht2,
|
||||
p->u0.emac4.gaht3, p->u0.emac4.gaht4);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static void *print_mal_regs(void *buf)
|
||||
{
|
||||
struct emac_ethtool_regs_subhdr *hdr = buf;
|
||||
struct mal_regs *p = (struct mal_regs *)(hdr + 1);
|
||||
int i;
|
||||
|
||||
printf("MAL%d Registers\n", hdr->index);
|
||||
printf("-----------------\n");
|
||||
printf("CFG = 0x%08x ESR = 0x%08x IER = 0x%08x\n"
|
||||
"TX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n"
|
||||
"RX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n",
|
||||
p->cfg, p->esr, p->ier,
|
||||
p->tx_casr, p->tx_carr, p->tx_eobisr, p->tx_deir,
|
||||
p->rx_casr, p->rx_carr, p->rx_eobisr, p->rx_deir);
|
||||
|
||||
printf("TX|");
|
||||
for (i = 0; i < p->tx_count; ++i) {
|
||||
if (i && !(i % 4))
|
||||
printf("\n ");
|
||||
printf("CTP%d = 0x%08x ", i, p->tx_ctpr[i]);
|
||||
}
|
||||
printf("\nRX|");
|
||||
for (i = 0; i < p->rx_count; ++i) {
|
||||
if (i && !(i % 4))
|
||||
printf("\n ");
|
||||
printf("CTP%d = 0x%08x ", i, p->rx_ctpr[i]);
|
||||
}
|
||||
printf("\n ");
|
||||
for (i = 0; i < p->rx_count; ++i) {
|
||||
u32 r = p->rcbs[i];
|
||||
if (i && !(i % 3))
|
||||
printf("\n ");
|
||||
printf("RCBS%d = 0x%08x (%d) ", i, r, r * 16);
|
||||
}
|
||||
printf("\n\n");
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
static void *print_zmii_regs(void *buf)
|
||||
{
|
||||
struct emac_ethtool_regs_subhdr *hdr = buf;
|
||||
struct zmii_regs *p = (struct zmii_regs *)(hdr + 1);
|
||||
|
||||
printf("ZMII%d Registers\n", hdr->index);
|
||||
printf("-----------------\n");
|
||||
printf("FER = %08x SSR = %08x\n"
|
||||
"SMIISR = %08x\n\n", p->fer, p->ssr, p->smiisr);
|
||||
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
static void *print_rgmii_regs(void *buf)
|
||||
{
|
||||
struct emac_ethtool_regs_subhdr *hdr = buf;
|
||||
struct rgmii_regs *p = (struct rgmii_regs *)(hdr + 1);
|
||||
|
||||
printf("RGMII%d Registers\n", hdr->index);
|
||||
printf("-----------------\n");
|
||||
printf("FER = %08x SSR = %08x\n\n", p->fer, p->ssr);
|
||||
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
static void *print_tah_regs(void *buf)
|
||||
{
|
||||
struct emac_ethtool_regs_subhdr *hdr = buf;
|
||||
struct tah_regs *p = (struct tah_regs *)(hdr + 1);
|
||||
|
||||
printf("TAH%d Registers\n", hdr->index);
|
||||
printf("-----------------\n");
|
||||
|
||||
printf("REVID = %08x MR = %08x TSR = %08x\n"
|
||||
"SSR0 = %08x SSR1 = %08x SSR2 = %08x\n"
|
||||
"SSR3 = %08x SSR4 = %08x SSR5 = %08x\n\n",
|
||||
p->revid, p->mr, p->tsr,
|
||||
p->ssr0, p->ssr1, p->ssr2, p->ssr3, p->ssr4, p->ssr5);
|
||||
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
int ibm_emac_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
struct emac_ethtool_regs_hdr *hdr =
|
||||
(struct emac_ethtool_regs_hdr *)regs->data;
|
||||
void *buf = hdr + 1;
|
||||
|
||||
buf = print_mal_regs(buf);
|
||||
buf = print_emac_regs(buf);
|
||||
if (hdr->components & EMAC_ETHTOOL_REGS_ZMII)
|
||||
buf = print_zmii_regs(buf);
|
||||
if (hdr->components & EMAC_ETHTOOL_REGS_RGMII)
|
||||
buf = print_rgmii_regs(buf);
|
||||
if (hdr->components & EMAC_ETHTOOL_REGS_TAH)
|
||||
print_tah_regs(buf);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,876 @@
|
|||
/* Copyright (c) 2007 Intel Corporation */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
/* Register Bit Masks */
|
||||
/* Device Control */
|
||||
#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */
|
||||
#define E1000_CTRL_PRIOR 0x00000004 /* Priority on PCI. 0=rx,1=fair */
|
||||
#define E1000_CTRL_GIOMASTERD 0x00000008 /* GIO Master Disable*/
|
||||
#define E1000_CTRL_TME 0x00000010 /* Test mode. 0=normal,1=test */
|
||||
#define E1000_CTRL_SLE 0x00000020 /* Serial Link on 0=dis,1=en */
|
||||
#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */
|
||||
#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */
|
||||
#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */
|
||||
#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */
|
||||
#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */
|
||||
#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */
|
||||
#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */
|
||||
#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */
|
||||
#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */
|
||||
#define E1000_CTRL_SDP0_GPIEN 0x00010000 /* General Purpose Interrupt Detection Enable for SDP0 */
|
||||
#define E1000_CTRL_SDP1_GPIEN 0x00020000 /* General Purpose Interrupt Detection Enable for SDP1 */
|
||||
#define E1000_CTRL_SDP0_DATA 0x00040000 /* SDP0 Data */
|
||||
#define E1000_CTRL_SDP1_DATA 0x00080000 /* SDP1 Data */
|
||||
#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3Cold WakeUp Capability Advertisement Enable */
|
||||
#define E1000_CTRL_SDP0_WDE 0x00200000 /* Watchdog Indication for SDP0 */
|
||||
#define E1000_CTRL_SDP1_IODIR 0x00400000 /* SDP1 Directionality */
|
||||
#define E1000_CTRL_RST 0x04000000 /* Global reset */
|
||||
#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */
|
||||
#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */
|
||||
#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */
|
||||
#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */
|
||||
|
||||
/* Device Status */
|
||||
#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
|
||||
#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
|
||||
#define E1000_STATUS_LANID 0x00000008 /* LAN ID */
|
||||
#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */
|
||||
#define E1000_STATUS_TBIMODE 0x00000020 /* TBI mode */
|
||||
#define E1000_STATUS_SPEED_MASK 0x000000C0 /* Speed Mask */
|
||||
#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */
|
||||
#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
|
||||
#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
|
||||
#define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */
|
||||
#define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */
|
||||
#define E1000_STATUS_GIOMASTEREN 0x00080000 /* GIO Master Enable Status */
|
||||
#define E1000_STATUS_DMA_CGEN 0x80000000 /* DMA clock gating Enable */
|
||||
|
||||
/* Receive Control */
|
||||
#define E1000_RCTL_EN 0x00000002 /* enable */
|
||||
#define E1000_RCTL_SBP 0x00000004 /* store bad packet */
|
||||
#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */
|
||||
#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */
|
||||
#define E1000_RCTL_LPE 0x00000020 /* long packet enable */
|
||||
#define E1000_RCTL_LBM_MASK 0x000000C0 /* Loopback mode mask */
|
||||
#define E1000_RCTL_LBM_NORM 0x00000000 /* normal loopback mode */
|
||||
#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */
|
||||
#define E1000_RCTL_LBM_SERDES 0x000000C0 /* SERDES loopback mode */
|
||||
#define E1000_RCTL_RDMTS 0x00000300 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_RDMTS_HALF 0x00000000 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_RDMTS_QUAT 0x00000100 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_RDMTS_EIGTH 0x00000200 /* rx desc min threshold size */
|
||||
#define E1000_RCTL_MO 0x00003000 /* multicast offset shift */
|
||||
#define E1000_RCTL_MO_0 0x00000000 /* multicast offset 47:36 */
|
||||
#define E1000_RCTL_MO_1 0x00001000 /* multicast offset 46:35 */
|
||||
#define E1000_RCTL_MO_2 0x00002000 /* multicast offset 45:34 */
|
||||
#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 43:32 */
|
||||
#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */
|
||||
#define E1000_RCTL_BSIZE 0x00030000 /* rx buffer size */
|
||||
#define E1000_RCTL_BSIZE_2048 0x00000000 /* rx buffer size 2048 */
|
||||
#define E1000_RCTL_BSIZE_1024 0x00010000 /* rx buffer size 1024 */
|
||||
#define E1000_RCTL_BSIZE_512 0x00020000 /* rx buffer size 512 */
|
||||
#define E1000_RCTL_BSIZE_256 0x00030000 /* rx buffer size 256 */
|
||||
#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */
|
||||
#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */
|
||||
#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */
|
||||
#define E1000_RCTL_DPF 0x00400000 /* discard pause frames */
|
||||
#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */
|
||||
#define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC from packet.0=No strip;1=strip */
|
||||
|
||||
/* Transmit Control */
|
||||
#define E1000_TCTL_EN 0x00000002 /* enable tx */
|
||||
#define E1000_TCTL_PSP 0x00000008 /* pad short packets */
|
||||
#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */
|
||||
#define E1000_TCTL_BST 0x003ff000 /* Backoff Slot time */
|
||||
#define E1000_TCTL_SWXOFF 0x00400000 /* SW Xoff transmission */
|
||||
#define E1000_TCTL_PBE 0x00800000 /* Packet Burst Enable */
|
||||
#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */
|
||||
#define E1000_TCTL_NRTU 0x02000000 /* No Re-transmit on underrun */
|
||||
|
||||
int igb_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
u32 reg;
|
||||
u8 i;
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
|
||||
if (version != 1)
|
||||
return -1;
|
||||
|
||||
/* Device control register */
|
||||
reg = regs_buff[0];
|
||||
fprintf(stdout,
|
||||
"0x00000: CTRL (Device control register) 0x%08X\n"
|
||||
" Invert Loss-Of-Signal: %s\n"
|
||||
" Receive flow control: %s\n"
|
||||
" Transmit flow control: %s\n"
|
||||
" VLAN mode: %s\n"
|
||||
" Set link up: %s\n"
|
||||
" D3COLD WakeUp capability advertisement: %s\n",
|
||||
reg,
|
||||
reg & E1000_CTRL_ILOS ? "yes" : "no",
|
||||
reg & E1000_CTRL_RFCE ? "enabled" : "disabled",
|
||||
reg & E1000_CTRL_TFCE ? "enabled" : "disabled",
|
||||
reg & E1000_CTRL_VME ? "enabled" : "disabled",
|
||||
reg & E1000_CTRL_SLU ? "1" : "0",
|
||||
reg & E1000_CTRL_ADVD3WUC ? "enabled" : "disabled");
|
||||
fprintf(stdout,
|
||||
" Auto speed detect: %s\n"
|
||||
" Speed select: %s\n"
|
||||
" Force speed: %s\n"
|
||||
" Force duplex: %s\n",
|
||||
reg & E1000_CTRL_ASDE ? "enabled" : "disabled",
|
||||
(reg & E1000_CTRL_SPD_SEL) == E1000_CTRL_SPD_10 ? "10Mb/s" :
|
||||
(reg & E1000_CTRL_SPD_SEL) == E1000_CTRL_SPD_100 ? "100Mb/s" :
|
||||
(reg & E1000_CTRL_SPD_SEL) == E1000_CTRL_SPD_1000 ? "1000Mb/s" :
|
||||
"not used",
|
||||
reg & E1000_CTRL_FRCSPD ? "yes" : "no",
|
||||
reg & E1000_CTRL_FRCDPX ? "yes" : "no");
|
||||
|
||||
/* Device status register */
|
||||
reg = regs_buff[1];
|
||||
fprintf(stdout,
|
||||
"0x00008: STATUS (Device status register) 0x%08X\n"
|
||||
" Duplex: %s\n"
|
||||
" Link up: %s\n"
|
||||
" Transmission: %s\n"
|
||||
" DMA clock gating: %s\n",
|
||||
reg,
|
||||
reg & E1000_STATUS_FD ? "full" : "half",
|
||||
reg & E1000_STATUS_LU ? "link config" : "no link config",
|
||||
reg & E1000_STATUS_TXOFF ? "paused" : "on",
|
||||
reg & E1000_STATUS_DMA_CGEN ? "enabled" : "disabled");
|
||||
fprintf(stdout,
|
||||
" TBI mode: %s\n"
|
||||
" Link speed: %s\n"
|
||||
" Bus type: %s\n",
|
||||
reg & E1000_STATUS_TBIMODE ? "enabled" : "disabled",
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_10 ?
|
||||
"10Mb/s" :
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_100 ?
|
||||
"100Mb/s" :
|
||||
(reg & E1000_STATUS_SPEED_MASK) == E1000_STATUS_SPEED_1000 ?
|
||||
"1000Mb/s" : "not used",
|
||||
"PCI Express");
|
||||
|
||||
/* Receive control register */
|
||||
reg = regs_buff[32];
|
||||
fprintf(stdout,
|
||||
"0x00100: RCTL (Receive control register) 0x%08X\n"
|
||||
" Receiver: %s\n"
|
||||
" Store bad packets: %s\n"
|
||||
" Unicast promiscuous: %s\n"
|
||||
" Multicast promiscuous: %s\n"
|
||||
" Long packet: %s\n"
|
||||
" Descriptor minimum threshold size: %s\n"
|
||||
" Broadcast accept mode: %s\n"
|
||||
" VLAN filter: %s\n"
|
||||
" Cononical form indicator: %s\n"
|
||||
" Discard pause frames: %s\n"
|
||||
" Pass MAC control frames: %s\n"
|
||||
" Loopback mode: %s\n",
|
||||
reg,
|
||||
reg & E1000_RCTL_EN ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_SBP ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_UPE ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_MPE ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_LPE ? "enabled" : "disabled",
|
||||
(reg & E1000_RCTL_RDMTS) == E1000_RCTL_RDMTS_HALF ? "1/2" :
|
||||
(reg & E1000_RCTL_RDMTS) == E1000_RCTL_RDMTS_QUAT ? "1/4" :
|
||||
(reg & E1000_RCTL_RDMTS) == E1000_RCTL_RDMTS_EIGTH ? "1/8" :
|
||||
"reserved",
|
||||
reg & E1000_RCTL_BAM ? "accept" : "ignore",
|
||||
reg & E1000_RCTL_VFE ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_CFIEN ? "enabled" : "disabled",
|
||||
reg & E1000_RCTL_DPF ? "ignored" : "filtered",
|
||||
reg & E1000_RCTL_PMCF ? "pass" : "don't pass",
|
||||
(reg & E1000_RCTL_LBM_MASK) == E1000_RCTL_LBM_NORM ? "normal" :
|
||||
(reg & E1000_RCTL_LBM_MASK) == E1000_RCTL_LBM_MAC ? "MAC":
|
||||
(reg & E1000_RCTL_LBM_MASK) == E1000_RCTL_LBM_SERDES ? "SERDES":
|
||||
"undefined");
|
||||
fprintf(stdout,
|
||||
" Receive buffer size: %s\n",
|
||||
(reg & E1000_RCTL_BSIZE)==E1000_RCTL_BSIZE_2048 ? "2048" :
|
||||
(reg & E1000_RCTL_BSIZE)==E1000_RCTL_BSIZE_1024 ? "1024" :
|
||||
(reg & E1000_RCTL_BSIZE)==E1000_RCTL_BSIZE_512 ? "512" :
|
||||
"256");
|
||||
|
||||
/* Receive descriptor registers */
|
||||
fprintf(stdout,
|
||||
"0x02808: RDLEN (Receive desc length) 0x%08X\n",
|
||||
regs_buff[137]);
|
||||
fprintf(stdout,
|
||||
"0x02810: RDH (Receive desc head) 0x%08X\n",
|
||||
regs_buff[141]);
|
||||
fprintf(stdout,
|
||||
"0x02818: RDT (Receive desc tail) 0x%08X\n",
|
||||
regs_buff[145]);
|
||||
|
||||
/* Transmit control register */
|
||||
reg = regs_buff[38];
|
||||
fprintf(stdout,
|
||||
"0x00400: TCTL (Transmit ctrl register) 0x%08X\n"
|
||||
" Transmitter: %s\n"
|
||||
" Pad short packets: %s\n"
|
||||
" Software XOFF Transmission: %s\n",
|
||||
reg,
|
||||
reg & E1000_TCTL_EN ? "enabled" : "disabled",
|
||||
reg & E1000_TCTL_PSP ? "enabled" : "disabled",
|
||||
reg & E1000_TCTL_SWXOFF ? "enabled" : "disabled");
|
||||
fprintf(stdout,
|
||||
" Re-transmit on late collision: %s\n",
|
||||
reg & E1000_TCTL_RTLC ? "enabled" : "disabled");
|
||||
|
||||
/* Transmit descriptor registers */
|
||||
fprintf(stdout,
|
||||
"0x03808: TDLEN (Transmit desc length) 0x%08X\n",
|
||||
regs_buff[219]);
|
||||
fprintf(stdout,
|
||||
"0x03810: TDH (Transmit desc head) 0x%08X\n",
|
||||
regs_buff[223]);
|
||||
fprintf(stdout,
|
||||
"0x03818: TDT (Transmit desc tail) 0x%08X\n",
|
||||
regs_buff[227]);
|
||||
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00018: CTRL_EXT (Extended device control) 0x%08X\n",
|
||||
regs_buff[2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00018: MDIC (MDI control) 0x%08X\n",
|
||||
regs_buff[3]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00024: SCTL (SERDES ANA) 0x%08X\n",
|
||||
regs_buff[4]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00034: CONNSW (Copper/Fiber switch control) 0x%08X\n",
|
||||
regs_buff[5]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00038: VET (VLAN Ether type) 0x%08X\n",
|
||||
regs_buff[6]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00E00: LEDCTL (LED control) 0x%08X\n",
|
||||
regs_buff[7]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01000: PBA (Packet buffer allocation) 0x%08X\n",
|
||||
regs_buff[8]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01008: PBS (Packet buffer size) 0x%08X\n",
|
||||
regs_buff[9]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01048: FRTIMER (Free running timer) 0x%08X\n",
|
||||
regs_buff[10]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0104C: TCPTIMER (TCP timer) 0x%08X\n",
|
||||
regs_buff[11]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00010: EEC (EEPROM/FLASH control) 0x%08X\n",
|
||||
regs_buff[12]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01580: EICR (Extended interrupt cause) 0x%08X\n",
|
||||
regs_buff[13]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01520: EICS (Extended interrupt cause set) 0x%08X\n",
|
||||
regs_buff[14]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01524: EIMS (Extended interrup set/read) 0x%08X\n",
|
||||
regs_buff[15]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01528: EIMC (Extended interrupt mask clear) 0x%08X\n",
|
||||
regs_buff[16]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0152C: EIAC (Extended interrupt auto clear) 0x%08X\n",
|
||||
regs_buff[17]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01530: EIAM (Extended interrupt auto mask) 0x%08X\n",
|
||||
regs_buff[18]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01500: ICR (Interrupt cause read) 0x%08X\n",
|
||||
regs_buff[19]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01504: ICS (Interrupt cause set) 0x%08X\n",
|
||||
regs_buff[20]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01508: IMS (Interrupt mask set/read) 0x%08X\n",
|
||||
regs_buff[21]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0150C: IMC (Interrupt mask clear) 0x%08X\n",
|
||||
regs_buff[22]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04100: IAC (Interrupt assertion count) 0x%08X\n",
|
||||
regs_buff[23]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x01510: IAM (Interr acknowledge auto-mask) 0x%08X\n",
|
||||
regs_buff[24]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05AC0: IMIRVP (Immed interr rx VLAN priority) 0x%08X\n",
|
||||
regs_buff[25]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00028: FCAL (Flow control address low) 0x%08X\n",
|
||||
regs_buff[26]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0002C: FCAH (Flow control address high) 0x%08X\n",
|
||||
regs_buff[27]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00170: FCTTV (Flow control tx timer value) 0x%08X\n",
|
||||
regs_buff[28]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x02160: FCRTL (Flow control rx threshold low) 0x%08X\n",
|
||||
regs_buff[29]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x02168: FCRTH (Flow control rx threshold high) 0x%08X\n",
|
||||
regs_buff[30]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x02460: FCRTV (Flow control refresh threshold) 0x%08X\n",
|
||||
regs_buff[31]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05000: RXCSUM (Receive checksum control) 0x%08X\n",
|
||||
regs_buff[33]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05004: RLPML (Receive long packet max length) 0x%08X\n",
|
||||
regs_buff[34]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05008: RFCTL (Receive filter control) 0x%08X\n",
|
||||
regs_buff[35]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05818: MRQC (Multiple rx queues command) 0x%08X\n",
|
||||
regs_buff[36]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0581C: VMD_CTL (VMDq control) 0x%08X\n",
|
||||
regs_buff[37]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00404: TCTL_EXT (Transmit control extended) 0x%08X\n",
|
||||
regs_buff[39]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00410: TIPG (Transmit IPG) 0x%08X\n",
|
||||
regs_buff[40]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x03590: DTXCTL (DMA tx control) 0x%08X\n",
|
||||
regs_buff[41]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05800: WUC (Wake up control) 0x%08X\n",
|
||||
regs_buff[42]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05808: WUFC (Wake up filter control) 0x%08X\n",
|
||||
regs_buff[43]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05810: WUS (Wake up status) 0x%08X\n",
|
||||
regs_buff[44]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05838: IPAV (IP address valid) 0x%08X\n",
|
||||
regs_buff[45]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05900: WUPL (Wake up packet length) 0x%08X\n",
|
||||
regs_buff[46]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04200: PCS_CFG (PCS configuration 0) 0x%08X\n",
|
||||
regs_buff[47]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04208: PCS_LCTL (PCS link control) 0x%08X\n",
|
||||
regs_buff[48]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0420C: PCS_LSTS (PCS link status) 0x%08X\n",
|
||||
regs_buff[49]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04218: PCS_ANADV (AN advertisement) 0x%08X\n",
|
||||
regs_buff[50]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0421C: PCS_LPAB (Link partner ability) 0x%08X\n",
|
||||
regs_buff[51]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04220: PCS_NPTX (Next Page transmit) 0x%08X\n",
|
||||
regs_buff[52]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04224: PCS_LPABNP (Link partner ability Next Page) 0x%08X\n",
|
||||
regs_buff[53]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04000: CRCERRS (CRC error count) 0x%08X\n",
|
||||
regs_buff[54]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04004: ALGNERRC (Alignment error count) 0x%08X\n",
|
||||
regs_buff[55]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04008: SYMERRS (Symbol error count) 0x%08X\n",
|
||||
regs_buff[56]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0400C: RXERRC (RX error count) 0x%08X\n",
|
||||
regs_buff[57]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04010: MPC (Missed packets count) 0x%08X\n",
|
||||
regs_buff[58]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04014: SCC (Single collision count) 0x%08X\n",
|
||||
regs_buff[59]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04018: ECOL (Excessive collisions count) 0x%08X\n",
|
||||
regs_buff[60]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0401C: MCC (Multiple collision count) 0x%08X\n",
|
||||
regs_buff[61]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04020: LATECOL (Late collisions count) 0x%08X\n",
|
||||
regs_buff[62]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04028: COLC (Collision count) 0x%08X\n",
|
||||
regs_buff[63]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04030: DC (Defer count) 0x%08X\n",
|
||||
regs_buff[64]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04034: TNCRS (Transmit with no CRS) 0x%08X\n",
|
||||
regs_buff[65]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04038: SEC (Sequence error count) 0x%08X\n",
|
||||
regs_buff[66]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0403C: HTDPMC (Host tx discrd pkts MAC count) 0x%08X\n",
|
||||
regs_buff[67]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04040: RLEC (Receive length error count) 0x%08X\n",
|
||||
regs_buff[68]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04048: XONRXC (XON received count) 0x%08X\n",
|
||||
regs_buff[69]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0404C: XONTXC (XON transmitted count) 0x%08X\n",
|
||||
regs_buff[70]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04050: XOFFRXC (XOFF received count) 0x%08X\n",
|
||||
regs_buff[71]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04054: XOFFTXC (XOFF transmitted count) 0x%08X\n",
|
||||
regs_buff[72]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04058: FCRUC (FC received unsupported count) 0x%08X\n",
|
||||
regs_buff[73]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0405C: PRC64 (Packets rx (64 B) count) 0x%08X\n",
|
||||
regs_buff[74]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04060: PRC127 (Packets rx (65-127 B) count) 0x%08X\n",
|
||||
regs_buff[75]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04064: PRC255 (Packets rx (128-255 B) count) 0x%08X\n",
|
||||
regs_buff[76]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04068: PRC511 (Packets rx (256-511 B) count) 0x%08X\n",
|
||||
regs_buff[77]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0406C: PRC1023 (Packets rx (512-1023 B) count) 0x%08X\n",
|
||||
regs_buff[78]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04070: PRC1522 (Packets rx (1024-max B) count) 0x%08X\n",
|
||||
regs_buff[79]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04074: GPRC (Good packets received count) 0x%08X\n",
|
||||
regs_buff[80]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04078: BPRC (Broadcast packets rx count) 0x%08X\n",
|
||||
regs_buff[81]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0407C: MPRC (Multicast packets rx count) 0x%08X\n",
|
||||
regs_buff[82]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04080: GPTC (Good packets tx count) 0x%08X\n",
|
||||
regs_buff[83]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04088: GORCL (Good octets rx count lower) 0x%08X\n",
|
||||
regs_buff[84]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0408C: GORCH (Good octets rx count upper) 0x%08X\n",
|
||||
regs_buff[85]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04090: GOTCL (Good octets tx count lower) 0x%08X\n",
|
||||
regs_buff[86]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04094: GOTCH (Good octets tx count upper) 0x%08X\n",
|
||||
regs_buff[87]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040A0: RNBC (Receive no buffers count) 0x%08X\n",
|
||||
regs_buff[88]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040A4: RUC (Receive undersize count) 0x%08X\n",
|
||||
regs_buff[89]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040A8: RFC (Receive fragment count) 0x%08X\n",
|
||||
regs_buff[90]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040AC: ROC (Receive oversize count) 0x%08X\n",
|
||||
regs_buff[91]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040B0: RJC (Receive jabber count) 0x%08X\n",
|
||||
regs_buff[92]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040B4: MGPRC (Management packets rx count) 0x%08X\n",
|
||||
regs_buff[93]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040B8: MGPDC (Management pkts dropped count) 0x%08X\n",
|
||||
regs_buff[94]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040BC: MGPTC (Management packets tx count) 0x%08X\n",
|
||||
regs_buff[95]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040C0: TORL (Total octets received lower) 0x%08X\n",
|
||||
regs_buff[96]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040C4: TORH (Total octets received upper) 0x%08X\n",
|
||||
regs_buff[97]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040C8: TOTL (Total octets transmitted lower) 0x%08X\n",
|
||||
regs_buff[98]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040CC: TOTH (Total octets transmitted upper) 0x%08X\n",
|
||||
regs_buff[99]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040D0: TPR (Total packets received) 0x%08X\n",
|
||||
regs_buff[100]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040D4: TPT (Total packets transmitted) 0x%08X\n",
|
||||
regs_buff[101]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040D8: PTC64 (Packets tx (64 B) count) 0x%08X\n",
|
||||
regs_buff[102]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040DC: PTC127 (Packets tx (65-127 B) count) 0x%08X\n",
|
||||
regs_buff[103]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040E0: PTC255 (Packets tx (128-255 B) count) 0x%08X\n",
|
||||
regs_buff[104]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040E4: PTC511 (Packets tx (256-511 B) count) 0x%08X\n",
|
||||
regs_buff[105]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040E8: PTC1023 (Packets tx (512-1023 B) count) 0x%08X\n",
|
||||
regs_buff[106]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040EC: PTC1522 (Packets tx (> 1024 B) count) 0x%08X\n",
|
||||
regs_buff[107]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040F0: MPTC (Multicast packets tx count) 0x%08X\n",
|
||||
regs_buff[108]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040F4: BPTC (Broadcast packets tx count) 0x%08X\n",
|
||||
regs_buff[109]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x040F8: TSCTC (TCP segment context tx count) 0x%08X\n",
|
||||
regs_buff[110]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04100: IAC (Interrupt assertion count) 0x%08X\n",
|
||||
regs_buff[111]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04104: RPTHC (Rx packets to host count) 0x%08X\n",
|
||||
regs_buff[112]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04118: HGPTC (Host good packets tx count) 0x%08X\n",
|
||||
regs_buff[113]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04128: HGORCL (Host good octets rx cnt lower) 0x%08X\n",
|
||||
regs_buff[114]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0412C: HGORCH (Host good octets rx cnt upper) 0x%08X\n",
|
||||
regs_buff[115]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04130: HGOTCL (Host good octets tx cnt lower) 0x%08X\n",
|
||||
regs_buff[116]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04134: HGOTCH (Host good octets tx cnt upper) 0x%08X\n",
|
||||
regs_buff[117]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04138: LENNERS (Length error count) 0x%08X\n",
|
||||
regs_buff[118]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x04228: SCVPC (SerDes/SGMII code viol pkt cnt) 0x%08X\n",
|
||||
regs_buff[119]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0A018: HRMPC (Header redir missed pkt count) 0x%08X\n",
|
||||
regs_buff[120]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: SRRCTL%d (Split and replic rx ctl%d) 0x%08X\n",
|
||||
0x0280C + (0x100 * i), i, i, regs_buff[121 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: PSRTYPE%d (Packet split receive type%d) 0x%08X\n",
|
||||
0x05480 + (0x4 * i), i, i, regs_buff[125 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RDBAL%d (Rx desc base addr low%d) 0x%08X\n",
|
||||
0x02800 + (0x100 * i), i, i, regs_buff[129 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RDBAH%d (Rx desc base addr high%d) 0x%08X\n",
|
||||
0x02804 + (0x100 * i), i, i, regs_buff[133 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RDLEN%d (Rx descriptor length%d) 0x%08X\n",
|
||||
0x02808 + (0x100 * i), i, i, regs_buff[137 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RDH%d (Rx descriptor head%d) 0x%08X\n",
|
||||
0x02810 + (0x100 * i), i, i, regs_buff[141 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RDT%d (Rx descriptor tail%d) 0x%08X\n",
|
||||
0x02818 + (0x100 * i), i, i, regs_buff[145 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RXDCTL%d (Rx descriptor control%d) 0x%08X\n",
|
||||
0x02828 + (0x100 * i), i, i, regs_buff[149 + i]);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: EITR%d (Interrupt throttle%d) 0x%08X\n",
|
||||
0x01680 + (0x4 * i), i, i, regs_buff[153 + i]);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: IMIR%d (Immediate interrupt Rx%d) 0x%08X\n",
|
||||
0x05A80 + (0x4 * i), i, i, regs_buff[163 + i]);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: IMIREXT%d (Immediate interr Rx extended%d) 0x%08X\n",
|
||||
0x05AA0 + (0x4 * i), i, i, regs_buff[171 + i]);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RAL%02d (Receive address low%02d) 0x%08X\n",
|
||||
0x05400 + (0x8 * i), i,i, regs_buff[179 + i]);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: RAH%02d (Receive address high%02d) 0x%08X\n",
|
||||
0x05404 + (0x8 * i), i, i, regs_buff[195 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDBAL%d (Tx desc base address low%d) 0x%08X\n",
|
||||
0x03800 + (0x100 * i), i, i, regs_buff[211 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDBAH%d (Tx desc base address high%d) 0x%08X\n",
|
||||
0x03804 + (0x100 * i), i, i, regs_buff[215 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDLEN%d (Tx descriptor length%d) 0x%08X\n",
|
||||
0x03808 + (0x100 * i), i, i, regs_buff[219 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDH%d (Transmit descriptor head%d) 0x%08X\n",
|
||||
0x03810 + (0x100 * i), i, i, regs_buff[223 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDT%d (Transmit descriptor tail%d) 0x%08X\n",
|
||||
0x03818 + (0x100 * i), i, i, regs_buff[227 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TXDCTL%d (Transmit descriptor control%d) 0x%08X\n",
|
||||
0x03828 + (0x100 * i), i, i, regs_buff[231 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDWBAL%d (Tx desc complete wb addr low%d) 0x%08X\n",
|
||||
0x03838 + (0x100 * i), i, i, regs_buff[235 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: TDWBAH%d (Tx desc complete wb addr hi%d) 0x%08X\n",
|
||||
0x0383C + (0x100 * i), i, i, regs_buff[239 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: DCA_TXCTRL%d (Tx DCA control%d) 0x%08X\n",
|
||||
0x03814 + (0x100 * i), i, i, regs_buff[243 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: IP4AT%d (IPv4 address table%d) 0x%08X\n",
|
||||
0x05840 + (0x8 * i), i, i, regs_buff[247 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: IP6AT%d (IPv6 address table%d) 0x%08X\n",
|
||||
0x05880 + (0x4 * i), i, i, regs_buff[251 + i]);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: WUPM%02d (Wake up packet memory%02d) 0x%08X\n",
|
||||
0x05A00 + (0x4 * i), i, i, regs_buff[255 + i]);
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: FFMT%03d (Flexible filter mask table%03d) 0x%08X\n",
|
||||
0x09000 + (0x8 * i), i, i, regs_buff[287 + i]);
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: FFVT%03d (Flexible filter value table%03d) 0x%08X\n",
|
||||
0x09800 + (0x8 * i), i, i, regs_buff[415 + i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
fprintf(stdout,
|
||||
"0x0%02X: FFLT%d (Flexible filter length table%d) 0x%08X\n",
|
||||
0x05F00 + (0x8 * i), i, i, regs_buff[543 + i]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x03410: TDFH (Tx data FIFO head) 0x%08X\n",
|
||||
regs_buff[547]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x03418: TDFT (Tx data FIFO tail) 0x%08X\n",
|
||||
regs_buff[548]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x03420: TDFHS (Tx data FIFO head saved) 0x%08X\n",
|
||||
regs_buff[549]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x03430: TDFPC (Tx data FIFO packet count) 0x%08X\n",
|
||||
regs_buff[550]);
|
||||
|
||||
/*
|
||||
* Starting from kernel version 5.3 the registers dump buffer grew from
|
||||
* 739 4-byte words to 740 words, and word 740 contains the RR2DCDELAY
|
||||
* register.
|
||||
*/
|
||||
if (regs->len < 740)
|
||||
return 0;
|
||||
|
||||
fprintf(stdout,
|
||||
"0x05BF4: RR2DCDELAY (Max. DMA read delay) 0x%08X\n",
|
||||
regs_buff[739]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,501 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2013-12-25.23; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,365 @@
|
|||
/* Portions Copyright 2001 Sun Microsystems (thockin@sun.com) */
|
||||
/* Portions Copyright 2002 Intel (scott.feldman@intel.com) */
|
||||
#ifndef ETHTOOL_INTERNAL_H__
|
||||
#define ETHTOOL_INTERNAL_H__
|
||||
|
||||
/* Some platforms (eg. ppc64) need __SANE_USERSPACE_TYPES__ before
|
||||
* <linux/types.h> to select 'int-ll64.h' and avoid compile warnings
|
||||
* when printing __u64 with %llu.
|
||||
*/
|
||||
#define __SANE_USERSPACE_TYPES__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "ethtool-config.h"
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <endian.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#define maybe_unused __attribute__((__unused__))
|
||||
|
||||
/* ethtool.h expects these to be defined by <linux/types.h> */
|
||||
#ifndef HAVE_BE_TYPES
|
||||
typedef uint16_t __be16;
|
||||
typedef uint32_t __be32;
|
||||
typedef unsigned long long __be64;
|
||||
#endif
|
||||
|
||||
typedef unsigned long long u64;
|
||||
typedef uint32_t u32;
|
||||
typedef uint16_t u16;
|
||||
typedef uint8_t u8;
|
||||
typedef int32_t s32;
|
||||
|
||||
/* ethtool.h epxects __KERNEL_DIV_ROUND_UP to be defined by <linux/kernel.h> */
|
||||
#include <linux/kernel.h>
|
||||
#ifndef __KERNEL_DIV_ROUND_UP
|
||||
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||
#endif
|
||||
|
||||
#include "ethtool-copy.h"
|
||||
#include "net_tstamp-copy.h"
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
static inline u16 cpu_to_be16(u16 value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
static inline u32 cpu_to_be32(u32 value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
static inline u64 cpu_to_be64(u64 value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
#else
|
||||
static inline u16 cpu_to_be16(u16 value)
|
||||
{
|
||||
return (value >> 8) | (value << 8);
|
||||
}
|
||||
static inline u32 cpu_to_be32(u32 value)
|
||||
{
|
||||
return cpu_to_be16(value >> 16) | (cpu_to_be16(value) << 16);
|
||||
}
|
||||
static inline u64 cpu_to_be64(u64 value)
|
||||
{
|
||||
return cpu_to_be32(value >> 32) | ((u64)cpu_to_be32(value) << 32);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ntohll cpu_to_be64
|
||||
#define htonll cpu_to_be64
|
||||
|
||||
#define BITS_PER_BYTE 8
|
||||
#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long))
|
||||
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
|
||||
|
||||
static inline void set_bit(unsigned int nr, unsigned long *addr)
|
||||
{
|
||||
addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
|
||||
}
|
||||
|
||||
static inline void clear_bit(unsigned int nr, unsigned long *addr)
|
||||
{
|
||||
addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
|
||||
}
|
||||
|
||||
static inline int test_bit(unsigned int nr, const unsigned long *addr)
|
||||
{
|
||||
return !!((1UL << (nr % BITS_PER_LONG)) &
|
||||
(((unsigned long *)addr)[nr / BITS_PER_LONG]));
|
||||
}
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#ifndef SIOCETHTOOL
|
||||
#define SIOCETHTOOL 0x8946
|
||||
#endif
|
||||
|
||||
/* Internal values for old-style offload flags. Values and names
|
||||
* must not clash with the flags defined for ETHTOOL_{G,S}FLAGS.
|
||||
*/
|
||||
#define ETH_FLAG_RXCSUM (1 << 0)
|
||||
#define ETH_FLAG_TXCSUM (1 << 1)
|
||||
#define ETH_FLAG_SG (1 << 2)
|
||||
#define ETH_FLAG_TSO (1 << 3)
|
||||
#define ETH_FLAG_UFO (1 << 4)
|
||||
#define ETH_FLAG_GSO (1 << 5)
|
||||
#define ETH_FLAG_GRO (1 << 6)
|
||||
#define ETH_FLAG_INT_MASK (ETH_FLAG_RXCSUM | ETH_FLAG_TXCSUM | \
|
||||
ETH_FLAG_SG | ETH_FLAG_TSO | ETH_FLAG_UFO | \
|
||||
ETH_FLAG_GSO | ETH_FLAG_GRO),
|
||||
/* Mask of all flags defined for ETHTOOL_{G,S}FLAGS. */
|
||||
#define ETH_FLAG_EXT_MASK (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | \
|
||||
ETH_FLAG_TXVLAN | ETH_FLAG_NTUPLE | \
|
||||
ETH_FLAG_RXHASH)
|
||||
|
||||
/* internal API for link mode bitmap interaction with kernel. */
|
||||
|
||||
#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 \
|
||||
(SCHAR_MAX)
|
||||
#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBITS \
|
||||
(32 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32)
|
||||
#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES \
|
||||
(4 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32)
|
||||
#define ETHTOOL_DECLARE_LINK_MODE_MASK(name) \
|
||||
u32 name[ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32]
|
||||
|
||||
struct ethtool_link_usettings {
|
||||
struct {
|
||||
__u8 transceiver;
|
||||
} deprecated;
|
||||
struct ethtool_link_settings base;
|
||||
struct {
|
||||
ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
|
||||
ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
|
||||
ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
|
||||
} link_modes;
|
||||
};
|
||||
|
||||
#define ethtool_link_mode_for_each_u32(index) \
|
||||
for ((index) = 0; \
|
||||
(index) < ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32; \
|
||||
++(index))
|
||||
|
||||
static inline void ethtool_link_mode_zero(u32 *dst)
|
||||
{
|
||||
memset(dst, 0, ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES);
|
||||
}
|
||||
|
||||
static inline bool ethtool_link_mode_is_empty(const u32 *mask)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
ethtool_link_mode_for_each_u32(i) {
|
||||
if (mask[i] != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void ethtool_link_mode_copy(u32 *dst, const u32 *src)
|
||||
{
|
||||
memcpy(dst, src, ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES);
|
||||
}
|
||||
|
||||
static inline int ethtool_link_mode_test_bit(unsigned int nr, const u32 *mask)
|
||||
{
|
||||
if (nr >= ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBITS)
|
||||
return !!0;
|
||||
return !!(mask[nr / 32] & (1 << (nr % 32)));
|
||||
}
|
||||
|
||||
static inline int ethtool_link_mode_set_bit(unsigned int nr, u32 *mask)
|
||||
{
|
||||
if (nr >= ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBITS)
|
||||
return -1;
|
||||
mask[nr / 32] |= (1 << (nr % 32));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Context for sub-commands */
|
||||
struct cmd_context {
|
||||
const char *devname; /* net device name */
|
||||
int fd; /* socket suitable for ethtool ioctl */
|
||||
struct ifreq ifr; /* ifreq suitable for ethtool ioctl */
|
||||
int argc; /* number of arguments to the sub-command */
|
||||
char **argp; /* arguments to the sub-command */
|
||||
};
|
||||
|
||||
#ifdef TEST_ETHTOOL
|
||||
int test_cmdline(const char *args);
|
||||
|
||||
struct cmd_expect {
|
||||
const void *cmd; /* expected command; NULL at end of list */
|
||||
size_t cmd_len; /* length to match (might be < sizeof struct) */
|
||||
int rc; /* kernel return code */
|
||||
const void *resp; /* response to write back; may be NULL */
|
||||
size_t resp_len; /* length to write back */
|
||||
};
|
||||
int test_ioctl(const struct cmd_expect *expect, void *cmd);
|
||||
#define TEST_IOCTL_MISMATCH (-2)
|
||||
|
||||
int test_main(int argc, char **argp);
|
||||
void test_exit(int rc) __attribute__((noreturn));
|
||||
|
||||
#ifndef TEST_NO_WRAPPERS
|
||||
#define main(...) test_main(__VA_ARGS__)
|
||||
#undef exit
|
||||
#define exit(rc) test_exit(rc)
|
||||
void *test_malloc(size_t size);
|
||||
#undef malloc
|
||||
#define malloc(size) test_malloc(size)
|
||||
void *test_calloc(size_t nmemb, size_t size);
|
||||
#undef calloc
|
||||
#define calloc(nmemb, size) test_calloc(nmemb, size)
|
||||
char *test_strdup(const char *s);
|
||||
#undef strdup
|
||||
#define strdup(s) test_strdup(s)
|
||||
void test_free(void *ptr);
|
||||
#undef free
|
||||
#define free(ptr) test_free(ptr)
|
||||
void *test_realloc(void *ptr, size_t size);
|
||||
#undef realloc
|
||||
#define realloc(ptr, size) test_realloc(ptr, size)
|
||||
int test_open(const char *pathname, int flag, ...);
|
||||
#undef open
|
||||
#define open(...) test_open(__VA_ARGS__)
|
||||
int test_socket(int domain, int type, int protocol);
|
||||
#undef socket
|
||||
#define socket(...) test_socket(__VA_ARGS__)
|
||||
int test_close(int fd);
|
||||
#undef close
|
||||
#define close(fd) test_close(fd)
|
||||
FILE *test_fopen(const char *path, const char *mode);
|
||||
#undef fopen
|
||||
#define fopen(path, mode) test_fopen(path, mode)
|
||||
int test_fclose(FILE *fh);
|
||||
#undef fclose
|
||||
#define fclose(fh) test_fclose(fh)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int send_ioctl(struct cmd_context *ctx, void *cmd);
|
||||
|
||||
void dump_hex(FILE *f, const u8 *data, int len, int offset);
|
||||
|
||||
/* National Semiconductor DP83815, DP83816 */
|
||||
int natsemi_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
int natsemi_dump_eeprom(struct ethtool_drvinfo *info,
|
||||
struct ethtool_eeprom *ee);
|
||||
|
||||
/* Digital/Intel 21040 and 21041 */
|
||||
int de2104x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Intel(R) PRO/1000 Gigabit Adapter Family */
|
||||
int e1000_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
int igb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* RealTek PCI */
|
||||
int realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Intel(R) PRO/100 Fast Ethernet Adapter Family */
|
||||
int e100_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Tigon3 */
|
||||
int tg3_dump_eeprom(struct ethtool_drvinfo *info, struct ethtool_eeprom *ee);
|
||||
|
||||
/* Advanced Micro Devices AMD8111 based Adapter */
|
||||
int amd8111e_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Advanced Micro Devices PCnet32 Adapter */
|
||||
int pcnet32_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Motorola 8xx FEC Ethernet controller */
|
||||
int fec_8xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* PowerPC 4xx on-chip Ethernet controller */
|
||||
int ibm_emac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Intel(R) PRO/10GBe Gigabit Adapter Family */
|
||||
int ixgb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
int ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
int ixgbevf_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Broadcom Tigon3 Ethernet controller */
|
||||
int tg3_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* SysKonnect Gigabit (Genesis and Yukon) */
|
||||
int skge_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* SysKonnect Gigabit (Yukon2) */
|
||||
int sky2_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Fabric7 VIOC */
|
||||
int vioc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* SMSC LAN911x/LAN921x embedded ethernet controller */
|
||||
int smsc911x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
int at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Solarflare Solarstorm controllers */
|
||||
int sfc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* STMMAC embedded ethernet controller */
|
||||
int st_mac100_dump_regs(struct ethtool_drvinfo *info,
|
||||
struct ethtool_regs *regs);
|
||||
int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Et131x ethernet controller */
|
||||
int et131x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Altera TSE 10/100/1000 ethernet controller */
|
||||
int altera_tse_dump_regs(struct ethtool_drvinfo *info,
|
||||
struct ethtool_regs *regs);
|
||||
|
||||
/* VMware vmxnet3 ethernet controller */
|
||||
int vmxnet3_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Rx flow classification */
|
||||
int rxclass_parse_ruleopts(struct cmd_context *ctx,
|
||||
struct ethtool_rx_flow_spec *fsp, __u32 *rss_context);
|
||||
int rxclass_rule_getall(struct cmd_context *ctx);
|
||||
int rxclass_rule_get(struct cmd_context *ctx, __u32 loc);
|
||||
int rxclass_rule_ins(struct cmd_context *ctx,
|
||||
struct ethtool_rx_flow_spec *fsp, __u32 rss_context);
|
||||
int rxclass_rule_del(struct cmd_context *ctx, __u32 loc);
|
||||
|
||||
/* Module EEPROM parsing code */
|
||||
void sff8079_show_all(const __u8 *id);
|
||||
|
||||
/* Optics diagnostics */
|
||||
void sff8472_show_all(const __u8 *id);
|
||||
|
||||
/* QSFP Optics diagnostics */
|
||||
void sff8636_show_all(const __u8 *id, __u32 eeprom_len);
|
||||
|
||||
/* FUJITSU Extended Socket network device */
|
||||
int fjes_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* MICROCHIP LAN78XX USB ETHERNET Controller */
|
||||
int lan78xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* Distributed Switch Architecture */
|
||||
int dsa_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
/* i.MX Fast Ethernet Controller */
|
||||
int fec_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
|
||||
|
||||
#endif /* ETHTOOL_INTERNAL_H__ */
|
|
@ -0,0 +1,147 @@
|
|||
/* Copyright (c) 2006 Intel Corporation */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
/* CTRL0 Bit Masks */
|
||||
#define IXGB_CTRL0_LRST 0x00000008
|
||||
#define IXGB_CTRL0_VME 0x40000000
|
||||
|
||||
/* STATUS Bit Masks */
|
||||
#define IXGB_STATUS_LU 0x00000002
|
||||
#define IXGB_STATUS_BUS64 0x00001000
|
||||
#define IXGB_STATUS_PCIX_MODE 0x00002000
|
||||
#define IXGB_STATUS_PCIX_SPD_100 0x00004000
|
||||
#define IXGB_STATUS_PCIX_SPD_133 0x00008000
|
||||
|
||||
/* RCTL Bit Masks */
|
||||
#define IXGB_RCTL_RXEN 0x00000002
|
||||
#define IXGB_RCTL_SBP 0x00000004
|
||||
#define IXGB_RCTL_UPE 0x00000008
|
||||
#define IXGB_RCTL_MPE 0x00000010
|
||||
#define IXGB_RCTL_RDMTS_MASK 0x00000300
|
||||
#define IXGB_RCTL_RDMTS_1_2 0x00000000
|
||||
#define IXGB_RCTL_RDMTS_1_4 0x00000100
|
||||
#define IXGB_RCTL_RDMTS_1_8 0x00000200
|
||||
#define IXGB_RCTL_BAM 0x00008000
|
||||
#define IXGB_RCTL_BSIZE_MASK 0x00030000
|
||||
#define IXGB_RCTL_BSIZE_4096 0x00010000
|
||||
#define IXGB_RCTL_BSIZE_8192 0x00020000
|
||||
#define IXGB_RCTL_BSIZE_16384 0x00030000
|
||||
#define IXGB_RCTL_VFE 0x00040000
|
||||
#define IXGB_RCTL_CFIEN 0x00080000
|
||||
|
||||
/* TCTL Bit Masks */
|
||||
#define IXGB_TCTL_TXEN 0x00000002
|
||||
|
||||
/* RAH Bit Masks */
|
||||
#define IXGB_RAH_ASEL_DEST 0x00000000
|
||||
#define IXGB_RAH_ASEL_SRC 0x00010000
|
||||
#define IXGB_RAH_AV 0x80000000
|
||||
|
||||
int ixgb_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
u32 reg;
|
||||
|
||||
if (version != 1)
|
||||
return -1;
|
||||
fprintf(stdout, "MAC Registers\n");
|
||||
fprintf(stdout, "-------------\n");
|
||||
|
||||
/* Device control register */
|
||||
reg = regs_buff[0];
|
||||
fprintf(stdout,
|
||||
"0x00000: CTRL0 (Device control register) 0x%08X\n"
|
||||
" Link reset: %s\n"
|
||||
" VLAN mode: %s\n",
|
||||
reg,
|
||||
reg & IXGB_CTRL0_LRST ? "reset" : "normal",
|
||||
reg & IXGB_CTRL0_VME ? "enabled" : "disabled");
|
||||
|
||||
/* Device status register */
|
||||
reg = regs_buff[2];
|
||||
fprintf(stdout,
|
||||
"0x00010: STATUS (Device status register) 0x%08X\n"
|
||||
" Link up: %s\n"
|
||||
" Bus type: %s\n"
|
||||
" Bus speed: %s\n"
|
||||
" Bus width: %s\n",
|
||||
reg,
|
||||
(reg & IXGB_STATUS_LU) ? "link config" : "no link config",
|
||||
(reg & IXGB_STATUS_PCIX_MODE) ? "PCI-X" : "PCI",
|
||||
((reg & IXGB_STATUS_PCIX_SPD_133) ? "133MHz" :
|
||||
(reg & IXGB_STATUS_PCIX_SPD_100) ? "100MHz" :
|
||||
"66MHz"),
|
||||
(reg & IXGB_STATUS_BUS64) ? "64-bit" : "32-bit");
|
||||
/* Receive control register */
|
||||
reg = regs_buff[9];
|
||||
fprintf(stdout,
|
||||
"0x00100: RCTL (Receive control register) 0x%08X\n"
|
||||
" Receiver: %s\n"
|
||||
" Store bad packets: %s\n"
|
||||
" Unicast promiscuous: %s\n"
|
||||
" Multicast promiscuous: %s\n"
|
||||
" Descriptor minimum threshold size: %s\n"
|
||||
" Broadcast accept mode: %s\n"
|
||||
" VLAN filter: %s\n"
|
||||
" Cononical form indicator: %s\n",
|
||||
reg,
|
||||
reg & IXGB_RCTL_RXEN ? "enabled" : "disabled",
|
||||
reg & IXGB_RCTL_SBP ? "enabled" : "disabled",
|
||||
reg & IXGB_RCTL_UPE ? "enabled" : "disabled",
|
||||
reg & IXGB_RCTL_MPE ? "enabled" : "disabled",
|
||||
(reg & IXGB_RCTL_RDMTS_MASK) == IXGB_RCTL_RDMTS_1_2 ? "1/2" :
|
||||
(reg & IXGB_RCTL_RDMTS_MASK) == IXGB_RCTL_RDMTS_1_4 ? "1/4" :
|
||||
(reg & IXGB_RCTL_RDMTS_MASK) == IXGB_RCTL_RDMTS_1_8 ? "1/8" :
|
||||
"reserved",
|
||||
reg & IXGB_RCTL_BAM ? "accept" : "ignore",
|
||||
reg & IXGB_RCTL_VFE ? "enabled" : "disabled",
|
||||
reg & IXGB_RCTL_CFIEN ? "enabled" : "disabled");
|
||||
fprintf(stdout,
|
||||
" Receive buffer size: %s\n",
|
||||
(reg & IXGB_RCTL_BSIZE_MASK) == IXGB_RCTL_BSIZE_16384 ? "16384" :
|
||||
(reg & IXGB_RCTL_BSIZE_MASK) == IXGB_RCTL_BSIZE_8192 ? "8192" :
|
||||
(reg & IXGB_RCTL_BSIZE_MASK) == IXGB_RCTL_BSIZE_4096 ? "4096" :
|
||||
"2048");
|
||||
|
||||
/* Receive descriptor registers */
|
||||
fprintf(stdout,
|
||||
"0x00120: RDLEN (Receive desc length) 0x%08X\n",
|
||||
regs_buff[14]);
|
||||
fprintf(stdout,
|
||||
"0x00128: RDH (Receive desc head) 0x%08X\n",
|
||||
regs_buff[15]);
|
||||
fprintf(stdout,
|
||||
"0x00130: RDT (Receive desc tail) 0x%08X\n",
|
||||
regs_buff[16]);
|
||||
fprintf(stdout,
|
||||
"0x00138: RDTR (Receive delay timer) 0x%08X\n",
|
||||
regs_buff[17]);
|
||||
|
||||
/* Transmit control register */
|
||||
reg = regs_buff[53];
|
||||
fprintf(stdout,
|
||||
"0x00600: TCTL (Transmit ctrl register) 0x%08X\n"
|
||||
" Transmitter: %s\n",
|
||||
reg,
|
||||
reg & IXGB_TCTL_TXEN ? "enabled" : "disabled");
|
||||
|
||||
/* Transmit descriptor registers */
|
||||
fprintf(stdout,
|
||||
"0x00610: TDLEN (Transmit desc length) 0x%08X\n",
|
||||
regs_buff[56]);
|
||||
fprintf(stdout,
|
||||
"0x00618: TDH (Transmit desc head) 0x%08X\n",
|
||||
regs_buff[57]);
|
||||
fprintf(stdout,
|
||||
"0x00620: TDT (Transmit desc tail) 0x%08X\n",
|
||||
regs_buff[58]);
|
||||
fprintf(stdout,
|
||||
"0x00628: TIDV (Transmit delay timer) 0x%08X\n",
|
||||
regs_buff[59]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
/* Copyright (c) 2013 Intel Corporation */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
int
|
||||
ixgbevf_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
u8 version = (u8)(regs->version >> 24);
|
||||
u8 i;
|
||||
|
||||
if (version == 0)
|
||||
return -1;
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00000: VFCTRL (VF Control Register) (Write Only) N/A\n");
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00008: VFSTATUS (VF Status Register) 0x%08X\n",
|
||||
regs_buff[1]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00010: VFLINKS (VF Link Status Register) 0x%08X\n",
|
||||
regs_buff[2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x03190: VFRXMEMWRAP (Rx Packet Buffer Flush Detect) 0x%08X\n",
|
||||
regs_buff[3]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00048: VFFRTIMER (VF Free Running Timer) 0x%08X\n",
|
||||
regs_buff[4]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00100: VFEICR (VF Extended Interrupt Cause) 0x%08X\n",
|
||||
regs_buff[5]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00104: VFEICS (VF Extended Interrupt Cause Set) 0x%08X\n",
|
||||
regs_buff[6]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00108: VFEIMS (VF Extended Interrupt Mask Set) 0x%08X\n",
|
||||
regs_buff[7]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x0010C: VFEIMC (VF Extended Interrupt Mask Clear) 0x%08X\n",
|
||||
regs_buff[8]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00110: VFEIAC (VF Extended Interrupt Auto Clear) 0x%08X\n",
|
||||
regs_buff[9]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00114: VFEIAM (VF Extended Interrupt Auto Mask) 0x%08X\n",
|
||||
regs_buff[10]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00820: VFEITR(0) (VF Extended Interrupt Throttle) 0x%08X\n",
|
||||
regs_buff[11]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00120: VFIVAR(0) (VF Interrupt Vector Allocation) 0x%08X\n",
|
||||
regs_buff[12]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00140: VFIVAR_MISC (VF Interrupt Vector Misc) 0x%08X\n",
|
||||
regs_buff[13]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00104: VFPSRTYPE (VF Replication Packet Split Type) 0x%08X\n",
|
||||
regs_buff[28]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFRDBAL(%d) (VF Rx Desc. Base Addr Low %d) 0x%08X\n",
|
||||
0x1000 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[14+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFRDBAH(%d) (VF Rx Desc. Base Addr High %d) 0x%08X\n",
|
||||
0x1004 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[16+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFRDLEN(%d) (VF Rx Desc. Length %d) 0x%08X\n",
|
||||
0x1008 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[18+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFRDH(%d) (VF Rx Desc. Head %d) 0x%08X\n",
|
||||
0x1010 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[20+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFRDT(%d) (VF Rx Desc. Tail %d) 0x%08X\n",
|
||||
0x1018 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[22+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFRDT(%d) (VF Rx Desc. Control %d), 0x%08X\n",
|
||||
0x1028 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[24+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFSRRCTL(%d) (VF Split Rx Control %d) 0x%08X\n",
|
||||
0x1014 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[26+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDBAL(%d) (VF Tx Desc. Base Addr Low %d) 0x%08X\n",
|
||||
0x2000 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[29+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDBAH(%d) (VF Tx Desc. Base Addr High %d) 0x%08X\n",
|
||||
0x2004 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[31+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDLEN(%d) (VF Tx Desc. Length %d) 0x%08X\n",
|
||||
0x2008 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[33+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDH(%d) (VF Tx Desc. Head %d) 0x%08X\n",
|
||||
0x2010 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[35+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDT(%d) (VF Tx Desc. Tail %d) 0x%08X\n",
|
||||
0x2018 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[37+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDT(%d) (VF Tx Desc. Control %d) 0x%08X\n",
|
||||
0x2028 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[39+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDWBAL(%d) (VF Tx Desc. Write Back Addr Lo %d) 0x%08X\n",
|
||||
0x2038 + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[41+i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf(stdout,
|
||||
"0x%05x: VFTDWBAH(%d) (VF Tx Desc. Write Back Addr Hi %d) 0x%08X\n",
|
||||
0x203C + 0x40*i,
|
||||
i, i,
|
||||
regs_buff[43+i]);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal.h"
|
||||
|
||||
int lan78xx_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
unsigned int *lan78xx_reg = (unsigned int *)regs->data;
|
||||
|
||||
fprintf(stdout, "LAN78xx Registers:\n");
|
||||
fprintf(stdout, "------------------\n");
|
||||
fprintf(stdout, "ID_REV = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "INT_STS = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "HW_CFG = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "PMT_CTRL = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "E2P_CMD = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "E2P_DATA = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "USB_STATUS = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "VLAN_TYPE = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "MAC Registers:\n");
|
||||
fprintf(stdout, "--------------\n");
|
||||
fprintf(stdout, "MAC_CR = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "MAC_RX = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "MAC_TX = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "FLOW = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "ERR_STS = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "MII_ACC = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "MII_DATA = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "EEE_TX_LPI_REQ_DLY = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "EEE_TW_TX_SYS = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "EEE_TX_LPI_REM_DLY = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "WUCSR = 0x%08X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "PHY Registers:\n");
|
||||
fprintf(stdout, "--------------\n");
|
||||
fprintf(stdout, "Mode Control = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Mode Status = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Device identifier1 = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Device identifier2 = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Auto-Neg Advertisement = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "Auto-Neg Link Partner Ability = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "Auto-Neg Expansion = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Auto-Neg Next Page TX = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Auto-Neg Link Partner Next Page RX = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "1000BASE-T Control = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "1000BASE-T Status = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Reserved = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Reserved = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "MMD Access Control = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "MMD Access Address/Data = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "1000BASE-T Status Extension1 = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "1000BASE-TX Status Extension = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "1000BASE-T Status Extension2 = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "Bypass Control = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout,
|
||||
"100BASE-TX/1000BASE-T Rx Error Counter = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout,
|
||||
"100BASE-TX/1000BASE-T FC Err Counter = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout,
|
||||
"10BASE-T/100BASE-TX/1000BASE-T LD Counter = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "Extended 10BASE-T Control and Status = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "Extended PHY Control1 = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Extended PHY Control2 = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Interrupt Mask = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Interrupt Status = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Reserved = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Auxiliary Control and Status = 0x%04X\n",
|
||||
*lan78xx_reg++);
|
||||
fprintf(stdout, "LED Mode Select = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "LED Behavior = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "Extended Page Access = 0x%04X\n", *lan78xx_reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,455 @@
|
|||
/*
|
||||
* Code to dump Marvell SysKonnect registers for skge and sky2 drivers.
|
||||
*
|
||||
* Copyright (C) 2004, 2006
|
||||
* Stephen Hemminger <shemminger@osdl.org>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
static void dump_addr(int n, const u8 *a)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("Addr %d ", n);
|
||||
for (i = 0; i < 6; i++)
|
||||
printf("%02X%c", a[i], i == 5 ? '\n' : ' ');
|
||||
}
|
||||
|
||||
static void dump_timer(const char *name, const void *p)
|
||||
{
|
||||
const u8 *a = p;
|
||||
const u32 *r = p;
|
||||
|
||||
printf("%s\n", name);
|
||||
printf("\tInit 0x%08X Value 0x%08X\n", r[0], r[1]);
|
||||
printf("\tTest 0x%02X Control 0x%02X\n", a[8], a[9]);
|
||||
}
|
||||
|
||||
static void dump_queue(const char *name, const void *a, int rx)
|
||||
{
|
||||
struct desc {
|
||||
u_int32_t ctl;
|
||||
u_int32_t next;
|
||||
u_int32_t data_lo;
|
||||
u_int32_t data_hi;
|
||||
u_int32_t status;
|
||||
u_int32_t timestamp;
|
||||
u_int16_t csum2;
|
||||
u_int16_t csum1;
|
||||
u_int16_t csum2_start;
|
||||
u_int16_t csum1_start;
|
||||
u_int32_t addr_lo;
|
||||
u_int32_t addr_hi;
|
||||
u_int32_t count_lo;
|
||||
u_int32_t count_hi;
|
||||
u_int32_t byte_count;
|
||||
u_int32_t csr;
|
||||
u_int32_t flag;
|
||||
};
|
||||
const struct desc *d = a;
|
||||
|
||||
/* is reset bit set? */
|
||||
if (!(d->ctl & 2)) {
|
||||
printf("\n%s (disabled)\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n%s\n", name);
|
||||
printf("---------------\n");
|
||||
printf("Descriptor Address 0x%08X%08X\n",
|
||||
d->addr_hi, d->addr_lo);
|
||||
printf("Address Counter 0x%08X%08X\n",
|
||||
d->count_hi, d->count_lo);
|
||||
printf("Current Byte Counter %d\n", d->byte_count);
|
||||
printf("BMU Control/Status 0x%08X\n", d->csr);
|
||||
printf("Flag & FIFO Address 0x%08X\n", d->flag);
|
||||
printf("\n");
|
||||
printf("Control 0x%08X\n", d->ctl);
|
||||
printf("Next 0x%08X\n", d->next);
|
||||
printf("Data 0x%08X%08X\n",
|
||||
d->data_hi, d->data_lo);
|
||||
printf("Status 0x%08X\n", d->status);
|
||||
printf("Timestamp 0x%08X\n", d->timestamp);
|
||||
if (rx) {
|
||||
printf("Csum1 Offset %4d Position %d\n",
|
||||
d->csum1, d->csum1_start);
|
||||
printf("Csum2 Offset %4d Position %d\n",
|
||||
d->csum2, d->csum2_start);
|
||||
} else
|
||||
printf("Csum Start 0x%04X Pos %4d Write %d\n",
|
||||
d->csum1, d->csum2_start, d->csum1_start);
|
||||
|
||||
}
|
||||
|
||||
static void dump_ram(const char *name, const void *p)
|
||||
{
|
||||
const u32 *r = p;
|
||||
|
||||
if (!(r[10] & 2)) {
|
||||
printf("\n%s (disabled)\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n%s\n", name);
|
||||
printf("---------------\n");
|
||||
printf("Start Address 0x%08X\n", r[0]);
|
||||
printf("End Address 0x%08X\n", r[1]);
|
||||
printf("Write Pointer 0x%08X\n", r[2]);
|
||||
printf("Read Pointer 0x%08X\n", r[3]);
|
||||
|
||||
if (*name == 'R') { /* Receive only */
|
||||
printf("Upper Threshold/Pause Packets 0x%08X\n", r[4]);
|
||||
printf("Lower Threshold/Pause Packets 0x%08X\n", r[5]);
|
||||
printf("Upper Threshold/High Priority 0x%08X\n", r[6]);
|
||||
printf("Lower Threshold/High Priority 0x%08X\n", r[7]);
|
||||
}
|
||||
printf("Packet Counter 0x%08X\n", r[8]);
|
||||
printf("Level 0x%08X\n", r[9]);
|
||||
printf("Control 0x%08X\n", r[10]);
|
||||
}
|
||||
|
||||
static void dump_fifo(const char *name, const void *p)
|
||||
{
|
||||
const u32 *r = p;
|
||||
|
||||
printf("\n%s\n", name);
|
||||
printf("---------------\n");
|
||||
printf("End Address 0x%08X\n", r[0]);
|
||||
printf("Write Pointer 0x%08X\n", r[1]);
|
||||
printf("Read Pointer 0x%08X\n", r[2]);
|
||||
printf("Packet Counter 0x%08X\n", r[3]);
|
||||
printf("Level 0x%08X\n", r[4]);
|
||||
printf("Control 0x%08X\n", r[5]);
|
||||
printf("Control/Test 0x%08X\n", r[6]);
|
||||
dump_timer("LED", r + 8);
|
||||
}
|
||||
|
||||
static void dump_gmac_fifo(const char *name, const void *p)
|
||||
{
|
||||
const u32 *r = p;
|
||||
int i;
|
||||
static const char *regs[] = {
|
||||
"End Address",
|
||||
"Almost Full Thresh",
|
||||
"Control/Test",
|
||||
"FIFO Flush Mask",
|
||||
"FIFO Flush Threshold",
|
||||
"Truncation Threshold",
|
||||
"Upper Pause Threshold",
|
||||
"Lower Pause Threshold",
|
||||
"VLAN Tag",
|
||||
"FIFO Write Pointer",
|
||||
"FIFO Write Level",
|
||||
"FIFO Read Pointer",
|
||||
"FIFO Read Level",
|
||||
};
|
||||
|
||||
printf("\n%s\n", name);
|
||||
for (i = 0; i < sizeof(regs)/sizeof(regs[0]); ++i)
|
||||
printf("%-32s 0x%08X\n", regs[i], r[i]);
|
||||
|
||||
}
|
||||
|
||||
static void dump_mac(const u8 *r)
|
||||
{
|
||||
u8 id;
|
||||
|
||||
printf("\nMAC Addresses\n");
|
||||
printf("---------------\n");
|
||||
dump_addr(1, r + 0x100);
|
||||
dump_addr(2, r + 0x108);
|
||||
dump_addr(3, r + 0x110);
|
||||
printf("\n");
|
||||
|
||||
printf("Connector type 0x%02X (%c)\n",
|
||||
r[0x118], (char)r[0x118]);
|
||||
printf("PMD type 0x%02X (%c)\n",
|
||||
r[0x119], (char)r[0x119]);
|
||||
printf("PHY type 0x%02X\n", r[0x11d]);
|
||||
|
||||
id = r[0x11b];
|
||||
printf("Chip Id 0x%02X ", id);
|
||||
|
||||
switch (id) {
|
||||
case 0x0a: printf("Genesis"); break;
|
||||
case 0xb0: printf("Yukon"); break;
|
||||
case 0xb1: printf("Yukon-Lite"); break;
|
||||
case 0xb2: printf("Yukon-LP"); break;
|
||||
case 0xb3: printf("Yukon-2 XL"); break;
|
||||
case 0xb5: printf("Yukon Extreme"); break;
|
||||
case 0xb4: printf("Yukon-2 EC Ultra"); break;
|
||||
case 0xb6: printf("Yukon-2 EC"); break;
|
||||
case 0xb7: printf("Yukon-2 FE"); break;
|
||||
case 0xb8: printf("Yukon-2 FE Plus"); break;
|
||||
case 0xb9: printf("Yukon Supreme"); break;
|
||||
case 0xba: printf("Yukon Ultra 2"); break;
|
||||
case 0xbc: printf("Yukon Optima"); break;
|
||||
default: printf("(Unknown)"); break;
|
||||
}
|
||||
|
||||
printf(" (rev %d)\n", (r[0x11a] & 0xf0) >> 4);
|
||||
|
||||
printf("Ram Buffer 0x%02X\n", r[0x11c]);
|
||||
|
||||
}
|
||||
|
||||
static void dump_gma(const char *name, const u8 *r)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("%12s address: ", name);
|
||||
for (i = 0; i < 3; i++) {
|
||||
u16 a = *(u16 *)(r + i * 4);
|
||||
printf(" %02X %02X", a & 0xff, (a >> 8) & 0xff);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void dump_gmac(const char *name, const u8 *data)
|
||||
{
|
||||
printf("\n%s\n", name);
|
||||
|
||||
printf("Status 0x%04X\n", *(u16 *) data);
|
||||
printf("Control 0x%04X\n", *(u16 *) (data + 4));
|
||||
printf("Transmit 0x%04X\n", *(u16 *) (data + 8));
|
||||
printf("Receive 0x%04X\n", *(u16 *) (data + 0xc));
|
||||
printf("Transmit flow control 0x%04X\n", *(u16 *) (data + 0x10));
|
||||
printf("Transmit parameter 0x%04X\n", *(u16 *) (data + 0x14));
|
||||
printf("Serial mode 0x%04X\n", *(u16 *) (data + 0x18));
|
||||
|
||||
dump_gma("Source", data + 0x1c);
|
||||
dump_gma("Physical", data + 0x28);
|
||||
}
|
||||
|
||||
static void dump_pci(const u8 *cfg)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("\nPCI config\n----------\n");
|
||||
for(i = 0; i < 0x80; i++) {
|
||||
if (!(i & 15))
|
||||
printf("%02x:", i);
|
||||
printf(" %02x", cfg[i]);
|
||||
if ((i & 15) == 15)
|
||||
putchar('\n');
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void dump_control(u8 *r)
|
||||
{
|
||||
printf("Control Registers\n");
|
||||
printf("-----------------\n");
|
||||
|
||||
printf("Register Access Port 0x%02X\n", *r);
|
||||
printf("LED Control/Status 0x%08X\n", *(u32 *) (r + 4));
|
||||
|
||||
printf("Interrupt Source 0x%08X\n", *(u32 *) (r + 8));
|
||||
printf("Interrupt Mask 0x%08X\n", *(u32 *) (r + 0xc));
|
||||
printf("Interrupt Hardware Error Source 0x%08X\n", *(u32 *) (r + 0x10));
|
||||
printf("Interrupt Hardware Error Mask 0x%08X\n", *(u32 *) (r + 0x14));
|
||||
printf("Interrupt Control 0x%08X\n", *(u32 *) (r + 0x2c));
|
||||
printf("Interrupt Moderation Mask 0x%08X\n", *(u32 *) (r + 0x14c));
|
||||
printf("Hardware Moderation Mask 0x%08X\n", *(u32 *) (r + 0x150));
|
||||
dump_timer("Moderation Timer", r + 0x140);
|
||||
|
||||
printf("General Purpose I/O 0x%08X\n", *(u32 *) (r + 0x15c));
|
||||
}
|
||||
|
||||
int skge_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
const u32 *r = (const u32 *) regs->data;
|
||||
int dual = !(regs->data[0x11a] & 1);
|
||||
|
||||
dump_pci(regs->data + 0x380);
|
||||
|
||||
dump_control(regs->data);
|
||||
|
||||
printf("\nBus Management Unit\n");
|
||||
printf("-------------------\n");
|
||||
printf("CSR Receive Queue 1 0x%08X\n", r[24]);
|
||||
printf("CSR Sync Queue 1 0x%08X\n", r[26]);
|
||||
printf("CSR Async Queue 1 0x%08X\n", r[27]);
|
||||
if (dual) {
|
||||
printf("CSR Receive Queue 2 0x%08X\n", r[25]);
|
||||
printf("CSR Async Queue 2 0x%08X\n", r[29]);
|
||||
printf("CSR Sync Queue 2 0x%08X\n", r[28]);
|
||||
}
|
||||
|
||||
dump_mac(regs->data);
|
||||
dump_gmac("GMAC 1", regs->data + 0x2800);
|
||||
|
||||
dump_timer("Timer", regs->data + 0x130);
|
||||
dump_timer("Blink Source", regs->data +0x170);
|
||||
|
||||
dump_queue("Receive Queue 1", regs->data +0x400, 1);
|
||||
dump_queue("Sync Transmit Queue 1", regs->data +0x600, 0);
|
||||
dump_queue("Async Transmit Queue 1", regs->data +0x680, 0);
|
||||
|
||||
dump_ram("Receive RAMbuffer 1", regs->data+0x800);
|
||||
dump_ram("Sync Transmit RAMbuffer 1", regs->data+0xa00);
|
||||
dump_ram("Async Transmit RAMbuffer 1", regs->data+0xa80);
|
||||
|
||||
dump_fifo("Receive MAC FIFO 1", regs->data+0xc00);
|
||||
dump_fifo("Transmit MAC FIFO 1", regs->data+0xd00);
|
||||
if (dual) {
|
||||
dump_gmac("GMAC 1", regs->data + 0x2800);
|
||||
|
||||
dump_queue("Receive Queue 2", regs->data +0x480, 1);
|
||||
dump_queue("Async Transmit Queue 2", regs->data +0x780, 0);
|
||||
dump_queue("Sync Transmit Queue 2", regs->data +0x700, 0);
|
||||
|
||||
dump_ram("Receive RAMbuffer 2", regs->data+0x880);
|
||||
dump_ram("Sync Transmit RAMbuffer 2", regs->data+0xb00);
|
||||
dump_ram("Async Transmit RAMbuffer 21", regs->data+0xb80);
|
||||
|
||||
dump_fifo("Receive MAC FIFO 2", regs->data+0xc80);
|
||||
dump_fifo("Transmit MAC FIFO 2", regs->data+0xd80);
|
||||
}
|
||||
|
||||
dump_timer("Descriptor Poll", regs->data+0xe00);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static void dump_queue2(const char *name, void *a, int rx)
|
||||
{
|
||||
struct sky2_queue {
|
||||
u16 buf_control;
|
||||
u16 byte_count;
|
||||
u32 rss;
|
||||
u32 addr_lo, addr_hi;
|
||||
u32 status;
|
||||
u32 timestamp;
|
||||
u16 csum1, csum2;
|
||||
u16 csum1_start, csum2_start;
|
||||
u16 length;
|
||||
u16 vlan;
|
||||
u16 rsvd1;
|
||||
u16 done;
|
||||
u32 req_lo, req_hi;
|
||||
u16 rsvd2;
|
||||
u16 req_count;
|
||||
u32 csr;
|
||||
} *d = a;
|
||||
|
||||
printf("\n%s\n", name);
|
||||
printf("---------------\n");
|
||||
|
||||
printf("Buffer control 0x%04X\n", d->buf_control);
|
||||
|
||||
printf("Byte Counter %d\n", d->byte_count);
|
||||
printf("Descriptor Address 0x%08X%08X\n",
|
||||
d->addr_hi, d->addr_lo);
|
||||
printf("Status 0x%08X\n", d->status);
|
||||
printf("Timestamp 0x%08X\n", d->timestamp);
|
||||
printf("BMU Control/Status 0x%08X\n", d->csr);
|
||||
printf("Done 0x%04X\n", d->done);
|
||||
printf("Request 0x%08X%08X\n",
|
||||
d->req_hi, d->req_lo);
|
||||
if (rx) {
|
||||
printf("Csum1 Offset %4d Position %d\n",
|
||||
d->csum1, d->csum1_start);
|
||||
printf("Csum2 Offset %4d Position %d\n",
|
||||
d->csum2, d->csum2_start);
|
||||
} else
|
||||
printf("Csum Start 0x%04X Pos %4d Write %d\n",
|
||||
d->csum1, d->csum2_start, d->csum1_start);
|
||||
}
|
||||
|
||||
static void dump_prefetch(const char *name, const void *r)
|
||||
{
|
||||
const u32 *reg = r;
|
||||
|
||||
printf("\n%s Prefetch\n", name);
|
||||
printf("Control 0x%08X\n", reg[0]);
|
||||
printf("Last Index %u\n", reg[1]);
|
||||
printf("Start Address 0x%08x%08x\n", reg[3], reg[2]);
|
||||
if (*name == 'S') { /* Status unit */
|
||||
printf("TX1 report %u\n", reg[4]);
|
||||
printf("TX2 report %u\n", reg[5]);
|
||||
printf("TX threshold %u\n", reg[6]);
|
||||
printf("Put Index %u\n", reg[7]);
|
||||
} else {
|
||||
printf("Get Index %u\n", reg[4]);
|
||||
printf("Put Index %u\n", reg[5]);
|
||||
}
|
||||
}
|
||||
|
||||
int sky2_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
const u16 *r16 = (const u16 *) regs->data;
|
||||
const u32 *r32 = (const u32 *) regs->data;
|
||||
int dual;
|
||||
|
||||
dump_pci(regs->data + 0x1c00);
|
||||
|
||||
dump_control(regs->data);
|
||||
|
||||
printf("\nBus Management Unit\n");
|
||||
printf("-------------------\n");
|
||||
printf("CSR Receive Queue 1 0x%08X\n", r32[24]);
|
||||
printf("CSR Sync Queue 1 0x%08X\n", r32[26]);
|
||||
printf("CSR Async Queue 1 0x%08X\n", r32[27]);
|
||||
|
||||
dual = (regs->data[0x11e] & 2) != 0;
|
||||
if (dual) {
|
||||
printf("CSR Receive Queue 2 0x%08X\n", r32[25]);
|
||||
printf("CSR Async Queue 2 0x%08X\n", r32[29]);
|
||||
printf("CSR Sync Queue 2 0x%08X\n", r32[28]);
|
||||
}
|
||||
|
||||
dump_mac(regs->data);
|
||||
|
||||
dump_prefetch("Status", regs->data + 0xe80);
|
||||
dump_prefetch("Receive 1", regs->data + 0x450);
|
||||
dump_prefetch("Transmit 1", regs->data + 0x450 + 0x280);
|
||||
|
||||
if (dual) {
|
||||
dump_prefetch("Receive 2", regs->data + 0x450 + 0x80);
|
||||
dump_prefetch("Transmit 2", regs->data + 0x450 + 0x380);
|
||||
}
|
||||
|
||||
printf("\nStatus FIFO\n");
|
||||
printf("\tWrite Pointer 0x%02X\n", regs->data[0xea0]);
|
||||
printf("\tRead Pointer 0x%02X\n", regs->data[0xea4]);
|
||||
printf("\tLevel 0x%02X\n", regs->data[0xea8]);
|
||||
printf("\tWatermark 0x%02X\n", regs->data[0xeac]);
|
||||
printf("\tISR Watermark 0x%02X\n", regs->data[0xead]);
|
||||
|
||||
dump_timer("Status level", regs->data + 0xeb0);
|
||||
dump_timer("TX status", regs->data + 0xec0);
|
||||
dump_timer("ISR", regs->data + 0xed0);
|
||||
|
||||
printf("\nGMAC control 0x%04X\n", r32[0xf00 >> 2]);
|
||||
printf("GPHY control 0x%04X\n", r32[0xf04 >> 2]);
|
||||
printf("LINK control 0x%02hX\n", r16[0xf10 >> 1]);
|
||||
|
||||
dump_gmac("GMAC 1", regs->data + 0x2800);
|
||||
dump_gmac_fifo("Rx GMAC 1", regs->data + 0xc40);
|
||||
dump_gmac_fifo("Tx GMAC 1", regs->data + 0xd40);
|
||||
|
||||
dump_queue2("Receive Queue 1", regs->data +0x400, 1);
|
||||
dump_queue("Sync Transmit Queue 1", regs->data +0x600, 0);
|
||||
dump_queue2("Async Transmit Queue 1", regs->data +0x680, 0);
|
||||
|
||||
dump_ram("Receive RAMbuffer 1", regs->data+0x800);
|
||||
dump_ram("Sync Transmit RAMbuffer 1", regs->data+0xa00);
|
||||
dump_ram("Async Transmit RAMbuffer 1", regs->data+0xa80);
|
||||
|
||||
if (dual) {
|
||||
dump_ram("Receive RAMbuffer 2", regs->data+0x880);
|
||||
dump_ram("Sync Transmit RAMbuffer 2", regs->data+0xb00);
|
||||
dump_ram("Async Transmit RAMbuffer 21", regs->data+0xb80);
|
||||
dump_gmac("GMAC 2", regs->data + 0x3800);
|
||||
dump_gmac_fifo("Rx GMAC 2", regs->data + 0xc40 + 128);
|
||||
dump_gmac_fifo("Tx GMAC 2", regs->data + 0xd40 + 128);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2013-10-28.13; # UTC
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,987 @@
|
|||
/* Copyright 2001 Sun Microsystems (thockin@sun.com) */
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define PCI_VENDOR_NATSEMI 0x100b
|
||||
#define PCI_DEVICE_DP83815 0x0020
|
||||
#define NATSEMI_MAGIC (PCI_VENDOR_NATSEMI | \
|
||||
(PCI_DEVICE_DP83815<<16))
|
||||
|
||||
/* register indices in the ethtool_regs->data */
|
||||
#define REG_CR 0
|
||||
#define BIT_CR_TXE (1<<0)
|
||||
#define BIT_CR_RXE (1<<2)
|
||||
#define BIT_CR_RST (1<<8)
|
||||
#define REG_CFG 1
|
||||
#define BIT_CFG_BEM (1<<0)
|
||||
#define BIT_CFG_BROM_DIS (1<<2)
|
||||
#define BIT_CFG_PHY_DIS (1<<9)
|
||||
#define BIT_CFG_PHY_RST (1<<10)
|
||||
#define BIT_CFG_EXT_PHY (1<<12)
|
||||
#define BIT_CFG_ANEG_EN (1<<13)
|
||||
#define BIT_CFG_ANEG_100 (1<<14)
|
||||
#define BIT_CFG_ANEG_FDUP (1<<15)
|
||||
#define BIT_CFG_PINT_ACEN (1<<17)
|
||||
#define BIT_CFG_PHY_CFG (0x3f<<18)
|
||||
#define BIT_CFG_ANEG_DN (1<<27)
|
||||
#define BIT_CFG_POL (1<<28)
|
||||
#define BIT_CFG_FDUP (1<<29)
|
||||
#define BIT_CFG_SPEED100 (1<<30)
|
||||
#define BIT_CFG_LNKSTS (1<<31)
|
||||
|
||||
#define REG_MEAR 2
|
||||
#define REG_PTSCR 3
|
||||
#define BIT_PTSCR_EEBIST_FAIL (1<<0)
|
||||
#define BIT_PTSCR_EELOAD_EN (1<<2)
|
||||
#define BIT_PTSCR_RBIST_RXFFAIL (1<<3)
|
||||
#define BIT_PTSCR_RBIST_TXFAIL (1<<4)
|
||||
#define BIT_PTSCR_RBIST_RXFAIL (1<<5)
|
||||
#define REG_ISR 4
|
||||
#define REG_IMR 5
|
||||
#define BIT_INTR_RXOK (1<<0)
|
||||
#define NAME_INTR_RXOK "Rx Complete"
|
||||
#define BIT_INTR_RXDESC (1<<1)
|
||||
#define NAME_INTR_RXDESC "Rx Descriptor"
|
||||
#define BIT_INTR_RXERR (1<<2)
|
||||
#define NAME_INTR_RXERR "Rx Packet Error"
|
||||
#define BIT_INTR_RXEARLY (1<<3)
|
||||
#define NAME_INTR_RXEARLY "Rx Early Threshold"
|
||||
#define BIT_INTR_RXIDLE (1<<4)
|
||||
#define NAME_INTR_RXIDLE "Rx Idle"
|
||||
#define BIT_INTR_RXORN (1<<5)
|
||||
#define NAME_INTR_RXORN "Rx Overrun"
|
||||
#define BIT_INTR_TXOK (1<<6)
|
||||
#define NAME_INTR_TXOK "Tx Packet OK"
|
||||
#define BIT_INTR_TXDESC (1<<7)
|
||||
#define NAME_INTR_TXDESC "Tx Descriptor"
|
||||
#define BIT_INTR_TXERR (1<<8)
|
||||
#define NAME_INTR_TXERR "Tx Packet Error"
|
||||
#define BIT_INTR_TXIDLE (1<<9)
|
||||
#define NAME_INTR_TXIDLE "Tx Idle"
|
||||
#define BIT_INTR_TXURN (1<<10)
|
||||
#define NAME_INTR_TXURN "Tx Underrun"
|
||||
#define BIT_INTR_MIB (1<<11)
|
||||
#define NAME_INTR_MIB "MIB Service"
|
||||
#define BIT_INTR_SWI (1<<12)
|
||||
#define NAME_INTR_SWI "Software"
|
||||
#define BIT_INTR_PME (1<<13)
|
||||
#define NAME_INTR_PME "Power Management Event"
|
||||
#define BIT_INTR_PHY (1<<14)
|
||||
#define NAME_INTR_PHY "Phy"
|
||||
#define BIT_INTR_HIBERR (1<<15)
|
||||
#define NAME_INTR_HIBERR "High Bits Error"
|
||||
#define BIT_INTR_RXSOVR (1<<16)
|
||||
#define NAME_INTR_RXSOVR "Rx Status FIFO Overrun"
|
||||
#define BIT_INTR_RTABT (1<<20)
|
||||
#define NAME_INTR_RTABT "Received Target Abort"
|
||||
#define BIT_INTR_RMABT (1<<20)
|
||||
#define NAME_INTR_RMABT "Received Master Abort"
|
||||
#define BIT_INTR_SSERR (1<<20)
|
||||
#define NAME_INTR_SSERR "Signaled System Error"
|
||||
#define BIT_INTR_DPERR (1<<20)
|
||||
#define NAME_INTR_DPERR "Detected Parity Error"
|
||||
#define BIT_INTR_RXRCMP (1<<20)
|
||||
#define NAME_INTR_RXRCMP "Rx Reset Complete"
|
||||
#define BIT_INTR_TXRCMP (1<<20)
|
||||
#define NAME_INTR_TXRCMP "Tx Reset Complete"
|
||||
#define REG_IER 6
|
||||
#define BIT_IER_IE (1<<0)
|
||||
#define REG_TXDP 8
|
||||
#define REG_TXCFG 9
|
||||
#define BIT_TXCFG_DRTH (0x3f<<0)
|
||||
#define BIT_TXCFG_FLTH (0x3f<<8)
|
||||
#define BIT_TXCFG_MXDMA (0x7<<20)
|
||||
#define BIT_TXCFG_ATP (1<<28)
|
||||
#define BIT_TXCFG_MLB (1<<29)
|
||||
#define BIT_TXCFG_HBI (1<<30)
|
||||
#define BIT_TXCFG_CSI (1<<31)
|
||||
#define REG_RXDP 12
|
||||
#define REG_RXCFG 13
|
||||
#define BIT_RXCFG_DRTH (0x1f<<1)
|
||||
#define BIT_RXCFG_MXDMA (0x7<<20)
|
||||
#define BIT_RXCFG_ALP (1<<27)
|
||||
#define BIT_RXCFG_ATX (1<<28)
|
||||
#define BIT_RXCFG_ARP (1<<30)
|
||||
#define BIT_RXCFG_AEP (1<<31)
|
||||
#define REG_CCSR 15
|
||||
#define BIT_CCSR_CLKRUN_EN (1<<0)
|
||||
#define BIT_CCSR_PMEEN (1<<8)
|
||||
#define BIT_CCSR_PMESTS (1<<15)
|
||||
#define REG_WCSR 16
|
||||
#define BIT_WCSR_WKPHY (1<<0)
|
||||
#define BIT_WCSR_WKUCP (1<<1)
|
||||
#define BIT_WCSR_WKMCP (1<<2)
|
||||
#define BIT_WCSR_WKBCP (1<<3)
|
||||
#define BIT_WCSR_WKARP (1<<4)
|
||||
#define BIT_WCSR_WKPAT0 (1<<5)
|
||||
#define BIT_WCSR_WKPAT1 (1<<6)
|
||||
#define BIT_WCSR_WKPAT2 (1<<7)
|
||||
#define BIT_WCSR_WKPAT3 (1<<8)
|
||||
#define BIT_WCSR_WKMAG (1<<9)
|
||||
#define BIT_WCSR_MPSOE (1<<10)
|
||||
#define BIT_WCSR_SOHACK (1<<20)
|
||||
#define BIT_WCSR_PHYINT (1<<22)
|
||||
#define BIT_WCSR_UCASTR (1<<23)
|
||||
#define BIT_WCSR_MCASTR (1<<24)
|
||||
#define BIT_WCSR_BCASTR (1<<25)
|
||||
#define BIT_WCSR_ARPR (1<<26)
|
||||
#define BIT_WCSR_PATM0 (1<<27)
|
||||
#define BIT_WCSR_PATM1 (1<<28)
|
||||
#define BIT_WCSR_PATM2 (1<<29)
|
||||
#define BIT_WCSR_PATM3 (1<<30)
|
||||
#define BIT_WCSR_MPR (1<<31)
|
||||
#define REG_PCR 17
|
||||
#define BIT_PCR_PAUSE_CNT (0xffff<<0)
|
||||
#define BIT_PCR_PSNEG (1<<21)
|
||||
#define BIT_PCR_PS_RCVD (1<<22)
|
||||
#define BIT_PCR_PS_DA (1<<29)
|
||||
#define BIT_PCR_PSMCAST (1<<30)
|
||||
#define BIT_PCR_PSEN (1<<31)
|
||||
#define REG_RFCR 18
|
||||
#define BIT_RFCR_UHEN (1<<20)
|
||||
#define BIT_RFCR_MHEN (1<<21)
|
||||
#define BIT_RFCR_AARP (1<<22)
|
||||
#define BIT_RFCR_APAT0 (1<<23)
|
||||
#define BIT_RFCR_APAT1 (1<<24)
|
||||
#define BIT_RFCR_APAT2 (1<<25)
|
||||
#define BIT_RFCR_APAT3 (1<<26)
|
||||
#define BIT_RFCR_APM (1<<27)
|
||||
#define BIT_RFCR_AAU (1<<28)
|
||||
#define BIT_RFCR_AAM (1<<29)
|
||||
#define BIT_RFCR_AAB (1<<30)
|
||||
#define BIT_RFCR_RFEN (1<<31)
|
||||
#define REG_RFDR 19
|
||||
#define REG_BRAR 20
|
||||
#define BIT_BRAR_AUTOINC (1<<31)
|
||||
#define REG_BRDR 21
|
||||
#define REG_SRR 22
|
||||
#define REG_MIBC 23
|
||||
#define BIT_MIBC_WRN (1<<0)
|
||||
#define BIT_MIBC_FRZ (1<<1)
|
||||
#define REG_MIB0 24
|
||||
#define REG_MIB1 25
|
||||
#define REG_MIB2 26
|
||||
#define REG_MIB3 27
|
||||
#define REG_MIB4 28
|
||||
#define REG_MIB5 29
|
||||
#define REG_MIB6 30
|
||||
#define REG_BMCR 32
|
||||
#define BIT_BMCR_FDUP (1<<8)
|
||||
#define BIT_BMCR_ANRST (1<<9)
|
||||
#define BIT_BMCR_ISOL (1<<10)
|
||||
#define BIT_BMCR_PDOWN (1<<11)
|
||||
#define BIT_BMCR_ANEN (1<<12)
|
||||
#define BIT_BMCR_SPEED (1<<13)
|
||||
#define BIT_BMCR_LOOP (1<<14)
|
||||
#define BIT_BMCR_RST (1<<15)
|
||||
#define REG_BMSR 33
|
||||
#define BIT_BMSR_JABBER (1<<1)
|
||||
#define BIT_BMSR_LNK (1<<2)
|
||||
#define BIT_BMSR_ANCAP (1<<3)
|
||||
#define BIT_BMSR_RFAULT (1<<4)
|
||||
#define BIT_BMSR_ANDONE (1<<5)
|
||||
#define BIT_BMSR_PREAMBLE (1<<6)
|
||||
#define BIT_BMSR_10HCAP (1<<11)
|
||||
#define BIT_BMSR_10FCAP (1<<12)
|
||||
#define BIT_BMSR_100HCAP (1<<13)
|
||||
#define BIT_BMSR_100FCAP (1<<14)
|
||||
#define BIT_BMSR_100T4CAP (1<<15)
|
||||
#define REG_PHYIDR1 34
|
||||
#define REG_PHYIDR2 35
|
||||
#define BIT_PHYIDR2_OUILSB (0x3f<<10)
|
||||
#define BIT_PHYIDR2_MODEL (0x3f<<4)
|
||||
#define BIT_PHYIDR2_REV (0xf)
|
||||
#define REG_ANAR 36
|
||||
#define BIT_ANAR_PROTO (0x1f<<0)
|
||||
#define BIT_ANAR_10 (1<<5)
|
||||
#define BIT_ANAR_10_FD (1<<6)
|
||||
#define BIT_ANAR_TX (1<<7)
|
||||
#define BIT_ANAR_TXFD (1<<8)
|
||||
#define BIT_ANAR_T4 (1<<9)
|
||||
#define BIT_ANAR_PAUSE (1<<10)
|
||||
#define BIT_ANAR_RF (1<<13)
|
||||
#define BIT_ANAR_NP (1<<15)
|
||||
#define REG_ANLPAR 37
|
||||
#define BIT_ANLPAR_PROTO (0x1f<<0)
|
||||
#define BIT_ANLPAR_10 (1<<5)
|
||||
#define BIT_ANLPAR_10_FD (1<<6)
|
||||
#define BIT_ANLPAR_TX (1<<7)
|
||||
#define BIT_ANLPAR_TXFD (1<<8)
|
||||
#define BIT_ANLPAR_T4 (1<<9)
|
||||
#define BIT_ANLPAR_PAUSE (1<<10)
|
||||
#define BIT_ANLPAR_RF (1<<13)
|
||||
#define BIT_ANLPAR_ACK (1<<14)
|
||||
#define BIT_ANLPAR_NP (1<<15)
|
||||
#define REG_ANER 38
|
||||
#define BIT_ANER_LP_AN_ENABLE (1<<0)
|
||||
#define BIT_ANER_PAGE_RX (1<<1)
|
||||
#define BIT_ANER_NP_ABLE (1<<2)
|
||||
#define BIT_ANER_LP_NP_ABLE (1<<3)
|
||||
#define BIT_ANER_PDF (1<<4)
|
||||
#define REG_ANNPTR 39
|
||||
#define REG_PHYSTS 48
|
||||
#define BIT_PHYSTS_LNK (1<<0)
|
||||
#define BIT_PHYSTS_SPD10 (1<<1)
|
||||
#define BIT_PHYSTS_FDUP (1<<2)
|
||||
#define BIT_PHYSTS_LOOP (1<<3)
|
||||
#define BIT_PHYSTS_ANDONE (1<<4)
|
||||
#define BIT_PHYSTS_JABBER (1<<5)
|
||||
#define BIT_PHYSTS_RF (1<<6)
|
||||
#define BIT_PHYSTS_MINT (1<<7)
|
||||
#define BIT_PHYSTS_FC (1<<11)
|
||||
#define BIT_PHYSTS_POL (1<<12)
|
||||
#define BIT_PHYSTS_RXERR (1<<13)
|
||||
#define REG_MICR 49
|
||||
#define BIT_MICR_INTEN (1<<1)
|
||||
#define REG_MISR 50
|
||||
#define BIT_MISR_MSK_RHF (1<<9)
|
||||
#define BIT_MISR_MSK_FHF (1<<10)
|
||||
#define BIT_MISR_MSK_ANC (1<<11)
|
||||
#define BIT_MISR_MSK_RF (1<<12)
|
||||
#define BIT_MISR_MSK_JAB (1<<13)
|
||||
#define BIT_MISR_MSK_LNK (1<<14)
|
||||
#define BIT_MISR_MINT (1<<15)
|
||||
#define REG_PGSEL 51
|
||||
#define REG_FCSCR 52
|
||||
#define REG_RECR 53
|
||||
#define REG_PCSR 54
|
||||
#define BIT_PCSR_NRZI (1<<2)
|
||||
#define BIT_PCSR_FORCE_100 (1<<5)
|
||||
#define BIT_PCSR_SDOPT (1<<8)
|
||||
#define BIT_PCSR_SDFORCE (1<<9)
|
||||
#define BIT_PCSR_TQM (1<<10)
|
||||
#define BIT_PCSR_CLK (1<<11)
|
||||
#define BIT_PCSR_4B5B (1<<12)
|
||||
#define REG_PHYCR 57
|
||||
#define BIT_PHYCR_PHYADDR (0x1f<<0)
|
||||
#define BIT_PHYCR_PAUSE_STS (1<<7)
|
||||
#define BIT_PHYCR_STRETCH (1<<8)
|
||||
#define BIT_PHYCR_BIST (1<<9)
|
||||
#define BIT_PHYCR_BIST_STAT (1<<10)
|
||||
#define BIT_PHYCR_PSR15 (1<<11)
|
||||
#define REG_TBTSCR 58
|
||||
#define BIT_TBTSCR_JAB (1<<0)
|
||||
#define BIT_TBTSCR_BEAT (1<<1)
|
||||
#define BIT_TBTSCR_AUTOPOL (1<<3)
|
||||
#define BIT_TBTSCR_POL (1<<4)
|
||||
#define BIT_TBTSCR_FPOL (1<<5)
|
||||
#define BIT_TBTSCR_FORCE_10 (1<<6)
|
||||
#define BIT_TBTSCR_PULSE (1<<7)
|
||||
#define BIT_TBTSCR_LOOP (1<<8)
|
||||
#define REG_PMDCSR 64
|
||||
#define REG_TSTDAT 65
|
||||
#define REG_DSPCFG 66
|
||||
#define REG_SDCFG 67
|
||||
#define REG_PMATCH0 68
|
||||
#define REG_PMATCH1 69
|
||||
#define REG_PMATCH2 70
|
||||
#define REG_PCOUNT0 71
|
||||
#define REG_PCOUNT1 72
|
||||
#define REG_SOPASS0 73
|
||||
#define REG_SOPASS1 74
|
||||
#define REG_SOPASS2 75
|
||||
|
||||
static void __print_intr(int d, int intr, const char *name,
|
||||
const char *s1, const char *s2)
|
||||
{
|
||||
if ((d) & intr)
|
||||
fprintf(stdout, " %s Interrupt: %s\n", name, s1);
|
||||
else if (s2)
|
||||
fprintf(stdout, " %s Interrupt: %s\n", name, s2);
|
||||
}
|
||||
|
||||
#define PRINT_INTR(d, i, s1, s2) do { \
|
||||
int intr = BIT_INTR_ ## i; \
|
||||
const char *name = NAME_INTR_ ## i; \
|
||||
__print_intr(d, intr, name, s1, s2); \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_INTRS(d, s1, s2) do { \
|
||||
PRINT_INTR((d), RXOK, s1, s2); \
|
||||
PRINT_INTR((d), RXDESC, s1, s2); \
|
||||
PRINT_INTR((d), RXERR, s1, s2); \
|
||||
PRINT_INTR((d), RXEARLY, s1, s2); \
|
||||
PRINT_INTR((d), RXIDLE, s1, s2); \
|
||||
PRINT_INTR((d), RXORN, s1, s2); \
|
||||
PRINT_INTR((d), TXOK, s1, s2); \
|
||||
PRINT_INTR((d), TXDESC, s1, s2); \
|
||||
PRINT_INTR((d), TXERR, s1, s2); \
|
||||
PRINT_INTR((d), TXIDLE, s1, s2); \
|
||||
PRINT_INTR((d), TXURN, s1, s2); \
|
||||
PRINT_INTR((d), MIB, s1, s2); \
|
||||
PRINT_INTR((d), SWI, s1, s2); \
|
||||
PRINT_INTR((d), PME, s1, s2); \
|
||||
PRINT_INTR((d), PHY, s1, s2); \
|
||||
PRINT_INTR((d), HIBERR, s1, s2); \
|
||||
PRINT_INTR((d), RXSOVR, s1, s2); \
|
||||
PRINT_INTR((d), RTABT, s1, s2); \
|
||||
PRINT_INTR((d), RMABT, s1, s2); \
|
||||
PRINT_INTR((d), SSERR, s1, s2); \
|
||||
PRINT_INTR((d), DPERR, s1, s2); \
|
||||
PRINT_INTR((d), RXRCMP, s1, s2); \
|
||||
PRINT_INTR((d), TXRCMP, s1, s2); \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
natsemi_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *data = (u32 *)regs->data;
|
||||
u32 tmp;
|
||||
|
||||
fprintf(stdout, "Mac/BIU Registers\n");
|
||||
fprintf(stdout, "-----------------\n");
|
||||
|
||||
/* command register */
|
||||
fprintf(stdout,
|
||||
"0x00: CR (Command): 0x%08x\n",
|
||||
data[REG_CR]);
|
||||
fprintf(stdout,
|
||||
" Transmit %s\n"
|
||||
" Receive %s\n",
|
||||
data[REG_CR] & BIT_CR_TXE ? "Active" : "Idle",
|
||||
data[REG_CR] & BIT_CR_RXE ? "Active" : "Idle");
|
||||
if (data[REG_CR] & BIT_CR_RST) fprintf(stdout,
|
||||
" Reset In Progress\n");
|
||||
|
||||
/* configuration register */
|
||||
fprintf(stdout,
|
||||
"0x04: CFG (Configuration): 0x%08x\n",
|
||||
data[REG_CFG]);
|
||||
fprintf(stdout,
|
||||
" %s Endian\n"
|
||||
" Boot ROM %s\n"
|
||||
" Internal Phy %s\n"
|
||||
" Phy Reset %s\n"
|
||||
" External Phy %s\n"
|
||||
" Default Auto-Negotiation %s, %s %s Mb %s Duplex\n"
|
||||
" Phy Interrupt %sAuto-Cleared\n"
|
||||
" Phy Configuration = 0x%02x\n"
|
||||
" Auto-Negotiation %s\n"
|
||||
" %s Polarity\n"
|
||||
" %s Duplex\n"
|
||||
" %d Mb/s\n"
|
||||
" Link %s\n",
|
||||
data[REG_CFG] & BIT_CFG_BEM ? "Big" : "Little",
|
||||
data[REG_CFG] & BIT_CFG_BROM_DIS ? "Disabled" : "Enabled",
|
||||
data[REG_CFG] & BIT_CFG_PHY_DIS ? "Disabled" : "Enabled",
|
||||
data[REG_CFG] & BIT_CFG_PHY_RST ? "In Progress" : "Idle",
|
||||
data[REG_CFG] & BIT_CFG_EXT_PHY ? "Enabled" : "Disabled",
|
||||
data[REG_CFG] & BIT_CFG_ANEG_EN ? "Enabled" : "Disabled",
|
||||
data[REG_CFG] & BIT_CFG_ANEG_EN ? "Advertise" : "Force",
|
||||
data[REG_CFG] & BIT_CFG_ANEG_100 ?
|
||||
(data[REG_CFG] & BIT_CFG_ANEG_EN ? "10/100" : "100")
|
||||
: "10",
|
||||
data[REG_CFG] & BIT_CFG_ANEG_FDUP ?
|
||||
(data[REG_CFG] & BIT_CFG_ANEG_EN ? "Half/Full" : "Full")
|
||||
: "Half",
|
||||
data[REG_CFG] & BIT_CFG_PINT_ACEN ? "" : "Not ",
|
||||
data[REG_CFG] & BIT_CFG_PHY_CFG >> 18,
|
||||
data[REG_CFG] & BIT_CFG_ANEG_DN ? "Done" : "Not Done",
|
||||
data[REG_CFG] & BIT_CFG_POL ? "Reversed" : "Normal",
|
||||
data[REG_CFG] & BIT_CFG_FDUP ? "Full" : "Half",
|
||||
data[REG_CFG] & BIT_CFG_SPEED100 ? 100 : 10,
|
||||
data[REG_CFG] & BIT_CFG_LNKSTS ? "Up" : "Down");
|
||||
|
||||
/* EEPROM access register */
|
||||
fprintf(stdout,
|
||||
"0x08: MEAR (EEPROM Access): 0x%08x\n",
|
||||
data[REG_MEAR]);
|
||||
|
||||
/* PCI test control register */
|
||||
fprintf(stdout,
|
||||
"0x0c: PTSCR (PCI Test Control): 0x%08x\n",
|
||||
data[REG_PTSCR]);
|
||||
fprintf(stdout,
|
||||
" EEPROM Self Test %s\n"
|
||||
" Rx Filter Self Test %s\n"
|
||||
" Tx FIFO Self Test %s\n"
|
||||
" Rx FIFO Self Test %s\n",
|
||||
data[REG_PTSCR] & BIT_PTSCR_EEBIST_FAIL ? "Failed" : "Passed",
|
||||
data[REG_PTSCR] & BIT_PTSCR_RBIST_RXFFAIL ? "Failed" : "Passed",
|
||||
data[REG_PTSCR] & BIT_PTSCR_RBIST_TXFAIL ? "Failed" : "Passed",
|
||||
data[REG_PTSCR] & BIT_PTSCR_RBIST_RXFAIL ? "Failed" : "Passed");
|
||||
if (data[REG_PTSCR] & BIT_PTSCR_EELOAD_EN) fprintf(stdout,
|
||||
" EEPROM Reload In Progress\n");
|
||||
|
||||
/* Interrupt status register */
|
||||
fprintf(stdout,
|
||||
"0x10: ISR (Interrupt Status): 0x%08x\n",
|
||||
data[REG_ISR]);
|
||||
if (data[REG_ISR])
|
||||
PRINT_INTRS(data[REG_ISR], "Active", (char *)NULL);
|
||||
else
|
||||
fprintf(stdout, " No Interrupts Active\n");
|
||||
|
||||
/* Interrupt mask register */
|
||||
fprintf(stdout,
|
||||
"0x14: IMR (Interrupt Mask): 0x%08x\n",
|
||||
data[REG_IMR]);
|
||||
PRINT_INTRS(data[REG_IMR], "Enabled", "Masked");
|
||||
|
||||
/* Interrupt enable register */
|
||||
fprintf(stdout,
|
||||
"0x18: IER (Interrupt Enable): 0x%08x\n",
|
||||
data[REG_IER]);
|
||||
fprintf(stdout,
|
||||
" Interrupts %s\n",
|
||||
data[REG_IER] & BIT_IER_IE ? "Enabled" : "Disabled");
|
||||
|
||||
/* Tx descriptor pointer register */
|
||||
fprintf(stdout,
|
||||
"0x20: TXDP (Tx Descriptor Pointer): 0x%08x\n",
|
||||
data[REG_TXDP]);
|
||||
|
||||
/* Tx configuration register */
|
||||
fprintf(stdout,
|
||||
"0x24: TXCFG (Tx Config): 0x%08x\n",
|
||||
data[REG_TXCFG]);
|
||||
tmp = (data[REG_TXCFG] & BIT_TXCFG_MXDMA)>>20;
|
||||
fprintf(stdout,
|
||||
" Drain Threshold = %d bytes (%d)\n"
|
||||
" Fill Threshold = %d bytes (%d)\n"
|
||||
" Max DMA Burst per Tx = %d bytes\n"
|
||||
" Automatic Tx Padding %s\n"
|
||||
" Mac Loopback %s\n"
|
||||
" Heartbeat Ignore %s\n"
|
||||
" Carrier Sense Ignore %s\n",
|
||||
(data[REG_TXCFG] & BIT_TXCFG_DRTH) * 32,
|
||||
data[REG_TXCFG] & BIT_TXCFG_DRTH,
|
||||
((data[REG_TXCFG] & BIT_TXCFG_FLTH)>>8) * 32,
|
||||
data[REG_TXCFG] & BIT_TXCFG_FLTH,
|
||||
tmp ? (1<<(tmp-1))*4 : 512,
|
||||
data[REG_TXCFG] & BIT_TXCFG_ATP ? "Enabled" : "Disabled",
|
||||
data[REG_TXCFG] & BIT_TXCFG_MLB ? "Enabled" : "Disabled",
|
||||
data[REG_TXCFG] & BIT_TXCFG_HBI ? "Enabled" : "Disabled",
|
||||
data[REG_TXCFG] & BIT_TXCFG_CSI ? "Enabled" : "Disabled");
|
||||
|
||||
|
||||
/* Rx descriptor pointer register */
|
||||
fprintf(stdout,
|
||||
"0x30: RXDP (Rx Descriptor Pointer): 0x%08x\n",
|
||||
data[REG_RXDP]);
|
||||
|
||||
/* Rx configuration register */
|
||||
fprintf(stdout,
|
||||
"0x34: RXCFG (Rx Config): 0x%08x\n",
|
||||
data[REG_RXCFG]);
|
||||
tmp = (data[REG_RXCFG] & BIT_RXCFG_MXDMA)>>20;
|
||||
fprintf(stdout,
|
||||
" Drain Threshold = %d bytes (%d)\n"
|
||||
" Max DMA Burst per Rx = %d bytes\n"
|
||||
" Long Packets %s\n"
|
||||
" Tx Packets %s\n"
|
||||
" Runt Packets %s\n"
|
||||
" Error Packets %s\n",
|
||||
((data[REG_RXCFG] & BIT_RXCFG_DRTH) >> 1) * 8,
|
||||
(data[REG_RXCFG] & BIT_RXCFG_DRTH) >> 1,
|
||||
tmp ? (1<<(tmp-1))*4 : 512,
|
||||
data[REG_RXCFG] & BIT_RXCFG_ALP ? "Accepted" : "Rejected",
|
||||
data[REG_RXCFG] & BIT_RXCFG_ATX ? "Accepted" : "Rejected",
|
||||
data[REG_RXCFG] & BIT_RXCFG_ARP ? "Accepted" : "Rejected",
|
||||
data[REG_RXCFG] & BIT_RXCFG_AEP ? "Accepted" : "Rejected");
|
||||
|
||||
/* CLKRUN control/status register */
|
||||
fprintf(stdout,
|
||||
"0x3c: CCSR (CLKRUN Control/Status): 0x%08x\n",
|
||||
data[REG_CCSR]);
|
||||
fprintf(stdout,
|
||||
" CLKRUNN %s\n"
|
||||
" Power Management %s\n",
|
||||
data[REG_CCSR] & BIT_CCSR_CLKRUN_EN ? "Enabled" : "Disabled",
|
||||
data[REG_CCSR] & BIT_CCSR_PMEEN ? "Enabled" : "Disabled");
|
||||
if (data[REG_CCSR] & BIT_CCSR_PMESTS) fprintf(stdout,
|
||||
" Power Management Event Pending\n");
|
||||
|
||||
/* WoL control/status register */
|
||||
fprintf(stdout,
|
||||
"0x40: WCSR (Wake-on-LAN Control/Status): 0x%08x\n",
|
||||
data[REG_WCSR]);
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKPHY) fprintf(stdout,
|
||||
" Wake on Phy Interrupt Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKUCP) fprintf(stdout,
|
||||
" Wake on Unicast Packet Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKMCP) fprintf(stdout,
|
||||
" Wake on Multicast Packet Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKBCP) fprintf(stdout,
|
||||
" Wake on Broadcast Packet Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKARP) fprintf(stdout,
|
||||
" Wake on Arp Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKPAT0) fprintf(stdout,
|
||||
" Wake on Pattern 0 Match Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKPAT1) fprintf(stdout,
|
||||
" Wake on Pattern 1 Match Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKPAT2) fprintf(stdout,
|
||||
" Wake on Pattern 2 Match Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKPAT3) fprintf(stdout,
|
||||
" Wake on Pattern 3 Match Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_WKMAG) fprintf(stdout,
|
||||
" Wake on Magic Packet Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_MPSOE) fprintf(stdout,
|
||||
" Magic Packet SecureOn Enabled\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_SOHACK) fprintf(stdout,
|
||||
" SecureOn Hack Detected\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_PHYINT) fprintf(stdout,
|
||||
" Phy Interrupt Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_UCASTR) fprintf(stdout,
|
||||
" Unicast Packet Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_MCASTR) fprintf(stdout,
|
||||
" Multicast Packet Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_BCASTR) fprintf(stdout,
|
||||
" Broadcast Packet Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_ARPR) fprintf(stdout,
|
||||
" Arp Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_PATM0) fprintf(stdout,
|
||||
" Pattern 0 Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_PATM1) fprintf(stdout,
|
||||
" Pattern 1 Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_PATM2) fprintf(stdout,
|
||||
" Pattern 2 Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_PATM3) fprintf(stdout,
|
||||
" Pattern 3 Received\n");
|
||||
if (data[REG_WCSR] & BIT_WCSR_MPR) fprintf(stdout,
|
||||
" Magic Packet Received\n");
|
||||
|
||||
/* Pause control/status register */
|
||||
fprintf(stdout,
|
||||
"0x44: PCR (Pause Control/Status): 0x%08x\n",
|
||||
data[REG_PCR]);
|
||||
fprintf(stdout,
|
||||
" Pause Counter = %d\n"
|
||||
" Pause %sNegotiated\n"
|
||||
" Pause on DA %s\n"
|
||||
" Pause on Mulitcast %s\n"
|
||||
" Pause %s\n",
|
||||
data[REG_PCR] & BIT_PCR_PAUSE_CNT,
|
||||
data[REG_PCR] & BIT_PCR_PSNEG ? "" : "Not ",
|
||||
data[REG_PCR] & BIT_PCR_PS_DA ? "Enabled" : "Disabled",
|
||||
data[REG_PCR] & BIT_PCR_PSMCAST ? "Enabled" : "Disabled",
|
||||
data[REG_PCR] & BIT_PCR_PSEN ? "Enabled" : "Disabled");
|
||||
if (data[REG_PCR] & BIT_PCR_PS_RCVD) fprintf(stdout,
|
||||
" PS_RCVD: Pause Frame Received\n");
|
||||
|
||||
/* Rx Filter Control */
|
||||
fprintf(stdout,
|
||||
"0x48: RFCR (Rx Filter Control): 0x%08x\n",
|
||||
data[REG_RFCR]);
|
||||
fprintf(stdout,
|
||||
" Unicast Hash %s\n"
|
||||
" Multicast Hash %s\n"
|
||||
" Arp %s\n"
|
||||
" Pattern 0 Match %s\n"
|
||||
" Pattern 1 Match %s\n"
|
||||
" Pattern 2 Match %s\n"
|
||||
" Pattern 3 Match %s\n"
|
||||
" Perfect Match %s\n"
|
||||
" All Unicast %s\n"
|
||||
" All Multicast %s\n"
|
||||
" All Broadcast %s\n"
|
||||
" Rx Filter %s\n",
|
||||
data[REG_RFCR] & BIT_RFCR_UHEN ? "Enabled" : "Disabled",
|
||||
data[REG_RFCR] & BIT_RFCR_MHEN ? "Enabled" : "Disabled",
|
||||
data[REG_RFCR] & BIT_RFCR_AARP ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_APAT0 ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_APAT1 ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_APAT2 ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_APAT3 ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_APM ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_AAU ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_AAM ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_AAB ? "Accepted" : "Rejected",
|
||||
data[REG_RFCR] & BIT_RFCR_RFEN ? "Enabled" : "Disabled");
|
||||
|
||||
/* Rx filter data register */
|
||||
fprintf(stdout,
|
||||
"0x4c: RFDR (Rx Filter Data): 0x%08x\n",
|
||||
data[REG_RFDR]);
|
||||
if (regs->version >= 1) fprintf(stdout,
|
||||
" PMATCH 1-0 = 0x%08x\n"
|
||||
" PMATCH 3-2 = 0x%08x\n"
|
||||
" PMATCH 5-4 = 0x%08x\n"
|
||||
" PCOUNT 1-0 = 0x%08x\n"
|
||||
" PCOUNT 3-2 = 0x%08x\n"
|
||||
" SOPASS 1-0 = 0x%08x\n"
|
||||
" SOPASS 3-2 = 0x%08x\n"
|
||||
" SOPASS 5-4 = 0x%08x\n",
|
||||
data[REG_PMATCH0], data[REG_PMATCH1], data[REG_PMATCH2],
|
||||
data[REG_PCOUNT0], data[REG_PCOUNT1],
|
||||
data[REG_SOPASS0], data[REG_SOPASS1], data[REG_SOPASS2]);
|
||||
|
||||
|
||||
/* Boot ROM address register */
|
||||
fprintf(stdout,
|
||||
"0x50: BRAR (Boot ROM Address): 0x%08x\n",
|
||||
data[REG_BRAR]);
|
||||
if (data[REG_BRAR] & BIT_BRAR_AUTOINC) fprintf(stdout,
|
||||
" Automatically Increment Address\n");
|
||||
|
||||
/* Boot ROM data register */
|
||||
fprintf(stdout,
|
||||
"0x54: BRDR (Boot ROM Data): 0x%08x\n",
|
||||
data[REG_BRDR]);
|
||||
|
||||
/* Silicon revison register */
|
||||
fprintf(stdout,
|
||||
"0x58: SRR (Silicon Revision): 0x%08x\n",
|
||||
data[REG_SRR]);
|
||||
|
||||
/* Management information base control register */
|
||||
fprintf(stdout,
|
||||
"0x5c: MIBC (Mgmt Info Base Control): 0x%08x\n",
|
||||
data[REG_MIBC]);
|
||||
if (data[REG_MIBC] & BIT_MIBC_WRN) fprintf(stdout,
|
||||
" Counter Overflow Warning\n");
|
||||
if (data[REG_MIBC] & BIT_MIBC_FRZ) fprintf(stdout,
|
||||
" Counters Frozen\n");
|
||||
|
||||
/* MIB registers */
|
||||
fprintf(stdout,
|
||||
"0x60: MIB[0] (Rx Errored Packets): 0x%04x\n",
|
||||
data[REG_MIB0]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB0]);
|
||||
fprintf(stdout,
|
||||
"0x64: MIB[1] (Rx Frame Sequence Errors): 0x%02x\n",
|
||||
data[REG_MIB1]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB1]);
|
||||
fprintf(stdout,
|
||||
"0x68: MIB[2] (Rx Missed Packets): 0x%02x\n",
|
||||
data[REG_MIB2]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB2]);
|
||||
fprintf(stdout,
|
||||
"0x6c: MIB[3] (Rx Alignment Errors): 0x%02x\n",
|
||||
data[REG_MIB3]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB3]);
|
||||
fprintf(stdout,
|
||||
"0x70: MIB[4] (Rx Symbol Errors): 0x%02x\n",
|
||||
data[REG_MIB4]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB4]);
|
||||
fprintf(stdout,
|
||||
"0x74: MIB[5] (Rx Long Frame Errors): 0x%02x\n",
|
||||
data[REG_MIB5]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB5]);
|
||||
fprintf(stdout,
|
||||
"0x78: MIB[6] (Tx Heartbeat Errors): 0x%02x\n",
|
||||
data[REG_MIB6]);
|
||||
fprintf(stdout, " Value = %d\n", data[REG_MIB6]);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "Internal Phy Registers\n");
|
||||
fprintf(stdout, "----------------------\n");
|
||||
|
||||
/* Basic mode control register */
|
||||
fprintf(stdout,
|
||||
"0x80: BMCR (Basic Mode Control): 0x%04x\n",
|
||||
data[REG_BMCR]);
|
||||
fprintf(stdout,
|
||||
" %s Duplex\n"
|
||||
" Port is Powered %s\n"
|
||||
" Auto-Negotiation %s\n"
|
||||
" %d Mb/s\n",
|
||||
data[REG_BMCR] & BIT_BMCR_FDUP ? "Full" : "Half",
|
||||
data[REG_BMCR] & BIT_BMCR_PDOWN ? "Down" : "Up",
|
||||
data[REG_BMCR] & BIT_BMCR_ANEN ? "Enabled" : "Disabled",
|
||||
data[REG_BMCR] & BIT_BMCR_SPEED ? 100 : 10);
|
||||
if (data[REG_BMCR] & BIT_BMCR_ANRST) fprintf(stdout,
|
||||
" Auto-Negotiation Restarting\n");
|
||||
if (data[REG_BMCR] & BIT_BMCR_ISOL) fprintf(stdout,
|
||||
" Port Isolated\n");
|
||||
if (data[REG_BMCR] & BIT_BMCR_LOOP) fprintf(stdout,
|
||||
" Loopback Enabled\n");
|
||||
if (data[REG_BMCR] & BIT_BMCR_RST) fprintf(stdout,
|
||||
" Reset In Progress\n");
|
||||
|
||||
/* Basic mode status register */
|
||||
fprintf(stdout,
|
||||
"0x84: BMSR (Basic Mode Status): 0x%04x\n",
|
||||
data[REG_BMSR]);
|
||||
fprintf(stdout,
|
||||
" Link %s\n"
|
||||
" %sCapable of Auto-Negotiation\n"
|
||||
" Auto-Negotiation %sComplete\n"
|
||||
" %sCapable of Preamble Suppression\n"
|
||||
" %sCapable of 10Base-T Half Duplex\n"
|
||||
" %sCapable of 10Base-T Full Duplex\n"
|
||||
" %sCapable of 100Base-TX Half Duplex\n"
|
||||
" %sCapable of 100Base-TX Full Duplex\n"
|
||||
" %sCapable of 100Base-T4\n",
|
||||
data[REG_BMSR] & BIT_BMSR_LNK ? "Up" : "Down",
|
||||
data[REG_BMSR] & BIT_BMSR_ANCAP ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_ANDONE ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_PREAMBLE ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_10HCAP ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_10FCAP ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_100HCAP ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_100FCAP ? "" : "Not ",
|
||||
data[REG_BMSR] & BIT_BMSR_100T4CAP ? "" : "Not ");
|
||||
if (data[REG_BMSR] & BIT_BMSR_JABBER) fprintf(stdout,
|
||||
" Jabber Condition Detected\n");
|
||||
if (data[REG_BMSR] & BIT_BMSR_RFAULT) fprintf(stdout,
|
||||
" Remote Fault Detected\n");
|
||||
|
||||
/* PHY identification registers */
|
||||
fprintf(stdout,
|
||||
"0x88: PHYIDR1 (PHY ID #1): 0x%04x\n",
|
||||
data[REG_PHYIDR1]);
|
||||
fprintf(stdout,
|
||||
"0x8c: PHYIDR2 (PHY ID #2): 0x%04x\n",
|
||||
data[REG_PHYIDR2]);
|
||||
fprintf(stdout,
|
||||
" OUI = 0x%06x\n"
|
||||
" Model = 0x%02x (%d)\n"
|
||||
" Revision = 0x%01x (%d)\n",
|
||||
(data[REG_PHYIDR1] << 6) | (data[REG_PHYIDR2] >> 10),
|
||||
(data[REG_PHYIDR2] & BIT_PHYIDR2_MODEL) >> 4 & 0x3f,
|
||||
(data[REG_PHYIDR2] & BIT_PHYIDR2_MODEL) >> 4 & 0x3f,
|
||||
data[REG_PHYIDR2] & BIT_PHYIDR2_REV,
|
||||
data[REG_PHYIDR2] & BIT_PHYIDR2_REV);
|
||||
|
||||
/* autonegotiation advertising register */
|
||||
fprintf(stdout,
|
||||
"0x90: ANAR (Autoneg Advertising): 0x%04x\n",
|
||||
data[REG_ANAR]);
|
||||
fprintf(stdout,
|
||||
" Protocol Selector = 0x%02x (%d)\n",
|
||||
data[REG_ANAR] & BIT_ANAR_PROTO,
|
||||
data[REG_ANAR] & BIT_ANAR_PROTO);
|
||||
if (data[REG_ANAR] & BIT_ANAR_10) fprintf(stdout,
|
||||
" Advertising 10Base-T Half Duplex\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_10_FD) fprintf(stdout,
|
||||
" Advertising 10Base-T Full Duplex\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_TX) fprintf(stdout,
|
||||
" Advertising 100Base-TX Half Duplex\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_TXFD) fprintf(stdout,
|
||||
" Advertising 100Base-TX Full Duplex\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_T4) fprintf(stdout,
|
||||
" Advertising 100Base-T4\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_PAUSE) fprintf(stdout,
|
||||
" Advertising Pause\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_RF) fprintf(stdout,
|
||||
" Indicating Remote Fault\n");
|
||||
if (data[REG_ANAR] & BIT_ANAR_NP) fprintf(stdout,
|
||||
" Next Page Desired\n");
|
||||
|
||||
/* Autonegotiation link partner ability register */
|
||||
fprintf(stdout,
|
||||
"0x94: ANLPAR (Autoneg Partner): 0x%04x\n",
|
||||
data[REG_ANLPAR]);
|
||||
fprintf(stdout,
|
||||
" Protocol Selector = 0x%02x (%d)\n",
|
||||
data[REG_ANLPAR] & BIT_ANLPAR_PROTO,
|
||||
data[REG_ANLPAR] & BIT_ANLPAR_PROTO);
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_10) fprintf(stdout,
|
||||
" Supports 10Base-T Half Duplex\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_10_FD) fprintf(stdout,
|
||||
" Supports 10Base-T Full Duplex\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_TX) fprintf(stdout,
|
||||
" Supports 100Base-TX Half Duplex\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_TXFD) fprintf(stdout,
|
||||
" Supports 100Base-TX Full Duplex\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_T4) fprintf(stdout,
|
||||
" Supports 100Base-T4\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_PAUSE) fprintf(stdout,
|
||||
" Supports Pause\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_RF) fprintf(stdout,
|
||||
" Indicates Remote Fault\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_ACK) fprintf(stdout,
|
||||
" Indicates Acknowledgement\n");
|
||||
if (data[REG_ANLPAR] & BIT_ANLPAR_NP) fprintf(stdout,
|
||||
" Next Page Desired\n");
|
||||
|
||||
/* Autonegotiation expansion register */
|
||||
fprintf(stdout,
|
||||
"0x98: ANER (Autoneg Expansion): 0x%04x\n",
|
||||
data[REG_ANER]);
|
||||
fprintf(stdout,
|
||||
" Link Partner Can %sAuto-Negotiate\n"
|
||||
" Link Code Word %sReceived\n"
|
||||
" Next Page %sSupported\n"
|
||||
" Link Partner Next Page %sSupported\n",
|
||||
data[REG_ANER] & BIT_ANER_LP_AN_ENABLE ? "" : "Not ",
|
||||
data[REG_ANER] & BIT_ANER_PAGE_RX ? "" : "Not ",
|
||||
data[REG_ANER] & BIT_ANER_NP_ABLE ? "" : "Not ",
|
||||
data[REG_ANER] & BIT_ANER_LP_NP_ABLE ? "" : "Not ");
|
||||
if (data[REG_ANER] & BIT_ANER_PDF) fprintf(stdout,
|
||||
" Parallel Detection Fault\n");
|
||||
|
||||
/* Autonegotiation next-page tx register */
|
||||
fprintf(stdout,
|
||||
"0x9c: ANNPTR (Autoneg Next Page Tx): 0x%04x\n",
|
||||
data[REG_ANNPTR]);
|
||||
|
||||
/* Phy status register */
|
||||
fprintf(stdout,
|
||||
"0xc0: PHYSTS (Phy Status): 0x%04x\n",
|
||||
data[REG_PHYSTS]);
|
||||
fprintf(stdout,
|
||||
" Link %s\n"
|
||||
" %d Mb/s\n"
|
||||
" %s Duplex\n"
|
||||
" Auto-Negotiation %sComplete\n"
|
||||
" %s Polarity\n",
|
||||
data[REG_PHYSTS] & BIT_PHYSTS_LNK ? "Up" : "Down",
|
||||
data[REG_PHYSTS] & BIT_PHYSTS_SPD10 ? 10 : 100,
|
||||
data[REG_PHYSTS] & BIT_PHYSTS_FDUP ? "Full" : "Half",
|
||||
data[REG_PHYSTS] & BIT_PHYSTS_ANDONE ? "" : "Not ",
|
||||
data[REG_PHYSTS] & BIT_PHYSTS_POL ? "Reverse" : "Normal");
|
||||
if (data[REG_PHYSTS] & BIT_PHYSTS_LOOP) fprintf(stdout,
|
||||
" Loopback Enabled\n");
|
||||
if (data[REG_PHYSTS] & BIT_PHYSTS_JABBER) fprintf(stdout,
|
||||
" Jabber Condition Detected\n");
|
||||
if (data[REG_PHYSTS] & BIT_PHYSTS_RF) fprintf(stdout,
|
||||
" Remote Fault Detected\n");
|
||||
if (data[REG_PHYSTS] & BIT_PHYSTS_MINT) fprintf(stdout,
|
||||
" MII Interrupt Detected\n");
|
||||
if (data[REG_PHYSTS] & BIT_PHYSTS_FC) fprintf(stdout,
|
||||
" False Carrier Detected\n");
|
||||
if (data[REG_PHYSTS] & BIT_PHYSTS_RXERR) fprintf(stdout,
|
||||
" Rx Error Detected\n");
|
||||
|
||||
fprintf(stdout,
|
||||
"0xc4: MICR (MII Interrupt Control): 0x%04x\n",
|
||||
data[REG_MICR]);
|
||||
fprintf(stdout,
|
||||
" MII Interrupts %s\n",
|
||||
data[REG_MICR] & BIT_MICR_INTEN ? "Enabled" : "Disabled");
|
||||
|
||||
fprintf(stdout,
|
||||
"0xc8: MISR (MII Interrupt Status): 0x%04x\n",
|
||||
data[REG_MISR]);
|
||||
fprintf(stdout,
|
||||
" Rx Error Counter Half-Full Interrupt %s\n"
|
||||
" False Carrier Counter Half-Full Interrupt %s\n"
|
||||
" Auto-Negotiation Complete Interrupt %s\n"
|
||||
" Remote Fault Interrupt %s\n"
|
||||
" Jabber Interrupt %s\n"
|
||||
" Link Change Interrupt %s\n",
|
||||
data[REG_MISR] & BIT_MISR_MSK_RHF ? "Masked" : "Enabled",
|
||||
data[REG_MISR] & BIT_MISR_MSK_FHF ? "Masked" : "Enabled",
|
||||
data[REG_MISR] & BIT_MISR_MSK_ANC ? "Masked" : "Enabled",
|
||||
data[REG_MISR] & BIT_MISR_MSK_RF ? "Masked" : "Enabled",
|
||||
data[REG_MISR] & BIT_MISR_MSK_JAB ? "Masked" : "Enabled",
|
||||
data[REG_MISR] & BIT_MISR_MSK_LNK ? "Masked" : "Enabled");
|
||||
if (data[REG_MISR] & BIT_MISR_MINT) fprintf(stdout,
|
||||
" MII Interrupt Pending\n");
|
||||
|
||||
/* Page select register (from section of spec on 'suggested values') */
|
||||
fprintf(stdout,
|
||||
"0xcc: PGSEL (Phy Register Page Select): 0x%04x\n",
|
||||
data[REG_PGSEL]);
|
||||
|
||||
/* counters */
|
||||
fprintf(stdout,
|
||||
"0xd0: FCSCR (False Carrier Counter): 0x%04x\n",
|
||||
data[REG_FCSCR]);
|
||||
fprintf(stdout,
|
||||
" Value = %d\n", data[REG_FCSCR] & 0xff);
|
||||
fprintf(stdout,
|
||||
"0xd4: RECR (Rx Error Counter): 0x%04x\n",
|
||||
data[REG_RECR]);
|
||||
fprintf(stdout,
|
||||
" Value = %d\n", data[REG_RECR] & 0xff);
|
||||
|
||||
/* 100 Mbit configuration register */
|
||||
fprintf(stdout,
|
||||
"0xd8: PCSR (100Mb/s PCS Config/Status): 0x%04x\n",
|
||||
data[REG_PCSR]);
|
||||
fprintf(stdout,
|
||||
" NRZI Bypass %s\n"
|
||||
" %s Signal Detect Algorithm\n"
|
||||
" %s Signal Detect Operation\n"
|
||||
" True Quiet Mode %s\n"
|
||||
" Rx Clock is %s\n"
|
||||
" 4B/5B Operation %s\n",
|
||||
data[REG_PCSR] & BIT_PCSR_NRZI ? "Enabled" : "Disabled",
|
||||
data[REG_PCSR] & BIT_PCSR_SDOPT ? "Enhanced" : "Reduced",
|
||||
data[REG_PCSR] & BIT_PCSR_SDFORCE ? "Forced" : "Normal",
|
||||
data[REG_PCSR] & BIT_PCSR_TQM ? "Enabled" : "Disabled",
|
||||
data[REG_PCSR] & BIT_PCSR_CLK ?
|
||||
"Free-Running" : "Phase-Adjusted",
|
||||
data[REG_PCSR] & BIT_PCSR_4B5B ? "Bypassed" : "Normal");
|
||||
if (data[REG_PCSR] & BIT_PCSR_FORCE_100) fprintf(stdout,
|
||||
" Forced 100 Mb/s Good Link\n");
|
||||
|
||||
/* Phy control register */
|
||||
fprintf(stdout,
|
||||
"0xe4: PHYCR (Phy Control): 0x%04x\n",
|
||||
data[REG_PHYCR]);
|
||||
fprintf(stdout,
|
||||
" Phy Address = 0x%x (%d)\n"
|
||||
" %sPause Compatible with Link Partner\n"
|
||||
" LED Stretching %s\n"
|
||||
" Phy Self Test %s\n"
|
||||
" Self Test Sequence = PSR%d\n",
|
||||
data[REG_PHYCR] & BIT_PHYCR_PHYADDR,
|
||||
data[REG_PHYCR] & BIT_PHYCR_PHYADDR,
|
||||
data[REG_PHYCR] & BIT_PHYCR_PAUSE_STS ? "" : "Not ",
|
||||
data[REG_PHYCR] & BIT_PHYCR_STRETCH ? "Bypassed" : "Enabled",
|
||||
data[REG_PHYCR] & BIT_PHYCR_BIST ? "In Progress" :
|
||||
data[REG_PHYCR] & BIT_PHYCR_BIST_STAT ?
|
||||
"Passed" : "Failed or Not Run",
|
||||
data[REG_PHYCR] & BIT_PHYCR_PSR15 ? 15 : 9);
|
||||
|
||||
|
||||
/* 10 Mbit control and status register */
|
||||
fprintf(stdout,
|
||||
"0xe8: TBTSCR (10Base-T Status/Control): 0x%04x\n",
|
||||
data[REG_TBTSCR]);
|
||||
fprintf(stdout,
|
||||
" Jabber %s\n"
|
||||
" Heartbeat %s\n"
|
||||
" Polarity Auto-Sense/Correct %s\n"
|
||||
" %s Polarity %s\n"
|
||||
" Normal Link Pulse %s\n"
|
||||
" 10 Mb/s Loopback %s\n",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_JAB ? "Disabled" : "Enabled",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_BEAT ? "Disabled" : "Enabled",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_AUTOPOL ? "Disabled" : "Enabled",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_AUTOPOL ?
|
||||
data[REG_TBTSCR]&BIT_TBTSCR_FPOL ? "Reverse":"Normal" :
|
||||
data[REG_TBTSCR]&BIT_TBTSCR_POL ? "Reverse":"Normal",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_AUTOPOL ? "Forced" : "Detected",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_PULSE ? "Disabled" : "Enabled",
|
||||
data[REG_TBTSCR] & BIT_TBTSCR_LOOP ? "Enabled" : "Disabled");
|
||||
if (data[REG_TBTSCR] & BIT_TBTSCR_FORCE_10) fprintf(stdout,
|
||||
" Forced 10 Mb/s Good Link\n");
|
||||
|
||||
/* the spec says to set these */
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "'Magic' Phy Registers\n");
|
||||
fprintf(stdout, "---------------------\n");
|
||||
fprintf(stdout,
|
||||
"0xe4: PMDCSR: 0x%04x\n",
|
||||
data[REG_PMDCSR]);
|
||||
fprintf(stdout,
|
||||
"0xf4: DSPCFG: 0x%04x\n",
|
||||
data[REG_DSPCFG]);
|
||||
fprintf(stdout,
|
||||
"0xf8: SDCFG: 0x%04x\n",
|
||||
data[REG_SDCFG]);
|
||||
fprintf(stdout,
|
||||
"0xfc: TSTDAT: 0x%04x\n",
|
||||
data[REG_TSTDAT]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
natsemi_dump_eeprom(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_eeprom *ee)
|
||||
{
|
||||
int i;
|
||||
u16 *eebuf = (u16 *)ee->data;
|
||||
|
||||
if (ee->magic != NATSEMI_MAGIC) {
|
||||
fprintf(stderr, "Magic number 0x%08x does not match 0x%08x\n",
|
||||
ee->magic, NATSEMI_MAGIC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "Address\tData\n");
|
||||
fprintf(stdout, "-------\t------\n");
|
||||
for (i = 0; i < ee->len/2; i++) {
|
||||
fprintf(stdout, "0x%02x \t0x%04x\n", i + ee->offset, eebuf[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* Userspace API for hardware time stamping of network packets
|
||||
*
|
||||
* Copyright (C) 2008,2009 Intel Corporation
|
||||
* Author: Patrick Ohly <patrick.ohly@intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NET_TIMESTAMPING_H
|
||||
#define _NET_TIMESTAMPING_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/socket.h> /* for SO_TIMESTAMPING */
|
||||
|
||||
/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
|
||||
enum {
|
||||
SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
|
||||
SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
|
||||
SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
|
||||
SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
|
||||
SOF_TIMESTAMPING_SOFTWARE = (1<<4),
|
||||
SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
|
||||
SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
|
||||
SOF_TIMESTAMPING_OPT_ID = (1<<7),
|
||||
SOF_TIMESTAMPING_TX_SCHED = (1<<8),
|
||||
SOF_TIMESTAMPING_TX_ACK = (1<<9),
|
||||
SOF_TIMESTAMPING_OPT_CMSG = (1<<10),
|
||||
SOF_TIMESTAMPING_OPT_TSONLY = (1<<11),
|
||||
SOF_TIMESTAMPING_OPT_STATS = (1<<12),
|
||||
SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13),
|
||||
SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14),
|
||||
|
||||
SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW,
|
||||
SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
|
||||
SOF_TIMESTAMPING_LAST
|
||||
};
|
||||
|
||||
/*
|
||||
* SO_TIMESTAMPING flags are either for recording a packet timestamp or for
|
||||
* reporting the timestamp to user space.
|
||||
* Recording flags can be set both via socket options and control messages.
|
||||
*/
|
||||
#define SOF_TIMESTAMPING_TX_RECORD_MASK (SOF_TIMESTAMPING_TX_HARDWARE | \
|
||||
SOF_TIMESTAMPING_TX_SOFTWARE | \
|
||||
SOF_TIMESTAMPING_TX_SCHED | \
|
||||
SOF_TIMESTAMPING_TX_ACK)
|
||||
|
||||
/**
|
||||
* struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter
|
||||
*
|
||||
* @flags: no flags defined right now, must be zero for %SIOCSHWTSTAMP
|
||||
* @tx_type: one of HWTSTAMP_TX_*
|
||||
* @rx_filter: one of HWTSTAMP_FILTER_*
|
||||
*
|
||||
* %SIOCGHWTSTAMP and %SIOCSHWTSTAMP expect a &struct ifreq with a
|
||||
* ifr_data pointer to this structure. For %SIOCSHWTSTAMP, if the
|
||||
* driver or hardware does not support the requested @rx_filter value,
|
||||
* the driver may use a more general filter mode. In this case
|
||||
* @rx_filter will indicate the actual mode on return.
|
||||
*/
|
||||
struct hwtstamp_config {
|
||||
int flags;
|
||||
int tx_type;
|
||||
int rx_filter;
|
||||
};
|
||||
|
||||
/* possible values for hwtstamp_config->tx_type */
|
||||
enum hwtstamp_tx_types {
|
||||
/*
|
||||
* No outgoing packet will need hardware time stamping;
|
||||
* should a packet arrive which asks for it, no hardware
|
||||
* time stamping will be done.
|
||||
*/
|
||||
HWTSTAMP_TX_OFF,
|
||||
|
||||
/*
|
||||
* Enables hardware time stamping for outgoing packets;
|
||||
* the sender of the packet decides which are to be
|
||||
* time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
|
||||
* before sending the packet.
|
||||
*/
|
||||
HWTSTAMP_TX_ON,
|
||||
|
||||
/*
|
||||
* Enables time stamping for outgoing packets just as
|
||||
* HWTSTAMP_TX_ON does, but also enables time stamp insertion
|
||||
* directly into Sync packets. In this case, transmitted Sync
|
||||
* packets will not received a time stamp via the socket error
|
||||
* queue.
|
||||
*/
|
||||
HWTSTAMP_TX_ONESTEP_SYNC,
|
||||
};
|
||||
|
||||
/* possible values for hwtstamp_config->rx_filter */
|
||||
enum hwtstamp_rx_filters {
|
||||
/* time stamp no incoming packet at all */
|
||||
HWTSTAMP_FILTER_NONE,
|
||||
|
||||
/* time stamp any incoming packet */
|
||||
HWTSTAMP_FILTER_ALL,
|
||||
|
||||
/* return value: time stamp all packets requested plus some others */
|
||||
HWTSTAMP_FILTER_SOME,
|
||||
|
||||
/* PTP v1, UDP, any kind of event packet */
|
||||
HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
|
||||
/* PTP v1, UDP, Sync packet */
|
||||
HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
|
||||
/* PTP v1, UDP, Delay_req packet */
|
||||
HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
|
||||
/* PTP v2, UDP, any kind of event packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
|
||||
/* PTP v2, UDP, Sync packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
|
||||
/* PTP v2, UDP, Delay_req packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
|
||||
|
||||
/* 802.AS1, Ethernet, any kind of event packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
|
||||
/* 802.AS1, Ethernet, Sync packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
|
||||
/* 802.AS1, Ethernet, Delay_req packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
|
||||
|
||||
/* PTP v2/802.AS1, any layer, any kind of event packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_EVENT,
|
||||
/* PTP v2/802.AS1, any layer, Sync packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_SYNC,
|
||||
/* PTP v2/802.AS1, any layer, Delay_req packet */
|
||||
HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
|
||||
|
||||
/* NTP, UDP, all versions and packet modes */
|
||||
HWTSTAMP_FILTER_NTP_ALL,
|
||||
};
|
||||
|
||||
/* SCM_TIMESTAMPING_PKTINFO control message */
|
||||
struct scm_ts_pktinfo {
|
||||
__u32 if_index;
|
||||
__u32 pkt_length;
|
||||
__u32 reserved[2];
|
||||
};
|
||||
|
||||
#endif /* _NET_TIMESTAMPING_H */
|
|
@ -0,0 +1,249 @@
|
|||
/* Copyright 2004 IBM Corporation (jklewis@us.ibm.com) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define BIT0 0x0001
|
||||
#define BIT1 0x0002
|
||||
#define BIT2 0x0004
|
||||
#define BIT3 0x0008
|
||||
#define BIT4 0x0010
|
||||
#define BIT5 0x0020
|
||||
#define BIT6 0x0040
|
||||
#define BIT7 0x0080
|
||||
#define BIT8 0x0100
|
||||
#define BIT9 0x0200
|
||||
#define BIT10 0x0400
|
||||
#define BIT11 0x0800
|
||||
#define BIT12 0x1000
|
||||
#define BIT13 0x2000
|
||||
#define BIT14 0x4000
|
||||
#define BIT15 0x8000
|
||||
|
||||
int pcnet32_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
|
||||
{
|
||||
int i, csr;
|
||||
u16 *data = (u16 *) regs->data;
|
||||
int len = regs->len / 2;
|
||||
u16 temp,*ptr;
|
||||
|
||||
printf("Driver: %s\n",info->driver);
|
||||
printf("Version: %s\n",info->version);
|
||||
|
||||
printf("APROM: ");
|
||||
for (i=0; i<8; i++)
|
||||
printf(" %04x ", data[i]);
|
||||
printf("\n");
|
||||
|
||||
csr = i;
|
||||
for (; i<100; i++)
|
||||
{
|
||||
if (((i-csr) & 7) == 0) printf("CSR%02d: ", i-csr);
|
||||
printf(" %04x ", data[i]);
|
||||
if (((i-csr) & 7) == 7) printf("\n");
|
||||
}
|
||||
if (((i-csr) & 7) != 7) printf("\n");
|
||||
|
||||
csr = i;
|
||||
for (; i<136; i++)
|
||||
{
|
||||
if (((i-csr) & 7) == 0) printf("BCR%02d: ", i-csr);
|
||||
printf(" %04x ", data[i]);
|
||||
if (((i-csr) & 7) == 7) printf("\n");
|
||||
}
|
||||
if (((i-csr) & 7) != 7) printf("\n");
|
||||
|
||||
csr = i;
|
||||
for (; i<len; i++)
|
||||
{
|
||||
if (((i-csr) & 7) == 0) printf("MII%02d: ", (i-csr) & 0x1f);
|
||||
printf(" %04x ", data[i]);
|
||||
if (((i-csr) & 7) == 7) printf("\n");
|
||||
}
|
||||
if (((i-csr) & 7) != 7) printf("\n");
|
||||
printf("\n");
|
||||
|
||||
ptr=&data[8]; /* start of the CSRs */
|
||||
|
||||
printf("CSR0: Status and Control 0x%04x\n ",ptr[0]);
|
||||
temp=ptr[0];
|
||||
|
||||
if(temp & BIT15) printf("ERR ");
|
||||
if(temp & BIT14) printf("BABL ");
|
||||
if(temp & BIT13) printf("CERR ");
|
||||
if(temp & BIT12) printf("MISS ");
|
||||
if(temp & BIT11) printf("MERR ");
|
||||
if(temp & BIT10) printf("RINT ");
|
||||
if(temp & BIT9) printf("TINT ");
|
||||
if(temp & BIT8) printf("IDON ");
|
||||
if(temp & BIT7) printf("INTR ");
|
||||
if(temp & BIT6) printf("INT ");
|
||||
if(temp & BIT5) printf("RXON ");
|
||||
if(temp & BIT4) printf("TXON ");
|
||||
if(temp & BIT3) printf("TDMD ");
|
||||
if(temp & BIT2) printf("STOP ");
|
||||
if(temp & BIT1) printf("STRT ");
|
||||
if(temp & BIT0) printf("INIT ");
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("CSR3: Interrupt Mask 0x%04x\n ",ptr[3]);
|
||||
temp=ptr[3];
|
||||
|
||||
if(temp & BIT14) printf("BABLM ");
|
||||
if(temp & BIT12) printf("MISSM ");
|
||||
if(temp & BIT11) printf("MERRM ");
|
||||
if(temp & BIT10) printf("RINTM ");
|
||||
if(temp & BIT9) printf("TINTM ");
|
||||
if(temp & BIT8) printf("IDONM ");
|
||||
if(temp & BIT6) printf("DXSUFLO ");
|
||||
if(temp & BIT5) printf("LAPPEN ");
|
||||
if(temp & BIT4) printf("DXMT2PD ");
|
||||
if(temp & BIT3) printf("EMBA ");
|
||||
if(temp & BIT2) printf("BSWP ");
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("CSR4: Test and Features 0x%04x\n ",ptr[4]);
|
||||
temp=ptr[4];
|
||||
|
||||
if(temp & BIT15) printf("EN124 ");
|
||||
if(temp & BIT14) printf("DMAPLUS ");
|
||||
if(temp & BIT12) printf("TXDPOLL ");
|
||||
if(temp & BIT11) printf("APAD_XMT ");
|
||||
if(temp & BIT10) printf("ASTRP_RCV ");
|
||||
if(temp & BIT9) printf("MFCO ");
|
||||
if(temp & BIT8) printf("MFCON ");
|
||||
if(temp & BIT7) printf("UINTCMD ");
|
||||
if(temp & BIT6) printf("UINT ");
|
||||
if(temp & BIT5) printf("RCVCCO ");
|
||||
if(temp & BIT4) printf("RCVCCOM ");
|
||||
if(temp & BIT3) printf("TXSTRT ");
|
||||
if(temp & BIT2) printf("TXSTRTM ");
|
||||
if(temp & BIT1) printf("JAB ");
|
||||
if(temp & BIT0) printf("JABM ");
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("CSR5: Ext Control and Int 1 0x%04x\n ",ptr[5]);
|
||||
temp=ptr[5];
|
||||
|
||||
if(temp & BIT15) printf("TOKINTD ");
|
||||
if(temp & BIT14) printf("LTINTEN ");
|
||||
if(temp & BIT11) printf("SINT ");
|
||||
if(temp & BIT10) printf("SINTE ");
|
||||
if(temp & BIT9) printf("SLPINT ");
|
||||
if(temp & BIT8) printf("SLPINTE ");
|
||||
if(temp & BIT7) printf("EXDINT ");
|
||||
if(temp & BIT6) printf("EXDINTE ");
|
||||
if(temp & BIT5) printf("MPPLBA ");
|
||||
if(temp & BIT4) printf("MPINT ");
|
||||
if(temp & BIT3) printf("MPINTE ");
|
||||
if(temp & BIT2) printf("MPEN ");
|
||||
if(temp & BIT1) printf("MPMODE ");
|
||||
if(temp & BIT0) printf("SPND ");
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("CSR7: Ext Control and Int 2 0x%04x\n ",ptr[7]);
|
||||
temp=ptr[7];
|
||||
|
||||
if(temp & BIT15) printf("FASTSPNDE ");
|
||||
if(temp & BIT14) printf("RXFRTG ");
|
||||
if(temp & BIT13) printf("RDMD ");
|
||||
if(temp & BIT12) printf("RXDPOLL ");
|
||||
if(temp & BIT11) printf("STINT ");
|
||||
if(temp & BIT10) printf("STINTE ");
|
||||
if(temp & BIT9) printf("MREINT ");
|
||||
if(temp & BIT8) printf("MREINTE ");
|
||||
if(temp & BIT7) printf("MAPINT ");
|
||||
if(temp & BIT6) printf("MAPINTE ");
|
||||
if(temp & BIT5) printf("MCCINT ");
|
||||
if(temp & BIT4) printf("MCCINTE ");
|
||||
if(temp & BIT3) printf("MCCIINT ");
|
||||
if(temp & BIT2) printf("MCCIINTE ");
|
||||
if(temp & BIT1) printf("MIIPDTINT ");
|
||||
if(temp & BIT0) printf("MIIPDTINTE ");
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("CSR15: Mode 0x%04x\n",ptr[15]);
|
||||
printf("CSR40: Current RX Byte Count 0x%04x\n",ptr[40]);
|
||||
printf("CSR41: Current RX Status 0x%04x\n",ptr[41]);
|
||||
printf("CSR42: Current TX Byte Count 0x%04x\n",ptr[42]);
|
||||
printf("CSR43: Current TX Status 0x%04x\n",ptr[43]);
|
||||
printf("CSR88: Chip ID Lower 0x%04x\n",ptr[88]);
|
||||
temp = (((ptr[89] << 16) | ptr[88]) >> 12) & 0xffff;
|
||||
switch (temp) {
|
||||
case 0x2420:
|
||||
printf(" PCnet/PCI 79C970\n");
|
||||
break;
|
||||
case 0x2621:
|
||||
printf(" PCnet/PCI II 79C970A\n");
|
||||
break;
|
||||
case 0x2623:
|
||||
printf(" PCnet/FAST 79C971\n");
|
||||
break;
|
||||
case 0x2624:
|
||||
printf(" PCnet/FAST+ 79C972\n");
|
||||
break;
|
||||
case 0x2625:
|
||||
printf(" PCnet/FAST III 79C973\n");
|
||||
break;
|
||||
case 0x2626:
|
||||
printf(" PCnet/Home 79C978\n");
|
||||
break;
|
||||
case 0x2627:
|
||||
printf(" PCnet/FAST III 79C975\n");
|
||||
break;
|
||||
case 0x2628:
|
||||
printf(" PCnet/PRO 79C976\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf("CSR89: Chip ID Upper 0x%04x\n ",ptr[89]);
|
||||
temp=ptr[89];
|
||||
printf("VER: %04x PARTIDU: %04x\n",temp >> 12,temp & 0x00000fff);
|
||||
|
||||
printf("CSR112: Missed Frame Count 0x%04x\n",ptr[90]); /* 90 is 112 */
|
||||
printf("CSR114: RX Collision Count 0x%04x\n",ptr[91]);
|
||||
|
||||
printf("\n");
|
||||
|
||||
ptr=&data[100]; /* point to BCR 0 */
|
||||
|
||||
printf("BCR2: Misc. Configuration 0x%04x\n ",ptr[2]);
|
||||
temp=ptr[2];
|
||||
|
||||
if(temp & BIT14) printf("TMAULOOP ");
|
||||
if(temp & BIT12) printf("LEDPE ");
|
||||
|
||||
if(temp & BIT8) printf("APROMWE ");
|
||||
if(temp & BIT7) printf("INTLEVEL ");
|
||||
|
||||
if(temp & BIT3) printf("EADISEL ");
|
||||
if(temp & BIT2) printf("AWAKE ");
|
||||
if(temp & BIT1) printf("ASEL ");
|
||||
if(temp & BIT0) printf("XMAUSEL ");
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("BCR9: Full-Duplex Control 0x%04x\n",ptr[9]);
|
||||
printf("BCR18: Burst and Bus Control 0x%04x\n",ptr[18]);
|
||||
|
||||
printf("BCR19: EEPROM Control and Status 0x%04x\n ",ptr[19]);
|
||||
temp=ptr[19];
|
||||
if(temp & BIT15) printf("PVALID ");
|
||||
if(temp & BIT13) printf("EEDET ");
|
||||
printf("\n");
|
||||
|
||||
printf("BCR23: PCI Subsystem Vendor ID 0x%04x\n",ptr[23]);
|
||||
printf("BCR24: PCI Subsystem ID 0x%04x\n",ptr[24]);
|
||||
printf("BCR31: Software Timer 0x%04x\n",ptr[31]);
|
||||
printf("BCR32: MII Control and Status 0x%04x\n",ptr[32]);
|
||||
printf("BCR35: PCI Vendor ID 0x%04x\n",ptr[35]);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,788 @@
|
|||
/*
|
||||
* qsfp.c: Implements SFF-8636 based QSFP+/QSFP28 Diagnostics Memory map.
|
||||
*
|
||||
* Copyright 2010 Solarflare Communications Inc.
|
||||
* Aurelien Guillaume <aurelien@iwi.me> (C) 2012
|
||||
* Copyright (C) 2014 Cumulus networks Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Freeoftware Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Vidya Ravipati <vidya@cumulusnetworks.com>
|
||||
* This implementation is loosely based on current SFP parser
|
||||
* and SFF-8636 spec Rev 2.7 (ftp://ftp.seagate.com/pub/sff/SFF-8636.PDF)
|
||||
* by SFF Committee.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* a) The register/memory layout is up to 5 128 byte pages defined by
|
||||
* a "pages valid" register and switched via a "page select"
|
||||
* register. Memory of 256 bytes can be memory mapped at a time
|
||||
* according to SFF 8636.
|
||||
* b) SFF 8636 based 640 bytes memory layout is presented for parser
|
||||
*
|
||||
* SFF 8636 based QSFP Memory Map
|
||||
*
|
||||
* 2-Wire Serial Address: 1010000x
|
||||
*
|
||||
* Lower Page 00h (128 bytes)
|
||||
* ======================
|
||||
* | |
|
||||
* |Page Select Byte(127)|
|
||||
* ======================
|
||||
* |
|
||||
* V
|
||||
* ----------------------------------------
|
||||
* | | | |
|
||||
* V V V V
|
||||
* ---------- ---------- --------- ------------
|
||||
* | Upper | | Upper | | Upper | | Upper |
|
||||
* | Page 00h | | Page 01h | | Page 02h | | Page 03h |
|
||||
* | | |(Optional)| |(Optional)| | (Optional) |
|
||||
* | | | | | | | |
|
||||
* | | | | | | | |
|
||||
* | ID | | AST | | User | | For |
|
||||
* | Fields | | Table | | EEPROM | | Cable |
|
||||
* | | | | | Data | | Assemblies |
|
||||
* | | | | | | | |
|
||||
* | | | | | | | |
|
||||
* ----------- ----------- ---------- --------------
|
||||
*
|
||||
*
|
||||
**/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "internal.h"
|
||||
#include "sff-common.h"
|
||||
#include "qsfp.h"
|
||||
|
||||
#define MAX_DESC_SIZE 42
|
||||
|
||||
static struct sff8636_aw_flags {
|
||||
const char *str; /* Human-readable string, null at the end */
|
||||
int offset; /* A2-relative address offset */
|
||||
__u8 value; /* Alarm is on if (offset & value) != 0. */
|
||||
} sff8636_aw_flags[] = {
|
||||
{ "Laser bias current high alarm (Chan 1)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_1_HALARM) },
|
||||
{ "Laser bias current low alarm (Chan 1)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_1_LALARM) },
|
||||
{ "Laser bias current high warning (Chan 1)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_1_HWARN) },
|
||||
{ "Laser bias current low warning (Chan 1)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_1_LWARN) },
|
||||
|
||||
{ "Laser bias current high alarm (Chan 2)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_2_HALARM) },
|
||||
{ "Laser bias current low alarm (Chan 2)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_2_LALARM) },
|
||||
{ "Laser bias current high warning (Chan 2)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_2_HWARN) },
|
||||
{ "Laser bias current low warning (Chan 2)",
|
||||
SFF8636_TX_BIAS_12_AW_OFFSET, (SFF8636_TX_BIAS_2_LWARN) },
|
||||
|
||||
{ "Laser bias current high alarm (Chan 3)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_3_HALARM) },
|
||||
{ "Laser bias current low alarm (Chan 3)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_3_LALARM) },
|
||||
{ "Laser bias current high warning (Chan 3)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_3_HWARN) },
|
||||
{ "Laser bias current low warning (Chan 3)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_3_LWARN) },
|
||||
|
||||
{ "Laser bias current high alarm (Chan 4)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_4_HALARM) },
|
||||
{ "Laser bias current low alarm (Chan 4)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_4_LALARM) },
|
||||
{ "Laser bias current high warning (Chan 4)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_4_HWARN) },
|
||||
{ "Laser bias current low warning (Chan 4)",
|
||||
SFF8636_TX_BIAS_34_AW_OFFSET, (SFF8636_TX_BIAS_4_LWARN) },
|
||||
|
||||
{ "Module temperature high alarm",
|
||||
SFF8636_TEMP_AW_OFFSET, (SFF8636_TEMP_HALARM_STATUS) },
|
||||
{ "Module temperature low alarm",
|
||||
SFF8636_TEMP_AW_OFFSET, (SFF8636_TEMP_LALARM_STATUS) },
|
||||
{ "Module temperature high warning",
|
||||
SFF8636_TEMP_AW_OFFSET, (SFF8636_TEMP_HWARN_STATUS) },
|
||||
{ "Module temperature low warning",
|
||||
SFF8636_TEMP_AW_OFFSET, (SFF8636_TEMP_LWARN_STATUS) },
|
||||
|
||||
{ "Module voltage high alarm",
|
||||
SFF8636_VCC_AW_OFFSET, (SFF8636_VCC_HALARM_STATUS) },
|
||||
{ "Module voltage low alarm",
|
||||
SFF8636_VCC_AW_OFFSET, (SFF8636_VCC_LALARM_STATUS) },
|
||||
{ "Module voltage high warning",
|
||||
SFF8636_VCC_AW_OFFSET, (SFF8636_VCC_HWARN_STATUS) },
|
||||
{ "Module voltage low warning",
|
||||
SFF8636_VCC_AW_OFFSET, (SFF8636_VCC_LWARN_STATUS) },
|
||||
|
||||
{ "Laser tx power high alarm (Channel 1)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_1_HALARM) },
|
||||
{ "Laser tx power low alarm (Channel 1)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_1_LALARM) },
|
||||
{ "Laser tx power high warning (Channel 1)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_1_HWARN) },
|
||||
{ "Laser tx power low warning (Channel 1)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_1_LWARN) },
|
||||
|
||||
{ "Laser tx power high alarm (Channel 2)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_2_HALARM) },
|
||||
{ "Laser tx power low alarm (Channel 2)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_2_LALARM) },
|
||||
{ "Laser tx power high warning (Channel 2)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_2_HWARN) },
|
||||
{ "Laser tx power low warning (Channel 2)",
|
||||
SFF8636_TX_PWR_12_AW_OFFSET, (SFF8636_TX_PWR_2_LWARN) },
|
||||
|
||||
{ "Laser tx power high alarm (Channel 3)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_3_HALARM) },
|
||||
{ "Laser tx power low alarm (Channel 3)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_3_LALARM) },
|
||||
{ "Laser tx power high warning (Channel 3)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_3_HWARN) },
|
||||
{ "Laser tx power low warning (Channel 3)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_3_LWARN) },
|
||||
|
||||
{ "Laser tx power high alarm (Channel 4)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_4_HALARM) },
|
||||
{ "Laser tx power low alarm (Channel 4)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_4_LALARM) },
|
||||
{ "Laser tx power high warning (Channel 4)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_4_HWARN) },
|
||||
{ "Laser tx power low warning (Channel 4)",
|
||||
SFF8636_TX_PWR_34_AW_OFFSET, (SFF8636_TX_PWR_4_LWARN) },
|
||||
|
||||
{ "Laser rx power high alarm (Channel 1)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_1_HALARM) },
|
||||
{ "Laser rx power low alarm (Channel 1)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_1_LALARM) },
|
||||
{ "Laser rx power high warning (Channel 1)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_1_HWARN) },
|
||||
{ "Laser rx power low warning (Channel 1)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_1_LWARN) },
|
||||
|
||||
{ "Laser rx power high alarm (Channel 2)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_2_HALARM) },
|
||||
{ "Laser rx power low alarm (Channel 2)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_2_LALARM) },
|
||||
{ "Laser rx power high warning (Channel 2)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_2_HWARN) },
|
||||
{ "Laser rx power low warning (Channel 2)",
|
||||
SFF8636_RX_PWR_12_AW_OFFSET, (SFF8636_RX_PWR_2_LWARN) },
|
||||
|
||||
{ "Laser rx power high alarm (Channel 3)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_3_HALARM) },
|
||||
{ "Laser rx power low alarm (Channel 3)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_3_LALARM) },
|
||||
{ "Laser rx power high warning (Channel 3)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_3_HWARN) },
|
||||
{ "Laser rx power low warning (Channel 3)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_3_LWARN) },
|
||||
|
||||
{ "Laser rx power high alarm (Channel 4)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_4_HALARM) },
|
||||
{ "Laser rx power low alarm (Channel 4)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_4_LALARM) },
|
||||
{ "Laser rx power high warning (Channel 4)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_4_HWARN) },
|
||||
{ "Laser rx power low warning (Channel 4)",
|
||||
SFF8636_RX_PWR_34_AW_OFFSET, (SFF8636_RX_PWR_4_LWARN) },
|
||||
|
||||
{ NULL, 0, 0 },
|
||||
};
|
||||
|
||||
static void sff8636_show_identifier(const __u8 *id)
|
||||
{
|
||||
sff8024_show_identifier(id, SFF8636_ID_OFFSET);
|
||||
}
|
||||
|
||||
static void sff8636_show_ext_identifier(const __u8 *id)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x\n", "Extended identifier",
|
||||
id[SFF8636_EXT_ID_OFFSET]);
|
||||
|
||||
static const char *pfx =
|
||||
"\tExtended identifier description :";
|
||||
|
||||
switch (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_PWR_CLASS_MASK) {
|
||||
case SFF8636_EXT_ID_PWR_CLASS_1:
|
||||
printf("%s 1.5W max. Power consumption\n", pfx);
|
||||
break;
|
||||
case SFF8636_EXT_ID_PWR_CLASS_2:
|
||||
printf("%s 2.0W max. Power consumption\n", pfx);
|
||||
break;
|
||||
case SFF8636_EXT_ID_PWR_CLASS_3:
|
||||
printf("%s 2.5W max. Power consumption\n", pfx);
|
||||
break;
|
||||
case SFF8636_EXT_ID_PWR_CLASS_4:
|
||||
printf("%s 3.5W max. Power consumption\n", pfx);
|
||||
break;
|
||||
}
|
||||
|
||||
if (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_TX_MASK)
|
||||
printf("%s CDR present in TX,", pfx);
|
||||
else
|
||||
printf("%s No CDR in TX,", pfx);
|
||||
|
||||
if (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_RX_MASK)
|
||||
printf(" CDR present in RX\n");
|
||||
else
|
||||
printf(" No CDR in RX\n");
|
||||
|
||||
switch (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_EPWR_CLASS_MASK) {
|
||||
case SFF8636_EXT_ID_PWR_CLASS_LEGACY:
|
||||
printf("%s", pfx);
|
||||
break;
|
||||
case SFF8636_EXT_ID_PWR_CLASS_5:
|
||||
printf("%s 4.0W max. Power consumption,", pfx);
|
||||
break;
|
||||
case SFF8636_EXT_ID_PWR_CLASS_6:
|
||||
printf("%s 4.5W max. Power consumption, ", pfx);
|
||||
break;
|
||||
case SFF8636_EXT_ID_PWR_CLASS_7:
|
||||
printf("%s 5.0W max. Power consumption, ", pfx);
|
||||
break;
|
||||
}
|
||||
if (id[SFF8636_PWR_MODE_OFFSET] & SFF8636_HIGH_PWR_ENABLE)
|
||||
printf(" High Power Class (> 3.5 W) enabled\n");
|
||||
else
|
||||
printf(" High Power Class (> 3.5 W) not enabled\n");
|
||||
}
|
||||
|
||||
static void sff8636_show_connector(const __u8 *id)
|
||||
{
|
||||
sff8024_show_connector(id, SFF8636_CTOR_OFFSET);
|
||||
}
|
||||
|
||||
static void sff8636_show_transceiver(const __u8 *id)
|
||||
{
|
||||
static const char *pfx =
|
||||
"\tTransceiver type :";
|
||||
|
||||
printf("\t%-41s : 0x%02x 0x%02x 0x%02x " \
|
||||
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
"Transceiver codes",
|
||||
id[SFF8636_ETHERNET_COMP_OFFSET],
|
||||
id[SFF8636_SONET_COMP_OFFSET],
|
||||
id[SFF8636_SAS_COMP_OFFSET],
|
||||
id[SFF8636_GIGE_COMP_OFFSET],
|
||||
id[SFF8636_FC_LEN_OFFSET],
|
||||
id[SFF8636_FC_TECH_OFFSET],
|
||||
id[SFF8636_FC_TRANS_MEDIA_OFFSET],
|
||||
id[SFF8636_FC_SPEED_OFFSET]);
|
||||
|
||||
/* 10G/40G Ethernet Compliance Codes */
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_10G_LRM)
|
||||
printf("%s 10G Ethernet: 10G Base-LRM\n", pfx);
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_10G_LR)
|
||||
printf("%s 10G Ethernet: 10G Base-LR\n", pfx);
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_10G_SR)
|
||||
printf("%s 10G Ethernet: 10G Base-SR\n", pfx);
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_CR4)
|
||||
printf("%s 40G Ethernet: 40G Base-CR4\n", pfx);
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_SR4)
|
||||
printf("%s 40G Ethernet: 40G Base-SR4\n", pfx);
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_LR4)
|
||||
printf("%s 40G Ethernet: 40G Base-LR4\n", pfx);
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_ACTIVE)
|
||||
printf("%s 40G Ethernet: 40G Active Cable (XLPPI)\n", pfx);
|
||||
/* Extended Specification Compliance Codes from SFF-8024 */
|
||||
if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_RSRVD) {
|
||||
switch (id[SFF8636_OPTION_1_OFFSET]) {
|
||||
case SFF8636_ETHERNET_UNSPECIFIED:
|
||||
printf("%s (reserved or unknown)\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_AOC:
|
||||
printf("%s 100G Ethernet: 100G AOC or 25GAUI C2M AOC with worst BER of 5x10^(-5)\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_SR4:
|
||||
printf("%s 100G Ethernet: 100G Base-SR4 or 25GBase-SR\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_LR4:
|
||||
printf("%s 100G Ethernet: 100G Base-LR4\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_ER4:
|
||||
printf("%s 100G Ethernet: 100G Base-ER4\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_SR10:
|
||||
printf("%s 100G Ethernet: 100G Base-SR10\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_CWDM4_FEC:
|
||||
printf("%s 100G Ethernet: 100G CWDM4 MSA with FEC\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_PSM4:
|
||||
printf("%s 100G Ethernet: 100G PSM4 Parallel SMF\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_ACC:
|
||||
printf("%s 100G Ethernet: 100G ACC or 25GAUI C2M ACC with worst BER of 5x10^(-5)\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_CWDM4_NO_FEC:
|
||||
printf("%s 100G Ethernet: 100G CWDM4 MSA without FEC\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_RSVD1:
|
||||
printf("%s (reserved or unknown)\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_CR4:
|
||||
printf("%s 100G Ethernet: 100G Base-CR4 or 25G Base-CR CA-L\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_25G_CR_CA_S:
|
||||
printf("%s 25G Ethernet: 25G Base-CR CA-S\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_25G_CR_CA_N:
|
||||
printf("%s 25G Ethernet: 25G Base-CR CA-N\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_40G_ER4:
|
||||
printf("%s 40G Ethernet: 40G Base-ER4\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_4X10_SR:
|
||||
printf("%s 4x10G Ethernet: 10G Base-SR\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_40G_PSM4:
|
||||
printf("%s 40G Ethernet: 40G PSM4 Parallel SMF\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_G959_P1I1_2D1:
|
||||
printf("%s Ethernet: G959.1 profile P1I1-2D1 (10709 MBd, 2km, 1310nm SM)\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_G959_P1S1_2D2:
|
||||
printf("%s Ethernet: G959.1 profile P1S1-2D2 (10709 MBd, 40km, 1550nm SM)\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_G959_P1L1_2D2:
|
||||
printf("%s Ethernet: G959.1 profile P1L1-2D2 (10709 MBd, 80km, 1550nm SM)\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_10GT_SFI:
|
||||
printf("%s 10G Ethernet: 10G Base-T with SFI electrical interface\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_CLR4:
|
||||
printf("%s 100G Ethernet: 100G CLR4\n", pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_AOC2:
|
||||
printf("%s 100G Ethernet: 100G AOC or 25GAUI C2M AOC with worst BER of 10^(-12)\n",
|
||||
pfx);
|
||||
break;
|
||||
case SFF8636_ETHERNET_100G_ACC2:
|
||||
printf("%s 100G Ethernet: 100G ACC or 25GAUI C2M ACC with worst BER of 10^(-12)\n",
|
||||
pfx);
|
||||
break;
|
||||
default:
|
||||
printf("%s (reserved or unknown)\n", pfx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* SONET Compliance Codes */
|
||||
if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_40G_OTN))
|
||||
printf("%s 40G OTN (OTU3B/OTU3C)\n", pfx);
|
||||
if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_LR))
|
||||
printf("%s SONET: OC-48, long reach\n", pfx);
|
||||
if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_IR))
|
||||
printf("%s SONET: OC-48, intermediate reach\n", pfx);
|
||||
if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_SR))
|
||||
printf("%s SONET: OC-48, short reach\n", pfx);
|
||||
|
||||
/* SAS/SATA Compliance Codes */
|
||||
if (id[SFF8636_SAS_COMP_OFFSET] & (SFF8636_SAS_6G))
|
||||
printf("%s SAS 6.0G\n", pfx);
|
||||
if (id[SFF8636_SAS_COMP_OFFSET] & (SFF8636_SAS_3G))
|
||||
printf("%s SAS 3.0G\n", pfx);
|
||||
|
||||
/* Ethernet Compliance Codes */
|
||||
if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_T)
|
||||
printf("%s Ethernet: 1000BASE-T\n", pfx);
|
||||
if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_CX)
|
||||
printf("%s Ethernet: 1000BASE-CX\n", pfx);
|
||||
if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_LX)
|
||||
printf("%s Ethernet: 1000BASE-LX\n", pfx);
|
||||
if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_SX)
|
||||
printf("%s Ethernet: 1000BASE-SX\n", pfx);
|
||||
|
||||
/* Fibre Channel link length */
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_VERY_LONG)
|
||||
printf("%s FC: very long distance (V)\n", pfx);
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_SHORT)
|
||||
printf("%s FC: short distance (S)\n", pfx);
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_INT)
|
||||
printf("%s FC: intermediate distance (I)\n", pfx);
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_LONG)
|
||||
printf("%s FC: long distance (L)\n", pfx);
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_MED)
|
||||
printf("%s FC: medium distance (M)\n", pfx);
|
||||
|
||||
/* Fibre Channel transmitter technology */
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_TECH_LONG_LC)
|
||||
printf("%s FC: Longwave laser (LC)\n", pfx);
|
||||
if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_TECH_ELEC_INTER)
|
||||
printf("%s FC: Electrical inter-enclosure (EL)\n", pfx);
|
||||
if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_ELEC_INTRA)
|
||||
printf("%s FC: Electrical intra-enclosure (EL)\n", pfx);
|
||||
if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_SHORT_WO_OFC)
|
||||
printf("%s FC: Shortwave laser w/o OFC (SN)\n", pfx);
|
||||
if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_SHORT_W_OFC)
|
||||
printf("%s FC: Shortwave laser with OFC (SL)\n", pfx);
|
||||
if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_LONG_LL)
|
||||
printf("%s FC: Longwave laser (LL)\n", pfx);
|
||||
|
||||
/* Fibre Channel transmission media */
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_TW)
|
||||
printf("%s FC: Twin Axial Pair (TW)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_TP)
|
||||
printf("%s FC: Twisted Pair (TP)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_MI)
|
||||
printf("%s FC: Miniature Coax (MI)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_TV)
|
||||
printf("%s FC: Video Coax (TV)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_M6)
|
||||
printf("%s FC: Multimode, 62.5m (M6)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_M5)
|
||||
printf("%s FC: Multimode, 50m (M5)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_OM3)
|
||||
printf("%s FC: Multimode, 50um (OM3)\n", pfx);
|
||||
if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_SM)
|
||||
printf("%s FC: Single Mode (SM)\n", pfx);
|
||||
|
||||
/* Fibre Channel speed */
|
||||
if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_1200_MBPS)
|
||||
printf("%s FC: 1200 MBytes/sec\n", pfx);
|
||||
if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_800_MBPS)
|
||||
printf("%s FC: 800 MBytes/sec\n", pfx);
|
||||
if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_1600_MBPS)
|
||||
printf("%s FC: 1600 MBytes/sec\n", pfx);
|
||||
if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_400_MBPS)
|
||||
printf("%s FC: 400 MBytes/sec\n", pfx);
|
||||
if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_200_MBPS)
|
||||
printf("%s FC: 200 MBytes/sec\n", pfx);
|
||||
if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_100_MBPS)
|
||||
printf("%s FC: 100 MBytes/sec\n", pfx);
|
||||
}
|
||||
|
||||
static void sff8636_show_encoding(const __u8 *id)
|
||||
{
|
||||
sff8024_show_encoding(id, SFF8636_ENCODING_OFFSET, ETH_MODULE_SFF_8636);
|
||||
}
|
||||
|
||||
static void sff8636_show_rate_identifier(const __u8 *id)
|
||||
{
|
||||
/* TODO: Need to fix rate select logic */
|
||||
printf("\t%-41s : 0x%02x\n", "Rate identifier",
|
||||
id[SFF8636_EXT_RS_OFFSET]);
|
||||
}
|
||||
|
||||
static void sff8636_show_oui(const __u8 *id)
|
||||
{
|
||||
sff8024_show_oui(id, SFF8636_VENDOR_OUI_OFFSET);
|
||||
}
|
||||
|
||||
static void sff8636_show_wavelength_or_copper_compliance(const __u8 *id)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x", "Transmitter technology",
|
||||
(id[SFF8636_DEVICE_TECH_OFFSET] & SFF8636_TRANS_TECH_MASK));
|
||||
|
||||
switch (id[SFF8636_DEVICE_TECH_OFFSET] & SFF8636_TRANS_TECH_MASK) {
|
||||
case SFF8636_TRANS_850_VCSEL:
|
||||
printf(" (850 nm VCSEL)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1310_VCSEL:
|
||||
printf(" (1310 nm VCSEL)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1550_VCSEL:
|
||||
printf(" (1550 nm VCSEL)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1310_FP:
|
||||
printf(" (1310 nm FP)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1310_DFB:
|
||||
printf(" (1310 nm DFB)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1550_DFB:
|
||||
printf(" (1550 nm DFB)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1310_EML:
|
||||
printf(" (1310 nm EML)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1550_EML:
|
||||
printf(" (1550 nm EML)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_OTHERS:
|
||||
printf(" (Others/Undefined)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_1490_DFB:
|
||||
printf(" (1490 nm DFB)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_COPPER_PAS_UNEQUAL:
|
||||
printf(" (Copper cable unequalized)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_COPPER_PAS_EQUAL:
|
||||
printf(" (Copper cable passive equalized)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_COPPER_LNR_FAR_EQUAL:
|
||||
printf(" (Copper cable, near and far end limiting active equalizers)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_COPPER_FAR_EQUAL:
|
||||
printf(" (Copper cable, far end limiting active equalizers)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_COPPER_NEAR_EQUAL:
|
||||
printf(" (Copper cable, near end limiting active equalizers)\n");
|
||||
break;
|
||||
case SFF8636_TRANS_COPPER_LNR_EQUAL:
|
||||
printf(" (Copper cable, linear active equalizers)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((id[SFF8636_DEVICE_TECH_OFFSET] & SFF8636_TRANS_TECH_MASK)
|
||||
>= SFF8636_TRANS_COPPER_PAS_UNEQUAL) {
|
||||
printf("\t%-41s : %udb\n", "Attenuation at 2.5GHz",
|
||||
id[SFF8636_WAVELEN_HIGH_BYTE_OFFSET]);
|
||||
printf("\t%-41s : %udb\n", "Attenuation at 5.0GHz",
|
||||
id[SFF8636_WAVELEN_LOW_BYTE_OFFSET]);
|
||||
printf("\t%-41s : %udb\n", "Attenuation at 7.0GHz",
|
||||
id[SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET]);
|
||||
printf("\t%-41s : %udb\n", "Attenuation at 12.9GHz",
|
||||
id[SFF8636_WAVE_TOL_LOW_BYTE_OFFSET]);
|
||||
} else {
|
||||
printf("\t%-41s : %.3lfnm\n", "Laser wavelength",
|
||||
(((id[SFF8636_WAVELEN_HIGH_BYTE_OFFSET] << 8) |
|
||||
id[SFF8636_WAVELEN_LOW_BYTE_OFFSET])*0.05));
|
||||
printf("\t%-41s : %.3lfnm\n", "Laser wavelength tolerance",
|
||||
(((id[SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET] << 8) |
|
||||
id[SFF8636_WAVE_TOL_LOW_BYTE_OFFSET])*0.005));
|
||||
}
|
||||
}
|
||||
|
||||
static void sff8636_show_revision_compliance(const __u8 *id)
|
||||
{
|
||||
static const char *pfx =
|
||||
"\tRevision Compliance :";
|
||||
|
||||
switch (id[SFF8636_REV_COMPLIANCE_OFFSET]) {
|
||||
case SFF8636_REV_UNSPECIFIED:
|
||||
printf("%s Revision not specified\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8436_48:
|
||||
printf("%s SFF-8436 Rev 4.8 or earlier\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8436_8636:
|
||||
printf("%s SFF-8436 Rev 4.8 or earlier\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8636_13:
|
||||
printf("%s SFF-8636 Rev 1.3 or earlier\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8636_14:
|
||||
printf("%s SFF-8636 Rev 1.4\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8636_15:
|
||||
printf("%s SFF-8636 Rev 1.5\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8636_20:
|
||||
printf("%s SFF-8636 Rev 2.0\n", pfx);
|
||||
break;
|
||||
case SFF8636_REV_8636_27:
|
||||
printf("%s SFF-8636 Rev 2.5/2.6/2.7\n", pfx);
|
||||
break;
|
||||
default:
|
||||
printf("%s Unallocated\n", pfx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2-byte internal temperature conversions:
|
||||
* First byte is a signed 8-bit integer, which is the temp decimal part
|
||||
* Second byte are 1/256th of degree, which are added to the dec part.
|
||||
*/
|
||||
#define SFF8636_OFFSET_TO_TEMP(offset) ((__s16)OFFSET_TO_U16(offset))
|
||||
|
||||
static void sff8636_dom_parse(const __u8 *id, struct sff_diags *sd)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* Monitoring Thresholds for Alarms and Warnings */
|
||||
sd->sfp_voltage[MCURR] = OFFSET_TO_U16(SFF8636_VCC_CURR);
|
||||
sd->sfp_voltage[HALRM] = OFFSET_TO_U16(SFF8636_VCC_HALRM);
|
||||
sd->sfp_voltage[LALRM] = OFFSET_TO_U16(SFF8636_VCC_LALRM);
|
||||
sd->sfp_voltage[HWARN] = OFFSET_TO_U16(SFF8636_VCC_HWARN);
|
||||
sd->sfp_voltage[LWARN] = OFFSET_TO_U16(SFF8636_VCC_LWARN);
|
||||
|
||||
sd->sfp_temp[MCURR] = SFF8636_OFFSET_TO_TEMP(SFF8636_TEMP_CURR);
|
||||
sd->sfp_temp[HALRM] = SFF8636_OFFSET_TO_TEMP(SFF8636_TEMP_HALRM);
|
||||
sd->sfp_temp[LALRM] = SFF8636_OFFSET_TO_TEMP(SFF8636_TEMP_LALRM);
|
||||
sd->sfp_temp[HWARN] = SFF8636_OFFSET_TO_TEMP(SFF8636_TEMP_HWARN);
|
||||
sd->sfp_temp[LWARN] = SFF8636_OFFSET_TO_TEMP(SFF8636_TEMP_LWARN);
|
||||
|
||||
sd->bias_cur[HALRM] = OFFSET_TO_U16(SFF8636_TX_BIAS_HALRM);
|
||||
sd->bias_cur[LALRM] = OFFSET_TO_U16(SFF8636_TX_BIAS_LALRM);
|
||||
sd->bias_cur[HWARN] = OFFSET_TO_U16(SFF8636_TX_BIAS_HWARN);
|
||||
sd->bias_cur[LWARN] = OFFSET_TO_U16(SFF8636_TX_BIAS_LWARN);
|
||||
|
||||
sd->tx_power[HALRM] = OFFSET_TO_U16(SFF8636_TX_PWR_HALRM);
|
||||
sd->tx_power[LALRM] = OFFSET_TO_U16(SFF8636_TX_PWR_LALRM);
|
||||
sd->tx_power[HWARN] = OFFSET_TO_U16(SFF8636_TX_PWR_HWARN);
|
||||
sd->tx_power[LWARN] = OFFSET_TO_U16(SFF8636_TX_PWR_LWARN);
|
||||
|
||||
sd->rx_power[HALRM] = OFFSET_TO_U16(SFF8636_RX_PWR_HALRM);
|
||||
sd->rx_power[LALRM] = OFFSET_TO_U16(SFF8636_RX_PWR_LALRM);
|
||||
sd->rx_power[HWARN] = OFFSET_TO_U16(SFF8636_RX_PWR_HWARN);
|
||||
sd->rx_power[LWARN] = OFFSET_TO_U16(SFF8636_RX_PWR_LWARN);
|
||||
|
||||
|
||||
/* Channel Specific Data */
|
||||
for (i = 0; i < MAX_CHANNEL_NUM; i++) {
|
||||
u8 rx_power_offset, tx_bias_offset;
|
||||
u8 tx_power_offset;
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
rx_power_offset = SFF8636_RX_PWR_1_OFFSET;
|
||||
tx_power_offset = SFF8636_TX_PWR_1_OFFSET;
|
||||
tx_bias_offset = SFF8636_TX_BIAS_1_OFFSET;
|
||||
break;
|
||||
case 1:
|
||||
rx_power_offset = SFF8636_RX_PWR_2_OFFSET;
|
||||
tx_power_offset = SFF8636_TX_PWR_2_OFFSET;
|
||||
tx_bias_offset = SFF8636_TX_BIAS_2_OFFSET;
|
||||
break;
|
||||
case 2:
|
||||
rx_power_offset = SFF8636_RX_PWR_3_OFFSET;
|
||||
tx_power_offset = SFF8636_TX_PWR_3_OFFSET;
|
||||
tx_bias_offset = SFF8636_TX_BIAS_3_OFFSET;
|
||||
break;
|
||||
case 3:
|
||||
rx_power_offset = SFF8636_RX_PWR_4_OFFSET;
|
||||
tx_power_offset = SFF8636_TX_PWR_4_OFFSET;
|
||||
tx_bias_offset = SFF8636_TX_BIAS_4_OFFSET;
|
||||
break;
|
||||
}
|
||||
sd->scd[i].bias_cur = OFFSET_TO_U16(tx_bias_offset);
|
||||
sd->scd[i].rx_power = OFFSET_TO_U16(rx_power_offset);
|
||||
sd->scd[i].tx_power = OFFSET_TO_U16(tx_power_offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len)
|
||||
{
|
||||
struct sff_diags sd = {0};
|
||||
char *rx_power_string = NULL;
|
||||
char power_string[MAX_DESC_SIZE];
|
||||
int i;
|
||||
|
||||
/*
|
||||
* There is no clear identifier to signify the existence of
|
||||
* optical diagnostics similar to SFF-8472. So checking existence
|
||||
* of page 3, will provide the gurantee for existence of alarms
|
||||
* and thresholds
|
||||
* If pagging support exists, then supports_alarms is marked as 1
|
||||
*/
|
||||
|
||||
if (eeprom_len == ETH_MODULE_SFF_8636_MAX_LEN) {
|
||||
if (!(id[SFF8636_STATUS_2_OFFSET] &
|
||||
SFF8636_STATUS_PAGE_3_PRESENT)) {
|
||||
sd.supports_alarms = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sd.rx_power_type = id[SFF8636_DIAG_TYPE_OFFSET] &
|
||||
SFF8636_RX_PWR_TYPE_MASK;
|
||||
sd.tx_power_type = id[SFF8636_DIAG_TYPE_OFFSET] &
|
||||
SFF8636_RX_PWR_TYPE_MASK;
|
||||
|
||||
sff8636_dom_parse(id, &sd);
|
||||
|
||||
PRINT_TEMP("Module temperature", sd.sfp_temp[MCURR]);
|
||||
PRINT_VCC("Module voltage", sd.sfp_voltage[MCURR]);
|
||||
|
||||
/*
|
||||
* SFF-8636/8436 spec is not clear whether RX power/ TX bias
|
||||
* current fields are supported or not. A valid temperature
|
||||
* reading is used as existence for TX/RX power.
|
||||
*/
|
||||
if ((sd.sfp_temp[MCURR] == 0x0) ||
|
||||
(sd.sfp_temp[MCURR] == (__s16)0xFFFF))
|
||||
return;
|
||||
|
||||
printf("\t%-41s : %s\n", "Alarm/warning flags implemented",
|
||||
(sd.supports_alarms ? "Yes" : "No"));
|
||||
|
||||
for (i = 0; i < MAX_CHANNEL_NUM; i++) {
|
||||
snprintf(power_string, MAX_DESC_SIZE, "%s (Channel %d)",
|
||||
"Laser tx bias current", i+1);
|
||||
PRINT_BIAS(power_string, sd.scd[i].bias_cur);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CHANNEL_NUM; i++) {
|
||||
snprintf(power_string, MAX_DESC_SIZE, "%s (Channel %d)",
|
||||
"Transmit avg optical power", i+1);
|
||||
PRINT_xX_PWR(power_string, sd.scd[i].tx_power);
|
||||
}
|
||||
|
||||
if (!sd.rx_power_type)
|
||||
rx_power_string = "Receiver signal OMA";
|
||||
else
|
||||
rx_power_string = "Rcvr signal avg optical power";
|
||||
|
||||
for (i = 0; i < MAX_CHANNEL_NUM; i++) {
|
||||
snprintf(power_string, MAX_DESC_SIZE, "%s(Channel %d)",
|
||||
rx_power_string, i+1);
|
||||
PRINT_xX_PWR(power_string, sd.scd[i].rx_power);
|
||||
}
|
||||
|
||||
if (sd.supports_alarms) {
|
||||
for (i = 0; sff8636_aw_flags[i].str; ++i) {
|
||||
printf("\t%-41s : %s\n", sff8636_aw_flags[i].str,
|
||||
id[sff8636_aw_flags[i].offset]
|
||||
& sff8636_aw_flags[i].value ? "On" : "Off");
|
||||
}
|
||||
|
||||
sff_show_thresholds(sd);
|
||||
}
|
||||
|
||||
}
|
||||
void sff8636_show_all(const __u8 *id, __u32 eeprom_len)
|
||||
{
|
||||
sff8636_show_identifier(id);
|
||||
if ((id[SFF8636_ID_OFFSET] == SFF8024_ID_QSFP) ||
|
||||
(id[SFF8636_ID_OFFSET] == SFF8024_ID_QSFP_PLUS) ||
|
||||
(id[SFF8636_ID_OFFSET] == SFF8024_ID_QSFP28)) {
|
||||
sff8636_show_ext_identifier(id);
|
||||
sff8636_show_connector(id);
|
||||
sff8636_show_transceiver(id);
|
||||
sff8636_show_encoding(id);
|
||||
sff_show_value_with_unit(id, SFF8636_BR_NOMINAL_OFFSET,
|
||||
"BR, Nominal", 100, "Mbps");
|
||||
sff8636_show_rate_identifier(id);
|
||||
sff_show_value_with_unit(id, SFF8636_SM_LEN_OFFSET,
|
||||
"Length (SMF,km)", 1, "km");
|
||||
sff_show_value_with_unit(id, SFF8636_OM3_LEN_OFFSET,
|
||||
"Length (OM3 50um)", 2, "m");
|
||||
sff_show_value_with_unit(id, SFF8636_OM2_LEN_OFFSET,
|
||||
"Length (OM2 50um)", 1, "m");
|
||||
sff_show_value_with_unit(id, SFF8636_OM1_LEN_OFFSET,
|
||||
"Length (OM1 62.5um)", 1, "m");
|
||||
sff_show_value_with_unit(id, SFF8636_CBL_LEN_OFFSET,
|
||||
"Length (Copper or Active cable)", 1, "m");
|
||||
sff8636_show_wavelength_or_copper_compliance(id);
|
||||
sff_show_ascii(id, SFF8636_VENDOR_NAME_START_OFFSET,
|
||||
SFF8636_VENDOR_NAME_END_OFFSET, "Vendor name");
|
||||
sff8636_show_oui(id);
|
||||
sff_show_ascii(id, SFF8636_VENDOR_PN_START_OFFSET,
|
||||
SFF8636_VENDOR_PN_END_OFFSET, "Vendor PN");
|
||||
sff_show_ascii(id, SFF8636_VENDOR_REV_START_OFFSET,
|
||||
SFF8636_VENDOR_REV_END_OFFSET, "Vendor rev");
|
||||
sff_show_ascii(id, SFF8636_VENDOR_SN_START_OFFSET,
|
||||
SFF8636_VENDOR_SN_END_OFFSET, "Vendor SN");
|
||||
sff_show_ascii(id, SFF8636_DATE_YEAR_OFFSET,
|
||||
SFF8636_DATE_VENDOR_LOT_OFFSET + 1, "Date code");
|
||||
sff8636_show_revision_compliance(id);
|
||||
sff8636_show_dom(id, eeprom_len);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,597 @@
|
|||
/*
|
||||
* SFF 8636 standards based QSFP EEPROM Field Definitions
|
||||
*
|
||||
* Vidya Ravipati <vidya@cumulusnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QSFP_H__
|
||||
#define QSFP_H__
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*
|
||||
* QSFP EEPROM data structures
|
||||
*
|
||||
* register info from SFF-8636 Rev 2.7
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*
|
||||
* Lower Memory Page 00h
|
||||
* Measurement, Diagnostic and Control Functions
|
||||
*
|
||||
*/
|
||||
/* Identifier - 0 */
|
||||
/* Values are defined under SFF8024_ID_OFFSET */
|
||||
#define SFF8636_ID_OFFSET 0x00
|
||||
|
||||
#define SFF8636_REV_COMPLIANCE_OFFSET 0x01
|
||||
#define SFF8636_REV_UNSPECIFIED 0x00
|
||||
#define SFF8636_REV_8436_48 0x01
|
||||
#define SFF8636_REV_8436_8636 0x02
|
||||
#define SFF8636_REV_8636_13 0x03
|
||||
#define SFF8636_REV_8636_14 0x04
|
||||
#define SFF8636_REV_8636_15 0x05
|
||||
#define SFF8636_REV_8636_20 0x06
|
||||
#define SFF8636_REV_8636_27 0x07
|
||||
|
||||
#define SFF8636_STATUS_2_OFFSET 0x02
|
||||
/* Flat Memory:0- Paging, 1- Page 0 only */
|
||||
#define SFF8636_STATUS_PAGE_3_PRESENT (1 << 2)
|
||||
#define SFF8636_STATUS_INTL_OUTPUT (1 << 1)
|
||||
#define SFF8636_STATUS_DATA_NOT_READY (1 << 0)
|
||||
|
||||
/* Channel Status Interrupt Flags - 3-5 */
|
||||
#define SFF8636_LOS_AW_OFFSET 0x03
|
||||
#define SFF8636_TX4_LOS_AW (1 << 7)
|
||||
#define SFF8636_TX3_LOS_AW (1 << 6)
|
||||
#define SFF8636_TX2_LOS_AW (1 << 5)
|
||||
#define SFF8636_TX1_LOS_AW (1 << 4)
|
||||
#define SFF8636_RX4_LOS_AW (1 << 3)
|
||||
#define SFF8636_RX3_LOS_AW (1 << 2)
|
||||
#define SFF8636_RX2_LOS_AW (1 << 1)
|
||||
#define SFF8636_RX1_LOS_AW (1 << 0)
|
||||
|
||||
#define SFF8636_FAULT_AW_OFFSET 0x04
|
||||
#define SFF8636_TX4_FAULT_AW (1 << 3)
|
||||
#define SFF8636_TX3_FAULT_AW (1 << 2)
|
||||
#define SFF8636_TX2_FAULT_AW (1 << 1)
|
||||
#define SFF8636_TX1_FAULT_AW (1 << 0)
|
||||
|
||||
/* Module Monitor Interrupt Flags - 6-8 */
|
||||
#define SFF8636_TEMP_AW_OFFSET 0x06
|
||||
#define SFF8636_TEMP_HALARM_STATUS (1 << 7)
|
||||
#define SFF8636_TEMP_LALARM_STATUS (1 << 6)
|
||||
#define SFF8636_TEMP_HWARN_STATUS (1 << 5)
|
||||
#define SFF8636_TEMP_LWARN_STATUS (1 << 4)
|
||||
|
||||
#define SFF8636_VCC_AW_OFFSET 0x07
|
||||
#define SFF8636_VCC_HALARM_STATUS (1 << 7)
|
||||
#define SFF8636_VCC_LALARM_STATUS (1 << 6)
|
||||
#define SFF8636_VCC_HWARN_STATUS (1 << 5)
|
||||
#define SFF8636_VCC_LWARN_STATUS (1 << 4)
|
||||
|
||||
/* Channel Monitor Interrupt Flags - 9-21 */
|
||||
#define SFF8636_RX_PWR_12_AW_OFFSET 0x09
|
||||
#define SFF8636_RX_PWR_1_HALARM (1 << 7)
|
||||
#define SFF8636_RX_PWR_1_LALARM (1 << 6)
|
||||
#define SFF8636_RX_PWR_1_HWARN (1 << 5)
|
||||
#define SFF8636_RX_PWR_1_LWARN (1 << 4)
|
||||
#define SFF8636_RX_PWR_2_HALARM (1 << 3)
|
||||
#define SFF8636_RX_PWR_2_LALARM (1 << 2)
|
||||
#define SFF8636_RX_PWR_2_HWARN (1 << 1)
|
||||
#define SFF8636_RX_PWR_2_LWARN (1 << 0)
|
||||
|
||||
#define SFF8636_RX_PWR_34_AW_OFFSET 0x0A
|
||||
#define SFF8636_RX_PWR_3_HALARM (1 << 7)
|
||||
#define SFF8636_RX_PWR_3_LALARM (1 << 6)
|
||||
#define SFF8636_RX_PWR_3_HWARN (1 << 5)
|
||||
#define SFF8636_RX_PWR_3_LWARN (1 << 4)
|
||||
#define SFF8636_RX_PWR_4_HALARM (1 << 3)
|
||||
#define SFF8636_RX_PWR_4_LALARM (1 << 2)
|
||||
#define SFF8636_RX_PWR_4_HWARN (1 << 1)
|
||||
#define SFF8636_RX_PWR_4_LWARN (1 << 0)
|
||||
|
||||
#define SFF8636_TX_BIAS_12_AW_OFFSET 0x0B
|
||||
#define SFF8636_TX_BIAS_1_HALARM (1 << 7)
|
||||
#define SFF8636_TX_BIAS_1_LALARM (1 << 6)
|
||||
#define SFF8636_TX_BIAS_1_HWARN (1 << 5)
|
||||
#define SFF8636_TX_BIAS_1_LWARN (1 << 4)
|
||||
#define SFF8636_TX_BIAS_2_HALARM (1 << 3)
|
||||
#define SFF8636_TX_BIAS_2_LALARM (1 << 2)
|
||||
#define SFF8636_TX_BIAS_2_HWARN (1 << 1)
|
||||
#define SFF8636_TX_BIAS_2_LWARN (1 << 0)
|
||||
|
||||
#define SFF8636_TX_BIAS_34_AW_OFFSET 0xC
|
||||
#define SFF8636_TX_BIAS_3_HALARM (1 << 7)
|
||||
#define SFF8636_TX_BIAS_3_LALARM (1 << 6)
|
||||
#define SFF8636_TX_BIAS_3_HWARN (1 << 5)
|
||||
#define SFF8636_TX_BIAS_3_LWARN (1 << 4)
|
||||
#define SFF8636_TX_BIAS_4_HALARM (1 << 3)
|
||||
#define SFF8636_TX_BIAS_4_LALARM (1 << 2)
|
||||
#define SFF8636_TX_BIAS_4_HWARN (1 << 1)
|
||||
#define SFF8636_TX_BIAS_4_LWARN (1 << 0)
|
||||
|
||||
#define SFF8636_TX_PWR_12_AW_OFFSET 0x0D
|
||||
#define SFF8636_TX_PWR_1_HALARM (1 << 7)
|
||||
#define SFF8636_TX_PWR_1_LALARM (1 << 6)
|
||||
#define SFF8636_TX_PWR_1_HWARN (1 << 5)
|
||||
#define SFF8636_TX_PWR_1_LWARN (1 << 4)
|
||||
#define SFF8636_TX_PWR_2_HALARM (1 << 3)
|
||||
#define SFF8636_TX_PWR_2_LALARM (1 << 2)
|
||||
#define SFF8636_TX_PWR_2_HWARN (1 << 1)
|
||||
#define SFF8636_TX_PWR_2_LWARN (1 << 0)
|
||||
|
||||
#define SFF8636_TX_PWR_34_AW_OFFSET 0x0E
|
||||
#define SFF8636_TX_PWR_3_HALARM (1 << 7)
|
||||
#define SFF8636_TX_PWR_3_LALARM (1 << 6)
|
||||
#define SFF8636_TX_PWR_3_HWARN (1 << 5)
|
||||
#define SFF8636_TX_PWR_3_LWARN (1 << 4)
|
||||
#define SFF8636_TX_PWR_4_HALARM (1 << 3)
|
||||
#define SFF8636_TX_PWR_4_LALARM (1 << 2)
|
||||
#define SFF8636_TX_PWR_4_HWARN (1 << 1)
|
||||
#define SFF8636_TX_PWR_4_LWARN (1 << 0)
|
||||
|
||||
/* Module Monitoring Values - 22-33 */
|
||||
#define SFF8636_TEMP_CURR 0x16
|
||||
#define SFF8636_TEMP_MSB_OFFSET 0x16
|
||||
#define SFF8636_TEMP_LSB_OFFSET 0x17
|
||||
|
||||
#define SFF8636_VCC_CURR 0x1A
|
||||
#define SFF8636_VCC_MSB_OFFSET 0x1A
|
||||
#define SFF8636_VCC_LSB_OFFSET 0x1B
|
||||
|
||||
/* Channel Monitoring Values - 34-81 */
|
||||
#define SFF8636_RX_PWR_1_OFFSET 0x22
|
||||
#define SFF8636_RX_PWR_2_OFFSET 0x24
|
||||
#define SFF8636_RX_PWR_3_OFFSET 0x26
|
||||
#define SFF8636_RX_PWR_4_OFFSET 0x28
|
||||
|
||||
#define SFF8636_TX_BIAS_1_OFFSET 0x2A
|
||||
#define SFF8636_TX_BIAS_2_OFFSET 0x2C
|
||||
#define SFF8636_TX_BIAS_3_OFFSET 0x2E
|
||||
#define SFF8636_TX_BIAS_4_OFFSET 0x30
|
||||
|
||||
#define SFF8636_TX_PWR_1_OFFSET 0x32
|
||||
#define SFF8636_TX_PWR_2_OFFSET 0x34
|
||||
#define SFF8636_TX_PWR_3_OFFSET 0x36
|
||||
#define SFF8636_TX_PWR_4_OFFSET 0x38
|
||||
|
||||
/* Control Bytes - 86 - 99 */
|
||||
#define SFF8636_TX_DISABLE_OFFSET 0x56
|
||||
#define SFF8636_TX_DISABLE_4 (1 << 3)
|
||||
#define SFF8636_TX_DISABLE_3 (1 << 2)
|
||||
#define SFF8636_TX_DISABLE_2 (1 << 1)
|
||||
#define SFF8636_TX_DISABLE_1 (1 << 0)
|
||||
|
||||
#define SFF8636_RX_RATE_SELECT_OFFSET 0x57
|
||||
#define SFF8636_RX_RATE_SELECT_4_MASK (3 << 6)
|
||||
#define SFF8636_RX_RATE_SELECT_3_MASK (3 << 4)
|
||||
#define SFF8636_RX_RATE_SELECT_2_MASK (3 << 2)
|
||||
#define SFF8636_RX_RATE_SELECT_1_MASK (3 << 0)
|
||||
|
||||
#define SFF8636_TX_RATE_SELECT_OFFSET 0x58
|
||||
#define SFF8636_TX_RATE_SELECT_4_MASK (3 << 6)
|
||||
#define SFF8636_TX_RATE_SELECT_3_MASK (3 << 4)
|
||||
#define SFF8636_TX_RATE_SELECT_2_MASK (3 << 2)
|
||||
#define SFF8636_TX_RATE_SELECT_1_MASK (3 << 0)
|
||||
|
||||
#define SFF8636_RX_APP_SELECT_4_OFFSET 0x58
|
||||
#define SFF8636_RX_APP_SELECT_3_OFFSET 0x59
|
||||
#define SFF8636_RX_APP_SELECT_2_OFFSET 0x5A
|
||||
#define SFF8636_RX_APP_SELECT_1_OFFSET 0x5B
|
||||
|
||||
#define SFF8636_PWR_MODE_OFFSET 0x5D
|
||||
#define SFF8636_HIGH_PWR_ENABLE (1 << 2)
|
||||
#define SFF8636_LOW_PWR_MODE (1 << 1)
|
||||
#define SFF8636_PWR_OVERRIDE (1 << 0)
|
||||
|
||||
#define SFF8636_TX_APP_SELECT_4_OFFSET 0x5E
|
||||
#define SFF8636_TX_APP_SELECT_3_OFFSET 0x5F
|
||||
#define SFF8636_TX_APP_SELECT_2_OFFSET 0x60
|
||||
#define SFF8636_TX_APP_SELECT_1_OFFSET 0x61
|
||||
|
||||
#define SFF8636_LOS_MASK_OFFSET 0x64
|
||||
#define SFF8636_TX_LOS_4_MASK (1 << 7)
|
||||
#define SFF8636_TX_LOS_3_MASK (1 << 6)
|
||||
#define SFF8636_TX_LOS_2_MASK (1 << 5)
|
||||
#define SFF8636_TX_LOS_1_MASK (1 << 4)
|
||||
#define SFF8636_RX_LOS_4_MASK (1 << 3)
|
||||
#define SFF8636_RX_LOS_3_MASK (1 << 2)
|
||||
#define SFF8636_RX_LOS_2_MASK (1 << 1)
|
||||
#define SFF8636_RX_LOS_1_MASK (1 << 0)
|
||||
|
||||
#define SFF8636_FAULT_MASK_OFFSET 0x65
|
||||
#define SFF8636_TX_FAULT_1_MASK (1 << 3)
|
||||
#define SFF8636_TX_FAULT_2_MASK (1 << 2)
|
||||
#define SFF8636_TX_FAULT_3_MASK (1 << 1)
|
||||
#define SFF8636_TX_FAULT_4_MASK (1 << 0)
|
||||
|
||||
#define SFF8636_TEMP_MASK_OFFSET 0x67
|
||||
#define SFF8636_TEMP_HALARM_MASK (1 << 7)
|
||||
#define SFF8636_TEMP_LALARM_MASK (1 << 6)
|
||||
#define SFF8636_TEMP_HWARN_MASK (1 << 5)
|
||||
#define SFF8636_TEMP_LWARN_MASK (1 << 4)
|
||||
|
||||
#define SFF8636_VCC_MASK_OFFSET 0x68
|
||||
#define SFF8636_VCC_HALARM_MASK (1 << 7)
|
||||
#define SFF8636_VCC_LALARM_MASK (1 << 6)
|
||||
#define SFF8636_VCC_HWARN_MASK (1 << 5)
|
||||
#define SFF8636_VCC_LWARN_MASK (1 << 4)
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*
|
||||
* Upper Memory Page 00h
|
||||
* Serial ID - Base ID, Extended ID and Vendor Specific ID fields
|
||||
*
|
||||
*/
|
||||
/* Identifier - 128 */
|
||||
/* Identifier values same as Lower Memory Page 00h */
|
||||
#define SFF8636_UPPER_PAGE_0_ID_OFFSET 0x80
|
||||
|
||||
/* Extended Identifier - 128 */
|
||||
#define SFF8636_EXT_ID_OFFSET 0x81
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_MASK 0xC0
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_1 (0 << 6)
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_2 (1 << 6)
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_3 (2 << 6)
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_4 (3 << 6)
|
||||
#define SFF8636_EXT_ID_CLIE_MASK 0x10
|
||||
#define SFF8636_EXT_ID_CLIEI_CODE_PRESENT (1 << 4)
|
||||
#define SFF8636_EXT_ID_CDR_TX_MASK 0x08
|
||||
#define SFF8636_EXT_ID_CDR_TX_PRESENT (1 << 3)
|
||||
#define SFF8636_EXT_ID_CDR_RX_MASK 0x04
|
||||
#define SFF8636_EXT_ID_CDR_RX_PRESENT (1 << 2)
|
||||
#define SFF8636_EXT_ID_EPWR_CLASS_MASK 0x03
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_LEGACY 0
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_5 1
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_6 2
|
||||
#define SFF8636_EXT_ID_PWR_CLASS_7 3
|
||||
|
||||
/* Connector Values offset - 130 */
|
||||
/* Values are defined under SFF8024_CTOR */
|
||||
#define SFF8636_CTOR_OFFSET 0x82
|
||||
#define SFF8636_CTOR_UNKNOWN 0x00
|
||||
#define SFF8636_CTOR_SC 0x01
|
||||
#define SFF8636_CTOR_FC_STYLE_1 0x02
|
||||
#define SFF8636_CTOR_FC_STYLE_2 0x03
|
||||
#define SFF8636_CTOR_BNC_TNC 0x04
|
||||
#define SFF8636_CTOR_FC_COAX 0x05
|
||||
#define SFF8636_CTOR_FIBER_JACK 0x06
|
||||
#define SFF8636_CTOR_LC 0x07
|
||||
#define SFF8636_CTOR_MT_RJ 0x08
|
||||
#define SFF8636_CTOR_MU 0x09
|
||||
#define SFF8636_CTOR_SG 0x0A
|
||||
#define SFF8636_CTOR_OPT_PT 0x0B
|
||||
#define SFF8636_CTOR_MPO 0x0C
|
||||
/* 0D-1Fh --- Reserved */
|
||||
#define SFF8636_CTOR_HSDC_II 0x20
|
||||
#define SFF8636_CTOR_COPPER_PT 0x21
|
||||
#define SFF8636_CTOR_RJ45 0x22
|
||||
#define SFF8636_CTOR_NO_SEPARABLE 0x23
|
||||
#define SFF8636_CTOR_MXC_2X16 0x24
|
||||
|
||||
/* Specification Compliance - 131-138 */
|
||||
/* Ethernet Compliance Codes - 131 */
|
||||
#define SFF8636_ETHERNET_COMP_OFFSET 0x83
|
||||
#define SFF8636_ETHERNET_RSRVD (1 << 7)
|
||||
#define SFF8636_ETHERNET_10G_LRM (1 << 6)
|
||||
#define SFF8636_ETHERNET_10G_LR (1 << 5)
|
||||
#define SFF8636_ETHERNET_10G_SR (1 << 4)
|
||||
#define SFF8636_ETHERNET_40G_CR4 (1 << 3)
|
||||
#define SFF8636_ETHERNET_40G_SR4 (1 << 2)
|
||||
#define SFF8636_ETHERNET_40G_LR4 (1 << 1)
|
||||
#define SFF8636_ETHERNET_40G_ACTIVE (1 << 0)
|
||||
|
||||
/* SONET Compliance Codes - 132 */
|
||||
#define SFF8636_SONET_COMP_OFFSET 0x84
|
||||
#define SFF8636_SONET_40G_OTN (1 << 3)
|
||||
#define SFF8636_SONET_OC48_LR (1 << 2)
|
||||
#define SFF8636_SONET_OC48_IR (1 << 1)
|
||||
#define SFF8636_SONET_OC48_SR (1 << 0)
|
||||
|
||||
/* SAS/SATA Complaince Codes - 133 */
|
||||
#define SFF8636_SAS_COMP_OFFSET 0x85
|
||||
#define SFF8636_SAS_12G (1 << 6)
|
||||
#define SFF8636_SAS_6G (1 << 5)
|
||||
#define SFF8636_SAS_3G (1 << 4)
|
||||
|
||||
/* Gigabit Ethernet Compliance Codes - 134 */
|
||||
#define SFF8636_GIGE_COMP_OFFSET 0x86
|
||||
#define SFF8636_GIGE_1000_BASE_T (1 << 3)
|
||||
#define SFF8636_GIGE_1000_BASE_CX (1 << 2)
|
||||
#define SFF8636_GIGE_1000_BASE_LX (1 << 1)
|
||||
#define SFF8636_GIGE_1000_BASE_SX (1 << 0)
|
||||
|
||||
/* Fibre Channel Link length/Transmitter Tech. - 135,136 */
|
||||
#define SFF8636_FC_LEN_OFFSET 0x87
|
||||
#define SFF8636_FC_LEN_VERY_LONG (1 << 7)
|
||||
#define SFF8636_FC_LEN_SHORT (1 << 6)
|
||||
#define SFF8636_FC_LEN_INT (1 << 5)
|
||||
#define SFF8636_FC_LEN_LONG (1 << 4)
|
||||
#define SFF8636_FC_LEN_MED (1 << 3)
|
||||
#define SFF8636_FC_TECH_LONG_LC (1 << 1)
|
||||
#define SFF8636_FC_TECH_ELEC_INTER (1 << 0)
|
||||
|
||||
#define SFF8636_FC_TECH_OFFSET 0x88
|
||||
#define SFF8636_FC_TECH_ELEC_INTRA (1 << 7)
|
||||
#define SFF8636_FC_TECH_SHORT_WO_OFC (1 << 6)
|
||||
#define SFF8636_FC_TECH_SHORT_W_OFC (1 << 5)
|
||||
#define SFF8636_FC_TECH_LONG_LL (1 << 4)
|
||||
|
||||
/* Fibre Channel Transmitter Media - 137 */
|
||||
#define SFF8636_FC_TRANS_MEDIA_OFFSET 0x89
|
||||
/* Twin Axial Pair */
|
||||
#define SFF8636_FC_TRANS_MEDIA_TW (1 << 7)
|
||||
/* Shielded Twisted Pair */
|
||||
#define SFF8636_FC_TRANS_MEDIA_TP (1 << 6)
|
||||
/* Miniature Coax */
|
||||
#define SFF8636_FC_TRANS_MEDIA_MI (1 << 5)
|
||||
/* Video Coax */
|
||||
#define SFF8636_FC_TRANS_MEDIA_TV (1 << 4)
|
||||
/* Multi-mode 62.5m */
|
||||
#define SFF8636_FC_TRANS_MEDIA_M6 (1 << 3)
|
||||
/* Multi-mode 50m */
|
||||
#define SFF8636_FC_TRANS_MEDIA_M5 (1 << 2)
|
||||
/* Multi-mode 50um */
|
||||
#define SFF8636_FC_TRANS_MEDIA_OM3 (1 << 1)
|
||||
/* Single Mode */
|
||||
#define SFF8636_FC_TRANS_MEDIA_SM (1 << 0)
|
||||
|
||||
/* Fibre Channel Speed - 138 */
|
||||
#define SFF8636_FC_SPEED_OFFSET 0x8A
|
||||
#define SFF8636_FC_SPEED_1200_MBPS (1 << 7)
|
||||
#define SFF8636_FC_SPEED_800_MBPS (1 << 6)
|
||||
#define SFF8636_FC_SPEED_1600_MBPS (1 << 5)
|
||||
#define SFF8636_FC_SPEED_400_MBPS (1 << 4)
|
||||
#define SFF8636_FC_SPEED_200_MBPS (1 << 2)
|
||||
#define SFF8636_FC_SPEED_100_MBPS (1 << 0)
|
||||
|
||||
/* Encoding - 139 */
|
||||
/* Values are defined under SFF8024_ENCODING */
|
||||
#define SFF8636_ENCODING_OFFSET 0x8B
|
||||
#define SFF8636_ENCODING_MANCHESTER 0x06
|
||||
#define SFF8636_ENCODING_64B66B 0x05
|
||||
#define SFF8636_ENCODING_SONET 0x04
|
||||
#define SFF8636_ENCODING_NRZ 0x03
|
||||
#define SFF8636_ENCODING_4B5B 0x02
|
||||
#define SFF8636_ENCODING_8B10B 0x01
|
||||
#define SFF8636_ENCODING_UNSPEC 0x00
|
||||
|
||||
/* BR, Nominal - 140 */
|
||||
#define SFF8636_BR_NOMINAL_OFFSET 0x8C
|
||||
|
||||
/* Extended RateSelect - 141 */
|
||||
#define SFF8636_EXT_RS_OFFSET 0x8D
|
||||
#define SFF8636_EXT_RS_V1 (1 << 0)
|
||||
|
||||
/* Length (Standard SM Fiber)-km - 142 */
|
||||
#define SFF8636_SM_LEN_OFFSET 0x8E
|
||||
|
||||
/* Length (OM3)-Unit 2m - 143 */
|
||||
#define SFF8636_OM3_LEN_OFFSET 0x8F
|
||||
|
||||
/* Length (OM2)-Unit 1m - 144 */
|
||||
#define SFF8636_OM2_LEN_OFFSET 0x90
|
||||
|
||||
/* Length (OM1)-Unit 1m - 145 */
|
||||
#define SFF8636_OM1_LEN_OFFSET 0x91
|
||||
|
||||
/* Cable Assembly Length -Unit 1m - 146 */
|
||||
#define SFF8636_CBL_LEN_OFFSET 0x92
|
||||
|
||||
/* Device Technology - 147 */
|
||||
#define SFF8636_DEVICE_TECH_OFFSET 0x93
|
||||
/* Transmitter Technology */
|
||||
#define SFF8636_TRANS_TECH_MASK 0xF0
|
||||
/* Copper cable, linear active equalizers */
|
||||
#define SFF8636_TRANS_COPPER_LNR_EQUAL (15 << 4)
|
||||
/* Copper cable, near end limiting active equalizers */
|
||||
#define SFF8636_TRANS_COPPER_NEAR_EQUAL (14 << 4)
|
||||
/* Copper cable, far end limiting active equalizers */
|
||||
#define SFF8636_TRANS_COPPER_FAR_EQUAL (13 << 4)
|
||||
/* Copper cable, near & far end limiting active equalizers */
|
||||
#define SFF8636_TRANS_COPPER_LNR_FAR_EQUAL (12 << 4)
|
||||
/* Copper cable, passive equalized */
|
||||
#define SFF8636_TRANS_COPPER_PAS_EQUAL (11 << 4)
|
||||
/* Copper cable, unequalized */
|
||||
#define SFF8636_TRANS_COPPER_PAS_UNEQUAL (10 << 4)
|
||||
/* 1490 nm DFB */
|
||||
#define SFF8636_TRANS_1490_DFB (9 << 4)
|
||||
/* Others */
|
||||
#define SFF8636_TRANS_OTHERS (8 << 4)
|
||||
/* 1550 nm EML */
|
||||
#define SFF8636_TRANS_1550_EML (7 << 4)
|
||||
/* 1310 nm EML */
|
||||
#define SFF8636_TRANS_1310_EML (6 << 4)
|
||||
/* 1550 nm DFB */
|
||||
#define SFF8636_TRANS_1550_DFB (5 << 4)
|
||||
/* 1310 nm DFB */
|
||||
#define SFF8636_TRANS_1310_DFB (4 << 4)
|
||||
/* 1310 nm FP */
|
||||
#define SFF8636_TRANS_1310_FP (3 << 4)
|
||||
/* 1550 nm VCSEL */
|
||||
#define SFF8636_TRANS_1550_VCSEL (2 << 4)
|
||||
/* 1310 nm VCSEL */
|
||||
#define SFF8636_TRANS_1310_VCSEL (1 << 4)
|
||||
/* 850 nm VCSEL */
|
||||
#define SFF8636_TRANS_850_VCSEL (0 << 4)
|
||||
|
||||
/* Active/No wavelength control */
|
||||
#define SFF8636_DEV_TECH_ACTIVE_WAVE_LEN (1 << 3)
|
||||
/* Cooled transmitter */
|
||||
#define SFF8636_DEV_TECH_COOL_TRANS (1 << 2)
|
||||
/* APD/Pin Detector */
|
||||
#define SFF8636_DEV_TECH_APD_DETECTOR (1 << 1)
|
||||
/* Transmitter tunable */
|
||||
#define SFF8636_DEV_TECH_TUNABLE (1 << 0)
|
||||
|
||||
/* Vendor Name - 148-163 */
|
||||
#define SFF8636_VENDOR_NAME_START_OFFSET 0x94
|
||||
#define SFF8636_VENDOR_NAME_END_OFFSET 0xA3
|
||||
|
||||
/* Extended Module Codes - 164 */
|
||||
#define SFF8636_EXT_MOD_CODE_OFFSET 0xA4
|
||||
#define SFF8636_EXT_MOD_INFINIBAND_EDR (1 << 4)
|
||||
#define SFF8636_EXT_MOD_INFINIBAND_FDR (1 << 3)
|
||||
#define SFF8636_EXT_MOD_INFINIBAND_QDR (1 << 2)
|
||||
#define SFF8636_EXT_MOD_INFINIBAND_DDR (1 << 1)
|
||||
#define SFF8636_EXT_MOD_INFINIBAND_SDR (1 << 0)
|
||||
|
||||
/* Vendor OUI - 165-167 */
|
||||
#define SFF8636_VENDOR_OUI_OFFSET 0xA5
|
||||
#define SFF8636_VENDOR_OUI_LEN 3
|
||||
|
||||
/* Vendor OUI - 165-167 */
|
||||
#define SFF8636_VENDOR_PN_START_OFFSET 0xA8
|
||||
#define SFF8636_VENDOR_PN_END_OFFSET 0xB7
|
||||
|
||||
/* Vendor Revision - 184-185 */
|
||||
#define SFF8636_VENDOR_REV_START_OFFSET 0xB8
|
||||
#define SFF8636_VENDOR_REV_END_OFFSET 0xB9
|
||||
|
||||
/* Wavelength - 186-187 */
|
||||
#define SFF8636_WAVELEN_HIGH_BYTE_OFFSET 0xBA
|
||||
#define SFF8636_WAVELEN_LOW_BYTE_OFFSET 0xBB
|
||||
|
||||
/* Wavelength Tolerance- 188-189 */
|
||||
#define SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET 0xBC
|
||||
#define SFF8636_WAVE_TOL_LOW_BYTE_OFFSET 0xBD
|
||||
|
||||
/* Max case temp - Other than 70 C - 190 */
|
||||
#define SFF8636_MAXCASE_TEMP_OFFSET 0xBE
|
||||
|
||||
/* CC_BASE - 191 */
|
||||
#define SFF8636_CC_BASE_OFFSET 0xBF
|
||||
|
||||
/* Option Values - 192-195 */
|
||||
#define SFF8636_OPTION_1_OFFSET 0xC0
|
||||
#define SFF8636_ETHERNET_UNSPECIFIED 0x00
|
||||
#define SFF8636_ETHERNET_100G_AOC 0x01
|
||||
#define SFF8636_ETHERNET_100G_SR4 0x02
|
||||
#define SFF8636_ETHERNET_100G_LR4 0x03
|
||||
#define SFF8636_ETHERNET_100G_ER4 0x04
|
||||
#define SFF8636_ETHERNET_100G_SR10 0x05
|
||||
#define SFF8636_ETHERNET_100G_CWDM4_FEC 0x06
|
||||
#define SFF8636_ETHERNET_100G_PSM4 0x07
|
||||
#define SFF8636_ETHERNET_100G_ACC 0x08
|
||||
#define SFF8636_ETHERNET_100G_CWDM4_NO_FEC 0x09
|
||||
#define SFF8636_ETHERNET_100G_RSVD1 0x0A
|
||||
#define SFF8636_ETHERNET_100G_CR4 0x0B
|
||||
#define SFF8636_ETHERNET_25G_CR_CA_S 0x0C
|
||||
#define SFF8636_ETHERNET_25G_CR_CA_N 0x0D
|
||||
#define SFF8636_ETHERNET_40G_ER4 0x10
|
||||
#define SFF8636_ETHERNET_4X10_SR 0x11
|
||||
#define SFF8636_ETHERNET_40G_PSM4 0x12
|
||||
#define SFF8636_ETHERNET_G959_P1I1_2D1 0x13
|
||||
#define SFF8636_ETHERNET_G959_P1S1_2D2 0x14
|
||||
#define SFF8636_ETHERNET_G959_P1L1_2D2 0x15
|
||||
#define SFF8636_ETHERNET_10GT_SFI 0x16
|
||||
#define SFF8636_ETHERNET_100G_CLR4 0x17
|
||||
#define SFF8636_ETHERNET_100G_AOC2 0x18
|
||||
#define SFF8636_ETHERNET_100G_ACC2 0x19
|
||||
|
||||
#define SFF8636_OPTION_2_OFFSET 0xC1
|
||||
/* Rx output amplitude */
|
||||
#define SFF8636_O2_RX_OUTPUT_AMP (1 << 0)
|
||||
#define SFF8636_OPTION_3_OFFSET 0xC2
|
||||
/* Rx Squelch Disable */
|
||||
#define SFF8636_O3_RX_SQL_DSBL (1 << 3)
|
||||
/* Rx Output Disable capable */
|
||||
#define SFF8636_O3_RX_OUTPUT_DSBL (1 << 2)
|
||||
/* Tx Squelch Disable */
|
||||
#define SFF8636_O3_TX_SQL_DSBL (1 << 1)
|
||||
/* Tx Squelch Impl */
|
||||
#define SFF8636_O3_TX_SQL_IMPL (1 << 0)
|
||||
#define SFF8636_OPTION_4_OFFSET 0xC3
|
||||
/* Memory Page 02 present */
|
||||
#define SFF8636_O4_PAGE_02_PRESENT (1 << 7)
|
||||
/* Memory Page 01 present */
|
||||
#define SFF8636_O4_PAGE_01_PRESENT (1 << 6)
|
||||
/* Rate Select implemented */
|
||||
#define SFF8636_O4_RATE_SELECT (1 << 5)
|
||||
/* Tx_DISABLE implemented */
|
||||
#define SFF8636_O4_TX_DISABLE (1 << 4)
|
||||
/* Tx_FAULT implemented */
|
||||
#define SFF8636_O4_TX_FAULT (1 << 3)
|
||||
/* Tx Squelch implemented */
|
||||
#define SFF8636_O4_TX_SQUELCH (1 << 2)
|
||||
/* Tx Loss of Signal */
|
||||
#define SFF8636_O4_TX_LOS (1 << 1)
|
||||
|
||||
/* Vendor SN - 196-211 */
|
||||
#define SFF8636_VENDOR_SN_START_OFFSET 0xC4
|
||||
#define SFF8636_VENDOR_SN_END_OFFSET 0xD3
|
||||
|
||||
/* Vendor Date - 212-219 */
|
||||
#define SFF8636_DATE_YEAR_OFFSET 0xD4
|
||||
#define SFF8636_DATE_YEAR_LEN 2
|
||||
#define SFF8636_DATE_MONTH_OFFSET 0xD6
|
||||
#define SFF8636_DATE_MONTH_LEN 2
|
||||
#define SFF8636_DATE_DAY_OFFSET 0xD8
|
||||
#define SFF8636_DATE_DAY_LEN 2
|
||||
#define SFF8636_DATE_VENDOR_LOT_OFFSET 0xDA
|
||||
#define SFF8636_DATE_VENDOR_LOT_LEN 2
|
||||
|
||||
/* Diagnostic Monitoring Type - 220 */
|
||||
#define SFF8636_DIAG_TYPE_OFFSET 0xDC
|
||||
#define SFF8636_RX_PWR_TYPE_MASK 0x8
|
||||
#define SFF8636_RX_PWR_TYPE_AVG_PWR (1 << 3)
|
||||
#define SFF8636_RX_PWR_TYPE_OMA (0 << 3)
|
||||
#define SFF8636_TX_PWR_TYPE_MASK 0x4
|
||||
#define SFF8636_TX_PWR_TYPE_AVG_PWR (1 << 2)
|
||||
|
||||
/* Enhanced Options - 221 */
|
||||
#define SFF8636_ENH_OPTIONS_OFFSET 0xDD
|
||||
#define SFF8636_RATE_SELECT_EXT_SUPPORT (1 << 3)
|
||||
#define SFF8636_RATE_SELECT_APP_TABLE_SUPPORT (1 << 2)
|
||||
|
||||
/* Check code - 223 */
|
||||
#define SFF8636_CC_EXT_OFFSET 0xDF
|
||||
#define SFF8636_CC_EXT_LEN 1
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*
|
||||
* Upper Memory Page 03h
|
||||
* Contains module thresholds, channel thresholds and masks,
|
||||
* and optional channel controls
|
||||
*
|
||||
* Offset - Page Num(3) * PageSize(0x80) + Page offset
|
||||
*/
|
||||
|
||||
/* Module Thresholds (48 Bytes) 128-175 */
|
||||
/* MSB at low address, LSB at high address */
|
||||
#define SFF8636_TEMP_HALRM 0x200
|
||||
#define SFF8636_TEMP_LALRM 0x202
|
||||
#define SFF8636_TEMP_HWARN 0x204
|
||||
#define SFF8636_TEMP_LWARN 0x206
|
||||
|
||||
#define SFF8636_VCC_HALRM 0x210
|
||||
#define SFF8636_VCC_LALRM 0x212
|
||||
#define SFF8636_VCC_HWARN 0x214
|
||||
#define SFF8636_VCC_LWARN 0x216
|
||||
|
||||
#define SFF8636_RX_PWR_HALRM 0x230
|
||||
#define SFF8636_RX_PWR_LALRM 0x232
|
||||
#define SFF8636_RX_PWR_HWARN 0x234
|
||||
#define SFF8636_RX_PWR_LWARN 0x236
|
||||
|
||||
#define SFF8636_TX_BIAS_HALRM 0x238
|
||||
#define SFF8636_TX_BIAS_LALRM 0x23A
|
||||
#define SFF8636_TX_BIAS_HWARN 0x23C
|
||||
#define SFF8636_TX_BIAS_LWARN 0x23E
|
||||
|
||||
#define SFF8636_TX_PWR_HALRM 0x240
|
||||
#define SFF8636_TX_PWR_LALRM 0x242
|
||||
#define SFF8636_TX_PWR_HWARN 0x244
|
||||
#define SFF8636_TX_PWR_LWARN 0x246
|
||||
|
||||
#define ETH_MODULE_SFF_8636_MAX_LEN 640
|
||||
#define ETH_MODULE_SFF_8436_MAX_LEN 640
|
||||
|
||||
#endif /* QSFP_H__ */
|
|
@ -0,0 +1,689 @@
|
|||
/* Copyright 2001 Sun Microsystems (thockin@sun.com) */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
enum chip_type {
|
||||
RTL8139 = 1,
|
||||
RTL8139_K,
|
||||
RTL8139A,
|
||||
RTL8139A_G,
|
||||
RTL8139B,
|
||||
RTL8130,
|
||||
RTL8139C,
|
||||
RTL8100,
|
||||
RTL8100B_8139D,
|
||||
RTL8139Cp,
|
||||
RTL8101,
|
||||
|
||||
/* chips not handled by 8139too/8139cp module */
|
||||
RTL_GIGA_MAC_VER_01,
|
||||
RTL_GIGA_MAC_VER_02,
|
||||
RTL_GIGA_MAC_VER_03,
|
||||
RTL_GIGA_MAC_VER_04,
|
||||
RTL_GIGA_MAC_VER_05,
|
||||
RTL_GIGA_MAC_VER_06,
|
||||
RTL_GIGA_MAC_VER_07,
|
||||
RTL_GIGA_MAC_VER_08,
|
||||
RTL_GIGA_MAC_VER_09,
|
||||
RTL_GIGA_MAC_VER_10,
|
||||
RTL_GIGA_MAC_VER_11,
|
||||
RTL_GIGA_MAC_VER_12,
|
||||
RTL_GIGA_MAC_VER_13,
|
||||
RTL_GIGA_MAC_VER_14,
|
||||
RTL_GIGA_MAC_VER_15,
|
||||
RTL_GIGA_MAC_VER_16,
|
||||
RTL_GIGA_MAC_VER_17,
|
||||
RTL_GIGA_MAC_VER_18,
|
||||
RTL_GIGA_MAC_VER_19,
|
||||
RTL_GIGA_MAC_VER_20,
|
||||
RTL_GIGA_MAC_VER_21,
|
||||
RTL_GIGA_MAC_VER_22,
|
||||
RTL_GIGA_MAC_VER_23,
|
||||
RTL_GIGA_MAC_VER_24,
|
||||
RTL_GIGA_MAC_VER_25,
|
||||
RTL_GIGA_MAC_VER_26,
|
||||
RTL_GIGA_MAC_VER_27,
|
||||
RTL_GIGA_MAC_VER_28,
|
||||
RTL_GIGA_MAC_VER_29,
|
||||
RTL_GIGA_MAC_VER_30,
|
||||
RTL_GIGA_MAC_VER_31,
|
||||
RTL_GIGA_MAC_VER_32,
|
||||
RTL_GIGA_MAC_VER_33,
|
||||
RTL_GIGA_MAC_VER_34,
|
||||
RTL_GIGA_MAC_VER_35,
|
||||
RTL_GIGA_MAC_VER_36,
|
||||
RTL_GIGA_MAC_VER_37,
|
||||
RTL_GIGA_MAC_VER_38,
|
||||
RTL_GIGA_MAC_VER_39,
|
||||
RTL_GIGA_MAC_VER_40,
|
||||
RTL_GIGA_MAC_VER_41,
|
||||
RTL_GIGA_MAC_VER_42,
|
||||
RTL_GIGA_MAC_VER_43,
|
||||
RTL_GIGA_MAC_VER_44,
|
||||
};
|
||||
|
||||
static const char * const chip_names[] = {
|
||||
[RTL8139] = "8139",
|
||||
[RTL8139_K] = "8139-K",
|
||||
[RTL8139A] = "8139A",
|
||||
[RTL8139A_G] = "8139A-G",
|
||||
[RTL8139B] = "8139B",
|
||||
[RTL8130] = "8130",
|
||||
[RTL8139C] = "8139C",
|
||||
[RTL8100] = "8100",
|
||||
[RTL8100B_8139D] = "8100B/8139D",
|
||||
[RTL8139Cp] = "8139C+",
|
||||
[RTL8101] = "8101",
|
||||
|
||||
/* chips not handled by 8139too/8139cp module */
|
||||
[RTL_GIGA_MAC_VER_01] = "8169",
|
||||
[RTL_GIGA_MAC_VER_02] = "8169s",
|
||||
[RTL_GIGA_MAC_VER_03] = "8110s",
|
||||
[RTL_GIGA_MAC_VER_04] = "8169sb/8110sb",
|
||||
[RTL_GIGA_MAC_VER_05] = "8169sc/8110sc",
|
||||
[RTL_GIGA_MAC_VER_06] = "8169sc/8110sc",
|
||||
[RTL_GIGA_MAC_VER_07] = "8102e",
|
||||
[RTL_GIGA_MAC_VER_08] = "8102e",
|
||||
[RTL_GIGA_MAC_VER_09] = "8102e",
|
||||
[RTL_GIGA_MAC_VER_10] = "8101e",
|
||||
[RTL_GIGA_MAC_VER_11] = "8168b/8111b",
|
||||
[RTL_GIGA_MAC_VER_12] = "8168b/8111b",
|
||||
[RTL_GIGA_MAC_VER_13] = "8101e",
|
||||
[RTL_GIGA_MAC_VER_14] = "8100e",
|
||||
[RTL_GIGA_MAC_VER_15] = "8100e",
|
||||
[RTL_GIGA_MAC_VER_16] = "8101e",
|
||||
[RTL_GIGA_MAC_VER_17] = "8168b/8111b",
|
||||
[RTL_GIGA_MAC_VER_18] = "8168cp/8111cp",
|
||||
[RTL_GIGA_MAC_VER_19] = "8168c/8111c",
|
||||
[RTL_GIGA_MAC_VER_20] = "8168c/8111c",
|
||||
[RTL_GIGA_MAC_VER_21] = "8168c/8111c",
|
||||
[RTL_GIGA_MAC_VER_22] = "8168c/8111c",
|
||||
[RTL_GIGA_MAC_VER_23] = "8168cp/8111cp",
|
||||
[RTL_GIGA_MAC_VER_24] = "8168cp/8111cp",
|
||||
[RTL_GIGA_MAC_VER_25] = "8168d/8111d",
|
||||
[RTL_GIGA_MAC_VER_26] = "8168d/8111d",
|
||||
[RTL_GIGA_MAC_VER_27] = "8168dp/8111dp",
|
||||
[RTL_GIGA_MAC_VER_28] = "8168dp/8111dp",
|
||||
[RTL_GIGA_MAC_VER_29] = "8105e",
|
||||
[RTL_GIGA_MAC_VER_30] = "8105e",
|
||||
[RTL_GIGA_MAC_VER_31] = "8168dp/8111dp",
|
||||
[RTL_GIGA_MAC_VER_32] = "8168e/8111e",
|
||||
[RTL_GIGA_MAC_VER_33] = "8168e/8111e",
|
||||
[RTL_GIGA_MAC_VER_34] = "8168evl/8111evl",
|
||||
[RTL_GIGA_MAC_VER_35] = "8168f/8111f",
|
||||
[RTL_GIGA_MAC_VER_36] = "8168f/8111f",
|
||||
[RTL_GIGA_MAC_VER_37] = "8402",
|
||||
[RTL_GIGA_MAC_VER_38] = "8411",
|
||||
[RTL_GIGA_MAC_VER_39] = "8106e",
|
||||
[RTL_GIGA_MAC_VER_40] = "8168g/8111g",
|
||||
[RTL_GIGA_MAC_VER_41] = "8168g/8111g",
|
||||
[RTL_GIGA_MAC_VER_42] = "8168g/8111g",
|
||||
[RTL_GIGA_MAC_VER_43] = "8106e",
|
||||
[RTL_GIGA_MAC_VER_44] = "8411",
|
||||
};
|
||||
|
||||
static struct chip_info {
|
||||
u32 id_mask;
|
||||
u32 id_val;
|
||||
int mac_version;
|
||||
} rtl_info_tbl[] = {
|
||||
{ 0xfcc00000, 0x40000000, RTL8139 },
|
||||
{ 0xfcc00000, 0x60000000, RTL8139_K },
|
||||
{ 0xfcc00000, 0x70000000, RTL8139A },
|
||||
{ 0xfcc00000, 0x70800000, RTL8139A_G },
|
||||
{ 0xfcc00000, 0x78000000, RTL8139B },
|
||||
{ 0xfcc00000, 0x7c000000, RTL8130 },
|
||||
{ 0xfcc00000, 0x74000000, RTL8139C },
|
||||
{ 0xfcc00000, 0x78800000, RTL8100 },
|
||||
{ 0xfcc00000, 0x74400000, RTL8100B_8139D },
|
||||
{ 0xfcc00000, 0x74800000, RTL8139Cp },
|
||||
{ 0xfcc00000, 0x74c00000, RTL8101 },
|
||||
|
||||
/* chips not handled by 8139too/8139cp module */
|
||||
/* 8168G family. */
|
||||
{ 0x7cf00000, 0x5c800000, RTL_GIGA_MAC_VER_44 },
|
||||
{ 0x7cf00000, 0x50900000, RTL_GIGA_MAC_VER_42 },
|
||||
{ 0x7cf00000, 0x4c100000, RTL_GIGA_MAC_VER_41 },
|
||||
{ 0x7cf00000, 0x4c000000, RTL_GIGA_MAC_VER_40 },
|
||||
|
||||
/* 8168F family. */
|
||||
{ 0x7c800000, 0x48800000, RTL_GIGA_MAC_VER_38 },
|
||||
{ 0x7cf00000, 0x48100000, RTL_GIGA_MAC_VER_36 },
|
||||
{ 0x7cf00000, 0x48000000, RTL_GIGA_MAC_VER_35 },
|
||||
|
||||
/* 8168E family. */
|
||||
{ 0x7c800000, 0x2c800000, RTL_GIGA_MAC_VER_34 },
|
||||
{ 0x7cf00000, 0x2c200000, RTL_GIGA_MAC_VER_33 },
|
||||
{ 0x7cf00000, 0x2c100000, RTL_GIGA_MAC_VER_32 },
|
||||
{ 0x7c800000, 0x2c000000, RTL_GIGA_MAC_VER_33 },
|
||||
|
||||
/* 8168D family. */
|
||||
{ 0x7cf00000, 0x28300000, RTL_GIGA_MAC_VER_26 },
|
||||
{ 0x7cf00000, 0x28100000, RTL_GIGA_MAC_VER_25 },
|
||||
{ 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 },
|
||||
|
||||
/* 8168DP family. */
|
||||
{ 0x7cf00000, 0x28800000, RTL_GIGA_MAC_VER_27 },
|
||||
{ 0x7cf00000, 0x28a00000, RTL_GIGA_MAC_VER_28 },
|
||||
{ 0x7cf00000, 0x28b00000, RTL_GIGA_MAC_VER_31 },
|
||||
|
||||
/* 8168C family. */
|
||||
{ 0x7cf00000, 0x3cb00000, RTL_GIGA_MAC_VER_24 },
|
||||
{ 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 },
|
||||
{ 0x7cf00000, 0x3c800000, RTL_GIGA_MAC_VER_18 },
|
||||
{ 0x7c800000, 0x3c800000, RTL_GIGA_MAC_VER_24 },
|
||||
{ 0x7cf00000, 0x3c000000, RTL_GIGA_MAC_VER_19 },
|
||||
{ 0x7cf00000, 0x3c200000, RTL_GIGA_MAC_VER_20 },
|
||||
{ 0x7cf00000, 0x3c300000, RTL_GIGA_MAC_VER_21 },
|
||||
{ 0x7cf00000, 0x3c400000, RTL_GIGA_MAC_VER_22 },
|
||||
{ 0x7c800000, 0x3c000000, RTL_GIGA_MAC_VER_22 },
|
||||
|
||||
/* 8168B family. */
|
||||
{ 0x7cf00000, 0x38000000, RTL_GIGA_MAC_VER_12 },
|
||||
{ 0x7cf00000, 0x38500000, RTL_GIGA_MAC_VER_17 },
|
||||
{ 0x7c800000, 0x38000000, RTL_GIGA_MAC_VER_17 },
|
||||
{ 0x7c800000, 0x30000000, RTL_GIGA_MAC_VER_11 },
|
||||
|
||||
/* 8101 family. */
|
||||
{ 0x7cf00000, 0x44900000, RTL_GIGA_MAC_VER_39 },
|
||||
{ 0x7c800000, 0x44800000, RTL_GIGA_MAC_VER_39 },
|
||||
{ 0x7c800000, 0x44000000, RTL_GIGA_MAC_VER_37 },
|
||||
{ 0x7cf00000, 0x40b00000, RTL_GIGA_MAC_VER_30 },
|
||||
{ 0x7cf00000, 0x40a00000, RTL_GIGA_MAC_VER_30 },
|
||||
{ 0x7cf00000, 0x40900000, RTL_GIGA_MAC_VER_29 },
|
||||
{ 0x7c800000, 0x40800000, RTL_GIGA_MAC_VER_30 },
|
||||
{ 0x7cf00000, 0x34a00000, RTL_GIGA_MAC_VER_09 },
|
||||
{ 0x7cf00000, 0x24a00000, RTL_GIGA_MAC_VER_09 },
|
||||
{ 0x7cf00000, 0x34900000, RTL_GIGA_MAC_VER_08 },
|
||||
{ 0x7cf00000, 0x24900000, RTL_GIGA_MAC_VER_08 },
|
||||
{ 0x7cf00000, 0x34800000, RTL_GIGA_MAC_VER_07 },
|
||||
{ 0x7cf00000, 0x24800000, RTL_GIGA_MAC_VER_07 },
|
||||
{ 0x7cf00000, 0x34000000, RTL_GIGA_MAC_VER_13 },
|
||||
{ 0x7cf00000, 0x34300000, RTL_GIGA_MAC_VER_10 },
|
||||
{ 0x7cf00000, 0x34200000, RTL_GIGA_MAC_VER_16 },
|
||||
{ 0x7c800000, 0x34800000, RTL_GIGA_MAC_VER_09 },
|
||||
{ 0x7c800000, 0x24800000, RTL_GIGA_MAC_VER_09 },
|
||||
{ 0x7c800000, 0x34000000, RTL_GIGA_MAC_VER_16 },
|
||||
/* FIXME: where did these entries come from ? -- FR */
|
||||
{ 0xfc800000, 0x38800000, RTL_GIGA_MAC_VER_15 },
|
||||
{ 0xfc800000, 0x30800000, RTL_GIGA_MAC_VER_14 },
|
||||
|
||||
/* 8110 family. */
|
||||
{ 0xfc800000, 0x98000000, RTL_GIGA_MAC_VER_06 },
|
||||
{ 0xfc800000, 0x18000000, RTL_GIGA_MAC_VER_05 },
|
||||
{ 0xfc800000, 0x10000000, RTL_GIGA_MAC_VER_04 },
|
||||
{ 0xfc800000, 0x04000000, RTL_GIGA_MAC_VER_03 },
|
||||
{ 0xfc800000, 0x00800000, RTL_GIGA_MAC_VER_02 },
|
||||
{ 0xfc800000, 0x00000000, RTL_GIGA_MAC_VER_01 },
|
||||
|
||||
{ }
|
||||
};
|
||||
|
||||
static void
|
||||
print_intr_bits(u16 mask)
|
||||
{
|
||||
fprintf(stdout,
|
||||
" %s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
mask & (1 << 15) ? "SERR " : "",
|
||||
mask & (1 << 14) ? "TimeOut " : "",
|
||||
mask & (1 << 8) ? "SWInt " : "",
|
||||
mask & (1 << 7) ? "TxNoBuf " : "",
|
||||
mask & (1 << 6) ? "RxFIFO " : "",
|
||||
mask & (1 << 5) ? "LinkChg " : "",
|
||||
mask & (1 << 4) ? "RxNoBuf " : "",
|
||||
mask & (1 << 3) ? "TxErr " : "",
|
||||
mask & (1 << 2) ? "TxOK " : "",
|
||||
mask & (1 << 1) ? "RxErr " : "",
|
||||
mask & (1 << 0) ? "RxOK " : "");
|
||||
}
|
||||
|
||||
int
|
||||
realtek_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *data = (u32 *) regs->data;
|
||||
u8 *data8 = (u8 *) regs->data;
|
||||
u32 v;
|
||||
struct chip_info *ci;
|
||||
unsigned int board_type;
|
||||
|
||||
v = data[0x40 >> 2]; /* TxConfig */
|
||||
|
||||
ci = &rtl_info_tbl[0];
|
||||
while (ci->mac_version) {
|
||||
if ((v & ci->id_mask) == ci->id_val)
|
||||
break;
|
||||
ci++;
|
||||
}
|
||||
board_type = ci->mac_version;
|
||||
if (!board_type) {
|
||||
fprintf(stderr, "Unknown RealTek chip (TxConfig: 0x%08x)\n", v);
|
||||
return 91;
|
||||
}
|
||||
|
||||
fprintf(stdout,
|
||||
"RealTek RTL%s registers:\n"
|
||||
"--------------------------------------------------------\n",
|
||||
chip_names[board_type]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x00: MAC Address %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
data8[0x00],
|
||||
data8[0x01],
|
||||
data8[0x02],
|
||||
data8[0x03],
|
||||
data8[0x04],
|
||||
data8[0x05]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x08: Multicast Address Filter 0x%08x 0x%08x\n",
|
||||
data[0x08 >> 2],
|
||||
data[0x0c >> 2]);
|
||||
|
||||
if (board_type == RTL8139Cp || board_type >= RTL_GIGA_MAC_VER_01) {
|
||||
fprintf(stdout,
|
||||
"0x10: Dump Tally Counter Command 0x%08x 0x%08x\n",
|
||||
data[0x10 >> 2],
|
||||
data[0x14 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x20: Tx Normal Priority Ring Addr 0x%08x 0x%08x\n",
|
||||
data[0x20 >> 2],
|
||||
data[0x24 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x28: Tx High Priority Ring Addr 0x%08x 0x%08x\n",
|
||||
data[0x28 >> 2],
|
||||
data[0x2C >> 2]);
|
||||
} else {
|
||||
fprintf(stdout,
|
||||
"0x10: Transmit Status Desc 0 0x%08x\n"
|
||||
"0x14: Transmit Status Desc 1 0x%08x\n"
|
||||
"0x18: Transmit Status Desc 2 0x%08x\n"
|
||||
"0x1C: Transmit Status Desc 3 0x%08x\n",
|
||||
data[0x10 >> 2],
|
||||
data[0x14 >> 2],
|
||||
data[0x18 >> 2],
|
||||
data[0x1C >> 2]);
|
||||
fprintf(stdout,
|
||||
"0x20: Transmit Start Addr 0 0x%08x\n"
|
||||
"0x24: Transmit Start Addr 1 0x%08x\n"
|
||||
"0x28: Transmit Start Addr 2 0x%08x\n"
|
||||
"0x2C: Transmit Start Addr 3 0x%08x\n",
|
||||
data[0x20 >> 2],
|
||||
data[0x24 >> 2],
|
||||
data[0x28 >> 2],
|
||||
data[0x2C >> 2]);
|
||||
}
|
||||
|
||||
if (board_type < RTL_GIGA_MAC_VER_11 ||
|
||||
board_type > RTL_GIGA_MAC_VER_17) {
|
||||
if (board_type >= RTL_GIGA_MAC_VER_01) {
|
||||
fprintf(stdout,
|
||||
"0x30: Flash memory read/write 0x%08x\n",
|
||||
data[0x30 >> 2]);
|
||||
} else {
|
||||
fprintf(stdout,
|
||||
"0x30: Rx buffer addr (C mode) 0x%08x\n",
|
||||
data[0x30 >> 2]);
|
||||
}
|
||||
}
|
||||
|
||||
v = data8[0x36];
|
||||
fprintf(stdout,
|
||||
"0x34: Early Rx Byte Count %8u\n"
|
||||
"0x36: Early Rx Status 0x%02x\n",
|
||||
data[0x34 >> 2] & 0xffff,
|
||||
v);
|
||||
|
||||
if (v & 0xf) {
|
||||
fprintf(stdout,
|
||||
" %s%s%s%s\n",
|
||||
v & (1 << 3) ? "ERxGood " : "",
|
||||
v & (1 << 2) ? "ERxBad " : "",
|
||||
v & (1 << 1) ? "ERxOverWrite " : "",
|
||||
v & (1 << 0) ? "ERxOK " : "");
|
||||
}
|
||||
|
||||
v = data8[0x37];
|
||||
fprintf(stdout,
|
||||
"0x37: Command 0x%02x\n"
|
||||
" Rx %s, Tx %s%s\n",
|
||||
data8[0x37],
|
||||
v & (1 << 3) ? "on" : "off",
|
||||
v & (1 << 2) ? "on" : "off",
|
||||
v & (1 << 4) ? ", RESET" : "");
|
||||
|
||||
if (board_type < RTL_GIGA_MAC_VER_01) {
|
||||
fprintf(stdout,
|
||||
"0x38: Current Address of Packet Read (C mode) 0x%04x\n"
|
||||
"0x3A: Current Rx buffer address (C mode) 0x%04x\n",
|
||||
data[0x38 >> 2] & 0xffff,
|
||||
data[0x38 >> 2] >> 16);
|
||||
}
|
||||
|
||||
fprintf(stdout,
|
||||
"0x3C: Interrupt Mask 0x%04x\n",
|
||||
data[0x3c >> 2] & 0xffff);
|
||||
print_intr_bits(data[0x3c >> 2] & 0xffff);
|
||||
fprintf(stdout,
|
||||
"0x3E: Interrupt Status 0x%04x\n",
|
||||
data[0x3c >> 2] >> 16);
|
||||
print_intr_bits(data[0x3c >> 2] >> 16);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x40: Tx Configuration 0x%08x\n"
|
||||
"0x44: Rx Configuration 0x%08x\n"
|
||||
"0x48: Timer count 0x%08x\n"
|
||||
"0x4C: Missed packet counter 0x%06x\n",
|
||||
data[0x40 >> 2],
|
||||
data[0x44 >> 2],
|
||||
data[0x48 >> 2],
|
||||
data[0x4C >> 2] & 0xffffff);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x50: EEPROM Command 0x%02x\n"
|
||||
"0x51: Config 0 0x%02x\n"
|
||||
"0x52: Config 1 0x%02x\n",
|
||||
data8[0x50],
|
||||
data8[0x51],
|
||||
data8[0x52]);
|
||||
|
||||
if (board_type >= RTL_GIGA_MAC_VER_01) {
|
||||
fprintf(stdout,
|
||||
"0x53: Config 2 0x%02x\n"
|
||||
"0x54: Config 3 0x%02x\n"
|
||||
"0x55: Config 4 0x%02x\n"
|
||||
"0x56: Config 5 0x%02x\n",
|
||||
data8[0x53],
|
||||
data8[0x54],
|
||||
data8[0x55],
|
||||
data8[0x56]);
|
||||
fprintf(stdout,
|
||||
"0x58: Timer interrupt 0x%08x\n",
|
||||
data[0x58 >> 2]);
|
||||
}
|
||||
else {
|
||||
if (board_type >= RTL8139A) {
|
||||
fprintf(stdout,
|
||||
"0x54: Timer interrupt 0x%08x\n",
|
||||
data[0x54 >> 2]);
|
||||
}
|
||||
fprintf(stdout,
|
||||
"0x58: Media status 0x%02x\n",
|
||||
data8[0x58]);
|
||||
if (board_type >= RTL8139A) {
|
||||
fprintf(stdout,
|
||||
"0x59: Config 3 0x%02x\n",
|
||||
data8[0x59]);
|
||||
}
|
||||
if (board_type >= RTL8139B) {
|
||||
fprintf(stdout,
|
||||
"0x5A: Config 4 0x%02x\n",
|
||||
data8[0x5A]);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stdout,
|
||||
"0x5C: Multiple Interrupt Select 0x%04x\n",
|
||||
data[0x5c >> 2] & 0xffff);
|
||||
|
||||
if (board_type >= RTL_GIGA_MAC_VER_01) {
|
||||
fprintf(stdout,
|
||||
"0x60: PHY access 0x%08x\n",
|
||||
data[0x60 >> 2]);
|
||||
|
||||
if (board_type < RTL_GIGA_MAC_VER_11 ||
|
||||
board_type > RTL_GIGA_MAC_VER_17) {
|
||||
fprintf(stdout,
|
||||
"0x64: TBI control and status 0x%08x\n",
|
||||
data[0x64 >> 2]);
|
||||
fprintf(stdout,
|
||||
"0x68: TBI Autonegotiation advertisement (ANAR) 0x%04x\n"
|
||||
"0x6A: TBI Link partner ability (LPAR) 0x%04x\n",
|
||||
data[0x68 >> 2] & 0xffff,
|
||||
data[0x68 >> 2] >> 16);
|
||||
}
|
||||
|
||||
fprintf(stdout,
|
||||
"0x6C: PHY status 0x%02x\n",
|
||||
data8[0x6C]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x84: PM wakeup frame 0 0x%08x 0x%08x\n"
|
||||
"0x8C: PM wakeup frame 1 0x%08x 0x%08x\n",
|
||||
data[0x84 >> 2],
|
||||
data[0x88 >> 2],
|
||||
data[0x8C >> 2],
|
||||
data[0x90 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0x94: PM wakeup frame 2 (low) 0x%08x 0x%08x\n"
|
||||
"0x9C: PM wakeup frame 2 (high) 0x%08x 0x%08x\n",
|
||||
data[0x94 >> 2],
|
||||
data[0x98 >> 2],
|
||||
data[0x9C >> 2],
|
||||
data[0xA0 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0xA4: PM wakeup frame 3 (low) 0x%08x 0x%08x\n"
|
||||
"0xAC: PM wakeup frame 3 (high) 0x%08x 0x%08x\n",
|
||||
data[0xA4 >> 2],
|
||||
data[0xA8 >> 2],
|
||||
data[0xAC >> 2],
|
||||
data[0xB0 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0xB4: PM wakeup frame 4 (low) 0x%08x 0x%08x\n"
|
||||
"0xBC: PM wakeup frame 4 (high) 0x%08x 0x%08x\n",
|
||||
data[0xB4 >> 2],
|
||||
data[0xB8 >> 2],
|
||||
data[0xBC >> 2],
|
||||
data[0xC0 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0xC4: Wakeup frame 0 CRC 0x%04x\n"
|
||||
"0xC6: Wakeup frame 1 CRC 0x%04x\n"
|
||||
"0xC8: Wakeup frame 2 CRC 0x%04x\n"
|
||||
"0xCA: Wakeup frame 3 CRC 0x%04x\n"
|
||||
"0xCC: Wakeup frame 4 CRC 0x%04x\n",
|
||||
data[0xC4 >> 2] & 0xffff,
|
||||
data[0xC4 >> 2] >> 16,
|
||||
data[0xC8 >> 2] & 0xffff,
|
||||
data[0xC8 >> 2] >> 16,
|
||||
data[0xCC >> 2] & 0xffff);
|
||||
fprintf(stdout,
|
||||
"0xDA: RX packet maximum size 0x%04x\n",
|
||||
data[0xD8 >> 2] >> 16);
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,
|
||||
"0x5E: PCI revision id 0x%02x\n",
|
||||
data8[0x5e]);
|
||||
fprintf(stdout,
|
||||
"0x60: Transmit Status of All Desc (C mode) 0x%04x\n"
|
||||
"0x62: MII Basic Mode Control Register 0x%04x\n",
|
||||
data[0x60 >> 2] & 0xffff,
|
||||
data[0x60 >> 2] >> 16);
|
||||
fprintf(stdout,
|
||||
"0x64: MII Basic Mode Status Register 0x%04x\n"
|
||||
"0x66: MII Autonegotiation Advertising 0x%04x\n",
|
||||
data[0x64 >> 2] & 0xffff,
|
||||
data[0x64 >> 2] >> 16);
|
||||
fprintf(stdout,
|
||||
"0x68: MII Link Partner Ability 0x%04x\n"
|
||||
"0x6A: MII Expansion 0x%04x\n",
|
||||
data[0x68 >> 2] & 0xffff,
|
||||
data[0x68 >> 2] >> 16);
|
||||
fprintf(stdout,
|
||||
"0x6C: MII Disconnect counter 0x%04x\n"
|
||||
"0x6E: MII False carrier sense counter 0x%04x\n",
|
||||
data[0x6C >> 2] & 0xffff,
|
||||
data[0x6C >> 2] >> 16);
|
||||
fprintf(stdout,
|
||||
"0x70: MII Nway test 0x%04x\n"
|
||||
"0x72: MII RX_ER counter 0x%04x\n",
|
||||
data[0x70 >> 2] & 0xffff,
|
||||
data[0x70 >> 2] >> 16);
|
||||
fprintf(stdout,
|
||||
"0x74: MII CS configuration 0x%04x\n",
|
||||
data[0x74 >> 2] & 0xffff);
|
||||
if (board_type >= RTL8139_K) {
|
||||
fprintf(stdout,
|
||||
"0x78: PHY parameter 1 0x%08x\n"
|
||||
"0x7C: Twister parameter 0x%08x\n",
|
||||
data[0x78 >> 2],
|
||||
data[0x7C >> 2]);
|
||||
if (board_type >= RTL8139A) {
|
||||
fprintf(stdout,
|
||||
"0x80: PHY parameter 2 0x%02x\n",
|
||||
data8[0x80]);
|
||||
}
|
||||
}
|
||||
if (board_type == RTL8139Cp) {
|
||||
fprintf(stdout,
|
||||
"0x82: Low addr of a Tx Desc w/ Tx DMA OK 0x%04x\n",
|
||||
data[0x80 >> 2] >> 16);
|
||||
} else if (board_type == RTL8130) {
|
||||
fprintf(stdout,
|
||||
"0x82: MII register 0x%02x\n",
|
||||
data8[0x82]);
|
||||
}
|
||||
if (board_type >= RTL8139A) {
|
||||
fprintf(stdout,
|
||||
"0x84: PM CRC for wakeup frame 0 0x%02x\n"
|
||||
"0x85: PM CRC for wakeup frame 1 0x%02x\n"
|
||||
"0x86: PM CRC for wakeup frame 2 0x%02x\n"
|
||||
"0x87: PM CRC for wakeup frame 3 0x%02x\n"
|
||||
"0x88: PM CRC for wakeup frame 4 0x%02x\n"
|
||||
"0x89: PM CRC for wakeup frame 5 0x%02x\n"
|
||||
"0x8A: PM CRC for wakeup frame 6 0x%02x\n"
|
||||
"0x8B: PM CRC for wakeup frame 7 0x%02x\n",
|
||||
data8[0x84],
|
||||
data8[0x85],
|
||||
data8[0x86],
|
||||
data8[0x87],
|
||||
data8[0x88],
|
||||
data8[0x89],
|
||||
data8[0x8A],
|
||||
data8[0x8B]);
|
||||
fprintf(stdout,
|
||||
"0x8C: PM wakeup frame 0 0x%08x 0x%08x\n"
|
||||
"0x94: PM wakeup frame 1 0x%08x 0x%08x\n"
|
||||
"0x9C: PM wakeup frame 2 0x%08x 0x%08x\n"
|
||||
"0xA4: PM wakeup frame 3 0x%08x 0x%08x\n"
|
||||
"0xAC: PM wakeup frame 4 0x%08x 0x%08x\n"
|
||||
"0xB4: PM wakeup frame 5 0x%08x 0x%08x\n"
|
||||
"0xBC: PM wakeup frame 6 0x%08x 0x%08x\n"
|
||||
"0xC4: PM wakeup frame 7 0x%08x 0x%08x\n",
|
||||
data[0x8C >> 2],
|
||||
data[0x90 >> 2],
|
||||
data[0x94 >> 2],
|
||||
data[0x98 >> 2],
|
||||
data[0x9C >> 2],
|
||||
data[0xA0 >> 2],
|
||||
data[0xA4 >> 2],
|
||||
data[0xA8 >> 2],
|
||||
data[0xAC >> 2],
|
||||
data[0xB0 >> 2],
|
||||
data[0xB4 >> 2],
|
||||
data[0xB8 >> 2],
|
||||
data[0xBC >> 2],
|
||||
data[0xC0 >> 2],
|
||||
data[0xC4 >> 2],
|
||||
data[0xC8 >> 2]);
|
||||
fprintf(stdout,
|
||||
"0xCC: PM LSB CRC for wakeup frame 0 0x%02x\n"
|
||||
"0xCD: PM LSB CRC for wakeup frame 1 0x%02x\n"
|
||||
"0xCE: PM LSB CRC for wakeup frame 2 0x%02x\n"
|
||||
"0xCF: PM LSB CRC for wakeup frame 3 0x%02x\n"
|
||||
"0xD0: PM LSB CRC for wakeup frame 4 0x%02x\n"
|
||||
"0xD1: PM LSB CRC for wakeup frame 5 0x%02x\n"
|
||||
"0xD2: PM LSB CRC for wakeup frame 6 0x%02x\n"
|
||||
"0xD3: PM LSB CRC for wakeup frame 7 0x%02x\n",
|
||||
data8[0xCC],
|
||||
data8[0xCD],
|
||||
data8[0xCE],
|
||||
data8[0xCF],
|
||||
data8[0xD0],
|
||||
data8[0xD1],
|
||||
data8[0xD2],
|
||||
data8[0xD3]);
|
||||
}
|
||||
if (board_type >= RTL8139B) {
|
||||
if (board_type != RTL8100 && board_type != RTL8100B_8139D &&
|
||||
board_type != RTL8101)
|
||||
fprintf(stdout,
|
||||
"0xD4: Flash memory read/write 0x%08x\n",
|
||||
data[0xD4 >> 2]);
|
||||
if (board_type != RTL8130)
|
||||
fprintf(stdout,
|
||||
"0xD8: Config 5 0x%02x\n",
|
||||
data8[0xD8]);
|
||||
}
|
||||
}
|
||||
|
||||
if (board_type == RTL8139Cp || board_type >= RTL_GIGA_MAC_VER_01) {
|
||||
v = data[0xE0 >> 2] & 0xffff;
|
||||
fprintf(stdout,
|
||||
"0xE0: C+ Command 0x%04x\n",
|
||||
v);
|
||||
if (v & (1 << 9))
|
||||
fprintf(stdout, " Big-endian mode\n");
|
||||
if (v & (1 << 8))
|
||||
fprintf(stdout, " Home LAN enable\n");
|
||||
if (v & (1 << 6))
|
||||
fprintf(stdout, " VLAN de-tagging\n");
|
||||
if (v & (1 << 5))
|
||||
fprintf(stdout, " RX checksumming\n");
|
||||
if (v & (1 << 4))
|
||||
fprintf(stdout, " PCI 64-bit DAC\n");
|
||||
if (v & (1 << 3))
|
||||
fprintf(stdout, " PCI Multiple RW\n");
|
||||
|
||||
v = data[0xe0 >> 2] >> 16;
|
||||
fprintf(stdout,
|
||||
"0xE2: Interrupt Mitigation 0x%04x\n"
|
||||
" TxTimer: %u\n"
|
||||
" TxPackets: %u\n"
|
||||
" RxTimer: %u\n"
|
||||
" RxPackets: %u\n",
|
||||
v,
|
||||
v >> 12,
|
||||
(v >> 8) & 0xf,
|
||||
(v >> 4) & 0xf,
|
||||
v & 0xf);
|
||||
|
||||
fprintf(stdout,
|
||||
"0xE4: Rx Ring Addr 0x%08x 0x%08x\n",
|
||||
data[0xE4 >> 2],
|
||||
data[0xE8 >> 2]);
|
||||
|
||||
fprintf(stdout,
|
||||
"0xEC: Early Tx threshold 0x%02x\n",
|
||||
data8[0xEC]);
|
||||
|
||||
if (board_type == RTL8139Cp) {
|
||||
fprintf(stdout,
|
||||
"0xFC: External MII register 0x%08x\n",
|
||||
data[0xFC >> 2]);
|
||||
} else if (board_type >= RTL_GIGA_MAC_VER_01 &&
|
||||
(board_type < RTL_GIGA_MAC_VER_11 ||
|
||||
board_type > RTL_GIGA_MAC_VER_17)) {
|
||||
fprintf(stdout,
|
||||
"0xF0: Func Event 0x%08x\n"
|
||||
"0xF4: Func Event Mask 0x%08x\n"
|
||||
"0xF8: Func Preset State 0x%08x\n"
|
||||
"0xFC: Func Force Event 0x%08x\n",
|
||||
data[0xF0 >> 2],
|
||||
data[0xF4 >> 2],
|
||||
data[0xF8 >> 2],
|
||||
data[0xFC >> 2]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,304 @@
|
|||
/*
|
||||
* sff-common.c: Implements SFF-8024 Rev 4.0 i.e. Specifcation
|
||||
* of pluggable I/O configuration
|
||||
*
|
||||
* Common utilities across SFF-8436/8636 and SFF-8472/8079
|
||||
* are defined in this file
|
||||
*
|
||||
* Copyright 2010 Solarflare Communications Inc.
|
||||
* Aurelien Guillaume <aurelien@iwi.me> (C) 2012
|
||||
* Copyright (C) 2014 Cumulus networks Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Freeoftware Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Vidya Sagar Ravipati <vidya@cumulusnetworks.com>
|
||||
* This implementation is loosely based on current SFP parser
|
||||
* and SFF-8024 Rev 4.0 spec (ftp://ftp.seagate.com/pub/sff/SFF-8024.PDF)
|
||||
* by SFF Committee.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "sff-common.h"
|
||||
|
||||
double convert_mw_to_dbm(double mw)
|
||||
{
|
||||
return (10. * log10(mw / 1000.)) + 30.;
|
||||
}
|
||||
|
||||
void sff_show_value_with_unit(const __u8 *id, unsigned int reg,
|
||||
const char *name, unsigned int mult,
|
||||
const char *unit)
|
||||
{
|
||||
unsigned int val = id[reg];
|
||||
|
||||
printf("\t%-41s : %u%s\n", name, val * mult, unit);
|
||||
}
|
||||
|
||||
void sff_show_ascii(const __u8 *id, unsigned int first_reg,
|
||||
unsigned int last_reg, const char *name)
|
||||
{
|
||||
unsigned int reg, val;
|
||||
|
||||
printf("\t%-41s : ", name);
|
||||
while (first_reg <= last_reg && id[last_reg] == ' ')
|
||||
last_reg--;
|
||||
for (reg = first_reg; reg <= last_reg; reg++) {
|
||||
val = id[reg];
|
||||
putchar(((val >= 32) && (val <= 126)) ? val : '_');
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void sff8024_show_oui(const __u8 *id, int id_offset)
|
||||
{
|
||||
printf("\t%-41s : %02x:%02x:%02x\n", "Vendor OUI",
|
||||
id[id_offset], id[(id_offset) + 1],
|
||||
id[(id_offset) + 2]);
|
||||
}
|
||||
|
||||
void sff8024_show_identifier(const __u8 *id, int id_offset)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x", "Identifier", id[id_offset]);
|
||||
switch (id[id_offset]) {
|
||||
case SFF8024_ID_UNKNOWN:
|
||||
printf(" (no module present, unknown, or unspecified)\n");
|
||||
break;
|
||||
case SFF8024_ID_GBIC:
|
||||
printf(" (GBIC)\n");
|
||||
break;
|
||||
case SFF8024_ID_SOLDERED_MODULE:
|
||||
printf(" (module soldered to motherboard)\n");
|
||||
break;
|
||||
case SFF8024_ID_SFP:
|
||||
printf(" (SFP)\n");
|
||||
break;
|
||||
case SFF8024_ID_300_PIN_XBI:
|
||||
printf(" (300 pin XBI)\n");
|
||||
break;
|
||||
case SFF8024_ID_XENPAK:
|
||||
printf(" (XENPAK)\n");
|
||||
break;
|
||||
case SFF8024_ID_XFP:
|
||||
printf(" (XFP)\n");
|
||||
break;
|
||||
case SFF8024_ID_XFF:
|
||||
printf(" (XFF)\n");
|
||||
break;
|
||||
case SFF8024_ID_XFP_E:
|
||||
printf(" (XFP-E)\n");
|
||||
break;
|
||||
case SFF8024_ID_XPAK:
|
||||
printf(" (XPAK)\n");
|
||||
break;
|
||||
case SFF8024_ID_X2:
|
||||
printf(" (X2)\n");
|
||||
break;
|
||||
case SFF8024_ID_DWDM_SFP:
|
||||
printf(" (DWDM-SFP)\n");
|
||||
break;
|
||||
case SFF8024_ID_QSFP:
|
||||
printf(" (QSFP)\n");
|
||||
break;
|
||||
case SFF8024_ID_QSFP_PLUS:
|
||||
printf(" (QSFP+)\n");
|
||||
break;
|
||||
case SFF8024_ID_CXP:
|
||||
printf(" (CXP)\n");
|
||||
break;
|
||||
case SFF8024_ID_HD4X:
|
||||
printf(" (Shielded Mini Multilane HD 4X)\n");
|
||||
break;
|
||||
case SFF8024_ID_HD8X:
|
||||
printf(" (Shielded Mini Multilane HD 8X)\n");
|
||||
break;
|
||||
case SFF8024_ID_QSFP28:
|
||||
printf(" (QSFP28)\n");
|
||||
break;
|
||||
case SFF8024_ID_CXP2:
|
||||
printf(" (CXP2/CXP28)\n");
|
||||
break;
|
||||
case SFF8024_ID_CDFP:
|
||||
printf(" (CDFP Style 1/Style 2)\n");
|
||||
break;
|
||||
case SFF8024_ID_HD4X_FANOUT:
|
||||
printf(" (Shielded Mini Multilane HD 4X Fanout Cable)\n");
|
||||
break;
|
||||
case SFF8024_ID_HD8X_FANOUT:
|
||||
printf(" (Shielded Mini Multilane HD 8X Fanout Cable)\n");
|
||||
break;
|
||||
case SFF8024_ID_CDFP_S3:
|
||||
printf(" (CDFP Style 3)\n");
|
||||
break;
|
||||
case SFF8024_ID_MICRO_QSFP:
|
||||
printf(" (microQSFP)\n");
|
||||
break;
|
||||
default:
|
||||
printf(" (reserved or unknown)\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sff8024_show_connector(const __u8 *id, int ctor_offset)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x", "Connector", id[ctor_offset]);
|
||||
switch (id[ctor_offset]) {
|
||||
case SFF8024_CTOR_UNKNOWN:
|
||||
printf(" (unknown or unspecified)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_SC:
|
||||
printf(" (SC)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_FC_STYLE_1:
|
||||
printf(" (Fibre Channel Style 1 copper)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_FC_STYLE_2:
|
||||
printf(" (Fibre Channel Style 2 copper)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_BNC_TNC:
|
||||
printf(" (BNC/TNC)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_FC_COAX:
|
||||
printf(" (Fibre Channel coaxial headers)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_FIBER_JACK:
|
||||
printf(" (FibreJack)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_LC:
|
||||
printf(" (LC)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_MT_RJ:
|
||||
printf(" (MT-RJ)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_MU:
|
||||
printf(" (MU)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_SG:
|
||||
printf(" (SG)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_OPT_PT:
|
||||
printf(" (Optical pigtail)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_MPO:
|
||||
printf(" (MPO Parallel Optic)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_MPO_2:
|
||||
printf(" (MPO Parallel Optic - 2x16)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_HSDC_II:
|
||||
printf(" (HSSDC II)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_COPPER_PT:
|
||||
printf(" (Copper pigtail)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_RJ45:
|
||||
printf(" (RJ45)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_NO_SEPARABLE:
|
||||
printf(" (No separable connector)\n");
|
||||
break;
|
||||
case SFF8024_CTOR_MXC_2x16:
|
||||
printf(" (MXC 2x16)\n");
|
||||
break;
|
||||
default:
|
||||
printf(" (reserved or unknown)\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sff8024_show_encoding(const __u8 *id, int encoding_offset, int sff_type)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x", "Encoding", id[encoding_offset]);
|
||||
switch (id[encoding_offset]) {
|
||||
case SFF8024_ENCODING_UNSPEC:
|
||||
printf(" (unspecified)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_8B10B:
|
||||
printf(" (8B/10B)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_4B5B:
|
||||
printf(" (4B/5B)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_NRZ:
|
||||
printf(" (NRZ)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_4h:
|
||||
if (sff_type == ETH_MODULE_SFF_8472)
|
||||
printf(" (Manchester)\n");
|
||||
else if (sff_type == ETH_MODULE_SFF_8636)
|
||||
printf(" (SONET Scrambled)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_5h:
|
||||
if (sff_type == ETH_MODULE_SFF_8472)
|
||||
printf(" (SONET Scrambled)\n");
|
||||
else if (sff_type == ETH_MODULE_SFF_8636)
|
||||
printf(" (64B/66B)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_6h:
|
||||
if (sff_type == ETH_MODULE_SFF_8472)
|
||||
printf(" (64B/66B)\n");
|
||||
else if (sff_type == ETH_MODULE_SFF_8636)
|
||||
printf(" (Manchester)\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_256B:
|
||||
printf(" ((256B/257B (transcoded FEC-enabled data))\n");
|
||||
break;
|
||||
case SFF8024_ENCODING_PAM4:
|
||||
printf(" (PAM4)\n");
|
||||
break;
|
||||
default:
|
||||
printf(" (reserved or unknown)\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sff_show_thresholds(struct sff_diags sd)
|
||||
{
|
||||
PRINT_BIAS("Laser bias current high alarm threshold",
|
||||
sd.bias_cur[HALRM]);
|
||||
PRINT_BIAS("Laser bias current low alarm threshold",
|
||||
sd.bias_cur[LALRM]);
|
||||
PRINT_BIAS("Laser bias current high warning threshold",
|
||||
sd.bias_cur[HWARN]);
|
||||
PRINT_BIAS("Laser bias current low warning threshold",
|
||||
sd.bias_cur[LWARN]);
|
||||
|
||||
PRINT_xX_PWR("Laser output power high alarm threshold",
|
||||
sd.tx_power[HALRM]);
|
||||
PRINT_xX_PWR("Laser output power low alarm threshold",
|
||||
sd.tx_power[LALRM]);
|
||||
PRINT_xX_PWR("Laser output power high warning threshold",
|
||||
sd.tx_power[HWARN]);
|
||||
PRINT_xX_PWR("Laser output power low warning threshold",
|
||||
sd.tx_power[LWARN]);
|
||||
|
||||
PRINT_TEMP("Module temperature high alarm threshold",
|
||||
sd.sfp_temp[HALRM]);
|
||||
PRINT_TEMP("Module temperature low alarm threshold",
|
||||
sd.sfp_temp[LALRM]);
|
||||
PRINT_TEMP("Module temperature high warning threshold",
|
||||
sd.sfp_temp[HWARN]);
|
||||
PRINT_TEMP("Module temperature low warning threshold",
|
||||
sd.sfp_temp[LWARN]);
|
||||
|
||||
PRINT_VCC("Module voltage high alarm threshold",
|
||||
sd.sfp_voltage[HALRM]);
|
||||
PRINT_VCC("Module voltage low alarm threshold",
|
||||
sd.sfp_voltage[LALRM]);
|
||||
PRINT_VCC("Module voltage high warning threshold",
|
||||
sd.sfp_voltage[HWARN]);
|
||||
PRINT_VCC("Module voltage low warning threshold",
|
||||
sd.sfp_voltage[LWARN]);
|
||||
|
||||
PRINT_xX_PWR("Laser rx power high alarm threshold",
|
||||
sd.rx_power[HALRM]);
|
||||
PRINT_xX_PWR("Laser rx power low alarm threshold",
|
||||
sd.rx_power[LALRM]);
|
||||
PRINT_xX_PWR("Laser rx power high warning threshold",
|
||||
sd.rx_power[HWARN]);
|
||||
PRINT_xX_PWR("Laser rx power low warning threshold",
|
||||
sd.rx_power[LWARN]);
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* sff-common.h: Implements SFF-8024 Rev 4.0 i.e. Specifcation
|
||||
* of pluggable I/O configuration
|
||||
*
|
||||
* Common utilities across SFF-8436/8636 and SFF-8472/8079
|
||||
* are defined in this file
|
||||
*
|
||||
* Copyright 2010 Solarflare Communications Inc.
|
||||
* Aurelien Guillaume <aurelien@iwi.me> (C) 2012
|
||||
* Copyright (C) 2014 Cumulus networks Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Freeoftware Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Vidya Sagar Ravipati <vidya@cumulusnetworks.com>
|
||||
* This implementation is loosely based on current SFP parser
|
||||
* and SFF-8024 specs (ftp://ftp.seagate.com/pub/sff/SFF-8024.PDF)
|
||||
* by SFF Committee.
|
||||
*/
|
||||
|
||||
#ifndef SFF_COMMON_H__
|
||||
#define SFF_COMMON_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define SFF8024_ID_OFFSET 0x00
|
||||
#define SFF8024_ID_UNKNOWN 0x00
|
||||
#define SFF8024_ID_GBIC 0x01
|
||||
#define SFF8024_ID_SOLDERED_MODULE 0x02
|
||||
#define SFF8024_ID_SFP 0x03
|
||||
#define SFF8024_ID_300_PIN_XBI 0x04
|
||||
#define SFF8024_ID_XENPAK 0x05
|
||||
#define SFF8024_ID_XFP 0x06
|
||||
#define SFF8024_ID_XFF 0x07
|
||||
#define SFF8024_ID_XFP_E 0x08
|
||||
#define SFF8024_ID_XPAK 0x09
|
||||
#define SFF8024_ID_X2 0x0A
|
||||
#define SFF8024_ID_DWDM_SFP 0x0B
|
||||
#define SFF8024_ID_QSFP 0x0C
|
||||
#define SFF8024_ID_QSFP_PLUS 0x0D
|
||||
#define SFF8024_ID_CXP 0x0E
|
||||
#define SFF8024_ID_HD4X 0x0F
|
||||
#define SFF8024_ID_HD8X 0x10
|
||||
#define SFF8024_ID_QSFP28 0x11
|
||||
#define SFF8024_ID_CXP2 0x12
|
||||
#define SFF8024_ID_CDFP 0x13
|
||||
#define SFF8024_ID_HD4X_FANOUT 0x14
|
||||
#define SFF8024_ID_HD8X_FANOUT 0x15
|
||||
#define SFF8024_ID_CDFP_S3 0x16
|
||||
#define SFF8024_ID_MICRO_QSFP 0x17
|
||||
#define SFF8024_ID_LAST SFF8024_ID_MICRO_QSFP
|
||||
#define SFF8024_ID_UNALLOCATED_LAST 0x7F
|
||||
#define SFF8024_ID_VENDOR_START 0x80
|
||||
#define SFF8024_ID_VENDOR_LAST 0xFF
|
||||
|
||||
#define SFF8024_CTOR_UNKNOWN 0x00
|
||||
#define SFF8024_CTOR_SC 0x01
|
||||
#define SFF8024_CTOR_FC_STYLE_1 0x02
|
||||
#define SFF8024_CTOR_FC_STYLE_2 0x03
|
||||
#define SFF8024_CTOR_BNC_TNC 0x04
|
||||
#define SFF8024_CTOR_FC_COAX 0x05
|
||||
#define SFF8024_CTOR_FIBER_JACK 0x06
|
||||
#define SFF8024_CTOR_LC 0x07
|
||||
#define SFF8024_CTOR_MT_RJ 0x08
|
||||
#define SFF8024_CTOR_MU 0x09
|
||||
#define SFF8024_CTOR_SG 0x0A
|
||||
#define SFF8024_CTOR_OPT_PT 0x0B
|
||||
#define SFF8024_CTOR_MPO 0x0C
|
||||
#define SFF8024_CTOR_MPO_2 0x0D
|
||||
/* 0E-1Fh --- Reserved */
|
||||
#define SFF8024_CTOR_HSDC_II 0x20
|
||||
#define SFF8024_CTOR_COPPER_PT 0x21
|
||||
#define SFF8024_CTOR_RJ45 0x22
|
||||
#define SFF8024_CTOR_NO_SEPARABLE 0x23
|
||||
#define SFF8024_CTOR_MXC_2x16 0x24
|
||||
#define SFF8024_CTOR_LAST SFF8024_CTOR_MXC_2x16
|
||||
#define SFF8024_CTOR_UNALLOCATED_LAST 0x7F
|
||||
#define SFF8024_CTOR_VENDOR_START 0x80
|
||||
#define SFF8024_CTOR_VENDOR_LAST 0xFF
|
||||
|
||||
/* ENCODING Values */
|
||||
#define SFF8024_ENCODING_UNSPEC 0x00
|
||||
#define SFF8024_ENCODING_8B10B 0x01
|
||||
#define SFF8024_ENCODING_4B5B 0x02
|
||||
#define SFF8024_ENCODING_NRZ 0x03
|
||||
/*
|
||||
* Value: 04h
|
||||
* SFF-8472 - Manchester
|
||||
* SFF-8436/8636 - SONET Scrambled
|
||||
*/
|
||||
#define SFF8024_ENCODING_4h 0x04
|
||||
/*
|
||||
* Value: 05h
|
||||
* SFF-8472 - SONET Scrambled
|
||||
* SFF-8436/8636 - 64B/66B
|
||||
*/
|
||||
#define SFF8024_ENCODING_5h 0x05
|
||||
/*
|
||||
* Value: 06h
|
||||
* SFF-8472 - 64B/66B
|
||||
* SFF-8436/8636 - Manchester
|
||||
*/
|
||||
#define SFF8024_ENCODING_6h 0x06
|
||||
#define SFF8024_ENCODING_256B 0x07
|
||||
#define SFF8024_ENCODING_PAM4 0x08
|
||||
|
||||
/* Most common case: 16-bit unsigned integer in a certain unit */
|
||||
#define OFFSET_TO_U16(offset) \
|
||||
(id[offset] << 8 | id[(offset) + 1])
|
||||
|
||||
# define PRINT_xX_PWR(string, var) \
|
||||
printf("\t%-41s : %.4f mW / %.2f dBm\n", (string), \
|
||||
(double)((var) / 10000.), \
|
||||
convert_mw_to_dbm((double)((var) / 10000.)))
|
||||
|
||||
#define PRINT_BIAS(string, bias_cur) \
|
||||
printf("\t%-41s : %.3f mA\n", (string), \
|
||||
(double)(bias_cur / 500.))
|
||||
|
||||
#define PRINT_TEMP(string, temp) \
|
||||
printf("\t%-41s : %.2f degrees C / %.2f degrees F\n", \
|
||||
(string), (double)(temp / 256.), \
|
||||
(double)(temp / 256. * 1.8 + 32.))
|
||||
|
||||
#define PRINT_VCC(string, sfp_voltage) \
|
||||
printf("\t%-41s : %.4f V\n", (string), \
|
||||
(double)(sfp_voltage / 10000.))
|
||||
|
||||
# define PRINT_xX_THRESH_PWR(string, var, index) \
|
||||
PRINT_xX_PWR(string, (var)[(index)])
|
||||
|
||||
/* Channel Monitoring Fields */
|
||||
struct sff_channel_diags {
|
||||
__u16 bias_cur; /* Measured bias current in 2uA units */
|
||||
__u16 rx_power; /* Measured RX Power */
|
||||
__u16 tx_power; /* Measured TX Power */
|
||||
};
|
||||
|
||||
/* Module Monitoring Fields */
|
||||
struct sff_diags {
|
||||
|
||||
#define MAX_CHANNEL_NUM 4
|
||||
#define LWARN 0
|
||||
#define HWARN 1
|
||||
#define LALRM 2
|
||||
#define HALRM 3
|
||||
#define MCURR 4
|
||||
|
||||
/* Supports DOM */
|
||||
__u8 supports_dom;
|
||||
/* Supports alarm/warning thold */
|
||||
__u8 supports_alarms;
|
||||
/* RX Power: 0 = OMA, 1 = Average power */
|
||||
__u8 rx_power_type;
|
||||
/* TX Power: 0 = Not supported, 1 = Average power */
|
||||
__u8 tx_power_type;
|
||||
|
||||
__u8 calibrated_ext; /* Is externally calibrated */
|
||||
/* [5] tables are low/high warn, low/high alarm, current */
|
||||
/* SFP voltage in 0.1mV units */
|
||||
__u16 sfp_voltage[5];
|
||||
/* SFP Temp in 16-bit signed 1/256 Celcius */
|
||||
__s16 sfp_temp[5];
|
||||
/* Measured bias current in 2uA units */
|
||||
__u16 bias_cur[5];
|
||||
/* Measured TX Power */
|
||||
__u16 tx_power[5];
|
||||
/* Measured RX Power */
|
||||
__u16 rx_power[5];
|
||||
struct sff_channel_diags scd[MAX_CHANNEL_NUM];
|
||||
};
|
||||
|
||||
double convert_mw_to_dbm(double mw);
|
||||
void sff_show_value_with_unit(const __u8 *id, unsigned int reg,
|
||||
const char *name, unsigned int mult,
|
||||
const char *unit);
|
||||
void sff_show_ascii(const __u8 *id, unsigned int first_reg,
|
||||
unsigned int last_reg, const char *name);
|
||||
void sff_show_thresholds(struct sff_diags sd);
|
||||
|
||||
void sff8024_show_oui(const __u8 *id, int id_offset);
|
||||
void sff8024_show_identifier(const __u8 *id, int id_offset);
|
||||
void sff8024_show_connector(const __u8 *id, int ctor_offset);
|
||||
void sff8024_show_encoding(const __u8 *id, int encoding_offset, int sff_type);
|
||||
|
||||
#endif /* SFF_COMMON_H__ */
|
|
@ -0,0 +1,281 @@
|
|||
/*
|
||||
* sfpdiag.c: Implements SFF-8472 optics diagnostics.
|
||||
*
|
||||
* Aurelien Guillaume <aurelien@iwi.me> (C) 2012
|
||||
* This implementation is loosely based on DOM patches
|
||||
* from Robert Olsson <robert@herjulf.se> (C) 2009
|
||||
* and SFF-8472 specs (ftp://ftp.seagate.com/pub/sff/SFF-8472.PDF)
|
||||
* by SFF Committee.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "internal.h"
|
||||
#include "sff-common.h"
|
||||
|
||||
/* Offsets in decimal, for direct comparison with the SFF specs */
|
||||
|
||||
/* A0-based EEPROM offsets for DOM support checks */
|
||||
#define SFF_A0_DOM 92
|
||||
#define SFF_A0_OPTIONS 93
|
||||
#define SFF_A0_COMP 94
|
||||
|
||||
/* EEPROM bit values for various registers */
|
||||
#define SFF_A0_DOM_EXTCAL (1 << 4)
|
||||
#define SFF_A0_DOM_INTCAL (1 << 5)
|
||||
#define SFF_A0_DOM_IMPL (1 << 6)
|
||||
#define SFF_A0_DOM_PWRT (1 << 3)
|
||||
|
||||
#define SFF_A0_OPTIONS_AW (1 << 7)
|
||||
|
||||
/*
|
||||
* See ethtool.c comments about SFF-8472, this is the offset
|
||||
* at which the A2 page is in the EEPROM blob returned by the
|
||||
* kernel.
|
||||
*/
|
||||
#define SFF_A2_BASE 0x100
|
||||
|
||||
/* A2-based offsets for DOM */
|
||||
#define SFF_A2_TEMP 96
|
||||
#define SFF_A2_TEMP_HALRM 0
|
||||
#define SFF_A2_TEMP_LALRM 2
|
||||
#define SFF_A2_TEMP_HWARN 4
|
||||
#define SFF_A2_TEMP_LWARN 6
|
||||
|
||||
#define SFF_A2_VCC 98
|
||||
#define SFF_A2_VCC_HALRM 8
|
||||
#define SFF_A2_VCC_LALRM 10
|
||||
#define SFF_A2_VCC_HWARN 12
|
||||
#define SFF_A2_VCC_LWARN 14
|
||||
|
||||
#define SFF_A2_BIAS 100
|
||||
#define SFF_A2_BIAS_HALRM 16
|
||||
#define SFF_A2_BIAS_LALRM 18
|
||||
#define SFF_A2_BIAS_HWARN 20
|
||||
#define SFF_A2_BIAS_LWARN 22
|
||||
|
||||
#define SFF_A2_TX_PWR 102
|
||||
#define SFF_A2_TX_PWR_HALRM 24
|
||||
#define SFF_A2_TX_PWR_LALRM 26
|
||||
#define SFF_A2_TX_PWR_HWARN 28
|
||||
#define SFF_A2_TX_PWR_LWARN 30
|
||||
|
||||
#define SFF_A2_RX_PWR 104
|
||||
#define SFF_A2_RX_PWR_HALRM 32
|
||||
#define SFF_A2_RX_PWR_LALRM 34
|
||||
#define SFF_A2_RX_PWR_HWARN 36
|
||||
#define SFF_A2_RX_PWR_LWARN 38
|
||||
|
||||
#define SFF_A2_ALRM_FLG 112
|
||||
#define SFF_A2_WARN_FLG 116
|
||||
|
||||
/* 32-bit little-endian calibration constants */
|
||||
#define SFF_A2_CAL_RXPWR4 56
|
||||
#define SFF_A2_CAL_RXPWR3 60
|
||||
#define SFF_A2_CAL_RXPWR2 64
|
||||
#define SFF_A2_CAL_RXPWR1 68
|
||||
#define SFF_A2_CAL_RXPWR0 72
|
||||
|
||||
/* 16-bit little endian calibration constants */
|
||||
#define SFF_A2_CAL_TXI_SLP 76
|
||||
#define SFF_A2_CAL_TXI_OFF 78
|
||||
#define SFF_A2_CAL_TXPWR_SLP 80
|
||||
#define SFF_A2_CAL_TXPWR_OFF 82
|
||||
#define SFF_A2_CAL_T_SLP 84
|
||||
#define SFF_A2_CAL_T_OFF 86
|
||||
#define SFF_A2_CAL_V_SLP 88
|
||||
#define SFF_A2_CAL_V_OFF 90
|
||||
|
||||
static struct sff8472_aw_flags {
|
||||
const char *str; /* Human-readable string, null at the end */
|
||||
int offset; /* A2-relative address offset */
|
||||
__u8 value; /* Alarm is on if (offset & value) != 0. */
|
||||
} sff8472_aw_flags[] = {
|
||||
{ "Laser bias current high alarm", SFF_A2_ALRM_FLG, (1 << 3) },
|
||||
{ "Laser bias current low alarm", SFF_A2_ALRM_FLG, (1 << 2) },
|
||||
{ "Laser bias current high warning", SFF_A2_WARN_FLG, (1 << 3) },
|
||||
{ "Laser bias current low warning", SFF_A2_WARN_FLG, (1 << 2) },
|
||||
|
||||
{ "Laser output power high alarm", SFF_A2_ALRM_FLG, (1 << 1) },
|
||||
{ "Laser output power low alarm", SFF_A2_ALRM_FLG, (1 << 0) },
|
||||
{ "Laser output power high warning", SFF_A2_WARN_FLG, (1 << 1) },
|
||||
{ "Laser output power low warning", SFF_A2_WARN_FLG, (1 << 0) },
|
||||
|
||||
{ "Module temperature high alarm", SFF_A2_ALRM_FLG, (1 << 7) },
|
||||
{ "Module temperature low alarm", SFF_A2_ALRM_FLG, (1 << 6) },
|
||||
{ "Module temperature high warning", SFF_A2_WARN_FLG, (1 << 7) },
|
||||
{ "Module temperature low warning", SFF_A2_WARN_FLG, (1 << 6) },
|
||||
|
||||
{ "Module voltage high alarm", SFF_A2_ALRM_FLG, (1 << 5) },
|
||||
{ "Module voltage low alarm", SFF_A2_ALRM_FLG, (1 << 4) },
|
||||
{ "Module voltage high warning", SFF_A2_WARN_FLG, (1 << 5) },
|
||||
{ "Module voltage low warning", SFF_A2_WARN_FLG, (1 << 4) },
|
||||
|
||||
{ "Laser rx power high alarm", SFF_A2_ALRM_FLG + 1, (1 << 7) },
|
||||
{ "Laser rx power low alarm", SFF_A2_ALRM_FLG + 1, (1 << 6) },
|
||||
{ "Laser rx power high warning", SFF_A2_WARN_FLG + 1, (1 << 7) },
|
||||
{ "Laser rx power low warning", SFF_A2_WARN_FLG + 1, (1 << 6) },
|
||||
|
||||
{ NULL, 0, 0 },
|
||||
};
|
||||
|
||||
/* Most common case: 16-bit unsigned integer in a certain unit */
|
||||
#define A2_OFFSET_TO_U16(offset) \
|
||||
(id[SFF_A2_BASE + (offset)] << 8 | id[SFF_A2_BASE + (offset) + 1])
|
||||
|
||||
/* Calibration slope is a number between 0.0 included and 256.0 excluded. */
|
||||
#define A2_OFFSET_TO_SLP(offset) \
|
||||
(id[SFF_A2_BASE + (offset)] + id[SFF_A2_BASE + (offset) + 1] / 256.)
|
||||
|
||||
/* Calibration offset is an integer from -32768 to 32767 */
|
||||
#define A2_OFFSET_TO_OFF(offset) \
|
||||
((__s16)A2_OFFSET_TO_U16(offset))
|
||||
|
||||
/* RXPWR(x) are IEEE-754 floating point numbers in big-endian format */
|
||||
#define A2_OFFSET_TO_RXPWRx(offset) \
|
||||
(befloattoh((__u32 *)(id + SFF_A2_BASE + (offset))))
|
||||
|
||||
/*
|
||||
* 2-byte internal temperature conversions:
|
||||
* First byte is a signed 8-bit integer, which is the temp decimal part
|
||||
* Second byte are 1/256th of degree, which are added to the dec part.
|
||||
*/
|
||||
#define A2_OFFSET_TO_TEMP(offset) ((__s16)A2_OFFSET_TO_U16(offset))
|
||||
|
||||
static void sff8472_dom_parse(const __u8 *id, struct sff_diags *sd)
|
||||
{
|
||||
sd->bias_cur[MCURR] = A2_OFFSET_TO_U16(SFF_A2_BIAS);
|
||||
sd->bias_cur[HALRM] = A2_OFFSET_TO_U16(SFF_A2_BIAS_HALRM);
|
||||
sd->bias_cur[LALRM] = A2_OFFSET_TO_U16(SFF_A2_BIAS_LALRM);
|
||||
sd->bias_cur[HWARN] = A2_OFFSET_TO_U16(SFF_A2_BIAS_HWARN);
|
||||
sd->bias_cur[LWARN] = A2_OFFSET_TO_U16(SFF_A2_BIAS_LWARN);
|
||||
|
||||
sd->sfp_voltage[MCURR] = A2_OFFSET_TO_U16(SFF_A2_VCC);
|
||||
sd->sfp_voltage[HALRM] = A2_OFFSET_TO_U16(SFF_A2_VCC_HALRM);
|
||||
sd->sfp_voltage[LALRM] = A2_OFFSET_TO_U16(SFF_A2_VCC_LALRM);
|
||||
sd->sfp_voltage[HWARN] = A2_OFFSET_TO_U16(SFF_A2_VCC_HWARN);
|
||||
sd->sfp_voltage[LWARN] = A2_OFFSET_TO_U16(SFF_A2_VCC_LWARN);
|
||||
|
||||
sd->tx_power[MCURR] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR);
|
||||
sd->tx_power[HALRM] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_HALRM);
|
||||
sd->tx_power[LALRM] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_LALRM);
|
||||
sd->tx_power[HWARN] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_HWARN);
|
||||
sd->tx_power[LWARN] = A2_OFFSET_TO_U16(SFF_A2_TX_PWR_LWARN);
|
||||
|
||||
sd->rx_power[MCURR] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR);
|
||||
sd->rx_power[HALRM] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_HALRM);
|
||||
sd->rx_power[LALRM] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_LALRM);
|
||||
sd->rx_power[HWARN] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_HWARN);
|
||||
sd->rx_power[LWARN] = A2_OFFSET_TO_U16(SFF_A2_RX_PWR_LWARN);
|
||||
|
||||
sd->sfp_temp[MCURR] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP);
|
||||
sd->sfp_temp[HALRM] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_HALRM);
|
||||
sd->sfp_temp[LALRM] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_LALRM);
|
||||
sd->sfp_temp[HWARN] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_HWARN);
|
||||
sd->sfp_temp[LWARN] = A2_OFFSET_TO_TEMP(SFF_A2_TEMP_LWARN);
|
||||
}
|
||||
|
||||
/* Converts to a float from a big-endian 4-byte source buffer. */
|
||||
static float befloattoh(const __u32 *source)
|
||||
{
|
||||
union {
|
||||
__u32 src;
|
||||
float dst;
|
||||
} converter;
|
||||
|
||||
converter.src = ntohl(*source);
|
||||
return converter.dst;
|
||||
}
|
||||
|
||||
static void sff8472_calibration(const __u8 *id, struct sff_diags *sd)
|
||||
{
|
||||
int i;
|
||||
__u16 rx_reading;
|
||||
|
||||
/* Calibration should occur for all values (threshold and current) */
|
||||
for (i = 0; i < ARRAY_SIZE(sd->bias_cur); ++i) {
|
||||
/*
|
||||
* Apply calibration formula 1 (Temp., Voltage, Bias, Tx Power)
|
||||
*/
|
||||
sd->bias_cur[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_TXI_SLP);
|
||||
sd->tx_power[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_TXPWR_SLP);
|
||||
sd->sfp_voltage[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_V_SLP);
|
||||
sd->sfp_temp[i] *= A2_OFFSET_TO_SLP(SFF_A2_CAL_T_SLP);
|
||||
|
||||
sd->bias_cur[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_TXI_OFF);
|
||||
sd->tx_power[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_TXPWR_OFF);
|
||||
sd->sfp_voltage[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_V_OFF);
|
||||
sd->sfp_temp[i] += A2_OFFSET_TO_OFF(SFF_A2_CAL_T_OFF);
|
||||
|
||||
/*
|
||||
* Apply calibration formula 2 (Rx Power only)
|
||||
*/
|
||||
rx_reading = sd->rx_power[i];
|
||||
sd->rx_power[i] = A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR0);
|
||||
sd->rx_power[i] += rx_reading *
|
||||
A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR1);
|
||||
sd->rx_power[i] += rx_reading *
|
||||
A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR2);
|
||||
sd->rx_power[i] += rx_reading *
|
||||
A2_OFFSET_TO_RXPWRx(SFF_A2_CAL_RXPWR3);
|
||||
}
|
||||
}
|
||||
|
||||
static void sff8472_parse_eeprom(const __u8 *id, struct sff_diags *sd)
|
||||
{
|
||||
sd->supports_dom = id[SFF_A0_DOM] & SFF_A0_DOM_IMPL;
|
||||
sd->supports_alarms = id[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_AW;
|
||||
sd->calibrated_ext = id[SFF_A0_DOM] & SFF_A0_DOM_EXTCAL;
|
||||
sd->rx_power_type = id[SFF_A0_DOM] & SFF_A0_DOM_PWRT;
|
||||
|
||||
sff8472_dom_parse(id, sd);
|
||||
|
||||
/*
|
||||
* If the SFP is externally calibrated, we need to read calibration data
|
||||
* and compensate the already stored readings.
|
||||
*/
|
||||
if (sd->calibrated_ext)
|
||||
sff8472_calibration(id, sd);
|
||||
}
|
||||
|
||||
void sff8472_show_all(const __u8 *id)
|
||||
{
|
||||
struct sff_diags sd = {0};
|
||||
char *rx_power_string = NULL;
|
||||
int i;
|
||||
|
||||
sff8472_parse_eeprom(id, &sd);
|
||||
|
||||
if (!sd.supports_dom) {
|
||||
printf("\t%-41s : No\n", "Optical diagnostics support");
|
||||
return;
|
||||
}
|
||||
printf("\t%-41s : Yes\n", "Optical diagnostics support");
|
||||
|
||||
PRINT_BIAS("Laser bias current", sd.bias_cur[MCURR]);
|
||||
PRINT_xX_PWR("Laser output power", sd.tx_power[MCURR]);
|
||||
|
||||
if (!sd.rx_power_type)
|
||||
rx_power_string = "Receiver signal OMA";
|
||||
else
|
||||
rx_power_string = "Receiver signal average optical power";
|
||||
|
||||
PRINT_xX_PWR(rx_power_string, sd.rx_power[MCURR]);
|
||||
|
||||
PRINT_TEMP("Module temperature", sd.sfp_temp[MCURR]);
|
||||
PRINT_VCC("Module voltage", sd.sfp_voltage[MCURR]);
|
||||
|
||||
printf("\t%-41s : %s\n", "Alarm/warning flags implemented",
|
||||
(sd.supports_alarms ? "Yes" : "No"));
|
||||
if (sd.supports_alarms) {
|
||||
|
||||
for (i = 0; sff8472_aw_flags[i].str; ++i) {
|
||||
printf("\t%-41s : %s\n", sff8472_aw_flags[i].str,
|
||||
id[SFF_A2_BASE + sff8472_aw_flags[i].offset]
|
||||
& sff8472_aw_flags[i].value ? "On" : "Off");
|
||||
}
|
||||
sff_show_thresholds(sd);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
/****************************************************************************
|
||||
* Support for Solarflare Solarstorm network controllers and boards
|
||||
* Copyright 2010 Solarflare Communications Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
#include "sff-common.h"
|
||||
|
||||
static void sff8079_show_identifier(const __u8 *id)
|
||||
{
|
||||
sff8024_show_identifier(id, 0);
|
||||
}
|
||||
|
||||
static void sff8079_show_ext_identifier(const __u8 *id)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x", "Extended identifier", id[1]);
|
||||
if (id[1] == 0x00)
|
||||
printf(" (GBIC not specified / not MOD_DEF compliant)\n");
|
||||
else if (id[1] == 0x04)
|
||||
printf(" (GBIC/SFP defined by 2-wire interface ID)\n");
|
||||
else if (id[1] <= 0x07)
|
||||
printf(" (GBIC compliant with MOD_DEF %u)\n", id[1]);
|
||||
else
|
||||
printf(" (unknown)\n");
|
||||
}
|
||||
|
||||
static void sff8079_show_connector(const __u8 *id)
|
||||
{
|
||||
sff8024_show_connector(id, 2);
|
||||
}
|
||||
|
||||
static void sff8079_show_transceiver(const __u8 *id)
|
||||
{
|
||||
static const char *pfx =
|
||||
"\tTransceiver type :";
|
||||
|
||||
printf("\t%-41s : 0x%02x 0x%02x 0x%02x " \
|
||||
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
"Transceiver codes",
|
||||
id[3], id[4], id[5], id[6],
|
||||
id[7], id[8], id[9], id[10], id[36]);
|
||||
/* 10G Ethernet Compliance Codes */
|
||||
if (id[3] & (1 << 7))
|
||||
printf("%s 10G Ethernet: 10G Base-ER" \
|
||||
" [SFF-8472 rev10.4 onwards]\n", pfx);
|
||||
if (id[3] & (1 << 6))
|
||||
printf("%s 10G Ethernet: 10G Base-LRM\n", pfx);
|
||||
if (id[3] & (1 << 5))
|
||||
printf("%s 10G Ethernet: 10G Base-LR\n", pfx);
|
||||
if (id[3] & (1 << 4))
|
||||
printf("%s 10G Ethernet: 10G Base-SR\n", pfx);
|
||||
/* Infiniband Compliance Codes */
|
||||
if (id[3] & (1 << 3))
|
||||
printf("%s Infiniband: 1X SX\n", pfx);
|
||||
if (id[3] & (1 << 2))
|
||||
printf("%s Infiniband: 1X LX\n", pfx);
|
||||
if (id[3] & (1 << 1))
|
||||
printf("%s Infiniband: 1X Copper Active\n", pfx);
|
||||
if (id[3] & (1 << 0))
|
||||
printf("%s Infiniband: 1X Copper Passive\n", pfx);
|
||||
/* ESCON Compliance Codes */
|
||||
if (id[4] & (1 << 7))
|
||||
printf("%s ESCON: ESCON MMF, 1310nm LED\n", pfx);
|
||||
if (id[4] & (1 << 6))
|
||||
printf("%s ESCON: ESCON SMF, 1310nm Laser\n", pfx);
|
||||
/* SONET Compliance Codes */
|
||||
if (id[4] & (1 << 5))
|
||||
printf("%s SONET: OC-192, short reach\n", pfx);
|
||||
if (id[4] & (1 << 4))
|
||||
printf("%s SONET: SONET reach specifier bit 1\n", pfx);
|
||||
if (id[4] & (1 << 3))
|
||||
printf("%s SONET: SONET reach specifier bit 2\n", pfx);
|
||||
if (id[4] & (1 << 2))
|
||||
printf("%s SONET: OC-48, long reach\n", pfx);
|
||||
if (id[4] & (1 << 1))
|
||||
printf("%s SONET: OC-48, intermediate reach\n", pfx);
|
||||
if (id[4] & (1 << 0))
|
||||
printf("%s SONET: OC-48, short reach\n", pfx);
|
||||
if (id[5] & (1 << 6))
|
||||
printf("%s SONET: OC-12, single mode, long reach\n", pfx);
|
||||
if (id[5] & (1 << 5))
|
||||
printf("%s SONET: OC-12, single mode, inter. reach\n", pfx);
|
||||
if (id[5] & (1 << 4))
|
||||
printf("%s SONET: OC-12, short reach\n", pfx);
|
||||
if (id[5] & (1 << 2))
|
||||
printf("%s SONET: OC-3, single mode, long reach\n", pfx);
|
||||
if (id[5] & (1 << 1))
|
||||
printf("%s SONET: OC-3, single mode, inter. reach\n", pfx);
|
||||
if (id[5] & (1 << 0))
|
||||
printf("%s SONET: OC-3, short reach\n", pfx);
|
||||
/* Ethernet Compliance Codes */
|
||||
if (id[6] & (1 << 7))
|
||||
printf("%s Ethernet: BASE-PX\n", pfx);
|
||||
if (id[6] & (1 << 6))
|
||||
printf("%s Ethernet: BASE-BX10\n", pfx);
|
||||
if (id[6] & (1 << 5))
|
||||
printf("%s Ethernet: 100BASE-FX\n", pfx);
|
||||
if (id[6] & (1 << 4))
|
||||
printf("%s Ethernet: 100BASE-LX/LX10\n", pfx);
|
||||
if (id[6] & (1 << 3))
|
||||
printf("%s Ethernet: 1000BASE-T\n", pfx);
|
||||
if (id[6] & (1 << 2))
|
||||
printf("%s Ethernet: 1000BASE-CX\n", pfx);
|
||||
if (id[6] & (1 << 1))
|
||||
printf("%s Ethernet: 1000BASE-LX\n", pfx);
|
||||
if (id[6] & (1 << 0))
|
||||
printf("%s Ethernet: 1000BASE-SX\n", pfx);
|
||||
/* Fibre Channel link length */
|
||||
if (id[7] & (1 << 7))
|
||||
printf("%s FC: very long distance (V)\n", pfx);
|
||||
if (id[7] & (1 << 6))
|
||||
printf("%s FC: short distance (S)\n", pfx);
|
||||
if (id[7] & (1 << 5))
|
||||
printf("%s FC: intermediate distance (I)\n", pfx);
|
||||
if (id[7] & (1 << 4))
|
||||
printf("%s FC: long distance (L)\n", pfx);
|
||||
if (id[7] & (1 << 3))
|
||||
printf("%s FC: medium distance (M)\n", pfx);
|
||||
/* Fibre Channel transmitter technology */
|
||||
if (id[7] & (1 << 2))
|
||||
printf("%s FC: Shortwave laser, linear Rx (SA)\n", pfx);
|
||||
if (id[7] & (1 << 1))
|
||||
printf("%s FC: Longwave laser (LC)\n", pfx);
|
||||
if (id[7] & (1 << 0))
|
||||
printf("%s FC: Electrical inter-enclosure (EL)\n", pfx);
|
||||
if (id[8] & (1 << 7))
|
||||
printf("%s FC: Electrical intra-enclosure (EL)\n", pfx);
|
||||
if (id[8] & (1 << 6))
|
||||
printf("%s FC: Shortwave laser w/o OFC (SN)\n", pfx);
|
||||
if (id[8] & (1 << 5))
|
||||
printf("%s FC: Shortwave laser with OFC (SL)\n", pfx);
|
||||
if (id[8] & (1 << 4))
|
||||
printf("%s FC: Longwave laser (LL)\n", pfx);
|
||||
if (id[8] & (1 << 3))
|
||||
printf("%s Active Cable\n", pfx);
|
||||
if (id[8] & (1 << 2))
|
||||
printf("%s Passive Cable\n", pfx);
|
||||
if (id[8] & (1 << 1))
|
||||
printf("%s FC: Copper FC-BaseT\n", pfx);
|
||||
/* Fibre Channel transmission media */
|
||||
if (id[9] & (1 << 7))
|
||||
printf("%s FC: Twin Axial Pair (TW)\n", pfx);
|
||||
if (id[9] & (1 << 6))
|
||||
printf("%s FC: Twisted Pair (TP)\n", pfx);
|
||||
if (id[9] & (1 << 5))
|
||||
printf("%s FC: Miniature Coax (MI)\n", pfx);
|
||||
if (id[9] & (1 << 4))
|
||||
printf("%s FC: Video Coax (TV)\n", pfx);
|
||||
if (id[9] & (1 << 3))
|
||||
printf("%s FC: Multimode, 62.5um (M6)\n", pfx);
|
||||
if (id[9] & (1 << 2))
|
||||
printf("%s FC: Multimode, 50um (M5)\n", pfx);
|
||||
if (id[9] & (1 << 0))
|
||||
printf("%s FC: Single Mode (SM)\n", pfx);
|
||||
/* Fibre Channel speed */
|
||||
if (id[10] & (1 << 7))
|
||||
printf("%s FC: 1200 MBytes/sec\n", pfx);
|
||||
if (id[10] & (1 << 6))
|
||||
printf("%s FC: 800 MBytes/sec\n", pfx);
|
||||
if (id[10] & (1 << 4))
|
||||
printf("%s FC: 400 MBytes/sec\n", pfx);
|
||||
if (id[10] & (1 << 2))
|
||||
printf("%s FC: 200 MBytes/sec\n", pfx);
|
||||
if (id[10] & (1 << 0))
|
||||
printf("%s FC: 100 MBytes/sec\n", pfx);
|
||||
/* Extended Specification Compliance Codes from SFF-8024 */
|
||||
if (id[36] == 0x1)
|
||||
printf("%s Extended: 100G AOC or 25GAUI C2M AOC with worst BER of 5x10^(-5)\n", pfx);
|
||||
if (id[36] == 0x2)
|
||||
printf("%s Extended: 100G Base-SR4 or 25GBase-SR\n", pfx);
|
||||
if (id[36] == 0x3)
|
||||
printf("%s Extended: 100G Base-LR4 or 25GBase-LR\n", pfx);
|
||||
if (id[36] == 0x4)
|
||||
printf("%s Extended: 100G Base-ER4 or 25GBase-ER\n", pfx);
|
||||
if (id[36] == 0x8)
|
||||
printf("%s Extended: 100G ACC or 25GAUI C2M ACC with worst BER of 5x10^(-5)\n", pfx);
|
||||
if (id[36] == 0xb)
|
||||
printf("%s Extended: 100G Base-CR4 or 25G Base-CR CA-L\n", pfx);
|
||||
if (id[36] == 0xc)
|
||||
printf("%s Extended: 25G Base-CR CA-S\n", pfx);
|
||||
if (id[36] == 0xd)
|
||||
printf("%s Extended: 25G Base-CR CA-N\n", pfx);
|
||||
if (id[36] == 0x16)
|
||||
printf("%s Extended: 10Gbase-T with SFI electrical interface\n", pfx);
|
||||
if (id[36] == 0x18)
|
||||
printf("%s Extended: 100G AOC or 25GAUI C2M AOC with worst BER of 10^(-12)\n", pfx);
|
||||
if (id[36] == 0x19)
|
||||
printf("%s Extended: 100G ACC or 25GAUI C2M ACC with worst BER of 10^(-12)\n", pfx);
|
||||
if (id[36] == 0x1c)
|
||||
printf("%s Extended: 10Gbase-T Short Reach\n", pfx);
|
||||
}
|
||||
|
||||
static void sff8079_show_encoding(const __u8 *id)
|
||||
{
|
||||
sff8024_show_encoding(id, 11, ETH_MODULE_SFF_8472);
|
||||
}
|
||||
|
||||
static void sff8079_show_rate_identifier(const __u8 *id)
|
||||
{
|
||||
printf("\t%-41s : 0x%02x", "Rate identifier", id[13]);
|
||||
switch (id[13]) {
|
||||
case 0x00:
|
||||
printf(" (unspecified)\n");
|
||||
break;
|
||||
case 0x01:
|
||||
printf(" (4/2/1G Rate_Select & AS0/AS1)\n");
|
||||
break;
|
||||
case 0x02:
|
||||
printf(" (8/4/2G Rx Rate_Select only)\n");
|
||||
break;
|
||||
case 0x03:
|
||||
printf(" (8/4/2G Independent Rx & Tx Rate_Select)\n");
|
||||
break;
|
||||
case 0x04:
|
||||
printf(" (8/4/2G Tx Rate_Select only)\n");
|
||||
break;
|
||||
default:
|
||||
printf(" (reserved or unknown)\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void sff8079_show_oui(const __u8 *id)
|
||||
{
|
||||
printf("\t%-41s : %02x:%02x:%02x\n", "Vendor OUI",
|
||||
id[37], id[38], id[39]);
|
||||
}
|
||||
|
||||
static void sff8079_show_wavelength_or_copper_compliance(const __u8 *id)
|
||||
{
|
||||
if (id[8] & (1 << 2)) {
|
||||
printf("\t%-41s : 0x%02x", "Passive Cu cmplnce.", id[60]);
|
||||
switch (id[60]) {
|
||||
case 0x00:
|
||||
printf(" (unspecified)");
|
||||
break;
|
||||
case 0x01:
|
||||
printf(" (SFF-8431 appendix E)");
|
||||
break;
|
||||
default:
|
||||
printf(" (unknown)");
|
||||
break;
|
||||
}
|
||||
printf(" [SFF-8472 rev10.4 only]\n");
|
||||
} else if (id[8] & (1 << 3)) {
|
||||
printf("\t%-41s : 0x%02x", "Active Cu cmplnce.", id[60]);
|
||||
switch (id[60]) {
|
||||
case 0x00:
|
||||
printf(" (unspecified)");
|
||||
break;
|
||||
case 0x01:
|
||||
printf(" (SFF-8431 appendix E)");
|
||||
break;
|
||||
case 0x04:
|
||||
printf(" (SFF-8431 limiting)");
|
||||
break;
|
||||
default:
|
||||
printf(" (unknown)");
|
||||
break;
|
||||
}
|
||||
printf(" [SFF-8472 rev10.4 only]\n");
|
||||
} else {
|
||||
printf("\t%-41s : %unm\n", "Laser wavelength",
|
||||
(id[60] << 8) | id[61]);
|
||||
}
|
||||
}
|
||||
|
||||
static void sff8079_show_value_with_unit(const __u8 *id, unsigned int reg,
|
||||
const char *name, unsigned int mult,
|
||||
const char *unit)
|
||||
{
|
||||
unsigned int val = id[reg];
|
||||
|
||||
printf("\t%-41s : %u%s\n", name, val * mult, unit);
|
||||
}
|
||||
|
||||
static void sff8079_show_ascii(const __u8 *id, unsigned int first_reg,
|
||||
unsigned int last_reg, const char *name)
|
||||
{
|
||||
unsigned int reg, val;
|
||||
|
||||
printf("\t%-41s : ", name);
|
||||
while (first_reg <= last_reg && id[last_reg] == ' ')
|
||||
last_reg--;
|
||||
for (reg = first_reg; reg <= last_reg; reg++) {
|
||||
val = id[reg];
|
||||
putchar(((val >= 32) && (val <= 126)) ? val : '_');
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void sff8079_show_options(const __u8 *id)
|
||||
{
|
||||
static const char *pfx =
|
||||
"\tOption :";
|
||||
|
||||
printf("\t%-41s : 0x%02x 0x%02x\n", "Option values", id[64], id[65]);
|
||||
if (id[65] & (1 << 1))
|
||||
printf("%s RX_LOS implemented\n", pfx);
|
||||
if (id[65] & (1 << 2))
|
||||
printf("%s RX_LOS implemented, inverted\n", pfx);
|
||||
if (id[65] & (1 << 3))
|
||||
printf("%s TX_FAULT implemented\n", pfx);
|
||||
if (id[65] & (1 << 4))
|
||||
printf("%s TX_DISABLE implemented\n", pfx);
|
||||
if (id[65] & (1 << 5))
|
||||
printf("%s RATE_SELECT implemented\n", pfx);
|
||||
if (id[65] & (1 << 6))
|
||||
printf("%s Tunable transmitter technology\n", pfx);
|
||||
if (id[65] & (1 << 7))
|
||||
printf("%s Receiver decision threshold implemented\n", pfx);
|
||||
if (id[64] & (1 << 0))
|
||||
printf("%s Linear receiver output implemented\n", pfx);
|
||||
if (id[64] & (1 << 1))
|
||||
printf("%s Power level 2 requirement\n", pfx);
|
||||
if (id[64] & (1 << 2))
|
||||
printf("%s Cooled transceiver implemented\n", pfx);
|
||||
if (id[64] & (1 << 3))
|
||||
printf("%s Retimer or CDR implemented\n", pfx);
|
||||
if (id[64] & (1 << 4))
|
||||
printf("%s Paging implemented\n", pfx);
|
||||
if (id[64] & (1 << 5))
|
||||
printf("%s Power level 3 requirement\n", pfx);
|
||||
}
|
||||
|
||||
void sff8079_show_all(const __u8 *id)
|
||||
{
|
||||
sff8079_show_identifier(id);
|
||||
if (((id[0] == 0x02) || (id[0] == 0x03)) && (id[1] == 0x04)) {
|
||||
unsigned int br_nom, br_min, br_max;
|
||||
|
||||
if (id[12] == 0) {
|
||||
br_nom = br_min = br_max = 0;
|
||||
} else if (id[12] == 255) {
|
||||
br_nom = id[66] * 250;
|
||||
br_max = id[67];
|
||||
br_min = id[67];
|
||||
} else {
|
||||
br_nom = id[12] * 100;
|
||||
br_max = id[66];
|
||||
br_min = id[67];
|
||||
}
|
||||
sff8079_show_ext_identifier(id);
|
||||
sff8079_show_connector(id);
|
||||
sff8079_show_transceiver(id);
|
||||
sff8079_show_encoding(id);
|
||||
printf("\t%-41s : %u%s\n", "BR, Nominal", br_nom, "MBd");
|
||||
sff8079_show_rate_identifier(id);
|
||||
sff8079_show_value_with_unit(id, 14,
|
||||
"Length (SMF,km)", 1, "km");
|
||||
sff8079_show_value_with_unit(id, 15, "Length (SMF)", 100, "m");
|
||||
sff8079_show_value_with_unit(id, 16, "Length (50um)", 10, "m");
|
||||
sff8079_show_value_with_unit(id, 17,
|
||||
"Length (62.5um)", 10, "m");
|
||||
sff8079_show_value_with_unit(id, 18, "Length (Copper)", 1, "m");
|
||||
sff8079_show_value_with_unit(id, 19, "Length (OM3)", 10, "m");
|
||||
sff8079_show_wavelength_or_copper_compliance(id);
|
||||
sff8079_show_ascii(id, 20, 35, "Vendor name");
|
||||
sff8079_show_oui(id);
|
||||
sff8079_show_ascii(id, 40, 55, "Vendor PN");
|
||||
sff8079_show_ascii(id, 56, 59, "Vendor rev");
|
||||
sff8079_show_options(id);
|
||||
printf("\t%-41s : %u%s\n", "BR margin, max", br_max, "%");
|
||||
printf("\t%-41s : %u%s\n", "BR margin, min", br_min, "%");
|
||||
sff8079_show_ascii(id, 68, 83, "Vendor SN");
|
||||
sff8079_show_ascii(id, 84, 91, "Date code");
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,91 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal.h"
|
||||
|
||||
int smsc911x_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
unsigned int *smsc_reg = (unsigned int *)regs->data;
|
||||
|
||||
fprintf(stdout, "LAN911x Registers\n");
|
||||
fprintf(stdout, "offset 0x50, ID_REV = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x54, INT_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x58, INT_STS = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x5C, INT_EN = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x60, RESERVED = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x64, BYTE_TEST = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x68, FIFO_INT = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x6C, RX_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x70, TX_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x74, HW_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x78, RX_DP_CTRL = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x7C, RX_FIFO_INF = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x80, TX_FIFO_INF = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x84, PMT_CTRL = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x88, GPIO_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x8C, GPT_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x90, GPT_CNT = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x94, FPGA_REV = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x98, ENDIAN = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0x9C, FREE_RUN = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0xA0, RX_DROP = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0xA4, MAC_CSR_CMD = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0xA8, MAC_CSR_DATA = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0xAC, AFC_CFG = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0xB0, E2P_CMD = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "offset 0xB4, E2P_DATA = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "MAC Registers\n");
|
||||
fprintf(stdout, "index 1, MAC_CR = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 2, ADDRH = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 3, ADDRL = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 4, HASHH = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 5, HASHL = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 6, MII_ACC = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 7, MII_DATA = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 8, FLOW = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 9, VLAN1 = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index A, VLAN2 = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index B, WUFF = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index C, WUCSR = 0x%08X\n",*smsc_reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "PHY Registers\n");
|
||||
fprintf(stdout, "index 0, Basic Control Reg = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 1, Basic Status Reg = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 2, PHY identifier 1 = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 3, PHY identifier 2 = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 4, Auto Negotiation Advertisement Reg = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 5, Auto Negotiation Link Partner Ability Reg = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 6, Auto Negotiation Expansion Register = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 7, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 8, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 9, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 10, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 11, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 12, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 13, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 14, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 15, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 16, Silicon Revision Reg = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 17, Mode Control/Status Reg = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 18, Special Modes = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 19, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 20, TSTCNTL = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 21, TSTREAD1 = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 22, TSTREAD2 = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 23, TSTWRITE = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 24, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 25, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 26, Reserved = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 27, Control/Status Indication = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 28, Special internal testability = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 29, Interrupt Source Register = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 30, Interrupt Mask Register = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "index 31, PHY Special Control/Status Register = 0x%04X\n",*smsc_reg++);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/****************************************************************************
|
||||
* Support for the Synopsys MAC 10/100/1000 on-chip Ethernet controllers
|
||||
*
|
||||
* Copyright (C) 2007-2009 STMicroelectronics Ltd
|
||||
*
|
||||
* Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define MAC100_DMA_REG_NUM 9
|
||||
#define GMAC_REG_NUM 55
|
||||
#define GMAC_DMA_REG_NUM 23
|
||||
|
||||
int st_mac100_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
int i;
|
||||
unsigned int *stmmac_reg = (unsigned int *)regs->data;
|
||||
|
||||
fprintf(stdout, "ST MAC 10/100 Registers\n");
|
||||
fprintf(stdout, "control reg 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "addr HI 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "addr LO 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "multicast hash HI 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "multicast hash LO 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "MII addr 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "MII data %08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "flow control 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "VLAN1 tag 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "VLAN2 tag 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "mac wakeup frame 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "mac wakeup crtl 0x%08X\n", *stmmac_reg++);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "DMA Registers\n");
|
||||
for (i = 0; i < MAC100_DMA_REG_NUM; i++)
|
||||
fprintf(stdout, "CSR%d 0x%08X\n", i, *stmmac_reg++);
|
||||
|
||||
fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
|
||||
fprintf(stdout, "DMA cur rx buf addr 0x%08X\n", *stmmac_reg++);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int st_gmac_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
int i;
|
||||
unsigned int *stmmac_reg = (unsigned int *)regs->data;
|
||||
|
||||
fprintf(stdout, "ST GMAC Registers\n");
|
||||
fprintf(stdout, "GMAC Registers\n");
|
||||
for (i = 0; i < GMAC_REG_NUM; i++)
|
||||
fprintf(stdout, "Reg%d 0x%08X\n", i, *stmmac_reg++);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "DMA Registers\n");
|
||||
for (i = 0; i < GMAC_DMA_REG_NUM; i++)
|
||||
fprintf(stdout, "Reg%d 0x%08X\n", i, *stmmac_reg++);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
/****************************************************************************
|
||||
* Test cases for ethtool command-line parsing
|
||||
* Copyright 2011 Solarflare Communications Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define TEST_NO_WRAPPERS
|
||||
#include "internal.h"
|
||||
|
||||
static struct test_case {
|
||||
int rc;
|
||||
const char *args;
|
||||
} test_cases[] = {
|
||||
{ 1, "" },
|
||||
{ 0, "devname" },
|
||||
{ 0, "15_char_devname" },
|
||||
{ 1, "16_char_devname!" },
|
||||
/* Argument parsing for -s is specialised */
|
||||
{ 0, "-s devname" },
|
||||
{ 0, "--change devname speed 100 duplex half mdix auto" },
|
||||
{ 1, "-s devname speed foo" },
|
||||
{ 1, "--change devname speed" },
|
||||
{ 0, "-s devname duplex half" },
|
||||
{ 1, "--change devname duplex foo" },
|
||||
{ 1, "-s devname duplex" },
|
||||
{ 1, "--change devname mdix foo" },
|
||||
{ 1, "-s devname mdix" },
|
||||
{ 0, "--change devname port tp" },
|
||||
{ 1, "-s devname port foo" },
|
||||
{ 1, "--change devname port" },
|
||||
{ 0, "-s devname autoneg on" },
|
||||
{ 1, "--change devname autoneg foo" },
|
||||
{ 1, "-s devname autoneg" },
|
||||
{ 0, "--change devname advertise 0x1" },
|
||||
{ 0, "--change devname advertise 0xf" },
|
||||
{ 0, "--change devname advertise 0Xf" },
|
||||
{ 0, "--change devname advertise 1" },
|
||||
{ 0, "--change devname advertise f" },
|
||||
{ 0, "--change devname advertise 01" },
|
||||
{ 0, "--change devname advertise 0f" },
|
||||
{ 0, "--change devname advertise 0xfffffffffffffffffffffffffffffffff" },
|
||||
{ 0, "--change devname advertise fffffffffffffffffffffffffffffffff" },
|
||||
{ 0, "--change devname advertise 0x0000fffffffffffffffffffffffffffff" },
|
||||
{ 0, "--change devname advertise 0000fffffffffffffffffffffffffffff" },
|
||||
{ 1, "-s devname advertise" },
|
||||
{ 1, "-s devname advertise 0x" },
|
||||
{ 1, "-s devname advertise foo" },
|
||||
{ 1, "-s devname advertise 0xfoo" },
|
||||
{ 1, "--change devname advertise" },
|
||||
{ 0, "-s devname phyad 1" },
|
||||
{ 1, "--change devname phyad foo" },
|
||||
{ 1, "-s devname phyad" },
|
||||
{ 0, "--change devname xcvr external" },
|
||||
{ 1, "-s devname xcvr foo" },
|
||||
{ 1, "--change devname xcvr" },
|
||||
{ 0, "-s devname wol p" },
|
||||
{ 1, "--change devname wol" },
|
||||
{ 0, "-s devname sopass 01:23:45:67:89:ab" },
|
||||
{ 1, "--change devname sopass 01:23:45:67:89:" },
|
||||
{ 1, "-s devname sopass 01:23:45:67:89" },
|
||||
{ 1, "--change devname sopass" },
|
||||
{ 0, "-s devname msglvl 1" },
|
||||
{ 1, "--change devname msglvl" },
|
||||
{ 0, "-s devname msglvl hw on rx_status off" },
|
||||
{ 1, "--change devname msglvl hw foo" },
|
||||
{ 1, "-s devname msglvl hw" },
|
||||
{ 0, "--change devname speed 100 duplex half port tp autoneg on advertise 0x1 phyad 1 xcvr external wol p sopass 01:23:45:67:89:ab msglvl 1" },
|
||||
{ 1, "-s devname foo" },
|
||||
{ 1, "-s" },
|
||||
{ 0, "-a devname" },
|
||||
{ 0, "--show-pause devname" },
|
||||
{ 1, "-a" },
|
||||
/* Many other sub-commands use parse_generic_cmdline() and
|
||||
* don't need to be check in that much detail. */
|
||||
{ 0, "-A devname autoneg on" },
|
||||
{ 1, "--pause devname autoneg foo" },
|
||||
{ 1, "-A devname autoneg" },
|
||||
{ 0, "--pause devname rx off" },
|
||||
{ 0, "-A devname tx on rx on autoneg off" },
|
||||
{ 1, "--pause devname foo on" },
|
||||
{ 1, "-A" },
|
||||
{ 0, "-c devname" },
|
||||
{ 0, "--show-coalesce devname" },
|
||||
{ 0, "-C devname adaptive-rx on adaptive-tx off rx-usecs 1 rx-frames 2 rx-usecs-irq 3 rx-frames-irq 4 tx-usecs 5 tx-frames 6 tx-usecs-irq 7 tx-frames-irq 8 stats-block-usecs 9 pkt-rate-low 10" },
|
||||
{ 0, "--coalesce devname rx-usecs-low 11 rx-frames-low 12 tx-usecs-low 13 tx-frames-low 14 pkt-rate-high 15 rx-usecs-high 16 rx-frames-high 17 tx-usecs-high 18 tx-frames-high 19 sample-interval 20" },
|
||||
{ 1, "-C devname adaptive-rx foo" },
|
||||
{ 1, "--coalesce devname adaptive-rx" },
|
||||
{ 1, "-C devname foo on" },
|
||||
{ 1, "-C" },
|
||||
{ 0, "-g devname" },
|
||||
{ 0, "--show-ring devname" },
|
||||
{ 1, "-g" },
|
||||
{ 0, "-G devname rx 1 rx-mini 2 rx-jumbo 3 tx 4" },
|
||||
{ 0, "--set-ring devname rx 1 rx-mini 2 rx-jumbo 3 tx 4" },
|
||||
{ 1, "-G devname rx foo" },
|
||||
{ 1, "--set-ring devname rx" },
|
||||
{ 1, "-G devname foo 1" },
|
||||
{ 1, "-G" },
|
||||
{ 1, "-k" },
|
||||
{ 1, "-K" },
|
||||
{ 0, "-i devname" },
|
||||
{ 0, "--driver devname" },
|
||||
{ 1, "-i" },
|
||||
{ 0, "-d devname" },
|
||||
{ 0, "--register-dump devname raw on file foo" },
|
||||
{ 1, "-d devname raw foo" },
|
||||
{ 1, "--register-dump devname file" },
|
||||
{ 1, "-d devname foo" },
|
||||
{ 1, "-d" },
|
||||
{ 0, "-e devname" },
|
||||
{ 0, "--eeprom-dump devname raw on offset 1 length 2" },
|
||||
{ 1, "-e devname raw foo" },
|
||||
{ 1, "--eeprom-dump devname offset foo" },
|
||||
{ 1, "-e devname length" },
|
||||
{ 1, "--eeprom-dump devname foo" },
|
||||
{ 1, "-e" },
|
||||
{ 0, "-E devname" },
|
||||
{ 0, "--change-eeprom devname magic 0x87654321 offset 0 value 1" },
|
||||
{ 0, "-E devname magic 0x87654321 offset 0 length 2" },
|
||||
{ 1, "-E" },
|
||||
{ 0, "-r devname" },
|
||||
{ 0, "--negotiate devname" },
|
||||
{ 1, "-r" },
|
||||
{ 0, "-p devname" },
|
||||
{ 0, "--identify devname 1" },
|
||||
{ 1, "-p devname 1 foo" },
|
||||
{ 1, "--identify devname foo" },
|
||||
{ 1, "-p" },
|
||||
/* Argument parsing for -t is specialised */
|
||||
{ 0, "-t devname" },
|
||||
{ 0, "--test devname online" },
|
||||
{ 1, "-t devname foo" },
|
||||
{ 1, "--test devname online foo" },
|
||||
{ 0, "-S devname" },
|
||||
{ 0, "--statistics devname" },
|
||||
{ 1, "-S" },
|
||||
/* Argument parsing for -n/-u is specialised */
|
||||
{ 0, "-n devname rx-flow-hash tcp4" },
|
||||
{ 0, "-u devname rx-flow-hash sctp4" },
|
||||
{ 0, "--show-nfc devname rx-flow-hash udp6" },
|
||||
{ 0, "--show-ntuple devname rx-flow-hash esp6" },
|
||||
{ 1, "-n devname rx-flow-hash foo" },
|
||||
{ 1, "-u devname rx-flow-hash foo" },
|
||||
{ 1, "--show-nfc devname rx-flow-hash" },
|
||||
{ 1, "--show-ntuple devname rx-flow-hash" },
|
||||
{ 1, "-n" },
|
||||
/* Argument parsing for -f is specialised */
|
||||
{ 1, "-f devname" },
|
||||
{ 0, "--flash devname filename" },
|
||||
{ 0, "-f devname filename 1" },
|
||||
{ 1, "-f devname filename 1 foo" },
|
||||
{ 1, "-f" },
|
||||
/* Argument parsing for -N/-U is specialised */
|
||||
{ 0, "-N devname rx-flow-hash tcp4 mvtsdfn" },
|
||||
{ 0, "--config-ntuple devname rx-flow-hash tcp4 r" },
|
||||
{ 1, "-U devname rx-flow-hash tcp4" },
|
||||
{ 1, "--config-nfc devname rx-flow-hash foo" },
|
||||
{ 1, "-N devname rx-flow-hash" },
|
||||
{ 1, "--config-ntuple devname foo" },
|
||||
{ 0, "-U devname delete 1" },
|
||||
{ 1, "--config-nfc devname delete foo" },
|
||||
{ 1, "-N devname delete" },
|
||||
{ 0, "--config-ntuple devname flow-type ether src 01:23:45:67:89:ab m cd:ef:01:23:45:67 dst 89:ab:cd:ef:01:23 m 45:67:89:ab:cd:ef proto 0x0123 m 0x4567 vlan 0x89ab m 0xcdef action 0" },
|
||||
{ 0, "-U devname flow-type ether src 01:23:45:67:89:ab src-mask cd:ef:01:23:45:67 dst 89:ab:cd:ef:01:23 dst-mask 45:67:89:ab:cd:ef proto 0x0123 proto-mask 0x4567 vlan 0x89ab vlan-mask 0xcdef action 1" },
|
||||
{ 1, "--config-nfc devname flow-type ether src 01:23:45:67:89: action 3" },
|
||||
{ 1, "-N devname flow-type ether src 01:23:45:67:89 action 4" },
|
||||
{ 0, "--config-ntuple devname flow-type ip4 src-ip 0.123.45.67 m 89.0.123.45 dst-ip 67.89.0.123 m 45.67.89.0 tos 1 m 1 l4proto 0x23 m 0x45 l4data 0xfedcba98 m 76543210 vlan 0x89ab m 0xcdef action 6" },
|
||||
{ 0, "-U devname flow-type ip4 src-ip 0.123.45.67 src-ip-mask 89.0.123.45 dst-ip 67.89.0.123 dst-ip-mask 45.67.89.0 tos 1 tos-mask 1 l4proto 0x23 l4proto-mask 0x45 l4data 0xfedcba98 l4data-mask 76543210 vlan 0x89ab vlan-mask 0xcdef action 7" },
|
||||
{ 0, "--config-nfc devname flow-type tcp4 src-ip 0.123.45.67 m 89.0.123.45 dst-ip 67.89.0.123 m 45.67.89.0 tos 1 m 1 src-port 23456 m 7890 dst-port 12345 m 6789 vlan 0x89ab m 0xcdef action 8" },
|
||||
{ 0, "-N devname flow-type tcp4 src-ip 0.123.45.67 src-ip-mask 89.0.123.45 dst-ip 67.89.0.123 dst-ip-mask 45.67.89.0 tos 1 tos-mask 1 src-port 23456 src-port-mask 7890 dst-port 12345 dst-port-mask 6789 vlan 0x89ab vlan-mask 0xcdef action 9" },
|
||||
{ 0, "--config-ntuple devname flow-type ah4 src-ip 0.123.45.67 m 89.0.123.45 dst-ip 67.89.0.123 m 45.67.89.0 tos 1 m 1 spi 2 m 3 vlan 0x89ab m 0xcdef action 10" },
|
||||
{ 0, "-U devname flow-type ah4 src-ip 0.123.45.67 src-ip-mask 89.0.123.45 dst-ip 67.89.0.123 dst-ip-mask 45.67.89.0 tos 1 tos-mask 1 spi 2 spi-mask 3 vlan 0x89ab vlan-mask 0xcdef action 11" },
|
||||
{ 1, "--config-nfc devname flow-type tcp4 action foo" },
|
||||
{ 1, "-N devname flow-type foo" },
|
||||
{ 1, "--config-ntuple devname flow-type" },
|
||||
{ 1, "-U devname foo" },
|
||||
{ 1, "-N" },
|
||||
{ 1, "-U" },
|
||||
{ 0, "-T devname" },
|
||||
{ 0, "--show-time-stamping devname" },
|
||||
{ 1, "-T" },
|
||||
{ 0, "-x devname" },
|
||||
{ 0, "--show-rxfh-indir devname" },
|
||||
{ 0, "--show-rxfh devname" },
|
||||
{ 1, "-x" },
|
||||
/* Argument parsing for -X is specialised */
|
||||
{ 0, "-X devname equal 2" },
|
||||
{ 0, "--set-rxfh-indir devname equal 256" },
|
||||
{ 1, "-X devname equal 0" },
|
||||
{ 1, "--set-rxfh-indir devname equal foo" },
|
||||
{ 1, "-X devname equal" },
|
||||
{ 1, "-X devname start" },
|
||||
{ 1, "-X devname start 3" },
|
||||
{ 0, "-X devname start 4 equal 2" },
|
||||
{ 0, "--set-rxfh-indir devname weight 1 2 3 4" },
|
||||
{ 0, "--set-rxfh-indir devname start 4 weight 1 2 3 4" },
|
||||
{ 0, "--rxfh devname hkey 48:15:6e:bb:d8:bd:6f:b1:a4:c6:7a:c4:76:1c:29:98:da:e1:ae:6c:2e:12:2f:c0:b9:be:61:3d:00:54:35:9e:09:05:c7:d7:93:72:4a:ee" },
|
||||
{ 0, "-X devname hkey 48:15:6e:bb:d8:bd:6f:b1:a4:c6:7a:c4:76:1c:29:98:da:e1:ae:6c:2e:12:2f:c0:b9:be:61:3d:00:54:35:9e:09:05:c7:d7:93:72:4a:ee" },
|
||||
#if 0
|
||||
/* XXX These won't fail as expected because we don't parse the
|
||||
* hash key until after the first send_ioctl(). That needs to
|
||||
* be changed before we enable them.
|
||||
*/
|
||||
{ 1, "--rxfh devname hkey foo" },
|
||||
{ 1, "-X devname hkey foo" },
|
||||
#endif
|
||||
{ 0, "--rxfh devname hkey 48:15:6e:bb:d8:bd:6f:b1:a4:c6:7a:c4:76:1c:29:98:da:e1:ae:6c:2e:12:2f:c0:b9:be:61:3d:00:54:35:9e:09:05:c7:d7:93:72:4a:ee weight 1 2 3 4" },
|
||||
{ 0, "-X devname weight 1 2 3 4 hkey 48:15:6e:bb:d8:bd:6f:b1:a4:c6:7a:c4:76:1c:29:98:da:e1:ae:6c:2e:12:2f:c0:b9:be:61:3d:00:54:35:9e:09:05:c7:d7:93:72:4a:ee" },
|
||||
{ 0, "--rxfh devname hkey 48:15:6e:bb:d8:bd:6f:b1:a4:c6:7a:c4:76:1c:29:98:da:e1:ae:6c:2e:12:2f:c0:b9:be:61:3d:00:54:35:9e:09:05:c7:d7:93:72:4a:ee equal 2" },
|
||||
{ 0, "-X devname equal 2 hkey 48:15:6e:bb:d8:bd:6f:b1:a4:c6:7a:c4:76:1c:29:98:da:e1:ae:6c:2e:12:2f:c0:b9:be:61:3d:00:54:35:9e:09:05:c7:d7:93:72:4a:ee" },
|
||||
{ 1, "--rxfh devname weight 1 2 3 4 equal 8" },
|
||||
{ 1, "-X devname weight 1 2 3 4 equal 8" },
|
||||
{ 1, "-X devname foo" },
|
||||
{ 1, "-X" },
|
||||
{ 0, "-P devname" },
|
||||
{ 0, "--show-permaddr devname" },
|
||||
{ 1, "-P" },
|
||||
{ 0, "-w devname" },
|
||||
{ 0, "--get-dump devname data filename" },
|
||||
{ 0, "-w devname data filename" },
|
||||
{ 1, "--get-dump devname data" },
|
||||
{ 1, "-w devname foo" },
|
||||
{ 1, "-w" },
|
||||
{ 0, "-W devname 1" },
|
||||
{ 0, "--set-dump devname 2" },
|
||||
{ 1, "-W devname 1 foo" },
|
||||
{ 1, "-W devname foo" },
|
||||
{ 1, "-W" },
|
||||
{ 0, "-l devname" },
|
||||
{ 0, "--show-channels devname" },
|
||||
{ 1, "-l" },
|
||||
{ 0, "-L devname rx 1 tx 2 other 3 combined 4" },
|
||||
{ 0, "--set-channels devname rx 1 tx 2 other 3 combined 4" },
|
||||
{ 1, "-L devname rx foo" },
|
||||
{ 1, "--set-channels devname rx" },
|
||||
{ 0, "-L devname" },
|
||||
{ 1, "-L" },
|
||||
{ 0, "--show-priv-flags devname" },
|
||||
{ 1, "--show-priv-flags devname foo" },
|
||||
{ 1, "--show-priv-flags" },
|
||||
{ 1, "-m" },
|
||||
{ 0, "-m devname" },
|
||||
{ 1, "--dump-module-eeprom" },
|
||||
{ 0, "--dump-module-eeprom devname" },
|
||||
{ 1, "--module-info" },
|
||||
{ 0, "--module-info devname" },
|
||||
{ 0, "-m devname raw on" },
|
||||
{ 0, "-m devname raw off" },
|
||||
{ 0, "-m devname hex on" },
|
||||
{ 0, "-m devname hex off" },
|
||||
{ 1, "-m devname hex on raw on" },
|
||||
{ 0, "-m devname offset 4 length 6" },
|
||||
{ 1, "--show-eee" },
|
||||
{ 0, "--show-eee devname" },
|
||||
{ 1, "--show-eee devname foo" },
|
||||
{ 1, "--set-eee" },
|
||||
{ 1, "--set-eee devname" },
|
||||
{ 1, "--set-eee devname foo" },
|
||||
{ 0, "--set-eee devname eee on" },
|
||||
{ 0, "--set-eee devname eee off" },
|
||||
{ 1, "--set-eee devname eee foo" },
|
||||
{ 0, "--set-eee devname tx-lpi on" },
|
||||
{ 0, "--set-eee devname tx-lpi off" },
|
||||
{ 1, "--set-eee devname tx-lpi foo" },
|
||||
{ 0, "--set-eee devname tx-timer 42 advertise 0x4321" },
|
||||
{ 1, "--set-eee devname tx-timer foo" },
|
||||
{ 1, "--set-eee devname advertise foo" },
|
||||
{ 1, "--set-fec devname" },
|
||||
{ 0, "--set-fec devname encoding auto" },
|
||||
{ 0, "--set-fec devname encoding off" },
|
||||
{ 0, "--set-fec devname encoding baser rs" },
|
||||
{ 0, "--set-fec devname encoding auto auto" },
|
||||
{ 1, "--set-fec devname encoding foo" },
|
||||
{ 1, "--set-fec devname encoding auto foo" },
|
||||
{ 1, "--set-fec devname encoding none" },
|
||||
{ 1, "--set-fec devname auto" },
|
||||
/* can't test --set-priv-flags yet */
|
||||
{ 0, "-h" },
|
||||
{ 0, "--help" },
|
||||
{ 0, "--version" },
|
||||
{ 1, "--foo" },
|
||||
{ 1, "-foo" },
|
||||
{ 1, "-0" },
|
||||
};
|
||||
|
||||
int send_ioctl(struct cmd_context *ctx, void *cmd)
|
||||
{
|
||||
/* If we get this far then parsing succeeded */
|
||||
test_exit(0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct test_case *tc;
|
||||
int test_rc;
|
||||
int rc = 0;
|
||||
|
||||
for (tc = test_cases; tc < test_cases + ARRAY_SIZE(test_cases); tc++) {
|
||||
if (getenv("ETHTOOL_TEST_VERBOSE"))
|
||||
printf("I: Test command line: ethtool %s\n", tc->args);
|
||||
test_rc = test_cmdline(tc->args);
|
||||
if (test_rc != tc->rc) {
|
||||
fprintf(stderr, "E: ethtool %s returns %d\n",
|
||||
tc->args, test_rc);
|
||||
rc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
|
@ -0,0 +1,383 @@
|
|||
/****************************************************************************
|
||||
* Common test functions for ethtool
|
||||
* Copyright 2011 Solarflare Communications Inc.
|
||||
*
|
||||
* Partly derived from kernel <linux/list.h>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <unistd.h>
|
||||
#define TEST_NO_WRAPPERS
|
||||
#include "internal.h"
|
||||
|
||||
/* List utilities */
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next, *prev;
|
||||
};
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
|
||||
static void init_list_head(struct list_head *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static void list_add(struct list_head *new, struct list_head *head)
|
||||
{
|
||||
head->next->prev = new;
|
||||
new->next = head->next;
|
||||
new->prev = head;
|
||||
head->next = new;
|
||||
}
|
||||
|
||||
static void list_del(struct list_head *entry)
|
||||
{
|
||||
entry->next->prev = entry->prev;
|
||||
entry->prev->next = entry->next;
|
||||
entry->next = NULL;
|
||||
entry->prev = NULL;
|
||||
}
|
||||
|
||||
#define list_for_each_safe(pos, n, head) \
|
||||
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||
pos = n, n = pos->next)
|
||||
|
||||
/* Free memory at end of test */
|
||||
|
||||
static struct list_head malloc_list = LIST_HEAD_INIT(malloc_list);
|
||||
|
||||
void *test_malloc(size_t size)
|
||||
{
|
||||
struct list_head *block = malloc(sizeof(*block) + size);
|
||||
|
||||
if (!block)
|
||||
return NULL;
|
||||
list_add(block, &malloc_list);
|
||||
return block + 1;
|
||||
}
|
||||
|
||||
void *test_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *ptr = test_malloc(nmemb * size);
|
||||
|
||||
if (ptr)
|
||||
memset(ptr, 0, nmemb * size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
char *test_strdup(const char *s)
|
||||
{
|
||||
size_t size = strlen(s) + 1;
|
||||
char *dup = test_malloc(size);
|
||||
|
||||
if (dup)
|
||||
memcpy(dup, s, size);
|
||||
return dup;
|
||||
}
|
||||
|
||||
void test_free(void *ptr)
|
||||
{
|
||||
struct list_head *block;
|
||||
|
||||
if (!ptr)
|
||||
return;
|
||||
block = (struct list_head *)ptr - 1;
|
||||
list_del(block);
|
||||
free(block);
|
||||
}
|
||||
|
||||
void *test_realloc(void *ptr, size_t size)
|
||||
{
|
||||
struct list_head *block = NULL;
|
||||
|
||||
if (ptr) {
|
||||
block = (struct list_head *)ptr - 1;
|
||||
list_del(block);
|
||||
}
|
||||
block = realloc(block, sizeof(*block) + size);
|
||||
if (!block)
|
||||
return NULL;
|
||||
list_add(block, &malloc_list);
|
||||
return block + 1;
|
||||
}
|
||||
|
||||
static void test_free_all(void)
|
||||
{
|
||||
struct list_head *block, *next;
|
||||
|
||||
list_for_each_safe(block, next, &malloc_list)
|
||||
free(block);
|
||||
init_list_head(&malloc_list);
|
||||
}
|
||||
|
||||
/* Close files at end of test */
|
||||
|
||||
struct file_node {
|
||||
struct list_head link;
|
||||
FILE *fh;
|
||||
int fd;
|
||||
};
|
||||
|
||||
static struct list_head file_list = LIST_HEAD_INIT(file_list);
|
||||
|
||||
int test_open(const char *pathname, int flag, ...)
|
||||
{
|
||||
struct file_node *node;
|
||||
mode_t mode;
|
||||
|
||||
if (flag & O_CREAT) {
|
||||
va_list ap;
|
||||
va_start(ap, flag);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
} else {
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
node = malloc(sizeof(*node));
|
||||
if (!node)
|
||||
return -1;
|
||||
|
||||
node->fd = open(pathname, flag, mode);
|
||||
if (node->fd < 0) {
|
||||
free(node);
|
||||
return -1;
|
||||
}
|
||||
|
||||
node->fh = NULL;
|
||||
list_add(&node->link, &file_list);
|
||||
return node->fd;
|
||||
}
|
||||
|
||||
int test_socket(int domain, int type, int protocol)
|
||||
{
|
||||
struct file_node *node;
|
||||
|
||||
node = malloc(sizeof(*node));
|
||||
if (!node)
|
||||
return -1;
|
||||
|
||||
node->fd = socket(domain, type, protocol);
|
||||
if (node->fd < 0) {
|
||||
free(node);
|
||||
return -1;
|
||||
}
|
||||
|
||||
node->fh = NULL;
|
||||
list_add(&node->link, &file_list);
|
||||
return node->fd;
|
||||
}
|
||||
|
||||
int test_close(int fd)
|
||||
{
|
||||
struct list_head *head, *next;
|
||||
|
||||
if (fd >= 0) {
|
||||
list_for_each_safe(head, next, &file_list) {
|
||||
if (((struct file_node *)head)->fd == fd) {
|
||||
list_del(head);
|
||||
free(head);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
FILE *test_fopen(const char *path, const char *mode)
|
||||
{
|
||||
struct file_node *node;
|
||||
|
||||
node = malloc(sizeof(*node));
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
node->fh = fopen(path, mode);
|
||||
if (!node->fh) {
|
||||
free(node);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node->fd = -1;
|
||||
list_add(&node->link, &file_list);
|
||||
return node->fh;
|
||||
}
|
||||
|
||||
int test_fclose(FILE *fh)
|
||||
{
|
||||
struct list_head *head, *next;
|
||||
|
||||
assert(fh);
|
||||
|
||||
list_for_each_safe(head, next, &file_list) {
|
||||
if (((struct file_node *)head)->fh == fh) {
|
||||
list_del(head);
|
||||
free(head);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return fclose(fh);
|
||||
}
|
||||
|
||||
static void test_close_all(void)
|
||||
{
|
||||
struct list_head *head, *next;
|
||||
struct file_node *node;
|
||||
|
||||
list_for_each_safe(head, next, &file_list) {
|
||||
node = (struct file_node *)head;
|
||||
if (node->fh)
|
||||
fclose(node->fh);
|
||||
else
|
||||
close(node->fd);
|
||||
free(node);
|
||||
}
|
||||
init_list_head(&file_list);
|
||||
}
|
||||
|
||||
/* Wrap test main function */
|
||||
|
||||
static jmp_buf test_return;
|
||||
static FILE *orig_stderr;
|
||||
|
||||
void test_exit(int rc)
|
||||
{
|
||||
longjmp(test_return, rc + 1);
|
||||
}
|
||||
|
||||
int test_ioctl(const struct cmd_expect *expect, void *cmd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!expect->cmd || *(u32 *)cmd != *(const u32 *)expect->cmd) {
|
||||
/* We have no idea how long this command structure is */
|
||||
fprintf(orig_stderr, "Unexpected ioctl: cmd=%#10x\n",
|
||||
*(u32 *)cmd);
|
||||
return TEST_IOCTL_MISMATCH;
|
||||
}
|
||||
|
||||
if (memcmp(cmd, expect->cmd, expect->cmd_len)) {
|
||||
fprintf(orig_stderr, "Expected ioctl structure:\n");
|
||||
dump_hex(orig_stderr, expect->cmd, expect->cmd_len, 0);
|
||||
fprintf(orig_stderr, "Actual ioctl structure:\n");
|
||||
dump_hex(orig_stderr, cmd, expect->cmd_len, 0);
|
||||
return TEST_IOCTL_MISMATCH;
|
||||
}
|
||||
|
||||
if (expect->resp)
|
||||
memcpy(cmd, expect->resp, expect->resp_len);
|
||||
rc = expect->rc;
|
||||
|
||||
/* Convert kernel return code according to libc convention */
|
||||
if (rc >= 0) {
|
||||
return rc;
|
||||
} else {
|
||||
errno = -rc;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int test_cmdline(const char *args)
|
||||
{
|
||||
int argc, i;
|
||||
char **argv;
|
||||
const char *arg;
|
||||
size_t len;
|
||||
int dev_null = -1, orig_stdout_fd = -1, orig_stderr_fd = -1;
|
||||
int rc;
|
||||
|
||||
/* Convert line to argv */
|
||||
argc = 1;
|
||||
arg = args;
|
||||
for (;;) {
|
||||
len = strcspn(arg, " ");
|
||||
if (len == 0)
|
||||
break;
|
||||
argc++;
|
||||
if (arg[len] == 0)
|
||||
break;
|
||||
arg += len + 1;
|
||||
}
|
||||
argv = test_calloc(argc + 1, sizeof(argv[0]));
|
||||
argv[0] = test_strdup("ethtool");
|
||||
arg = args;
|
||||
for (i = 1; i < argc; i++) {
|
||||
len = strcspn(arg, " ");
|
||||
argv[i] = test_malloc(len + 1);
|
||||
memcpy(argv[i], arg, len);
|
||||
argv[i][len] = 0;
|
||||
arg += len + 1;
|
||||
}
|
||||
|
||||
dev_null = open("/dev/null", O_RDWR);
|
||||
if (dev_null < 0) {
|
||||
perror("open /dev/null");
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
fflush(NULL);
|
||||
dup2(dev_null, STDIN_FILENO);
|
||||
if (getenv("TEST_TEST_VERBOSE")) {
|
||||
orig_stderr = stderr;
|
||||
} else {
|
||||
orig_stdout_fd = dup(STDOUT_FILENO);
|
||||
if (orig_stdout_fd < 0) {
|
||||
perror("dup stdout");
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
dup2(dev_null, STDOUT_FILENO);
|
||||
orig_stderr_fd = dup(STDERR_FILENO);
|
||||
if (orig_stderr_fd < 0) {
|
||||
perror("dup stderr");
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
orig_stderr = fdopen(orig_stderr_fd, "w");
|
||||
if (orig_stderr == NULL) {
|
||||
perror("fdopen orig_stderr_fd");
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
dup2(dev_null, STDERR_FILENO);
|
||||
}
|
||||
|
||||
rc = setjmp(test_return);
|
||||
rc = rc ? rc - 1 : test_main(argc, argv);
|
||||
|
||||
out:
|
||||
fflush(NULL);
|
||||
if (orig_stderr_fd >= 0) {
|
||||
dup2(orig_stderr_fd, STDERR_FILENO);
|
||||
if (orig_stderr)
|
||||
fclose(orig_stderr);
|
||||
else
|
||||
close(orig_stderr_fd);
|
||||
}
|
||||
orig_stderr = NULL;
|
||||
if (orig_stdout_fd >= 0) {
|
||||
dup2(orig_stdout_fd, STDOUT_FILENO);
|
||||
close(orig_stdout_fd);
|
||||
}
|
||||
if (dev_null >= 0)
|
||||
close(dev_null);
|
||||
|
||||
test_free_all();
|
||||
test_close_all();
|
||||
return rc;
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2013-07-13.22; # UTC
|
||||
|
||||
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
else
|
||||
tweaked_estatus=$estatus
|
||||
fi
|
||||
|
||||
case $tweaked_estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report the test outcome and exit status in the logs, so that one can
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>$log_file
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,544 @@
|
|||
/****************************************************************************
|
||||
* Test cases for ethtool features
|
||||
* Copyright 2012 Solarflare Communications Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define TEST_NO_WRAPPERS
|
||||
#include "internal.h"
|
||||
|
||||
static const struct {
|
||||
struct ethtool_sset_info cmd;
|
||||
u32 data[1];
|
||||
}
|
||||
cmd_gssetinfo = { { ETHTOOL_GSSET_INFO, 0, 1ULL << ETH_SS_FEATURES }, { 34 } };
|
||||
|
||||
static const struct ethtool_value
|
||||
cmd_grxcsum_off = { ETHTOOL_GRXCSUM, 0 },
|
||||
cmd_grxcsum_on = { ETHTOOL_GRXCSUM, 1 },
|
||||
cmd_srxcsum_off = { ETHTOOL_SRXCSUM, 0 },
|
||||
cmd_srxcsum_on = { ETHTOOL_SRXCSUM, 1 },
|
||||
cmd_gtxcsum_off = { ETHTOOL_GTXCSUM, 0 },
|
||||
cmd_gtxcsum_on = { ETHTOOL_GTXCSUM, 1 },
|
||||
cmd_stxcsum_off = { ETHTOOL_STXCSUM, 0 },
|
||||
cmd_stxcsum_on = { ETHTOOL_STXCSUM, 1 },
|
||||
cmd_gsg_off = { ETHTOOL_GSG, 0 },
|
||||
cmd_gsg_on = { ETHTOOL_GSG, 1 },
|
||||
cmd_ssg_off = { ETHTOOL_SSG, 0 },
|
||||
cmd_ssg_on = { ETHTOOL_SSG, 1 },
|
||||
cmd_gtso_off = { ETHTOOL_GTSO, 0 },
|
||||
cmd_gtso_on = { ETHTOOL_GTSO, 1 },
|
||||
cmd_stso_off = { ETHTOOL_STSO, 0 },
|
||||
cmd_stso_on = { ETHTOOL_STSO, 1 },
|
||||
cmd_gufo_off = { ETHTOOL_GUFO, 0 },
|
||||
cmd_gufo_on = { ETHTOOL_GUFO, 1 },
|
||||
cmd_sufo_off = { ETHTOOL_SUFO, 0 },
|
||||
cmd_sufo_on = { ETHTOOL_SUFO, 1 },
|
||||
cmd_ggso_off = { ETHTOOL_GGSO, 0 },
|
||||
cmd_ggso_on = { ETHTOOL_GGSO, 1 },
|
||||
cmd_sgso_off = { ETHTOOL_SGSO, 0 },
|
||||
cmd_sgso_on = { ETHTOOL_SGSO, 1 },
|
||||
cmd_ggro_off = { ETHTOOL_GGRO, 0 },
|
||||
cmd_ggro_on = { ETHTOOL_GGRO, 1 },
|
||||
cmd_sgro_off = { ETHTOOL_SGRO, 0 },
|
||||
cmd_sgro_on = { ETHTOOL_SGRO, 1 },
|
||||
cmd_gflags_off = { ETHTOOL_GFLAGS, 0 },
|
||||
cmd_gflags_on = { ETHTOOL_GFLAGS,
|
||||
ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN |
|
||||
ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH },
|
||||
cmd_sflags_off = { ETHTOOL_SFLAGS, 0 },
|
||||
cmd_sflags_ntuple = { ETHTOOL_GFLAGS, ETH_FLAG_NTUPLE },
|
||||
cmd_sflags_on = { ETHTOOL_SFLAGS,
|
||||
ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN |
|
||||
ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH },
|
||||
cmd_sflags_not_rxhash = { ETHTOOL_SFLAGS,
|
||||
ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN |
|
||||
ETH_FLAG_NTUPLE };
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_strings_old[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EINVAL },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_features_off_old[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EINVAL },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_features_off_old_some_unsup[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EINVAL },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, -EOPNOTSUPP },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4, -EOPNOTSUPP },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_features_off_old_some_priv[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EPERM },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4, -EPERM },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_off_old[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EINVAL },
|
||||
{ &cmd_grxcsum_on, 4, 0, &cmd_grxcsum_on, sizeof(cmd_grxcsum_on) },
|
||||
{ &cmd_gtxcsum_on, 4, 0, &cmd_gtxcsum_on, sizeof(cmd_gtxcsum_on) },
|
||||
{ &cmd_gsg_on, 4, 0, &cmd_gsg_on, sizeof(cmd_gsg_on) },
|
||||
{ &cmd_gtso_on, 4, 0, &cmd_gtso_on, sizeof(cmd_gtso_on) },
|
||||
{ &cmd_gufo_on, 4, 0, &cmd_gufo_on, sizeof(cmd_gufo_on) },
|
||||
{ &cmd_ggso_on, 4, 0, &cmd_ggso_on, sizeof(cmd_ggso_on) },
|
||||
{ &cmd_ggro_on, 4,0, &cmd_ggro_on, sizeof(cmd_ggro_on) },
|
||||
{ &cmd_gflags_on, 4, 0, &cmd_gflags_on, sizeof(cmd_sflags_on) },
|
||||
{ &cmd_srxcsum_off, sizeof(cmd_srxcsum_off), 0, 0, 0 },
|
||||
{ &cmd_stxcsum_off, sizeof(cmd_stxcsum_off), 0, 0, 0 },
|
||||
{ &cmd_ssg_off, sizeof(cmd_ssg_off), 0, 0, 0 },
|
||||
{ &cmd_stso_off, sizeof(cmd_stso_off), 0, 0, 0 },
|
||||
{ &cmd_sufo_off, sizeof(cmd_sufo_off), 0, 0, 0 },
|
||||
{ &cmd_sgso_off, sizeof(cmd_sgso_off), 0, 0, 0 },
|
||||
{ &cmd_sgro_off, sizeof(cmd_sgro_off), 0, 0, 0 },
|
||||
{ &cmd_sflags_off, sizeof(cmd_sflags_off), 0, 0, 0 },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_sflags_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_on_old[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EINVAL },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_srxcsum_on, sizeof(cmd_srxcsum_on), 0, 0, 0 },
|
||||
{ &cmd_stxcsum_on, sizeof(cmd_stxcsum_on), 0, 0, 0 },
|
||||
{ &cmd_ssg_on, sizeof(cmd_ssg_on), 0, 0, 0 },
|
||||
{ &cmd_stso_on, sizeof(cmd_stso_on), 0, 0, 0 },
|
||||
{ &cmd_sufo_on, sizeof(cmd_sufo_on), 0, 0, 0 },
|
||||
{ &cmd_sgso_on, sizeof(cmd_sgso_on), 0, 0, 0 },
|
||||
{ &cmd_sgro_on, sizeof(cmd_sgro_on), 0, 0, 0 },
|
||||
{ &cmd_sflags_on, sizeof(cmd_sflags_on), 0, 0, 0 },
|
||||
{ &cmd_grxcsum_on, 4, 0, &cmd_grxcsum_on, sizeof(cmd_grxcsum_on) },
|
||||
{ &cmd_gtxcsum_on, 4, 0, &cmd_gtxcsum_on, sizeof(cmd_gtxcsum_on) },
|
||||
{ &cmd_gsg_on, 4, 0, &cmd_gsg_on, sizeof(cmd_gsg_on) },
|
||||
{ &cmd_gtso_on, 4, 0, &cmd_gtso_on, sizeof(cmd_gtso_on) },
|
||||
{ &cmd_gufo_on, 4, 0, &cmd_gufo_on, sizeof(cmd_gufo_on) },
|
||||
{ &cmd_ggso_on, 4, 0, &cmd_ggso_on, sizeof(cmd_ggso_on) },
|
||||
{ &cmd_ggro_on, 4,0, &cmd_ggro_on, sizeof(cmd_ggro_on) },
|
||||
{ &cmd_gflags_on, 4, 0, &cmd_gflags_on, sizeof(cmd_sflags_on) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_unsup_on_old[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd), -EINVAL },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_stxcsum_on, sizeof(cmd_stxcsum_on), -EOPNOTSUPP },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct {
|
||||
struct ethtool_gstrings cmd;
|
||||
u8 data[34][ETH_GSTRING_LEN];
|
||||
}
|
||||
cmd_gstrings = {
|
||||
{ ETHTOOL_GSTRINGS, ETH_SS_FEATURES, 34 },
|
||||
{
|
||||
"tx-scatter-gather",
|
||||
"tx-checksum-ipv4",
|
||||
"",
|
||||
"tx-checksum-ip-generic",
|
||||
"tx-checksum-ipv6",
|
||||
"highdma",
|
||||
"tx-scatter-gather-fraglist",
|
||||
"tx-vlan-hw-insert",
|
||||
"rx-vlan-hw-parse",
|
||||
"rx-vlan-filter",
|
||||
"vlan-challenged",
|
||||
"tx-generic-segmentation",
|
||||
"tx-lockless",
|
||||
"netns-local",
|
||||
"rx-gro",
|
||||
"rx-lro",
|
||||
"tx-tcp-segmentation",
|
||||
"tx-udp-fragmentation",
|
||||
"tx-gso-robust",
|
||||
"tx-tcp-ecn-segmentation",
|
||||
"tx-tcp6-segmentation",
|
||||
"tx-fcoe-segmentation",
|
||||
"",
|
||||
"",
|
||||
"tx-checksum-fcoe-crc",
|
||||
"tx-checksum-sctp",
|
||||
"fcoe-mtu",
|
||||
"rx-ntuple-filter",
|
||||
"rx-hashing",
|
||||
"rx-checksum",
|
||||
"tx-nocache-copy",
|
||||
"loopback",
|
||||
"rx-fcs",
|
||||
"rx-all",
|
||||
}
|
||||
};
|
||||
|
||||
static const struct {
|
||||
struct ethtool_gfeatures cmd;
|
||||
struct ethtool_get_features_block data[2];
|
||||
}
|
||||
/* available requested active never_changed */
|
||||
/* minimal: only GRO and GSO are available (and GSO won't work) */
|
||||
cmd_gfeatures_min_off = { { ETHTOOL_GFEATURES, 2 },
|
||||
{{ 0x00004800, 0x00000000, 0x00000000, 0x00003400},
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000}}
|
||||
},
|
||||
cmd_gfeatures_min_on = { { ETHTOOL_GFEATURES, 2 },
|
||||
{{ 0x00004800, 0x00004800, 0x00004000, 0x00003400},
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000}}
|
||||
},
|
||||
/* maximal: everything that isn't never-changed is available */
|
||||
cmd_gfeatures_max_off = { { ETHTOOL_GFEATURES, 2 },
|
||||
{{ 0xffffcbff, 0x00000000, 0x00000000, 0x00003400 },
|
||||
{ 0x00000003, 0x00000000, 0x00000000, 0x00000000 }}
|
||||
},
|
||||
cmd_gfeatures_max_on = { { ETHTOOL_GFEATURES, 2 },
|
||||
{{ 0xffffcbff, 0xffffcbff, 0xffffcbff, 0x00003400 },
|
||||
{ 0x00000003, 0x00000003, 0x00000003, 0x00000000 }}
|
||||
},
|
||||
/* IPv4: GRO, GSO, SG and some IPv4-specific offloads are available */
|
||||
cmd_gfeatures_ipv4_off = { { ETHTOOL_GFEATURES, 2 },
|
||||
{{ 0x00014803, 0x00000000, 0x00000000, 0x00003400 },
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 }}
|
||||
},
|
||||
cmd_gfeatures_ipv4_on = { { ETHTOOL_GFEATURES, 2 },
|
||||
{{ 0x00014803, 0x00014803, 0x00014803, 0x00003400 },
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000 }}
|
||||
};
|
||||
|
||||
static const struct {
|
||||
struct ethtool_sfeatures cmd;
|
||||
struct ethtool_set_features_block data[2];
|
||||
}
|
||||
/* valid requested */
|
||||
cmd_sfeatures_min_on = { { ETHTOOL_SFEATURES, 2 },
|
||||
{{ 0x00004800, 0x00004800 },
|
||||
{ 0x00000000, 0x00000000 }} },
|
||||
cmd_sfeatures_min_off = { { ETHTOOL_SFEATURES, 2 },
|
||||
{{ 0x00004800, 0x00000000 },
|
||||
{ 0x00000000, 0x00000000 }} },
|
||||
cmd_sfeatures_noop = { { ETHTOOL_SFEATURES, 2 },
|
||||
{{ 0x00000000, 0x00000000 },
|
||||
{ 0x00000000, 0x00000000 }} },
|
||||
cmd_sfeatures_ipv4_on = { { ETHTOOL_SFEATURES, 2 },
|
||||
{{ 0x00014803, 0x00014803 },
|
||||
{ 0x00000000, 0x00000000 }} };
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_strings[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_features_min_off[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_get_features_max_on[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_on, 4, 0, &cmd_grxcsum_on, sizeof(cmd_grxcsum_on) },
|
||||
{ &cmd_gtxcsum_on, 4, 0, &cmd_gtxcsum_on, sizeof(cmd_gtxcsum_on) },
|
||||
{ &cmd_gsg_on, 4, 0, &cmd_gsg_on, sizeof(cmd_gsg_on) },
|
||||
{ &cmd_gtso_on, 4, 0, &cmd_gtso_on, sizeof(cmd_gtso_on) },
|
||||
{ &cmd_gufo_on, 4, 0, &cmd_gufo_on, sizeof(cmd_gufo_on) },
|
||||
{ &cmd_ggso_on, 4, 0, &cmd_ggso_on, sizeof(cmd_ggso_on) },
|
||||
{ &cmd_ggro_on, 4,0, &cmd_ggro_on, sizeof(cmd_ggro_on) },
|
||||
{ &cmd_gflags_on, 4, 0, &cmd_gflags_on, sizeof(cmd_sflags_on) },
|
||||
{ &cmd_gfeatures_max_on, sizeof(cmd_gfeatures_max_on.cmd),
|
||||
0, &cmd_gfeatures_max_on, sizeof(cmd_gfeatures_max_on) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_min_off_min_on[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ &cmd_sfeatures_min_on, sizeof(cmd_sfeatures_min_on),
|
||||
ETHTOOL_F_WISH, 0, 0 },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_on, 4,0, &cmd_ggro_on, sizeof(cmd_ggro_on) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_on, sizeof(cmd_gfeatures_min_on.cmd),
|
||||
0, &cmd_gfeatures_min_on, sizeof(cmd_gfeatures_min_on) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_min_off_min_off[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ &cmd_sfeatures_min_off, sizeof(cmd_sfeatures_min_off), 0, 0, 0 },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_min_on_min_off[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_on, 4,0, &cmd_ggro_on, sizeof(cmd_ggro_on) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_on, sizeof(cmd_gfeatures_min_on.cmd),
|
||||
0, &cmd_gfeatures_min_on, sizeof(cmd_gfeatures_min_on) },
|
||||
{ &cmd_sfeatures_min_off, sizeof(cmd_sfeatures_min_off), 0, 0, 0 },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_min_off_unsup_on[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ &cmd_sfeatures_noop, sizeof(cmd_sfeatures_noop), 0, 0, 0 },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off.cmd),
|
||||
0, &cmd_gfeatures_min_off, sizeof(cmd_gfeatures_min_off) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct cmd_expect cmd_expect_set_features_ipv4_off_many_on[] = {
|
||||
{ &cmd_gssetinfo, sizeof(cmd_gssetinfo.cmd),
|
||||
0, &cmd_gssetinfo, sizeof(cmd_gssetinfo) },
|
||||
{ &cmd_gstrings, sizeof(cmd_gstrings.cmd),
|
||||
0, &cmd_gstrings, sizeof(cmd_gstrings) },
|
||||
{ &cmd_grxcsum_off, 4, 0, &cmd_grxcsum_off, sizeof(cmd_grxcsum_off) },
|
||||
{ &cmd_gtxcsum_off, 4, 0, &cmd_gtxcsum_off, sizeof(cmd_gtxcsum_off) },
|
||||
{ &cmd_gsg_off, 4, 0, &cmd_gsg_off, sizeof(cmd_gsg_off) },
|
||||
{ &cmd_gtso_off, 4, 0, &cmd_gtso_off, sizeof(cmd_gtso_off) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_off, 4, 0, &cmd_ggso_off, sizeof(cmd_ggso_off) },
|
||||
{ &cmd_ggro_off, 4,0, &cmd_ggro_off, sizeof(cmd_ggro_off) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_ipv4_off, sizeof(cmd_gfeatures_ipv4_off.cmd),
|
||||
0, &cmd_gfeatures_ipv4_off, sizeof(cmd_gfeatures_ipv4_off) },
|
||||
{ &cmd_sfeatures_ipv4_on, sizeof(cmd_sfeatures_ipv4_on), 0, 0, 0 },
|
||||
{ &cmd_grxcsum_on, 4, 0, &cmd_grxcsum_on, sizeof(cmd_grxcsum_on) },
|
||||
{ &cmd_gtxcsum_on, 4, 0, &cmd_gtxcsum_on, sizeof(cmd_gtxcsum_on) },
|
||||
{ &cmd_gsg_on, 4, 0, &cmd_gsg_on, sizeof(cmd_gsg_on) },
|
||||
{ &cmd_gtso_on, 4, 0, &cmd_gtso_on, sizeof(cmd_gtso_on) },
|
||||
{ &cmd_gufo_off, 4, 0, &cmd_gufo_off, sizeof(cmd_gufo_off) },
|
||||
{ &cmd_ggso_on, 4, 0, &cmd_ggso_on, sizeof(cmd_ggso_on) },
|
||||
{ &cmd_ggro_on, 4,0, &cmd_ggro_on, sizeof(cmd_ggro_on) },
|
||||
{ &cmd_gflags_off, 4, 0, &cmd_gflags_off, sizeof(cmd_gflags_off) },
|
||||
{ &cmd_gfeatures_ipv4_on, sizeof(cmd_gfeatures_ipv4_on.cmd),
|
||||
0, &cmd_gfeatures_ipv4_on, sizeof(cmd_gfeatures_ipv4_on) },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static struct test_case {
|
||||
int rc;
|
||||
const char *args;
|
||||
const struct cmd_expect *expect;
|
||||
} const test_cases[] = {
|
||||
{ 0, "-k devname", cmd_expect_get_features_off_old },
|
||||
{ 0, "-k dev_unsup", cmd_expect_get_features_off_old_some_unsup },
|
||||
{ 0, "-k dev_priv", cmd_expect_get_features_off_old_some_priv },
|
||||
{ 0, "-K devname rx off tx off sg off tso off ufo off gso off lro off rxvlan off txvlan off ntuple off rxhash off gro off",
|
||||
cmd_expect_set_features_off_old },
|
||||
{ 0, "-K devname rx on tx on sg on tso on ufo on gso on lro on rxvlan on txvlan on ntuple on rxhash on gro on",
|
||||
cmd_expect_set_features_on_old },
|
||||
{ 1, "-K devname tx on sg on", cmd_expect_set_features_unsup_on_old },
|
||||
{ 0, "--show-offload devname", cmd_expect_get_features_min_off },
|
||||
{ 0, "--show-features devname", cmd_expect_get_features_max_on },
|
||||
{ 0, "-K devname rx on tx on sg on tso on ufo on gso on gro on",
|
||||
cmd_expect_set_features_min_off_min_on },
|
||||
{ 0, "-K devname rx off tx off sg off tso off ufo off gso off gro off",
|
||||
cmd_expect_set_features_min_off_min_off },
|
||||
{ 0, "-K devname rx off tx off sg off tso off ufo off gso off gro off",
|
||||
cmd_expect_set_features_min_on_min_off },
|
||||
{ 1, "-K devname tx on sg on",
|
||||
cmd_expect_set_features_min_off_unsup_on },
|
||||
{ 0, "--features devname rx on tx on sg on tso on gso on gro on",
|
||||
cmd_expect_set_features_ipv4_off_many_on },
|
||||
{ 1, "-K devname rx foo", cmd_expect_get_strings_old },
|
||||
{ 1, "-K devname rx foo", cmd_expect_get_strings },
|
||||
{ 1, "--offload devname rx", cmd_expect_get_strings_old },
|
||||
{ 1, "--features devname rx", cmd_expect_get_strings },
|
||||
{ 1, "--features devname foo on", cmd_expect_get_strings_old },
|
||||
{ 1, "--offload devname foo on", cmd_expect_get_strings },
|
||||
};
|
||||
|
||||
static int expect_matched;
|
||||
static const struct cmd_expect *expect_next;
|
||||
|
||||
int send_ioctl(struct cmd_context *ctx, void *cmd)
|
||||
{
|
||||
int rc = test_ioctl(expect_next, cmd);
|
||||
|
||||
if (rc == TEST_IOCTL_MISMATCH) {
|
||||
expect_matched = 0;
|
||||
test_exit(0);
|
||||
}
|
||||
expect_next++;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const struct test_case *tc;
|
||||
int test_rc;
|
||||
int rc = 0;
|
||||
|
||||
for (tc = test_cases; tc < test_cases + ARRAY_SIZE(test_cases); tc++) {
|
||||
if (getenv("ETHTOOL_TEST_VERBOSE"))
|
||||
printf("I: Test command line: ethtool %s\n", tc->args);
|
||||
expect_matched = 1;
|
||||
expect_next = tc->expect;
|
||||
test_rc = test_cmdline(tc->args);
|
||||
|
||||
/* If we found a mismatch, or there is still another
|
||||
* expected ioctl to match, the test failed.
|
||||
*/
|
||||
if (!expect_matched || expect_next->cmd) {
|
||||
fprintf(stderr,
|
||||
"E: ethtool %s deviated from the expected "
|
||||
"ioctl sequence after %zu calls\n",
|
||||
tc->args, expect_next - tc->expect);
|
||||
rc = 1;
|
||||
} else if (test_rc != tc->rc) {
|
||||
fprintf(stderr, "E: ethtool %s returns %d\n",
|
||||
tc->args, test_rc);
|
||||
rc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define TG3_MAGIC 0x669955aa
|
||||
|
||||
int tg3_dump_eeprom(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_eeprom *ee)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ee->magic != TG3_MAGIC) {
|
||||
fprintf(stderr, "Magic number 0x%08x does not match 0x%08x\n",
|
||||
ee->magic, TG3_MAGIC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fprintf(stdout, "Address \tData\n");
|
||||
fprintf(stdout, "----------\t----\n");
|
||||
for (i = 0; i < ee->len; i++)
|
||||
fprintf(stdout, "0x%08x\t0x%02x\n", i + ee->offset, ee->data[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tg3_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
int i;
|
||||
u32 reg;
|
||||
|
||||
fprintf(stdout, "Offset\tValue\n");
|
||||
fprintf(stdout, "------\t----------\n");
|
||||
for (i = 0; i < regs->len; i += sizeof(reg)) {
|
||||
memcpy(®, ®s->data[i], sizeof(reg));
|
||||
if (reg)
|
||||
fprintf(stdout, "0x%04x\t0x%08x\n", i, reg);
|
||||
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/****************************************************************************
|
||||
* Support for the Altera Triple Speed Ethernet 10/100/1000 Controller
|
||||
*
|
||||
* Copyright (C) 2014 Altera Corporation
|
||||
*
|
||||
* Author: Vince Bridgers <vbridgers2013@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define ALTERA_VERSION_MASK 0xffff
|
||||
#define ALTERA_ETHTOOL_V1 1
|
||||
|
||||
int
|
||||
bitset(u32 val, int bit)
|
||||
{
|
||||
if (val & (1 << bit))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int altera_tse_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
int i;
|
||||
u32 *tsereg = (unsigned int *)regs->data;
|
||||
u32 version = regs->version;
|
||||
|
||||
if ((version & ALTERA_VERSION_MASK) > ALTERA_ETHTOOL_V1)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Version 1: Initial TSE driver release. No feature information
|
||||
* available, 32-bits of version is equal to 1.
|
||||
*
|
||||
* Version 2: Lower 16-bits of version is 2, upper 16 bits are:
|
||||
* Bit 16 - SGMDA or MSGDMA Registers
|
||||
* Bit 17 - PCS Present
|
||||
* Bit 18 - Supplementary MAC Address Filter Registers Present
|
||||
* Bit 19 - Multicast Hash Filter Present
|
||||
* Bit 20 - IEEE 1588 Feature Present
|
||||
*/
|
||||
fprintf(stdout, "Altera TSE 10/100/1000 Registers, Version %d\n",
|
||||
version);
|
||||
fprintf(stdout, "---------------------------------------------\n");
|
||||
fprintf(stdout, "Revision 0x%08X\n", tsereg[0]);
|
||||
fprintf(stdout, " Core Version %d.%d\n",
|
||||
(tsereg[0] & 0xffff) >> 8,
|
||||
tsereg[0] & 0xff);
|
||||
fprintf(stdout, " CustVersion 0x%08X\n", tsereg[0] >> 16);
|
||||
fprintf(stdout, "Scratch 0x%08X\n", tsereg[1]);
|
||||
fprintf(stdout, "Command/Config 0x%08X\n", tsereg[2]);
|
||||
fprintf(stdout, " (0)TX_EN %d\n", bitset(tsereg[2], 0));
|
||||
fprintf(stdout, " (1)RX_EN %d\n", bitset(tsereg[2], 1));
|
||||
fprintf(stdout, " (2)XON_GEN %d\n", bitset(tsereg[2], 2));
|
||||
fprintf(stdout, " (3)ETH_SPEED %d\n", bitset(tsereg[2], 3));
|
||||
fprintf(stdout, " (4)PROMIS_EN %d\n", bitset(tsereg[2], 4));
|
||||
fprintf(stdout, " (5)PAD_EN %d\n", bitset(tsereg[2], 5));
|
||||
fprintf(stdout, " (6)CRC_FWD %d\n", bitset(tsereg[2], 6));
|
||||
fprintf(stdout, " (7)PAUSE_FWD %d\n", bitset(tsereg[2], 7));
|
||||
fprintf(stdout, " (8)PAUSE_IGN %d\n", bitset(tsereg[2], 8));
|
||||
fprintf(stdout, " (9)TXADDR_INS %d\n", bitset(tsereg[2], 9));
|
||||
fprintf(stdout, " (10)HD_EN %d\n", bitset(tsereg[2], 10));
|
||||
fprintf(stdout, " (11)EXCESS_COL %d\n", bitset(tsereg[2], 11));
|
||||
fprintf(stdout, " (12)LATE_COL %d\n", bitset(tsereg[2], 12));
|
||||
fprintf(stdout, " (13)SW_RESET %d\n", bitset(tsereg[2], 13));
|
||||
fprintf(stdout, " (14)MHASH_SEL %d\n", bitset(tsereg[2], 14));
|
||||
fprintf(stdout, " (15)LOOP_EN %d\n", bitset(tsereg[2], 15));
|
||||
fprintf(stdout, " (16-18)TX_ADDR_SEL %d\n",
|
||||
(tsereg[2] & 0x30000) >> 16);
|
||||
fprintf(stdout, " (19)MAGIC_EN %d\n", bitset(tsereg[2], 19));
|
||||
fprintf(stdout, " (20)SLEEP %d\n", bitset(tsereg[2], 20));
|
||||
fprintf(stdout, " (21)WAKEUP %d\n", bitset(tsereg[2], 21));
|
||||
fprintf(stdout, " (22)XOFF_GEN %d\n", bitset(tsereg[2], 22));
|
||||
fprintf(stdout, " (23)CTRL_FRAME_EN %d\n", bitset(tsereg[2], 23));
|
||||
fprintf(stdout, " (24)NO_LEN_CHECK %d\n", bitset(tsereg[2], 24));
|
||||
fprintf(stdout, " (25)ENA_10 %d\n", bitset(tsereg[2], 25));
|
||||
fprintf(stdout, " (26)RX_ERR_DISC %d\n", bitset(tsereg[2], 26));
|
||||
fprintf(stdout, " (31)CTRL_RESET %d\n", bitset(tsereg[2], 31));
|
||||
fprintf(stdout, "mac_0 0x%08X\n", tsereg[3]);
|
||||
fprintf(stdout, "mac_1 0x%08X\n", tsereg[4]);
|
||||
fprintf(stdout, "frm_length 0x%08X\n", tsereg[5]);
|
||||
fprintf(stdout, "pause_quant 0x%08X\n", tsereg[6]);
|
||||
fprintf(stdout, "rx_section_empty 0x%08X\n", tsereg[7]);
|
||||
fprintf(stdout, "rx_section_full 0x%08X\n", tsereg[8]);
|
||||
fprintf(stdout, "tx_section_empty 0x%08X\n", tsereg[9]);
|
||||
fprintf(stdout, "tx_section_full 0x%08X\n", tsereg[0xa]);
|
||||
fprintf(stdout, "rx_almost_empty 0x%08X\n", tsereg[0xb]);
|
||||
fprintf(stdout, "rx_almost_full 0x%08X\n", tsereg[0xc]);
|
||||
fprintf(stdout, "tx_almost_empty 0x%08X\n", tsereg[0xd]);
|
||||
fprintf(stdout, "tx_almost_full 0x%08X\n", tsereg[0xe]);
|
||||
fprintf(stdout, "mdio_addr0 0x%08X\n", tsereg[0xf]);
|
||||
fprintf(stdout, "mdio_addr1 0x%08X\n", tsereg[0x10]);
|
||||
fprintf(stdout, "holdoff_quant 0x%08X\n", tsereg[0x11]);
|
||||
|
||||
fprintf(stdout, "tx_ipg_length 0x%08X\n", tsereg[0x17]);
|
||||
fprintf(stdout, "Transmit Command 0x%08X\n", tsereg[0x3a]);
|
||||
fprintf(stdout, "Receive Command 0x%08X\n", tsereg[0x3b]);
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
fprintf(stdout, "Multicast Hash[%02d] 0x%08X\n",
|
||||
i,
|
||||
tsereg[0x40 + i]);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/* Copyright 2006 Fabric7 Systems, Inc */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "internal.h"
|
||||
|
||||
struct regs_line {
|
||||
u32 addr;
|
||||
u32 data;
|
||||
};
|
||||
|
||||
#define VIOC_REGS_LINE_SIZE sizeof(struct regs_line)
|
||||
|
||||
int vioc_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int num_regs;
|
||||
struct regs_line *reg_info = (struct regs_line *) regs->data;
|
||||
|
||||
printf("ethtool_regs\n"
|
||||
"%-20s = %04x\n"
|
||||
"%-20s = %04x\n",
|
||||
"cmd", regs->cmd,
|
||||
"version", regs->version);
|
||||
|
||||
num_regs = regs->len/VIOC_REGS_LINE_SIZE;
|
||||
|
||||
for (i = 0; i < num_regs; i++){
|
||||
printf("%08x = %08x\n", reg_info[i].addr, reg_info[i].data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
/* Copyright (c) 2015 VMware Inc.*/
|
||||
#include <stdio.h>
|
||||
#include "internal.h"
|
||||
|
||||
int
|
||||
vmxnet3_dump_regs(struct ethtool_drvinfo *info maybe_unused,
|
||||
struct ethtool_regs *regs)
|
||||
{
|
||||
u32 *regs_buff = (u32 *)regs->data;
|
||||
u32 version = regs->version;
|
||||
int i = 0, j = 0, cnt;
|
||||
|
||||
if (version != 2)
|
||||
return -1;
|
||||
|
||||
fprintf(stdout, "Control Registers\n");
|
||||
fprintf(stdout, "=================\n");
|
||||
|
||||
fprintf(stdout,
|
||||
" VRRS (Vmxnet3 Revision Report and Selection) 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" UVRS (UPT Version Report and Selection) 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" DSA (Driver Shared Address) 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" CMD (Command Register) 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" MAC (Media Access Control address) %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
regs_buff[j] & 0xff,
|
||||
(regs_buff[j] >> 8) & 0xff,
|
||||
(regs_buff[j] >> 16) & 0xff,
|
||||
(regs_buff[j] >> 24) & 0xff,
|
||||
regs_buff[j + 1] & 0xff,
|
||||
(regs_buff[j + 1] >> 8) & 0xff);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" ICR (Interrupt Cause Register) 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" ECR (Event Cause Register) 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
|
||||
fprintf(stdout, "Datapath Registers\n");
|
||||
fprintf(stdout, "==================\n");
|
||||
|
||||
/* Interrupt Mask Registers */
|
||||
cnt = regs_buff[j++];
|
||||
for (i = 0; i < cnt; i++) {
|
||||
fprintf(stdout,
|
||||
" IMR (Interrupt Mask Register) %d 0x%x\n",
|
||||
i, regs_buff[j++]);
|
||||
}
|
||||
|
||||
/* Transmit Queue Registers */
|
||||
cnt = regs_buff[j++];
|
||||
for (i = 0; i < cnt; i++) {
|
||||
fprintf(stdout, " Transmit Queue %d\n", i);
|
||||
fprintf(stdout, " ----------------\n");
|
||||
fprintf(stdout,
|
||||
" TXPROD (Transmit Ring Producer Register) 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" Transmit Ring\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" Size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2fill %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2comp %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" gen %u\n",
|
||||
regs_buff[j++]);
|
||||
|
||||
fprintf(stdout,
|
||||
" Transmit Data Ring\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" Size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" Buffer Size %u\n",
|
||||
regs_buff[j++]);
|
||||
|
||||
fprintf(stdout,
|
||||
" Transmit Completion Ring\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2proc %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" gen %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" stopped %u\n",
|
||||
regs_buff[j++]);
|
||||
}
|
||||
|
||||
/* Receive Queue Registers */
|
||||
cnt = regs_buff[j++];
|
||||
for (i = 0; i < cnt; i++) {
|
||||
fprintf(stdout, " Receive Queue %d\n", i);
|
||||
fprintf(stdout, " ----------------\n");
|
||||
fprintf(stdout,
|
||||
" RXPROD1 (Receive Ring Producer Register) 1 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" RXPROD2 (Receive Ring Producer Register) 2 0x%x\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" Receive Ring 0\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" Size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2fill %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2comp %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" gen %u\n",
|
||||
regs_buff[j++]);
|
||||
|
||||
fprintf(stdout,
|
||||
" Receive Ring 1\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" Size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2fill %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2comp %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" gen %u\n",
|
||||
regs_buff[j++]);
|
||||
|
||||
fprintf(stdout,
|
||||
" Receive Data Ring\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" Size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" Buffer Size %u\n",
|
||||
regs_buff[j++]);
|
||||
|
||||
fprintf(stdout,
|
||||
" Receive Completion Ring\n");
|
||||
fprintf(stdout,
|
||||
" Base Address 0x%08x%08x\n",
|
||||
regs_buff[j+1], regs_buff[j]);
|
||||
j += 2;
|
||||
fprintf(stdout,
|
||||
" size %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" next2proc %u\n",
|
||||
regs_buff[j++]);
|
||||
fprintf(stdout,
|
||||
" gen %u\n",
|
||||
regs_buff[j++]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue