Upstream release 5.2.0.41

This commit is contained in:
Silicom Ltd 2019-06-18 14:22:49 +00:00 committed by Shoghi
parent 355206db20
commit 708f90ee76
17 changed files with 6888 additions and 1236 deletions

407
Makefile
View File

@ -1,301 +1,134 @@
################################################################################
#
# Intel(R) 10GbE PCI Express Linux Network Driver
# Copyright(c) 1999 - 2017 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
# Contact Information:
# Linux NICS <linux.nics@intel.com>
# e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
# Silicom, Ltd
################################################################################
MOD_VER=5.0.65.1
# core driver files
CFILES = bp_mod.c
HFILES = bp_mod.h
MOD_VER=5.2.0.41
PRDPATH_UTIL=/bin
TARGET_UTIL=bpctl_util
OBJS = bp_util.o
OBJS_UTIL = bp_util.o
ifeq (,$(BUILD_KERNEL))
BUILD_KERNEL=$(shell uname -r)
endif
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
#
# Makefile for the Intel(R) 10GbE PCI Express Linux Network Driver
#
obj-$(CONFIG_BPCTL_MOD) += bpctl_mod.o
define bpctl_mod-y
bp_mod.o
endef
bpctl_mod-y := $(strip ${bpctl_mod-y})
###########################################################################
# Environment tests
else # ifneq($(KERNELRELEASE),)
# normal makefile
# Kernel Search Path
# All the places we look for kernel source
KSP := /lib/modules/$(BUILD_KERNEL)/build \
/lib/modules/$(BUILD_KERNEL)/source \
/usr/src/linux-$(BUILD_KERNEL) \
/usr/src/linux-$($(BUILD_KERNEL) | sed 's/-.*//') \
/usr/src/kernel-headers-$(BUILD_KERNEL) \
/usr/src/kernel-source-$(BUILD_KERNEL) \
/usr/src/linux-$($(BUILD_KERNEL) | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
/usr/src/linux
DRIVER := bpctl_mod
# prune the list down to only values that exist
# and have an include/linux sub-directory
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))
# we will use this first valid entry in the search path
ifeq (,$(KSRC))
KSRC := $(firstword $(KSP))
endif
ifeq (,$(KSRC))
$(warning *** Kernel header files not in any of the expected locations.)
$(warning *** Install the appropriate kernel development package, e.g.)
$(error kernel-devel, for building kernel modules and try again)
ifeq (,$(wildcard common.mk))
$(error Cannot find common.mk build rules)
else
ifeq (/lib/modules/$(BUILD_KERNEL)/source, $(KSRC))
KOBJ := /lib/modules/$(BUILD_KERNEL)/build
else
KOBJ := $(KSRC)
endif
include common.mk
endif
# Version file Search Path
VSP := $(KOBJ)/include/generated/utsrelease.h \
$(KOBJ)/include/linux/utsrelease.h \
$(KOBJ)/include/linux/version.h \
$(KOBJ)/include/generated/uapi/linux/version.h \
/boot/vmlinuz.version.h
# Config file Search Path
CSP := $(KOBJ)/include/generated/autoconf.h \
$(KOBJ)/include/linux/autoconf.h \
/boot/vmlinuz.autoconf.h
# prune the lists down to only files that exist
test_file = $(shell [ -f $(file) ] && echo $(file))
VSP := $(foreach file, $(VSP), $(test_file))
CSP := $(foreach file, $(CSP), $(test_file))
# and use the first valid entry in the Search Paths
ifeq (,$(VERSION_FILE))
VERSION_FILE := $(firstword $(VSP))
endif
ifeq (,$(CONFIG_FILE))
CONFIG_FILE := $(firstword $(CSP))
# Check that kernel version is at least 2.6.0, since we don't support 2.4.x
# kernels with the BPCTL driver. We can't use minimum_kver_check since SLES 10
# SP4's Make has a bug which causes $(eval) inside an ifeq conditional to error
# out. This was fixed in Make 3.81, but SLES 10 SP4 does not have a fix for
# this yet.
ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,2,6,0) ]; echo "$?"))
$(warning *** Aborting the build.)
$(error This driver is not supported on kernel versions older than 2.6.0)
endif
ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version header file)
endif
######################
# Kernel Build Macro #
######################
ifeq (,$(wildcard $(CONFIG_FILE)))
$(error Linux kernel source not configured - missing autoconf.h)
endif
# customized kernelbuild function
#
# ${1} is the kernel build target
# ${2} may contain extra rules to pass to kernelbuild macro
#
# We customize the kernelbuild target in order to provide our hack to disable
# CONFIG_PTP_1588_CLOCK support should -DNO_PTP_SUPPORT be defined in the extra
# cflags given on the command line.
devkernelbuild = $(call kernelbuild,$(if $(filter -DNO_PTP_SUPPORT,${EXTRA_CFLAGS}),CONFIG_PTP_1588_CLOCK=n) ${2},${1})
# pick a compiler
ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
CC := kgcc gcc cc
else
CC := gcc cc
endif
test_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc))
CC := $(foreach cc, $(CC), $(test_cc))
CC := $(firstword $(CC))
ifeq (,$(CC))
$(error Compiler not found)
endif
###############
# Build rules #
###############
# we need to know what platform the driver is being built on
# some additional features are only built on Intel platforms
ARCH := $(shell uname -m | sed 's/i.86/i386/')
ifeq ($(ARCH),alpha)
EXTRA_CFLAGS += -ffixed-8 -mno-fp-regs
endif
ifeq ($(ARCH),x86_64)
EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone
endif
ifeq ($(ARCH),ppc)
EXTRA_CFLAGS += -msoft-float
endif
ifeq ($(ARCH),ppc64)
EXTRA_CFLAGS += -m64 -msoft-float
LDFLAGS += -melf64ppc
endif
EXTRA_CFLAGS += -DVER_STR_SET="\"$(MOD_VER)\""
EXTRA_CFLAGS += -DBP_READ_REG
EXTRA_CFLAGS += -DPMC_FIX_FLAG
EXTRA_CFLAGS += -DBP_SYNC_FLAG
EXTRA_CFLAGS += -DBP_10G
#EXTRA_CFLAGS += -DBP_SELF_TEST
#EXTRA_CFLAGS += -DBP_LINK_FAIL_NOTIFIER
EXTRA_CFLAGS += -DBP_PROC_SUPPORT
#EXTRA_CFLAGS += -DBP_DBI_FLAG
# extra flags for module builds
EXTRA_CFLAGS += -DDRIVER_$(shell echo $(DRIVER_NAME) | tr '[a-z]' '[A-Z]')
EXTRA_CFLAGS += -DDRIVER_NAME=$(DRIVER_NAME)
EXTRA_CFLAGS += -DDRIVER_NAME_CAPS=$(shell echo $(DRIVER_NAME) | tr '[a-z]' '[A-Z]')
# standard flags for module builds
EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
EXTRA_CFLAGS += -I$(KSRC)/generated/uapi -I$(KSRC)/include -I.
EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
echo "-DMODVERSIONS -DEXPORT_SYMTAB \
-include $(KSRC)/include/linux/modversions.h")
EXTRA_CFLAGS += $(CFLAGS_EXTRA)
RHC := $(KSRC)/include/linux/rhconfig.h
ifneq (,$(wildcard $(RHC)))
# 7.3 typo in rhconfig.h
ifneq (,$(shell $(CC) $(CFLAGS) -E -dM $(RHC) | grep __module__bigmem))
EXTRA_CFLAGS += -D__module_bigmem
endif
endif
# get the kernel version - we use this to find the correct install path
KVER := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
awk '{ print $$3 }' | sed 's/\"//g')
# assume source symlink is the same as build, otherwise adjust KOBJ
ifneq (,$(wildcard /lib/modules/$(KVER)/build))
ifneq ($(KSRC),$(shell readlink /lib/modules/$(KVER)/build))
KOBJ=/lib/modules/$(KVER)/build
endif
endif
KVER_CODE := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(VSP) 2>/dev/null |\
grep -m 1 LINUX_VERSION_CODE | awk '{ print $$3 }' | sed 's/\"//g')
# abort the build on kernels older than 2.4.0
ifneq (1,$(shell [ $(KVER_CODE) -ge 132096 ] && echo 1 || echo 0))
$(error *** Aborting the build. \
*** This driver is not supported on kernel versions older than 2.4.0)
endif
# set the install path
INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net/$(DRIVER_NAME)
# look for SMP in config.h
SMP := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(CONFIG_FILE) | \
grep -w CONFIG_SMP | awk '{ print $$3 }')
ifneq ($(SMP),1)
SMP := 0
endif
ifneq ($(SMP),$(shell uname -a | grep SMP > /dev/null 2>&1 && echo 1 || echo 0))
$(warning ***)
ifeq ($(SMP),1)
$(warning *** Warning: kernel source configuration (SMP))
$(warning *** does not match running kernel (UP))
else
$(warning *** Warning: kernel source configuration (UP))
$(warning *** does not match running kernel (SMP))
endif
$(warning *** Continuing with build,)
$(warning *** resulting driver may not be what you want)
$(warning ***)
endif
ifeq ($(SMP),1)
EXTRA_CFLAGS += -D__SMP__
endif
###########################################################################
# Kernel Version Specific rules
ifeq (1,$(shell [ $(KVER_CODE) -ge 132352 ] && echo 1 || echo 0))
# Makefile for 2.5.x and newer kernel
TARGET = bpctl_mod.ko
# man page
MANSECTION = 7
MANFILE = $(TARGET:.ko=.$(MANSECTION))
ifneq ($(PATCHLEVEL),)
EXTRA_CFLAGS += $(CFLAGS_EXTRA)
obj-m += bpctl_mod.o
bpctl_mod-objs := $(CFILES:.c=.o)
else
# Standard compilation, with regular output
default: $(TARGET_UTIL)
ifeq ($(KOBJ),$(KSRC))
$(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd) modules
else
$(MAKE) -C $(KSRC) O=$(KOBJ) SUBDIRS=$(shell pwd) modules
endif
endif
@+$(call devkernelbuild,modules)
else # ifeq (1,$(shell [ $(KVER_CODE) -ge 132352 ] && echo 1 || echo 0))
# Noisy output, for extra debugging
noisy:
@+$(call devkernelbuild,modules,V=1)
# Makefile for 2.4.x kernel
TARGET = bpctl_mod.o
# Silence any output generated
silent:
@+$(call devkernelbuild,modules,>/dev/null)
# man page
MANSECTION = 7
MANFILE = $(TARGET:.o=.$(MANSECTION))
# Enable higher warning level
checkwarnings: clean
@+$(call devkernelbuild,modules,W=1)
# Get rid of compile warnings in kernel header files from SuSE
ifneq (,$(wildcard /etc/SuSE-release))
EXTRA_CFLAGS += -Wno-sign-compare -fno-strict-aliasing
endif
# Run sparse static analyzer
sparse: clean
@+$(call devkernelbuild,modules,C=2 CF="-D__CHECK_ENDIAN__ -Wbitwise -Wcontext")
# Get rid of compile warnings in kernel header files from fedora
ifneq (,$(wildcard /etc/fedora-release))
EXTRA_CFLAGS += -fno-strict-aliasing
endif
CFLAGS += $(EXTRA_CFLAGS)
.SILENT: $(TARGET)
$(TARGET): $(filter-out $(TARGET), $(CFILES:.c=.o))
$(LD) $(LDFLAGS) -r $^ -o $@
echo; echo
echo "**************************************************"
echo "** $(TARGET) built for $(KVER)"
echo -n "** SMP "
if [ "$(SMP)" = "1" ]; \
then echo "Enabled"; else echo "Disabled"; fi
echo "**************************************************"
echo
$(CFILES:.c=.o): $(HFILES) Makefile
default:
$(MAKE)
endif # ifeq (1,$(shell [ $(KVER_CODE) -ge 132352 ] && echo 1 || echo 0))
# Run coccicheck static analyzer
ccc: clean
@+$(call devkernelbuild,modules,coccicheck MODE=report))
# depmod version for rpm builds
DEPVER := $(shell /sbin/depmod -V 2>/dev/null | \
awk 'BEGIN {FS="."} NR==1 {print $$2}')
# Clean the module subdirectories
clean:
@+$(call devkernelbuild,clean)
@-rm -rf *.ko
rm -rf $(OBJS_UTIL) $(TARGET_UTIL)
###########################################################################
# Build rules
install: default
# remove all old versions of the driver
find $(INSTALL_MOD_PATH)/lib/modules/$(KVER) -name $(TARGET) -exec rm -f {} \; || true
find $(INSTALL_MOD_PATH)/lib/modules/$(KVER) -name $(TARGET).gz -exec rm -f {} \; || true
install -D -m 777 $(TARGET) $(INSTALL_MOD_PATH)$(INSTDIR)/$(TARGET)
ifeq (,$(INSTALL_MOD_PATH))
/sbin/depmod -a || true
else
ifeq ($(DEPVER),1 )
/sbin/depmod -r $(INSTALL_MOD_PATH) -a || true
else
/sbin/depmod -b $(INSTALL_MOD_PATH) -a -n $(KVERSION) > /dev/null || true
endif
endif
# Install the modules
install: default
@echo "Installing modules..."
@+$(call devkernelbuild,modules_install)
@echo "Running depmod..."
@$(call cmd_depmod)
mkdir -p $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)
install $(TARGET_UTIL) $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)
install bpctl_start $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)
install bpctl_stop $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)
install bpctl_stop $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)
$(TARGET_UTIL): $(OBJS_UTIL)
$(CC) $(OBJS_UTIL) -g -Wall -o $(TARGET_UTIL)
$(TARGET_UTIL): $(OBJS)
$(OBJS): bp_util.c
$(CC) $(CFLAGS) -c bp_util.c -DBP_DBI_FLAG -DPMC_FIX_FLAG -DVER_STR_SET="\"$(MOD_VER)\""
$(CC) $(OBJS) -o $(TARGET_UTIL)
uninstall:
if [ -e $(INSTDIR)/$(TARGET) ] ; then \
rm -f $(INSTDIR)/$(TARGET) ; \
fi
/sbin/depmod -a
rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko;
$(call cmd_depmod)
if [ -e $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/$(TARGET_UTIL) ] ; then \
rm -f $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/$(TARGET_UTIL) ; \
fi
@ -304,14 +137,34 @@ uninstall:
fi
if [ -e $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/bpctl_stop ] ; then \
rm -f $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/bpctl_stop ; \
fi
.PHONY: clean install
fi
clean:
ifeq ($(KOBJ),$(KSRC))
$(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd) clean
else
$(MAKE) -C $(KSRC) O=$(KOBJ) SUBDIRS=$(shell pwd) clean
endif
rm -rf $(TARGET) $(TARGET:.ko=.o) $(TARGET:.ko=.mod.c) $(TARGET:.ko=.mod.o) $(CFILES:.c=.o) .*cmd .tmp_versions $(OBJS) $(TARGET_UTIL) Module.symvers Modules.symvers modules.order Module.markers
########
# Help #
########
help:
@echo 'Cleaning targets:'
@echo ' clean - Clean files generated by kernel module build'
@echo 'Build targets:'
@echo ' default - Build module(s) with standard verbosity'
@echo ' noisy - Build module(s) with V=1 verbosity -- very noisy'
@echo ' silent - Build module(s), squelching all output'
@echo 'Static Analysis:'
@echo ' checkwarnings - Clean, then build module(s) with W=1 warnings enabled'
@echo ' sparse - Clean, then check module(s) using sparse'
@echo ' ccc - Clean, then check module(s) using coccicheck'
@echo 'Other targets:'
@echo ' install - Build then install the module(s)'
@echo ' uninstall - Uninstall the module(s)'
@echo ' help - Display this help message'
@echo 'Variables:'
@echo ' LINUX_VERSION - Debug tool to force kernel LINUX_VERSION_CODE. Use at your own risk.'
@echo ' W=N - Kernel variable for setting warning levels'
@echo ' V=N - Kernel variable for setting output verbosity'
@echo ' INSTALL_MOD_PATH - Add prefix for the module installation path'
@echo ' Other variables may be available for tuning make process, see'
@echo ' Kernel Kbuild documentation for more information'
.PHONY: default noisy clean silent sparse ccc install uninstall help
endif # ifneq($(KERNELRELEASE),)

32
bits.h
View File

@ -1,35 +1,3 @@
/**************************************************************************
Copyright (c) 2006-2013, Silicom
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Silicom nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#ifndef BITS_H
#define BITS_H

View File

@ -1,35 +1,3 @@
/**************************************************************************
Copyright (c) 2006-2013, Silicom
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Silicom nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
/* [R 19] Interrupt register #0 read */

675
bp_cmd.h Executable file
View File

@ -0,0 +1,675 @@
#ifndef __BP_CMD_H__
#define __BP_CMD_H__
//#define FW_HEADER_DEF 1
#ifndef FW_HEADER_DEF
typedef unsigned int U32_T; /* 32-bit unsigned */
typedef unsigned short int U16_T; /* 16-bit unsigned */
typedef unsigned char U8_T; /* 8-bit unsigned */
#endif
typedef U8_T byte;
#ifndef FW_HEADER_DEF
#pragma pack(push) /* push current alignment to stack */
#pragma pack(1) /* set alignment to 1 byte boundary */
#endif
/******************************************************\
* *
* COMMUNICATION PROTOCOL SPECIFICATION *
* *
* <COMMAND_ID><COMMAND_LEN><COMMAND_DATA> *
* *
\******************************************************/
/*
* BP cmd IDs
*/
#define CMD_GET_BYPASS_CAPS 1
#define CMD_GET_WD_SET_CAPS 2
#define CMD_SET_BYPASS 3
#define CMD_GET_BYPASS 4
#define CMD_GET_BYPASS_CHANGE 5
#define CMD_SET_BYPASS_WD 6
#define CMD_GET_BYPASS_WD 7
#define CMD_GET_WD_EXPIRE_TIME 8
#define CMD_RESET_BYPASS_WD_TIMER 9
#define CMD_SET_DIS_BYPASS 10
#define CMD_GET_DIS_BYPASS 11
#define CMD_SET_BYPASS_PWOFF 12
#define CMD_GET_BYPASS_PWOFF 13
#define CMD_SET_BYPASS_PWUP 14
#define CMD_GET_BYPASS_PWUP 15
#define CMD_SET_STD_NIC 16
#define CMD_GET_STD_NIC 17
#define CMD_SET_TAP 18
#define CMD_GET_TAP 19
#define CMD_GET_TAP_CHANGE 20
#define CMD_SET_DIS_TAP 21
#define CMD_GET_DIS_TAP 22
#define CMD_SET_TAP_PWUP 23
#define CMD_GET_TAP_PWUP 24
#define CMD_SET_WD_EXP_MODE 25
#define CMD_GET_WD_EXP_MODE 26
#define CMD_SET_DISC 27
#define CMD_GET_DISC 28
#define CMD_GET_DISC_CHANGE 29
#define CMD_SET_DIS_DISC 30
#define CMD_GET_DIS_DISC 31
#define CMD_SET_DISC_PWUP 32
#define CMD_GET_DISC_PWUP 33
#define CMD_SET_DISC_PWOFF 34
#define CMD_GET_DISC_PWOFF 35
#define CMD_GET_BYPASS_CAPS_EX 36
#define CMD_SET_HOST_PWOFF_MODE 37
#define CMD_GET_HOST_PWOFF_MODE 38
#define CMD_SET_HOST_PWUP_MODE 39
#define CMD_GET_HOST_PWUP_MODE 40
#define CMD_SET_DISC_PORT 41
#define CMD_GET_DISC_PORT 42
#define CMD_SET_DISC_PORT_PWUP 43
#define CMD_GET_DISC_PORT_PWUP 44
#define CMD_SET_WD_RST_RESTORE_MODE 45
#define CMD_GET_WD_RST_RESTORE_MODE 46
#define CMD_SET_TPL 47
#define CMD_GET_TPL 48
#define CMD_SET_TX 49
#define CMD_GET_TX 50
#define CMD_GET_BYPASS_INFO 100
#define CMD_GET_BP_WAIT_AT_PWUP 101
#define CMD_SET_BP_WAIT_AT_PWUP 102
#define CMD_GET_BP_HW_RESET 103
#define CMD_SET_BP_HW_RESET 104
#define CMD_SET_BP_MANUF 105
//#define CMD_RESERVED 131-132
#define CMD_GET_DEV_INFO 133
//#define CMD_RESERVED 132-139
typedef U8_T cmd_id_t;
/*
* BP cmd response codes
*/
#define BP_ERR_OK 1
#define BP_ERR_NOT_CAP 2
#define BP_ERR_DEV_BUSY 3
#define BP_ERR_INVAL_DEV_NUM 4
#define BP_ERR_INVAL_STATE 5
#define BP_ERR_INVAL_PARAM 6
#define BP_ERR_UNSUPPORTED_PARAM 7
#define BP_ERR_INVAL_CMD 8
#define BP_ERR_UNSUPPORTED_CMD 9
#define BP_ERR_INTERNAL 10
#define BP_ERR_UNKNOWN 11
typedef U8_T cmd_rsp_id_t;
typedef U8_T cmd_bp_board_t;
/*
* BP device info
*/
typedef struct _cmd_bp_info_t{
cmd_bp_board_t dev_id;
byte fw_ver;
}cmd_bp_info_t;
/*
* Disc port
*/
typedef struct _disc_port_t{
U8_T mode;
U8_T port_num;
}disc_port_t;
/*
* Tx disable
*/
typedef struct _tx_dis_t{
U8_T mode;
U8_T port_num;
}tx_dis_t;
/*
* Device info
*/
typedef union _cmd_dev_info_t{
U8_T info_id;
struct {
U8_T dev_id;
U8_T dev_rev;
U8_T eeprom_ver;
U8_T eeprom_rev;
}dev_ver;
U8_T bds_rev[4];
U8_T fw_ver[4];
U8_T hw_ver[4];
U32_T fw_build;
union {
U8_T part0[4];
U8_T part1[2];
}mac_addr;
union {
U8_T sn0[4];
U8_T sn1[4];
U8_T sn2[4];
U8_T sn3[4];
}sn;
}cmd_dev_info_t;
/*
* BP command device number
*/
#define DEV_NUM_MAX 4
typedef U8_T cmd_dev_num_t;
/*
* BP command data lenth type
*/
typedef U8_T cmd_data_len_t;
/*
* BP command data structure
*/
typedef union _cmd_data_t{
#if 0
/*
* CMD_GET_BYPASS_CAPS
*/
/*
* CMD_GET_BYPASS_CAPS_EX (1st double word)
*/
#define BP_CAP BIT0
#define BP_STATUS_CAP BIT1
#define BP_STATUS_CHANGE_CAP BIT2
#define SW_CTL_CAP BIT3
#define BP_DIS_CAP BIT4
#define BP_DIS_STATUS_CAP BIT5
#define STD_NIC_CAP BIT6
#define BP_PWOFF_ON_CAP BIT7
#define BP_PWOFF_OFF_CAP BIT8
#define BP_PWOFF_CTL_CAP BIT9
#define BP_PWUP_ON_CAP BIT10
#define BP_PWUP_OFF_CAP BIT11
#define BP_PWUP_CTL_CAP BIT12
#define WD_CTL_CAP BIT13
#define WD_STATUS_CAP BIT14
#define WD_TIMEOUT_CAP BIT15
#define TX_CTL_CAP BIT16
#define TX_STATUS_CAP BIT17
#define TAP_CAP BIT18
#define TAP_STATUS_CAP BIT19
#define TAP_STATUS_CHANGE_CAP BIT20
#define TAP_DIS_CAP BIT21
#define TAP_DIS_STATUS_CAP BIT22
#define TAP_PWUP_ON_CAP BIT23
#define TAP_PWUP_OFF_CAP BIT24
#define TAP_PWUP_CTL_CAP BIT25
#define NIC_CAP_NEG BIT26
#define TPL_CAP BIT27
#define DISC_CAP BIT28
#define DISC_DIS_CAP BIT29
#define DISC_PWUP_CTL_CAP BIT30
#define BP_CAPS_EX_CAP BIT31
#endif
U32_T bypass_caps;
/*
* CMD_GET_BYPASS_CAPS_EX (2nd double word)
*/
#if 0
#define DISC_PWOFF_CTL_CAP BIT0
#define BP_HOST_PWOFF_CTL_CAP BIT1
#define BP_HOST_PWUP_CTL_CAP BIT2
#define DISC_HOST_PWOFF_CTL_CAP BIT3
#define DISC_HOST_PWUP_CTL_CAP BIT4
#define NORMAL_HOST_PWOFF_CTL_CAP BIT5
#define NORMAL_HOST_PWUP_CTL_CAP BIT6
#define TAP_HOST_PWOFF_CTL_CAP BIT7
#define TAP_HOST_PWUP_CTL_CAP BIT8
#define DISC_PORT_CAP BIT9
#define DISC_PORT_PWUP_CTL_CAP BIT10
#endif
U32_T bypass_caps_ex;
/*
* CMD_GET_WD_SET_CAPS
*/
/* --------------------------------------------------------------------------------------
* Bit feature description Products
* ---------------------------------------------------------------------------------------
* 0-3 WD_MIN_TIME The interface WD minimal time period in PXG2/4BP - 5 (500mS)
* 100mS units All the other
* products - 1(100mS)
* ---------------------------------------------------------------------------------------
* 4 WD_STEP_TIME The steps of the WD timer in PXG2/4BP - 0
* 0 - for linear steps (WD_MIN_TIME * X) All the other
* 1 - for multiply by 2 from previous step products - 1
* (WD_MIN_TIME * 2^X)
* ---------------------------------------------------------------------------------------
* 5-8 WD_STEP_COUNT Number of register bits available for PXG2/4BP -7
* configuring the WD timer. From that the All the other
* number of steps the WD timer will have is products - 4
* 2^X (X number of bits available for
* defining the value)
* ---------------------------------------------------------------------------------------
* 9-31 RESERVED Reserved, should be ignored.
* -------------------------------------------------------------------------------------*/
U32_T wd_set_caps;
/*
* CMD_SET_BYPASS
*/
/*
* CMD_GET_BYPASS
*/
/* #define BYPASS_OFF 0 */
/* #define BYPASS_ON 1 */
U8_T bypass_mode;
/*
* CMD_GET_BYPASS_CHANGE
*/
#define BYPASS_NOT_CHANGED 0
#define BYPASS_CHANGED 1
U8_T bypass_change;
/*
* CMD_SET_BYPASS_WD
*/
/*
* CMD_GET_BYPASS_WD
*/
U32_T timeout;
U32_T timeout_set;
/*
* CMD_GET_WD_EXPIRE_TIME
*/
U32_T time_left;
/*
* CMD_SET_DIS_BYPASS
*/
/*
* CMD_GET_DIS_BYPASS
*/
#define DIS_BYPASS_ENABLE 0
#define DIS_BYPASS_DISABLE 1
U8_T dis_bypass;
/*
* CMD_SET_BYPASS_PWOFF
*/
/*
* CMD_GET_BYPASS_PWOFF
*/
#define BYPASS_PWOFF_DIS 0
#define BYPASS_PWOFF_EN 1
U8_T bypass_pwoff;
/*
* CMD_SET_BYPASS_PWUP
*/
/*
* CMD_GET_BYPASS_PWUP
*/
#define BYPASS_PWUP_DIS 0
#define BYPASS_PWUP_EN 1
U8_T bypass_pwup;
/*
* CMD_SET_HOST_PWOFF_MODE
*/
/*
* CMD_GET_HOST_PWOFF_MODE
*/
#define HOST_PWOFF_MODE_BYPASS 0
#define HOST_PWOFF_MODE_TAP 1
#define HOST_PWOFF_MODE_DISC 2
#define HOST_PWOFF_MODE_NORMAL 3
U8_T host_pwoff_mode;
/*
* CMD_SET_HOST_PWUP_MODE
*/
/*
* CMD_GET_HOST_PWUP_MODE
*/
#define HOST_PWUP_MODE_BYPASS 0
#define HOST_PWUP_MODE_TAP 1
#define HOST_PWUP_MODE_DISC 2
#define HOST_PWUP_MODE_NORMAL 3
U8_T host_pwup_mode;
/*
* CMD_SET_STD_NIC
*/
/*
* CMD_GET_STD_NIC
*/
#define STD_NIC_DIS 0
#define STD_NIC_EN 1
U8_T std_nic;
/*
* CMD_SET_TAP
*/
/*
* CMD_GET_TAP
*/
/* #define TAP_OFF 0 */
/* #define TAP_ON 1 */
U8_T tap_mode;
/*
* CMD_GET_TAP_CHANGE
*/
#define TAP_NOT_CHANGED 0
#define TAP_CHANGED 1
U8_T tap_change;
/*
* CMD_SET_DIS_TAP
*/
/*
* CMD_GET_DIS_TAP
*/
#define DIS_TAP_ENABLE 0
#define DIS_TAP_DISABLE 1
U8_T dis_tap;
/*
* CMD_SET_TAP_PWUP
*/
/*
* CMD_GET_TAP_PWUP
*/
#define TAP_PWUP_DIS 0
#define TAP_PWUP_EN 1
U8_T tap_pwup;
/*
* CMD_SET_WD_EXP_MODE
*/
/*
* CMD_GET_WD_EXP_MODE
*/
#define WD_EXP_MODE_BYPASS 0
#define WD_EXP_MODE_TAP 1
#define WD_EXP_MODE_DISC 2
#define WD_EXP_MODE_NORMAL 3
U8_T wd_exp_mode;
/*
* CMD_SET_WD_RST_RESTORE_MODE
*/
/*
* CMD_GET_WD_RST_RESTORE_MODE
*/
#define WD_RST_RESTORE_MODE_BYPASS 0
#define WD_RST_RESTORE_MODE_TAP 1
#define WD_RST_RESTORE_MODE_DISC 2
#define WD_RST_RESTORE_MODE_NORMAL 3
#define WD_RST_RESTORE_MODE_LAST_STATE 4
#define WD_RST_RESTORE_MODE_STAY_OFF 5
U8_T wd_rst_restore_mode;
/*
* CMD_SET_DISC
*/
/*
* CMD_GET_DISC
*/
/* #define DISC_OFF 0 */
/* #define DISC_ON 1 */
U8_T disc_mode;
/*
* CMD_GET_DISC_CHANGE
*/
#define DISC_NOT_CHANGED 0
#define DISC_CHANGED 1
U8_T disc_change;
/*
* CMD_SET_DIS_DISC
*/
/*
* CMD_GET_DIS_DISC
*/
#define DIS_DISC_ENABLE 0
#define DIS_DISC_DISABLE 1
U8_T dis_disc;
/*
* CMD_SET_DISC_PWUP
*/
/*
* CMD_GET_DISC_PWUP
*/
#define DISC_PWUP_DIS 0
#define DISC_PWUP_EN 1
U8_T disc_pwup;
/*
* CMD_SET_DISC_PWOFF
*/
/*
* CMD_GET_DISC_PWOFF
*/
#define DISC_PWOFF_DIS 0
#define DISC_PWOFF_EN 1
U8_T disc_pwoff;
/*
* CMD_SET_DISC_PORT
*/
/*
* CMD_GET_DISC_PORT
*/
#define DISC_PORT_OFF 0
#define DISC_PORT_ON 1
disc_port_t disc_port;
/*
* CMD_SET_DISC_PORT_PWUP
*/
/*
* CMD_GET_DISC_PORT_PWUP
*/
#define DISC_PORT_PWUP_DIS 0
#define DISC_PORT_PWUP_EN 1
disc_port_t disc_port_pwup;
/*
* CMD_SET_TPL
*/
/*
* CMD_GET_TPL
*/
#define TPL_OFF 0
#define TPL_ON 1
U8_T tpl_mode;
/*
* CMD_SET_TX
*/
/*
* CMD_GET_TX
*/
#define TX_OFF 0
#define TX_ON 1
tx_dis_t tx_dis;
/*
* CMD_GET_BYPASS_INFO
*/
cmd_bp_info_t bypass_info;
/*
* CMD_GET_DEV_INFO
*/
#define DEV_INFO_DEV_VER 0
#define DEV_INFO_FW_VER 1
#define DEV_INFO_MAC_PART0 2
#define DEV_INFO_MAC_PART1 3
#define DEV_INFO_SN_PART0 4
#define DEV_INFO_SN_PART1 5
#define DEV_INFO_SN_PART2 6
#define DEV_INFO_SN_PART3 7
#define DEV_INFO_FW_BUILD 8
#define DEV_INFO_BDS_REV 9
#define DEV_INFO_HW_REV 10
cmd_dev_info_t dev_info;
/*
* CMD_GET_BP_WAIT_AT_PWUP
*/
/*
* CMD_SET_BP_WAIT_AT_PWUP
*/
/* #define BP_WAIT_AT_PWUP_DIS 0 */
/* #define BP_WAIT_AT_PWUP_EN 1 */
U8_T bp_wait_at_pwup;
/*
* CMD_GET_BP_HW_RESET
*/
/*
* CMD_SET_BP_HW_RESET
*/
/* #define BP_HW_RESET_DIS 0 */
/* #define BP_HW_RESET_EN 1 */
U8_T bp_hw_reset;
}cmd_data_t;
/******************************************************\
* *
* <DEV_NUM><COMMAND_ID><COMMAND_LEN><COMMAND_DATA> *
* *
\******************************************************/
#define BP_CMD_PACKET_SIZE ( sizeof(cmd_dev_num_t) \
+ sizeof(cmd_id_t) \
+ sizeof(cmd_data_len_t) \
+ sizeof(cmd_data_t) )
typedef union _bp_cmd_t
{
byte cmd_bytes[BP_CMD_PACKET_SIZE]; // For Byte Access
struct {
cmd_dev_num_t cmd_dev_num;
cmd_id_t cmd_id;
cmd_data_len_t cmd_data_len;
cmd_data_t cmd_data;
}cmd;
}bp_cmd_t;
/******************************************************\
* *
* <RET_CODE><COMMAND_LEN><COMMAND_DATA> *
* *
\******************************************************/
#define BP_RSP_PACKET_SIZE ( sizeof(cmd_rsp_id_t) \
+ sizeof(cmd_data_len_t) \
+ sizeof(cmd_data_t) )
typedef union _bp_cmd_rsp_t
{
byte cmd_bytes[BP_RSP_PACKET_SIZE]; // For Byte Access
struct {
cmd_rsp_id_t rsp_id;
cmd_data_len_t rsp_data_len;
cmd_data_t rsp_data;
}rsp;
}bp_cmd_rsp_t;
#ifndef FW_HEADER_DEF
#pragma pack(pop) /* push current alignment to stack */
#endif
#endif /* End of __BP_CMD_H__ */

506
bp_cmd_vm.h Executable file
View File

@ -0,0 +1,506 @@
#ifndef __BP_CMD_VM_H__
#define __BP_CMD_VM_H__
//#define FW_HEADER_DEF 1
#ifndef FW_HEADER_DEF
#ifndef U32_T
typedef unsigned int U32_T; /* 32-bit unsigned */
typedef unsigned short int U16_T; /* 16-bit unsigned */
typedef unsigned char U8_T; /* 8-bit unsigned */
#endif
#endif
typedef U8_T byte;
//#ifndef FW_HEADER_DEF
#pragma pack(push) /* push current alignment to stack */
#pragma pack(1) /* set alignment to 1 byte boundary */
//#endif
/******************************************************\
* *
* COMMUNICATION PROTOCOL SPECIFICATION *
* *
* <COMMAND_ID><COMMAND_LEN><COMMAND_DATA> *
* *
\******************************************************/
/*
* BP cmd IDs
*/
#define CMD_VM_GET_BYPASS_CAPS 1
#define CMD_VM_GET_WD_SET_CAPS 2
#define CMD_VM_SET_BYPASS 3
#define CMD_VM_GET_BYPASS 4
#define CMD_VM_GET_BYPASS_CHANGE 5
#define CMD_VM_SET_BYPASS_WD 6
#define CMD_VM_GET_BYPASS_WD 7
#define CMD_VM_GET_WD_EXPIRE_TIME 8
#define CMD_VM_RESET_BYPASS_WD_TIMER 9
#define CMD_VM_SET_DIS_BYPASS 10
#define CMD_VM_GET_DIS_BYPASS 11
#define CMD_VM_SET_BYPASS_PWOFF 12
#define CMD_VM_GET_BYPASS_PWOFF 13
#define CMD_VM_SET_BYPASS_PWUP 14
#define CMD_VM_GET_BYPASS_PWUP 15
#define CMD_VM_SET_STD_NIC 16
#define CMD_VM_GET_STD_NIC 17
#define CMD_VM_SET_TAP 18
#define CMD_VM_GET_TAP 19
#define CMD_VM_GET_TAP_CHANGE 20
#define CMD_VM_SET_DIS_TAP 21
#define CMD_VM_GET_DIS_TAP 22
#define CMD_VM_SET_TAP_PWUP 23
#define CMD_VM_GET_TAP_PWUP 24
#define CMD_VM_SET_WD_EXP_MODE 25
#define CMD_VM_GET_WD_EXP_MODE 26
#define CMD_VM_SET_DISC 27
#define CMD_VM_GET_DISC 28
#define CMD_VM_GET_DISC_CHANGE 29
#define CMD_VM_SET_DIS_DISC 30
#define CMD_VM_GET_DIS_DISC 31
#define CMD_VM_SET_DISC_PWUP 32
#define CMD_VM_GET_DISC_PWUP 33
#define CMD_VM_SET_WD_AUTORESET 34
#define CMD_VM_GET_WD_AUTORESET 35
#define CMD_VM_SET_TPL 36
#define CMD_VM_GET_TPL 37
#define CMD_VM_GET_BYPASS_SLAVE 38
#define CMD_VM_IS_BYPASS 39
#define CMD_VM_SET_TX 40
#define CMD_VM_GET_TX 41
#define CMD_VM_GET_BYPASS_INFO 100
#define CMD_VM_GET_BP_WAIT_AT_PWUP 101
#define CMD_VM_SET_BP_WAIT_AT_PWUP 102
#define CMD_VM_GET_BP_HW_RESET 103
#define CMD_VM_SET_BP_HW_RESET 104
#define CMD_VM_SET_BP_MANUF 105
#define CMD_VM_GET_BPNIC_INFO 106
#define CMD_VM_GET_BP_PCI_INFO 107
#define CMD_VM_GET_BP_ALL_INFO 108
#define CMD_VM_GET_BP_DEV_NUM 109
#define CMD_VM_GET_BP_DRV_VER 110
#define CMD_VM_GET_BP_OEM_DATA 111
#define CMD_VM_SET_BP_BLINK 112
typedef U8_T cmd_vm_id_t;
/*
* BP cmd response codes
*/
#define BP_ERR_OK 1
#define BP_ERR_NOT_CAP 2
#define BP_ERR_DEV_BUSY 3
#define BP_ERR_INVAL_DEV_NUM 4
#define BP_ERR_INVAL_STATE 5
#define BP_ERR_INVAL_PARAM 6
#define BP_ERR_UNSUPPORTED_PARAM 7
#define BP_ERR_INVAL_CMD 8
#define BP_ERR_UNSUPPORTED_CMD 9
#define BP_ERR_INTERNAL 10
#define BP_ERR_UNKNOWN 11
typedef U8_T cmd_vm_rsp_id_t;
typedef U8_T cmd_vm_bp_board_t;
/*
* BP device info
*/
typedef struct _cmd_vm_bp_info_t {
cmd_vm_bp_board_t dev_id;
byte fw_ver;
}cmd_vm_bp_info_t;
/*
* BP command device number
*/
#define DEV_NUM_MAX 4
typedef U8_T cmd_vm_dev_num_t;
/*
* BP command data lenth type
*/
typedef U8_T cmd_vm_data_len_t;
/*
* BP command data structure
*/
typedef union _cmd_vm_data_t {
#if 0
/*
* CMD_GET_BYPASS_CAPS
*/
#define BP_CAP BIT0
#define BP_STATUS_CAP BIT1
#define BP_STATUS_CHANGE_CAP BIT2
#define SW_CTL_CAP BIT3
#define BP_DIS_CAP BIT4
#define BP_DIS_STATUS_CAP BIT5
#define STD_NIC_CAP BIT6
#define BP_PWOFF_ON_CAP BIT7
#define BP_PWOFF_OFF_CAP BIT8
#define BP_PWOFF_CTL_CAP BIT9
#define BP_PWUP_ON_CAP BIT10
#define BP_PWUP_OFF_CAP BIT11
#define BP_PWUP_CTL_CAP BIT12
#define WD_CTL_CAP BIT13
#define WD_STATUS_CAP BIT14
#define WD_TIMEOUT_CAP BIT15
#define TX_CTL_CAP BIT16
#define TX_STATUS_CAP BIT17
#define TAP_CAP BIT18
#define TAP_STATUS_CAP BIT19
#define TAP_STATUS_CHANGE_CAP BIT20
#define TAP_DIS_CAP BIT21
#define TAP_DIS_STATUS_CAP BIT22
#define TAP_PWUP_ON_CAP BIT23
#define TAP_PWUP_OFF_CAP BIT24
#define TAP_PWUP_CTL_CAP BIT25
#define NIC_CAP_NEG BIT26
#define TPL_CAP BIT27
#define DISC_CAP BIT28
#define DISC_DIS_CAP BIT29
#define DISC_PWUP_CTL_CAP BIT30
#endif
U32_T bypass_caps;
/*
* CMD_GET_WD_SET_CAPS
*/
/* --------------------------------------------------------------------------------------
* Bit feature description Products
* ---------------------------------------------------------------------------------------
* 0-3 WD_MIN_TIME The interface WD minimal time period in PXG2/4BP - 5 (500mS)
* 100mS units All the other
* products - 1(100mS)
* ---------------------------------------------------------------------------------------
* 4 WD_STEP_TIME The steps of the WD timer in PXG2/4BP - 0
* 0 - for linear steps (WD_MIN_TIME * X) All the other
* 1 - for multiply by 2 from previous step products - 1
* (WD_MIN_TIME * 2^X)
* ---------------------------------------------------------------------------------------
* 5-8 WD_STEP_COUNT Number of register bits available for PXG2/4BP -7
* configuring the WD timer. From that the All the other
* number of steps the WD timer will have is products - 4
* 2^X (X number of bits available for
* defining the value)
* ---------------------------------------------------------------------------------------
* 9-31 RESERVED Reserved, should be ignored.
* -------------------------------------------------------------------------------------*/
U32_T wd_set_caps;
/*
* CMD_SET_BYPASS
*/
/*
* CMD_GET_BYPASS
*/
//#define BYPASS_OFF 0
//#define BYPASS_ON 1
U8_T bypass_mode;
/*
* CMD_GET_BYPASS_CHANGE
*/
#define BYPASS_NOT_CHANGED 0
#define BYPASS_CHANGED 1
U8_T bypass_change;
/*
* CMD_SET_BYPASS_WD
*/
/*
* CMD_GET_BYPASS_WD
*/
U32_T timeout;
U32_T timeout_set;
/*
* CMD_GET_WD_EXPIRE_TIME
*/
U32_T time_left;
/*
* CMD_SET_DIS_BYPASS
*/
/*
* CMD_GET_DIS_BYPASS
*/
#define DIS_BYPASS_ENABLE 0
#define DIS_BYPASS_DISABLE 1
U8_T dis_bypass;
/*
* CMD_SET_BYPASS_PWOFF
*/
/*
* CMD_GET_BYPASS_PWOFF
*/
#define BYPASS_PWOFF_DIS 0
#define BYPASS_PWOFF_EN 1
U8_T bypass_pwoff;
/*
* CMD_SET_BYPASS_PWUP
*/
/*
* CMD_GET_BYPASS_PWUP
*/
#define BYPASS_PWUP_DIS 0
#define BYPASS_PWUP_EN 1
U8_T bypass_pwup;
/*
* CMD_SET_STD_NIC
*/
/*
* CMD_GET_STD_NIC
*/
#define DEF_BYPASS_MODE 0
#define STD_NIC_MODE 1
U8_T std_nic;
/*
* CMD_SET_TAP
*/
/*
* CMD_GET_TAP
*/
//#define TAP_OFF 0
//#define TAP_ON 1
U8_T tap_mode;
/*
* CMD_GET_TAP_CHANGE
*/
#define TAP_NOT_CHANGED 0
#define TAP_CHANGED 1
U8_T tap_change;
/*
* CMD_SET_DIS_TAP
*/
/*
* CMD_GET_DIS_TAP
*/
#define DIS_TAP_ENABLE 0
#define DIS_TAP_DISABLE 1
U8_T dis_tap;
/*
* CMD_SET_TAP_PWUP
*/
/*
* CMD_GET_TAP_PWUP
*/
#define TAP_PWUP_DIS 0
#define TAP_PWUP_EN 1
U8_T tap_pwup;
/*
* CMD_SET_WD_EXP_MODE
*/
/*
* CMD_GET_WD_EXP_MODE
*/
#define WD_EXP_MODE_BYPASS 0
#define WD_EXP_MODE_TAP 1
#define WD_EXP_MODE_DISC 2
U8_T wd_exp_mode;
/*
* CMD_SET_DISC
*/
/*
* CMD_GET_DISC
*/
//#define DISC_OFF 0
//#define DISC_ON 1
U8_T disc_mode;
/*
* CMD_GET_DISC_CHANGE
*/
//#define DISC_NOT_CHANGED 0
//#define DISC_CHANGED 1
U8_T disc_change;
/*
* CMD_SET_DIS_DISC
*/
/*
* CMD_GET_DIS_DISC
*/
//#define DIS_DISC_ENABLE 0
//#define DIS_DISC_DISABLE 1
U8_T dis_disc;
/*
* CMD_SET_DISC_PWUP
*/
/*
* CMD_GET_DISC_PWUP
*/
//#define DISC_PWUP_DIS 0
//#define DISC_PWUP_EN 1
U8_T disc_pwup;
/*
* CMD_GET_BYPASS_INFO
*/
cmd_vm_bp_info_t bypass_info;
/*
* CMD_GET_BP_WAIT_AT_PWUP
*/
/*
* CMD_SET_BP_WAIT_AT_PWUP
*/
//#define BP_WAIT_AT_PWUP_DIS 0
//#define BP_WAIT_AT_PWUP_EN 1
U8_T bp_wait_at_pwup;
/*
* CMD_GET_BP_HW_RESET
*/
/*
* CMD_SET_BP_HW_RESET
*/
//#define BP_HW_RESET_DIS 0
//#define BP_HW_RESET_EN 1
U8_T bp_hw_reset;
}cmd_vm_data_t;
/******************************************************\
* *
* <DEV_NUM><COMMAND_ID><COMMAND_LEN><COMMAND_DATA> *
* *
\******************************************************/
#define BP_CMD_PACKET_SIZE (sizeof(cmd_vm_dev_num_t) \
+ sizeof(cmd_vm_id_t) \
+ sizeof(cmd_vm_data_len_t) \
+ sizeof(cmd_vm_data_t))
typedef union _bp_cmd_vm_t {
byte cmd_vm_bytes[64]; // For Byte Access
struct {
byte str[6];
byte str1[6];
byte type[2];
U32_T multiplex_id;
U32_T request_id;
cmd_vm_dev_num_t cmd_vm_dev_num;
cmd_vm_id_t cmd_vm_id;
cmd_vm_data_len_t cmd_vm_data_len;
U32_T cmd_vm_data;
}cmd_vm;
}bp_cmd_vm_t;
/******************************************************\
* *
* <COMMAND_ID><COMMAND_LEN><COMMAND_DATA> *
* *
\******************************************************/
#define BP_VM_RSP_PACKET_SIZE sizeof(cmd_vm_rsp_id_t) \
+ sizeof(cmd_vm_data_len_t) \
+ sizeof(cmd_vm_data_t)
typedef union _bp_cmd_vm_rsp_t {
byte cmd_vm_bytes[64]; // For Byte Access
struct {
byte str[6];
byte str1[6];
byte type[2];
U32_T multiplex_id;
U32_T request_id;
cmd_vm_rsp_id_t rsp_id;
cmd_vm_data_len_t rsp_data_len;
U32_T rsp_data;
}rsp;
struct {
byte str[6];
byte str1[6];
byte type[2];
U32_T multiplex_id;
U32_T request_id;
cmd_vm_rsp_id_t rsp_id;
byte fw_ver;
byte info[40];
}rsp_info;
}bp_cmd_vm_rsp_t;
#ifndef FW_HEADER_DEF
#pragma pack(pop) /* push current alignment to stack */
#endif
#endif /* End of __BP_CMD_VM_H__ */

View File

@ -129,12 +129,15 @@ typedef enum {
SET_BP_WAIT_AT_PWUP,
GET_BP_HW_RESET,
SET_BP_HW_RESET,
SET_BP_BLINK,
SET_DISC_PORT,
GET_DISC_PORT,
SET_DISC_PORT_PWUP,
GET_DISC_PORT_PWUP,
SET_BP_FORCE_LINK,
GET_BP_FORCE_LINK,
SET_BP_MANUF,
GET_WD_EXPIRE,
#ifdef BP_SELF_TEST
SET_BP_SELF_TEST=200,
GET_BP_SELF_TEST,

5453
bp_mod.c

File diff suppressed because it is too large Load Diff

249
bp_mod.h
View File

@ -54,6 +54,56 @@ POSSIBILITY OF SUCH DAMAGE.
#define EXPORT_SYMBOL_NOVERS EXPORT_SYMBOL
#endif
#define BP_PROC_DIR "bypass"
#define GPIO6_SET_ENTRY_SD "gpio6_set"
#define GPIO6_CLEAR_ENTRY_SD "gpio6_clear"
#define GPIO7_SET_ENTRY_SD "gpio7_set"
#define GPIO7_CLEAR_ENTRY_SD "gpio7_clear"
#define PULSE_SET_ENTRY_SD "pulse_set"
#define ZERO_SET_ENTRY_SD "zero_set"
#define PULSE_GET1_ENTRY_SD "pulse_get1"
#define PULSE_GET2_ENTRY_SD "pulse_get2"
#define CMND_ON_ENTRY_SD "cmnd_on"
#define CMND_OFF_ENTRY_SD "cmnd_off"
#define RESET_CONT_ENTRY_SD "reset_cont"
/*COMMANDS*/
#define BYPASS_INFO_ENTRY_SD "bypass_info"
#define BYPASS_SLAVE_ENTRY_SD "bypass_slave"
#define BYPASS_CAPS_ENTRY_SD "bypass_caps"
#define WD_SET_CAPS_ENTRY_SD "wd_set_caps"
#define BYPASS_ENTRY_SD "bypass"
#define BYPASS_CHANGE_ENTRY_SD "bypass_change"
#define BYPASS_WD_ENTRY_SD "bypass_wd"
#define WD_EXPIRE_TIME_ENTRY_SD "wd_expire_time"
#define RESET_BYPASS_WD_ENTRY_SD "reset_bypass_wd"
#define DIS_BYPASS_ENTRY_SD "dis_bypass"
#define BYPASS_PWUP_ENTRY_SD "bypass_pwup"
#define BYPASS_PWOFF_ENTRY_SD "bypass_pwoff"
#define STD_NIC_ENTRY_SD "std_nic"
#define STD_NIC_ENTRY_SD "std_nic"
#define TAP_ENTRY_SD "tap"
#define TAP_CHANGE_ENTRY_SD "tap_change"
#define DIS_TAP_ENTRY_SD "dis_tap"
#define TAP_PWUP_ENTRY_SD "tap_pwup"
#define TWO_PORT_LINK_ENTRY_SD "two_port_link"
#define WD_EXP_MODE_ENTRY_SD "wd_exp_mode"
#define WD_AUTORESET_ENTRY_SD "wd_autoreset"
#define TPL_ENTRY_SD "tpl"
#define WAIT_AT_PWUP_ENTRY_SD "wait_at_pwup"
#define HW_RESET_ENTRY_SD "hw_reset"
#define DISC_ENTRY_SD "disc"
#define DISC_CHANGE_ENTRY_SD "disc_change"
#define DIS_DISC_ENTRY_SD "dis_disc"
#define DISC_PWUP_ENTRY_SD "disc_pwup"
@ -265,6 +315,7 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define SILICOM_PE2G4BPFi80ZX_SSID 0x0383
#define SILICOM_PE2G4BPi80_SSID 0x0388
#define SILICOM_PE2G4BPi80RB1_SSID 0x0389
#define SILICOM_PE2G2BPi80_SSID 0x0390
#define SILICOM_PE2G2BPFi80_SSID 0x0391
@ -322,6 +373,8 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define SILICOM_M1EG6BPI6_SSID 0x0440
#define SILICOM_M1E2G4BPi80_SSID 0x0460
#define SILICOM_M4E2G4BPi80CP_SSID 0x0464
#define SILICOM_M4E2G4BPi80CQ_SSID 0x0465
#define SILICOM_M1E2G4BPFi80_SSID 0x0461
#define SILICOM_M1E2G4BPFi80LX_SSID 0x0462
#define SILICOM_M1E2G4BPFi80ZX_SSID 0x0463
@ -445,23 +498,23 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define BP10GB_CX4_SERIES(pid) \
(pid==SILICOM_PE10G2BPTCX4_SSID)
#define BPRANG_IF_SERIES(pid) \
(pid==0X1f41)
#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_M2EG2BPFI6_SSID 0x0401
#define SILICOM_M2EG2BPFI6LX_SSID 0x0402
#define SILICOM_M2EG2BPFI6ZX_SSID 0x0403
#define SILICOM_M2EG4BPI6_SSID 0x0420
#define SILICOM_M2EG6BPI6_SSID 0x0540
#define SILICOM_M2EG4BPFI6_SSID 0x0421
#define SILICOM_M2EG4BPFI6LX_SSID 0x0422
#define SILICOM_M2EG4BPFI6ZX_SSID 0x0423
#define SILICOM_M2EG6BPI6_SSID 0x0440
@ -472,10 +525,13 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#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_M4E210G2BPI9SRCP_SSID 0x486
#define SILICOM_M4E210G2BPI9SRCQ_SSID 0x487
#define SILICOM_M2E10G2BPI9CX4_SSID 0x481
#define SILICOM_M2E10G2BPI9SR_SSID 0x482
#define SILICOM_M2E10G2BPI9LR_SSID 0x483
//#define SILICOM_M2E10G2BPI9T_SSID 0x480
#define SILICOM_PE210G2BPI9CX4_SSID 0x121
@ -489,9 +545,27 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define SILICOM_M1E210G2BPI9SRDJP1_SSID 0x1E10
#define SILICOM_M1E210G2BPI9LRDJP_SSID 0x1F00
#define SILICOM_M1E210G2BPI9LRDJP1_SSID 0x1F10
#define SILICOM_PE310G4BPI71SRD_SSID 0x0502
#define SILICOM_PE310G4BPI71LRD_SSID 0x0503
#define SILICOM_PE310G2BPI71SRD_SSID 0x050A
#define SILICOM_PE310G2BPI71LRD_SSID 0x050B
#define SILICOM_PE340G2BPI71QS43_SSID 0x0511
#define SILICOM_PE340G2BPI71QS4_SSID 0x0512
#define SILICOM_PE340G2BPI71QL4_SSID 0x0513
#define BP40_IF_SERIES(pid) \
((pid==SILICOM_PE310G4BPI71SRD_SSID)|| \
(pid== SILICOM_PE310G4BPI71LRD_SSID)|| \
(pid==SILICOM_PE310G2BPI71SRD_SSID)|| \
(pid== SILICOM_PE310G2BPI71LRD_SSID)|| \
(pid==SILICOM_PE340G2BPI71QS4_SSID)|| \
(pid==SILICOM_PE340G2BPI71QS43_SSID)|| \
(pid==SILICOM_PE340G2BPI71QL4_SSID))
#define DBI_IF_SERIES(pid) \
@ -550,11 +624,21 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
(pid==SILICOM_PEG6BPI_SSID)|| \
(pid==SILICOM_PEG4BPIL_SSID)|| \
(pid==SILICOM_PEG2BISC6_SSID)|| \
(pid==SILICOM_PE2G2BPi35_SSID)|| \
(pid==SILICOM_PAC1200BPi35_SSID)|| \
(pid==SILICOM_PE2G4BPi35_SSID)|| \
(pid==SILICOM_PE2G4BPi35L_SSID)|| \
(pid==SILICOM_M1E2G4BPi35_SSID)|| \
(pid==SILICOM_M1E2G4BPi35JP_SSID)|| \
(pid==SILICOM_M1E2G4BPi35JP1_SSID)|| \
(pid==SILICOM_PE2G6BPi35_SSID)|| \
(pid==SILICOM_PEG2BPI5_SSID))
#define PEG80_IF_SERIES(pid) \
((pid==SILICOM_M1E2G4BPi80_SSID)|| \
(pid==SILICOM_M4E2G4BPi80CP_SSID)|| \
(pid==SILICOM_M4E2G4BPi80CQ_SSID)|| \
(pid==SILICOM_M6E2G8BPi80_SSID)|| \
(pid==SILICOM_PE2G4BPi80L_SSID)|| \
(pid==SILICOM_M6E2G8BPi80A_SSID)|| \
@ -568,6 +652,7 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
(pid==SILICOM_PE2G6BPi35_SSID)|| \
(pid==SILICOM_PE2G2BPi80_SSID)|| \
(pid==SILICOM_PE2G4BPi80_SSID)|| \
(pid==SILICOM_PE2G4BPi80RB1_SSID)|| \
(pid==SILICOM_PE2G4BPFi80_SSID)|| \
(pid==SILICOM_PE2G4BPFi80LX_SSID)|| \
(pid==SILICOM_PE2G4BPFi80ZX_SSID)|| \
@ -614,11 +699,12 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
((pid==INTEL_PE210G2SPI9_SSID)|| \
(pid==SILICOM_M1E10G2BPI9CX4_SSID)|| \
(pid==SILICOM_M1E10G2BPI9SR_SSID)|| \
(pid==SILICOM_M4E210G2BPI9SRCP_SSID)|| \
(pid==SILICOM_M4E210G2BPI9SRCQ_SSID)|| \
(pid==SILICOM_M1E10G2BPI9LR_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)|| \
@ -645,6 +731,21 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
(pid==SILICOM_M1E210G2BPI9LRDJP1_SSID)|| \
(pid==SILICOM_PE210G2BPI9T_SSID))
#define BP71_IF_SERIES(pid) \
((pid==SILICOM_PEG2BPI_SSID)|| \
(pid==SILICOM_PEG2BPIX1_SSID)|| \
(pid==SILICOM_PEG4BPIN_SSID)|| \
(pid==SILICOM_PEG2BPFILX_SSID)|| \
(pid==SILICOM_PEG4BPFI_SSID)|| \
(pid==SILICOM_PEG2TBFI_SSID)|| \
(pid==SILICOM_PEG4BPIPT_SSID)|| \
(pid==SILICOM_PEG2BPFID_SSID)|| \
(pid==SILICOM_PEG2BPFIDLX_SSID)|| \
(pid==SILICOM_MEG2BPFILN_SSID)|| \
(pid==SILICOM_MEG2BPFINX_SSID)|| \
(pid==SILICOM_PEG4BPFILX_SSID)|| \
(pid==SILICOM_MEG2BPFILXLN_SSID)||\
(pid==SILICOM_PXEG4BPFI_SSID))
@ -655,21 +756,31 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
/* Intel Registers */
#define BPCTLI_CTRL 0x00000
#define BPCTLI_LEDCTL 0x00E00
#define BPCTLI_CTRL_SWDPIO0 0x00400000
#define BPCTLI_CTRL_SWDPIN0 0x00040000
#define BPCTLI_TSS 0x3C
#define BPCTLI_DCA_ID 0x5B70
#define BPCTLI_CTRL_EXT 0x00018 /* Extended Device Control - RW */
#define BPCTLI_STATUS 0x00008 /* Device Status - RO */
#define BPCTLI_EERD 0x14
#define BPCTLI_EEWR 0x102c
/* 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_SDP1_DATA 0x00080000
#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_SWDPIN0 0x00040000
#define BPCTLI_CTRL_SWDPIN1 0x00080000
#define BPCTLI_CTRL_SDP1_DIR 0x00800000
@ -683,6 +794,14 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define BPCTLI_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
#define BPCTLI_CTRL_EXT_LINK_MODE_MASK 0x00C00000
#define BPCTLI_LEDCTL_MODE_LED_ON 0xE
#define BPCTLI_LEDCTL_MODE_LED_OFF 0xF
#define BPCTLI_LEDCTL_LED0_MODE_MASK 0x0000000F
#define BPCTLI_LEDCTL_LED0_MODE_SHIFT 0
#define BPCTLI_LEDCTL_LED0_BLINK_RATE 0x0000020
#define BPCTLI_LEDCTL_LED0_IVRT 0x00000040
#define BPCTLI_LEDCTL_LED0_BLINK 0x00000080
#define BPCTLI_CTRL_EXT_MCLK_DIR BPCTLI_CTRL_EXT_SDP7_DIR
@ -768,6 +887,7 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define BP10G_ESDP 0x20
#define BP10G_DCA_ID 0x11070
#define BP10G_SDP0_DIR 0x100
#define BP10G_SDP1_DIR 0x200
@ -815,6 +935,29 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define BP10G_MDIO_DATA_IN9 BP10G_I2C_DATA_IN /*BP10G_I2C_CLK_IN*/
#define BP10G_LEDCTL 0x00200
/* LEDCTL Bit Masks */
#define BP10G_LED_IVRT_BASE 0x00000040
#define BP10G_LED_BLINK_BASE 0x00000080
#define BP10G_LED_MODE_MASK_BASE 0x0000000F
#define BP10G_LED_OFFSET(_base, _i) (_base << (8 * (_i)))
#define BP10G_LED_MODE_SHIFT(_i) (8*(_i))
#define BP10G_LED_IVRT(_i) BP10G_LED_OFFSET(BP10G_LED_IVRT_BASE, _i)
#define BP10G_LED_BLINK(_i) BP10G_LED_OFFSET(BP10G_LED_BLINK_BASE, _i)
#define BP10G_LED_MODE_MASK(_i) BP10G_LED_OFFSET(BP10G_LED_MODE_MASK_BASE, _i)
/* LED modes */
#define BP10G_LED_LINK_UP 0x0
#define BP10G_LED_LINK_10G 0x1
#define BP10G_LED_MAC 0x2
#define BP10G_LED_FILTER 0x3
#define BP10G_LED_LINK_ACTIVE 0x4
#define BP10G_LED_LINK_1G 0x5
#define BP10G_LED_ON 0xE
#define BP10G_LED_OFF 0xF
#define BP10G_STATUS 0x00008
#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
@ -879,12 +1022,65 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define BP10GB_MDIO_CLR BP10GB_GPIO4_CLR
/* toggle LED 4 times per second = 2 "blinks" per second */
#define BPVM_ID_INTERVAL (HZ/4)
/* bit defines for adapter->led_status */
#define BPVM_LED_ON 0
/*#define BPCTLI_LEDCTL_MODE_LED_ON 0xE
#define BPCTLI_LEDCTL_MODE_LED_OFF 0xF*/
#define BPCTLI_EEPROM_ID_LED_SETTINGS 0x0004
#define ID_LED_RESERVED_0000 0x0000
#define ID_LED_RESERVED_FFFF 0xFFFF
#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \
(ID_LED_OFF1_OFF2 << 8) | \
(ID_LED_DEF1_DEF2 << 4) | \
(ID_LED_DEF1_DEF2))
#define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
(ID_LED_DEF1_OFF2 << 8) | \
(ID_LED_DEF1_ON2 << 4) | \
(ID_LED_DEF1_DEF2))
#define ID_LED_DEF1_DEF2 0x1
#define ID_LED_DEF1_ON2 0x2
#define ID_LED_DEF1_OFF2 0x3
#define ID_LED_ON1_DEF2 0x4
#define ID_LED_ON1_ON2 0x5
#define ID_LED_ON1_OFF2 0x6
#define ID_LED_OFF1_DEF2 0x7
#define ID_LED_OFF1_ON2 0x8
#define ID_LED_OFF1_OFF2 0x9
#define BPCTL_SUCCESS 0
#define BPCTL_NVM_POLL_READ 0
#define BPCTL_NVM_RW_ADDR_SHIFT 2
#define BPCTL_ERR_NVM 1
#define BPCTL_NVM_RW_REG_DATA 16
#define BPCTL_NVM_RW_REG_DONE 2
#define BPCTL_NVM_RW_REG_START 1
#define BP40G_I2CCMD 0x000881E0
#define BP40G_I2CSEL 0x000881C0
#define BP40G_I2CPARAMS 0x000881AC
#define BP40G_CLK_DATA_OUT BIT_9
#define BP40G_MDIO_DATA_OUT BIT_10
#define BP40G_MDIO_DIR_OUTN BIT_11
#define BP40G_MDIO_DATA_IN BIT_12
#define BP40G_CLK_DIR_OUTN BIT_13
#define BP40G_GPIO_SET 0x00088184
#define BP40G_GPIO_STAT 0x0008817C
#define BP40GB_GPIO_OE BIT_4
#define BP40GB_GPIO_SDP_MODE_MASK (BIT_7 | BIT_8 | BIT_9)
#define BP40G_PF_FUNC_RID 0x0009C000
#define TIME_CLK 10 //40 //20 //10
#define TIME_DET //10 // 5
#define BP10GB_WRITE_REG(a, reg, value) \
@ -893,6 +1089,25 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j)
#define BP10GB_READ_REG(a, reg) ( \
readl((void *)((a)->mem_map) + BP10GB_##reg))
#define BP10G_WRITE_FLUSH(a) BP10G_READ_REG(a, STATUS)
#define BP40G_READ_REG(a, reg) ( \
readl((void *)((a)->mem_map) + BP40G_##reg+0x4*((a)->func)))
#define BP40G_WRITE_REG(a, reg, value) \
(writel((value), (void *)(((a)->mem_map) + BP40G_##reg+0x4*((a)->func))))
#define BP40G_READ_GPIO_CTL(a, n) ( \
readl((void *)((a)->mem_map) + 0x88100+0x4*n))
#define BP40G_WRITE_GPIO_CTL(a, n, value) \
(writel((value), (void *)(((a)->mem_map) + 0x88100+0x4*n)))
#define BP40G_WR_REG(a, reg, value) \
(writel((value), (void *)(((a)->mem_map) + BP40G_##reg)))
#define BP40G_RD_REG(a, reg) ( \
readl((void *)((a)->mem_map) + BP40G_##reg))
#endif

View File

@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define GET_WD_SET_CAPS_ENTRY "get_wd_set_caps"
#define SET_BYPASS_ENTRY "set_bypass"
#define GET_BYPASS_ENTRY "get_bypass"
#define GET_WD_EXPIRE_ENTRY "get_wd_expire"
#define GET_BYPASS_CHANGE_ENTRY "get_bypass_change"
#define SET_DIS_BYPASS_ENTRY "set_dis_bypass"
#define GET_DIS_BYPASS_ENTRY "get_dis_bypass"
@ -62,11 +63,12 @@ POSSIBILITY OF SUCH DAMAGE.
#define BYPASS_DISABLE "off"
#define TAP_MODE "tap"
#define BYPASS_MODE "bypass"
#define DISC_MODE "disc"
#define DISC_MODE "disc"
#define SET_TAP_ENTRY "set_tap"
#define GET_TAP_ENTRY "get_tap"
#define SET_FORCE_LINK_ENTRY "set_force_link_on"
#define GET_FORCE_LINK_ENTRY "get_force_link_on"
#define SET_BP_MANUF_ENTRY "set_bp_manuf"
#define SET_HW_RESET_ENTRY "set_hw_reset"

230
bp_util.c
View File

@ -98,6 +98,7 @@ static void bp_usage(void){
printf("set_bypass_wd - set watchdog state\n");
printf("get_bypass_wd - get watchdog state\n");
printf("get_wd_time_expire - get watchdog expired time\n");
printf("get_wd_expire - get watchdog expired status\n");
printf("reset_bypass_wd - reset watchdog timer\n");
printf("set_tx - set transmit enable / disable\n");
printf("get_tx - get transmitter state (enabled / disabled)\n");
@ -177,17 +178,43 @@ static void bp_usage(void){
else \
reset_bypass_wd_all_cmd(file_desc,dev_num);})
#define BP_MANUF_CMD(file_desc,if_index,dev_num, bus, slot, func) \
({if((bus)||(slot)||(func)||(if_index)) \
set_bp_manuf_cmd(file_desc,if_index, bus, slot, func); \
else \
set_bp_manuf_all_cmd(file_desc,dev_num);})
int if_info_msg (struct bpctl_cmd *bpctl_cmd){
int if_info_msg (int file_desc, struct bpctl_cmd *bpctl_cmd){
char if_name[IFNAMSIZ];
int ret_val = 0;
struct bpctl_cmd bpctl_cmd1;
memset(&bpctl_cmd1, 0, sizeof(bpctl_cmd1));
bpctl_cmd1.in_param[1] = bpctl_cmd->out_param[3];
bpctl_cmd1.in_param[5] = bpctl_cmd->out_param[0];
bpctl_cmd1.in_param[6] = bpctl_cmd->out_param[1];
bpctl_cmd1.in_param[7] = bpctl_cmd->out_param[2];
printf("%02x:%02x.%x ",bpctl_cmd->out_param[0],bpctl_cmd->out_param[1],bpctl_cmd->out_param[2]);
if ((bpctl_cmd->out_param[3]>0)&&(if_indextoname(bpctl_cmd->out_param[3], (char *)&if_name)!=NULL))
printf("%s ",if_name);
else printf(" ");
if ((bpctl_cmd->out_param[2]==1)||(bpctl_cmd->out_param[2]==3)) {
if ((ret_val = ioctl(file_desc, IOCTL_TX_MSG(IS_BYPASS), &bpctl_cmd1))<0) {
return 0;
}
if (bpctl_cmd1.status < 0) {
return 0;
}
/* if ((bpctl_cmd->out_param[2]==1)||(bpctl_cmd->out_param[2]==3)) { */
if (bpctl_cmd1.status == 0) {
printf("slave\n");
return 0;
} else return 1;
@ -229,7 +256,7 @@ void set_dis_bypass_cmd(int file_desc,int if_index,int bp_mode, int bus, int slo
}
}
void set_dis_bypass_all_cmd(int file_desc,int dev_num, int bp_mode){
void set_dis_bypass_all_cmd(int file_desc, int dev_num, int bp_mode){
int ret_val,i;
struct bpctl_cmd bpctl_cmd;
memset(&bpctl_cmd, 0, sizeof(bpctl_cmd));
@ -243,7 +270,7 @@ void set_dis_bypass_all_cmd(int file_desc,int dev_num, int bp_mode){
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DIS_BYPASS), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
printf("ok\n");
@ -309,7 +336,7 @@ void set_bypass_all_cmd(int file_desc,int dev_num,int tx_state){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_BYPASS), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
printf("ok\n");
@ -354,15 +381,11 @@ void set_tx_all_cmd(int file_desc,int dev_num, int tx_state){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_TX), &bpctl_cmd);
if (ret_val==0) {
ret_info=if_infox_msg(&bpctl_cmd);
if (bpctl_cmd.status==0)
printf("ok\n");
else {
if (ret_info==0)
printf("slave\n");
else printf("fail\n");
}
else
printf("fail\n");
}
}
}
@ -1090,7 +1113,7 @@ void get_dis_bypass_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DIS_BYPASS), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0) {
@ -1142,7 +1165,7 @@ void get_bypass_change_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS_CHANGE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -1198,7 +1221,7 @@ void get_bypass_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -1210,6 +1233,62 @@ void get_bypass_all_cmd(int file_desc,int dev_num){
}
}
void get_wd_expire_cmd(int file_desc,int if_index, int bus, int slot, int func){
int ret_val;
struct bpctl_cmd bpctl_cmd;
memset(&bpctl_cmd, 0, sizeof(bpctl_cmd));
bpctl_cmd.in_param[1]=if_index;
bpctl_cmd.in_param[5]=bus;
bpctl_cmd.in_param[6]= slot;
bpctl_cmd.in_param[7]= func;
if ((ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_WD_EXPIRE), &bpctl_cmd))<0) {
printf(NOT_SUPP_BPCTL_MSG);
return;
}
if (bpctl_cmd.status<0) {
printf(NOT_SUPP_BP_SLAVE_UN_MSG);
return;
}
if (bpctl_cmd.status==0)
printf("not expired\n");
else if (bpctl_cmd.status==1)
printf("expired\n");
else printf("fail\n");
}
void get_wd_expire_all_cmd(int file_desc,int dev_num){
int ret_val,i;
struct bpctl_cmd bpctl_cmd;
memset(&bpctl_cmd, 0, sizeof(bpctl_cmd));
bpctl_cmd.in_param[1]=0;
for (i=0;i<dev_num;i++) {
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_WD_EXPIRE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
printf("not expired\n");
else if (bpctl_cmd.status==1)
printf("expired\n");
else printf("fail\n");
}
}
}
void get_bypass_caps_cmd(int file_desc,int if_index, int bus, int slot, int func){
int ret_val,i;
struct bpctl_cmd bpctl_cmd;
@ -1226,7 +1305,7 @@ void get_bypass_caps_cmd(int file_desc,int if_index, int bus, int slot, int func
return;
}
if (bpctl_cmd.status<0) {
if (ret_val != 0) {
printf(NOT_SUPP_BPT_MSG);
return;
}
@ -1308,21 +1387,17 @@ void get_bypass_slave_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS_SLAVE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status!=1)
if (bpctl_cmd.status < 0)
printf("fail\n");
else {
printf("slave: %02x:%02x.%x ",bpctl_cmd.out_param[4],bpctl_cmd.out_param[5],bpctl_cmd.out_param[6]);
if ((bpctl_cmd.out_param[7]>0)&&(if_indextoname(bpctl_cmd.out_param[7], (char *)&if_name)!=NULL))
printf("%s",if_name);
printf("\n");
printf("\n");
}
}
}
}
@ -1365,7 +1440,7 @@ void is_bypass_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(IS_BYPASS), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
@ -1442,7 +1517,7 @@ void get_wd_set_caps_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_WD_SET_CAPS), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
printf("fail\n");
@ -1488,7 +1563,7 @@ void set_bypass_pwoff_all_cmd(int file_desc, int dev_num, int bypass_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_BYPASS_PWOFF), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -1540,7 +1615,7 @@ void get_bypass_pwoff_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS_PWOFF), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -1592,7 +1667,7 @@ void set_bypass_pwup_all_cmd(int file_desc, int dev_num,int bypass_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_BYPASS_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -1644,7 +1719,7 @@ void get_bypass_pwup_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -1696,7 +1771,7 @@ void set_bypass_wd_all_cmd(int file_desc, int dev_num, int timeout){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_BYPASS_WD), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
@ -1750,7 +1825,7 @@ void get_bypass_wd_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS_WD), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
@ -1803,7 +1878,7 @@ void get_wd_expire_time_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_WD_EXPIRE_TIME), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
@ -1851,19 +1926,52 @@ void reset_bypass_wd_all_cmd(int file_desc, int dev_num){
struct bpctl_cmd bpctl_cmd;
memset(&bpctl_cmd, 0, sizeof(bpctl_cmd));
bpctl_cmd.in_param[0] = -1;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(RESET_BYPASS_WD_TIMER), &bpctl_cmd);
if (ret_val == 0)
printf("ok\n");
else
printf("fail\n");
}
void set_bp_manuf_cmd(int file_desc, int if_index, int bus, int slot, int func){
int ret_val;
struct bpctl_cmd bpctl_cmd;
memset(&bpctl_cmd, 0, sizeof(bpctl_cmd));
bpctl_cmd.in_param[1]=if_index;
bpctl_cmd.in_param[5]=bus;
bpctl_cmd.in_param[6]= slot;
bpctl_cmd.in_param[7]= func;
if ((ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_BP_MANUF), &bpctl_cmd))<0) {
printf(NOT_SUPP_BPCTL_MSG);
return;
}
if (bpctl_cmd.status<0)
printf("fail\n");
else printf("ok\n");
}
void set_bp_manuf_all_cmd(int file_desc, int dev_num){
int ret_val,i;
struct bpctl_cmd bpctl_cmd;
memset(&bpctl_cmd, 0, sizeof(bpctl_cmd));
bpctl_cmd.in_param[1]=0;
for (i=0;i<dev_num;i++) {
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(RESET_BYPASS_WD_TIMER), &bpctl_cmd);
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_BP_MANUF), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
printf("fail\n");
else if (bpctl_cmd.status==0)
printf("disable\n");
else printf("ok\n");
}
}
@ -1904,7 +2012,7 @@ void set_std_nic_all_cmd(int file_desc, int dev_num, int nic_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_STD_NIC), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
@ -1953,7 +2061,7 @@ void get_std_nic_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_STD_NIC), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status<0)
@ -2003,7 +2111,7 @@ void set_dis_tap_all_cmd(int file_desc,int dev_num, int tap_mode){
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DIS_TAP), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2050,7 +2158,7 @@ void set_tap_all_cmd(int file_desc,int dev_num,int tap_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_TAP), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2096,7 +2204,7 @@ void get_dis_tap_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DIS_TAP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0) {
@ -2144,7 +2252,7 @@ void get_tap_change_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_TAP_CHANGE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2192,7 +2300,7 @@ void get_tap_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_TAP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2242,7 +2350,7 @@ void set_tap_pwup_all_cmd(int file_desc, int dev_num, int tap_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_TAP_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2293,7 +2401,7 @@ void get_tap_pwup_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_TAP_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2340,7 +2448,7 @@ void set_dis_disc_all_cmd(int file_desc,int dev_num, int disc_mode){
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DIS_DISC), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2386,7 +2494,7 @@ void set_disc_all_cmd(int file_desc,int dev_num,int disc_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DISC), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2432,7 +2540,7 @@ void get_dis_disc_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DIS_DISC), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0) {
@ -2480,7 +2588,7 @@ void get_disc_change_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DISC_CHANGE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2527,7 +2635,7 @@ void get_disc_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DISC), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2577,7 +2685,7 @@ void set_disc_pwup_all_cmd(int file_desc, int dev_num, int disc_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DISC_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2628,7 +2736,7 @@ void get_disc_pwup_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DISC_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2675,7 +2783,7 @@ void set_disc_port_all_cmd(int file_desc,int dev_num,int disc_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DISC_PORT), &bpctl_cmd);
if (ret_val==0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2722,7 +2830,7 @@ void get_disc_port_all_cmd(int file_desc,int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DISC_PORT), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2772,7 +2880,7 @@ void set_disc_port_pwup_all_cmd(int file_desc, int dev_num, int disc_mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_DISC_PORT_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2823,7 +2931,7 @@ void get_disc_port_pwup_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_DISC_PORT_PWUP), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2871,7 +2979,7 @@ void set_wd_exp_mode_all_cmd(int file_desc, int dev_num, int mode){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(SET_WD_EXP_MODE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
@ -2918,7 +3026,7 @@ void get_wd_exp_mode_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_WD_EXP_MODE), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0)
printf("bypass\n");
@ -2967,7 +3075,7 @@ void get_bypass_info_all_cmd(int file_desc, int dev_num){
bpctl_cmd.in_param[0]=i;
ret_val = ioctl(file_desc, IOCTL_TX_MSG(GET_BYPASS_INFO), &bpctl_cmd);
if (ret_val == 0) {
if (if_info_msg(&bpctl_cmd)==0)
if (if_info_msg(file_desc, &bpctl_cmd)==0)
continue;
if (bpctl_cmd.status==0) {
printf("\n\tName\t\t\t%s\n", (char *)bpctl_cmd.data);
@ -3109,6 +3217,9 @@ int parse_cmdline(int argc, char **argp, int file_desc){
} else if (!strcmp(argp[i], GET_BYPASS_ENTRY)) {
BPCTL_GET_CMD(bypass,file_desc,if_index,dev_num, bus, slot, func);
return OK;
} else if (!strcmp(argp[i], GET_WD_EXPIRE_ENTRY)) {
BPCTL_GET_CMD(wd_expire,file_desc,if_index,dev_num, bus, slot, func);
return OK;
} else if (!strcmp(argp[i], GET_BYPASS_CHANGE_ENTRY)) {
BPCTL_GET_CMD(bypass_change,file_desc,if_index,dev_num, bus, slot, func);
return OK;
@ -3173,6 +3284,9 @@ int parse_cmdline(int argc, char **argp, int file_desc){
} else if (!strcmp(argp[i], RESET_BYPASS_WD_TIMER_ENTRY)) {
RESET_WD_CMD(file_desc,if_index,dev_num, bus, slot, func);
return OK;
} else if (!strcmp(argp[i], SET_BP_MANUF_ENTRY)) {
BP_MANUF_CMD(file_desc,if_index,dev_num, bus, slot, func);
return OK;
} else if (!strcmp(argp[i], SET_TAP_ENTRY)) {
int bypass_mode=0;
if ((argc<(i+2))||((bypass_mode=parse_bypass_mode(argp[i+1]))<0))

View File

@ -40,11 +40,11 @@ POSSIBILITY OF SUCH DAMAGE.
#define APP_NAME "Bypass-SD Control utility"
#define COPYRT_MSG "Copyright Silicom Ltd."
#define PROG_NAME "bpctl_util"
#define UTIL_VER VER_STR_SET
#define UTIL_VER "5.2.0.41"
#define OK 1
#define ERROR 0
#define OK 0
#define ERROR 1
#define HELP_ENTRY "help"
#define INFO_ENTRY "info"

View File

@ -1,36 +1,3 @@
#**************************************************************************
#
# Copyright (c) 2006-2013, Silicom
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Silicom nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#***************************************************************************
#!/bin/sh
drv_name="bpctl_mod"
dev_node="bpctl"

View File

@ -1,36 +1,3 @@
#**************************************************************************
#
# Copyright (c) 2006-2013, Silicom
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Silicom nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#***************************************************************************
#!/bin/sh
/sbin/rmmod bpctl_mod $* || exit 1

View File

@ -128,7 +128,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TMRH_REG_ADDR 3
/* NEW_FW */
#define WDT_INTERVAL 1 //5 //8
#define WDT_INTERVAL 5 //20
#define WDT_CMND_INTERVAL 200 //50
#define CMND_INTERVAL 200 //100 /* usec */
#define PULSE_TIME 100
@ -204,10 +204,10 @@ POSSIBILITY OF SUCH DAMAGE.
#define TX_ENB_PWRUP 0xA5
#define BYPASS_CAP_DELAY 21 /* msec */
#define BYPASS_CAP_DELAY 35 /* msec */
#define DFLT_PWRON_DELAY 10 /* msec */
#define LATCH_DELAY 13 /* msec */
#define EEPROM_WR_DELAY 8 /* msec */
#define LATCH_DELAY 15 /* msec */
#define EEPROM_WR_DELAY 20 /* msec */
#define BP_LINK_MON_DELAY 4 /* sec */
@ -223,12 +223,12 @@ POSSIBILITY OF SUCH DAMAGE.
#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

335
common.mk Executable file
View File

@ -0,0 +1,335 @@
################################################################################
#
# Intel(R) 10GbE PCI Express Linux Network Driver
# Copyright(c) 1999 - 2017 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
# Contact Information:
# Linux NICS <linux.nics@intel.com>
# e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
#
################################################################################
# common Makefile rules useful for out-of-tree Linux driver builds
#
# Usage: include common.mk
#
# After including, you probably want to add a minimum_kver_check call
#
# Required Variables:
# DRIVER
# -- Set to the lowercase driver name
#####################
# Helpful functions #
#####################
readlink = $(shell readlink -f ${1})
# helper functions for converting kernel version to version codes
get_kver = $(or $(word ${2},$(subst ., ,${1})),0)
get_kvercode = $(shell [ "${1}" -ge 0 -a "${1}" -le 255 2>/dev/null ] && \
[ "${2}" -ge 0 -a "${2}" -le 255 2>/dev/null ] && \
[ "${3}" -ge 0 -a "${3}" -le 255 2>/dev/null ] && \
printf %d $$(( ( ${1} << 16 ) + ( ${2} << 8 ) + ( ${3} ) )) )
################
# depmod Macro #
################
cmd_depmod = /sbin/depmod $(if ${SYSTEM_MAP_FILE},-e -F ${SYSTEM_MAP_FILE}) \
$(if $(strip ${INSTALL_MOD_PATH}),-b ${INSTALL_MOD_PATH}) \
-a ${KVER}
################
# dracut Macro #
################
cmd_initrd := $(shell \
if which dracut > /dev/null 2>&1 ; then \
echo "dracut --force"; \
elif which update-initramfs > /dev/null 2>&1 ; then \
echo "update-initramfs -u"; \
fi )
#####################
# Environment tests #
#####################
DRIVER_UPPERCASE := $(shell echo ${DRIVER} | tr "[:lower:]" "[:upper:]")
ifeq (,${BUILD_KERNEL})
BUILD_KERNEL=$(shell uname -r)
endif
# Kernel Search Path
# All the places we look for kernel source
KSP := /lib/modules/${BUILD_KERNEL}/source \
/lib/modules/${BUILD_KERNEL}/build \
/usr/src/linux-${BUILD_KERNEL} \
/usr/src/linux-$(${BUILD_KERNEL} | sed 's/-.*//') \
/usr/src/kernel-headers-${BUILD_KERNEL} \
/usr/src/kernel-source-${BUILD_KERNEL} \
/usr/src/linux-$(${BUILD_KERNEL} | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
/usr/src/linux \
/usr/src/kernels/${BUILD_KERNEL} \
/usr/src/kernels
# prune the list down to only values that exist and have an include/linux
# sub-directory. We can't use include/config because some older kernels don't
# have this.
test_dir = $(shell [ -e ${dir}/include/linux ] && echo ${dir})
KSP := $(foreach dir, ${KSP}, ${test_dir})
# we will use this first valid entry in the search path
ifeq (,${KSRC})
KSRC := $(firstword ${KSP})
endif
ifeq (,${KSRC})
$(warning *** Kernel header files not in any of the expected locations.)
$(warning *** Install the appropriate kernel development package, e.g.)
$(error kernel-devel, for building kernel modules and try again)
else
ifeq (/lib/modules/${BUILD_KERNEL}/source, ${KSRC})
KOBJ := /lib/modules/${BUILD_KERNEL}/build
else
KOBJ := ${KSRC}
endif
endif
# Version file Search Path
VSP := ${KOBJ}/include/generated/utsrelease.h \
${KOBJ}/include/linux/utsrelease.h \
${KOBJ}/include/linux/version.h \
${KOBJ}/include/generated/uapi/linux/version.h \
/boot/vmlinuz.version.h
# Config file Search Path
CSP := ${KOBJ}/include/generated/autoconf.h \
${KOBJ}/include/linux/autoconf.h \
/boot/vmlinuz.autoconf.h
# System.map Search Path (for depmod)
MSP := ${KSRC}/System.map \
/boot/System.map-${BUILD_KERNEL}
# prune the lists down to only files that exist
test_file = $(shell [ -f ${file} ] && echo ${file})
VSP := $(foreach file, ${VSP}, ${test_file})
CSP := $(foreach file, ${CSP}, ${test_file})
MSP := $(foreach file, ${MSP}, ${test_file})
# and use the first valid entry in the Search Paths
ifeq (,${VERSION_FILE})
VERSION_FILE := $(firstword ${VSP})
endif
ifeq (,${CONFIG_FILE})
CONFIG_FILE := $(firstword ${CSP})
endif
ifeq (,${SYSTEM_MAP_FILE})
SYSTEM_MAP_FILE := $(firstword ${MSP})
endif
ifeq (,$(wildcard ${VERSION_FILE}))
$(error Linux kernel source not configured - missing version header file)
endif
ifeq (,$(wildcard ${CONFIG_FILE}))
$(error Linux kernel source not configured - missing autoconf.h)
endif
ifeq (,$(wildcard ${SYSTEM_MAP_FILE}))
$(warning Missing System.map file - depmod will not check for missing symbols)
endif
#######################
# Linux Version Setup #
#######################
# The following command line parameter is intended for development of KCOMPAT
# against upstream kernels such as net-next which have broken or non-updated
# version codes in their Makefile. They are intended for debugging and
# development purpose only so that we can easily test new KCOMPAT early. If you
# don't know what this means, you do not need to set this flag. There is no
# arcane magic here.
# Convert LINUX_VERSION into LINUX_VERSION_CODE
ifneq (${LINUX_VERSION},)
LINUX_VERSION_CODE=$(call get_kvercode,$(call get_kver,${LINUX_VERSION},1),$(call get_kver,${LINUX_VERSION},2),$(call get_kver,${LINUX_VERSION},3))
endif
# Honor LINUX_VERSION_CODE
ifneq (${LINUX_VERSION_CODE},)
$(warning Forcing target kernel to build with LINUX_VERSION_CODE of ${LINUX_VERSION_CODE}$(if ${LINUX_VERSION}, from LINUX_VERSION=${LINUX_VERSION}). Do this at your own risk.)
KVER_CODE := ${LINUX_VERSION_CODE}
EXTRA_CFLAGS += -DLINUX_VERSION_CODE=${LINUX_VERSION_CODE}
endif
# Determine SLE_LOCALVERSION_CODE for SuSE SLE >= 11 (needed by kcompat)
# This assumes SuSE will continue setting CONFIG_LOCALVERSION to the string
# appended to the stable kernel version on which their kernel is based with
# additional versioning information (up to 3 numbers), a possible abbreviated
# git SHA1 commit id and a kernel type, e.g. CONFIG_LOCALVERSION=-1.2.3-default
# or CONFIG_LOCALVERSION=-999.gdeadbee-default
ifeq (1,$(shell ${CC} -E -dM ${CONFIG_FILE} 2> /dev/null |\
grep -m 1 CONFIG_SUSE_KERNEL | awk '{ print $$3 }'))
ifneq (10,$(shell ${CC} -E -dM ${CONFIG_FILE} 2> /dev/null |\
grep -m 1 CONFIG_SLE_VERSION | awk '{ print $$3 }'))
LOCALVERSION := $(shell ${CC} -E -dM ${CONFIG_FILE} 2> /dev/null |\
grep -m 1 CONFIG_LOCALVERSION | awk '{ print $$3 }' |\
cut -d'-' -f2 | sed 's/\.g[[:xdigit:]]\{7\}//')
LOCALVER_A := $(shell echo ${LOCALVERSION} | cut -d'.' -f1)
LOCALVER_B := $(shell echo ${LOCALVERSION} | cut -s -d'.' -f2)
LOCALVER_C := $(shell echo ${LOCALVERSION} | cut -s -d'.' -f3)
SLE_LOCALVERSION_CODE := $(shell expr ${LOCALVER_A} \* 65536 + \
0${LOCALVER_B} \* 256 + 0${LOCALVER_C})
EXTRA_CFLAGS += -DSLE_LOCALVERSION_CODE=${SLE_LOCALVERSION_CODE}
endif
endif
EXTRA_CFLAGS += -DVER_STR_SET='\"$(MOD_VER)\"'
EXTRA_CFLAGS += -DBP_READ_REG
EXTRA_CFLAGS += -DPMC_FIX_FLAG
EXTRA_CFLAGS += -DBP_SYNC_FLAG
EXTRA_CFLAGS += -DBP_10G
#EXTRA_CFLAGS += -DADI_RANGELEY_SUPPORT
#EXTRA_CFLAGS += -BP_HW_WD_CNT
#EXTRA_CFLAGS += -DBPVM_KVM
#EXTRA_CFLAGS += -DBP_SELF_TEST
#EXTRA_CFLAGS += -DBP_LINK_FAIL_NOTIFIER
EXTRA_CFLAGS += -DBP_PROC_SUPPORT
#EXTRA_CFLAGS += -DBP_DBI_FLAG
EXTRA_CFLAGS += ${CFLAGS_EXTRA}
# get the kernel version - we use this to find the correct install path
KVER := $(shell ${CC} ${EXTRA_CFLAGS} -E -dM ${VERSION_FILE} | grep UTS_RELEASE | \
awk '{ print $$3 }' | sed 's/\"//g')
# assume source symlink is the same as build, otherwise adjust KOBJ
ifneq (,$(wildcard /lib/modules/${KVER}/build))
ifneq (${KSRC},$(call readlink,/lib/modules/${KVER}/build))
KOBJ=/lib/modules/${KVER}/build
endif
endif
ifeq (${KVER_CODE},)
KVER_CODE := $(shell ${CC} ${EXTRA_CFLAGS} -E -dM ${VSP} 2> /dev/null |\
grep -m 1 LINUX_VERSION_CODE | awk '{ print $$3 }' | sed 's/\"//g')
endif
# minimum_kver_check
#
# helper function to provide uniform output for different drivers to abort the
# build based on kernel version check. Usage: "$(call minimum_kver_check,2,6,XX)".
define _minimum_kver_check
ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,${1},${2},${3}) ]; echo "$$?"))
$$(warning *** Aborting the build.)
$$(error This driver is not supported on kernel versions older than ${1}.${2}.${3})
endif
endef
minimum_kver_check = $(eval $(call _minimum_kver_check,${1},${2},${3}))
################
# Manual Pages #
################
MANSECTION = 7
ifeq (,${MANDIR})
# find the best place to install the man page
MANPATH := $(shell (manpath 2>/dev/null || echo $MANPATH) | sed 's/:/ /g')
ifneq (,${MANPATH})
# test based on inclusion in MANPATH
test_dir = $(findstring ${dir}, ${MANPATH})
else
# no MANPATH, test based on directory existence
test_dir = $(shell [ -e ${dir} ] && echo ${dir})
endif
# our preferred install path
# should /usr/local/man be in here ?
MANDIR := /usr/share/man /usr/man
MANDIR := $(foreach dir, ${MANDIR}, ${test_dir})
MANDIR := $(firstword ${MANDIR})
endif
ifeq (,${MANDIR})
# fallback to /usr/man
MANDIR := /usr/man
endif
####################
# CCFLAGS variable #
####################
# set correct CCFLAGS variable for kernels older than 2.6.24
ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,2,6,24) ]; echo $$?))
CCFLAGS_VAR := EXTRA_CFLAGS
else
CCFLAGS_VAR := ccflags-y
endif
#################
# KBUILD_OUTPUT #
#################
# Only set KBUILD_OUTPUT if the real paths of KOBJ and KSRC differ
ifneq ($(call readlink,${KSRC}),$(call readlink,${KOBJ}))
export KBUILD_OUTPUT ?= ${KOBJ}
endif
############################
# Module Install Directory #
############################
# Default to using updates/drivers/net/ethernet/intel/ path, since depmod since
# v3.1 defaults to checking updates folder first, and only checking kernels/
# and extra afterwards. We use updates instead of kernel/* due to desire to
# prevent over-writing built-in modules files.
export INSTALL_MOD_DIR ?= updates/drivers/net/ethernet/intel/${DRIVER}
######################
# Kernel Build Macro #
######################
# kernel build function
# ${1} is the kernel build target
# ${2} may contain any extra rules to pass directly to the sub-make process
#
# This function is expected to be executed by
# @+$(call kernelbuild,<target>,<extra parameters>)
# from within a Makefile recipe.
#
# The following variables are expected to be defined for its use:
# GCC_I_SYS -- if set it will enable use of gcc-i-sys.sh wrapper to use -isystem
# CCFLAGS_VAR -- the CCFLAGS variable to set extra CFLAGS
# EXTRA_CFLAGS -- a set of extra CFLAGS to pass into the ccflags-y variable
# KSRC -- the location of the kernel source tree to build against
# DRIVER_UPPERCASE -- the uppercase name of the kernel module, set from DRIVER
#
kernelbuild = ${MAKE} $(if ${GCC_I_SYS},CC="${GCC_I_SYS}") \
${CCFLAGS_VAR}="${EXTRA_CFLAGS}" \
-C "${KSRC}" \
CONFIG_${DRIVER_UPPERCASE}=m \
M="${CURDIR}" \
${2} ${1}

View File

@ -65,7 +65,7 @@ POSSIBILITY OF SUCH DAMAGE.
struct bp_info {
char prod_name[14];
char prod_name[32];
unsigned char fw_ver;
};

View File

@ -1,7 +1,113 @@
Release Notes
Silicom Linux Bypass-SD Control Utility
Version 5.0.65
09/06/2014
Version 5.2.0.41
18/06/2019
v5.2.0.41
- Removed M2E10G2BPI9T
- Fixed M2 IDs
v5.2.0.40
- Added support for kernel 5.1.6
v5.2.0.39
- Fixed proc interface for bypass_slave command
v5.2.0.38
- Added support for M4E2G4BPi80-SD-CP,
M4E2G4BPi80-SD-CQ, M4E210G2BPI9-SR-SD-CP,
M4E210G2BPI9-SR-SD-CQ
v5.2.0.37
- Added support for kernel 4.15
v5.2.0.36
- Added support for PE2G6BPi35-SD-RB2.
v5.2.0.35
- Added KVM passthrough support for intel i350/i80.
v5.2.0.34
- Added KVM passthrough support for intel 71.
v5.2.0.33
- Added support for PE2G4BPI80-SD-RB1,
PE340G2BPI71-QS43.
- Fixed prod_name size.
v5.2.0.31
- Added support for Ubuntu 17.
- Fixed memory issue.
v5.2.0.30
- Fixed get_dis_disc for ADI RANGELEY
v5.2.0.29
- Fixed M1 IDs
v5.2.0.28.1
- Added support for ADI RANGELEY Bypass
v5.2.0.27
- Added support for PE310G2BPi71-SR,
PE310G2BPi71-LR
v5.2.0.26
- Added TPL for i80
- Removed delay log
v5.2.0.25
- Added TPL log.
- Added reset_bypass_wd_all IOCTL support.
v5.2.0.24
- Added support for 3.2.81.
v5.2.0.23
- Fixed 71 71LRD, added copper tpl.
v5.2.0.22
- Fixed reset for non-71 adapters.
v5.2.0.21
- Some protocol changes for updated intel 71.
v5.2.0.19
- Some interface changes for updated intel 71.
v5.2.0.19
- Some interface changes for updated intel 71.
v5.2.0.18
- Added support for updated Intel 71.
v5.2.0.15
- Added support for initial Intel 71.
v5.1.5
- Fixed sleep for KVM.
v5.1.4
- Added support for KVM.
v5.1.3
- Fixed output message for switch "all".
- Changed bpctl_util return code.
v5.1.2
- Added KVM passthrough support for 82599.
v5.1.1
- Added reboot notifier.
v5.0.66
- Moved to BSD license.
v5.0.65.1v2
- Fixed some warnings.
v5.0.65.1v
- Latch delay free version.
v5.0.65
- Fixed problem with event notifier