[BCMSAI] Update BCM SAI debian package to 4.2.1.3 (6.5.19 hsdk) (#5532)
* [BCMSAI DEB] Update BCM SAI debian package to 4.2.1.3 (6.5.19 hsdk)(1.6.5 SAI) * [BCMSAI GPL] Update BCMSAI GPL to 6.5.19
This commit is contained in:
parent
48c089b9bb
commit
49b34dc433
@ -1,9 +1,8 @@
|
||||
# Broadcom SAI modules
|
||||
|
||||
BRCM_OPENNSL_KERNEL_VERSION = 3.7.3.3-1
|
||||
BRCM_OPENNSL_KERNEL_VERSION = 4.2.1.3-1
|
||||
|
||||
BRCM_OPENNSL_KERNEL = opennsl-modules_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb
|
||||
$(BRCM_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules
|
||||
$(BRCM_OPENNSL_KERNEL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
||||
SONIC_DPKG_DEBS += $(BRCM_OPENNSL_KERNEL)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
BRCM_SAI = libsaibcm_3.7.5.1-3_amd64.deb
|
||||
$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.7/master/libsaibcm_3.7.5.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=hwGt%2Fw1fWhauEsCXBTBmC3vC8G90iJT4DEp%2Bznwh4WY%3D&se=2034-04-16T01%3A02%3A17Z&sp=r"
|
||||
BRCM_SAI_DEV = libsaibcm-dev_3.7.5.1-3_amd64.deb
|
||||
BRCM_SAI = libsaibcm_4.2.1.3_amd64.deb
|
||||
$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/4.2/master/libsaibcm_4.2.1.3_amd64.deb?sv=2015-04-05&sr=b&sig=aA0Ltk2jteFuJZdr1ldj%2F5e6o7R0U5S%2FqVWvutPC7k0%3D&se=2021-08-31T04%3A08%3A35Z&sp=r"
|
||||
BRCM_SAI_DEV = libsaibcm-dev_4.2.1.3_amd64.deb
|
||||
$(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV)))
|
||||
$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.7/master/libsaibcm-dev_3.7.5.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=nuyZOMB%2BnmDIROP60UAiDl9eG0YHAEj6u8ViTlEqjf0%3D&se=2034-04-16T01%3A01%3A51Z&sp=r"
|
||||
$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/4.2/master/libsaibcm-dev_4.2.1.3_amd64.deb?sv=2015-04-05&sr=b&sig=r%2FWgs1VEFo07sbfYK%2FDZmk83QKTzwSSe%2F3%2BN3k3uAcY%3D&se=2022-01-30T22%3A55%3A04Z&sp=r"
|
||||
|
||||
SONIC_ONLINE_DEBS += $(BRCM_SAI)
|
||||
$(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI)
|
||||
|
@ -1,19 +1,25 @@
|
||||
opennsl (4.2.1.3-1) unstable; urgency=medium
|
||||
|
||||
* Update to Broadcom SAI 4.2.1.3
|
||||
|
||||
-- Mahesh Maddikayala <samaddik@microsoft.com> Fri, 18 Sep 2029 10:57:47 +0000
|
||||
|
||||
opennsl (3.7.3.3-1) unstable; urgency=medium
|
||||
|
||||
|
||||
* Port Broadcom SAI 3.7.3.3
|
||||
* Cherry-pick change from master branch, 3.7.3.3-1
|
||||
|
||||
-- Judy Joseph <jujoseph@microsoft.com> Fri, 2 Dec 2019 15:32:47 +0000
|
||||
|
||||
opennsl (3.7.3.2-1) unstable; urgency=medium
|
||||
|
||||
|
||||
* Port Broadcom SAI 3.7.3.2
|
||||
* Cherry-pick change from master branch, 3.7.3.2-1
|
||||
|
||||
-- Judy Joseph <jujoseph@microsoft.com> Fri, 12 Nov 2019 15:22:47 +0000
|
||||
|
||||
opennsl (3.7.3.1-1) unstable; urgency=medium
|
||||
|
||||
|
||||
* Port Broadcom SAI 3.7.3.1
|
||||
* Cherry-pick change from master branch, 3.7.3.1-1
|
||||
|
||||
|
@ -3,4 +3,5 @@ systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.19.0
|
||||
systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.19.0-9-2-amd64/extra
|
||||
systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.19.0-9-2-amd64/extra
|
||||
systems/linux/user/x86-smp_generic_64-2_6/psample.ko lib/modules/4.19.0-9-2-amd64/extra
|
||||
systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-ptp-clock.ko lib/modules/4.19.0-9-2-amd64/extra
|
||||
systemd/opennsl-modules.service lib/systemd/system
|
||||
|
@ -35,6 +35,8 @@ PACKAGE=opennsl-modules
|
||||
# modifieable for experiments or debugging m-a
|
||||
MA_DIR ?= /usr/share/modass
|
||||
KVERSION ?= 4.19.0-9-2-amd64
|
||||
KERNVERSION ?= 4.19.0-9-2
|
||||
|
||||
# load generic variable handling
|
||||
-include $(MA_DIR)/include/generic.make
|
||||
# load default rules, including kdist, kdist_image, ...
|
||||
@ -62,8 +64,8 @@ kdist_clean: clean
|
||||
dh_testdir
|
||||
dh_clean
|
||||
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \
|
||||
KERNDIR=/usr/src/linux-headers-$(KVERSION) \
|
||||
KERNEL_SRC=/usr/src/linux-headers-$(KVERSION) \
|
||||
KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
|
||||
KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \
|
||||
$(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean
|
||||
# rm -f driver/*.o driver/*.ko
|
||||
#
|
||||
@ -78,13 +80,24 @@ configure-stamp:
|
||||
|
||||
|
||||
build-arch: configure-stamp build-arch-stamp
|
||||
build-arch-stamp:
|
||||
build-arch-stamp:
|
||||
dh_testdir
|
||||
|
||||
# create links
|
||||
cd /; sudo mkdir -p /lib/modules/$(KERNVERSION)-amd64
|
||||
cd /; sudo rm /lib/modules/$(KERNVERSION)-amd64/build
|
||||
cd /; sudo rm /lib/modules/$(KERNVERSION)-amd64/source
|
||||
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-common/ /lib/modules/$(KERNVERSION)-amd64/source
|
||||
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/ /lib/modules/$(KERNVERSION)-amd64/build
|
||||
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/include/generated/ /usr/src/linux-headers-$(KERNVERSION)-common/include/generated
|
||||
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/arch/x86/include/generated/ /usr/src/linux-headers-$(KERNVERSION)-common/arch/x86/include/generated
|
||||
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/include/config/ /usr/src/linux-headers-$(KERNVERSION)-common/include/config
|
||||
cd /; sudo cp /usr/src/linux-headers-$(KERNVERSION)-amd64/Module.symvers /usr/src/linux-headers-$(KERNVERSION)-common/Module.symvers
|
||||
|
||||
# Add here command to compile/build the package.
|
||||
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \
|
||||
KERNDIR=/usr/src/linux-headers-$(KVERSION) \
|
||||
KERNEL_SRC=/usr/src/linux-headers-$(KVERSION) \
|
||||
KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
|
||||
KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \
|
||||
$(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6
|
||||
|
||||
touch $@
|
||||
@ -92,7 +105,7 @@ build-arch-stamp:
|
||||
#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k)
|
||||
|
||||
build-indep: configure-stamp build-indep-stamp
|
||||
build-indep-stamp:
|
||||
build-indep-stamp:
|
||||
dh_testdir
|
||||
|
||||
# Add here command to compile/build the arch indep package.
|
||||
@ -104,15 +117,15 @@ build-indep-stamp:
|
||||
|
||||
build: build-arch
|
||||
|
||||
clean:
|
||||
clean:
|
||||
dh_testdir
|
||||
#dh_testroot
|
||||
rm -f build-arch-stamp build-indep-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \
|
||||
KERNDIR=/usr/src/linux-headers-$(KVERSION) \
|
||||
KERNEL_SRC=/usr/src/linux-headers-$(KVERSION) \
|
||||
KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
|
||||
KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \
|
||||
$(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean
|
||||
|
||||
dh_clean
|
||||
|
@ -34,6 +34,12 @@ typedef struct ibde_dev_s {
|
||||
sal_vaddr_t base_address;
|
||||
sal_vaddr_t base_address1;
|
||||
sal_vaddr_t base_address2;
|
||||
/* a unique number representing the specific device.
|
||||
* Must be different for different devices.
|
||||
* May be used to identify specific devices in the system.
|
||||
* May be implemented as a full PCIe address, a persistent configurable user value, ...
|
||||
* Possible implementation value stores in QSPI flash memory of the device. */
|
||||
uint32 dev_unique_id;
|
||||
} ibde_dev_t;
|
||||
|
||||
|
||||
|
@ -59,8 +59,9 @@
|
||||
#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */
|
||||
#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */
|
||||
#define KCOM_M_WB_CLEANUP 51 /* Clean up for warmbooting */
|
||||
#define KCOM_M_CLOCK_CMD 52 /* Clock Commands */
|
||||
|
||||
#define KCOM_VERSION 10 /* Protocol version */
|
||||
#define KCOM_VERSION 12 /* Protocol version */
|
||||
|
||||
/*
|
||||
* Message status codes
|
||||
@ -138,11 +139,10 @@ typedef struct kcom_netif_s {
|
||||
uint16 vlan;
|
||||
uint16 qnum;
|
||||
uint8 macaddr[6];
|
||||
uint8 ptch[2];
|
||||
uint8 itmh[4];
|
||||
uint8 system_headers[KCOM_NETIF_SYSTEM_HEADERS_SIZE_MAX];
|
||||
uint8 system_headers_size;
|
||||
char name[KCOM_NETIF_NAME_MAX];
|
||||
uint8 phys_port;
|
||||
} kcom_netif_t;
|
||||
|
||||
/*
|
||||
@ -225,13 +225,9 @@ typedef struct kcom_filter_s {
|
||||
uint8 b[KCOM_FILTER_BYTES_MAX];
|
||||
uint32 w[KCOM_FILTER_WORDS_MAX];
|
||||
} mask;
|
||||
/** Information to parse Dune system headers */
|
||||
uint32 ftmh_lb_key_ext_size;
|
||||
uint32 ftmh_stacking_ext_size;
|
||||
uint32 pph_base_size;
|
||||
uint32 pph_lif_ext_size[8];
|
||||
uint8 udh_enable;
|
||||
uint32 udh_length_type[4];
|
||||
/** Mark to match source modid and modport */
|
||||
uint8 is_src_modport;
|
||||
uint8 spa_unit;
|
||||
} kcom_filter_t;
|
||||
|
||||
/*
|
||||
@ -338,6 +334,19 @@ typedef struct kcom_msg_version_s {
|
||||
uint32 filter_max;
|
||||
} kcom_msg_version_t;
|
||||
|
||||
/*
|
||||
* Request KCOM interface clock info.
|
||||
*/
|
||||
#define KSYNC_M_HW_INIT 0
|
||||
#define KSYNC_M_HW_DEINIT 1
|
||||
#define KSYNC_M_VERSION 2
|
||||
#define KSYNC_M_HW_TS_DISABLE 3
|
||||
|
||||
typedef struct kcom_clock_info_s {
|
||||
uint8 cmd;
|
||||
int32 data[8];
|
||||
} kcom_clock_info_t;
|
||||
|
||||
/*
|
||||
* Send literal string to/from kernel module.
|
||||
* Mainly for debugging purposes.
|
||||
@ -386,6 +395,19 @@ typedef struct kcom_msg_hw_init_s {
|
||||
uint8 pkt_hdr_size;
|
||||
uint32 dma_hi;
|
||||
uint32 cdma_channels;
|
||||
/*
|
||||
* Information to parse Dune system headers
|
||||
*/
|
||||
uint32 ftmh_lb_key_ext_size;
|
||||
uint32 ftmh_stacking_ext_size;
|
||||
uint32 pph_base_size;
|
||||
uint32 pph_lif_ext_size[8];
|
||||
uint32 udh_length_type[4];
|
||||
uint32 udh_size;
|
||||
uint32 oamp_punted;
|
||||
uint8 no_skip_udh_check;
|
||||
uint8 system_headers_mode;
|
||||
uint8 udh_enable;
|
||||
} kcom_msg_hw_init_t;
|
||||
|
||||
/*
|
||||
@ -445,6 +467,14 @@ typedef struct kcom_msg_netif_destroy_s {
|
||||
kcom_msg_hdr_t hdr;
|
||||
} kcom_msg_netif_destroy_t;
|
||||
|
||||
/*
|
||||
* Destroy system network interface.
|
||||
*/
|
||||
typedef struct kcom_msg_clock_s{
|
||||
kcom_msg_hdr_t hdr;
|
||||
kcom_clock_info_t clock_info;
|
||||
} kcom_msg_clock_cmd_t;
|
||||
|
||||
/*
|
||||
* Get list of currently defined system network interfaces.
|
||||
*/
|
||||
@ -486,7 +516,7 @@ typedef struct kcom_msg_filter_destroy_s {
|
||||
* Get list of currently defined packet filters.
|
||||
*/
|
||||
#ifndef KCOM_FILTER_MAX
|
||||
#define KCOM_FILTER_MAX 128
|
||||
#define KCOM_FILTER_MAX 128
|
||||
#endif
|
||||
|
||||
typedef struct kcom_msg_filter_list_s {
|
||||
@ -535,6 +565,7 @@ typedef union kcom_msg_s {
|
||||
kcom_msg_dbg_pkt_set_t dbg_pkt_set;
|
||||
kcom_msg_dbg_pkt_get_t dbg_pkt_get;
|
||||
kcom_msg_wb_cleanup_t wb_cleanup;
|
||||
kcom_msg_clock_cmd_t clock_cmd;
|
||||
} kcom_msg_t;
|
||||
|
||||
/*
|
||||
|
@ -92,17 +92,25 @@ typedef signed int int32; /* 32-bit quantity */
|
||||
|
||||
#define COUNTOF(ary) ((int) (sizeof (ary) / sizeof ((ary)[0])))
|
||||
|
||||
typedef uint32 sal_paddr_t; /* Physical address (PCI address) */
|
||||
|
||||
#ifdef PTRS_ARE_64BITS
|
||||
typedef uint64 sal_vaddr_t; /* Virtual address (Host address) */
|
||||
#define PTR_TO_INT(x) ((uint32)(((sal_vaddr_t)(x))&0xFFFFFFFF))
|
||||
typedef uint64 sal_vaddr_t; /* Virtual address (Host address) */
|
||||
typedef uint64 sal_paddr_t; /* Physical address (PCI address) */
|
||||
#define PTR_TO_INT(x) ((uint32)(((sal_vaddr_t)(x))&0xFFFFFFFF))
|
||||
#define PTR_HI_TO_INT(x) ((uint32)((((sal_vaddr_t)(x))>>32)&0xFFFFFFFF))
|
||||
#else
|
||||
typedef uint32 sal_vaddr_t; /* Virtual address (Host address) */
|
||||
#define PTR_TO_INT(x) ((uint32)(x))
|
||||
typedef uint32 sal_vaddr_t; /* Virtual address (Host address) */
|
||||
/* Physical address (PCI address) */
|
||||
#ifdef PHYS_ADDRS_ARE_64BITS
|
||||
typedef uint64 sal_paddr_t;
|
||||
#define PTR_HI_TO_INT(x) ((uint32)((((uint64)(x))>>32)&0xFFFFFFFF))
|
||||
#else
|
||||
typedef uint32 sal_paddr_t;
|
||||
#define PTR_HI_TO_INT(x) (0)
|
||||
#endif
|
||||
#define PTR_TO_INT(x) ((uint32)(x))
|
||||
#endif
|
||||
|
||||
#define INT_TO_PTR(x) ((void *)((sal_vaddr_t)(x)))
|
||||
#define INT_TO_PTR(x) ((void *)((sal_vaddr_t)(x)))
|
||||
|
||||
#define PTR_TO_UINTPTR(x) ((sal_vaddr_t)(x))
|
||||
#define UINTPTR_TO_PTR(x) ((void *)(x))
|
||||
@ -128,6 +136,7 @@ typedef union
|
||||
#define SAL_I2C_DEV_TYPE 0x00040 /* I2C device */
|
||||
#define SAL_AXI_DEV_TYPE 0x00080 /* AXI device */
|
||||
#define SAL_EMMI_DEV_TYPE 0x10000 /* EMMI device */
|
||||
#define SAL_COMPOSITE_DEV_TYPE 0x20000 /* Composite device, composed of sub-devices with buses */
|
||||
#define SAL_DEV_BUS_TYPE_MASK 0xf00ff /* Odd for historical reasons */
|
||||
|
||||
/* Device types */
|
||||
@ -152,4 +161,4 @@ typedef union
|
||||
/* Special access addresses */
|
||||
#define SAL_DEV_OP_EMMI_INIT 0x0fff1000
|
||||
|
||||
#endif /* !_SAL_TYPES_H */
|
||||
#endif /* !_SAL_TYPES_H */
|
||||
|
@ -14,7 +14,7 @@
|
||||
* version 2 (GPLv2) along with this source code.
|
||||
*/
|
||||
/*
|
||||
* Copyright: (c) 2019 Broadcom.
|
||||
* Copyright: (c) 2020 Broadcom.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
@ -1211,11 +1211,13 @@
|
||||
#define BCM56169_B0_REV_ID 0x11
|
||||
#define BCM56169_B1_REV_ID 0x12
|
||||
|
||||
#define BCM56980_DEVICE_ID_MASK 0xFFF0
|
||||
#define BCM56980_DEVICE_ID 0xb980
|
||||
#define BCM56980_A0_REV_ID 1
|
||||
#define BCM56980_B0_REV_ID 0x11
|
||||
#define BCM56981_DEVICE_ID 0xb981
|
||||
#define BCM56981_A0_REV_ID 1
|
||||
#define BCM56981_B0_REV_ID 0x11
|
||||
#define BCM56982_DEVICE_ID 0xb982
|
||||
#define BCM56982_A0_REV_ID 1
|
||||
#define BCM56982_B0_REV_ID 0x11
|
||||
@ -1248,6 +1250,30 @@
|
||||
#define BCM56166_A0_REV_ID 1
|
||||
#define BCM56166_B0_REV_ID 0x11
|
||||
|
||||
#define BCM56273_DEVICE_ID 0xb273
|
||||
#define BCM56273_A0_REV_ID 1
|
||||
#define BCM56273_A1_REV_ID 2
|
||||
|
||||
#define BCM56274_DEVICE_ID 0xb274
|
||||
#define BCM56274_A0_REV_ID 1
|
||||
#define BCM56274_A1_REV_ID 2
|
||||
|
||||
#define BCM56275_DEVICE_ID 0xb275
|
||||
#define BCM56275_A0_REV_ID 1
|
||||
#define BCM56275_A1_REV_ID 2
|
||||
|
||||
#define BCM56276_DEVICE_ID 0xb276
|
||||
#define BCM56276_A0_REV_ID 1
|
||||
#define BCM56276_A1_REV_ID 2
|
||||
|
||||
#define BCM56277_DEVICE_ID 0xb277
|
||||
#define BCM56277_A0_REV_ID 1
|
||||
#define BCM56277_A1_REV_ID 2
|
||||
|
||||
#define BCM56278_DEVICE_ID 0xb278
|
||||
#define BCM56278_A0_REV_ID 1
|
||||
#define BCM56278_A1_REV_ID 2
|
||||
|
||||
#define BCM53440_DEVICE_ID 0x8440
|
||||
#define BCM53440_A0_REV_ID 1
|
||||
#define BCM53440_B0_REV_ID 0x11
|
||||
@ -1277,18 +1303,23 @@
|
||||
#define BCM56670_DEVICE_ID 0xb670
|
||||
#define BCM56670_A0_REV_ID 1
|
||||
#define BCM56670_B0_REV_ID 0x11
|
||||
#define BCM56670_C0_REV_ID 0x21
|
||||
|
||||
|
||||
#define BCM56671_DEVICE_ID 0xb671
|
||||
#define BCM56671_A0_REV_ID 1
|
||||
#define BCM56671_B0_REV_ID 0x11
|
||||
#define BCM56671_C0_REV_ID 0x21
|
||||
|
||||
#define BCM56672_DEVICE_ID 0xb672
|
||||
#define BCM56672_A0_REV_ID 1
|
||||
#define BCM56672_B0_REV_ID 0x11
|
||||
#define BCM56672_C0_REV_ID 0x21
|
||||
|
||||
#define BCM56675_DEVICE_ID 0xb675
|
||||
#define BCM56675_A0_REV_ID 1
|
||||
#define BCM56675_B0_REV_ID 0x11
|
||||
#define BCM56675_C0_REV_ID 0x21
|
||||
|
||||
|
||||
#define BCM56565_DEVICE_ID 0xb565
|
||||
@ -1312,9 +1343,6 @@
|
||||
#define BCM56760_A1_REV_ID 2
|
||||
#define BCM56760_B0_REV_ID 0x11
|
||||
|
||||
#define BCM56761_DEVICE_ID 0xb761
|
||||
#define BCM56761_A0_REV_ID 1
|
||||
#define BCM56761_B0_REV_ID 0x11
|
||||
|
||||
#define BCM56761_DEVICE_ID 0xb761
|
||||
#define BCM56761_A0_REV_ID 1
|
||||
@ -1372,6 +1400,11 @@
|
||||
#define BCM53575_A0_REV_ID 1
|
||||
#define BCM53575_B0_REV_ID 0x11
|
||||
|
||||
#define BCM56070_DEVICE_ID 0xb070
|
||||
#define BCM56070_A0_REV_ID 1
|
||||
#define BCM56071_DEVICE_ID 0xb071
|
||||
#define BCM56071_A0_REV_ID 1
|
||||
|
||||
|
||||
#define BCM56965_DEVICE_ID 0xb965
|
||||
#define BCM56965_A0_REV_ID 1
|
||||
@ -1407,42 +1440,52 @@
|
||||
#define BCM56370_DEVICE_ID 0xb370
|
||||
#define BCM56370_A0_REV_ID 1
|
||||
#define BCM56370_A1_REV_ID 0x02
|
||||
#define BCM56370_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56371_DEVICE_ID 0xb371
|
||||
#define BCM56371_A0_REV_ID 1
|
||||
#define BCM56371_A1_REV_ID 0x02
|
||||
#define BCM56371_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56372_DEVICE_ID 0xb372
|
||||
#define BCM56372_A0_REV_ID 1
|
||||
#define BCM56372_A1_REV_ID 0x02
|
||||
#define BCM56372_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56374_DEVICE_ID 0xb374
|
||||
#define BCM56374_A0_REV_ID 1
|
||||
#define BCM56374_A1_REV_ID 0x02
|
||||
#define BCM56374_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56375_DEVICE_ID 0xb375
|
||||
#define BCM56375_A0_REV_ID 1
|
||||
#define BCM56375_A1_REV_ID 0x02
|
||||
#define BCM56375_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56376_DEVICE_ID 0xb376
|
||||
#define BCM56376_A0_REV_ID 1
|
||||
#define BCM56376_A1_REV_ID 0x02
|
||||
#define BCM56376_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56377_DEVICE_ID 0xb377
|
||||
#define BCM56377_A0_REV_ID 1
|
||||
#define BCM56377_A1_REV_ID 0x02
|
||||
#define BCM56377_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56577_DEVICE_ID 0xb577
|
||||
#define BCM56577_A0_REV_ID 1
|
||||
#define BCM56577_A1_REV_ID 0x02
|
||||
#define BCM56577_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56578_DEVICE_ID 0xb578
|
||||
#define BCM56578_A0_REV_ID 1
|
||||
#define BCM56578_A1_REV_ID 0x02
|
||||
#define BCM56578_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56579_DEVICE_ID 0xb579
|
||||
#define BCM56579_A0_REV_ID 1
|
||||
#define BCM56579_A1_REV_ID 0x02
|
||||
#define BCM56579_A2_REV_ID 0x03
|
||||
|
||||
#define BCM56770_DEVICE_ID 0xb770
|
||||
#define BCM56770_A0_REV_ID 1
|
||||
@ -1450,6 +1493,14 @@
|
||||
#define BCM56771_DEVICE_ID 0xb771
|
||||
#define BCM56771_A0_REV_ID 1
|
||||
|
||||
#define BCM56470_DEVICE_ID 0xb470
|
||||
#define BCM56470_A0_REV_ID 1
|
||||
#define BCM56471_DEVICE_ID 0xb471
|
||||
#define BCM56471_A0_REV_ID 1
|
||||
#define BCM56472_DEVICE_ID 0xb472
|
||||
#define BCM56472_A0_REV_ID 1
|
||||
|
||||
|
||||
#define BCM53540_DEVICE_ID 0x8540
|
||||
#define BCM53540_A0_REV_ID 1
|
||||
#define BCM53547_DEVICE_ID 0x8547
|
||||
@ -1526,6 +1577,7 @@
|
||||
#define DNXC_A1_REV_ID 0x0002
|
||||
#define DNXC_B0_REV_ID 0x0011
|
||||
#define DNXC_B1_REV_ID 0x0012
|
||||
#define DNXC_DEVID_FAMILY_MASK 0xfff0
|
||||
#define BCM88790_DEVICE_ID 0x8790
|
||||
#define BCM88790_A0_REV_ID DNXC_A0_REV_ID
|
||||
#define BCM88790_B0_REV_ID DNXC_B0_REV_ID
|
||||
@ -1544,7 +1596,6 @@
|
||||
#define BCM8879D_DEVICE_ID 0x879D
|
||||
#define BCM8879E_DEVICE_ID 0x879E
|
||||
#define BCM8879F_DEVICE_ID 0x879F
|
||||
#define BCM_DNXF_DEVID_MASK 0xFFF0
|
||||
#define ARADPLUS_DEVICE_ID 0x8660
|
||||
#define ARADPLUS_A0_REV_ID 0x0001
|
||||
#define BCM88660_DEVICE_ID ARADPLUS_DEVICE_ID
|
||||
@ -1675,19 +1726,22 @@
|
||||
#define BCM88685_DEVICE_ID 0x8685
|
||||
#define BCM88685_A0_REV_ID JERICHO_PLUS_A0_REV_ID
|
||||
|
||||
#define BCM88687_DEVICE_ID 0x8687
|
||||
#define BCM88687_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 DNXC_A0_REV_ID
|
||||
#define JERICHO_2_B0_REV_ID DNXC_B0_REV_ID
|
||||
#define JERICHO_2_B1_REV_ID DNXC_B1_REV_ID
|
||||
#define BCM88690_DEVICE_ID JERICHO_2_DEVICE_ID
|
||||
#define BCM88690_A0_REV_ID JERICHO_2_A0_REV_ID
|
||||
#define BCM88690_B0_REV_ID JERICHO_2_B0_REV_ID
|
||||
#define BCM88690_B1_REV_ID JERICHO_2_B1_REV_ID
|
||||
#define JERICHO2_DEVICE_ID 0x8690
|
||||
#define JERICHO2_A0_REV_ID DNXC_A0_REV_ID
|
||||
#define JERICHO2_B0_REV_ID DNXC_B0_REV_ID
|
||||
#define JERICHO2_B1_REV_ID DNXC_B1_REV_ID
|
||||
#define BCM88690_DEVICE_ID JERICHO2_DEVICE_ID
|
||||
#define BCM88690_A0_REV_ID JERICHO2_A0_REV_ID
|
||||
#define BCM88690_B0_REV_ID JERICHO2_B0_REV_ID
|
||||
#define BCM88690_B1_REV_ID JERICHO2_B1_REV_ID
|
||||
#define BCM88691_DEVICE_ID 0x8691
|
||||
#define BCM88692_DEVICE_ID 0x8692
|
||||
#define BCM88693_DEVICE_ID 0x8693
|
||||
@ -1703,12 +1757,56 @@
|
||||
#define BCM8869D_DEVICE_ID 0x869D
|
||||
#define BCM8869E_DEVICE_ID 0x869E
|
||||
#define BCM8869F_DEVICE_ID 0x869F
|
||||
#define BCM_JR2_DEVID_MASK 0xFFF0
|
||||
|
||||
#define J2C_DEVICE_ID 0x8800
|
||||
#define J2C_DEVICE_ID 0x8800
|
||||
#define J2C_2ND_DEVICE_ID 0x8820
|
||||
#define J2C_DEVID_FAMILY_MASK 0xffd0
|
||||
#define J2C_A0_REV_ID DNXC_A0_REV_ID
|
||||
#define J2C_A1_REV_ID DNXC_A1_REV_ID
|
||||
#define BCM88800_DEVICE_ID J2C_DEVICE_ID
|
||||
#define BCM88820_DEVICE_ID J2C_2ND_DEVICE_ID
|
||||
#define BCM88800_A0_REV_ID J2C_A0_REV_ID
|
||||
#define BCM88800_A1_REV_ID J2C_A1_REV_ID
|
||||
#define BCM88821_DEVICE_ID 0x8821
|
||||
#define BCM88826_DEVICE_ID 0x8826
|
||||
#define BCM88802_DEVICE_ID 0x8802
|
||||
#define BCM88803_DEVICE_ID 0x8803
|
||||
#define BCM88804_DEVICE_ID 0x8804
|
||||
#define BCM88805_DEVICE_ID 0x8805
|
||||
#define BCM88806_DEVICE_ID 0x8806
|
||||
#define BCM88822_DEVICE_ID 0x8822
|
||||
#define BCM88823_DEVICE_ID 0x8823
|
||||
#define BCM88824_DEVICE_ID 0x8824
|
||||
#define BCM88825_DEVICE_ID 0x8825
|
||||
|
||||
#define J2P_DEVICE_ID 0x8850
|
||||
#define J2P_A0_REV_ID DNXC_A0_REV_ID
|
||||
#define BCM88850_DEVICE_ID J2P_DEVICE_ID
|
||||
#define BCM88850_A0_REV_ID J2P_A0_REV_ID
|
||||
|
||||
#define Q2A_DEVICE_ID 0x8480
|
||||
#define Q2A_A0_REV_ID DNXC_A0_REV_ID
|
||||
#define Q2A_B0_REV_ID DNXC_B0_REV_ID
|
||||
#define Q2A_B1_REV_ID DNXC_B1_REV_ID
|
||||
#define BCM88480_DEVICE_ID Q2A_DEVICE_ID
|
||||
#define BCM88480_A0_REV_ID Q2A_A0_REV_ID
|
||||
#define BCM88480_B0_REV_ID Q2A_B0_REV_ID
|
||||
#define BCM88480_B1_REV_ID Q2A_B1_REV_ID
|
||||
#define BCM88481_DEVICE_ID 0x8481
|
||||
#define BCM88482_DEVICE_ID 0x8482
|
||||
#define BCM88483_DEVICE_ID 0x8483
|
||||
#define BCM88484_DEVICE_ID 0x8484
|
||||
#define BCM88485_DEVICE_ID 0x8485
|
||||
#define BCM88486_DEVICE_ID 0x8486
|
||||
#define BCM88487_DEVICE_ID 0x8487
|
||||
#define BCM88488_DEVICE_ID 0x8488
|
||||
#define BCM88489_DEVICE_ID 0x8489
|
||||
#define BCM8848A_DEVICE_ID 0x848A
|
||||
#define BCM8848B_DEVICE_ID 0x848B
|
||||
#define BCM8848C_DEVICE_ID 0x848C
|
||||
#define BCM8848D_DEVICE_ID 0x848D
|
||||
#define BCM8848E_DEVICE_ID 0x848E
|
||||
#define BCM8848F_DEVICE_ID 0x848F
|
||||
|
||||
#define QAX_DEVICE_ID 0x8470
|
||||
#define QAX_A0_REV_ID 0x0001
|
||||
@ -1822,5 +1920,17 @@
|
||||
|
||||
#define PLX9056_DEVICE_ID 0x9056
|
||||
|
||||
#ifdef BCM_LTSW_SUPPORT
|
||||
#define BCM56880_DEVICE_ID 0xb880
|
||||
#define BCM56880_A0_REV_ID 0x0001
|
||||
#define BCM56880_B0_REV_ID 0x0011
|
||||
#define BCM56881_DEVICE_ID 0xb881
|
||||
#define BCM56881_A0_REV_ID 0x0001
|
||||
#define BCM56881_B0_REV_ID 0x0011
|
||||
#define BCM56883_DEVICE_ID 0xb883
|
||||
#define BCM56883_A0_REV_ID 0x0001
|
||||
#define BCM56883_B0_REV_ID 0x0011
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -85,7 +85,7 @@ endif
|
||||
build:
|
||||
$(MAKE) $(CMD)
|
||||
|
||||
DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user:
|
||||
DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user issu:
|
||||
$(MAKE) $(CMD) $@
|
||||
|
||||
clean_d: clean
|
||||
@ -93,5 +93,5 @@ clean_d: clean
|
||||
distclean:
|
||||
$(MAKE) $(CMD) $@
|
||||
|
||||
.PHONY: build clean distclean clean_d DELIVER variable mod bcm user
|
||||
.PHONY: build clean distclean clean_d DELIVER variable mod bcm user issu
|
||||
|
||||
|
@ -97,6 +97,21 @@ ifdef SHADOW_PLX
|
||||
CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK
|
||||
endif
|
||||
|
||||
ifdef LTSW_CHIPS
|
||||
# Default open source target build
|
||||
OPENSRC_BUILD ?= uclibc_201402_ppc
|
||||
|
||||
# Hardware interface (see $SDKLT/bcma/sys/probe directory)
|
||||
SYSTEM_INTERFACE ?= ngbde
|
||||
|
||||
# Turn on direct register access if running on real hardware.
|
||||
ifeq (ngbde,$(SYSTEM_INTERFACE))
|
||||
LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
|
||||
endif
|
||||
|
||||
export SYSTEM_INTERFACE
|
||||
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
|
||||
|
142
platform/broadcom/saibcm-modules/make/Makefile.linux-gts
Normal file
142
platform/broadcom/saibcm-modules/make/Makefile.linux-gts
Normal file
@ -0,0 +1,142 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# $Id: Makefile.linux-xlr-4_19,v 0.1 Broadcom SDK $
|
||||
# $Copyright: (c) 2015 Broadcom Corp.
|
||||
# All Rights Reserved.$
|
||||
|
||||
#
|
||||
# XLR system make file.
|
||||
#
|
||||
# Most of this was taken from target x86-smp_generic_64-2_6.
|
||||
#
|
||||
|
||||
|
||||
#############################################################################
|
||||
# this segment is custom and not sourced from any existing makefile #
|
||||
# (base thanks to http:<slash><slash>confluence.broadcom.com/display/NTSWSW/X86+System) #
|
||||
#############################################################################
|
||||
|
||||
# set up a basic feature list. tcl, etc. #
|
||||
#ifeq (,$(FEATURE_LIST))
|
||||
#FEATURE_LIST = TCL BFD PTP CINT L3 I2C MEM_SCAN EDITLINE BCM_SAL_PROFILE CUSTOMER TEST CHASSIS MSTP RCPU
|
||||
#endif
|
||||
|
||||
# some basic path variables for tools and kernel source, etc #
|
||||
export XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-419
|
||||
TOOLCHAIN_DIR = $(XLR_TOOLS_BASE)/buildroot/host/usr
|
||||
KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux
|
||||
|
||||
# set up cross compile prefix, tools dir variables. #
|
||||
export CROSS_COMPILE := x86_64-broadcom-linux-gnu-
|
||||
export TOOLS_DIR := $(TOOLCHAIN_DIR)/bin
|
||||
|
||||
# architecture. #
|
||||
ARCH = x86_64
|
||||
TARGET_ARCHITECTURE = x86_64-broadcom-linux-gnu
|
||||
|
||||
# Noisy kernel build
|
||||
KBUILD_VERBOSE = 1
|
||||
|
||||
export ARCH KBUILD_VERBOSE
|
||||
|
||||
# set up paths. #
|
||||
export LIBRARY_PATH := $(TOOLCHAIN_DIR)/lib:$(TOOLCHAIN_DIR)/lib64:$(LIBRARY_PATH)
|
||||
export PATH := $(TOOLCHAIN_DIR)/bin:$(KERNDIR):$(PATH)
|
||||
|
||||
# set up SYSINC path #
|
||||
export SYSINC := $(XLR_TOOLS_BASE)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/5.4.0/include
|
||||
|
||||
|
||||
# CFLAGS/CFGFLAGS #
|
||||
CFLAGS += -DUSE_LINUX_BDE_MMAP=1
|
||||
#CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT
|
||||
CFLAGS += -Wno-error=unused-value
|
||||
CFLAGS += -Wno-error=unused-but-set-variable
|
||||
CFLAGS += -Wno-error=maybe-uninitialized
|
||||
CFLAGS += -Wno-error=cpp
|
||||
CFLAGS += -Wno-error=aggressive-loop-optimizations
|
||||
CFLAGS += -Wno-error=array-bounds
|
||||
CFLAGS += -Wno-error=strict-overflow
|
||||
CFLAGS += -L$(TOOLCHAIN_DIR)/lib
|
||||
CFLAGS += -L$(TOOLCHAIN_DIR)/lib64
|
||||
#CFLAGS += -Wl,--rpath=/lib64 # may need to set rpath and dynamic-linker path here (and possibly in KLFAGS below) in the future, #
|
||||
#CFLAGS += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 # if we want to build the target executable to be used with shared libs #
|
||||
|
||||
#XLDK-568 fix inline references
|
||||
CFGFLAGS += -fgnu89-inline
|
||||
|
||||
|
||||
# set up KFLAGS appropriately. #
|
||||
ifeq (,$(KFLAGS))
|
||||
KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-larger-than=1024 -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack
|
||||
endif
|
||||
|
||||
|
||||
######################################################################
|
||||
# this segment comes from make/Makefile.linux-x86-smp_generic_64-2_6 #
|
||||
######################################################################
|
||||
CFGFLAGS += -DLONGS_ARE_64BITS
|
||||
CFGFLAGS += -DPTRS_ARE_64BITS
|
||||
CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ
|
||||
|
||||
|
||||
##############################################################
|
||||
# This segment comes from make/Makefile.linux-x86-common-2_6 #
|
||||
##############################################################
|
||||
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\"
|
||||
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
|
||||
|
||||
# Extra variables.
|
||||
EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
|
||||
|
||||
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)))")
|
||||
|
||||
ifdef LTSW_CHIPS
|
||||
# Ensure we do not use an out-of-date libelf.so
|
||||
ELFUTILS_MIN = 158
|
||||
ELFUTILS_DIR ?= /projects/ntsw-tools/lib
|
||||
|
||||
# Default open source target build
|
||||
OPENSRC_BUILD ?= fed21-x86_64
|
||||
|
||||
# Hardware interface (see $SDKLT/bcma/sys/probe directory)
|
||||
SYSTEM_INTERFACE ?= ngbde
|
||||
|
||||
# Turn on direct register access if running on real hardware.
|
||||
ifeq (ngbde,$(SYSTEM_INTERFACE))
|
||||
LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
|
||||
endif
|
||||
|
||||
export SYSTEM_INTERFACE
|
||||
endif
|
||||
|
||||
ifneq ($(targetplat),user)
|
||||
# By default we exclude -Werror from x86 kernel builds
|
||||
BCM_CFLAGS = -Wall
|
||||
include ${SDK}/make/Makefile.linux-kernel-2_6
|
||||
endif
|
||||
|
||||
|
@ -27,11 +27,14 @@ endif
|
||||
# TARGET_ARCHITECTURE Compiler for target architecture
|
||||
# KERNDIR Kernel directory for iPROC-CMICd devices
|
||||
ifeq (BE,$(ENDIAN_MODE))
|
||||
#While BE mode is supported, it's use is very limited. We had a specific customer
|
||||
#request for BE support but don't currently mainstream it. So a 5.1.0 version
|
||||
#has not been built. Continue using 5.0.3 for any BE support
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk50-be/XLDK32
|
||||
TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi
|
||||
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
|
||||
else
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk50/XLDK32
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51/XLDK32
|
||||
TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi
|
||||
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
|
||||
endif
|
||||
@ -44,9 +47,10 @@ endif
|
||||
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
|
||||
|
||||
CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_BIN_DIR)/$(CROSS_COMPILE)gcc -dumpversion)
|
||||
|
||||
# Default Linux include directory
|
||||
ifeq (,$(LINUX_INCLUDE))
|
||||
LINUX_INCLUDE := $(KERNDIR)/include
|
||||
@ -61,6 +65,12 @@ ENDIAN = LE_HOST=1
|
||||
endif
|
||||
|
||||
CFLAGS += -fno-aggressive-loop-optimizations
|
||||
CFLAGS += -Wno-error=maybe-uninitialized
|
||||
CFLAGS += -Wno-error=array-bounds
|
||||
CFLAGS += -fgnu89-inline
|
||||
ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 7)" "1"
|
||||
CFLAGS += -Wno-error=bool-operation
|
||||
endif
|
||||
|
||||
CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
|
||||
CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
|
||||
@ -82,7 +92,7 @@ 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.4/include
|
||||
KFLAG_INCLD ?= $(LD_LIBRARY_PATH)/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/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
|
||||
|
@ -0,0 +1,92 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# $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/xldk40-be/XLDK
|
||||
TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi
|
||||
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
|
||||
else
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk40/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
|
106
platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64
Normal file
106
platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64
Normal file
@ -0,0 +1,106 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# $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))
|
||||
#We've never actually built a 64 BE executable. Just here for any future
|
||||
#customer requirements.
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51-be/XLDK64
|
||||
TARGET_ARCHITECTURE ?= aarch64_be-broadcom-linux-uclibc
|
||||
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
|
||||
else
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51/XLDK64
|
||||
TARGET_ARCHITECTURE ?= aarch64-broadcom-linux-uclibc
|
||||
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
|
||||
endif
|
||||
|
||||
ifeq (,$(CROSS_COMPILE))
|
||||
CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
|
||||
endif
|
||||
|
||||
# A72 tools
|
||||
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
|
||||
|
||||
CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_BIN_DIR)/$(CROSS_COMPILE)gcc -dumpversion)
|
||||
|
||||
# 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
|
||||
|
||||
CFLAGS += -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS
|
||||
CFLAGS += -DPHYS_ADDRS_ARE_64BITS
|
||||
CFLAGS += -fno-aggressive-loop-optimizations -fno-strict-overflow
|
||||
CFLAGS += -Wno-error=maybe-uninitialized
|
||||
CFLAGS += -Wno-error=array-bounds
|
||||
CFLAGS += -fgnu89-inline
|
||||
ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 7)" "1"
|
||||
CFLAGS += -Wno-error=bool-operation
|
||||
endif
|
||||
|
||||
|
||||
CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
|
||||
CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
|
||||
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=16
|
||||
|
||||
ARCH = arm64
|
||||
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 ?= $(LD_LIBRARY_PATH)/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/include
|
||||
|
||||
ifeq (,$(KFLAGS))
|
||||
KFLAGS := -D__LINUX_ARM_ARCH__=8 -D__KERNEL__ -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm64/include -I$(KERNDIR)/arch/arm64/include/generated -I$(KERNDIR)/arch/arm64/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/generated/asm -I$(KERNDIR)/include/uapi -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/uapi -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mcmodel=large
|
||||
endif
|
||||
|
||||
ifneq ($(targetplat),user)
|
||||
include ${SDK}/make/Makefile.linux-kernel-3_6
|
||||
endif
|
146
platform/broadcom/saibcm-modules/make/Makefile.linux-slk
Normal file
146
platform/broadcom/saibcm-modules/make/Makefile.linux-slk
Normal file
@ -0,0 +1,146 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# $Id: Makefile.linux-slk-3_14,v 1.2 Broadcom SDK $
|
||||
# $Copyright: (c) 2013 Broadcom Corp.
|
||||
# All Rights Reserved.$
|
||||
# Makefile for SLK(BCM957812)
|
||||
|
||||
# User must select one platform from below.By default ARM_LINUX is selected. .
|
||||
ifeq (,$(BUILD_PLATFORM))
|
||||
BUILD_PLATFORM=ARM_LINUX
|
||||
endif
|
||||
|
||||
# Toolchain base directory for NS2 XMC card
|
||||
ifeq (BE,$(ENDIAN_MODE))
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/toolchains/slk/linaro-be
|
||||
TARGET_ARCHITECTURE:=aarch64_be-linux-gnu
|
||||
KERNDIR ?= /projects/ntsw-tools/linux/iproc_ldks/slk-be/poky/brcm-released-source/git
|
||||
else
|
||||
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/toolchains/slk/linaro-le
|
||||
# Compiler for target architecture
|
||||
TARGET_ARCHITECTURE:= aarch64-linux-gnu
|
||||
# Kernel directory
|
||||
KERNDIR ?= /projects/ntsw-tools/linux/iproc_ldks/slk/poky/brcm-released-source/git
|
||||
endif
|
||||
|
||||
ifeq (,$(CROSS_COMPILE))
|
||||
CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
|
||||
endif
|
||||
|
||||
# armtools
|
||||
TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/bin
|
||||
override PATH:=$(TOOLCHAIN_BIN_DIR):$(PATH)
|
||||
LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/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) -DBCM958525
|
||||
CFGFLAGS += -DBCM_PLATFORM_STRING=\"SLK_BCM957812\"
|
||||
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
|
||||
ifeq (1,$(SLK_32BIT))
|
||||
CFGFLAGS += -DSAL_BDE_32BIT_USER_64BIT_KERNEL
|
||||
else
|
||||
CFGFLAGS += -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS
|
||||
endif
|
||||
CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS
|
||||
|
||||
CFLAGS += -Wno-unused-value -Wno-unused-but-set-variable -Wno-sizeof-pointer-memaccess -fno-aggressive-loop-optimizations
|
||||
|
||||
ifdef DPP_CHIPS
|
||||
CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__
|
||||
CFGFLAGS += -DSOC_CM_FUNCTION
|
||||
endif
|
||||
|
||||
ifdef DFE_CHIPS
|
||||
CFLAGS += -DDUNE_BCM
|
||||
CFGFLAGS += -DSOC_CM_FUNCTION
|
||||
endif
|
||||
|
||||
ifdef SAND_CHIPS
|
||||
CFLAGS += -D__DUNE_SLK_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__
|
||||
endif
|
||||
|
||||
# Enable cached DMA memory by default
|
||||
ifeq (,$(SAL_BDE_USE_CACHED_DMA_MEM))
|
||||
SAL_BDE_USE_CACHED_DMA_MEM = 1
|
||||
endif
|
||||
ifeq ($(SAL_BDE_USE_CACHED_DMA_MEM),1)
|
||||
CFGFLAGS += -DSAL_BDE_CACHE_DMA_MEM
|
||||
endif
|
||||
|
||||
ifeq (1,$(SLK_32BIT))
|
||||
ARCH = arm
|
||||
else
|
||||
ARCH = arm64
|
||||
endif
|
||||
|
||||
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)/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.2/include
|
||||
|
||||
ifeq (,$(KFLAGS))
|
||||
KFLAGS := -D__LINUX_ARM_ARCH__=8 -D__KERNEL__ -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm64/include -I$(KERNDIR)/arch/arm64/include/generated -I$(KERNDIR)/arch/arm64/include/generated/asm -I$(KERNDIR)/include/uapi -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/uapi -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign
|
||||
endif
|
||||
|
||||
ifdef LTSW_CHIPS
|
||||
# Default open source target build
|
||||
ifeq (BE,$(ENDIAN_MODE))
|
||||
OPENSRC_BUILD ?= linaro_arm64_be
|
||||
else
|
||||
OPENSRC_BUILD ?= linaro_arm64_le
|
||||
endif
|
||||
|
||||
# Hardware interface (see $SDKLT/bcma/sys/probe directory)
|
||||
SYSTEM_INTERFACE ?= ngbde
|
||||
|
||||
# Turn on direct register access if running on real hardware.
|
||||
ifeq (ngbde,$(SYSTEM_INTERFACE))
|
||||
LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
|
||||
endif
|
||||
|
||||
export SYSTEM_INTERFACE
|
||||
endif
|
||||
|
||||
ifneq ($(targetplat),user)
|
||||
include ${SDK}/make/Makefile.linux-kernel-3_6
|
||||
endif
|
@ -48,4 +48,5 @@ AUTOCONF = $(KERNDIR)/include/linux/autoconf.h
|
||||
endif
|
||||
|
||||
# gcc system include path
|
||||
# SAI_FIXUP /* SDK-218654 */
|
||||
SYSINC = $(shell $(CC) -print-search-dirs | grep install | cut -c 10-)include
|
||||
|
@ -29,17 +29,33 @@ KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x8
|
||||
endif
|
||||
|
||||
ifeq ($(LINUX_MAKE_SHARED_LIB), 1)
|
||||
KFLAGS += -fPIC -mcmodel=small
|
||||
KFLAGS += -fPIC -mcmodel=small
|
||||
else
|
||||
KFLAGS += -fno-pie -mcmodel=kernel
|
||||
KFLAGS += -fno-pie -mcmodel=kernel
|
||||
endif
|
||||
|
||||
LINUX_UAPI = $(LINUX_INCLUDE)/uapi
|
||||
ifneq (,$(shell ls $(LINUX_UAPI) 2>/dev/null))
|
||||
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
|
||||
endif
|
||||
|
||||
ifeq (1,$(DEBIAN_LINUX_HEADER))
|
||||
KERNDIR_COMMON := $(subst amd64,common,$(KERNDIR))
|
||||
KFLAGS += -I$(KERNDIR_COMMON)/include -I$(KERNDIR_COMMON)/include/uapi -I$(KERNDIR_COMMON)/arch/x86/include -I$(KERNDIR_COMMON)/arch/x86/include/uapi
|
||||
ifdef LTSW_CHIPS
|
||||
# Ensure we do not use an out-of-date libelf.so
|
||||
ELFUTILS_MIN = 158
|
||||
ELFUTILS_DIR ?= /projects/ntsw-tools/lib
|
||||
|
||||
# Default open source target build
|
||||
OPENSRC_BUILD ?= x86_64
|
||||
|
||||
# Hardware interface (see $SDKLT/bcma/sys/probe directory)
|
||||
SYSTEM_INTERFACE ?= ngbde
|
||||
|
||||
# Turn on direct register access if running on real hardware.
|
||||
ifeq (ngbde,$(SYSTEM_INTERFACE))
|
||||
LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
|
||||
endif
|
||||
|
||||
export SYSTEM_INTERFACE
|
||||
endif
|
||||
|
||||
include ${SDK}/make/Makefile.linux-x86-common-2_6
|
||||
|
142
platform/broadcom/saibcm-modules/make/Makefile.linux-xlr
Normal file
142
platform/broadcom/saibcm-modules/make/Makefile.linux-xlr
Normal file
@ -0,0 +1,142 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# $Id: Makefile.linux-xlr-4_19,v 0.1 Broadcom SDK $
|
||||
# $Copyright: (c) 2015 Broadcom Corp.
|
||||
# All Rights Reserved.$
|
||||
|
||||
#
|
||||
# XLR system make file.
|
||||
#
|
||||
# Most of this was taken from target x86-smp_generic_64-2_6.
|
||||
#
|
||||
|
||||
|
||||
#############################################################################
|
||||
# this segment is custom and not sourced from any existing makefile #
|
||||
# (base thanks to http:<slash><slash>confluence.broadcom.com/display/NTSWSW/X86+System) #
|
||||
#############################################################################
|
||||
|
||||
# set up a basic feature list. tcl, etc. #
|
||||
#ifeq (,$(FEATURE_LIST))
|
||||
#FEATURE_LIST = TCL BFD PTP CINT L3 I2C MEM_SCAN EDITLINE BCM_SAL_PROFILE CUSTOMER TEST CHASSIS MSTP RCPU
|
||||
#endif
|
||||
|
||||
# some basic path variables for tools and kernel source, etc #
|
||||
export XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-419
|
||||
TOOLCHAIN_DIR = $(XLR_TOOLS_BASE)/buildroot/host/usr
|
||||
KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux
|
||||
|
||||
# set up cross compile prefix, tools dir variables. #
|
||||
export CROSS_COMPILE := x86_64-broadcom-linux-gnu-
|
||||
export TOOLS_DIR := $(TOOLCHAIN_DIR)/bin
|
||||
|
||||
# architecture. #
|
||||
ARCH = x86_64
|
||||
TARGET_ARCHITECTURE = x86_64-broadcom-linux-gnu
|
||||
|
||||
# Noisy kernel build
|
||||
KBUILD_VERBOSE = 1
|
||||
|
||||
export ARCH KBUILD_VERBOSE
|
||||
|
||||
# set up paths. #
|
||||
export LIBRARY_PATH := $(TOOLCHAIN_DIR)/lib:$(TOOLCHAIN_DIR)/lib64:$(LIBRARY_PATH)
|
||||
export PATH := $(TOOLCHAIN_DIR)/bin:$(KERNDIR):$(PATH)
|
||||
|
||||
# set up SYSINC path #
|
||||
export SYSINC := $(XLR_TOOLS_BASE)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/5.4.0/include
|
||||
|
||||
|
||||
# CFLAGS/CFGFLAGS #
|
||||
CFLAGS += -DUSE_LINUX_BDE_MMAP=1
|
||||
#CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT
|
||||
CFLAGS += -Wno-error=unused-value
|
||||
CFLAGS += -Wno-error=unused-but-set-variable
|
||||
CFLAGS += -Wno-error=maybe-uninitialized
|
||||
CFLAGS += -Wno-error=cpp
|
||||
CFLAGS += -Wno-error=aggressive-loop-optimizations
|
||||
CFLAGS += -Wno-error=array-bounds
|
||||
CFLAGS += -Wno-error=strict-overflow
|
||||
CFLAGS += -L$(TOOLCHAIN_DIR)/lib
|
||||
CFLAGS += -L$(TOOLCHAIN_DIR)/lib64
|
||||
#CFLAGS += -Wl,--rpath=/lib64 # may need to set rpath and dynamic-linker path here (and possibly in KLFAGS below) in the future, #
|
||||
#CFLAGS += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 # if we want to build the target executable to be used with shared libs #
|
||||
|
||||
#XLDK-568 fix inline references
|
||||
CFGFLAGS += -fgnu89-inline
|
||||
|
||||
|
||||
# set up KFLAGS appropriately. #
|
||||
ifeq (,$(KFLAGS))
|
||||
KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-larger-than=1024 -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack
|
||||
endif
|
||||
|
||||
|
||||
######################################################################
|
||||
# this segment comes from make/Makefile.linux-x86-smp_generic_64-2_6 #
|
||||
######################################################################
|
||||
CFGFLAGS += -DLONGS_ARE_64BITS
|
||||
CFGFLAGS += -DPTRS_ARE_64BITS
|
||||
CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ
|
||||
|
||||
|
||||
##############################################################
|
||||
# This segment comes from make/Makefile.linux-x86-common-2_6 #
|
||||
##############################################################
|
||||
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\"
|
||||
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
|
||||
|
||||
# Extra variables.
|
||||
EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
|
||||
|
||||
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)))")
|
||||
|
||||
ifdef LTSW_CHIPS
|
||||
# Ensure we do not use an out-of-date libelf.so
|
||||
ELFUTILS_MIN = 158
|
||||
ELFUTILS_DIR ?= /projects/ntsw-tools/lib
|
||||
|
||||
# Default open source target build
|
||||
OPENSRC_BUILD ?= fed21-x86_64
|
||||
|
||||
# Hardware interface (see $SDKLT/bcma/sys/probe directory)
|
||||
SYSTEM_INTERFACE ?= ngbde
|
||||
|
||||
# Turn on direct register access if running on real hardware.
|
||||
ifeq (ngbde,$(SYSTEM_INTERFACE))
|
||||
LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
|
||||
endif
|
||||
|
||||
export SYSTEM_INTERFACE
|
||||
endif
|
||||
|
||||
ifneq ($(targetplat),user)
|
||||
# By default we exclude -Werror from x86 kernel builds
|
||||
BCM_CFLAGS = -Wall
|
||||
include ${SDK}/make/Makefile.linux-kernel-2_6
|
||||
endif
|
||||
|
||||
|
@ -55,14 +55,16 @@ THIS_MOD_NAME := linux-kernel-bde
|
||||
MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o
|
||||
KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko
|
||||
|
||||
build: kernel_libs $(MODULE) $(KMODULE)
|
||||
build: kernel_libs module $(KMODULE)
|
||||
else
|
||||
MODULE = $(LIBDIR)/linux-kernel-bde.o
|
||||
|
||||
build: kernel_libs $(MODULE)
|
||||
build: kernel_libs module
|
||||
endif
|
||||
|
||||
$(MODULE): $(BLDDIR)/.tree kernel_libs $(BOBJS)
|
||||
module: kernel_libs $(MODULE)
|
||||
|
||||
$(MODULE): $(BLDDIR)/.tree $(BOBJS)
|
||||
mkdir -p $(@D)
|
||||
$(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@
|
||||
ifneq ($(kernel_version),2_4)
|
||||
|
@ -1,25 +1,21 @@
|
||||
/*
|
||||
* Copyright 2017 Broadcom
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2, as
|
||||
* published by the Free Software Foundation (the "GPL").
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 (GPLv2) for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 (GPLv2) along with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: linux-kernel-bde.c,v 1.414 Broadcom SDK $
|
||||
* $Copyright: (c) 2005 Broadcom Corp.
|
||||
* All Rights Reserved.$
|
||||
*
|
||||
* Linux Kernel BDE
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gmodule.h>
|
||||
@ -30,27 +26,32 @@
|
||||
#include <linux/types.h>
|
||||
#include <sdk_config.h>
|
||||
#include <soc/devids.h>
|
||||
#include <soc/cmic.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "linux_shbde.h"
|
||||
|
||||
#define MEMCPY memcpy
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if __GNUC__ == 8
|
||||
#ifdef CONFIG_X86_64
|
||||
#if (defined(__GNUC__) && (__GNUC__ == 8))
|
||||
/*
|
||||
* Prevent gcc 8.1.10 using a compiler inline memcpy even if using -fno-builtin or
|
||||
* -fno-builtin-memcpy .
|
||||
* __inline_memcpy and __memcpy are kernel functions that may be used instead,
|
||||
* for either an inline or non-inline implementations of the function
|
||||
*/
|
||||
#define MEMCPY __inline_memcpy
|
||||
#else
|
||||
#define MEMCPY memcpy
|
||||
#endif /* __GNUC__ == 8 */
|
||||
#else /* ifdef __GNUC__ */
|
||||
#define MEMCPY memcpy
|
||||
#endif /* ifdef __GNUC__ */
|
||||
#undef MEMCPY
|
||||
#define MEMCPY __memcpy
|
||||
#endif /* (defined(__GNUC__) && (__GNUC__ == 8)) */
|
||||
#endif /* CONFIG_X86_64 */
|
||||
|
||||
|
||||
#if defined(CMIC_SOFT_BYTE_SWAP)
|
||||
#define CMIC_SWAP32(_x) ((((_x) & 0xff000000) >> 24) \
|
||||
| (((_x) & 0x00ff0000) >> 8) \
|
||||
| (((_x) & 0x0000ff00) << 8) \
|
||||
| (((_x) & 0x000000ff) << 24))
|
||||
#endif /* defined(CMIC_SOFT_BYTE_SWAP) */
|
||||
|
||||
#define PCI_USE_INT_NONE (-1)
|
||||
#define PCI_USE_INT_INTX (0)
|
||||
@ -68,8 +69,15 @@ MODULE_AUTHOR("Broadcom Corporation");
|
||||
MODULE_DESCRIPTION("Kernel BDE");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
/* PCIe max payload */
|
||||
int maxpayload = 256;
|
||||
/*
|
||||
* PCIe max payload size in bytes.
|
||||
* The default value if not specified to the kernel module by maxpayload is historically 256.
|
||||
* The default value may be changed using the BDE_PCIE_MAXPAYLOAD_DEFAULT macro.
|
||||
*/
|
||||
#ifndef BDE_PCIE_MAXPAYLOAD_DEFAULT
|
||||
#define BDE_PCIE_MAXPAYLOAD_DEFAULT 256
|
||||
#endif
|
||||
int maxpayload = BDE_PCIE_MAXPAYLOAD_DEFAULT;
|
||||
LKM_MOD_PARAM(maxpayload, "i", int, 0);
|
||||
MODULE_PARM_DESC(maxpayload,
|
||||
"Limit maximum payload size and request size on PCIe devices");
|
||||
@ -256,6 +264,19 @@ struct bde_spi_device_id {
|
||||
uint32 spifreq;
|
||||
};
|
||||
|
||||
/* Maximum number of I/O windows supported per device. */
|
||||
#define BDE_NUM_IOWIN_MAX 3
|
||||
|
||||
/* I/O memory window definition. */
|
||||
struct memwin_s {
|
||||
|
||||
/* Physical address of I/O window. */
|
||||
resource_size_t addr;
|
||||
|
||||
/* Size of I/O window (in bytes). */
|
||||
resource_size_t size;
|
||||
};
|
||||
|
||||
/* Control Data */
|
||||
typedef struct bde_ctrl_s {
|
||||
struct list_head list;
|
||||
@ -285,10 +306,7 @@ typedef struct bde_ctrl_s {
|
||||
struct device *dma_dev;
|
||||
#endif
|
||||
|
||||
/* Physical addresses */
|
||||
resource_size_t phys_address;
|
||||
resource_size_t phys_address1;
|
||||
resource_size_t phys_address2;
|
||||
struct memwin_s iowin[BDE_NUM_IOWIN_MAX];
|
||||
|
||||
/* Secondary mapped base address */
|
||||
sal_vaddr_t alt_base_addr;
|
||||
@ -334,7 +352,7 @@ static int _cpu_ndevices = 0;
|
||||
|
||||
#if defined(IPROC_CMICD) && defined(CONFIG_OF)
|
||||
#define ICFG_CHIP_ID_REG 0x10236000
|
||||
#define IHOST_CMICX_MAX_INTRS 128
|
||||
#define IHOST_CMICX_MAX_INTRS 129
|
||||
static uint32 iproc_cmicx_irqs[IHOST_CMICX_MAX_INTRS];
|
||||
#endif
|
||||
|
||||
@ -415,7 +433,7 @@ static void *cpu_address = NULL;
|
||||
/* 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
|
||||
@ -432,10 +450,11 @@ static void *cpu_address = NULL;
|
||||
|
||||
#define IHOST_GICD_REG_ADDR_VALID(d, addr) \
|
||||
(_devices[d].bde_dev.base_address1 && \
|
||||
(addr & 0xFFFFFF00) == _devices[d].phys_address1)
|
||||
(addr & 0xFFFFFF00) == _devices[d].iowin[1].addr)
|
||||
|
||||
#define IHOST_GICD_REG_ADDR_REMAP(d, addr) \
|
||||
(void *)(_devices[d].bde_dev.base_address1 + (addr - _devices[d].phys_address1))
|
||||
(void *)(_devices[d].bde_dev.base_address1 + \
|
||||
(addr - ((sal_vaddr_t)_devices[d].iowin[1].addr)))
|
||||
|
||||
static uint32_t _read(int d, uint32_t addr);
|
||||
|
||||
@ -554,7 +573,8 @@ _eb_device_create(resource_size_t paddr, int irq, int rd_hw, int wr_hw)
|
||||
|
||||
/* Map in the device */
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, 0x10000);
|
||||
ctrl->phys_address = paddr;
|
||||
ctrl->iowin[0].addr = paddr;
|
||||
ctrl->iowin[0].size = 0x10000;
|
||||
|
||||
dev_rev_id = _read(dev_id, 0x178); /* CMIC_DEV_REV_ID */
|
||||
|
||||
@ -590,7 +610,8 @@ sand_device_create(void)
|
||||
|
||||
/* Map in the device */ /* FIX_ME: not realy map anything */
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(0x40000000, 0x100000);
|
||||
ctrl->phys_address = 0x40000000;
|
||||
ctrl->iowin[0].addr = 0x40000000;
|
||||
ctrl->iowin[0].size = 0x100000;
|
||||
|
||||
ctrl->iLine = 0;
|
||||
ctrl->isr = NULL;
|
||||
@ -695,7 +716,8 @@ iproc_cmicd_probe(struct platform_device *pldev)
|
||||
gprintk("Error mapping iProc CMIC registers");
|
||||
return -1;
|
||||
}
|
||||
ctrl->phys_address = memres->start;
|
||||
ctrl->iowin[0].addr = memres->start;
|
||||
ctrl->iowin[0].size = size;
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) {
|
||||
@ -712,16 +734,18 @@ iproc_cmicd_probe(struct platform_device *pldev)
|
||||
memres = iproc_platform_get_resource(pldev, IORESOURCE_MEM, 1);
|
||||
if (memres) {
|
||||
ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(memres->start, memres->end - memres->start + 1);
|
||||
ctrl->phys_address1 = memres->start;
|
||||
ctrl->iowin[1].addr = memres->start;
|
||||
ctrl->iowin[1].size = memres->end - memres->start + 1;
|
||||
} else {
|
||||
/* Use default address if not available in DTB */
|
||||
ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(IHOST_GICD_REG_ADDR, IHOST_GICD_REG_REMAP_LEN);
|
||||
ctrl->phys_address1 = IHOST_GICD_REG_ADDR;
|
||||
ctrl->iowin[1].addr = IHOST_GICD_REG_ADDR;
|
||||
ctrl->iowin[1].size = IHOST_GICD_REG_REMAP_LEN;
|
||||
}
|
||||
if (ctrl->bde_dev.base_address1) {
|
||||
if (debug >= 1) {
|
||||
gprintk("base_address1:0x%lx phys_address1:0x%lx\n",
|
||||
(unsigned long)ctrl->bde_dev.base_address1, (unsigned long)ctrl->phys_address1);
|
||||
(unsigned long)ctrl->bde_dev.base_address1, (unsigned long)ctrl->iowin[1].addr);
|
||||
}
|
||||
} else {
|
||||
gprintk("Error mapping ihost GICD registers\n");
|
||||
@ -753,9 +777,12 @@ iproc_cmicd_probe(struct platform_device *pldev)
|
||||
#ifdef CONFIG_OF
|
||||
if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) {
|
||||
int i;
|
||||
memset(iproc_cmicx_irqs, 0, IHOST_CMICX_MAX_INTRS*sizeof(uint32_t));
|
||||
for (i = 0; i < IHOST_CMICX_MAX_INTRS; i++) {
|
||||
irqres = iproc_platform_get_resource(pldev, IORESOURCE_IRQ, i);
|
||||
iproc_cmicx_irqs[i] = irqres->start;
|
||||
if (irqres) {
|
||||
iproc_cmicx_irqs[i] = irqres->start;
|
||||
}
|
||||
if (debug >= 1) {
|
||||
gprintk("iproc_cmicx_irqs[%d] = %d\n", i, iproc_cmicx_irqs[i]);
|
||||
}
|
||||
@ -1019,7 +1046,8 @@ _ics_bde_create(void)
|
||||
/* Map in the device */
|
||||
paddr = BCM_ICS_CMIC_BASE;
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, 0x10000);
|
||||
ctrl->phys_address = paddr;
|
||||
ctrl->iowin[0].addr = paddr;
|
||||
ctrl->iowin[0].size = 0x10000;
|
||||
|
||||
dev_rev_id = *((unsigned int *)(KSEG1ADDR(paddr + 0x178)));
|
||||
|
||||
@ -1399,6 +1427,8 @@ static const struct pci_device_id _id_table[] = {
|
||||
{ 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 },
|
||||
{ BROADCOM_VENDOR_ID, BCM56070_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56071_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9656, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BCM53000_VENDOR_ID, BCM53000PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
@ -1463,6 +1493,7 @@ static const struct pci_device_id _id_table[] = {
|
||||
{ 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, BCM88687_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, BCM88202_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
@ -1493,8 +1524,38 @@ static const struct pci_device_id _id_table[] = {
|
||||
{ BROADCOM_VENDOR_ID, BCM8869B_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8869C_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8869D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8869E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8869F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88800_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88821_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88826_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88802_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88803_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88804_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88805_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88806_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88820_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88822_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88823_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88824_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88825_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88480_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88481_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88482_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88483_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88484_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88485_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88486_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88487_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88488_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88489_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8848A_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8848B_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8848C_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8848D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8848E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM8848F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM88850_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
#endif /* BCM_DNX_SUPPORT */
|
||||
#ifdef BCM_DFE_SUPPORT
|
||||
{ BROADCOM_VENDOR_ID, BCM88750_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
@ -1546,6 +1607,12 @@ static const struct pci_device_id _id_table[] = {
|
||||
{ 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, BCM56273_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56274_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56275_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56276_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56277_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56278_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56370_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56371_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56372_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
@ -1568,6 +1635,9 @@ static const struct pci_device_id _id_table[] = {
|
||||
{ BROADCOM_VENDOR_ID, BCM53547_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM53548_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM53549_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56470_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56471_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ BROADCOM_VENDOR_ID, BCM56472_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ 0, 0, 0, 0 }
|
||||
};;
|
||||
|
||||
@ -2180,7 +2250,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
resource_size_t paddr;
|
||||
uint16 cmd = 0;
|
||||
uint32 bar_len;
|
||||
int cmic_bar;
|
||||
int i, cmic_bar;
|
||||
int baroff = 0;
|
||||
int iproc = 0;
|
||||
int plx_dev = 0;
|
||||
@ -2219,7 +2289,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
}
|
||||
}
|
||||
#endif /* IPROC_CMICD */
|
||||
|
||||
|
||||
/*
|
||||
* Note that a few supported devices have a non-Broadcom PCI vendor ID,
|
||||
* but since none of their associated PCI device IDs collide with the
|
||||
@ -2441,7 +2511,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
((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) {
|
||||
if (maxpayload && maxpayload != 128) {
|
||||
maxpayload = 128;
|
||||
if (debug >= 1) gprintk("force max payload size to 128\n");
|
||||
}
|
||||
@ -2500,19 +2570,6 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
}
|
||||
#endif /* BCM_DFE_SUPPORT */
|
||||
|
||||
#if defined(BCM_DNXF_SUPPORT)
|
||||
/*All Ramon devices from 0x8790 to 0x879F*/
|
||||
if ((dev->device & BCM_DNXF_DEVID_MASK) == 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);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Prevent compiler warning */
|
||||
if (ctrl == NULL) {
|
||||
return 0;
|
||||
@ -2523,6 +2580,15 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
ctrl->pci_device = dev;
|
||||
pci_set_drvdata(dev, ctrl);
|
||||
|
||||
/*
|
||||
* Sample setting of unique ID, used the PCIe address of the device:
|
||||
* domain, bus, slot, function in hex digits: DDDDBBSS (SS includes the slot/device and function.
|
||||
* Tested with old kernels from 2.6 .
|
||||
* Do not use the PCI_DEVID macro which old kernel versions don't have. */
|
||||
ctrl->bde_dev.dev_unique_id = dev->bus ?
|
||||
(((uint32)pci_domain_nr(dev->bus)) << 16) ^ (((uint32)dev->bus->number) << 8) ^ dev->devfn :
|
||||
dev->devfn;
|
||||
|
||||
/* Check for iProc device */
|
||||
if (shbde_pci_is_iproc(shbde, dev, &cmic_bar)) {
|
||||
iproc = 1;
|
||||
@ -2557,13 +2623,21 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
}
|
||||
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, bar_len);
|
||||
ctrl->phys_address = paddr;
|
||||
ctrl->iowin[0].addr = paddr;
|
||||
ctrl->iowin[0].size = bar_len;
|
||||
|
||||
if (debug >= 3) {
|
||||
gprintk("BAR %d: kernel addr:0x%lx phys addr:0x%lx length:%lx\n",
|
||||
baroff, (unsigned long)ctrl->bde_dev.base_address, (unsigned long)paddr, (unsigned long)bar_len);
|
||||
}
|
||||
|
||||
/* Map secondary address spaces */
|
||||
for (i = 1; i < BDE_NUM_IOWIN_MAX; i++) {
|
||||
ctrl->iowin[i].addr = 0;
|
||||
ctrl->iowin[i].size = 0;
|
||||
}
|
||||
ctrl->bde_dev.base_address1 = 0;
|
||||
|
||||
if (iproc
|
||||
#ifdef DNX_TEST_BOARD
|
||||
|| (dev->device == PLX9056_DEVICE_ID && baroff == 2)
|
||||
@ -2572,7 +2646,8 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
||||
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);
|
||||
ctrl->phys_address1 = paddr;
|
||||
ctrl->iowin[1].addr = paddr;
|
||||
ctrl->iowin[1].size = bar_len;
|
||||
if (debug >= 3) {
|
||||
gprintk("BAR 0: kernel addr:0x%lx phys addr:0x%lx length:%lx\n",
|
||||
(unsigned long)ctrl->bde_dev.base_address1, (unsigned long)paddr, (unsigned long)bar_len);
|
||||
@ -2773,7 +2848,8 @@ map_local_bus(uint64_t addr, uint32_t size)
|
||||
|
||||
/* Map in the device */
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(addr, size);
|
||||
ctrl->phys_address = addr;
|
||||
ctrl->iowin[0].addr = addr;
|
||||
ctrl->iowin[0].size = size;
|
||||
|
||||
_bde_add_device();
|
||||
return(ctrl);
|
||||
@ -2817,7 +2893,8 @@ map_local_bus2(bde_ctrl_t *plx_ctrl, uint32_t dev_base, uint32_t size)
|
||||
|
||||
/* Map in the device */
|
||||
ctrl->bde_dev.base_address = plx_ctrl->bde_dev.base_address + dev_base;
|
||||
ctrl->phys_address = plx_ctrl->phys_address + (resource_size_t)dev_base;
|
||||
ctrl->iowin[0].addr = plx_ctrl->iowin[0].addr + (resource_size_t)dev_base;
|
||||
ctrl->iowin[0].size = size;
|
||||
|
||||
#if 1
|
||||
addr = (uint8_t *)ctrl->bde_dev.base_address + PL0_REVISION_REG;
|
||||
@ -2850,12 +2927,12 @@ probe_plx_local_bus(void)
|
||||
}
|
||||
addr_hi_str[0] = 0;
|
||||
#ifdef PHYS_ADDR_IS_64BIT
|
||||
sprintf(addr_hi_str, "%08x", (uint32_t)(plx_ctrl.phys_address >> 32));
|
||||
sprintf(addr_hi_str, "%08x", (uint32_t)(plx_ctrl.iowin[0].addr >> 32));
|
||||
#endif
|
||||
printk(KERN_ERR "Found PLX %04x:%04x vir: 0x%08x phy: 0x%s%08x\n",
|
||||
plx_ctrl.bde_dev.device, plx_ctrl.bde_dev.rev,
|
||||
plx_ctrl.bde_dev.base_address, addr_hi_str,
|
||||
(uint32_t)(plx_ctrl.phys_address));
|
||||
(uint32_t)(plx_ctrl.iowin[0].addr));
|
||||
|
||||
addr = (uint8_t *)plx_ctrl.bde_dev.base_address + CPLD_OFFSET + CPLD_REVISION_REG;
|
||||
val = readl(addr);
|
||||
@ -2947,9 +3024,9 @@ _init(void)
|
||||
}
|
||||
#else
|
||||
if (use_msi > PCI_USE_INT_INTX) {
|
||||
/* Warn if invalid configuration */
|
||||
gprintk("MSI interrupts not supported by kernel\n");
|
||||
}
|
||||
/* Warn if invalid configuration */
|
||||
gprintk("MSI interrupts not supported by kernel\n");
|
||||
}
|
||||
use_msi = PCI_USE_INT_INTX;
|
||||
#endif /* CONFIG_PCI_MSI */
|
||||
|
||||
@ -3079,6 +3156,10 @@ _pprint(void)
|
||||
|
||||
pprintf("Broadcom Device Enumerator (%s)\n", LINUX_KERNEL_BDE_NAME);
|
||||
|
||||
pprintf("Module parameters:\n");
|
||||
pprintf("\tmaxpayload=%d\n", maxpayload);
|
||||
pprintf("\tusemsi=%d\n", usemsi);
|
||||
|
||||
_dma_pprint();
|
||||
|
||||
if (_ndevices == 0) {
|
||||
@ -3134,7 +3215,7 @@ _pprint(void)
|
||||
pprintf("AXI Device 0x%x:0x%x:0x%.8lx:%d\n",
|
||||
ctrl->bde_dev.device,
|
||||
ctrl->bde_dev.rev,
|
||||
(unsigned long)ctrl->phys_address,
|
||||
(unsigned long)ctrl->iowin[0].addr,
|
||||
ctrl->iLine);
|
||||
} else if (ctrl->dev_type & BDE_EB_DEV_TYPE) {
|
||||
pprintf("EB Bus Device 0x%x:0x%x\n",
|
||||
@ -3150,6 +3231,54 @@ _pprint(void)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Some kernels are configured to prevent mapping of kernel RAM memory
|
||||
* into user space via the /dev/mem device.
|
||||
*
|
||||
* The function below provides a backdoor to map IO and DMA memory to
|
||||
* user space via the BDE device file.
|
||||
*/
|
||||
static int
|
||||
_bde_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
unsigned long paddr = vma->vm_pgoff << PAGE_SHIFT;
|
||||
unsigned long size = vma->vm_end - vma->vm_start;
|
||||
int i, j, pio_range_valid = 0;
|
||||
|
||||
for(i = 0; i < _ndevices; i++) {
|
||||
bde_ctrl_t *ctrl = _devices + i;
|
||||
if (ctrl->dev_type & BDE_SWITCH_DEV_TYPE) {
|
||||
for (j = 0; j < BDE_NUM_IOWIN_MAX; j++) {
|
||||
if (paddr >= (unsigned long)ctrl->iowin[j].addr &&
|
||||
(paddr + size) <= (unsigned long)(ctrl->iowin[j].addr + ctrl->iowin[j].size)) {
|
||||
pio_range_valid = 1;
|
||||
break;
|
||||
}
|
||||
if ((ctrl->dev_type & BDE_AXI_DEV_TYPE) && (paddr == ctrl->iowin[j].addr)) {
|
||||
pio_range_valid = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pio_range_valid) {
|
||||
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
|
||||
|
||||
if (remap_pfn_range(vma,
|
||||
vma->vm_start,
|
||||
vma->vm_pgoff,
|
||||
size,
|
||||
vma->vm_page_prot)) {
|
||||
gprintk("Failed to mmap phys range 0x%lx-0x%lx to 0x%lx-0x%lx\n",
|
||||
paddr, paddr + size, vma->vm_start,vma->vm_end);
|
||||
return -EAGAIN;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _dma_mmap(filp, vma);
|
||||
}
|
||||
|
||||
/* Workaround for broken Busybox/PPC insmod */
|
||||
static char _modname[] = LINUX_KERNEL_BDE_NAME;
|
||||
@ -3160,7 +3289,7 @@ static gmodule_t _gmodule = {
|
||||
init: _init,
|
||||
cleanup: _cleanup,
|
||||
pprint: _pprint,
|
||||
mmap: _dma_mmap,
|
||||
mmap: _bde_mmap,
|
||||
};
|
||||
|
||||
gmodule_t *
|
||||
@ -3479,6 +3608,9 @@ _interrupt_connect(int d,
|
||||
if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) {
|
||||
int i, j;
|
||||
for (i = 0; i < IHOST_CMICX_MAX_INTRS; i++) {
|
||||
if (!iproc_cmicx_irqs[i]) {
|
||||
continue;
|
||||
}
|
||||
if (unlikely(debug >= 1))
|
||||
gprintk("%s(%d):device# = %d, request_irq(%d)\n",
|
||||
__func__, __LINE__, d, iproc_cmicx_irqs[i]);
|
||||
@ -3491,6 +3623,9 @@ _interrupt_connect(int d,
|
||||
}
|
||||
if (ret < 0) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (!iproc_cmicx_irqs[j]) {
|
||||
continue;
|
||||
}
|
||||
free_irq(iproc_cmicx_irqs[j], ctrl);
|
||||
}
|
||||
goto err_disable_msi;
|
||||
@ -3519,10 +3654,10 @@ err_disable_msi:
|
||||
msi_exit:
|
||||
#endif
|
||||
gprintk("could not request IRQ\n");
|
||||
ctrl->isr = NULL;
|
||||
ctrl->isr_data = NULL;
|
||||
ctrl->isr2 = NULL;
|
||||
ctrl->isr2_data = NULL;
|
||||
ctrl->isr = NULL;
|
||||
ctrl->isr_data = NULL;
|
||||
ctrl->isr2 = NULL;
|
||||
ctrl->isr2_data = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -3600,6 +3735,9 @@ _interrupt_disconnect(int d)
|
||||
if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) {
|
||||
int i;
|
||||
for (i = 0; i < IHOST_CMICX_MAX_INTRS; i++) {
|
||||
if (!iproc_cmicx_irqs[i]) {
|
||||
continue;
|
||||
}
|
||||
if (unlikely(debug > 1)) {
|
||||
gprintk("%s(%d):device# = %d, free_irq(%d)\n",
|
||||
__func__, __LINE__, d, iproc_cmicx_irqs[i]);
|
||||
@ -3862,10 +4000,10 @@ lkbde_cpu_pci_register(int d)
|
||||
case BCM88683_DEVICE_ID:
|
||||
case BCM88684_DEVICE_ID:
|
||||
case BCM88685_DEVICE_ID:
|
||||
case BCM88687_DEVICE_ID:
|
||||
case BCM88380_DEVICE_ID:
|
||||
case BCM88381_DEVICE_ID:
|
||||
case BCM88680_DEVICE_ID:
|
||||
case BCM88800_DEVICE_ID:
|
||||
case BCM88470_DEVICE_ID:
|
||||
case BCM88470P_DEVICE_ID:
|
||||
case BCM88471_DEVICE_ID:
|
||||
@ -3915,34 +4053,41 @@ lkbde_cpu_pci_register(int d)
|
||||
break;
|
||||
}
|
||||
|
||||
/* configure iproc >=14 devices by device family */
|
||||
#if defined(BCM_DNXF_SUPPORT) || defined(BCM_DNX_SUPPORT)
|
||||
switch (ctrl->bde_dev.device & DNXC_DEVID_FAMILY_MASK) {
|
||||
#ifdef BCM_DNX_SUPPORT
|
||||
/*All Jericho 2 devices from 0x8690 to 0x869F*/
|
||||
if (SOC_IS_JERICHO_2_TYPE(ctrl->bde_dev.device)) {
|
||||
/* Fix bar 0 address */ /* FIXME: write full phy address */
|
||||
pci_write_config_byte(ctrl->pci_device, 0x12, 0x10);
|
||||
pci_write_config_byte(ctrl->pci_device, 0x13, 0x60);
|
||||
|
||||
case JERICHO2_DEVICE_ID:
|
||||
case J2C_DEVICE_ID:
|
||||
case J2C_2ND_DEVICE_ID:
|
||||
case Q2A_DEVICE_ID:
|
||||
case J2P_DEVICE_ID:
|
||||
#endif
|
||||
#ifdef BCM_DNXF_SUPPORT
|
||||
case BCM88790_DEVICE_ID:
|
||||
#endif
|
||||
/*
|
||||
* For DMA transactions - set Max_Payload_Size and
|
||||
* Max_Read_Request_Size to 128 bytes.
|
||||
*/
|
||||
pci_write_config_byte(ctrl->pci_device, 0xb5, 0x0c);
|
||||
pci_write_config_byte(ctrl->pci_device, 0xb4, 0x0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(BCM_DNXF_SUPPORT) || defined(BCM_DNX_SUPPORT) */
|
||||
|
||||
/* Redo ioremap */
|
||||
if (ctrl->bde_dev.base_address) {
|
||||
iounmap((void *)ctrl->bde_dev.base_address);
|
||||
}
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(ctrl->phys_address, 0x1000000);
|
||||
ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(ctrl->iowin[0].addr, 0x1000000);
|
||||
|
||||
if (debug >= 1) {
|
||||
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\n",
|
||||
ctrl->dev_type, (unsigned long)ctrl->phys_address);
|
||||
ctrl->dev_type, (unsigned long)ctrl->iowin[0].addr);
|
||||
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,
|
||||
@ -4089,7 +4234,7 @@ lkbde_get_dev_phys(int d)
|
||||
d, _devices[d].dev_type);
|
||||
return 0;
|
||||
}
|
||||
return _devices[d].phys_address;
|
||||
return _devices[d].iowin[0].addr;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@ -4105,7 +4250,7 @@ lkbde_get_dev_phys_hi(int d)
|
||||
return 0;
|
||||
}
|
||||
#ifdef PHYS_ADDR_IS_64BIT
|
||||
return (uint32_t)(_devices[d].phys_address >> 32);
|
||||
return (uint32_t)(_devices[d].iowin[0].addr >> 32);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
@ -4151,15 +4296,15 @@ lkbde_get_dev_resource(int d, int rsrc, uint32_t *flags,
|
||||
|
||||
switch (rsrc) {
|
||||
case 0:
|
||||
*phys_lo = (uint32_t)(_devices[d].phys_address);
|
||||
*phys_lo = (uint32_t)(_devices[d].iowin[0].addr);
|
||||
#ifdef PHYS_ADDR_IS_64BIT
|
||||
*phys_hi = (uint32_t)(_devices[d].phys_address >> 32);
|
||||
*phys_hi = (uint32_t)(_devices[d].iowin[0].addr >> 32);
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
*phys_lo = (uint32_t)(_devices[d].phys_address1);
|
||||
*phys_lo = (uint32_t)(_devices[d].iowin[1].addr);
|
||||
#ifdef PHYS_ADDR_IS_64BIT
|
||||
*phys_hi = (uint32_t)(_devices[d].phys_address1 >> 32);
|
||||
*phys_hi = (uint32_t)(_devices[d].iowin[1].addr >> 32);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
@ -4286,7 +4431,7 @@ lkbde_irq_mask_set(int d, uint32_t addr, uint32_t mask, uint32_t fmask)
|
||||
if (iproc_reg) {
|
||||
_iproc_write(d, addr, ctrl->imask | ctrl->imask2);
|
||||
} else {
|
||||
_write(d, addr, ctrl->imask | ctrl->imask2);
|
||||
_write(d, addr, ctrl->imask | ctrl->imask2);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&ctrl->lock, flags);
|
||||
@ -4326,7 +4471,7 @@ lkbde_irq_mask_get(int d, uint32_t *mask, uint32_t *fmask)
|
||||
|
||||
*fmask = ctrl->fmask;
|
||||
*mask = ctrl->imask | ctrl->imask2;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,10 @@
|
||||
#include <mpool.h>
|
||||
#include <sdk_config.h>
|
||||
|
||||
#if defined(IPROC_CMICD) && defined(CONFIG_OF)
|
||||
#include <linux/of.h>
|
||||
#endif
|
||||
|
||||
#ifdef BCM_PLX9656_LOCAL_BUS
|
||||
#include <asm/cacheflush.h>
|
||||
#endif
|
||||
@ -117,9 +121,9 @@
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
|
||||
#define DMA_MAPPING_ERROR(d, p) dma_mapping_error((d),(p))
|
||||
#define BDE_DMA_MAPPING_ERROR(d, p) dma_mapping_error((d),(p))
|
||||
#else
|
||||
#define DMA_MAPPING_ERROR(d, p) dma_mapping_error((p))
|
||||
#define BDE_DMA_MAPPING_ERROR(d, p) dma_mapping_error((p))
|
||||
#endif
|
||||
|
||||
#ifndef KMALLOC_MAX_SIZE
|
||||
@ -612,6 +616,15 @@ static void
|
||||
_alloc_mpool(size_t size)
|
||||
{
|
||||
unsigned long pbase = 0;
|
||||
struct device *dev = DMA_DEV(DMA_DEV_INDEX);
|
||||
int dma64_support = 0;
|
||||
|
||||
#if defined(IPROC_CMICD) && defined(CONFIG_OF)
|
||||
if (of_find_compatible_node(NULL, NULL, "brcm,iproc-cmicx")) {
|
||||
dma64_support = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__arm__) && !defined(CONFIG_HIGHMEM)
|
||||
if (_use_himem) {
|
||||
gprintk("DMA in high memory requires CONFIG_HIGHMEM on ARM CPUs.\n");
|
||||
@ -647,8 +660,8 @@ _alloc_mpool(size_t size)
|
||||
/* get a memory allocation from the kernel */
|
||||
{
|
||||
dma_addr_t dma_handle;
|
||||
if (!(_dma_vbase = dma_alloc_coherent(DMA_DEV(DMA_DEV_INDEX),
|
||||
alloc_size, &dma_handle, GFP_KERNEL)) || !dma_handle) {
|
||||
_dma_vbase = dma_alloc_coherent(dev, alloc_size, &dma_handle, GFP_KERNEL);
|
||||
if (!_dma_vbase || !dma_handle) {
|
||||
gprintk("Failed to allocate coherent memory pool of size 0x%lx\n", (unsigned long)alloc_size);
|
||||
return;
|
||||
}
|
||||
@ -672,9 +685,9 @@ _alloc_mpool(size_t size)
|
||||
}
|
||||
_cpu_pbase = virt_to_bus(_dma_vbase);
|
||||
/* Use dma_map_single to obtain DMA bus address or IOVA if iommu is present. */
|
||||
if (DMA_DEV(DMA_DEV_INDEX)) {
|
||||
pbase = dma_map_single(DMA_DEV(DMA_DEV_INDEX), _dma_vbase, size, DMA_BIDIRECTIONAL);
|
||||
if (DMA_MAPPING_ERROR(DMA_DEV(DMA_DEV_INDEX), pbase)) {
|
||||
if (dev) {
|
||||
pbase = dma_map_single(dev, _dma_vbase, size, DMA_BIDIRECTIONAL);
|
||||
if (BDE_DMA_MAPPING_ERROR(dev, pbase)) {
|
||||
gprintk("Failed to map memory at %p\n", _dma_vbase);
|
||||
_pgcleanup();
|
||||
_dma_vbase = NULL;
|
||||
@ -692,7 +705,9 @@ _alloc_mpool(size_t size)
|
||||
return;
|
||||
}
|
||||
|
||||
if (((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) {
|
||||
_dma_pbase = pbase;
|
||||
|
||||
if (!dma64_support && ((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;
|
||||
@ -700,14 +715,13 @@ _alloc_mpool(size_t size)
|
||||
return;
|
||||
}
|
||||
|
||||
_dma_pbase = pbase;
|
||||
#ifdef REMAP_DMA_NONCACHED
|
||||
_dma_vbase = IOREMAP(_dma_pbase, size);
|
||||
#endif
|
||||
if (dma_debug >= 1) {
|
||||
gprintk("_use_dma_mapping:%d _dma_vbase:%p _dma_pbase:%lx _cpu_pbase:%lx allocated:%lx dmaalloc:%d\n",
|
||||
gprintk("_use_dma_mapping:%d _dma_vbase:%p _dma_pbase:%lx _cpu_pbase:%lx allocated:%lx dmaalloc:%d, dma64_support:%d\n",
|
||||
_use_dma_mapping, _dma_vbase, (unsigned long)_dma_pbase,
|
||||
(unsigned long)_cpu_pbase, (unsigned long)size, dmaalloc);
|
||||
(unsigned long)_cpu_pbase, (unsigned long)size, dmaalloc, dma64_support);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -749,7 +763,7 @@ void _dma_init(int dev_index)
|
||||
if (dev_index > DMA_DEV_INDEX) {
|
||||
if (_use_dma_mapping && DMA_DEV(dev_index) && _dma_vbase) {
|
||||
pbase = dma_map_single(DMA_DEV(dev_index), _dma_vbase, _dma_mem_size, DMA_BIDIRECTIONAL);
|
||||
if (DMA_MAPPING_ERROR(DMA_DEV(dev_index), pbase)) {
|
||||
if (BDE_DMA_MAPPING_ERROR(DMA_DEV(dev_index), pbase)) {
|
||||
gprintk("Failed to map memory for device %d at %p\n", dev_index, _dma_vbase);
|
||||
return;
|
||||
}
|
||||
@ -992,6 +1006,9 @@ lkbde_get_dma_info(phys_addr_t* cpu_pbase, phys_addr_t* dma_pbase, ssize_t* size
|
||||
void
|
||||
_dma_pprint(void)
|
||||
{
|
||||
pprintf("\tdmasize=%s\n", dmasize);
|
||||
pprintf("\thimem=%s\n", himem);
|
||||
pprintf("\thimemaddr=%s\n", himemaddr);
|
||||
pprintf("DMA Memory (%s): %d bytes, %d used, %d free%s\n",
|
||||
(_use_himem) ? "high" : "kernel",
|
||||
(_dma_vbase) ? _dma_mem_size : 0,
|
||||
|
@ -1,23 +1,20 @@
|
||||
/*
|
||||
* Copyright 2017 Broadcom
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2, as
|
||||
* published by the Free Software Foundation (the "GPL").
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 (GPLv2) for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 (GPLv2) along with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: linux-user-bde.c,v 1.80 Broadcom SDK $
|
||||
* $Copyright: (c) 2005 Broadcom Corp.
|
||||
* All Rights Reserved.$
|
||||
*
|
||||
* Linux User BDE Helper Module
|
||||
*/
|
||||
#include <gmodule.h>
|
||||
@ -81,6 +78,17 @@ The INTR base address values are changed for HX5,
|
||||
hence making new #defines so runtime decisions can
|
||||
be made.
|
||||
*/
|
||||
#define PAXB_0_PAXB_IC_INTRCLR_0 (0x180123a0)
|
||||
#define PAXB_0_PAXB_IC_INTRCLR_1 (0x180123a4)
|
||||
|
||||
#define PAXB_0_PAXB_IC_INTRCLR_MODE_0 (0x180123a8)
|
||||
#define PAXB_0_PAXB_IC_INTRCLR_MODE_1 (0x180123ac)
|
||||
|
||||
#define HX5_PAXB_0_PAXB_IC_INTRCLR_0 (0x102303a0)
|
||||
#define HX5_PAXB_0_PAXB_IC_INTRCLR_1 (0x102303a4)
|
||||
|
||||
#define HX5_PAXB_0_PAXB_IC_INTRCLR_MODE_0 (0x102303a8)
|
||||
#define HX5_PAXB_0_PAXB_IC_INTRCLR_MODE_1 (0x102303ac)
|
||||
|
||||
#define INTC_INTR_ENABLE_REG0 (0x180130f0)
|
||||
#define INTC_INTR_STATUS_REG0 (0x18013190)
|
||||
@ -104,12 +112,18 @@ be made.
|
||||
#define HX5_IHOST_GICD_ISENABLERN_1 (0x10781104)
|
||||
#define HX5_IHOST_GICD_ICENABLERN_1 (0x10781184)
|
||||
#define HX5_IHOST_GICD_ICENABLERN_8 (0x107811a0)
|
||||
#define HX5_IHOST_GICD_ISPENDRN_8 (0x10781220)
|
||||
/* Offset between ISENABLERN_1 and ICENABLERN_1 in 4-bytes */
|
||||
#define HX5_IHOST_IRQ_MASK_OFFSET 0x20
|
||||
#define HX5_IHOST_INTR_MAP_NUM (HX5_IHOST_GICD_ICENABLERN_8 - HX5_IHOST_GICD_ISENABLERN_0)
|
||||
/* Offset between ISENABLERN_1 and ISPENDRN_1 in 4-bytes */
|
||||
#define HX5_IHOST_IRQ_PEND_OFFSET 0x40
|
||||
#define HX5_IHOST_INTR_MAP_NUM (HX5_IHOST_GICD_ISPENDRN_8 - HX5_IHOST_GICD_ISENABLERN_0)
|
||||
#define HX5_IHOST_INTR_STATUS_MAP_NUM (INTC_INTR_REG_NUM * (sizeof(uint32)))
|
||||
#define IRQ_BIT(intr) (intr % (sizeof(uint32)*8))
|
||||
#define IRQ_MASK_INDEX(intr) (intr / (sizeof(uint32)*8))
|
||||
#define HX5_SW_PROG_INTR_PRIORITY 73
|
||||
#define INTR_SW_PROG_INTR_BITPOS (1 << IRQ_BIT(HX5_SW_PROG_INTR_PRIORITY))
|
||||
#define INTC_SW_PROG_INTR_REG_IND IRQ_MASK_INDEX(HX5_SW_PROG_INTR_PRIORITY)
|
||||
#define HX5_CHIP_INTR_LOW_PRIORITY 119
|
||||
#define INTR_LOW_PRIORITY_BITPOS (1 << IRQ_BIT(HX5_CHIP_INTR_LOW_PRIORITY))
|
||||
#define INTC_LOW_PRIORITY_INTR_REG_IND IRQ_MASK_INDEX(HX5_CHIP_INTR_LOW_PRIORITY)
|
||||
@ -141,10 +155,25 @@ be made.
|
||||
static uint32 *ihost_intr_status_base = NULL;
|
||||
static uint32 *ihost_intr_enable_base = NULL;
|
||||
|
||||
/* Debug output */
|
||||
static int debug;
|
||||
LKM_MOD_PARAM(debug, "i", int, (S_IRUGO | S_IWUSR));
|
||||
MODULE_PARM_DESC(debug,
|
||||
"Set debug level (default 0).");
|
||||
|
||||
static ibde_t *user_bde = NULL;
|
||||
|
||||
typedef void (*isr_f)(void *);
|
||||
|
||||
typedef struct _intr_regs_s {
|
||||
uint32 intc_intr_status_base;
|
||||
uint32 intc_intr_enable_base;
|
||||
uint32 intc_intr_clear_0;
|
||||
uint32 intc_intr_clear_1;
|
||||
uint32 intc_intr_clear_mode_0;
|
||||
uint32 intc_intr_clear_mode_1;
|
||||
} _intr_regs_t;
|
||||
|
||||
typedef struct bde_ctrl_s {
|
||||
uint32 dev_type;
|
||||
int irq;
|
||||
@ -153,6 +182,7 @@ typedef struct bde_ctrl_s {
|
||||
isr_f isr;
|
||||
uint32 *ba;
|
||||
int inst; /* associate to _bde_inst_resource[] */
|
||||
_intr_regs_t intr_regs;
|
||||
} bde_ctrl_t;
|
||||
|
||||
#define VALID_DEVICE(_n) (_n < LINUX_BDE_MAX_DEVICES)
|
||||
@ -178,6 +208,10 @@ typedef struct {
|
||||
} bde_inst_resource_t;
|
||||
|
||||
static bde_inst_resource_t _bde_inst_resource[LINUX_BDE_MAX_DEVICES];
|
||||
/*
|
||||
* Lock used to protect changes to _bde_inst_resource
|
||||
*/
|
||||
static spinlock_t bde_resource_lock;
|
||||
|
||||
typedef struct {
|
||||
phys_addr_t cpu_pbase; /* CPU physical base address of the DMA pool */
|
||||
@ -263,44 +297,33 @@ _cmicx_interrupt(bde_ctrl_t *ctrl)
|
||||
int d, ind;
|
||||
uint32 stat, iena, mask, fmask;
|
||||
bde_inst_resource_t *res;
|
||||
uint32 intc_intr_status_base = 0, intc_intr_enable_base = 0;
|
||||
|
||||
d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t));
|
||||
|
||||
if (ctrl->dev_type & BDE_PCI_DEV_TYPE) {
|
||||
/* Clear MSI interrupts immediately to prevent spurious interrupts */
|
||||
WRITE_INTC_INTR(d, ctrl->intr_regs.intc_intr_clear_0, 0xFFFFFFFF);
|
||||
WRITE_INTC_INTR(d, ctrl->intr_regs.intc_intr_clear_1, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
res = &_bde_inst_resource[ctrl->inst];
|
||||
|
||||
lkbde_irq_mask_get(d, &mask, &fmask);
|
||||
|
||||
if ((ctrl->dev_type & BDE_SWITCH_DEV_TYPE) &&
|
||||
((user_bde->get_dev(d)->device == BCM56370_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56371_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56372_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56374_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56375_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56376_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56377_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56577_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56578_DEVICE_ID) ||
|
||||
(user_bde->get_dev(d)->device == BCM56579_DEVICE_ID))) {
|
||||
intc_intr_status_base = HX5_INTC_INTR_STATUS_BASE;
|
||||
intc_intr_enable_base = HX5_INTC_INTR_ENABLE_BASE;
|
||||
} else {
|
||||
intc_intr_status_base = INTC_INTR_STATUS_BASE;
|
||||
intc_intr_enable_base = INTC_INTR_ENABLE_BASE;
|
||||
}
|
||||
if (fmask) {
|
||||
if (ctrl->dev_type & BDE_AXI_DEV_TYPE) {
|
||||
IHOST_READ_INTR(d, ihost_intr_status_base + INTC_PDMA_INTR_REG_IND, stat);
|
||||
IHOST_READ_INTR(d, ihost_intr_enable_base + INTC_PDMA_INTR_REG_IND, iena);
|
||||
} else {
|
||||
READ_INTC_INTR(d, intc_intr_status_base + 4 * INTC_PDMA_INTR_REG_IND, stat);
|
||||
READ_INTC_INTR(d, intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, iena);
|
||||
READ_INTC_INTR(d, ctrl->intr_regs.intc_intr_status_base + 4 * INTC_PDMA_INTR_REG_IND, stat);
|
||||
READ_INTC_INTR(d, ctrl->intr_regs.intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, iena);
|
||||
}
|
||||
if (stat & iena) {
|
||||
if (ctrl->dev_type & BDE_AXI_DEV_TYPE) {
|
||||
IHOST_WRITE_INTR(d, ihost_intr_enable_base + INTC_PDMA_INTR_REG_IND +
|
||||
HX5_IHOST_IRQ_MASK_OFFSET, ~0);
|
||||
} else {
|
||||
WRITE_INTC_INTR(d, intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, 0);
|
||||
WRITE_INTC_INTR(d, ctrl->intr_regs.intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, 0);
|
||||
}
|
||||
|
||||
for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) {
|
||||
@ -308,17 +331,21 @@ _cmicx_interrupt(bde_ctrl_t *ctrl)
|
||||
continue;
|
||||
}
|
||||
if (ctrl->dev_type & BDE_AXI_DEV_TYPE) {
|
||||
if (ind < INTC_LOW_PRIORITY_INTR_REG_IND) {
|
||||
if (ind < INTC_SW_PROG_INTR_REG_IND) {
|
||||
continue;
|
||||
}
|
||||
IHOST_READ_INTR(d, ihost_intr_status_base + ind, stat);
|
||||
IHOST_READ_INTR(d, ihost_intr_enable_base + ind, iena);
|
||||
if (ind == INTC_LOW_PRIORITY_INTR_REG_IND) {
|
||||
stat &= INTR_LOW_PRIORITY_BITPOS;
|
||||
if (ind == INTC_SW_PROG_INTR_REG_IND) {
|
||||
IHOST_READ_INTR(d, ihost_intr_enable_base + ind + HX5_IHOST_IRQ_PEND_OFFSET, stat);
|
||||
stat &= INTR_SW_PROG_INTR_BITPOS;
|
||||
} else {
|
||||
IHOST_READ_INTR(d, ihost_intr_status_base + ind, stat);
|
||||
if (ind == INTC_LOW_PRIORITY_INTR_REG_IND) {
|
||||
stat &= INTR_LOW_PRIORITY_BITPOS;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
READ_INTC_INTR(d, intc_intr_status_base + 4 * ind, stat);
|
||||
READ_INTC_INTR(d, intc_intr_enable_base + 4 * ind, iena);
|
||||
READ_INTC_INTR(d, ctrl->intr_regs.intc_intr_status_base + 4 * ind, stat);
|
||||
READ_INTC_INTR(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena);
|
||||
}
|
||||
if (stat & iena) {
|
||||
break;
|
||||
@ -340,10 +367,13 @@ _cmicx_interrupt(bde_ctrl_t *ctrl)
|
||||
continue;
|
||||
}
|
||||
if (ctrl->dev_type & BDE_AXI_DEV_TYPE) {
|
||||
if (ind < INTC_LOW_PRIORITY_INTR_REG_IND) {
|
||||
if (ind < INTC_SW_PROG_INTR_REG_IND) {
|
||||
continue;
|
||||
}
|
||||
if (ind == INTC_LOW_PRIORITY_INTR_REG_IND) {
|
||||
if (ind == INTC_SW_PROG_INTR_REG_IND) {
|
||||
IHOST_WRITE_INTR(d, ihost_intr_enable_base + INTC_SW_PROG_INTR_REG_IND +
|
||||
HX5_IHOST_IRQ_MASK_OFFSET, INTR_SW_PROG_INTR_BITPOS);
|
||||
} else if (ind == INTC_LOW_PRIORITY_INTR_REG_IND) {
|
||||
IHOST_WRITE_INTR(d, ihost_intr_enable_base + INTC_LOW_PRIORITY_INTR_REG_IND +
|
||||
HX5_IHOST_IRQ_MASK_OFFSET, INTR_LOW_PRIORITY_BITPOS);
|
||||
} else {
|
||||
@ -351,7 +381,7 @@ _cmicx_interrupt(bde_ctrl_t *ctrl)
|
||||
HX5_IHOST_IRQ_MASK_OFFSET, ~0);
|
||||
}
|
||||
} else {
|
||||
WRITE_INTC_INTR(d, intc_intr_enable_base + 4*ind, 0);
|
||||
WRITE_INTC_INTR(d, ctrl->intr_regs.intc_intr_enable_base + 4*ind, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,6 +597,18 @@ _cmicd_interrupt(bde_ctrl_t *ctrl)
|
||||
if (stat & imask) {
|
||||
break;
|
||||
}
|
||||
/** Check if there are interrupts other than PacketIO interrupts on CMC1 */
|
||||
stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT0_OFFSET(1));
|
||||
imask = mask & ~fmask;
|
||||
if (stat & imask) {
|
||||
break;
|
||||
}
|
||||
/** Check if there are interrupts other than PacketIO interrupts on CMC2 */
|
||||
stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT0_OFFSET(2));
|
||||
imask = mask & ~fmask;
|
||||
if (stat & imask) {
|
||||
break;
|
||||
}
|
||||
stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT1_OFFSET(cmc));
|
||||
if (ctrl->dev_type & BDE_AXI_DEV_TYPE) {
|
||||
mask = user_bde->read(d, CMIC_CMCx_UC0_IRQ_MASK1_OFFSET(cmc));
|
||||
@ -716,6 +758,26 @@ _intr_mode_str(void *isr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr)
|
||||
{
|
||||
if (hx5_intr) {
|
||||
ctrl->intr_regs.intc_intr_status_base = HX5_INTC_INTR_STATUS_BASE;
|
||||
ctrl->intr_regs.intc_intr_enable_base = HX5_INTC_INTR_ENABLE_BASE;
|
||||
ctrl->intr_regs.intc_intr_clear_0 = HX5_PAXB_0_PAXB_IC_INTRCLR_0;
|
||||
ctrl->intr_regs.intc_intr_clear_1 = HX5_PAXB_0_PAXB_IC_INTRCLR_1;
|
||||
ctrl->intr_regs.intc_intr_clear_mode_0 = HX5_PAXB_0_PAXB_IC_INTRCLR_MODE_0;
|
||||
ctrl->intr_regs.intc_intr_clear_mode_1 = HX5_PAXB_0_PAXB_IC_INTRCLR_MODE_1;
|
||||
} else {
|
||||
ctrl->intr_regs.intc_intr_status_base = INTC_INTR_STATUS_BASE;
|
||||
ctrl->intr_regs.intc_intr_enable_base = INTC_INTR_ENABLE_BASE;
|
||||
ctrl->intr_regs.intc_intr_clear_0 = PAXB_0_PAXB_IC_INTRCLR_0;
|
||||
ctrl->intr_regs.intc_intr_clear_1 = PAXB_0_PAXB_IC_INTRCLR_1;
|
||||
ctrl->intr_regs.intc_intr_clear_mode_0 = PAXB_0_PAXB_IC_INTRCLR_MODE_0;
|
||||
ctrl->intr_regs.intc_intr_clear_mode_1 = PAXB_0_PAXB_IC_INTRCLR_MODE_1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_devices_init(int d)
|
||||
{
|
||||
@ -753,6 +815,8 @@ _devices_init(int d)
|
||||
case BCM53547_DEVICE_ID:
|
||||
case BCM53548_DEVICE_ID:
|
||||
case BCM53549_DEVICE_ID:
|
||||
ctrl->isr = (isr_f)_cmicd_cmc0_interrupt;
|
||||
break;
|
||||
case BCM88670_DEVICE_ID:
|
||||
case BCM88671_DEVICE_ID:
|
||||
case BCM88671M_DEVICE_ID:
|
||||
@ -780,10 +844,10 @@ _devices_init(int d)
|
||||
case BCM88683_DEVICE_ID:
|
||||
case BCM88684_DEVICE_ID:
|
||||
case BCM88685_DEVICE_ID:
|
||||
case BCM88687_DEVICE_ID:
|
||||
case BCM88380_DEVICE_ID:
|
||||
case BCM88381_DEVICE_ID:
|
||||
case BCM88680_DEVICE_ID:
|
||||
case BCM88800_DEVICE_ID:
|
||||
case BCM88770_DEVICE_ID:
|
||||
case BCM88773_DEVICE_ID:
|
||||
case BCM88774_DEVICE_ID:
|
||||
@ -812,10 +876,7 @@ _devices_init(int d)
|
||||
case BCM88956_DEVICE_ID:
|
||||
case BCM88772_DEVICE_ID:
|
||||
case BCM88952_DEVICE_ID:
|
||||
ctrl->isr = (isr_f)_cmicd_cmc0_interrupt;
|
||||
break;
|
||||
case BCM88790_DEVICE_ID:
|
||||
ctrl->isr = (isr_f)_cmicx_interrupt;
|
||||
ctrl->isr = (isr_f)_cmicd_interrupt;
|
||||
break;
|
||||
case BCM56370_DEVICE_ID:
|
||||
case BCM56371_DEVICE_ID:
|
||||
@ -827,6 +888,12 @@ _devices_init(int d)
|
||||
case BCM56577_DEVICE_ID:
|
||||
case BCM56578_DEVICE_ID:
|
||||
case BCM56579_DEVICE_ID:
|
||||
case BCM56273_DEVICE_ID:
|
||||
case BCM56274_DEVICE_ID:
|
||||
case BCM56275_DEVICE_ID:
|
||||
case BCM56276_DEVICE_ID:
|
||||
case BCM56277_DEVICE_ID:
|
||||
case BCM56278_DEVICE_ID:
|
||||
ctrl->isr = (isr_f)_cmicx_interrupt;
|
||||
if (ctrl->dev_type & BDE_AXI_DEV_TYPE) {
|
||||
if (!ihost_intr_enable_base) {
|
||||
@ -838,6 +905,7 @@ _devices_init(int d)
|
||||
HX5_IHOST_INTR_STATUS_MAP_NUM);
|
||||
}
|
||||
}
|
||||
_intr_regs_init(ctrl, 1);
|
||||
break;
|
||||
default:
|
||||
/* Get CMIC version */
|
||||
@ -853,7 +921,8 @@ _devices_init(int d)
|
||||
}
|
||||
/* check if version is CMICX */
|
||||
else if (ver == 0x04) {
|
||||
ctrl->isr = (isr_f)_cmicx_interrupt;
|
||||
ctrl->isr = (isr_f)_cmicx_interrupt;
|
||||
_intr_regs_init(ctrl, 0);
|
||||
} else {
|
||||
ctrl->isr = (isr_f)_cmic_interrupt;
|
||||
if ((ctrl->dev_type & BDE_256K_REG_SPACE) &&
|
||||
@ -867,17 +936,25 @@ _devices_init(int d)
|
||||
break;
|
||||
}
|
||||
|
||||
/* configure interrupts for DNX devices using iproc >=14 */
|
||||
#if defined(BCM_DNXF_SUPPORT) || defined(BCM_DNX_SUPPORT)
|
||||
switch (user_bde->get_dev(d)->device & DNXC_DEVID_FAMILY_MASK) {
|
||||
#ifdef BCM_DNX_SUPPORT
|
||||
/*All Jericho 2 devices from 0x8690 to 0x869F*/
|
||||
if (SOC_IS_JERICHO_2_TYPE(user_bde->get_dev(d)->device)) {
|
||||
ctrl->isr = (isr_f)_cmicx_interrupt;
|
||||
}
|
||||
case JERICHO2_DEVICE_ID:
|
||||
case J2C_DEVICE_ID:
|
||||
case J2C_2ND_DEVICE_ID:
|
||||
case Q2A_DEVICE_ID:
|
||||
case J2P_DEVICE_ID:
|
||||
#endif
|
||||
#ifdef BCM_DNXF_SUPPORT
|
||||
case BCM88790_DEVICE_ID:
|
||||
#endif
|
||||
|
||||
/*All Ramon devices from 0x8790 to 0x879F*/
|
||||
if ((user_bde->get_dev(d)->device & BCM88790_DEVICE_ID) == BCM88790_DEVICE_ID) {
|
||||
ctrl->isr = (isr_f)_cmicx_interrupt;
|
||||
_intr_regs_init(ctrl, 0);
|
||||
break;
|
||||
}
|
||||
#endif /* defined(BCM_DNXF_SUPPORT) || defined(BCM_DNX_SUPPORT) */
|
||||
|
||||
if (_intr_mode_str(ctrl->isr) == NULL) {
|
||||
gprintk("Warning: Unknown interrupt mode\n");
|
||||
}
|
||||
@ -906,6 +983,7 @@ _init(void)
|
||||
if ((linux_bde_create(NULL, &user_bde) < 0) || user_bde == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
spin_lock_init(&bde_resource_lock);
|
||||
|
||||
init_waitqueue_head(&_ether_interrupt_wq);
|
||||
|
||||
@ -1121,15 +1199,27 @@ _instance_attach(unsigned int inst_id, unsigned int dma_size)
|
||||
/* Reprobe the system for hot-plugged device */
|
||||
_device_reprobe();
|
||||
|
||||
if (debug >= 2) {
|
||||
gprintk("INFO: Request to attach to instance_id %d with dma size %d!\n", inst_id, dma_size);
|
||||
}
|
||||
|
||||
spin_lock(&bde_resource_lock);
|
||||
|
||||
/* Validate the resource with inst_id */
|
||||
exist = _instance_validate(inst_id, dma_size);
|
||||
if (exist < 0) {
|
||||
spin_unlock(&bde_resource_lock);
|
||||
return LUBDE_FAIL;
|
||||
}
|
||||
if (exist > 0) {
|
||||
if (debug >= 2) {
|
||||
gprintk("INFO: Already attached to instance_id %d with dma size %d!\n", inst_id, dma_size);
|
||||
}
|
||||
spin_unlock(&bde_resource_lock);
|
||||
return LUBDE_SUCCESS;
|
||||
}
|
||||
if (_dma_resource_alloc(dma_size, &dma_offset) < 0) {
|
||||
spin_unlock(&bde_resource_lock);
|
||||
return LUBDE_FAIL;
|
||||
}
|
||||
for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) {
|
||||
@ -1157,6 +1247,10 @@ _instance_attach(unsigned int inst_id, unsigned int dma_size)
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock(&bde_resource_lock);
|
||||
if (debug >= 2) {
|
||||
gprintk("INFO: Attached to instance_id %d with dma size %d! SUCCESS\n", inst_id, dma_size);
|
||||
}
|
||||
|
||||
return LUBDE_SUCCESS;
|
||||
}
|
||||
@ -1204,6 +1298,7 @@ _ioctl(unsigned int cmd, unsigned long arg)
|
||||
if (bde_dev) {
|
||||
io.d0 = bde_dev->device;
|
||||
io.d1 = bde_dev->rev;
|
||||
io.dx.dw[0] = bde_dev->dev_unique_id;
|
||||
if (BDE_DEV_MEM_MAPPED(_devices[io.dev].dev_type)) {
|
||||
/* Get physical address to map */
|
||||
io.d2 = lkbde_get_dev_phys(io.dev);
|
||||
@ -1258,8 +1353,10 @@ _ioctl(unsigned int cmd, unsigned long arg)
|
||||
io.dx.dw[0] = cpu_pbase;
|
||||
#ifdef PHYS_ADDRS_ARE_64BITS
|
||||
io.dx.dw[1] = cpu_pbase >> 32;
|
||||
io.d3 = dma_pbase >> 32;
|
||||
#else
|
||||
io.dx.dw[1] = 0;
|
||||
io.d3 = 0;
|
||||
#endif
|
||||
break;
|
||||
case LUBDE_ENABLE_INTERRUPTS:
|
||||
@ -1268,6 +1365,14 @@ _ioctl(unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
if (_devices[io.dev].dev_type & BDE_SWITCH_DEV_TYPE) {
|
||||
if (_devices[io.dev].isr && !_devices[io.dev].enabled) {
|
||||
bde_ctrl_t *ctrl;
|
||||
ctrl = &_devices[io.dev];
|
||||
if ((ctrl->isr == (isr_f)_cmicx_interrupt) &&
|
||||
(ctrl->dev_type & BDE_PCI_DEV_TYPE)) {
|
||||
/* Set MSI mode to SW clear vs auto clear */
|
||||
WRITE_INTC_INTR(io.dev, ctrl->intr_regs.intc_intr_clear_mode_0, 0x0);
|
||||
WRITE_INTC_INTR(io.dev, ctrl->intr_regs.intc_intr_clear_mode_1, 0x0);
|
||||
}
|
||||
user_bde->interrupt_connect(io.dev,
|
||||
_devices[io.dev].isr,
|
||||
_devices+io.dev);
|
||||
|
@ -290,8 +290,9 @@ shbde_iproc_paxb_init(shbde_hal_t *shbde, void *iproc_regs,
|
||||
}
|
||||
}
|
||||
|
||||
/* Configure MSIX interrupt page, only need for iproc ver == 0x10 */
|
||||
if ((icfg->use_msi == 2) && (icfg->iproc_ver == 0x10)) {
|
||||
/* Configure MSIX interrupt page, need for iproc ver 0x10 and 0x12 */
|
||||
if ((icfg->use_msi == 2) &&
|
||||
((icfg->iproc_ver == 0x10) || (icfg->iproc_ver == 0x12))){
|
||||
unsigned int mask = (0x1 << PAXB_0_FUNC0_IMAP1_3_ADDR_SHIFT) - 1;
|
||||
reg = ROFFS(iproc_regs, PAXB_0_FUNC0_IMAP1_3);
|
||||
data = iproc32_read(shbde, reg);
|
||||
@ -341,19 +342,23 @@ shbde_iproc_pci_read(shbde_hal_t *shbde, void *iproc_regs,
|
||||
subwin_base = (addr & ~0xfff);
|
||||
|
||||
if((icfg->cmic_ver >= 4) &&
|
||||
((subwin_base == 0x10230000) || (subwin_base == 0x18012000))) {
|
||||
/* Route the PAXB register through IMAP0_2 */
|
||||
reg = ROFFS(iproc_regs, 0x2000 + (addr & 0xfff));
|
||||
} else if((icfg->cmic_ver >= 4) &&
|
||||
((subwin_base == 0x10231000) || (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);
|
||||
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);
|
||||
@ -388,19 +393,23 @@ shbde_iproc_pci_write(shbde_hal_t *shbde, void *iproc_regs,
|
||||
subwin_base = (addr & ~0xfff);
|
||||
|
||||
if((icfg->cmic_ver >= 4) &&
|
||||
((subwin_base == 0x10230000) || (subwin_base == 0x18012000))) {
|
||||
/* Route the PAXB register through IMAP0_2 */
|
||||
reg = ROFFS(iproc_regs, 0x2000 + (addr & 0xfff));
|
||||
} else if((icfg->cmic_ver >= 4) &&
|
||||
((subwin_base == 0x10231000) || (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);
|
||||
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));
|
||||
reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff));
|
||||
}
|
||||
|
||||
iproc32_write(shbde, reg, data);
|
||||
|
@ -24,7 +24,7 @@ LOCALDIR = systems/linux/kernel/modules
|
||||
|
||||
include ${SDK}/make/Make.config
|
||||
|
||||
subdirs=shared uk-proxy bcm-diag-full bcm-core bcm-net bcm-diag
|
||||
subdirs=
|
||||
|
||||
include ${SDK}/make/Make.subdirs
|
||||
|
||||
|
@ -37,9 +37,6 @@ build: $(MODULE) $(KMODULE)
|
||||
endif
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers
|
||||
ifeq (,$(findstring -DPROXY_SUPPORT=0,$(CFLAGS)))
|
||||
KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../uk-proxy/kernel_module/Module.symvers
|
||||
endif
|
||||
|
||||
# BCM Network Device
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,65 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# -*- Makefile -*-
|
||||
# $Id: Makefile,v 1.3 Broadcom SDK $
|
||||
# $Copyright: (c) 2020 Broadcom.
|
||||
# Broadcom Proprietary and Confidential. All rights reserved.$
|
||||
#
|
||||
LOCALDIR = systems/linux/kernel/modules/bcm-ptp-clock
|
||||
|
||||
include ${SDK}/make/Make.config
|
||||
|
||||
LIBS = $(LIBDIR)/libkern.a
|
||||
|
||||
ifeq ($(kernel_version),2_4)
|
||||
MODULE = $(LIBDIR)/linux-bcm-ptp-clock.o
|
||||
else
|
||||
KERNEL_MODULE_DIR = kernel_module
|
||||
|
||||
THIS_MOD_NAME := linux-bcm-ptp-clock
|
||||
MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o
|
||||
KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko
|
||||
|
||||
build: $(MODULE) $(KMODULE)
|
||||
endif
|
||||
|
||||
#KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers
|
||||
|
||||
# BCM PTP Clock Device
|
||||
|
||||
$(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS)
|
||||
$(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@
|
||||
ifneq ($(kernel_version),2_4)
|
||||
$(KMODULE): $(MODULE)
|
||||
rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR)
|
||||
mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR)
|
||||
cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile
|
||||
cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers
|
||||
MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko
|
||||
endif
|
||||
|
||||
# Make.depend is before clean:: so that Make.depend's clean:: runs first.
|
||||
|
||||
include ${SDK}/make/Make.depend
|
||||
|
||||
clean::
|
||||
$(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o
|
||||
$(RM) $(BOBJS) $(MODULE)
|
||||
|
||||
ifneq ($(kernel_version),2_4)
|
||||
.PHONY: build
|
||||
endif
|
File diff suppressed because it is too large
Load Diff
@ -47,6 +47,8 @@ typedef struct {
|
||||
uint32 filter_user_data;
|
||||
uint16 dcb_type;
|
||||
int port;
|
||||
uint64_t ts;
|
||||
uint32 hwts;
|
||||
} knet_skb_cb_t;
|
||||
|
||||
#define KNET_SKB_CB(_skb) ((knet_skb_cb_t *)_skb->cb)
|
||||
@ -59,19 +61,22 @@ typedef int
|
||||
int chan, kcom_filter_t *filter);
|
||||
|
||||
typedef int
|
||||
(*knet_hw_tstamp_enable_cb_f)(int dev_no, int port);
|
||||
(*knet_hw_tstamp_enable_cb_f)(int dev_no, int phys_port, int tx_type);
|
||||
|
||||
typedef int
|
||||
(*knet_hw_tstamp_tx_time_get_cb_f)(int dev_no, int port, uint8_t *pkt, uint64_t *ts);
|
||||
(*knet_hw_tstamp_tx_time_get_cb_f)(int dev_no, int phys_port, uint8_t *pkt, uint64_t *ts);
|
||||
|
||||
typedef int
|
||||
(*knet_hw_tstamp_tx_meta_get_cb_f)(int dev_no, struct sk_buff *skb, uint32_t **md);
|
||||
(*knet_hw_tstamp_tx_meta_get_cb_f)(int dev_no, int hwts, int hdrlen, struct sk_buff *skb, uint64_t *ts, uint32_t **md);
|
||||
|
||||
typedef int
|
||||
(*knet_hw_tstamp_ptp_clock_index_cb_f)(int dev_no);
|
||||
|
||||
typedef int
|
||||
(*knet_hw_tstamp_rx_time_upscale_cb_f)(int dev_no, uint64_t *ts);
|
||||
(*knet_hw_tstamp_rx_time_upscale_cb_f)(int dev_no, int phys_port, struct sk_buff *skb, uint32_t *meta, uint64_t *ts);
|
||||
|
||||
typedef int
|
||||
(*knet_hw_tstamp_ioctl_cmd_cb_f)(kcom_msg_clock_cmd_t *kmsg, int len, int dcb_type);
|
||||
|
||||
extern int
|
||||
bkn_rx_skb_cb_register(knet_skb_cb_f rx_cb);
|
||||
@ -127,6 +132,12 @@ bkn_hw_tstamp_rx_time_upscale_cb_register(knet_hw_tstamp_rx_time_upscale_cb_f hw
|
||||
extern int
|
||||
bkn_hw_tstamp_rx_time_upscale_cb_unregister(knet_hw_tstamp_rx_time_upscale_cb_f hw_tstamp_rx_time_upscale_cb);
|
||||
|
||||
extern int
|
||||
bkn_hw_tstamp_ioctl_cmd_cb_register(knet_hw_tstamp_ioctl_cmd_cb_f hw_tstamp_ioctl_cmd_cb);
|
||||
|
||||
extern int
|
||||
bkn_hw_tstamp_ioctl_cmd_cb_unregister(knet_hw_tstamp_ioctl_cmd_cb_f hw_tstamp_ioctl_cmd_cb);
|
||||
|
||||
typedef struct {
|
||||
uint8 cmic_type;
|
||||
uint8 dcb_type;
|
||||
@ -153,6 +164,6 @@ bkn_netif_destroy_cb_register(knet_netif_cb_f netif_cb);
|
||||
extern int
|
||||
bkn_netif_destroy_cb_unregister(knet_netif_cb_f netif_cb);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_BCM_KNET_H__ */
|
||||
|
@ -38,6 +38,11 @@
|
||||
#include <linux/kconfig.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
|
||||
#if defined(INCLUDE_KNET) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
|
||||
#ifdef CONFIG_NF_CONNTRACK_MODULE
|
||||
#include <linux/netfilter.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <linux/slab.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
|
||||
|
@ -36,6 +36,7 @@ KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko
|
||||
build: $(MODULE) $(KMODULE)
|
||||
endif
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers
|
||||
ifeq ($(BUILD_PSAMPLE),1)
|
||||
KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../psample/kernel_module/Module.symvers
|
||||
endif
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Copyright 2017-2019 Broadcom
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2, as
|
||||
* published by the Free Software Foundation (the "GPL").
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 (GPLv2) for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 (GPLv2) along with this source code.
|
||||
*/
|
||||
@ -59,6 +59,26 @@ LKM_MOD_PARAM(debug, "i", int, 0);
|
||||
MODULE_PARM_DESC(debug,
|
||||
"Debug level (default 0)");
|
||||
|
||||
static int tpid=0x8100;
|
||||
LKM_MOD_PARAM(tpid, "i", int, 0);
|
||||
MODULE_PARM_DESC(debug,
|
||||
"Tag Protocol Identifier (TPID) indicates the frame type (default 0x8100)");
|
||||
|
||||
static int pri=0;
|
||||
LKM_MOD_PARAM(pri, "i", int, 0);
|
||||
MODULE_PARM_DESC(pri,
|
||||
"Priority (PRI) indicates the frame priority (default 0)");
|
||||
|
||||
static int cfi=0;
|
||||
LKM_MOD_PARAM(cfi, "i", int, 0);
|
||||
MODULE_PARM_DESC(cfi,
|
||||
"Canonical Format Indicator (CFI) indicates whether a MAC address is encapsulated in canonical format over different transmission media (default 0)");
|
||||
|
||||
static int vid=0;
|
||||
LKM_MOD_PARAM(vid, "i", int, 0);
|
||||
MODULE_PARM_DESC(vid,
|
||||
"VLAN ID (VID) indicates the VLAN to which a frame belongs (default 0)");
|
||||
|
||||
/* Module Information */
|
||||
#define MODULE_MAJOR 121
|
||||
#define MODULE_NAME "linux-knet-cb"
|
||||
@ -67,8 +87,8 @@ MODULE_PARM_DESC(debug,
|
||||
#define KNET_CB_DEBUG
|
||||
|
||||
/* These below need to match incoming enum values */
|
||||
#define FILTER_TAG_STRIP 0
|
||||
#define FILTER_TAG_KEEP 1
|
||||
#define FILTER_TAG_STRIP 0
|
||||
#define FILTER_TAG_KEEP 1
|
||||
#define FILTER_TAG_ORIGINAL 2
|
||||
|
||||
/* Maintain tag strip statistics */
|
||||
@ -105,6 +125,31 @@ strip_vlan_tag(struct sk_buff *skb)
|
||||
}
|
||||
}
|
||||
|
||||
/* Add VLAN tag to untagged packet */
|
||||
static void
|
||||
add_vlan_tag(struct sk_buff *skb, u32 forward_domain)
|
||||
{
|
||||
u32 vlan = 0;
|
||||
uint16_t vlan_proto = (uint16_t) ((skb->data[12] << 8) | skb->data[13]);
|
||||
|
||||
if ((vlan_proto != 0x8100) && (vlan_proto != 0x88a8) && (vlan_proto != 0x9100)) {
|
||||
/* If vid is specified, use configued vid as VLAN ID, or, use forward_domain as vid */
|
||||
vlan = vid ? vid: forward_domain;
|
||||
|
||||
skb_push(skb, 4); /* Add 4 bytes from start of buffer */
|
||||
/* Move first 12 bytes of packet forward by 4 */
|
||||
((u32 *) skb->data)[0] = ((u32 *) skb->data)[1];
|
||||
((u32 *) skb->data)[1] = ((u32 *) skb->data)[2];
|
||||
((u32 *) skb->data)[2] = ((u32 *) skb->data)[3];
|
||||
|
||||
/* Set VLAN tag */
|
||||
skb->data[12] = (tpid >> 8) & 0xff;
|
||||
skb->data[13] = tpid & 0xff;
|
||||
skb->data[14] = (((pri & 0x7) << 5) | ((cfi & 0x1) << 4) | ((vlan >> 8) & 0xf)) & 0xff;
|
||||
skb->data[15] = vlan & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Location of tagging status in select DCB types found below:
|
||||
*
|
||||
@ -119,6 +164,7 @@ strip_vlan_tag(struct sk_buff *skb)
|
||||
* 1 = Single inner-tag
|
||||
* 2 = Single outer-tag
|
||||
* 3 = Double tagged.
|
||||
* 4 = Dedicated for Dune device, packets are received with original tag status.
|
||||
* -1 = Unsupported DCB type
|
||||
*/
|
||||
static int
|
||||
@ -159,6 +205,11 @@ get_tag_status(int dcb_type, void *meta)
|
||||
tag_status = tag_map[(dcb[9] >> 13) & 0x3];
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
case 39:
|
||||
tag_status = 4;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
tag_status = -1;
|
||||
break;
|
||||
@ -188,12 +239,20 @@ strip_tag_rx_cb(struct sk_buff *skb, int dev_no, void *meta)
|
||||
if (debug & 0x1) {
|
||||
gprintk("%s Enter; netif Flags: %08X filter_flags %08X \n",
|
||||
__func__, netif_flags, filter_flags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Get DCB type for this packet, passed by KNET driver */
|
||||
dcb_type = KNET_SKB_CB(skb)->dcb_type;
|
||||
|
||||
/* KNET implements this already */
|
||||
if (filter_flags == FILTER_TAG_KEEP)
|
||||
{
|
||||
{
|
||||
if (dcb_type ==28 || dcb_type == 39)
|
||||
{
|
||||
uint32 *meta_buffer = (uint32 *)meta;
|
||||
uint32 forward_domain = meta_buffer[1] & 0xffff;
|
||||
add_vlan_tag(skb, forward_domain);
|
||||
}
|
||||
strip_stats.skipped++;
|
||||
return skb;
|
||||
}
|
||||
@ -205,18 +264,16 @@ strip_tag_rx_cb(struct sk_buff *skb, int dev_no, void *meta)
|
||||
{
|
||||
strip_tag = 1;
|
||||
}
|
||||
/* Get DCB type for this packet, passed by KNET driver */
|
||||
dcb_type = KNET_SKB_CB(skb)->dcb_type;
|
||||
|
||||
|
||||
|
||||
/* Get tag status from DCB */
|
||||
tag_status = get_tag_status(dcb_type, meta);
|
||||
|
||||
#ifdef KNET_CB_DEBUG
|
||||
if (debug & 0x1) {
|
||||
gprintk("%s; DCB Type: %d; tag status: %d\n", __func__, dcb_type, tag_status);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tag_status < 0) {
|
||||
/* Unsupported DCB type */
|
||||
return skb;
|
||||
@ -231,12 +288,13 @@ strip_tag_rx_cb(struct sk_buff *skb, int dev_no, void *meta)
|
||||
strip_tag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
strip_stats.checked++;
|
||||
|
||||
if (strip_tag) {
|
||||
#ifdef KNET_CB_DEBUG
|
||||
if (debug & 0x1) {
|
||||
gprintk("%s; Stripping VLAN\n", __func__);
|
||||
gprintk("%s; Stripping VLAN tag\n", __func__);
|
||||
}
|
||||
#endif
|
||||
strip_stats.stripped++;
|
||||
@ -245,10 +303,11 @@ strip_tag_rx_cb(struct sk_buff *skb, int dev_no, void *meta)
|
||||
#ifdef KNET_CB_DEBUG
|
||||
else {
|
||||
if (debug & 0x1) {
|
||||
gprintk("%s; Preserve VLAN\n", __func__);
|
||||
gprintk("%s; Keeping VLAN tag\n", __func__);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return skb;
|
||||
}
|
||||
|
||||
@ -263,7 +322,7 @@ strip_tag_tx_cb(struct sk_buff *skb, int dev_no, void *meta)
|
||||
/* Filter callback not used */
|
||||
static int
|
||||
strip_tag_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta,
|
||||
int chan, kcom_filter_t *kf)
|
||||
int chan, kcom_filter_t *kf)
|
||||
{
|
||||
/* Pass through for now */
|
||||
return 0;
|
||||
@ -287,7 +346,7 @@ knet_netif_create_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
|
||||
{
|
||||
int retv = 0;
|
||||
#ifdef PSAMPLE_SUPPORT
|
||||
retv = psample_netif_create_cb(unit, netif, dev);
|
||||
retv = psample_netif_create_cb(unit, netif, dev);
|
||||
#endif
|
||||
return retv;
|
||||
}
|
||||
@ -297,7 +356,7 @@ knet_netif_destroy_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
|
||||
{
|
||||
int retv = 0;
|
||||
#ifdef PSAMPLE_SUPPORT
|
||||
retv = psample_netif_destroy_cb(unit, netif, dev);
|
||||
retv = psample_netif_destroy_cb(unit, netif, dev);
|
||||
#endif
|
||||
return retv;
|
||||
}
|
||||
@ -306,10 +365,9 @@ knet_netif_destroy_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
|
||||
* Get statistics.
|
||||
* % cat /proc/linux-knet-cb
|
||||
*/
|
||||
|
||||
static int
|
||||
_pprint(void)
|
||||
{
|
||||
{
|
||||
pprintf("Broadcom Linux KNET Call-Back: Untagged VLAN Stripper\n");
|
||||
pprintf(" %lu stripped packets\n", strip_stats.stripped);
|
||||
pprintf(" %lu packets checked\n", strip_stats.checked);
|
||||
@ -322,7 +380,9 @@ static int
|
||||
_cleanup(void)
|
||||
{
|
||||
bkn_rx_skb_cb_unregister(strip_tag_rx_cb);
|
||||
/* strip_tag_tx_cb is currently a no-op, so no need to unregister */
|
||||
/* strip_tag_tx_cb is currently a noop, so
|
||||
* no need to unregister.
|
||||
*/
|
||||
if (0)
|
||||
{
|
||||
bkn_tx_skb_cb_unregister(strip_tag_tx_cb);
|
||||
@ -336,14 +396,15 @@ _cleanup(void)
|
||||
psample_cleanup();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_init(void)
|
||||
{
|
||||
|
||||
bkn_rx_skb_cb_register(strip_tag_rx_cb);
|
||||
/* strip_tag_tx_cb is currently a no-op, so no need to register */
|
||||
/* strip_tag_tx_cb is currently a noop, so
|
||||
* no need to register.
|
||||
*/
|
||||
if (0)
|
||||
{
|
||||
bkn_tx_skb_cb_register(strip_tag_tx_cb);
|
||||
@ -352,23 +413,24 @@ _init(void)
|
||||
#ifdef PSAMPLE_SUPPORT
|
||||
psample_init();
|
||||
#endif
|
||||
|
||||
|
||||
bkn_filter_cb_register(knet_filter_cb);
|
||||
bkn_netif_create_cb_register(knet_netif_create_cb);
|
||||
bkn_netif_destroy_cb_register(knet_netif_destroy_cb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gmodule_t _gmodule = {
|
||||
name: MODULE_NAME,
|
||||
major: MODULE_MAJOR,
|
||||
name: MODULE_NAME,
|
||||
major: MODULE_MAJOR,
|
||||
init: _init,
|
||||
cleanup: _cleanup,
|
||||
pprint: _pprint,
|
||||
cleanup: _cleanup,
|
||||
pprint: _pprint,
|
||||
ioctl: NULL,
|
||||
open: NULL,
|
||||
close: NULL,
|
||||
};
|
||||
open: NULL,
|
||||
close: NULL,
|
||||
};
|
||||
|
||||
gmodule_t*
|
||||
gmodule_get(void)
|
||||
|
@ -64,10 +64,24 @@ extern int debug;
|
||||
#define SOC_HIGIG_SRCPORT(x) ((x[1] >> 16) & 0x1f)
|
||||
#define SOC_HIGIG2_SOP (0xfb) //0xfc - TODO: how can we differentiate between Higig and higig2?
|
||||
#define SOC_HIGIG2_START(x) ((x[0] >> 24) & 0xff)
|
||||
#define SOC_HIGIG2_IS_MC(x) ((x[0] >> 20) & 0x1)
|
||||
#define SOC_HIGIG2_DSTPORT(x) ((x[0] >> 0) & 0xff)
|
||||
#define SOC_HIGIG2_SRCPORT(x) ((x[1] >> 16) & 0xff)
|
||||
#define SOC_DCB32_HG_OFFSET (6)
|
||||
|
||||
/* sFlow v5 datagram dst ifindex field type
|
||||
* dst ifindex encoding bits [31:30]
|
||||
*/
|
||||
#define DSTPORT_TYPE_DISCARD 1
|
||||
#define DSTPORT_TYPE_MC 2
|
||||
|
||||
#define DSTPORT_TYPE_OFFSET 30
|
||||
#define DSTPORT_TYPE_MASK 0x3
|
||||
#define DSTPORT_TYPE_CLR(_dst) (_dst &= ~(DSTPORT_TYPE_MASK << DSTPORT_TYPE_OFFSET))
|
||||
#define DSTPORT_TYPE_SET(_dst,_type) (_dst |= ((_type & DSTPORT_TYPE_MASK) << DSTPORT_TYPE_OFFSET))
|
||||
#define DSTPORT_TYPE_GET(_dst) ((_dst >> DSTPORT_TYPE_OFFSET) & DSTPORT_TYPE_MASK)
|
||||
#define DSTPORT_GET(_dst) (_dst & ~(DSTPORT_TYPE_MASK << DSTPORT_TYPE_OFFSET))
|
||||
|
||||
#define FCS_SZ 4
|
||||
#define PSAMPLE_NLA_PADDING 4
|
||||
|
||||
@ -78,17 +92,25 @@ LKM_MOD_PARAM(psample_size, "i", int, 0);
|
||||
MODULE_PARM_DESC(psample_size,
|
||||
"psample pkt size (default 128 bytes)");
|
||||
|
||||
#define PSAMPLE_QLEN_DFLT 1024
|
||||
static int psample_qlen = PSAMPLE_QLEN_DFLT;
|
||||
LKM_MOD_PARAM(psample_qlen, "i", int, 0);
|
||||
MODULE_PARM_DESC(psample_qlen,
|
||||
"psample queue length (default 1024 buffers)");
|
||||
|
||||
/* driver proc entry root */
|
||||
static struct proc_dir_entry *psample_proc_root = NULL;
|
||||
static struct proc_dir_entry *knet_cb_proc_root = NULL;
|
||||
|
||||
/* psample general info */
|
||||
typedef struct {
|
||||
struct list_head netif_list;
|
||||
int netif_count;
|
||||
knet_hw_info_t hw;
|
||||
struct net *netns;
|
||||
spinlock_t lock;
|
||||
} psample_info_t;
|
||||
static psample_info_t g_psample_info = {{0}};
|
||||
static psample_info_t g_psample_info = {0};
|
||||
|
||||
/* Maintain sampled pkt statistics */
|
||||
typedef struct psample_stats_s {
|
||||
@ -96,9 +118,13 @@ typedef struct psample_stats_s {
|
||||
unsigned long pkts_f_psample_mod;
|
||||
unsigned long pkts_f_handled;
|
||||
unsigned long pkts_f_pass_through;
|
||||
unsigned long pkts_f_dst_mc;
|
||||
unsigned long pkts_c_qlen_cur;
|
||||
unsigned long pkts_c_qlen_hi;
|
||||
unsigned long pkts_d_qlen_max;
|
||||
unsigned long pkts_d_no_mem;
|
||||
unsigned long pkts_d_no_group;
|
||||
unsigned long pkts_d_sampling_disabled;
|
||||
unsigned long pkts_d_no_skb;
|
||||
unsigned long pkts_d_not_ready;
|
||||
unsigned long pkts_d_metadata;
|
||||
unsigned long pkts_d_meta_srcport;
|
||||
@ -114,6 +140,19 @@ typedef struct psample_meta_s {
|
||||
int sample_rate;
|
||||
} psample_meta_t;
|
||||
|
||||
typedef struct psample_pkt_s {
|
||||
struct list_head list;
|
||||
struct psample_group *group;
|
||||
psample_meta_t meta;
|
||||
struct sk_buff *skb;
|
||||
} psample_pkt_t;
|
||||
|
||||
typedef struct psample_work_s {
|
||||
struct list_head pkt_list;
|
||||
struct work_struct wq;
|
||||
spinlock_t lock;
|
||||
} psample_work_t;
|
||||
static psample_work_t g_psample_work = {0};
|
||||
|
||||
static psample_netif_t*
|
||||
psample_netif_lookup_by_port(int unit, int port)
|
||||
@ -170,7 +209,6 @@ psample_meta_srcport_get(uint8_t *pkt, void *pkt_meta)
|
||||
case 26: /* TD2 */
|
||||
case 23: /* HX4 */
|
||||
metadata += SOC_DCB32_HG_OFFSET;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -205,16 +243,23 @@ psample_meta_dstport_get(uint8_t *pkt, void *pkt_meta)
|
||||
case 32: /* TH1/TH2 */
|
||||
case 26: /* TD2 */
|
||||
case 23: /* HX4 */
|
||||
metadata += SOC_DCB32_HG_OFFSET;
|
||||
break;
|
||||
default:
|
||||
metadata += SOC_DCB32_HG_OFFSET;
|
||||
break;
|
||||
}
|
||||
|
||||
if (SOC_HIGIG2_START(metadata) == SOC_HIGIG2_SOP)
|
||||
{
|
||||
if (SOC_HIGIG2_IS_MC(metadata))
|
||||
{
|
||||
DSTPORT_TYPE_CLR(dstport);
|
||||
DSTPORT_TYPE_SET(dstport, DSTPORT_TYPE_MC);
|
||||
}
|
||||
else
|
||||
{
|
||||
dstport = SOC_HIGIG2_DSTPORT(metadata);
|
||||
}
|
||||
}
|
||||
else if (SOC_HIGIG_START(metadata) == SOC_HIGIG_SOP)
|
||||
{
|
||||
dstport = SOC_HIGIG_DSTPORT(metadata);
|
||||
@ -273,10 +318,10 @@ psample_meta_sample_reason(uint8_t *pkt, void *pkt_meta)
|
||||
static int
|
||||
psample_meta_get(int unit, uint8_t *pkt, void *pkt_meta, psample_meta_t *sflow_meta)
|
||||
{
|
||||
int srcport, dstport;
|
||||
int srcport, dstport, dstport_type;
|
||||
int src_ifindex = 0;
|
||||
int dst_ifindex = 0;
|
||||
int sample_rate = PSAMPLE_RATE_DFLT;
|
||||
int sample_rate = 1;
|
||||
int sample_size = PSAMPLE_SIZE_DFLT;
|
||||
psample_netif_t *psample_netif = NULL;
|
||||
|
||||
@ -313,8 +358,16 @@ psample_meta_get(int unit, uint8_t *pkt, void *pkt_meta, psample_meta_t *sflow_m
|
||||
}
|
||||
}
|
||||
|
||||
/* find dst port netif (no need to lookup CPU port) */
|
||||
if (dstport != 0) {
|
||||
dstport_type = DSTPORT_TYPE_GET(dstport);
|
||||
dstport = DSTPORT_GET(dstport);
|
||||
|
||||
/* set sFlow dst type for MC pkts */
|
||||
if (dstport_type == DSTPORT_TYPE_MC) {
|
||||
DSTPORT_TYPE_SET(dst_ifindex, DSTPORT_TYPE_MC);
|
||||
g_psample_stats.pkts_f_dst_mc++;
|
||||
|
||||
/* find dst port netif for UC pkts (no need to lookup CPU port) */
|
||||
} else if (dstport != 0) {
|
||||
if ((psample_netif = psample_netif_lookup_by_port(unit, dstport))) {
|
||||
dst_ifindex = psample_netif->dev->ifindex;
|
||||
} else {
|
||||
@ -323,7 +376,7 @@ psample_meta_get(int unit, uint8_t *pkt, void *pkt_meta, psample_meta_t *sflow_m
|
||||
}
|
||||
}
|
||||
|
||||
PSAMPLE_CB_DBG_PRINT("%s: srcport %d, dstport %d, src_ifindex %d, dst_ifindex %d, trunc_size %d, sample_rate %d\n",
|
||||
PSAMPLE_CB_DBG_PRINT("%s: srcport %d, dstport %d, src_ifindex 0x%x, dst_ifindex 0x%x, trunc_size %d, sample_rate %d\n",
|
||||
__func__, srcport, dstport, src_ifindex, dst_ifindex, sample_size, sample_rate);
|
||||
|
||||
sflow_meta->src_ifindex = src_ifindex;
|
||||
@ -334,13 +387,51 @@ psample_meta_get(int unit, uint8_t *pkt, void *pkt_meta, psample_meta_t *sflow_m
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
psample_task(struct work_struct *work)
|
||||
{
|
||||
psample_work_t *psample_work = container_of(work, psample_work_t, wq);
|
||||
unsigned long flags;
|
||||
struct list_head *list_ptr, *list_next;
|
||||
psample_pkt_t *pkt;
|
||||
|
||||
spin_lock_irqsave(&psample_work->lock, flags);
|
||||
list_for_each_safe(list_ptr, list_next, &psample_work->pkt_list) {
|
||||
/* dequeue pkt from list */
|
||||
pkt = list_entry(list_ptr, psample_pkt_t, list);
|
||||
list_del(list_ptr);
|
||||
g_psample_stats.pkts_c_qlen_cur--;
|
||||
spin_unlock_irqrestore(&psample_work->lock, flags);
|
||||
|
||||
/* send to psample */
|
||||
if (pkt) {
|
||||
PSAMPLE_CB_DBG_PRINT("%s: group 0x%x, trunc_size %d, src_ifdx 0x%x, dst_ifdx 0x%x, sample_rate %d\n",
|
||||
__func__, pkt->group->group_num,
|
||||
pkt->meta.trunc_size, pkt->meta.src_ifindex,
|
||||
pkt->meta.dst_ifindex, pkt->meta.sample_rate);
|
||||
|
||||
psample_sample_packet(pkt->group,
|
||||
pkt->skb,
|
||||
pkt->meta.trunc_size,
|
||||
pkt->meta.src_ifindex,
|
||||
pkt->meta.dst_ifindex,
|
||||
pkt->meta.sample_rate);
|
||||
g_psample_stats.pkts_f_psample_mod++;
|
||||
|
||||
dev_kfree_skb_any(pkt->skb);
|
||||
kfree(pkt);
|
||||
}
|
||||
spin_lock_irqsave(&psample_work->lock, flags);
|
||||
}
|
||||
spin_unlock_irqrestore(&psample_work->lock, flags);
|
||||
}
|
||||
|
||||
int
|
||||
psample_filter_cb(uint8_t * pkt, int size, int dev_no, void *pkt_meta,
|
||||
int chan, kcom_filter_t *kf)
|
||||
{
|
||||
struct psample_group *group;
|
||||
psample_meta_t meta;
|
||||
struct sk_buff skb;
|
||||
int rv = 0;
|
||||
static int info_get = 0;
|
||||
|
||||
@ -386,24 +477,51 @@ psample_filter_cb(uint8_t * pkt, int size, int dev_no, void *pkt_meta,
|
||||
meta.trunc_size = size - PSAMPLE_NLA_PADDING;
|
||||
}
|
||||
|
||||
PSAMPLE_CB_DBG_PRINT("%s: group 0x%x, trunc_size %d, src_ifdx %d, dst_ifdx %d, sample_rate %d\n",
|
||||
PSAMPLE_CB_DBG_PRINT("%s: group 0x%x, trunc_size %d, src_ifdx 0x%x, dst_ifdx 0x%x, sample_rate %d\n",
|
||||
__func__, group->group_num, meta.trunc_size, meta.src_ifindex, meta.dst_ifindex, meta.sample_rate);
|
||||
|
||||
/* drop if configured sample rate is 0 */
|
||||
if (meta.sample_rate > 0) {
|
||||
unsigned long flags;
|
||||
psample_pkt_t *psample_pkt;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (g_psample_stats.pkts_c_qlen_cur >= psample_qlen) {
|
||||
gprintk("%s: tail drop due to max qlen %d reached\n", __func__, psample_qlen);
|
||||
g_psample_stats.pkts_d_qlen_max++;
|
||||
goto PSAMPLE_FILTER_CB_PKT_HANDLED;
|
||||
}
|
||||
|
||||
if ((psample_pkt = kmalloc(sizeof(psample_pkt_t), GFP_ATOMIC)) == NULL) {
|
||||
gprintk("%s: failed to alloc psample mem for pkt\n", __func__);
|
||||
g_psample_stats.pkts_d_no_mem++;
|
||||
goto PSAMPLE_FILTER_CB_PKT_HANDLED;
|
||||
}
|
||||
memcpy(&psample_pkt->meta, &meta, sizeof(psample_meta_t));
|
||||
psample_pkt->group = group;
|
||||
|
||||
if ((skb = dev_alloc_skb(meta.trunc_size)) == NULL) {
|
||||
gprintk("%s: failed to alloc psample mem for pkt skb\n", __func__);
|
||||
g_psample_stats.pkts_d_no_mem++;
|
||||
goto PSAMPLE_FILTER_CB_PKT_HANDLED;
|
||||
}
|
||||
|
||||
/* setup skb to point to pkt */
|
||||
memset(&skb, 0, sizeof(struct sk_buff));
|
||||
skb.len = size;
|
||||
skb.data = pkt;
|
||||
memcpy(skb->data, pkt, meta.trunc_size);
|
||||
skb_put(skb, meta.trunc_size);
|
||||
skb->len = meta.trunc_size;
|
||||
psample_pkt->skb = skb;
|
||||
|
||||
psample_sample_packet(group,
|
||||
&skb,
|
||||
meta.trunc_size,
|
||||
meta.src_ifindex,
|
||||
meta.dst_ifindex,
|
||||
meta.sample_rate);
|
||||
spin_lock_irqsave(&g_psample_work.lock, flags);
|
||||
list_add_tail(&psample_pkt->list, &g_psample_work.pkt_list);
|
||||
|
||||
g_psample_stats.pkts_c_qlen_cur++;
|
||||
if (g_psample_stats.pkts_c_qlen_cur > g_psample_stats.pkts_c_qlen_hi) {
|
||||
g_psample_stats.pkts_c_qlen_hi = g_psample_stats.pkts_c_qlen_cur;
|
||||
}
|
||||
|
||||
g_psample_stats.pkts_f_psample_mod++;
|
||||
schedule_work(&g_psample_work.wq);
|
||||
spin_unlock_irqrestore(&g_psample_work.lock, flags);
|
||||
} else {
|
||||
g_psample_stats.pkts_d_sampling_disabled++;
|
||||
}
|
||||
@ -427,7 +545,7 @@ psample_netif_create_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
|
||||
psample_netif_t *psample_netif, *lpsample_netif;
|
||||
unsigned long flags;
|
||||
|
||||
if ((psample_netif = kmalloc(sizeof(psample_netif_t), GFP_KERNEL)) == NULL) {
|
||||
if ((psample_netif = kmalloc(sizeof(psample_netif_t), GFP_ATOMIC)) == NULL) {
|
||||
gprintk("%s: failed to alloc psample mem for netif '%s'\n",
|
||||
__func__, dev->name);
|
||||
return (-1);
|
||||
@ -449,6 +567,7 @@ psample_netif_create_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
|
||||
lpsample_netif = (psample_netif_t*)list;
|
||||
if (netif->id < lpsample_netif->id) {
|
||||
found = 1;
|
||||
g_psample_info.netif_count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -489,6 +608,7 @@ psample_netif_destroy_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
|
||||
list_del(&psample_netif->list);
|
||||
PSAMPLE_CB_DBG_PRINT("%s: removing psample netif '%s'\n", __func__, dev->name);
|
||||
kfree(psample_netif);
|
||||
g_psample_info.netif_count--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -702,6 +822,47 @@ struct file_operations psample_proc_size_file_ops = {
|
||||
release: single_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* psample map Proc Read Entry
|
||||
*/
|
||||
static int
|
||||
psample_proc_map_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct list_head *list;
|
||||
psample_netif_t *psample_netif;
|
||||
unsigned long flags;
|
||||
|
||||
seq_printf(m, " Interface logical port ifindex\n");
|
||||
seq_printf(m, "------------- ------------ -------\n");
|
||||
spin_lock_irqsave(&g_psample_info.lock, flags);
|
||||
|
||||
list_for_each(list, &g_psample_info.netif_list) {
|
||||
psample_netif = (psample_netif_t*)list;
|
||||
seq_printf(m, " %-14s %-14d %d\n",
|
||||
psample_netif->dev->name,
|
||||
psample_netif->port,
|
||||
psample_netif->dev->ifindex);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&g_psample_info.lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
psample_proc_map_open(struct inode * inode, struct file * file)
|
||||
{
|
||||
return single_open(file, psample_proc_map_show, NULL);
|
||||
}
|
||||
|
||||
struct file_operations psample_proc_map_file_ops = {
|
||||
owner: THIS_MODULE,
|
||||
open: psample_proc_map_open,
|
||||
read: seq_read,
|
||||
llseek: seq_lseek,
|
||||
write: NULL,
|
||||
release: single_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* psample debug Proc Read Entry
|
||||
*/
|
||||
@ -715,6 +876,8 @@ psample_proc_debug_show(struct seq_file *m, void *v)
|
||||
seq_printf(m, " dcb_size: %d\n", g_psample_info.hw.dcb_size);
|
||||
seq_printf(m, " pkt_hdr_size: %d\n", g_psample_info.hw.pkt_hdr_size);
|
||||
seq_printf(m, " cdma_channels: %d\n", g_psample_info.hw.cdma_channels);
|
||||
seq_printf(m, " netif_count: %d\n", g_psample_info.netif_count);
|
||||
seq_printf(m, " queue length: %d\n", psample_qlen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -779,9 +942,13 @@ psample_proc_stats_show(struct seq_file *m, void *v)
|
||||
seq_printf(m, " pkts sent to psample module %10lu\n", g_psample_stats.pkts_f_psample_mod);
|
||||
seq_printf(m, " pkts handled by psample %10lu\n", g_psample_stats.pkts_f_handled);
|
||||
seq_printf(m, " pkts pass through %10lu\n", g_psample_stats.pkts_f_pass_through);
|
||||
seq_printf(m, " pkts with mc destination %10lu\n", g_psample_stats.pkts_f_dst_mc);
|
||||
seq_printf(m, " pkts current queue length %10lu\n", g_psample_stats.pkts_c_qlen_cur);
|
||||
seq_printf(m, " pkts high queue length %10lu\n", g_psample_stats.pkts_c_qlen_hi);
|
||||
seq_printf(m, " pkts drop max queue length %10lu\n", g_psample_stats.pkts_d_qlen_max);
|
||||
seq_printf(m, " pkts drop no memory %10lu\n", g_psample_stats.pkts_d_no_mem);
|
||||
seq_printf(m, " pkts drop no psample group %10lu\n", g_psample_stats.pkts_d_no_group);
|
||||
seq_printf(m, " pkts drop sampling disabled %10lu\n", g_psample_stats.pkts_d_sampling_disabled);
|
||||
seq_printf(m, " pkts drop no skb %10lu\n", g_psample_stats.pkts_d_no_skb);
|
||||
seq_printf(m, " pkts drop psample not ready %10lu\n", g_psample_stats.pkts_d_not_ready);
|
||||
seq_printf(m, " pkts drop metadata parse error %10lu\n", g_psample_stats.pkts_d_metadata);
|
||||
seq_printf(m, " pkts with invalid src port %10lu\n", g_psample_stats.pkts_d_meta_srcport);
|
||||
@ -796,21 +963,46 @@ psample_proc_stats_open(struct inode * inode, struct file * file)
|
||||
return single_open(file, psample_proc_stats_show, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* psample stats Proc Write Entry
|
||||
*
|
||||
* Syntax:
|
||||
* write any value to clear stats
|
||||
*/
|
||||
static ssize_t
|
||||
psample_proc_stats_write(struct file *file, const char *buf,
|
||||
size_t count, loff_t *loff)
|
||||
{
|
||||
int qlen_cur = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&g_psample_work.lock, flags);
|
||||
qlen_cur = g_psample_stats.pkts_c_qlen_cur;
|
||||
memset(&g_psample_stats, 0, sizeof(psample_stats_t));
|
||||
g_psample_stats.pkts_c_qlen_cur = qlen_cur;
|
||||
spin_unlock_irqrestore(&g_psample_work.lock, flags);
|
||||
|
||||
return count;
|
||||
}
|
||||
struct file_operations psample_proc_stats_file_ops = {
|
||||
owner: THIS_MODULE,
|
||||
open: psample_proc_stats_open,
|
||||
read: seq_read,
|
||||
llseek: seq_lseek,
|
||||
write: NULL,
|
||||
write: psample_proc_stats_write,
|
||||
release: single_release,
|
||||
};
|
||||
|
||||
int psample_cleanup(void)
|
||||
{
|
||||
cancel_work_sync(&g_psample_work.wq);
|
||||
remove_proc_entry("stats", psample_proc_root);
|
||||
remove_proc_entry("rate", psample_proc_root);
|
||||
remove_proc_entry("size", psample_proc_root);
|
||||
remove_proc_entry("debug", psample_proc_root);
|
||||
remove_proc_entry("map" , psample_proc_root);
|
||||
remove_proc_entry("psample", knet_cb_proc_root);
|
||||
remove_proc_entry("bcm/knet-cb", NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -822,7 +1014,7 @@ int psample_init(void)
|
||||
|
||||
/* create procfs for psample */
|
||||
snprintf(psample_procfs_path, PROCFS_MAX_PATH, "bcm/knet-cb");
|
||||
proc_mkdir(psample_procfs_path, NULL);
|
||||
knet_cb_proc_root = proc_mkdir(psample_procfs_path, NULL);
|
||||
snprintf(psample_procfs_path, PROCFS_MAX_PATH, "%s/%s", psample_procfs_path, PSAMPLE_CB_NAME);
|
||||
psample_proc_root = proc_mkdir(psample_procfs_path, NULL);
|
||||
|
||||
@ -847,6 +1039,13 @@ int psample_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* create procfs for getting netdev mapping */
|
||||
PROC_CREATE(entry, "map", 0666, psample_proc_root, &psample_proc_map_file_ops);
|
||||
if (entry == NULL) {
|
||||
gprintk("%s: Unable to create procfs entry '/procfs/%s/map'\n", __func__, psample_procfs_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* create procfs for debug log */
|
||||
PROC_CREATE(entry, "debug", 0666, psample_proc_root, &psample_proc_debug_file_ops);
|
||||
if (entry == NULL) {
|
||||
@ -857,11 +1056,17 @@ int psample_init(void)
|
||||
/* clear data structs */
|
||||
memset(&g_psample_stats, 0, sizeof(psample_stats_t));
|
||||
memset(&g_psample_info, 0, sizeof(psample_info_t));
|
||||
memset(&g_psample_work, 0, sizeof(psample_work_t));
|
||||
|
||||
/* setup psample_info struct */
|
||||
INIT_LIST_HEAD(&g_psample_info.netif_list);
|
||||
spin_lock_init(&g_psample_info.lock);
|
||||
|
||||
/* setup psample work queue */
|
||||
spin_lock_init(&g_psample_work.lock);
|
||||
INIT_LIST_HEAD(&g_psample_work.pkt_list);
|
||||
INIT_WORK(&g_psample_work.wq, psample_task);
|
||||
|
||||
/* get net namespace */
|
||||
g_psample_info.netns = get_net_ns_by_pid(current->pid);
|
||||
if (!g_psample_info.netns) {
|
||||
@ -871,5 +1076,6 @@ int psample_init(void)
|
||||
PSAMPLE_CB_DBG_PRINT("%s: current->pid %d, netns 0x%p, sample_size %d\n", __func__,
|
||||
current->pid, g_psample_info.netns, psample_size);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ static const struct genl_multicast_group psample_nl_mcgrps[] = {
|
||||
[PSAMPLE_NL_MCGRP_SAMPLE] = { .name = PSAMPLE_NL_MCGRP_SAMPLE_NAME },
|
||||
};
|
||||
|
||||
static struct genl_family psample_nl_family __ro_after_init;
|
||||
static struct genl_family psample_nl_family;
|
||||
|
||||
static int psample_group_nl_fill(struct sk_buff *msg,
|
||||
struct psample_group *group,
|
||||
@ -106,7 +106,7 @@ static const struct genl_ops psample_nl_ops[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct genl_family psample_nl_family __ro_after_init = {
|
||||
static struct genl_family psample_nl_family = {
|
||||
.name = PSAMPLE_GENL_NAME,
|
||||
.version = PSAMPLE_GENL_VERSION,
|
||||
.maxattr = PSAMPLE_ATTR_MAX,
|
||||
|
@ -65,7 +65,7 @@ ifeq (,$(kernel_version))
|
||||
kernel_version=2_4
|
||||
endif
|
||||
|
||||
ifeq ($(kernel_version),2_6)
|
||||
ifneq ($(kernel_version),2_4)
|
||||
KOBJ=ko
|
||||
else
|
||||
KOBJ=o
|
||||
@ -94,6 +94,9 @@ BCM_KNET=$(DEST_DIR)/$(BCM_KNET_LOCAL)
|
||||
PSAMPLE_LOCAL := psample.$(KOBJ)
|
||||
PSAMPLE := $(DEST_DIR)/$(PSAMPLE_LOCAL)
|
||||
|
||||
BCM_LPTP_LOCAL :=linux-bcm-ptp-clock.$(KOBJ)
|
||||
BCM_LPTP=$(DEST_DIR)/$(BCM_LPTP_LOCAL)
|
||||
|
||||
ifeq (,$(findstring DELIVER,$(MAKECMDGOALS)))
|
||||
.DEFAULT_GOAL := all
|
||||
all_targets := kernel_modules $(KERNEL_BDE) $(USER_BDE)
|
||||
@ -110,6 +113,11 @@ endif
|
||||
ifndef BUILD_KNET
|
||||
BUILD_KNET = 1
|
||||
endif
|
||||
# Remove this when LinuxPTP support becomes optional.
|
||||
ifndef BUILD_LPTP
|
||||
BUILD_LPTP = 1
|
||||
BUILD_KNETSYNC = 1
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_KNET),1)
|
||||
# Kernel network support
|
||||
@ -132,19 +140,35 @@ endif
|
||||
ifdef BUILD_PSAMPLE
|
||||
all_targets += $(PSAMPLE)
|
||||
ADD_TO_CFLAGS += -DPSAMPLE_SUPPORT
|
||||
|
||||
|
||||
# KnetSync support
|
||||
ifdef BUILD_KNETSYNC
|
||||
|
||||
KERNEL_TARGETS += $(BCM_PTP_CLOCK)
|
||||
LOCAL_KERNEL_TARGETS += $(patsubst %,$(realpath ..)/$(platform)/%,$(BCM_PTP_CLOCK_LOCAL))
|
||||
|
||||
endif # BUILD_KNETSYNC
|
||||
|
||||
ifeq ($(NO_LOCAL_TARGETS),)
|
||||
LOCAL_TARGETS +=$(patsubst %,../$(platform)/%,$(PSAMPLE_LOCAL))
|
||||
all_targets +=$(LOCAL_TARGETS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef BUILD_LPTP
|
||||
all_targets += $(BCM_LPTP)
|
||||
|
||||
ifeq ($(NO_LOCAL_TARGETS),)
|
||||
LOCAL_TARGETS +=$(patsubst %,../$(platform)/%,$(BCM_LPTP_LOCAL))
|
||||
all_targets +=$(LOCAL_TARGETS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ADD_TO_CFLAGS += -I$(SDK)/systems/linux/kernel/modules/include
|
||||
COND_KNET_LIBS = libuser.$(libext)
|
||||
endif
|
||||
|
||||
#SAI_FIXUP
|
||||
.NOTPARALLEL:
|
||||
|
||||
all: $(BLDDIR)/.tree $(all_targets)
|
||||
|
||||
ifeq ($(NO_LOCAL_TARGETS),)
|
||||
@ -161,24 +185,33 @@ ADD_TO_CFLAGS += -I$(SDK)/systems/bde/linux/include
|
||||
ADD_TO_CFLAGS += -DPROXY_SUPPORT=0
|
||||
|
||||
CFLAGS += $(ADD_TO_CFLAGS)
|
||||
|
||||
#SAI_FIXUP
|
||||
CFLAGS:=$(filter-out -fPIC, $(CFLAGS))
|
||||
|
||||
# KnetSync Support
|
||||
ifdef BUILD_KNETSYNC
|
||||
knetsync_subdirs = bcm-ptp-clock
|
||||
endif # BUILD_KNETSYNC
|
||||
|
||||
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) -j1 -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
$(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
subdirs="shared bcm-knet" override-target=linux-$(platform) CFLAGS="$(CFLAGS)"
|
||||
ifdef BUILD_PSAMPLE
|
||||
$(MAKE) -j1 -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
$(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
subdirs="psample" override-target=linux-$(platform) CFLAGS="$(CFLAGS)"
|
||||
endif
|
||||
ifdef BUILD_KNET_CB
|
||||
$(MAKE) -j1 -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
$(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
subdirs="knet-cb" override-target=linux-$(platform) CFLAGS="$(CFLAGS)"
|
||||
endif
|
||||
ifdef BUILD_LPTP
|
||||
$(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \
|
||||
subdirs="bcm-ptp-clock" override-target=linux-$(platform) CFLAGS="$(CFLAGS)"
|
||||
endif
|
||||
endif
|
||||
|
||||
$(KERNEL_BDE): $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ)
|
||||
@ -197,6 +230,8 @@ $(KNET_CB): $(KERN_BLDROOT)/linux-knet-cb.$(KOBJ)
|
||||
$(PSAMPLE): $(KERN_BLDROOT)/psample.$(KOBJ)
|
||||
$(OBJCOPY) --strip-debug $< $@
|
||||
|
||||
$(BCM_LPTP): $(KERN_BLDROOT)/linux-bcm-ptp-clock.$(KOBJ)
|
||||
$(OBJCOPY) --strip-debug $< $@
|
||||
|
||||
ifeq ($(NO_LOCAL_TARGETS),)
|
||||
$(foreach targ,$(LOCAL_TARGETS),$(eval $(call LOCAL_TARGET_DEF,$(targ))))
|
||||
@ -206,10 +241,10 @@ clean::
|
||||
$(MAKE) -C $(SDK)/systems/bde/linux/kernel $@
|
||||
$(MAKE) -C $(SDK)/systems/bde/linux/user/kernel $@
|
||||
$(MAKE) -C $(SDK)/systems/linux/kernel/modules \
|
||||
subdirs="shared bcm-knet knet-cb" \
|
||||
subdirs="shared bcm-knet knet-cb psample bcm-ptp-clock" \
|
||||
override-target=linux-$(platform) $@
|
||||
$(RM) $(KERNEL_BDE) $(USER_BDE)
|
||||
$(RM) $(BCM_KNET) $(KNET_CB)
|
||||
$(RM) $(BCM_KNET) $(KNET_CB) $(PSAMPLE) $(BCM_LPTP)
|
||||
$(RM) $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ)
|
||||
$(RM) $(KERN_BLDROOT)/linux-user-bde.$(KOBJ)
|
||||
$(RM) $(KERN_BLDROOT)/linux-bcm-knet.$(KOBJ)
|
||||
|
@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# -*- Makefile -*-
|
||||
# $Id: Makefile,v 0.1 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:
|
||||
#
|
||||
# TOOLS_DIR - path to build tools (if not in PATH already)
|
||||
# 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_19
|
||||
platform=gts
|
||||
LINUX_MAKE_USER=1
|
||||
export LINKER_RELAX = 1
|
||||
export ADD_TO_CFLAGS
|
||||
export BR_NO_CCACHE
|
||||
|
||||
|
||||
include ${SDK}/make/Make.linux
|
||||
|
@ -0,0 +1,59 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# -*- 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-$(kernel_version)
|
||||
|
||||
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
|
@ -0,0 +1,59 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# -*- 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_14
|
||||
platform=iproc_64
|
||||
|
||||
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
|
@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# -*- Makefile -*-
|
||||
# $Id: Makefile,v 0.1 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:
|
||||
#
|
||||
# TOOLS_DIR - path to build tools (if not in PATH already)
|
||||
# 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=slk
|
||||
LINUX_MAKE_USER=1
|
||||
export LINKER_RELAX = 1
|
||||
|
||||
include ${SDK}/make/Make.linux
|
||||
|
@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright 2017 Broadcom
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2, as
|
||||
# published by the Free Software Foundation (the "GPL").
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License version 2 (GPLv2) for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# version 2 (GPLv2) along with this source code.
|
||||
#
|
||||
# -*- Makefile -*-
|
||||
# $Id: Makefile,v 0.1 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:
|
||||
#
|
||||
# TOOLS_DIR - path to build tools (if not in PATH already)
|
||||
# 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_19
|
||||
platform=xlr
|
||||
LINUX_MAKE_USER=1
|
||||
export LINKER_RELAX = 1
|
||||
export ADD_TO_CFLAGS
|
||||
export BR_NO_CCACHE
|
||||
|
||||
|
||||
include ${SDK}/make/Make.linux
|
||||
|
Reference in New Issue
Block a user