mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
staging: add Silicom Bypass driver
The Silicom Bypass Network Interface Cards (NICs) are network cards with paired ports (2 or 4). The pairs either act as a "wire" allowing the network packets to pass or insert the device in between the two ports. When paired with the on-board hardware watchdog or other failsafe, they provide high availability for the network in the face of software outages or maintenance. Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
960cf81187
commit
7040e556c9
18 changed files with 13382 additions and 0 deletions
|
@ -136,4 +136,6 @@ source "drivers/staging/omap-thermal/Kconfig"
|
|||
|
||||
source "drivers/staging/ramster/Kconfig"
|
||||
|
||||
source "drivers/staging/silicom/Kconfig"
|
||||
|
||||
endif # STAGING
|
||||
|
|
|
@ -60,3 +60,4 @@ obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
|
|||
obj-$(CONFIG_CSR_WIFI) += csr/
|
||||
obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal/
|
||||
obj-$(CONFIG_ZCACHE2) += ramster/
|
||||
obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/
|
||||
|
|
43
drivers/staging/silicom/Kconfig
Normal file
43
drivers/staging/silicom/Kconfig
Normal file
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Silicom device configuration
|
||||
#
|
||||
|
||||
config NET_VENDOR_SILICOM
|
||||
bool "Silicom devices"
|
||||
default y
|
||||
depends on (SSB_POSSIBLE && HAS_DMA) || PCI
|
||||
---help---
|
||||
If you have a network card (Ethernet) belonging to this class,
|
||||
say Y.
|
||||
|
||||
Note that the answer to this question does not directly affect
|
||||
the kernel: saying N will just case the configurator to skip all
|
||||
the questions regarding Silicom chipsets. If you say Y, you will be asked
|
||||
for your specific chipset/driver in the following questions.
|
||||
|
||||
if NET_VENDOR_SILICOM
|
||||
|
||||
config SBYPASS
|
||||
tristate "Silicom BypassCTL library support"
|
||||
---help---
|
||||
If you have a network (Ethernet) controller of this type, say Y
|
||||
|
||||
To compile this driver as a module, choose M here. The module
|
||||
will be called bypass.
|
||||
|
||||
config BPCTL
|
||||
tristate "Silicom BypassCTL net support"
|
||||
depends on PCI
|
||||
select SBYPASS
|
||||
select NET_CORE
|
||||
select MII
|
||||
---help---
|
||||
If you have a network (Ethernet) controller of this type, say Y
|
||||
or M and read the Ethernet-HOWTO, available from
|
||||
<http://www.tldp.org/docs.html#howto>.
|
||||
|
||||
To compile this driver as a module, choose M here. The module
|
||||
will be called bpctl_mod.
|
||||
|
||||
|
||||
endif # NET_VENDOR_SILICOM
|
9
drivers/staging/silicom/Makefile
Normal file
9
drivers/staging/silicom/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# Makefile for the Bypass network device drivers.
|
||||
#
|
||||
|
||||
obj-$(CONFIG_BPCTL) += bpctl_mod.o
|
||||
obj-$(CONFIG_SBYPASS) += bypasslib/
|
||||
|
||||
|
||||
bpctl_mod-objs := bp_mod.o bp_proc.o
|
14
drivers/staging/silicom/README
Normal file
14
drivers/staging/silicom/README
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
Theory of Operation:
|
||||
|
||||
The Silicom Bypass Network Interface Cards (NICs) are network cards with paired ports (2 or 4).
|
||||
The pairs either act as a "wire" allowing the network packets to pass or insert the device in
|
||||
between the two ports. When paired with the on-board hardware watchdog or other failsafe,
|
||||
they provide high availability for the network in the face of software outages or maintenance.
|
||||
|
||||
The software requirements are for a kernel level driver that interfaces with the bypass and watchdog,
|
||||
as well as for control software. User control can be either the provided standalone executable
|
||||
(/bin/bpctl) or the API exposed by the Silicom library.
|
||||
|
||||
|
||||
|
7
drivers/staging/silicom/TODO
Normal file
7
drivers/staging/silicom/TODO
Normal file
|
@ -0,0 +1,7 @@
|
|||
TODO:
|
||||
- checkpatch.pl cleanups
|
||||
- locking audit
|
||||
- single module with all functionality
|
||||
- userland
|
||||
|
||||
|
56
drivers/staging/silicom/bits.h
Normal file
56
drivers/staging/silicom/bits.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 - 2004 Broadcom */
|
||||
/* Corporation. */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* History: */
|
||||
/* 02/25/00 Hav Khauv Initial version. */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef BITS_H
|
||||
#define BITS_H
|
||||
|
||||
/******************************************************************************/
|
||||
/* Bit Mask definitions */
|
||||
/******************************************************************************/
|
||||
|
||||
#define BIT_NONE 0x00
|
||||
#define BIT_0 0x01
|
||||
#define BIT_1 0x02
|
||||
#define BIT_2 0x04
|
||||
#define BIT_3 0x08
|
||||
#define BIT_4 0x10
|
||||
#define BIT_5 0x20
|
||||
#define BIT_6 0x40
|
||||
#define BIT_7 0x80
|
||||
#define BIT_8 0x0100
|
||||
#define BIT_9 0x0200
|
||||
#define BIT_10 0x0400
|
||||
#define BIT_11 0x0800
|
||||
#define BIT_12 0x1000
|
||||
#define BIT_13 0x2000
|
||||
#define BIT_14 0x4000
|
||||
#define BIT_15 0x8000
|
||||
#define BIT_16 0x010000
|
||||
#define BIT_17 0x020000
|
||||
#define BIT_18 0x040000
|
||||
#define BIT_19 0x080000
|
||||
#define BIT_20 0x100000
|
||||
#define BIT_21 0x200000
|
||||
#define BIT_22 0x400000
|
||||
#define BIT_23 0x800000
|
||||
#define BIT_24 0x01000000
|
||||
#define BIT_25 0x02000000
|
||||
#define BIT_26 0x04000000
|
||||
#define BIT_27 0x08000000
|
||||
#define BIT_28 0x10000000
|
||||
#define BIT_29 0x20000000
|
||||
#define BIT_30 0x40000000
|
||||
#define BIT_31 0x80000000
|
||||
|
||||
#endif /* BITS_H */
|
141
drivers/staging/silicom/bp_ioctl.h
Normal file
141
drivers/staging/silicom/bp_ioctl.h
Normal file
|
@ -0,0 +1,141 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* Silicom Bypass Control Utility, Copyright (c) 2005-2007 Silicom */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef BP_IOCTL_H
|
||||
#define BP_IOCTL_H
|
||||
|
||||
#define BP_CAP 0x01 //BIT_0
|
||||
#define BP_STATUS_CAP 0x02 //BIT_1
|
||||
#define BP_STATUS_CHANGE_CAP 0x04 //BIT_2
|
||||
#define SW_CTL_CAP 0x08 //BIT_3
|
||||
#define BP_DIS_CAP 0x10 //BIT_4
|
||||
#define BP_DIS_STATUS_CAP 0x20 //BIT_5
|
||||
#define STD_NIC_CAP 0x40 //BIT_6
|
||||
#define BP_PWOFF_ON_CAP 0x80 //BIT_7
|
||||
#define BP_PWOFF_OFF_CAP 0x0100 //BIT_8
|
||||
#define BP_PWOFF_CTL_CAP 0x0200 //BIT_9
|
||||
#define BP_PWUP_ON_CAP 0x0400 //BIT_10
|
||||
#define BP_PWUP_OFF_CAP 0x0800 //BIT_11
|
||||
#define BP_PWUP_CTL_CAP 0x1000 //BIT_12
|
||||
#define WD_CTL_CAP 0x2000 //BIT_13
|
||||
#define WD_STATUS_CAP 0x4000 //BIT_14
|
||||
#define WD_TIMEOUT_CAP 0x8000 //BIT_15
|
||||
#define TX_CTL_CAP 0x10000 //BIT_16
|
||||
#define TX_STATUS_CAP 0x20000 //BIT_17
|
||||
#define TAP_CAP 0x40000 //BIT_18
|
||||
#define TAP_STATUS_CAP 0x80000 //BIT_19
|
||||
#define TAP_STATUS_CHANGE_CAP 0x100000 //BIT_20
|
||||
#define TAP_DIS_CAP 0x200000 //BIT_21
|
||||
#define TAP_DIS_STATUS_CAP 0x400000 //BIT_22
|
||||
#define TAP_PWUP_ON_CAP 0x800000 //BIT_23
|
||||
#define TAP_PWUP_OFF_CAP 0x1000000 //BIT 24
|
||||
#define TAP_PWUP_CTL_CAP 0x2000000 //BIT 25
|
||||
#define NIC_CAP_NEG 0x4000000 //BIT 26
|
||||
#define TPL_CAP 0x8000000 //BIT 27
|
||||
#define DISC_CAP 0x10000000 //BIT 28
|
||||
#define DISC_DIS_CAP 0x20000000 //BIT 29
|
||||
#define DISC_PWUP_CTL_CAP 0x40000000 //BIT 30
|
||||
|
||||
#define TPL2_CAP_EX 0x01
|
||||
#define DISC_PORT_CAP_EX 0x02
|
||||
|
||||
#define WD_MIN_TIME_MASK(val) (val & 0xf)
|
||||
#define WD_STEP_COUNT_MASK(val) ((val & 0xf) << 5)
|
||||
#define WDT_STEP_TIME 0x10 //BIT_4
|
||||
|
||||
#define WD_MIN_TIME_GET(desc) (desc & 0xf)
|
||||
#define WD_STEP_COUNT_GET(desc) (desc>>5) & 0xf
|
||||
|
||||
typedef enum {
|
||||
IF_SCAN,
|
||||
GET_DEV_NUM,
|
||||
IS_BYPASS,
|
||||
GET_BYPASS_SLAVE,
|
||||
GET_BYPASS_CAPS,
|
||||
GET_WD_SET_CAPS,
|
||||
SET_BYPASS,
|
||||
GET_BYPASS,
|
||||
GET_BYPASS_CHANGE,
|
||||
SET_BYPASS_WD,
|
||||
GET_BYPASS_WD,
|
||||
GET_WD_EXPIRE_TIME,
|
||||
RESET_BYPASS_WD_TIMER,
|
||||
SET_DIS_BYPASS,
|
||||
GET_DIS_BYPASS,
|
||||
SET_BYPASS_PWOFF,
|
||||
GET_BYPASS_PWOFF,
|
||||
SET_BYPASS_PWUP,
|
||||
GET_BYPASS_PWUP,
|
||||
SET_STD_NIC,
|
||||
GET_STD_NIC,
|
||||
SET_TX,
|
||||
GET_TX,
|
||||
SET_TAP,
|
||||
GET_TAP,
|
||||
GET_TAP_CHANGE,
|
||||
SET_DIS_TAP,
|
||||
GET_DIS_TAP,
|
||||
SET_TAP_PWUP,
|
||||
GET_TAP_PWUP,
|
||||
SET_WD_EXP_MODE,
|
||||
GET_WD_EXP_MODE,
|
||||
SET_WD_AUTORESET,
|
||||
GET_WD_AUTORESET,
|
||||
SET_TPL,
|
||||
GET_TPL,
|
||||
SET_DISC,
|
||||
GET_DISC,
|
||||
GET_DISC_CHANGE,
|
||||
SET_DIS_DISC,
|
||||
GET_DIS_DISC,
|
||||
SET_DISC_PWUP,
|
||||
GET_DISC_PWUP,
|
||||
GET_BYPASS_INFO = 100,
|
||||
GET_BP_WAIT_AT_PWUP,
|
||||
SET_BP_WAIT_AT_PWUP,
|
||||
GET_BP_HW_RESET,
|
||||
SET_BP_HW_RESET,
|
||||
SET_DISC_PORT,
|
||||
GET_DISC_PORT,
|
||||
SET_DISC_PORT_PWUP,
|
||||
GET_DISC_PORT_PWUP,
|
||||
SET_BP_FORCE_LINK,
|
||||
GET_BP_FORCE_LINK,
|
||||
#ifdef BP_SELF_TEST
|
||||
SET_BP_SELF_TEST = 200,
|
||||
GET_BP_SELF_TEST,
|
||||
#endif
|
||||
|
||||
} CMND_TYPE_SD;
|
||||
|
||||
/*
|
||||
* The major device number. We can't rely on dynamic
|
||||
* registration any more, because ioctls need to know
|
||||
* it.
|
||||
*/
|
||||
|
||||
#define MAGIC_NUM 'J'
|
||||
|
||||
/* for passing single values */
|
||||
struct bpctl_cmd {
|
||||
int status;
|
||||
int data[8];
|
||||
int in_param[8];
|
||||
int out_param[8];
|
||||
};
|
||||
|
||||
#define IOCTL_TX_MSG(cmd) _IOWR(MAGIC_NUM, cmd, struct bpctl_cmd)
|
||||
|
||||
#define DEVICE_NODE "/dev/bpctl0"
|
||||
#define DEVICE_NAME "bpctl"
|
||||
|
||||
#endif
|
9012
drivers/staging/silicom/bp_mod.c
Normal file
9012
drivers/staging/silicom/bp_mod.c
Normal file
File diff suppressed because it is too large
Load diff
703
drivers/staging/silicom/bp_mod.h
Normal file
703
drivers/staging/silicom/bp_mod.h
Normal file
|
@ -0,0 +1,703 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* Bypass Control utility, Copyright (c) 2005 Silicom */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* */
|
||||
/* bp_mod.h */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef BP_MOD_H
|
||||
#define BP_MOD_H
|
||||
#include "bits.h"
|
||||
|
||||
#define EXPORT_SYMBOL_NOVERS EXPORT_SYMBOL
|
||||
|
||||
#define usec_delay(x) udelay(x)
|
||||
#ifndef msec_delay_bp
|
||||
#define msec_delay_bp(x) do { \
|
||||
int i; \
|
||||
if(1) { \
|
||||
for(i = 0; i < 1000; i++) \
|
||||
{ \
|
||||
udelay(x) ; \
|
||||
} \
|
||||
} else { \
|
||||
msleep(x); \
|
||||
} } while(0)
|
||||
|
||||
#endif
|
||||
|
||||
#include <linux/param.h>
|
||||
|
||||
#ifndef jiffies_to_msecs
|
||||
#define jiffies_to_msecs(x) _kc_jiffies_to_msecs(x)
|
||||
static inline unsigned int jiffies_to_msecs(const unsigned long j)
|
||||
{
|
||||
#if HZ <= 1000 && !(1000 % HZ)
|
||||
return (1000 / HZ) * j;
|
||||
#elif HZ > 1000 && !(HZ % 1000)
|
||||
return (j + (HZ / 1000) - 1) / (HZ / 1000);
|
||||
#else
|
||||
return (j * 1000) / HZ;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SILICOM_VID 0x1374
|
||||
#define SILICOM_SVID 0x1374
|
||||
|
||||
#define SILICOM_PXG2BPFI_SSID 0x0026
|
||||
#define SILICOM_PXG2BPFILX_SSID 0x0027
|
||||
#define SILICOM_PXGBPI_SSID 0x0028
|
||||
#define SILICOM_PXGBPIG_SSID 0x0029
|
||||
#define SILICOM_PXG2TBFI_SSID 0x002a
|
||||
#define SILICOM_PXG4BPI_SSID 0x002c
|
||||
#define SILICOM_PXG4BPFI_SSID 0x002d
|
||||
#define SILICOM_PXG4BPFILX_SSID 0x002e
|
||||
#define SILICOM_PXG2BPFIL_SSID 0x002F
|
||||
#define SILICOM_PXG2BPFILLX_SSID 0x0030
|
||||
#define SILICOM_PEG4BPI_SSID 0x0031
|
||||
#define SILICOM_PEG2BPI_SSID 0x0037
|
||||
#define SILICOM_PEG4BPIN_SSID 0x0038
|
||||
#define SILICOM_PEG2BPFI_SSID 0x0039
|
||||
#define SILICOM_PEG2BPFILX_SSID 0x003A
|
||||
#define SILICOM_PMCXG2BPFI_SSID 0x003B
|
||||
#define NOKIA_PMCXG2BPFIN_SSID 0x0510
|
||||
#define NOKIA_PMCXG2BPIN_SSID 0x0513
|
||||
#define NOKIA_PMCXG4BPIN_SSID 0x0514
|
||||
#define NOKIA_PMCXG2BPFIN_SVID 0x13B8
|
||||
#define NOKIA_PMCXG2BPIN2_SSID 0x0515
|
||||
#define NOKIA_PMCXG4BPIN2_SSID 0x0516
|
||||
#define SILICOM_PMCX2BPI_SSID 0x041
|
||||
#define SILICOM_PMCX4BPI_SSID 0x042
|
||||
#define SILICOM_PXG2BISC1_SSID 0x003d
|
||||
#define SILICOM_PEG2TBFI_SSID 0x003E
|
||||
#define SILICOM_PXG2TBI_SSID 0x003f
|
||||
#define SILICOM_PXG4BPFID_SSID 0x0043
|
||||
#define SILICOM_PEG4BPFI_SSID 0x0040
|
||||
#define SILICOM_PEG4BPIPT_SSID 0x0044
|
||||
#define SILICOM_PXG6BPI_SSID 0x0045
|
||||
#define SILICOM_PEG4BPIL_SSID 0x0046
|
||||
#define SILICOM_PEG2BPI5_SSID 0x0052
|
||||
#define SILICOM_PEG6BPI_SSID 0x0053
|
||||
#define SILICOM_PEG4BPFI5_SSID 0x0050
|
||||
#define SILICOM_PEG4BPFI5LX_SSID 0x0051
|
||||
#define SILICOM_PEG2BISC6_SSID 0x54
|
||||
|
||||
#define SILICOM_PEG6BPIFC_SSID 0x55
|
||||
|
||||
#define SILICOM_PEG2BPFI5_SSID 0x0056
|
||||
#define SILICOM_PEG2BPFI5LX_SSID 0x0057
|
||||
|
||||
#define SILICOM_PXEG4BPFI_SSID 0x0058
|
||||
|
||||
#define SILICOM_PEG2BPFID_SSID 0x0047
|
||||
#define SILICOM_PEG2BPFIDLX_SSID 0x004C
|
||||
#define SILICOM_MEG2BPFILN_SSID 0x0048
|
||||
#define SILICOM_MEG2BPFINX_SSID 0x0049
|
||||
#define SILICOM_PEG4BPFILX_SSID 0x004A
|
||||
#define SILICOM_MHIO8AD_SSID 0x004F
|
||||
|
||||
#define SILICOM_MEG2BPFILXLN_SSID 0x004b
|
||||
#define SILICOM_PEG2BPIX1_SSID 0x004d
|
||||
#define SILICOM_MEG2BPFILXNX_SSID 0x004e
|
||||
|
||||
#define SILICOM_PE10G2BPISR_SSID 0x0102
|
||||
#define SILICOM_PE10G2BPILR_SSID 0x0103
|
||||
#define SILICOM_PE10G2BPICX4_SSID 0x0101
|
||||
|
||||
#define SILICOM_XE10G2BPILR_SSID 0x0163
|
||||
#define SILICOM_XE10G2BPISR_SSID 0x0162
|
||||
#define SILICOM_XE10G2BPICX4_SSID 0x0161
|
||||
#define SILICOM_XE10G2BPIT_SSID 0x0160
|
||||
|
||||
#define SILICOM_PE10GDBISR_SSID 0x0181
|
||||
#define SILICOM_PE10GDBILR_SSID 0x0182
|
||||
|
||||
#define SILICOM_PE210G2DBi9SR_SSID 0x0188
|
||||
#define SILICOM_PE210G2DBi9SRRB_SSID 0x0188
|
||||
#define SILICOM_PE210G2DBi9LR_SSID 0x0189
|
||||
#define SILICOM_PE210G2DBi9LRRB_SSID 0x0189
|
||||
#define SILICOM_PE310G4DBi940SR_SSID 0x018C
|
||||
|
||||
#define SILICOM_PE310G4BPi9T_SSID 0x130
|
||||
#define SILICOM_PE310G4BPi9SR_SSID 0x132
|
||||
#define SILICOM_PE310G4BPi9LR_SSID 0x133
|
||||
|
||||
#define NOKIA_XE10G2BPIXR_SVID 0x13B8
|
||||
#define NOKIA_XE10G2BPIXR_SSID 0x051C
|
||||
|
||||
#define INTEL_PEG4BPII_PID 0x10A0
|
||||
#define INTEL_PEG4BPFII_PID 0x10A1
|
||||
#define INTEL_PEG4BPII_SSID 0x11A0
|
||||
#define INTEL_PEG4BPFII_SSID 0x11A1
|
||||
|
||||
#define INTEL_PEG4BPIIO_SSID 0x10A0
|
||||
#define INTEL_PEG4BPIIO_PID 0x105e
|
||||
|
||||
#define BROADCOM_VID 0x14e4
|
||||
#define BROADCOM_PE10G2_PID 0x164e
|
||||
|
||||
#define SILICOM_PE10G2BPTCX4_SSID 0x0141
|
||||
#define SILICOM_PE10G2BPTSR_SSID 0x0142
|
||||
#define SILICOM_PE10G2BPTLR_SSID 0x0143
|
||||
#define SILICOM_PE10G2BPTT_SSID 0x0140
|
||||
|
||||
#define SILICOM_PEG4BPI6_SSID 0x0320
|
||||
#define SILICOM_PEG4BPFI6_SSID 0x0321
|
||||
#define SILICOM_PEG4BPFI6LX_SSID 0x0322
|
||||
#define SILICOM_PEG4BPFI6ZX_SSID 0x0323
|
||||
|
||||
#define SILICOM_PEG2BPI6_SSID 0x0300
|
||||
#define SILICOM_PEG2BPFI6_SSID 0x0301
|
||||
#define SILICOM_PEG2BPFI6LX_SSID 0x0302
|
||||
#define SILICOM_PEG2BPFI6ZX_SSID 0x0303
|
||||
#define SILICOM_PEG2BPFI6FLXM_SSID 0x0304
|
||||
|
||||
#define SILICOM_PEG2DBI6_SSID 0x0308
|
||||
#define SILICOM_PEG2DBFI6_SSID 0x0309
|
||||
#define SILICOM_PEG2DBFI6LX_SSID 0x030A
|
||||
#define SILICOM_PEG2DBFI6ZX_SSID 0x030B
|
||||
|
||||
#define SILICOM_MEG2BPI6_SSID 0x0310
|
||||
#define SILICOM_XEG2BPI6_SSID 0x0318
|
||||
#define SILICOM_PEG4BPI6FC_SSID 0x0328
|
||||
#define SILICOM_PEG4BPFI6FC_SSID 0x0329
|
||||
#define SILICOM_PEG4BPFI6FCLX_SSID 0x032A
|
||||
#define SILICOM_PEG4BPFI6FCZX_SSID 0x032B
|
||||
|
||||
#define SILICOM_PEG6BPI6_SSID 0x0340
|
||||
|
||||
#define SILICOM_PEG2BPI6SC6_SSID 0x0360
|
||||
|
||||
#define SILICOM_MEG2BPI6_SSID 0x0310
|
||||
#define SILICOM_XEG2BPI6_SSID 0x0318
|
||||
#define SILICOM_MEG4BPI6_SSID 0x0330
|
||||
|
||||
#define SILICOM_PE2G4BPi80L_SSID 0x0380
|
||||
|
||||
#define SILICOM_M6E2G8BPi80A_SSID 0x0474
|
||||
|
||||
#define SILICOM_PE2G4BPi35_SSID 0x03d8
|
||||
|
||||
#define SILICOM_PE2G4BPFi80_SSID 0x0381
|
||||
#define SILICOM_PE2G4BPFi80LX_SSID 0x0382
|
||||
#define SILICOM_PE2G4BPFi80ZX_SSID 0x0383
|
||||
|
||||
#define SILICOM_PE2G4BPi80_SSID 0x0388
|
||||
|
||||
#define SILICOM_PE2G2BPi80_SSID 0x0390
|
||||
#define SILICOM_PE2G2BPFi80_SSID 0x0391
|
||||
#define SILICOM_PE2G2BPFi80LX_SSID 0x0392
|
||||
#define SILICOM_PE2G2BPFi80ZX_SSID 0x0393
|
||||
|
||||
#define SILICOM_PE2G4BPi35L_SSID 0x03D0
|
||||
#define SILICOM_PE2G4BPFi35_SSID 0x03D1
|
||||
#define SILICOM_PE2G4BPFi35LX_SSID 0x03D2
|
||||
#define SILICOM_PE2G4BPFi35ZX_SSID 0x03D3
|
||||
|
||||
#define SILICOM_PE2G2BPi35_SSID 0x03c0
|
||||
#define SILICOM_PAC1200BPi35_SSID 0x03cc
|
||||
#define SILICOM_PE2G2BPFi35_SSID 0x03C1
|
||||
#define SILICOM_PE2G2BPFi35LX_SSID 0x03C2
|
||||
#define SILICOM_PE2G2BPFi35ZX_SSID 0x03C3
|
||||
|
||||
#define SILICOM_PE2G6BPi35_SSID 0x03E0
|
||||
#define SILICOM_PE2G6BPi35CX_SSID 0x0AA0
|
||||
|
||||
#define INTEL_PE210G2SPI9_SSID 0x00C
|
||||
|
||||
#define SILICOM_M1EG2BPI6_SSID 0x400
|
||||
|
||||
#define SILICOM_M1EG2BPFI6_SSID 0x0401
|
||||
#define SILICOM_M1EG2BPFI6LX_SSID 0x0402
|
||||
#define SILICOM_M1EG2BPFI6ZX_SSID 0x0403
|
||||
|
||||
#define SILICOM_M1EG4BPI6_SSID 0x0420
|
||||
|
||||
#define SILICOM_M1EG4BPFI6_SSID 0x0421
|
||||
#define SILICOM_M1EG4BPFI6LX_SSID 0x0422
|
||||
#define SILICOM_M1EG4BPFI6ZX_SSID 0x0423
|
||||
|
||||
#define SILICOM_M1EG6BPI6_SSID 0x0440
|
||||
|
||||
#define SILICOM_M1E2G4BPi80_SSID 0x0460
|
||||
#define SILICOM_M1E2G4BPFi80_SSID 0x0461
|
||||
#define SILICOM_M1E2G4BPFi80LX_SSID 0x0462
|
||||
#define SILICOM_M1E2G4BPFi80ZX_SSID 0x0463
|
||||
|
||||
#define SILICOM_M6E2G8BPi80_SSID 0x0470
|
||||
#define SILICOM_PE210G2BPi40_SSID 0x01a0
|
||||
|
||||
#define PEG540_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PE210G2BPi40_SSID))
|
||||
|
||||
#define OLD_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PXG2BPFI_SSID)|| \
|
||||
(pid==SILICOM_PXG2BPFILX_SSID))
|
||||
|
||||
#define P2BPFI_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PXG2BPFI_SSID)|| \
|
||||
(pid==SILICOM_PXG2BPFILX_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFI_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFID_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFIDLX_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFILN_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFINX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFILX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI_SSID)|| \
|
||||
(pid==SILICOM_PXEG4BPFI_SSID)|| \
|
||||
(pid==SILICOM_PXG4BPFID_SSID)|| \
|
||||
(pid==SILICOM_PEG2TBFI_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPISR_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPILR_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFILX_SSID)|| \
|
||||
(pid==SILICOM_PMCXG2BPFI_SSID) || \
|
||||
(pid==SILICOM_MHIO8AD_SSID) || \
|
||||
(pid==SILICOM_PEG4BPFI5LX_SSID) || \
|
||||
(pid==SILICOM_PEG4BPFI5_SSID) || \
|
||||
(pid==SILICOM_PEG4BPFI6FC_SSID) || \
|
||||
(pid==SILICOM_PEG4BPFI6FCLX_SSID) || \
|
||||
(pid==SILICOM_PEG4BPFI6FCZX_SSID) || \
|
||||
(pid==NOKIA_PMCXG2BPFIN_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFILXLN_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFILXNX_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPIT_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPICX4_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPISR_SSID)|| \
|
||||
(pid==NOKIA_XE10G2BPIXR_SSID)|| \
|
||||
(pid==SILICOM_PE10GDBISR_SSID)|| \
|
||||
(pid==SILICOM_PE10GDBILR_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPILR_SSID))
|
||||
|
||||
#define INTEL_IF_SERIES(pid) \
|
||||
((pid==INTEL_PEG4BPII_SSID)|| \
|
||||
(pid==INTEL_PEG4BPIIO_SSID)|| \
|
||||
(pid==INTEL_PEG4BPFII_SSID))
|
||||
|
||||
#define NOKIA_SERIES(pid) \
|
||||
((pid==NOKIA_PMCXG2BPIN_SSID)|| \
|
||||
(pid==NOKIA_PMCXG4BPIN_SSID)|| \
|
||||
(pid==SILICOM_PMCX4BPI_SSID)|| \
|
||||
(pid==NOKIA_PMCXG2BPFIN_SSID)|| \
|
||||
(pid==SILICOM_PMCXG2BPFI_SSID)|| \
|
||||
(pid==NOKIA_PMCXG2BPIN2_SSID)|| \
|
||||
(pid==NOKIA_PMCXG4BPIN2_SSID)|| \
|
||||
(pid==SILICOM_PMCX2BPI_SSID))
|
||||
|
||||
#define DISCF_IF_SERIES(pid) \
|
||||
(pid==SILICOM_PEG2TBFI_SSID)
|
||||
|
||||
#define PEGF_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PEG2BPFI_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFID_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFIDLX_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFILX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI_SSID)|| \
|
||||
(pid==SILICOM_PXEG4BPFI_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFILN_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFINX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFILX_SSID)|| \
|
||||
(pid==SILICOM_PEG2TBFI_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFILXLN_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPFILXNX_SSID))
|
||||
|
||||
#define TPL_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PXG2BPFIL_SSID)|| \
|
||||
(pid==SILICOM_PXG2BPFILLX_SSID)|| \
|
||||
(pid==SILICOM_PXG2TBFI_SSID)|| \
|
||||
(pid==SILICOM_PXG4BPFID_SSID)|| \
|
||||
(pid==SILICOM_PXG4BPFI_SSID))
|
||||
|
||||
#define BP10G_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PE10G2BPISR_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPICX4_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPILR_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPIT_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPICX4_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPISR_SSID)|| \
|
||||
(pid==NOKIA_XE10G2BPIXR_SSID)|| \
|
||||
(pid==SILICOM_PE10GDBISR_SSID)|| \
|
||||
(pid==SILICOM_PE10GDBILR_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPILR_SSID))
|
||||
|
||||
#define BP10GB_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PE10G2BPTCX4_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPTSR_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPTLR_SSID)|| \
|
||||
(pid==SILICOM_PE10G2BPTT_SSID))
|
||||
|
||||
#define BP10G_CX4_SERIES(pid) \
|
||||
(pid==SILICOM_PE10G2BPICX4_SSID)
|
||||
|
||||
#define BP10GB_CX4_SERIES(pid) \
|
||||
(pid==SILICOM_PE10G2BPTCX4_SSID)
|
||||
|
||||
#define SILICOM_M2EG2BPFI6_SSID 0x0501
|
||||
#define SILICOM_M2EG2BPFI6LX_SSID 0x0502
|
||||
#define SILICOM_M2EG2BPFI6ZX_SSID 0x0503
|
||||
#define SILICOM_M2EG4BPI6_SSID 0x0520
|
||||
|
||||
#define SILICOM_M2EG4BPFI6_SSID 0x0521
|
||||
#define SILICOM_M2EG4BPFI6LX_SSID 0x0522
|
||||
#define SILICOM_M2EG4BPFI6ZX_SSID 0x0523
|
||||
|
||||
#define SILICOM_M2EG6BPI6_SSID 0x0540
|
||||
|
||||
#define SILICOM_M1E10G2BPI9CX4_SSID 0x481
|
||||
#define SILICOM_M1E10G2BPI9SR_SSID 0x482
|
||||
#define SILICOM_M1E10G2BPI9LR_SSID 0x483
|
||||
#define SILICOM_M1E10G2BPI9T_SSID 0x480
|
||||
|
||||
#define SILICOM_M2E10G2BPI9CX4_SSID 0x581
|
||||
#define SILICOM_M2E10G2BPI9SR_SSID 0x582
|
||||
#define SILICOM_M2E10G2BPI9LR_SSID 0x583
|
||||
#define SILICOM_M2E10G2BPI9T_SSID 0x580
|
||||
|
||||
#define SILICOM_PE210G2BPI9CX4_SSID 0x121
|
||||
#define SILICOM_PE210G2BPI9SR_SSID 0x122
|
||||
#define SILICOM_PE210G2BPI9LR_SSID 0x123
|
||||
#define SILICOM_PE210G2BPI9T_SSID 0x120
|
||||
|
||||
#define DBI_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PE10GDBISR_SSID)|| \
|
||||
(pid==SILICOM_PE10GDBILR_SSID)|| \
|
||||
(pid==SILICOM_XE10G2BPILR_SSID)|| \
|
||||
(pid==SILICOM_PE210G2DBi9LR_SSID))
|
||||
|
||||
#define PEGF5_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PEG2BPFI5_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFI5LX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI6_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI6LX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFI6_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFI6LX_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPFI6FLXM_SSID)|| \
|
||||
(pid==SILICOM_PEG2DBFI6_SSID)|| \
|
||||
(pid==SILICOM_PEG2DBFI6LX_SSID)|| \
|
||||
(pid==SILICOM_PEG2DBFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPI6FC_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI6FCLX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPI6FC_SSID)|| \
|
||||
(pid==SILICOM_M1EG2BPFI6_SSID)|| \
|
||||
(pid==SILICOM_M1EG2BPFI6LX_SSID)|| \
|
||||
(pid==SILICOM_M1EG2BPFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_M1EG4BPFI6_SSID)|| \
|
||||
(pid==SILICOM_M1EG4BPFI6LX_SSID)|| \
|
||||
(pid==SILICOM_M1EG4BPFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_M2EG2BPFI6_SSID)|| \
|
||||
(pid==SILICOM_M2EG2BPFI6LX_SSID)|| \
|
||||
(pid==SILICOM_M2EG2BPFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_M2EG4BPFI6_SSID)|| \
|
||||
(pid==SILICOM_M2EG4BPFI6LX_SSID)|| \
|
||||
(pid==SILICOM_M2EG4BPFI6ZX_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPFI6FCZX_SSID))
|
||||
|
||||
#define PEG5_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PEG4BPI6_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPI6_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPI6FC_SSID)|| \
|
||||
(pid==SILICOM_PEG6BPI6_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPI6SC6_SSID)|| \
|
||||
(pid==SILICOM_MEG2BPI6_SSID)|| \
|
||||
(pid==SILICOM_XEG2BPI6_SSID)|| \
|
||||
(pid==SILICOM_MEG4BPI6_SSID)|| \
|
||||
(pid==SILICOM_M1EG2BPI6_SSID)|| \
|
||||
(pid==SILICOM_M1EG4BPI6_SSID)|| \
|
||||
(pid==SILICOM_M1EG6BPI6_SSID)|| \
|
||||
(pid==SILICOM_PEG6BPI_SSID)|| \
|
||||
(pid==SILICOM_PEG4BPIL_SSID)|| \
|
||||
(pid==SILICOM_PEG2BISC6_SSID)|| \
|
||||
(pid==SILICOM_PEG2BPI5_SSID))
|
||||
|
||||
#define PEG80_IF_SERIES(pid) \
|
||||
((pid==SILICOM_M1E2G4BPi80_SSID)|| \
|
||||
(pid==SILICOM_M6E2G8BPi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPi80L_SSID)|| \
|
||||
(pid==SILICOM_M6E2G8BPi80A_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPi35_SSID)|| \
|
||||
(pid==SILICOM_PAC1200BPi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPi35L_SSID)|| \
|
||||
(pid==SILICOM_PE2G6BPi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi80LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi35LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi35ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi35LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi35ZX_SSID))
|
||||
|
||||
#define PEGF80_IF_SERIES(pid) \
|
||||
((pid==SILICOM_PE2G4BPFi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_M1E2G4BPFi80_SSID)|| \
|
||||
(pid==SILICOM_M1E2G4BPFi80LX_SSID)|| \
|
||||
(pid==SILICOM_M1E2G4BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi80_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi80LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi80ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi35LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G2BPFi35ZX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi35_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi35LX_SSID)|| \
|
||||
(pid==SILICOM_PE2G4BPFi35ZX_SSID))
|
||||
|
||||
#define BP10G9_IF_SERIES(pid) \
|
||||
((pid==INTEL_PE210G2SPI9_SSID)|| \
|
||||
(pid==SILICOM_M1E10G2BPI9CX4_SSID)|| \
|
||||
(pid==SILICOM_M1E10G2BPI9SR_SSID)|| \
|
||||
(pid==SILICOM_M1E10G2BPI9LR_SSID)|| \
|
||||
(pid==SILICOM_M1E10G2BPI9T_SSID)|| \
|
||||
(pid==SILICOM_M2E10G2BPI9CX4_SSID)|| \
|
||||
(pid==SILICOM_M2E10G2BPI9SR_SSID)|| \
|
||||
(pid==SILICOM_M2E10G2BPI9LR_SSID)|| \
|
||||
(pid==SILICOM_M2E10G2BPI9T_SSID)|| \
|
||||
(pid==SILICOM_PE210G2BPI9CX4_SSID)|| \
|
||||
(pid==SILICOM_PE210G2BPI9SR_SSID)|| \
|
||||
(pid==SILICOM_PE210G2BPI9LR_SSID)|| \
|
||||
(pid==SILICOM_PE210G2DBi9SR_SSID)|| \
|
||||
(pid==SILICOM_PE210G2DBi9SRRB_SSID)|| \
|
||||
(pid==SILICOM_PE210G2DBi9LR_SSID)|| \
|
||||
(pid==SILICOM_PE210G2DBi9LRRB_SSID)|| \
|
||||
(pid==SILICOM_PE310G4DBi940SR_SSID)|| \
|
||||
(pid==SILICOM_PEG2BISC6_SSID)|| \
|
||||
(pid==SILICOM_PE310G4BPi9T_SSID)|| \
|
||||
(pid==SILICOM_PE310G4BPi9SR_SSID)|| \
|
||||
(pid==SILICOM_PE310G4BPi9LR_SSID)|| \
|
||||
(pid==SILICOM_PE210G2BPI9T_SSID))
|
||||
|
||||
/*******************************************************/
|
||||
/* 1G INTERFACE ****************************************/
|
||||
/*******************************************************/
|
||||
|
||||
/* Intel Registers */
|
||||
#define BPCTLI_CTRL 0x00000
|
||||
#define BPCTLI_CTRL_SWDPIO0 0x00400000
|
||||
#define BPCTLI_CTRL_SWDPIN0 0x00040000
|
||||
|
||||
#define BPCTLI_CTRL_EXT 0x00018 /* Extended Device Control - RW */
|
||||
#define BPCTLI_STATUS 0x00008 /* Device Status - RO */
|
||||
|
||||
/* HW related */
|
||||
#define BPCTLI_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Defineable Pin 6 */
|
||||
#define BPCTLI_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */
|
||||
#define BPCTLI_CTRL_SDP0_DATA 0x00040000 /* SWDPIN 0 value */
|
||||
#define BPCTLI_CTRL_EXT_SDP6_DIR 0x00000400 /* Direction of SDP6 0=in 1=out */
|
||||
#define BPCTLI_CTRL_EXT_SDP7_DIR 0x00000800 /* Direction of SDP7 0=in 1=out */
|
||||
#define BPCTLI_CTRL_SDP0_DIR 0x00400000 /* SDP0 Input or output */
|
||||
#define BPCTLI_CTRL_SWDPIN1 0x00080000
|
||||
#define BPCTLI_CTRL_SDP1_DIR 0x00800000
|
||||
|
||||
#define BPCTLI_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
|
||||
|
||||
#define BPCTLI_CTRL_SDP0_SHIFT 18
|
||||
#define BPCTLI_CTRL_EXT_SDP6_SHIFT 6
|
||||
|
||||
#define BPCTLI_STATUS_TBIMODE 0x00000020
|
||||
#define BPCTLI_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
|
||||
#define BPCTLI_CTRL_EXT_LINK_MODE_MASK 0x00C00000
|
||||
|
||||
#define BPCTLI_CTRL_EXT_MCLK_DIR BPCTLI_CTRL_EXT_SDP7_DIR
|
||||
#define BPCTLI_CTRL_EXT_MCLK_DATA BPCTLI_CTRL_EXT_SDP7_DATA
|
||||
#define BPCTLI_CTRL_EXT_MDIO_DIR BPCTLI_CTRL_EXT_SDP6_DIR
|
||||
#define BPCTLI_CTRL_EXT_MDIO_DATA BPCTLI_CTRL_EXT_SDP6_DATA
|
||||
|
||||
#define BPCTLI_CTRL_EXT_MCLK_DIR5 BPCTLI_CTRL_SDP1_DIR
|
||||
#define BPCTLI_CTRL_EXT_MCLK_DATA5 BPCTLI_CTRL_SWDPIN1
|
||||
#define BPCTLI_CTRL_EXT_MCLK_DIR80 BPCTLI_CTRL_EXT_SDP6_DIR
|
||||
#define BPCTLI_CTRL_EXT_MCLK_DATA80 BPCTLI_CTRL_EXT_SDP6_DATA
|
||||
#define BPCTLI_CTRL_EXT_MDIO_DIR5 BPCTLI_CTRL_SWDPIO0
|
||||
#define BPCTLI_CTRL_EXT_MDIO_DATA5 BPCTLI_CTRL_SWDPIN0
|
||||
#define BPCTLI_CTRL_EXT_MDIO_DIR80 BPCTLI_CTRL_SWDPIO0
|
||||
#define BPCTLI_CTRL_EXT_MDIO_DATA80 BPCTLI_CTRL_SWDPIN0
|
||||
|
||||
#define BPCTL_WRITE_REG(a, reg, value) \
|
||||
(writel((value), (void *)(((a)->mem_map) + BPCTLI_##reg)))
|
||||
|
||||
#define BPCTL_READ_REG(a, reg) ( \
|
||||
readl((void *)((a)->mem_map) + BPCTLI_##reg))
|
||||
|
||||
#define BPCTL_WRITE_FLUSH(a) BPCTL_READ_REG(a, STATUS)
|
||||
|
||||
#define BPCTL_BP_WRITE_REG(a, reg, value) ({ \
|
||||
BPCTL_WRITE_REG(a, reg, value); \
|
||||
BPCTL_WRITE_FLUSH(a);})
|
||||
|
||||
/**************************************************************/
|
||||
/************** 82575 Interface********************************/
|
||||
/**************************************************************/
|
||||
|
||||
#define BPCTLI_MII_CR_POWER_DOWN 0x0800
|
||||
#define BPCTLI_PHY_CONTROL 0x00 /* Control Register */
|
||||
#define BPCTLI_MDIC 0x00020 /* MDI Control - RW */
|
||||
#define BPCTLI_IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */
|
||||
#define BPCTLI_MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */
|
||||
|
||||
#define BPCTLI_MDIC_DATA_MASK 0x0000FFFF
|
||||
#define BPCTLI_MDIC_REG_MASK 0x001F0000
|
||||
#define BPCTLI_MDIC_REG_SHIFT 16
|
||||
#define BPCTLI_MDIC_PHY_MASK 0x03E00000
|
||||
#define BPCTLI_MDIC_PHY_SHIFT 21
|
||||
#define BPCTLI_MDIC_OP_WRITE 0x04000000
|
||||
#define BPCTLI_MDIC_OP_READ 0x08000000
|
||||
#define BPCTLI_MDIC_READY 0x10000000
|
||||
#define BPCTLI_MDIC_INT_EN 0x20000000
|
||||
#define BPCTLI_MDIC_ERROR 0x40000000
|
||||
|
||||
#define BPCTLI_SWFW_PHY0_SM 0x02
|
||||
#define BPCTLI_SWFW_PHY1_SM 0x04
|
||||
|
||||
#define BPCTLI_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
|
||||
|
||||
#define BPCTLI_SWSM 0x05B50 /* SW Semaphore */
|
||||
#define BPCTLI_FWSM 0x05B54 /* FW Semaphore */
|
||||
|
||||
#define BPCTLI_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
|
||||
#define BPCTLI_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
|
||||
#define BPCTLI_MAX_PHY_MULTI_PAGE_REG 0xF
|
||||
#define BPCTLI_GEN_POLL_TIMEOUT 640
|
||||
|
||||
/********************************************************/
|
||||
|
||||
/********************************************************/
|
||||
/* 10G INTERFACE ****************************************/
|
||||
/********************************************************/
|
||||
|
||||
#define BP10G_I2CCTL 0x28
|
||||
|
||||
/* I2CCTL Bit Masks */
|
||||
#define BP10G_I2C_CLK_IN 0x00000001
|
||||
#define BP10G_I2C_CLK_OUT 0x00000002
|
||||
#define BP10G_I2C_DATA_IN 0x00000004
|
||||
#define BP10G_I2C_DATA_OUT 0x00000008
|
||||
|
||||
#define BP10G_ESDP 0x20
|
||||
|
||||
#define BP10G_SDP0_DIR 0x100
|
||||
#define BP10G_SDP1_DIR 0x200
|
||||
#define BP10G_SDP3_DIR 0x800
|
||||
#define BP10G_SDP4_DIR BIT_12
|
||||
#define BP10G_SDP5_DIR 0x2000
|
||||
#define BP10G_SDP0_DATA 0x001
|
||||
#define BP10G_SDP1_DATA 0x002
|
||||
#define BP10G_SDP3_DATA 0x008
|
||||
#define BP10G_SDP4_DATA 0x010
|
||||
#define BP10G_SDP5_DATA 0x020
|
||||
|
||||
#define BP10G_SDP2_DIR 0x400
|
||||
#define BP10G_SDP2_DATA 0x4
|
||||
|
||||
#define BP10G_EODSDP 0x28
|
||||
|
||||
#define BP10G_SDP6_DATA_IN 0x001
|
||||
#define BP10G_SDP6_DATA_OUT 0x002
|
||||
|
||||
#define BP10G_SDP7_DATA_IN 0x004
|
||||
#define BP10G_SDP7_DATA_OUT 0x008
|
||||
|
||||
#define BP10G_MCLK_DATA_OUT BP10G_SDP7_DATA_OUT
|
||||
#define BP10G_MDIO_DATA_OUT BP10G_SDP6_DATA_OUT
|
||||
#define BP10G_MDIO_DATA_IN BP10G_SDP6_DATA_IN
|
||||
|
||||
#define BP10G_MDIO_DATA /*BP10G_SDP5_DATA*/ BP10G_SDP3_DATA
|
||||
#define BP10G_MDIO_DIR /*BP10G_SDP5_DIR*/ BP10G_SDP3_DATA
|
||||
|
||||
/*#define BP10G_MCLK_DATA_OUT9 BP10G_I2C_CLK_OUT
|
||||
#define BP10G_MDIO_DATA_OUT9 BP10G_I2C_DATA_OUT*/
|
||||
|
||||
/*#define BP10G_MCLK_DATA_OUT9*//*BP10G_I2C_DATA_OUT */
|
||||
#define BP10G_MDIO_DATA_OUT9 BP10G_I2C_DATA_OUT /*BP10G_I2C_CLK_OUT */
|
||||
|
||||
/* VIA EOSDP ! */
|
||||
#define BP10G_MCLK_DATA_OUT9 BP10G_SDP4_DATA
|
||||
#define BP10G_MCLK_DIR_OUT9 BP10G_SDP4_DIR
|
||||
|
||||
/*#define BP10G_MDIO_DATA_IN9 BP10G_I2C_DATA_IN*/
|
||||
|
||||
#define BP10G_MDIO_DATA_IN9 BP10G_I2C_DATA_IN /*BP10G_I2C_CLK_IN */
|
||||
|
||||
#define BP540_MDIO_DATA /*BP10G_SDP5_DATA*/ BP10G_SDP0_DATA
|
||||
#define BP540_MDIO_DIR /*BP10G_SDP5_DIR*/ BP10G_SDP0_DIR
|
||||
#define BP540_MCLK_DATA BP10G_SDP2_DATA
|
||||
#define BP540_MCLK_DIR BP10G_SDP2_DIR
|
||||
|
||||
#define BP10G_WRITE_REG(a, reg, value) \
|
||||
(writel((value), (void *)(((a)->mem_map) + BP10G_##reg)))
|
||||
|
||||
#define BP10G_READ_REG(a, reg) ( \
|
||||
readl((void *)((a)->mem_map) + BP10G_##reg))
|
||||
|
||||
/*****BROADCOM*******************************************/
|
||||
|
||||
#define BP10GB_MISC_REG_GPIO 0xa490
|
||||
#define BP10GB_GPIO3_P0 BIT_3
|
||||
#define BP10GB_GPIO3_P1 BIT_7
|
||||
|
||||
#define BP10GB_GPIO3_SET_P0 BIT_11
|
||||
#define BP10GB_GPIO3_CLR_P0 BIT_19
|
||||
#define BP10GB_GPIO3_OE_P0 BIT_27
|
||||
|
||||
#define BP10GB_GPIO3_SET_P1 BIT_15
|
||||
#define BP10GB_GPIO3_CLR_P1 BIT_23
|
||||
#define BP10GB_GPIO3_OE_P1 BIT_31
|
||||
|
||||
#define BP10GB_GPIO0_P1 0x10
|
||||
#define BP10GB_GPIO0_P0 0x1
|
||||
#define BP10GB_GPIO0_CLR_P0 0x10000
|
||||
#define BP10GB_GPIO0_CLR_P1 0x100000
|
||||
#define BP10GB_GPIO0_SET_P0 0x100
|
||||
#define BP10GB_GPIO0_SET_P1 0x1000
|
||||
|
||||
#define BP10GB_GPIO0_OE_P1 0x10000000
|
||||
#define BP10GB_GPIO0_OE_P0 0x1000000
|
||||
|
||||
#define BP10GB_MISC_REG_SPIO 0xa4fc
|
||||
#define BP10GB_GPIO4_OE BIT_28
|
||||
#define BP10GB_GPIO5_OE BIT_29
|
||||
#define BP10GB_GPIO4_CLR BIT_20
|
||||
#define BP10GB_GPIO5_CLR BIT_21
|
||||
#define BP10GB_GPIO4_SET BIT_12
|
||||
#define BP10GB_GPIO5_SET BIT_13
|
||||
#define BP10GB_GPIO4 BIT_4
|
||||
#define BP10GB_GPIO5 BIT_5
|
||||
|
||||
#define BP10GB_MCLK_DIR BP10GB_GPIO5_OE
|
||||
#define BP10GB_MDIO_DIR BP10GB_GPIO4_OE
|
||||
|
||||
#define BP10GB_MCLK_DATA BP10GB_GPIO5
|
||||
#define BP10GB_MDIO_DATA BP10GB_GPIO4
|
||||
|
||||
#define BP10GB_MCLK_SET BP10GB_GPIO5_SET
|
||||
#define BP10GB_MDIO_SET BP10GB_GPIO4_SET
|
||||
|
||||
#define BP10GB_MCLK_CLR BP10GB_GPIO5_CLR
|
||||
#define BP10GB_MDIO_CLR BP10GB_GPIO4_CLR
|
||||
|
||||
#define BP10GB_WRITE_REG(a, reg, value) \
|
||||
(writel((value), (void *)(((a)->mem_map) + BP10GB_##reg)))
|
||||
|
||||
#define BP10GB_READ_REG(a, reg) ( \
|
||||
readl((void *)((a)->mem_map) + BP10GB_##reg))
|
||||
|
||||
#endif
|
||||
|
||||
int bp_proc_create(void);
|
1351
drivers/staging/silicom/bp_proc.c
Normal file
1351
drivers/staging/silicom/bp_proc.c
Normal file
File diff suppressed because it is too large
Load diff
202
drivers/staging/silicom/bypass.h
Normal file
202
drivers/staging/silicom/bypass.h
Normal file
|
@ -0,0 +1,202 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* Bypass Control utility, Copyright (c) 2005 Silicom */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef BYPASS_H
|
||||
#define BYPASS_H
|
||||
|
||||
/* Bypass related */
|
||||
|
||||
#define SYNC_CMD_VAL 2 /* 10b */
|
||||
#define SYNC_CMD_LEN 2
|
||||
|
||||
#define WR_CMD_VAL 2 /* 10b */
|
||||
#define WR_CMD_LEN 2
|
||||
|
||||
#define RD_CMD_VAL 1 /* 10b */
|
||||
#define RD_CMD_LEN 2
|
||||
|
||||
#define ADDR_CMD_LEN 4
|
||||
|
||||
#define WR_DATA_LEN 8
|
||||
#define RD_DATA_LEN 8
|
||||
|
||||
#define PIC_SIGN_REG_ADDR 0x7
|
||||
#define PIC_SIGN_VALUE 0xcd
|
||||
|
||||
#define STATUS_REG_ADDR 0
|
||||
#define WDT_EN_MASK 0x01 //BIT_0
|
||||
#define CMND_EN_MASK 0x02 //BIT_1
|
||||
#define DIS_BYPASS_CAP_MASK 0x04 //BIT_2 /* Bypass Cap is disable*/
|
||||
#define DFLT_PWRON_MASK 0x08 //BIT_3
|
||||
#define BYPASS_OFF_MASK 0x10 //BIT_4
|
||||
#define BYPASS_FLAG_MASK 0x20 //BIT_5
|
||||
#define STD_NIC_MASK (DIS_BYPASS_CAP_MASK | BYPASS_OFF_MASK | DFLT_PWRON_MASK)
|
||||
#define WD_EXP_FLAG_MASK 0x40 //BIT_6
|
||||
#define DFLT_PWROFF_MASK 0x80 //BIT_7
|
||||
#define STD_NIC_PWOFF_MASK (DIS_BYPASS_CAP_MASK | BYPASS_OFF_MASK | DFLT_PWRON_MASK | DFLT_PWROFF_MASK)
|
||||
|
||||
#define PRODUCT_CAP_REG_ADDR 0x5
|
||||
#define BYPASS_SUPPORT_MASK 0x01 //BIT_0
|
||||
#define TAP_SUPPORT_MASK 0x02 //BIT_1
|
||||
#define NORMAL_UNSUPPORT_MASK 0x04 /*BIT_2 */
|
||||
#define DISC_SUPPORT_MASK 0x08 //BIT_3
|
||||
#define TPL2_SUPPORT_MASK 0x10 //BIT_4
|
||||
#define DISC_PORT_SUPPORT_MASK 0x20 //BIT_5
|
||||
|
||||
#define STATUS_TAP_REG_ADDR 0x6
|
||||
#define WDTE_TAP_BPN_MASK 0x01 //BIT_1 /* 1 when wdt expired -> TAP, 0 - Bypass */
|
||||
#define DIS_TAP_CAP_MASK 0x04 //BIT_2 /* TAP Cap is disable*/
|
||||
#define DFLT_PWRON_TAP_MASK 0x08 //BIT_3
|
||||
#define TAP_OFF_MASK 0x10 //BIT_4
|
||||
#define TAP_FLAG_MASK 0x20 //BIT_5
|
||||
#define TX_DISA_MASK 0x40
|
||||
#define TX_DISB_MASK 0x80
|
||||
|
||||
#define STD_NIC_TAP_MASK (DIS_TAP_CAP_MASK | TAP_OFF_MASK | DFLT_PWRON_TAP_MASK)
|
||||
|
||||
#define STATUS_DISC_REG_ADDR 13
|
||||
#define WDTE_DISC_BPN_MASK 0x01 //BIT_0 /* 1 when wdt expired -> TAP, 0 - Bypass */
|
||||
#define STD_NIC_ON_MASK 0x02 //BIT_1
|
||||
#define DIS_DISC_CAP_MASK 0x04 //BIT_2 /* TAP Cap is disable*/
|
||||
#define DFLT_PWRON_DISC_MASK 0x08 //BIT_3
|
||||
#define DISC_OFF_MASK 0x10 //BIT_4
|
||||
#define DISC_FLAG_MASK 0x20 //BIT_5
|
||||
#define TPL2_FLAG_MASK 0x40 //BIT_6
|
||||
#define STD_NIC_DISC_MASK DIS_DISC_CAP_MASK
|
||||
|
||||
#define CONT_CONFIG_REG_ADDR 12
|
||||
#define EN_HW_RESET_MASK 0x2 /* BIT_1 */
|
||||
#define WAIT_AT_PWUP_MASK 0x1 /* BIT_0 */
|
||||
|
||||
#define VER_REG_ADDR 0x1
|
||||
#define BP_FW_VER_A0 0xa0
|
||||
#define BP_FW_VER_A1 0xa1
|
||||
|
||||
#define INT_VER_MASK 0xf0
|
||||
#define EXT_VER_MASK 0xf
|
||||
/* */
|
||||
#define PXG2BPI_VER 0x0
|
||||
#define PXG2TBPI_VER 0x1
|
||||
#define PXE2TBPI_VER 0x2
|
||||
#define PXG4BPFI_VER 0x4
|
||||
#define BP_FW_EXT_VER7 0x6
|
||||
#define BP_FW_EXT_VER8 0x8
|
||||
#define BP_FW_EXT_VER9 0x9
|
||||
|
||||
#define OLD_IF_VER -1
|
||||
|
||||
#define CMND_REG_ADDR 10 /* 1010b */
|
||||
#define WDT_REG_ADDR 4
|
||||
#define TMRL_REG_ADDR 2
|
||||
#define TMRH_REG_ADDR 3
|
||||
|
||||
/* NEW_FW */
|
||||
#define WDT_INTERVAL 1 //5 //8
|
||||
#define WDT_CMND_INTERVAL 200 //50
|
||||
#define CMND_INTERVAL 200 //100 /* usec */
|
||||
#define PULSE_TIME 100
|
||||
|
||||
/* OLD_FW */
|
||||
#define INIT_CMND_INTERVAL 40
|
||||
#define PULSE_INTERVAL 5
|
||||
#define WDT_TIME_CNT 3
|
||||
|
||||
/* Intel Commands */
|
||||
|
||||
#define CMND_OFF_INT 0xf
|
||||
#define PWROFF_BYPASS_ON_INT 0x5
|
||||
#define BYPASS_ON_INT 0x6
|
||||
#define DIS_BYPASS_CAP_INT 0x4
|
||||
#define RESET_WDT_INT 0x1
|
||||
|
||||
/* Intel timing */
|
||||
|
||||
#define BYPASS_DELAY_INT 4 /* msec */
|
||||
#define CMND_INTERVAL_INT 2 /* msec */
|
||||
|
||||
/* Silicom Commands */
|
||||
#define CMND_ON 0x4
|
||||
#define CMND_OFF 0x2
|
||||
#define BYPASS_ON 0xa
|
||||
#define BYPASS_OFF 0x8
|
||||
#define PORT_LINK_EN 0xe
|
||||
#define PORT_LINK_DIS 0xc
|
||||
#define WDT_ON 0x10 /* 0x1f (11111) - max */
|
||||
#define TIMEOUT_UNIT 100
|
||||
#define TIMEOUT_MAX_STEP 15
|
||||
#define WDT_TIMEOUT_MIN 100 /* msec */
|
||||
#define WDT_TIMEOUT_MAX 3276800 /* msec */
|
||||
#define WDT_AUTO_MIN_INT 500
|
||||
#define WDT_TIMEOUT_DEF WDT_TIMEOUT_MIN
|
||||
#define WDT_OFF 0x6
|
||||
#define WDT_RELOAD 0x9
|
||||
#define RESET_CONT 0x20
|
||||
#define DIS_BYPASS_CAP 0x22
|
||||
#define EN_BYPASS_CAP 0x24
|
||||
#define BYPASS_STATE_PWRON 0x26
|
||||
#define NORMAL_STATE_PWRON 0x28
|
||||
#define BYPASS_STATE_PWROFF 0x27
|
||||
#define NORMAL_STATE_PWROFF 0x29
|
||||
#define TAP_ON 0xb
|
||||
#define TAP_OFF 0x9
|
||||
#define TAP_STATE_PWRON 0x2a
|
||||
#define DIS_TAP_CAP 0x2c
|
||||
#define EN_TAP_CAP 0x2e
|
||||
#define STD_NIC_OFF 0x86
|
||||
#define STD_NIC_ON 0x84
|
||||
#define DISC_ON 0x85
|
||||
#define DISC_OFF 0x8a
|
||||
#define DISC_STATE_PWRON 0x87
|
||||
#define DIS_DISC_CAP 0x88
|
||||
#define EN_DISC_CAP 0x89
|
||||
#define TPL2_ON 0x8c
|
||||
#define TPL2_OFF 0x8b
|
||||
#define BP_WAIT_AT_PWUP_EN 0x80
|
||||
#define BP_WAIT_AT_PWUP_DIS 0x81
|
||||
#define BP_HW_RESET_EN 0x82
|
||||
#define BP_HW_RESET_DIS 0x83
|
||||
|
||||
#define TX_DISA 0x8d
|
||||
#define TX_DISB 0x8e
|
||||
#define TX_ENA 0xA0
|
||||
#define TX_ENB 0xA1
|
||||
|
||||
#define TX_DISA_PWRUP 0xA2
|
||||
#define TX_DISB_PWRUP 0xA3
|
||||
#define TX_ENA_PWRUP 0xA4
|
||||
#define TX_ENB_PWRUP 0xA5
|
||||
|
||||
#define BYPASS_CAP_DELAY 21 /* msec */
|
||||
#define DFLT_PWRON_DELAY 10 /* msec */
|
||||
#define LATCH_DELAY 13 /* msec */
|
||||
#define EEPROM_WR_DELAY 8 /* msec */
|
||||
|
||||
#define BP_LINK_MON_DELAY 4 /* sec */
|
||||
|
||||
#define BP_FW_EXT_VER0 0xa0
|
||||
#define BP_FW_EXT_VER1 0xa1
|
||||
#define BP_FW_EXT_VER2 0xb1
|
||||
|
||||
#define BP_OK 0
|
||||
#define BP_NOT_CAP -1
|
||||
#define WDT_STATUS_EXP -2
|
||||
#define WDT_STATUS_UNKNOWN -1
|
||||
#define WDT_STATUS_EN 1
|
||||
#define WDT_STATUS_DIS 0
|
||||
|
||||
#ifdef BP_SELF_TEST
|
||||
#define ETH_P_BPTEST 0xabba
|
||||
|
||||
#define BPTEST_DATA_LEN 60
|
||||
#endif
|
||||
|
||||
#endif /* BYPASS_H */
|
6
drivers/staging/silicom/bypasslib/Makefile
Normal file
6
drivers/staging/silicom/bypasslib/Makefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
#
|
||||
# Makefile for the Bypass network device drivers.
|
||||
#
|
||||
|
||||
obj-$(CONFIG_SBYPASS) += bypass.o
|
||||
|
199
drivers/staging/silicom/bypasslib/bp_ioctl.h
Normal file
199
drivers/staging/silicom/bypasslib/bp_ioctl.h
Normal file
|
@ -0,0 +1,199 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* bypass library, Copyright (c) 2004-2006 Silicom, Ltd */
|
||||
/* Corporation. */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifndef BP_IOCTL_H
|
||||
#define BP_IOCTL_H
|
||||
|
||||
#define BP_CAP 0x01 //BIT_0
|
||||
#define BP_STATUS_CAP 0x02 //BIT_1
|
||||
#define BP_STATUS_CHANGE_CAP 0x04 //BIT_2
|
||||
#define SW_CTL_CAP 0x08 //BIT_3
|
||||
#define BP_DIS_CAP 0x10 //BIT_4
|
||||
#define BP_DIS_STATUS_CAP 0x20 //BIT_5
|
||||
#define STD_NIC_CAP 0x40 //BIT_6
|
||||
#define BP_PWOFF_ON_CAP 0x80 //BIT_7
|
||||
#define BP_PWOFF_OFF_CAP 0x0100 //BIT_8
|
||||
#define BP_PWOFF_CTL_CAP 0x0200 //BIT_9
|
||||
#define BP_PWUP_ON_CAP 0x0400 //BIT_10
|
||||
#define BP_PWUP_OFF_CAP 0x0800 //BIT_11
|
||||
#define BP_PWUP_CTL_CAP 0x1000 //BIT_12
|
||||
#define WD_CTL_CAP 0x2000 //BIT_13
|
||||
#define WD_STATUS_CAP 0x4000 //BIT_14
|
||||
#define WD_TIMEOUT_CAP 0x8000 //BIT_15
|
||||
#define TX_CTL_CAP 0x10000 //BIT_16
|
||||
#define TX_STATUS_CAP 0x20000 //BIT_17
|
||||
#define TAP_CAP 0x40000 //BIT_18
|
||||
#define TAP_STATUS_CAP 0x80000 //BIT_19
|
||||
#define TAP_STATUS_CHANGE_CAP 0x100000 //BIT_20
|
||||
#define TAP_DIS_CAP 0x200000 //BIT_21
|
||||
#define TAP_DIS_STATUS_CAP 0x400000 //BIT_22
|
||||
#define TAP_PWUP_ON_CAP 0x800000 //BIT_23
|
||||
#define TAP_PWUP_OFF_CAP 0x1000000 //BIT 24
|
||||
#define TAP_PWUP_CTL_CAP 0x2000000 //BIT 25
|
||||
#define NIC_CAP_NEG 0x4000000 //BIT 26
|
||||
#define TPL_CAP 0x8000000 //BIT 27
|
||||
#define DISC_CAP 0x10000000 //BIT 28
|
||||
#define DISC_DIS_CAP 0x20000000 //BIT 29
|
||||
#define DISC_PWUP_CTL_CAP 0x40000000 //BIT 30
|
||||
|
||||
#define WD_MIN_TIME_MASK(val) (val & 0xf)
|
||||
#define WD_STEP_COUNT_MASK(val) ((val & 0xf) << 5)
|
||||
#define WDT_STEP_TIME 0x10 //BIT_4
|
||||
|
||||
#define WD_MIN_TIME_GET(desc) (desc & 0xf)
|
||||
#define WD_STEP_COUNT_GET(desc) (desc>>5) & 0xf
|
||||
|
||||
typedef enum {
|
||||
IS_BYPASS = 1,
|
||||
GET_BYPASS_SLAVE,
|
||||
GET_BYPASS_CAPS,
|
||||
GET_WD_SET_CAPS,
|
||||
SET_BYPASS,
|
||||
GET_BYPASS,
|
||||
GET_BYPASS_CHANGE,
|
||||
SET_BYPASS_WD,
|
||||
GET_BYPASS_WD,
|
||||
GET_WD_EXPIRE_TIME,
|
||||
RESET_BYPASS_WD_TIMER,
|
||||
SET_DIS_BYPASS,
|
||||
GET_DIS_BYPASS,
|
||||
SET_BYPASS_PWOFF,
|
||||
GET_BYPASS_PWOFF,
|
||||
SET_BYPASS_PWUP,
|
||||
GET_BYPASS_PWUP,
|
||||
SET_STD_NIC,
|
||||
GET_STD_NIC,
|
||||
SET_TX,
|
||||
GET_TX,
|
||||
SET_TAP,
|
||||
GET_TAP,
|
||||
GET_TAP_CHANGE,
|
||||
SET_DIS_TAP,
|
||||
GET_DIS_TAP,
|
||||
SET_TAP_PWUP,
|
||||
GET_TAP_PWUP,
|
||||
SET_WD_EXP_MODE,
|
||||
GET_WD_EXP_MODE,
|
||||
SET_WD_AUTORESET,
|
||||
GET_WD_AUTORESET,
|
||||
SET_TPL,
|
||||
GET_TPL,
|
||||
SET_DISC,
|
||||
GET_DISC,
|
||||
GET_DISC_CHANGE,
|
||||
SET_DIS_DISC,
|
||||
GET_DIS_DISC,
|
||||
SET_DISC_PWUP,
|
||||
GET_DISC_PWUP,
|
||||
|
||||
GET_BYPASS_INFO = 100,
|
||||
GET_BP_WAIT_AT_PWUP,
|
||||
SET_BP_WAIT_AT_PWUP,
|
||||
GET_BP_HW_RESET,
|
||||
SET_BP_HW_RESET,
|
||||
} CMND_TYPE;
|
||||
|
||||
typedef enum {
|
||||
IF_SCAN_SD,
|
||||
GET_DEV_NUM_SD,
|
||||
IS_BYPASS_SD,
|
||||
GET_BYPASS_SLAVE_SD,
|
||||
GET_BYPASS_CAPS_SD,
|
||||
GET_WD_SET_CAPS_SD,
|
||||
SET_BYPASS_SD,
|
||||
GET_BYPASS_SD,
|
||||
GET_BYPASS_CHANGE_SD,
|
||||
SET_BYPASS_WD_SD,
|
||||
GET_BYPASS_WD_SD,
|
||||
GET_WD_EXPIRE_TIME_SD,
|
||||
RESET_BYPASS_WD_TIMER_SD,
|
||||
SET_DIS_BYPASS_SD,
|
||||
GET_DIS_BYPASS_SD,
|
||||
SET_BYPASS_PWOFF_SD,
|
||||
GET_BYPASS_PWOFF_SD,
|
||||
SET_BYPASS_PWUP_SD,
|
||||
GET_BYPASS_PWUP_SD,
|
||||
SET_STD_NIC_SD,
|
||||
GET_STD_NIC_SD,
|
||||
SET_TX_SD,
|
||||
GET_TX_SD,
|
||||
SET_TAP_SD,
|
||||
GET_TAP_SD,
|
||||
GET_TAP_CHANGE_SD,
|
||||
SET_DIS_TAP_SD,
|
||||
GET_DIS_TAP_SD,
|
||||
SET_TAP_PWUP_SD,
|
||||
GET_TAP_PWUP_SD,
|
||||
SET_WD_EXP_MODE_SD,
|
||||
GET_WD_EXP_MODE_SD,
|
||||
SET_WD_AUTORESET_SD,
|
||||
GET_WD_AUTORESET_SD,
|
||||
SET_TPL_SD,
|
||||
GET_TPL_SD,
|
||||
SET_DISC_SD,
|
||||
GET_DISC_SD,
|
||||
GET_DISC_CHANGE_SD,
|
||||
SET_DIS_DISC_SD,
|
||||
GET_DIS_DISC_SD,
|
||||
SET_DISC_PWUP_SD,
|
||||
GET_DISC_PWUP_SD,
|
||||
|
||||
GET_BYPASS_INFO_SD = 100,
|
||||
GET_BP_WAIT_AT_PWUP_SD,
|
||||
SET_BP_WAIT_AT_PWUP_SD,
|
||||
GET_BP_HW_RESET_SD,
|
||||
SET_BP_HW_RESET_SD,
|
||||
|
||||
} CMND_TYPE_SD;
|
||||
|
||||
#define SIOCGIFBYPASS SIOCDEVPRIVATE+10
|
||||
|
||||
struct bp_info {
|
||||
char prod_name[14];
|
||||
unsigned char fw_ver;
|
||||
};
|
||||
|
||||
/* for passing single values */
|
||||
struct if_bypass {
|
||||
char if_name[IFNAMSIZ];
|
||||
int cmd;
|
||||
int data;
|
||||
};
|
||||
struct if_bypass_info {
|
||||
char if_name[IFNAMSIZ];
|
||||
char cmd;
|
||||
struct bp_info bp_info;
|
||||
};
|
||||
|
||||
/*
|
||||
* The major device number. We can't rely on dynamic
|
||||
* registration any more, because ioctls need to know
|
||||
* it.
|
||||
*/
|
||||
|
||||
#define MAGIC_NUM 'J'
|
||||
|
||||
/* for passing single values */
|
||||
struct bpctl_cmd {
|
||||
int status;
|
||||
int data[8];
|
||||
int in_param[8];
|
||||
int out_param[8];
|
||||
};
|
||||
|
||||
#define IOCTL_TX_MSG(cmd) _IOWR(MAGIC_NUM, cmd, struct bpctl_cmd)
|
||||
|
||||
#define DEVICE_NODE "/dev/bpctl0"
|
||||
#define DEVICE_NAME "bpctl"
|
||||
|
||||
#endif
|
47
drivers/staging/silicom/bypasslib/bplibk.h
Normal file
47
drivers/staging/silicom/bypasslib/bplibk.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* bypass library, Copyright (c) 2004 Silicom, Ltd */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* */
|
||||
/* bplib.h */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
#ifndef BYPASS_H
|
||||
#define BYPASS_H
|
||||
|
||||
#include "bp_ioctl.h"
|
||||
#include "libbp_sd.h"
|
||||
|
||||
#define IF_NAME "eth"
|
||||
#define SILICOM_VID 0x1374
|
||||
#define SILICOM_BP_PID_MIN 0x24
|
||||
#define SILICOM_BP_PID_MAX 0x5f
|
||||
#define INTEL_PEG4BPII_PID 0x10a0
|
||||
#define INTEL_PEG4BPFII_PID 0x10a1
|
||||
|
||||
#define PEGII_IF_SERIES(vid, pid) \
|
||||
((vid==0x8086)&& \
|
||||
((pid==INTEL_PEG4BPII_PID)|| \
|
||||
(pid==INTEL_PEG4BPFII_PID)))
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
|
||||
#define pci_get_class pci_find_class
|
||||
|
||||
#define pci_get_device pci_find_device
|
||||
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
|
||||
#define EXPORT_SYMBOL_NOVERS EXPORT_SYMBOL
|
||||
#endif
|
||||
|
||||
#ifdef BP_VENDOR_SUPPORT
|
||||
char *bp_desc_array[] =
|
||||
{ "e1000bp", "e1000bpe", "slcm5700", "bnx2xbp", "ixgbp", "ixgbpe", NULL };
|
||||
#endif
|
||||
|
||||
#endif
|
529
drivers/staging/silicom/bypasslib/bypass.c
Normal file
529
drivers/staging/silicom/bypasslib/bypass.c
Normal file
|
@ -0,0 +1,529 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* bypass library, Copyright (c) 2004-2007 Silicom, Ltd */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* */
|
||||
/* bypass.c */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#include <linux/version.h>
|
||||
#if defined(CONFIG_SMP) && ! defined(__SMP__)
|
||||
#define __SMP__
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
#include <linux/netdevice.h> // struct device, and other headers
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/ethtool.h>
|
||||
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include "bplibk.h"
|
||||
|
||||
#define MOD_NAME "bypass"
|
||||
|
||||
#define VERSION "\n"MOD_NAME" version 9.0.4\n"
|
||||
|
||||
MODULE_AUTHOR("www.silicom.co.il");
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
int init_lib_module(void);
|
||||
void cleanup_lib_module(void);
|
||||
|
||||
static int do_cmd(struct net_device *dev, struct ifreq *ifr, int cmd, int *data)
|
||||
{
|
||||
int ret = -1;
|
||||
struct if_bypass *bypass_cb;
|
||||
static int (*ioctl) (struct net_device *, struct ifreq *, int);
|
||||
|
||||
bypass_cb = (struct if_bypass *)ifr;
|
||||
bypass_cb->cmd = cmd;
|
||||
bypass_cb->data = *data;
|
||||
if ((dev->netdev_ops) && (ioctl = dev->netdev_ops->ndo_do_ioctl)) {
|
||||
ret = ioctl(dev, ifr, SIOCGIFBYPASS);
|
||||
*data = bypass_cb->data;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int doit(int cmd, int if_index, int *data)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
int ret = -1;
|
||||
struct net_device *dev;
|
||||
struct net_device *n;
|
||||
for_each_netdev_safe(&init_net, dev, n) {
|
||||
|
||||
if (dev->ifindex == if_index) {
|
||||
ret = do_cmd(dev, &ifr, cmd, data);
|
||||
if (ret < 0)
|
||||
ret = -1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define bp_symbol_get(fn_name) symbol_get(fn_name)
|
||||
#define bp_symbol_put(fn_name) symbol_put(fn_name)
|
||||
|
||||
#define SET_BPLIB_INT_FN(fn_name, arg_type, arg, ret) \
|
||||
({ int (* fn_ex)(arg_type)=NULL; \
|
||||
fn_ex=bp_symbol_get(fn_name##_sd); \
|
||||
if(fn_ex) { \
|
||||
ret= fn_ex(arg); \
|
||||
bp_symbol_put(fn_name##_sd); \
|
||||
} else ret=-1; \
|
||||
})
|
||||
|
||||
#define SET_BPLIB_INT_FN2(fn_name, arg_type, arg, arg_type1, arg1, ret) \
|
||||
({ int (* fn_ex)(arg_type,arg_type1)=NULL; \
|
||||
fn_ex=bp_symbol_get(fn_name##_sd); \
|
||||
if(fn_ex) { \
|
||||
ret= fn_ex(arg,arg1); \
|
||||
bp_symbol_put(fn_name##_sd); \
|
||||
} else ret=-1; \
|
||||
})
|
||||
#define SET_BPLIB_INT_FN3(fn_name, arg_type, arg, arg_type1, arg1,arg_type2, arg2, ret) \
|
||||
({ int (* fn_ex)(arg_type,arg_type1, arg_type2)=NULL; \
|
||||
fn_ex=bp_symbol_get(fn_name##_sd); \
|
||||
if(fn_ex) { \
|
||||
ret= fn_ex(arg,arg1,arg2); \
|
||||
bp_symbol_put(fn_name##_sd); \
|
||||
} else ret=-1; \
|
||||
})
|
||||
|
||||
#define DO_BPLIB_GET_ARG_FN(fn_name,ioctl_val, if_index) \
|
||||
({ int data, ret=0; \
|
||||
if(is_dev_sd(if_index)){ \
|
||||
SET_BPLIB_INT_FN(fn_name, int, if_index, ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return doit(ioctl_val,if_index, &data); \
|
||||
})
|
||||
|
||||
#define DO_BPLIB_SET_ARG_FN(fn_name,ioctl_val,if_index,arg) \
|
||||
({ int data, ret=0; \
|
||||
if(is_dev_sd(if_index)){ \
|
||||
SET_BPLIB_INT_FN2(fn_name, int, if_index, int, arg, ret); \
|
||||
return ret; \
|
||||
} \
|
||||
data=arg; \
|
||||
return doit(ioctl_val,if_index, &data); \
|
||||
})
|
||||
|
||||
static int is_dev_sd(int if_index)
|
||||
{
|
||||
int ret = 0;
|
||||
SET_BPLIB_INT_FN(is_bypass, int, if_index, ret);
|
||||
return (ret >= 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
int is_bypass_dev(int if_index)
|
||||
{
|
||||
struct pci_dev *pdev = NULL;
|
||||
struct net_device *dev = NULL;
|
||||
struct ifreq ifr;
|
||||
int ret = 0, data = 0;
|
||||
|
||||
while ((pdev = pci_get_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) {
|
||||
if ((dev = pci_get_drvdata(pdev)) != NULL)
|
||||
if (((dev = pci_get_drvdata(pdev)) != NULL) &&
|
||||
(dev->ifindex == if_index)) {
|
||||
if ((pdev->vendor == SILICOM_VID) &&
|
||||
(pdev->device >= SILICOM_BP_PID_MIN) &&
|
||||
(pdev->device <= SILICOM_BP_PID_MAX))
|
||||
goto send_cmd;
|
||||
#if defined(BP_VENDOR_SUPPORT) && defined(ETHTOOL_GDRVINFO)
|
||||
else {
|
||||
struct ethtool_drvinfo info;
|
||||
const struct ethtool_ops *ops =
|
||||
dev->ethtool_ops;
|
||||
int k = 0;
|
||||
|
||||
if (ops->get_drvinfo) {
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.cmd = ETHTOOL_GDRVINFO;
|
||||
ops->get_drvinfo(dev, &info);
|
||||
for (; bp_desc_array[k]; k++)
|
||||
if (!
|
||||
(strcmp
|
||||
(bp_desc_array[k],
|
||||
info.driver)))
|
||||
goto send_cmd;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
send_cmd:
|
||||
ret = do_cmd(dev, &ifr, IS_BYPASS, &data);
|
||||
return (ret < 0 ? -1 : ret);
|
||||
}
|
||||
|
||||
int is_bypass(int if_index)
|
||||
{
|
||||
int ret = 0;
|
||||
SET_BPLIB_INT_FN(is_bypass, int, if_index, ret);
|
||||
|
||||
if (ret < 0)
|
||||
return is_bypass_dev(if_index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_bypass_slave(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bypass_slave, GET_BYPASS_SLAVE, if_index);
|
||||
}
|
||||
|
||||
int get_bypass_caps(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bypass_caps, GET_BYPASS_CAPS, if_index);
|
||||
}
|
||||
|
||||
int get_wd_set_caps(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_wd_set_caps, GET_WD_SET_CAPS, if_index);
|
||||
}
|
||||
|
||||
int set_bypass(int if_index, int bypass_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_bypass, SET_BYPASS, if_index, bypass_mode);
|
||||
}
|
||||
|
||||
int get_bypass(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bypass, GET_BYPASS, if_index);
|
||||
}
|
||||
|
||||
int get_bypass_change(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bypass_change, GET_BYPASS_CHANGE, if_index);
|
||||
}
|
||||
|
||||
int set_dis_bypass(int if_index, int dis_bypass)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_dis_bypass, SET_DIS_BYPASS, if_index,
|
||||
dis_bypass);
|
||||
}
|
||||
|
||||
int get_dis_bypass(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_dis_bypass, GET_DIS_BYPASS, if_index);
|
||||
}
|
||||
|
||||
int set_bypass_pwoff(int if_index, int bypass_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_bypass_pwoff, SET_BYPASS_PWOFF, if_index,
|
||||
bypass_mode);
|
||||
}
|
||||
|
||||
int get_bypass_pwoff(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bypass_pwoff, GET_BYPASS_PWOFF, if_index);
|
||||
}
|
||||
|
||||
int set_bypass_pwup(int if_index, int bypass_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_bypass_pwup, SET_BYPASS_PWUP, if_index,
|
||||
bypass_mode);
|
||||
}
|
||||
|
||||
int get_bypass_pwup(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bypass_pwup, GET_BYPASS_PWUP, if_index);
|
||||
}
|
||||
|
||||
int set_bypass_wd(int if_index, int ms_timeout, int *ms_timeout_set)
|
||||
{
|
||||
int data = ms_timeout, ret = 0;
|
||||
if (is_dev_sd(if_index))
|
||||
SET_BPLIB_INT_FN3(set_bypass_wd, int, if_index, int, ms_timeout,
|
||||
int *, ms_timeout_set, ret);
|
||||
else {
|
||||
ret = doit(SET_BYPASS_WD, if_index, &data);
|
||||
if (ret > 0) {
|
||||
*ms_timeout_set = ret;
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_bypass_wd(int if_index, int *ms_timeout_set)
|
||||
{
|
||||
int *data = ms_timeout_set, ret = 0;
|
||||
if (is_dev_sd(if_index))
|
||||
SET_BPLIB_INT_FN2(get_bypass_wd, int, if_index, int *,
|
||||
ms_timeout_set, ret);
|
||||
else
|
||||
ret = doit(GET_BYPASS_WD, if_index, data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int get_wd_expire_time(int if_index, int *ms_time_left)
|
||||
{
|
||||
int *data = ms_time_left, ret = 0;
|
||||
if (is_dev_sd(if_index))
|
||||
SET_BPLIB_INT_FN2(get_wd_expire_time, int, if_index, int *,
|
||||
ms_time_left, ret);
|
||||
else {
|
||||
ret = doit(GET_WD_EXPIRE_TIME, if_index, data);
|
||||
if ((ret == 0) && (*data != 0))
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int reset_bypass_wd_timer(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(reset_bypass_wd_timer, RESET_BYPASS_WD_TIMER,
|
||||
if_index);
|
||||
}
|
||||
|
||||
int set_std_nic(int if_index, int bypass_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_std_nic, SET_STD_NIC, if_index, bypass_mode);
|
||||
}
|
||||
|
||||
int get_std_nic(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_std_nic, GET_STD_NIC, if_index);
|
||||
}
|
||||
|
||||
int set_tx(int if_index, int tx_state)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_tx, SET_TX, if_index, tx_state);
|
||||
}
|
||||
|
||||
int get_tx(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_tx, GET_TX, if_index);
|
||||
}
|
||||
|
||||
int set_tap(int if_index, int tap_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_tap, SET_TAP, if_index, tap_mode);
|
||||
}
|
||||
|
||||
int get_tap(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_tap, GET_TAP, if_index);
|
||||
}
|
||||
|
||||
int get_tap_change(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_tap_change, GET_TAP_CHANGE, if_index);
|
||||
}
|
||||
|
||||
int set_dis_tap(int if_index, int dis_tap)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_dis_tap, SET_DIS_TAP, if_index, dis_tap);
|
||||
}
|
||||
|
||||
int get_dis_tap(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_dis_tap, GET_DIS_TAP, if_index);
|
||||
}
|
||||
|
||||
int set_tap_pwup(int if_index, int tap_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_tap_pwup, SET_TAP_PWUP, if_index, tap_mode);
|
||||
}
|
||||
|
||||
int get_tap_pwup(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_tap_pwup, GET_TAP_PWUP, if_index);
|
||||
}
|
||||
|
||||
int set_bp_disc(int if_index, int disc_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_bp_disc, SET_DISC, if_index, disc_mode);
|
||||
}
|
||||
|
||||
int get_bp_disc(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bp_disc, GET_DISC, if_index);
|
||||
}
|
||||
|
||||
int get_bp_disc_change(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bp_disc_change, GET_DISC_CHANGE, if_index);
|
||||
}
|
||||
|
||||
int set_bp_dis_disc(int if_index, int dis_disc)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_bp_dis_disc, SET_DIS_DISC, if_index, dis_disc);
|
||||
}
|
||||
|
||||
int get_bp_dis_disc(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bp_dis_disc, GET_DIS_DISC, if_index);
|
||||
}
|
||||
|
||||
int set_bp_disc_pwup(int if_index, int disc_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_bp_disc_pwup, SET_DISC_PWUP, if_index,
|
||||
disc_mode);
|
||||
}
|
||||
|
||||
int get_bp_disc_pwup(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_bp_disc_pwup, GET_DISC_PWUP, if_index);
|
||||
}
|
||||
|
||||
int set_wd_exp_mode(int if_index, int mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_wd_exp_mode, SET_WD_EXP_MODE, if_index, mode);
|
||||
}
|
||||
|
||||
int get_wd_exp_mode(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_wd_exp_mode, GET_WD_EXP_MODE, if_index);
|
||||
}
|
||||
|
||||
int set_wd_autoreset(int if_index, int time)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_wd_autoreset, SET_WD_AUTORESET, if_index, time);
|
||||
}
|
||||
|
||||
int get_wd_autoreset(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_wd_autoreset, GET_WD_AUTORESET, if_index);
|
||||
}
|
||||
|
||||
int set_tpl(int if_index, int tpl_mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_tpl, SET_TPL, if_index, tpl_mode);
|
||||
}
|
||||
|
||||
int get_tpl(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_tpl, GET_TPL, if_index);
|
||||
}
|
||||
|
||||
int set_bp_hw_reset(int if_index, int mode)
|
||||
{
|
||||
DO_BPLIB_SET_ARG_FN(set_tpl, SET_BP_HW_RESET, if_index, mode);
|
||||
}
|
||||
|
||||
int get_bp_hw_reset(int if_index)
|
||||
{
|
||||
DO_BPLIB_GET_ARG_FN(get_tpl, GET_BP_HW_RESET, if_index);
|
||||
}
|
||||
|
||||
int get_bypass_info(int if_index, struct bp_info *bp_info)
|
||||
{
|
||||
int ret = 0;
|
||||
if (is_dev_sd(if_index)) {
|
||||
SET_BPLIB_INT_FN2(get_bypass_info, int, if_index,
|
||||
struct bp_info *, bp_info, ret);
|
||||
} else {
|
||||
static int (*ioctl) (struct net_device *, struct ifreq *, int);
|
||||
struct net_device *dev;
|
||||
|
||||
struct net_device *n;
|
||||
for_each_netdev_safe(&init_net, dev, n) {
|
||||
if (dev->ifindex == if_index) {
|
||||
struct if_bypass_info *bypass_cb;
|
||||
struct ifreq ifr;
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
bypass_cb = (struct if_bypass_info *)𝔦
|
||||
bypass_cb->cmd = GET_BYPASS_INFO;
|
||||
|
||||
if ((dev->netdev_ops) &&
|
||||
(ioctl = dev->netdev_ops->ndo_do_ioctl)) {
|
||||
ret = ioctl(dev, &ifr, SIOCGIFBYPASS);
|
||||
}
|
||||
|
||||
else
|
||||
ret = -1;
|
||||
if (ret == 0)
|
||||
memcpy(bp_info, &bypass_cb->bp_info,
|
||||
sizeof(struct bp_info));
|
||||
ret = (ret < 0 ? -1 : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int init_lib_module()
|
||||
{
|
||||
|
||||
printk(VERSION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cleanup_lib_module()
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_NOVERS(is_bypass);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_slave);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_caps);
|
||||
EXPORT_SYMBOL_NOVERS(get_wd_set_caps);
|
||||
EXPORT_SYMBOL_NOVERS(set_bypass);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_change);
|
||||
EXPORT_SYMBOL_NOVERS(set_dis_bypass);
|
||||
EXPORT_SYMBOL_NOVERS(get_dis_bypass);
|
||||
EXPORT_SYMBOL_NOVERS(set_bypass_pwoff);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_pwoff);
|
||||
EXPORT_SYMBOL_NOVERS(set_bypass_pwup);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_pwup);
|
||||
EXPORT_SYMBOL_NOVERS(set_bypass_wd);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_wd);
|
||||
EXPORT_SYMBOL_NOVERS(get_wd_expire_time);
|
||||
EXPORT_SYMBOL_NOVERS(reset_bypass_wd_timer);
|
||||
EXPORT_SYMBOL_NOVERS(set_std_nic);
|
||||
EXPORT_SYMBOL_NOVERS(get_std_nic);
|
||||
EXPORT_SYMBOL_NOVERS(set_tx);
|
||||
EXPORT_SYMBOL_NOVERS(get_tx);
|
||||
EXPORT_SYMBOL_NOVERS(set_tap);
|
||||
EXPORT_SYMBOL_NOVERS(get_tap);
|
||||
EXPORT_SYMBOL_NOVERS(get_tap_change);
|
||||
EXPORT_SYMBOL_NOVERS(set_dis_tap);
|
||||
EXPORT_SYMBOL_NOVERS(get_dis_tap);
|
||||
EXPORT_SYMBOL_NOVERS(set_tap_pwup);
|
||||
EXPORT_SYMBOL_NOVERS(get_tap_pwup);
|
||||
EXPORT_SYMBOL_NOVERS(set_bp_disc);
|
||||
EXPORT_SYMBOL_NOVERS(get_bp_disc);
|
||||
EXPORT_SYMBOL_NOVERS(get_bp_disc_change);
|
||||
EXPORT_SYMBOL_NOVERS(set_bp_dis_disc);
|
||||
EXPORT_SYMBOL_NOVERS(get_bp_dis_disc);
|
||||
EXPORT_SYMBOL_NOVERS(set_bp_disc_pwup);
|
||||
EXPORT_SYMBOL_NOVERS(get_bp_disc_pwup);
|
||||
EXPORT_SYMBOL_NOVERS(set_wd_exp_mode);
|
||||
EXPORT_SYMBOL_NOVERS(get_wd_exp_mode);
|
||||
EXPORT_SYMBOL_NOVERS(set_wd_autoreset);
|
||||
EXPORT_SYMBOL_NOVERS(get_wd_autoreset);
|
||||
EXPORT_SYMBOL_NOVERS(set_tpl);
|
||||
EXPORT_SYMBOL_NOVERS(get_tpl);
|
||||
EXPORT_SYMBOL_NOVERS(set_bp_hw_reset);
|
||||
EXPORT_SYMBOL_NOVERS(get_bp_hw_reset);
|
||||
EXPORT_SYMBOL_NOVERS(get_bypass_info);
|
||||
|
||||
module_init(init_lib_module);
|
||||
module_exit(cleanup_lib_module);
|
509
drivers/staging/silicom/bypasslib/libbp_sd.h
Normal file
509
drivers/staging/silicom/bypasslib/libbp_sd.h
Normal file
|
@ -0,0 +1,509 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* bypass library, Copyright (c) 2004 Silicom, Ltd */
|
||||
/* Corporation. */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* Ver 1.0.0 */
|
||||
/* */
|
||||
/* libbypass.h */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* is_bypass - check if device is a Bypass controlling device
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
* 1 - if device is bypass controlling device,
|
||||
* 0 - if device is bypass slave device
|
||||
* -1 - device not support Bypass
|
||||
**/
|
||||
int is_bypass_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bypass_slave - get second port participate in the Bypass pair
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
* network device index of the slave device
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_bypass_slave_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bypass_caps - get second port participate in the Bypass pair
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
* flags word on success;flag word is a 32-bit mask word with each bit defines different
|
||||
* capability as described bellow.
|
||||
* Value of 1 for supporting this feature. 0 for not supporting this feature.
|
||||
* -1 - on failure (if the device is not capable of the operation or not a Bypass device)
|
||||
* Bit feature description
|
||||
*
|
||||
* 0 BP_CAP The interface is Bypass capable in general
|
||||
*
|
||||
* 1 BP_STATUS_CAP The interface can report of the current Bypass mode
|
||||
*
|
||||
* 2 BP_STATUS_CHANGE_CAP The interface can report on a change to bypass mode from
|
||||
* the last time the mode was defined
|
||||
*
|
||||
* 3 SW_CTL_CAP The interface is Software controlled capable for bypass/non bypass modes.
|
||||
*
|
||||
* 4 BP_DIS_CAP The interface is capable of disabling the Bypass mode at all times.
|
||||
* This mode will retain its mode even during power loss and also after
|
||||
* power recovery. This will overcome on any bypass operation due to
|
||||
* watchdog timeout or set bypass command.
|
||||
*
|
||||
* 5 BP_DIS_STATUS_CAP The interface can report of the current DIS_BP_CAP
|
||||
*
|
||||
* 6 STD_NIC_CAP The interface is capable to be configured to operate as standard, non Bypass,
|
||||
* NIC interface (have direct connection to interfaces at all power modes)
|
||||
*
|
||||
* 7 BP_PWOFF_NO_CAP The interface can be in Bypass mode at power off state
|
||||
*
|
||||
* 8 BP_PWOFF_OFF_CAP The interface can disconnect the Bypass mode at power off state without
|
||||
* effecting all the other states of operation
|
||||
*
|
||||
* 9 BP_PWOFF_CTL_CAP The behavior of the Bypass mode at Power-off state can be controlled by
|
||||
* software without effecting any other state
|
||||
*
|
||||
*10 BP_PWUP_ON_CAP The interface can be in Bypass mode when power is turned on
|
||||
* (until the system take control of the bypass functionality)
|
||||
*
|
||||
*11 BP_PWUP_OFF_CAP The interface can disconnect from Bypass mode when power is turned on
|
||||
* (until the system take control of the bypass functionality)
|
||||
*
|
||||
*12 BP_PWUP_CTL_CAP The behavior of the Bypass mode at Power-up can be controlled by software
|
||||
*
|
||||
*13 WD_CTL_CAP The interface has watchdog capabilities to turn to Bypass mode when not reset
|
||||
* for defined period of time.
|
||||
*
|
||||
*14 WD_STATUS_CAP The interface can report on the watchdog status (Active/inactive)
|
||||
*
|
||||
*15 WD_TIMEOUT_CAP The interface can report the time left till watchdog triggers to Bypass mode.
|
||||
*
|
||||
*16-31 RESERVED
|
||||
*
|
||||
* **/
|
||||
int get_bypass_caps_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_wd_set_caps - Obtain watchdog timer setting capabilities
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
*
|
||||
* Set of numbers defining the various parameters of the watchdog capable
|
||||
* to be set to as described bellow.
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
*
|
||||
* Bit feature description
|
||||
*
|
||||
* 0-3 WD_MIN_TIME The interface WD minimal time period in 100mS units
|
||||
*
|
||||
* 4 WD_STEP_TIME The steps of the WD timer in
|
||||
* 0 - for linear steps (WD_MIN_TIME * X)
|
||||
* 1 - for multiply by 2 from previous step (WD_MIN_TIME * 2^X)
|
||||
*
|
||||
* 5-8 WD_STEP_COUNT Number of steps the WD timer supports in 2^X
|
||||
* (X bit available for defining the value)
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
int get_wd_set_caps_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass - set Bypass state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: bypass mode (1=on, 0=off)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int set_bypass_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_bypass - Get Bypass mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_bypass_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bypass_change - Get change of Bypass mode state from last status check
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_bypass_change_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_dis_bypass - Set Disable Bypass mode
|
||||
* @if_index: network device index of the controlling device
|
||||
* @dis_bypass: disable bypass(1=dis, 0=en)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_dis_bypass_sd(int if_index, int dis_bypass);
|
||||
|
||||
/**
|
||||
* get_dis_bypass - Get Disable Bypass mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (normal Bypass mode/ Disable bypass)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_dis_bypass_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass_pwoff - Set Bypass mode at power-off state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: bypass mode setting at power off state (1=BP en, 0=BP Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bypass_pwoff_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_bypass_pwoff - Get Bypass mode state at power-off state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable bypass at power off state / normal Bypass mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bypass_pwoff_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass_pwup - Set Bypass mode at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: bypass mode setting at power up state (1=BP en, 0=BP Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bypass_pwup_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_bypass_pwup - Get Bypass mode state at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable bypass at power up state / normal Bypass mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bypass_pwup_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass_wd - Set watchdog state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @ms_timeout: requested timeout (in ms units), 0 for disabling the watchdog timer
|
||||
* @ms_timeout_set(output): requested timeout (in ms units),
|
||||
* that the adapter supports and will be used by the watchdog
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bypass_wd_sd(int if_index, int ms_timeout, int *ms_timeout_set);
|
||||
|
||||
/**
|
||||
* get_bypass_wd - Get watchdog state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @ms_timeout (output): WDT timeout (in ms units),
|
||||
* -1 for unknown wdt status
|
||||
* 0 if WDT is disabled
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bypass_wd_sd(int if_index, int *ms_timeout_set);
|
||||
|
||||
/**
|
||||
* get_wd_expire_time - Get watchdog expire
|
||||
* @if_index: network device index of the controlling device
|
||||
* @ms_time_left (output): time left till watchdog time expire,
|
||||
* -1 if WDT has expired
|
||||
* 0 if WDT is disabled
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int get_wd_expire_time_sd(int if_index, int *ms_time_left);
|
||||
|
||||
/**
|
||||
* reset_bypass_wd_timer - Reset watchdog timer
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 1 - on success
|
||||
* 0 - watchdog is not configured
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int reset_bypass_wd_timer_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_std_nic - Standard NIC mode of operation
|
||||
* @if_index: network device index of the controlling device
|
||||
* @nic_mode: 0/1 (Default Bypass mode / Standard NIC mode)
|
||||
*
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_std_nic_sd(int if_index, int nic_mode);
|
||||
|
||||
/**
|
||||
* get_std_nic - Get Standard NIC mode setting
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 0/1 (Default Bypass mode / Standard NIC mode) on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_std_nic_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tx - set transmitter enable/disable
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tx_state: 0/1 (Transmit Disable / Transmit Enable)
|
||||
*
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation )
|
||||
**/
|
||||
int set_tx_sd(int if_index, int tx_state);
|
||||
|
||||
/**
|
||||
* get_std_nic - get transmitter state (disable / enable)
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 0/1 (ransmit Disable / Transmit Enable) on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass)
|
||||
**/
|
||||
int get_tx_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tap - set TAP state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tap_mode: 1 tap mode , 0 normal nic mode
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support TAP or it's a slave device)
|
||||
**/
|
||||
int set_tap_sd(int if_index, int tap_mode);
|
||||
|
||||
/**
|
||||
* get_tap - Get TAP mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support TAP or it's a slave device)
|
||||
**/
|
||||
int get_tap_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_tap_change - Get change of TAP mode state from last status check
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support TAP or it's a slave device)
|
||||
**/
|
||||
int get_tap_change_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_dis_tap - Set Disable TAP mode
|
||||
* @if_index: network device index of the controlling device
|
||||
* @dis_tap: disable tap(1=dis, 0=en)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_dis_tap_sd(int if_index, int dis_tap);
|
||||
|
||||
/**
|
||||
* get_dis_tap - Get Disable TAP mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (normal TAP mode/ Disable TAP)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_dis_tap_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tap_pwup - Set TAP mode at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: tap mode setting at power up state (1=TAP en, 0=TAP Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_tap_pwup_sd(int if_index, int tap_mode);
|
||||
|
||||
/**
|
||||
* get_tap_pwup - Get TAP mode state at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable TAP at power up state / normal TAP mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_tap_pwup_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bp_disc - set Disconnect state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tap_mode: 1 disc mode , 0 non-disc mode
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support Disconnect or it's a slave device)
|
||||
**/
|
||||
int set_bp_disc_sd(int if_index, int disc_mode);
|
||||
|
||||
/**
|
||||
* get_bp_disc - Get Disconnect mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support Disconnect or it's a slave device)
|
||||
**/
|
||||
int get_bp_disc_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bp_disc_change - Get change of Disconnect mode state from last status check
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support Disconnect or it's a slave device)
|
||||
**/
|
||||
int get_bp_disc_change_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bp_dis_disc - Set Disable Disconnect mode
|
||||
* @if_index: network device index of the controlling device
|
||||
* @dis_tap: disable tap(1=dis, 0=en)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable ofthe operation ordevice not support Disconnect
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bp_dis_disc_sd(int if_index, int dis_disc);
|
||||
|
||||
/**
|
||||
* get_dis_tap - Get Disable Disconnect mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (normal Disconnect mode/ Disable Disconnect)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Disconnect
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bp_dis_disc_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bp_disc_pwup - Set Disconnect mode at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @disc_mode: tap mode setting at power up state (1=Disc en, 0=Disc Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Disconnect
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bp_disc_pwup_sd(int if_index, int disc_mode);
|
||||
|
||||
/**
|
||||
* get_bp_disc_pwup - Get Disconnect mode state at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable Disconnect at power up state / normal Disconnect mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bp_disc_pwup_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_wd_exp_mode - Set adapter state when WDT expired.
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: adapter mode (1=tap mode, 0=bypass mode)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int set_wd_exp_mode_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_wd_exp_mode - Get adapter state when WDT expired.
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (bypass/tap) on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_wd_exp_mode_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_wd_autoreset - reset WDT periodically.
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: adapter mode (1=tap mode, 0=bypass mode)
|
||||
* Output:
|
||||
* 1 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int set_wd_autoreset_sd(int if_index, int time);
|
||||
|
||||
/**
|
||||
* set_wd_autoreset - reset WDT periodically.
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: adapter mode (1=tap mode, 0=bypass mode)
|
||||
* Output:
|
||||
* 1 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int get_wd_autoreset_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tpl - set TPL state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tpl_mode: 1 tpl mode , 0 normal nic mode
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support TPL)
|
||||
**/
|
||||
int set_tpl_sd(int if_index, int tpl_mode);
|
||||
|
||||
/**
|
||||
* get_tpl - Get TPL mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support TPL or it's a slave device)
|
||||
**/
|
||||
int get_tpl_sd(int if_index);
|
||||
|
||||
int get_bypass_info_sd(int if_index, struct bp_info *bp_info);
|
||||
int bp_if_scan_sd(void);
|
||||
/*int get_dev_num_sd(void);*/
|
551
drivers/staging/silicom/libbp_sd.h
Normal file
551
drivers/staging/silicom/libbp_sd.h
Normal file
|
@ -0,0 +1,551 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* bypass library, Copyright (c) 2004 Silicom, Ltd */
|
||||
/* Corporation. */
|
||||
/* */
|
||||
/* 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, located in the file LICENSE. */
|
||||
/* */
|
||||
/* Ver 1.0.0 */
|
||||
/* */
|
||||
/* libbypass.h */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#define BP_CAP 0x01 //BIT_0
|
||||
#define BP_STATUS_CAP 0x02 //BIT_1
|
||||
#define BP_STATUS_CHANGE_CAP 0x04 //BIT_2
|
||||
#define SW_CTL_CAP 0x08 //BIT_3
|
||||
#define BP_DIS_CAP 0x10 //BIT_4
|
||||
#define BP_DIS_STATUS_CAP 0x20 //BIT_5
|
||||
#define STD_NIC_CAP 0x40 //BIT_6
|
||||
#define BP_PWOFF_ON_CAP 0x80 //BIT_7
|
||||
#define BP_PWOFF_OFF_CAP 0x0100 //BIT_8
|
||||
#define BP_PWOFF_CTL_CAP 0x0200 //BIT_9
|
||||
#define BP_PWUP_ON_CAP 0x0400 //BIT_10
|
||||
#define BP_PWUP_OFF_CAP 0x0800 //BIT_11
|
||||
#define BP_PWUP_CTL_CAP 0x1000 //BIT_12
|
||||
#define WD_CTL_CAP 0x2000 //BIT_13
|
||||
#define WD_STATUS_CAP 0x4000 //BIT_14
|
||||
#define WD_TIMEOUT_CAP 0x8000 //BIT_15
|
||||
#define TX_CTL_CAP 0x10000 //BIT_16
|
||||
#define TX_STATUS_CAP 0x20000 //BIT_17
|
||||
#define TAP_CAP 0x40000 //BIT_18
|
||||
#define TAP_STATUS_CAP 0x80000 //BIT_19
|
||||
#define TAP_STATUS_CHANGE_CAP 0x100000 //BIT_20
|
||||
#define TAP_DIS_CAP 0x200000 //BIT_21
|
||||
#define TAP_DIS_STATUS_CAP 0x400000 //BIT_22
|
||||
#define TAP_PWUP_ON_CAP 0x800000 //BIT_23
|
||||
#define TAP_PWUP_OFF_CAP 0x1000000 //BIT 24
|
||||
#define TAP_PWUP_CTL_CAP 0x2000000 //BIT 25
|
||||
#define NIC_CAP_NEG 0x4000000 //BIT 26
|
||||
|
||||
#define WD_MIN_TIME_GET(desc) (desc & 0xf)
|
||||
#define WD_STEP_COUNT_GET(desc) (desc>>5) & 0xf
|
||||
#define WDT_STEP_TIME 0x10
|
||||
|
||||
struct bp_info {
|
||||
char prod_name[14];
|
||||
unsigned char fw_ver;
|
||||
};
|
||||
|
||||
/**
|
||||
* is_bypass - check if device is a Bypass controlling device
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
* 1 - if device is bypass controlling device,
|
||||
* 0 - if device is bypass slave device
|
||||
* -1 - device not support Bypass
|
||||
**/
|
||||
int is_bypass_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bypass_slave - get second port participate in the Bypass pair
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
* network device index of the slave device
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_bypass_slave_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bypass_caps - get second port participate in the Bypass pair
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
* flags word on success;flag word is a 32-bit mask word with each bit defines different
|
||||
* capability as described bellow.
|
||||
* Value of 1 for supporting this feature. 0 for not supporting this feature.
|
||||
* -1 - on failure (if the device is not capable of the operation or not a Bypass device)
|
||||
* Bit feature description
|
||||
*
|
||||
* 0 BP_CAP The interface is Bypass capable in general
|
||||
*
|
||||
* 1 BP_STATUS_CAP The interface can report of the current Bypass mode
|
||||
*
|
||||
* 2 BP_STATUS_CHANGE_CAP The interface can report on a change to bypass mode from
|
||||
* the last time the mode was defined
|
||||
*
|
||||
* 3 SW_CTL_CAP The interface is Software controlled capable for bypass/non bypass modes.
|
||||
*
|
||||
* 4 BP_DIS_CAP The interface is capable of disabling the Bypass mode at all times.
|
||||
* This mode will retain its mode even during power loss and also after
|
||||
* power recovery. This will overcome on any bypass operation due to
|
||||
* watchdog timeout or set bypass command.
|
||||
*
|
||||
* 5 BP_DIS_STATUS_CAP The interface can report of the current DIS_BP_CAP
|
||||
*
|
||||
* 6 STD_NIC_CAP The interface is capable to be configured to operate as standard, non Bypass,
|
||||
* NIC interface (have direct connection to interfaces at all power modes)
|
||||
*
|
||||
* 7 BP_PWOFF_NO_CAP The interface can be in Bypass mode at power off state
|
||||
*
|
||||
* 8 BP_PWOFF_OFF_CAP The interface can disconnect the Bypass mode at power off state without
|
||||
* effecting all the other states of operation
|
||||
*
|
||||
* 9 BP_PWOFF_CTL_CAP The behavior of the Bypass mode at Power-off state can be controlled by
|
||||
* software without effecting any other state
|
||||
*
|
||||
*10 BP_PWUP_ON_CAP The interface can be in Bypass mode when power is turned on
|
||||
* (until the system take control of the bypass functionality)
|
||||
*
|
||||
*11 BP_PWUP_OFF_CAP The interface can disconnect from Bypass mode when power is turned on
|
||||
* (until the system take control of the bypass functionality)
|
||||
*
|
||||
*12 BP_PWUP_CTL_CAP The behavior of the Bypass mode at Power-up can be controlled by software
|
||||
*
|
||||
*13 WD_CTL_CAP The interface has watchdog capabilities to turn to Bypass mode when not reset
|
||||
* for defined period of time.
|
||||
*
|
||||
*14 WD_STATUS_CAP The interface can report on the watchdog status (Active/inactive)
|
||||
*
|
||||
*15 WD_TIMEOUT_CAP The interface can report the time left till watchdog triggers to Bypass mode.
|
||||
*
|
||||
*16-31 RESERVED
|
||||
*
|
||||
* **/
|
||||
int get_bypass_caps_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_wd_set_caps - Obtain watchdog timer setting capabilities
|
||||
* @if_index: network device index
|
||||
*
|
||||
* Output:
|
||||
*
|
||||
* Set of numbers defining the various parameters of the watchdog capable
|
||||
* to be set to as described bellow.
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
*
|
||||
* Bit feature description
|
||||
*
|
||||
* 0-3 WD_MIN_TIME The interface WD minimal time period in 100mS units
|
||||
*
|
||||
* 4 WD_STEP_TIME The steps of the WD timer in
|
||||
* 0 - for linear steps (WD_MIN_TIME * X)
|
||||
* 1 - for multiply by 2 from previous step (WD_MIN_TIME * 2^X)
|
||||
*
|
||||
* 5-8 WD_STEP_COUNT Number of steps the WD timer supports in 2^X
|
||||
* (X bit available for defining the value)
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
int get_wd_set_caps_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass - set Bypass state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: bypass mode (1=on, 0=off)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int set_bypass_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_bypass - Get Bypass mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_bypass_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_bypass_change - Get change of Bypass mode state from last status check
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_bypass_change_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_dis_bypass - Set Disable Bypass mode
|
||||
* @if_index: network device index of the controlling device
|
||||
* @dis_bypass: disable bypass(1=dis, 0=en)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_dis_bypass_sd(int if_index, int dis_bypass);
|
||||
|
||||
/**
|
||||
* get_dis_bypass - Get Disable Bypass mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (normal Bypass mode/ Disable bypass)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_dis_bypass_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass_pwoff - Set Bypass mode at power-off state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: bypass mode setting at power off state (1=BP en, 0=BP Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bypass_pwoff_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_bypass_pwoff - Get Bypass mode state at power-off state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable bypass at power off state / normal Bypass mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bypass_pwoff_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass_pwup - Set Bypass mode at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: bypass mode setting at power up state (1=BP en, 0=BP Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bypass_pwup_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_bypass_pwup - Get Bypass mode state at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable bypass at power up state / normal Bypass mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bypass_pwup_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_bypass_wd - Set watchdog state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @ms_timeout: requested timeout (in ms units), 0 for disabling the watchdog timer
|
||||
* @ms_timeout_set(output): requested timeout (in ms units),
|
||||
* that the adapter supports and will be used by the watchdog
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bypass_wd_sd(int if_index, int ms_timeout, int *ms_timeout_set);
|
||||
|
||||
/**
|
||||
* get_bypass_wd - Get watchdog state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @ms_timeout (output): WDT timeout (in ms units),
|
||||
* -1 for unknown wdt status
|
||||
* 0 if WDT is disabled
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bypass_wd_sd(int if_index, int *ms_timeout_set);
|
||||
|
||||
/**
|
||||
* get_wd_expire_time - Get watchdog expire
|
||||
* @if_index: network device index of the controlling device
|
||||
* @ms_time_left (output): time left till watchdog time expire,
|
||||
* -1 if WDT has expired
|
||||
* 0 if WDT is disabled
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int get_wd_expire_time_sd(int if_index, int *ms_time_left);
|
||||
|
||||
/**
|
||||
* reset_bypass_wd_timer - Reset watchdog timer
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 1 - on success
|
||||
* 0 - watchdog is not configured
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int reset_bypass_wd_timer_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_std_nic - Standard NIC mode of operation
|
||||
* @if_index: network device index of the controlling device
|
||||
* @nic_mode: 0/1 (Default Bypass mode / Standard NIC mode)
|
||||
*
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_std_nic_sd(int if_index, int nic_mode);
|
||||
|
||||
/**
|
||||
* get_std_nic - Get Standard NIC mode setting
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 0/1 (Default Bypass mode / Standard NIC mode) on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_std_nic_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tx - set transmitter enable/disable
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tx_state: 0/1 (Transmit Disable / Transmit Enable)
|
||||
*
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation )
|
||||
**/
|
||||
int set_tx_sd(int if_index, int tx_state);
|
||||
|
||||
/**
|
||||
* get_tx - get transmitter state (disable / enable)
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 0/1 (ransmit Disable / Transmit Enable) on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass)
|
||||
**/
|
||||
int get_tx_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tpl - set TPL enable/disable
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tx_state: 0/1 (TPL Disable / TPL Enable)
|
||||
*
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation )
|
||||
**/
|
||||
int set_tpl_sd(int if_index, int tpl_state);
|
||||
|
||||
/**
|
||||
* get_tpl - get TPL state (disable / enable)
|
||||
* @if_index: network device index of the controlling device
|
||||
*
|
||||
* Output:
|
||||
* 0/1 (TPL Disable / TPL Enable) on success
|
||||
* -1 - on failure (device is not capable of the operation)
|
||||
**/
|
||||
int get_tpl_sd(int if_index);
|
||||
|
||||
int get_bp_hw_reset_sd(int if_index);
|
||||
|
||||
int set_bp_hw_reset_sd(int if_index, int status);
|
||||
|
||||
/**
|
||||
* set_tap - set TAP state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tap_mode: 1 tap mode , 0 normal nic mode
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support TAP or it's a slave device)
|
||||
**/
|
||||
int set_tap_sd(int if_index, int tap_mode);
|
||||
|
||||
/**
|
||||
* get_tap - Get TAP mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support TAP or it's a slave device)
|
||||
**/
|
||||
int get_tap_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_tap_change - Get change of TAP mode state from last status check
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support TAP or it's a slave device)
|
||||
**/
|
||||
int get_tap_change_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_dis_tap - Set Disable TAP mode
|
||||
* @if_index: network device index of the controlling device
|
||||
* @dis_tap: disable tap(1=dis, 0=en)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_dis_tap_sd(int if_index, int dis_tap);
|
||||
|
||||
/**
|
||||
* get_dis_tap - Get Disable TAP mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (normal TAP mode/ Disable TAP)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_dis_tap_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_tap_pwup - Set TAP mode at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: tap mode setting at power up state (1=TAP en, 0=TAP Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_tap_pwup_sd(int if_index, int tap_mode);
|
||||
|
||||
/**
|
||||
* get_tap_pwup - Get TAP mode state at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable TAP at power up state / normal TAP mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_tap_pwup_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_wd_exp_mode - Set adapter state when WDT expired.
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: adapter mode (1=tap mode, 0=bypass mode)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int set_wd_exp_mode_sd(int if_index, int bypass_mode);
|
||||
|
||||
/**
|
||||
* get_wd_exp_mode - Get adapter state when WDT expired.
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (bypass/tap) on success
|
||||
* -1 - on failure (device not support Bypass or it's a slave device)
|
||||
**/
|
||||
int get_wd_exp_mode_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_wd_autoreset - reset WDT periodically.
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: adapter mode (1=tap mode, 0=bypass mode)
|
||||
* Output:
|
||||
* 1 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int set_wd_autoreset_sd(int if_index, int time);
|
||||
|
||||
/**
|
||||
* set_wd_autoreset - reset WDT periodically.
|
||||
* @if_index: network device index of the controlling device
|
||||
* @bypass_mode: adapter mode (1=tap mode, 0=bypass mode)
|
||||
* Output:
|
||||
* 1 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support Bypass
|
||||
* or it's a slave device or unknown wdt status)
|
||||
**/
|
||||
int get_wd_autoreset_sd(int if_index);
|
||||
/**
|
||||
* set_disc - set DISC state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @tap_mode: 1 DISC mode , 0 normal nic mode
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device not support disconnect or it's a slave device)
|
||||
**/
|
||||
int set_bp_disc_sd(int if_index, int disc_mode);
|
||||
|
||||
/**
|
||||
* get_disc - Get disc mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support disconnect or it's a slave device)
|
||||
**/
|
||||
int get_bp_disc_sd(int if_index);
|
||||
|
||||
/**
|
||||
* get_disc_change - Get change of DISC mode state from last status check
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - (off/on) on success
|
||||
* -1 - on failure (device not support disconnect or it's a slave device)
|
||||
**/
|
||||
int get_bp_disc_change_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_dis_disc - Set Disable DISC mode
|
||||
* @if_index: network device index of the controlling device
|
||||
* @dis_disc: disable disconnect(1=dis, 0=en)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support DISC
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bp_dis_disc_sd(int if_index, int dis_disc);
|
||||
|
||||
/**
|
||||
* get_dis_disc - Get Disable DISC mode state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (normal DISC mode/ Disable DISC)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support TAP
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bp_dis_disc_sd(int if_index);
|
||||
|
||||
/**
|
||||
* set_disc_pwup - Set DISC mode at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* @disc_mode: DISC mode setting at power up state (1= en, 0= Dis)
|
||||
* Output:
|
||||
* 0 - on success
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support DISC
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int set_bp_disc_pwup_sd(int if_index, int disc_mode);
|
||||
|
||||
/**
|
||||
* get_disc_pwup - Get DISC mode state at power-up state
|
||||
* @if_index: network device index of the controlling device
|
||||
* Output:
|
||||
* 0/1 - on success (Disable DISC at power up state / normal DISC mode)
|
||||
* -1 - on failure (device is not capable of the operation ordevice not support DISC
|
||||
* or it's a slave device)
|
||||
**/
|
||||
int get_bp_disc_pwup_sd(int if_index);
|
||||
|
||||
int get_bypass_info_sd(int if_index, struct bp_info *bp_info);
|
||||
int bp_if_scan_sd(void);
|
||||
/*int get_dev_num_sd(void);*/
|
Loading…
Reference in a new issue