1
0
Fork 0

sk98lin: resurrect driver

This reverts commit e1abecc489.

The driver works on some hardware that skge doesn't handle yet.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
hifive-unleashed-5.1
Stephen Hemminger 2007-09-15 19:35:14 -04:00 committed by Jeff Garzik
parent 62270336e8
commit 5ad887fa8e
45 changed files with 41977 additions and 1 deletions

View File

@ -298,3 +298,11 @@ Why: All mthca hardware also supports MSI-X, which provides
Who: Roland Dreier <rolandd@cisco.com>
---------------------------
What: sk98lin network driver
When: Feburary 2008
Why: In kernel tree version of driver is unmaintained. Sk98lin driver
replaced by the skge driver.
Who: Stephen Hemminger <shemminger@linux-foundation.org>
---------------------------

View File

@ -96,6 +96,9 @@ routing.txt
- the new routing mechanism
shaper.txt
- info on the module that can shape/limit transmitted traffic.
sk98lin.txt
- Marvell Yukon Chipset / SysKonnect SK-98xx compliant Gigabit
Ethernet Adapter family driver info
skfp.txt
- SysKonnect FDDI (SK-5xxx, Compaq Netelligent) driver info.
smc9.txt

View File

@ -0,0 +1,568 @@
(C)Copyright 1999-2004 Marvell(R).
All rights reserved
===========================================================================
sk98lin.txt created 13-Feb-2004
Readme File for sk98lin v6.23
Marvell Yukon/SysKonnect SK-98xx Gigabit Ethernet Adapter family driver for LINUX
This file contains
1 Overview
2 Required Files
3 Installation
3.1 Driver Installation
3.2 Inclusion of adapter at system start
4 Driver Parameters
4.1 Per-Port Parameters
4.2 Adapter Parameters
5 Large Frame Support
6 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad)
7 Troubleshooting
===========================================================================
1 Overview
===========
The sk98lin driver supports the Marvell Yukon and SysKonnect
SK-98xx/SK-95xx compliant Gigabit Ethernet Adapter on Linux. It has
been tested with Linux on Intel/x86 machines.
***
2 Required Files
=================
The linux kernel source.
No additional files required.
***
3 Installation
===============
It is recommended to download the latest version of the driver from the
SysKonnect web site www.syskonnect.com. If you have downloaded the latest
driver, the Linux kernel has to be patched before the driver can be
installed. For details on how to patch a Linux kernel, refer to the
patch.txt file.
3.1 Driver Installation
------------------------
The following steps describe the actions that are required to install
the driver and to start it manually. These steps should be carried
out for the initial driver setup. Once confirmed to be ok, they can
be included in the system start.
NOTE 1: To perform the following tasks you need 'root' access.
NOTE 2: In case of problems, please read the section "Troubleshooting"
below.
The driver can either be integrated into the kernel or it can be compiled
as a module. Select the appropriate option during the kernel
configuration.
Compile/use the driver as a module
----------------------------------
To compile the driver, go to the directory /usr/src/linux and
execute the command "make menuconfig" or "make xconfig" and proceed as
follows:
To integrate the driver permanently into the kernel, proceed as follows:
1. Select the menu "Network device support" and then "Ethernet(1000Mbit)"
2. Mark "Marvell Yukon Chipset / SysKonnect SK-98xx family support"
with (*)
3. Build a new kernel when the configuration of the above options is
finished.
4. Install the new kernel.
5. Reboot your system.
To use the driver as a module, proceed as follows:
1. Enable 'loadable module support' in the kernel.
2. For automatic driver start, enable the 'Kernel module loader'.
3. Select the menu "Network device support" and then "Ethernet(1000Mbit)"
4. Mark "Marvell Yukon Chipset / SysKonnect SK-98xx family support"
with (M)
5. Execute the command "make modules".
6. Execute the command "make modules_install".
The appropriate modules will be installed.
7. Reboot your system.
Load the module manually
------------------------
To load the module manually, proceed as follows:
1. Enter "modprobe sk98lin".
2. If a Marvell Yukon or SysKonnect SK-98xx adapter is installed in
your computer and you have a /proc file system, execute the command:
"ls /proc/net/sk98lin/"
This should produce an output containing a line with the following
format:
eth0 eth1 ...
which indicates that your adapter has been found and initialized.
NOTE 1: If you have more than one Marvell Yukon or SysKonnect SK-98xx
adapter installed, the adapters will be listed as 'eth0',
'eth1', 'eth2', etc.
For each adapter, repeat steps 3 and 4 below.
NOTE 2: If you have other Ethernet adapters installed, your Marvell
Yukon or SysKonnect SK-98xx adapter will be mapped to the
next available number, e.g. 'eth1'. The mapping is executed
automatically.
The module installation message (displayed either in a system
log file or on the console) prints a line for each adapter
found containing the corresponding 'ethX'.
3. Select an IP address and assign it to the respective adapter by
entering:
ifconfig eth0 <ip-address>
With this command, the adapter is connected to the Ethernet.
SK-98xx Gigabit Ethernet Server Adapters: The yellow LED on the adapter
is now active, the link status LED of the primary port is active and
the link status LED of the secondary port (on dual port adapters) is
blinking (if the ports are connected to a switch or hub).
SK-98xx V2.0 Gigabit Ethernet Adapters: The link status LED is active.
In addition, you will receive a status message on the console stating
"ethX: network connection up using port Y" and showing the selected
connection parameters (x stands for the ethernet device number
(0,1,2, etc), y stands for the port name (A or B)).
NOTE: If you are in doubt about IP addresses, ask your network
administrator for assistance.
4. Your adapter should now be fully operational.
Use 'ping <otherstation>' to verify the connection to other computers
on your network.
5. To check the adapter configuration view /proc/net/sk98lin/[devicename].
For example by executing:
"cat /proc/net/sk98lin/eth0"
Unload the module
-----------------
To stop and unload the driver modules, proceed as follows:
1. Execute the command "ifconfig eth0 down".
2. Execute the command "rmmod sk98lin".
3.2 Inclusion of adapter at system start
-----------------------------------------
Since a large number of different Linux distributions are
available, we are unable to describe a general installation procedure
for the driver module.
Because the driver is now integrated in the kernel, installation should
be easy, using the standard mechanism of your distribution.
Refer to the distribution's manual for installation of ethernet adapters.
***
4 Driver Parameters
====================
Parameters can be set at the command line after the module has been
loaded with the command 'modprobe'.
In some distributions, the configuration tools are able to pass parameters
to the driver module.
If you use the kernel module loader, you can set driver parameters
in the file /etc/modprobe.conf (or /etc/modules.conf in 2.4 or earlier).
To set the driver parameters in this file, proceed as follows:
1. Insert a line of the form :
options sk98lin ...
For "...", the same syntax is required as described for the command
line parameters of modprobe below.
2. To activate the new parameters, either reboot your computer
or
unload and reload the driver.
The syntax of the driver parameters is:
modprobe sk98lin parameter=value1[,value2[,value3...]]
where value1 refers to the first adapter, value2 to the second etc.
NOTE: All parameters are case sensitive. Write them exactly as shown
below.
Example:
Suppose you have two adapters. You want to set auto-negotiation
on the first adapter to ON and on the second adapter to OFF.
You also want to set DuplexCapabilities on the first adapter
to FULL, and on the second adapter to HALF.
Then, you must enter:
modprobe sk98lin AutoNeg_A=On,Off DupCap_A=Full,Half
NOTE: The number of adapters that can be configured this way is
limited in the driver (file skge.c, constant SK_MAX_CARD_PARAM).
The current limit is 16. If you happen to install
more adapters, adjust this and recompile.
4.1 Per-Port Parameters
------------------------
These settings are available for each port on the adapter.
In the following description, '?' stands for the port for
which you set the parameter (A or B).
Speed
-----
Parameter: Speed_?
Values: 10, 100, 1000, Auto
Default: Auto
This parameter is used to set the speed capabilities. It is only valid
for the SK-98xx V2.0 copper adapters.
Usually, the speed is negotiated between the two ports during link
establishment. If this fails, a port can be forced to a specific setting
with this parameter.
Auto-Negotiation
----------------
Parameter: AutoNeg_?
Values: On, Off, Sense
Default: On
The "Sense"-mode automatically detects whether the link partner supports
auto-negotiation or not.
Duplex Capabilities
-------------------
Parameter: DupCap_?
Values: Half, Full, Both
Default: Both
This parameters is only relevant if auto-negotiation for this port is
not set to "Sense". If auto-negotiation is set to "On", all three values
are possible. If it is set to "Off", only "Full" and "Half" are allowed.
This parameter is useful if your link partner does not support all
possible combinations.
Flow Control
------------
Parameter: FlowCtrl_?
Values: Sym, SymOrRem, LocSend, None
Default: SymOrRem
This parameter can be used to set the flow control capabilities the
port reports during auto-negotiation. It can be set for each port
individually.
Possible modes:
-- Sym = Symmetric: both link partners are allowed to send
PAUSE frames
-- SymOrRem = SymmetricOrRemote: both or only remote partner
are allowed to send PAUSE frames
-- LocSend = LocalSend: only local link partner is allowed
to send PAUSE frames
-- None = no link partner is allowed to send PAUSE frames
NOTE: This parameter is ignored if auto-negotiation is set to "Off".
Role in Master-Slave-Negotiation (1000Base-T only)
--------------------------------------------------
Parameter: Role_?
Values: Auto, Master, Slave
Default: Auto
This parameter is only valid for the SK-9821 and SK-9822 adapters.
For two 1000Base-T ports to communicate, one must take the role of the
master (providing timing information), while the other must be the
slave. Usually, this is negotiated between the two ports during link
establishment. If this fails, a port can be forced to a specific setting
with this parameter.
4.2 Adapter Parameters
-----------------------
Connection Type (SK-98xx V2.0 copper adapters only)
---------------
Parameter: ConType
Values: Auto, 100FD, 100HD, 10FD, 10HD
Default: Auto
The parameter 'ConType' is a combination of all five per-port parameters
within one single parameter. This simplifies the configuration of both ports
of an adapter card! The different values of this variable reflect the most
meaningful combinations of port parameters.
The following table shows the values of 'ConType' and the corresponding
combinations of the per-port parameters:
ConType | DupCap AutoNeg FlowCtrl Role Speed
----------+------------------------------------------------------
Auto | Both On SymOrRem Auto Auto
100FD | Full Off None Auto (ignored) 100
100HD | Half Off None Auto (ignored) 100
10FD | Full Off None Auto (ignored) 10
10HD | Half Off None Auto (ignored) 10
Stating any other port parameter together with this 'ConType' variable
will result in a merged configuration of those settings. This due to
the fact, that the per-port parameters (e.g. Speed_? ) have a higher
priority than the combined variable 'ConType'.
NOTE: This parameter is always used on both ports of the adapter card.
Interrupt Moderation
--------------------
Parameter: Moderation
Values: None, Static, Dynamic
Default: None
Interrupt moderation is employed to limit the maximum number of interrupts
the driver has to serve. That is, one or more interrupts (which indicate any
transmit or receive packet to be processed) are queued until the driver
processes them. When queued interrupts are to be served, is determined by the
'IntsPerSec' parameter, which is explained later below.
Possible modes:
-- None - No interrupt moderation is applied on the adapter card.
Therefore, each transmit or receive interrupt is served immediately
as soon as it appears on the interrupt line of the adapter card.
-- Static - Interrupt moderation is applied on the adapter card.
All transmit and receive interrupts are queued until a complete
moderation interval ends. If such a moderation interval ends, all
queued interrupts are processed in one big bunch without any delay.
The term 'static' reflects the fact, that interrupt moderation is
always enabled, regardless how much network load is currently
passing via a particular interface. In addition, the duration of
the moderation interval has a fixed length that never changes while
the driver is operational.
-- Dynamic - Interrupt moderation might be applied on the adapter card,
depending on the load of the system. If the driver detects that the
system load is too high, the driver tries to shield the system against
too much network load by enabling interrupt moderation. If - at a later
time - the CPU utilization decreases again (or if the network load is
negligible) the interrupt moderation will automatically be disabled.
Interrupt moderation should be used when the driver has to handle one or more
interfaces with a high network load, which - as a consequence - leads also to a
high CPU utilization. When moderation is applied in such high network load
situations, CPU load might be reduced by 20-30%.
NOTE: The drawback of using interrupt moderation is an increase of the round-
trip-time (RTT), due to the queueing and serving of interrupts at dedicated
moderation times.
Interrupts per second
---------------------
Parameter: IntsPerSec
Values: 30...40000 (interrupts per second)
Default: 2000
This parameter is only used if either static or dynamic interrupt moderation
is used on a network adapter card. Using this parameter if no moderation is
applied will lead to no action performed.
This parameter determines the length of any interrupt moderation interval.
Assuming that static interrupt moderation is to be used, an 'IntsPerSec'
parameter value of 2000 will lead to an interrupt moderation interval of
500 microseconds.
NOTE: The duration of the moderation interval is to be chosen with care.
At first glance, selecting a very long duration (e.g. only 100 interrupts per
second) seems to be meaningful, but the increase of packet-processing delay
is tremendous. On the other hand, selecting a very short moderation time might
compensate the use of any moderation being applied.
Preferred Port
--------------
Parameter: PrefPort
Values: A, B
Default: A
This is used to force the preferred port to A or B (on dual-port network
adapters). The preferred port is the one that is used if both are detected
as fully functional.
RLMT Mode (Redundant Link Management Technology)
------------------------------------------------
Parameter: RlmtMode
Values: CheckLinkState,CheckLocalPort, CheckSeg, DualNet
Default: CheckLinkState
RLMT monitors the status of the port. If the link of the active port
fails, RLMT switches immediately to the standby link. The virtual link is
maintained as long as at least one 'physical' link is up.
Possible modes:
-- CheckLinkState - Check link state only: RLMT uses the link state
reported by the adapter hardware for each individual port to
determine whether a port can be used for all network traffic or
not.
-- CheckLocalPort - In this mode, RLMT monitors the network path
between the two ports of an adapter by regularly exchanging packets
between them. This mode requires a network configuration in which
the two ports are able to "see" each other (i.e. there must not be
any router between the ports).
-- CheckSeg - Check local port and segmentation: This mode supports the
same functions as the CheckLocalPort mode and additionally checks
network segmentation between the ports. Therefore, this mode is only
to be used if Gigabit Ethernet switches are installed on the network
that have been configured to use the Spanning Tree protocol.
-- DualNet - In this mode, ports A and B are used as separate devices.
If you have a dual port adapter, port A will be configured as eth0
and port B as eth1. Both ports can be used independently with
distinct IP addresses. The preferred port setting is not used.
RLMT is turned off.
NOTE: RLMT modes CLP and CLPSS are designed to operate in configurations
where a network path between the ports on one adapter exists.
Moreover, they are not designed to work where adapters are connected
back-to-back.
***
5 Large Frame Support
======================
The driver supports large frames (also called jumbo frames). Using large
frames can result in an improved throughput if transferring large amounts
of data.
To enable large frames, set the MTU (maximum transfer unit) of the
interface to the desired value (up to 9000), execute the following
command:
ifconfig eth0 mtu 9000
This will only work if you have two adapters connected back-to-back
or if you use a switch that supports large frames. When using a switch,
it should be configured to allow large frames and auto-negotiation should
be set to OFF. The setting must be configured on all adapters that can be
reached by the large frames. If one adapter is not set to receive large
frames, it will simply drop them.
You can switch back to the standard ethernet frame size by executing the
following command:
ifconfig eth0 mtu 1500
To permanently configure this setting, add a script with the 'ifconfig'
line to the system startup sequence (named something like "S99sk98lin"
in /etc/rc.d/rc2.d).
***
6 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad)
==================================================================
The Marvell Yukon/SysKonnect Linux drivers are able to support VLAN and
Link Aggregation according to IEEE standards 802.1, 802.1q, and 802.3ad.
These features are only available after installation of open source
modules available on the Internet:
For VLAN go to: http://www.candelatech.com/~greear/vlan.html
For Link Aggregation go to: http://www.st.rim.or.jp/~yumo
NOTE: SysKonnect GmbH does not offer any support for these open source
modules and does not take the responsibility for any kind of
failures or problems arising in connection with these modules.
NOTE: Configuring Link Aggregation on a SysKonnect dual link adapter may
cause problems when unloading the driver.
7 Troubleshooting
==================
If any problems occur during the installation process, check the
following list:
Problem: The SK-98xx adapter cannot be found by the driver.
Solution: In /proc/pci search for the following entry:
'Ethernet controller: SysKonnect SK-98xx ...'
If this entry exists, the SK-98xx or SK-98xx V2.0 adapter has
been found by the system and should be operational.
If this entry does not exist or if the file '/proc/pci' is not
found, there may be a hardware problem or the PCI support may
not be enabled in your kernel.
The adapter can be checked using the diagnostics program which
is available on the SysKonnect web site:
www.syskonnect.com
Some COMPAQ machines have problems dealing with PCI under Linux.
This problem is described in the 'PCI howto' document
(included in some distributions or available from the
web, e.g. at 'www.linux.org').
Problem: Programs such as 'ifconfig' or 'route' cannot be found or the
error message 'Operation not permitted' is displayed.
Reason: You are not logged in as user 'root'.
Solution: Logout and login as 'root' or change to 'root' via 'su'.
Problem: Upon use of the command 'ping <address>' the message
"ping: sendto: Network is unreachable" is displayed.
Reason: Your route is not set correctly.
Solution: If you are using RedHat, you probably forgot to set up the
route in the 'network configuration'.
Check the existing routes with the 'route' command and check
if an entry for 'eth0' exists, and if so, if it is set correctly.
Problem: The driver can be started, the adapter is connected to the
network, but you cannot receive or transmit any packets;
e.g. 'ping' does not work.
Reason: There is an incorrect route in your routing table.
Solution: Check the routing table with the command 'route' and read the
manual help pages dealing with routes (enter 'man route').
NOTE: Although the 2.2.x kernel versions generate the routing entry
automatically, problems of this kind may occur here as well. We've
come across a situation in which the driver started correctly at
system start, but after the driver has been removed and reloaded,
the route of the adapter's network pointed to the 'dummy0'device
and had to be corrected manually.
Problem: Your computer should act as a router between multiple
IP subnetworks (using multiple adapters), but computers in
other subnetworks cannot be reached.
Reason: Either the router's kernel is not configured for IP forwarding
or the routing table and gateway configuration of at least one
computer is not working.
Problem: Upon driver start, the following error message is displayed:
"eth0: -- ERROR --
Class: internal Software error
Nr: 0xcc
Msg: SkGeInitPort() cannot init running ports"
Reason: You are using a driver compiled for single processor machines
on a multiprocessor machine with SMP (Symmetric MultiProcessor)
kernel.
Solution: Configure your kernel appropriately and recompile the kernel or
the modules.
If your problem is not listed here, please contact SysKonnect's technical
support for help (linux@syskonnect.de).
When contacting our technical support, please ensure that the following
information is available:
- System Manufacturer and HW Informations (CPU, Memory... )
- PCI-Boards in your system
- Distribution
- Kernel version
- Driver version
***
***End of Readme File***

View File

@ -2177,7 +2177,7 @@ config SKGE
with better performance and more complete ethtool support.
It does not support the link failover and network management
features available in the hardware.
features that "portable" vendor supplied sk98lin driver does.
This driver supports adapters based on the original Yukon chipset:
Marvell 88E8001, Belkin F5D5005, CNet GigaCard, DLink DGE-530T,
@ -2215,6 +2215,93 @@ config SKY2_DEBUG
If unsure, say N.
config SK98LIN
tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support (DEPRECATED)"
depends on PCI
---help---
Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx
compliant Gigabit Ethernet Adapter.
This driver supports the original Yukon chipset. This driver is
deprecated and will be removed from the kernel in the near future,
it has been replaced by the skge driver. skge is cleaner and
seems to work better.
This driver does not support the newer Yukon2 chipset. A separate
driver, sky2, is provided to support Yukon2-based adapters.
The following adapters are supported by this driver:
- 3Com 3C940 Gigabit LOM Ethernet Adapter
- 3Com 3C941 Gigabit LOM Ethernet Adapter
- Allied Telesyn AT-2970LX Gigabit Ethernet Adapter
- Allied Telesyn AT-2970LX/2SC Gigabit Ethernet Adapter
- Allied Telesyn AT-2970SX Gigabit Ethernet Adapter
- Allied Telesyn AT-2970SX/2SC Gigabit Ethernet Adapter
- Allied Telesyn AT-2970TX Gigabit Ethernet Adapter
- Allied Telesyn AT-2970TX/2TX Gigabit Ethernet Adapter
- Allied Telesyn AT-2971SX Gigabit Ethernet Adapter
- Allied Telesyn AT-2971T Gigabit Ethernet Adapter
- Belkin Gigabit Desktop Card 10/100/1000Base-T Adapter, Copper RJ-45
- EG1032 v2 Instant Gigabit Network Adapter
- EG1064 v2 Instant Gigabit Network Adapter
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Albatron)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Asus)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (ECS)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Epox)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Foxconn)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Gigabyte)
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Iwill)
- Marvell 88E8050 Gigabit LOM Ethernet Adapter (Intel)
- Marvell RDK-8001 Adapter
- Marvell RDK-8002 Adapter
- Marvell RDK-8003 Adapter
- Marvell RDK-8004 Adapter
- Marvell RDK-8006 Adapter
- Marvell RDK-8007 Adapter
- Marvell RDK-8008 Adapter
- Marvell RDK-8009 Adapter
- Marvell RDK-8010 Adapter
- Marvell RDK-8011 Adapter
- Marvell RDK-8012 Adapter
- Marvell RDK-8052 Adapter
- Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (32 bit)
- Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (64 bit)
- N-Way PCI-Bus Giga-Card 1000/100/10Mbps(L)
- SK-9521 10/100/1000Base-T Adapter
- SK-9521 V2.0 10/100/1000Base-T Adapter
- SK-9821 Gigabit Ethernet Server Adapter (SK-NET GE-T)
- SK-9821 V2.0 Gigabit Ethernet 10/100/1000Base-T Adapter
- SK-9822 Gigabit Ethernet Server Adapter (SK-NET GE-T dual link)
- SK-9841 Gigabit Ethernet Server Adapter (SK-NET GE-LX)
- SK-9841 V2.0 Gigabit Ethernet 1000Base-LX Adapter
- SK-9842 Gigabit Ethernet Server Adapter (SK-NET GE-LX dual link)
- SK-9843 Gigabit Ethernet Server Adapter (SK-NET GE-SX)
- SK-9843 V2.0 Gigabit Ethernet 1000Base-SX Adapter
- SK-9844 Gigabit Ethernet Server Adapter (SK-NET GE-SX dual link)
- SK-9851 V2.0 Gigabit Ethernet 1000Base-SX Adapter
- SK-9861 Gigabit Ethernet Server Adapter (SK-NET GE-SX Volition)
- SK-9861 V2.0 Gigabit Ethernet 1000Base-SX Adapter
- SK-9862 Gigabit Ethernet Server Adapter (SK-NET GE-SX Volition dual link)
- SK-9871 Gigabit Ethernet Server Adapter (SK-NET GE-ZX)
- SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter
- SK-9872 Gigabit Ethernet Server Adapter (SK-NET GE-ZX dual link)
- SMC EZ Card 1000 (SMC9452TXV.2)
The adapters support Jumbo Frames.
The dual link adapters support link-failover and dual port features.
Both Marvell Yukon and SysKonnect SK-98xx/SK-95xx adapters support
the scatter-gather functionality with sendfile(). Please refer to
<file:Documentation/networking/sk98lin.txt> for more information about
optional driver parameters.
Questions concerning this driver may be addressed to:
<linux@syskonnect.de>
If you want to compile this driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/kbuild/modules.txt>. The module will
be called sk98lin. This is recommended.
config VIA_VELOCITY
tristate "VIA Velocity support"
depends on PCI

View File

@ -66,6 +66,7 @@ ps3_gelic-objs += ps3_gelic_net.o
obj-$(CONFIG_TC35815) += tc35815.o
obj-$(CONFIG_SKGE) += skge.o
obj-$(CONFIG_SKY2) += sky2.o
obj-$(CONFIG_SK98LIN) += sk98lin/
obj-$(CONFIG_SKFP) += skfp/
obj-$(CONFIG_VIA_RHINE) += via-rhine.o
obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o

View File

@ -0,0 +1,87 @@
#
# Makefile for the SysKonnect SK-98xx device driver.
#
#
# Standalone driver params
# SKPARAM += -DSK_KERNEL_24
# SKPARAM += -DSK_KERNEL_24_26
# SKPARAM += -DSK_KERNEL_26
# SKPARAM += -DSK_KERNEL_22_24
obj-$(CONFIG_SK98LIN) += sk98lin.o
sk98lin-objs := \
skge.o \
skethtool.o \
skdim.o \
skaddr.o \
skgehwt.o \
skgeinit.o \
skgepnmi.o \
skgesirq.o \
ski2c.o \
sklm80.o \
skqueue.o \
skrlmt.o \
sktimer.o \
skvpd.o \
skxmac2.o
# DBGDEF = \
# -DDEBUG
ifdef DEBUG
DBGDEF += \
-DSK_DEBUG_CHKMOD=0x00000000L \
-DSK_DEBUG_CHKCAT=0x00000000L
endif
# **** possible debug modules for SK_DEBUG_CHKMOD *****************
# SK_DBGMOD_MERR 0x00000001L /* general module error indication */
# SK_DBGMOD_HWM 0x00000002L /* Hardware init module */
# SK_DBGMOD_RLMT 0x00000004L /* RLMT module */
# SK_DBGMOD_VPD 0x00000008L /* VPD module */
# SK_DBGMOD_I2C 0x00000010L /* I2C module */
# SK_DBGMOD_PNMI 0x00000020L /* PNMI module */
# SK_DBGMOD_CSUM 0x00000040L /* CSUM module */
# SK_DBGMOD_ADDR 0x00000080L /* ADDR module */
# SK_DBGMOD_DRV 0x00010000L /* DRV module */
# **** possible debug categories for SK_DEBUG_CHKCAT **************
# *** common modules ***
# SK_DBGCAT_INIT 0x00000001L module/driver initialization
# SK_DBGCAT_CTRL 0x00000002L controlling: add/rmv MCA/MAC and other controls (IOCTL)
# SK_DBGCAT_ERR 0x00000004L error handling paths
# SK_DBGCAT_TX 0x00000008L transmit path
# SK_DBGCAT_RX 0x00000010L receive path
# SK_DBGCAT_IRQ 0x00000020L general IRQ handling
# SK_DBGCAT_QUEUE 0x00000040L any queue management
# SK_DBGCAT_DUMP 0x00000080L large data output e.g. hex dump
# SK_DBGCAT_FATAL 0x00000100L large data output e.g. hex dump
# *** driver (file skge.c) ***
# SK_DBGCAT_DRV_ENTRY 0x00010000 entry points
# SK_DBGCAT_DRV_??? 0x00020000 not used
# SK_DBGCAT_DRV_MCA 0x00040000 multicast
# SK_DBGCAT_DRV_TX_PROGRESS 0x00080000 tx path
# SK_DBGCAT_DRV_RX_PROGRESS 0x00100000 rx path
# SK_DBGCAT_DRV_PROGRESS 0x00200000 general runtime
# SK_DBGCAT_DRV_??? 0x00400000 not used
# SK_DBGCAT_DRV_PROM 0x00800000 promiscuous mode
# SK_DBGCAT_DRV_TX_FRAME 0x01000000 display tx frames
# SK_DBGCAT_DRV_ERROR 0x02000000 error conditions
# SK_DBGCAT_DRV_INT_SRC 0x04000000 interrupts sources
# SK_DBGCAT_DRV_EVENT 0x08000000 driver events
EXTRA_CFLAGS += -Idrivers/net/sk98lin -DSK_DIAG_SUPPORT -DGENESIS -DYUKON $(DBGDEF) $(SKPARAM)
clean:
rm -f core *.o *.a *.s

View File

@ -0,0 +1,179 @@
/******************************************************************************
*
* Name: lm80.h
* Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.6 $
* Date: $Date: 2003/05/13 17:26:52 $
* Purpose: Contains all defines for the LM80 Chip
* (National Semiconductor).
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef __INC_LM80_H
#define __INC_LM80_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* defines ********************************************************************/
/*
* LM80 register definition
*
* All registers are 8 bit wide
*/
#define LM80_CFG 0x00 /* Configuration Register */
#define LM80_ISRC_1 0x01 /* Interrupt Status Register 1 */
#define LM80_ISRC_2 0x02 /* Interrupt Status Register 2 */
#define LM80_IMSK_1 0x03 /* Interrupt Mask Register 1 */
#define LM80_IMSK_2 0x04 /* Interrupt Mask Register 2 */
#define LM80_FAN_CTRL 0x05 /* Fan Devisor/RST#/OS# Register */
#define LM80_TEMP_CTRL 0x06 /* OS# Config, Temp Res. Reg */
/* 0x07 - 0x1f reserved */
/* current values */
#define LM80_VT0_IN 0x20 /* current Voltage 0 value */
#define LM80_VT1_IN 0x21 /* current Voltage 1 value */
#define LM80_VT2_IN 0x22 /* current Voltage 2 value */
#define LM80_VT3_IN 0x23 /* current Voltage 3 value */
#define LM80_VT4_IN 0x24 /* current Voltage 4 value */
#define LM80_VT5_IN 0x25 /* current Voltage 5 value */
#define LM80_VT6_IN 0x26 /* current Voltage 6 value */
#define LM80_TEMP_IN 0x27 /* current Temperature value */
#define LM80_FAN1_IN 0x28 /* current Fan 1 count */
#define LM80_FAN2_IN 0x29 /* current Fan 2 count */
/* limit values */
#define LM80_VT0_HIGH_LIM 0x2a /* high limit val for Voltage 0 */
#define LM80_VT0_LOW_LIM 0x2b /* low limit val for Voltage 0 */
#define LM80_VT1_HIGH_LIM 0x2c /* high limit val for Voltage 1 */
#define LM80_VT1_LOW_LIM 0x2d /* low limit val for Voltage 1 */
#define LM80_VT2_HIGH_LIM 0x2e /* high limit val for Voltage 2 */
#define LM80_VT2_LOW_LIM 0x2f /* low limit val for Voltage 2 */
#define LM80_VT3_HIGH_LIM 0x30 /* high limit val for Voltage 3 */
#define LM80_VT3_LOW_LIM 0x31 /* low limit val for Voltage 3 */
#define LM80_VT4_HIGH_LIM 0x32 /* high limit val for Voltage 4 */
#define LM80_VT4_LOW_LIM 0x33 /* low limit val for Voltage 4 */
#define LM80_VT5_HIGH_LIM 0x34 /* high limit val for Voltage 5 */
#define LM80_VT5_LOW_LIM 0x35 /* low limit val for Voltage 5 */
#define LM80_VT6_HIGH_LIM 0x36 /* high limit val for Voltage 6 */
#define LM80_VT6_LOW_LIM 0x37 /* low limit val for Voltage 6 */
#define LM80_THOT_LIM_UP 0x38 /* hot temperature limit (high) */
#define LM80_THOT_LIM_LO 0x39 /* hot temperature limit (low) */
#define LM80_TOS_LIM_UP 0x3a /* OS temperature limit (high) */
#define LM80_TOS_LIM_LO 0x3b /* OS temperature limit (low) */
#define LM80_FAN1_COUNT_LIM 0x3c /* Fan 1 count limit (high) */
#define LM80_FAN2_COUNT_LIM 0x3d /* Fan 2 count limit (low) */
/* 0x3e - 0x3f reserved */
/*
* LM80 bit definitions
*/
/* LM80_CFG Configuration Register */
#define LM80_CFG_START (1<<0) /* start monitoring operation */
#define LM80_CFG_INT_ENA (1<<1) /* enables the INT# Interrupt output */
#define LM80_CFG_INT_POL (1<<2) /* INT# pol: 0 act low, 1 act high */
#define LM80_CFG_INT_CLR (1<<3) /* disables INT#/RST_OUT#/OS# outputs */
#define LM80_CFG_RESET (1<<4) /* signals a reset */
#define LM80_CFG_CHASS_CLR (1<<5) /* clears Chassis Intrusion (CI) pin */
#define LM80_CFG_GPO (1<<6) /* drives the GPO# pin */
#define LM80_CFG_INIT (1<<7) /* restore power on defaults */
/* LM80_ISRC_1 Interrupt Status Register 1 */
/* LM80_IMSK_1 Interrupt Mask Register 1 */
#define LM80_IS_VT0 (1<<0) /* limit exceeded for Voltage 0 */
#define LM80_IS_VT1 (1<<1) /* limit exceeded for Voltage 1 */
#define LM80_IS_VT2 (1<<2) /* limit exceeded for Voltage 2 */
#define LM80_IS_VT3 (1<<3) /* limit exceeded for Voltage 3 */
#define LM80_IS_VT4 (1<<4) /* limit exceeded for Voltage 4 */
#define LM80_IS_VT5 (1<<5) /* limit exceeded for Voltage 5 */
#define LM80_IS_VT6 (1<<6) /* limit exceeded for Voltage 6 */
#define LM80_IS_INT_IN (1<<7) /* state of INT_IN# */
/* LM80_ISRC_2 Interrupt Status Register 2 */
/* LM80_IMSK_2 Interrupt Mask Register 2 */
#define LM80_IS_TEMP (1<<0) /* HOT temperature limit exceeded */
#define LM80_IS_BTI (1<<1) /* state of BTI# pin */
#define LM80_IS_FAN1 (1<<2) /* count limit exceeded for Fan 1 */
#define LM80_IS_FAN2 (1<<3) /* count limit exceeded for Fan 2 */
#define LM80_IS_CI (1<<4) /* Chassis Intrusion occured */
#define LM80_IS_OS (1<<5) /* OS temperature limit exceeded */
/* bit 6 and 7 are reserved in LM80_ISRC_2 */
#define LM80_IS_HT_IRQ_MD (1<<6) /* Hot temperature interrupt mode */
#define LM80_IS_OT_IRQ_MD (1<<7) /* OS temperature interrupt mode */
/* LM80_FAN_CTRL Fan Devisor/RST#/OS# Register */
#define LM80_FAN1_MD_SEL (1<<0) /* Fan 1 mode select */
#define LM80_FAN2_MD_SEL (1<<1) /* Fan 2 mode select */
#define LM80_FAN1_PRM_CTL (3<<2) /* Fan 1 speed control */
#define LM80_FAN2_PRM_CTL (3<<4) /* Fan 2 speed control */
#define LM80_FAN_OS_ENA (1<<6) /* enable OS mode on RST_OUT#/OS# pins*/
#define LM80_FAN_RST_ENA (1<<7) /* sets RST_OUT#/OS# pins in RST mode */
/* LM80_TEMP_CTRL OS# Config, Temp Res. Reg */
#define LM80_TEMP_OS_STAT (1<<0) /* mirrors the state of RST_OUT#/OS# */
#define LM80_TEMP_OS_POL (1<<1) /* select OS# polarity */
#define LM80_TEMP_OS_MODE (1<<2) /* selects Interrupt mode */
#define LM80_TEMP_RES (1<<3) /* selects 9 or 11 bit temp resulution*/
#define LM80_TEMP_LSB (0xf<<4)/* 4 LSBs of 11 bit temp data */
#define LM80_TEMP_LSB_9 (1<<7) /* LSB of 9 bit temperature data */
/* 0x07 - 0x1f reserved */
/* LM80_VT0_IN current Voltage 0 value */
/* LM80_VT1_IN current Voltage 1 value */
/* LM80_VT2_IN current Voltage 2 value */
/* LM80_VT3_IN current Voltage 3 value */
/* LM80_VT4_IN current Voltage 4 value */
/* LM80_VT5_IN current Voltage 5 value */
/* LM80_VT6_IN current Voltage 6 value */
/* LM80_TEMP_IN current temperature value */
/* LM80_FAN1_IN current Fan 1 count */
/* LM80_FAN2_IN current Fan 2 count */
/* LM80_VT0_HIGH_LIM high limit val for Voltage 0 */
/* LM80_VT0_LOW_LIM low limit val for Voltage 0 */
/* LM80_VT1_HIGH_LIM high limit val for Voltage 1 */
/* LM80_VT1_LOW_LIM low limit val for Voltage 1 */
/* LM80_VT2_HIGH_LIM high limit val for Voltage 2 */
/* LM80_VT2_LOW_LIM low limit val for Voltage 2 */
/* LM80_VT3_HIGH_LIM high limit val for Voltage 3 */
/* LM80_VT3_LOW_LIM low limit val for Voltage 3 */
/* LM80_VT4_HIGH_LIM high limit val for Voltage 4 */
/* LM80_VT4_LOW_LIM low limit val for Voltage 4 */
/* LM80_VT5_HIGH_LIM high limit val for Voltage 5 */
/* LM80_VT5_LOW_LIM low limit val for Voltage 5 */
/* LM80_VT6_HIGH_LIM high limit val for Voltage 6 */
/* LM80_VT6_LOW_LIM low limit val for Voltage 6 */
/* LM80_THOT_LIM_UP hot temperature limit (high) */
/* LM80_THOT_LIM_LO hot temperature limit (low) */
/* LM80_TOS_LIM_UP OS temperature limit (high) */
/* LM80_TOS_LIM_LO OS temperature limit (low) */
/* LM80_FAN1_COUNT_LIM Fan 1 count limit (high) */
/* LM80_FAN2_COUNT_LIM Fan 2 count limit (low) */
/* 0x3e - 0x3f reserved */
#define LM80_ADDR 0x28 /* LM80 default addr */
/* typedefs *******************************************************************/
/* function prototypes ********************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_LM80_H */

View File

@ -0,0 +1,285 @@
/******************************************************************************
*
* Name: skaddr.h
* Project: Gigabit Ethernet Adapters, ADDR-Modul
* Version: $Revision: 1.29 $
* Date: $Date: 2003/05/13 16:57:24 $
* Purpose: Header file for Address Management (MC, UC, Prom).
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This module is intended to manage multicast addresses and promiscuous mode
* on GEnesis adapters.
*
* Include File Hierarchy:
*
* "skdrv1st.h"
* ...
* "sktypes.h"
* "skqueue.h"
* "skaddr.h"
* ...
* "skdrv2nd.h"
*
******************************************************************************/
#ifndef __INC_SKADDR_H
#define __INC_SKADDR_H
#ifdef __cplusplus
extern "C" {
#endif /* cplusplus */
/* defines ********************************************************************/
#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */
#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */
/* ----- Common return values ----- */
#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */
#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */
#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */
/* ----- Clear/Add flag bits ----- */
#define SK_ADDR_PERMANENT 1 /* RLMT Address */
/* ----- Additional Clear flag bits ----- */
#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */
/* ----- Override flag bits ----- */
#define SK_ADDR_LOGICAL_ADDRESS 0
#define SK_ADDR_VIRTUAL_ADDRESS (SK_ADDR_LOGICAL_ADDRESS) /* old */
#define SK_ADDR_PHYSICAL_ADDRESS 1
#define SK_ADDR_CLEAR_LOGICAL 2
#define SK_ADDR_SET_LOGICAL 4
/* ----- Override return values ----- */
#define SK_ADDR_OVERRIDE_SUCCESS (SK_ADDR_SUCCESS)
#define SK_ADDR_DUPLICATE_ADDRESS 1
#define SK_ADDR_MULTICAST_ADDRESS 2
/* ----- Partitioning of excact match table ----- */
#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */
#define SK_ADDR_FIRST_MATCH_RLMT 1
#define SK_ADDR_LAST_MATCH_RLMT 2
#define SK_ADDR_FIRST_MATCH_DRV 3
#define SK_ADDR_LAST_MATCH_DRV (SK_ADDR_EXACT_MATCHES - 1)
/* ----- SkAddrMcAdd/SkAddrMcUpdate return values ----- */
#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */
#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */
/* ----- Additional SkAddrMcAdd return values ----- */
#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */
#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */
#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */
/* Promiscuous mode bits ----- */
#define SK_PROM_MODE_NONE 0 /* Normal receive. */
#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */
#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */
/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */
/* Macros */
#ifdef OLD_STUFF
#ifndef SK_ADDR_EQUAL
/*
* "&" instead of "&&" allows better optimization on IA-64.
* The replacement is safe here, as all bytes exist.
*/
#ifndef SK_ADDR_DWORD_COMPARE
#define SK_ADDR_EQUAL(A1,A2) ( \
(((SK_U8 *)(A1))[5] == ((SK_U8 *)(A2))[5]) & \
(((SK_U8 *)(A1))[4] == ((SK_U8 *)(A2))[4]) & \
(((SK_U8 *)(A1))[3] == ((SK_U8 *)(A2))[3]) & \
(((SK_U8 *)(A1))[2] == ((SK_U8 *)(A2))[2]) & \
(((SK_U8 *)(A1))[1] == ((SK_U8 *)(A2))[1]) & \
(((SK_U8 *)(A1))[0] == ((SK_U8 *)(A2))[0]))
#else /* SK_ADDR_DWORD_COMPARE */
#define SK_ADDR_EQUAL(A1,A2) ( \
(*(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2])) & \
(*(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])))
#endif /* SK_ADDR_DWORD_COMPARE */
#endif /* SK_ADDR_EQUAL */
#endif /* 0 */
#ifndef SK_ADDR_EQUAL
#ifndef SK_ADDR_DWORD_COMPARE
#define SK_ADDR_EQUAL(A1,A2) ( \
(((SK_U8 SK_FAR *)(A1))[5] == ((SK_U8 SK_FAR *)(A2))[5]) & \
(((SK_U8 SK_FAR *)(A1))[4] == ((SK_U8 SK_FAR *)(A2))[4]) & \
(((SK_U8 SK_FAR *)(A1))[3] == ((SK_U8 SK_FAR *)(A2))[3]) & \
(((SK_U8 SK_FAR *)(A1))[2] == ((SK_U8 SK_FAR *)(A2))[2]) & \
(((SK_U8 SK_FAR *)(A1))[1] == ((SK_U8 SK_FAR *)(A2))[1]) & \
(((SK_U8 SK_FAR *)(A1))[0] == ((SK_U8 SK_FAR *)(A2))[0]))
#else /* SK_ADDR_DWORD_COMPARE */
#define SK_ADDR_EQUAL(A1,A2) ( \
(*(SK_U16 SK_FAR *)&(((SK_U8 SK_FAR *)(A1))[4]) == \
*(SK_U16 SK_FAR *)&(((SK_U8 SK_FAR *)(A2))[4])) && \
(*(SK_U32 SK_FAR *)&(((SK_U8 SK_FAR *)(A1))[0]) == \
*(SK_U32 SK_FAR *)&(((SK_U8 SK_FAR *)(A2))[0])))
#endif /* SK_ADDR_DWORD_COMPARE */
#endif /* SK_ADDR_EQUAL */
/* typedefs *******************************************************************/
typedef struct s_MacAddr {
SK_U8 a[SK_MAC_ADDR_LEN];
} SK_MAC_ADDR;
/* SK_FILTER is used to ensure alignment of the filter. */
typedef union s_InexactFilter {
SK_U8 Bytes[8];
SK_U64 Val; /* Dummy entry for alignment only. */
} SK_FILTER64;
typedef struct s_AddrNet SK_ADDR_NET;
typedef struct s_AddrPort {
/* ----- Public part (read-only) ----- */
SK_MAC_ADDR CurrentMacAddress; /* Current physical MAC Address. */
SK_MAC_ADDR PermanentMacAddress; /* Permanent physical MAC Address. */
int PromMode; /* Promiscuous Mode. */
/* ----- Private part ----- */
SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */
SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */
SK_U8 Align01;
SK_U32 FirstExactMatchRlmt;
SK_U32 NextExactMatchRlmt;
SK_U32 FirstExactMatchDrv;
SK_U32 NextExactMatchDrv;
SK_MAC_ADDR Exact[SK_ADDR_EXACT_MATCHES];
SK_FILTER64 InexactFilter; /* For 64-bit hash register. */
SK_FILTER64 InexactRlmtFilter; /* For 64-bit hash register. */
SK_FILTER64 InexactDrvFilter; /* For 64-bit hash register. */
} SK_ADDR_PORT;
struct s_AddrNet {
/* ----- Public part (read-only) ----- */
SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */
SK_MAC_ADDR PermanentMacAddress; /* Logical MAC Address. */
/* ----- Private part ----- */
SK_U32 ActivePort; /* View of module ADDR. */
SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */
SK_U8 Align01;
SK_U16 Align02;
};
typedef struct s_Addr {
/* ----- Public part (read-only) ----- */
SK_ADDR_NET Net[SK_MAX_NETS];
SK_ADDR_PORT Port[SK_MAX_MACS];
/* ----- Private part ----- */
} SK_ADDR;
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
/* Functions provided by SkAddr */
/* ANSI/C++ compliant function prototypes */
extern int SkAddrInit(
SK_AC *pAC,
SK_IOC IoC,
int Level);
extern int SkAddrMcClear(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int Flags);
extern int SkAddrMcAdd(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
SK_MAC_ADDR *pMc,
int Flags);
extern int SkAddrMcUpdate(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber);
extern int SkAddrOverride(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
SK_MAC_ADDR SK_FAR *pNewAddr,
int Flags);
extern int SkAddrPromiscuousChange(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 PortNumber,
int NewPromMode);
#ifndef SK_SLIM
extern int SkAddrSwap(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 FromPortNumber,
SK_U32 ToPortNumber);
#endif
#else /* defined(SK_KR_PROTO)) */
/* Non-ANSI/C++ compliant function prototypes */
#error KR-style prototypes are not yet provided.
#endif /* defined(SK_KR_PROTO)) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_SKADDR_H */

View File

@ -0,0 +1,213 @@
/******************************************************************************
*
* Name: skcsum.h
* Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx)
* Version: $Revision: 1.10 $
* Date: $Date: 2003/08/20 13:59:57 $
* Purpose: Store/verify Internet checksum in send/receive packets.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2001 SysKonnect GmbH.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* Public header file for the "GEnesis" common module "CSUM".
*
* "GEnesis" is an abbreviation of "Gigabit Ethernet Network System in Silicon"
* and is the code name of this SysKonnect project.
*
* Compilation Options:
*
* SK_USE_CSUM - Define if CSUM is to be used. Otherwise, CSUM will be an
* empty module.
*
* SKCS_OVERWRITE_PROTO - Define to overwrite the default protocol id
* definitions. In this case, all SKCS_PROTO_xxx definitions must be made
* external.
*
* SKCS_OVERWRITE_STATUS - Define to overwrite the default return status
* definitions. In this case, all SKCS_STATUS_xxx definitions must be made
* external.
*
* Include File Hierarchy:
*
* "h/skcsum.h"
* "h/sktypes.h"
* "h/skqueue.h"
*
******************************************************************************/
#ifndef __INC_SKCSUM_H
#define __INC_SKCSUM_H
#include "h/sktypes.h"
#include "h/skqueue.h"
/* defines ********************************************************************/
/*
* Define the default bit flags for 'SKCS_PACKET_INFO.ProtocolFlags' if no user
* overwrite.
*/
#ifndef SKCS_OVERWRITE_PROTO /* User overwrite? */
#define SKCS_PROTO_IP 0x1 /* IP (Internet Protocol version 4) */
#define SKCS_PROTO_TCP 0x2 /* TCP (Transmission Control Protocol) */
#define SKCS_PROTO_UDP 0x4 /* UDP (User Datagram Protocol) */
/* Indices for protocol statistics. */
#define SKCS_PROTO_STATS_IP 0
#define SKCS_PROTO_STATS_UDP 1
#define SKCS_PROTO_STATS_TCP 2
#define SKCS_NUM_PROTOCOLS 3 /* Number of supported protocols. */
#endif /* !SKCS_OVERWRITE_PROTO */
/*
* Define the default SKCS_STATUS type and values if no user overwrite.
*
* SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame.
* SKCS_STATUS_IP_CSUM_ERROR - IP checksum error.
* SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame.
* SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame
* SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok).
* SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame).
* SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok).
* SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok).
* SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok.
* SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok.
* SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum.
*/
#ifndef SKCS_OVERWRITE_STATUS /* User overwrite? */
#define SKCS_STATUS int /* Define status type. */
#define SKCS_STATUS_UNKNOWN_IP_VERSION 1
#define SKCS_STATUS_IP_CSUM_ERROR 2
#define SKCS_STATUS_IP_FRAGMENT 3
#define SKCS_STATUS_IP_CSUM_OK 4
#define SKCS_STATUS_TCP_CSUM_ERROR 5
#define SKCS_STATUS_UDP_CSUM_ERROR 6
#define SKCS_STATUS_TCP_CSUM_OK 7
#define SKCS_STATUS_UDP_CSUM_OK 8
/* needed for Microsoft */
#define SKCS_STATUS_IP_CSUM_ERROR_UDP 9
#define SKCS_STATUS_IP_CSUM_ERROR_TCP 10
/* UDP checksum may be omitted */
#define SKCS_STATUS_IP_CSUM_OK_NO_UDP 11
#endif /* !SKCS_OVERWRITE_STATUS */
/* Clear protocol statistics event. */
#define SK_CSUM_EVENT_CLEAR_PROTO_STATS 1
/*
* Add two values in one's complement.
*
* Note: One of the two input values may be "longer" than 16-bit, but then the
* resulting sum may be 17 bits long. In this case, add zero to the result using
* SKCS_OC_ADD() again.
*
* Result = Value1 + Value2
*/
#define SKCS_OC_ADD(Result, Value1, Value2) { \
unsigned long Sum; \
\
Sum = (unsigned long) (Value1) + (unsigned long) (Value2); \
/* Add-in any carry. */ \
(Result) = (Sum & 0xffff) + (Sum >> 16); \
}
/*
* Subtract two values in one's complement.
*
* Result = Value1 - Value2
*/
#define SKCS_OC_SUB(Result, Value1, Value2) \
SKCS_OC_ADD((Result), (Value1), ~(Value2) & 0xffff)
/* typedefs *******************************************************************/
/*
* SKCS_PROTO_STATS - The CSUM protocol statistics structure.
*
* There is one instance of this structure for each protocol supported.
*/
typedef struct s_CsProtocolStatistics {
SK_U64 RxOkCts; /* Receive checksum ok. */
SK_U64 RxUnableCts; /* Unable to verify receive checksum. */
SK_U64 RxErrCts; /* Receive checksum error. */
SK_U64 TxOkCts; /* Transmit checksum ok. */
SK_U64 TxUnableCts; /* Unable to calculate checksum in hw. */
} SKCS_PROTO_STATS;
/*
* s_Csum - The CSUM module context structure.
*/
typedef struct s_Csum {
/* Enabled receive SK_PROTO_XXX bit flags. */
unsigned ReceiveFlags[SK_MAX_NETS];
#ifdef TX_CSUM
unsigned TransmitFlags[SK_MAX_NETS];
#endif /* TX_CSUM */
/* The protocol statistics structure; one per supported protocol. */
SKCS_PROTO_STATS ProtoStats[SK_MAX_NETS][SKCS_NUM_PROTOCOLS];
} SK_CSUM;
/*
* SKCS_PACKET_INFO - The packet information structure.
*/
typedef struct s_CsPacketInfo {
/* Bit field specifiying the desired/found protocols. */
unsigned ProtocolFlags;
/* Length of complete IP header, including any option fields. */
unsigned IpHeaderLength;
/* IP header checksum. */
unsigned IpHeaderChecksum;
/* TCP/UDP pseudo header checksum. */
unsigned PseudoHeaderChecksum;
} SKCS_PACKET_INFO;
/* function prototypes ********************************************************/
#ifndef SK_CS_CALCULATE_CHECKSUM
extern unsigned SkCsCalculateChecksum(
void *pData,
unsigned Length);
#endif /* SK_CS_CALCULATE_CHECKSUM */
extern int SkCsEvent(
SK_AC *pAc,
SK_IOC Ioc,
SK_U32 Event,
SK_EVPARA Param);
extern SKCS_STATUS SkCsGetReceiveInfo(
SK_AC *pAc,
void *pIpHeader,
unsigned Checksum1,
unsigned Checksum2,
int NetNumber);
extern void SkCsSetReceiveFlags(
SK_AC *pAc,
unsigned ReceiveFlags,
unsigned *pChecksum1Offset,
unsigned *pChecksum2Offset,
int NetNumber);
#endif /* __INC_SKCSUM_H */

View File

@ -0,0 +1,74 @@
/******************************************************************************
*
* Name: skdebug.h
* Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.14 $
* Date: $Date: 2003/05/13 17:26:00 $
* Purpose: SK specific DEBUG support
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef __INC_SKDEBUG_H
#define __INC_SKDEBUG_H
#ifdef DEBUG
#ifndef SK_DBG_MSG
#define SK_DBG_MSG(pAC,comp,cat,arg) \
if ( ((comp) & SK_DBG_CHKMOD(pAC)) && \
((cat) & SK_DBG_CHKCAT(pAC)) ) { \
SK_DBG_PRINTF arg ; \
}
#endif
#else
#define SK_DBG_MSG(pAC,comp,lev,arg)
#endif
/* PLS NOTE:
* =========
* Due to any restrictions of kernel printf routines do not use other
* format identifiers as: %x %d %c %s .
* Never use any combined format identifiers such as: %lx %ld in your
* printf - argument (arg) because some OS specific kernel printfs may
* only support some basic identifiers.
*/
/* Debug modules */
#define SK_DBGMOD_MERR 0x00000001L /* general module error indication */
#define SK_DBGMOD_HWM 0x00000002L /* Hardware init module */
#define SK_DBGMOD_RLMT 0x00000004L /* RLMT module */
#define SK_DBGMOD_VPD 0x00000008L /* VPD module */
#define SK_DBGMOD_I2C 0x00000010L /* I2C module */
#define SK_DBGMOD_PNMI 0x00000020L /* PNMI module */
#define SK_DBGMOD_CSUM 0x00000040L /* CSUM module */
#define SK_DBGMOD_ADDR 0x00000080L /* ADDR module */
#define SK_DBGMOD_PECP 0x00000100L /* PECP module */
#define SK_DBGMOD_POWM 0x00000200L /* Power Management module */
/* Debug events */
#define SK_DBGCAT_INIT 0x00000001L /* module/driver initialization */
#define SK_DBGCAT_CTRL 0x00000002L /* controlling devices */
#define SK_DBGCAT_ERR 0x00000004L /* error handling paths */
#define SK_DBGCAT_TX 0x00000008L /* transmit path */
#define SK_DBGCAT_RX 0x00000010L /* receive path */
#define SK_DBGCAT_IRQ 0x00000020L /* general IRQ handling */
#define SK_DBGCAT_QUEUE 0x00000040L /* any queue management */
#define SK_DBGCAT_DUMP 0x00000080L /* large data output e.g. hex dump */
#define SK_DBGCAT_FATAL 0x00000100L /* fatal error */
#endif /* __INC_SKDEBUG_H */

View File

@ -0,0 +1,188 @@
/******************************************************************************
*
* Name: skdrv1st.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.4 $
* Date: $Date: 2003/11/12 14:28:14 $
* Purpose: First header file for driver and all other modules
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This is the first include file of the driver, which includes all
* neccessary system header files and some of the GEnesis header files.
* It also defines some basic items.
*
* Include File Hierarchy:
*
* see skge.c
*
******************************************************************************/
#ifndef __INC_SKDRV1ST_H
#define __INC_SKDRV1ST_H
typedef struct s_AC SK_AC;
/* Set card versions */
#define SK_FAR
/* override some default functions with optimized linux functions */
#define SK_PNMI_STORE_U16(p,v) memcpy((char*)(p),(char*)&(v),2)
#define SK_PNMI_STORE_U32(p,v) memcpy((char*)(p),(char*)&(v),4)
#define SK_PNMI_STORE_U64(p,v) memcpy((char*)(p),(char*)&(v),8)
#define SK_PNMI_READ_U16(p,v) memcpy((char*)&(v),(char*)(p),2)
#define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),4)
#define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),8)
#define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6))
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/bitops.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <net/checksum.h>
#define SK_CS_CALCULATE_CHECKSUM
#ifndef CONFIG_X86_64
#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
#else
#define SkCsCalculateChecksum(p,l) ((~ip_fast_csum(p, l)) & 0xffff)
#endif
#include "h/sktypes.h"
#include "h/skerror.h"
#include "h/skdebug.h"
#include "h/lm80.h"
#include "h/xmac_ii.h"
#ifdef __LITTLE_ENDIAN
#define SK_LITTLE_ENDIAN
#else
#define SK_BIG_ENDIAN
#endif
#define SK_NET_DEVICE net_device
/* we use gethrtime(), return unit: nanoseconds */
#define SK_TICKS_PER_SEC 100
#define SK_MEM_MAPPED_IO
// #define SK_RLMT_SLOW_LOOKAHEAD
#define SK_MAX_MACS 2
#define SK_MAX_NETS 2
#define SK_IOC char __iomem *
typedef struct s_DrvRlmtMbuf SK_MBUF;
#define SK_CONST64 INT64_C
#define SK_CONSTU64 UINT64_C
#define SK_MEMCPY(dest,src,size) memcpy(dest,src,size)
#define SK_MEMCMP(s1,s2,size) memcmp(s1,s2,size)
#define SK_MEMSET(dest,val,size) memset(dest,val,size)
#define SK_STRLEN(pStr) strlen((char*)(pStr))
#define SK_STRNCPY(pDest,pSrc,size) strncpy((char*)(pDest),(char*)(pSrc),size)
#define SK_STRCMP(pStr1,pStr2) strcmp((char*)(pStr1),(char*)(pStr2))
/* macros to access the adapter */
#define SK_OUT8(b,a,v) writeb((v), ((b)+(a)))
#define SK_OUT16(b,a,v) writew((v), ((b)+(a)))
#define SK_OUT32(b,a,v) writel((v), ((b)+(a)))
#define SK_IN8(b,a,pv) (*(pv) = readb((b)+(a)))
#define SK_IN16(b,a,pv) (*(pv) = readw((b)+(a)))
#define SK_IN32(b,a,pv) (*(pv) = readl((b)+(a)))
#define int8_t char
#define int16_t short
#define int32_t long
#define int64_t long long
#define uint8_t u_char
#define uint16_t u_short
#define uint32_t u_long
#define uint64_t unsigned long long
#define t_scalar_t int
#define t_uscalar_t unsigned int
#define uintptr_t unsigned long
#define __CONCAT__(A,B) A##B
#define INT32_C(a) __CONCAT__(a,L)
#define INT64_C(a) __CONCAT__(a,LL)
#define UINT32_C(a) __CONCAT__(a,UL)
#define UINT64_C(a) __CONCAT__(a,ULL)
#ifdef DEBUG
#define SK_DBG_PRINTF printk
#ifndef SK_DEBUG_CHKMOD
#define SK_DEBUG_CHKMOD 0
#endif
#ifndef SK_DEBUG_CHKCAT
#define SK_DEBUG_CHKCAT 0
#endif
/* those come from the makefile */
#define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD)
#define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT)
extern void SkDbgPrintf(const char *format,...);
#define SK_DBGMOD_DRV 0x00010000
/**** possible driver debug categories ********************************/
#define SK_DBGCAT_DRV_ENTRY 0x00010000
#define SK_DBGCAT_DRV_SAP 0x00020000
#define SK_DBGCAT_DRV_MCA 0x00040000
#define SK_DBGCAT_DRV_TX_PROGRESS 0x00080000
#define SK_DBGCAT_DRV_RX_PROGRESS 0x00100000
#define SK_DBGCAT_DRV_PROGRESS 0x00200000
#define SK_DBGCAT_DRV_MSG 0x00400000
#define SK_DBGCAT_DRV_PROM 0x00800000
#define SK_DBGCAT_DRV_TX_FRAME 0x01000000
#define SK_DBGCAT_DRV_ERROR 0x02000000
#define SK_DBGCAT_DRV_INT_SRC 0x04000000
#define SK_DBGCAT_DRV_EVENT 0x08000000
#endif
#define SK_ERR_LOG SkErrorLog
extern void SkErrorLog(SK_AC*, int, int, char*);
#endif

View File

@ -0,0 +1,447 @@
/******************************************************************************
*
* Name: skdrv2nd.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.10 $
* Date: $Date: 2003/12/11 16:04:45 $
* Purpose: Second header file for driver and all other modules
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This is the second include file of the driver, which includes all other
* neccessary files and defines all structures and constants used by the
* driver and the common modules.
*
* Include File Hierarchy:
*
* see skge.c
*
******************************************************************************/
#ifndef __INC_SKDRV2ND_H
#define __INC_SKDRV2ND_H
#include "h/skqueue.h"
#include "h/skgehwt.h"
#include "h/sktimer.h"
#include "h/ski2c.h"
#include "h/skgepnmi.h"
#include "h/skvpd.h"
#include "h/skgehw.h"
#include "h/skgeinit.h"
#include "h/skaddr.h"
#include "h/skgesirq.h"
#include "h/skcsum.h"
#include "h/skrlmt.h"
#include "h/skgedrv.h"
extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned);
extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*);
extern SK_U64 SkOsGetTime(SK_AC*);
extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);
extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);
extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);
extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
#ifdef SK_DIAG_SUPPORT
extern int SkDrvEnterDiagMode(SK_AC *pAc);
extern int SkDrvLeaveDiagMode(SK_AC *pAc);
#endif
struct s_DrvRlmtMbuf {
SK_MBUF *pNext; /* Pointer to next RLMT Mbuf. */
SK_U8 *pData; /* Data buffer (virtually contig.). */
unsigned Size; /* Data buffer size. */
unsigned Length; /* Length of packet (<= Size). */
SK_U32 PortIdx; /* Receiving/transmitting port. */
#ifdef SK_RLMT_MBUF_PRIVATE
SK_RLMT_MBUF Rlmt; /* Private part for RLMT. */
#endif /* SK_RLMT_MBUF_PRIVATE */
struct sk_buff *pOs; /* Pointer to message block */
};
/*
* Time macros
*/
#if SK_TICKS_PER_SEC == 100
#define SK_PNMI_HUNDREDS_SEC(t) (t)
#else
#define SK_PNMI_HUNDREDS_SEC(t) ((((unsigned long)t) * 100) / \
(SK_TICKS_PER_SEC))
#endif
/*
* New SkOsGetTime
*/
#define SkOsGetTimeCurrent(pAC, pUsec) {\
struct timeval t;\
do_gettimeofday(&t);\
*pUsec = ((((t.tv_sec) * 1000000L)+t.tv_usec)/10000);\
}
/*
* ioctl definitions
*/
#define SK_IOCTL_BASE (SIOCDEVPRIVATE)
#define SK_IOCTL_GETMIB (SK_IOCTL_BASE + 0)
#define SK_IOCTL_SETMIB (SK_IOCTL_BASE + 1)
#define SK_IOCTL_PRESETMIB (SK_IOCTL_BASE + 2)
#define SK_IOCTL_GEN (SK_IOCTL_BASE + 3)
#define SK_IOCTL_DIAG (SK_IOCTL_BASE + 4)
typedef struct s_IOCTL SK_GE_IOCTL;
struct s_IOCTL {
char __user * pData;
unsigned int Len;
};
/*
* define sizes of descriptor rings in bytes
*/
#define TX_RING_SIZE (8*1024)
#define RX_RING_SIZE (24*1024)
/*
* Buffer size for ethernet packets
*/
#define ETH_BUF_SIZE 1540
#define ETH_MAX_MTU 1514
#define ETH_MIN_MTU 60
#define ETH_MULTICAST_BIT 0x01
#define SK_JUMBO_MTU 9000
/*
* transmit priority selects the queue: LOW=asynchron, HIGH=synchron
*/
#define TX_PRIO_LOW 0
#define TX_PRIO_HIGH 1
/*
* alignment of rx/tx descriptors
*/
#define DESCR_ALIGN 64
/*
* definitions for pnmi. TODO
*/
#define SK_DRIVER_RESET(pAC, IoC) 0
#define SK_DRIVER_SENDEVENT(pAC, IoC) 0
#define SK_DRIVER_SELFTEST(pAC, IoC) 0
/* For get mtu you must add an own function */
#define SK_DRIVER_GET_MTU(pAc,IoC,i) 0
#define SK_DRIVER_SET_MTU(pAc,IoC,i,v) 0
#define SK_DRIVER_PRESET_MTU(pAc,IoC,i,v) 0
/*
** Interim definition of SK_DRV_TIMER placed in this file until
** common modules have been finalized
*/
#define SK_DRV_TIMER 11
#define SK_DRV_MODERATION_TIMER 1
#define SK_DRV_MODERATION_TIMER_LENGTH 1000000 /* 1 second */
#define SK_DRV_RX_CLEANUP_TIMER 2
#define SK_DRV_RX_CLEANUP_TIMER_LENGTH 1000000 /* 100 millisecs */
/*
** Definitions regarding transmitting frames
** any calculating any checksum.
*/
#define C_LEN_ETHERMAC_HEADER_DEST_ADDR 6
#define C_LEN_ETHERMAC_HEADER_SRC_ADDR 6
#define C_LEN_ETHERMAC_HEADER_LENTYPE 2
#define C_LEN_ETHERMAC_HEADER ( (C_LEN_ETHERMAC_HEADER_DEST_ADDR) + \
(C_LEN_ETHERMAC_HEADER_SRC_ADDR) + \
(C_LEN_ETHERMAC_HEADER_LENTYPE) )
#define C_LEN_ETHERMTU_MINSIZE 46
#define C_LEN_ETHERMTU_MAXSIZE_STD 1500
#define C_LEN_ETHERMTU_MAXSIZE_JUMBO 9000
#define C_LEN_ETHERNET_MINSIZE ( (C_LEN_ETHERMAC_HEADER) + \
(C_LEN_ETHERMTU_MINSIZE) )
#define C_OFFSET_IPHEADER C_LEN_ETHERMAC_HEADER
#define C_OFFSET_IPHEADER_IPPROTO 9
#define C_OFFSET_TCPHEADER_TCPCS 16
#define C_OFFSET_UDPHEADER_UDPCS 6
#define C_OFFSET_IPPROTO ( (C_LEN_ETHERMAC_HEADER) + \
(C_OFFSET_IPHEADER_IPPROTO) )
#define C_PROTO_ID_UDP 17 /* refer to RFC 790 or Stevens' */
#define C_PROTO_ID_TCP 6 /* TCP/IP illustrated for details */
/* TX and RX descriptors *****************************************************/
typedef struct s_RxD RXD; /* the receive descriptor */
struct s_RxD {
volatile SK_U32 RBControl; /* Receive Buffer Control */
SK_U32 VNextRxd; /* Next receive descriptor,low dword */
SK_U32 VDataLow; /* Receive buffer Addr, low dword */
SK_U32 VDataHigh; /* Receive buffer Addr, high dword */
SK_U32 FrameStat; /* Receive Frame Status word */
SK_U32 TimeStamp; /* Time stamp from XMAC */
SK_U32 TcpSums; /* TCP Sum 2 / TCP Sum 1 */
SK_U32 TcpSumStarts; /* TCP Sum Start 2 / TCP Sum Start 1 */
RXD *pNextRxd; /* Pointer to next Rxd */
struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
};
typedef struct s_TxD TXD; /* the transmit descriptor */
struct s_TxD {
volatile SK_U32 TBControl; /* Transmit Buffer Control */
SK_U32 VNextTxd; /* Next transmit descriptor,low dword */
SK_U32 VDataLow; /* Transmit Buffer Addr, low dword */
SK_U32 VDataHigh; /* Transmit Buffer Addr, high dword */
SK_U32 FrameStat; /* Transmit Frame Status Word */
SK_U32 TcpSumOfs; /* Reserved / TCP Sum Offset */
SK_U16 TcpSumSt; /* TCP Sum Start */
SK_U16 TcpSumWr; /* TCP Sum Write */
SK_U32 TcpReserved; /* not used */
TXD *pNextTxd; /* Pointer to next Txd */
struct sk_buff *pMBuf; /* Pointer to Linux' socket buffer */
};
/* Used interrupt bits in the interrupts source register *********************/
#define DRIVER_IRQS ((IS_IRQ_SW) | \
(IS_R1_F) |(IS_R2_F) | \
(IS_XS1_F) |(IS_XA1_F) | \
(IS_XS2_F) |(IS_XA2_F))
#define SPECIAL_IRQS ((IS_HW_ERR) |(IS_I2C_READY) | \
(IS_EXT_REG) |(IS_TIMINT) | \
(IS_PA_TO_RX1) |(IS_PA_TO_RX2) | \
(IS_PA_TO_TX1) |(IS_PA_TO_TX2) | \
(IS_MAC1) |(IS_LNK_SYNC_M1)| \
(IS_MAC2) |(IS_LNK_SYNC_M2)| \
(IS_R1_C) |(IS_R2_C) | \
(IS_XS1_C) |(IS_XA1_C) | \
(IS_XS2_C) |(IS_XA2_C))
#define IRQ_MASK ((IS_IRQ_SW) | \
(IS_R1_B) |(IS_R1_F) |(IS_R2_B) |(IS_R2_F) | \
(IS_XS1_B) |(IS_XS1_F) |(IS_XA1_B)|(IS_XA1_F)| \
(IS_XS2_B) |(IS_XS2_F) |(IS_XA2_B)|(IS_XA2_F)| \
(IS_HW_ERR) |(IS_I2C_READY)| \
(IS_EXT_REG) |(IS_TIMINT) | \
(IS_PA_TO_RX1) |(IS_PA_TO_RX2)| \
(IS_PA_TO_TX1) |(IS_PA_TO_TX2)| \
(IS_MAC1) |(IS_MAC2) | \
(IS_R1_C) |(IS_R2_C) | \
(IS_XS1_C) |(IS_XA1_C) | \
(IS_XS2_C) |(IS_XA2_C))
#define IRQ_HWE_MASK (IS_ERR_MSK) /* enable all HW irqs */
typedef struct s_DevNet DEV_NET;
struct s_DevNet {
int PortNr;
int NetNr;
SK_AC *pAC;
};
typedef struct s_TxPort TX_PORT;
struct s_TxPort {
/* the transmit descriptor rings */
caddr_t pTxDescrRing; /* descriptor area memory */
SK_U64 VTxDescrRing; /* descr. area bus virt. addr. */
TXD *pTxdRingHead; /* Head of Tx rings */
TXD *pTxdRingTail; /* Tail of Tx rings */
TXD *pTxdRingPrev; /* descriptor sent previously */
int TxdRingFree; /* # of free entrys */
spinlock_t TxDesRingLock; /* serialize descriptor accesses */
SK_IOC HwAddr; /* bmu registers address */
int PortIndex; /* index number of port (0 or 1) */
};
typedef struct s_RxPort RX_PORT;
struct s_RxPort {
/* the receive descriptor rings */
caddr_t pRxDescrRing; /* descriptor area memory */
SK_U64 VRxDescrRing; /* descr. area bus virt. addr. */
RXD *pRxdRingHead; /* Head of Rx rings */
RXD *pRxdRingTail; /* Tail of Rx rings */
RXD *pRxdRingPrev; /* descriptor given to BMU previously */
int RxdRingFree; /* # of free entrys */
int RxCsum; /* use receive checksum hardware */
spinlock_t RxDesRingLock; /* serialize descriptor accesses */
int RxFillLimit; /* limit for buffers in ring */
SK_IOC HwAddr; /* bmu registers address */
int PortIndex; /* index number of port (0 or 1) */
};
/* Definitions needed for interrupt moderation *******************************/
#define IRQ_EOF_AS_TX ((IS_XA1_F) | (IS_XA2_F))
#define IRQ_EOF_SY_TX ((IS_XS1_F) | (IS_XS2_F))
#define IRQ_MASK_TX_ONLY ((IRQ_EOF_AS_TX)| (IRQ_EOF_SY_TX))
#define IRQ_MASK_RX_ONLY ((IS_R1_F) | (IS_R2_F))
#define IRQ_MASK_SP_ONLY (SPECIAL_IRQS)
#define IRQ_MASK_TX_RX ((IRQ_MASK_TX_ONLY)| (IRQ_MASK_RX_ONLY))
#define IRQ_MASK_SP_RX ((SPECIAL_IRQS) | (IRQ_MASK_RX_ONLY))
#define IRQ_MASK_SP_TX ((SPECIAL_IRQS) | (IRQ_MASK_TX_ONLY))
#define IRQ_MASK_RX_TX_SP ((SPECIAL_IRQS) | (IRQ_MASK_TX_RX))
#define C_INT_MOD_NONE 1
#define C_INT_MOD_STATIC 2
#define C_INT_MOD_DYNAMIC 4
#define C_CLK_FREQ_GENESIS 53215000 /* shorter: 53.125 MHz */
#define C_CLK_FREQ_YUKON 78215000 /* shorter: 78.125 MHz */
#define C_INTS_PER_SEC_DEFAULT 2000
#define C_INT_MOD_ENABLE_PERCENTAGE 50 /* if higher 50% enable */
#define C_INT_MOD_DISABLE_PERCENTAGE 50 /* if lower 50% disable */
#define C_INT_MOD_IPS_LOWER_RANGE 30
#define C_INT_MOD_IPS_UPPER_RANGE 40000
typedef struct s_DynIrqModInfo DIM_INFO;
struct s_DynIrqModInfo {
unsigned long PrevTimeVal;
unsigned int PrevSysLoad;
unsigned int PrevUsedTime;
unsigned int PrevTotalTime;
int PrevUsedDescrRatio;
int NbrProcessedDescr;
SK_U64 PrevPort0RxIntrCts;
SK_U64 PrevPort1RxIntrCts;
SK_U64 PrevPort0TxIntrCts;
SK_U64 PrevPort1TxIntrCts;
SK_BOOL ModJustEnabled; /* Moderation just enabled yes/no */
int MaxModIntsPerSec; /* Moderation Threshold */
int MaxModIntsPerSecUpperLimit; /* Upper limit for DIM */
int MaxModIntsPerSecLowerLimit; /* Lower limit for DIM */
long MaskIrqModeration; /* ModIrqType (eg. 'TxRx') */
SK_BOOL DisplayStats; /* Stats yes/no */
SK_BOOL AutoSizing; /* Resize DIM-timer on/off */
int IntModTypeSelect; /* EnableIntMod (eg. 'dynamic') */
SK_TIMER ModTimer; /* just some timer */
};
typedef struct s_PerStrm PER_STRM;
#define SK_ALLOC_IRQ 0x00000001
#ifdef SK_DIAG_SUPPORT
#define DIAG_ACTIVE 1
#define DIAG_NOTACTIVE 0
#endif
/****************************************************************************
* Per board structure / Adapter Context structure:
* Allocated within attach(9e) and freed within detach(9e).
* Contains all 'per device' necessary handles, flags, locks etc.:
*/
struct s_AC {
SK_GEINIT GIni; /* GE init struct */
SK_PNMI Pnmi; /* PNMI data struct */
SK_VPD vpd; /* vpd data struct */
SK_QUEUE Event; /* Event queue */
SK_HWT Hwt; /* Hardware Timer control struct */
SK_TIMCTRL Tim; /* Software Timer control struct */
SK_I2C I2c; /* I2C relevant data structure */
SK_ADDR Addr; /* for Address module */
SK_CSUM Csum; /* for checksum module */
SK_RLMT Rlmt; /* for rlmt module */
spinlock_t SlowPathLock; /* Normal IRQ lock */
struct timer_list BlinkTimer; /* for LED blinking */
int LedsOn;
SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */
int RlmtMode; /* link check mode to set */
int RlmtNets; /* Number of nets */
SK_IOC IoBase; /* register set of adapter */
int BoardLevel; /* level of active hw init (0-2) */
SK_U32 AllocFlag; /* flag allocation of resources */
struct pci_dev *PciDev; /* for access to pci config space */
struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
int RxBufSize; /* length of receive buffers */
struct net_device_stats stats; /* linux 'netstat -i' statistics */
int Index; /* internal board index number */
/* adapter RAM sizes for queues of active port */
int RxQueueSize; /* memory used for receive queue */
int TxSQueueSize; /* memory used for sync. tx queue */
int TxAQueueSize; /* memory used for async. tx queue */
int PromiscCount; /* promiscuous mode counter */
int AllMultiCount; /* allmulticast mode counter */
int MulticCount; /* number of different MC */
/* addresses for this board */
/* (may be more than HW can)*/
int HWRevision; /* Hardware revision */
int ActivePort; /* the active XMAC port */
int MaxPorts; /* number of activated ports */
int TxDescrPerRing; /* # of descriptors per tx ring */
int RxDescrPerRing; /* # of descriptors per rx ring */
caddr_t pDescrMem; /* Pointer to the descriptor area */
dma_addr_t pDescrMemDMA; /* PCI DMA address of area */
/* the port structures with descriptor rings */
TX_PORT TxPort[SK_MAX_MACS][2];
RX_PORT RxPort[SK_MAX_MACS];
SK_BOOL CheckQueue; /* check event queue soon */
SK_TIMER DrvCleanupTimer;/* to check for pending descriptors */
DIM_INFO DynIrqModInfo; /* all data related to DIM */
/* Only for tests */
int PortDown;
int ChipsetType; /* Chipset family type
* 0 == Genesis family support
* 1 == Yukon family support
*/
#ifdef SK_DIAG_SUPPORT
SK_U32 DiagModeActive; /* is diag active? */
SK_BOOL DiagFlowCtrl; /* for control purposes */
SK_PNMI_STRUCT_DATA PnmiBackup; /* backup structure for all Pnmi-Data */
SK_BOOL WasIfUp[SK_MAX_MACS]; /* for OpenClose while
* DIAG is busy with NIC
*/
#endif
};
#endif /* __INC_SKDRV2ND_H */

View File

@ -0,0 +1,55 @@
/******************************************************************************
*
* Name: skerror.h
* Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.7 $
* Date: $Date: 2003/05/13 17:25:13 $
* Purpose: SK specific Error log support
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef _INC_SKERROR_H_
#define _INC_SKERROR_H_
/*
* Define Error Classes
*/
#define SK_ERRCL_OTHER (0) /* Other error */
#define SK_ERRCL_CONFIG (1L<<0) /* Configuration error */
#define SK_ERRCL_INIT (1L<<1) /* Initialization error */
#define SK_ERRCL_NORES (1L<<2) /* Out of Resources error */
#define SK_ERRCL_SW (1L<<3) /* Internal Software error */
#define SK_ERRCL_HW (1L<<4) /* Hardware Failure */
#define SK_ERRCL_COMM (1L<<5) /* Communication error */
/*
* Define Error Code Bases
*/
#define SK_ERRBASE_RLMT 100 /* Base Error number for RLMT */
#define SK_ERRBASE_HWINIT 200 /* Base Error number for HWInit */
#define SK_ERRBASE_VPD 300 /* Base Error number for VPD */
#define SK_ERRBASE_PNMI 400 /* Base Error number for PNMI */
#define SK_ERRBASE_CSUM 500 /* Base Error number for Checksum */
#define SK_ERRBASE_SIRQ 600 /* Base Error number for Special IRQ */
#define SK_ERRBASE_I2C 700 /* Base Error number for I2C module */
#define SK_ERRBASE_QUEUE 800 /* Base Error number for Scheduler */
#define SK_ERRBASE_ADDR 900 /* Base Error number for Address module */
#define SK_ERRBASE_PECP 1000 /* Base Error number for PECP */
#define SK_ERRBASE_DRV 1100 /* Base Error number for Driver */
#endif /* _INC_SKERROR_H_ */

View File

@ -0,0 +1,51 @@
/******************************************************************************
*
* Name: skgedrv.h
* Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.10 $
* Date: $Date: 2003/07/04 12:25:01 $
* Purpose: Interface with the driver
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef __INC_SKGEDRV_H_
#define __INC_SKGEDRV_H_
/* defines ********************************************************************/
/*
* Define the driver events.
* Usually the events are defined by the destination module.
* In case of the driver we put the definition of the events here.
*/
#define SK_DRV_PORT_RESET 1 /* The port needs to be reset */
#define SK_DRV_NET_UP 2 /* The net is operational */
#define SK_DRV_NET_DOWN 3 /* The net is down */
#define SK_DRV_SWITCH_SOFT 4 /* Ports switch with both links connected */
#define SK_DRV_SWITCH_HARD 5 /* Port switch due to link failure */
#define SK_DRV_RLMT_SEND 6 /* Send a RLMT packet */
#define SK_DRV_ADAP_FAIL 7 /* The whole adapter fails */
#define SK_DRV_PORT_FAIL 8 /* One port fails */
#define SK_DRV_SWITCH_INTERN 9 /* Port switch by the driver itself */
#define SK_DRV_POWER_DOWN 10 /* Power down mode */
#define SK_DRV_TIMER 11 /* Timer for free use */
#ifdef SK_NO_RLMT
#define SK_DRV_LINK_UP 12 /* Link Up event for driver */
#define SK_DRV_LINK_DOWN 13 /* Link Down event for driver */
#endif
#define SK_DRV_DOWNSHIFT_DET 14 /* Downshift 4-Pair / 2-Pair (YUKON only) */
#endif /* __INC_SKGEDRV_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
/******************************************************************************
*
* Name: skhwt.h
* Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.7 $
* Date: $Date: 2003/09/16 12:55:08 $
* Purpose: Defines for the hardware timer functions
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* SKGEHWT.H contains all defines and types for the timer functions
*/
#ifndef _SKGEHWT_H_
#define _SKGEHWT_H_
/*
* SK Hardware Timer
* - needed wherever the HWT module is used
* - use in Adapters context name pAC->Hwt
*/
typedef struct s_Hwt {
SK_U32 TStart; /* HWT start */
SK_U32 TStop; /* HWT stop */
int TActive; /* HWT: flag : active/inactive */
} SK_HWT;
extern void SkHwtInit(SK_AC *pAC, SK_IOC Ioc);
extern void SkHwtStart(SK_AC *pAC, SK_IOC Ioc, SK_U32 Time);
extern void SkHwtStop(SK_AC *pAC, SK_IOC Ioc);
extern SK_U32 SkHwtRead(SK_AC *pAC, SK_IOC Ioc);
extern void SkHwtIsr(SK_AC *pAC, SK_IOC Ioc);
#endif /* _SKGEHWT_H_ */

View File

@ -0,0 +1,210 @@
/******************************************************************************
*
* Name: skgei2c.h
* Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.25 $
* Date: $Date: 2003/10/20 09:06:05 $
* Purpose: Special defines for TWSI
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* SKGEI2C.H contains all SK-98xx specific defines for the TWSI handling
*/
#ifndef _INC_SKGEI2C_H_
#define _INC_SKGEI2C_H_
/*
* Macros to access the B2_I2C_CTRL
*/
#define SK_I2C_CTL(IoC, flag, dev, dev_size, reg, burst) \
SK_OUT32(IoC, B2_I2C_CTRL,\
(flag ? 0x80000000UL : 0x0L) | \
(((SK_U32)reg << 16) & I2C_ADDR) | \
(((SK_U32)dev << 9) & I2C_DEV_SEL) | \
(dev_size & I2C_DEV_SIZE) | \
((burst << 4) & I2C_BURST_LEN))
#define SK_I2C_STOP(IoC) { \
SK_U32 I2cCtrl; \
SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \
SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \
}
#define SK_I2C_GET_CTL(IoC, pI2cCtrl) SK_IN32(IoC, B2_I2C_CTRL, pI2cCtrl)
/*
* Macros to access the TWSI SW Registers
*/
#define SK_I2C_SET_BIT(IoC, SetBits) { \
SK_U8 OrgBits; \
SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SK_U8)(SetBits)); \
}
#define SK_I2C_CLR_BIT(IoC, ClrBits) { \
SK_U8 OrgBits; \
SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~((SK_U8)(ClrBits))); \
}
#define SK_I2C_GET_SW(IoC, pI2cSw) SK_IN8(IoC, B2_I2C_SW, pI2cSw)
/*
* define the possible sensor states
*/
#define SK_SEN_IDLE 0 /* Idle: sensor not read */
#define SK_SEN_VALUE 1 /* Value Read cycle */
#define SK_SEN_VALEXT 2 /* Extended Value Read cycle */
/*
* Conversion factor to convert read Voltage sensor to milli Volt
* Conversion factor to convert read Temperature sensor to 10th degree Celsius
*/
#define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */
#define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */
#define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for ext. val. */
/*
* formula: counter = (22500*60)/(rpm * divisor * pulses/2)
* assuming: 6500rpm, 4 pulses, divisor 1
*/
#define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
/*
* Define sensor management data
* Maximum is reached on Genesis copper dual port and Yukon-64
* Board specific maximum is in pAC->I2c.MaxSens
*/
#define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */
#define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */
/*
* To watch the state machine (SM) use the timer in two ways
* instead of one as hitherto
*/
#define SK_TIMER_WATCH_SM 0 /* Watch the SM to finish in a spec. time */
#define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
/*
* Defines for the individual thresholds
*/
/* Temperature sensor */
#define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
#define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
#define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
#define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
/* VCC which should be 5 V */
#define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
#define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
#define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
#define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
/*
* VIO may be 5 V or 3.3 V. Initialization takes two parts:
* 1. Initialize lowest lower limit and highest higher limit.
* 2. After the first value is read correct the upper or the lower limit to
* the appropriate C constant.
*
* Warning limits are +-5% of the exepected voltage.
* Error limits are +-10% of the expected voltage.
*/
/* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
#define SK_SEN_PCI_IO_5V_HIGH_ERR 5566 /* + 10% V PCI-IO High Err Threshold */
#define SK_SEN_PCI_IO_5V_HIGH_WARN 5324 /* + 5% V PCI-IO High Warn Threshold */
/* 5000 mVolt */
#define SK_SEN_PCI_IO_5V_LOW_WARN 4686 /* - 5% V PCI-IO Low Warn Threshold */
#define SK_SEN_PCI_IO_5V_LOW_ERR 4444 /* - 10% V PCI-IO Low Err Threshold */
#define SK_SEN_PCI_IO_RANGE_LIMITER 4000 /* 4000 mV range delimiter */
/* correction values for the second pass */
#define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
#define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
/* 3300 mVolt */
#define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
#define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
/*
* VDD voltage
*/
#define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
#define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
#define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
#define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
/*
* PHY PLL 3V3 voltage
*/
#define SK_SEN_PLL_3V3_HIGH_ERR 3630 /* Voltage PMA High Err Threshold */
#define SK_SEN_PLL_3V3_HIGH_WARN 3476 /* Voltage PMA High Warn Threshold */
#define SK_SEN_PLL_3V3_LOW_WARN 3146 /* Voltage PMA Low Warn Threshold */
#define SK_SEN_PLL_3V3_LOW_ERR 2970 /* Voltage PMA Low Err Threshold */
/*
* VAUX (YUKON only)
*/
#define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */
#define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */
#define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */
#define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */
#define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */
#define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
/*
* PHY 2V5 voltage
*/
#define SK_SEN_PHY_2V5_HIGH_ERR 2750 /* Voltage PHY High Err Threshold */
#define SK_SEN_PHY_2V5_HIGH_WARN 2640 /* Voltage PHY High Warn Threshold */
#define SK_SEN_PHY_2V5_LOW_WARN 2376 /* Voltage PHY Low Warn Threshold */
#define SK_SEN_PHY_2V5_LOW_ERR 2222 /* Voltage PHY Low Err Threshold */
/*
* ASIC Core 1V5 voltage (YUKON only)
*/
#define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */
#define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */
#define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */
#define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */
/*
* FAN 1 speed
*/
/* assuming: 6500rpm +-15%, 4 pulses,
* warning at: 80 %
* error at: 70 %
* no upper limit
*/
#define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
#define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
#define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
#define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
/*
* Some Voltages need dynamic thresholds
*/
#define SK_SEN_DYN_INIT_NONE 0 /* No dynamic init of thresholds */
#define SK_SEN_DYN_INIT_PCI_IO 10 /* Init PCI-IO with new thresholds */
#define SK_SEN_DYN_INIT_VAUX 11 /* Init VAUX with new thresholds */
extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
#endif /* n_INC_SKGEI2C_H */

View File

@ -0,0 +1,797 @@
/******************************************************************************
*
* Name: skgeinit.h
* Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.83 $
* Date: $Date: 2003/09/16 14:07:37 $
* Purpose: Structures and prototypes for the GE Init Module
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef __INC_SKGEINIT_H_
#define __INC_SKGEINIT_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* defines ********************************************************************/
#define SK_TEST_VAL 0x11335577UL
/* modifying Link LED behaviour (used with SkGeLinkLED()) */
#define SK_LNK_OFF LED_OFF
#define SK_LNK_ON (LED_ON | LED_BLK_OFF | LED_SYNC_OFF)
#define SK_LNK_BLINK (LED_ON | LED_BLK_ON | LED_SYNC_ON)
#define SK_LNK_PERM (LED_ON | LED_BLK_OFF | LED_SYNC_ON)
#define SK_LNK_TST (LED_ON | LED_BLK_ON | LED_SYNC_OFF)
/* parameter 'Mode' when calling SK_HWAC_LINK_LED() */
#define SK_LED_OFF LED_OFF
#define SK_LED_ACTIVE (LED_ON | LED_BLK_OFF | LED_SYNC_OFF)
#define SK_LED_STANDBY (LED_ON | LED_BLK_ON | LED_SYNC_OFF)
/* addressing LED Registers in SkGeXmitLED() */
#define XMIT_LED_INI 0
#define XMIT_LED_CNT (RX_LED_VAL - RX_LED_INI)
#define XMIT_LED_CTRL (RX_LED_CTRL- RX_LED_INI)
#define XMIT_LED_TST (RX_LED_TST - RX_LED_INI)
/* parameter 'Mode' when calling SkGeXmitLED() */
#define SK_LED_DIS 0
#define SK_LED_ENA 1
#define SK_LED_TST 2
/* Counter and Timer constants, for a host clock of 62.5 MHz */
#define SK_XMIT_DUR 0x002faf08UL /* 50 ms */
#define SK_BLK_DUR 0x01dcd650UL /* 500 ms */
#define SK_DPOLL_DEF 0x00ee6b28UL /* 250 ms at 62.5 MHz */
#define SK_DPOLL_MAX 0x00ffffffUL /* 268 ms at 62.5 MHz */
/* 215 ms at 78.12 MHz */
#define SK_FACT_62 100 /* is given in percent */
#define SK_FACT_53 85 /* on GENESIS: 53.12 MHz */
#define SK_FACT_78 125 /* on YUKON: 78.12 MHz */
/* Timeout values */
#define SK_MAC_TO_53 72 /* MAC arbiter timeout */
#define SK_PKT_TO_53 0x2000 /* Packet arbiter timeout */
#define SK_PKT_TO_MAX 0xffff /* Maximum value */
#define SK_RI_TO_53 36 /* RAM interface timeout */
#define SK_PHY_ACC_TO 600000 /* PHY access timeout */
/* RAM Buffer High Pause Threshold values */
#define SK_RB_ULPP ( 8 * 1024) /* Upper Level in kB/8 */
#define SK_RB_LLPP_S (10 * 1024) /* Lower Level for small Queues */
#define SK_RB_LLPP_B (16 * 1024) /* Lower Level for big Queues */
#ifndef SK_BMU_RX_WM
#define SK_BMU_RX_WM 0x600 /* BMU Rx Watermark */
#endif
#ifndef SK_BMU_TX_WM
#define SK_BMU_TX_WM 0x600 /* BMU Tx Watermark */
#endif
/* XMAC II Rx High Watermark */
#define SK_XM_RX_HI_WM 0x05aa /* 1450 */
/* XMAC II Tx Threshold */
#define SK_XM_THR_REDL 0x01fb /* .. for redundant link usage */
#define SK_XM_THR_SL 0x01fb /* .. for single link adapters */
#define SK_XM_THR_MULL 0x01fb /* .. for multiple link usage */
#define SK_XM_THR_JUMBO 0x03fc /* .. for jumbo frame usage */
/* values for GIPortUsage */
#define SK_RED_LINK 1 /* redundant link usage */
#define SK_MUL_LINK 2 /* multiple link usage */
#define SK_JUMBO_LINK 3 /* driver uses jumbo frames */
/* Minimum RAM Buffer Rx Queue Size */
#define SK_MIN_RXQ_SIZE 16 /* 16 kB */
/* Minimum RAM Buffer Tx Queue Size */
#define SK_MIN_TXQ_SIZE 16 /* 16 kB */
/* Queue Size units */
#define QZ_UNITS 0x7
#define QZ_STEP 8
/* Percentage of queue size from whole memory */
/* 80 % for receive */
#define RAM_QUOTA_RX 80L
/* 0% for sync transfer */
#define RAM_QUOTA_SYNC 0L
/* the rest (20%) is taken for async transfer */
/* Get the rounded queue size in Bytes in 8k steps */
#define ROUND_QUEUE_SIZE(SizeInBytes) \
((((unsigned long) (SizeInBytes) + (QZ_STEP*1024L)-1) / 1024) & \
~(QZ_STEP-1))
/* Get the rounded queue size in KBytes in 8k steps */
#define ROUND_QUEUE_SIZE_KB(Kilobytes) \
ROUND_QUEUE_SIZE((Kilobytes) * 1024L)
/* Types of RAM Buffer Queues */
#define SK_RX_SRAM_Q 1 /* small receive queue */
#define SK_RX_BRAM_Q 2 /* big receive queue */
#define SK_TX_RAM_Q 3 /* small or big transmit queue */
/* parameter 'Dir' when calling SkGeStopPort() */
#define SK_STOP_TX 1 /* Stops the transmit path, resets the XMAC */
#define SK_STOP_RX 2 /* Stops the receive path */
#define SK_STOP_ALL 3 /* Stops Rx and Tx path, resets the XMAC */
/* parameter 'RstMode' when calling SkGeStopPort() */
#define SK_SOFT_RST 1 /* perform a software reset */
#define SK_HARD_RST 2 /* perform a hardware reset */
/* Init Levels */
#define SK_INIT_DATA 0 /* Init level 0: init data structures */
#define SK_INIT_IO 1 /* Init level 1: init with IOs */
#define SK_INIT_RUN 2 /* Init level 2: init for run time */
/* Link Mode Parameter */
#define SK_LMODE_HALF 1 /* Half Duplex Mode */
#define SK_LMODE_FULL 2 /* Full Duplex Mode */
#define SK_LMODE_AUTOHALF 3 /* AutoHalf Duplex Mode */
#define SK_LMODE_AUTOFULL 4 /* AutoFull Duplex Mode */
#define SK_LMODE_AUTOBOTH 5 /* AutoBoth Duplex Mode */
#define SK_LMODE_AUTOSENSE 6 /* configured mode auto sensing */
#define SK_LMODE_INDETERMINATED 7 /* indeterminated */
/* Auto-negotiation timeout in 100ms granularity */
#define SK_AND_MAX_TO 6 /* Wait 600 msec before link comes up */
/* Auto-negotiation error codes */
#define SK_AND_OK 0 /* no error */
#define SK_AND_OTHER 1 /* other error than below */
#define SK_AND_DUP_CAP 2 /* Duplex capabilities error */
/* Link Speed Capabilities */
#define SK_LSPEED_CAP_AUTO (1<<0) /* Automatic resolution */
#define SK_LSPEED_CAP_10MBPS (1<<1) /* 10 Mbps */
#define SK_LSPEED_CAP_100MBPS (1<<2) /* 100 Mbps */
#define SK_LSPEED_CAP_1000MBPS (1<<3) /* 1000 Mbps */
#define SK_LSPEED_CAP_INDETERMINATED (1<<4) /* indeterminated */
/* Link Speed Parameter */
#define SK_LSPEED_AUTO 1 /* Automatic resolution */
#define SK_LSPEED_10MBPS 2 /* 10 Mbps */
#define SK_LSPEED_100MBPS 3 /* 100 Mbps */
#define SK_LSPEED_1000MBPS 4 /* 1000 Mbps */
#define SK_LSPEED_INDETERMINATED 5 /* indeterminated */
/* Link Speed Current State */
#define SK_LSPEED_STAT_UNKNOWN 1
#define SK_LSPEED_STAT_10MBPS 2
#define SK_LSPEED_STAT_100MBPS 3
#define SK_LSPEED_STAT_1000MBPS 4
#define SK_LSPEED_STAT_INDETERMINATED 5
/* Link Capability Parameter */
#define SK_LMODE_CAP_HALF (1<<0) /* Half Duplex Mode */
#define SK_LMODE_CAP_FULL (1<<1) /* Full Duplex Mode */
#define SK_LMODE_CAP_AUTOHALF (1<<2) /* AutoHalf Duplex Mode */
#define SK_LMODE_CAP_AUTOFULL (1<<3) /* AutoFull Duplex Mode */
#define SK_LMODE_CAP_INDETERMINATED (1<<4) /* indeterminated */
/* Link Mode Current State */
#define SK_LMODE_STAT_UNKNOWN 1 /* Unknown Duplex Mode */
#define SK_LMODE_STAT_HALF 2 /* Half Duplex Mode */
#define SK_LMODE_STAT_FULL 3 /* Full Duplex Mode */
#define SK_LMODE_STAT_AUTOHALF 4 /* Half Duplex Mode obtained by Auto-Neg */
#define SK_LMODE_STAT_AUTOFULL 5 /* Full Duplex Mode obtained by Auto-Neg */
#define SK_LMODE_STAT_INDETERMINATED 6 /* indeterminated */
/* Flow Control Mode Parameter (and capabilities) */
#define SK_FLOW_MODE_NONE 1 /* No Flow-Control */
#define SK_FLOW_MODE_LOC_SEND 2 /* Local station sends PAUSE */
#define SK_FLOW_MODE_SYMMETRIC 3 /* Both stations may send PAUSE */
#define SK_FLOW_MODE_SYM_OR_REM 4 /* Both stations may send PAUSE or
* just the remote station may send PAUSE
*/
#define SK_FLOW_MODE_INDETERMINATED 5 /* indeterminated */
/* Flow Control Status Parameter */
#define SK_FLOW_STAT_NONE 1 /* No Flow Control */
#define SK_FLOW_STAT_REM_SEND 2 /* Remote Station sends PAUSE */
#define SK_FLOW_STAT_LOC_SEND 3 /* Local station sends PAUSE */
#define SK_FLOW_STAT_SYMMETRIC 4 /* Both station may send PAUSE */
#define SK_FLOW_STAT_INDETERMINATED 5 /* indeterminated */
/* Master/Slave Mode Capabilities */
#define SK_MS_CAP_AUTO (1<<0) /* Automatic resolution */
#define SK_MS_CAP_MASTER (1<<1) /* This station is master */
#define SK_MS_CAP_SLAVE (1<<2) /* This station is slave */
#define SK_MS_CAP_INDETERMINATED (1<<3) /* indeterminated */
/* Set Master/Slave Mode Parameter (and capabilities) */
#define SK_MS_MODE_AUTO 1 /* Automatic resolution */
#define SK_MS_MODE_MASTER 2 /* This station is master */
#define SK_MS_MODE_SLAVE 3 /* This station is slave */
#define SK_MS_MODE_INDETERMINATED 4 /* indeterminated */
/* Master/Slave Status Parameter */
#define SK_MS_STAT_UNSET 1 /* The M/S status is not set */
#define SK_MS_STAT_MASTER 2 /* This station is master */
#define SK_MS_STAT_SLAVE 3 /* This station is slave */
#define SK_MS_STAT_FAULT 4 /* M/S resolution failed */
#define SK_MS_STAT_INDETERMINATED 5 /* indeterminated */
/* parameter 'Mode' when calling SkXmSetRxCmd() */
#define SK_STRIP_FCS_ON (1<<0) /* Enable FCS stripping of Rx frames */
#define SK_STRIP_FCS_OFF (1<<1) /* Disable FCS stripping of Rx frames */
#define SK_STRIP_PAD_ON (1<<2) /* Enable pad byte stripping of Rx fr */
#define SK_STRIP_PAD_OFF (1<<3) /* Disable pad byte stripping of Rx fr */
#define SK_LENERR_OK_ON (1<<4) /* Don't chk fr for in range len error */
#define SK_LENERR_OK_OFF (1<<5) /* Check frames for in range len error */
#define SK_BIG_PK_OK_ON (1<<6) /* Don't set Rx Error bit for big frames */
#define SK_BIG_PK_OK_OFF (1<<7) /* Set Rx Error bit for big frames */
#define SK_SELF_RX_ON (1<<8) /* Enable Rx of own packets */
#define SK_SELF_RX_OFF (1<<9) /* Disable Rx of own packets */
/* parameter 'Para' when calling SkMacSetRxTxEn() */
#define SK_MAC_LOOPB_ON (1<<0) /* Enable MAC Loopback Mode */
#define SK_MAC_LOOPB_OFF (1<<1) /* Disable MAC Loopback Mode */
#define SK_PHY_LOOPB_ON (1<<2) /* Enable PHY Loopback Mode */
#define SK_PHY_LOOPB_OFF (1<<3) /* Disable PHY Loopback Mode */
#define SK_PHY_FULLD_ON (1<<4) /* Enable GMII Full Duplex */
#define SK_PHY_FULLD_OFF (1<<5) /* Disable GMII Full Duplex */
/* States of PState */
#define SK_PRT_RESET 0 /* the port is reset */
#define SK_PRT_STOP 1 /* the port is stopped (similar to SW reset) */
#define SK_PRT_INIT 2 /* the port is initialized */
#define SK_PRT_RUN 3 /* the port has an active link */
/* PHY power down modes */
#define PHY_PM_OPERATIONAL_MODE 0 /* PHY operational mode */
#define PHY_PM_DEEP_SLEEP 1 /* coma mode --> minimal power */
#define PHY_PM_IEEE_POWER_DOWN 2 /* IEEE 22.2.4.1.5 compl. power down */
#define PHY_PM_ENERGY_DETECT 3 /* energy detect */
#define PHY_PM_ENERGY_DETECT_PLUS 4 /* energy detect plus */
/* Default receive frame limit for Workaround of XMAC Errata */
#define SK_DEF_RX_WA_LIM SK_CONSTU64(100)
/* values for GILedBlinkCtrl (LED Blink Control) */
#define SK_ACT_LED_BLINK (1<<0) /* Active LED blinking */
#define SK_DUP_LED_NORMAL (1<<1) /* Duplex LED normal */
#define SK_LED_LINK100_ON (1<<2) /* Link 100M LED on */
/* Link Partner Status */
#define SK_LIPA_UNKNOWN 0 /* Link partner is in unknown state */
#define SK_LIPA_MANUAL 1 /* Link partner is in detected manual state */
#define SK_LIPA_AUTO 2 /* Link partner is in auto-negotiation state */
/* Maximum Restarts before restart is ignored (3Com WA) */
#define SK_MAX_LRESTART 3 /* Max. 3 times the link is restarted */
/* Max. Auto-neg. timeouts before link detection in sense mode is reset */
#define SK_MAX_ANEG_TO 10 /* Max. 10 times the sense mode is reset */
/* structures *****************************************************************/
/*
* MAC specific functions
*/
typedef struct s_GeMacFunc {
int (*pFnMacUpdateStats)(SK_AC *pAC, SK_IOC IoC, unsigned int Port);
int (*pFnMacStatistic)(SK_AC *pAC, SK_IOC IoC, unsigned int Port,
SK_U16 StatAddr, SK_U32 SK_FAR *pVal);
int (*pFnMacResetCounter)(SK_AC *pAC, SK_IOC IoC, unsigned int Port);
int (*pFnMacOverflow)(SK_AC *pAC, SK_IOC IoC, unsigned int Port,
SK_U16 IStatus, SK_U64 SK_FAR *pVal);
} SK_GEMACFUNC;
/*
* Port Structure
*/
typedef struct s_GePort {
#ifndef SK_DIAG
SK_TIMER PWaTimer; /* Workaround Timer */
SK_TIMER HalfDupChkTimer;
#endif /* SK_DIAG */
SK_U32 PPrevShorts; /* Previous Short Counter checking */
SK_U32 PPrevFcs; /* Previous FCS Error Counter checking */
SK_U64 PPrevRx; /* Previous RxOk Counter checking */
SK_U64 PRxLim; /* Previous RxOk Counter checking */
SK_U64 LastOctets; /* For half duplex hang check */
int PLinkResCt; /* Link Restart Counter */
int PAutoNegTimeOut;/* Auto-negotiation timeout current value */
int PAutoNegTOCt; /* Auto-negotiation Timeout Counter */
int PRxQSize; /* Port Rx Queue Size in kB */
int PXSQSize; /* Port Synchronous Transmit Queue Size in kB */
int PXAQSize; /* Port Asynchronous Transmit Queue Size in kB */
SK_U32 PRxQRamStart; /* Receive Queue RAM Buffer Start Address */
SK_U32 PRxQRamEnd; /* Receive Queue RAM Buffer End Address */
SK_U32 PXsQRamStart; /* Sync Tx Queue RAM Buffer Start Address */
SK_U32 PXsQRamEnd; /* Sync Tx Queue RAM Buffer End Address */
SK_U32 PXaQRamStart; /* Async Tx Queue RAM Buffer Start Address */
SK_U32 PXaQRamEnd; /* Async Tx Queue RAM Buffer End Address */
SK_U32 PRxOverCnt; /* Receive Overflow Counter */
int PRxQOff; /* Rx Queue Address Offset */
int PXsQOff; /* Synchronous Tx Queue Address Offset */
int PXaQOff; /* Asynchronous Tx Queue Address Offset */
int PhyType; /* PHY used on this port */
int PState; /* Port status (reset, stop, init, run) */
SK_U16 PhyId1; /* PHY Id1 on this port */
SK_U16 PhyAddr; /* MDIO/MDC PHY address */
SK_U16 PIsave; /* Saved Interrupt status word */
SK_U16 PSsave; /* Saved PHY status word */
SK_U16 PGmANegAdv; /* Saved GPhy AutoNegAdvertisment register */
SK_BOOL PHWLinkUp; /* The hardware Link is up (wiring) */
SK_BOOL PLinkBroken; /* Is Link broken ? */
SK_BOOL PCheckPar; /* Do we check for parity errors ? */
SK_BOOL HalfDupTimerActive;
SK_U8 PLinkCap; /* Link Capabilities */
SK_U8 PLinkModeConf; /* Link Mode configured */
SK_U8 PLinkMode; /* Link Mode currently used */
SK_U8 PLinkModeStatus;/* Link Mode Status */
SK_U8 PLinkSpeedCap; /* Link Speed Capabilities(10/100/1000 Mbps) */
SK_U8 PLinkSpeed; /* configured Link Speed (10/100/1000 Mbps) */
SK_U8 PLinkSpeedUsed; /* current Link Speed (10/100/1000 Mbps) */
SK_U8 PFlowCtrlCap; /* Flow Control Capabilities */
SK_U8 PFlowCtrlMode; /* Flow Control Mode */
SK_U8 PFlowCtrlStatus;/* Flow Control Status */
SK_U8 PMSCap; /* Master/Slave Capabilities */
SK_U8 PMSMode; /* Master/Slave Mode */
SK_U8 PMSStatus; /* Master/Slave Status */
SK_BOOL PAutoNegFail; /* Auto-negotiation fail flag */
SK_U8 PLipaAutoNeg; /* Auto-negotiation possible with Link Partner */
SK_U8 PCableLen; /* Cable Length */
SK_U8 PMdiPairLen[4]; /* MDI[0..3] Pair Length */
SK_U8 PMdiPairSts[4]; /* MDI[0..3] Pair Diagnostic Status */
SK_U8 PPhyPowerState; /* PHY current power state */
int PMacColThres; /* MAC Collision Threshold */
int PMacJamLen; /* MAC Jam length */
int PMacJamIpgVal; /* MAC Jam IPG */
int PMacJamIpgData; /* MAC IPG Jam to Data */
int PMacIpgData; /* MAC Data IPG */
SK_BOOL PMacLimit4; /* reset collision counter and backoff algorithm */
} SK_GEPORT;
/*
* Gigabit Ethernet Initialization Struct
* (has to be included in the adapter context)
*/
typedef struct s_GeInit {
int GIChipId; /* Chip Identification Number */
int GIChipRev; /* Chip Revision Number */
SK_U8 GIPciHwRev; /* PCI HW Revision Number */
SK_BOOL GIGenesis; /* Genesis adapter ? */
SK_BOOL GIYukon; /* YUKON-A1/Bx chip */
SK_BOOL GIYukonLite; /* YUKON-Lite chip */
SK_BOOL GICopperType; /* Copper Type adapter ? */
SK_BOOL GIPciSlot64; /* 64-bit PCI Slot */
SK_BOOL GIPciClock66; /* 66 MHz PCI Clock */
SK_BOOL GIVauxAvail; /* VAUX available (YUKON) */
SK_BOOL GIYukon32Bit; /* 32-Bit YUKON adapter */
SK_U16 GILedBlinkCtrl; /* LED Blink Control */
int GIMacsFound; /* Number of MACs found on this adapter */
int GIMacType; /* MAC Type used on this adapter */
int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */
int GIPortUsage; /* Driver Port Usage */
int GILevel; /* Initialization Level completed */
int GIRamSize; /* The RAM size of the adapter in kB */
int GIWolOffs; /* WOL Register Offset (HW-Bug in Rev. A) */
SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */
SK_U32 GIPollTimerVal; /* Descr. Poll Timer Init Val (HstClk ticks) */
SK_U32 GIValIrqMask; /* Value for Interrupt Mask */
SK_U32 GITimeStampCnt; /* Time Stamp High Counter (YUKON only) */
SK_GEPORT GP[SK_MAX_MACS];/* Port Dependent Information */
SK_GEMACFUNC GIFunc; /* MAC depedent functions */
} SK_GEINIT;
/*
* Error numbers and messages for skxmac2.c and skgeinit.c
*/
#define SKERR_HWI_E001 (SK_ERRBASE_HWINIT)
#define SKERR_HWI_E001MSG "SkXmClrExactAddr() has got illegal parameters"
#define SKERR_HWI_E002 (SKERR_HWI_E001+1)
#define SKERR_HWI_E002MSG "SkGeInit(): Level 1 call missing"
#define SKERR_HWI_E003 (SKERR_HWI_E002+1)
#define SKERR_HWI_E003MSG "SkGeInit() called with illegal init Level"
#define SKERR_HWI_E004 (SKERR_HWI_E003+1)
#define SKERR_HWI_E004MSG "SkGeInitPort(): Queue Size illegal configured"
#define SKERR_HWI_E005 (SKERR_HWI_E004+1)
#define SKERR_HWI_E005MSG "SkGeInitPort(): cannot init running ports"
#define SKERR_HWI_E006 (SKERR_HWI_E005+1)
#define SKERR_HWI_E006MSG "SkGeMacInit(): PState does not match HW state"
#define SKERR_HWI_E007 (SKERR_HWI_E006+1)
#define SKERR_HWI_E007MSG "SkXmInitDupMd() called with invalid Dup Mode"
#define SKERR_HWI_E008 (SKERR_HWI_E007+1)
#define SKERR_HWI_E008MSG "SkXmSetRxCmd() called with invalid Mode"
#define SKERR_HWI_E009 (SKERR_HWI_E008+1)
#define SKERR_HWI_E009MSG "SkGeCfgSync() called although PXSQSize zero"
#define SKERR_HWI_E010 (SKERR_HWI_E009+1)
#define SKERR_HWI_E010MSG "SkGeCfgSync() called with invalid parameters"
#define SKERR_HWI_E011 (SKERR_HWI_E010+1)
#define SKERR_HWI_E011MSG "SkGeInitPort(): Receive Queue Size too small"
#define SKERR_HWI_E012 (SKERR_HWI_E011+1)
#define SKERR_HWI_E012MSG "SkGeInitPort(): invalid Queue Size specified"
#define SKERR_HWI_E013 (SKERR_HWI_E012+1)
#define SKERR_HWI_E013MSG "SkGeInitPort(): cfg changed for running queue"
#define SKERR_HWI_E014 (SKERR_HWI_E013+1)
#define SKERR_HWI_E014MSG "SkGeInitPort(): unknown GIPortUsage specified"
#define SKERR_HWI_E015 (SKERR_HWI_E014+1)
#define SKERR_HWI_E015MSG "Illegal Link mode parameter"
#define SKERR_HWI_E016 (SKERR_HWI_E015+1)
#define SKERR_HWI_E016MSG "Illegal Flow control mode parameter"
#define SKERR_HWI_E017 (SKERR_HWI_E016+1)
#define SKERR_HWI_E017MSG "Illegal value specified for GIPollTimerVal"
#define SKERR_HWI_E018 (SKERR_HWI_E017+1)
#define SKERR_HWI_E018MSG "FATAL: SkGeStopPort() does not terminate (Tx)"
#define SKERR_HWI_E019 (SKERR_HWI_E018+1)
#define SKERR_HWI_E019MSG "Illegal Speed parameter"
#define SKERR_HWI_E020 (SKERR_HWI_E019+1)
#define SKERR_HWI_E020MSG "Illegal Master/Slave parameter"
#define SKERR_HWI_E021 (SKERR_HWI_E020+1)
#define SKERR_HWI_E021MSG "MacUpdateStats(): cannot update statistic counter"
#define SKERR_HWI_E022 (SKERR_HWI_E021+1)
#define SKERR_HWI_E022MSG "MacStatistic(): illegal statistic base address"
#define SKERR_HWI_E023 (SKERR_HWI_E022+1)
#define SKERR_HWI_E023MSG "SkGeInitPort(): Transmit Queue Size too small"
#define SKERR_HWI_E024 (SKERR_HWI_E023+1)
#define SKERR_HWI_E024MSG "FATAL: SkGeStopPort() does not terminate (Rx)"
#define SKERR_HWI_E025 (SKERR_HWI_E024+1)
#define SKERR_HWI_E025MSG ""
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
/*
* public functions in skgeinit.c
*/
extern void SkGePollTxD(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL PollTxD);
extern void SkGeYellowLED(
SK_AC *pAC,
SK_IOC IoC,
int State);
extern int SkGeCfgSync(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_U32 IntTime,
SK_U32 LimCount,
int SyncMode);
extern void SkGeLoadLnkSyncCnt(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_U32 CntVal);
extern void SkGeStopPort(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Dir,
int RstMode);
extern int SkGeInit(
SK_AC *pAC,
SK_IOC IoC,
int Level);
extern void SkGeDeInit(
SK_AC *pAC,
SK_IOC IoC);
extern int SkGeInitPort(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkGeXmitLED(
SK_AC *pAC,
SK_IOC IoC,
int Led,
int Mode);
extern int SkGeInitAssignRamToQueues(
SK_AC *pAC,
int ActivePort,
SK_BOOL DualNet);
/*
* public functions in skxmac2.c
*/
extern void SkMacRxTxDisable(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacSoftRst(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacHardRst(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkXmInitMac(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkGmInitMac(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacInitPhy(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL DoLoop);
extern void SkMacIrqDisable(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacFlushTxFifo(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacIrq(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern int SkMacAutoNegDone(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacAutoNegLipaPhy(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_U16 IStatus);
extern int SkMacRxTxEnable(
SK_AC *pAC,
SK_IOC IoC,
int Port);
extern void SkMacPromiscMode(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL Enable);
extern void SkMacHashing(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL Enable);
extern void SkXmPhyRead(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Addr,
SK_U16 SK_FAR *pVal);
extern void SkXmPhyWrite(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Addr,
SK_U16 Val);
extern void SkGmPhyRead(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Addr,
SK_U16 SK_FAR *pVal);
extern void SkGmPhyWrite(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Addr,
SK_U16 Val);
extern void SkXmClrExactAddr(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int StartNum,
int StopNum);
extern void SkXmAutoNegLipaXmac(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_U16 IStatus);
extern int SkXmUpdateStats(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port);
extern int SkGmUpdateStats(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port);
extern int SkXmMacStatistic(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port,
SK_U16 StatAddr,
SK_U32 SK_FAR *pVal);
extern int SkGmMacStatistic(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port,
SK_U16 StatAddr,
SK_U32 SK_FAR *pVal);
extern int SkXmResetCounter(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port);
extern int SkGmResetCounter(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port);
extern int SkXmOverflowStatus(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port,
SK_U16 IStatus,
SK_U64 SK_FAR *pStatus);
extern int SkGmOverflowStatus(
SK_AC *pAC,
SK_IOC IoC,
unsigned int Port,
SK_U16 MacStatus,
SK_U64 SK_FAR *pStatus);
extern int SkGmCableDiagStatus(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL StartTest);
#ifdef SK_DIAG
extern void SkGePhyRead(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Addr,
SK_U16 *pVal);
extern void SkGePhyWrite(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Addr,
SK_U16 Val);
extern void SkMacSetRxCmd(
SK_AC *pAC,
SK_IOC IoC,
int Port,
int Mode);
extern void SkMacCrcGener(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL Enable);
extern void SkMacTimeStamp(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL Enable);
extern void SkXmSendCont(
SK_AC *pAC,
SK_IOC IoC,
int Port,
SK_BOOL Enable);
#endif /* SK_DIAG */
#else /* SK_KR_PROTO */
/*
* public functions in skgeinit.c
*/
extern void SkGePollTxD();
extern void SkGeYellowLED();
extern int SkGeCfgSync();
extern void SkGeLoadLnkSyncCnt();
extern void SkGeStopPort();
extern int SkGeInit();
extern void SkGeDeInit();
extern int SkGeInitPort();
extern void SkGeXmitLED();
extern int SkGeInitAssignRamToQueues();
/*
* public functions in skxmac2.c
*/
extern void SkMacRxTxDisable();
extern void SkMacSoftRst();
extern void SkMacHardRst();
extern void SkMacInitPhy();
extern int SkMacRxTxEnable();
extern void SkMacPromiscMode();
extern void SkMacHashing();
extern void SkMacIrqDisable();
extern void SkMacFlushTxFifo();
extern void SkMacIrq();
extern int SkMacAutoNegDone();
extern void SkMacAutoNegLipaPhy();
extern void SkXmInitMac();
extern void SkXmPhyRead();
extern void SkXmPhyWrite();
extern void SkGmInitMac();
extern void SkGmPhyRead();
extern void SkGmPhyWrite();
extern void SkXmClrExactAddr();
extern void SkXmAutoNegLipaXmac();
extern int SkXmUpdateStats();
extern int SkGmUpdateStats();
extern int SkXmMacStatistic();
extern int SkGmMacStatistic();
extern int SkXmResetCounter();
extern int SkGmResetCounter();
extern int SkXmOverflowStatus();
extern int SkGmOverflowStatus();
extern int SkGmCableDiagStatus();
#ifdef SK_DIAG
extern void SkGePhyRead();
extern void SkGePhyWrite();
extern void SkMacSetRxCmd();
extern void SkMacCrcGener();
extern void SkMacTimeStamp();
extern void SkXmSendCont();
#endif /* SK_DIAG */
#endif /* SK_KR_PROTO */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_SKGEINIT_H_ */

View File

@ -0,0 +1,334 @@
/*****************************************************************************
*
* Name: skgepnm2.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.36 $
* Date: $Date: 2003/05/23 12:45:13 $
* Purpose: Defines for Private Network Management Interface
*
****************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef _SKGEPNM2_H_
#define _SKGEPNM2_H_
/*
* General definitions
*/
#define SK_PNMI_CHIPSET_XMAC 1 /* XMAC11800FP */
#define SK_PNMI_CHIPSET_YUKON 2 /* YUKON */
#define SK_PNMI_BUS_PCI 1 /* PCI bus*/
/*
* Actions
*/
#define SK_PNMI_ACT_IDLE 1
#define SK_PNMI_ACT_RESET 2
#define SK_PNMI_ACT_SELFTEST 3
#define SK_PNMI_ACT_RESETCNT 4
/*
* VPD releated defines
*/
#define SK_PNMI_VPD_RW 1
#define SK_PNMI_VPD_RO 2
#define SK_PNMI_VPD_OK 0
#define SK_PNMI_VPD_NOTFOUND 1
#define SK_PNMI_VPD_CUT 2
#define SK_PNMI_VPD_TIMEOUT 3
#define SK_PNMI_VPD_FULL 4
#define SK_PNMI_VPD_NOWRITE 5
#define SK_PNMI_VPD_FATAL 6
#define SK_PNMI_VPD_IGNORE 0
#define SK_PNMI_VPD_CREATE 1
#define SK_PNMI_VPD_DELETE 2
/*
* RLMT related defines
*/
#define SK_PNMI_DEF_RLMT_CHG_THRES 240 /* 4 changes per minute */
/*
* VCT internal status values
*/
#define SK_PNMI_VCT_PENDING 32
#define SK_PNMI_VCT_TEST_DONE 64
#define SK_PNMI_VCT_LINK 128
/*
* Internal table definitions
*/
#define SK_PNMI_GET 0
#define SK_PNMI_PRESET 1
#define SK_PNMI_SET 2
#define SK_PNMI_RO 0
#define SK_PNMI_RW 1
#define SK_PNMI_WO 2
typedef struct s_OidTabEntry {
SK_U32 Id;
SK_U32 InstanceNo;
unsigned int StructSize;
unsigned int Offset;
int Access;
int (* Func)(SK_AC *pAc, SK_IOC pIo, int action,
SK_U32 Id, char* pBuf, unsigned int* pLen,
SK_U32 Instance, unsigned int TableIndex,
SK_U32 NetNumber);
SK_U16 Param;
} SK_PNMI_TAB_ENTRY;
/*
* Trap lengths
*/
#define SK_PNMI_TRAP_SIMPLE_LEN 17
#define SK_PNMI_TRAP_SENSOR_LEN_BASE 46
#define SK_PNMI_TRAP_RLMT_CHANGE_LEN 23
#define SK_PNMI_TRAP_RLMT_PORT_LEN 23
/*
* Number of MAC types supported
*/
#define SK_PNMI_MAC_TYPES (SK_MAC_GMAC + 1)
/*
* MAC statistic data list (overall set for MAC types used)
*/
enum SK_MACSTATS {
SK_PNMI_HTX = 0,
SK_PNMI_HTX_OCTET,
SK_PNMI_HTX_OCTETHIGH = SK_PNMI_HTX_OCTET,
SK_PNMI_HTX_OCTETLOW,
SK_PNMI_HTX_BROADCAST,
SK_PNMI_HTX_MULTICAST,
SK_PNMI_HTX_UNICAST,
SK_PNMI_HTX_BURST,
SK_PNMI_HTX_PMACC,
SK_PNMI_HTX_MACC,
SK_PNMI_HTX_COL,
SK_PNMI_HTX_SINGLE_COL,
SK_PNMI_HTX_MULTI_COL,
SK_PNMI_HTX_EXCESS_COL,
SK_PNMI_HTX_LATE_COL,
SK_PNMI_HTX_DEFFERAL,
SK_PNMI_HTX_EXCESS_DEF,
SK_PNMI_HTX_UNDERRUN,
SK_PNMI_HTX_CARRIER,
SK_PNMI_HTX_UTILUNDER,
SK_PNMI_HTX_UTILOVER,
SK_PNMI_HTX_64,
SK_PNMI_HTX_127,
SK_PNMI_HTX_255,
SK_PNMI_HTX_511,
SK_PNMI_HTX_1023,
SK_PNMI_HTX_MAX,
SK_PNMI_HTX_LONGFRAMES,
SK_PNMI_HTX_SYNC,
SK_PNMI_HTX_SYNC_OCTET,
SK_PNMI_HTX_RESERVED,
SK_PNMI_HRX,
SK_PNMI_HRX_OCTET,
SK_PNMI_HRX_OCTETHIGH = SK_PNMI_HRX_OCTET,
SK_PNMI_HRX_OCTETLOW,
SK_PNMI_HRX_BADOCTET,
SK_PNMI_HRX_BADOCTETHIGH = SK_PNMI_HRX_BADOCTET,
SK_PNMI_HRX_BADOCTETLOW,
SK_PNMI_HRX_BROADCAST,
SK_PNMI_HRX_MULTICAST,
SK_PNMI_HRX_UNICAST,
SK_PNMI_HRX_PMACC,
SK_PNMI_HRX_MACC,
SK_PNMI_HRX_PMACC_ERR,
SK_PNMI_HRX_MACC_UNKWN,
SK_PNMI_HRX_BURST,
SK_PNMI_HRX_MISSED,
SK_PNMI_HRX_FRAMING,
SK_PNMI_HRX_UNDERSIZE,
SK_PNMI_HRX_OVERFLOW,
SK_PNMI_HRX_JABBER,
SK_PNMI_HRX_CARRIER,
SK_PNMI_HRX_IRLENGTH,
SK_PNMI_HRX_SYMBOL,
SK_PNMI_HRX_SHORTS,
SK_PNMI_HRX_RUNT,
SK_PNMI_HRX_TOO_LONG,
SK_PNMI_HRX_FCS,
SK_PNMI_HRX_CEXT,
SK_PNMI_HRX_UTILUNDER,
SK_PNMI_HRX_UTILOVER,
SK_PNMI_HRX_64,
SK_PNMI_HRX_127,
SK_PNMI_HRX_255,
SK_PNMI_HRX_511,
SK_PNMI_HRX_1023,
SK_PNMI_HRX_MAX,
SK_PNMI_HRX_LONGFRAMES,
SK_PNMI_HRX_RESERVED,
SK_PNMI_MAX_IDX /* NOTE: Ensure SK_PNMI_CNT_NO is set to this value */
};
/*
* MAC specific data
*/
typedef struct s_PnmiStatAddr {
SK_U16 Reg; /* MAC register containing the value */
SK_BOOL GetOffset; /* TRUE: Offset managed by PNMI (call GetStatVal())*/
} SK_PNMI_STATADDR;
/*
* SK_PNMI_STRUCT_DATA copy offset evaluation macros
*/
#define SK_PNMI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e))
#define SK_PNMI_MAI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e))
#define SK_PNMI_VPD_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_VPD *)0)->e))
#define SK_PNMI_SEN_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_SENSOR *)0)->e))
#define SK_PNMI_CHK_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CHECKSUM *)0)->e))
#define SK_PNMI_STA_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STAT *)0)->e))
#define SK_PNMI_CNF_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CONF *)0)->e))
#define SK_PNMI_RLM_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT *)0)->e))
#define SK_PNMI_MON_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT_MONITOR *)0)->e))
#define SK_PNMI_TRP_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_TRAP *)0)->e))
#define SK_PNMI_SET_STAT(b,s,o) {SK_U32 Val32; char *pVal; \
Val32 = (s); \
pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \
&(((SK_PNMI_STRUCT_DATA *)0)-> \
ReturnStatus.ErrorStatus)); \
SK_PNMI_STORE_U32(pVal, Val32); \
Val32 = (o); \
pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \
&(((SK_PNMI_STRUCT_DATA *)0)-> \
ReturnStatus.ErrorOffset)); \
SK_PNMI_STORE_U32(pVal, Val32);}
/*
* Time macros
*/
#ifndef SK_PNMI_HUNDREDS_SEC
#if SK_TICKS_PER_SEC == 100
#define SK_PNMI_HUNDREDS_SEC(t) (t)
#else
#define SK_PNMI_HUNDREDS_SEC(t) (((t) * 100) / (SK_TICKS_PER_SEC))
#endif /* !SK_TICKS_PER_SEC */
#endif /* !SK_PNMI_HUNDREDS_SEC */
/*
* Macros to work around alignment problems
*/
#ifndef SK_PNMI_STORE_U16
#define SK_PNMI_STORE_U16(p,v) {*(char *)(p) = *((char *)&(v)); \
*((char *)(p) + 1) = \
*(((char *)&(v)) + 1);}
#endif
#ifndef SK_PNMI_STORE_U32
#define SK_PNMI_STORE_U32(p,v) {*(char *)(p) = *((char *)&(v)); \
*((char *)(p) + 1) = \
*(((char *)&(v)) + 1); \
*((char *)(p) + 2) = \
*(((char *)&(v)) + 2); \
*((char *)(p) + 3) = \
*(((char *)&(v)) + 3);}
#endif
#ifndef SK_PNMI_STORE_U64
#define SK_PNMI_STORE_U64(p,v) {*(char *)(p) = *((char *)&(v)); \
*((char *)(p) + 1) = \
*(((char *)&(v)) + 1); \
*((char *)(p) + 2) = \
*(((char *)&(v)) + 2); \
*((char *)(p) + 3) = \
*(((char *)&(v)) + 3); \
*((char *)(p) + 4) = \
*(((char *)&(v)) + 4); \
*((char *)(p) + 5) = \
*(((char *)&(v)) + 5); \
*((char *)(p) + 6) = \
*(((char *)&(v)) + 6); \
*((char *)(p) + 7) = \
*(((char *)&(v)) + 7);}
#endif
#ifndef SK_PNMI_READ_U16
#define SK_PNMI_READ_U16(p,v) {*((char *)&(v)) = *(char *)(p); \
*(((char *)&(v)) + 1) = \
*((char *)(p) + 1);}
#endif
#ifndef SK_PNMI_READ_U32
#define SK_PNMI_READ_U32(p,v) {*((char *)&(v)) = *(char *)(p); \
*(((char *)&(v)) + 1) = \
*((char *)(p) + 1); \
*(((char *)&(v)) + 2) = \
*((char *)(p) + 2); \
*(((char *)&(v)) + 3) = \
*((char *)(p) + 3);}
#endif
#ifndef SK_PNMI_READ_U64
#define SK_PNMI_READ_U64(p,v) {*((char *)&(v)) = *(char *)(p); \
*(((char *)&(v)) + 1) = \
*((char *)(p) + 1); \
*(((char *)&(v)) + 2) = \
*((char *)(p) + 2); \
*(((char *)&(v)) + 3) = \
*((char *)(p) + 3); \
*(((char *)&(v)) + 4) = \
*((char *)(p) + 4); \
*(((char *)&(v)) + 5) = \
*((char *)(p) + 5); \
*(((char *)&(v)) + 6) = \
*((char *)(p) + 6); \
*(((char *)&(v)) + 7) = \
*((char *)(p) + 7);}
#endif
/*
* Macros for Debug
*/
#ifdef DEBUG
#define SK_PNMI_CHECKFLAGS(vSt) {if (pAC->Pnmi.MacUpdatedFlag > 0 || \
pAC->Pnmi.RlmtUpdatedFlag > 0 || \
pAC->Pnmi.SirqUpdatedFlag > 0) { \
SK_DBG_MSG(pAC, \
SK_DBGMOD_PNMI, \
SK_DBGCAT_CTRL, \
("PNMI: ERR: %s MacUFlag=%d, RlmtUFlag=%d, SirqUFlag=%d\n", \
vSt, \
pAC->Pnmi.MacUpdatedFlag, \
pAC->Pnmi.RlmtUpdatedFlag, \
pAC->Pnmi.SirqUpdatedFlag))}}
#else /* !DEBUG */
#define SK_PNMI_CHECKFLAGS(vSt) /* Nothing */
#endif /* !DEBUG */
#endif /* _SKGEPNM2_H_ */

View File

@ -0,0 +1,962 @@
/*****************************************************************************
*
* Name: skgepnmi.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.62 $
* Date: $Date: 2003/08/15 12:31:52 $
* Purpose: Defines for Private Network Management Interface
*
****************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef _SKGEPNMI_H_
#define _SKGEPNMI_H_
/*
* Include dependencies
*/
#include "h/sktypes.h"
#include "h/skerror.h"
#include "h/sktimer.h"
#include "h/ski2c.h"
#include "h/skaddr.h"
#include "h/skrlmt.h"
#include "h/skvpd.h"
/*
* Management Database Version
*/
#define SK_PNMI_MDB_VERSION 0x00030001 /* 3.1 */
/*
* Event definitions
*/
#define SK_PNMI_EVT_SIRQ_OVERFLOW 1 /* Counter overflow */
#define SK_PNMI_EVT_SEN_WAR_LOW 2 /* Lower war thres exceeded */
#define SK_PNMI_EVT_SEN_WAR_UPP 3 /* Upper war thres exceeded */
#define SK_PNMI_EVT_SEN_ERR_LOW 4 /* Lower err thres exceeded */
#define SK_PNMI_EVT_SEN_ERR_UPP 5 /* Upper err thres exceeded */
#define SK_PNMI_EVT_CHG_EST_TIMER 6 /* Timer event for RLMT Chg */
#define SK_PNMI_EVT_UTILIZATION_TIMER 7 /* Timer event for Utiliza. */
#define SK_PNMI_EVT_CLEAR_COUNTER 8 /* Clear statistic counters */
#define SK_PNMI_EVT_XMAC_RESET 9 /* XMAC will be reset */
#define SK_PNMI_EVT_RLMT_PORT_UP 10 /* Port came logically up */
#define SK_PNMI_EVT_RLMT_PORT_DOWN 11 /* Port went logically down */
#define SK_PNMI_EVT_RLMT_SEGMENTATION 13 /* Two SP root bridges found */
#define SK_PNMI_EVT_RLMT_ACTIVE_DOWN 14 /* Port went logically down */
#define SK_PNMI_EVT_RLMT_ACTIVE_UP 15 /* Port came logically up */
#define SK_PNMI_EVT_RLMT_SET_NETS 16 /* 1. Parameter is number of nets
1 = single net; 2 = dual net */
#define SK_PNMI_EVT_VCT_RESET 17 /* VCT port reset timer event started with SET. */
/*
* Return values
*/
#define SK_PNMI_ERR_OK 0
#define SK_PNMI_ERR_GENERAL 1
#define SK_PNMI_ERR_TOO_SHORT 2
#define SK_PNMI_ERR_BAD_VALUE 3
#define SK_PNMI_ERR_READ_ONLY 4
#define SK_PNMI_ERR_UNKNOWN_OID 5
#define SK_PNMI_ERR_UNKNOWN_INST 6
#define SK_PNMI_ERR_UNKNOWN_NET 7
#define SK_PNMI_ERR_NOT_SUPPORTED 10
/*
* Return values of driver reset function SK_DRIVER_RESET() and
* driver event function SK_DRIVER_EVENT()
*/
#define SK_PNMI_ERR_OK 0
#define SK_PNMI_ERR_FAIL 1
/*
* Return values of driver test function SK_DRIVER_SELFTEST()
*/
#define SK_PNMI_TST_UNKNOWN (1 << 0)
#define SK_PNMI_TST_TRANCEIVER (1 << 1)
#define SK_PNMI_TST_ASIC (1 << 2)
#define SK_PNMI_TST_SENSOR (1 << 3)
#define SK_PNMI_TST_POWERMGMT (1 << 4)
#define SK_PNMI_TST_PCI (1 << 5)
#define SK_PNMI_TST_MAC (1 << 6)
/*
* RLMT specific definitions
*/
#define SK_PNMI_RLMT_STATUS_STANDBY 1
#define SK_PNMI_RLMT_STATUS_ACTIVE 2
#define SK_PNMI_RLMT_STATUS_ERROR 3
#define SK_PNMI_RLMT_LSTAT_PHY_DOWN 1
#define SK_PNMI_RLMT_LSTAT_AUTONEG 2
#define SK_PNMI_RLMT_LSTAT_LOG_DOWN 3
#define SK_PNMI_RLMT_LSTAT_LOG_UP 4
#define SK_PNMI_RLMT_LSTAT_INDETERMINATED 5
#define SK_PNMI_RLMT_MODE_CHK_LINK (SK_RLMT_CHECK_LINK)
#define SK_PNMI_RLMT_MODE_CHK_RX (SK_RLMT_CHECK_LOC_LINK)
#define SK_PNMI_RLMT_MODE_CHK_SPT (SK_RLMT_CHECK_SEG)
/* #define SK_PNMI_RLMT_MODE_CHK_EX */
/*
* OID definition
*/
#ifndef _NDIS_ /* Check, whether NDIS already included OIDs */
#define OID_GEN_XMIT_OK 0x00020101
#define OID_GEN_RCV_OK 0x00020102
#define OID_GEN_XMIT_ERROR 0x00020103
#define OID_GEN_RCV_ERROR 0x00020104
#define OID_GEN_RCV_NO_BUFFER 0x00020105
/* #define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 */
#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
/* #define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 */
#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
/* #define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 */
#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
/* #define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 */
#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
/* #define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 */
#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
/* #define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B */
#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
#define OID_GEN_RCV_CRC_ERROR 0x0002020D
#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
#define OID_802_3_PERMANENT_ADDRESS 0x01010101
#define OID_802_3_CURRENT_ADDRESS 0x01010102
/* #define OID_802_3_MULTICAST_LIST 0x01010103 */
/* #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 */
/* #define OID_802_3_MAC_OPTIONS 0x01010105 */
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
#define OID_802_3_XMIT_DEFERRED 0x01020201
#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
#define OID_802_3_RCV_OVERRUN 0x01020203
#define OID_802_3_XMIT_UNDERRUN 0x01020204
#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
/*
* PnP and PM OIDs
*/
#ifdef SK_POWER_MGMT
#define OID_PNP_CAPABILITIES 0xFD010100
#define OID_PNP_SET_POWER 0xFD010101
#define OID_PNP_QUERY_POWER 0xFD010102
#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
#define OID_PNP_ENABLE_WAKE_UP 0xFD010106
#endif /* SK_POWER_MGMT */
#endif /* _NDIS_ */
#define OID_SKGE_MDB_VERSION 0xFF010100
#define OID_SKGE_SUPPORTED_LIST 0xFF010101
#define OID_SKGE_VPD_FREE_BYTES 0xFF010102
#define OID_SKGE_VPD_ENTRIES_LIST 0xFF010103
#define OID_SKGE_VPD_ENTRIES_NUMBER 0xFF010104
#define OID_SKGE_VPD_KEY 0xFF010105
#define OID_SKGE_VPD_VALUE 0xFF010106
#define OID_SKGE_VPD_ACCESS 0xFF010107
#define OID_SKGE_VPD_ACTION 0xFF010108
#define OID_SKGE_PORT_NUMBER 0xFF010110
#define OID_SKGE_DEVICE_TYPE 0xFF010111
#define OID_SKGE_DRIVER_DESCR 0xFF010112
#define OID_SKGE_DRIVER_VERSION 0xFF010113
#define OID_SKGE_HW_DESCR 0xFF010114
#define OID_SKGE_HW_VERSION 0xFF010115
#define OID_SKGE_CHIPSET 0xFF010116
#define OID_SKGE_ACTION 0xFF010117
#define OID_SKGE_RESULT 0xFF010118
#define OID_SKGE_BUS_TYPE 0xFF010119
#define OID_SKGE_BUS_SPEED 0xFF01011A
#define OID_SKGE_BUS_WIDTH 0xFF01011B
/* 0xFF01011C unused */
#define OID_SKGE_DIAG_ACTION 0xFF01011D
#define OID_SKGE_DIAG_RESULT 0xFF01011E
#define OID_SKGE_MTU 0xFF01011F
#define OID_SKGE_PHYS_CUR_ADDR 0xFF010120
#define OID_SKGE_PHYS_FAC_ADDR 0xFF010121
#define OID_SKGE_PMD 0xFF010122
#define OID_SKGE_CONNECTOR 0xFF010123
#define OID_SKGE_LINK_CAP 0xFF010124
#define OID_SKGE_LINK_MODE 0xFF010125
#define OID_SKGE_LINK_MODE_STATUS 0xFF010126
#define OID_SKGE_LINK_STATUS 0xFF010127
#define OID_SKGE_FLOWCTRL_CAP 0xFF010128
#define OID_SKGE_FLOWCTRL_MODE 0xFF010129
#define OID_SKGE_FLOWCTRL_STATUS 0xFF01012A
#define OID_SKGE_PHY_OPERATION_CAP 0xFF01012B
#define OID_SKGE_PHY_OPERATION_MODE 0xFF01012C
#define OID_SKGE_PHY_OPERATION_STATUS 0xFF01012D
#define OID_SKGE_MULTICAST_LIST 0xFF01012E
#define OID_SKGE_CURRENT_PACKET_FILTER 0xFF01012F
#define OID_SKGE_TRAP 0xFF010130
#define OID_SKGE_TRAP_NUMBER 0xFF010131
#define OID_SKGE_RLMT_MODE 0xFF010140
#define OID_SKGE_RLMT_PORT_NUMBER 0xFF010141
#define OID_SKGE_RLMT_PORT_ACTIVE 0xFF010142
#define OID_SKGE_RLMT_PORT_PREFERRED 0xFF010143
#define OID_SKGE_INTERMEDIATE_SUPPORT 0xFF010160
#define OID_SKGE_SPEED_CAP 0xFF010170
#define OID_SKGE_SPEED_MODE 0xFF010171
#define OID_SKGE_SPEED_STATUS 0xFF010172
#define OID_SKGE_BOARDLEVEL 0xFF010180
#define OID_SKGE_SENSOR_NUMBER 0xFF020100
#define OID_SKGE_SENSOR_INDEX 0xFF020101
#define OID_SKGE_SENSOR_DESCR 0xFF020102
#define OID_SKGE_SENSOR_TYPE 0xFF020103
#define OID_SKGE_SENSOR_VALUE 0xFF020104
#define OID_SKGE_SENSOR_WAR_THRES_LOW 0xFF020105
#define OID_SKGE_SENSOR_WAR_THRES_UPP 0xFF020106
#define OID_SKGE_SENSOR_ERR_THRES_LOW 0xFF020107
#define OID_SKGE_SENSOR_ERR_THRES_UPP 0xFF020108
#define OID_SKGE_SENSOR_STATUS 0xFF020109
#define OID_SKGE_SENSOR_WAR_CTS 0xFF02010A
#define OID_SKGE_SENSOR_ERR_CTS 0xFF02010B
#define OID_SKGE_SENSOR_WAR_TIME 0xFF02010C
#define OID_SKGE_SENSOR_ERR_TIME 0xFF02010D
#define OID_SKGE_CHKSM_NUMBER 0xFF020110
#define OID_SKGE_CHKSM_RX_OK_CTS 0xFF020111
#define OID_SKGE_CHKSM_RX_UNABLE_CTS 0xFF020112
#define OID_SKGE_CHKSM_RX_ERR_CTS 0xFF020113
#define OID_SKGE_CHKSM_TX_OK_CTS 0xFF020114
#define OID_SKGE_CHKSM_TX_UNABLE_CTS 0xFF020115
#define OID_SKGE_STAT_TX 0xFF020120
#define OID_SKGE_STAT_TX_OCTETS 0xFF020121
#define OID_SKGE_STAT_TX_BROADCAST 0xFF020122
#define OID_SKGE_STAT_TX_MULTICAST 0xFF020123
#define OID_SKGE_STAT_TX_UNICAST 0xFF020124
#define OID_SKGE_STAT_TX_LONGFRAMES 0xFF020125
#define OID_SKGE_STAT_TX_BURST 0xFF020126
#define OID_SKGE_STAT_TX_PFLOWC 0xFF020127
#define OID_SKGE_STAT_TX_FLOWC 0xFF020128
#define OID_SKGE_STAT_TX_SINGLE_COL 0xFF020129
#define OID_SKGE_STAT_TX_MULTI_COL 0xFF02012A
#define OID_SKGE_STAT_TX_EXCESS_COL 0xFF02012B
#define OID_SKGE_STAT_TX_LATE_COL 0xFF02012C
#define OID_SKGE_STAT_TX_DEFFERAL 0xFF02012D
#define OID_SKGE_STAT_TX_EXCESS_DEF 0xFF02012E
#define OID_SKGE_STAT_TX_UNDERRUN 0xFF02012F
#define OID_SKGE_STAT_TX_CARRIER 0xFF020130
/* #define OID_SKGE_STAT_TX_UTIL 0xFF020131 */
#define OID_SKGE_STAT_TX_64 0xFF020132
#define OID_SKGE_STAT_TX_127 0xFF020133
#define OID_SKGE_STAT_TX_255 0xFF020134
#define OID_SKGE_STAT_TX_511 0xFF020135
#define OID_SKGE_STAT_TX_1023 0xFF020136
#define OID_SKGE_STAT_TX_MAX 0xFF020137
#define OID_SKGE_STAT_TX_SYNC 0xFF020138
#define OID_SKGE_STAT_TX_SYNC_OCTETS 0xFF020139
#define OID_SKGE_STAT_RX 0xFF02013A
#define OID_SKGE_STAT_RX_OCTETS 0xFF02013B
#define OID_SKGE_STAT_RX_BROADCAST 0xFF02013C
#define OID_SKGE_STAT_RX_MULTICAST 0xFF02013D
#define OID_SKGE_STAT_RX_UNICAST 0xFF02013E
#define OID_SKGE_STAT_RX_PFLOWC 0xFF02013F
#define OID_SKGE_STAT_RX_FLOWC 0xFF020140
#define OID_SKGE_STAT_RX_PFLOWC_ERR 0xFF020141
#define OID_SKGE_STAT_RX_FLOWC_UNKWN 0xFF020142
#define OID_SKGE_STAT_RX_BURST 0xFF020143
#define OID_SKGE_STAT_RX_MISSED 0xFF020144
#define OID_SKGE_STAT_RX_FRAMING 0xFF020145
#define OID_SKGE_STAT_RX_OVERFLOW 0xFF020146
#define OID_SKGE_STAT_RX_JABBER 0xFF020147
#define OID_SKGE_STAT_RX_CARRIER 0xFF020148
#define OID_SKGE_STAT_RX_IR_LENGTH 0xFF020149
#define OID_SKGE_STAT_RX_SYMBOL 0xFF02014A
#define OID_SKGE_STAT_RX_SHORTS 0xFF02014B
#define OID_SKGE_STAT_RX_RUNT 0xFF02014C
#define OID_SKGE_STAT_RX_CEXT 0xFF02014D
#define OID_SKGE_STAT_RX_TOO_LONG 0xFF02014E
#define OID_SKGE_STAT_RX_FCS 0xFF02014F
/* #define OID_SKGE_STAT_RX_UTIL 0xFF020150 */
#define OID_SKGE_STAT_RX_64 0xFF020151
#define OID_SKGE_STAT_RX_127 0xFF020152
#define OID_SKGE_STAT_RX_255 0xFF020153
#define OID_SKGE_STAT_RX_511 0xFF020154
#define OID_SKGE_STAT_RX_1023 0xFF020155
#define OID_SKGE_STAT_RX_MAX 0xFF020156
#define OID_SKGE_STAT_RX_LONGFRAMES 0xFF020157
#define OID_SKGE_RLMT_CHANGE_CTS 0xFF020160
#define OID_SKGE_RLMT_CHANGE_TIME 0xFF020161
#define OID_SKGE_RLMT_CHANGE_ESTIM 0xFF020162
#define OID_SKGE_RLMT_CHANGE_THRES 0xFF020163
#define OID_SKGE_RLMT_PORT_INDEX 0xFF020164
#define OID_SKGE_RLMT_STATUS 0xFF020165
#define OID_SKGE_RLMT_TX_HELLO_CTS 0xFF020166
#define OID_SKGE_RLMT_RX_HELLO_CTS 0xFF020167
#define OID_SKGE_RLMT_TX_SP_REQ_CTS 0xFF020168
#define OID_SKGE_RLMT_RX_SP_CTS 0xFF020169
#define OID_SKGE_RLMT_MONITOR_NUMBER 0xFF010150
#define OID_SKGE_RLMT_MONITOR_INDEX 0xFF010151
#define OID_SKGE_RLMT_MONITOR_ADDR 0xFF010152
#define OID_SKGE_RLMT_MONITOR_ERRS 0xFF010153
#define OID_SKGE_RLMT_MONITOR_TIMESTAMP 0xFF010154
#define OID_SKGE_RLMT_MONITOR_ADMIN 0xFF010155
#define OID_SKGE_TX_SW_QUEUE_LEN 0xFF020170
#define OID_SKGE_TX_SW_QUEUE_MAX 0xFF020171
#define OID_SKGE_TX_RETRY 0xFF020172
#define OID_SKGE_RX_INTR_CTS 0xFF020173
#define OID_SKGE_TX_INTR_CTS 0xFF020174
#define OID_SKGE_RX_NO_BUF_CTS 0xFF020175
#define OID_SKGE_TX_NO_BUF_CTS 0xFF020176
#define OID_SKGE_TX_USED_DESCR_NO 0xFF020177
#define OID_SKGE_RX_DELIVERED_CTS 0xFF020178
#define OID_SKGE_RX_OCTETS_DELIV_CTS 0xFF020179
#define OID_SKGE_RX_HW_ERROR_CTS 0xFF02017A
#define OID_SKGE_TX_HW_ERROR_CTS 0xFF02017B
#define OID_SKGE_IN_ERRORS_CTS 0xFF02017C
#define OID_SKGE_OUT_ERROR_CTS 0xFF02017D
#define OID_SKGE_ERR_RECOVERY_CTS 0xFF02017E
#define OID_SKGE_SYSUPTIME 0xFF02017F
#define OID_SKGE_ALL_DATA 0xFF020190
/* Defines for VCT. */
#define OID_SKGE_VCT_GET 0xFF020200
#define OID_SKGE_VCT_SET 0xFF020201
#define OID_SKGE_VCT_STATUS 0xFF020202
#ifdef SK_DIAG_SUPPORT
/* Defines for driver DIAG mode. */
#define OID_SKGE_DIAG_MODE 0xFF020204
#endif /* SK_DIAG_SUPPORT */
/* New OIDs */
#define OID_SKGE_DRIVER_RELDATE 0xFF020210
#define OID_SKGE_DRIVER_FILENAME 0xFF020211
#define OID_SKGE_CHIPID 0xFF020212
#define OID_SKGE_RAMSIZE 0xFF020213
#define OID_SKGE_VAUXAVAIL 0xFF020214
#define OID_SKGE_PHY_TYPE 0xFF020215
#define OID_SKGE_PHY_LP_MODE 0xFF020216
/* VCT struct to store a backup copy of VCT data after a port reset. */
typedef struct s_PnmiVct {
SK_U8 VctStatus;
SK_U8 PCableLen;
SK_U32 PMdiPairLen[4];
SK_U8 PMdiPairSts[4];
} SK_PNMI_VCT;
/* VCT status values (to be given to CPA via OID_SKGE_VCT_STATUS). */
#define SK_PNMI_VCT_NONE 0
#define SK_PNMI_VCT_OLD_VCT_DATA 1
#define SK_PNMI_VCT_NEW_VCT_DATA 2
#define SK_PNMI_VCT_OLD_DSP_DATA 4
#define SK_PNMI_VCT_NEW_DSP_DATA 8
#define SK_PNMI_VCT_RUNNING 16
/* VCT cable test status. */
#define SK_PNMI_VCT_NORMAL_CABLE 0
#define SK_PNMI_VCT_SHORT_CABLE 1
#define SK_PNMI_VCT_OPEN_CABLE 2
#define SK_PNMI_VCT_TEST_FAIL 3
#define SK_PNMI_VCT_IMPEDANCE_MISMATCH 4
#define OID_SKGE_TRAP_SEN_WAR_LOW 500
#define OID_SKGE_TRAP_SEN_WAR_UPP 501
#define OID_SKGE_TRAP_SEN_ERR_LOW 502
#define OID_SKGE_TRAP_SEN_ERR_UPP 503
#define OID_SKGE_TRAP_RLMT_CHANGE_THRES 520
#define OID_SKGE_TRAP_RLMT_CHANGE_PORT 521
#define OID_SKGE_TRAP_RLMT_PORT_DOWN 522
#define OID_SKGE_TRAP_RLMT_PORT_UP 523
#define OID_SKGE_TRAP_RLMT_SEGMENTATION 524
#ifdef SK_DIAG_SUPPORT
/* Defines for driver DIAG mode. */
#define SK_DIAG_ATTACHED 2
#define SK_DIAG_RUNNING 1
#define SK_DIAG_IDLE 0
#endif /* SK_DIAG_SUPPORT */
/*
* Generic PNMI IOCTL subcommand definitions.
*/
#define SK_GET_SINGLE_VAR 1
#define SK_SET_SINGLE_VAR 2
#define SK_PRESET_SINGLE_VAR 3
#define SK_GET_FULL_MIB 4
#define SK_SET_FULL_MIB 5
#define SK_PRESET_FULL_MIB 6
/*
* Define error numbers and messages for syslog
*/
#define SK_PNMI_ERR001 (SK_ERRBASE_PNMI + 1)
#define SK_PNMI_ERR001MSG "SkPnmiGetStruct: Unknown OID"
#define SK_PNMI_ERR002 (SK_ERRBASE_PNMI + 2)
#define SK_PNMI_ERR002MSG "SkPnmiGetStruct: Cannot read VPD keys"
#define SK_PNMI_ERR003 (SK_ERRBASE_PNMI + 3)
#define SK_PNMI_ERR003MSG "OidStruct: Called with wrong OID"
#define SK_PNMI_ERR004 (SK_ERRBASE_PNMI + 4)
#define SK_PNMI_ERR004MSG "OidStruct: Called with wrong action"
#define SK_PNMI_ERR005 (SK_ERRBASE_PNMI + 5)
#define SK_PNMI_ERR005MSG "Perform: Cannot reset driver"
#define SK_PNMI_ERR006 (SK_ERRBASE_PNMI + 6)
#define SK_PNMI_ERR006MSG "Perform: Unknown OID action command"
#define SK_PNMI_ERR007 (SK_ERRBASE_PNMI + 7)
#define SK_PNMI_ERR007MSG "General: Driver description not initialized"
#define SK_PNMI_ERR008 (SK_ERRBASE_PNMI + 8)
#define SK_PNMI_ERR008MSG "Addr: Tried to get unknown OID"
#define SK_PNMI_ERR009 (SK_ERRBASE_PNMI + 9)
#define SK_PNMI_ERR009MSG "Addr: Unknown OID"
#define SK_PNMI_ERR010 (SK_ERRBASE_PNMI + 10)
#define SK_PNMI_ERR010MSG "CsumStat: Unknown OID"
#define SK_PNMI_ERR011 (SK_ERRBASE_PNMI + 11)
#define SK_PNMI_ERR011MSG "SensorStat: Sensor descr string too long"
#define SK_PNMI_ERR012 (SK_ERRBASE_PNMI + 12)
#define SK_PNMI_ERR012MSG "SensorStat: Unknown OID"
#define SK_PNMI_ERR013 (SK_ERRBASE_PNMI + 13)
#define SK_PNMI_ERR013MSG ""
#define SK_PNMI_ERR014 (SK_ERRBASE_PNMI + 14)
#define SK_PNMI_ERR014MSG "Vpd: Cannot read VPD keys"
#define SK_PNMI_ERR015 (SK_ERRBASE_PNMI + 15)
#define SK_PNMI_ERR015MSG "Vpd: Internal array for VPD keys to small"
#define SK_PNMI_ERR016 (SK_ERRBASE_PNMI + 16)
#define SK_PNMI_ERR016MSG "Vpd: Key string too long"
#define SK_PNMI_ERR017 (SK_ERRBASE_PNMI + 17)
#define SK_PNMI_ERR017MSG "Vpd: Invalid VPD status pointer"
#define SK_PNMI_ERR018 (SK_ERRBASE_PNMI + 18)
#define SK_PNMI_ERR018MSG "Vpd: VPD data not valid"
#define SK_PNMI_ERR019 (SK_ERRBASE_PNMI + 19)
#define SK_PNMI_ERR019MSG "Vpd: VPD entries list string too long"
#define SK_PNMI_ERR021 (SK_ERRBASE_PNMI + 21)
#define SK_PNMI_ERR021MSG "Vpd: VPD data string too long"
#define SK_PNMI_ERR022 (SK_ERRBASE_PNMI + 22)
#define SK_PNMI_ERR022MSG "Vpd: VPD data string too long should be errored before"
#define SK_PNMI_ERR023 (SK_ERRBASE_PNMI + 23)
#define SK_PNMI_ERR023MSG "Vpd: Unknown OID in get action"
#define SK_PNMI_ERR024 (SK_ERRBASE_PNMI + 24)
#define SK_PNMI_ERR024MSG "Vpd: Unknown OID in preset/set action"
#define SK_PNMI_ERR025 (SK_ERRBASE_PNMI + 25)
#define SK_PNMI_ERR025MSG "Vpd: Cannot write VPD after modify entry"
#define SK_PNMI_ERR026 (SK_ERRBASE_PNMI + 26)
#define SK_PNMI_ERR026MSG "Vpd: Cannot update VPD"
#define SK_PNMI_ERR027 (SK_ERRBASE_PNMI + 27)
#define SK_PNMI_ERR027MSG "Vpd: Cannot delete VPD entry"
#define SK_PNMI_ERR028 (SK_ERRBASE_PNMI + 28)
#define SK_PNMI_ERR028MSG "Vpd: Cannot update VPD after delete entry"
#define SK_PNMI_ERR029 (SK_ERRBASE_PNMI + 29)
#define SK_PNMI_ERR029MSG "General: Driver description string too long"
#define SK_PNMI_ERR030 (SK_ERRBASE_PNMI + 30)
#define SK_PNMI_ERR030MSG "General: Driver version not initialized"
#define SK_PNMI_ERR031 (SK_ERRBASE_PNMI + 31)
#define SK_PNMI_ERR031MSG "General: Driver version string too long"
#define SK_PNMI_ERR032 (SK_ERRBASE_PNMI + 32)
#define SK_PNMI_ERR032MSG "General: Cannot read VPD Name for HW descr"
#define SK_PNMI_ERR033 (SK_ERRBASE_PNMI + 33)
#define SK_PNMI_ERR033MSG "General: HW description string too long"
#define SK_PNMI_ERR034 (SK_ERRBASE_PNMI + 34)
#define SK_PNMI_ERR034MSG "General: Unknown OID"
#define SK_PNMI_ERR035 (SK_ERRBASE_PNMI + 35)
#define SK_PNMI_ERR035MSG "Rlmt: Unknown OID"
#define SK_PNMI_ERR036 (SK_ERRBASE_PNMI + 36)
#define SK_PNMI_ERR036MSG ""
#define SK_PNMI_ERR037 (SK_ERRBASE_PNMI + 37)
#define SK_PNMI_ERR037MSG "Rlmt: SK_RLMT_MODE_CHANGE event return not 0"
#define SK_PNMI_ERR038 (SK_ERRBASE_PNMI + 38)
#define SK_PNMI_ERR038MSG "Rlmt: SK_RLMT_PREFPORT_CHANGE event return not 0"
#define SK_PNMI_ERR039 (SK_ERRBASE_PNMI + 39)
#define SK_PNMI_ERR039MSG "RlmtStat: Unknown OID"
#define SK_PNMI_ERR040 (SK_ERRBASE_PNMI + 40)
#define SK_PNMI_ERR040MSG "PowerManagement: Unknown OID"
#define SK_PNMI_ERR041 (SK_ERRBASE_PNMI + 41)
#define SK_PNMI_ERR041MSG "MacPrivateConf: Unknown OID"
#define SK_PNMI_ERR042 (SK_ERRBASE_PNMI + 42)
#define SK_PNMI_ERR042MSG "MacPrivateConf: SK_HWEV_SET_ROLE returned not 0"
#define SK_PNMI_ERR043 (SK_ERRBASE_PNMI + 43)
#define SK_PNMI_ERR043MSG "MacPrivateConf: SK_HWEV_SET_LMODE returned not 0"
#define SK_PNMI_ERR044 (SK_ERRBASE_PNMI + 44)
#define SK_PNMI_ERR044MSG "MacPrivateConf: SK_HWEV_SET_FLOWMODE returned not 0"
#define SK_PNMI_ERR045 (SK_ERRBASE_PNMI + 45)
#define SK_PNMI_ERR045MSG "MacPrivateConf: SK_HWEV_SET_SPEED returned not 0"
#define SK_PNMI_ERR046 (SK_ERRBASE_PNMI + 46)
#define SK_PNMI_ERR046MSG "Monitor: Unknown OID"
#define SK_PNMI_ERR047 (SK_ERRBASE_PNMI + 47)
#define SK_PNMI_ERR047MSG "SirqUpdate: Event function returns not 0"
#define SK_PNMI_ERR048 (SK_ERRBASE_PNMI + 48)
#define SK_PNMI_ERR048MSG "RlmtUpdate: Event function returns not 0"
#define SK_PNMI_ERR049 (SK_ERRBASE_PNMI + 49)
#define SK_PNMI_ERR049MSG "SkPnmiInit: Invalid size of 'CounterOffset' struct!!"
#define SK_PNMI_ERR050 (SK_ERRBASE_PNMI + 50)
#define SK_PNMI_ERR050MSG "SkPnmiInit: Invalid size of 'StatAddr' table!!"
#define SK_PNMI_ERR051 (SK_ERRBASE_PNMI + 51)
#define SK_PNMI_ERR051MSG "SkPnmiEvent: Port switch suspicious"
#define SK_PNMI_ERR052 (SK_ERRBASE_PNMI + 52)
#define SK_PNMI_ERR052MSG ""
#define SK_PNMI_ERR053 (SK_ERRBASE_PNMI + 53)
#define SK_PNMI_ERR053MSG "General: Driver release date not initialized"
#define SK_PNMI_ERR054 (SK_ERRBASE_PNMI + 54)
#define SK_PNMI_ERR054MSG "General: Driver release date string too long"
#define SK_PNMI_ERR055 (SK_ERRBASE_PNMI + 55)
#define SK_PNMI_ERR055MSG "General: Driver file name not initialized"
#define SK_PNMI_ERR056 (SK_ERRBASE_PNMI + 56)
#define SK_PNMI_ERR056MSG "General: Driver file name string too long"
/*
* Management counter macros called by the driver
*/
#define SK_PNMI_SET_DRIVER_DESCR(pAC,v) ((pAC)->Pnmi.pDriverDescription = \
(char *)(v))
#define SK_PNMI_SET_DRIVER_VER(pAC,v) ((pAC)->Pnmi.pDriverVersion = \
(char *)(v))
#define SK_PNMI_SET_DRIVER_RELDATE(pAC,v) ((pAC)->Pnmi.pDriverReleaseDate = \
(char *)(v))
#define SK_PNMI_SET_DRIVER_FILENAME(pAC,v) ((pAC)->Pnmi.pDriverFileName = \
(char *)(v))
#define SK_PNMI_CNT_TX_QUEUE_LEN(pAC,v,p) \
{ \
(pAC)->Pnmi.Port[p].TxSwQueueLen = (SK_U64)(v); \
if ((pAC)->Pnmi.Port[p].TxSwQueueLen > (pAC)->Pnmi.Port[p].TxSwQueueMax) { \
(pAC)->Pnmi.Port[p].TxSwQueueMax = (pAC)->Pnmi.Port[p].TxSwQueueLen; \
} \
}
#define SK_PNMI_CNT_TX_RETRY(pAC,p) (((pAC)->Pnmi.Port[p].TxRetryCts)++)
#define SK_PNMI_CNT_RX_INTR(pAC,p) (((pAC)->Pnmi.Port[p].RxIntrCts)++)
#define SK_PNMI_CNT_TX_INTR(pAC,p) (((pAC)->Pnmi.Port[p].TxIntrCts)++)
#define SK_PNMI_CNT_NO_RX_BUF(pAC,p) (((pAC)->Pnmi.Port[p].RxNoBufCts)++)
#define SK_PNMI_CNT_NO_TX_BUF(pAC,p) (((pAC)->Pnmi.Port[p].TxNoBufCts)++)
#define SK_PNMI_CNT_USED_TX_DESCR(pAC,v,p) \
((pAC)->Pnmi.Port[p].TxUsedDescrNo=(SK_U64)(v));
#define SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,v,p) \
{ \
((pAC)->Pnmi.Port[p].RxDeliveredCts)++; \
(pAC)->Pnmi.Port[p].RxOctetsDeliveredCts += (SK_U64)(v); \
}
#define SK_PNMI_CNT_ERR_RECOVERY(pAC,p) (((pAC)->Pnmi.Port[p].ErrRecoveryCts)++);
#define SK_PNMI_CNT_SYNC_OCTETS(pAC,p,v) \
{ \
if ((p) < SK_MAX_MACS) { \
((pAC)->Pnmi.Port[p].StatSyncCts)++; \
(pAC)->Pnmi.Port[p].StatSyncOctetsCts += (SK_U64)(v); \
} \
}
#define SK_PNMI_CNT_RX_LONGFRAMES(pAC,p) \
{ \
if ((p) < SK_MAX_MACS) { \
((pAC)->Pnmi.Port[p].StatRxLongFrameCts++); \
} \
}
#define SK_PNMI_CNT_RX_FRAMETOOLONG(pAC,p) \
{ \
if ((p) < SK_MAX_MACS) { \
((pAC)->Pnmi.Port[p].StatRxFrameTooLongCts++); \
} \
}
#define SK_PNMI_CNT_RX_PMACC_ERR(pAC,p) \
{ \
if ((p) < SK_MAX_MACS) { \
((pAC)->Pnmi.Port[p].StatRxPMaccErr++); \
} \
}
/*
* Conversion Macros
*/
#define SK_PNMI_PORT_INST2LOG(i) ((unsigned int)(i) - 1)
#define SK_PNMI_PORT_LOG2INST(l) ((unsigned int)(l) + 1)
#define SK_PNMI_PORT_PHYS2LOG(p) ((unsigned int)(p) + 1)
#define SK_PNMI_PORT_LOG2PHYS(pAC,l) ((unsigned int)(l) - 1)
#define SK_PNMI_PORT_PHYS2INST(pAC,p) \
(pAC->Pnmi.DualNetActiveFlag ? 2 : ((unsigned int)(p) + 2))
#define SK_PNMI_PORT_INST2PHYS(pAC,i) ((unsigned int)(i) - 2)
/*
* Structure definition for SkPnmiGetStruct and SkPnmiSetStruct
*/
#define SK_PNMI_VPD_KEY_SIZE 5
#define SK_PNMI_VPD_BUFSIZE (VPD_SIZE)
#define SK_PNMI_VPD_ENTRIES (VPD_SIZE / 4)
#define SK_PNMI_VPD_DATALEN 128 /* Number of data bytes */
#define SK_PNMI_MULTICAST_LISTLEN 64
#define SK_PNMI_SENSOR_ENTRIES (SK_MAX_SENSORS)
#define SK_PNMI_CHECKSUM_ENTRIES 3
#define SK_PNMI_MAC_ENTRIES (SK_MAX_MACS + 1)
#define SK_PNMI_MONITOR_ENTRIES 20
#define SK_PNMI_TRAP_ENTRIES 10
#define SK_PNMI_TRAPLEN 128
#define SK_PNMI_STRINGLEN1 80
#define SK_PNMI_STRINGLEN2 25
#define SK_PNMI_TRAP_QUEUE_LEN 512
typedef struct s_PnmiVpd {
char VpdKey[SK_PNMI_VPD_KEY_SIZE];
char VpdValue[SK_PNMI_VPD_DATALEN];
SK_U8 VpdAccess;
SK_U8 VpdAction;
} SK_PNMI_VPD;
typedef struct s_PnmiSensor {
SK_U8 SensorIndex;
char SensorDescr[SK_PNMI_STRINGLEN2];
SK_U8 SensorType;
SK_U32 SensorValue;
SK_U32 SensorWarningThresholdLow;
SK_U32 SensorWarningThresholdHigh;
SK_U32 SensorErrorThresholdLow;
SK_U32 SensorErrorThresholdHigh;
SK_U8 SensorStatus;
SK_U64 SensorWarningCts;
SK_U64 SensorErrorCts;
SK_U64 SensorWarningTimestamp;
SK_U64 SensorErrorTimestamp;
} SK_PNMI_SENSOR;
typedef struct s_PnmiChecksum {
SK_U64 ChecksumRxOkCts;
SK_U64 ChecksumRxUnableCts;
SK_U64 ChecksumRxErrCts;
SK_U64 ChecksumTxOkCts;
SK_U64 ChecksumTxUnableCts;
} SK_PNMI_CHECKSUM;
typedef struct s_PnmiStat {
SK_U64 StatTxOkCts;
SK_U64 StatTxOctetsOkCts;
SK_U64 StatTxBroadcastOkCts;
SK_U64 StatTxMulticastOkCts;
SK_U64 StatTxUnicastOkCts;
SK_U64 StatTxLongFramesCts;
SK_U64 StatTxBurstCts;
SK_U64 StatTxPauseMacCtrlCts;
SK_U64 StatTxMacCtrlCts;
SK_U64 StatTxSingleCollisionCts;
SK_U64 StatTxMultipleCollisionCts;
SK_U64 StatTxExcessiveCollisionCts;
SK_U64 StatTxLateCollisionCts;
SK_U64 StatTxDeferralCts;
SK_U64 StatTxExcessiveDeferralCts;
SK_U64 StatTxFifoUnderrunCts;
SK_U64 StatTxCarrierCts;
SK_U64 Dummy1; /* StatTxUtilization */
SK_U64 StatTx64Cts;
SK_U64 StatTx127Cts;
SK_U64 StatTx255Cts;
SK_U64 StatTx511Cts;
SK_U64 StatTx1023Cts;
SK_U64 StatTxMaxCts;
SK_U64 StatTxSyncCts;
SK_U64 StatTxSyncOctetsCts;
SK_U64 StatRxOkCts;
SK_U64 StatRxOctetsOkCts;
SK_U64 StatRxBroadcastOkCts;
SK_U64 StatRxMulticastOkCts;
SK_U64 StatRxUnicastOkCts;
SK_U64 StatRxLongFramesCts;
SK_U64 StatRxPauseMacCtrlCts;
SK_U64 StatRxMacCtrlCts;
SK_U64 StatRxPauseMacCtrlErrorCts;
SK_U64 StatRxMacCtrlUnknownCts;
SK_U64 StatRxBurstCts;
SK_U64 StatRxMissedCts;
SK_U64 StatRxFramingCts;
SK_U64 StatRxFifoOverflowCts;
SK_U64 StatRxJabberCts;
SK_U64 StatRxCarrierCts;
SK_U64 StatRxIRLengthCts;
SK_U64 StatRxSymbolCts;
SK_U64 StatRxShortsCts;
SK_U64 StatRxRuntCts;
SK_U64 StatRxCextCts;
SK_U64 StatRxTooLongCts;
SK_U64 StatRxFcsCts;
SK_U64 Dummy2; /* StatRxUtilization */
SK_U64 StatRx64Cts;
SK_U64 StatRx127Cts;
SK_U64 StatRx255Cts;
SK_U64 StatRx511Cts;
SK_U64 StatRx1023Cts;
SK_U64 StatRxMaxCts;
} SK_PNMI_STAT;
typedef struct s_PnmiConf {
char ConfMacCurrentAddr[6];
char ConfMacFactoryAddr[6];
SK_U8 ConfPMD;
SK_U8 ConfConnector;
SK_U32 ConfPhyType;
SK_U32 ConfPhyMode;
SK_U8 ConfLinkCapability;
SK_U8 ConfLinkMode;
SK_U8 ConfLinkModeStatus;
SK_U8 ConfLinkStatus;
SK_U8 ConfFlowCtrlCapability;
SK_U8 ConfFlowCtrlMode;
SK_U8 ConfFlowCtrlStatus;
SK_U8 ConfPhyOperationCapability;
SK_U8 ConfPhyOperationMode;
SK_U8 ConfPhyOperationStatus;
SK_U8 ConfSpeedCapability;
SK_U8 ConfSpeedMode;
SK_U8 ConfSpeedStatus;
} SK_PNMI_CONF;
typedef struct s_PnmiRlmt {
SK_U32 RlmtIndex;
SK_U32 RlmtStatus;
SK_U64 RlmtTxHelloCts;
SK_U64 RlmtRxHelloCts;
SK_U64 RlmtTxSpHelloReqCts;
SK_U64 RlmtRxSpHelloCts;
} SK_PNMI_RLMT;
typedef struct s_PnmiRlmtMonitor {
SK_U32 RlmtMonitorIndex;
char RlmtMonitorAddr[6];
SK_U64 RlmtMonitorErrorCts;
SK_U64 RlmtMonitorTimestamp;
SK_U8 RlmtMonitorAdmin;
} SK_PNMI_RLMT_MONITOR;
typedef struct s_PnmiRequestStatus {
SK_U32 ErrorStatus;
SK_U32 ErrorOffset;
} SK_PNMI_REQUEST_STATUS;
typedef struct s_PnmiStrucData {
SK_U32 MgmtDBVersion;
SK_PNMI_REQUEST_STATUS ReturnStatus;
SK_U32 VpdFreeBytes;
char VpdEntriesList[SK_PNMI_VPD_ENTRIES * SK_PNMI_VPD_KEY_SIZE];
SK_U32 VpdEntriesNumber;
SK_PNMI_VPD Vpd[SK_PNMI_VPD_ENTRIES];
SK_U32 PortNumber;
SK_U32 DeviceType;
char DriverDescr[SK_PNMI_STRINGLEN1];
char DriverVersion[SK_PNMI_STRINGLEN2];
char DriverReleaseDate[SK_PNMI_STRINGLEN1];
char DriverFileName[SK_PNMI_STRINGLEN1];
char HwDescr[SK_PNMI_STRINGLEN1];
char HwVersion[SK_PNMI_STRINGLEN2];
SK_U16 Chipset;
SK_U32 ChipId;
SK_U8 VauxAvail;
SK_U32 RamSize;
SK_U32 MtuSize;
SK_U32 Action;
SK_U32 TestResult;
SK_U8 BusType;
SK_U8 BusSpeed;
SK_U8 BusWidth;
SK_U8 SensorNumber;
SK_PNMI_SENSOR Sensor[SK_PNMI_SENSOR_ENTRIES];
SK_U8 ChecksumNumber;
SK_PNMI_CHECKSUM Checksum[SK_PNMI_CHECKSUM_ENTRIES];
SK_PNMI_STAT Stat[SK_PNMI_MAC_ENTRIES];
SK_PNMI_CONF Conf[SK_PNMI_MAC_ENTRIES];
SK_U8 RlmtMode;
SK_U32 RlmtPortNumber;
SK_U8 RlmtPortActive;
SK_U8 RlmtPortPreferred;
SK_U64 RlmtChangeCts;
SK_U64 RlmtChangeTime;
SK_U64 RlmtChangeEstimate;
SK_U64 RlmtChangeThreshold;
SK_PNMI_RLMT Rlmt[SK_MAX_MACS];
SK_U32 RlmtMonitorNumber;
SK_PNMI_RLMT_MONITOR RlmtMonitor[SK_PNMI_MONITOR_ENTRIES];
SK_U32 TrapNumber;
SK_U8 Trap[SK_PNMI_TRAP_QUEUE_LEN];
SK_U64 TxSwQueueLen;
SK_U64 TxSwQueueMax;
SK_U64 TxRetryCts;
SK_U64 RxIntrCts;
SK_U64 TxIntrCts;
SK_U64 RxNoBufCts;
SK_U64 TxNoBufCts;
SK_U64 TxUsedDescrNo;
SK_U64 RxDeliveredCts;
SK_U64 RxOctetsDeliveredCts;
SK_U64 RxHwErrorsCts;
SK_U64 TxHwErrorsCts;
SK_U64 InErrorsCts;
SK_U64 OutErrorsCts;
SK_U64 ErrRecoveryCts;
SK_U64 SysUpTime;
} SK_PNMI_STRUCT_DATA;
#define SK_PNMI_STRUCT_SIZE (sizeof(SK_PNMI_STRUCT_DATA))
#define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)(SK_UPTR)\
&(((SK_PNMI_STRUCT_DATA *)0)->VpdFreeBytes))
/*
* ReturnStatus field
* must be located
* before VpdFreeBytes
*/
/*
* Various definitions
*/
#define SK_PNMI_MAX_PROTOS 3
#define SK_PNMI_CNT_NO 66 /* Must have the value of the enum
* SK_PNMI_MAX_IDX. Define SK_PNMI_CHECK
* for check while init phase 1
*/
/*
* Estimate data structure
*/
typedef struct s_PnmiEstimate {
unsigned int EstValueIndex;
SK_U64 EstValue[7];
SK_U64 Estimate;
SK_TIMER EstTimer;
} SK_PNMI_ESTIMATE;
/*
* VCT timer data structure
*/
typedef struct s_VctTimer {
SK_TIMER VctTimer;
} SK_PNMI_VCT_TIMER;
/*
* PNMI specific adapter context structure
*/
typedef struct s_PnmiPort {
SK_U64 StatSyncCts;
SK_U64 StatSyncOctetsCts;
SK_U64 StatRxLongFrameCts;
SK_U64 StatRxFrameTooLongCts;
SK_U64 StatRxPMaccErr;
SK_U64 TxSwQueueLen;
SK_U64 TxSwQueueMax;
SK_U64 TxRetryCts;
SK_U64 RxIntrCts;
SK_U64 TxIntrCts;
SK_U64 RxNoBufCts;
SK_U64 TxNoBufCts;
SK_U64 TxUsedDescrNo;
SK_U64 RxDeliveredCts;
SK_U64 RxOctetsDeliveredCts;
SK_U64 RxHwErrorsCts;
SK_U64 TxHwErrorsCts;
SK_U64 InErrorsCts;
SK_U64 OutErrorsCts;
SK_U64 ErrRecoveryCts;
SK_U64 RxShortZeroMark;
SK_U64 CounterOffset[SK_PNMI_CNT_NO];
SK_U32 CounterHigh[SK_PNMI_CNT_NO];
SK_BOOL ActiveFlag;
SK_U8 Align[3];
} SK_PNMI_PORT;
typedef struct s_PnmiData {
SK_PNMI_PORT Port [SK_MAX_MACS];
SK_PNMI_PORT BufPort [SK_MAX_MACS]; /* 2002-09-13 pweber */
SK_U64 VirtualCounterOffset[SK_PNMI_CNT_NO];
SK_U32 TestResult;
char HwVersion[10];
SK_U16 Align01;
char *pDriverDescription;
char *pDriverVersion;
char *pDriverReleaseDate;
char *pDriverFileName;
int MacUpdatedFlag;
int RlmtUpdatedFlag;
int SirqUpdatedFlag;
SK_U64 RlmtChangeCts;
SK_U64 RlmtChangeTime;
SK_PNMI_ESTIMATE RlmtChangeEstimate;
SK_U64 RlmtChangeThreshold;
SK_U64 StartUpTime;
SK_U32 DeviceType;
char PciBusSpeed;
char PciBusWidth;
char Chipset;
char PMD;
char Connector;
SK_BOOL DualNetActiveFlag;
SK_U16 Align02;
char TrapBuf[SK_PNMI_TRAP_QUEUE_LEN];
unsigned int TrapBufFree;
unsigned int TrapQueueBeg;
unsigned int TrapQueueEnd;
unsigned int TrapBufPad;
unsigned int TrapUnique;
SK_U8 VctStatus[SK_MAX_MACS];
SK_PNMI_VCT VctBackup[SK_MAX_MACS];
SK_PNMI_VCT_TIMER VctTimeout[SK_MAX_MACS];
#ifdef SK_DIAG_SUPPORT
SK_U32 DiagAttached;
#endif /* SK_DIAG_SUPPORT */
} SK_PNMI;
/*
* Function prototypes
*/
extern int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int Level);
extern int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void* pBuf,
unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex);
extern int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf,
unsigned int *pLen, SK_U32 NetIndex);
extern int SkPnmiPreSetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf,
unsigned int *pLen, SK_U32 NetIndex);
extern int SkPnmiSetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf,
unsigned int *pLen, SK_U32 NetIndex);
extern int SkPnmiEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event,
SK_EVPARA Param);
extern int SkPnmiGenIoctl(SK_AC *pAC, SK_IOC IoC, void * pBuf,
unsigned int * pLen, SK_U32 NetIndex);
#endif

View File

@ -0,0 +1,110 @@
/******************************************************************************
*
* Name: skgesirq.h
* Project: Gigabit Ethernet Adapters, Common Modules
* Version: $Revision: 1.30 $
* Date: $Date: 2003/07/04 12:34:13 $
* Purpose: SK specific Gigabit Ethernet special IRQ functions
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef _INC_SKGESIRQ_H_
#define _INC_SKGESIRQ_H_
/* Define return codes of SkGePortCheckUp and CheckShort */
#define SK_HW_PS_NONE 0 /* No action needed */
#define SK_HW_PS_RESTART 1 /* Restart needed */
#define SK_HW_PS_LINK 2 /* Link Up actions needed */
/*
* Define the Event the special IRQ/INI module can handle
*/
#define SK_HWEV_WATIM 1 /* Timeout for WA Errata #2 XMAC */
#define SK_HWEV_PORT_START 2 /* Port Start Event by RLMT */
#define SK_HWEV_PORT_STOP 3 /* Port Stop Event by RLMT */
#define SK_HWEV_CLEAR_STAT 4 /* Clear Statistics by PNMI */
#define SK_HWEV_UPDATE_STAT 5 /* Update Statistics by PNMI */
#define SK_HWEV_SET_LMODE 6 /* Set Link Mode by PNMI */
#define SK_HWEV_SET_FLOWMODE 7 /* Set Flow Control Mode by PNMI */
#define SK_HWEV_SET_ROLE 8 /* Set Master/Slave (Role) by PNMI */
#define SK_HWEV_SET_SPEED 9 /* Set Link Speed by PNMI */
#define SK_HWEV_HALFDUP_CHK 10 /* Half Duplex Hangup Workaround */
#define SK_WA_ACT_TIME (5000000UL) /* 5 sec */
#define SK_WA_INA_TIME (100000UL) /* 100 msec */
#define SK_HALFDUP_CHK_TIME (10000UL) /* 10 msec */
/*
* Define the error numbers and messages
*/
#define SKERR_SIRQ_E001 (SK_ERRBASE_SIRQ+0)
#define SKERR_SIRQ_E001MSG "Unknown event"
#define SKERR_SIRQ_E002 (SKERR_SIRQ_E001+1)
#define SKERR_SIRQ_E002MSG "Packet timeout RX1"
#define SKERR_SIRQ_E003 (SKERR_SIRQ_E002+1)
#define SKERR_SIRQ_E003MSG "Packet timeout RX2"
#define SKERR_SIRQ_E004 (SKERR_SIRQ_E003+1)
#define SKERR_SIRQ_E004MSG "MAC 1 not correctly initialized"
#define SKERR_SIRQ_E005 (SKERR_SIRQ_E004+1)
#define SKERR_SIRQ_E005MSG "MAC 2 not correctly initialized"
#define SKERR_SIRQ_E006 (SKERR_SIRQ_E005+1)
#define SKERR_SIRQ_E006MSG "CHECK failure R1"
#define SKERR_SIRQ_E007 (SKERR_SIRQ_E006+1)
#define SKERR_SIRQ_E007MSG "CHECK failure R2"
#define SKERR_SIRQ_E008 (SKERR_SIRQ_E007+1)
#define SKERR_SIRQ_E008MSG "CHECK failure XS1"
#define SKERR_SIRQ_E009 (SKERR_SIRQ_E008+1)
#define SKERR_SIRQ_E009MSG "CHECK failure XA1"
#define SKERR_SIRQ_E010 (SKERR_SIRQ_E009+1)
#define SKERR_SIRQ_E010MSG "CHECK failure XS2"
#define SKERR_SIRQ_E011 (SKERR_SIRQ_E010+1)
#define SKERR_SIRQ_E011MSG "CHECK failure XA2"
#define SKERR_SIRQ_E012 (SKERR_SIRQ_E011+1)
#define SKERR_SIRQ_E012MSG "unexpected IRQ Master error"
#define SKERR_SIRQ_E013 (SKERR_SIRQ_E012+1)
#define SKERR_SIRQ_E013MSG "unexpected IRQ Status error"
#define SKERR_SIRQ_E014 (SKERR_SIRQ_E013+1)
#define SKERR_SIRQ_E014MSG "Parity error on RAM (read)"
#define SKERR_SIRQ_E015 (SKERR_SIRQ_E014+1)
#define SKERR_SIRQ_E015MSG "Parity error on RAM (write)"
#define SKERR_SIRQ_E016 (SKERR_SIRQ_E015+1)
#define SKERR_SIRQ_E016MSG "Parity error MAC 1"
#define SKERR_SIRQ_E017 (SKERR_SIRQ_E016+1)
#define SKERR_SIRQ_E017MSG "Parity error MAC 2"
#define SKERR_SIRQ_E018 (SKERR_SIRQ_E017+1)
#define SKERR_SIRQ_E018MSG "Parity error RX 1"
#define SKERR_SIRQ_E019 (SKERR_SIRQ_E018+1)
#define SKERR_SIRQ_E019MSG "Parity error RX 2"
#define SKERR_SIRQ_E020 (SKERR_SIRQ_E019+1)
#define SKERR_SIRQ_E020MSG "MAC transmit FIFO underrun"
#define SKERR_SIRQ_E021 (SKERR_SIRQ_E020+1)
#define SKERR_SIRQ_E021MSG "Spurious TWSI interrupt"
#define SKERR_SIRQ_E022 (SKERR_SIRQ_E021+1)
#define SKERR_SIRQ_E022MSG "Cable pair swap error"
#define SKERR_SIRQ_E023 (SKERR_SIRQ_E022+1)
#define SKERR_SIRQ_E023MSG "Auto-negotiation error"
#define SKERR_SIRQ_E024 (SKERR_SIRQ_E023+1)
#define SKERR_SIRQ_E024MSG "FIFO overflow error"
#define SKERR_SIRQ_E025 (SKERR_SIRQ_E024+1)
#define SKERR_SIRQ_E025MSG "2 Pair Downshift detected"
extern void SkGeSirqIsr(SK_AC *pAC, SK_IOC IoC, SK_U32 Istatus);
extern int SkGeSirqEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
extern void SkHWLinkDown(SK_AC *pAC, SK_IOC IoC, int Port);
#endif /* _INC_SKGESIRQ_H_ */

View File

@ -0,0 +1,174 @@
/******************************************************************************
*
* Name: ski2c.h
* Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.35 $
* Date: $Date: 2003/10/20 09:06:30 $
* Purpose: Defines to access Voltage and Temperature Sensor
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* SKI2C.H contains all I2C specific defines
*/
#ifndef _SKI2C_H_
#define _SKI2C_H_
typedef struct s_Sensor SK_SENSOR;
#include "h/skgei2c.h"
/*
* Define the I2C events.
*/
#define SK_I2CEV_IRQ 1 /* IRQ happened Event */
#define SK_I2CEV_TIM 2 /* Timeout event */
#define SK_I2CEV_CLEAR 3 /* Clear MIB Values */
/*
* Define READ and WRITE Constants.
*/
#define I2C_READ 0
#define I2C_WRITE 1
#define I2C_BURST 1
#define I2C_SINGLE 0
#define SKERR_I2C_E001 (SK_ERRBASE_I2C+0)
#define SKERR_I2C_E001MSG "Sensor index unknown"
#define SKERR_I2C_E002 (SKERR_I2C_E001+1)
#define SKERR_I2C_E002MSG "TWSI: transfer does not complete"
#define SKERR_I2C_E003 (SKERR_I2C_E002+1)
#define SKERR_I2C_E003MSG "LM80: NAK on device send"
#define SKERR_I2C_E004 (SKERR_I2C_E003+1)
#define SKERR_I2C_E004MSG "LM80: NAK on register send"
#define SKERR_I2C_E005 (SKERR_I2C_E004+1)
#define SKERR_I2C_E005MSG "LM80: NAK on device (2) send"
#define SKERR_I2C_E006 (SKERR_I2C_E005+1)
#define SKERR_I2C_E006MSG "Unknown event"
#define SKERR_I2C_E007 (SKERR_I2C_E006+1)
#define SKERR_I2C_E007MSG "LM80 read out of state"
#define SKERR_I2C_E008 (SKERR_I2C_E007+1)
#define SKERR_I2C_E008MSG "Unexpected sensor read completed"
#define SKERR_I2C_E009 (SKERR_I2C_E008+1)
#define SKERR_I2C_E009MSG "WARNING: temperature sensor out of range"
#define SKERR_I2C_E010 (SKERR_I2C_E009+1)
#define SKERR_I2C_E010MSG "WARNING: voltage sensor out of range"
#define SKERR_I2C_E011 (SKERR_I2C_E010+1)
#define SKERR_I2C_E011MSG "ERROR: temperature sensor out of range"
#define SKERR_I2C_E012 (SKERR_I2C_E011+1)
#define SKERR_I2C_E012MSG "ERROR: voltage sensor out of range"
#define SKERR_I2C_E013 (SKERR_I2C_E012+1)
#define SKERR_I2C_E013MSG "ERROR: couldn't init sensor"
#define SKERR_I2C_E014 (SKERR_I2C_E013+1)
#define SKERR_I2C_E014MSG "WARNING: fan sensor out of range"
#define SKERR_I2C_E015 (SKERR_I2C_E014+1)
#define SKERR_I2C_E015MSG "ERROR: fan sensor out of range"
#define SKERR_I2C_E016 (SKERR_I2C_E015+1)
#define SKERR_I2C_E016MSG "TWSI: active transfer does not complete"
/*
* Define Timeout values
*/
#define SK_I2C_TIM_LONG 2000000L /* 2 seconds */
#define SK_I2C_TIM_SHORT 100000L /* 100 milliseconds */
#define SK_I2C_TIM_WATCH 1000000L /* 1 second */
/*
* Define trap and error log hold times
*/
#ifndef SK_SEN_ERR_TR_HOLD
#define SK_SEN_ERR_TR_HOLD (4*SK_TICKS_PER_SEC)
#endif
#ifndef SK_SEN_ERR_LOG_HOLD
#define SK_SEN_ERR_LOG_HOLD (60*SK_TICKS_PER_SEC)
#endif
#ifndef SK_SEN_WARN_TR_HOLD
#define SK_SEN_WARN_TR_HOLD (15*SK_TICKS_PER_SEC)
#endif
#ifndef SK_SEN_WARN_LOG_HOLD
#define SK_SEN_WARN_LOG_HOLD (15*60*SK_TICKS_PER_SEC)
#endif
/*
* Defines for SenType
*/
#define SK_SEN_UNKNOWN 0
#define SK_SEN_TEMP 1
#define SK_SEN_VOLT 2
#define SK_SEN_FAN 3
/*
* Define for the SenErrorFlag
*/
#define SK_SEN_ERR_NOT_PRESENT 0 /* Error Flag: Sensor not present */
#define SK_SEN_ERR_OK 1 /* Error Flag: O.K. */
#define SK_SEN_ERR_WARN 2 /* Error Flag: Warning */
#define SK_SEN_ERR_ERR 3 /* Error Flag: Error */
#define SK_SEN_ERR_FAULTY 4 /* Error Flag: Faulty */
/*
* Define the Sensor struct
*/
struct s_Sensor {
char *SenDesc; /* Description */
int SenType; /* Voltage or Temperature */
SK_I32 SenValue; /* Current value of the sensor */
SK_I32 SenThreErrHigh; /* High error Threshhold of this sensor */
SK_I32 SenThreWarnHigh; /* High warning Threshhold of this sensor */
SK_I32 SenThreErrLow; /* Lower error Threshold of the sensor */
SK_I32 SenThreWarnLow; /* Lower warning Threshold of the sensor */
int SenErrFlag; /* Sensor indicated an error */
SK_BOOL SenInit; /* Is sensor initialized ? */
SK_U64 SenErrCts; /* Error trap counter */
SK_U64 SenWarnCts; /* Warning trap counter */
SK_U64 SenBegErrTS; /* Begin error timestamp */
SK_U64 SenBegWarnTS; /* Begin warning timestamp */
SK_U64 SenLastErrTrapTS; /* Last error trap timestamp */
SK_U64 SenLastErrLogTS; /* Last error log timestamp */
SK_U64 SenLastWarnTrapTS; /* Last warning trap timestamp */
SK_U64 SenLastWarnLogTS; /* Last warning log timestamp */
int SenState; /* Sensor State (see HW specific include) */
int (*SenRead)(SK_AC *pAC, SK_IOC IoC, struct s_Sensor *pSen);
/* Sensors read function */
SK_U16 SenReg; /* Register Address for this sensor */
SK_U8 SenDev; /* Device Selection for this sensor */
};
typedef struct s_I2c {
SK_SENSOR SenTable[SK_MAX_SENSORS]; /* Sensor Table */
int CurrSens; /* Which sensor is currently queried */
int MaxSens; /* Max. number of sensors */
int TimerMode; /* Use the timer also to watch the state machine */
int InitLevel; /* Initialized Level */
#ifndef SK_DIAG
int DummyReads; /* Number of non-checked dummy reads */
SK_TIMER SenTimer; /* Sensors timer */
#endif /* !SK_DIAG */
} SK_I2C;
extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level);
#ifdef SK_DIAG
extern SK_U32 SkI2cRead(SK_AC *pAC, SK_IOC IoC, int Dev, int Size, int Reg,
int Burst);
#else /* !SK_DIAG */
extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);
extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC);
extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC);
#endif /* !SK_DIAG */
#endif /* n_SKI2C_H */

View File

@ -0,0 +1,94 @@
/******************************************************************************
*
* Name: skqueue.h
* Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.16 $
* Date: $Date: 2003/09/16 12:50:32 $
* Purpose: Defines for the Event queue
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* SKQUEUE.H contains all defines and types for the event queue
*/
#ifndef _SKQUEUE_H_
#define _SKQUEUE_H_
/*
* define the event classes to be served
*/
#define SKGE_DRV 1 /* Driver Event Class */
#define SKGE_RLMT 2 /* RLMT Event Class */
#define SKGE_I2C 3 /* I2C Event Class */
#define SKGE_PNMI 4 /* PNMI Event Class */
#define SKGE_CSUM 5 /* Checksum Event Class */
#define SKGE_HWAC 6 /* Hardware Access Event Class */
#define SKGE_SWT 9 /* Software Timer Event Class */
#define SKGE_LACP 10 /* LACP Aggregation Event Class */
#define SKGE_RSF 11 /* RSF Aggregation Event Class */
#define SKGE_MARKER 12 /* MARKER Aggregation Event Class */
#define SKGE_FD 13 /* FD Distributor Event Class */
/*
* define event queue as circular buffer
*/
#define SK_MAX_EVENT 64
/*
* Parameter union for the Para stuff
*/
typedef union u_EvPara {
void *pParaPtr; /* Parameter Pointer */
SK_U64 Para64; /* Parameter 64bit version */
SK_U32 Para32[2]; /* Parameter Array of 32bit parameters */
} SK_EVPARA;
/*
* Event Queue
* skqueue.c
* events are class/value pairs
* class is addressee, e.g. RLMT, PNMI etc.
* value is command, e.g. line state change, ring op change etc.
*/
typedef struct s_EventElem {
SK_U32 Class; /* Event class */
SK_U32 Event; /* Event value */
SK_EVPARA Para; /* Event parameter */
} SK_EVENTELEM;
typedef struct s_Queue {
SK_EVENTELEM EvQueue[SK_MAX_EVENT];
SK_EVENTELEM *EvPut;
SK_EVENTELEM *EvGet;
} SK_QUEUE;
extern void SkEventInit(SK_AC *pAC, SK_IOC Ioc, int Level);
extern void SkEventQueue(SK_AC *pAC, SK_U32 Class, SK_U32 Event,
SK_EVPARA Para);
extern int SkEventDispatcher(SK_AC *pAC, SK_IOC Ioc);
/* Define Error Numbers and messages */
#define SKERR_Q_E001 (SK_ERRBASE_QUEUE+0)
#define SKERR_Q_E001MSG "Event queue overflow"
#define SKERR_Q_E002 (SKERR_Q_E001+1)
#define SKERR_Q_E002MSG "Undefined event class"
#endif /* _SKQUEUE_H_ */

View File

@ -0,0 +1,438 @@
/******************************************************************************
*
* Name: skrlmt.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.37 $
* Date: $Date: 2003/04/15 09:43:43 $
* Purpose: Header file for Redundant Link ManagemenT.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This is the header file for Redundant Link ManagemenT.
*
* Include File Hierarchy:
*
* "skdrv1st.h"
* ...
* "sktypes.h"
* "skqueue.h"
* "skaddr.h"
* "skrlmt.h"
* ...
* "skdrv2nd.h"
*
******************************************************************************/
#ifndef __INC_SKRLMT_H
#define __INC_SKRLMT_H
#ifdef __cplusplus
extern "C" {
#endif /* cplusplus */
/* defines ********************************************************************/
#define SK_RLMT_NET_DOWN_TEMP 1 /* NET_DOWN due to last port down. */
#define SK_RLMT_NET_DOWN_FINAL 2 /* NET_DOWN due to RLMT_STOP. */
/* ----- Default queue sizes - must be multiples of 8 KB ----- */
/* Less than 8 KB free in RX queue => pause frames. */
#define SK_RLMT_STANDBY_QRXSIZE 128 /* Size of rx standby queue in KB. */
#define SK_RLMT_STANDBY_QXASIZE 32 /* Size of async standby queue in KB. */
#define SK_RLMT_STANDBY_QXSSIZE 0 /* Size of sync standby queue in KB. */
#define SK_RLMT_MAX_TX_BUF_SIZE 60 /* Maximum RLMT transmit size. */
/* ----- PORT states ----- */
#define SK_RLMT_PS_INIT 0 /* Port state: Init. */
#define SK_RLMT_PS_LINK_DOWN 1 /* Port state: Link down. */
#define SK_RLMT_PS_DOWN 2 /* Port state: Port down. */
#define SK_RLMT_PS_GOING_UP 3 /* Port state: Going up. */
#define SK_RLMT_PS_UP 4 /* Port state: Up. */
/* ----- RLMT states ----- */
#define SK_RLMT_RS_INIT 0 /* RLMT state: Init. */
#define SK_RLMT_RS_NET_DOWN 1 /* RLMT state: Net down. */
#define SK_RLMT_RS_NET_UP 2 /* RLMT state: Net up. */
/* ----- PORT events ----- */
#define SK_RLMT_LINK_UP 1001 /* Link came up. */
#define SK_RLMT_LINK_DOWN 1002 /* Link went down. */
#define SK_RLMT_PORT_ADDR 1003 /* Port address changed. */
/* ----- RLMT events ----- */
#define SK_RLMT_START 2001 /* Start RLMT. */
#define SK_RLMT_STOP 2002 /* Stop RLMT. */
#define SK_RLMT_PACKET_RECEIVED 2003 /* Packet was received for RLMT. */
#define SK_RLMT_STATS_CLEAR 2004 /* Clear statistics. */
#define SK_RLMT_STATS_UPDATE 2005 /* Update statistics. */
#define SK_RLMT_PREFPORT_CHANGE 2006 /* Change preferred port. */
#define SK_RLMT_MODE_CHANGE 2007 /* New RlmtMode. */
#define SK_RLMT_SET_NETS 2008 /* Number of Nets (1 or 2). */
/* ----- RLMT mode bits ----- */
/*
* CAUTION: These defines are private to RLMT.
* Please use the RLMT mode defines below.
*/
#define SK_RLMT_CHECK_LINK 1 /* Check Link. */
#define SK_RLMT_CHECK_LOC_LINK 2 /* Check other link on same adapter. */
#define SK_RLMT_CHECK_SEG 4 /* Check segmentation. */
#ifndef RLMT_CHECK_REMOTE
#define SK_RLMT_CHECK_OTHERS SK_RLMT_CHECK_LOC_LINK
#else /* RLMT_CHECK_REMOTE */
#define SK_RLMT_CHECK_REM_LINK 8 /* Check link(s) on other adapter(s). */
#define SK_RLMT_MAX_REMOTE_PORTS_CHECKED 3
#define SK_RLMT_CHECK_OTHERS \
(SK_RLMT_CHECK_LOC_LINK | SK_RLMT_CHECK_REM_LINK)
#endif /* RLMT_CHECK_REMOTE */
#ifndef SK_RLMT_ENABLE_TRANSPARENT
#define SK_RLMT_TRANSPARENT 0 /* RLMT transparent - inactive. */
#else /* SK_RLMT_ENABLE_TRANSPARENT */
#define SK_RLMT_TRANSPARENT 128 /* RLMT transparent. */
#endif /* SK_RLMT_ENABLE_TRANSPARENT */
/* ----- RLMT modes ----- */
/* Check Link State. */
#define SK_RLMT_MODE_CLS (SK_RLMT_CHECK_LINK)
/* Check Local Ports: check other links on the same adapter. */
#define SK_RLMT_MODE_CLP (SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK)
/* Check Local Ports and Segmentation Status. */
#define SK_RLMT_MODE_CLPSS \
(SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK | SK_RLMT_CHECK_SEG)
#ifdef RLMT_CHECK_REMOTE
/* Check Local and Remote Ports: check links (local or remote). */
Name of define TBD!
#define SK_RLMT_MODE_CRP \
(SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK | SK_RLMT_CHECK_REM_LINK)
/* Check Local and Remote Ports and Segmentation Status. */
Name of define TBD!
#define SK_RLMT_MODE_CRPSS \
(SK_RLMT_CHECK_LINK | SK_RLMT_CHECK_LOC_LINK | \
SK_RLMT_CHECK_REM_LINK | SK_RLMT_CHECK_SEG)
#endif /* RLMT_CHECK_REMOTE */
/* ----- RLMT lookahead result bits ----- */
#define SK_RLMT_RX_RLMT 1 /* Give packet to RLMT. */
#define SK_RLMT_RX_PROTOCOL 2 /* Give packet to protocol. */
/* Macros */
#if 0
SK_AC *pAC /* adapter context */
SK_U32 PortNum /* receiving port */
unsigned PktLen /* received packet's length */
SK_BOOL IsBc /* Flag: packet is broadcast */
unsigned *pOffset /* offs. of bytes to present to SK_RLMT_LOOKAHEAD */
unsigned *pNumBytes /* #Bytes to present to SK_RLMT_LOOKAHEAD */
#endif /* 0 */
#define SK_RLMT_PRE_LOOKAHEAD(pAC,PortNum,PktLen,IsBc,pOffset,pNumBytes) { \
SK_AC *_pAC; \
SK_U32 _PortNum; \
_pAC = (pAC); \
_PortNum = (SK_U32)(PortNum); \
/* _pAC->Rlmt.Port[_PortNum].PacketsRx++; */ \
_pAC->Rlmt.Port[_PortNum].PacketsPerTimeSlot++; \
if (_pAC->Rlmt.RlmtOff) { \
*(pNumBytes) = 0; \
} \
else {\
if ((_pAC->Rlmt.Port[_PortNum].Net->RlmtMode & SK_RLMT_TRANSPARENT) != 0) { \
*(pNumBytes) = 0; \
} \
else if (IsBc) { \
if (_pAC->Rlmt.Port[_PortNum].Net->RlmtMode != SK_RLMT_MODE_CLS) { \
*(pNumBytes) = 6; \
*(pOffset) = 6; \
} \
else { \
*(pNumBytes) = 0; \
} \
} \
else { \
if ((PktLen) > SK_RLMT_MAX_TX_BUF_SIZE) { \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pNumBytes) = 0; \
} \
else { \
*(pNumBytes) = 6; \
*(pOffset) = 0; \
} \
} \
} \
}
#if 0
SK_AC *pAC /* adapter context */
SK_U32 PortNum /* receiving port */
SK_U8 *pLaPacket, /* received packet's data (points to pOffset) */
SK_BOOL IsBc /* Flag: packet is broadcast */
SK_BOOL IsMc /* Flag: packet is multicast */
unsigned *pForRlmt /* Result: bits SK_RLMT_RX_RLMT, SK_RLMT_RX_PROTOCOL */
SK_RLMT_LOOKAHEAD() expects *pNumBytes from
packet offset *pOffset (s.a.) at *pLaPacket.
If you use SK_RLMT_LOOKAHEAD in a path where you already know if the packet is
BC, MC, or UC, you should use constants for IsBc and IsMc, so that your compiler
can trash unneeded parts of the if construction.
#endif /* 0 */
#define SK_RLMT_LOOKAHEAD(pAC,PortNum,pLaPacket,IsBc,IsMc,pForRlmt) { \
SK_AC *_pAC; \
SK_U32 _PortNum; \
SK_U8 *_pLaPacket; \
_pAC = (pAC); \
_PortNum = (SK_U32)(PortNum); \
_pLaPacket = (SK_U8 *)(pLaPacket); \
if (IsBc) {\
if (!SK_ADDR_EQUAL(_pLaPacket, _pAC->Addr.Net[_pAC->Rlmt.Port[ \
_PortNum].Net->NetNumber].CurrentMacAddress.a)) { \
_pAC->Rlmt.Port[_PortNum].BcTimeStamp = SkOsGetTime(_pAC); \
_pAC->Rlmt.CheckSwitch = SK_TRUE; \
} \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
else if (IsMc) { \
if (SK_ADDR_EQUAL(_pLaPacket, BridgeMcAddr.a)) { \
_pAC->Rlmt.Port[_PortNum].BpduPacketsPerTimeSlot++; \
if (_pAC->Rlmt.Port[_PortNum].Net->RlmtMode & SK_RLMT_CHECK_SEG) { \
*(pForRlmt) = SK_RLMT_RX_RLMT | SK_RLMT_RX_PROTOCOL; \
} \
else { \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
} \
else if (SK_ADDR_EQUAL(_pLaPacket, SkRlmtMcAddr.a)) { \
*(pForRlmt) = SK_RLMT_RX_RLMT; \
} \
else { \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
} \
else { \
if (SK_ADDR_EQUAL( \
_pLaPacket, \
_pAC->Addr.Port[_PortNum].CurrentMacAddress.a)) { \
*(pForRlmt) = SK_RLMT_RX_RLMT; \
} \
else { \
/* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \
*(pForRlmt) = SK_RLMT_RX_PROTOCOL; \
} \
} \
}
#ifdef SK_RLMT_FAST_LOOKAHEAD
Error: SK_RLMT_FAST_LOOKAHEAD no longer used. Use new macros for lookahead.
#endif /* SK_RLMT_FAST_LOOKAHEAD */
#ifdef SK_RLMT_SLOW_LOOKAHEAD
Error: SK_RLMT_SLOW_LOOKAHEAD no longer used. Use new macros for lookahead.
#endif /* SK_RLMT_SLOW_LOOKAHEAD */
/* typedefs *******************************************************************/
#ifdef SK_RLMT_MBUF_PRIVATE
typedef struct s_RlmtMbuf {
some content
} SK_RLMT_MBUF;
#endif /* SK_RLMT_MBUF_PRIVATE */
#ifdef SK_LA_INFO
typedef struct s_Rlmt_PacketInfo {
unsigned PacketLength; /* Length of packet. */
unsigned PacketType; /* Directed/Multicast/Broadcast. */
} SK_RLMT_PINFO;
#endif /* SK_LA_INFO */
typedef struct s_RootId {
SK_U8 Id[8]; /* Root Bridge Id. */
} SK_RLMT_ROOT_ID;
typedef struct s_port {
SK_MAC_ADDR CheckAddr;
SK_BOOL SuspectTx;
} SK_PORT_CHECK;
typedef struct s_RlmtNet SK_RLMT_NET;
typedef struct s_RlmtPort {
/* ----- Public part (read-only) ----- */
SK_U8 PortState; /* Current state of this port. */
/* For PNMI */
SK_BOOL LinkDown;
SK_BOOL PortDown;
SK_U8 Align01;
SK_U32 PortNumber; /* Number of port on adapter. */
SK_RLMT_NET * Net; /* Net port belongs to. */
SK_U64 TxHelloCts;
SK_U64 RxHelloCts;
SK_U64 TxSpHelloReqCts;
SK_U64 RxSpHelloCts;
/* ----- Private part ----- */
/* SK_U64 PacketsRx; */ /* Total packets received. */
SK_U32 PacketsPerTimeSlot; /* Packets rxed between TOs. */
/* SK_U32 DataPacketsPerTimeSlot; */ /* Data packets ... */
SK_U32 BpduPacketsPerTimeSlot; /* BPDU packets rxed in TS. */
SK_U64 BcTimeStamp; /* Time of last BC receive. */
SK_U64 GuTimeStamp; /* Time of entering GOING_UP. */
SK_TIMER UpTimer; /* Timer struct Link/Port up. */
SK_TIMER DownRxTimer; /* Timer struct down rx. */
SK_TIMER DownTxTimer; /* Timer struct down tx. */
SK_U32 CheckingState; /* Checking State. */
SK_ADDR_PORT * AddrPort;
SK_U8 Random[4]; /* Random value. */
unsigned PortsChecked; /* #ports checked. */
unsigned PortsSuspect; /* #ports checked that are s. */
SK_PORT_CHECK PortCheck[1];
/* SK_PORT_CHECK PortCheck[SK_MAX_MACS - 1]; */
SK_BOOL PortStarted; /* Port is started. */
SK_BOOL PortNoRx; /* NoRx for >= 1 time slot. */
SK_BOOL RootIdSet;
SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */
} SK_RLMT_PORT;
struct s_RlmtNet {
/* ----- Public part (read-only) ----- */
SK_U32 NetNumber; /* Number of net. */
SK_RLMT_PORT * Port[SK_MAX_MACS]; /* Ports that belong to this net. */
SK_U32 NumPorts; /* Number of ports. */
SK_U32 PrefPort; /* Preferred port. */
/* For PNMI */
SK_U32 ChgBcPrio; /* Change Priority of last broadcast received */
SK_U32 RlmtMode; /* Check ... */
SK_U32 ActivePort; /* Active port. */
SK_U32 Preference; /* 0xFFFFFFFF: Automatic. */
SK_U8 RlmtState; /* Current RLMT state. */
/* ----- Private part ----- */
SK_BOOL RootIdSet;
SK_U16 Align01;
int LinksUp; /* #Links up. */
int PortsUp; /* #Ports up. */
SK_U32 TimeoutValue; /* RLMT timeout value. */
SK_U32 CheckingState; /* Checking State. */
SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */
SK_TIMER LocTimer; /* Timer struct. */
SK_TIMER SegTimer; /* Timer struct. */
};
typedef struct s_Rlmt {
/* ----- Public part (read-only) ----- */
SK_U32 NumNets; /* Number of nets. */
SK_U32 NetsStarted; /* Number of nets started. */
SK_RLMT_NET Net[SK_MAX_NETS]; /* Array of available nets. */
SK_RLMT_PORT Port[SK_MAX_MACS]; /* Array of available ports. */
/* ----- Private part ----- */
SK_BOOL CheckSwitch;
SK_BOOL RlmtOff; /* set to zero if the Mac addresses
are equal or the second one
is zero */
SK_U16 Align01;
} SK_RLMT;
extern SK_MAC_ADDR BridgeMcAddr;
extern SK_MAC_ADDR SkRlmtMcAddr;
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
/* Functions provided by SkRlmt */
/* ANSI/C++ compliant function prototypes */
extern void SkRlmtInit(
SK_AC *pAC,
SK_IOC IoC,
int Level);
extern int SkRlmtEvent(
SK_AC *pAC,
SK_IOC IoC,
SK_U32 Event,
SK_EVPARA Para);
#else /* defined(SK_KR_PROTO) */
/* Non-ANSI/C++ compliant function prototypes */
#error KR-style function prototypes are not yet provided.
#endif /* defined(SK_KR_PROTO)) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INC_SKRLMT_H */

View File

@ -0,0 +1,63 @@
/******************************************************************************
*
* Name: sktimer.h
* Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.11 $
* Date: $Date: 2003/09/16 12:58:18 $
* Purpose: Defines for the timer functions
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* SKTIMER.H contains all defines and types for the timer functions
*/
#ifndef _SKTIMER_H_
#define _SKTIMER_H_
#include "h/skqueue.h"
/*
* SK timer
* - needed wherever a timer is used. Put this in your data structure
* wherever you want.
*/
typedef struct s_Timer SK_TIMER;
struct s_Timer {
SK_TIMER *TmNext; /* linked list */
SK_U32 TmClass; /* Timer Event class */
SK_U32 TmEvent; /* Timer Event value */
SK_EVPARA TmPara; /* Timer Event parameter */
SK_U32 TmDelta; /* delta time */
int TmActive; /* flag: active/inactive */
};
/*
* Timer control struct.
* - use in Adapters context name pAC->Tim
*/
typedef struct s_TimCtrl {
SK_TIMER *StQueue; /* Head of Timer queue */
} SK_TIMCTRL;
extern void SkTimerInit(SK_AC *pAC, SK_IOC Ioc, int Level);
extern void SkTimerStop(SK_AC *pAC, SK_IOC Ioc, SK_TIMER *pTimer);
extern void SkTimerStart(SK_AC *pAC, SK_IOC Ioc, SK_TIMER *pTimer,
SK_U32 Time, SK_U32 Class, SK_U32 Event, SK_EVPARA Para);
extern void SkTimerDone(SK_AC *pAC, SK_IOC Ioc);
#endif /* _SKTIMER_H_ */

View File

@ -0,0 +1,69 @@
/******************************************************************************
*
* Name: sktypes.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.2 $
* Date: $Date: 2003/10/07 08:16:51 $
* Purpose: Define data types for Linux
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* In this file, all data types that are needed by the common modules
* are mapped to Linux data types.
*
*
* Include File Hierarchy:
*
*
******************************************************************************/
#ifndef __INC_SKTYPES_H
#define __INC_SKTYPES_H
/* defines *******************************************************************/
/*
* Data types with a specific size. 'I' = signed, 'U' = unsigned.
*/
#define SK_I8 s8
#define SK_U8 u8
#define SK_I16 s16
#define SK_U16 u16
#define SK_I32 s32
#define SK_U32 u32
#define SK_I64 s64
#define SK_U64 u64
#define SK_UPTR ulong /* casting pointer <-> integral */
/*
* Boolean type.
*/
#define SK_BOOL SK_U8
#define SK_FALSE 0
#define SK_TRUE (!SK_FALSE)
/* typedefs *******************************************************************/
/* function prototypes ********************************************************/
#endif /* __INC_SKTYPES_H */

View File

@ -0,0 +1,38 @@
/******************************************************************************
*
* Name: version.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.5 $
* Date: $Date: 2003/10/07 08:16:51 $
* Purpose: SK specific Error log support
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifdef lint
static const char SysKonnectFileId[] = "@(#) (C) SysKonnect GmbH.";
static const char SysKonnectBuildNumber[] =
"@(#)SK-BUILD: 6.23 PL: 01";
#endif /* !defined(lint) */
#define BOOT_STRING "sk98lin: Network Device Driver v6.23\n" \
"(C)Copyright 1999-2004 Marvell(R)."
#define VER_STRING "6.23"
#define DRIVER_FILE_NAME "sk98lin"
#define DRIVER_REL_DATE "Feb-13-2004"

View File

@ -0,0 +1,248 @@
/******************************************************************************
*
* Name: skvpd.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.15 $
* Date: $Date: 2003/01/13 10:39:38 $
* Purpose: Defines and Macros for VPD handling
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2003 SysKonnect GmbH.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* skvpd.h contains Diagnostic specific defines for VPD handling
*/
#ifndef __INC_SKVPD_H_
#define __INC_SKVPD_H_
/*
* Define Resource Type Identifiers and VPD keywords
*/
#define RES_ID 0x82 /* Resource Type ID String (Product Name) */
#define RES_VPD_R 0x90 /* start of VPD read only area */
#define RES_VPD_W 0x91 /* start of VPD read/write area */
#define RES_END 0x78 /* Resource Type End Tag */
#ifndef VPD_NAME
#define VPD_NAME "Name" /* Product Name, VPD name of RES_ID */
#endif /* VPD_NAME */
#define VPD_PN "PN" /* Adapter Part Number */
#define VPD_EC "EC" /* Adapter Engineering Level */
#define VPD_MN "MN" /* Manufacture ID */
#define VPD_SN "SN" /* Serial Number */
#define VPD_CP "CP" /* Extended Capability */
#define VPD_RV "RV" /* Checksum and Reserved */
#define VPD_YA "YA" /* Asset Tag Identifier */
#define VPD_VL "VL" /* First Error Log Message (SK specific) */
#define VPD_VF "VF" /* Second Error Log Message (SK specific) */
#define VPD_RW "RW" /* Remaining Read / Write Area */
/* 'type' values for vpd_setup_para() */
#define VPD_RO_KEY 1 /* RO keys are "PN", "EC", "MN", "SN", "RV" */
#define VPD_RW_KEY 2 /* RW keys are "Yx", "Vx", and "RW" */
/* 'op' values for vpd_setup_para() */
#define ADD_KEY 1 /* add the key at the pos "RV" or "RW" */
#define OWR_KEY 2 /* overwrite key if already exists */
/*
* Define READ and WRITE Constants.
*/
#define VPD_DEV_ID_GENESIS 0x4300
#define VPD_SIZE_YUKON 256
#define VPD_SIZE_GENESIS 512
#define VPD_SIZE 512
#define VPD_READ 0x0000
#define VPD_WRITE 0x8000
#define VPD_STOP(pAC,IoC) VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG,VPD_WRITE)
#define VPD_GET_RES_LEN(p) ((unsigned int) \
(* (SK_U8 *)&(p)[1]) |\
((* (SK_U8 *)&(p)[2]) << 8))
#define VPD_GET_VPD_LEN(p) ((unsigned int)(* (SK_U8 *)&(p)[2]))
#define VPD_GET_VAL(p) ((char *)&(p)[3])
#define VPD_MAX_LEN 50
/* VPD status */
/* bit 7..1 reserved */
#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */
/* and vpd_free_rw valid */
/*
* VPD structs
*/
typedef struct s_vpd_status {
unsigned short Align01; /* Alignment */
unsigned short vpd_status; /* VPD status, description see above */
int vpd_free_ro; /* unused bytes in read only area */
int vpd_free_rw; /* bytes available in read/write area */
} SK_VPD_STATUS;
typedef struct s_vpd {
SK_VPD_STATUS v; /* VPD status structure */
char vpd_buf[VPD_SIZE]; /* VPD buffer */
int rom_size; /* VPD ROM Size from PCI_OUR_REG_2 */
int vpd_size; /* saved VPD-size */
} SK_VPD;
typedef struct s_vpd_para {
unsigned int p_len; /* parameter length */
char *p_val; /* points to the value */
} SK_VPD_PARA;
/*
* structure of Large Resource Type Identifiers
*/
/* was removed because of alignment problems */
/*
* structure of VPD keywords
*/
typedef struct s_vpd_key {
char p_key[2]; /* 2 bytes ID string */
unsigned char p_len; /* 1 byte length */
char p_val; /* start of the value string */
} SK_VPD_KEY;
/*
* System specific VPD macros
*/
#ifndef SKDIAG
#ifndef VPD_DO_IO
#define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val)
#define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val)
#define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal)
#define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal)
#define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal)
#else /* VPD_DO_IO */
#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val)
#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val)
#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal)
#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal)
#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal)
#endif /* VPD_DO_IO */
#else /* SKDIAG */
#define VPD_OUT8(pAC,Ioc,Addr,Val) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciWriteCfgByte(pAC,Addr,Val); \
else \
SK_OUT8(pAC,PCI_C(Addr),Val); \
}
#define VPD_OUT16(pAC,Ioc,Addr,Val) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciWriteCfgWord(pAC,Addr,Val); \
else \
SK_OUT16(pAC,PCI_C(Addr),Val); \
}
#define VPD_IN8(pAC,Ioc,Addr,pVal) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciReadCfgByte(pAC,Addr,pVal); \
else \
SK_IN8(pAC,PCI_C(Addr),pVal); \
}
#define VPD_IN16(pAC,Ioc,Addr,pVal) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciReadCfgWord(pAC,Addr,pVal); \
else \
SK_IN16(pAC,PCI_C(Addr),pVal); \
}
#define VPD_IN32(pAC,Ioc,Addr,pVal) { \
if ((pAC)->DgT.DgUseCfgCycle) \
SkPciReadCfgDWord(pAC,Addr,pVal); \
else \
SK_IN32(pAC,PCI_C(Addr),pVal); \
}
#endif /* nSKDIAG */
/* function prototypes ********************************************************/
#ifndef SK_KR_PROTO
#ifdef SKDIAG
extern SK_U32 VpdReadDWord(
SK_AC *pAC,
SK_IOC IoC,
int addr);
#endif /* SKDIAG */
extern SK_VPD_STATUS *VpdStat(
SK_AC *pAC,
SK_IOC IoC);
extern int VpdKeys(
SK_AC *pAC,
SK_IOC IoC,
char *buf,
int *len,
int *elements);
extern int VpdRead(
SK_AC *pAC,
SK_IOC IoC,
const char *key,
char *buf,
int *len);
extern SK_BOOL VpdMayWrite(
char *key);
extern int VpdWrite(
SK_AC *pAC,
SK_IOC IoC,
const char *key,
const char *buf);
extern int VpdDelete(
SK_AC *pAC,
SK_IOC IoC,
char *key);
extern int VpdUpdate(
SK_AC *pAC,
SK_IOC IoC);
#ifdef SKDIAG
extern int VpdReadBlock(
SK_AC *pAC,
SK_IOC IoC,
char *buf,
int addr,
int len);
extern int VpdWriteBlock(
SK_AC *pAC,
SK_IOC IoC,
char *buf,
int addr,
int len);
#endif /* SKDIAG */
#else /* SK_KR_PROTO */
extern SK_U32 VpdReadDWord();
extern SK_VPD_STATUS *VpdStat();
extern int VpdKeys();
extern int VpdRead();
extern SK_BOOL VpdMayWrite();
extern int VpdWrite();
extern int VpdDelete();
extern int VpdUpdate();
#endif /* SK_KR_PROTO */
#endif /* __INC_SKVPD_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,742 @@
/******************************************************************************
*
* Name: skdim.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.5 $
* Date: $Date: 2003/11/28 12:55:40 $
* Purpose: All functions to maintain interrupt moderation
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/******************************************************************************
*
* Description:
*
* This module is intended to manage the dynamic interrupt moderation on both
* GEnesis and Yukon adapters.
*
* Include File Hierarchy:
*
* "skdrv1st.h"
* "skdrv2nd.h"
*
******************************************************************************/
#ifndef lint
static const char SysKonnectFileId[] =
"@(#) $Id: skdim.c,v 1.5 2003/11/28 12:55:40 rroesler Exp $ (C) SysKonnect.";
#endif
#define __SKADDR_C
#ifdef __cplusplus
#error C++ is not yet supported.
extern "C" {
#endif
/*******************************************************************************
**
** Includes
**
*******************************************************************************/
#ifndef __INC_SKDRV1ST_H
#include "h/skdrv1st.h"
#endif
#ifndef __INC_SKDRV2ND_H
#include "h/skdrv2nd.h"
#endif
#include <linux/kernel_stat.h>
/*******************************************************************************
**
** Defines
**
*******************************************************************************/
/*******************************************************************************
**
** Typedefs
**
*******************************************************************************/
/*******************************************************************************
**
** Local function prototypes
**
*******************************************************************************/
static unsigned int GetCurrentSystemLoad(SK_AC *pAC);
static SK_U64 GetIsrCalls(SK_AC *pAC);
static SK_BOOL IsIntModEnabled(SK_AC *pAC);
static void SetCurrIntCtr(SK_AC *pAC);
static void EnableIntMod(SK_AC *pAC);
static void DisableIntMod(SK_AC *pAC);
static void ResizeDimTimerDuration(SK_AC *pAC);
static void DisplaySelectedModerationType(SK_AC *pAC);
static void DisplaySelectedModerationMask(SK_AC *pAC);
static void DisplayDescrRatio(SK_AC *pAC);
/*******************************************************************************
**
** Global variables
**
*******************************************************************************/
/*******************************************************************************
**
** Local variables
**
*******************************************************************************/
/*******************************************************************************
**
** Global functions
**
*******************************************************************************/
/*******************************************************************************
** Function : SkDimModerate
** Description : Called in every ISR to check if moderation is to be applied
** or not for the current number of interrupts
** Programmer : Ralph Roesler
** Last Modified: 22-mar-03
** Returns : void (!)
** Notes : -
*******************************************************************************/
void
SkDimModerate(SK_AC *pAC) {
unsigned int CurrSysLoad = 0; /* expressed in percent */
unsigned int LoadIncrease = 0; /* expressed in percent */
SK_U64 ThresholdInts = 0;
SK_U64 IsrCallsPerSec = 0;
#define M_DIMINFO pAC->DynIrqModInfo
if (!IsIntModEnabled(pAC)) {
if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
CurrSysLoad = GetCurrentSystemLoad(pAC);
if (CurrSysLoad > 75) {
/*
** More than 75% total system load! Enable the moderation
** to shield the system against too many interrupts.
*/
EnableIntMod(pAC);
} else if (CurrSysLoad > M_DIMINFO.PrevSysLoad) {
LoadIncrease = (CurrSysLoad - M_DIMINFO.PrevSysLoad);
if (LoadIncrease > ((M_DIMINFO.PrevSysLoad *
C_INT_MOD_ENABLE_PERCENTAGE) / 100)) {
if (CurrSysLoad > 10) {
/*
** More than 50% increase with respect to the
** previous load of the system. Most likely this
** is due to our ISR-proc...
*/
EnableIntMod(pAC);
}
}
} else {
/*
** Neither too much system load at all nor too much increase
** with respect to the previous system load. Hence, we can leave
** the ISR-handling like it is without enabling moderation.
*/
}
M_DIMINFO.PrevSysLoad = CurrSysLoad;
}
} else {
if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
ThresholdInts = ((M_DIMINFO.MaxModIntsPerSec *
C_INT_MOD_DISABLE_PERCENTAGE) / 100);
IsrCallsPerSec = GetIsrCalls(pAC);
if (IsrCallsPerSec <= ThresholdInts) {
/*
** The number of interrupts within the last second is
** lower than the disable_percentage of the desried
** maxrate. Therefore we can disable the moderation.
*/
DisableIntMod(pAC);
M_DIMINFO.MaxModIntsPerSec =
(M_DIMINFO.MaxModIntsPerSecUpperLimit +
M_DIMINFO.MaxModIntsPerSecLowerLimit) / 2;
} else {
/*
** The number of interrupts per sec is the same as expected.
** Evalulate the descriptor-ratio. If it has changed, a resize
** in the moderation timer might be useful
*/
if (M_DIMINFO.AutoSizing) {
ResizeDimTimerDuration(pAC);
}
}
}
}
/*
** Some information to the log...
*/
if (M_DIMINFO.DisplayStats) {
DisplaySelectedModerationType(pAC);
DisplaySelectedModerationMask(pAC);
DisplayDescrRatio(pAC);
}
M_DIMINFO.NbrProcessedDescr = 0;
SetCurrIntCtr(pAC);
}
/*******************************************************************************
** Function : SkDimStartModerationTimer
** Description : Starts the audit-timer for the dynamic interrupt moderation
** Programmer : Ralph Roesler
** Last Modified: 22-mar-03
** Returns : void (!)
** Notes : -
*******************************************************************************/
void
SkDimStartModerationTimer(SK_AC *pAC) {
SK_EVPARA EventParam; /* Event struct for timer event */
SK_MEMSET((char *) &EventParam, 0, sizeof(EventParam));
EventParam.Para32[0] = SK_DRV_MODERATION_TIMER;
SkTimerStart(pAC, pAC->IoBase, &pAC->DynIrqModInfo.ModTimer,
SK_DRV_MODERATION_TIMER_LENGTH,
SKGE_DRV, SK_DRV_TIMER, EventParam);
}
/*******************************************************************************
** Function : SkDimEnableModerationIfNeeded
** Description : Either enables or disables moderation
** Programmer : Ralph Roesler
** Last Modified: 22-mar-03
** Returns : void (!)
** Notes : This function is called when a particular adapter is opened
** There is no Disable function, because when all interrupts
** might be disable, the moderation timer has no meaning at all
******************************************************************************/
void
SkDimEnableModerationIfNeeded(SK_AC *pAC) {
if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_STATIC) {
EnableIntMod(pAC); /* notification print in this function */
} else if (M_DIMINFO.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
SkDimStartModerationTimer(pAC);
if (M_DIMINFO.DisplayStats) {
printk("Dynamic moderation has been enabled\n");
}
} else {
if (M_DIMINFO.DisplayStats) {
printk("No moderation has been enabled\n");
}
}
}
/*******************************************************************************
** Function : SkDimDisplayModerationSettings
** Description : Displays the current settings regarding interrupt moderation
** Programmer : Ralph Roesler
** Last Modified: 22-mar-03
** Returns : void (!)
** Notes : -
*******************************************************************************/
void
SkDimDisplayModerationSettings(SK_AC *pAC) {
DisplaySelectedModerationType(pAC);
DisplaySelectedModerationMask(pAC);
}
/*******************************************************************************
**
** Local functions
**
*******************************************************************************/
/*******************************************************************************
** Function : GetCurrentSystemLoad
** Description : Retrieves the current system load of the system. This load
** is evaluated for all processors within the system.
** Programmer : Ralph Roesler
** Last Modified: 22-mar-03
** Returns : unsigned int: load expressed in percentage
** Notes : The possible range being returned is from 0 up to 100.
** Whereas 0 means 'no load at all' and 100 'system fully loaded'
** It is impossible to determine what actually causes the system
** to be in 100%, but maybe that is due to too much interrupts.
*******************************************************************************/
static unsigned int
GetCurrentSystemLoad(SK_AC *pAC) {
unsigned long jif = jiffies;
unsigned int UserTime = 0;
unsigned int SystemTime = 0;
unsigned int NiceTime = 0;
unsigned int IdleTime = 0;
unsigned int TotalTime = 0;
unsigned int UsedTime = 0;
unsigned int SystemLoad = 0;
/* unsigned int NbrCpu = 0; */
/*
** The following lines have been commented out, because
** from kernel 2.5.44 onwards, the kernel-owned structure
**
** struct kernel_stat kstat
**
** is not marked as an exported symbol in the file
**
** kernel/ksyms.c
**
** As a consequence, using this driver as KLM is not possible
** and any access of the structure kernel_stat via the
** dedicated macros kstat_cpu(i).cpustat.xxx is to be avoided.
**
** The kstat-information might be added again in future
** versions of the 2.5.xx kernel, but for the time being,
** number of interrupts will serve as indication how much
** load we currently have...
**
** for (NbrCpu = 0; NbrCpu < num_online_cpus(); NbrCpu++) {
** UserTime = UserTime + kstat_cpu(NbrCpu).cpustat.user;
** NiceTime = NiceTime + kstat_cpu(NbrCpu).cpustat.nice;
** SystemTime = SystemTime + kstat_cpu(NbrCpu).cpustat.system;
** }
*/
SK_U64 ThresholdInts = 0;
SK_U64 IsrCallsPerSec = 0;
ThresholdInts = ((M_DIMINFO.MaxModIntsPerSec *
C_INT_MOD_ENABLE_PERCENTAGE) + 100);
IsrCallsPerSec = GetIsrCalls(pAC);
if (IsrCallsPerSec >= ThresholdInts) {
/*
** We do not know how much the real CPU-load is!
** Return 80% as a default in order to activate DIM
*/
SystemLoad = 80;
return (SystemLoad);
}
UsedTime = UserTime + NiceTime + SystemTime;
IdleTime = jif * num_online_cpus() - UsedTime;
TotalTime = UsedTime + IdleTime;
SystemLoad = ( 100 * (UsedTime - M_DIMINFO.PrevUsedTime) ) /
(TotalTime - M_DIMINFO.PrevTotalTime);
if (M_DIMINFO.DisplayStats) {
printk("Current system load is: %u\n", SystemLoad);
}
M_DIMINFO.PrevTotalTime = TotalTime;
M_DIMINFO.PrevUsedTime = UsedTime;
return (SystemLoad);
}
/*******************************************************************************
** Function : GetIsrCalls
** Description : Depending on the selected moderation mask, this function will
** return the number of interrupts handled in the previous time-
** frame. This evaluated number is based on the current number
** of interrupts stored in PNMI-context and the previous stored
** interrupts.
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : int: the number of interrupts being executed in the last
** timeframe
** Notes : It makes only sense to call this function, when dynamic
** interrupt moderation is applied
*******************************************************************************/
static SK_U64
GetIsrCalls(SK_AC *pAC) {
SK_U64 RxPort0IntDiff = 0;
SK_U64 RxPort1IntDiff = 0;
SK_U64 TxPort0IntDiff = 0;
SK_U64 TxPort1IntDiff = 0;
if (pAC->DynIrqModInfo.MaskIrqModeration == IRQ_MASK_TX_ONLY) {
if (pAC->GIni.GIMacsFound == 2) {
TxPort1IntDiff = pAC->Pnmi.Port[1].TxIntrCts -
pAC->DynIrqModInfo.PrevPort1TxIntrCts;
}
TxPort0IntDiff = pAC->Pnmi.Port[0].TxIntrCts -
pAC->DynIrqModInfo.PrevPort0TxIntrCts;
} else if (pAC->DynIrqModInfo.MaskIrqModeration == IRQ_MASK_RX_ONLY) {
if (pAC->GIni.GIMacsFound == 2) {
RxPort1IntDiff = pAC->Pnmi.Port[1].RxIntrCts -
pAC->DynIrqModInfo.PrevPort1RxIntrCts;
}
RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
pAC->DynIrqModInfo.PrevPort0RxIntrCts;
} else {
if (pAC->GIni.GIMacsFound == 2) {
RxPort1IntDiff = pAC->Pnmi.Port[1].RxIntrCts -
pAC->DynIrqModInfo.PrevPort1RxIntrCts;
TxPort1IntDiff = pAC->Pnmi.Port[1].TxIntrCts -
pAC->DynIrqModInfo.PrevPort1TxIntrCts;
}
RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
pAC->DynIrqModInfo.PrevPort0RxIntrCts;
TxPort0IntDiff = pAC->Pnmi.Port[0].TxIntrCts -
pAC->DynIrqModInfo.PrevPort0TxIntrCts;
}
return (RxPort0IntDiff + RxPort1IntDiff + TxPort0IntDiff + TxPort1IntDiff);
}
/*******************************************************************************
** Function : GetRxCalls
** Description : This function will return the number of times a receive inter-
** rupt was processed. This is needed to evaluate any resizing
** factor.
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : SK_U64: the number of RX-ints being processed
** Notes : It makes only sense to call this function, when dynamic
** interrupt moderation is applied
*******************************************************************************/
static SK_U64
GetRxCalls(SK_AC *pAC) {
SK_U64 RxPort0IntDiff = 0;
SK_U64 RxPort1IntDiff = 0;
if (pAC->GIni.GIMacsFound == 2) {
RxPort1IntDiff = pAC->Pnmi.Port[1].RxIntrCts -
pAC->DynIrqModInfo.PrevPort1RxIntrCts;
}
RxPort0IntDiff = pAC->Pnmi.Port[0].RxIntrCts -
pAC->DynIrqModInfo.PrevPort0RxIntrCts;
return (RxPort0IntDiff + RxPort1IntDiff);
}
/*******************************************************************************
** Function : SetCurrIntCtr
** Description : Will store the current number orf occured interrupts in the
** adapter context. This is needed to evaluated the number of
** interrupts within a current timeframe.
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : void (!)
** Notes : -
*******************************************************************************/
static void
SetCurrIntCtr(SK_AC *pAC) {
if (pAC->GIni.GIMacsFound == 2) {
pAC->DynIrqModInfo.PrevPort1RxIntrCts = pAC->Pnmi.Port[1].RxIntrCts;
pAC->DynIrqModInfo.PrevPort1TxIntrCts = pAC->Pnmi.Port[1].TxIntrCts;
}
pAC->DynIrqModInfo.PrevPort0RxIntrCts = pAC->Pnmi.Port[0].RxIntrCts;
pAC->DynIrqModInfo.PrevPort0TxIntrCts = pAC->Pnmi.Port[0].TxIntrCts;
}
/*******************************************************************************
** Function : IsIntModEnabled()
** Description : Retrieves the current value of the interrupts moderation
** command register. Its content determines whether any
** moderation is running or not.
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : SK_TRUE : if mod timer running
** SK_FALSE : if no moderation is being performed
** Notes : -
*******************************************************************************/
static SK_BOOL
IsIntModEnabled(SK_AC *pAC) {
unsigned long CtrCmd;
SK_IN32(pAC->IoBase, B2_IRQM_CTRL, &CtrCmd);
if ((CtrCmd & TIM_START) == TIM_START) {
return SK_TRUE;
} else {
return SK_FALSE;
}
}
/*******************************************************************************
** Function : EnableIntMod()
** Description : Enables the interrupt moderation using the values stored in
** in the pAC->DynIntMod data structure
** Programmer : Ralph Roesler
** Last Modified: 22-mar-03
** Returns : -
** Notes : -
*******************************************************************************/
static void
EnableIntMod(SK_AC *pAC) {
unsigned long ModBase;
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
ModBase = C_CLK_FREQ_GENESIS / pAC->DynIrqModInfo.MaxModIntsPerSec;
} else {
ModBase = C_CLK_FREQ_YUKON / pAC->DynIrqModInfo.MaxModIntsPerSec;
}
SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase);
SK_OUT32(pAC->IoBase, B2_IRQM_MSK, pAC->DynIrqModInfo.MaskIrqModeration);
SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_START);
if (M_DIMINFO.DisplayStats) {
printk("Enabled interrupt moderation (%i ints/sec)\n",
M_DIMINFO.MaxModIntsPerSec);
}
}
/*******************************************************************************
** Function : DisableIntMod()
** Description : Disables the interrupt moderation independent of what inter-
** rupts are running or not
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : -
** Notes : -
*******************************************************************************/
static void
DisableIntMod(SK_AC *pAC) {
SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_STOP);
if (M_DIMINFO.DisplayStats) {
printk("Disabled interrupt moderation\n");
}
}
/*******************************************************************************
** Function : ResizeDimTimerDuration();
** Description : Checks the current used descriptor ratio and resizes the
** duration timer (longer/smaller) if possible.
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : -
** Notes : There are both maximum and minimum timer duration value.
** This function assumes that interrupt moderation is already
** enabled!
*******************************************************************************/
static void
ResizeDimTimerDuration(SK_AC *pAC) {
SK_BOOL IncreaseTimerDuration;
int TotalMaxNbrDescr;
int UsedDescrRatio;
int RatioDiffAbs;
int RatioDiffRel;
int NewMaxModIntsPerSec;
int ModAdjValue;
long ModBase;
/*
** Check first if we are allowed to perform any modification
*/
if (IsIntModEnabled(pAC)) {
if (M_DIMINFO.IntModTypeSelect != C_INT_MOD_DYNAMIC) {
return;
} else {
if (M_DIMINFO.ModJustEnabled) {
M_DIMINFO.ModJustEnabled = SK_FALSE;
return;
}
}
}
/*
** If we got until here, we have to evaluate the amount of the
** descriptor ratio change...
*/
TotalMaxNbrDescr = pAC->RxDescrPerRing * GetRxCalls(pAC);
UsedDescrRatio = (M_DIMINFO.NbrProcessedDescr * 100) / TotalMaxNbrDescr;
if (UsedDescrRatio > M_DIMINFO.PrevUsedDescrRatio) {
RatioDiffAbs = (UsedDescrRatio - M_DIMINFO.PrevUsedDescrRatio);
RatioDiffRel = (RatioDiffAbs * 100) / UsedDescrRatio;
M_DIMINFO.PrevUsedDescrRatio = UsedDescrRatio;
IncreaseTimerDuration = SK_FALSE; /* in other words: DECREASE */
} else if (UsedDescrRatio < M_DIMINFO.PrevUsedDescrRatio) {
RatioDiffAbs = (M_DIMINFO.PrevUsedDescrRatio - UsedDescrRatio);
RatioDiffRel = (RatioDiffAbs * 100) / M_DIMINFO.PrevUsedDescrRatio;
M_DIMINFO.PrevUsedDescrRatio = UsedDescrRatio;
IncreaseTimerDuration = SK_TRUE; /* in other words: INCREASE */
} else {
RatioDiffAbs = (M_DIMINFO.PrevUsedDescrRatio - UsedDescrRatio);
RatioDiffRel = (RatioDiffAbs * 100) / M_DIMINFO.PrevUsedDescrRatio;
M_DIMINFO.PrevUsedDescrRatio = UsedDescrRatio;
IncreaseTimerDuration = SK_TRUE; /* in other words: INCREASE */
}
/*
** Now we can determine the change in percent
*/
if ((RatioDiffRel >= 0) && (RatioDiffRel <= 5) ) {
ModAdjValue = 1; /* 1% change - maybe some other value in future */
} else if ((RatioDiffRel > 5) && (RatioDiffRel <= 10) ) {
ModAdjValue = 1; /* 1% change - maybe some other value in future */
} else if ((RatioDiffRel > 10) && (RatioDiffRel <= 15) ) {
ModAdjValue = 1; /* 1% change - maybe some other value in future */
} else {
ModAdjValue = 1; /* 1% change - maybe some other value in future */
}
if (IncreaseTimerDuration) {
NewMaxModIntsPerSec = M_DIMINFO.MaxModIntsPerSec +
(M_DIMINFO.MaxModIntsPerSec * ModAdjValue) / 100;
} else {
NewMaxModIntsPerSec = M_DIMINFO.MaxModIntsPerSec -
(M_DIMINFO.MaxModIntsPerSec * ModAdjValue) / 100;
}
/*
** Check if we exceed boundaries...
*/
if ( (NewMaxModIntsPerSec > M_DIMINFO.MaxModIntsPerSecUpperLimit) ||
(NewMaxModIntsPerSec < M_DIMINFO.MaxModIntsPerSecLowerLimit)) {
if (M_DIMINFO.DisplayStats) {
printk("Cannot change ModTim from %i to %i ints/sec\n",
M_DIMINFO.MaxModIntsPerSec, NewMaxModIntsPerSec);
}
return;
} else {
if (M_DIMINFO.DisplayStats) {
printk("Resized ModTim from %i to %i ints/sec\n",
M_DIMINFO.MaxModIntsPerSec, NewMaxModIntsPerSec);
}
}
M_DIMINFO.MaxModIntsPerSec = NewMaxModIntsPerSec;
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) {
ModBase = C_CLK_FREQ_GENESIS / pAC->DynIrqModInfo.MaxModIntsPerSec;
} else {
ModBase = C_CLK_FREQ_YUKON / pAC->DynIrqModInfo.MaxModIntsPerSec;
}
/*
** We do not need to touch any other registers
*/
SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase);
}
/*******************************************************************************
** Function : DisplaySelectedModerationType()
** Description : Displays what type of moderation we have
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : void!
** Notes : -
*******************************************************************************/
static void
DisplaySelectedModerationType(SK_AC *pAC) {
if (pAC->DynIrqModInfo.DisplayStats) {
if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC) {
printk("Static int moderation runs with %i INTS/sec\n",
pAC->DynIrqModInfo.MaxModIntsPerSec);
} else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC) {
if (IsIntModEnabled(pAC)) {
printk("Dynamic int moderation runs with %i INTS/sec\n",
pAC->DynIrqModInfo.MaxModIntsPerSec);
} else {
printk("Dynamic int moderation currently not applied\n");
}
} else {
printk("No interrupt moderation selected!\n");
}
}
}
/*******************************************************************************
** Function : DisplaySelectedModerationMask()
** Description : Displays what interrupts are moderated
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : void!
** Notes : -
*******************************************************************************/
static void
DisplaySelectedModerationMask(SK_AC *pAC) {
if (pAC->DynIrqModInfo.DisplayStats) {
if (pAC->DynIrqModInfo.IntModTypeSelect != C_INT_MOD_NONE) {
switch (pAC->DynIrqModInfo.MaskIrqModeration) {
case IRQ_MASK_TX_ONLY:
printk("Only Tx-interrupts are moderated\n");
break;
case IRQ_MASK_RX_ONLY:
printk("Only Rx-interrupts are moderated\n");
break;
case IRQ_MASK_SP_ONLY:
printk("Only special-interrupts are moderated\n");
break;
case IRQ_MASK_TX_RX:
printk("Tx- and Rx-interrupts are moderated\n");
break;
case IRQ_MASK_SP_RX:
printk("Special- and Rx-interrupts are moderated\n");
break;
case IRQ_MASK_SP_TX:
printk("Special- and Tx-interrupts are moderated\n");
break;
case IRQ_MASK_RX_TX_SP:
printk("All Rx-, Tx and special-interrupts are moderated\n");
break;
default:
printk("Don't know what is moderated\n");
break;
}
} else {
printk("No specific interrupts masked for moderation\n");
}
}
}
/*******************************************************************************
** Function : DisplayDescrRatio
** Description : Like the name states...
** Programmer : Ralph Roesler
** Last Modified: 23-mar-03
** Returns : void!
** Notes : -
*******************************************************************************/
static void
DisplayDescrRatio(SK_AC *pAC) {
int TotalMaxNbrDescr = 0;
if (pAC->DynIrqModInfo.DisplayStats) {
TotalMaxNbrDescr = pAC->RxDescrPerRing * GetRxCalls(pAC);
printk("Ratio descriptors: %i/%i\n",
M_DIMINFO.NbrProcessedDescr, TotalMaxNbrDescr);
}
}
/*******************************************************************************
**
** End of file
**
*******************************************************************************/

View File

@ -0,0 +1,627 @@
/******************************************************************************
*
* Name: skethtool.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
* Version: $Revision: 1.7 $
* Date: $Date: 2004/09/29 13:32:07 $
* Purpose: All functions regarding ethtool handling
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2004 Marvell.
*
* Driver for Marvell Yukon/2 chipset and SysKonnect Gigabit Ethernet
* Server Adapters.
*
* Author: Ralph Roesler (rroesler@syskonnect.de)
* Mirko Lindner (mlindner@syskonnect.de)
*
* Address all question to: linux@syskonnect.de
*
* The technical manual for the adapters is available from SysKonnect's
* web pages: www.syskonnect.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.
*
* The information in this file is provided "AS IS" without warranty.
*
*****************************************************************************/
#include "h/skdrv1st.h"
#include "h/skdrv2nd.h"
#include "h/skversion.h"
#include <linux/ethtool.h>
#include <linux/timer.h>
#include <linux/delay.h>
/******************************************************************************
*
* Defines
*
*****************************************************************************/
#define SUPP_COPPER_ALL (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | \
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \
SUPPORTED_1000baseT_Half| SUPPORTED_1000baseT_Full| \
SUPPORTED_TP)
#define ADV_COPPER_ALL (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | \
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | \
ADVERTISED_1000baseT_Half| ADVERTISED_1000baseT_Full| \
ADVERTISED_TP)
#define SUPP_FIBRE_ALL (SUPPORTED_1000baseT_Full | \
SUPPORTED_FIBRE | \
SUPPORTED_Autoneg)
#define ADV_FIBRE_ALL (ADVERTISED_1000baseT_Full | \
ADVERTISED_FIBRE | \
ADVERTISED_Autoneg)
/******************************************************************************
*
* Local Functions
*
*****************************************************************************/
/*****************************************************************************
*
* getSettings - retrieves the current settings of the selected adapter
*
* Description:
* The current configuration of the selected adapter is returned.
* This configuration involves a)speed, b)duplex and c)autoneg plus
* a number of other variables.
*
* Returns: always 0
*
*/
static int getSettings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
const DEV_NET *pNet = netdev_priv(dev);
int port = pNet->PortNr;
const SK_AC *pAC = pNet->pAC;
const SK_GEPORT *pPort = &pAC->GIni.GP[port];
static int DuplexAutoNegConfMap[9][3]= {
{ -1 , -1 , -1 },
{ 0 , -1 , -1 },
{ SK_LMODE_HALF , DUPLEX_HALF, AUTONEG_DISABLE },
{ SK_LMODE_FULL , DUPLEX_FULL, AUTONEG_DISABLE },
{ SK_LMODE_AUTOHALF , DUPLEX_HALF, AUTONEG_ENABLE },
{ SK_LMODE_AUTOFULL , DUPLEX_FULL, AUTONEG_ENABLE },
{ SK_LMODE_AUTOBOTH , DUPLEX_FULL, AUTONEG_ENABLE },
{ SK_LMODE_AUTOSENSE , -1 , -1 },
{ SK_LMODE_INDETERMINATED, -1 , -1 }
};
static int SpeedConfMap[6][2] = {
{ 0 , -1 },
{ SK_LSPEED_AUTO , -1 },
{ SK_LSPEED_10MBPS , SPEED_10 },
{ SK_LSPEED_100MBPS , SPEED_100 },
{ SK_LSPEED_1000MBPS , SPEED_1000 },
{ SK_LSPEED_INDETERMINATED, -1 }
};
static int AdvSpeedMap[6][2] = {
{ 0 , -1 },
{ SK_LSPEED_AUTO , -1 },
{ SK_LSPEED_10MBPS , ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full },
{ SK_LSPEED_100MBPS , ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full },
{ SK_LSPEED_1000MBPS , ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full},
{ SK_LSPEED_INDETERMINATED, -1 }
};
ecmd->phy_address = port;
ecmd->speed = SpeedConfMap[pPort->PLinkSpeedUsed][1];
ecmd->duplex = DuplexAutoNegConfMap[pPort->PLinkModeStatus][1];
ecmd->autoneg = DuplexAutoNegConfMap[pPort->PLinkModeStatus][2];
ecmd->transceiver = XCVR_INTERNAL;
if (pAC->GIni.GICopperType) {
ecmd->port = PORT_TP;
ecmd->supported = (SUPP_COPPER_ALL|SUPPORTED_Autoneg);
if (pAC->GIni.GIGenesis) {
ecmd->supported &= ~(SUPPORTED_10baseT_Half);
ecmd->supported &= ~(SUPPORTED_10baseT_Full);
ecmd->supported &= ~(SUPPORTED_100baseT_Half);
ecmd->supported &= ~(SUPPORTED_100baseT_Full);
} else {
if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
ecmd->supported &= ~(SUPPORTED_1000baseT_Half);
}
#ifdef CHIP_ID_YUKON_FE
if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) {
ecmd->supported &= ~(SUPPORTED_1000baseT_Half);
ecmd->supported &= ~(SUPPORTED_1000baseT_Full);
}
#endif
}
if (pAC->GIni.GP[0].PLinkSpeed != SK_LSPEED_AUTO) {
ecmd->advertising = AdvSpeedMap[pPort->PLinkSpeed][1];
if (pAC->GIni.GIChipId == CHIP_ID_YUKON) {
ecmd->advertising &= ~(SUPPORTED_1000baseT_Half);
}
} else {
ecmd->advertising = ecmd->supported;
}
if (ecmd->autoneg == AUTONEG_ENABLE)
ecmd->advertising |= ADVERTISED_Autoneg;
} else {
ecmd->port = PORT_FIBRE;
ecmd->supported = SUPP_FIBRE_ALL;
ecmd->advertising = ADV_FIBRE_ALL;
}
return 0;
}
/*
* MIB infrastructure uses instance value starting at 1
* based on board and port.
*/
static inline u32 pnmiInstance(const DEV_NET *pNet)
{
return 1 + (pNet->pAC->RlmtNets == 2) + pNet->PortNr;
}
/*****************************************************************************
*
* setSettings - configures the settings of a selected adapter
*
* Description:
* Possible settings that may be altered are a)speed, b)duplex or
* c)autonegotiation.
*
* Returns:
* 0: everything fine, no error
* <0: the return value is the error code of the failure
*/
static int setSettings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
u32 instance;
char buf[4];
int len = 1;
if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100
&& ecmd->speed != SPEED_1000)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
return -EINVAL;
if (ecmd->autoneg == AUTONEG_DISABLE)
*buf = (ecmd->duplex == DUPLEX_FULL)
? SK_LMODE_FULL : SK_LMODE_HALF;
else
*buf = (ecmd->duplex == DUPLEX_FULL)
? SK_LMODE_AUTOFULL : SK_LMODE_AUTOHALF;
instance = pnmiInstance(pNet);
if (SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_LINK_MODE,
&buf, &len, instance, pNet->NetNr) != SK_PNMI_ERR_OK)
return -EINVAL;
switch(ecmd->speed) {
case SPEED_1000:
*buf = SK_LSPEED_1000MBPS;
break;
case SPEED_100:
*buf = SK_LSPEED_100MBPS;
break;
case SPEED_10:
*buf = SK_LSPEED_10MBPS;
}
if (SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
&buf, &len, instance, pNet->NetNr) != SK_PNMI_ERR_OK)
return -EINVAL;
return 0;
}
/*****************************************************************************
*
* getDriverInfo - returns generic driver and adapter information
*
* Description:
* Generic driver information is returned via this function, such as
* the name of the driver, its version and and firmware version.
* In addition to this, the location of the selected adapter is
* returned as a bus info string (e.g. '01:05.0').
*
* Returns: N/A
*
*/
static void getDriverInfo(struct net_device *dev, struct ethtool_drvinfo *info)
{
const DEV_NET *pNet = netdev_priv(dev);
const SK_AC *pAC = pNet->pAC;
char vers[32];
snprintf(vers, sizeof(vers)-1, VER_STRING "(v%d.%d)",
(pAC->GIni.GIPciHwRev >> 4) & 0xf, pAC->GIni.GIPciHwRev & 0xf);
strlcpy(info->driver, DRIVER_FILE_NAME, sizeof(info->driver));
strcpy(info->version, vers);
strcpy(info->fw_version, "N/A");
strlcpy(info->bus_info, pci_name(pAC->PciDev), ETHTOOL_BUSINFO_LEN);
}
/*
* Ethtool statistics support.
*/
static const char StringsStats[][ETH_GSTRING_LEN] = {
"rx_packets", "tx_packets",
"rx_bytes", "tx_bytes",
"rx_errors", "tx_errors",
"rx_dropped", "tx_dropped",
"multicasts", "collisions",
"rx_length_errors", "rx_buffer_overflow_errors",
"rx_crc_errors", "rx_frame_errors",
"rx_too_short_errors", "rx_too_long_errors",
"rx_carrier_extension_errors", "rx_symbol_errors",
"rx_llc_mac_size_errors", "rx_carrier_errors",
"rx_jabber_errors", "rx_missed_errors",
"tx_abort_collision_errors", "tx_carrier_errors",
"tx_buffer_underrun_errors", "tx_heartbeat_errors",
"tx_window_errors",
};
static int getStatsCount(struct net_device *dev)
{
return ARRAY_SIZE(StringsStats);
}
static void getStrings(struct net_device *dev, u32 stringset, u8 *data)
{
switch(stringset) {
case ETH_SS_STATS:
memcpy(data, *StringsStats, sizeof(StringsStats));
break;
}
}
static void getEthtoolStats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
const DEV_NET *pNet = netdev_priv(dev);
const SK_AC *pAC = pNet->pAC;
const SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct;
*data++ = pPnmiStruct->Stat[0].StatRxOkCts;
*data++ = pPnmiStruct->Stat[0].StatTxOkCts;
*data++ = pPnmiStruct->Stat[0].StatRxOctetsOkCts;
*data++ = pPnmiStruct->Stat[0].StatTxOctetsOkCts;
*data++ = pPnmiStruct->InErrorsCts;
*data++ = pPnmiStruct->Stat[0].StatTxSingleCollisionCts;
*data++ = pPnmiStruct->RxNoBufCts;
*data++ = pPnmiStruct->TxNoBufCts;
*data++ = pPnmiStruct->Stat[0].StatRxMulticastOkCts;
*data++ = pPnmiStruct->Stat[0].StatTxSingleCollisionCts;
*data++ = pPnmiStruct->Stat[0].StatRxRuntCts;
*data++ = pPnmiStruct->Stat[0].StatRxFifoOverflowCts;
*data++ = pPnmiStruct->Stat[0].StatRxFcsCts;
*data++ = pPnmiStruct->Stat[0].StatRxFramingCts;
*data++ = pPnmiStruct->Stat[0].StatRxShortsCts;
*data++ = pPnmiStruct->Stat[0].StatRxTooLongCts;
*data++ = pPnmiStruct->Stat[0].StatRxCextCts;
*data++ = pPnmiStruct->Stat[0].StatRxSymbolCts;
*data++ = pPnmiStruct->Stat[0].StatRxIRLengthCts;
*data++ = pPnmiStruct->Stat[0].StatRxCarrierCts;
*data++ = pPnmiStruct->Stat[0].StatRxJabberCts;
*data++ = pPnmiStruct->Stat[0].StatRxMissedCts;
*data++ = pAC->stats.tx_aborted_errors;
*data++ = pPnmiStruct->Stat[0].StatTxCarrierCts;
*data++ = pPnmiStruct->Stat[0].StatTxFifoUnderrunCts;
*data++ = pPnmiStruct->Stat[0].StatTxCarrierCts;
*data++ = pAC->stats.tx_window_errors;
}
/*****************************************************************************
*
* toggleLeds - Changes the LED state of an adapter
*
* Description:
* This function changes the current state of all LEDs of an adapter so
* that it can be located by a user.
*
* Returns: N/A
*
*/
static void toggleLeds(DEV_NET *pNet, int on)
{
SK_AC *pAC = pNet->pAC;
int port = pNet->PortNr;
void __iomem *io = pAC->IoBase;
if (pAC->GIni.GIGenesis) {
SK_OUT8(io, MR_ADDR(port,LNK_LED_REG),
on ? SK_LNK_ON : SK_LNK_OFF);
SkGeYellowLED(pAC, io,
on ? (LED_ON >> 1) : (LED_OFF >> 1));
SkGeXmitLED(pAC, io, MR_ADDR(port,RX_LED_INI),
on ? SK_LED_TST : SK_LED_DIS);
if (pAC->GIni.GP[port].PhyType == SK_PHY_BCOM)
SkXmPhyWrite(pAC, io, port, PHY_BCOM_P_EXT_CTRL,
on ? PHY_B_PEC_LED_ON : PHY_B_PEC_LED_OFF);
else if (pAC->GIni.GP[port].PhyType == SK_PHY_LONE)
SkXmPhyWrite(pAC, io, port, PHY_LONE_LED_CFG,
on ? 0x0800 : PHY_L_LC_LEDT);
else
SkGeXmitLED(pAC, io, MR_ADDR(port,TX_LED_INI),
on ? SK_LED_TST : SK_LED_DIS);
} else {
const u16 YukLedOn = (PHY_M_LED_MO_DUP(MO_LED_ON) |
PHY_M_LED_MO_10(MO_LED_ON) |
PHY_M_LED_MO_100(MO_LED_ON) |
PHY_M_LED_MO_1000(MO_LED_ON) |
PHY_M_LED_MO_RX(MO_LED_ON));
const u16 YukLedOff = (PHY_M_LED_MO_DUP(MO_LED_OFF) |
PHY_M_LED_MO_10(MO_LED_OFF) |
PHY_M_LED_MO_100(MO_LED_OFF) |
PHY_M_LED_MO_1000(MO_LED_OFF) |
PHY_M_LED_MO_RX(MO_LED_OFF));
SkGmPhyWrite(pAC,io,port,PHY_MARV_LED_CTRL,0);
SkGmPhyWrite(pAC,io,port,PHY_MARV_LED_OVER,
on ? YukLedOn : YukLedOff);
}
}
/*****************************************************************************
*
* skGeBlinkTimer - Changes the LED state of an adapter
*
* Description:
* This function changes the current state of all LEDs of an adapter so
* that it can be located by a user. If the requested time interval for
* this test has elapsed, this function cleans up everything that was
* temporarily setup during the locate NIC test. This involves of course
* also closing or opening any adapter so that the initial board state
* is recovered.
*
* Returns: N/A
*
*/
void SkGeBlinkTimer(unsigned long data)
{
struct net_device *dev = (struct net_device *) data;
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
toggleLeds(pNet, pAC->LedsOn);
pAC->LedsOn = !pAC->LedsOn;
mod_timer(&pAC->BlinkTimer, jiffies + HZ/4);
}
/*****************************************************************************
*
* locateDevice - start the locate NIC feature of the elected adapter
*
* Description:
* This function is used if the user want to locate a particular NIC.
* All LEDs are regularly switched on and off, so the NIC can easily
* be identified.
*
* Returns:
* ==0: everything fine, no error, locateNIC test was started
* !=0: one locateNIC test runs already
*
*/
static int locateDevice(struct net_device *dev, u32 data)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
/* start blinking */
pAC->LedsOn = 0;
mod_timer(&pAC->BlinkTimer, jiffies);
msleep_interruptible(data * 1000);
del_timer_sync(&pAC->BlinkTimer);
toggleLeds(pNet, 0);
return 0;
}
/*****************************************************************************
*
* getPauseParams - retrieves the pause parameters
*
* Description:
* All current pause parameters of a selected adapter are placed
* in the passed ethtool_pauseparam structure and are returned.
*
* Returns: N/A
*
*/
static void getPauseParams(struct net_device *dev, struct ethtool_pauseparam *epause)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
SK_GEPORT *pPort = &pAC->GIni.GP[pNet->PortNr];
epause->rx_pause = (pPort->PFlowCtrlMode == SK_FLOW_MODE_SYMMETRIC) ||
(pPort->PFlowCtrlMode == SK_FLOW_MODE_SYM_OR_REM);
epause->tx_pause = epause->rx_pause || (pPort->PFlowCtrlMode == SK_FLOW_MODE_LOC_SEND);
epause->autoneg = epause->rx_pause || epause->tx_pause;
}
/*****************************************************************************
*
* setPauseParams - configures the pause parameters of an adapter
*
* Description:
* This function sets the Rx or Tx pause parameters
*
* Returns:
* ==0: everything fine, no error
* !=0: the return value is the error code of the failure
*/
static int setPauseParams(struct net_device *dev , struct ethtool_pauseparam *epause)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
SK_GEPORT *pPort = &pAC->GIni.GP[pNet->PortNr];
u32 instance = pnmiInstance(pNet);
struct ethtool_pauseparam old;
u8 oldspeed = pPort->PLinkSpeedUsed;
char buf[4];
int len = 1;
int ret;
/*
** we have to determine the current settings to see if
** the operator requested any modification of the flow
** control parameters...
*/
getPauseParams(dev, &old);
/*
** perform modifications regarding the changes
** requested by the operator
*/
if (epause->autoneg != old.autoneg)
*buf = epause->autoneg ? SK_FLOW_MODE_NONE : SK_FLOW_MODE_SYMMETRIC;
else {
if (epause->rx_pause && epause->tx_pause)
*buf = SK_FLOW_MODE_SYMMETRIC;
else if (epause->rx_pause && !epause->tx_pause)
*buf = SK_FLOW_MODE_SYM_OR_REM;
else if (!epause->rx_pause && epause->tx_pause)
*buf = SK_FLOW_MODE_LOC_SEND;
else
*buf = SK_FLOW_MODE_NONE;
}
ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_FLOWCTRL_MODE,
&buf, &len, instance, pNet->NetNr);
if (ret != SK_PNMI_ERR_OK) {
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_CTRL,
("ethtool (sk98lin): error changing rx/tx pause (%i)\n", ret));
goto err;
}
/*
** It may be that autoneg has been disabled! Therefore
** set the speed to the previously used value...
*/
if (!epause->autoneg) {
len = 1;
ret = SkPnmiSetVar(pAC, pAC->IoBase, OID_SKGE_SPEED_MODE,
&oldspeed, &len, instance, pNet->NetNr);
if (ret != SK_PNMI_ERR_OK)
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_CTRL,
("ethtool (sk98lin): error setting speed (%i)\n", ret));
}
err:
return ret ? -EIO : 0;
}
/* Only Yukon supports checksum offload. */
static int setScatterGather(struct net_device *dev, u32 data)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
return -EOPNOTSUPP;
return ethtool_op_set_sg(dev, data);
}
static int setTxCsum(struct net_device *dev, u32 data)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
return -EOPNOTSUPP;
return ethtool_op_set_tx_csum(dev, data);
}
static u32 getRxCsum(struct net_device *dev)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
return pAC->RxPort[pNet->PortNr].RxCsum;
}
static int setRxCsum(struct net_device *dev, u32 data)
{
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
return -EOPNOTSUPP;
pAC->RxPort[pNet->PortNr].RxCsum = data != 0;
return 0;
}
static int getRegsLen(struct net_device *dev)
{
return 0x4000;
}
/*
* Returns copy of whole control register region
* Note: skip RAM address register because accessing it will
* cause bus hangs!
*/
static void getRegs(struct net_device *dev, struct ethtool_regs *regs,
void *p)
{
DEV_NET *pNet = netdev_priv(dev);
const void __iomem *io = pNet->pAC->IoBase;
regs->version = 1;
memset(p, 0, regs->len);
memcpy_fromio(p, io, B3_RAM_ADDR);
memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1,
regs->len - B3_RI_WTO_R1);
}
const struct ethtool_ops SkGeEthtoolOps = {
.get_settings = getSettings,
.set_settings = setSettings,
.get_drvinfo = getDriverInfo,
.get_strings = getStrings,
.get_stats_count = getStatsCount,
.get_ethtool_stats = getEthtoolStats,
.phys_id = locateDevice,
.get_pauseparam = getPauseParams,
.set_pauseparam = setPauseParams,
.get_link = ethtool_op_get_link,
.get_sg = ethtool_op_get_sg,
.set_sg = setScatterGather,
.get_tx_csum = ethtool_op_get_tx_csum,
.set_tx_csum = setTxCsum,
.get_rx_csum = getRxCsum,
.set_rx_csum = setRxCsum,
.get_regs = getRegs,
.get_regs_len = getRegsLen,
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,171 @@
/******************************************************************************
*
* Name: skgehwt.c
* Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.15 $
* Date: $Date: 2003/09/16 13:41:23 $
* Purpose: Hardware Timer
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* Event queue and dispatcher
*/
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] =
"@(#) $Id: skgehwt.c,v 1.15 2003/09/16 13:41:23 rschmidt Exp $ (C) Marvell.";
#endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef __C2MAN__
/*
* Hardware Timer function queue management.
*/
intro()
{}
#endif
/*
* Prototypes of local functions.
*/
#define SK_HWT_MAX (65000)
/* correction factor */
#define SK_HWT_FAC (1000 * (SK_U32)pAC->GIni.GIHstClkFact / 100)
/*
* Initialize hardware timer.
*
* Must be called during init level 1.
*/
void SkHwtInit(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
pAC->Hwt.TStart = 0 ;
pAC->Hwt.TStop = 0 ;
pAC->Hwt.TActive = SK_FALSE;
SkHwtStop(pAC, Ioc);
}
/*
*
* Start hardware timer (clock ticks are 16us).
*
*/
void SkHwtStart(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
SK_U32 Time) /* Time in units of 16us to load the timer with. */
{
SK_U32 Cnt;
if (Time > SK_HWT_MAX)
Time = SK_HWT_MAX;
pAC->Hwt.TStart = Time;
pAC->Hwt.TStop = 0L;
Cnt = Time;
/*
* if time < 16 us
* time = 16 us
*/
if (!Cnt) {
Cnt++;
}
SK_OUT32(Ioc, B2_TI_INI, Cnt * SK_HWT_FAC);
SK_OUT16(Ioc, B2_TI_CTRL, TIM_START); /* Start timer. */
pAC->Hwt.TActive = SK_TRUE;
}
/*
* Stop hardware timer.
* and clear the timer IRQ
*/
void SkHwtStop(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
SK_OUT16(Ioc, B2_TI_CTRL, TIM_STOP);
SK_OUT16(Ioc, B2_TI_CTRL, TIM_CLR_IRQ);
pAC->Hwt.TActive = SK_FALSE;
}
/*
* Stop hardware timer and read time elapsed since last start.
*
* returns
* The elapsed time since last start in units of 16us.
*
*/
SK_U32 SkHwtRead(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
SK_U32 TRead;
SK_U32 IStatus;
if (pAC->Hwt.TActive) {
SkHwtStop(pAC, Ioc);
SK_IN32(Ioc, B2_TI_VAL, &TRead);
TRead /= SK_HWT_FAC;
SK_IN32(Ioc, B0_ISRC, &IStatus);
/* Check if timer expired (or wraped around) */
if ((TRead > pAC->Hwt.TStart) || (IStatus & IS_TIMINT)) {
SkHwtStop(pAC, Ioc);
pAC->Hwt.TStop = pAC->Hwt.TStart;
}
else {
pAC->Hwt.TStop = pAC->Hwt.TStart - TRead;
}
}
return(pAC->Hwt.TStop);
}
/*
* interrupt source= timer
*/
void SkHwtIsr(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
SkHwtStop(pAC, Ioc);
pAC->Hwt.TStop = pAC->Hwt.TStart;
SkTimerDone(pAC, Ioc);
}
/* End of file */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,141 @@
/******************************************************************************
*
* Name: sklm80.c
* Project: Gigabit Ethernet Adapters, TWSI-Module
* Version: $Revision: 1.22 $
* Date: $Date: 2003/10/20 09:08:21 $
* Purpose: Functions to access Voltage and Temperature Sensor (LM80)
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
LM80 functions
*/
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] =
"@(#) $Id: sklm80.c,v 1.22 2003/10/20 09:08:21 rschmidt Exp $ (C) Marvell. ";
#endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/lm80.h"
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#define BREAK_OR_WAIT(pAC,IoC,Event) break
/*
* read a sensors value (LM80 specific)
*
* This function reads a sensors value from the I2C sensor chip LM80.
* The sensor is defined by its index into the sensors database in the struct
* pAC points to.
*
* Returns 1 if the read is completed
* 0 if the read must be continued (I2C Bus still allocated)
*/
int SkLm80ReadSensor(
SK_AC *pAC, /* Adapter Context */
SK_IOC IoC, /* I/O Context needed in level 1 and 2 */
SK_SENSOR *pSen) /* Sensor to be read */
{
SK_I32 Value;
switch (pSen->SenState) {
case SK_SEN_IDLE:
/* Send address to ADDR register */
SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, I2C_025K_DEV, pSen->SenReg, 0);
pSen->SenState = SK_SEN_VALUE ;
BREAK_OR_WAIT(pAC, IoC, I2C_READ);
case SK_SEN_VALUE:
/* Read value from data register */
SK_IN32(IoC, B2_I2C_DATA, ((SK_U32 *)&Value));
Value &= 0xff; /* only least significant byte is valid */
/* Do NOT check the Value against the thresholds */
/* Checking is done in the calling instance */
if (pSen->SenType == SK_SEN_VOLT) {
/* Voltage sensor */
pSen->SenValue = Value * SK_LM80_VT_LSB;
pSen->SenState = SK_SEN_IDLE ;
return(1);
}
if (pSen->SenType == SK_SEN_FAN) {
if (Value != 0 && Value != 0xff) {
/* Fan speed counter */
pSen->SenValue = SK_LM80_FAN_FAKTOR/Value;
}
else {
/* Indicate Fan error */
pSen->SenValue = 0;
}
pSen->SenState = SK_SEN_IDLE ;
return(1);
}
/* First: correct the value: it might be negative */
if ((Value & 0x80) != 0) {
/* Value is negative */
Value = Value - 256;
}
/* We have a temperature sensor and need to get the signed extension.
* For now we get the extension from the last reading, so in the normal
* case we won't see flickering temperatures.
*/
pSen->SenValue = (Value * SK_LM80_TEMP_LSB) +
(pSen->SenValue % SK_LM80_TEMP_LSB);
/* Send address to ADDR register */
SK_I2C_CTL(IoC, I2C_READ, pSen->SenDev, I2C_025K_DEV, LM80_TEMP_CTRL, 0);
pSen->SenState = SK_SEN_VALEXT ;
BREAK_OR_WAIT(pAC, IoC, I2C_READ);
case SK_SEN_VALEXT:
/* Read value from data register */
SK_IN32(IoC, B2_I2C_DATA, ((SK_U32 *)&Value));
Value &= LM80_TEMP_LSB_9; /* only bit 7 is valid */
/* cut the LSB bit */
pSen->SenValue = ((pSen->SenValue / SK_LM80_TEMP_LSB) *
SK_LM80_TEMP_LSB);
if (pSen->SenValue < 0) {
/* Value negative: The bit value must be subtracted */
pSen->SenValue -= ((Value >> 7) * SK_LM80_TEMPEXT_LSB);
}
else {
/* Value positive: The bit value must be added */
pSen->SenValue += ((Value >> 7) * SK_LM80_TEMPEXT_LSB);
}
pSen->SenState = SK_SEN_IDLE ;
return(1);
default:
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E007, SKERR_I2C_E007MSG);
return(1);
}
/* Not completed */
return(0);
}

View File

@ -0,0 +1,179 @@
/******************************************************************************
*
* Name: skqueue.c
* Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.20 $
* Date: $Date: 2003/09/16 13:44:00 $
* Purpose: Management of an event queue.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* Event queue and dispatcher
*/
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] =
"@(#) $Id: skqueue.c,v 1.20 2003/09/16 13:44:00 rschmidt Exp $ (C) Marvell.";
#endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/skqueue.h" /* Queue Definitions */
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef __C2MAN__
/*
Event queue management.
General Description:
*/
intro()
{}
#endif
#define PRINTF(a,b,c)
/*
* init event queue management
*
* Must be called during init level 0.
*/
void SkEventInit(
SK_AC *pAC, /* Adapter context */
SK_IOC Ioc, /* IO context */
int Level) /* Init level */
{
switch (Level) {
case SK_INIT_DATA:
pAC->Event.EvPut = pAC->Event.EvGet = pAC->Event.EvQueue;
break;
default:
break;
}
}
/*
* add event to queue
*/
void SkEventQueue(
SK_AC *pAC, /* Adapters context */
SK_U32 Class, /* Event Class */
SK_U32 Event, /* Event to be queued */
SK_EVPARA Para) /* Event parameter */
{
pAC->Event.EvPut->Class = Class;
pAC->Event.EvPut->Event = Event;
pAC->Event.EvPut->Para = Para;
if (++pAC->Event.EvPut == &pAC->Event.EvQueue[SK_MAX_EVENT])
pAC->Event.EvPut = pAC->Event.EvQueue;
if (pAC->Event.EvPut == pAC->Event.EvGet) {
SK_ERR_LOG(pAC, SK_ERRCL_NORES, SKERR_Q_E001, SKERR_Q_E001MSG);
}
}
/*
* event dispatcher
* while event queue is not empty
* get event from queue
* send command to state machine
* end
* return error reported by individual Event function
* 0 if no error occured.
*/
int SkEventDispatcher(
SK_AC *pAC, /* Adapters Context */
SK_IOC Ioc) /* Io context */
{
SK_EVENTELEM *pEv; /* pointer into queue */
SK_U32 Class;
int Rtv;
pEv = pAC->Event.EvGet;
PRINTF("dispatch get %x put %x\n", pEv, pAC->Event.ev_put);
while (pEv != pAC->Event.EvPut) {
PRINTF("dispatch Class %d Event %d\n", pEv->Class, pEv->Event);
switch (Class = pEv->Class) {
#ifndef SK_USE_LAC_EV
#ifndef SK_SLIM
case SKGE_RLMT: /* RLMT Event */
Rtv = SkRlmtEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
case SKGE_I2C: /* I2C Event */
Rtv = SkI2cEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
case SKGE_PNMI: /* PNMI Event */
Rtv = SkPnmiEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
#endif /* not SK_SLIM */
#endif /* not SK_USE_LAC_EV */
case SKGE_DRV: /* Driver Event */
Rtv = SkDrvEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
#ifndef SK_USE_SW_TIMER
case SKGE_HWAC:
Rtv = SkGeSirqEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
#else /* !SK_USE_SW_TIMER */
case SKGE_SWT :
Rtv = SkSwtEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
#endif /* !SK_USE_SW_TIMER */
#ifdef SK_USE_LAC_EV
case SKGE_LACP :
Rtv = SkLacpEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
case SKGE_RSF :
Rtv = SkRsfEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
case SKGE_MARKER :
Rtv = SkMarkerEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
case SKGE_FD :
Rtv = SkFdEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
#endif /* SK_USE_LAC_EV */
#ifdef SK_USE_CSUM
case SKGE_CSUM :
Rtv = SkCsEvent(pAC, Ioc, pEv->Event, pEv->Para);
break;
#endif /* SK_USE_CSUM */
default :
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_Q_E002, SKERR_Q_E002MSG);
Rtv = 0;
}
if (Rtv != 0) {
return(Rtv);
}
if (++pEv == &pAC->Event.EvQueue[SK_MAX_EVENT])
pEv = pAC->Event.EvQueue;
/* Renew get: it is used in queue_events to detect overruns */
pAC->Event.EvGet = pEv;
}
return(0);
}
/* End of file */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,250 @@
/******************************************************************************
*
* Name: sktimer.c
* Project: Gigabit Ethernet Adapters, Event Scheduler Module
* Version: $Revision: 1.14 $
* Date: $Date: 2003/09/16 13:46:51 $
* Purpose: High level timer functions.
*
******************************************************************************/
/******************************************************************************
*
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2003 Marvell.
*
* 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.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
/*
* Event queue and dispatcher
*/
#if (defined(DEBUG) || ((!defined(LINT)) && (!defined(SK_SLIM))))
static const char SysKonnectFileId[] =
"@(#) $Id: sktimer.c,v 1.14 2003/09/16 13:46:51 rschmidt Exp $ (C) Marvell.";
#endif
#include "h/skdrv1st.h" /* Driver Specific Definitions */
#include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */
#ifdef __C2MAN__
/*
Event queue management.
General Description:
*/
intro()
{}
#endif
/* Forward declaration */
static void timer_done(SK_AC *pAC,SK_IOC Ioc,int Restart);
/*
* Inits the software timer
*
* needs to be called during Init level 1.
*/
void SkTimerInit(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
int Level) /* Init Level */
{
switch (Level) {
case SK_INIT_DATA:
pAC->Tim.StQueue = NULL;
break;
case SK_INIT_IO:
SkHwtInit(pAC, Ioc);
SkTimerDone(pAC, Ioc);
break;
default:
break;
}
}
/*
* Stops a high level timer
* - If a timer is not in the queue the function returns normally, too.
*/
void SkTimerStop(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
SK_TIMER *pTimer) /* Timer Pointer to be started */
{
SK_TIMER **ppTimPrev;
SK_TIMER *pTm;
/*
* remove timer from queue
*/
pTimer->TmActive = SK_FALSE;
if (pAC->Tim.StQueue == pTimer && !pTimer->TmNext) {
SkHwtStop(pAC, Ioc);
}
for (ppTimPrev = &pAC->Tim.StQueue; (pTm = *ppTimPrev);
ppTimPrev = &pTm->TmNext ) {
if (pTm == pTimer) {
/*
* Timer found in queue
* - dequeue it and
* - correct delta of the next timer
*/
*ppTimPrev = pTm->TmNext;
if (pTm->TmNext) {
/* correct delta of next timer in queue */
pTm->TmNext->TmDelta += pTm->TmDelta;
}
return;
}
}
}
/*
* Start a high level software timer
*/
void SkTimerStart(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
SK_TIMER *pTimer, /* Timer Pointer to be started */
SK_U32 Time, /* Time value */
SK_U32 Class, /* Event Class for this timer */
SK_U32 Event, /* Event Value for this timer */
SK_EVPARA Para) /* Event Parameter for this timer */
{
SK_TIMER **ppTimPrev;
SK_TIMER *pTm;
SK_U32 Delta;
Time /= 16; /* input is uS, clock ticks are 16uS */
if (!Time)
Time = 1;
SkTimerStop(pAC, Ioc, pTimer);
pTimer->TmClass = Class;
pTimer->TmEvent = Event;
pTimer->TmPara = Para;
pTimer->TmActive = SK_TRUE;
if (!pAC->Tim.StQueue) {
/* First Timer to be started */
pAC->Tim.StQueue = pTimer;
pTimer->TmNext = NULL;
pTimer->TmDelta = Time;
SkHwtStart(pAC, Ioc, Time);
return;
}
/*
* timer correction
*/
timer_done(pAC, Ioc, 0);
/*
* find position in queue
*/
Delta = 0;
for (ppTimPrev = &pAC->Tim.StQueue; (pTm = *ppTimPrev);
ppTimPrev = &pTm->TmNext ) {
if (Delta + pTm->TmDelta > Time) {
/* Position found */
/* Here the timer needs to be inserted. */
break;
}
Delta += pTm->TmDelta;
}
/* insert in queue */
*ppTimPrev = pTimer;
pTimer->TmNext = pTm;
pTimer->TmDelta = Time - Delta;
if (pTm) {
/* There is a next timer
* -> correct its Delta value.
*/
pTm->TmDelta -= pTimer->TmDelta;
}
/* restart with first */
SkHwtStart(pAC, Ioc, pAC->Tim.StQueue->TmDelta);
}
void SkTimerDone(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc) /* IoContext */
{
timer_done(pAC, Ioc, 1);
}
static void timer_done(
SK_AC *pAC, /* Adapters context */
SK_IOC Ioc, /* IoContext */
int Restart) /* Do we need to restart the Hardware timer ? */
{
SK_U32 Delta;
SK_TIMER *pTm;
SK_TIMER *pTComp; /* Timer completed now now */
SK_TIMER **ppLast; /* Next field of Last timer to be deq */
int Done = 0;
Delta = SkHwtRead(pAC, Ioc);
ppLast = &pAC->Tim.StQueue;
pTm = pAC->Tim.StQueue;
while (pTm && !Done) {
if (Delta >= pTm->TmDelta) {
/* Timer ran out */
pTm->TmActive = SK_FALSE;
Delta -= pTm->TmDelta;
ppLast = &pTm->TmNext;
pTm = pTm->TmNext;
}
else {
/* We found the first timer that did not run out */
pTm->TmDelta -= Delta;
Delta = 0;
Done = 1;
}
}
*ppLast = NULL;
/*
* pTm points to the first Timer that did not run out.
* StQueue points to the first Timer that run out.
*/
for ( pTComp = pAC->Tim.StQueue; pTComp; pTComp = pTComp->TmNext) {
SkEventQueue(pAC,pTComp->TmClass, pTComp->TmEvent, pTComp->TmPara);
}
/* Set head of timer queue to the first timer that did not run out */
pAC->Tim.StQueue = pTm;
if (Restart && pAC->Tim.StQueue) {
/* Restart HW timer */
SkHwtStart(pAC, Ioc, pAC->Tim.StQueue->TmDelta);
}
}
/* End of file */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff