[SRU X][PATCH] UBUNTU: SAUCE: update OpenNSL kernel modules to 6.5.10
Juerg Haefliger
juerg.haefliger at canonical.com
Fri Oct 6 07:19:06 UTC 2017
From: Wen-chien Jesse Sung <jesse.sung at canonical.com>
BugLink: https://launchpad.net/bugs/1721511
The new version can be found at OpenNSL git repo:
https://github.com/Broadcom-Switch/OpenNSL/tree/v3.4.1.5
Signed-off-by: Wen-chien Jesse Sung <jesse.sung at canonical.com>
Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
ubuntu/opennsl/Makefile | 3 +-
ubuntu/opennsl/OpenNSL/include/sal/driver.h | 28 +-
ubuntu/opennsl/OpenNSL/include/sal/version.h | 2 +-
ubuntu/opennsl/OpenNSL/include/shared/bitop.h | 23 +-
ubuntu/opennsl/OpenNSL/include/shared/error.h | 7 +
ubuntu/opennsl/OpenNSL/include/shared/gport.h | 229 ++-
ubuntu/opennsl/OpenNSL/include/shared/pbmp.h | 25 +-
ubuntu/opennsl/OpenNSL/include/shared/pkt.h | 38 +
ubuntu/opennsl/OpenNSL/include/shared/port.h | 56 +-
.../opennsl/OpenNSL/include/shared/port_ability.h | 29 +-
ubuntu/opennsl/OpenNSL/include/shared/rx.h | 95 +-
ubuntu/opennsl/OpenNSL/include/shared/switch.h | 13 +
ubuntu/opennsl/OpenNSL/include/shared/types.h | 55 +-
.../RELEASE | 0
.../include/ibde.h | 10 +-
.../include/kcom.h | 31 +-
.../include/sal/core/sync.h | 2 +-
.../include/sal/core/thread.h | 2 +-
.../include/sal/types.h | 2 +-
.../include/sdk_config.h | 2 +-
.../include/soc/cmic.h | 2 +-
.../include/soc/devids.h | 330 +++-
.../make/Make.config | 2 +-
.../make/Make.depend | 2 +-
.../make/Make.kernlib | 5 +-
.../make/Make.lib | 4 +-
.../make/Make.linux | 4 +-
.../make/Make.subdirs | 2 +-
.../make/Make.tools | 2 +-
.../sdk-6.5.10-gpl-modules/make/Makefile.linux-gto | 115 ++
.../make/Makefile.linux-gto-2_6 | 10 +-
.../make/Makefile.linux-iproc | 93 +
.../make/Makefile.linux-iproc-3_14 | 104 ++
.../make/Makefile.linux-kernel | 2 +-
.../make/Makefile.linux-kernel-2_6 | 2 +-
.../make/Makefile.linux-kernel-3_6 | 149 ++
.../make/Makefile.linux-kernel-4_4 | 158 ++
.../make/Makefile.linux-kmodule | 7 +-
.../make/Makefile.linux-x86-common-2_6 | 4 +-
.../make/Makefile.linux-x86-generic-common-2_6 | 2 +-
.../make/Makefile.linux-x86-smp_generic_64-2_6 | 11 +-
.../systems/bde/linux/include/linux-bde.h | 34 +-
.../systems/bde/linux/include/linux_dma.h | 76 +
.../systems/bde/linux/include/mpool.h | 2 +-
.../systems/bde/linux/kernel/Makefile | 4 +-
.../systems/bde/linux/kernel/linux-kernel-bde.c | 1815 ++++++++++----------
.../systems/bde/linux/kernel/linux_dma.c | 906 ++++++++++
.../systems/bde/linux/kernel/linux_shbde.c | 0
.../systems/bde/linux/kernel/linux_shbde.h | 0
.../systems/bde/linux/shared/mpool.c | 2 +-
.../systems/bde/linux/user/kernel/Makefile | 2 +-
.../systems/bde/linux/user/kernel/linux-user-bde.c | 130 +-
.../systems/bde/linux/user/kernel/linux-user-bde.h | 2 +-
.../systems/bde/shared/include/shbde.h | 28 +-
.../systems/bde/shared/include/shbde_iproc.h | 0
.../systems/bde/shared/include/shbde_mdio.h | 0
.../systems/bde/shared/include/shbde_pci.h | 6 +
.../systems/bde/shared/shbde_iproc.c | 108 +-
.../systems/bde/shared/shbde_mdio.c | 0
.../systems/bde/shared/shbde_pci.c | 77 +-
.../systems/linux/kernel/modules/Makefile | 2 +-
.../systems/linux/kernel/modules/bcm-knet/Makefile | 2 +-
.../linux/kernel/modules/bcm-knet/bcm-knet.c | 1086 ++++++++++--
.../linux/kernel/modules/include/bcm-knet.h | 2 +-
.../systems/linux/kernel/modules/include/gmodule.h | 2 +-
.../systems/linux/kernel/modules/include/lkm.h | 2 +-
.../systems/linux/kernel/modules/shared/Makefile | 2 +-
.../systems/linux/kernel/modules/shared/gmodule.c | 10 +-
.../systems/linux/kernel/modules/shared/ksal.c | 5 +-
.../systems/linux/user/common/Makefile | 7 +-
.../systems/linux/user/gto-2_6/Makefile | 2 +-
.../systems/linux/user/gto/Makefile | 61 +
.../systems/linux/user/iproc-3_14/Makefile | 66 +
.../systems/linux/user/iproc/Makefile | 60 +
.../linux/user/x86-smp_generic_64-2_6/Makefile | 2 +-
.../tools/mktool.pl | 2 +-
76 files changed, 4815 insertions(+), 1352 deletions(-)
create mode 100644 ubuntu/opennsl/OpenNSL/include/shared/pkt.h
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/RELEASE (100%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/ibde.h (95%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/kcom.h (93%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/sal/core/sync.h (95%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/sal/core/thread.h (94%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/sal/types.h (98%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/sdk_config.h (95%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/soc/cmic.h (96%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/include/soc/devids.h (86%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.config (99%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.depend (98%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.kernlib (94%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.lib (93%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.linux (97%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.subdirs (96%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Make.tools (95%)
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-gto-2_6 (96%)
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc-3_14
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-kernel (98%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-kernel-2_6 (98%)
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-3_6
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-4_4
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-kmodule (92%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-x86-common-2_6 (93%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-x86-generic-common-2_6 (94%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/make/Makefile.linux-x86-smp_generic_64-2_6 (77%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/include/linux-bde.h (89%)
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux_dma.h
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/include/mpool.h (96%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/kernel/Makefile (96%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/kernel/linux-kernel-bde.c (84%)
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_dma.c
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/kernel/linux_shbde.c (100%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/kernel/linux_shbde.h (100%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/shared/mpool.c (99%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/user/kernel/Makefile (97%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/user/kernel/linux-user-bde.c (89%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/linux/user/kernel/linux-user-bde.h (98%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/include/shbde.h (95%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/include/shbde_iproc.h (100%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/include/shbde_mdio.h (100%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/include/shbde_pci.h (85%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/shbde_iproc.c (79%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/shbde_mdio.c (100%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/bde/shared/shbde_pci.c (80%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/Makefile (95%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/bcm-knet/Makefile (97%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/bcm-knet/bcm-knet.c (82%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/include/bcm-knet.h (96%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/include/gmodule.h (97%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/include/lkm.h (98%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/shared/Makefile (95%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/shared/gmodule.c (98%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/kernel/modules/shared/ksal.c (99%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/user/common/Makefile (97%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/user/gto-2_6/Makefile (97%)
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto/Makefile
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc-3_14/Makefile
create mode 100644 ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc/Makefile
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/systems/linux/user/x86-smp_generic_64-2_6/Makefile (96%)
rename ubuntu/opennsl/OpenNSL/{sdk-6.4.10-gpl-modules => sdk-6.5.10-gpl-modules}/tools/mktool.pl (99%)
diff --git a/ubuntu/opennsl/Makefile b/ubuntu/opennsl/Makefile
index ecb365845879..1cf447fabd80 100644
--- a/ubuntu/opennsl/Makefile
+++ b/ubuntu/opennsl/Makefile
@@ -2,7 +2,7 @@
# Makefile for OpenNSL drivers
#
-SDK=OpenNSL/sdk-6.4.10-gpl-modules
+SDK=OpenNSL/sdk-6.5.10-gpl-modules
OP=ubuntu/opennsl/$(SDK)
ccflags-y += \
@@ -25,6 +25,7 @@ linux-bcm-knet-objs := \
obj-$(CONFIG_OPENNSL_KERNEL_BDE) += linux-kernel-bde.o
linux-kernel-bde-objs := \
+ $(SDK)/systems/bde/linux/kernel/linux_dma.o \
$(SDK)/systems/bde/linux/kernel/linux-kernel-bde.o \
$(SDK)/systems/bde/linux/kernel/linux_shbde.o \
$(SDK)/systems/bde/linux/shared/mpool.o \
diff --git a/ubuntu/opennsl/OpenNSL/include/sal/driver.h b/ubuntu/opennsl/OpenNSL/include/sal/driver.h
index d142152e46a8..9709c8efc547 100644
--- a/ubuntu/opennsl/OpenNSL/include/sal/driver.h
+++ b/ubuntu/opennsl/OpenNSL/include/sal/driver.h
@@ -1,6 +1,6 @@
/*********************************************************************
*
-* (C) Copyright Broadcom Corporation 2013-2016
+* (C) Copyright Broadcom Corporation 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,8 @@
#ifndef DRIVER_H
#define DRIVER_H
+#define OPENNSL_F_FAST_BOOT 0x00000001 /* Fast boot mode */
+
typedef struct opennsl_config_s
{
char *cfg_fname; /* Configuration file name along with the path */
@@ -31,6 +33,9 @@ typedef struct opennsl_config_s
char *wb_fname; /* File to store warmboot configuration *
* along with the path */
char *rmcfg_fname; /* RM config file name along with the path */
+ char *cfg_post_fname; /* Post init configuration file name *
+ * along with the path */
+ unsigned int opennsl_flags; /* OpenNSL flags */
} opennsl_init_t;
/*****************************************************************//**
@@ -43,6 +48,13 @@ typedef struct opennsl_config_s
********************************************************************/
extern int opennsl_driver_init(opennsl_init_t *init);
+/*****************************************************************//**
+* \brief Function to free up the resources and exit the driver
+*
+* \return OPENNSL_E_XXX OpenNSL API return code
+********************************************************************/
+extern int opennsl_driver_exit();
+
/**************************************************************************//**
* \brief To get platform boot flags
*
@@ -50,6 +62,7 @@ extern int opennsl_driver_init(opennsl_init_t *init);
*****************************************************************************/
extern unsigned int opennsl_driver_boot_flags_get(void);
+#ifdef INCLUDE_DIAG_SHELL
/*****************************************************************//**
* \brief Bringup diagnostic shell prompt and process the input commands.
*
@@ -65,6 +78,19 @@ extern int opennsl_driver_shell();
* \return OPENNSL_E_XXX OpenNSL API return code
********************************************************************/
extern int opennsl_driver_process_command(char *commandBuf);
+#endif
+/*****************************************************************//**
+* \brief Get a line from a user with editing
+*
+* \param prompt [IN] prompt string
+*
+* \return char* NULL, if the line is empty
+* empty string, if the line is blank
+* text of the line read, otherwise.
+********************************************************************/
extern char *readline(const char *prompt);
+
+extern void platform_phy_cleanup();
+
#endif /* DRIVER_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/sal/version.h b/ubuntu/opennsl/OpenNSL/include/sal/version.h
index 1913f0508b50..44907583f341 100644
--- a/ubuntu/opennsl/OpenNSL/include/sal/version.h
+++ b/ubuntu/opennsl/OpenNSL/include/sal/version.h
@@ -1,6 +1,6 @@
/**************************************************************************
*
-* (C) Copyright Broadcom Corporation 2013-2016
+* (C) Copyright Broadcom Limited 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/bitop.h b/ubuntu/opennsl/OpenNSL/include/shared/bitop.h
index 45c1eed87412..31d55a636fd6 100644
--- a/ubuntu/opennsl/OpenNSL/include/shared/bitop.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/bitop.h
@@ -34,8 +34,20 @@
/* Size for giving to malloc and memset to handle _max bits */
#define SHR_BITALLOCSIZE(_max) (_SHR_BITDCLSIZE(_max) * sizeof (SHR_BITDCL))
+
+/* (internal) Number of SHR_BITDCLs needed to contain from start bit to start bit + range */
+#define _SHR_BITDCLSIZE_FROM_START_BIT(_start_bit, _range) (_range + _start_bit -1)/SHR_BITWID - _start_bit/SHR_BITWID + 1
+
+/* Size of SHR_BITDCLs needed to contain from start bit to start bit + range.
+ Needed when you want to do autosync */
+#define SHR_BITALLOCSIZE_FROM_START_BIT(_start_bit, _range) (_SHR_BITDCLSIZE_FROM_START_BIT(_start_bit, _range) * sizeof (SHR_BITDCL))
+
+
+
/* Declare bit array _n of size _max bits */
#define SHR_BITDCLNAME(_n, _max) SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)]
+/* Declare bit array _n of size _max bits, and clear it */
+#define SHR_BIT_DCL_CLR_NAME(_n, _max) SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)] = {0}
/* (internal) Generic operation macro on bit array _a, with bit _b */
#define _SHR_BITOP(_a, _b, _op) \
@@ -45,6 +57,7 @@
#define SHR_BITGET(_a, _b) _SHR_BITOP(_a, _b, &)
#define SHR_BITSET(_a, _b) _SHR_BITOP(_a, _b, |=)
#define SHR_BITCLR(_a, _b) _SHR_BITOP(_a, _b, &= ~)
+#define SHR_BITWRITE(_a, _b, _val) ((_val) ? SHR_BITSET(_a, _b) : SHR_BITCLR(_a, _b))
#define SHR_BIT_ITER(_a, _max, _b) \
for ((_b) = 0; (_b) < (_max); (_b)++) \
if ((_a)[(_b) / SHR_BITWID] == 0) \
@@ -63,17 +76,17 @@ extern void shr_bitop_range_set(SHR_BITDCL *a, CONST int b, CONST int c);
(shr_bitop_range_set(_a, _b, _c))
/*
- * Copy _e bits from bit array _c offset _d to bit array _a offset _b
- * There should be no overlap between source _c and desstination _a
- * _a[_b:_b + _e] = _c[_d:_d + _e]
+ * Copy _num_bits bits from bit array _src offset _src_offset to bit array _dest offset _dest_offset
+ * There should be no overlap between source _src and desstination _dest
+ * _dest[_dest_offset:_dest_offset + _num_bits] = _src[_src_offset:_src_offset + _num_bits]
*/
extern void shr_bitop_range_copy(SHR_BITDCL *a,
CONST int b,
CONST SHR_BITDCL *c,
CONST int d,
CONST int e);
-#define SHR_BITCOPY_RANGE(_a, _b, _c, _d, _e) \
- (shr_bitop_range_copy(_a, _b, _c, _d, _e))
+#define SHR_BITCOPY_RANGE(_dest, _dest_offset,_src, _src_offset, _num_bits) \
+ (shr_bitop_range_copy(_dest, _dest_offset, _src, _src_offset, _num_bits))
/* Result is 0 only if all bits in the range are 0 */
#define SHR_BITTEST_RANGE(_bits, _first, _bit_count, _result) \
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/error.h b/ubuntu/opennsl/OpenNSL/include/shared/error.h
index f0afc2e71044..152aee5195c9 100644
--- a/ubuntu/opennsl/OpenNSL/include/shared/error.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/error.h
@@ -87,6 +87,10 @@ extern char *_shr_errmsg[];
#define _SHR_E_IF_ERROR_RETURN(op) \
do { int __rv__; if ((__rv__ = (op)) < 0) { _SHR_ERROR_TRACE(__rv__); return(__rv__); } } while(0)
+
+#define _SHR_E_IF_ERROR_CLEAN_RETURN(op,exop) \
+ do { int __rv__; if ((__rv__ = (op)) < 0) { _SHR_ERROR_TRACE(__rv__); (exop); return(__rv__); } } while(0)
+
#define _SHR_E_IF_ERROR_NOT_UNAVAIL_RETURN(op) \
do { \
int __rv__; \
@@ -94,6 +98,8 @@ extern char *_shr_errmsg[];
return(__rv__); \
} \
} while(0)
+
+
typedef enum {
_SHR_SWITCH_EVENT_IO_ERROR = 1,
_SHR_SWITCH_EVENT_PARITY_ERROR = 2,
@@ -112,6 +118,7 @@ typedef enum {
_SHR_SWITCH_EVENT_MMU_BST_TRIGGER = 15,
_SHR_SWITCH_EVENT_EPON_ALARM = 16,
_SHR_SWITCH_EVENT_RUNT_DETECT = 17,
+ _SHR_SWITCH_EVENT_AUTONEG_SPEED_ERROR = 18,
_SHR_SWITCH_EVENT_COUNT /* last, as always */
} _shr_switch_event_t;
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/gport.h b/ubuntu/opennsl/OpenNSL/include/shared/gport.h
index 662756d41372..39e15270fcb1 100755
--- a/ubuntu/opennsl/OpenNSL/include/shared/gport.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/gport.h
@@ -1,6 +1,6 @@
/*********************************************************************
*
- * (C) Copyright Broadcom Corporation 2013-2016
+ * (C) Copyright Broadcom Corporation 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,7 @@
*
**********************************************************************
* File: gport.h
- * Details: This file defines common error codes to be shared
- * between API layers.
+ * Details: This file defines gport (generic port) parameters.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
@@ -37,35 +36,46 @@
#define _SHR_GPORT_NONE (0)
#define _SHR_GPORT_INVALID (-1)
+
#define _SHR_GPORT_TYPE_LOCAL 1 /* Port on local unit */
#define _SHR_GPORT_TYPE_MODPORT 2 /* Module ID and port */
#define _SHR_GPORT_TYPE_TRUNK 3 /* Trunk ID */
+#define _SHR_GPORT_TYPE_BLACK_HOLE 4 /* Black hole destination */
#define _SHR_GPORT_TYPE_LOCAL_CPU 5 /* CPU destination */
#define _SHR_GPORT_TYPE_UCAST_QUEUE_GROUP 9 /* Queue Group */
#define _SHR_GPORT_TYPE_MCAST 11 /* Multicast Set */
#define _SHR_GPORT_TYPE_MCAST_QUEUE_GROUP 12 /* Multicast Queue Group */
#define _SHR_GPORT_TYPE_SCHEDULER 13 /* Scheduler */
+#define _SHR_GPORT_TYPE_MIRROR 15 /* Mirror destination. */
+#define _SHR_GPORT_TYPE_TUNNEL 19 /* Tunnel ID */
#define _SHR_GPORT_TYPE_CHILD 20 /* Child port */
#define _SHR_GPORT_TYPE_EGRESS_GROUP 21 /* Egress group port */
#define _SHR_GPORT_TYPE_EGRESS_CHILD 22 /* Egress child port */
#define _SHR_GPORT_TYPE_EGRESS_MODPORT 23 /* Egress Mod and port */
#define _SHR_GPORT_TYPE_UCAST_SUBSCRIBER_QUEUE_GROUP 24 /* Local Queue Group */
#define _SHR_GPORT_TYPE_MCAST_SUBSCRIBER_QUEUE_GROUP 25 /* Local Multicast Queue Group */
+#define _SHR_GPORT_TYPE_SYSTEM_PORT 27 /* DPP System-Port */
#define _SHR_GPORT_TYPE_COSQ 30 /* cosq gport */
#define _SHR_GPORT_TYPE_PROFILE 40
#define _SHR_GPORT_TYPE_DESTMOD_QUEUE_GROUP 41 /* DMVOQ gport */
+/* definitions for cosq core handling */
+#define _SHR_COSQ_GPORT_COMMON_QUEUE_BITS 18
+#define _SHR_COSQ_GPORT_COMMON_QUEUE_MASK ((1 << _SHR_COSQ_GPORT_COMMON_QUEUE_BITS) - 1)
#define _SHR_COSQ_GPORT_COMMON_CORE_BITS 3
+#define _SHR_COSQ_GPORT_COMMON_CORE_SHIFT _SHR_COSQ_GPORT_COMMON_QUEUE_BITS
#define _SHR_COSQ_GPORT_COMMON_CORE_MASK ((1 << _SHR_COSQ_GPORT_COMMON_CORE_BITS) - 1)
#define _SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE _SHR_COSQ_GPORT_COMMON_CORE_MASK
-
+/*
+ * Note that only the bits under _SHR_COSQ_GPORT_CORE_MASK are considred
+ * See, e.g. _SHR_COSQ_GPORT_CORE_GET
+ */
#define _SHR_CORE_ALL -17
#define _SHR_CORE_FIELD2ID(field) ((field) != _SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE ? field : _SHR_CORE_ALL)
#define _SHR_CORE_ID2FIELD(id) ((id) != _SHR_CORE_ALL ? id : _SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE)
#define _SHR_GPORT_TYPE_SHIFT 26
#define _SHR_GPORT_TYPE_MASK 0x3f
-
#define _SHR_GPORT_MODID_SHIFT 11
#define _SHR_GPORT_MODID_MASK 0x7fff
#define _SHR_GPORT_PORT_SHIFT 0
@@ -78,12 +88,52 @@
#define _SHR_GPORT_UCAST_QUEUE_GROUP_QID_MASK 0x3fff
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_SHIFT 14
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_MASK 0xfff
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_QID_SHIFT 0
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_QID_MASK 0x3fff
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_SHIFT 14
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_MASK 0xfff
#define _SHR_GPORT_SCHEDULER_SHIFT 0
#define _SHR_GPORT_SCHEDULER_MASK 0x7fffff
#define _SHR_GPORT_SCHEDULER_CORE_SHIFT 23
#define _SHR_GPORT_SCHEDULER_CORE_MASK _SHR_COSQ_GPORT_COMMON_CORE_MASK
#define _SHR_GPORT_SCHEDULER_NODE_SHIFT 0
#define _SHR_GPORT_SCHEDULER_NODE_MASK 0xfffff
+#define _SHR_GPORT_MIRROR_SHIFT 0
+#define _SHR_GPORT_MIRROR_MASK 0xffff
+#define _SHR_GPORT_TUNNEL_SHIFT 0
+#define _SHR_GPORT_TUNNEL_MASK 0x3ffffff
+#define _SHR_GPORT_SYSTEM_PORT_SHIFT 0
+#define _SHR_GPORT_SYSTEM_PORT_MASK 0xffffff
+
+#define _SHR_GPORT_TYPE_TRAP ((_SHR_GPORT_TYPE_LOCAL_CPU << 1) | 1) /* This will mark the CPU type, and
+ the 1st bit in the value to indicate trap */
+#define _SHR_GPORT_TYPE_TRAP_SHIFT (_SHR_GPORT_TYPE_SHIFT-1) /* 25 */
+#define _SHR_GPORT_TYPE_TRAP_MASK (_SHR_GPORT_TYPE_MASK<<1|1) /* 0x4f */
+#define _SHR_GPORT_TRAP_ID_SHIFT 0
+#define _SHR_GPORT_TRAP_ID_MASK 0xfff
+#define _SHR_GPORT_TRAP_STRENGTH_SHIFT 12
+#define _SHR_GPORT_TRAP_STRENGTH_MASK 0xf
+#define _SHR_GPORT_TRAP_SNOOP_STRENGTH_SHIFT 16
+#define _SHR_GPORT_TRAP_SNOOP_STRENGTH_MASK 0xf
+
+#define _SHR_GPORT_LOCAL_TYPE_COMMON (0)
+#define _SHR_GPORT_LOCAL_TYPE_FABRIC (1)
+#define _SHR_GPORT_LOCAL_TYPE_SHIFT (21)
+#define _SHR_GPORT_LOCAL_TYPE_MASK (0x1f)
+
+#define _SHR_GPORT_IS_LOCAL(_gport) \
+ (((((_gport) >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK) == \
+ _SHR_GPORT_TYPE_LOCAL) && \
+ ((((_gport) >> _SHR_GPORT_LOCAL_TYPE_SHIFT) & _SHR_GPORT_LOCAL_TYPE_MASK) == \
+ _SHR_GPORT_LOCAL_TYPE_COMMON))
+
+#define _SHR_GPORT_LOCAL_SET(_gport, _port)\
+ ((_gport) = (_SHR_GPORT_TYPE_LOCAL << _SHR_GPORT_TYPE_SHIFT) |\
+ (_SHR_GPORT_LOCAL_TYPE_COMMON << _SHR_GPORT_LOCAL_TYPE_SHIFT)|\
+ (((_port) & _SHR_GPORT_PORT_MASK) << _SHR_GPORT_PORT_SHIFT))
+
+#define _SHR_GPORT_LOCAL_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_PORT_SHIFT) & _SHR_GPORT_PORT_MASK)
#define _SHR_GPORT_IS_MODPORT(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_MODPORT)
@@ -118,6 +168,27 @@
#define _SHR_GPORT_SCHEDULER_GET(_gport) \
(((_gport) >> _SHR_GPORT_SCHEDULER_SHIFT) & _SHR_GPORT_SCHEDULER_MASK)
+#define _SHR_GPORT_SCHEDULER_CORE_GET(_gport) \
+ _SHR_CORE_FIELD2ID((((_gport) >> _SHR_GPORT_SCHEDULER_CORE_SHIFT) & _SHR_GPORT_SCHEDULER_CORE_MASK))
+
+#define _SHR_GPORT_SCHEDULER_CORE_SET(_gport, _scheduler_id, _core_id) \
+ ((_gport) = (_SHR_GPORT_TYPE_SCHEDULER << _SHR_GPORT_TYPE_SHIFT) | \
+ (((_scheduler_id) & _SHR_GPORT_SCHEDULER_MASK) << _SHR_GPORT_SCHEDULER_SHIFT) | \
+ (((_SHR_CORE_ID2FIELD(_core_id)) & _SHR_GPORT_SCHEDULER_CORE_MASK) << _SHR_GPORT_SCHEDULER_CORE_SHIFT))
+
+#define _SHR_GPORT_SCHEDULER_NODE_SET(_gport, _level, _node) \
+ ((_gport) = (_SHR_GPORT_TYPE_SCHEDULER << _SHR_GPORT_TYPE_SHIFT) | \
+ (((_level) & _SHR_GPORT_SCHEDULER_LEVEL_MASK) << _SHR_GPORT_SCHEDULER_LEVEL_SHIFT) | \
+ (((_node) & _SHR_GPORT_SCHEDULER_NODE_MASK) << _SHR_GPORT_SCHEDULER_NODE_SHIFT))
+
+#define _SHR_GPORT_SCHEDULER_NODE_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_SCHEDULER_NODE_SHIFT) & _SHR_GPORT_SCHEDULER_NODE_MASK)
+
+#define _SHR_GPORT_BLACK_HOLE \
+ (_SHR_GPORT_TYPE_BLACK_HOLE << _SHR_GPORT_TYPE_SHIFT)
+
+#define _SHR_GPORT_IS_BLACK_HOLE(_gport) ((_gport) == _SHR_GPORT_BLACK_HOLE)
+
#define _SHR_GPORT_LOCAL_CPU \
(_SHR_GPORT_TYPE_LOCAL_CPU << _SHR_GPORT_TYPE_SHIFT)
@@ -134,26 +205,150 @@
(((_sysport_id) & _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_MASK) << _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_SHIFT) | \
(((_qid) & _SHR_GPORT_UCAST_QUEUE_GROUP_QID_MASK) << _SHR_GPORT_UCAST_QUEUE_GROUP_QID_SHIFT))
+#define _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_SHIFT) & _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_MASK)
+
+#define _SHR_GPORT_UCAST_QUEUE_GROUP_QID_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_UCAST_QUEUE_GROUP_QID_SHIFT) & _SHR_GPORT_UCAST_QUEUE_GROUP_QID_MASK)
+
#define _SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_MCAST_QUEUE_GROUP)
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_SET(_gport, _qid) \
+ _SHR_GPORT_MCAST_QUEUE_GROUP_SYSQID_SET(_gport, \
+ _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_MASK, \
+ _qid)
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_GET(_gport) \
+ _SHR_GPORT_MCAST_QUEUE_GROUP_QID_GET(_gport)
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_SYSQID_SET(_gport, _sysport_id, _qid) \
+ ((_gport) = (_SHR_GPORT_TYPE_MCAST_QUEUE_GROUP << _SHR_GPORT_TYPE_SHIFT) | \
+ (((_sysport_id) & _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_MASK) << _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_SHIFT) | \
+ (((_qid) & _SHR_GPORT_MCAST_QUEUE_GROUP_QID_MASK) << _SHR_GPORT_MCAST_QUEUE_GROUP_QID_SHIFT))
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_SHIFT) & _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_MASK)
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_QID_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_MCAST_QUEUE_GROUP_QID_SHIFT) & _SHR_GPORT_MCAST_QUEUE_GROUP_QID_MASK)
+
+/* for multicast queue gports representing queue ID + core ID */
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_QUEUE_SET(_gport, _qid) \
+ ((_gport) = (_SHR_GPORT_TYPE_MCAST_QUEUE_GROUP << _SHR_GPORT_TYPE_SHIFT) | \
+ (_SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE << _SHR_COSQ_GPORT_COMMON_CORE_SHIFT) | \
+ (((_qid) & _SHR_COSQ_GPORT_COMMON_QUEUE_MASK) << _SHR_GPORT_MCAST_QUEUE_GROUP_QID_SHIFT))
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_CORE_QUEUE_SET(_gport, _core, _qid) \
+ ((_gport) = (_SHR_GPORT_TYPE_MCAST_QUEUE_GROUP << _SHR_GPORT_TYPE_SHIFT) | \
+ (_SHR_CORE_ID2FIELD(_core) << _SHR_COSQ_GPORT_COMMON_CORE_SHIFT) | \
+ (((_qid) & _SHR_COSQ_GPORT_COMMON_QUEUE_MASK) << _SHR_GPORT_MCAST_QUEUE_GROUP_QID_SHIFT))
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_QUEUE_GET(_gport) \
+ (_SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_GET(_gport) == _SHR_GPORT_MCAST_QUEUE_GROUP_SYSPORTID_MASK ? \
+ _SHR_GPORT_MCAST_QUEUE_GROUP_QID_GET(_gport) : \
+ (((_gport) >> _SHR_GPORT_MCAST_QUEUE_GROUP_QID_SHIFT) & _SHR_COSQ_GPORT_COMMON_QUEUE_MASK))
+
+#define _SHR_GPORT_MCAST_QUEUE_GROUP_CORE_GET(_gport) \
+ _SHR_CORE_FIELD2ID(((_gport) >> _SHR_COSQ_GPORT_COMMON_CORE_SHIFT) & _SHR_COSQ_GPORT_COMMON_CORE_MASK)
+
+#define _SHR_GPORT_IS_MIRROR(_gport) \
+ (((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_MIRROR)
+
+#define _SHR_GPORT_MIRROR_SET(_gport, _value) \
+ ((_gport) = (_SHR_GPORT_TYPE_MIRROR << _SHR_GPORT_TYPE_SHIFT) | \
+ (((_value) & _SHR_GPORT_MIRROR_MASK) << _SHR_GPORT_MIRROR_SHIFT))
+
+#define _SHR_GPORT_MIRROR_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_MIRROR_SHIFT) & _SHR_GPORT_MIRROR_MASK)
+
+#define _SHR_GPORT_IS_TUNNEL(_gport) \
+ (((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_TUNNEL)
+
+#define _SHR_GPORT_TUNNEL_ID_SET(_gport, _tunnel_id) \
+ ((_gport) = (_SHR_GPORT_TYPE_TUNNEL << _SHR_GPORT_TYPE_SHIFT) | \
+ (((_tunnel_id) & _SHR_GPORT_TUNNEL_MASK) << _SHR_GPORT_TUNNEL_SHIFT))
+
+#define _SHR_GPORT_TUNNEL_ID_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_TUNNEL_SHIFT) & _SHR_GPORT_TUNNEL_MASK)
+
+#define _SHR_GPORT_IS_SYSTEM_PORT(_gport) \
+ (((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_SYSTEM_PORT)
+#define _SHR_GPORT_SYSTEM_PORT_ID_GET(_gport) \
+ (((_gport) >> _SHR_GPORT_SYSTEM_PORT_SHIFT) & _SHR_GPORT_SYSTEM_PORT_MASK)
+#define _SHR_GPORT_SYSTEM_PORT_ID_SET(_gport, _id) \
+ ((_gport) = (_SHR_GPORT_TYPE_SYSTEM_PORT << _SHR_GPORT_TYPE_SHIFT) | \
+ (((_id) & _SHR_GPORT_SYSTEM_PORT_MASK) << _SHR_GPORT_SYSTEM_PORT_SHIFT))
+
#define _SHR_GPORT_IS_COSQ(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_COSQ)
-#define _SHR_GPORT_SCHEDULER_CORE_GET(_gport) \
- _SHR_CORE_FIELD2ID((((_gport) >> _SHR_GPORT_SCHEDULER_CORE_SHIFT) & _SHR_GPORT_SCHEDULER_CORE_MASK))
+#define _SHR_GPORT_TRAP_SET(_gport, _trap_id, _trap_strength, _snoop_strength) \
+ ((_gport) = (_SHR_GPORT_TYPE_TRAP << _SHR_GPORT_TYPE_TRAP_SHIFT) | \
+ (((_trap_id) & _SHR_GPORT_TRAP_ID_MASK) << _SHR_GPORT_TRAP_ID_SHIFT) | \
+ (((_trap_strength) & _SHR_GPORT_TRAP_STRENGTH_MASK) << _SHR_GPORT_TRAP_STRENGTH_SHIFT) | \
+ (((_snoop_strength) & _SHR_GPORT_TRAP_SNOOP_STRENGTH_MASK) << _SHR_GPORT_TRAP_SNOOP_STRENGTH_SHIFT) )
-#define _SHR_GPORT_SCHEDULER_CORE_SET(_gport, _scheduler_id, _core_id) \
- ((_gport) = (_SHR_GPORT_TYPE_SCHEDULER << _SHR_GPORT_TYPE_SHIFT) | \
- (((_scheduler_id) & _SHR_GPORT_SCHEDULER_MASK) << _SHR_GPORT_SCHEDULER_SHIFT) | \
- (((_SHR_CORE_ID2FIELD(_core_id)) & _SHR_GPORT_SCHEDULER_CORE_MASK) << _SHR_GPORT_SCHEDULER_CORE_SHIFT))
+#define _SHR_GPORT_TRAP_GET_ID(_gport) \
+ (((_gport) >> _SHR_GPORT_TRAP_ID_SHIFT) & _SHR_GPORT_TRAP_ID_MASK)
-#define _SHR_GPORT_SCHEDULER_NODE_SET(_gport, _level, _node) \
- ((_gport) = (_SHR_GPORT_TYPE_SCHEDULER << _SHR_GPORT_TYPE_SHIFT) | \
- (((_level) & _SHR_GPORT_SCHEDULER_LEVEL_MASK) << _SHR_GPORT_SCHEDULER_LEVEL_SHIFT) | \
- (((_node) & _SHR_GPORT_SCHEDULER_NODE_MASK) << _SHR_GPORT_SCHEDULER_NODE_SHIFT))
+#define _SHR_GPORT_TRAP_GET_STRENGTH(_gport) \
+ (((_gport) >> _SHR_GPORT_TRAP_STRENGTH_SHIFT & _SHR_GPORT_TRAP_STRENGTH_MASK))
-#define _SHR_GPORT_SCHEDULER_NODE_GET(_gport) \
- (((_gport) >> _SHR_GPORT_SCHEDULER_NODE_SHIFT) & _SHR_GPORT_SCHEDULER_NODE_MASK)
+#define _SHR_GPORT_TRAP_GET_SNOOP_STRENGTH(_gport) \
+ (((_gport) >> _SHR_GPORT_TRAP_SNOOP_STRENGTH_SHIFT & _SHR_GPORT_TRAP_SNOOP_STRENGTH_MASK))
+
+#define _SHR_GPORT_IS_TRAP(_gport) \
+ (((_gport) >> _SHR_GPORT_TYPE_TRAP_SHIFT) == _SHR_GPORT_TYPE_TRAP)
+
+#define _SHR_FIELD_CTR_PROC_MASK_LEGACY ((1 << 2) - 1) /*2 bits for counter engines in Arad */
+#define _SHR_FIELD_CTR_PROC_SHIFT_LEGACY 29 /* minimum 20 for the Statistic-Report Counter in Arad */
+#define _SHR_FIELD_CTR_SET_MASK_LEGACY ((1 << _SHR_FIELD_CTR_PROC_SHIFT_LEGACY) - 1)
+#define _SHR_FIELD_CTR_SET_SHIFT_LEGACY 0
+
+#define _SHR_FIELD_STAT_ID_PROC_LEGACY_GET(_stat_id) \
+ (((_stat_id) >> _SHR_FIELD_CTR_PROC_SHIFT_LEGACY) & _SHR_FIELD_CTR_PROC_MASK_LEGACY)
+
+#define _SHR_FIELD_STAT_ID_CNTR_LEGACY_GET(_stat_id) \
+ (((_stat_id) >> _SHR_FIELD_CTR_SET_SHIFT_LEGACY) & _SHR_FIELD_CTR_SET_MASK_LEGACY)
+
+#define _SHR_FIELD_STAT_ID_LEGACY_SET(_proc, _ctr) \
+ ((((_proc) & _SHR_FIELD_CTR_PROC_MASK_LEGACY) << _SHR_FIELD_CTR_PROC_SHIFT_LEGACY)\
+ | (((_ctr) & _SHR_FIELD_CTR_SET_MASK_LEGACY) << _SHR_FIELD_CTR_SET_SHIFT_LEGACY))
+
+#define _SHR_FIELD_STAT_ID_IS_LEGACY(_stat_id) (!((_stat_id >> 31) & 0x1))
+#define _SHR_FIELD_STAT_ID_LEGACY (0x1 << 31)
+
+/* minimum 20 for the Statistic-Report Counter in Arad */
+#define _SHR_FIELD_CTR_PROC_MASK ((1 << 4) - 1) /*4 bits for counter engines in Arad */
+
+#define _SHR_FIELD_CTR_PROC_SHIFT 27 /* minimum 20 for the Statistic-Report Counter in Jericho */
+#define _SHR_FIELD_CTR_SET_MASK ((1 << _SHR_FIELD_CTR_PROC_SHIFT) - 1)
+#define _SHR_FIELD_CTR_SET_SHIFT 0
+
+#define _SHR_FIELD_CTR_PROC_SHIFT_GET(_stat_id) (_SHR_FIELD_STAT_ID_IS_LEGACY(_stat_id) ? _SHR_FIELD_CTR_PROC_SHIFT_LEGACY : _SHR_FIELD_CTR_PROC_SHIFT)
+#define _SHR_FIELD_STAT_ID_PROC_NEW_GET(_stat_id) \
+ (((_stat_id) >> _SHR_FIELD_CTR_PROC_SHIFT) & _SHR_FIELD_CTR_PROC_MASK)
+
+#define _SHR_FIELD_STAT_ID_CNTR_NEW_GET(_stat_id) \
+ (((_stat_id) >> _SHR_FIELD_CTR_SET_SHIFT) & _SHR_FIELD_CTR_SET_MASK)
+
+#define _SHR_FIELD_STAT_ID_NEW_SET(_proc, _ctr) \
+ (_SHR_FIELD_STAT_ID_LEGACY | \
+ (((_proc) & _SHR_FIELD_CTR_PROC_MASK) << _SHR_FIELD_CTR_PROC_SHIFT)|\
+ (((_ctr) & _SHR_FIELD_CTR_SET_MASK) << _SHR_FIELD_CTR_SET_SHIFT))
+
+#define _SHR_FIELD_STAT_ID_PROCESSOR_GET(_stat_id) \
+ (_SHR_FIELD_STAT_ID_IS_LEGACY(_stat_id) ? \
+ _SHR_FIELD_STAT_ID_PROC_LEGACY_GET(_stat_id) : \
+ _SHR_FIELD_STAT_ID_PROC_NEW_GET(_stat_id))
+
+#define _SHR_FIELD_STAT_ID_COUNTER_GET(_stat_id) \
+ (_SHR_FIELD_STAT_ID_IS_LEGACY(_stat_id) ? \
+ _SHR_FIELD_STAT_ID_CNTR_LEGACY_GET(_stat_id) : \
+ _SHR_FIELD_STAT_ID_CNTR_NEW_GET(_stat_id))
+
+#define _SHR_FIELD_STAT_ID_SET(_stat_id, _proc, _ctr) \
+ (_stat_id = _SHR_FIELD_STAT_ID_NEW_SET(_proc, _ctr))
#endif /* !_SHR_GPORT_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/pbmp.h b/ubuntu/opennsl/OpenNSL/include/shared/pbmp.h
index 6156502017c7..21fc962093d2 100644
--- a/ubuntu/opennsl/OpenNSL/include/shared/pbmp.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/pbmp.h
@@ -1,6 +1,6 @@
/*********************************************************************
*
- * (C) Copyright Broadcom Corporation 2013-2016
+ * (C) Copyright Broadcom Corporation 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -90,7 +90,12 @@
*/
#ifndef _SHR_PBMP_WIDTH
+#undef _SHR_PBMP_PORT_MAX
+#ifndef OPENNSL_PRODUCT_DNX
#define _SHR_PBMP_PORT_MAX 256
+#else
+#define _SHR_PBMP_PORT_MAX 571
+#endif
#define _SHR_PBMP_WIDTH (((_SHR_PBMP_PORT_MAX + 32 - 1)/32)*32)
#endif
@@ -245,6 +250,10 @@ extern int _shr_pbmp_bmeq(_shr_pbmp_t *, _shr_pbmp_t *);
for ((port) = 0; (port) < _SHR_PBMP_PORT_MAX; (port)++) \
if (_SHR_PBMP_MEMBER((bm), (port)))
+#define _SHR_PBMP_REVERSE_ITER(bm, port) \
+ for ((port) = _SHR_PBMP_PORT_MAX - 1; (port) > -1; (port)--) \
+ if (_SHR_PBMP_MEMBER((bm), (port)))
+
#define _SHR_PBMP_IS_NULL(bm) (_SHR_PBMP_BMNULL(bm))
#define _SHR_PBMP_NOT_NULL(bm) (!_SHR_PBMP_BMNULL(bm))
#define _SHR_PBMP_EQ(bma, bmb) (_SHR_PBMP_BMEQ(bma, bmb))
@@ -259,6 +268,18 @@ extern int _shr_pbmp_bmeq(_shr_pbmp_t *, _shr_pbmp_t *);
#define _SHR_PBMP_NEGATE(bma, bmb) _SHR_PBMP_BMOP(bma, bmb, = ~)
/* Port PBMP operators */
+#define _SHR_PBMP_FIRST(bm, first_port) \
+ do {\
+ _SHR_PBMP_ITER(bm, first_port) {break;} \
+ if (first_port == _SHR_PBMP_PORT_MAX) first_port = -1; \
+ } while(0)
+
+#define _SHR_PBMP_LAST(bm, last_port) \
+ do {\
+ _SHR_PBMP_REVERSE_ITER(bm, last_port) {break;} \
+ } while(0)
+
+
#define _SHR_PBMP_ENTRY(bm, port) \
(_SHR_PBMP_WORD_GET(bm,_SHR_PBMP_WENT(port)))
#define _SHR_PBMP_MEMBER(bm, port) \
@@ -277,4 +298,6 @@ extern char *_shr_pbmp_format(_shr_pbmp_t, char *);
#define _SHR_PBMP_FMT(bm, buf) _shr_pbmp_format(bm, buf)
#define _SHR_PBMP_FMT_LEN ((_SHR_PBMP_WORD_MAX*8)+3)
+#define _SHR_PBMP_PORT_VALID(p) ((p) >= 0 && (p) < _SHR_PBMP_PORT_MAX)
+
#endif /* !_SHR_PBMP_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/pkt.h b/ubuntu/opennsl/OpenNSL/include/shared/pkt.h
new file mode 100644
index 000000000000..dfcc31561014
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/include/shared/pkt.h
@@ -0,0 +1,38 @@
+/*********************************************************************
+ *
+ * (C) Copyright Broadcom Corporation 2013-2016
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ **********************************************************************
+ * File: pkt.h
+ * Details: This file defines for pkt module.
+ *
+ * Its contents are not used directly by applications;
+ * it is used only by header files of parent APIs which
+ * need to define PHY register definition.
+ *********************************************************************/
+
+#ifndef _SHR_PKT_H
+#define _SHR_PKT_H
+#include <shared/types.h>
+#include <shared/pbmp.h>
+#include <shared/rx.h>
+#include <shared/port.h>
+
+
+
+#define _SHR_PKT_NOF_DNX_HEADERS 9
+#define _SHR_PKT_DNX_RAW_SIZE_MAX 20
+
+#endif /* _SHR_PKT_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/port.h b/ubuntu/opennsl/OpenNSL/include/shared/port.h
index 7a1658921947..09ca21e71944 100755
--- a/ubuntu/opennsl/OpenNSL/include/shared/port.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/port.h
@@ -1,6 +1,6 @@
/*********************************************************************
*
- * (C) Copyright Broadcom Corporation 2013-2016
+ * (C) Copyright Broadcom Corporation 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,6 +115,13 @@ typedef enum _shr_port_if_e {
_SHR_PORT_IF_LR2,
_SHR_PORT_IF_LRM,
_SHR_PORT_IF_XLPPI,
+ _SHR_PORT_IF_2500X,
+ _SHR_PORT_IF_SAT,
+ _SHR_PORT_IF_IPSEC,
+ _SHR_PORT_IF_LBG,
+ _SHR_PORT_IF_CAUI4,
+ _SHR_PORT_IF_5000X,
+ _SHR_PORT_IF_EVENTOR,
_SHR_PORT_IF_COUNT /* last, please */
} _shr_port_if_t;
@@ -173,4 +180,51 @@ typedef enum _shr_port_medium_e {
_SHR_PORT_MEDIUM_COUNT /* last, please */
} _shr_port_medium_t;
+/*
+ * Defines:
+ * _SHR_PORT_PHY_CONTROL_*
+ * Purpose:
+ * PHY specific control settings
+ */
+typedef enum _shr_port_phy_control_e {
+ _SHR_PORT_PHY_CONTROL_FORWARD_ERROR_CORRECTION = 74,
+ _SHR_PORT_PHY_CONTROL_SOFTWARE_RX_LOS = 214,
+ _SHR_PORT_PHY_CONTROL_SOFTWARE_RX_LOS_LINK_WAIT_TIMER_US = 328,
+ _SHR_PORT_PHY_CONTROL_SOFTWARE_RX_LOS_RESTART_TIMER_US = 329
+} _shr_port_phy_control_t;
+
+/*
+ * Defines:
+ * _SHR_PORT_PRBS_POLYNOMIAL_*
+ * Purpose:
+ * PRBS polynomial type
+ */
+typedef enum _shr_port_prbs_polynomial_e {
+ _SHR_PORT_PRBS_POLYNOMIAL_X7_X6_1 = 0,
+ _SHR_PORT_PRBS_POLYNOMIAL_X15_X14_1 = 1,
+ _SHR_PORT_PRBS_POLYNOMIAL_X23_X18_1 = 2,
+ _SHR_PORT_PRBS_POLYNOMIAL_X31_X28_1 = 3,
+ _SHR_PORT_PRBS_POLYNOMIAL_X9_X5_1 = 4,
+ _SHR_PORT_PRBS_POLYNOMIAL_X11_X9_1 = 5,
+ _SHR_PORT_PRBS_POLYNOMIAL_X58_X31_1 = 6
+} _shr_port_prbs_polynomial_t;
+
+/*
+ * Defines:
+ * _SHR_PORT_PHY_CONTROL_FEC_*
+ * Purpose:
+ * PHY specific values for _SHR_PORT_PHY_CONTROL_FORWARD_ERROR_CORRECTION
+ */
+typedef enum _shr_port_phy_control_fec_e {
+ _SHR_PORT_PHY_CONTROL_FEC_OFF,
+ _SHR_PORT_PHY_CONTROL_FEC_ON,
+ _SHR_PORT_PHY_CONTROL_FEC_AUTO
+} _shr_port_phy_control_fec_t;
+
+typedef enum _shr_port_phy_control_rx_los_e {
+ _SHR_PORT_PHY_CONTROL_RX_LOS_NONE,
+ _SHR_PORT_PHY_CONTROL_RX_LOS_SOFTWARE,
+ _SHR_PORT_PHY_CONTROL_RX_LOS_FIRMWARE
+} _shr_port_phy_control_rx_los_t;
+
#endif /* !_SHR_PORT_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/port_ability.h b/ubuntu/opennsl/OpenNSL/include/shared/port_ability.h
index 9c1a8648ba38..13ae6ad5cc93 100644
--- a/ubuntu/opennsl/OpenNSL/include/shared/port_ability.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/port_ability.h
@@ -1,6 +1,6 @@
/*********************************************************************
*
- * (C) Copyright Broadcom Corporation 2013-2016
+ * (C) Copyright Broadcom Corporation 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,9 +36,10 @@ typedef struct _shr_port_ability_s {
_shr_port_mode_t loopback;
_shr_port_mode_t flags;
_shr_port_mode_t eee;
- _shr_port_mode_t fcmap;
+ _shr_port_mode_t rsvd;
_shr_pa_encap_t encap;
_shr_port_mode_t fec;
+ _shr_port_mode_t channel;
} _shr_port_ability_t;
#define _SHR_PA_ABILITY_ALL (0xffffffff)
@@ -100,8 +101,9 @@ typedef struct _shr_port_ability_s {
* Defines for FEC abilities.
*/
-#define _SHR_PA_FEC (1 << 0) /* FEC ability support */
-#define _SHR_PA_FEC_REQUEST (1 << 1) /* FEC ability request */
+#define _SHR_PA_FEC_NONE (1 << 0) /* FEC is not requested */
+#define _SHR_PA_FEC_CL74 (1 << 1) /* FEC CL74 ability request */
+#define _SHR_PA_FEC_CL91 (1 << 2) /* FEC Cl91 ability request */
/*
* Defines:
@@ -118,6 +120,16 @@ typedef struct _shr_port_ability_s {
#define _SHR_PA_INTF_QSGMII (1 << 6) /* QSGMII mode supported */
#define _SHR_PA_INTF_CGMII (1 << 7) /* CGMII mode supported */
+/*
+ * Defines:
+ * _SHR_PA_CHANNEL_*
+ * Purpose:
+ * Defines for CHANNEL abilities.
+ */
+
+#define _SHR_PA_CHANNEL_LONG (1 << 0) /* Channel is long */
+#define _SHR_PA_CHANNEL_SHORT (1 << 1) /* Channel is short */
+
/*
* Defines:
* _SHR_PA_MEDIUM_*
@@ -126,6 +138,7 @@ typedef struct _shr_port_ability_s {
*/
#define _SHR_PA_MEDIUM_COPPER (1 << 0)
#define _SHR_PA_MEDIUM_FIBER (1 << 1)
+#define _SHR_PA_MEDIUM_BACKPLANE (1 << 2)
/*
* Defines:
@@ -258,12 +271,4 @@ typedef struct _shr_port_ability_s {
#define _SHR_PA_EEE_10GB_KX4 (1 << 4) /* EEE for 10G-KX4 */
#define _SHR_PA_EEE_10GB_KR (1 << 5) /* EEE for 10G-KR */
-#define _SHR_PA_FCMAP (1 << 0)
-#define _SHR_PA_FCMAP_FCMAC_LOOPBACK (1 << 1)
-#define _SHR_PA_FCMAP_AUTONEG (1 << 2)
-#define _SHR_PA_FCMAP_2GB (1 << 3)
-#define _SHR_PA_FCMAP_4GB (1 << 4)
-#define _SHR_PA_FCMAP_8GB (1 << 5)
-#define _SHR_PA_FCMAP_16GB (1 << 6)
-
#endif /* !_SHR_PORTABILITY_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/rx.h b/ubuntu/opennsl/OpenNSL/include/shared/rx.h
index 6788eb01c7e9..a2d2598884e0 100644
--- a/ubuntu/opennsl/OpenNSL/include/shared/rx.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/rx.h
@@ -1,6 +1,6 @@
/*********************************************************************
*
- * (C) Copyright Broadcom Corporation 2013-2016
+ * (C) Copyright Broadcom Corporation 2013-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
#ifndef _SHR_RX_H_
#define _SHR_RX_H_
+#include <shared/types.h>
#include <shared/bitop.h>
/*
@@ -135,7 +136,7 @@ typedef enum _shr_rx_reason_e {
_SHR_RX_L2_MARKED = 89, /* L2 table marked */
_SHR_RX_WLAN_SLOWPATH_KEEPALIVE = 90, /* WLAN slowpath to the CPU, */
/* otherwise dropped */
- _SHR_RX_STATION = 91, /* MPLS sent to CPU */
+ _SHR_RX_STATION = 91, /* My Station packet to CPU */
_SHR_RX_NIV = 92, /* NIV packet */
_SHR_RX_NIV_PRIO_DROP = 93, /* NIV packet, priority drop */
_SHR_RX_NIV_INTERFACE_MISS = 94, /* NIV packet, interface miss */
@@ -206,7 +207,51 @@ typedef enum _shr_rx_reason_e {
_SHR_RX_OAM_MPLS_LMDM = 155, /* MPLS LM/DM (RFC 6374) packet */
_SHR_RX_SAT = 156, /* OAM SAT pkt */
_SHR_RX_SAMPLE_SOURCE_FLEX = 157, /* Flexible sampled packets to CPU */
- _SHR_RX_REASON_COUNT = 158 /* MUST BE LAST */
+ _SHR_RX_FLEX_SFLOW = 158, /* Flex Sflow? */
+ _SHR_RX_VXLT_MISS = 159, /* VLAN Translation miss packet */
+ _SHR_RX_TUNNEL_DECAP_ECN_ERROR = 160, /* Tunnel decap ECN error */
+ _SHR_RX_TUNNEL_OBJECT_VALIDATION_FAIL = 161, /* Tunnel Object Validation Fail */
+ _SHR_RX_L3_CPU = 162, /* L3 Copy to CPU */
+ _SHR_RX_TUNNEL_ADAPT_LOOKUP_MISS = 163, /* Tunnel Adapt Lookup Miss Drop */
+ _SHR_RX_PACKET_FLOW_SELECT_MISS = 164, /* Packet Flow Select Miss */
+ _SHR_RX_PROTECTION_DATA_DROP = 165, /* Protection Data Drop */
+ _SHR_RX_PACKET_FLOW_SELECT = 166, /* Packet Flow Select */
+ _SHR_RX_OTHER_LOOKUP_MISS = 167, /* Neither Source or Dest type of Lookup Miss */
+ _SHR_RX_INVALID_TPID = 168, /* Invalid TPID */
+ _SHR_RX_MPLS_CONTROL_PACKET = 169, /* MPLS Control Packet */
+ _SHR_RX_TUNNEL_TTL_ERROR = 170, /* Tunnel TTL Error */
+ _SHR_RX_L2_HEADER_ERROR = 171, /* L2 header */
+ _SHR_RX_OTHER_LOOKUP_HIT = 172, /* Neither Source or Dest type of Lookup Hit */
+ _SHR_RX_L2_SRC_LOOKUP_MISS = 173, /* L2 Source Lookup Miss */
+ _SHR_RX_L2_SRC_LOOKUP_HIT = 174, /* L2 Source Lookup Hit */
+ _SHR_RX_L2_DST_LOOKUP_MISS = 175, /* L2 Dest Lookup Miss */
+ _SHR_RX_L2_DST_LOOKUP_HIT = 176, /* L2 Dest Lookup Hit */
+ _SHR_RX_L3_SRC_ROUTE_LOOKUP_MISS = 177, /* L3 Source Route Lookup Miss */
+ _SHR_RX_L3_SRC_HOST_LOOKUP_MISS = 178, /* L3 Source Host Lookup Miss */
+ _SHR_RX_L3_SRC_ROUTE_LOOKUP_HIT = 179, /* L3 Source Route Lookup Hit */
+ _SHR_RX_L3_SRC_HOST_LOOKUP_HIT = 180, /* L3 Source Host Lookup Hit */
+ _SHR_RX_L3_DST_ROUTE_LOOKUP_MISS = 181, /* L3 Dest Route Lookup Miss */
+ _SHR_RX_L3_DST_HOST_LOOKUP_MISS = 182, /* L3 Dest Host Lookup Miss */
+ _SHR_RX_L3_DST_ROUTE_LOOKUP_HIT = 183, /* L3 Dest Route Lookup Hit */
+ _SHR_RX_L3_DST_HOST_LOOKUP_HIT = 184, /* L3 Dest Host Lookup Hit */
+ _SHR_RX_VLAN_TRANSLATE1_LOOKUP1_MISS = 185, /* VLAN Translate1 Lookup1 Miss */
+ _SHR_RX_VLAN_TRANSLATE1_LOOKUP2_MISS = 186, /* VLAN Translate1 Lookup2 Miss */
+ _SHR_RX_MPLS_LOOKUP1_MISS = 187, /* MPLS Lookup1 Miss */
+ _SHR_RX_MPLS_LOOKUP2_MISS = 188, /* MPLS Lookup2 Miss */
+ _SHR_RX_L3_TUNNEL_LOOKUP_MISS = 189, /* L3 Tunnel Lookup Miss */
+ _SHR_RX_VLAN_TRANSLATE2_LOOKUP1_MISS = 190, /* VLAN Translate2 Lookup1 Miss */
+ _SHR_RX_VLAN_TRANSLATE2_LOOKUP2_MISS = 191, /* VLAN Translate2 Lookup2 Miss */
+ _SHR_RX_L2_STU_FAIL = 192, /* L2 STU check fail */
+ _SHR_RX_SR_COUNTER_EXCEEDED = 193, /* Seamless Redundancy(SR) - */
+ /* Counter Threshold Exceeded */
+ _SHR_RX_SR_COPY_TO_CPU_BIT0 = 194, /* Seamless Redundancy(SR) copy to CPU */
+ /* SR custom reason code bit 0 */
+ _SHR_RX_SR_COPY_TO_CPU_BIT1 = 195, /* SR custom reason code bit 1 */
+ _SHR_RX_SR_COPY_TO_CPU_BIT2 = 196, /* SR custom reason code bit 2 */
+ _SHR_RX_SR_COPY_TO_CPU_BIT3 = 197, /* SR custom reason code bit 3 */
+ _SHR_RX_SR_COPY_TO_CPU_BIT4 = 198, /* SR custom reason code bit 4 */
+ _SHR_RX_SR_COPY_TO_CPU_BIT5 = 199, /* SR custom reason code bit 5 */
+ _SHR_RX_REASON_COUNT = 200 /* MUST BE LAST */
} _shr_rx_reason_t;
#define _SHR_RX_REASON_NAMES_INITIALIZER { \
@@ -367,7 +412,49 @@ typedef enum _shr_rx_reason_e {
"Reserved0", \
"OAMMplsLmDM", \
"SAT", \
- "SampleSourceFlex" \
+ "SampleSourceFlex", \
+ "FlexSflow", \
+ "VxltMiss", \
+ "TunnelDecapEcnError", \
+ "TunnelObjectValidationFail", \
+ "L3Cpu", \
+ "TunnelAdaptLookupMiss", \
+ "PacketFlowSelectMiss", \
+ "ProtectionDataDrop", \
+ "PacketFlowSelect", \
+ "OtherLookupMiss", \
+ "InvalidTpid", \
+ "MplsControlPacket", \
+ "TunnelTtlError", \
+ "L2HeaderError", \
+ "OtherLookupHit", \
+ "L2SrcLookupMiss", \
+ "L2SrcLookupHit", \
+ "L2DstLookupMiss", \
+ "L2DstLookupHit", \
+ "L3SrcRouteLookupMiss", \
+ "L3SrcHostLookupMiss", \
+ "L3SrcRouteLookupHit", \
+ "L3SrcHostLookupHit", \
+ "L3DstRouteLookupMiss", \
+ "L3DstHostLookupMiss", \
+ "L3DstRouteLookupHit", \
+ "L3DstHostLookupHit", \
+ "MplsLookup1Miss", \
+ "MplsLookup2Miss", \
+ "L3TunnelLookupMiss", \
+ "VlanTranslate1Lookup1Miss",\
+ "VlanTranslate1Lookup2Miss",\
+ "VlanTranslate2Lookup1Miss",\
+ "VlanTranslate2Lookup2Miss",\
+ "L2StuFail", \
+ "SrCounterExceeded", \
+ "SrCopyToCpuBit0", \
+ "SrCopyToCpuBit1", \
+ "SrCopyToCpuBit2", \
+ "SrCopyToCpuBit3", \
+ "SrCopyToCpuBit4", \
+ "SrCopyToCpuBit5", \
}
/*
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/switch.h b/ubuntu/opennsl/OpenNSL/include/shared/switch.h
index ad7114216fe9..83a4194fd7e7 100644
--- a/ubuntu/opennsl/OpenNSL/include/shared/switch.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/switch.h
@@ -28,5 +28,18 @@
#define _SHR_SWITCH_STABLE_DEVICE_NEXT_HOP 1 /* Use next hop table */
#define _SHR_SWITCH_STABLE_DEVICE_EXT_MEM 2 /* Use external TCAM/SRAM */
#define _SHR_SWITCH_STABLE_APPLICATION 3 /* Use application storage */
+#define _SHR_SWITCH_STABLE_SHARED_MEM 4 /* Use Linux shmem for internal proccess NV storage */
+
+/*
+ * structure:
+ * _shr_temperature_monitor_t
+ * Purpose:
+ * entry type for retrieving temperature monitor value
+ *
+ */
+typedef struct _shr_switch_temperature_monitor_s {
+ int curr;
+ int peak;
+} _shr_switch_temperature_monitor_t;
#endif /* !_SHR_SWITCH_H */
diff --git a/ubuntu/opennsl/OpenNSL/include/shared/types.h b/ubuntu/opennsl/OpenNSL/include/shared/types.h
index c1775bee17a9..54f908dee187 100755
--- a/ubuntu/opennsl/OpenNSL/include/shared/types.h
+++ b/ubuntu/opennsl/OpenNSL/include/shared/types.h
@@ -21,33 +21,44 @@
#ifndef _SHR_TYPES_H_
#define _SHR_TYPES_H_
+#include <sal/types.h>
+
typedef int8 _shr_dma_chan_t;
-typedef enum {
- _SHR_COLOR_GREEN = 0,
- _SHR_COLOR_YELLOW = 1,
- _SHR_COLOR_RED = 2,
- _SHR_COLOR_BLACK = 3,
- _SHR_COLOR_PRESERVE = 4,
- _SHR_COLOR_COUNT = 5
+typedef int _shr_module_t;
+
+typedef int _shr_if_t;
+
+typedef uint16 _shr_vlan_t;
+
+#define _SHR_PORT_INVALID (-1)
+
+
+typedef enum {
+ _SHR_COLOR_GREEN = 0,
+ _SHR_COLOR_YELLOW = 1,
+ _SHR_COLOR_RED = 2,
+ _SHR_COLOR_BLACK = 3,
+ _SHR_COLOR_PRESERVE = 4,
+ _SHR_COLOR_COUNT = 5
} _shr_color_t;
typedef enum {
- _SHR_FORWARDING_TYPE_L2 = 0, /* L2 switching forwarding. */
- _SHR_FORWARDING_TYPE_IP4UCAST = 1, /* IPv4 Unicast Routing forwarding. */
- _SHR_FORWARDING_TYPE_IP4MCAST = 2, /* IPv4 Multicast Routing forwarding. */
- _SHR_FORWARDING_TYPE_IP6UCAST = 3, /* IPv6 Unicast Routing forwarding. */
- _SHR_FORWARDING_TYPE_IP6MCAST = 4, /* IPv6 Multicast Routing forwarding. */
- _SHR_FORWARDING_TYPE_MPLS = 5, /* MPLS Switching forwarding. */
- _SHR_FORWARDING_TYPE_TRILL = 6, /* Trill forwarding. */
- _SHR_FORWARDING_TYPE_RXREASON = 7, /* Forwarding according to a RxReason. */
- _SHR_FORWARDING_TYPE_TRAFFIC_MANAGMENT = 8, /* Traffic Management forwarding, when
- an external Packet Processor sets the
- forwarding decision. */
- _SHR_FORWARDING_TYPE_SNOOP = 9, /* Snooped packet. */
- _SHR_FORWARDING_TYPE_FCoE = 10, /* Fiber Channel over Ethernet
- forwarding. */
- _SHR_FORWARDING_TYPE_COUNT = 11 /* Always Last. Not a usable value. */
+ _SHR_FORWARDING_TYPE_L2 = 0, /* L2 switching forwarding. */
+ _SHR_FORWARDING_TYPE_IP4UCAST = 1, /* IPv4 Unicast Routing forwarding. */
+ _SHR_FORWARDING_TYPE_IP4MCAST = 2, /* IPv4 Multicast Routing forwarding. */
+ _SHR_FORWARDING_TYPE_IP6UCAST = 3, /* IPv6 Unicast Routing forwarding. */
+ _SHR_FORWARDING_TYPE_IP6MCAST = 4, /* IPv6 Multicast Routing forwarding. */
+ _SHR_FORWARDING_TYPE_MPLS = 5, /* MPLS Switching forwarding. */
+ _SHR_FORWARDING_TYPE_TRILL = 6, /* Trill forwarding. */
+ _SHR_FORWARDING_TYPE_RXREASON = 7, /* Forwarding according to a RxReason. */
+ _SHR_FORWARDING_TYPE_TRAFFIC_MANAGMENT = 8, /* Traffic Management forwarding, when
+ an external Packet Processor sets the
+ forwarding decision. */
+ _SHR_FORWARDING_TYPE_SNOOP = 9, /* Snooped packet. */
+ _SHR_FORWARDING_TYPE_FCoE = 10, /* Fiber Channel over Ethernet
+ forwarding. */
+ _SHR_FORWARDING_TYPE_COUNT = 11 /* Always Last. Not a usable value. */
} _shr_forwarding_type_t;
#endif /* _SHR_TYPES_H_ */
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/RELEASE b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/RELEASE
similarity index 100%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/RELEASE
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/RELEASE
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/ibde.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/ibde.h
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/ibde.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/ibde.h
index 834c64444442..c022e0b95aa0 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/ibde.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/ibde.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: ibde.h,v 1.27 2012/11/02 23:10:59 bpeela Exp $
+ * $Id: ibde.h,v 1.27 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
@@ -81,6 +81,7 @@ typedef struct ibde_s {
#define BDE_CPU_DEV_TYPE SAL_CPU_DEV_TYPE /* CPU device */
#define BDE_BYTE_SWAP 0x01000000 /* SW byte swap */
+#define BDE_NO_IPROC 0x02000000 /* Device uses two BARs, but is not iProc */
#define BDE_256K_REG_SPACE 0x20000000 /* Map 256K (v 64K) */
#define BDE_128K_REG_SPACE 0x40000000 /* Map 128K (v 64K) */
@@ -119,7 +120,7 @@ typedef struct ibde_s {
int (*interrupt_disconnect)(int d);
sal_paddr_t (*l2p)(int d, void *laddr);
- uint32 *(*p2l)(int d, sal_paddr_t paddr);
+ void* (*p2l)(int d, sal_paddr_t paddr);
/*
* SPI Access via SMP
@@ -142,6 +143,11 @@ typedef struct ibde_s {
void (*shmem_write)(int dev, uint32 addr, uint8 *buf, uint32 len);
sal_vaddr_t (*shmem_map)(int dev, uint32 addr, uint32 size);
+ /*
+ * cmic
+ */
+ int (*get_cmic_ver)(int d, uint32 *ver);
+
} ibde_t;
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/kcom.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/kcom.h
similarity index 93%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/kcom.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/kcom.h
index debe7b783c49..baa9ea222453 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/kcom.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/kcom.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: kcom.h,v 1.9 2012/10/24 09:55:42 mlarsen Exp $
+ * $Id: kcom.h,v 1.9 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
@@ -57,6 +57,8 @@
#define KCOM_M_FILTER_LIST 23 /* Get list of Rx filter IDs */
#define KCOM_M_FILTER_GET 24 /* Get Rx filter info */
#define KCOM_M_DMA_INFO 31 /* Tx/Rx DMA info */
+#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */
+#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */
#define KCOM_VERSION 8 /* Protocol version */
@@ -115,6 +117,8 @@ typedef struct kcom_msg_hdr_s {
#define KCOM_NETIF_F_ADD_TAG (1U << 0)
#define KCOM_NETIF_F_RCPU_ENCAP (1U << 1)
+/* If a netif has this flag, the packet sent to the netif can't be stripped tag or added tag */
+#define KCOM_NETIF_F_KEEP_RX_TAG (1U << 2)
#define KCOM_NETIF_NAME_MAX 16
@@ -127,6 +131,8 @@ typedef struct kcom_netif_s {
uint16 vlan;
uint16 qnum;
uint8 macaddr[6];
+ uint8 ptch[2];
+ uint8 itmh[4];
char name[KCOM_NETIF_NAME_MAX];
} kcom_netif_t;
@@ -271,6 +277,9 @@ typedef struct kcom_dma_info_s {
} data;
} kcom_dma_info_t;
+/* Default channel configuration */
+#define KCOM_DMA_TX_CHAN 0
+#define KCOM_DMA_RX_CHAN 1
#define KCOM_ETH_HW_T_RESET 1
@@ -373,6 +382,22 @@ typedef struct kcom_msg_detach_s {
uint32 flags;
} kcom_msg_detach_t;
+/*
+ * Enable/Disable debugging packet function.
+ */
+typedef struct kcom_msg_dbg_pkt_set_s {
+ kcom_msg_hdr_t hdr;
+ int enable;
+} kcom_msg_dbg_pkt_set_t;
+
+/*
+ * Get debugging packet function info.
+ */
+typedef struct kcom_msg_dbg_pkt_get_s {
+ kcom_msg_hdr_t hdr;
+ int value;
+} kcom_msg_dbg_pkt_get_t;
+
/*
* Create new system network interface. The network interface will
* be associated with the specified switch unit number.
@@ -431,7 +456,7 @@ typedef struct kcom_msg_filter_destroy_s {
* Get list of currently defined packet filters.
*/
#ifndef KCOM_FILTER_MAX
- /* OPENNSL_FIXUP - Increased the filters to 1024 from 128 */
+/* OPENNSL_FIXUP - Increased the filters to 1024 from 128 */
#define KCOM_FILTER_MAX 1024
#endif
@@ -479,6 +504,8 @@ typedef union kcom_msg_s {
kcom_msg_filter_list_t filter_list;
kcom_msg_filter_get_t filter_get;
kcom_msg_dma_info_t dma_info;
+ kcom_msg_dbg_pkt_set_t dbg_pkt_set;
+ kcom_msg_dbg_pkt_get_t dbg_pkt_get;
} kcom_msg_t;
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/core/sync.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/core/sync.h
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/core/sync.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/core/sync.h
index 796683f8a86f..edac848b504b 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/core/sync.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/core/sync.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: sync.h,v 1.1 2005/06/25 22:26:59 mlarsen Exp $
+ * $Id: sync.h,v 1.1 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/core/thread.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/core/thread.h
similarity index 94%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/core/thread.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/core/thread.h
index 128dc420e771..1bccb1aaa3ab 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/core/thread.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/core/thread.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: thread.h,v 1.1 2005/06/25 22:26:59 mlarsen Exp $
+ * $Id: thread.h,v 1.1 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/types.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/types.h
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/types.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/types.h
index 0f6167540e5c..29e6fc6522a0 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sal/types.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sal/types.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: types.h,v 1.3 2013/04/06 06:19:14 mlarsen Exp $
+ * $Id: types.h,v 1.3 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sdk_config.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sdk_config.h
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sdk_config.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sdk_config.h
index c35560432ca1..5a1bcaddfc40 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/sdk_config.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/sdk_config.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: sdk_config.h,v 1.5 2012/03/02 15:13:56 yaronm Exp $
+ * $Id: sdk_config.h,v 1.5 Broadcom SDK $
* $Copyright: (c) 2006 Broadcom Corp.
* All Rights Reserved.$
*
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/soc/cmic.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/soc/cmic.h
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/soc/cmic.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/soc/cmic.h
index 72a99eaf0c08..c6cfc25c7595 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/soc/cmic.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/soc/cmic.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: cmic.h,v 1.1 2008/10/16 09:41:21 mlarsen Exp $
+ * $Id: cmic.h,v 1.1 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/soc/devids.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/soc/devids.h
similarity index 86%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/soc/devids.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/soc/devids.h
index a102f343198a..69fba7777c1a 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/include/soc/devids.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/include/soc/devids.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * Copyright: (c) 2016 Broadcom Corp.
+ * Copyright: (c) 2017 Broadcom Corp.
* All Rights Reserved.
*/
@@ -777,6 +777,18 @@
#define BCM56468_A0_REV_ID 1
#define BCM56468_B0_REV_ID 0x11
+#define BCM56270_DEVICE_ID 0xb270
+#define BCM56270_A0_REV_ID 1
+#define BCM56271_DEVICE_ID 0xb271
+#define BCM56271_A0_REV_ID 1
+#define BCM56272_DEVICE_ID 0xb272
+#define BCM56272_A0_REV_ID 1
+
+#define BCM53460_DEVICE_ID 0x8460
+#define BCM53460_A0_REV_ID 1
+#define BCM53461_DEVICE_ID 0x8461
+#define BCM53461_A0_REV_ID 1
+
#define BCM56842_DEVICE_ID 0xb842
#define BCM56842_A0_REV_ID 1
#define BCM56842_A1_REV_ID 2
@@ -848,26 +860,6 @@
#define BCM56613_A0_REV_ID 1
#define BCM56613_B0_REV_ID 0x11
#define BCM56613_C0_REV_ID 0x21
-#define BCM56930_DEVICE_ID 0xb930
-#define BCM56930_A0_REV_ID 1
-#define BCM56930_B0_REV_ID 0x11
-#define BCM56930_C0_REV_ID 0x21
-#define BCM56931_DEVICE_ID 0xb931
-#define BCM56931_A0_REV_ID 1
-#define BCM56931_B0_REV_ID 0x11
-#define BCM56931_C0_REV_ID 0x21
-#define BCM56935_DEVICE_ID 0xb935
-#define BCM56935_A0_REV_ID 1
-#define BCM56935_B0_REV_ID 0x11
-#define BCM56935_C0_REV_ID 0x21
-#define BCM56936_DEVICE_ID 0xb936
-#define BCM56936_A0_REV_ID 1
-#define BCM56936_B0_REV_ID 0x11
-#define BCM56936_C0_REV_ID 0x21
-#define BCM56939_DEVICE_ID 0xb939
-#define BCM56939_A0_REV_ID 1
-#define BCM56939_B0_REV_ID 0x11
-#define BCM56939_C0_REV_ID 0x21
#define BCM88732_DEVICE_ID 0x0732
#define BCM88732_A0_REV_ID 1
@@ -1095,9 +1087,6 @@
#define BCM56868_DEVICE_ID 0xb868
#define BCM56868_A0_REV_ID 1
#define BCM56868_A1_REV_ID 2
-#define BCM56760_DEVICE_ID 0xb760
-#define BCM56760_A0_REV_ID 1
-#define BCM56760_A1_REV_ID 2
#define BCM56832_DEVICE_ID 0xb832
#define BCM56832_A0_REV_ID 1
#define BCM56832_A1_REV_ID 2
@@ -1184,6 +1173,8 @@
#define BCM53408_A0_REV_ID 1
#define BCM53365_DEVICE_ID 0x8365
#define BCM53365_A0_REV_ID 1
+#define BCM53369_DEVICE_ID 0x8369
+#define BCM53369_A0_REV_ID 1
#define BCM53454_DEVICE_ID 0x8454
#define BCM53455_DEVICE_ID 0x8455
@@ -1219,12 +1210,187 @@
#define BCM56930_A0_REV_ID 1
#define BCM56930_B0_REV_ID 0x11
#define BCM56930_B1_REV_ID 0x12
+#define BCM56930_C0_REV_ID 0x21
+#define BCM56931_DEVICE_ID 0xb931
+#define BCM56931_A0_REV_ID 1
+#define BCM56931_B0_REV_ID 0x11
+#define BCM56931_C0_REV_ID 0x21
+#define BCM56935_DEVICE_ID 0xb935
+#define BCM56935_A0_REV_ID 1
+#define BCM56935_B0_REV_ID 0x11
+#define BCM56935_C0_REV_ID 0x21
+#define BCM56936_DEVICE_ID 0xb936
+#define BCM56936_A0_REV_ID 1
+#define BCM56936_B0_REV_ID 0x11
+#define BCM56936_C0_REV_ID 0x21
+#define BCM56939_DEVICE_ID 0xb939
+#define BCM56939_A0_REV_ID 1
+#define BCM56939_B0_REV_ID 0x11
+#define BCM56939_C0_REV_ID 0x21
+
+#define BCM56168_DEVICE_ID 0xb168
+#define BCM56168_A0_REV_ID 1
+#define BCM56168_B0_REV_ID 0x11
+#define BCM56168_B1_REV_ID 0x12
+#define BCM56169_DEVICE_ID 0xb169
+#define BCM56169_A0_REV_ID 1
+#define BCM56169_B0_REV_ID 0x11
+#define BCM56169_B1_REV_ID 0x12
#define BCM56968_DEVICE_ID 0xb968
#define BCM56968_A0_REV_ID 1
#define BCM56968_B0_REV_ID 0x11
#define BCM56968_B1_REV_ID 0x12
+#define BCM56160_DEVICE_ID 0xb160
+#define BCM56160_A0_REV_ID 1
+#define BCM56160_B0_REV_ID 0x11
+#define BCM56162_DEVICE_ID 0xb162
+#define BCM56162_A0_REV_ID 1
+#define BCM56162_B0_REV_ID 0x11
+
+#define BCM56163_DEVICE_ID 0xb163
+#define BCM56163_A0_REV_ID 1
+#define BCM56163_B0_REV_ID 0x11
+#define BCM56164_DEVICE_ID 0xb164
+#define BCM56164_A0_REV_ID 1
+#define BCM56164_B0_REV_ID 0x11
+#define BCM56166_DEVICE_ID 0xb166
+#define BCM56166_A0_REV_ID 1
+#define BCM56166_B0_REV_ID 0x11
+
+#define BCM53440_DEVICE_ID 0x8440
+#define BCM53440_A0_REV_ID 1
+#define BCM53440_B0_REV_ID 0x11
+#define BCM53442_DEVICE_ID 0x8442
+#define BCM53442_A0_REV_ID 1
+#define BCM53442_B0_REV_ID 0x11
+#define BCM53443_DEVICE_ID 0x8443
+#define BCM53443_A0_REV_ID 1
+#define BCM53443_B0_REV_ID 0x11
+
+#define BCM53434_DEVICE_ID 0x8434
+#define BCM53434_A0_REV_ID 1
+#define BCM53434_B0_REV_ID 0x11
+
+#define BCM56560_DEVICE_ID 0xb560
+#define BCM56560_A0_REV_ID 1
+#define BCM56560_B0_REV_ID 0x11
+#define BCM56560_B1_REV_ID 0x12
+
+#define BCM56561_DEVICE_ID 0xb561
+#define BCM56561_A0_REV_ID 1
+#define BCM56561_B0_REV_ID 0x11
+#define BCM56561_B1_REV_ID 0x12
+
+#define BCM56562_DEVICE_ID 0xb562
+#define BCM56562_A0_REV_ID 1
+#define BCM56562_B0_REV_ID 0x11
+#define BCM56562_B1_REV_ID 0x12
+
+#define BCM56565_DEVICE_ID 0xb565
+#define BCM56565_A0_REV_ID 1
+#define BCM56565_B0_REV_ID 0x11
+#define BCM56565_B1_REV_ID 0x12
+
+#define BCM56566_DEVICE_ID 0xb566
+#define BCM56566_A0_REV_ID 1
+#define BCM56566_B0_REV_ID 0x11
+#define BCM56566_B1_REV_ID 0x12
+
+#define BCM56567_DEVICE_ID 0xb567
+#define BCM56567_A0_REV_ID 1
+#define BCM56567_B0_REV_ID 0x11
+#define BCM56567_B1_REV_ID 0x12
+
+#define BCM56568_DEVICE_ID 0xb568
+#define BCM56568_A0_REV_ID 1
+#define BCM56568_B0_REV_ID 0x11
+#define BCM56568_B1_REV_ID 0x12
+
+#define BCM56760_DEVICE_ID 0xb760
+#define BCM56760_A0_REV_ID 1
+#define BCM56760_A1_REV_ID 2
+#define BCM56760_B0_REV_ID 0x11
+#define BCM56760_B1_REV_ID 0x12
+
+#define BCM56762_DEVICE_ID 0xb762
+#define BCM56762_A0_REV_ID 1
+#define BCM56762_B0_REV_ID 0x11
+#define BCM56762_B1_REV_ID 0x12
+
+#define BCM56764_DEVICE_ID 0xb764
+#define BCM56764_A0_REV_ID 1
+#define BCM56764_B0_REV_ID 0x11
+#define BCM56764_B1_REV_ID 0x12
+
+#define BCM56765_DEVICE_ID 0xb765
+#define BCM56765_A0_REV_ID 1
+#define BCM56765_B0_REV_ID 0x11
+#define BCM56765_B1_REV_ID 0x12
+
+#define BCM56766_DEVICE_ID 0xb766
+#define BCM56766_A0_REV_ID 1
+#define BCM56766_B0_REV_ID 0x11
+#define BCM56766_B1_REV_ID 0x12
+
+#define BCM56768_DEVICE_ID 0xb768
+#define BCM56768_A0_REV_ID 1
+#define BCM56768_B0_REV_ID 0x11
+#define BCM56768_B1_REV_ID 0x12
+
+#define BCM56068_DEVICE_ID 0xb068
+#define BCM56068_A0_REV_ID 1
+#define BCM56068_B0_REV_ID 0x11
+#define BCM56068_B1_REV_ID 0x12
+
+#define BCM56069_DEVICE_ID 0xb069
+#define BCM56069_A0_REV_ID 1
+#define BCM56069_B0_REV_ID 0x11
+#define BCM56069_B1_REV_ID 0x12
+
+#define BCM56170_DEVICE_ID 0xb170
+#define BCM56170_A0_REV_ID 1
+#define BCM56172_DEVICE_ID 0xb172
+#define BCM56172_A0_REV_ID 1
+#define BCM56174_DEVICE_ID 0xb174
+#define BCM56174_A0_REV_ID 1
+
+#define BCM53570_DEVICE_ID 0x8570
+#define BCM53570_A0_REV_ID 1
+#define BCM53575_DEVICE_ID 0x8575
+#define BCM53575_A0_REV_ID 1
+
+
+#define BCM56965_DEVICE_ID 0xb965
+#define BCM56965_A0_REV_ID 1
+#define BCM56965_A1_REV_ID 2
+#define BCM56969_DEVICE_ID 0xb969
+#define BCM56969_A0_REV_ID 1
+#define BCM56966_DEVICE_ID 0xb966
+#define BCM56966_A0_REV_ID 1
+#define BCM56967_DEVICE_ID 0xb967
+#define BCM56967_A0_REV_ID 1
+
+#define BCM56970_DEVICE_ID 0xb970
+#define BCM56970_A0_REV_ID 1
+#define BCM56970_B0_REV_ID 0x11
+#define BCM56971_DEVICE_ID 0xb971
+#define BCM56971_A0_REV_ID 1
+#define BCM56971_B0_REV_ID 0x11
+#define BCM56972_DEVICE_ID 0xb972
+#define BCM56972_A0_REV_ID 1
+#define BCM56972_B0_REV_ID 0x11
+#define BCM56974_DEVICE_ID 0xb974
+#define BCM56974_A0_REV_ID 1
+#define BCM56974_B0_REV_ID 0x11
+
+
+#define BCM56870_DEVICE_ID 0xb870
+#define BCM56870_A0_REV_ID 1
+#define BCM56873_DEVICE_ID 0xb873
+#define BCM56873_A0_REV_ID 1
+
#define BCM5665_DEVICE_ID 0x5665
#define BCM5665_A0_REV_ID 1
#define BCM5665_B0_REV_ID 0x11
@@ -1235,7 +1401,6 @@
#define BCM5655_B0_REV_ID 0x11
-
#define BCM5650_DEVICE_ID 0x5650
#define BCM5650_A0_REV_ID 1
#define BCM5650_B0_REV_ID 0x11
@@ -1362,6 +1527,15 @@
#define BCM53125_B0_REV_ID 0x4
#define BCM53125_MODEL_ID 0x53125
+#define BCM53134_PHYID_LOW 0x5350
+#define BCM53134_PHYID_HIGH 0xAE02
+#define BCM53134_DEVICE_ID 0x5350
+#define BCM53134_A0_REV_ID 0x0
+#define BCM53134_B0_REV_ID 0x1
+#define BCM53134_B1_REV_ID 0x2
+#define BCM53134_A0_MODEL_ID 0x5035
+#define BCM53134_B0_MODEL_ID 0x5075
+
#define BCM53128_PHYID_LOW 0x5e10
#define BCM53128_PHYID_HIGH 0x0362
#define BCM53128_DEVICE_ID 0x5e10
@@ -1475,11 +1649,8 @@
#define TK371X_DEVICE_ID 0x8600
#define TK371X_A0_REV_ID 0x0
-#define PETRAB_DEVICE_ID 0xa100
-#define PETRAB_A0_REV_ID 0x0001
-#define BCM88640_DEVICE_ID (PETRAB_DEVICE_ID)
-#define BCM88640_A0_REV_ID (PETRAB_A0_REV_ID)
-
+#define GEDI_DEVICE_ID 0xa100
+#define GEDI_REV_ID 0x0001
#define ARAD_DEVICE_ID 0x8650
#define ARAD_A0_REV_ID 0x0000
#define ARAD_B0_REV_ID 0x0011
@@ -1511,6 +1682,8 @@
#define BCM88775_A1_REV_ID 0x0002
#define BCM88776_DEVICE_ID 0x8776
#define BCM88776_A1_REV_ID 0x0002
+#define BCM88777_DEVICE_ID 0x8777
+#define BCM88777_A1_REV_ID 0x0002
#define BCM88950_DEVICE_ID 0x8950
#define BCM88950_A0_REV_ID 0x0001
#define BCM88950_A1_REV_ID 0x0002
@@ -1522,6 +1695,8 @@
#define BCM88955_A1_REV_ID 0x0002
#define BCM88956_DEVICE_ID 0x8956
#define BCM88956_A1_REV_ID 0x0002
+#define BCM88790_DEVICE_ID 0x8790
+#define BCM88790_A0_REV_ID 0x0001
#define ARADPLUS_DEVICE_ID 0x8660
#define ARADPLUS_A0_REV_ID 0x0001
#define BCM88660_DEVICE_ID ARADPLUS_DEVICE_ID
@@ -1544,6 +1719,11 @@
#define BCM88671_B0_REV_ID JERICHO_B0_REV_ID
#define BCM88671M_B0_REV_ID JERICHO_B0_REV_ID
+#define BCM88672_DEVICE_ID 0x8672
+#define BCM88672_A0_REV_ID JERICHO_A0_REV_ID
+#define BCM88672_A1_REV_ID JERICHO_A1_REV_ID
+
+#define BCM88672_B0_REV_ID JERICHO_B0_REV_ID
#define BCM88673_DEVICE_ID 0x8673
#define BCM88673_A0_REV_ID JERICHO_A0_REV_ID
@@ -1563,6 +1743,9 @@
#define BCM88676M_DEVICE_ID 0x867C
#define BCM88676M_A0_REV_ID JERICHO_A0_REV_ID
#define BCM88676M_A1_REV_ID JERICHO_A1_REV_ID
+#define BCM88677_DEVICE_ID 0x8677
+#define BCM88677_A0_REV_ID JERICHO_A0_REV_ID
+#define BCM88677_A1_REV_ID JERICHO_A1_REV_ID
#define BCM88678_DEVICE_ID 0x8678
#define BCM88678_A0_REV_ID JERICHO_A0_REV_ID
#define BCM88678_A1_REV_ID JERICHO_A1_REV_ID
@@ -1576,6 +1759,7 @@
#define BCM88675M_B0_REV_ID JERICHO_B0_REV_ID
#define BCM88676_B0_REV_ID JERICHO_B0_REV_ID
#define BCM88676M_B0_REV_ID JERICHO_B0_REV_ID
+#define BCM88677_B0_REV_ID JERICHO_B0_REV_ID
#define BCM88678_B0_REV_ID JERICHO_B0_REV_ID
#define BCM88679_B0_REV_ID JERICHO_B0_REV_ID
#define QMX_DEVICE_ID 0x8375
@@ -1610,7 +1794,6 @@
#define BCM88379_A0_REV_ID QMX_A0_REV_ID
#define BCM88379_A1_REV_ID QMX_A1_REV_ID
-
#define BCM88370_B0_REV_ID QMX_B0_REV_ID
#define BCM88371_B0_REV_ID QMX_B0_REV_ID
#define BCM88371M_B0_REV_ID QMX_B0_REV_ID
@@ -1622,17 +1805,80 @@
#define BCM88379_B0_REV_ID QMX_B0_REV_ID
+#define JERICHO_PLUS_DEVICE_ID 0x8680
+#define JERICHO_PLUS_A0_REV_ID 0x0001
+#define BCM88680_DEVICE_ID JERICHO_PLUS_DEVICE_ID
+#define BCM88680_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+#define BCM88680_A1_REV_ID 0x0002
+
+
+#define BCM88681_DEVICE_ID 0x8681
+#define BCM88681_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+
+#define BCM88682_DEVICE_ID 0x8682
+#define BCM88682_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+
+#define BCM88683_DEVICE_ID 0x8683
+#define BCM88683_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+
+#define BCM88684_DEVICE_ID 0x8684
+#define BCM88684_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+
+#define BCM88685_DEVICE_ID 0x8685
+#define BCM88685_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+
+#define BCM88380_DEVICE_ID 0x8380
+#define BCM88380_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+#define BCM88381_DEVICE_ID 0x8381
+#define BCM88381_A0_REV_ID JERICHO_PLUS_A0_REV_ID
+
+#define JERICHO_2_DEVICE_ID 0x8690
+#define JERICHO_2_A0_REV_ID 0x0001
+#define BCM88690_DEVICE_ID JERICHO_2_DEVICE_ID
+#define BCM88690_A0_REV_ID JERICHO_2_A0_REV_ID
#define QAX_DEVICE_ID 0x8470
#define QAX_A0_REV_ID 0x0001
#define QAX_B0_REV_ID 0x0011
-#define BCM88470_DEVICE_ID QAX_DEVICE_ID
+#define BCM88470_DEVICE_ID QAX_DEVICE_ID
+#define BCM88470_B0_REV_ID QAX_B0_REV_ID
+#define BCM88470P_DEVICE_ID 0x847C
+#define BCM88471_DEVICE_ID 0x8471
+#define BCM88473_DEVICE_ID 0x8473
+#define BCM88474_DEVICE_ID 0x8474
+#define BCM88474H_DEVICE_ID 0x847B
+#define BCM88476_DEVICE_ID 0x8476
+#define BCM88477_DEVICE_ID 0x8477
+
+
+
+
#define BCM88470_A0_REV_ID QAX_A0_REV_ID
+#define QUX_DEVICE_ID 0x8270
+#define QUX_A0_REV_ID 0x0001
+#define QUX_A1_REV_ID 0x0002
+#define QUX_B0_REV_ID 0x0011
+#define BCM88270_DEVICE_ID QUX_DEVICE_ID
+#define BCM88270_A0_REV_ID QUX_A0_REV_ID
+#define BCM88270_A1_REV_ID QUX_A1_REV_ID
+#define BCM88272_DEVICE_ID 0x8272
+#define BCM88273_DEVICE_ID 0x8273
+#define BCM88278_DEVICE_ID 0x8278
+
+#define FLAIR_DEVICE_ID 0xF000
+#define FLAIR_A0_REV_ID 0x0001
+#define BCM8206_DEVICE_ID FLAIR_DEVICE_ID
+#define BCM8206_A0_REV_ID FLAIR_A0_REV_ID
+
#define ARDON_DEVICE_ID 0x8202
#define ARDON_A0_REV_ID 0x0000
#define BCM88202_DEVICE_ID ARDON_DEVICE_ID
#define BCM88202_A0_REV_ID ARDON_A0_REV_ID
+#define ARDON_A1_REV_ID 0x0001
+#define BCM88202_A1_REV_ID ARDON_A1_REV_ID
+#define ARDON_A2_REV_ID 0x0002
+#define BCM88202_A2_REV_ID ARDON_A2_REV_ID
#define BCM2801PM_DEVICE_ID 0x2801
#define BCM2801PM_A0_REV_ID 0x0000
#define BCM88360_DEVICE_ID 0x8360
@@ -1657,11 +1903,6 @@
#define BCM88664_A0_REV_ID ARADPLUS_A0_REV_ID
-#define JERICHO2_DEVICE_ID 0x8850
-#define JERICHO2_P3_REV_ID 0x0001
-#define BCM88850_DEVICE_ID JERICHO2_DEVICE_ID
-#define BCM88850_P3_REV_ID JERICHO2_P3_REV_ID
-
#define BCM88350_DEVICE_ID 0x8350
#define BCM88350_B1_REV_ID ARAD_B1_REV_ID
#define BCM88351_DEVICE_ID 0x8351
@@ -1681,6 +1922,21 @@
#define BCM88654_DEVICE_ID 0x8654
#define BCM88654_B1_REV_ID ARAD_B1_REV_ID
+#define BCM88772_DEVICE_ID 0x8772
+#define BCM88952_DEVICE_ID 0x8952
+#define BCM88772_A1_REV_ID 0x0002
+#define BCM88952_A0_REV_ID 0x0001
+#define BCM88952_A1_REV_ID 0x0002
+
+#define BCM88752_DEVICE_ID 0x8752
+#define BCM88752_A0_REV_ID 0x0000
+#define BCM88752_B0_REV_ID 0x0011
+
+
+#define BCM83207_DEVICE_ID 0x3207
+#define BCM83208_DEVICE_ID 0x3208
+#define BCM83207_A0_REV_ID 0x0001
+#define BCM83208_A0_REV_ID 1
#define PCP_PCI_VENDOR_ID 0x1172
#define PCP_PCI_DEVICE_ID 0x4
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.config b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.config
similarity index 99%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.config
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.config
index 827993673086..d3f83c24c3f0 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.config
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.config
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Make.config,v 1.3 2011/09/08 06:37:31 mlarsen Exp $
+# $Id: Make.config,v 1.3 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.depend b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.depend
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.depend
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.depend
index 4174b706aed4..3d8b8c59d938 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.depend
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.depend
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Make.depend,v 1.14 2011/04/12 15:35:33 yshtil Exp $
+# $Id: Make.depend,v 1.14 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.kernlib b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.kernlib
similarity index 94%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.kernlib
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.kernlib
index 4354bf9fa69d..612b7e3479aa 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.kernlib
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.kernlib
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Make.kernlib,v 1.7 2011/08/21 07:18:42 bhanup Exp $
+# $Id: Make.kernlib,v 1.7 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
@@ -46,7 +46,9 @@ endif
$Q$(RM) $@
$Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS})
ifeq ($(LINUX_MAKE_SHARED_LIB),1)
+ifeq ($(targetbase),unix)
$(CC) -shared -Wl,-soname,${targetlibsoname} -o ${targetlibso} ${BOBJS} -lc
+endif
endif # LINUX_MAKE_SHARED_LIB #
endif # !Borland
@@ -62,6 +64,7 @@ ifdef QUIET
endif
$Q$(RM) ${BOBJS}
$Q$(RM) ${targetlib}
+ $Q$(RM) ${targetlibso}
distclean:: clean
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.lib b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.lib
similarity index 93%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.lib
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.lib
index 60b273f0b607..992a24e6955c 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.lib
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.lib
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Make.lib,v 1.14 2010/11/18 00:27:38 yshtil Exp $
+# $Id: Make.lib,v 1.14 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
@@ -61,7 +61,7 @@ ifdef QUIET
endif
$Q$(RM) $@
ifeq ($(LINUX_MAKE_SHARED_LIB),1)
- $(CC) -shared -Wl,-soname,${lib}.${LIBSUFFIX} -o ${targetlib} ${BOBJS} -lc
+ $(CC) -shared -Wl,-soname,${lib}.${LIBSUFFIX}${EXTRA_LIB_LDFLAGS} -o ${targetlib} ${BOBJS} -lc
else
${Q}cd $(dir $(word 1,${BOBJS}));$(AR) ${ARFLAGS} $@ $(sort $(notdir ${BOBJS}))
endif
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.linux b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.linux
similarity index 97%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.linux
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.linux
index 3bd2559800c2..18a6547bc660 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.linux
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.linux
@@ -15,7 +15,7 @@
# of the software.
#
#
-# $Id: Make.linux,v 1.18 2012/03/02 15:09:07 yaronm Exp $
+# $Id: Make.linux,v 1.18 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
@@ -93,6 +93,6 @@ clean_d: clean
distclean:
$(MAKE) $(CMD) $@
-
+
.PHONY: build clean distclean clean_d DELIVER variable mod bcm user
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.subdirs b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.subdirs
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.subdirs
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.subdirs
index 923dcf15a71c..69363da2ffb2 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.subdirs
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.subdirs
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Make.subdirs,v 1.8 2010/06/22 15:23:57 alai Exp $
+# $Id: Make.subdirs,v 1.8 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.tools b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.tools
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.tools
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.tools
index fc24a5a35673..c53d9d4276cc 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Make.tools
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Make.tools
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Make.tools,v 1.2 2011/09/06 21:30:39 yshtil Exp $
+# $Id: Make.tools,v 1.2 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto
new file mode 100644
index 000000000000..ee45fc26a595
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto
@@ -0,0 +1,115 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# $Id: Makefile.linux-gto-4_4,v 1.42 Broadcom SDK $
+# $Copyright: (c) 2015 Broadcom Corp.
+# All Rights Reserved.$
+
+# User must select one platform from below.
+ifeq (,$(BUILD_PLATFORM))
+BUILD_PLATFORM=POWERPC_LINUX
+endif
+
+# TOOLCHAIN_BASE_DIR Toolchain base directory for GTO devices
+# TARGET_ARCHITECTURE Compiler for target architecture
+# KERNDIR Kernel directory for iPROC-CMICd devices
+TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/gto
+TARGET_ARCHITECTURE := powerpc-broadcom-linux-gnuspe
+KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/current
+
+
+ifeq (,$(CROSS_COMPILE))
+CROSS_COMPILE := $(TARGET_ARCHITECTURE)-
+endif
+
+
+# GTO toolchain
+TOOLCHAIN_BIN_DIR := $(TOOLCHAIN_BASE_DIR)/toolchain/host/usr/bin
+override PATH := $(TOOLCHAIN_BIN_DIR)/../$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
+export TOOLCHAIN_BIN_DIR
+
+
+# Default Linux include directory
+ifeq (,$(LINUX_INCLUDE))
+LINUX_INCLUDE := $(KERNDIR)/include
+endif
+
+CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
+ENDIAN = BE_HOST=1
+CFGFLAGS += -D$(ENDIAN)
+CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\"
+CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
+
+# Extra variables.
+EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
+
+ARCH = powerpc
+KBUILD_VERBOSE = 1
+
+export ARCH KBUILD_VERBOSE
+
+
+# From linux/arch/ppc/Makefile
+comma = ,
+basetarget = $(basename $(notdir $@))
+modname = $(basetarget)
+
+name-fix = $(subst $(comma),_,$(subst -,_,$1))
+basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
+modname_flags = $(if $(filter 1,$(words $(modname))),\
+ -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
+
+KFLAG_INCLD = $(TOOLCHAIN_BIN_DIR)/../lib/gcc/$(TARGET_ARCHITECTURE)/4.6.4/include
+
+ifdef BROADCOM_SVK
+ifdef BCM_BME3200_B0
+PLX_PCI2LBUS=1
+endif
+ifdef BCM_BM9600_B0
+PLX_PCI2LBUS=1
+endif
+ifeq ($PLX_PCI2LBUS, 1)
+CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE
+endif
+endif
+
+ifdef DPP_CHIPS
+CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ -D__DUNE_LINUX_BCM_CPU_PCP_DMA__
+CFGFLAGS += -DSOC_CM_FUNCTION
+endif
+
+ifdef DFE_CHIPS
+CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__
+CFGFLAGS += -DSOC_CM_FUNCTION
+endif
+
+ifdef SHADOW_PLX
+CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK
+endif
+
+ifeq (,$(KFLAGS))
+KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/uapi/linux/version.h -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc/include -I$(KERNDIR)/include/asm-powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -funit-at-a-time -Wa,-me500 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign
+endif
+
+ifneq (,$(findstring TCL,$(FEATURE_LIST)))
+#LINK_STATIC = 0
+#export LINK_STATIC
+endif
+
+ifneq ($(targetplat),user)
+include ${SDK}/make/Makefile.linux-kernel-4_4
+endif
+
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-gto-2_6 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto-2_6
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-gto-2_6
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto-2_6
index 74ddb816f5cd..0ca62fc01f51 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-gto-2_6
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-gto-2_6
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-gto-2_6,v 1.42 2013/03/23 00:35:18 gururaj Exp $
+# $Id: Makefile.linux-gto-2_6,v 1.42 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
@@ -237,15 +237,19 @@ endif
endif
ifdef DPP_CHIPS
-CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ -D__DUNE_LINUX_BCM_CPU_PCP_DMA__
+CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__
CFGFLAGS += -DSOC_CM_FUNCTION
endif
ifdef DFE_CHIPS
-CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__
+CFLAGS += -DDUNE_BCM
CFGFLAGS += -DSOC_CM_FUNCTION
endif
+ifdef SAND_CHIPS
+CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__
+endif
+
ifdef SHADOW_PLX
CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK
endif
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc
new file mode 100644
index 000000000000..272ad93ef842
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc
@@ -0,0 +1,93 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# $Id: Makefile.linux-iproc Exp $
+# $Copyright: (c) 2007 Broadcom Corp.
+# All Rights Reserved.$
+# Makefile for iproc-CMICd
+
+# User must select one platform from below.By default ARM_LINUX is selected. .
+ifeq (,$(BUILD_PLATFORM))
+BUILD_PLATFORM=ARM_LINUX
+endif
+
+# TOOLCHAIN_BASE_DIR Toolchain base directory for iPROC-CMICd devices
+# TARGET_ARCHITECTURE Compiler for target architecture
+# KERNDIR Kernel directory for iPROC-CMICd devices
+ifeq (BE,$(ENDIAN_MODE))
+TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/iproc-be/XLDK
+TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi
+KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
+else
+TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/iproc/XLDK
+TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi
+KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
+endif
+
+ifeq (,$(CROSS_COMPILE))
+CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
+endif
+
+# arm9tools
+TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/bin
+override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
+LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib
+
+export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH
+
+# Default Linux include directory
+ifeq (,$(LINUX_INCLUDE))
+LINUX_INCLUDE := $(KERNDIR)/include
+endif
+
+ifeq (BE,$(ENDIAN_MODE))
+CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
+ENDIAN = BE_HOST=1
+else
+CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
+ENDIAN = LE_HOST=1
+endif
+
+CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
+CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
+
+ARCH = arm
+KBUILD_VERBOSE = 1
+
+export ARCH KBUILD_VERBOSE
+
+comma = ,
+basetarget = $(basename $(notdir $@))
+modname = $(basetarget)
+
+# Extra variables.
+EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
+
+name-fix = $(subst $(comma),_,$(subst -,_,$1))
+basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
+modname_flags = $(if $(filter 1,$(words $(modname))),\
+ -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
+
+KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.3/include
+
+ifeq (,$(KFLAGS))
+KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls
+KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi
+endif
+
+ifneq ($(targetplat),user)
+include ${SDK}/make/Makefile.linux-kernel-3_6
+endif
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc-3_14 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc-3_14
new file mode 100644
index 000000000000..e8a17b184710
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-iproc-3_14
@@ -0,0 +1,104 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# $Id: Makefile.linux-iproc-3_6,v 1.1 Broadcom SDK $
+# $Copyright: (c) 2007 Broadcom Corp.
+# All Rights Reserved.$
+# Makefile for iproc-CMICd
+
+# User must select one platform from below.By default ARM_LINUX is selected. .
+ifeq (,$(BUILD_PLATFORM))
+BUILD_PLATFORM=ARM_LINUX
+endif
+
+# TOOLCHAIN_BASE_DIR Toolchain base directory for iPROC-CMICd devices
+# TARGET_ARCHITECTURE Compiler for target architecture
+# KERNDIR Kernel directory for iPROC-CMICd devices
+ifeq (BE,$(ENDIAN_MODE))
+TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk37-be/buildroot-2013.11-gcc48-opt-broadcom
+TARGET_ARCHITECTURE:=armeb-buildroot-linux-gnueabi
+KERNDIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk37-be/XLDK/kernel/linux
+else
+TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk37/XLDK
+TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi
+KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
+endif
+
+
+ifeq (,$(CROSS_COMPILE))
+CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
+endif
+
+# arm9tools
+ifeq (BE,$(ENDIAN_MODE))
+TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/host/usr/bin
+override PATH:=$(TOOLCHAIN_BASE_DIR)/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
+LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/host/usr/lib
+else
+TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/usr/bin
+override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
+LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/usr/lib
+endif
+
+export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH
+
+# Default Linux include directory
+ifeq (,$(LINUX_INCLUDE))
+LINUX_INCLUDE := $(KERNDIR)/include
+endif
+
+ifeq (BE,$(ENDIAN_MODE))
+CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
+ENDIAN = BE_HOST=1
+else
+CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
+ENDIAN = LE_HOST=1
+endif
+
+CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
+CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
+
+ARCH = arm
+KBUILD_VERBOSE = 1
+
+export ARCH KBUILD_VERBOSE
+
+comma = ,
+basetarget = $(basename $(notdir $@))
+modname = $(basetarget)
+
+# Extra variables.
+EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
+
+name-fix = $(subst $(comma),_,$(subst -,_,$1))
+basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
+modname_flags = $(if $(filter 1,$(words $(modname))),\
+ -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
+
+ifeq (BE,$(ENDIAN_MODE))
+KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.8.2/include
+else
+KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/buildroot/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.7.2/include
+endif
+
+ifeq (,$(KFLAGS))
+KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-northstar/include -I$(KERNDIR)/arch/arm/plat-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls
+KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi
+endif
+
+ifneq ($(targetplat),user)
+include ${SDK}/make/Makefile.linux-kernel-3_6
+endif
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kernel b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kernel
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel
index e2782abcad18..2b8c36d6d4b0 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kernel
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-kernel,v 1.27 2012/06/25 20:23:24 assafz Exp $
+# $Id: Makefile.linux-kernel,v 1.27 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kernel-2_6 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-2_6
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kernel-2_6
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-2_6
index fbf07e42efdf..52660bc64f18 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kernel-2_6
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-2_6
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-kernel-2_6,v 1.40 2012/10/22 01:56:23 alai Exp $
+# $Id: Makefile.linux-kernel-2_6,v 1.40 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-3_6 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-3_6
new file mode 100644
index 000000000000..50f32816c686
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-3_6
@@ -0,0 +1,149 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# $Id: Makefile.linux-kernel-3_6,v 1.2 Broadcom SDK $
+# $Copyright: (c) 2005 Broadcom Corp.
+# All Rights Reserved.$
+
+# Configuration Flags
+
+# Filter out features that cannot or should not be supported in kernel mode
+
+_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI
+FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST))
+
+# Tools
+
+# Conditionally Replaces DEFAULT var
+ifeq ($(origin CC),default)
+CC = $(LSRUN) $(CROSS_COMPILE)gcc
+endif
+
+ifeq ($(origin CXX),default)
+CXX = $(CROSS_COMPILE)g++
+endif
+
+ifeq ($(origin LD),default)
+LD = $(CROSS_COMPILE)ld
+endif
+
+ifeq ($(origin AR),default)
+AR = $(CROSS_COMPILE)ar
+endif
+
+ifeq ($(origin AS),default)
+AS = $(CROSS_COMPILE)as
+endif
+
+ifeq ($(origin ARFLAGS),default)
+ ARFLAGS = -rc
+endif
+
+STRIP = $(CROSS_COMPILE)strip
+RANLIB = $(CROSS_COMPILE)ranlib
+OBJCOPY = $(CROSS_COMPILE)objcopy
+NM = $(CROSS_COMPILE)nm
+
+# Handle differences between gcc 2.x and gcc 3.x
+gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi)
+
+# Configuration Variables
+
+# OSType Defines: This defines the type of RTOS or microkernel which you
+# are compiling the SAL (and its associated driver) for. New platforms
+# can be created by porting the routines (system.c) to your platform and
+# adding the define in this Makefile.
+
+OSTYPE = LINUX
+
+#
+# ORIGIN is used to Optionally select different CFLAGS. It is used to import
+# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added
+# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT
+# added.
+#
+# Default specifies Broadcom
+#
+ifndef ORIGIN
+ ORIGIN = Broadcom
+endif
+
+#
+# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations
+# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files
+# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of
+# this Makefile, to define local "Extra" flags.
+#
+
+ifdef IPROC_BUILD
+CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
+ -I$(SDK)/systems/bde/linux/include \
+ -I$(LINUX_INCLUDE) \
+ -I$(KERNDIR)/arch/$(ARCH)
+else
+CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
+ -I$(SDK)/systems/bde/linux/include \
+ -I$(LINUX_INCLUDE) \
+ -I$(LINUX_INCLUDE)/asm/gcc \
+ -I$(LINUX_INCLUDE)/asm/mach-generic \
+ -I$(KERNDIR)/arch/$(ARCH)
+endif
+
+CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE
+
+CFGFLAGS += -D$(OSTYPE)
+
+# No user sal for the linux kernel
+# NO_SAL_APPL=1
+
+STD_CFLAGS = $(KFLAGS) $(CFGFLAGS)
+
+
+STD_CPPFLAGS = ${STD_CFLAGS}
+STD_CXXFLAGS = ${STD_CFLAGS}
+
+ifndef BCM_CFLAGS
+BCM_CFLAGS = -Wall -Werror
+endif
+
+BCM_CPPFLAGS = ${BCM_CFLAGS}
+BCM_CXXFLAGS = ${BCM_CFLAGS}
+
+ifeq (${ORIGIN}, Broadcom)
+ CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS}
+ CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS}
+ CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS}
+else
+ CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS}
+ CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS}
+ CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS}
+endif
+
+#
+# Ignore pedantic flag for kernel modules
+#
+ifdef DEBUG_PEDANTIC
+DEBUG_PEDANTIC = FALSE
+endif
+
+#
+# DEPEND is used as a command to generate the list of dependencies.
+# The format of the output must be
+# "file.o : file.c a/b/c.h d/e/f.h ...",
+# if it is on multiple lines, each line must end in a backslash.
+# The output MUST be on standard out.
+#
+DEPEND = ${CC} -M $(CFLAGS) $<
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-4_4 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-4_4
new file mode 100644
index 000000000000..d662b04334e7
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kernel-4_4
@@ -0,0 +1,158 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# $Id: Makefile.linux-kernel-2_6,v 1.40 Broadcom SDK $
+# $Copyright: (c) 2005 Broadcom Corp.
+# All Rights Reserved.$
+
+# Configuration Flags
+
+# Filter out features that cannot or should not be supported in kernel mode
+
+_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT
+FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST))
+
+# Tools
+
+# Conditionally Replaces DEFAULT var
+ifeq ($(origin CC),default)
+CC = $(LSRUN) $(CROSS_COMPILE)gcc
+endif
+
+ifeq ($(origin CXX),default)
+CXX = $(CROSS_COMPILE)g++
+endif
+
+ifeq ($(origin LD),default)
+LD = $(CROSS_COMPILE)ld
+endif
+
+ifeq ($(origin AR),default)
+AR = $(CROSS_COMPILE)ar
+endif
+
+ifeq ($(origin AS),default)
+AS = $(CROSS_COMPILE)as
+endif
+
+ifeq ($(origin ARFLAGS),default)
+ ARFLAGS = -rc
+endif
+
+STRIP = $(CROSS_COMPILE)strip
+RANLIB = $(CROSS_COMPILE)ranlib
+OBJCOPY = $(CROSS_COMPILE)objcopy
+NM = $(CROSS_COMPILE)nm
+
+# Handle differences between gcc 2.x and gcc 3.x
+gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi)
+
+# Configuration Variables
+
+# OSType Defines: This defines the type of RTOS or microkernel which you
+# are compiling the SAL (and its associated driver) for. New platforms
+# can be created by porting the routines (system.c) to your platform and
+# adding the define in this Makefile.
+OSTYPE = LINUX
+
+#
+# ORIGIN is used to Optionally select different CFLAGS. It is used to import
+# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added
+# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT
+# added.
+#
+# Default specifies Broadcom
+#
+ifndef ORIGIN
+ ORIGIN = Broadcom
+endif
+
+#
+# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations
+# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files
+# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of
+# this Makefile, to define local "Extra" flags.
+#
+ifdef IPROC_BUILD
+CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
+ -I$(SDK)/systems/bde/linux/include \
+ -I$(LINUX_INCLUDE) \
+ -I$(LINUX_INCLUDE)/uapi \
+ -I$(LINUX_INCLUDE)/generated/uapi \
+ -I$(KERNDIR)/arch/$(ARCH) \
+ -I$(KERNDIR)/arch/$(ARCH)/include/uapi \
+ -I$(KERNDIR)/arch/$(ARCH)/include/generated \
+ -I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi
+else
+CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
+ -I$(SDK)/systems/bde/linux/include \
+ -I$(LINUX_INCLUDE) \
+ -I$(LINUX_INCLUDE)/asm/gcc \
+ -I$(LINUX_INCLUDE)/asm/mach-generic \
+ -I$(LINUX_INCLUDE)/uapi \
+ -I$(LINUX_INCLUDE)/generated/uapi \
+ -I$(KERNDIR)/arch/$(ARCH) \
+ -I$(KERNDIR)/arch/$(ARCH)/include/uapi \
+ -I$(KERNDIR)/arch/$(ARCH)/include/generated \
+ -I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi
+endif
+
+CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE
+
+CFGFLAGS += -D$(OSTYPE)
+
+# No user sal for the linux kernel
+# NO_SAL_APPL=1
+
+STD_CFLAGS = $(KFLAGS) $(CFGFLAGS)
+
+
+STD_CPPFLAGS = ${STD_CFLAGS}
+STD_CXXFLAGS = ${STD_CFLAGS}
+
+ifndef BCM_CFLAGS
+BCM_CFLAGS = -Wall -Werror
+endif
+
+BCM_CPPFLAGS = ${BCM_CFLAGS}
+BCM_CXXFLAGS = ${BCM_CFLAGS}
+
+ifeq (${ORIGIN}, Broadcom)
+ CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS}
+ CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS}
+ CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS}
+else
+ CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS}
+ CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS}
+ CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS}
+endif
+
+#
+# Ignore pedantic flag for kernel modules
+#
+ifdef DEBUG_PEDANTIC
+DEBUG_PEDANTIC = FALSE
+endif
+
+#
+# DEPEND is used as a command to generate the list of dependencies.
+# The format of the output must be
+# "file.o : file.c a/b/c.h d/e/f.h ...",
+# if it is on multiple lines, each line must end in a backslash.
+# The output MUST be on standard out.
+#
+DEPEND = ${CC} -M $(CFLAGS) $<
+
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kmodule b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kmodule
similarity index 92%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kmodule
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kmodule
index 3d0685720fca..a49919c615b2 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-kmodule
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-kmodule
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-kmodule-3_6,v 1.2 2013/01/10 01:00:49 bpeela Exp $
+# $Id: Makefile.linux-kmodule-3_6,v 1.2 Broadcom SDK $
# $Copyright: (c) 2006 Broadcom Corp.
# All Rights Reserved.$
@@ -55,6 +55,9 @@ A := ARCH=$(ARCH)
export ARCH
endif
+# Provide an option in case kernel was built in separate directory
+KERNBLDDIR ?= $(KERNDIR)
+
# Standard SDK include path for building source files that export
# kernel symbols.
@@ -70,7 +73,7 @@ $(KMODULE):
rm -fr .tmp_versions
ln -s $(LIBDIR)/$(MODULE) $(PRE_COMPILED_OBJ)_shipped
echo "suppress warning" > .$(PRE_COMPILED_OBJ).cmd
- $(MAKE) -C $(KERNDIR) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
+ $(MAKE) -C $(KERNBLDDIR) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
if [ ! -f Module.symvers ]; then echo "old kernel (pre-2.6.17)" > Module.symvers; fi
cp -f $(KMODULE) $(LIBDIR)
rm -f $(PRE_COMPILED_OBJ)_shipped
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-common-2_6 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-common-2_6
similarity index 93%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-common-2_6
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-common-2_6
index 3ac42c0eb462..29fb4cddd652 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-common-2_6
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-common-2_6
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-x86-common-2_6,v 1.13 2011/08/23 02:32:54 mlarsen Exp $
+# $Id: Makefile.linux-x86-common-2_6,v 1.13 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
@@ -22,7 +22,9 @@ CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
ENDIAN = LE_HOST=1
CFGFLAGS += -D$(ENDIAN)
CFGFLAGS += -DBCM_PLATFORM_STRING=\"X86\"
+ifeq (,$(findstring -DSAL_BDE_DMA_MEM_DEFAULT,$(CFGFLAGS)))
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=16
+endif
# Extra variables.
EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-generic-common-2_6 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-generic-common-2_6
similarity index 94%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-generic-common-2_6
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-generic-common-2_6
index 4ea8c28a0911..5e01f2843bae 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-generic-common-2_6
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-generic-common-2_6
@@ -14,7 +14,7 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-x86-generic-common-2_6,v 1.2 2011/08/23 01:35:32 mlarsen Exp $
+# $Id: Makefile.linux-x86-generic-common-2_6,v 1.2 Broadcom SDK $
# $Copyright: (c) 2008 Broadcom Corp.
# All Rights Reserved.$
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6 b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6
similarity index 77%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6
index c98b7850ecdd..4aa9d39f7594 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6
@@ -14,26 +14,21 @@
# software. The special exception does not apply to any modifications
# of the software.
#
-# $Id: Makefile.linux-x86-smp_generic_64-2_6,v 1.5 2012/02/21 21:36:45 miyarn Exp $
+# $Id: Makefile.linux-x86-smp_generic_64-2_6,v 1.5 Broadcom SDK $
# $Copyright: (c) 2008 Broadcom Corp.
# All Rights Reserved.$
CFGFLAGS += -DLONGS_ARE_64BITS
CFGFLAGS += -DPTRS_ARE_64BITS
+CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS
CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ
include ${SDK}/make/Makefile.linux-x86-generic-common-2_6
ifeq (,$(KFLAGS))
-KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign
+KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign
endif
KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/arch/x86/include/generated/uapi
-ifeq ($(LINUX_MAKE_SHARED_LIB),1)
-KFLAGS += -fPIC -mcmodel=small
-else
-KFLAGS += -mcmodel=kernel
-endif
-
include ${SDK}/make/Makefile.linux-x86-common-2_6
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/include/linux-bde.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux-bde.h
similarity index 89%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/include/linux-bde.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux-bde.h
index fd758acac715..e0c23f73050a 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/include/linux-bde.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux-bde.h
@@ -16,7 +16,7 @@
*/
/***********************************************************************
*
- * $Id: linux-bde.h,v 1.24 2013/01/30 16:52:27 gili Exp $
+ * $Id: linux-bde.h,v 1.24 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
@@ -77,6 +77,21 @@
#include <linux/version.h>
+#ifdef __KERNEL__
+#include <linux/types.h>
+/* Key stone and Raptor has 2.6.21 but don't have definition */
+#if defined(KEYSTONE) || defined(RAPTOR)
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21))
+ #ifdef PHYS_ADDRS_ARE_64BITS
+ typedef u64 phys_addr_t;
+ #else
+ typedef u32 phys_addr_t;
+ #endif
+ #endif
+#endif
+#endif
+
+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
#define LINUX_BDE_DMA_DEVICE_SUPPORT
#endif
@@ -148,21 +163,24 @@ extern int linux_bde_instance_attach(unsigned int dev_mask,unsigned int dma_size
*/
/*
- * The user bde needs to get some physical addresses for
- * the userland code to mmap.
+ * The user bde needs to get cpu physical address for
+ * the userland code to mmap.
+ * And the second address is bus address, it is either
+ * identical to cpu physical address or another address
+ * (IOVA) translated by IOMMU.
*/
-extern int lkbde_get_dma_info(uint32 *pbase, uint32 *size);
-extern uint32 lkbde_get_dev_phys(int d);
-extern uint32 lkbde_get_dev_phys_hi(int d);
+extern int lkbde_get_dma_info(phys_addr_t *cpu_pbase, phys_addr_t *dma_pbase, ssize_t *size);
+extern uint32 lkbde_get_dev_phys(int d);
+extern uint32 lkbde_get_dev_phys_hi(int d);
/*
- * Virtual device address needed by kernel space
+ * Virtual device address needed by kernel space
* interrupt handler.
*/
extern void *lkbde_get_dev_virt(int d);
/*
- * The user bde needs to get some physical addresses for
+ * The user bde needs to get some physical addresses for
* the userland code to mmap. The following functions
* supports multiple resources for a single device.
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux_dma.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux_dma.h
new file mode 100644
index 000000000000..f2621a982cc1
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/linux_dma.h
@@ -0,0 +1,76 @@
+/*
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to
+ * you under the terms of the GNU General Public License version 2 (the
+ * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and to
+ * copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ */
+/***********************************************************************
+ *
+ * $Id: linux_dma.h,v 1.24 Broadcom SDK $
+ * $Copyright: (c) 2016 Broadcom Corp.
+ * All Rights Reserved.$
+ *
+ **********************************************************************/
+
+#ifndef __LINUX_DMA_H__
+#define __LINUX_DMA_H__
+
+#include <sal/types.h>
+
+#ifdef __KERNEL__
+
+#ifdef SAL_BDE_XLP
+#define KMALLOC(size, flags) __kmalloc(size, flags)
+#else
+#define KMALLOC(size, flags) kmalloc(size, flags)
+#endif
+
+#if defined(CONFIG_IDT_79EB334) || defined(CONFIG_BCM4702)
+/* ioremap is broken in kernel */
+#define IOREMAP(addr, size) ((void *)KSEG1ADDR(addr))
+#else
+#define IOREMAP(addr, size) ioremap_nocache(addr, size)
+#endif
+
+#if defined (__mips__)
+#if defined(CONFIG_NONCOHERENT_IO) || defined(CONFIG_DMA_NONCOHERENT)
+/* Use flush/invalidate for cached memory */
+#define NONCOHERENT_DMA_MEMORY
+/* Remap virtual DMA addresses to non-cached segment */
+#define REMAP_DMA_NONCACHED
+#endif /* CONFIG_NONCOHERENT_IO || CONFIG_DMA_NONCOHERENT */
+#endif /* __mips__ */
+
+#if defined(BCM958525) && (LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,5))
+#define REMAP_DMA_NONCACHED
+#endif
+
+#ifndef DMA_BIT_MASK
+#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
+#endif
+
+extern void _dma_init(int robo_switch);
+extern int _dma_cleanup(void);
+extern void _dma_pprint(void);
+extern uint32_t *_salloc(int d, int size, const char *name);
+extern void _sfree(int d, void *ptr);
+extern int _sinval(int d, void *ptr, int length);
+extern int _sflush(int d, void *ptr, int length);
+extern sal_paddr_t _l2p(int d, void *vaddr);
+extern void *_p2l(int d, sal_paddr_t paddr);
+extern int _dma_pool_allocated(void);
+extern int _dma_range_valid(unsigned long phys_addr, unsigned long size);
+
+#endif /* __KERNEL__ */
+
+#endif /* __LINUX_DMA_H__ */
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/include/mpool.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/mpool.h
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/include/mpool.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/mpool.h
index 69a6fc8d3abf..001743d7192a 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/include/mpool.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/include/mpool.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: mpool.h,v 1.2 2005/01/17 19:53:06 csm Exp $
+ * $Id: mpool.h,v 1.2 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/Makefile
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/Makefile
index 7fbf423090f2..0d126c9a2373 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.18 2013/01/10 01:00:43 bpeela Exp $
+# $Id: Makefile,v 1.18 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
@@ -55,7 +55,7 @@ else
LSRCS += etc_robo_spi.c aiutils.c
else
ifeq ($(platformbase), iproc)
- LSRCS += robo_srab.c aiutils.c
+ LSRCS += robo_srab.c robo_spi.c aiutils.c
endif
endif
endif # platformbase
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux-kernel-bde.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux-kernel-bde.c
similarity index 84%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux-kernel-bde.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux-kernel-bde.c
index dfb9be772a58..105d3d9bd940 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux-kernel-bde.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux-kernel-bde.c
@@ -15,67 +15,27 @@
* of the software.
*/
/*
- * $Id: linux-kernel-bde.c,v 1.414 2013/09/20 18:03:25 bpeela Exp $
+ * $Id: linux-kernel-bde.c,v 1.414 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
* Linux Kernel BDE
*
- *
- * DMA memory allocation modes
- * ===========================
- *
- * 1. Using private pool in kernel memory
- * --------------------------------------
- * In this mode the BDE module will try to assemble a physically contiguous
- * of memory using the kernel page allocator. This memory block is then
- * administered by the mpool allocation functions. Note that once a system
- * has been running for a while, the memory fragmentation may prevent the
- * allocator from assembling a contiguous memory block, however, if the
- * module is loaded shortly after system startup, it is very unlikely to
- * fail.
- *
- * This allocation method is used by default.
- *
- * 2. Using private pool in high memory
- * ------------------------------------
- * In this mode the BDE module will assume that unused physical memory is
- * present at the high_memory address, i.e. memory not managed by the Linux
- * memory manager. This memory block is mapped into kernel space and
- * administered by the mpool allocation functions. High memory must be
- * reserved using either the mem=xxx kernel parameter (recommended), or by
- * hardcoding the memory limit in the kernel image.
- *
- * The module parameter himem=1 enables this allocation mode.
- *
- * 3. Using kernel allocators (kmalloc, __get_free_pages)
- * ------------------------------------------------------
- * In this mode all DMA memory is allocated from the kernel on the fly, i.e.
- * no private DMA memory pool will be created. If large memory blocks are
- * only allocated at system startup (or not at all), this allocation method
- * is the most flexible and memory-efficient, however, it is not recommended
- * for non-coherent memory platforms due to an overall system performance
- * degradation arising from the use of cache flush/invalidate instructions.
- *
- * The module parameter dmasize=0M enables this allocation mode, however if
- * DMA memory is requested from a user mode application, a private memory
- * pool will be created and used irrespectively.
*/
#include <gmodule.h>
#include <linux-bde.h>
+#include <linux_dma.h>
#include <mpool.h>
#include <linux/delay.h>
+#include <linux/types.h>
#include <sdk_config.h>
#include <soc/devids.h>
#include <soc/cmic.h>
+#include <linux/version.h>
#include "linux_shbde.h"
-#ifdef BCM_PLX9656_LOCAL_BUS
-#include <asm/cacheflush.h>
-#endif
-
#ifdef BCM_ROBO_SUPPORT
/* robo/et related header files */
#include <shared/et/typedefs.h>
@@ -90,6 +50,9 @@
#elif defined(IPROC_CMICD)
#include <shared/et/aiutils.h>
#include <sbchipc.h>
+#ifdef BCM_STARFIGHTER3_SUPPORT
+#include <robo_spi.h>
+#endif
#include <robo_srab.h>
#include <soc/nsgmac2reg.h>
#else /* BCM4704 */
@@ -98,62 +61,33 @@
#endif
#endif /* BCM_ROBO_SUPPORT */
-/* allocation types/methods for the DMA memory pool */
-#define ALLOC_TYPE_CHUNK 0 /* use small allocations and join them */
-#define ALLOC_TYPE_API 1 /* use one allocation */
-#if _SIMPLE_MEMORY_ALLOCATION_
-#include <linux/dma-mapping.h>
-#if defined(IPROC_CMICD) && defined(CONFIG_CMA) && defined(CONFIG_CMA_SIZE_MBYTES)
-#define DMA_MAX_ALLOC_SIZE (CONFIG_CMA_SIZE_MBYTES * 1024 * 1024)
-#else
-#define DMA_MAX_ALLOC_SIZE (1 << (MAX_ORDER - 1 + PAGE_SHIFT)) /* Maximum size the kernel can allocate in one allocation */
+#define PCI_USE_INT_NONE (-1)
+#define PCI_USE_INT_INTX (0)
+#define PCI_USE_INT_MSI (1)
+#define PCI_USE_INT_MSIX (2)
+#ifdef CONFIG_PCI_MSI
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,110))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+#define msix_table_size(flags) ((flags & PCI_MSIX_FLAGS_QSIZE) + 1)
#endif
-#endif /* _SIMPLE_MEMORY_ALLOCATION_ */
-
-#if _SIMPLE_MEMORY_ALLOCATION_ == 1
-#define ALLOC_METHOD_DEFAULT ALLOC_TYPE_API
-#else
-#define ALLOC_METHOD_DEFAULT ALLOC_TYPE_CHUNK
+#define msi_control_reg(base) (base + PCI_MSI_FLAGS)
#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
-#include <linux/slab.h>
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
#endif
-
MODULE_AUTHOR("Broadcom Corporation");
MODULE_DESCRIPTION("Kernel BDE");
MODULE_LICENSE("GPL");
-/* DMA memory pool size */
-static char *dmasize;
-LKM_MOD_PARAM(dmasize, "s", charp, 0);
-MODULE_PARM_DESC(dmasize,
-"Specify DMA memory size (default 4MB)");
-
-/* Select DMA memory pool allocation method */
-static int dmaalloc = ALLOC_METHOD_DEFAULT;
-LKM_MOD_PARAM(dmaalloc, "i", int, 0);
-MODULE_PARM_DESC(dmaalloc, "Select DMA memory allocation method");
-
-/* Use high memory for DMA */
-static char *himem;
-LKM_MOD_PARAM(himem, "s", charp, 0);
-MODULE_PARM_DESC(himem,
-"Use high memory for DMA (default no)");
-
/* PCIe max payload */
int maxpayload = 256;
LKM_MOD_PARAM(maxpayload, "i", int, 0);
MODULE_PARM_DESC(maxpayload,
"Limit maximum payload size and request size on PCIe devices");
-/* Use MSI interrupts */
+/* Use MSI or MSIX interrupts */
int usemsi = -1;
LKM_MOD_PARAM(usemsi, "i", int, 0);
MODULE_PARM_DESC(usemsi,
-"Use MSI interrupts if supported by kernel");
+"Use MSI/ MSIX interrupts if supported by kernel");
/* Ignore all recognized devices (for debug purposes) */
int nodevices;
@@ -266,8 +200,6 @@ MODULE_PARM_DESC(eadevices,
#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d, struct pt_regs *_r
#define IRQ_NONE
#define IRQ_HANDLED
-#define MEM_MAP_RESERVE mem_map_reserve
-#define MEM_MAP_UNRESERVE mem_map_unreserve
#define SYNC_IRQ(_i) synchronize_irq()
#else /* LKM_2_6 */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
@@ -280,8 +212,6 @@ MODULE_PARM_DESC(eadevices,
#else
#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d, struct pt_regs *_r
#endif
-#define MEM_MAP_RESERVE SetPageReserved
-#define MEM_MAP_UNRESERVE ClearPageReserved
#define SYNC_IRQ(_i) synchronize_irq(_i)
char * ___strtok;
char * strtok(char * s,const char * ct)
@@ -306,14 +236,6 @@ LKM_EXPORT_SYM(___strtok);
LKM_EXPORT_SYM(strtok);
#endif /* LKM_2_x */
-#ifndef DMA_BIT_MASK
-#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
-#endif
-
-#ifndef GFP_DMA32
-#define GFP_DMA32 0
-#endif
-
/* PCIe capabilities */
#ifndef PCI_CAP_ID_EXP
#define PCI_CAP_ID_EXP 0x10
@@ -350,32 +272,6 @@ LKM_EXPORT_SYM(strtok);
#define PHYS_ADDR_IS_64BIT
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21))
-#define VIRT_TO_PAGE(p) virt_to_page((void*)(p))
-#else
-#define VIRT_TO_PAGE(p) virt_to_page((p))
-#endif
-
-#if defined(CONFIG_IDT_79EB334) || defined(CONFIG_BCM4702)
-/* ioremap is broken in kernel */
-#define IOREMAP(addr, size) ((void *)KSEG1ADDR(addr))
-#else
-#define IOREMAP(addr, size) ioremap_nocache(addr, size)
-#endif
-
-#if defined (__mips__)
-#if defined(CONFIG_NONCOHERENT_IO) || defined(CONFIG_DMA_NONCOHERENT)
-/* Use flush/invalidate for cached memory */
-#define NONCOHERENT_DMA_MEMORY
-/* Remap virtual DMA addresses to non-cached segment */
-#define REMAP_DMA_NONCACHED
-#endif /* CONFIG_NONCOHERENT_IO || CONFIG_DMA_NONCOHERENT */
-#endif /* __mips__ */
-
-#if defined(BCM958525)
-#define REMAP_DMA_NONCACHED
-#endif
-
/* Structure of private SPI device */
struct spi_dev {
uint8 cid; /* Chip ID */
@@ -401,10 +297,14 @@ typedef struct bde_ctrl_s {
/* Specify the type of device, pci, spi, switch, ether ... */
uint32 dev_type;
+ int domain_no;
int bus_no;
int be_pio;
int use_msi;
-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ struct msix_entry *entries;
+#endif
+ int msix_cnt;
union {
/* Linux PCI device pointer */
struct pci_dev* _pci_dev;
@@ -424,10 +324,6 @@ typedef struct bde_ctrl_s {
resource_size_t phys_address1;
resource_size_t phys_address2;
-#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT)
- void *cpu_address;
-#endif
-
/* Secondary mapped base address */
sal_vaddr_t alt_base_addr;
@@ -471,6 +367,11 @@ static int robo_switch = 0;
#define VALID_DEVICE(_n) ((_n >= 0) && (_n < _ndevices))
+/* CPU MMIO area used with CPU cards provided on demo boards */
+#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)) && (defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__))
+static void *cpu_address = NULL;
+#endif
+
#ifdef BCM_ROBO_SUPPORT
/* for SPI access via bcm4710 core */
@@ -581,13 +482,17 @@ robo_spi_write(void *cookie, uint16_t reg, uint8_t *buf, int len);
/* PLX PCI-E Switch */
#define PLX_PEX8608_DEV_ID 0x8608
#define PLX_PEX8617_DEV_ID 0x8617
-#define PLX_PEX86XX_DEV_CTRL_REG 0x70
+#define PLX_PEX86XX_DEV_CTRL_REG 0x70
/* Broadcom BCM58525 */
#define BCM58525_PCI_VENDOR_ID 0x14E4
#define BCM58525_PCI_DEVICE_ID 0x8025
#define BCM58522_PCI_DEVICE_ID 0x8022
+/* Broadcom BCM58712 */
+#define BCM58712_PCI_VENDOR_ID 0x14E4
+#define BCM58712_PCI_DEVICE_ID 0x168E
+
static uint32_t _read(int d, uint32_t addr);
#ifdef BCM_ICS
@@ -618,15 +523,6 @@ static int num_plx = 0;
#endif /* BCM_PLX9656_LOCAL_BUS */
-/* Flags for memory allocations */
-#ifdef SAL_BDE_XLP
-#define KMALLOC(size, flags) __kmalloc(size, flags)
-static int mem_flags = GFP_ATOMIC | GFP_KERNEL | GFP_DMA;
-#else
-#define KMALLOC(size, flags) kmalloc(size, flags)
-static int mem_flags = GFP_ATOMIC | GFP_DMA32;
-#endif
-
static spinlock_t bus_lock;
static int
@@ -686,12 +582,12 @@ _eb_device_create(resource_size_t paddr, int irq, int rd_hw, int wr_hw)
return 0;
}
-#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT)
+#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)
#include <soc/devids.h>
static int
-petra_device_create(void)
+sand_device_create(void)
{
bde_ctrl_t* ctrl;
@@ -718,14 +614,14 @@ petra_device_create(void)
/* Map CPU regs */
#ifdef __DUNE_WRX_BCM_CPU__
- ctrl->cpu_address = IOREMAP(0x18000000, 0x4000000);
-#else
- ctrl->cpu_address = IOREMAP(0xe0000000, 0x100000);
+ cpu_address = IOREMAP(0x18000000, 0x4000000);
+#elif defined(__DUNE_GTO_BCM_CPU__)
+ cpu_address = IOREMAP(0xe0000000, 0x100000);
#endif
if ((ctrl->bde_dev.device == PCP_PCI_DEVICE_ID)) {
- ctrl->bde_dev.device = PETRAB_DEVICE_ID;
- ctrl->bde_dev.rev = PETRAB_A0_REV_ID;
+ ctrl->bde_dev.device = GEDI_DEVICE_ID;
+ ctrl->bde_dev.rev = GEDI_REV_ID;
}
if ((ctrl->bde_dev.device == ACP_PCI_DEVICE_ID)) {
@@ -738,9 +634,28 @@ petra_device_create(void)
#ifdef IPROC_CMICD
static void
-iproc_cmicd_get_irqres(ibde_dev_t bde_dev, struct resource *res_irq);
+iproc_cmicd_get_irqres(ibde_dev_t bde_dev, struct resource *res_irq)
+{
+ shbde_iproc_config_t iproc_config, *icfg = &iproc_config;
+
+ /* iProc configuration parameters */
+ memset(icfg, 0, sizeof(*icfg));
+ shbde_iproc_config_init(icfg, bde_dev.device, bde_dev.rev);
+
+ if ((icfg->iproc_ver == 0) && (debug >= 1)) {
+ gprintk("Unable to determine iProc version\n");
+ }
+
+ if (icfg->iproc_ver == 7) {
+ res_irq->start = 221;
+ } else if (icfg->iproc_ver == 10) {
+ res_irq->start = 184;
+ }
+
+}
#include <linux/platform_device.h>
+#include <linux/of.h>
extern void iproc_platform_driver_register(struct platform_driver *drv);
extern void iproc_platform_driver_unregister(struct platform_driver *drv);
@@ -756,13 +671,19 @@ iproc_platform_get_resource(struct platform_device *dev, unsigned int type,
#define IPROC_CMICD_SIZE 0x40000
#define IPROC_CMICD_INT 194
+#define IPROC_CMICD_COMPATIBLE "brcm,iproc-cmicd"
+
static int
iproc_cmicd_probe(struct platform_device *pldev)
{
bde_ctrl_t *ctrl;
uint32 size, dev_rev_id;
struct resource *memres, *irqres;
-
+#ifdef CONFIG_OF
+ if (debug >= 1) {
+ gprintk("iproc_cmicd_probe %s\n", pldev->dev.of_node ? "with device node":"");
+ }
+#endif
memres = iproc_platform_get_resource(pldev, IORESOURCE_MEM, 0);
if (memres == NULL) {
gprintk("Unable to retrieve iProc CMIC resources");
@@ -795,8 +716,13 @@ iproc_cmicd_probe(struct platform_device *pldev)
ctrl->bde_dev.rev = (dev_rev_id >> 16) & 0xff;
#endif
- iproc_cmicd_get_irqres(ctrl->bde_dev, &pldev->resource[0]);
-
+#ifdef CONFIG_OF
+ if (!pldev->dev.of_node)
+#endif
+ {
+ /* Assign locally if not available from device node */
+ iproc_cmicd_get_irqres(ctrl->bde_dev, &pldev->resource[0]);
+ }
irqres = iproc_platform_get_resource(pldev, IORESOURCE_IRQ, 0);
ctrl->iLine = irqres->start;
@@ -817,7 +743,13 @@ iproc_cmicd_remove(struct platform_device *pldev)
{
return 0;
}
-
+#ifdef CONFIG_OF
+static const struct of_device_id iproc_cmicd_of_match[] = {
+ { .compatible = "brcm,iproc-cmicd" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, iproc_cmicd_of_match);
+#endif
static char iproc_cmicd_string[] = "bcmiproc-cmicd";
static struct platform_driver iproc_cmicd_driver =
@@ -828,6 +760,9 @@ static struct platform_driver iproc_cmicd_driver =
{
.name = iproc_cmicd_string,
.owner = THIS_MODULE,
+#ifdef CONFIG_OF
+ .of_match_table = iproc_cmicd_of_match,
+#endif
},
};
@@ -1026,26 +961,6 @@ iproc_cmicd_get_memregion(struct resource *res_mem)
iproc_cmicd_resources[IPROC_CMICD_RES_MEM].end);
}
}
-
-static void
-iproc_cmicd_get_irqres(ibde_dev_t bde_dev, struct resource *res_irq)
-{
- shbde_iproc_config_t iproc_config, *icfg = &iproc_config;
-
- /* iProc configuration parameters */
- memset(icfg, 0, sizeof(*icfg));
- shbde_iproc_config_init(icfg, bde_dev.device, bde_dev.rev);
-
- if ((icfg->iproc_ver == 0) && (debug >= 1)) {
- gprintk("Unable to determine iProc version\n");
- }
-
- if (icfg->iproc_ver == 7) {
- res_irq->start = 221;
- }
-
-}
-
#endif /* IPROC_CMICD */
#ifdef BCM_ICS
@@ -1332,6 +1247,11 @@ static struct pci_device_id _id_table[] = {
{ BROADCOM_VENDOR_ID, BCM55450_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM55455_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56260_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56270_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56271_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56272_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53460_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53461_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56261_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56262_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56263_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
@@ -1396,12 +1316,52 @@ static struct pci_device_id _id_table[] = {
{ BROADCOM_VENDOR_ID, BCM53424_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM53426_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM53365_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53369_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56960_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56961_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56962_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56963_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56930_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56968_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56970_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56971_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56972_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56974_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56168_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56169_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56560_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56561_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56562_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56565_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56566_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56567_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56568_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56760_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56762_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56764_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56765_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56766_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56768_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56069_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56068_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56160_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56162_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56163_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56164_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56166_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53440_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53443_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53442_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53434_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56965_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56969_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56966_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56967_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56170_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56172_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56174_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53570_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM53575_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
#ifdef BCM_ROBO_SUPPORT
{ BROADCOM_VENDOR_ID, BCM47XX_ENET_ID, PCI_ANY_ID, PCI_ANY_ID },
#ifdef KEYSTONE
@@ -1431,12 +1391,14 @@ static struct pci_device_id _id_table[] = {
{ BROADCOM_VENDOR_ID, BCM88670_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88671_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88671M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88672_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88673_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88674_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88675_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88675M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88676_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88676M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88677_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88678_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88679_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88370_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
@@ -1444,11 +1406,36 @@ static struct pci_device_id _id_table[] = {
{ BROADCOM_VENDOR_ID, BCM88371M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88375_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88470_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88470P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88471_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88473_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88474_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88474H_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88476_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88477_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+
+
+ { BROADCOM_VENDOR_ID, BCM88270_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88272_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88273_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88278_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+
+ { BROADCOM_VENDOR_ID, BCM8206_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+
{ BROADCOM_VENDOR_ID, BCM88376_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88376M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88377_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88378_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88379_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88680_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88681_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88682_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88683_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88684_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88685_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88380_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88381_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88690_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88202_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88360_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88361_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
@@ -1470,11 +1457,20 @@ static struct pci_device_id _id_table[] = {
{ BROADCOM_VENDOR_ID, BCM88774_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88775_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88776_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88777_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+#ifndef DNX_IGNORE_FE3200
{ BROADCOM_VENDOR_ID, BCM88950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+#endif
{ BROADCOM_VENDOR_ID, BCM88953_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88954_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88955_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM88956_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88752_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88772_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM88952_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+#endif
+#ifdef BCM_DNXF_SUPPORT
+ { BROADCOM_VENDOR_ID, BCM88790_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
#endif
{ BROADCOM_VENDOR_ID, BCM56860_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56861_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
@@ -1487,8 +1483,10 @@ static struct pci_device_id _id_table[] = {
{ BROADCOM_VENDOR_ID, BCM56833_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56832_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ BROADCOM_VENDOR_ID, BCM56836_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56870_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+ { BROADCOM_VENDOR_ID, BCM56873_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
{ 0, 0, 0, 0 }
-};
+};;
#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
@@ -1870,7 +1868,8 @@ _device_rescan_validate(struct pci_dev *dev)
if (dev->device == ctrl->bde_dev.device) {
/* check the bus number */
if ((dev->bus)) {
- if (dev->bus->number == ctrl->bus_no){
+ if ((dev->bus->number == ctrl->bus_no) &&
+ (pci_domain_nr(dev->bus) == ctrl->domain_no)) {
return i;
}
}
@@ -1879,6 +1878,179 @@ _device_rescan_validate(struct pci_dev *dev)
return -1;
}
+#ifdef CONFIG_PCI_MSI
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+/**
+ * _pci_msix_table_size - return the number of device's MSI-X table entries
+ * @dev: pointer to the pci_dev data structure of MSI-X device function
+ */
+static int
+_pci_msix_table_size(struct pci_dev *dev)
+{
+ int nr_entries = 0;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,110))
+ u16 control;
+ int pos;
+
+ pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+ if (pos) {
+ pci_read_config_word(dev, msi_control_reg(pos), &control);
+ nr_entries = msix_table_size(control);
+ }
+#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0))
+{
+ /* Pass large entry value to enable MSIX to get # of entires */
+ struct msix_entry *entries;
+ entries = kmalloc(sizeof(struct msix_entry) *
+ PCI_MSIX_FLAGS_QSIZE, GFP_KERNEL);
+ if (entries != NULL) {
+ nr_entries = pci_enable_msix(dev,
+ entries, PCI_MSIX_FLAGS_QSIZE);
+ if (nr_entries < 0) {
+ nr_entries = 0;
+ }
+ kfree(entries);
+ }
+}
+#else
+ nr_entries = pci_msix_vec_count(dev);
+#endif
+#endif
+
+ return nr_entries;
+}
+#endif
+
+static int
+_msi_connect(bde_ctrl_t *ctrl)
+{
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ int ret;
+ if (ctrl->use_msi == PCI_USE_INT_MSIX) {
+ int i;
+ ret = _pci_msix_table_size(ctrl->pci_device);
+
+ if (ret == 0) {
+ /* MSI-X failed */
+ gprintk("MSI-X not supported.\n");
+ goto er_intx;
+ }
+ ctrl->entries = kcalloc(ret, sizeof(struct msix_entry)*ret, GFP_KERNEL);
+
+ if (!ctrl->entries) {
+ goto er_intx;
+ }
+ /* We need only that much interrupt vecotrs */
+ ctrl->msix_cnt = ret/4;
+ if (unlikely(debug > 1))
+ gprintk("MSIX Table size = %d\n", ctrl->msix_cnt);
+ for (i = 0; i < ctrl->msix_cnt; i++)
+ ctrl->entries[i].entry = i;
+
+ ret = pci_enable_msix(ctrl->pci_device,
+ ctrl->entries, ctrl->msix_cnt);
+ if (ret > 0) {
+ /* Not enough vectors available , Retry MSI-X */
+ gprintk("Retrying with MSI-X interrupts = %d\n", ret);
+ ctrl->msix_cnt = ret;
+ ret = pci_enable_msix(ctrl->pci_device,
+ ctrl->entries, ctrl->msix_cnt);
+ if (ret != 0)
+ goto er_intx_free;
+ } else if (ret < 0) {
+ /* Error */
+ goto er_intx_free;
+ } else {
+ gprintk("Enabled MSI-X interrupts = %d\n", ctrl->msix_cnt);
+ }
+ }
+#endif
+
+ if (ctrl->use_msi == PCI_USE_INT_MSI) {
+ if (pci_enable_msi(ctrl->pci_device) == 0) {
+ ctrl->iLine = ctrl->pci_device->irq;
+ } else {
+ /* MSI failed */
+ gprintk("Failed to initialize MSI interrupts.\n");
+ goto er_intx;
+ }
+ } else {
+ /* failed */
+ gprintk("Not MSI/MSIC interrupt.\n");
+ goto er_intx;
+ }
+ return 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+er_intx_free:
+ gprintk("Failed to enable MSI-X interrupts = %d\n", ret);
+ kfree(ctrl->entries);
+#endif
+er_intx:
+ return -1;
+
+}
+
+static int
+_msi_disconnect(bde_ctrl_t *ctrl)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ if (ctrl->use_msi == PCI_USE_INT_MSIX) {
+ pci_disable_msix(ctrl->pci_device);
+ kfree(ctrl->entries);
+ ctrl->msix_cnt = 0;
+ }
+#endif
+ if (ctrl->use_msi == PCI_USE_INT_MSI) {
+ pci_disable_msi(ctrl->pci_device);
+ } else {
+ gprintk("MSI not used\n");
+ }
+ return 0;
+}
+
+#endif
+
+
+static void
+config_pci_intr_type(bde_ctrl_t *ctrl)
+{
+
+#ifdef CONFIG_PCI_MSI
+ int ret;
+
+ ctrl->use_msi = use_msi;
+ if (unlikely(debug > 1))
+ gprintk("%s: msi = %d\n", __func__, ctrl->use_msi);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ if (ctrl->use_msi == PCI_USE_INT_MSIX) {
+ /* check for support MSIX vector */
+ ret = _pci_msix_table_size(ctrl->pci_device);
+ if (ret == 0) {
+ gprintk("%s: Zero MSIX table size\n", __func__);
+ ctrl->use_msi = PCI_USE_INT_MSI;
+ }
+ }
+#endif
+
+ if (ctrl->use_msi == PCI_USE_INT_MSI) {
+ /* check for support MSI vector */
+ ret = pci_enable_msi(ctrl->pci_device);
+ if (ret < 0) {
+ ctrl->use_msi = PCI_USE_INT_INTX;
+ gprintk("%s: Failed to enable MSI\n", __func__);
+ } else {
+ pci_disable_msi(ctrl->pci_device);
+ }
+ }
+#else
+ ctrl->use_msi = PCI_USE_INT_INTX;
+#endif
+}
/*
* Function: _pci_probe
@@ -1946,8 +2118,11 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
*/
switch (dev->device) {
- case PCI_DEVICE_ID_PLX_9656:
case PCI_DEVICE_ID_PLX_9056:
+#ifdef DNX_TEST_BOARD
+ break; /* a PCIe bridge to a non PCIe device should be treated as the device */
+#endif /* DNX_TEST_BOARD */
+ case PCI_DEVICE_ID_PLX_9656:
plx_dev = 1;
break;
#if defined (BCM_ROBO_SUPPORT) && defined(KEYSTONE)
@@ -2038,6 +2213,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
ctrl = _devices + _ndevices++;
_switch_ndevices++;
ctrl->dev_type |= BDE_SWITCH_DEV_TYPE;
+ ctrl->domain_no = pci_domain_nr(dev->bus);
ctrl->bus_no = dev->bus->number;
ctrl->dev_state = BDE_DEV_STATE_NORMAL;
}
@@ -2164,8 +2340,9 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
}
if (((PCI_FIND_DEV(BCM58525_PCI_VENDOR_ID, BCM58525_PCI_DEVICE_ID, NULL)) != NULL) ||
- ((PCI_FIND_DEV(BCM58525_PCI_VENDOR_ID, BCM58522_PCI_DEVICE_ID, NULL)) != NULL)) {
- /* BCM58525 CPU boards support 128 Max payload size */
+ ((PCI_FIND_DEV(BCM58525_PCI_VENDOR_ID, BCM58522_PCI_DEVICE_ID, NULL)) != NULL) ||
+ ((PCI_FIND_DEV(BCM58712_PCI_VENDOR_ID, BCM58712_PCI_DEVICE_ID, NULL)) != NULL) ) {
+ /* BCM58525/BCM58712 CPU boards support 128 Max payload size */
if (maxpayload) {
maxpayload = 128;
if (debug >= 1) gprintk("force max payload size to 128\n");
@@ -2180,6 +2357,8 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
} else if (debug >= 1) gprintk("found irq %d\n", dev->irq);
ctrl->iLine = dev->irq;
+ if (unlikely(debug > 1))
+ gprintk("%s:irq = %d\n",__func__, ctrl->iLine);
if (shbde_pci_is_pcie(shbde, dev)) {
/* Set PCIe max payload */
@@ -2201,11 +2380,16 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
case BCM88774_DEVICE_ID:
case BCM88775_DEVICE_ID:
case BCM88776_DEVICE_ID:
+ case BCM88777_DEVICE_ID:
case BCM88950_DEVICE_ID:
case BCM88953_DEVICE_ID:
case BCM88954_DEVICE_ID:
case BCM88955_DEVICE_ID:
case BCM88956_DEVICE_ID:
+ case BCM88752_DEVICE_ID:
+ case BCM88772_DEVICE_ID:
+ case BCM88952_DEVICE_ID:
+
/*
* For DMA transactions - set Max_Payload_Size and
* Max_Read_Request_Size to 128 bytes.
@@ -2218,6 +2402,22 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
}
#endif /* BCM_DFE_SUPPORT */
+#if defined(BCM_DNXF_SUPPORT)
+ switch (dev->device) {
+ case BCM88790_DEVICE_ID:
+
+ /*
+ * For DMA transactions - set Max_Payload_Size and
+ * Max_Read_Request_Size to 128 bytes.
+ */
+ pci_write_config_byte(dev, 0xb5, 0x0c);
+ pci_write_config_byte(dev, 0xb4, 0x0);
+ break;
+ default:
+ break;
+ }
+#endif
+
/* Prevent compiler warning */
if (ctrl == NULL) {
return 0;
@@ -2235,6 +2435,12 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
baroff = cmic_bar;
}
}
+#ifdef DNX_TEST_BOARD
+ else if (dev->device == PLX9056_DEVICE_ID && baroff == 0) {
+ baroff = 2;
+ ctrl->dev_type |= BDE_NO_IPROC/* | BDE_BYTE_SWAP*/;
+ }
+#endif /* DNX_TEST_BOARD */
/* Get the device revision */
pci_read_config_byte(dev, PCI_REVISION_ID, &ctrl->bde_dev.rev);
@@ -2245,7 +2451,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
switch (dev->device) {
#if defined(BCM_PETRA_SUPPORT) && defined(__DUNE_LINUX_BCM_CPU_PCIE__)
- case PETRAB_DEVICE_ID:
+ case GEDI_DEVICE_ID:
case PCP_PCI_DEVICE_ID:
bar_len = 0x1000000;
break;
@@ -2263,7 +2469,11 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
}
/* Map secondary address spaces */
- if (iproc) {
+ if (iproc
+#ifdef DNX_TEST_BOARD
+ || (dev->device == PLX9056_DEVICE_ID && baroff == 2)
+#endif /* DNX_TEST_BOARD */
+ ) {
paddr = pci_resource_start(dev, 0);
bar_len = pci_resource_len(dev, 0);
ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(paddr, bar_len);
@@ -2288,17 +2498,25 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
}
}
+ /* configure interrupt type */
+ config_pci_intr_type(ctrl);
+
/* Configure iProc PCI-AXI bridge */
if (iproc && ctrl->bde_dev.base_address1) {
void *iproc_regs;
- shbde_iproc_config_t iproc_config, *icfg = &iproc_config;
+ shbde_iproc_config_t *icfg = &shbde->icfg;
/* Mapped iProc regs in PCI BAR 0 */
iproc_regs = (void *)ctrl->bde_dev.base_address1;
/* iProc configuration parameters */
- memset(icfg, 0, sizeof(*icfg));
+ (void)shbde_pci_iproc_version_get(shbde, dev, &icfg->iproc_ver,
+ &icfg->cmic_ver, &icfg->cmic_rev);
shbde_iproc_config_init(icfg, ctrl->bde_dev.device, ctrl->bde_dev.rev);
+
+ if (debug >=2) {
+ gprintk("iproc version = %x dma_hi_bits = %x\n", icfg->iproc_ver, icfg->dma_hi_bits);
+ }
icfg->use_msi = ctrl->use_msi;
/* Call shared function */
@@ -2318,6 +2536,27 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
shbde_iproc_pcie_preemphasis_set(shbde, iproc_regs, icfg, dev);
}
+ /* Save shared BDE HAL in device structure */
+ memcpy(&ctrl->shbde, shbde, sizeof(ctrl->shbde));
+
+#if defined(VENDOR_BROADCOM)
+#if defined(BCM_PLX9656_LOCAL_BUS) && defined(SHADOW_SVK)
+ if (num_plx) {
+ sal_vaddr_t base_address;
+ uint32 intr_enable;
+
+ paddr = pci_resource_start(dev, 0);
+ bar_len = pci_resource_len(dev, 0);
+ base_address = (sal_vaddr_t)IOREMAP(paddr, bar_len);
+
+ intr_enable = readl((uint32 *)(base_address + 0x68));
+ gprintk("PLX Interrupt ENABLE: %x\n", intr_enable);
+ intr_enable |= 0x00080000;
+ writel(intr_enable, (uint32 *)(base_address + 0x68));
+ gprintk("PLX Interrupt ENABLE: %x\n", intr_enable);
+ }
+#endif
+#endif
/*
* Since the GMAC driver of Robo chips needs access to the
@@ -2382,11 +2621,12 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
#endif
if (debug >= 2) {
- gprintk("_pci_probe: configured dev:0x%x rev:0x%d with base_addresses: 0x%lx 0x%lx\n",
+ gprintk("_pci_probe: configured dev:0x%x rev:0x%x with base_addresses: 0x%lx 0x%lx\n",
(unsigned)ctrl->bde_dev.device, (unsigned)ctrl->bde_dev.rev,
(unsigned long)ctrl->bde_dev.base_address, (unsigned long)ctrl->bde_dev.base_address1);
}
/* Let's boogie */
+
return 0;
}
@@ -2435,17 +2675,25 @@ _pci_remove(struct pci_dev* dev)
/* Free our interrupt handler, if we have one */
if (ctrl->isr || ctrl->isr2) {
- free_irq(ctrl->iLine, ctrl);
-#if defined(CONFIG_PCI_MSI)
- if (ctrl->use_msi) {
- pci_disable_msi(ctrl->pci_device);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ if (ctrl->use_msi >= PCI_USE_INT_MSIX) {
+ int i;
+ for (i = 0; i < ctrl->msix_cnt; i++)
+ free_irq(ctrl->entries[i].vector, ctrl->pci_device);
}
+ else
#endif
- ctrl->isr = NULL;
- ctrl->isr_data = NULL;
- ctrl->isr2 = NULL;
- ctrl->isr2_data = NULL;
+ {
+ free_irq(ctrl->iLine, ctrl);
+ }
}
+#ifdef CONFIG_PCI_MSI
+ _msi_disconnect(ctrl);
+#endif
+ ctrl->isr = NULL;
+ ctrl->isr_data = NULL;
+ ctrl->isr2 = NULL;
+ ctrl->isr2_data = NULL;
}
static struct pci_driver _device_driver = {
@@ -2515,547 +2763,212 @@ static struct bde_spi_device_id _spi_id_table[] = {
{ BCM53018_PHYID_HIGH, BCM53018_PHYID_LOW ,0x240230, 0x110240, 0},
{ BCM5389_PHYID_HIGH, BCM5389_PHYID_LOW, 0x110230, 0x110240, DEFAULT_FREQ},
{ BCM53020_PHYID_HIGH, BCM53020_PHYID_LOW ,0x20240230, 0x110240, 0},
- { BCM5396_PHYID_HIGH, BCM5396_PHYID_LOW, 0x110230, 0x110240, DEFAULT_FREQ},
+ { BCM5396_PHYID_HIGH , BCM5396_PHYID_LOW, 0x110230, 0x110240, DEFAULT_FREQ},
+ { BCM53134_PHYID_HIGH, BCM53134_PHYID_LOW , 0, 0x110240, DEFAULT_FREQ},
{ 0, 0, 0, 0, 0 },
};
#endif
+#ifdef BCM_ROBO_SUPPORT
-/* DMA memory allocation */
-
-#define ONE_KB 1024
-#define ONE_MB (1024*1024)
+static int
+_spi_device_valid_check(unsigned short phyidh,unsigned short phyidl, uint8 check_flag)
+{
+ struct bde_spi_device_id *_ids;
+ int idx, match_idx;
-/* Default DMA memory size */
-#ifdef SAL_BDE_DMA_MEM_DEFAULT
-#define DMA_MEM_DEFAULT (SAL_BDE_DMA_MEM_DEFAULT * ONE_MB)
-#else
-#define DMA_MEM_DEFAULT (8 * ONE_MB)
-#endif
-#define DMA_MEM_DEFAULT_ROBO (4 * ONE_MB)
+ match_idx = -1;
+ idx = 0;
+ if (check_flag == 0){
+ /* check_flag == 0 check phyidh only*/
+ for (_ids = _spi_id_table;
+ _ids->phyid_high && _ids->phyid_low; _ids++){
+ if (_ids->phyid_high == phyidh) {
+ return 0;
+ }
+ }
+ /* No valid SPI devices found */
+ return 1;
+ } else {
+ while(_spi_id_table[idx].phyid_high){
+ if (phyidh == _spi_id_table[idx].phyid_high &&
+ phyidl == _spi_id_table[idx].phyid_low) {
+ /* Found a match */
+ match_idx = idx;
+ break;
+ }
+ idx++;
+ }
+ return match_idx;
+ }
+}
-/* We try to assemble a contiguous segment from chunks of this size */
-#define DMA_BLOCK_SIZE (512 * ONE_KB)
+#if defined(IPROC_CMICD) || defined(KEYSTONE)
+#define ROBO_ATTACH_AVAIL
+#endif
-typedef struct _dma_segment {
- struct list_head list;
- unsigned long req_size; /* Requested DMA segment size */
- unsigned long blk_size; /* DMA block size */
- unsigned long blk_order; /* DMA block size in alternate format */
- unsigned long seg_size; /* Current DMA segment size */
- unsigned long seg_begin; /* Logical address of segment */
- unsigned long seg_end; /* Logical end address of segment */
- unsigned long *blk_ptr; /* Array of logical DMA block addresses */
- int blk_cnt_max; /* Maximum number of block to allocate */
- int blk_cnt; /* Current number of blocks allocated */
-} dma_segment_t;
-
-static unsigned int _dma_mem_size = DMA_MEM_DEFAULT;
-static mpool_handle_t _dma_pool = NULL;
-static void *_dma_vbase = NULL;
-static uint32_t _dma_pbase = 0;
-static int _use_himem = 0;
-static LIST_HEAD(_dma_seg);
+#ifdef ROBO_ATTACH_AVAIL
-/*
- * Function: _find_largest_segment
- *
- * Purpose:
- * Find largest contiguous segment from a pool of DMA blocks.
- * Parameters:
- * dseg - DMA segment descriptor
- * Returns:
- * 0 on success, < 0 on error.
- * Notes:
- * Assembly stops if a segment of the requested segment size
- * has been obtained.
- *
- * Lower address bits of the DMA blocks are used as follows:
- * 0: Untagged
- * 1: Discarded block
- * 2: Part of largest contiguous segment
- * 3: Part of current contiguous segment
- */
-static int
-_find_largest_segment(dma_segment_t *dseg)
-{
- int i, j, blks, found;
- unsigned long b, e, a;
-
- blks = dseg->blk_cnt;
- /* Clear all block tags */
- for (i = 0; i < blks; i++) {
- dseg->blk_ptr[i] &= ~3;
- }
- for (i = 0; i < blks && dseg->seg_size < dseg->req_size; i++) {
- /* First block must be an untagged block */
- if ((dseg->blk_ptr[i] & 3) == 0) {
- /* Initial segment size is the block size */
- b = dseg->blk_ptr[i];
- e = b + dseg->blk_size;
- dseg->blk_ptr[i] |= 3;
- /* Loop looking for adjacent blocks */
- do {
- found = 0;
- for (j = i + 1; j < blks && (e - b) < dseg->req_size; j++) {
- a = dseg->blk_ptr[j];
- /* Check untagged blocks only */
- if ((a & 3) == 0) {
- if (a == (b - dseg->blk_size)) {
- /* Found adjacent block below current segment */
- dseg->blk_ptr[j] |= 3;
- b = a;
- found = 1;
- } else if (a == e) {
- /* Found adjacent block above current segment */
- dseg->blk_ptr[j] |= 3;
- e += dseg->blk_size;
- found = 1;
- }
- }
- }
- } while (found);
- if ((e - b) > dseg->seg_size) {
- /* The current block is largest so far */
- dseg->seg_begin = b;
- dseg->seg_end = e;
- dseg->seg_size = e - b;
- /* Re-tag current and previous largest segment */
- for (j = 0; j < blks; j++) {
- if ((dseg->blk_ptr[j] & 3) == 3) {
- /* Tag current segment as the largest */
- dseg->blk_ptr[j] &= ~1;
- } else if ((dseg->blk_ptr[j] & 3) == 2) {
- /* Discard previous largest segment */
- dseg->blk_ptr[j] ^= 3;
- }
- }
- } else {
- /* Discard all blocks in current segment */
- for (j = 0; j < blks; j++) {
- if ((dseg->blk_ptr[j] & 3) == 3) {
- dseg->blk_ptr[j] &= ~2;
- }
- }
- }
- }
- }
- return 0;
-}
-
-/*
- * Function: _alloc_dma_blocks
- *
- * Purpose:
- * Allocate DMA blocks and add them to the pool.
- * Parameters:
- * dseg - DMA segment descriptor
- * blks - number of DMA blocks to allocate
- * Returns:
- * 0 on success, < 0 on error.
- * Notes:
- * DMA blocks are allocated using the page allocator.
- */
-static int
-_alloc_dma_blocks(dma_segment_t *dseg, int blks)
-{
- int i, start;
- unsigned long addr;
+#define SOC_ATTACH(_sc)\
+ ai_soc_kattach(_sc)
+
+#if defined(IPROC_CMICD)
+#ifdef BCM_STARFIGHTER3_SUPPORT
+#define ROBO_ATTACH_SPI(_sih, _ss)\
+ robo_attach_spi(_sih)
+#define ROBO_DETACH_SPI(robo)\
+ robo_detach_spi(robo)
+#define ROBO_SPI_RREG(_robo, _dev, _page, _reg, _buf, _len) \
+ robo_spi_rreg(_robo, _dev, _page, _reg, _buf, _len)
+#define ROBO_SPI_WREG(_robo, _dev, _page, _reg, _buf, _len) \
+ robo_spi_wreg(_robo, _dev, _page, _reg, _buf, _len)
+#endif
+#define ROBO_ATTACH(_sih, _ss)\
+ robo_attach(_sih)
+#define MAX_BUSTYPE 1
+#define ROBO_SWITCH_BUS(_robo, _bustype)
+#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl)
+#else /* KEYSTONE */
+#define ROBO_ATTACH(_sih, _ss)\
+ robo_attach(_sih, _ss)
+/* bustype 2: ROBO_MDCMDIO_BUS, 1: ROBO_SPI_BUS */
+#define MAX_BUSTYPE 2
+#define ROBO_SWITCH_BUS(_robo, _bustype)\
+ robo_switch_bus(_robo, _bustype)
- if (dseg->blk_cnt + blks > dseg->blk_cnt_max) {
- gprintk("No more DMA blocks\n");
- return -1;
- }
- start = dseg->blk_cnt;
- dseg->blk_cnt += blks;
- for (i = start; i < dseg->blk_cnt; i++) {
- /*
- * Note that we cannot use pci_alloc_consistent when we
- * want to be able to map DMA memory to user space.
- *
- * The GFP_DMA flag is omitted as this imposes the ISA
- * addressing limitations on x86 platforms. As long as
- * we have less than 1GB of memory, we can do PCI DMA
- * to all physical RAM locations.
- */
- addr = __get_free_pages(mem_flags, dseg->blk_order);
- if (addr) {
- dseg->blk_ptr[i] = addr;
- } else {
- gprintk("DMA allocation failed\n");
- return -1;
- }
- }
- return 0;
-}
+#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl) \
+ robo_select_device(_robo, _phyidh, _phyidl)
+#endif
-/*
- * Function: _dma_segment_alloc
- *
- * Purpose:
- * Allocate large physically contiguous DMA segment.
- * Parameters:
- * size - requested DMA segment size
- * blk_size - assemble segment from blocks of this size
- * Returns:
- * DMA segment descriptor.
- * Notes:
- * Since we cannot allocate large blocks of contiguous
- * memory from the kernel, we simply keep allocating
- * smaller chunks until we can assemble a contiguous
- * block of the desired size.
- *
- * When system allowed maximum bytes of memory has been allocated
- * without a successful assembly of a contiguous DMA
- * segment, the allocation function will return the
- * largest contiguous segment found so far. It is up
- * to the calling function to decide whether this
- * amount is sufficient to proceed.
- */
-static dma_segment_t *
-_dma_segment_alloc(size_t size, size_t blk_size)
-{
- dma_segment_t *dseg;
- int i, blk_ptr_size;
- unsigned long page_addr;
- struct sysinfo si;
+#else
- /* Sanity check */
- if (size == 0 || blk_size == 0) {
- return NULL;
- }
- /* Allocate an initialize DMA segment descriptor */
- if ((dseg = kmalloc(sizeof(dma_segment_t), GFP_KERNEL)) == NULL) {
- return NULL;
- }
- memset(dseg, 0, sizeof(dma_segment_t));
- dseg->req_size = size;
- dseg->blk_size = PAGE_ALIGN(blk_size);
- while ((PAGE_SIZE << dseg->blk_order) < dseg->blk_size) {
- dseg->blk_order++;
- }
+#define SOC_ATTACH(_sc) (NULL)
+#define ROBO_ATTACH(_sih, _ss) (NULL)
+#define MAX_BUSTYPE (0)
+#define ROBO_SWITCH_BUS(_robo, _bustype)
+#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl)
+#endif
- si_meminfo(&si);
- dseg->blk_cnt_max = (si.totalram << PAGE_SHIFT) / dseg->blk_size;
- blk_ptr_size = dseg->blk_cnt_max * sizeof(unsigned long);
- /* Allocate an initialize DMA block pool */
- dseg->blk_ptr = KMALLOC(blk_ptr_size, GFP_KERNEL);
- if (dseg->blk_ptr == NULL) {
- kfree(dseg);
- return NULL;
- }
- memset(dseg->blk_ptr, 0, blk_ptr_size);
- /* Allocate minimum number of blocks */
- _alloc_dma_blocks(dseg, dseg->req_size / dseg->blk_size);
- /* Allocate more blocks until we have a complete segment */
- do {
- _find_largest_segment(dseg);
- if (dseg->seg_size >= dseg->req_size) {
- break;
- }
- } while (_alloc_dma_blocks(dseg, 8) == 0);
- /* Reserve all pages in the DMA segment and free unused blocks */
- for (i = 0; i < dseg->blk_cnt; i++) {
- if ((dseg->blk_ptr[i] & 3) == 2) {
- dseg->blk_ptr[i] &= ~3;
- for (page_addr = dseg->blk_ptr[i];
- page_addr < dseg->blk_ptr[i] + dseg->blk_size;
- page_addr += PAGE_SIZE) {
- MEM_MAP_RESERVE(VIRT_TO_PAGE(page_addr));
- }
- } else if (dseg->blk_ptr[i]) {
- dseg->blk_ptr[i] &= ~3;
- free_pages(dseg->blk_ptr[i], dseg->blk_order);
- dseg->blk_ptr[i] = 0;
- }
- }
- return dseg;
-}
-/*
- * Function: _dma_segment_free
- *
- * Purpose:
- * Release resources used by DMA segment.
- * Parameters:
- * dseg - DMA segment descriptor
- * Returns:
- * Nothing.
- */
-static void
-_dma_segment_free(dma_segment_t *dseg)
+#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT)
+static int
+probe_robo_switch_iproc_spi(void)
{
- int i;
- unsigned long page_addr;
-
- if (dseg->blk_ptr) {
- for (i = 0; i < dseg->blk_cnt; i++) {
- if (dseg->blk_ptr[i]) {
- for (page_addr = dseg->blk_ptr[i];
- page_addr < dseg->blk_ptr[i] + dseg->blk_size;
- page_addr += PAGE_SIZE) {
- MEM_MAP_UNRESERVE(VIRT_TO_PAGE(page_addr));
- }
- free_pages(dseg->blk_ptr[i], dseg->blk_order);
- }
- }
- kfree(dseg->blk_ptr);
- kfree(dseg);
- }
-}
+ int dev;
+ int max_devices, max_bustype;
+ uint8 buf[8];
+ unsigned short phyidh = 0, phyidl = 0;
-/*
- * Function: _pgalloc
- *
- * Purpose:
- * Allocate DMA memory using page allocator
- * Parameters:
- * size - number of bytes to allocate
- * Returns:
- * Pointer to allocated DMA memory or NULL if failure.
- * Notes:
- * For any sizes less than DMA_BLOCK_SIZE, we ask the page
- * allocator for the entire memory block, otherwise we try
- * to assemble a contiguous segment ourselves.
- */
-static void *
-_pgalloc(size_t size)
-{
- dma_segment_t *dseg;
- size_t blk_size;
- blk_size = (size < DMA_BLOCK_SIZE) ? size : DMA_BLOCK_SIZE;
- if ((dseg = _dma_segment_alloc(size, blk_size)) == NULL) {
- return NULL;
+ /* Get Robo device handle */
+ if (robo == NULL) {
+ robo = (void *)ROBO_ATTACH_SPI(sbh, 0);
}
- if (dseg->seg_size < size) {
- /* If we didn't get the full size then forget it */
- _dma_segment_free(dseg);
- return NULL;
+ if (robo == NULL) {
+ return -ENODEV;
}
- list_add(&dseg->list, &_dma_seg);
- return (void *)dseg->seg_begin;
-}
-/*
- * Function: _pgfree
- *
- * Purpose:
- * Free memory allocated by _pgalloc
- * Parameters:
- * ptr - pointer returned by _pgalloc
- * Returns:
- * 0 if succesfully freed, otherwise -1.
- */
-static int
-_pgfree(void *ptr)
-{
- struct list_head *pos;
- list_for_each(pos, &_dma_seg) {
- dma_segment_t *dseg = list_entry(pos, dma_segment_t, list);
- if (ptr == (void *)dseg->seg_begin) {
- list_del(&dseg->list);
- _dma_segment_free(dseg);
- return 0;
- }
- }
- return -1;
-}
+ max_bustype = MAX_BUSTYPE + 1;
-/*
- * Function: _pgcleanup
- *
- * Purpose:
- * Free all memory allocated by _pgalloc
- * Parameters:
- * None
- * Returns:
- * Nothing.
- */
-static void
-_pgcleanup(void)
-{
- switch (dmaalloc) {
-#if _SIMPLE_MEMORY_ALLOCATION_
- case ALLOC_TYPE_API:
- if (_dma_vbase) {
- if (debug >= 1) gprintk("freeing v=%p p=0x%lx size=0x%lx\n", _dma_vbase,(unsigned long) _dma_pbase, (unsigned long)_dma_mem_size);
- dma_free_coherent(0, _dma_mem_size, _dma_vbase, _dma_pbase);
- }
- break;
-#endif /* _SIMPLE_MEMORY_ALLOCATION_ */
-
- case ALLOC_TYPE_CHUNK: {
- struct list_head *pos, *tmp;
- list_for_each_safe(pos, tmp, &_dma_seg) {
- dma_segment_t *dseg = list_entry(pos, dma_segment_t, list);
- list_del(&dseg->list);
- _dma_segment_free(dseg);
+ while(_spi_device_valid_check(phyidh, 0, 0)) {
+ max_bustype --;
+ if(!max_bustype)
+ return -ENODEV;
+ buf[0] = buf[1] = 0;
+ ROBO_SPI_RREG(robo, 0, 0x10, 0x04, buf, (uint)2);
+ phyidh = buf[0] | (buf[1] << 8);
+ /* re-try */
+ if ((phyidh == 0x0) || (phyidh == 0xffff)) {
+ ROBO_SPI_RREG(robo, 0, 0x10, 0x04, buf, (uint)2);
+ phyidh = buf[0] | (buf[1] << 8);
}
- break;
- }
-
- default:
- gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc);
}
-}
-/*
- * Function: _alloc_mpool
- *
- * Purpose:
- * Allocate DMA memory pool
- * Parameters:
- * size - size of DMA memory pool
- * Returns:
- * Nothing.
- * Notes:
- * If set up to use high memory, we simply map the memory into
- * kernel space.
- * It is assumed there is only one pool.
- */
-static void
-_alloc_mpool(size_t size)
-{
- unsigned long pbase = 0;
+ /* For psedo_phy access, only support one robo switch*/
+ /* For Northstar, only one switch on SRAB interface */
+ max_devices = (max_bustype == MAX_BUSTYPE) ? 1 : LINUX_BDE_MAX_SWITCH_DEVICES;
-#if defined(__arm__) && !defined(CONFIG_HIGHMEM)
- if (_use_himem) {
- gprintk("DMA in high memory requires CONFIG_HIGHMEM on ARM CPUs.\n");
- return;
- }
-#endif
+ for (dev = 0; dev < max_devices; dev++) {
+ bde_ctrl_t *ctrl;
+ int match_idx, i;
+ unsigned short phyidl_nr; /* phyidl with revision stripped */
+ uint16 model_id;
+ uint8 rev_id;
+ uint32 addr, len;
+ uint32 mlen;
- if (_use_himem) {
- /* Use high memory for DMA */
- pbase = virt_to_bus(high_memory);
- if (((pbase + size) >> 16) > DMA_BIT_MASK(16)) {
- gprintk("DMA in high memory at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size);
- return;
+ if (_switch_ndevices >= LINUX_BDE_MAX_SWITCH_DEVICES) {
+ break;
}
- _dma_pbase = pbase;
- _dma_vbase = IOREMAP(_dma_pbase, size);
- } else {
- /* Get DMA memory from kernel */
- switch (dmaalloc) {
-#if _SIMPLE_MEMORY_ALLOCATION_
- case ALLOC_TYPE_API: {
- size_t alloc_size = size; /* size of memory allocated in current iteration */
- if (alloc_size > DMA_MAX_ALLOC_SIZE) {
- alloc_size = DMA_MAX_ALLOC_SIZE;
- }
- /* get a memory allocation from the kernel */
- {
- dma_addr_t dma_handle;
- if (!(_dma_vbase = dma_alloc_coherent(0, alloc_size, &dma_handle, GFP_KERNEL)) || !dma_handle) {
- gprintk("_alloc_mpool: Kernel failed to allocate the memory pool of size 0x%lx\n", (unsigned long)alloc_size);
- return;
- }
- pbase = dma_handle;
- }
+ buf[0] = buf[1] = 0;
+ ROBO_SPI_RREG(robo, dev, 0x10, 0x04, buf, (uint)2);
+ phyidh = buf[0] | (buf[1] << 8);
- if (alloc_size != size) {
- gprintk("_alloc_mpool: allocated 0x%lx bytes instead of 0x%lx bytes.\n", (unsigned long)alloc_size, (unsigned long)size);
- }
- size = _dma_mem_size = alloc_size;
- break;
- }
-#endif /* _SIMPLE_MEMORY_ALLOCATION_ */
+ buf[0] = buf[1] = 0;
+ ROBO_SPI_RREG(robo, dev, 0x10, 0x06, buf, (uint)2);
+ phyidl = buf[0] | (buf[1] << 8);
- case ALLOC_TYPE_CHUNK:
- _dma_vbase = _pgalloc(size);
- pbase = virt_to_bus(_dma_vbase);
+ /* Strip revision */
+ phyidl_nr = phyidl & 0xfff0;
+
+ match_idx = _spi_device_valid_check(phyidh, phyidl_nr, 1);
+ if (match_idx == -1) {
+ if (debug >= 1) gprintk("found %d robo device(s).\n", robo_switch);
break;
- default:
- _dma_vbase = NULL;
- pbase = 0;
- gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc);
}
- if (debug >= 1) gprintk("_alloc_mpool: _dma_vbase:%p pbase:%lx allocated:%lx dmaalloc:%d\n", _dma_vbase, pbase, (unsigned long)size, dmaalloc);
- if (((pbase + size) >> 16) > DMA_BIT_MASK(16)) {
- _dma_vbase = NULL;
- gprintk("DMA memory allocated at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size);
- _pgcleanup();
- return;
+ model_id = phyidl_nr;
+
+ if(_spi_id_table[match_idx].rev_info){
+ addr = _spi_id_table[match_idx].rev_info & 0xffff;
+ len = (_spi_id_table[match_idx].rev_info >> 16) & 0xf;
+ ROBO_SPI_RREG(robo, dev, (addr >> 8), (addr & 0xff), buf, (uint)len);
+ mlen = (_spi_id_table[match_idx].rev_info >> 20) & 0xf;
+ rev_id = 0;
+ for (i = 0; i < mlen; i++)
+ rev_id |= buf[i] << (i << 3);
+ } else {
+ rev_id = phyidl & 0xf;
}
- _dma_pbase = pbase;
-#ifdef REMAP_DMA_NONCACHED
- _dma_vbase = IOREMAP(_dma_pbase, size);
-#endif
- }
-}
-#ifdef BCM_ROBO_SUPPORT
-static int
-_spi_device_valid_check(unsigned short phyidh,unsigned short phyidl, uint8 check_flag)
-{
- struct bde_spi_device_id *_ids;
- int idx, match_idx;
+ gprintk("found robo device with %d:%04x:%04x:%04x:%02x\n",
+ dev, phyidh, phyidl, model_id, rev_id);
- match_idx = -1;
- idx = 0;
+ ROBO_SELECT_DEVICE(robo, phyidh, phyidl);
- if (check_flag == 0){
- /* check_flag == 0 check phyidh only*/
- for (_ids = _spi_id_table;
- _ids->phyid_high && _ids->phyid_low; _ids++){
- if (_ids->phyid_high == phyidh) {
- return 0;
- }
- }
- /* No valid SPI devices found */
- return 1;
- } else {
- while(_spi_id_table[idx].phyid_high){
- if (phyidh == _spi_id_table[idx].phyid_high &&
- phyidl == _spi_id_table[idx].phyid_low) {
- /* Found a match */
- match_idx = idx;
- break;
- }
- idx++;
- }
- return match_idx;
- }
-}
+ /* Match supported chips */
+ ctrl = _devices + _ndevices++;
+ _switch_ndevices++;
-#if defined(IPROC_CMICD) || defined(KEYSTONE)
-#define ROBO_ATTACH_AVAIL
-#endif
+ if (NULL == (ctrl->spi_device = (struct spi_dev *)
+ KMALLOC(sizeof(struct spi_dev), GFP_KERNEL))) {
+ gprintk("no memory available");
+ return -ENOMEM;
+ }
+ ctrl->dev_type = (BDE_SPI_DEV_TYPE | BDE_SWITCH_DEV_TYPE);
+ ctrl->spi_device->cid = dev;
+ ctrl->spi_device->part = model_id;
+ ctrl->spi_device->rev = rev_id;
+ ctrl->spi_device->robo = robo;
+ ctrl->spi_device->phyid_high = phyidh;
+ ctrl->spi_device->phyid_low = phyidl;
+ ctrl->bde_dev.device = model_id;
+ ctrl->bde_dev.rev = rev_id;
+ ctrl->bde_dev.base_address = (sal_vaddr_t)NULL;
+ ctrl->isr = NULL;
+ ctrl->isr_data = NULL;
+ robo_switch++;
-#ifdef ROBO_ATTACH_AVAIL
+ }
-#define SOC_ATTACH(_sc)\
- ai_soc_kattach(_sc)
-
-#if defined(IPROC_CMICD)
-#define ROBO_ATTACH(_sih, _ss)\
- robo_attach(_sih)
-#define MAX_BUSTYPE 1
-#define ROBO_SWITCH_BUS(_robo, _bustype)
-#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl)
-#else /* KEYSTONE */
-#define ROBO_ATTACH(_sih, _ss)\
- robo_attach(_sih, _ss)
-/* bustype 2: ROBO_MDCMDIO_BUS, 1: ROBO_SPI_BUS */
-#define MAX_BUSTYPE 2
-#define ROBO_SWITCH_BUS(_robo, _bustype)\
- robo_switch_bus(_robo, _bustype)
+ return robo_switch;
-#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl) \
- robo_select_device(_robo, _phyidh, _phyidl)
-#endif
+}
-#else
+int spi_device_found = 0;
-#define SOC_ATTACH(_sc) (NULL)
-#define ROBO_ATTACH(_sih, _ss) (NULL)
-#define MAX_BUSTYPE (0)
-#define ROBO_SWITCH_BUS(_robo, _bustype)
-#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl)
-#endif
+#endif /* IPROC_CMICD || SF3 */
static int
@@ -3090,6 +3003,23 @@ probe_robo_switch(void)
if (sbh == NULL) {
return -ENODEV;
}
+ }
+
+#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT)
+ robo_switch = probe_robo_switch_iproc_spi();
+
+ if (robo_switch > 0) {
+ /* Robo switch found by SPI probe */
+ spi_device_found = 1;
+ gprintk("SPI device found, Skipping SRAB probe\n");
+ return robo_switch;
+ } else {
+ gprintk("SPI device NOT found, Probe SRAB probe\n");
+ ROBO_DETACH_SPI(robo);
+ }
+#endif
+
+ if (robo == NULL) {
robo = (void *)ROBO_ATTACH(sbh, 0);
}
if (robo == NULL) {
@@ -3211,7 +3141,6 @@ probe_robo_switch(void)
} else {
rev_id = phyidl & 0xf;
}
-
gprintk("found robo device with %d:%04x:%04x:%04x:%02x\n",
dev, phyidh, phyidl, model_id, rev_id);
@@ -3553,6 +3482,7 @@ static struct gmac_device_info _gmac_table[] = {
{BCM53018_CHIP_ID, 0, 2, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53017 */
{BCM53018_CHIP_ID, 0, 1, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53019 */
{BCM53020_CHIP_ID, 0, 0, BCM53010_GMAC_ID, 0x18024000, 181}, /* BCM53022 */
+ {BCM53020_CHIP_ID, 4, 0, BCM53010_GMAC_ID, 0x18023000, 180}, /* BCM53022 */
#endif
{0,0,0,0,0,0}
};
@@ -3655,7 +3585,13 @@ _init(void)
if (iproc_has_cmicd()) {
iproc_cmicd_get_memregion(&iproc_cmicd_resources[IPROC_CMICD_RES_MEM]);
iproc_platform_driver_register(&iproc_cmicd_driver);
- iproc_platform_device_register(&iproc_cmicd_pdev);
+#ifdef CONFIG_OF
+ if (!of_find_compatible_node(NULL, NULL, IPROC_CMICD_COMPATIBLE))
+#endif
+ {
+ /* Register platform device if no device node in dtb */
+ iproc_platform_device_register(&iproc_cmicd_pdev);
+ }
}
#endif /* IPROC_CMICD */
@@ -3675,25 +3611,32 @@ _init(void)
/* Configure MSI interrupt support */
use_msi = usemsi;
-#if defined(CONFIG_PCI_MSI)
- if (use_msi < 0) {
+
+#ifdef CONFIG_PCI_MSI
+ if (use_msi == PCI_USE_INT_NONE) {
/* Compilation flag determines default value */
-#if defined(BDE_LINUX_USE_MSI_INTERRUPT)
- use_msi = 1;
+#ifdef BDE_LINUX_USE_MSIX_INTERRUPT
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ use_msi = PCI_USE_INT_MSIX;
+#else
+ use_msi = PCI_USE_INT_MSI;
+#endif
+#elif defined(BDE_LINUX_USE_MSI_INTERRUPT)
+ use_msi = PCI_USE_INT_MSI;
#else
- use_msi = 0;
+ use_msi = PCI_USE_INT_INTX;
#endif
}
-#else /* !defined(CONFIG_PCI_MSI) */
- if (use_msi != 0) {
- if (use_msi > 0) {
- /* Warn if invalid configuration */
- gprintk("MSI interrupts not supported by kernel\n");
- }
- use_msi = 0;
+#else
+ if (use_msi > PCI_USE_INT_INTX) {
+ /* Warn if invalid configuration */
+ gprintk("MSI interrupts not supported by kernel\n");
}
-#endif /* defined(CONFIG_PCI_MSI) */
+ use_msi = PCI_USE_INT_INTX;
+#endif /* CONFIG_PCI_MSI */
+ if (unlikely(debug >= 1))
+ gprintk("%s(%d):use_mse = %d\n", __func__, __LINE__, use_msi);
if (spi_devid) {
_spi_device_setup();
} else {
@@ -3721,8 +3664,8 @@ _init(void)
probe_robo_switch();
#endif
-#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT)
- petra_device_create();
+#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)
+ sand_device_create();
#endif
#if defined(BCM_TK371X_SUPPORT)
@@ -3745,43 +3688,8 @@ _init(void)
tok = strtok(NULL,",");
}
}
-
- /* DMA Setup */
- if (dmasize) {
- if ((dmasize[strlen(dmasize)-1] & ~0x20) == 'M') {
- _dma_mem_size = simple_strtoul(dmasize, NULL, 0);
- _dma_mem_size *= ONE_MB;
- } else {
- gprintk("DMA memory size must be specified as e.g. dmasize=8M\n");
- }
- if (_dma_mem_size & (_dma_mem_size-1)) {
- gprintk("dmasize must be a power of 2 (1M, 2M, 4M, 8M etc.)\n");
- _dma_mem_size = 0;
- }
- } else {
- if(robo_switch){
- _dma_mem_size = DMA_MEM_DEFAULT_ROBO;
- }
- }
-
- if (himem) {
- if ((himem[0] & ~0x20) == 'Y' || himem[0] == '1') {
- _use_himem = 1;
- } else if ((himem[0] & ~0x20) == 'N' || himem[0] == '0') {
- _use_himem = 0;
- }
- }
- if (_dma_mem_size) {
- _alloc_mpool(_dma_mem_size);
- if (_dma_vbase == NULL) {
- gprintk("no DMA memory available\n");
- }
- else {
- mpool_init();
- _dma_pool = mpool_create(_dma_vbase, _dma_mem_size);
- }
- }
+ _dma_init(robo_switch);
/*
* In order to be backward compatible with the user mode BDE
@@ -3834,24 +3742,16 @@ _cleanup(void)
{
int i;
- if (_dma_vbase) {
- mpool_destroy(_dma_pool);
- if (_use_himem) {
- iounmap(_dma_vbase);
- } else {
-#ifdef REMAP_DMA_NONCACHED
- iounmap(_dma_vbase);
-#endif
- _pgcleanup();
- }
- _dma_vbase = NULL;
- _dma_pbase = 0;
-
- }
+ _dma_cleanup();
#ifdef IPROC_CMICD
if (iproc_has_cmicd()) {
- iproc_platform_device_unregister(&iproc_cmicd_pdev);
+#ifdef CONFIG_OF
+ if (!of_find_compatible_node(NULL, NULL, IPROC_CMICD_COMPATIBLE))
+#endif
+ {
+ iproc_platform_device_unregister(&iproc_cmicd_pdev);
+ }
iproc_platform_driver_unregister(&iproc_cmicd_driver);
}
#endif
@@ -3884,6 +3784,13 @@ _cleanup(void)
}
}
}
+#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)) && (defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__))
+ if (cpu_address) { /* unmap CPU card MMIO */
+ iounmap(cpu_address);
+ cpu_address = NULL;
+ }
+#endif
+
#ifdef BCM_ICS
#else
pci_unregister_driver(&_device_driver);
@@ -3907,12 +3814,8 @@ _pprint(void)
int i = 0;
pprintf("Broadcom Device Enumerator (%s)\n", LINUX_KERNEL_BDE_NAME);
- pprintf("DMA Memory (%s): %d bytes, %d used, %d free%s\n",
- (_use_himem) ? "high" : "kernel",
- (_dma_vbase) ? _dma_mem_size : 0,
- (_dma_vbase) ? mpool_usage(_dma_pool) : 0,
- (_dma_vbase) ? _dma_mem_size - mpool_usage(_dma_pool) : 0,
- USE_LINUX_BDE_MMAP ? ", local mmap" : "");
+
+ _dma_pprint();
if (_ndevices == 0) {
pprintf("No devices found\n");
@@ -3992,12 +3895,8 @@ static int _mmap(struct file *filp, struct vm_area_struct *vma)
{
unsigned long phys_addr = vma->vm_pgoff << PAGE_SHIFT;
unsigned long size = vma->vm_end - vma->vm_start;
- unsigned long pool_start = _dma_pbase;
- unsigned long pool_end = pool_start + _dma_mem_size;
- if (phys_addr < pool_start || (phys_addr + size) > pool_end) {
- gprintk("mmap range 0x%lx-0x%lx outside DMA pool 0x%lx-0x%lx\n",
- phys_addr, phys_addr + size, pool_start, pool_end);
+ if(!_dma_range_valid(phys_addr, size)) {
return -EINVAL;
}
@@ -4169,7 +4068,7 @@ _read(int d, uint32_t addr)
{
unsigned long flags;
volatile uint16 msb, lsb;
- uint32 sl_addr;
+ uint32 sl_addr, data;
if (!VALID_DEVICE(d)) {
return -1;
@@ -4193,7 +4092,11 @@ _read(int d, uint32_t addr)
return (msb << 16) | lsb;
} else {
- return ((VOL uint32_t *)_devices[d].bde_dev.base_address)[addr / 4];
+ data = ((VOL uint32_t *)_devices[d].bde_dev.base_address)[addr / 4];
+#if defined(CMIC_SOFT_BYTE_SWAP)
+ data = CMIC_SWAP32(data);
+#endif
+ return data;
}
}
@@ -4226,6 +4129,9 @@ _write(int d, uint32_t addr, uint32_t data)
(data >> 16) & 0xffff;
spin_unlock_irqrestore(&bus_lock, flags);
} else {
+#if defined(CMIC_SOFT_BYTE_SWAP)
+ data = CMIC_SWAP32(data);
+#endif
((VOL uint32_t *)_devices[d].bde_dev.base_address)[addr / 4] = data;
#ifdef KEYSTONE
/* Enforce PCIe transaction ordering. Commit the write transaction */
@@ -4236,66 +4142,6 @@ _write(int d, uint32_t addr, uint32_t data)
}
-static uint32_t *
-_salloc(int d, int size, const char *name)
-{
- void *ptr;
-
- if (_dma_mem_size) {
- return mpool_alloc(_dma_pool, size);
- }
- if ((ptr = kmalloc(size, mem_flags)) == NULL) {
- ptr = _pgalloc(size);
- }
- return ptr;
-}
-
-static void
-_sfree(int d, void *ptr)
-{
- if (_dma_mem_size) {
- return mpool_free(_dma_pool, ptr);
- }
- if (_pgfree(ptr) < 0) {
- kfree(ptr);
- }
-}
-
-static int
-_sinval(int d, void *ptr, int length)
-{
-#if defined(dma_cache_wback_inv)
- dma_cache_wback_inv((unsigned long)ptr, length);
-#else
-#if defined(IPROC_CMICD) || defined(BCM958525)
- /* FIXME: need proper function to replace dma_cache_sync */
- dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL);
-#else
- dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL);
-#endif
-#endif
- return 0;
-}
-
-static int
-_sflush(int d, void *ptr, int length)
-{
-#if defined(dma_cache_wback_inv)
- dma_cache_wback_inv((unsigned long)ptr, length);
-#else
-#if defined(IPROC_CMICD) || defined(BCM958525)
- /* FIXME: need proper function to replace dma_cache_sync */
- dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL);
-#else
- dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL);
-#endif
-#endif
-
- return 0;
-
-
-}
-
static _ISR_RET
_isr(_ISR_PARAMS(irq, dev_id, iregs))
{
@@ -4319,6 +4165,7 @@ _interrupt_connect(int d,
unsigned long irq_flags;
int isr2_dev;
int isr_active;
+ int ret = 0;
isr2_dev = d & LKBDE_ISR2_DEV;
d &= ~LKBDE_ISR2_DEV;
@@ -4340,6 +4187,9 @@ _interrupt_connect(int d,
isr_active = (ctrl->isr || ctrl->isr2) ? 1 : 0;
+ if (unlikely(debug > 1))
+ gprintk("%s:isr_active = %d\n", __func__, isr_active);
+
if (isr2_dev) {
if (debug >= 1) {
gprintk("connect secondary isr\n");
@@ -4364,34 +4214,59 @@ _interrupt_connect(int d,
if (ctrl->iLine != -1) {
irq_flags = IRQF_SHARED;
-#if defined(CONFIG_PCI_MSI)
- if (ctrl->use_msi && pci_enable_msi(ctrl->pci_device) == 0) {
- irq_flags = 0;
- ctrl->iLine = ctrl->pci_device->irq;
+#ifdef CONFIG_PCI_MSI
+ if (ctrl->use_msi >= PCI_USE_INT_MSI) {
+ ret = _msi_connect(ctrl);
+ if(ret != 0)
+ goto msi_exit;
}
#endif
- if (request_irq(ctrl->iLine,
- _isr,
- irq_flags,
- LINUX_KERNEL_BDE_NAME,
- ctrl) < 0) {
- gprintk("could not request irq %d for device %d\n",
- ctrl->pci_device->irq, d);
-
- ctrl->isr = NULL;
- ctrl->isr_data = NULL;
- ctrl->isr2 = NULL;
- ctrl->isr2_data = NULL;
-#if defined(CONFIG_PCI_MSI)
- if (ctrl->use_msi && irq_flags == 0) {
- pci_disable_msi(ctrl->pci_device);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ if (ctrl->use_msi == PCI_USE_INT_MSIX) {
+ int i;
+ for (i = 0; i < ctrl->msix_cnt; i++) {
+ ret = request_irq(ctrl->entries[i].vector, _isr,
+ irq_flags, LINUX_KERNEL_BDE_NAME, ctrl);
+ if (ret < 0)
+ break;
}
+ if (ret < 0) {
+ while (i >= 0)
+ free_irq(ctrl->entries[i--].vector, ctrl->pci_device);
+
+ goto err_disable_msi;
+ }
+ }
+ else
#endif
- return -1;
+ {
+ ret = request_irq(ctrl->iLine, _isr, irq_flags,
+ LINUX_KERNEL_BDE_NAME, ctrl);
+ if (ret < 0)
+ goto err_disable_msi;
+
+ if (unlikely(debug >= 1))
+ gprintk("%s(%d):device# = %d, \
+ irq_flags = %lu, irq = %d\n",
+ __func__, __LINE__, d,
+ irq_flags, ctrl->pci_device ? ctrl->pci_device->irq : ctrl->iLine);
}
}
-
return 0;
+
+err_disable_msi:
+#ifdef CONFIG_PCI_MSI
+ _msi_disconnect(ctrl);
+
+msi_exit:
+#endif
+ gprintk("could not request IRQ\n");
+ ctrl->isr = NULL;
+ ctrl->isr_data = NULL;
+ ctrl->isr2 = NULL;
+ ctrl->isr2_data = NULL;
+
+ return -1;
}
static int
@@ -4421,6 +4296,9 @@ _interrupt_disconnect(int d)
isr_active = (ctrl->isr || ctrl->isr2) ? 1 : 0;
+ if (unlikely(debug > 1))
+ gprintk("%s: isr_active = %d\n", __func__, isr_active);
+
if (isr2_dev) {
if (debug >= 1) {
gprintk("disconnect secondary isr\n");
@@ -4447,38 +4325,25 @@ _interrupt_disconnect(int d)
}
if (isr_active) {
- free_irq(ctrl->iLine, ctrl);
-#if defined(CONFIG_PCI_MSI)
- if (ctrl->use_msi) {
- pci_disable_msi(ctrl->pci_device);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84))
+ if (ctrl->use_msi >= PCI_USE_INT_MSIX) {
+ int i;
+ for (i = 0; i < ctrl->msix_cnt; i++)
+ free_irq(ctrl->entries[i].vector, ctrl->pci_device);
}
+ else
#endif
- }
-
- return 0;
-}
-
-static sal_paddr_t
-_l2p(int d, void *vaddr)
-{
- if (_dma_mem_size) {
- /* dma memory is a contiguous block */
- if (vaddr) {
- return _dma_pbase + (PTR_TO_UINTPTR(vaddr) - PTR_TO_UINTPTR(_dma_vbase));
+ {
+ free_irq(ctrl->iLine, ctrl);
}
- return 0;
+#ifdef CONFIG_PCI_MSI
+ if (ctrl->use_msi >= PCI_USE_INT_MSI) {
+ _msi_disconnect(ctrl);
+ }
+#endif
}
- return virt_to_bus(vaddr);
-}
-static uint32_t *
-_p2l(int d, sal_paddr_t paddr)
-{
- if (_dma_mem_size) {
- /* dma memory is a contiguous block */
- return paddr ? (void *)_dma_vbase + (paddr - _dma_pbase) : NULL;
- }
- return bus_to_virt(paddr);
+ return 0;
}
static uint32_t
@@ -4550,6 +4415,66 @@ _iproc_write(int d, uint32_t addr, uint32_t data)
return 0;
}
+static int
+_get_cmic_ver(int d , uint32_t *ver)
+{
+
+ unsigned int cap_base;
+ uint32_t rval = 0;
+
+ if (!VALID_DEVICE(d)) {
+ gprintk("%s: Invalid device index %d\n", __func__, d);
+ return -1;
+ }
+
+ if (!(_devices[d].dev_type & BDE_PCI_DEV_TYPE)) {
+ gprintk("%s: Not PCI device %d, type %x\n", __func__,
+ d, _devices[d].dev_type);
+ return -1;
+ }
+
+ /* Look for PCIe vendor-specific extended capability (VSEC) */
+ cap_base = PCI_EXT_CAP_START;
+ while (cap_base) {
+ pci_read_config_dword(_devices[d].pci_device, cap_base, &rval);
+ if (rval == 0xffffffff) {
+ /* Assume PCI HW read error */
+ gprintk("%s: PCI HW read error\n", __func__);
+ return -1;
+ }
+
+ if (PCI_EXT_CAP_ID(rval) == PCI_EXT_CAP_ID_VNDR) {
+ break;
+ }
+ cap_base = PCI_EXT_CAP_NEXT(rval);
+ }
+ if (cap_base) {
+ /*
+ * VSEC layout:
+ *
+ * 0x00: PCI Express Extended Capability Header
+ * 0x04: Vendor-Specific Header
+ * 0x08: Vendor-Specific Register 1
+ * 0x0c: Vendor-Specific Register 2
+ * ...
+ * 0x24: Vendor-Specific Register 8
+ */
+ pci_read_config_dword(_devices[d].pci_device, cap_base + 8, &rval);
+ if (unlikely(debug > 1))
+ gprintk("%s:Found VSEC = %u\n", __func__, rval);
+
+ /* Determine if CMICX */
+ rval = ((rval >> 12) & 0xf);
+ *ver = rval;
+
+ return 0;
+ } else {
+ gprintk("%s:VSEC not found\n", __func__);
+ }
+
+ return -1;
+}
+
#ifdef BCM_ROBO_SUPPORT
#define SOC_ROBO_PAGE_BP 8 /* for Robo Chip only */
@@ -4601,8 +4526,16 @@ _spi_read(int d, uint32 addr, uint8 *buf, int len)
offset = addr & 0xFF;
#endif
- ROBO_RREG(ctrl->spi_device->robo, ctrl->spi_device->cid,
- page, offset, buf, (uint)len);
+#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT)
+ if (spi_device_found) {
+ ROBO_SPI_RREG(ctrl->spi_device->robo, ctrl->spi_device->cid,
+ page, offset, buf, (uint)len);
+ } else
+#endif
+ {
+ ROBO_RREG(ctrl->spi_device->robo, ctrl->spi_device->cid,
+ page, offset, buf, (uint)len);
+ }
return 0;
}
@@ -4645,30 +4578,29 @@ _spi_write(int d, uint32 addr, uint8 *buf, int len)
offset = addr & 0xFF;
#endif
- ROBO_WREG(ctrl->spi_device->robo, ctrl->spi_device->cid,
- page, offset, buf, (uint)len);
+#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT)
+ if (spi_device_found) {
+ ROBO_SPI_WREG(ctrl->spi_device->robo, ctrl->spi_device->cid,
+ page, offset, buf, (uint)len);
+ } else
+#endif
+ {
+ ROBO_WREG(ctrl->spi_device->robo, ctrl->spi_device->cid,
+ page, offset, buf, (uint)len);
+ }
return 0;
}
#endif
-#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT))
+#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)
int
lkbde_cpu_write(int d, uint32 addr, uint32 *buf)
{
- bde_ctrl_t* ctrl;
- void *full_addr;
-
- if (!VALID_DEVICE(d)) {
- return -1;
- }
-
- ctrl = &_devices[d];
-
- full_addr = ctrl->cpu_address + addr;
-
- *((uint32_t*)full_addr) = *buf;
+#if defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__)
+ *((uint32_t*)((uint8_t*)cpu_address + addr)) = *buf;
+#endif
return 0;
}
@@ -4676,18 +4608,12 @@ lkbde_cpu_write(int d, uint32 addr, uint32 *buf)
int
lkbde_cpu_read(int d, uint32 addr, uint32 *buf)
{
- bde_ctrl_t* ctrl;
- void *full_addr;
-
- if (!VALID_DEVICE(d)) {
- return -1;
- }
-
- ctrl = &_devices[d];
-
- full_addr = ctrl->cpu_address + addr;
+#if defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__)
+ *buf = *((uint32_t*)((uint8_t*)cpu_address + addr));
+#else
+ *buf = (uint32_t)(-1);
+#endif
- *buf = *((uint32_t*)full_addr);
return 0;
}
@@ -4717,7 +4643,7 @@ lkbde_cpu_pci_register(int d)
}
switch (ctrl->bde_dev.device) {
- case PETRAB_DEVICE_ID:
+ case GEDI_DEVICE_ID:
/* Fix bar 0 address */ /* FIXME: write full phy address */
pci_write_config_byte(ctrl->pci_device, 0x13, 0x60);
@@ -4733,23 +4659,29 @@ lkbde_cpu_pci_register(int d)
case BCM88774_DEVICE_ID:
case BCM88775_DEVICE_ID:
case BCM88776_DEVICE_ID:
+ case BCM88777_DEVICE_ID:
case BCM88950_DEVICE_ID:
case BCM88953_DEVICE_ID:
case BCM88954_DEVICE_ID:
case BCM88955_DEVICE_ID:
case BCM88956_DEVICE_ID:
+ case BCM88752_DEVICE_ID:
+ case BCM88772_DEVICE_ID:
+ case BCM88952_DEVICE_ID:
case ACP_PCI_DEVICE_ID:
case BCM88650_DEVICE_ID:
case BCM88670_DEVICE_ID:
case BCM88671_DEVICE_ID:
case BCM88671M_DEVICE_ID:
+ case BCM88672_DEVICE_ID:
case BCM88673_DEVICE_ID:
case BCM88674_DEVICE_ID:
case BCM88675_DEVICE_ID:
case BCM88675M_DEVICE_ID:
case BCM88676_DEVICE_ID:
case BCM88676M_DEVICE_ID:
+ case BCM88677_DEVICE_ID:
case BCM88678_DEVICE_ID:
case BCM88679_DEVICE_ID:
@@ -4762,8 +4694,28 @@ lkbde_cpu_pci_register(int d)
case BCM88377_DEVICE_ID:
case BCM88378_DEVICE_ID:
case BCM88379_DEVICE_ID:
-
+ case BCM88681_DEVICE_ID:
+ case BCM88682_DEVICE_ID:
+ case BCM88683_DEVICE_ID:
+ case BCM88684_DEVICE_ID:
+ case BCM88685_DEVICE_ID:
+ case BCM88380_DEVICE_ID:
+ case BCM88381_DEVICE_ID:
+ case BCM88680_DEVICE_ID:
+ case BCM88690_DEVICE_ID:
case BCM88470_DEVICE_ID:
+ case BCM88470P_DEVICE_ID:
+ case BCM88471_DEVICE_ID:
+ case BCM88473_DEVICE_ID:
+ case BCM88474_DEVICE_ID:
+ case BCM88474H_DEVICE_ID:
+ case BCM88476_DEVICE_ID:
+ case BCM88477_DEVICE_ID:
+ case BCM88270_DEVICE_ID:
+ case BCM88272_DEVICE_ID:
+ case BCM88273_DEVICE_ID:
+ case BCM88278_DEVICE_ID:
+ case BCM8206_DEVICE_ID:
case BCM88350_DEVICE_ID:
case BCM88351_DEVICE_ID:
case BCM88450_DEVICE_ID:
@@ -4809,10 +4761,8 @@ lkbde_cpu_pci_register(int d)
gprintk("%s, %s(): info:\n", __FILE__, __FUNCTION__);
gprintk("_ndevices=%d, _switch_ndevices=%d\n",
_ndevices, _switch_ndevices);
- gprintk("ctrl->dev_type=0x%x, ctrl->phys_address=0x%lx, "
- "ctrl->cpu_address=%p\n",
- ctrl->dev_type, (unsigned long)ctrl->phys_address,
- ctrl->cpu_address);
+ gprintk("ctrl->dev_type=0x%x, ctrl->phys_address=0x%lx\n",
+ ctrl->dev_type, (unsigned long)ctrl->phys_address);
gprintk("ctrl->bde_dev.device=0x%x, ctrl->bde_dev.rev=0x%x, "
"ctrl->bde_dev.base_address=0x%lx\n",
ctrl->bde_dev.device, ctrl->bde_dev.rev,
@@ -4883,6 +4833,7 @@ static ibde_t _ibde = {
#endif /* defined(BCM_ROBO_SUPPORT) */
iproc_read: _iproc_read,
iproc_write: _iproc_write,
+ get_cmic_ver: _get_cmic_ver,
};
/*
@@ -4916,7 +4867,7 @@ linux_bde_create(linux_bde_bus_t *bus, ibde_t **ibde)
* If we have a non-cached DMA memory pool
* there is no need to flush and invalidate.
*/
- if (_dma_vbase != NULL) {
+ if (_dma_pool_allocated()) {
_ibde.sinval = NULL;
_ibde.sflush = NULL;
}
@@ -4946,35 +4897,6 @@ linux_bde_destroy(ibde_t *ibde)
return 0;
}
-/*
- * Backdoors provided by the kernel bde
- *
- */
-
-
-/*
- * Some of the driver malloc's are too large for
- * kmalloc(), so 'sal_alloc' and 'sal_free' in the
- * linux kernel sal cannot be implemented with kmalloc().
- *
- * Instead, they expect someone to provide an allocator
- * that can handle the gimongous size of some of the
- * allocations, and we provide it here, by allocating
- * this memory out of the boot-time dma pool.
- *
- * These are the functions in question:
- */
-
-void* kmalloc_giant(int sz)
-{
- return mpool_alloc(_dma_pool, sz);
-}
-
-void kfree_giant(void* ptr)
-{
- return mpool_free(_dma_pool, ptr);
-}
-
/*
* Backdoors provided by the kernel bde
*/
@@ -5071,20 +4993,6 @@ lkbde_get_dev_resource(int d, int rsrc, uint32_t *flags,
return 0;
}
-int
-lkbde_get_dma_info(uint32_t *pbase, uint32_t *size)
-{
- if (_dma_pbase == 0) {
- if (_dma_mem_size == 0) {
- _dma_mem_size = DMA_MEM_DEFAULT;
- }
- _alloc_mpool(_dma_mem_size);
- }
- *pbase = _dma_pbase;
- *size = _dma_mem_size;
- return 0;
-}
-
void *
lkbde_get_dma_dev(int d)
{
@@ -5246,12 +5154,9 @@ lkbde_irq_mask_get(int d, uint32_t *mask, uint32_t *fmask)
*/
LKM_EXPORT_SYM(linux_bde_create);
LKM_EXPORT_SYM(linux_bde_destroy);
-LKM_EXPORT_SYM(kmalloc_giant);
-LKM_EXPORT_SYM(kfree_giant);
LKM_EXPORT_SYM(lkbde_get_dev_phys);
LKM_EXPORT_SYM(lkbde_get_dev_virt);
LKM_EXPORT_SYM(lkbde_get_dev_resource);
-LKM_EXPORT_SYM(lkbde_get_dma_info);
LKM_EXPORT_SYM(lkbde_get_hw_dev);
LKM_EXPORT_SYM(lkbde_get_dma_dev);
LKM_EXPORT_SYM(lkbde_irq_mask_set);
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_dma.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_dma.c
new file mode 100644
index 000000000000..bd7eab6032e8
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_dma.c
@@ -0,0 +1,906 @@
+/*
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to
+ * you under the terms of the GNU General Public License version 2 (the
+ * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and to
+ * copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ */
+/*
+ * $Id: linux_dma.c,v 1.414 Broadcom SDK $
+ * $Copyright: (c) 2016 Broadcom Corp.
+ * All Rights Reserved.$
+ *
+ * Linux Kernel BDE DMA memory allocation
+ *
+ *
+ * DMA memory allocation modes
+ * ===========================
+ *
+ * 1. Using private pool in kernel memory
+ * --------------------------------------
+ * In this mode the BDE module will try to assemble a physically contiguous
+ * of memory using the kernel page allocator. This memory block is then
+ * administered by the mpool allocation functions. Note that once a system
+ * has been running for a while, the memory fragmentation may prevent the
+ * allocator from assembling a contiguous memory block, however, if the
+ * module is loaded shortly after system startup, it is very unlikely to
+ * fail.
+ *
+ * This allocation method is used by default.
+ *
+ * 2. Using private pool in high memory
+ * ------------------------------------
+ * In this mode the BDE module will assume that unused physical memory is
+ * present at the high_memory address, i.e. memory not managed by the Linux
+ * memory manager. This memory block is mapped into kernel space and
+ * administered by the mpool allocation functions. High memory must be
+ * reserved using either the mem=xxx kernel parameter (recommended), or by
+ * hardcoding the memory limit in the kernel image.
+ *
+ * The module parameter himem=1 enables this allocation mode.
+ *
+ * 3. Using kernel allocators (kmalloc, __get_free_pages)
+ * ------------------------------------------------------
+ * In this mode all DMA memory is allocated from the kernel on the fly, i.e.
+ * no private DMA memory pool will be created. If large memory blocks are
+ * only allocated at system startup (or not at all), this allocation method
+ * is the most flexible and memory-efficient, however, it is not recommended
+ * for non-coherent memory platforms due to an overall system performance
+ * degradation arising from the use of cache flush/invalidate instructions.
+ *
+ * The module parameter dmasize=0M enables this allocation mode, however if
+ * DMA memory is requested from a user mode application, a private memory
+ * pool will be created and used irrespectively.
+ */
+
+#include <gmodule.h>
+#include <linux-bde.h>
+#include <linux_dma.h>
+#include <mpool.h>
+#include <sdk_config.h>
+
+#ifdef BCM_PLX9656_LOCAL_BUS
+#include <asm/cacheflush.h>
+#endif
+
+/* allocation types/methods for the DMA memory pool */
+#define ALLOC_TYPE_CHUNK 0 /* use small allocations and join them */
+#define ALLOC_TYPE_API 1 /* use one allocation */
+#if _SIMPLE_MEMORY_ALLOCATION_
+#include <linux/dma-mapping.h>
+#if defined(IPROC_CMICD) && defined(CONFIG_CMA) && defined(CONFIG_CMA_SIZE_MBYTES)
+#define DMA_MAX_ALLOC_SIZE (CONFIG_CMA_SIZE_MBYTES * 1024 * 1024)
+#else
+#define DMA_MAX_ALLOC_SIZE (1 << (MAX_ORDER - 1 + PAGE_SHIFT)) /* Maximum size the kernel can allocate in one allocation */
+#endif
+#endif /* _SIMPLE_MEMORY_ALLOCATION_ */
+
+#if _SIMPLE_MEMORY_ALLOCATION_ == 1
+#define ALLOC_METHOD_DEFAULT ALLOC_TYPE_API
+#else
+#define ALLOC_METHOD_DEFAULT ALLOC_TYPE_CHUNK
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
+#include <linux/slab.h>
+#define virt_to_bus virt_to_phys
+#define bus_to_virt phys_to_virt
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21))
+#define VIRT_TO_PAGE(p) virt_to_page((void*)(p))
+#else
+#define VIRT_TO_PAGE(p) virt_to_page((p))
+#endif
+
+/* Compatibility */
+#ifdef LKM_2_4
+#define MEM_MAP_RESERVE mem_map_reserve
+#define MEM_MAP_UNRESERVE mem_map_unreserve
+#else /* LKM_2_6 */
+#define MEM_MAP_RESERVE SetPageReserved
+#define MEM_MAP_UNRESERVE ClearPageReserved
+#endif /* LKM_2_x */
+
+#ifndef GFP_DMA32
+#define GFP_DMA32 0
+#endif
+
+/* Flags for memory allocations */
+#ifdef SAL_BDE_XLP
+static int mem_flags = GFP_ATOMIC | GFP_KERNEL | GFP_DMA;
+#else
+#if defined(CONFIG_ZONE_DMA32)
+static int mem_flags = GFP_ATOMIC | GFP_DMA32;
+#else
+static int mem_flags = GFP_ATOMIC | GFP_DMA;
+#endif
+#endif
+
+/* Debug output */
+static int dma_debug = 0;
+module_param(dma_debug, int, 0);
+MODULE_PARM_DESC(dma_debug,
+"DMA debug output enable (default 0).");
+
+/* DMA memory pool size */
+static char *dmasize;
+LKM_MOD_PARAM(dmasize, "s", charp, 0);
+MODULE_PARM_DESC(dmasize,
+"Specify DMA memory size (default 4MB)");
+
+/* Select DMA memory pool allocation method */
+static int dmaalloc = ALLOC_METHOD_DEFAULT;
+LKM_MOD_PARAM(dmaalloc, "i", int, 0);
+MODULE_PARM_DESC(dmaalloc, "Select DMA memory allocation method");
+
+/* Use high memory for DMA */
+static char *himem;
+LKM_MOD_PARAM(himem, "s", charp, 0);
+MODULE_PARM_DESC(himem,
+"Use high memory for DMA (default no)");
+
+/* DMA memory allocation */
+
+#define ONE_KB 1024
+#define ONE_MB (1024*1024)
+
+/* Default DMA memory size */
+#ifdef SAL_BDE_DMA_MEM_DEFAULT
+#define DMA_MEM_DEFAULT (SAL_BDE_DMA_MEM_DEFAULT * ONE_MB)
+#else
+#define DMA_MEM_DEFAULT (8 * ONE_MB)
+#endif
+#define DMA_MEM_DEFAULT_ROBO (4 * ONE_MB)
+
+/* We try to assemble a contiguous segment from chunks of this size */
+#define DMA_BLOCK_SIZE (512 * ONE_KB)
+
+typedef struct _dma_segment {
+ struct list_head list;
+ unsigned long req_size; /* Requested DMA segment size */
+ unsigned long blk_size; /* DMA block size */
+ unsigned long blk_order; /* DMA block size in alternate format */
+ unsigned long seg_size; /* Current DMA segment size */
+ unsigned long seg_begin; /* Logical address of segment */
+ unsigned long seg_end; /* Logical end address of segment */
+ unsigned long *blk_ptr; /* Array of logical DMA block addresses */
+ int blk_cnt_max; /* Maximum number of block to allocate */
+ int blk_cnt; /* Current number of blocks allocated */
+} dma_segment_t;
+
+static unsigned int _dma_mem_size = DMA_MEM_DEFAULT;
+static mpool_handle_t _dma_pool = NULL;
+static void __iomem *_dma_vbase = NULL;
+/* cpu physical address for mmap */
+static phys_addr_t _cpu_pbase = 0;
+/*
+ * DMA bus address, it is either identical to cpu physical address
+ * or another address(IOVA) translated by IOMMU.
+ */
+static phys_addr_t _dma_pbase = 0;
+static int _use_himem = 0;
+static int _use_dma_mapping = 0;
+static LIST_HEAD(_dma_seg);
+
+#define DMA_DEV(n) lkbde_get_dma_dev(n)
+
+/*
+ * Function: _find_largest_segment
+ *
+ * Purpose:
+ * Find largest contiguous segment from a pool of DMA blocks.
+ * Parameters:
+ * dseg - DMA segment descriptor
+ * Returns:
+ * 0 on success, < 0 on error.
+ * Notes:
+ * Assembly stops if a segment of the requested segment size
+ * has been obtained.
+ *
+ * Lower address bits of the DMA blocks are used as follows:
+ * 0: Untagged
+ * 1: Discarded block
+ * 2: Part of largest contiguous segment
+ * 3: Part of current contiguous segment
+ */
+static int
+_find_largest_segment(dma_segment_t *dseg)
+{
+ int i, j, blks, found;
+ unsigned long b, e, a;
+
+ blks = dseg->blk_cnt;
+ /* Clear all block tags */
+ for (i = 0; i < blks; i++) {
+ dseg->blk_ptr[i] &= ~3;
+ }
+ for (i = 0; i < blks && dseg->seg_size < dseg->req_size; i++) {
+ /* First block must be an untagged block */
+ if ((dseg->blk_ptr[i] & 3) == 0) {
+ /* Initial segment size is the block size */
+ b = dseg->blk_ptr[i];
+ e = b + dseg->blk_size;
+ dseg->blk_ptr[i] |= 3;
+ /* Loop looking for adjacent blocks */
+ do {
+ found = 0;
+ for (j = i + 1; j < blks && (e - b) < dseg->req_size; j++) {
+ a = dseg->blk_ptr[j];
+ /* Check untagged blocks only */
+ if ((a & 3) == 0) {
+ if (a == (b - dseg->blk_size)) {
+ /* Found adjacent block below current segment */
+ dseg->blk_ptr[j] |= 3;
+ b = a;
+ found = 1;
+ } else if (a == e) {
+ /* Found adjacent block above current segment */
+ dseg->blk_ptr[j] |= 3;
+ e += dseg->blk_size;
+ found = 1;
+ }
+ }
+ }
+ } while (found);
+ if ((e - b) > dseg->seg_size) {
+ /* The current block is largest so far */
+ dseg->seg_begin = b;
+ dseg->seg_end = e;
+ dseg->seg_size = e - b;
+ /* Re-tag current and previous largest segment */
+ for (j = 0; j < blks; j++) {
+ if ((dseg->blk_ptr[j] & 3) == 3) {
+ /* Tag current segment as the largest */
+ dseg->blk_ptr[j] &= ~1;
+ } else if ((dseg->blk_ptr[j] & 3) == 2) {
+ /* Discard previous largest segment */
+ dseg->blk_ptr[j] ^= 3;
+ }
+ }
+ } else {
+ /* Discard all blocks in current segment */
+ for (j = 0; j < blks; j++) {
+ if ((dseg->blk_ptr[j] & 3) == 3) {
+ dseg->blk_ptr[j] &= ~2;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ * Function: _alloc_dma_blocks
+ *
+ * Purpose:
+ * Allocate DMA blocks and add them to the pool.
+ * Parameters:
+ * dseg - DMA segment descriptor
+ * blks - number of DMA blocks to allocate
+ * Returns:
+ * 0 on success, < 0 on error.
+ * Notes:
+ * DMA blocks are allocated using the page allocator.
+ */
+static int
+_alloc_dma_blocks(dma_segment_t *dseg, int blks)
+{
+ int i, start;
+ unsigned long addr;
+
+ if (dseg->blk_cnt + blks > dseg->blk_cnt_max) {
+ gprintk("No more DMA blocks\n");
+ return -1;
+ }
+ start = dseg->blk_cnt;
+ dseg->blk_cnt += blks;
+ for (i = start; i < dseg->blk_cnt; i++) {
+ /*
+ * Note that we cannot use pci_alloc_consistent when we
+ * want to be able to map DMA memory to user space.
+ *
+ * The GFP_DMA flag is omitted as this imposes the ISA
+ * addressing limitations on x86 platforms. As long as
+ * we have less than 1GB of memory, we can do PCI DMA
+ * to all physical RAM locations.
+ */
+ addr = __get_free_pages(mem_flags, dseg->blk_order);
+ if (addr) {
+ dseg->blk_ptr[i] = addr;
+ } else {
+ gprintk("DMA allocation failed\n");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/*
+ * Function: _dma_segment_alloc
+ *
+ * Purpose:
+ * Allocate large physically contiguous DMA segment.
+ * Parameters:
+ * size - requested DMA segment size
+ * blk_size - assemble segment from blocks of this size
+ * Returns:
+ * DMA segment descriptor.
+ * Notes:
+ * Since we cannot allocate large blocks of contiguous
+ * memory from the kernel, we simply keep allocating
+ * smaller chunks until we can assemble a contiguous
+ * block of the desired size.
+ *
+ * When system allowed maximum bytes of memory has been allocated
+ * without a successful assembly of a contiguous DMA
+ * segment, the allocation function will return the
+ * largest contiguous segment found so far. It is up
+ * to the calling function to decide whether this
+ * amount is sufficient to proceed.
+ */
+static dma_segment_t *
+_dma_segment_alloc(size_t size, size_t blk_size)
+{
+ dma_segment_t *dseg;
+ int i, blk_ptr_size;
+ unsigned long page_addr;
+ struct sysinfo si;
+
+ /* Sanity check */
+ if (size == 0 || blk_size == 0) {
+ return NULL;
+ }
+ /* Allocate an initialize DMA segment descriptor */
+ if ((dseg = kmalloc(sizeof(dma_segment_t), GFP_KERNEL)) == NULL) {
+ return NULL;
+ }
+ memset(dseg, 0, sizeof(dma_segment_t));
+ dseg->req_size = size;
+ dseg->blk_size = PAGE_ALIGN(blk_size);
+ while ((PAGE_SIZE << dseg->blk_order) < dseg->blk_size) {
+ dseg->blk_order++;
+ }
+
+ si_meminfo(&si);
+ dseg->blk_cnt_max = (si.totalram << PAGE_SHIFT) / dseg->blk_size;
+ blk_ptr_size = dseg->blk_cnt_max * sizeof(unsigned long);
+ /* Allocate an initialize DMA block pool */
+ dseg->blk_ptr = KMALLOC(blk_ptr_size, GFP_KERNEL);
+ if (dseg->blk_ptr == NULL) {
+ kfree(dseg);
+ return NULL;
+ }
+ memset(dseg->blk_ptr, 0, blk_ptr_size);
+ /* Allocate minimum number of blocks */
+ _alloc_dma_blocks(dseg, dseg->req_size / dseg->blk_size);
+ /* Allocate more blocks until we have a complete segment */
+ do {
+ _find_largest_segment(dseg);
+ if (dseg->seg_size >= dseg->req_size) {
+ break;
+ }
+ } while (_alloc_dma_blocks(dseg, 8) == 0);
+ /* Reserve all pages in the DMA segment and free unused blocks */
+ for (i = 0; i < dseg->blk_cnt; i++) {
+ if ((dseg->blk_ptr[i] & 3) == 2) {
+ dseg->blk_ptr[i] &= ~3;
+ for (page_addr = dseg->blk_ptr[i];
+ page_addr < dseg->blk_ptr[i] + dseg->blk_size;
+ page_addr += PAGE_SIZE) {
+ MEM_MAP_RESERVE(VIRT_TO_PAGE(page_addr));
+ }
+ } else if (dseg->blk_ptr[i]) {
+ dseg->blk_ptr[i] &= ~3;
+ free_pages(dseg->blk_ptr[i], dseg->blk_order);
+ dseg->blk_ptr[i] = 0;
+ }
+ }
+ return dseg;
+}
+
+/*
+ * Function: _dma_segment_free
+ *
+ * Purpose:
+ * Release resources used by DMA segment.
+ * Parameters:
+ * dseg - DMA segment descriptor
+ * Returns:
+ * Nothing.
+ */
+static void
+_dma_segment_free(dma_segment_t *dseg)
+{
+ int i;
+ unsigned long page_addr;
+
+ if (dseg->blk_ptr) {
+ for (i = 0; i < dseg->blk_cnt; i++) {
+ if (dseg->blk_ptr[i]) {
+ for (page_addr = dseg->blk_ptr[i];
+ page_addr < dseg->blk_ptr[i] + dseg->blk_size;
+ page_addr += PAGE_SIZE) {
+ MEM_MAP_UNRESERVE(VIRT_TO_PAGE(page_addr));
+ }
+ free_pages(dseg->blk_ptr[i], dseg->blk_order);
+ }
+ }
+ kfree(dseg->blk_ptr);
+ kfree(dseg);
+ }
+}
+
+/*
+ * Function: _pgalloc
+ *
+ * Purpose:
+ * Allocate DMA memory using page allocator
+ * Parameters:
+ * size - number of bytes to allocate
+ * Returns:
+ * Pointer to allocated DMA memory or NULL if failure.
+ * Notes:
+ * For any sizes less than DMA_BLOCK_SIZE, we ask the page
+ * allocator for the entire memory block, otherwise we try
+ * to assemble a contiguous segment ourselves.
+ */
+static void *
+_pgalloc(size_t size)
+{
+ dma_segment_t *dseg;
+ size_t blk_size;
+
+ blk_size = (size < DMA_BLOCK_SIZE) ? size : DMA_BLOCK_SIZE;
+ if ((dseg = _dma_segment_alloc(size, blk_size)) == NULL) {
+ return NULL;
+ }
+ if (dseg->seg_size < size) {
+ /* If we didn't get the full size then forget it */
+ _dma_segment_free(dseg);
+ return NULL;
+ }
+ list_add(&dseg->list, &_dma_seg);
+ return (void *)dseg->seg_begin;
+}
+
+/*
+ * Function: _pgfree
+ *
+ * Purpose:
+ * Free memory allocated by _pgalloc
+ * Parameters:
+ * ptr - pointer returned by _pgalloc
+ * Returns:
+ * 0 if succesfully freed, otherwise -1.
+ */
+static int
+_pgfree(void *ptr)
+{
+ struct list_head *pos;
+ list_for_each(pos, &_dma_seg) {
+ dma_segment_t *dseg = list_entry(pos, dma_segment_t, list);
+ if (ptr == (void *)dseg->seg_begin) {
+ list_del(&dseg->list);
+ _dma_segment_free(dseg);
+ return 0;
+ }
+ }
+ return -1;
+}
+
+/*
+ * Function: _pgcleanup
+ *
+ * Purpose:
+ * Free all memory allocated by _pgalloc
+ * Parameters:
+ * None
+ * Returns:
+ * Nothing.
+ */
+static void
+_pgcleanup(void)
+{
+ switch (dmaalloc) {
+#if _SIMPLE_MEMORY_ALLOCATION_
+ case ALLOC_TYPE_API:
+ if (_dma_vbase) {
+ if (dma_debug >= 1) gprintk("freeing v=%p p=0x%lx size=0x%lx\n", _dma_vbase,(unsigned long) _dma_pbase, (unsigned long)_dma_mem_size);
+ dma_free_coherent(DMA_DEV(0), _dma_mem_size, _dma_vbase, _dma_pbase);
+ }
+ break;
+#endif /* _SIMPLE_MEMORY_ALLOCATION_ */
+
+ case ALLOC_TYPE_CHUNK: {
+ struct list_head *pos, *tmp;
+ if (_use_dma_mapping) {
+ dma_unmap_single(DMA_DEV(0), (dma_addr_t)_dma_pbase, _dma_mem_size, DMA_BIDIRECTIONAL);
+ _use_dma_mapping = 0;
+ }
+ list_for_each_safe(pos, tmp, &_dma_seg) {
+ dma_segment_t *dseg = list_entry(pos, dma_segment_t, list);
+ list_del(&dseg->list);
+ _dma_segment_free(dseg);
+ }
+ break;
+ }
+
+ default:
+ gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc);
+ }
+}
+
+/*
+ * Function: _alloc_mpool
+ *
+ * Purpose:
+ * Allocate DMA memory pool
+ * Parameters:
+ * size - size of DMA memory pool
+ * Returns:
+ * Nothing.
+ * Notes:
+ * If set up to use high memory, we simply map the memory into
+ * kernel space.
+ * It is assumed there is only one pool.
+ */
+static void
+_alloc_mpool(size_t size)
+{
+ unsigned long pbase = 0;
+
+#if defined(__arm__) && !defined(CONFIG_HIGHMEM)
+ if (_use_himem) {
+ gprintk("DMA in high memory requires CONFIG_HIGHMEM on ARM CPUs.\n");
+ return;
+ }
+#endif
+
+ if (_use_himem) {
+ /* Use high memory for DMA */
+ pbase = virt_to_bus(high_memory);
+ if (((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) {
+ gprintk("DMA in high memory at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size);
+ return;
+ }
+ _cpu_pbase = _dma_pbase = pbase;
+ _dma_vbase = IOREMAP(_dma_pbase, size);
+ } else {
+ /* Get DMA memory from kernel */
+ switch (dmaalloc) {
+#if _SIMPLE_MEMORY_ALLOCATION_
+ case ALLOC_TYPE_API: {
+ size_t alloc_size = size; /* size of memory allocated in current iteration */
+ if (alloc_size > DMA_MAX_ALLOC_SIZE) {
+ alloc_size = DMA_MAX_ALLOC_SIZE;
+ }
+ /* get a memory allocation from the kernel */
+ {
+ dma_addr_t dma_handle;
+ if (!(_dma_vbase = dma_alloc_coherent(DMA_DEV(0), alloc_size, &dma_handle, GFP_KERNEL)) || !dma_handle) {
+ gprintk("_alloc_mpool: Kernel failed to allocate the memory pool of size 0x%lx\n", (unsigned long)alloc_size);
+ return;
+ }
+ pbase = dma_handle;
+ }
+
+ if (alloc_size != size) {
+ gprintk("_alloc_mpool: allocated 0x%lx bytes instead of 0x%lx bytes.\n",
+ (unsigned long)alloc_size, (unsigned long)size);
+ }
+ size = _dma_mem_size = alloc_size;
+ break;
+ }
+#endif /* _SIMPLE_MEMORY_ALLOCATION_ */
+
+ case ALLOC_TYPE_CHUNK:
+ _dma_vbase = _pgalloc(size);
+ if (DMA_DEV(0)) {
+ /*
+ * Use dma_map_single to obtain dma bus address or IOVA if iommu is present.
+ */
+ pbase = dma_map_single(DMA_DEV(0), _dma_vbase, size, DMA_BIDIRECTIONAL);
+ _use_dma_mapping = 1;
+ } else {
+ pbase = virt_to_bus(_dma_vbase);
+ }
+ break;
+ default:
+ _dma_vbase = NULL;
+ pbase = 0;
+ gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc);
+ }
+
+ _dma_pbase = pbase;
+
+ if (dma_debug >= 1) {
+ gprintk("_alloc_mpool:%s _dma_vbase:%p pbase:%lx allocated:%lx dmaalloc:%d\n",
+ DMA_DEV(0)?"dma_dev":"", _dma_vbase, pbase, (unsigned long)size, dmaalloc);
+ }
+
+ if (((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) {
+ gprintk("DMA memory allocated at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size);
+ _pgcleanup();
+ _dma_vbase = NULL;
+ _dma_pbase = 0;
+ return;
+ }
+
+ if (_dma_vbase) {
+ _cpu_pbase = virt_to_bus(_dma_vbase);
+ if (dma_debug >= 1) gprintk("_cpu_pbase at %lx\n", (unsigned long)_cpu_pbase);
+ }
+#ifdef REMAP_DMA_NONCACHED
+ _dma_vbase = IOREMAP(_dma_pbase, size);
+#endif
+
+ }
+}
+
+/*
+ * Function: _dma_cleanup
+ *
+ * Purpose:
+ * DMA cleanup function.
+ * Parameters:
+ * None
+ * Returns:
+ * Always 0
+ */
+int
+_dma_cleanup(void)
+{
+ if (_dma_vbase) {
+ mpool_destroy(_dma_pool);
+ if (_use_himem) {
+ iounmap(_dma_vbase);
+ } else {
+#ifdef REMAP_DMA_NONCACHED
+ iounmap(_dma_vbase);
+#endif
+ _pgcleanup();
+ }
+ _dma_vbase = NULL;
+ _dma_pbase = 0;
+ _cpu_pbase = 0;
+ }
+ return 0;
+}
+
+void _dma_init(int robo_switch)
+{
+ /* DMA Setup */
+ if (dmasize) {
+ if ((dmasize[strlen(dmasize)-1] & ~0x20) == 'M') {
+ _dma_mem_size = simple_strtoul(dmasize, NULL, 0);
+ _dma_mem_size *= ONE_MB;
+ } else {
+ gprintk("DMA memory size must be specified as e.g. dmasize=8M\n");
+ }
+ if (_dma_mem_size & (_dma_mem_size-1)) {
+ gprintk("dmasize must be a power of 2 (1M, 2M, 4M, 8M etc.)\n");
+ _dma_mem_size = 0;
+ }
+ } else {
+ if(robo_switch){
+ _dma_mem_size = DMA_MEM_DEFAULT_ROBO;
+ }
+ }
+
+ if (himem) {
+ if ((himem[0] & ~0x20) == 'Y' || himem[0] == '1') {
+ _use_himem = 1;
+ } else if ((himem[0] & ~0x20) == 'N' || himem[0] == '0') {
+ _use_himem = 0;
+ }
+ }
+
+ if (_dma_mem_size) {
+ _alloc_mpool(_dma_mem_size);
+ if (_dma_vbase == NULL) {
+ gprintk("no DMA memory available\n");
+ }
+ else {
+ mpool_init();
+ _dma_pool = mpool_create(_dma_vbase, _dma_mem_size);
+ }
+ }
+}
+
+#if USE_LINUX_BDE_MMAP
+/*
+ * Function: _dma_range_valid
+ *
+ * Purpose:
+ * Check if DMA address range is valid.
+ * Parameters:
+ * phys_addr - start physical address
+ * size - range size
+ * Returns:
+ * 0 : not valid
+ * 1 : valid
+ */
+int
+_dma_range_valid(unsigned long phys_addr, unsigned long size)
+{
+ unsigned long pool_start = _cpu_pbase;
+ unsigned long pool_end = pool_start + _dma_mem_size;
+
+ if (phys_addr < pool_start || (phys_addr + size) > pool_end) {
+ gprintk("range 0x%lx-0x%lx outside DMA pool 0x%lx-0x%lx\n",
+ phys_addr, phys_addr + size, pool_start, pool_end);
+ return 0;
+ }
+ return 1;
+}
+#endif
+
+/*
+ * Function: _dma_pool_allocated
+ *
+ * Purpose:
+ * Check if DMA pool has been allocated.
+ * Parameters:
+ * None
+ * Returns:
+ * 0 : not allocated
+ * 1 : allocated
+ */
+int
+_dma_pool_allocated(void)
+{
+ return (_dma_vbase) ? 1 : 0;
+}
+
+sal_paddr_t
+_l2p(int d, void *vaddr)
+{
+ if (_dma_mem_size) {
+ /* dma memory is a contiguous block */
+ if (vaddr) {
+ return _dma_pbase + (PTR_TO_UINTPTR(vaddr) - PTR_TO_UINTPTR(_dma_vbase));
+ }
+ return 0;
+ }
+ return ((sal_paddr_t)virt_to_bus(vaddr));
+}
+
+void *
+_p2l(int d, sal_paddr_t paddr)
+{
+ sal_vaddr_t vaddr = (sal_vaddr_t)_dma_vbase;
+
+ if (_dma_mem_size) {
+ /* DMA memory is a contiguous block */
+ if (paddr == 0) {
+ return NULL;
+ }
+ return (void *)(vaddr + (sal_vaddr_t)(paddr - _dma_pbase));
+ }
+ return bus_to_virt(paddr);
+}
+
+/*
+ * Some of the driver malloc's are too large for
+ * kmalloc(), so 'sal_alloc' and 'sal_free' in the
+ * linux kernel sal cannot be implemented with kmalloc().
+ *
+ * Instead, they expect someone to provide an allocator
+ * that can handle the gimongous size of some of the
+ * allocations, and we provide it here, by allocating
+ * this memory out of the boot-time dma pool.
+ *
+ * These are the functions in question:
+ */
+
+void* kmalloc_giant(int sz)
+{
+ return mpool_alloc(_dma_pool, sz);
+}
+
+void kfree_giant(void* ptr)
+{
+ return mpool_free(_dma_pool, ptr);
+}
+
+uint32_t *
+_salloc(int d, int size, const char *name)
+{
+ void *ptr;
+
+ if (_dma_mem_size) {
+ return mpool_alloc(_dma_pool, size);
+ }
+ if ((ptr = kmalloc(size, mem_flags)) == NULL) {
+ ptr = _pgalloc(size);
+ }
+ return ptr;
+}
+
+void
+_sfree(int d, void *ptr)
+{
+ if (_dma_mem_size) {
+ return mpool_free(_dma_pool, ptr);
+ }
+ if (_pgfree(ptr) < 0) {
+ kfree(ptr);
+ }
+}
+
+int
+_sinval(int d, void *ptr, int length)
+{
+#if defined(dma_cache_wback_inv)
+ dma_cache_wback_inv((unsigned long)ptr, length);
+#else
+#if defined(IPROC_CMICD) || defined(BCM958525)
+ /* FIXME: need proper function to replace dma_cache_sync */
+ dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL);
+#else
+ dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL);
+#endif
+#endif
+ return 0;
+}
+
+int
+_sflush(int d, void *ptr, int length)
+{
+#if defined(dma_cache_wback_inv)
+ dma_cache_wback_inv((unsigned long)ptr, length);
+#else
+#if defined(IPROC_CMICD) || defined(BCM958525)
+ /* FIXME: need proper function to replace dma_cache_sync */
+ dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL);
+#else
+ dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL);
+#endif
+#endif
+
+ return 0;
+}
+
+int
+lkbde_get_dma_info(phys_addr_t* cpu_pbase, phys_addr_t* dma_pbase, ssize_t* size)
+{
+ if (_dma_vbase == NULL) {
+ if (_dma_mem_size == 0) {
+ _dma_mem_size = DMA_MEM_DEFAULT;
+ }
+ _alloc_mpool(_dma_mem_size);
+ }
+ *cpu_pbase = _cpu_pbase;
+ *dma_pbase = _dma_pbase;
+ *size = (_dma_vbase) ? _dma_mem_size : 0;
+ return 0;
+}
+
+void
+_dma_pprint(void)
+{
+ pprintf("DMA Memory (%s): %d bytes, %d used, %d free%s\n",
+ (_use_himem) ? "high" : "kernel",
+ (_dma_vbase) ? _dma_mem_size : 0,
+ (_dma_vbase) ? mpool_usage(_dma_pool) : 0,
+ (_dma_vbase) ? _dma_mem_size - mpool_usage(_dma_pool) : 0,
+ USE_LINUX_BDE_MMAP ? ", local mmap" : "");
+}
+
+/*
+ * Export functions
+ */
+LKM_EXPORT_SYM(kmalloc_giant);
+LKM_EXPORT_SYM(kfree_giant);
+LKM_EXPORT_SYM(lkbde_get_dma_info);
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.c
similarity index 100%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.c
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.h
similarity index 100%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/kernel/linux_shbde.h
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/shared/mpool.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/shared/mpool.c
similarity index 99%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/shared/mpool.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/shared/mpool.c
index 98169d7935df..7f7332b3a7a4 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/shared/mpool.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/shared/mpool.c
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: mpool.c,v 1.18 2012/03/02 15:53:32 yaronm Exp $
+ * $Id: mpool.c,v 1.18 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/Makefile
similarity index 97%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/Makefile
index 8cd6a514531d..ac8b04ac9bcf 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.1 2008/10/16 09:41:22 mlarsen Exp $
+# $Id: Makefile,v 1.1 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.c
similarity index 89%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.c
index 2d7a521f84dd..130045369313 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.c
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: linux-user-bde.c,v 1.80 2013/06/14 22:31:44 mlarsen Exp $
+ * $Id: linux-user-bde.c,v 1.80 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
@@ -71,6 +71,23 @@ MODULE_LICENSE("GPL");
#define CMIC_CMCx_UC0_IRQ_MASK3_OFFSET(x) (0x31434 + (0x1000 * x))
#define CMIC_CMCx_UC0_IRQ_MASK4_OFFSET(x) (0x31438 + (0x1000 * x))
+/* CMICX defines */
+#define INTC_INTR_REG_NUM (8)
+
+#define INTC_INTR_ENABLE_REG0 (0x180130f0)
+#define INTC_INTR_STATUS_REG0 (0x18013190)
+#define INTC_INTR_RAW_STATUS_REG0 (0x18013140)
+
+#define INTC_INTR_ENABLE_BASE (INTC_INTR_ENABLE_REG0)
+#define INTC_INTR_STATUS_BASE (INTC_INTR_STATUS_REG0)
+#define INTC_INTR_RAW_STATUS_BASE (INTC_INTR_RAW_STATUS_REG0)
+
+
+#define READ_INTC_INTR(d, reg, v) \
+ (v = user_bde->iproc_read(d, reg))
+#define WRITE_INTC_INTR(d, reg, v) \
+ (user_bde->iproc_write(d, reg, v))
+
/* Allow override of default CMICm CMC */
#ifndef BDE_CMICM_PCIE_CMC
#define BDE_CMICM_PCIE_CMC 0
@@ -121,8 +138,9 @@ typedef struct {
static bde_inst_resource_t _bde_inst_resource[LINUX_BDE_MAX_DEVICES];
typedef struct {
+ phys_addr_t cpu_pbase; /* CPU physical base address of the DMA pool */
+ phys_addr_t dma_pbase; /* Bus base address of the DMA pool */
uint32 total_size; /* Total size of the pool in MB */
- uint32 pbase; /* Physical base address of the DMA pool */
uint32 offset; /* Current offset of the pool in MB */
}_dma_pool_t;
@@ -198,6 +216,32 @@ _cmic_interrupt(bde_ctrl_t *ctrl)
}
static void
+_cmicx_interrupt(bde_ctrl_t *ctrl)
+{
+ int d, i;
+ bde_inst_resource_t *res;
+
+ d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t));
+ res = &_bde_inst_resource[ctrl->inst];
+
+ /* Disable all interrupts.. Re-enable unserviced interrupts later
+ * So as to avoid getting new interrupts until the user level driver
+ * enumerates the interrupts to be serviced
+ */
+ for (i = 0 ; i < INTC_INTR_REG_NUM ; i++) {
+ WRITE_INTC_INTR(d, (INTC_INTR_ENABLE_BASE + 4*i), 0);
+ }
+
+ /* Notify */
+ atomic_set(&res->intr, 1);
+#ifdef BDE_LINUX_NON_INTERRUPTIBLE
+ wake_up(&res->intr_wq);
+#else
+ wake_up_interruptible(&res->intr_wq);
+#endif
+}
+
+static void
_cmicm_interrupt(bde_ctrl_t *ctrl)
{
int d;
@@ -511,6 +555,7 @@ static struct _intr_mode_s {
{ (isr_f)_bme3200_interrupt, "BME3200" },
{ (isr_f)_bm9600_interrupt, "BM9600" },
{ (isr_f)_bcm88750_interrupt, "BCM88750" },
+ { (isr_f)_cmicx_interrupt, "CMICx" },
{ NULL, NULL }
};
@@ -533,6 +578,7 @@ static void
_devices_init(int d)
{
bde_ctrl_t *ctrl;
+ uint32 ver;
ctrl = &_devices[d];
/* Initialize our control info */
@@ -565,18 +611,21 @@ _devices_init(int d)
case BCM88753_DEVICE_ID:
case BCM88754_DEVICE_ID:
case BCM88755_DEVICE_ID:
+ case BCM88752_DEVICE_ID:
ctrl->isr = (isr_f)_bcm88750_interrupt;
break;
/* FIXME: might use _devices[i].dev_type & BDE_AXI_DEV_TYPE*/
case BCM88670_DEVICE_ID:
case BCM88671_DEVICE_ID:
case BCM88671M_DEVICE_ID:
+ case BCM88672_DEVICE_ID:
case BCM88673_DEVICE_ID:
case BCM88674_DEVICE_ID:
case BCM88675_DEVICE_ID:
case BCM88675M_DEVICE_ID:
case BCM88676_DEVICE_ID:
case BCM88676M_DEVICE_ID:
+ case BCM88677_DEVICE_ID:
case BCM88678_DEVICE_ID:
case BCM88679_DEVICE_ID:
case BCM88370_DEVICE_ID:
@@ -588,27 +637,62 @@ _devices_init(int d)
case BCM88377_DEVICE_ID:
case BCM88378_DEVICE_ID:
case BCM88379_DEVICE_ID:
+ case BCM88681_DEVICE_ID:
+ case BCM88682_DEVICE_ID:
+ case BCM88683_DEVICE_ID:
+ case BCM88684_DEVICE_ID:
+ case BCM88685_DEVICE_ID:
+ case BCM88380_DEVICE_ID:
+ case BCM88381_DEVICE_ID:
+ case BCM88680_DEVICE_ID:
+ case BCM88690_DEVICE_ID:
case BCM88770_DEVICE_ID:
case BCM88773_DEVICE_ID:
case BCM88774_DEVICE_ID:
case BCM88775_DEVICE_ID:
case BCM88776_DEVICE_ID:
+ case BCM88777_DEVICE_ID:
case BCM88470_DEVICE_ID:
+ case BCM88470P_DEVICE_ID:
+ case BCM88471_DEVICE_ID:
+ case BCM88473_DEVICE_ID:
+ case BCM88474_DEVICE_ID:
+ case BCM88474H_DEVICE_ID:
+ case BCM88476_DEVICE_ID:
+ case BCM88477_DEVICE_ID:
+
+ case BCM88270_DEVICE_ID:
+ case BCM88272_DEVICE_ID:
+ case BCM88273_DEVICE_ID:
+ case BCM88278_DEVICE_ID:
+ case BCM8206_DEVICE_ID:
case BCM88950_DEVICE_ID:
case BCM88953_DEVICE_ID:
case BCM88954_DEVICE_ID:
case BCM88955_DEVICE_ID:
case BCM88956_DEVICE_ID:
+ case BCM88790_DEVICE_ID:
+ case BCM88772_DEVICE_ID:
+ case BCM88952_DEVICE_ID:
ctrl->isr = (isr_f)_cmicd_interrupt;
break;
default:
- ctrl->isr = (isr_f)_cmic_interrupt;
- if ((ctrl->dev_type & BDE_256K_REG_SPACE) &&
+ /* Get CMIC version */
+ if (user_bde->get_cmic_ver(d, &ver) != 0) {
+ ver = -1;
+ }
+ /* check if version is CMICX */
+ if (ver == 0x04) {
+ ctrl->isr = (isr_f)_cmicx_interrupt;
+ } else {
+ ctrl->isr = (isr_f)_cmic_interrupt;
+ if ((ctrl->dev_type & BDE_256K_REG_SPACE) &&
#ifdef BCM_PETRA_SUPPORT /* FIXME remove code when hardware design is fixed */
- ctrl->devid != 0x1234 &&
+ ctrl->devid != 0x1234 &&
#endif
- readl(ctrl->ba + CMICE_DEV_REV_ID) == 0) {
- ctrl->isr = (isr_f)_cmicm_interrupt;
+ readl(ctrl->ba + CMICE_DEV_REV_ID) == 0) {
+ ctrl->isr = (isr_f)_cmicm_interrupt;
+ }
}
break;
}
@@ -632,7 +716,8 @@ static int
_init(void)
{
int i;
- uint32 pbase, dmasize;
+ phys_addr_t cpu_pbase, dma_pbase;
+ ssize_t dmasize;
bde_inst_resource_t *res;
/* Connect to the kernel bde */
@@ -642,10 +727,11 @@ _init(void)
init_waitqueue_head(&_ether_interrupt_wq);
- lkbde_get_dma_info(&pbase, &dmasize);
+ lkbde_get_dma_info(&cpu_pbase, &dma_pbase, &dmasize);
memset(&_dma_pool, 0, sizeof(_dma_pool));
- _dma_pool.pbase = pbase;
+ _dma_pool.cpu_pbase = cpu_pbase;
+ _dma_pool.dma_pbase = dma_pbase;
_dma_pool.total_size = dmasize / ONE_MB;
memset(_devices, 0, sizeof(_devices));
@@ -769,7 +855,7 @@ _dma_resource_alloc(unsigned int dma_size, unsigned int *dma_offset)
}
static int
-_dma_resource_get(int inst_id, uint32 *pbase, uint32* size)
+_dma_resource_get(int inst_id, phys_addr_t *cpu_pbase, phys_addr_t *dma_pbase, ssize_t* size)
{
int i;
unsigned int dma_size = 0, dma_offset = 0;
@@ -784,7 +870,8 @@ _dma_resource_get(int inst_id, uint32 *pbase, uint32* size)
}
}
- *pbase = _dma_pool.pbase + dma_offset * ONE_MB;
+ *cpu_pbase = _dma_pool.cpu_pbase + dma_offset * ONE_MB;
+ *dma_pbase = _dma_pool.dma_pbase + dma_offset * ONE_MB;
*size = dma_size * ONE_MB;
return 0;
@@ -892,7 +979,8 @@ static int
_ioctl(unsigned int cmd, unsigned long arg)
{
lubde_ioctl_t io;
- uint32 pbase, size;
+ phys_addr_t cpu_pbase, dma_pbase;
+ ssize_t size;
const ibde_dev_t *bde_dev;
int inst_id;
bde_inst_resource_t *res;
@@ -908,7 +996,6 @@ _ioctl(unsigned int cmd, unsigned long arg)
io.d0 = KBDE_VERSION;
break;
case LUBDE_GET_NUM_DEVICES:
-
io.d0 = user_bde->num_devices(io.dev);
break;
case LUBDE_GET_DEVICE:
@@ -949,14 +1036,21 @@ _ioctl(unsigned int cmd, unsigned long arg)
case LUBDE_GET_DMA_INFO:
inst_id = io.dev;
if (_bde_multi_inst){
- _dma_resource_get(inst_id, &pbase, &size);
+ _dma_resource_get(inst_id, &cpu_pbase, &dma_pbase, &size);
} else {
- lkbde_get_dma_info(&pbase, &size);
+ lkbde_get_dma_info(&cpu_pbase, &dma_pbase, &size);
}
- io.d0 = pbase;
- io.d1 = size;
+ io.d0 = dma_pbase;
+ io.d1 = size;
/* Optionally enable DMA mmap via /dev/linux-kernel-bde */
io.d2 = USE_LINUX_BDE_MMAP;
+ /* Get physical address for mmap */
+ io.dx.dw[0] = cpu_pbase;
+#ifdef PHYS_ADDRS_ARE_64BITS
+ io.dx.dw[1] = cpu_pbase >> 32;
+#else
+ io.dx.dw[1] = 0;
+#endif
break;
case LUBDE_ENABLE_INTERRUPTS:
if (_devices[io.dev].dev_type & BDE_SWITCH_DEV_TYPE) {
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h
index f82373045c4d..edf5f63bf54a 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: linux-user-bde.h,v 1.23 2013/02/25 17:46:08 mason Exp $
+ * $Id: linux-user-bde.h,v 1.23 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde.h
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde.h
index cbaa977990f4..0a9df3a6e419 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde.h
@@ -30,6 +30,20 @@ typedef void (*shbde_log_func_t)(int level, const char *str, int param);
#define SHBDE_WARN 1
#define SHBDE_DBG 2
+/* iProc configuration (primarily used for PCI-AXI bridge) */
+typedef struct shbde_iproc_config_s {
+ unsigned int dev_id;
+ unsigned int dev_rev;
+ unsigned int use_msi;
+ unsigned int iproc_ver;
+ unsigned int cmic_ver;
+ unsigned int cmic_rev;
+ unsigned int dma_hi_bits;
+ unsigned int mdio_base_addr;
+ unsigned int pcie_phy_addr;
+ unsigned int adjust_pcie_preemphasis;
+} shbde_iproc_config_t;
+
/* Hardware abstraction functions */
typedef struct shbde_hal_s {
@@ -54,18 +68,10 @@ typedef struct shbde_hal_s {
/* PCI parent device access */
void *(*pci_parent_device_get)(void *pci_dev);
+ /* iProc configuration */
+ shbde_iproc_config_t icfg;
+
} shbde_hal_t;
-/* iProc configuration (primarily used for PCI-AXI bridge) */
-typedef struct shbde_iproc_config_s {
- unsigned int dev_id;
- unsigned int dev_rev;
- unsigned int use_msi;
- unsigned int iproc_ver;
- unsigned int dma_hi_bits;
- unsigned int mdio_base_addr;
- unsigned int pcie_phy_addr;
- unsigned int adjust_pcie_preemphasis;
-} shbde_iproc_config_t;
#endif /* __SHBDE_H__ */
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_iproc.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_iproc.h
similarity index 100%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_iproc.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_iproc.h
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_mdio.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_mdio.h
similarity index 100%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_mdio.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_mdio.h
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_pci.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_pci.h
similarity index 85%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_pci.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_pci.h
index 99edee7dc833..06aadfae5b31 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/include/shbde_pci.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/include/shbde_pci.h
@@ -38,4 +38,10 @@ shbde_pci_is_iproc(shbde_hal_t *shbde, void *pci_dev, int *cmic_bar);
extern int
shbde_pci_max_payload_set(shbde_hal_t *shbde, void *pci_dev, int maxpayload);
+extern int
+shbde_pci_iproc_version_get(shbde_hal_t *shbde, void *pci_dev,
+ unsigned int *iproc_ver,
+ unsigned int *cmic_ver,
+ unsigned int *cmic_rev);
+
#endif /* __SHBDE_PCI_H__ */
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_iproc.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_iproc.c
similarity index 79%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_iproc.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_iproc.c
index 564d2429f33d..2db25df585ae 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_iproc.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_iproc.c
@@ -30,10 +30,12 @@
#define BAR0_PAXB_PCIE_EP_AXI_CONFIG 0x2104
#define BAR0_PAXB_CONFIG_IND_ADDR 0x2120
#define BAR0_PAXB_CONFIG_IND_DATA 0x2124
-#define BAR0_PAXB_IMAP0_0 0x2c00
-#define BAR0_PAXB_IMAP0_1 0x2c04
-#define BAR0_PAXB_IMAP0_2 0x2c08
-#define BAR0_PAXB_IMAP0_7 0x2c1c
+
+#define BAR0_PAXB_IMAP0_0 (0x2c00)
+#define BAR0_PAXB_IMAP0_1 (0x2c04)
+#define BAR0_PAXB_IMAP0_2 (0x2c08)
+#define BAR0_PAXB_IMAP0_7 (0x2c1c)
+
#define BAR0_PAXB_OARR_FUNC0_MSI_PAGE 0x2d34
#define BAR0_PAXB_OARR_2 0x2d60
#define BAR0_PAXB_OARR_2_UPPER 0x2d64
@@ -131,17 +133,46 @@ shbde_iproc_config_init(shbde_iproc_config_t *icfg,
case 0x8420: /* Bloodhound */
case 0x8450: /* Elkhound */
case 0xb060: /* Ranger2(Greyhound) */
- case 0x8360: /* Greyhound Lite w/o L3 */
+ case 0x8360: /* Greyhound 53365 & 53369 */
case 0xb260: /* saber2 */
case 0xb460: /* saber2+ */
+ case 0xb170: /* Hurricane3-MG */
+ case 0x8570: /* Greyhound2 */
+ case 0xb070: /* Greyhound2(emulation) */
+ case 0x8580: /* Greyhound2(emulation) */
case 0xb230: /* Dagger2 */
icfg->iproc_ver = 7;
icfg->dma_hi_bits = 0x2;
break;
+ case 0xb560: /* Apache */
+ case 0xb760: /* Maverick */
+ icfg->iproc_ver = 0xB;
+ break;
+ case 0xb160: /* Hurricane3 */
+ case 0x8440: /* Wolfhound2 */
+ case 0x8430: /* Foxhound2 */
+ icfg->iproc_ver = 10;
+ icfg->dma_hi_bits = 0x2;
+ break;
default:
break;
}
+ /* Check for exceptions */
+ switch (icfg->dev_id) {
+ case 0xb069:
+ case 0xb068:
+ icfg->iproc_ver = 0xB; /*Ranger2+ Apache Family */
+ icfg->dma_hi_bits = 0;
+ break;
+ case 0xb168: /* Ranger3+ */
+ case 0xb169:
+ icfg->iproc_ver = 0;
+ icfg->dma_hi_bits = 0;
+ break;
+ default:
+ break;
+ }
/* Check for PCIe PHY address that needs PCIe preemphasis and
* assign the MDIO base address
*/
@@ -240,18 +271,19 @@ shbde_iproc_paxb_init(shbde_hal_t *shbde, void *iproc_regs,
/* Enable iProc DMA to external host memory */
reg = ROFFS(iproc_regs, BAR0_PAXB_PCIE_EP_AXI_CONFIG);
iproc32_write(shbde, reg, 0x0);
- reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2);
- iproc32_write(shbde, reg, 0x1);
- reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2_UPPER);
- iproc32_write(shbde, reg, icfg->dma_hi_bits);
-
- /* Configure MSI interrupt page */
- if (icfg->use_msi) {
- reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_FUNC0_MSI_PAGE);
- data = iproc32_read(shbde, reg);
- iproc32_write(shbde, reg, data | 0x1);
+ if(icfg->cmic_ver < 4) { /* Non-CMICX */
+ reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2);
+ iproc32_write(shbde, reg, 0x1);
+ reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2_UPPER);
+ iproc32_write(shbde, reg, icfg->dma_hi_bits);
+
+ /* Configure MSI interrupt page */
+ if (icfg->use_msi) {
+ reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_FUNC0_MSI_PAGE);
+ data = iproc32_read(shbde, reg);
+ iproc32_write(shbde, reg, data | 0x1);
+ }
}
-
return pci_num;
}
@@ -273,20 +305,30 @@ shbde_iproc_pci_read(shbde_hal_t *shbde, void *iproc_regs,
{
unsigned int subwin_base;
void *reg;
+ shbde_iproc_config_t *icfg = &shbde->icfg;
if (!iproc_regs) {
return -1;
}
/* Sub-window size is 0x1000 (4K) */
- subwin_base = (addr & ~0xfff) | 0x1;
+ subwin_base = (addr & ~0xfff);
- /* Update base address for sub-window 7 */
- reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_7);
- iproc32_write(shbde, reg, subwin_base);
+ if((icfg->cmic_ver >= 4) && (subwin_base == 0x18013000)) {
+ /* Route the INTC block access through IMAP0_6 */
+ reg = ROFFS(iproc_regs, 0x6000 + (addr & 0xfff));
+ } else {
+ /* Update base address for sub-window 7 */
+ subwin_base |= 1; /* Valid bit */
+ reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_7);
+ iproc32_write(shbde, reg, subwin_base);
+ /* Read it to make sure the write actually goes through */
+ subwin_base = iproc32_read(shbde, reg);
+
+ /* Read register through sub-window 7 */
+ reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff));
+ }
- /* Read register through sub-window 7 */
- reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff));
return iproc32_read(shbde, reg);
}
@@ -309,20 +351,30 @@ shbde_iproc_pci_write(shbde_hal_t *shbde, void *iproc_regs,
{
unsigned int subwin_base;
void *reg;
+ shbde_iproc_config_t *icfg = &shbde->icfg;
if (!iproc_regs) {
return;
}
/* Sub-window size is 0x1000 (4K) */
- subwin_base = (addr & ~0xfff) | 0x1;
+ subwin_base = (addr & ~0xfff);
- /* Update base address for sub-window 7 */
- reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_7);
- iproc32_write(shbde, reg, subwin_base);
+ if((icfg->cmic_ver >= 4) && (subwin_base == 0x18013000)) {
+ /* Route the INTC block access through IMAP0_6 */
+ reg = ROFFS(iproc_regs, 0x6000 + (addr & 0xfff));
+ } else {
+ /* Update base address for sub-window 7 */
+ subwin_base |= 1; /* Valid bit */
+ reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_7);
+ iproc32_write(shbde, reg, subwin_base);
+ /* Read it to make sure the write actually goes through */
+ subwin_base = iproc32_read(shbde, reg);
+
+ /* Read register through sub-window 7 */
+ reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff));
+ }
- /* Write register through sub-window 7 */
- reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff));
iproc32_write(shbde, reg, data);
}
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_mdio.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_mdio.c
similarity index 100%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_mdio.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_mdio.c
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_pci.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_pci.c
similarity index 80%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_pci.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_pci.c
index f8e83a5f3bc6..22408a84c3e6 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/bde/shared/shbde_pci.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/bde/shared/shbde_pci.c
@@ -197,12 +197,13 @@ shbde_pci_is_iproc(shbde_hal_t *shbde, void *pci_dev, int *cmic_bar)
* ...
* 0x24: Vendor-Specific Register 8
*/
+ /* 32'b // 31:12=0 Reserved; 11:08=CMIC BAR; 07:00=iProc Configuration ID */
rval = pcic32_read(shbde, pci_dev, cap_base + 8);
LOG_DBG(shbde, "Found VSEC", rval);
/* Determine PCI BAR of CMIC */
*cmic_bar = 0;
- if ((rval == 0x101) || (rval == 0x100)) { /* FIXME SDK-65019 SABER2_TOT_PRE_MERGE */
+ if ((rval & 0x100) == 0x100) {
*cmic_bar = 2;
}
/* Assume iProc device */
@@ -212,6 +213,80 @@ shbde_pci_is_iproc(shbde_hal_t *shbde, void *pci_dev, int *cmic_bar)
return 0;
}
+/*
+ * Function:
+ * shbde_pci_iproc_version_get
+ * Purpose:
+ * Get iproc, cmic versions and revisions
+ * Parameters:
+ * shbde - pointer to initialized hardware abstraction module
+ * dev - PCI device handle (passed back to PCI HAL functions)
+ * iproc_ver - (OUT) iProc version
+ * cmic_ver - (OUT) CMIC version
+ * cmic_rev - (OUT) CMIC revision
+ * Returns:
+ * 1 for no error, otherwise 0
+ */
+int
+shbde_pci_iproc_version_get(shbde_hal_t *shbde, void *pci_dev,
+ unsigned int *iproc_ver,
+ unsigned int *cmic_ver,
+ unsigned int *cmic_rev)
+{
+ unsigned int cap_base, rval;
+
+ if (!shbde_pci_is_pcie(shbde, pci_dev)) {
+ return 0;
+ }
+
+ /* Look for PCIe vendor-specific extended capability (VSEC) */
+ cap_base = PCI_EXT_CAP_START;
+ while (cap_base) {
+ rval = pcic32_read(shbde, pci_dev, cap_base);
+ if (rval == 0xffffffff) {
+ /* Assume PCI HW read error */
+ return 0;
+ }
+
+ if (PCI_EXT_CAP_ID(rval) == PCI_EXT_CAP_ID_VNDR) {
+ break;
+ }
+ cap_base = PCI_EXT_CAP_NEXT(rval);
+ }
+ if (cap_base) {
+ /*
+ * VSEC layout:
+ *
+ * 0x00: PCI Express Extended Capability Header
+ * 0x04: Vendor-Specific Header
+ * 0x08: Vendor-Specific Register 1
+ * 0x0c: Vendor-Specific Register 2
+ * ...
+ * 0x24: Vendor-Specific Register 8
+ */
+
+ /* Read PCIe Vendor Specific Register 1 */
+ /* VENODR REG FORMAT
+ * [7:0] iProc Rev = 8'h0E (for P14)
+ * [11:8] CMIC BAR = 4'h1 (BAR64-1)
+ * [15:12] CMIC Version = 4'h4
+ * [19:16] CMIC Rev = 4'h1
+ * [22:20] SBUS Version = 4'h4
+ */
+
+ rval = pcic32_read(shbde, pci_dev, cap_base + 8);
+ LOG_DBG(shbde, "Found VSEC", rval);
+
+ /* Determine PCI BAR of CMIC */
+ *iproc_ver = rval & 0xff;
+ *cmic_ver = (rval >> 12) & 0xf;
+ *cmic_rev = (rval >> 16) & 0xf;
+ return 1;
+ }
+
+ return 0;
+}
+
/*
* Function:
* shbde_pci_max_payload_set
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/Makefile
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/Makefile
index aa3496bb6e4e..37f35b2e27a5 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.10 2006/07/10 08:07:45 ako Exp $
+# $Id: Makefile,v 1.10 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile
similarity index 97%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile
index f421819242c7..5459b399aa4b 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.3 2012/07/17 07:39:51 mlarsen Exp $
+# $Id: Makefile,v 1.3 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c
similarity index 82%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c
index 9dc94b30d85e..e7d19a3342c4 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: bcm-knet.c,v 1.90 2013/09/25 10:02:36 mlarsen Exp $
+ * $Id: bcm-knet.c,v 1.90 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
@@ -66,14 +66,11 @@
#include <kcom.h>
#include <bcm-knet.h>
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,16,0)
-#include <linux/nsproxy.h>
-#endif
-
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/random.h>
#include <linux/seq_file.h>
+#include <linux/if_vlan.h>
MODULE_AUTHOR("Broadcom Corporation");
@@ -100,7 +97,7 @@ LKM_MOD_PARAM(default_mtu, "i", int, 0);
MODULE_PARM_DESC(default_mtu,
"Default MTU for KNET network interfaces (default 1500)");
-static int rx_sync_retry = 10;
+static int rx_sync_retry = 1000;
LKM_MOD_PARAM(rx_sync_retry, "i", int, 0);
MODULE_PARM_DESC(rx_sync_retry,
"Retries if chain is incomplete on interrupt (default 10)");
@@ -170,6 +167,16 @@ LKM_MOD_PARAM(basedev_suspend, "i", int, 0);
MODULE_PARM_DESC(basedev_suspend,
"Pause traffic till base device is up (enabled by default in NAPI mode)");
+static int ftmh_lb_key_ext = 0;
+LKM_MOD_PARAM(ftmh_lb_key_ext, "i", int, 0);
+MODULE_PARM_DESC(ftmh_lb_key_ext,
+"FTMH LB-Key Extension header is present (default 0)");
+
+static int ftmh_stacking_ext = 0;
+LKM_MOD_PARAM(ftmh_stacking_ext, "i", int, 0);
+MODULE_PARM_DESC(ftmh_stacking_ext,
+"FTMH Stacking Extension header is present (default 0)");
+
/* Debug levels */
#define DBG_LVL_VERB 0x1
#define DBG_LVL_DCB 0x2
@@ -186,9 +193,14 @@ MODULE_PARM_DESC(basedev_suspend,
#define DBG_LVL_WARN 0x1000
#define DBG_LVL_NDEV 0x2000
#define DBG_LVL_INST 0x4000
+/* Level to output Dune internal headers Parsing */
+#define DBG_LVL_DUNE 0x8000
+#define DBG_LVL_DCB_TX 0x10000
+#define DBG_LVL_DCB_RX 0x20000
+#define DBG_LVL_PDMP_TX 0x40000
+#define DBG_LVL_PDMP_RX 0x80000
#define DBG_VERB(_s) do { if (debug & DBG_LVL_VERB) gprintk _s; } while (0)
-#define DBG_DCB(_s) do { if (debug & DBG_LVL_DCB) gprintk _s; } while (0)
#define DBG_PKT(_s) do { if (debug & DBG_LVL_PKT) gprintk _s; } while (0)
#define DBG_SKB(_s) do { if (debug & DBG_LVL_SKB) gprintk _s; } while (0)
#define DBG_CMD(_s) do { if (debug & DBG_LVL_CMD) gprintk _s; } while (0)
@@ -202,6 +214,18 @@ MODULE_PARM_DESC(basedev_suspend,
#define DBG_WARN(_s) do { if (debug & DBG_LVL_WARN) gprintk _s; } while (0)
#define DBG_NDEV(_s) do { if (debug & DBG_LVL_NDEV) gprintk _s; } while (0)
#define DBG_INST(_s) do { if (debug & DBG_LVL_INST) gprintk _s; } while (0)
+#define DBG_DUNE(_s) do { if (debug & DBG_LVL_DUNE) gprintk _s; } while (0)
+#define DBG_DCB_TX(_s) do { if (debug & (DBG_LVL_DCB|DBG_LVL_DCB_TX)) \
+ gprintk _s; } while (0)
+#define DBG_DCB_RX(_s) do { if (debug & (DBG_LVL_DCB|DBG_LVL_DCB_RX)) \
+ gprintk _s; } while (0)
+#define DBG_DCB(_s) do { if (debug & (DBG_LVL_DCB|DBG_LVL_DCB_TX| \
+ DBG_LVL_DCB_RX)) \
+ gprintk _s; } while (0)
+
+
+/* This flag is used to indicate if debugging packet function is open or closed */
+static int dbg_pkt_enable = 0;
/* Module Information */
#define MODULE_MAJOR 122
@@ -365,6 +389,14 @@ static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
}
#endif /* KERNEL_VERSION(2,4,21) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
+#define bkn_vlan_hwaccel_put_tag(_skb, _proto, _tci) \
+ __vlan_hwaccel_put_tag(_skb, _tci)
+#else
+#define bkn_vlan_hwaccel_put_tag(_skb, _proto, _tci) \
+ __vlan_hwaccel_put_tag(_skb, htons(_proto), _tci)
+#endif
+
#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT
#define DMA_DEV device
#define DMA_FROMDEV DMA_FROM_DEVICE
@@ -423,7 +455,7 @@ typedef struct bkn_dcb_chain_s {
#define MAX_RX_DCBS 32
#define NUM_DMA_CHAN 4
-#define NUM_RX_CHAN 2
+#define NUM_RX_CHAN 3
#define API_RX_CHAN 0
/* Device control info */
@@ -497,7 +529,8 @@ typedef struct bkn_switch_info_s {
int api_active; /* BCM Rx API is active */
int chain_complete; /* All DCBs in chain processed */
int sync_err; /* Chain done with incomplete DCBs (debug) */
- int intr_miss; /* Completed DCBs w/o interrupt (debug) */
+ int sync_retry; /* Total retry times for sync error (debug) */
+ int sync_maxloop; /* Max loop times once in recovering sync (debug) */
int use_rx_skb; /* Use SKBs for DMA */
uint32_t rate_max; /* Rx rate in packets/sec */
uint32_t burst_max; /* Rx burst size in number of packets */
@@ -524,8 +557,109 @@ typedef struct bkn_switch_info_s {
} rx[NUM_RX_CHAN];
} bkn_switch_info_t;
+#define BKN_DNX_HDR_MAX_SIZE 40
+/* FTMH */
+#define BKN_DNX_FTMH_SIZE_BYTE 9
+#define BKN_DNX_FTMH_LB_EXT_SIZE_BYTE 1
+#define BKN_DNX_FTMH_STACKING_SIZE_BYTE 2
+#define BKN_DNX_FTMH_DEST_EXT_SIZE_BYTE 2
+#define BKN_DNX_FTMH_LB_EXT_SIZE_BYTE 1
+#define BKN_DNX_FTMH_PKT_SIZE_MSB 0
+#define BKN_DNX_FTMH_PKT_SIZE_NOF_BITS 14
+#define BKN_DNX_FTMH_TC_MSB 14
+#define BKN_DNX_FTMH_TC_NOF_BITS 3
+#define BKN_DNX_FTMH_SRC_SYS_PORT_MSB 17
+#define BKN_DNX_FTMH_SRC_SYS_PORT_NOF_BITS 16
+#define BKN_DNX_FTMH_EXT_DSP_EXIST_MSB 68
+#define BKN_DNX_FTMH_EXT_DSP_EXIST_NOF_BITS 1
+#define BKN_DNX_FTMH_EXT_MSB 45
+#define BKN_DNX_FTMH_EXT_NOF_BITS 2
+#define BKN_DNX_FTMH_FIRST_EXT_MSB 72
+#define BKN_DNX_FTMH_ACTION_TYPE_MSB 43
+#define BKN_DNX_FTMH_ACTION_TYPE_NOF_BITS 2
+#define BKN_DNX_FTMH_PPH_TYPE_MSB 45
+#define BKN_DNX_FTMH_PPH_TYPE_NOF_BITS 2
+/* PPH */
+#define BKN_DNX_PPH_SIZE_BYTE 7
+#define BKN_DNX_PPH_EEI_EXTENSION_PRESENT_MSB 0
+#define BKN_DNX_PPH_EEI_EXTENSION_PRESENT_NOF_BITS 1
+#define BKN_DNX_PPH_LEARN_EXENSION_PRESENT_MSB 1
+#define BKN_DNX_PPH_LEARN_EXENSION_PRESENT_NOF_BITS 1
+#define BKN_DNX_PPH_FHEI_SIZE_MSB 2
+#define BKN_DNX_PPH_FHEI_SIZE_NOF_BITS 2
+#define BKN_DNX_PPH_FORWARD_CODE_MSB 4
+#define BKN_DNX_PPH_FORWARD_CODE_NOF_BITS 4
+#define BKN_DNX_PPH_VSI_MSB 22
+#define BKN_DNX_PPH_VSI_NOF_BITS 16
+/* FHEI TRAP/SNOOP 3B */
+#define BKN_DNX_PPH_FHEI_3B_SIZE_BYTE 3
+#define BKN_DNX_PPH_FHEI_5B_SIZE_BYTE 5
+#define BKN_DNX_PPH_FHEI_8B_SIZE_BYTE 8
+#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_MSB 0
+#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_NOF_BITS 16
+#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_MSB 16
+#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_NOF_BITS 8
+/* PPH extension */
+#define BKN_DNX_PPH_EXPLICIT_EDITING_INFOMATION_EXTENSION_SIZE_BYTE 3
+#define BKN_DNX_PPH_LEARN_EXTENSION_SIZE_BYTE 5
+
+
+/* ftmh action type. */
+typedef enum bkn_dnx_ftmh_action_type_e {
+ BKN_DNX_FTMH_ACTION_TYPE_FORWARD = 0, /* TM action is forward */
+ BKN_DNX_FTMH_ACTION_TYPE_SNOOP = 1, /* TM action is snoop */
+ BKN_DNX_FTMH_ACTION_TYPE_INBOUND_MIRROR = 2, /* TM action is inbound mirror. */
+ BKN_DNX_FTMH_ACTION_TYPE_OUTBOUND_MIRROR = 3 /* TM action is outbound mirror. */
+}bkn_dnx_ftmh_action_type_t;
+
+/* ftmh dest extension. */
+typedef struct bkn_dnx_ftmh_dest_extension_s {
+ uint8 valid; /* Set if the extension is present */
+ uint32_t dst_sys_port; /* Destination System Port */
+} bkn_dnx_ftmh_dest_extension_t;
+
+/* dnx packet */
+typedef struct bkn_pkt_dnx_s {
+ uint32_t ntwrk_header_ptr;
+ struct {
+ uint32_t packet_size; /* Packet size in bytes */
+ uint32_t action_type; /* Indicates if the copy is one of the Forward Snoop or Mirror packet copies */
+ uint32_t pph_type;
+ uint32_t prio; /* Traffic class */
+ uint32_t src_sys_port; /* Source System port*/
+ } ftmh;
+ struct {
+ uint32_t vsi;
+ uint32_t trap_qualifier; /* RAW Data */
+ uint32_t trap_id; /* RAW Data */
+ } internal;
+} bkn_dnx_packet_info;
+
+
#define PREV_IDX(_cur, _max) (((_cur) == 0) ? (_max) - 1 : (_cur) - 1)
+#if defined(CMIC_SOFT_BYTE_SWAP)
+
+#define CMIC_SWAP32(_x) ((((_x) & 0xff000000) >> 24) \
+ | (((_x) & 0x00ff0000) >> 8) \
+ | (((_x) & 0x0000ff00) << 8) \
+ | (((_x) & 0x000000ff) << 24))
+
+#define DEV_READ32(_d, _a, _p) \
+ do { \
+ uint32_t _data; \
+ _data = (((volatile uint32_t *)(_d)->base_addr)[(_a)/4]); \
+ *(_p) = CMIC_SWAP32(_data); \
+ } while(0)
+
+#define DEV_WRITE32(_d, _a, _v) \
+ do { \
+ uint32_t _data = CMIC_SWAP32(_v); \
+ ((volatile uint32_t *)(_d)->base_addr)[(_a)/4] = (_data); \
+ } while(0)
+
+#else
+
#define DEV_READ32(_d, _a, _p) \
do { \
*(_p) = (((volatile uint32_t *)(_d)->base_addr)[(_a)/4]); \
@@ -536,6 +670,8 @@ typedef struct bkn_switch_info_s {
((volatile uint32_t *)(_d)->base_addr)[(_a)/4] = (_v); \
} while(0)
+#endif /* defined(CMIC_SOFT_BYTE_SWAP) */
+
#define MEMORY_BARRIER mb()
/* Default random MAC address has Broadcom OUI with local admin bit set */
@@ -555,6 +691,7 @@ typedef struct bkn_priv_s {
int id;
int type;
int port;
+ uint8_t itmh[4];
int qnum;
uint32_t vlan;
uint32_t flags;
@@ -1305,8 +1442,8 @@ bkn_clean_tx_dcbs(bkn_switch_info_t *sinfo)
{
bkn_desc_info_t *desc;
- DBG_DCB(("Cleaning Tx DCBs (%d %d).\n",
- sinfo->tx.cur, sinfo->tx.dirty));
+ DBG_DCB_TX(("Cleaning Tx DCBs (%d %d).\n",
+ sinfo->tx.cur, sinfo->tx.dirty));
while (sinfo->tx.free < MAX_TX_DCBS) {
desc = &sinfo->tx.desc[sinfo->tx.dirty];
if (desc->skb != NULL) {
@@ -1325,8 +1462,8 @@ bkn_clean_tx_dcbs(bkn_switch_info_t *sinfo)
sinfo->tx.free++;
}
sinfo->tx.api_active = 0;
- DBG_DCB(("Cleaned Tx DCBs (%d %d).\n",
- sinfo->tx.cur, sinfo->tx.dirty));
+ DBG_DCB_TX(("Cleaned Tx DCBs (%d %d).\n",
+ sinfo->tx.cur, sinfo->tx.dirty));
}
static void
@@ -1334,8 +1471,8 @@ bkn_clean_rx_dcbs(bkn_switch_info_t *sinfo, int chan)
{
bkn_desc_info_t *desc;
- DBG_DCB(("Cleaning Rx%d DCBs (%d %d).\n",
- chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty));
+ DBG_DCB_RX(("Cleaning Rx%d DCBs (%d %d).\n",
+ chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty));
while (sinfo->rx[chan].free) {
desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty];
if (desc->skb != NULL) {
@@ -1355,8 +1492,8 @@ bkn_clean_rx_dcbs(bkn_switch_info_t *sinfo, int chan)
}
sinfo->rx[chan].running = 0;
sinfo->rx[chan].api_active = 0;
- DBG_DCB(("Cleaned Rx%d DCBs (%d %d).\n",
- chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty));
+ DBG_DCB_RX(("Cleaned Rx%d DCBs (%d %d).\n",
+ chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty));
}
static void
@@ -1404,8 +1541,8 @@ bkn_init_dcbs(bkn_switch_info_t *sinfo)
sinfo->halt_addr[XGS_DMA_TX_CHAN] = sinfo->tx.desc[0].dcb_dma;
sinfo->tx.free = MAX_TX_DCBS;
- DBG_DCB(("Tx DCBs @ 0x%08x.\n",
- (uint32_t)sinfo->tx.desc[0].dcb_dma));
+ DBG_DCB_TX(("Tx DCBs @ 0x%08x.\n",
+ (uint32_t)sinfo->tx.desc[0].dcb_dma));
for (chan = 0; chan < NUM_RX_CHAN; chan++) {
for (idx = 0; idx < (MAX_RX_DCBS + 1); idx++) {
@@ -1425,29 +1562,37 @@ bkn_init_dcbs(bkn_switch_info_t *sinfo)
sinfo->halt_addr[XGS_DMA_RX_CHAN + chan] = sinfo->rx[chan].desc[MAX_RX_DCBS].dcb_dma;
sinfo->rx[chan].free = 0;
- DBG_DCB(("Rx%d DCBs @ 0x%08x.\n",
- chan, (uint32_t)sinfo->rx[chan].desc[0].dcb_dma));
+ DBG_DCB_RX(("Rx%d DCBs @ 0x%08x.\n",
+ chan, (uint32_t)sinfo->rx[chan].desc[0].dcb_dma));
}
}
static void
-bkn_dump_dcb(char *prefix, uint32_t *dcb, int wsize)
+bkn_dump_dcb(char *prefix, uint32_t *dcb, int wsize, int txrx)
{
- DBG_DCB(("%s: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x ... 0x%08x\n", prefix,
- dcb[0], dcb[1], dcb[2], dcb[3], dcb[4], dcb[5], dcb[wsize - 1]));
+ if (XGS_DMA_TX_CHAN == txrx) {
+ DBG_DCB_TX(("%s: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x ... 0x%08x\n",
+ prefix, dcb[0], dcb[1], dcb[2], dcb[3], dcb[4], dcb[5],
+ dcb[wsize - 1]));
+ } else {
+ DBG_DCB_RX(("%s: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x ... 0x%08x\n",
+ prefix, dcb[0], dcb[1], dcb[2], dcb[3], dcb[4], dcb[5],
+ dcb[wsize - 1]));
+ }
}
static void
-bkn_dump_pkt(uint8_t *data, int size)
+bkn_dump_pkt(uint8_t *data, int size, int txrx)
{
int idx;
char str[128];
- if ((debug & DBG_LVL_PDMP) == 0) {
+ if (!(debug & DBG_LVL_PDMP) &&
+ !(txrx == XGS_DMA_TX_CHAN && debug & DBG_LVL_PDMP_TX) &&
+ !(txrx == XGS_DMA_RX_CHAN && debug & DBG_LVL_PDMP_RX)) {
return;
}
-
- size = 32;
+ size =32;
for (idx = 0; idx < size; idx++) {
if ((idx & 0xf) == 0) {
@@ -1515,9 +1660,9 @@ bkn_api_rx_restart(bkn_switch_info_t *sinfo)
}
sinfo->rx[chan].api_dcb_chain = dcb_chain;
sinfo->rx[chan].api_active = 1;
- DBG_DCB(("Start API Rx DMA, first DCB @ 0x%08x (%d DCBs).\n",
- (uint32_t)dcb_chain->dcb_dma, dcb_chain->dcb_cnt));
if (start_dma) {
+ DBG_DCB_RX(("Start API Rx DMA, first DCB @ 0x%08x (%d DCBs).\n",
+ (uint32_t)dcb_chain->dcb_dma, dcb_chain->dcb_cnt));
dev_dma_chan_clear(sinfo, XGS_DMA_RX_CHAN + chan);
dev_irq_mask_enable(sinfo, XGS_DMA_RX_CHAN + chan, 1);
dev_dma_chan_start(sinfo, XGS_DMA_RX_CHAN + chan,
@@ -1531,7 +1676,7 @@ bkn_api_rx_restart(bkn_switch_info_t *sinfo)
static void
bkn_api_rx_chain_done(bkn_switch_info_t *sinfo, int chan)
{
- DBG_DCB(("API Rx DMA chain done\n"));
+ DBG_DCB_RX(("API Rx DMA chain done\n"));
if (!CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) {
sinfo->rx[chan].api_active = 0;
@@ -1541,6 +1686,10 @@ bkn_api_rx_chain_done(bkn_switch_info_t *sinfo, int chan)
sinfo->rx[chan].api_dcb_chain = NULL;
}
bkn_api_rx_restart(sinfo);
+ if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) &&
+ sinfo->rx[chan].api_dcb_chain == NULL) {
+ sinfo->rx[chan].api_active = 0;
+ }
}
static int
@@ -1646,8 +1795,8 @@ bkn_rx_refill(bkn_switch_info_t *sinfo, int chan)
skb_reserve(skb, RCPU_RX_ENCAP_SIZE);
desc->skb = skb;
} else {
- DBG_DCB(("Refill Rx%d SKB in DCB %d recycled.\n",
- chan, sinfo->rx[chan].cur));
+ DBG_DCB_RX(("Refill Rx%d SKB in DCB %d recycled.\n",
+ chan, sinfo->rx[chan].cur));
}
skb = desc->skb;
desc->dma_size = rx_buffer_size;
@@ -1668,8 +1817,8 @@ bkn_rx_refill(bkn_switch_info_t *sinfo, int chan)
desc->skb_dma = DMA_MAP_SINGLE(sinfo->dma_dev,
skb->data, desc->dma_size,
DMA_FROMDEV);
- DBG_DCB(("Refill Rx%d DCB %d (0x%08x).\n",
- chan, sinfo->rx[chan].cur, (uint32_t)desc->skb_dma));
+ DBG_DCB_RX(("Refill Rx%d DCB %d (0x%08x).\n",
+ chan, sinfo->rx[chan].cur, (uint32_t)desc->skb_dma));
dcb = desc->dcb_mem;
memset(dcb, 0, sizeof(uint32_t) * sinfo->dcb_wsize);
dcb[0] = desc->skb_dma;
@@ -1710,8 +1859,8 @@ bkn_rx_restart(bkn_switch_info_t *sinfo, int chan)
desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty];
sinfo->rx[chan].chain_complete = 0;
- DBG_DCB(("Restart Rx%d DMA, DCB @ 0x%08x (%d).\n",
- chan, (uint32_t)desc->dcb_dma, sinfo->rx[chan].dirty));
+ DBG_DCB_RX(("Restart Rx%d DMA, DCB @ 0x%08x (%d).\n",
+ chan, (uint32_t)desc->dcb_dma, sinfo->rx[chan].dirty));
dev_dma_chan_clear(sinfo, XGS_DMA_RX_CHAN + chan);
dev_irq_mask_enable(sinfo, XGS_DMA_RX_CHAN + chan, 1);
dev_dma_chan_start(sinfo, XGS_DMA_RX_CHAN + chan, desc->dcb_dma);
@@ -1733,8 +1882,8 @@ bkn_tx_dma_start(bkn_switch_info_t *sinfo)
desc = &sinfo->tx.desc[sinfo->tx.cur];
if (sinfo->tx.free == MAX_TX_DCBS) {
if (!sinfo->tx.api_active) {
- DBG_DCB(("Start Tx DMA, DCB @ 0x%08x (%d).\n",
- (uint32_t)desc->dcb_dma, sinfo->tx.cur));
+ DBG_DCB_TX(("Start Tx DMA, DCB @ 0x%08x (%d).\n",
+ (uint32_t)desc->dcb_dma, sinfo->tx.cur));
dev_dma_chan_clear(sinfo, XGS_DMA_TX_CHAN);
dev_irq_mask_enable(sinfo, XGS_DMA_TX_CHAN, 1);
dev_dma_chan_start(sinfo, XGS_DMA_TX_CHAN, desc->dcb_dma);
@@ -1787,7 +1936,7 @@ bkn_dma_abort_tx(bkn_switch_info_t *sinfo)
dev_dma_chan_abort(sinfo, XGS_DMA_TX_CHAN, 10000);
if (sinfo->tx.api_dcb_chain) {
- DBG_DCB(("Freeing active Tx DCB chain.\n"));
+ DBG_DCB_TX(("Freeing active Tx DCB chain.\n"));
kfree(sinfo->tx.api_dcb_chain);
sinfo->tx.api_dcb_chain = NULL;
}
@@ -1795,7 +1944,7 @@ bkn_dma_abort_tx(bkn_switch_info_t *sinfo)
dcb_chain = list_entry(sinfo->tx.api_dcb_list.next,
bkn_dcb_chain_t, list);
list_del(&dcb_chain->list);
- DBG_DCB(("Freeing Tx DCB chain.\n"));
+ DBG_DCB_TX(("Freeing Tx DCB chain.\n"));
kfree(dcb_chain);
}
sinfo->tx.api_dcb_chain_end = NULL;
@@ -1815,7 +1964,7 @@ bkn_dma_abort_rx(bkn_switch_info_t *sinfo, int chan)
dev_dma_chan_abort(sinfo, XGS_DMA_RX_CHAN + chan, 10000);
if (sinfo->rx[chan].api_dcb_chain) {
- DBG_DCB(("Freeing active Rx%d DCB chain.\n", chan));
+ DBG_DCB_RX(("Freeing active Rx%d DCB chain.\n", chan));
kfree(sinfo->rx[chan].api_dcb_chain);
sinfo->rx[chan].api_dcb_chain = NULL;
}
@@ -1823,7 +1972,7 @@ bkn_dma_abort_rx(bkn_switch_info_t *sinfo, int chan)
dcb_chain = list_entry(sinfo->rx[chan].api_dcb_list.next,
bkn_dcb_chain_t, list);
list_del(&dcb_chain->list);
- DBG_DCB(("Freeing Rx%d DCB chain.\n", chan));
+ DBG_DCB_RX(("Freeing Rx%d DCB chain.\n", chan));
kfree(dcb_chain);
}
sinfo->rx[chan].api_dcb_chain_end = NULL;
@@ -1993,6 +2142,329 @@ bkn_eth_type_update(struct sk_buff *skb, int ethertype)
#endif
}
+
+
+#define BKN_DNX_BIT(x) (1<<(x))
+#define BKN_DNX_RBIT(x) (~(1<<(x)))
+#ifdef __LITTLE_ENDIAN
+#define BKN_DNX_BYTE_SWAP(x) (x)
+#else
+#define BKN_DNX_BYTE_SWAP(x) ((((x) << 24)) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) >> 24)))
+#endif
+static int
+device_is_dune(bkn_switch_info_t *sinfo)
+{
+ int is_dune = 0;
+
+ is_dune = (sinfo->dcb_type == 28) ? 1 : 0;
+ return is_dune;
+}
+static int
+packet_is_untagged(uint16_t tpid)
+{
+ int is_untagged = 0;
+
+ /* Fixme SDK-111398 */
+ /* 0x8100 is used in 802.1Q */
+ /* 0x8848 is used in 802.11ad, the dtag tpid can be set to anything besides 0x8848, 0x9100 is a typical value, but couldn't cover all scenarios. */
+ is_untagged = ((tpid != 0x8100) && (tpid != 0x8848) && (tpid != 0x9100));
+ return is_untagged;
+}
+
+static void
+bkn_dnx_bitstream_set_field(uint32_t *input_buffer, uint32_t start_bit, uint32_t nof_bits, uint32_t field)
+{
+ uint32_t place;
+ uint32_t field_bit_i;
+ uint32_t bit_indicator;
+
+ if( nof_bits > 32)
+ {
+ return;
+ }
+
+ for( place=start_bit, field_bit_i = 0; field_bit_i< nof_bits; ++place, ++field_bit_i)
+ {
+ bit_indicator = field & BKN_DNX_BIT(nof_bits-field_bit_i-1);
+ if(bit_indicator)
+ {
+ input_buffer[place>>5] |= (0x80000000 >> (place & 0x0000001F));
+ }
+ else
+ {
+ input_buffer[place>>5] &= ~(0x80000000 >> (place & 0x0000001F));
+ }
+ }
+ return;
+}
+
+static void
+bkn_dnx_bitstream_get_field(uint8_t *input_buffer, uint32_t start_bit, uint32_t nof_bits, uint32_t *output_value)
+{
+ uint32_t idx;
+ uint32_t buf_sizes=0;
+ uint32_t tmp_output_value[2]={0};
+ uint32_t first_byte_ndx;
+ uint32_t last_byte_ndx;
+ uint32_t place;
+ uint32_t field_bit_i;
+ uint8_t *tmp_output_value_u8_ptr = (uint8_t*)&tmp_output_value;
+ uint32_t bit_indicator;
+
+ if (nof_bits > 32)
+ {
+ return;
+ }
+
+ first_byte_ndx = start_bit / 8;
+ last_byte_ndx = ((start_bit + nof_bits - 1) / 8);
+ *output_value=0;
+
+ /* get 32 bit value, MSB */
+ for (idx = first_byte_ndx; idx <= last_byte_ndx; ++idx)
+ {
+ tmp_output_value_u8_ptr[last_byte_ndx - idx] = input_buffer[idx];
+ buf_sizes += 8;
+ }
+ tmp_output_value[0] = BKN_DNX_BYTE_SWAP(tmp_output_value[0]);
+ if (last_byte_ndx > 4)
+ {
+ tmp_output_value[1] = BKN_DNX_BYTE_SWAP(tmp_output_value[1]);
+ }
+
+ place = buf_sizes - (start_bit % 8 + nof_bits);
+ for (field_bit_i = 0; field_bit_i< nof_bits; ++place, ++field_bit_i)
+ {
+ uint32_t result;
+ result = tmp_output_value[place>>5] & BKN_DNX_BIT(place & 0x0000001F);
+ if (result)
+ {
+ bit_indicator = 1;
+ } else {
+ bit_indicator = 0;
+ }
+ *output_value |= bit_indicator << field_bit_i;
+ }
+ return;
+}
+
+static void
+bkn_dnx_packet_parse_ftmh(uint8_t hdr_buff[], bkn_dnx_packet_info *packet_info)
+{
+ uint32_t header_ptr = 0;
+ uint32_t dsp_ext_exist=0;
+ uint32_t fld_val;
+
+ header_ptr = packet_info->ntwrk_header_ptr;
+
+ /* Packet-size */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_FTMH_PKT_SIZE_MSB,
+ BKN_DNX_FTMH_PKT_SIZE_NOF_BITS,
+ &fld_val);
+ packet_info->ftmh.packet_size = fld_val;
+ /* Traffic-class */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_FTMH_TC_MSB,
+ BKN_DNX_FTMH_TC_NOF_BITS,
+ &fld_val);
+ packet_info->ftmh.prio = fld_val;
+ /* Source-system-port-aggregate */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_FTMH_SRC_SYS_PORT_MSB,
+ BKN_DNX_FTMH_SRC_SYS_PORT_NOF_BITS,
+ &fld_val);
+ packet_info->ftmh.src_sys_port = fld_val;
+ /* TM-action-type */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_FTMH_ACTION_TYPE_MSB,
+ BKN_DNX_FTMH_ACTION_TYPE_NOF_BITS,
+ &fld_val);
+ packet_info->ftmh.action_type = fld_val;
+ /* PPH-type */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_FTMH_PPH_TYPE_MSB,
+ BKN_DNX_FTMH_PPH_TYPE_NOF_BITS,
+ &fld_val);
+ packet_info->ftmh.pph_type = fld_val;
+
+ packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_SIZE_BYTE;
+ DBG_DUNE(("FTMH(%d) Packet-size %d Action-type %d PPH-type %d Source-system-port 0x%x Traffic-class %d\n",
+ packet_info->ntwrk_header_ptr, packet_info->ftmh.packet_size, packet_info->ftmh.action_type,
+ packet_info->ftmh.pph_type, packet_info->ftmh.src_sys_port, packet_info->ftmh.prio));
+
+ /* LB-Key ext */
+ if (ftmh_lb_key_ext)
+ {
+ packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_LB_EXT_SIZE_BYTE;
+ DBG_DUNE(("FTMH(%d) FTMH LB-Key Extension is present\n", packet_info->ntwrk_header_ptr));
+ }
+ /* DSP ext*/
+ fld_val = 0;
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_FTMH_EXT_DSP_EXIST_MSB,
+ BKN_DNX_FTMH_EXT_DSP_EXIST_NOF_BITS,
+ &dsp_ext_exist);
+ if (dsp_ext_exist)
+ {
+ packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_DEST_EXT_SIZE_BYTE;
+ DBG_DUNE(("FTMH(%d) DSP Extension is present\n", packet_info->ntwrk_header_ptr));
+ }
+ /* stacking ext */
+ if (ftmh_stacking_ext)
+ {
+ packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_STACKING_SIZE_BYTE;
+ DBG_DUNE(("FTMH(%d) FTMH Stacking Extension is present\n", packet_info->ntwrk_header_ptr));
+ }
+ return;
+}
+
+static void
+bkn_dnx_packet_parse_internal(uint8_t hdr_buff[], bkn_dnx_packet_info *packet_info)
+{
+ uint32_t header_ptr = 0;
+ uint32_t fld_val;
+ uint32_t eei_extension_present = 0;
+ uint32_t learn_extension_present = 0;
+ uint32_t fhei_size = 0;
+ uint32_t forward_code;
+ uint8_t is_trapped = 0;
+
+ header_ptr = packet_info->ntwrk_header_ptr;
+
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_EEI_EXTENSION_PRESENT_MSB,
+ BKN_DNX_PPH_EEI_EXTENSION_PRESENT_NOF_BITS,
+ &eei_extension_present);
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_LEARN_EXENSION_PRESENT_MSB,
+ BKN_DNX_PPH_LEARN_EXENSION_PRESENT_NOF_BITS,
+ &learn_extension_present);
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_FHEI_SIZE_MSB,
+ BKN_DNX_PPH_FHEI_SIZE_NOF_BITS,
+ &fhei_size);
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_FORWARD_CODE_MSB,
+ BKN_DNX_PPH_FORWARD_CODE_NOF_BITS,
+ &forward_code);
+ /* 7: CPU-Trap */
+ is_trapped = (uint8_t)(forward_code == 7);
+
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_VSI_MSB,
+ BKN_DNX_PPH_VSI_NOF_BITS,
+ &fld_val);
+ packet_info->internal.vsi = fld_val;
+
+ /* size of PPH base is 7 */
+ packet_info->ntwrk_header_ptr += BKN_DNX_PPH_SIZE_BYTE;
+ header_ptr = packet_info->ntwrk_header_ptr;
+
+ DBG_DUNE(("PPH(%d) Forward-Code %d EEI-Extension %d Learn-Extension %d VSI %d FHEI-size %d\n", packet_info->ntwrk_header_ptr,
+ forward_code, eei_extension_present, learn_extension_present, packet_info->internal.vsi, fhei_size));
+
+ /* PPH extension */
+ if (is_trapped && (fhei_size == 1))
+ {
+ /* CPU trap code qualifier */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_MSB,
+ BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_NOF_BITS,
+ &fld_val);
+ packet_info->internal.trap_qualifier = fld_val;
+ /* CPU trap code */
+ bkn_dnx_bitstream_get_field(
+ &hdr_buff[header_ptr],
+ BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_MSB,
+ BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_NOF_BITS,
+ &fld_val);
+ packet_info->internal.trap_id = fld_val;
+ }
+ switch(fhei_size) {
+ case 1:
+ packet_info->ntwrk_header_ptr += BKN_DNX_PPH_FHEI_3B_SIZE_BYTE;
+ break;
+ case 2:
+ packet_info->ntwrk_header_ptr += BKN_DNX_PPH_FHEI_5B_SIZE_BYTE;
+ break;
+ case 3:
+ packet_info->ntwrk_header_ptr += BKN_DNX_PPH_FHEI_8B_SIZE_BYTE;
+ break;
+ default:
+ break;
+ }
+ if (eei_extension_present) {
+ packet_info->ntwrk_header_ptr += BKN_DNX_PPH_EXPLICIT_EDITING_INFOMATION_EXTENSION_SIZE_BYTE;
+ }
+ if (learn_extension_present) {
+ packet_info->ntwrk_header_ptr += BKN_DNX_PPH_LEARN_EXTENSION_SIZE_BYTE;
+ }
+
+ DBG_DUNE(("FHEI(%d) trap_qualifier 0x%x trap_id 0x%x\n", packet_info->ntwrk_header_ptr, packet_info->internal.trap_qualifier, packet_info->internal.trap_id));
+ return;
+}
+
+static int
+bkn_dnx_packet_header_parse(uint8 *buff, uint32_t buff_len, bkn_dnx_packet_info *packet_info)
+{
+ uint8_t hdr_buff[BKN_DNX_HDR_MAX_SIZE];
+ uint32_t hdr_size;
+ uint8_t has_internal = 0;
+
+ if ((buff == NULL) || (packet_info == NULL)) {
+ return -1;
+ }
+ hdr_size = buff_len < BKN_DNX_HDR_MAX_SIZE ? buff_len: BKN_DNX_HDR_MAX_SIZE;
+ memcpy(hdr_buff, buff, hdr_size);
+
+ /* FTMH */
+ bkn_dnx_packet_parse_ftmh(hdr_buff, packet_info);
+ if (packet_info->ftmh.packet_size != (buff_len + 2)) {
+ DBG_DUNE(("FTMH packet size verfication failed, %d-%d\n", packet_info->ftmh.packet_size, buff_len));
+ memset(packet_info, 0, sizeof(bkn_dnx_packet_info));
+ return -1;
+ }
+ switch (packet_info->ftmh.pph_type) {
+ case 0:
+ has_internal = 0;
+ break;
+ case 1:
+ has_internal = 1;
+ break;
+ case 2: /* PPH OAM-TS only */
+ case 3: /* PPH Base + OAM-TS */
+ /* OTSH immediately follows the FTMH when present */
+ packet_info->ntwrk_header_ptr += 6;
+ DBG_DUNE(("FTMH + OAM-TS(%d)\n", packet_info->ntwrk_header_ptr));
+ has_internal = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (has_internal) {
+ bkn_dnx_packet_parse_internal(&hdr_buff[0], packet_info);
+ }
+
+ /* FIXME: */
+ /* ignore packets with a double set of FTMH,internals */
+ /* ignore the user header size */
+ return 0;
+}
+
static int
bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
{
@@ -2008,7 +2480,7 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
int drop_api;
int idx;
int dcbs_done;
-
+ bkn_dnx_packet_info packet_info = {0};
dcbs_done = 0;
dcb_chain = sinfo->rx[chan].api_dcb_chain;
@@ -2033,6 +2505,9 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
dcb[sinfo->dcb_wsize - 1] |= SOC_DCB_KNET_DONE;
bkn_api_rx_chain_done(sinfo, chan);
dcb_chain = sinfo->rx[chan].api_dcb_chain;
+ if (dcb_chain == NULL) {
+ break;
+ }
continue;
}
}
@@ -2041,7 +2516,50 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
}
sinfo->rx[chan].pkts++;
pkt = (uint8_t *)kernel_bde->p2l(sinfo->dev_no, dcb[0]);
- bkn_dump_pkt(pkt, 32);
+ pktlen = dcb[sinfo->dcb_wsize-1] & SOC_DCB_KNET_COUNT_MASK;
+ bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN);
+
+ if (device_is_dune(sinfo)) {
+ uint16_t tpid = 0;
+ uint16_t vid = 0;
+ int res = -1;
+
+ memset(&packet_info, 0, sizeof(bkn_dnx_packet_info));
+ res = bkn_dnx_packet_header_parse(pkt, (uint32_t)pktlen, &packet_info);
+ if (res == 0) {
+ if (packet_info.ftmh.action_type == 0x2) {
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 192, 32, 0x8);
+ } else if (packet_info.ftmh.action_type == 0x1) {
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 231, 25, 0x20);
+ }
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 112, 16, packet_info.ftmh.src_sys_port);
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 296, 12, packet_info.internal.vsi);
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 64, 32, (packet_info.internal.trap_id << 16 | packet_info.internal.trap_qualifier));
+ pkt += packet_info.ntwrk_header_ptr;
+ pktlen -= packet_info.ntwrk_header_ptr;
+ bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN);
+ /* check if vlan tag exists */
+ tpid = (uint16_t)((pkt[12] << 8) | pkt[13]);
+ vid = (uint16_t)(packet_info.internal.vsi & 0xfff);
+ if (packet_is_untagged(tpid)) {
+ if ((pktlen + 4) < rx_buffer_size) {
+ DBG_DUNE(("add vlan tag (%d) to untagged packets\n", vid));
+ for (idx = (pktlen-1); idx >= 12; idx--) {
+ pkt[idx+4] = pkt[idx];
+ }
+ pkt[12] = 0x81;
+ pkt[13] = 0x00;
+ pkt[14] = (vid >> 8);
+ pkt[15] = (vid & 0xff);
+ /* reset packet length in DCB */
+ pktlen += 4;
+ dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK;
+ dcb[sinfo->dcb_wsize-1] |= ((pktlen + packet_info.ntwrk_header_ptr) & SOC_DCB_KNET_COUNT_MASK);
+ bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN);
+ }
+ }
+ }
+ }
filter = bkn_match_rx_pkt(sinfo, dcb, pkt, chan, &cbf);
if ((dcb[sinfo->dcb_wsize-1] & 0x70000) != 0x30000) {
/* Fragment or error */
@@ -2068,8 +2586,6 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
break;
}
- pktlen = dcb[sinfo->dcb_wsize-1] & SOC_DCB_KNET_COUNT_MASK;
-
/* Add 2 bytes for IP header alignment (see below) */
skb = dev_alloc_skb(pktlen + RCPU_RX_ENCAP_SIZE + 2);
if (skb == NULL) {
@@ -2086,18 +2602,41 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
/* Save for RCPU before stripping tag */
ethertype = (pkt[16] << 8) | pkt[17];
-
- if (filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) {
- /* Strip the VLAN tag */
- DBG_FLTR(("Strip VLAN tag\n"));
- for (idx = 11; idx >= 0; idx--) {
- pkt[idx+4] = pkt[idx];
+ if ((priv->flags & KCOM_NETIF_F_KEEP_RX_TAG) == 0) {
+ if (filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) {
+ /* Strip the VLAN tag */
+ uint16_t vlan_proto = (uint16_t)((pkt[12] << 8) | pkt[13]);
+ if (vlan_proto == 0x8100 || vlan_proto == 0x88a8) {
+ DBG_FLTR(("Strip VLAN tag\n"));
+ for (idx = 11; idx >= 0; idx--) {
+ pkt[idx+4] = pkt[idx];
+ }
+ pktlen -= 4;
+ pkt += 4;
+ }
+ } else {
+ /*
+ * Mark packet as VLAN-tagged, otherwise newer
+ * kernels will strip the tag.
+ */
+ uint16_t tci = (pkt[14] << 8) | pkt[15];
+
+ if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) {
+ bkn_vlan_hwaccel_put_tag(skb, ETH_P_8021Q, tci);
+ } else {
+ bkn_vlan_hwaccel_put_tag(skb,
+ ((skb->data[12] << 8) | skb->data[13]), tci);
+ }
}
- pktlen -= 4;
- pkt += 4;
}
+
skb_copy_to_linear_data(skb, pkt, pktlen);
- skb_put(skb, pktlen - 4); /* Strip CRC */
+ if (device_is_dune(sinfo)) {
+ /* CRC has been stripped */
+ skb_put(skb, pktlen);
+ } else {
+ skb_put(skb, pktlen - 4); /* Strip CRC */
+ }
priv->stats.rx_packets++;
priv->stats.rx_bytes += pktlen;
@@ -2114,14 +2653,14 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) {
bkn_add_rcpu_encap(sinfo, skb, dcb);
}
+ skb->protocol = eth_type_trans(skb, skb->dev);
if (filter->kf.dest_proto) {
skb->protocol = filter->kf.dest_proto;
- } else {
- skb->protocol = eth_type_trans(skb, skb->dev);
}
if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) {
bkn_eth_type_update(skb, ethertype);
}
+ DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol));
/* Unlock while calling up network stack */
spin_unlock(&sinfo->lock);
@@ -2132,7 +2671,9 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget)
}
spin_lock(&sinfo->lock);
- if (filter->kf.mirror_type == KCOM_DEST_T_API) {
+ if (filter->kf.mirror_type == KCOM_DEST_T_API ||
+ dbg_pkt_enable) {
+ DBG_FLTR(("Mirror to Rx API\n"));
sinfo->rx[chan].pkts_m_api++;
drop_api = 0;
}
@@ -2174,6 +2715,8 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget)
int ethertype;
int dcbs_done;
int pktlen;
+ bkn_dnx_packet_info packet_info = {0};
+ int idx;
dcbs_done = 0;
@@ -2187,7 +2730,7 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget)
sprintf(str, "Rx DCB (%d)", sinfo->rx[chan].dirty);
desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty];
dcb = desc->dcb_mem;
- bkn_dump_dcb(str, dcb, sinfo->dcb_wsize);
+ bkn_dump_dcb(str, dcb, sinfo->dcb_wsize, XGS_DMA_RX_CHAN);
if ((dcb[sinfo->dcb_wsize-1] & (1 << 31)) == 0) {
break;
}
@@ -2206,13 +2749,57 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget)
pktlen = dcb[sinfo->dcb_wsize-1] & 0xffff;
priv = netdev_priv(sinfo->dev);
skb = desc->skb;
- DBG_DCB(("Rx%d SKB DMA done (%d).\n", chan, sinfo->rx[chan].dirty));
+ DBG_DCB_RX(("Rx%d SKB DMA done (%d).\n", chan, sinfo->rx[chan].dirty));
DMA_UNMAP_SINGLE(sinfo->dma_dev,
desc->skb_dma, desc->dma_size,
DMA_FROMDEV);
desc->skb_dma = 0;
- bkn_dump_pkt(skb->data, 32);
- filter = bkn_match_rx_pkt(sinfo, dcb, skb->data, chan, &cbf);
+ bkn_dump_pkt(skb->data, 32, XGS_DMA_RX_CHAN);
+ if (device_is_dune(sinfo)) {
+ uint16_t tpid = 0;
+ uint16_t vid = 0;
+ uint8_t *pkt = skb->data;
+ int res = 0;
+
+ memset(&packet_info, 0, sizeof(bkn_dnx_packet_info));
+ res = bkn_dnx_packet_header_parse(pkt, (uint32_t)pktlen, &packet_info);
+ if (res == 0) {
+ if (packet_info.ftmh.action_type == 0x2) {
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 192, 32, 0x8);
+ } else if (packet_info.ftmh.action_type == 0x1) {
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 231, 25, 0x20);
+ }
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 112, 16, packet_info.ftmh.src_sys_port);
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 296, 12, packet_info.internal.vsi);
+ bkn_dnx_bitstream_set_field((uint32_t *)dcb, 64, 32, (packet_info.internal.trap_id << 16 | packet_info.internal.trap_qualifier));
+ pkt = skb->data + packet_info.ntwrk_header_ptr;
+ /* check if vlan tag exists */
+ tpid = (uint16_t)((pkt[12] << 8) | pkt[13]);
+ vid = (uint16_t)(packet_info.internal.vsi & 0xfff);
+ if (packet_is_untagged(tpid)) {
+ if ((pktlen + 4) < rx_buffer_size) {
+ DBG_DUNE(("add vlan tag to untagged packets\n"));
+ for (idx = (pktlen-packet_info.ntwrk_header_ptr-1); idx >= 12; idx--) {
+ pkt[idx+4] = pkt[idx];
+ }
+ pkt[12] = 0x81;
+ pkt[13] = 0x00;
+ pkt[14] = (vid >> 8);
+ pkt[15] = (vid & 0xff);
+ pktlen += 4;
+ /* reset packet length in DCB */
+ dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK;
+ dcb[sinfo->dcb_wsize-1] |= (pktlen & SOC_DCB_KNET_COUNT_MASK);
+ bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN);
+ }
+ }
+ }
+ }
+ if (device_is_dune(sinfo)) {
+ filter = bkn_match_rx_pkt(sinfo, dcb, (skb->data + packet_info.ntwrk_header_ptr), chan, &cbf);
+ } else {
+ filter = bkn_match_rx_pkt(sinfo, dcb, skb->data, chan, &cbf);
+ }
if ((dcb[sinfo->dcb_wsize-1] & 0x70000) == 0x30000) {
DBG_PKT(("Rx packet (%d bytes).\n", pktlen));
} else {
@@ -2239,25 +2826,54 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget)
sinfo->rx[chan].pkts_d_no_link++;
break;
}
-
DBG_FLTR(("Send to netif %d (%s)\n",
priv->id, priv->dev->name));
sinfo->rx[chan].pkts_f_netif++;
- skb_put(skb, pktlen - 4); /* Strip CRC */
+ if (device_is_dune(sinfo)) {
+ if (filter->kf.mirror_type == KCOM_DEST_T_API) {
+ sinfo->rx[chan].pkts_m_api++;
+ bkn_api_rx_copy_from_skb(sinfo, chan, desc);
+ }
+ /* Strip Dune headers */
+ skb->data += packet_info.ntwrk_header_ptr;
+ pktlen -= packet_info.ntwrk_header_ptr;
+ bkn_dump_pkt(skb->data, 32, XGS_DMA_RX_CHAN);
+ /* CRC has been stripped on Dune*/
+ skb_put(skb, pktlen);
+ } else {
+ skb_put(skb, pktlen - 4); /* Strip CRC */
+ }
/* Save for RCPU before stripping tag */
ethertype = (skb->data[16] << 8) | skb->data[17];
- if (filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) {
- /* Strip VLAN tag */
- DBG_FLTR(("Strip VLAN tag\n"));
- ((u32*)skb->data)[3] = ((u32*)skb->data)[2];
- ((u32*)skb->data)[2] = ((u32*)skb->data)[1];
- ((u32*)skb->data)[1] = ((u32*)skb->data)[0];
- skb_pull(skb, 4);
- pktlen -= 4;
- }
+ if ((priv->flags & KCOM_NETIF_F_KEEP_RX_TAG) == 0) {
+ if (filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) {
+ /* Strip VLAN tag */
+ uint16_t vlan_proto = (uint16_t)((skb->data[12] << 8) | skb->data[13]);
+ if (vlan_proto == 0x8100 || vlan_proto == 0x88a8) {
+ DBG_FLTR(("Strip VLAN tag\n"));
+ ((u32*)skb->data)[3] = ((u32*)skb->data)[2];
+ ((u32*)skb->data)[2] = ((u32*)skb->data)[1];
+ ((u32*)skb->data)[1] = ((u32*)skb->data)[0];
+ skb_pull(skb, 4);
+ pktlen -= 4;
+ }
+ } else {
+ /*
+ * Mark packet as VLAN-tagged, otherwise newer
+ * kernels will strip the tag.
+ */
+ uint16_t tci = (skb->data[14] << 8) | skb->data[15];
+ if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) {
+ bkn_vlan_hwaccel_put_tag(skb, ETH_P_8021Q, tci);
+ } else {
+ bkn_vlan_hwaccel_put_tag(skb,
+ ((skb->data[12] << 8) | skb->data[13]), tci);
+ }
+ }
+ }
priv->stats.rx_packets++;
priv->stats.rx_bytes += pktlen;
skb->dev = priv->dev;
@@ -2275,23 +2891,23 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget)
}
}
- if (filter->kf.mirror_type == KCOM_DEST_T_API) {
+ if (((filter->kf.mirror_type == KCOM_DEST_T_API) &&
+ (!device_is_dune(sinfo))) || dbg_pkt_enable) {
sinfo->rx[chan].pkts_m_api++;
bkn_api_rx_copy_from_skb(sinfo, chan, desc);
}
-
+
if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) {
bkn_add_rcpu_encap(sinfo, skb, dcb);
}
+ skb->protocol = eth_type_trans(skb, skb->dev);
if (filter->kf.dest_proto) {
skb->protocol = filter->kf.dest_proto;
- } else {
- skb->protocol = eth_type_trans(skb, skb->dev);
}
if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) {
bkn_eth_type_update(skb, ethertype);
}
-
+ DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol));
if (filter->kf.mirror_type == KCOM_DEST_T_NETIF) {
bkn_priv_t *mpriv;
struct sk_buff *mskb;
@@ -2392,8 +3008,6 @@ bkn_rx_chain_done(bkn_switch_info_t *sinfo, int chan)
{
DBG_IRQ(("Rx%d chain done\n", chan));
- sinfo->rx[chan].running = 0;
-
if (sinfo->rx[chan].chain_complete == 0) {
/*
* In certain environments the DCB memory is updated after
@@ -2403,12 +3017,16 @@ bkn_rx_chain_done(bkn_switch_info_t *sinfo, int chan)
*/
int maxloop = 0;
while (sinfo->rx[chan].chain_complete == 0) {
- if (bkn_do_rx(sinfo, chan, MAX_RX_DCBS) > 0) {
- bkn_rx_desc_done(sinfo, chan);
- }
+ sinfo->rx[chan].sync_retry++;
if (maxloop == 0) {
sinfo->rx[chan].sync_err++;
}
+ if (maxloop > sinfo->rx[chan].sync_maxloop) {
+ sinfo->rx[chan].sync_maxloop = maxloop;
+ }
+ if (bkn_do_rx(sinfo, chan, MAX_RX_DCBS) > 0) {
+ bkn_rx_desc_done(sinfo, chan);
+ }
if (++maxloop > rx_sync_retry) {
gprintk("Fatal error: Incomplete chain\n");
sinfo->rx[chan].chain_complete = 1;
@@ -2417,6 +3035,8 @@ bkn_rx_chain_done(bkn_switch_info_t *sinfo, int chan)
}
}
+ sinfo->rx[chan].running = 0;
+
if (sinfo->rx[chan].use_rx_skb == 0) {
bkn_api_rx_chain_done(sinfo, chan);
} else {
@@ -2439,8 +3059,6 @@ bkn_suspend_tx(bkn_switch_info_t *sinfo)
struct list_head *list;
bkn_priv_t *priv = netdev_priv(sinfo->dev);
- /* Unlock while calling up network stack */
- spin_unlock(&sinfo->lock);
/* Stop main device */
netif_stop_queue(priv->dev);
sinfo->tx.suspends++;
@@ -2449,30 +3067,23 @@ bkn_suspend_tx(bkn_switch_info_t *sinfo)
priv = (bkn_priv_t *)list;
netif_stop_queue(priv->dev);
}
- spin_lock(&sinfo->lock);
}
static void
bkn_resume_tx(bkn_switch_info_t *sinfo)
{
struct list_head *list;
- bkn_priv_t *priv;
+ bkn_priv_t *priv = netdev_priv(sinfo->dev);
/* Check main device */
- if (netif_queue_stopped(sinfo->dev) && sinfo->tx.free > 1) {
- /* Unlock while calling up network stack */
- spin_unlock(&sinfo->lock);
- netif_wake_queue(sinfo->dev);
- spin_lock(&sinfo->lock);
+ if (netif_queue_stopped(priv->dev) && sinfo->tx.free > 1) {
+ netif_wake_queue(priv->dev);
}
/* Check associated virtual devices */
list_for_each(list, &sinfo->ndev_list) {
priv = (bkn_priv_t *)list;
if (netif_queue_stopped(priv->dev) && sinfo->tx.free > 1) {
- /* Unlock while calling up network stack */
- spin_unlock(&sinfo->lock);
netif_wake_queue(priv->dev);
- spin_lock(&sinfo->lock);
}
}
}
@@ -2494,12 +3105,12 @@ bkn_do_tx(bkn_switch_info_t *sinfo)
}
sprintf(str, "Tx DCB (%d)", sinfo->tx.dirty);
desc = &sinfo->tx.desc[sinfo->tx.dirty];
- bkn_dump_dcb(str, desc->dcb_mem, sinfo->dcb_wsize);
+ bkn_dump_dcb(str, desc->dcb_mem, sinfo->dcb_wsize, XGS_DMA_TX_CHAN);
if ((desc->dcb_mem[sinfo->dcb_wsize-1] & (1 << 31)) == 0) {
break;
}
if (desc->skb) {
- DBG_DCB(("Tx SKB DMA done (%d).\n", sinfo->tx.dirty));
+ DBG_DCB_TX(("Tx SKB DMA done (%d).\n", sinfo->tx.dirty));
DMA_UNMAP_SINGLE(sinfo->dma_dev,
desc->skb_dma, desc->dma_size,
DMA_TODEV);
@@ -2544,7 +3155,7 @@ bkn_tx_cdma_chain_switch(bkn_switch_info_t *sinfo)
}
sinfo->tx.free--;
woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize;
- dcb_dma = dcb_chain->dcb_dma + woffset;
+ dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t);
/* DMA run to the new halt location */
bkn_cdma_goto(sinfo, XGS_DMA_TX_CHAN, dcb_dma);
} else {
@@ -2580,8 +3191,8 @@ bkn_api_tx(bkn_switch_info_t *sinfo)
sinfo->tx.pkts++;
dcb_chain = list_entry(sinfo->tx.api_dcb_list.next,
bkn_dcb_chain_t, list);
- DBG_DCB(("Start API Tx DMA, first DCB @ 0x%08x (%d DCBs).\n",
- (uint32_t)dcb_chain->dcb_dma, dcb_chain->dcb_cnt));
+ DBG_DCB_TX(("Start API Tx DMA, first DCB @ 0x%08x (%d DCBs).\n",
+ (uint32_t)dcb_chain->dcb_dma, dcb_chain->dcb_cnt));
if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) {
sinfo->tx.api_dcb_chain = dcb_chain;
@@ -2603,7 +3214,7 @@ bkn_api_tx(bkn_switch_info_t *sinfo)
}
static void
-bkn_tx_cdma_chain_done(bkn_switch_info_t *sinfo)
+bkn_tx_cdma_chain_done(bkn_switch_info_t *sinfo, int done)
{
int woffset;
int dcbs_done = 0;
@@ -2622,7 +3233,7 @@ bkn_tx_cdma_chain_done(bkn_switch_info_t *sinfo)
}
kfree(sinfo->tx.api_dcb_chain);
bkn_api_tx(sinfo);
- if (++dcbs_done >= MAX_TX_DCBS) {
+ if ((++dcbs_done + done) >= MAX_TX_DCBS) {
if (sinfo->napi_poll_mode) {
/* Request one extra poll to reschedule Tx */
sinfo->napi_poll_again = 1;
@@ -2672,7 +3283,7 @@ bkn_tx_chain_done(bkn_switch_info_t *sinfo, int done)
DBG_IRQ(("Tx chain done (%d/%d)\n", sinfo->tx.cur, sinfo->tx.dirty));
if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) {
- return bkn_tx_cdma_chain_done(sinfo);
+ return bkn_tx_cdma_chain_done(sinfo, done);
}
dev_irq_mask_disable(sinfo, XGS_DMA_TX_CHAN, 0);
@@ -2694,18 +3305,18 @@ bkn_tx_chain_done(bkn_switch_info_t *sinfo, int done)
if (sinfo->tx.api_active) {
return;
}
- } else if (done) {
+ } else {
/* If two or more DCBs are pending, chain them */
pending = MAX_TX_DCBS - sinfo->tx.free;
idx = sinfo->tx.dirty;
while (--pending && idx < (MAX_TX_DCBS - 1)) {
sinfo->tx.desc[idx++].dcb_mem[1] |= (1 << 16);
- DBG_DCB(("Chain Tx DCB %d (%d)\n", idx, pending));
+ DBG_DCB_TX(("Chain Tx DCB %d (%d)\n", idx, pending));
}
/* Restart DMA from where we stopped */
desc = &sinfo->tx.desc[sinfo->tx.dirty];
- DBG_DCB(("Restart Tx DMA, DCB @ 0x%08x (%d).\n",
- (uint32_t)desc->dcb_dma, sinfo->tx.dirty));
+ DBG_DCB_TX(("Restart Tx DMA, DCB @ 0x%08x (%d).\n",
+ (uint32_t)desc->dcb_dma, sinfo->tx.dirty));
dev_dma_chan_clear(sinfo, XGS_DMA_TX_CHAN);
dev_irq_mask_enable(sinfo, XGS_DMA_TX_CHAN, 0);
dev_dma_chan_start(sinfo, XGS_DMA_TX_CHAN, desc->dcb_dma);
@@ -2720,18 +3331,16 @@ bkn_schedule_napi_poll(bkn_switch_info_t *sinfo)
{
/* Schedule NAPI poll */
DBG_NAPI(("Schedule NAPI poll on %s.\n", sinfo->dev->name));
+ /* Disable interrupts until poll job is complete */
+ sinfo->napi_poll_mode = 1;
/* Unlock while calling up network stack */
spin_unlock(&sinfo->lock);
if (bkn_napi_schedule_prep(sinfo->dev, &sinfo->napi)) {
__bkn_napi_schedule(sinfo->dev, &sinfo->napi);
DBG_NAPI(("Schedule prep OK on %s.\n", sinfo->dev->name));
- /* Disable interrupts until poll job is complete */
- sinfo->napi_poll_mode = 1;
} else {
/* Most likely the base device is has not been opened */
gprintk("Warning: Unable to schedule NAPI - base device not up?\n");
- /* Disable interrupts to prevent soft lock up */
- sinfo->napi_poll_mode = 1;
}
spin_lock(&sinfo->lock);
}
@@ -2771,6 +3380,7 @@ xgs_do_dma(bkn_switch_info_t *sinfo, int budget)
}
if (dma_stat & DS_CHAIN_DONE_TST(XGS_DMA_TX_CHAN)) {
+ xgs_dma_chain_clear(sinfo, XGS_DMA_TX_CHAN);
tx_dcbs_done = bkn_do_tx(sinfo);
bkn_tx_chain_done(sinfo, tx_dcbs_done);
}
@@ -2813,6 +3423,8 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget)
irq_stat & (0x08000000 << XGS_DMA_TX_CHAN)) {
if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) {
xgsm_dma_desc_clear(sinfo, XGS_DMA_TX_CHAN);
+ } else {
+ xgsm_dma_chain_clear(sinfo, XGS_DMA_TX_CHAN);
}
tx_dcbs_done = bkn_do_tx(sinfo);
bkn_tx_chain_done(sinfo, tx_dcbs_done);
@@ -2882,7 +3494,7 @@ xgsm_isr(bkn_switch_info_t *sinfo)
do {
rx_dcbs_done = xgsm_do_dma(sinfo, MAX_RX_DCBS);
if (sinfo->cdma_channels) {
- if (rx_dcbs_done == MAX_RX_DCBS || sinfo->tx_yield) {
+ if (rx_dcbs_done >= MAX_RX_DCBS || sinfo->tx_yield) {
/* Continuous DMA mode requires to yield timely */
break;
}
@@ -2898,25 +3510,25 @@ bkn_isr(void *isr_data)
{
bkn_switch_info_t *sinfo = isr_data;
+ /* Safe exit on SMP systems */
+ if (!module_initialized) {
+ return;
+ }
+
/* Ensure that we do not touch registers during device reset */
if (sinfo->irq_mask == 0) {
/* Not ours */
return;
}
- /* Safe exit on SMP systems */
- if (!module_initialized) {
- dev_irq_mask_set(sinfo, 0);
- return;
- }
+ spin_lock(&sinfo->lock);
if (sinfo->napi_poll_mode) {
/* Not ours */
+ spin_unlock(&sinfo->lock);
return;
}
- spin_lock(&sinfo->lock);
-
if (DEV_HAS_CMICM(sinfo)) {
xgsm_isr(sinfo);
} else {
@@ -2970,7 +3582,7 @@ bkn_resume_rx(bkn_switch_info_t *sinfo)
if (sinfo->rx[chan].api_active) {
dcb_chain = sinfo->rx[chan].api_dcb_chain_end;
woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize;
- dcb_dma = dcb_chain->dcb_dma + woffset;
+ dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t);
bkn_cdma_goto(sinfo, XGS_DMA_RX_CHAN + chan, dcb_dma);
cdma_running = 1;
}
@@ -3017,10 +3629,22 @@ bkn_open(struct net_device *dev)
return 0;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+static int
+bkn_set_mac_address(struct net_device *dev, void *addr)
+{
+ if (!is_valid_ether_addr(((struct sockaddr *)addr)->sa_data)) {
+ return -EINVAL;
+ }
+ memcpy(dev->dev_addr, ((struct sockaddr *)addr)->sa_data, dev->addr_len);
+ return 0;
+}
+#endif
+
static int
bkn_change_mtu(struct net_device *dev, int new_mtu)
{
- if (new_mtu < 68 || new_mtu > (rx_buffer_size + RCPU_RX_ENCAP_SIZE)) {
+ if (new_mtu < 68 || new_mtu > rx_buffer_size) {
return -EINVAL;
}
dev->mtu = new_mtu;
@@ -3102,6 +3726,8 @@ bkn_stop(struct net_device *dev)
bkn_switch_info_t *sinfo = priv->sinfo;
unsigned long flags;
+ netif_stop_queue(dev);
+
/* Check if base device */
if (priv->id <= 0) {
/* NAPI used only on base device */
@@ -3117,8 +3743,6 @@ bkn_stop(struct net_device *dev)
}
}
- netif_stop_queue(dev);
-
return 0;
}
@@ -3349,7 +3973,7 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev)
}
dcb[1] |= (1 << 19);
}
- bkn_dump_dcb("Tx RCPU", dcb, sinfo->dcb_wsize);
+ bkn_dump_dcb("Tx RCPU", dcb, sinfo->dcb_wsize, XGS_DMA_TX_CHAN);
} else if (priv->port >= 0) {
/* Send to physical port */
dcb[1] |= (1 << 19);
@@ -3358,6 +3982,8 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev)
case 26:
case 30:
case 31:
+ case 34:
+ case 37:
dcb[2] = 0x81000000;
dcb[3] = priv->port;
dcb[3] |= (priv->qnum & 0xc00) << 20;
@@ -3368,6 +3994,8 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev)
dcb[2] = 0x81000000;
dcb[3] = priv->port;
dcb[4] = 0x4000;
+ /* according to format of register SOBMH in bcm56960_a0 */
+ dcb[4] |= (priv->qnum & 0x3f) << 8;
break;
case 33:
dcb[2] = 0x81000000;
@@ -3375,12 +4003,80 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev)
dcb[4] = 0x00100000;
dcb[4] |= (priv->qnum & 0xfff) << 8;
break;
+ case 35:
+ dcb[2] = 0x81000000;
+ dcb[3] = (priv->port) << 4;
+ dcb[4] = 0x00400000;
+ dcb[4] |= (priv->qnum & 0x3fff) << 8;
+ break;
case 24:
dcb[2] = 0xff000000;
dcb[3] = 0x00000100;
dcb[4] = priv->port;
dcb[4] |= (priv->qnum & 0xfff) << 14;
break;
+ case 28:
+ {
+ if (priv->type == KCOM_NETIF_T_PORT) {
+ /* add PTCH ITMH header */
+ if (skb_header_cloned(skb) || skb_headroom(skb) < 4) {
+ /* Current SKB cannot be modified */
+ DBG_SKB(("Realloc Tx SKB for DNX ITMH header\n"));
+ new_skb = dev_alloc_skb(pktlen + 4 + 2);
+ if (new_skb == NULL) {
+ DBG_WARN(("Tx drop: No SKB memory for DNX ITMH header\n"));
+ priv->stats.tx_dropped++;
+ sinfo->tx.pkts_d_no_skb++;
+ dev_kfree_skb_any(skb);
+ spin_unlock_irqrestore(&sinfo->lock, flags);
+ return 0;
+ }
+ memcpy(&new_skb->data[6], skb->data, pktlen);
+ skb_put(new_skb, pktlen + 6);
+ dev_kfree_skb_any(skb);
+ skb = new_skb;
+ } else {
+ /* Add tag to existing buffer */
+ DBG_SKB(("Expand Tx SKB for DNX ITMH header\n"));
+ skb_push(skb, 6);
+ }
+ pktdata = skb->data;
+ pktdata[0] = 0x50;
+ pktdata[1] = 0x00;
+ memcpy(&pktdata[2], priv->itmh, 4);
+ pktlen += 6;
+ }
+ else if (priv->type == KCOM_NETIF_T_VLAN) {
+ /* add PTCH header */
+ if (skb_header_cloned(skb) || skb_headroom(skb) < 4) {
+ /* Current SKB cannot be modified */
+ DBG_SKB(("Realloc Tx SKB for DNX header\n"));
+ new_skb = dev_alloc_skb(pktlen + 2);
+ if (new_skb == NULL) {
+ DBG_WARN(("Tx drop: No SKB memory for DNX header\n"));
+ priv->stats.tx_dropped++;
+ sinfo->tx.pkts_d_no_skb++;
+ dev_kfree_skb_any(skb);
+ spin_unlock_irqrestore(&sinfo->lock, flags);
+ return 0;
+ }
+ memcpy(&new_skb->data[2], skb->data, pktlen);
+ skb_put(new_skb, pktlen + 2);
+ dev_kfree_skb_any(skb);
+ skb = new_skb;
+ } else {
+ /* Add tag to existing buffer */
+ DBG_SKB(("Expand Tx SKB for DNX header\n"));
+ skb_push(skb, 2);
+ }
+ pktdata = skb->data;
+ pktdata[0] = 0xd0;
+ pktdata[1] = priv->port;
+ pktlen += 2;
+ }
+ dcb[1] = pktlen;
+ break;
+ }
case 29:
dcb[2] = 0x81000000;
dcb[3] = priv->port;
@@ -3406,8 +4102,23 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev)
spin_unlock_irqrestore(&sinfo->lock, flags);
return 0;
}
+ /* Restore (possibly) altered packet variables
+ * bit0 -bit15 of dcb[1] is used to save requested byte count
+ */
+ if ((skb->len + 4) <= SOC_DCB_KNET_COUNT_MASK) {
+ pktdata = skb->data;
+ pktlen = skb->len + 4;
+ } else {
+ DBG_WARN(("Tx drop: size of pkt (%d) is out of range(%d)\n",
+ pktlen, SOC_DCB_KNET_COUNT_MASK));
+ sinfo->tx.pkts_d_over_limit++;
+ priv->stats.tx_dropped++;
+ sinfo->tx.pkts_d_callback++;
+ dev_kfree_skb_any(skb);
+ spin_unlock_irqrestore(&sinfo->lock, flags);
+ return 0;
+ }
}
-
/* Prepare for DMA */
desc->skb = skb;
desc->dma_size = pktlen;
@@ -3415,11 +4126,13 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev)
pktdata, desc->dma_size,
DMA_TODEV);
dcb[0] = desc->skb_dma;
+ dcb[1] &= ~SOC_DCB_KNET_COUNT_MASK;
+ dcb[1] |= pktlen;
- DBG_DCB(("Add Tx DCB @ 0x%08x (%d) [%d free] (%d bytes).\n",
- (uint32_t)desc->dcb_dma, sinfo->tx.cur,
- sinfo->tx.free, pktlen));
- bkn_dump_pkt(pktdata, skb->len - rcpulen);
+ DBG_DCB_TX(("Add Tx DCB @ 0x%08x (%d) [%d free] (%d bytes).\n",
+ (uint32_t)desc->dcb_dma, sinfo->tx.cur,
+ sinfo->tx.free, pktlen));
+ bkn_dump_pkt(pktdata, skb->len - rcpulen, XGS_DMA_TX_CHAN);
if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) {
dcb[1] |= (1 << 24) | (1 << 16);
@@ -3497,12 +4210,9 @@ bkn_timer(unsigned long context)
static void
bkn_rx_add_tokens(bkn_switch_info_t *sinfo, int chan)
{
- unsigned long flags;
unsigned long cur_jif, ticks;
uint32_t tokens_per_tick;
- spin_lock_irqsave(&sinfo->lock, flags);
-
tokens_per_tick = sinfo->rx[chan].rate_max / HZ;
cur_jif = jiffies;
ticks = cur_jif - sinfo->rx[chan].tok_jif;
@@ -3517,18 +4227,19 @@ bkn_rx_add_tokens(bkn_switch_info_t *sinfo, int chan)
bkn_rx_refill(sinfo, chan);
bkn_rx_restart(sinfo, chan);
}
-
- spin_unlock_irqrestore(&sinfo->lock, flags);
}
static void
bkn_rxtick(unsigned long context)
{
bkn_switch_info_t *sinfo = (bkn_switch_info_t *)context;
+ unsigned long flags;
unsigned long cur_jif, ticks;
uint32_t pkt_diff;
int chan;
+ spin_lock_irqsave(&sinfo->lock, flags);
+
sinfo->rxtick.expires = jiffies + sinfo->rxtick_jiffies;
/* For debug purposes we maintain a rough actual packet rate */
@@ -3551,6 +4262,8 @@ bkn_rxtick(unsigned long context)
}
}
+ spin_unlock_irqrestore(&sinfo->lock, flags);
+
add_timer(&sinfo->rxtick);
}
@@ -3692,7 +4405,7 @@ static const struct net_device_ops bkn_netdev_ops = {
.ndo_get_stats = bkn_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_rx_mode = bkn_set_multicast_list,
- .ndo_set_mac_address = NULL,
+ .ndo_set_mac_address = bkn_set_mac_address,
.ndo_do_ioctl = NULL,
.ndo_tx_timeout = NULL,
.ndo_change_mtu = bkn_change_mtu,
@@ -3730,9 +4443,6 @@ bkn_init_ndev(u8 *mac, char *name)
if (dev->mtu == 0) {
dev->mtu = rx_buffer_size;
}
- if (rcpu_mode) {
- dev->mtu += RCPU_RX_ENCAP_SIZE;
- }
/* Device vectors */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
@@ -3753,11 +4463,6 @@ bkn_init_ndev(u8 *mac, char *name)
strncpy(dev->name, name, IFNAMSIZ-1);
}
-#if defined(CONFIG_NET_NS)
- /* OPENNSL_FIXUP */
- dev_net_set(dev, current->nsproxy->net_ns);
-#endif
-
/* Register the kernel Ethernet device */
if (register_netdev(dev)) {
DBG_WARN(("Error registering Ethernet device.\n"));
@@ -3779,10 +4484,12 @@ bkn_proc_link_show(struct seq_file *m, void *v)
struct net_device *dev;
bkn_priv_t *priv;
bkn_switch_info_t *sinfo;
+ unsigned long flags;
seq_printf(m, "Software link status:\n");
list_for_each(slist, &_sinfo_list) {
sinfo = (bkn_switch_info_t *)slist;
+ spin_lock_irqsave(&sinfo->lock, flags);
list_for_each(dlist, &sinfo->ndev_list) {
priv = (bkn_priv_t *)dlist;
dev = priv->dev;
@@ -3791,6 +4498,7 @@ bkn_proc_link_show(struct seq_file *m, void *v)
netif_carrier_ok(dev) ? "up" : "down");
}
}
+ spin_unlock_irqrestore(&sinfo->lock, flags);
}
return 0;
}
@@ -3821,9 +4529,10 @@ bkn_proc_link_write(struct file *file, const char *buf,
struct net_device *dev;
bkn_priv_t *priv;
bkn_switch_info_t *sinfo;
+ unsigned long flags;
char link_str[40];
char *ptr;
- int len;
+ char *newline;
if (count >= sizeof(link_str)) {
count = sizeof(link_str) - 1;
@@ -3832,40 +4541,47 @@ bkn_proc_link_write(struct file *file, const char *buf,
return -EFAULT;
}
link_str[count] = 0;
+ newline = strchr(link_str, '\n');
+ if (newline) {
+ /* Chop off the trailing newline */
+ *newline = '\0';
+ }
if ((ptr = strchr(link_str, '=')) == NULL &&
(ptr = strchr(link_str, ':')) == NULL) {
- gprintk("Error: link syntax not recognized\n");
+ gprintk("Error: link syntax not recognized: '%s'\n", link_str);
return count;
}
*ptr++ = 0;
- len = strlen(link_str);
dev = NULL;
list_for_each(slist, &_sinfo_list) {
sinfo = (bkn_switch_info_t *)slist;
+ spin_lock_irqsave(&sinfo->lock, flags);
list_for_each(dlist, &sinfo->ndev_list) {
priv = (bkn_priv_t *)dlist;
- dev = priv->dev;
- if (dev && dev->name) {
- if (memcmp(dev->name, link_str, len) == 0) {
+ if (priv->dev && priv->dev->name) {
+ if (strcmp(priv->dev->name, link_str) == 0) {
+ dev = priv->dev;
break;
}
}
}
if (dev) {
- if (memcmp(ptr, "up", 2) == 0) {
+ if (strcmp(ptr, "up") == 0) {
netif_carrier_on(dev);
- } else if (memcmp(ptr, "down", 4) == 0) {
+ } else if (strcmp(ptr, "down") == 0) {
netif_carrier_off(dev);
} else {
- gprintk("Warning: unknown link setting\n");
+ gprintk("Warning: unknown link state setting: '%s'\n", ptr);
}
+ spin_unlock_irqrestore(&sinfo->lock, flags);
return count;
}
+ spin_unlock_irqrestore(&sinfo->lock, flags);
}
- gprintk("Warning: unknown network interface\n");
+ gprintk("Warning: unknown network interface: '%s'\n", link_str);
return count;
}
@@ -4292,6 +5008,7 @@ bkn_proc_stats_show(struct seq_file *m, void *v){
sinfo = (bkn_switch_info_t *)list;
seq_printf(m, "Device stats (unit %d):\n", unit);
+ seq_printf(m, " Interrupts %10u\n", sinfo->interrupts);
seq_printf(m, " Tx packets %10u\n", sinfo->tx.pkts);
for (chan = 0; chan < NUM_RX_CHAN; chan++) {
seq_printf(m, " Rx%d packets %10u\n",
@@ -4306,7 +5023,6 @@ bkn_proc_stats_show(struct seq_file *m, void *v){
chan, sinfo->rx[chan].pkts / sinfo->interrupts);
}
}
- seq_printf(m, " Interrupts %10u\n", sinfo->interrupts);
seq_printf(m, " Timer runs %10u\n", sinfo->timer_runs);
seq_printf(m, " NAPI reruns %10u\n", sinfo->napi_not_done);
@@ -4460,8 +5176,10 @@ bkn_proc_dstats_show(struct seq_file *m, void *v){
chan, sinfo->rx[chan].pkts_d_no_link);
seq_printf(m, " Rx%d sync error %10u\n",
chan, sinfo->rx[chan].sync_err);
- seq_printf(m, " Rx%d interrupt miss %10u\n",
- chan, sinfo->rx[chan].intr_miss);
+ seq_printf(m, " Rx%d sync retry %10u\n",
+ chan, sinfo->rx[chan].sync_retry);
+ seq_printf(m, " Rx%d sync maxloop %10u\n",
+ chan, sinfo->rx[chan].sync_maxloop);
seq_printf(m, " Rx%d drop no buffer %10u\n",
chan, sinfo->rx[chan].pkts_d_no_api_buf);
}
@@ -4557,7 +5275,8 @@ bkn_proc_dstats_write(struct file *file, const char *buf,
sinfo->rx[chan].pkts_d_unkn_dest = 0;
sinfo->rx[chan].pkts_d_no_api_buf = 0;
sinfo->rx[chan].sync_err = 0;
- sinfo->rx[chan].intr_miss = 0;
+ sinfo->rx[chan].sync_retry = 0;
+ sinfo->rx[chan].sync_maxloop = 0;
}
}
@@ -4689,7 +5408,7 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len)
if (sinfo->tx.api_active) {
/* Set new halt location */
woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize;
- dcb_dma = dcb_chain->dcb_dma + woffset;
+ dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t);
/* DMA run to the new halt location */
bkn_cdma_goto(sinfo, XGS_DMA_TX_CHAN, dcb_dma);
}
@@ -4729,7 +5448,7 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len)
if (!sinfo->rx[chan].use_rx_skb) {
/* Set new halt location */
woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize;
- dcb_dma = dcb_chain->dcb_dma + woffset;
+ dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t);
/* DMA run to the new halt location */
bkn_cdma_goto(sinfo, XGS_DMA_RX_CHAN + chan, dcb_dma);
}
@@ -5040,9 +5759,17 @@ bkn_knet_netif_create(kcom_msg_netif_create_t *kmsg, int len)
priv->vlan = kmsg->netif.vlan;
if (priv->type == KCOM_NETIF_T_PORT) {
priv->port = kmsg->netif.port;
+ memcpy(priv->itmh, kmsg->netif.itmh, 4);
priv->qnum = kmsg->netif.qnum;
} else {
- priv->port = -1;
+ if ((device_is_dune(sinfo)) && (priv->type == KCOM_NETIF_T_VLAN)) {
+ /* set port as SSP to PTCH */
+ priv->port = kmsg->netif.port;
+ priv->qnum = kmsg->netif.qnum;
+ }
+ else {
+ priv->port = -1;
+ }
}
priv->flags = kmsg->netif.flags;
@@ -5240,6 +5967,7 @@ bkn_knet_netif_get(kcom_msg_netif_get_t *kmsg, int len)
} else {
kmsg->netif.port = priv->port;
}
+ kmsg->netif.qnum = priv->qnum;
spin_unlock_irqrestore(&sinfo->lock, flags);
@@ -5295,7 +6023,7 @@ bkn_knet_filter_create(kcom_msg_filter_create_t *kmsg, int len)
return sizeof(kcom_msg_hdr_t);
}
- filter = kmalloc(sizeof(*filter), GFP_KERNEL);
+ filter = kmalloc(sizeof(*filter), GFP_ATOMIC);
if (filter == NULL) {
spin_unlock_irqrestore(&sinfo->lock, flags);
kmsg->hdr.status = KCOM_E_PARAM;
@@ -5451,6 +6179,20 @@ bkn_knet_filter_get(kcom_msg_filter_get_t *kmsg, int len)
return sizeof(*kmsg);
}
+static int
+bkn_knet_dbg_pkt_set(kcom_msg_dbg_pkt_set_t *kmsg, int len)
+{
+ dbg_pkt_enable = kmsg->enable;
+ return sizeof(kcom_msg_dbg_pkt_set_t);
+}
+
+static int
+bkn_knet_dbg_pkt_get(kcom_msg_dbg_pkt_get_t *kmsg, int len)
+{
+ kmsg->value = dbg_pkt_enable;
+ return sizeof(kcom_msg_dbg_pkt_get_t);
+}
+
static int
bkn_handle_cmd_req(kcom_msg_t *kmsg, int len)
{
@@ -5531,6 +6273,16 @@ bkn_handle_cmd_req(kcom_msg_t *kmsg, int len)
/* Return packet filter info */
len = bkn_knet_filter_get(&kmsg->filter_get, len);
break;
+ case KCOM_M_DBGPKT_SET:
+ DBG_CMD(("KCOM_M_DBGPKT_SET\n"));
+ /* Set debugging packet function */
+ len = bkn_knet_dbg_pkt_set(&kmsg->dbg_pkt_set, len);
+ break;
+ case KCOM_M_DBGPKT_GET:
+ DBG_CMD(("KCOM_M_DBGPKT_GET\n"));
+ /* Get debugging packet function info */
+ len = bkn_knet_dbg_pkt_get(&kmsg->dbg_pkt_get, len);
+ break;
default:
DBG_WARN(("Unsupported command (type=%d, opcode=%d)\n",
kmsg->hdr.type, kmsg->hdr.opcode));
@@ -5701,15 +6453,12 @@ _cleanup(void)
list_for_each(list, &_sinfo_list) {
sinfo = (bkn_switch_info_t *)list;
- spin_lock_irqsave(&sinfo->lock, flags);
-
- bkn_dma_abort(sinfo);
-
del_timer_sync(&sinfo->timer);
del_timer_sync(&sinfo->rxtick);
+ spin_lock_irqsave(&sinfo->lock, flags);
+ bkn_dma_abort(sinfo);
dev_irq_mask_set(sinfo, 0);
-
spin_unlock_irqrestore(&sinfo->lock, flags);
DBG_IRQ(("Unregister ISR.\n"));
@@ -5722,9 +6471,7 @@ _cleanup(void)
}
spin_lock_irqsave(&sinfo->lock, flags);
-
bkn_clean_dcbs(sinfo);
-
spin_unlock_irqrestore(&sinfo->lock, flags);
}
@@ -5893,6 +6640,7 @@ bkn_knet_dev_init(int d)
priv->sinfo = sinfo;
priv->vlan = 1;
priv->port = -1;
+ memset(priv->itmh, 0, sizeof(priv->itmh));
priv->id = -1;
}
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h
index f2bb0949826f..e0a5b25f7fcf 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: bcm-knet.h,v 1.4 2013/03/01 07:54:20 mlarsen Exp $
+ * $Id: bcm-knet.h,v 1.4 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/gmodule.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/gmodule.h
similarity index 97%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/gmodule.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/gmodule.h
index 5030964cf6df..a0deac1bae08 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/gmodule.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/gmodule.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: gmodule.h,v 1.9 2013/01/23 04:43:06 gili Exp $
+ * $Id: gmodule.h,v 1.9 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/lkm.h b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/lkm.h
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/lkm.h
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/lkm.h
index c0bbfb878da0..eb0077f2573b 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/include/lkm.h
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/include/lkm.h
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: lkm.h,v 1.22 2013/03/06 23:44:17 mlarsen Exp $
+ * $Id: lkm.h,v 1.22 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/Makefile
similarity index 95%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/Makefile
index add45e73d229..4c420c07ecdd 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.2 2005/01/17 19:53:10 csm Exp $
+# $Id: Makefile,v 1.2 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/gmodule.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/gmodule.c
similarity index 98%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/gmodule.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/gmodule.c
index 38e9542e9a7f..a72a54ef1c69 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/gmodule.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/gmodule.c
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: gmodule.c,v 1.20 2013/01/23 04:43:08 gili Exp $
+ * $Id: gmodule.c,v 1.20 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
@@ -55,12 +55,12 @@ static int
gvprintk(const char* fmt, va_list args)
{
static char _buf[256];
-
+
strcpy(_buf, "");
- sprintf(_buf, "%s (%d): ", _gmodule->name, current->pid);
+ sprintf(_buf, "%s (%d): ", _gmodule->name, current->pid);
vsprintf(_buf+strlen(_buf), fmt, args);
- printk(_buf);
-
+ printk("%s",_buf);
+
return 0;
}
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/ksal.c b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/ksal.c
similarity index 99%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/ksal.c
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/ksal.c
index 098de2ca6bc3..1ed0416f02c9 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/kernel/modules/shared/ksal.c
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/kernel/modules/shared/ksal.c
@@ -15,7 +15,7 @@
* of the software.
*/
/*
- * $Id: ksal.c,v 1.1 2008/10/16 09:41:23 mlarsen Exp $
+ * $Id: ksal.c,v 1.1 Broadcom SDK $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
@@ -31,11 +31,10 @@
#endif
#include <linux/interrupt.h>
#include <linux/sched.h>
-#include <linux/time.h>
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
#include <linux/sched/rt.h>
#endif
+#include <linux/time.h>
#ifdef MAX_USER_RT_PRIO
/* Assume 2.6 scheduler */
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/common/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/common/Makefile
similarity index 97%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/common/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/common/Makefile
index 4e5e2611b83a..1a4d8af484c3 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/common/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/common/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.4 2011/09/09 10:07:52 mlarsen Exp $
+# $Id: Makefile,v 1.4 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
@@ -119,6 +119,9 @@ ADD_TO_CFLAGS += -I$(SDK)/systems/linux/kernel/modules/include
COND_KNET_LIBS = libuser.$(libext)
endif
+#OPENNSL_FIXUP
+.NOTPARALLEL:
+
all: $(BLDDIR)/.tree $(all_targets)
ifeq ($(NO_LOCAL_TARGETS),)
@@ -140,7 +143,7 @@ kernel_modules:
$(MAKE) -C $(SDK)/systems/bde/linux/kernel kernel_version=$(kernel_version)
$(MAKE) -C $(SDK)/systems/bde/linux/user/kernel kernel_version=$(kernel_version)
ifeq ($(BUILD_KNET),1)
- $(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
+ $(MAKE) -j1 -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
subdirs="shared bcm-knet" override-target=linux-$(platform) CFLAGS="$(CFLAGS)"
endif
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/gto-2_6/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto-2_6/Makefile
similarity index 97%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/gto-2_6/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto-2_6/Makefile
index 41649f75b419..08f37e51c637 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/gto-2_6/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto-2_6/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.9 2009/05/21 20:09:56 gururaj Exp $
+# $Id: Makefile,v 1.9 Broadcom SDK $
# $Copyright: (c) 2007 Broadcom Corp.
# All Rights Reserved.$
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto/Makefile
new file mode 100644
index 000000000000..8e3422cd18d8
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/gto/Makefile
@@ -0,0 +1,61 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# -*- Makefile -*-
+# $Id: Makefile,v 1.9 Broadcom SDK $
+# $Copyright: (c) 2015 Broadcom Corp.
+# All Rights Reserved.$
+
+#
+# This make job requires the following environment variables to be set:
+#
+# SDK - path to StrataXGS SDK root directory
+#
+# Optionally the following environment variables can be set to
+# override the default build server configuration:
+#
+# PPC_TOOLS_DIR - path to build tools (if not in PATH already)
+# PPC_CROSS_COMPILE - cross compile tools prefix
+# LINUX_INCLUDE - path to Linux kernel include directory
+#
+
+SDK :=$(shell if [ -n "$$SDK" ] ; then\
+ echo $$SDK;\
+ else\
+ cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \
+ dir=`cd ../;pwd`; \
+ if [ "$$dir" = "/" ] ; then \
+ echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \
+ exit 1; \
+ fi ; \
+ cd $$dir; \
+ done ; \
+ pwd; \
+ fi)
+
+ifeq ($(SDK),)
+$(error Please run this in a tree)
+endif
+
+export SDK
+
+override kernel_version=4_4
+platform=gto
+LINUX_MAKE_USER=1
+export LINKER_RELAX=1
+
+include ${SDK}/make/Make.linux
+
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc-3_14/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc-3_14/Makefile
new file mode 100644
index 000000000000..c2081e42dc33
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc-3_14/Makefile
@@ -0,0 +1,66 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# -*- Makefile -*-
+# $Id: Makefile,v 1.7 Broadcom SDK $
+# $Copyright: (c) 2005 Broadcom Corp.
+# All Rights Reserved.$
+
+#
+# This make job requires the following environment variables to be set:
+#
+# SDK - path to StrataXGS SDK root directory
+#
+# Optionally the following environment variables can be set to
+# override the default build server configuration:
+#
+# MIPS_TOOLS_DIR - path to build tools (if not in PATH already)
+# MIPS_CROSS_COMPILE - cross compile tools prefix
+# LINUX_INCLUDE - path to Linux kernel include directory
+#
+
+SDK :=$(shell if [ -n "$$SDK" ] ; then\
+ echo $$SDK;\
+ else\
+ cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \
+ dir=`cd ../;pwd`; \
+ if [ "$$dir" = "/" ] ; then \
+ echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \
+ exit 1; \
+ fi ; \
+ cd $$dir; \
+ done ; \
+ pwd; \
+ fi)
+
+ifeq ($(SDK),)
+$(error Please run this in a tree)
+endif
+
+export SDK
+
+override kernel_version=3_14
+platform=iproc-$(kernel_version)
+
+IPROC_BUILD=1
+export IPROC_BUILD
+export BUILD_PLATFORM
+export ARM_LINUX_VERSION
+
+LINUX_MAKE_USER=1
+export ADD_TO_CFLAGS
+
+include ${SDK}/make/Make.linux
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc/Makefile
new file mode 100644
index 000000000000..7eef55d448fd
--- /dev/null
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/iproc/Makefile
@@ -0,0 +1,60 @@
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed to
+# you under the terms of the GNU General Public License version 2 (the
+# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and to
+# copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module. An
+# independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# -*- Makefile -*-
+# $Id: Makefile,v 1.7 Broadcom SDK $
+# $Copyright: (c) 2005 Broadcom Corp.
+# All Rights Reserved.$
+
+#
+# This make job requires the following environment variables to be set:
+#
+# SDK - path to StrataXGS SDK root directory
+#
+
+SDK :=$(shell if [ -n "$$SDK" ] ; then\
+ echo $$SDK;\
+ else\
+ cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \
+ dir=`cd ../;pwd`; \
+ if [ "$$dir" = "/" ] ; then \
+ echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \
+ exit 1; \
+ fi ; \
+ cd $$dir; \
+ done ; \
+ pwd; \
+ fi)
+
+ifeq ($(SDK),)
+$(error Please run this in a tree)
+endif
+
+export SDK
+
+override kernel_version=4_4
+platform=iproc
+
+IPROC_BUILD=1
+export IPROC_BUILD
+export BUILD_PLATFORM
+export ARM_LINUX_VERSION
+
+LINUX_MAKE_USER=1
+export ADD_TO_CFLAGS
+export BR_NO_CCACHE
+
+include ${SDK}/make/Make.linux
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile
similarity index 96%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile
index e26f82d55591..bb5408536a3d 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile
@@ -15,7 +15,7 @@
# of the software.
#
# -*- Makefile -*-
-# $Id: Makefile,v 1.2 2008/06/12 19:25:32 mpall Exp $
+# $Id: Makefile,v 1.2 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
diff --git a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/tools/mktool.pl b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/tools/mktool.pl
similarity index 99%
rename from ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/tools/mktool.pl
rename to ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/tools/mktool.pl
index 5d62b40e2a83..96bff14ecdc8 100644
--- a/ubuntu/opennsl/OpenNSL/sdk-6.4.10-gpl-modules/tools/mktool.pl
+++ b/ubuntu/opennsl/OpenNSL/sdk-6.5.10-gpl-modules/tools/mktool.pl
@@ -17,7 +17,7 @@
#
# mktool.pl
#
-# $Id: mktool.pl,v 1.5 2011/04/12 09:05:28 sraj Exp $
+# $Id: mktool.pl,v 1.5 Broadcom SDK $
#
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved. $
--
2.14.1
More information about the kernel-team
mailing list