diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk index d4a523c949..b4f28f1256 100644 --- a/platform/broadcom/sai-modules.mk +++ b/platform/broadcom/sai-modules.mk @@ -1,6 +1,6 @@ # Broadcom SAI modules -BRCM_OPENNSL_KERNEL_VERSION = 6.0.0.10 +BRCM_OPENNSL_KERNEL_VERSION = 6.0.0.13 BRCM_OPENNSL_KERNEL = opennsl-modules_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb $(BRCM_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules @@ -10,7 +10,7 @@ $(BRCM_OPENNSL_KERNEL)_MACHINE = broadcom SONIC_DPKG_DEBS += $(BRCM_OPENNSL_KERNEL) # SAI bcm modules for DNX family ASIC -BRCM_DNX_OPENNSL_KERNEL_VERSION = 6.0.0.10 +BRCM_DNX_OPENNSL_KERNEL_VERSION = 6.0.0.13 BRCM_DNX_OPENNSL_KERNEL = opennsl-modules-dnx_$(BRCM_DNX_OPENNSL_KERNEL_VERSION)_amd64.deb $(BRCM_DNX_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules-dnx diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 45e3a0114a..fd3b362723 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,4 +1,4 @@ -LIBSAIBCM_VERSION = 6.0.0.10-1 +LIBSAIBCM_VERSION = 6.0.0.13 LIBSAIBCM_BRANCH_NAME = REL_6.0 LIBSAIBCM_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_VERSION)" diff --git a/platform/broadcom/saibcm-modules-dnx b/platform/broadcom/saibcm-modules-dnx index be53f7910a..3fc83d5e5f 160000 --- a/platform/broadcom/saibcm-modules-dnx +++ b/platform/broadcom/saibcm-modules-dnx @@ -1 +1 @@ -Subproject commit be53f7910a9e8b37bf191527a6da3aba0414d4b8 +Subproject commit 3fc83d5e5f9d1abad3ddf7fa6767b8cdd6121232 diff --git a/platform/broadcom/saibcm-modules/debian/changelog b/platform/broadcom/saibcm-modules/debian/changelog index 127dce8af6..e9e36aaaf3 100644 --- a/platform/broadcom/saibcm-modules/debian/changelog +++ b/platform/broadcom/saibcm-modules/debian/changelog @@ -1,3 +1,9 @@ +opennsl (6.0.0.13) unstable; urgency=medium + + * Update to Broadcom SAI 6.0.0.13 + + -- Judy Joseph Fri, 14 Jan 2022 18:36:38 +0000 + opennsl (6.0.0.10) unstable; urgency=medium * Update to Broadcom SAI 6.0.0.10 diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install index 2d773b8961..59bf020cb2 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install @@ -2,6 +2,5 @@ systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/5.10.0-8 systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/5.10.0-8-2-amd64/extra systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/5.10.0-8-2-amd64/extra systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/5.10.0-8-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-ptp-clock.ko lib/modules/5.10.0-8-2-amd64/extra systemd/opennsl-modules.service lib/systemd/system sdklt/linux/bde/linux_ngbde.ko lib/modules/5.10.0-8-2-amd64/extra diff --git a/platform/broadcom/saibcm-modules/include/ibde.h b/platform/broadcom/saibcm-modules/include/ibde.h index 1716a18f39..d71d487f03 100644 --- a/platform/broadcom/saibcm-modules/include/ibde.h +++ b/platform/broadcom/saibcm-modules/include/ibde.h @@ -182,6 +182,10 @@ typedef struct ibde_s { uint32 addr, /* The address to access in the internal device address space */ uint32 value); /* the value to be written. */ + /* 64 bit read/write */ + uint64 (*read64)(int d, uint32 addr); + void (*write64)(int d, uint32 addr, uint64 data); + } ibde_t; diff --git a/platform/broadcom/saibcm-modules/include/soc/devids.h b/platform/broadcom/saibcm-modules/include/soc/devids.h index 0347f84710..8a67d385d9 100644 --- a/platform/broadcom/saibcm-modules/include/soc/devids.h +++ b/platform/broadcom/saibcm-modules/include/soc/devids.h @@ -1842,6 +1842,22 @@ #define BCM8884E_DEVICE_ID 0x884E #define BCM8884F_DEVICE_ID 0x884F +#define BCM88831_DEVICE_ID 0x8831 +#define BCM88832_DEVICE_ID 0x8832 +#define BCM88833_DEVICE_ID 0x8833 +#define BCM88834_DEVICE_ID 0x8834 +#define BCM88835_DEVICE_ID 0x8835 +#define BCM88836_DEVICE_ID 0x8836 +#define BCM88837_DEVICE_ID 0x8837 +#define BCM88838_DEVICE_ID 0x8838 +#define BCM88839_DEVICE_ID 0x8839 +#define BCM8883A_DEVICE_ID 0x883A +#define BCM8883B_DEVICE_ID 0x883B +#define BCM8883C_DEVICE_ID 0x883C +#define BCM8883D_DEVICE_ID 0x883D +#define BCM8883E_DEVICE_ID 0x883E +#define BCM8883F_DEVICE_ID 0x883F + #define Q2A_DEVICE_ID 0x8480 #define Q2A_A0_REV_ID DNXC_A0_REV_ID diff --git a/platform/broadcom/saibcm-modules/make/Make.config b/platform/broadcom/saibcm-modules/make/Make.config index 2d4536285a..b6f42bf65c 100644 --- a/platform/broadcom/saibcm-modules/make/Make.config +++ b/platform/broadcom/saibcm-modules/make/Make.config @@ -171,9 +171,11 @@ INCFLAGS = -I${INCDIR} -I${SDK}/systems CFLAGS += ${INCFLAGS} CXXFLAGS += ${INCFLAGS} CPPFLAGS += ${INCFLAGS} - CFLAGS += -DSAI_FIXUP -UKCOM_FILTER_MAX -DKCOM_FILTER_MAX=1025 -UKCOM_NETIF_MAX -DKCOM_NETIF_MAX=1056 +# Flag to enable multi instance support +CFLAGS += -DBCM_INSTANCE_SUPPORT + # # Debug #ifdef control # diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc index 183f7f2742..9b08d0b2a3 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc @@ -42,12 +42,14 @@ ifeq (BE,$(ENDIAN_MODE)) #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/xldk61-be/XLDK32 +KERN_BASE_DIR ?= $(TOOLCHAIN_BASE_DIR) TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux else -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK32 +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/XLDK_GCC10/XLDK32 +KERN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK32 TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux endif ifeq (,$(CROSS_COMPILE)) diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 index 121ccc2f3a..bfb6cd48dd 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 @@ -41,12 +41,14 @@ 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/xldk61-be/XLDK64 +KERN_BASE_DIR ?= $(TOOLCHAIN_BASE_DIR) TARGET_ARCHITECTURE ?= aarch64_be-broadcom-linux-uclibc -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux else -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK64 +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/XLDK_GCC10/XLDK64 +KERN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK64 TARGET_ARCHITECTURE ?= aarch64-broadcom-linux-uclibc -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux endif ifeq (,$(CROSS_COMPILE)) diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 index 80dd9c97c0..2f6b54f1b9 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 @@ -39,11 +39,6 @@ ifeq (,$(KFLAGS)) KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -fno-pie -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign endif -ifeq ($(LINUX_MAKE_SHARED_LIB), 1) - KFLAGS += -fPIC -mcmodel=small -else - KFLAGS += -fno-pie -mcmodel=kernel -endif LINUX_UAPI = $(LINUX_INCLUDE)/uapi ifneq (,$(shell ls $(LINUX_UAPI) 2>/dev/null)) diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_buff.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_buff.h new file mode 120000 index 0000000000..b4bc2b7ffe --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_buff.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicd.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicd.h new file mode 120000 index 0000000000..cface69c63 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicd.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicd.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicx.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicx.h new file mode 120000 index 0000000000..ee9f52060e --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicx.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicx.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_core.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_core.h new file mode 120000 index 0000000000..83e0769b2b --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_core.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_core.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dep.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dep.h new file mode 120000 index 0000000000..8a9a6c6f65 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dep.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_dep.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dev.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dev.h new file mode 120000 index 0000000000..4ba5f9aefb --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dev.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_dev.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_internal.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_internal.h new file mode 120000 index 0000000000..e9c65317d6 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_internal.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_internal.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_rxtx.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_rxtx.h new file mode 120000 index 0000000000..7bfe68f898 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_rxtx.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_rxtx.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_types.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_types.h new file mode 120000 index 0000000000..f2e6649cd0 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_types.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_types.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h index a1f7920b6b..c2730c140b 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h @@ -45,13 +45,6 @@ #define KMALLOC(size, flags) kmalloc(size, flags) #endif -#if defined(CONFIG_IDT_79EB334) || defined(CONFIG_BCM4702) -/* ioremap is broken in kernel */ -#define IOREMAP(addr, size) ((void *)KSEG1ADDR(addr)) -#else -#define IOREMAP(addr, size) ioremap(addr, size) -#endif - #if defined (__mips__) #if defined(CONFIG_NONCOHERENT_IO) || defined(CONFIG_DMA_NONCOHERENT) /* Use flush/invalidate for cached memory */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile index 2aa3bec11d..bc7b6fef5f 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile @@ -66,16 +66,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: $(KMODULE) else MODULE = $(LIBDIR)/linux-kernel-bde.o -build: kernel_libs module +build: module endif -module: kernel_libs $(MODULE) +module: $(MODULE) -$(MODULE): $(BLDDIR)/.tree $(BOBJS) +$(MODULE): $(BLDDIR)/.tree $(BOBJS) kernel_libs mkdir -p $(@D) $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ ifneq ($(kernel_version),2_4) diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c index b7c422e04e..be5b628239 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c @@ -166,14 +166,6 @@ MODULE_PARM_DESC(spifreq, #endif -/* Compatibility */ -#ifdef LKM_2_4 -#define _ISR_RET void -#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d, struct pt_regs *_r -#define IRQ_NONE -#define IRQ_HANDLED -#define SYNC_IRQ(_i) synchronize_irq() -#else /* LKM_2_6 */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) #define _ISR_RET irqreturn_t #else @@ -207,7 +199,6 @@ char * strtok(char * s,const char * ct) } LKM_EXPORT_SYM(___strtok); LKM_EXPORT_SYM(strtok); -#endif /* LKM_2_x */ /* PCIe capabilities */ #ifndef PCI_CAP_ID_EXP @@ -585,7 +576,7 @@ _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->bde_dev.base_address = (sal_vaddr_t)ioremap(paddr, 0x10000); ctrl->iowin[0].addr = paddr; ctrl->iowin[0].size = 0x10000; @@ -622,7 +613,7 @@ sand_device_create(void) ctrl->pci_device = NULL; /* No PCI bus */ /* Map in the device */ /* FIX_ME: not realy map anything */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(0x40000000, 0x100000); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(0x40000000, 0x100000); ctrl->iowin[0].addr = 0x40000000; ctrl->iowin[0].size = 0x100000; @@ -636,17 +627,17 @@ sand_device_create(void) /* Map CPU regs */ #ifdef __DUNE_WRX_BCM_CPU__ - cpu_address = IOREMAP(0x18000000, 0x4000000); + cpu_address = ioremap(0x18000000, 0x4000000); #elif defined(__DUNE_GTO_BCM_CPU__) - cpu_address = IOREMAP(0xe0000000, 0x100000); + cpu_address = ioremap(0xe0000000, 0x100000); #endif - if ((ctrl->bde_dev.device == PCP_PCI_DEVICE_ID)) { + if (ctrl->bde_dev.device == PCP_PCI_DEVICE_ID) { ctrl->bde_dev.device = GEDI_DEVICE_ID; ctrl->bde_dev.rev = GEDI_REV_ID; } - if ((ctrl->bde_dev.device == ACP_PCI_DEVICE_ID)) { + if (ctrl->bde_dev.device == ACP_PCI_DEVICE_ID) { ctrl->dev_type |= BDE_PCI_DEV_TYPE | BDE_SWITCH_DEV_TYPE; } @@ -724,7 +715,7 @@ iproc_cmicd_probe(struct platform_device *pldev) ctrl->pci_device = NULL; /* No PCI bus */ /* Map CMIC block in the AXI memory space into CPU address space */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(memres->start, size); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(memres->start, size); if (!ctrl->bde_dev.base_address) { gprintk("Error mapping iProc CMIC registers"); return -1; @@ -735,7 +726,7 @@ iproc_cmicd_probe(struct platform_device *pldev) #ifdef CONFIG_OF if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { uint32 *icfg_chip_id; - icfg_chip_id = (uint32 *)IOREMAP(ICFG_CHIP_ID_REG, 2 * sizeof(uint32)); + icfg_chip_id = (uint32 *)ioremap(ICFG_CHIP_ID_REG, 2 * sizeof(uint32)); if (icfg_chip_id == NULL) { gprintk("Error mapping ICFG_CHIP_ID_REG\n"); return -1; @@ -746,12 +737,12 @@ iproc_cmicd_probe(struct platform_device *pldev) /* Map GICD block in the AXI memory space into CPU address space */ 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->bde_dev.base_address1 = (sal_vaddr_t)ioremap(memres->start, memres->end - memres->start + 1); 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->bde_dev.base_address1 = (sal_vaddr_t)ioremap(IHOST_GICD_REG_ADDR, IHOST_GICD_REG_REMAP_LEN); ctrl->iowin[1].addr = IHOST_GICD_REG_ADDR; ctrl->iowin[1].size = IHOST_GICD_REG_REMAP_LEN; } @@ -914,7 +905,7 @@ iproc_has_cmicd(void) void *iproc_cca_base; /* Read ChipcommonA chip id register to identify current SOC */ - iproc_cca_base = IOREMAP(IPROC_CHIPCOMMONA_BASE, 0x3000); + iproc_cca_base = ioremap(IPROC_CHIPCOMMONA_BASE, 0x3000); if (iproc_cca_base == NULL) { gprintk("iproc_has_cmicd: ioremap of ChipcommonA registers failed"); return 0; @@ -969,12 +960,12 @@ iproc_cmicd_get_memregion(struct resource *res_mem) uint8_t size_type = 0; bool is_compident_a = 1; /* 1: CompidentA; o/w: CompidentB */ - erom_ptr_oft = IOREMAP(IPROC_CHIPCOMMONA_EROM_PTR_OFFSET, 0x100); + erom_ptr_oft = ioremap(IPROC_CHIPCOMMONA_EROM_PTR_OFFSET, 0x100); erom_phy_addr = readl((uint32 *)(erom_ptr_oft)); iounmap(erom_ptr_oft); - erom_base = IOREMAP(erom_phy_addr, EROM_MAX_SIZE); + erom_base = ioremap(erom_phy_addr, EROM_MAX_SIZE); while (1) { word = readl((uint32 *)(erom_base + i)); @@ -1071,7 +1062,7 @@ _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->bde_dev.base_address = (sal_vaddr_t)ioremap(paddr, 0x10000); ctrl->iowin[0].addr = paddr; ctrl->iowin[0].size = 0x10000; @@ -1662,6 +1653,21 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM8884D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM8884E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM8884F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88831_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88832_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88833_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88834_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88835_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88836_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88837_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88838_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88839_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883A_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883B_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883C_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, #endif /* BCM_DNX_SUPPORT */ #ifdef BCM_DFE_SUPPORT { BROADCOM_VENDOR_ID, BCM88770_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -2072,7 +2078,7 @@ _plx_las_bar_get(struct pci_dev *dev) void *local_config_addr; int bar = -1; - local_config_addr = IOREMAP(pci_resource_start(dev, PLX_MMAP_PCIBAR0), + local_config_addr = ioremap(pci_resource_start(dev, PLX_MMAP_PCIBAR0), pci_resource_len(dev, PLX_MMAP_PCIBAR0)); if (local_config_addr) { uint32 las_remap_reg; @@ -2578,7 +2584,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) * system performance. This change significantly reduces the * number of PCI retries from other devices on the PCI bus. */ - void * _mc_vbase = IOREMAP(BCM4704_MEMC_BASE, 0x1000); + void * _mc_vbase = ioremap(BCM4704_MEMC_BASE, 0x1000); int priorinv = 0x80; static int done = 0; if (!done) { @@ -2726,7 +2732,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) break; } - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, bar_len); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(paddr, bar_len); ctrl->iowin[0].addr = paddr; ctrl->iowin[0].size = bar_len; @@ -2749,7 +2755,7 @@ _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->bde_dev.base_address1 = (sal_vaddr_t)ioremap(paddr, bar_len); ctrl->iowin[1].addr = paddr; ctrl->iowin[1].size = PAGE_ALIGN(bar_len); if (debug >= 3) { @@ -2959,7 +2965,7 @@ map_local_bus(uint64_t addr, uint32_t size) ctrl->pci_device = NULL; /* No PCI bus */ /* Map in the device */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(addr, size); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(addr, size); ctrl->iowin[0].addr = addr; ctrl->iowin[0].size = size; @@ -3424,12 +3430,12 @@ _bde_mmap(struct file *filp, struct vm_area_struct *vma) static char _modname[] = LINUX_KERNEL_BDE_NAME; static gmodule_t _gmodule = { - name: LINUX_KERNEL_BDE_NAME, - major: LINUX_KERNEL_BDE_MAJOR, - init: _init, - cleanup: _cleanup, - pprint: _pprint, - mmap: _bde_mmap, + .name = LINUX_KERNEL_BDE_NAME, + .major = LINUX_KERNEL_BDE_MAJOR, + .init = _init, + .cleanup = _cleanup, + .pprint = _pprint, + .mmap = _bde_mmap, }; gmodule_t * @@ -3906,7 +3912,7 @@ _iproc_ihost_read(int d, uint32_t addr) { uint32_t *mapaddr; uint32_t reg_val; - mapaddr = IOREMAP(addr, sizeof(uint32_t)); + mapaddr = ioremap(addr, sizeof(uint32_t)); if (mapaddr == NULL) { return -1; } @@ -3919,7 +3925,7 @@ static int _iproc_ihost_write(int d, uint32_t addr, uint32_t data) { uint32_t *mapaddr; - mapaddr = IOREMAP(addr, sizeof(uint32_t)); + mapaddr = ioremap(addr, sizeof(uint32_t)); if (mapaddr == NULL) { return -1; } @@ -4219,7 +4225,7 @@ lkbde_cpu_pci_register(int d) if (ctrl->bde_dev.base_address) { iounmap((void *)ctrl->bde_dev.base_address); } - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(ctrl->iowin[0].addr, 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__); @@ -4271,29 +4277,29 @@ LKM_EXPORT_SYM(lkbde_mem_read); #endif /* BCM_SAND_SUPPORT */ static ibde_t _ibde = { - name: _name, - num_devices: _num_devices, - get_dev: _get_dev, - get_dev_type: _get_dev_type, - pci_conf_read: _pci_conf_read, - pci_conf_write: _pci_conf_write, - pci_bus_features: _pci_bus_features, - read: _read, - write: _write, - salloc: _salloc, - sfree: _sfree, - sinval: _sinval, - sflush: _sflush, - interrupt_connect: _interrupt_connect, - interrupt_disconnect: _interrupt_disconnect, - l2p: _l2p, - p2l: _p2l, + .name = _name, + .num_devices = _num_devices, + .get_dev = _get_dev, + .get_dev_type = _get_dev_type, + .pci_conf_read = _pci_conf_read, + .pci_conf_write = _pci_conf_write, + .pci_bus_features = _pci_bus_features, + .read = _read, + .write = _write, + .salloc = _salloc, + .sfree = _sfree, + .sinval = _sinval, + .sflush = _sflush, + .interrupt_connect = _interrupt_connect, + .interrupt_disconnect = _interrupt_disconnect, + .l2p = _l2p, + .p2l = _p2l, NULL, NULL, - iproc_read: _iproc_read, - iproc_write: _iproc_write, - get_cmic_ver: _get_cmic_ver, + .iproc_read = _iproc_read, + .iproc_write = _iproc_write, + .get_cmic_ver = _get_cmic_ver, }; /* diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c index 53a31f859c..be46282e7f 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c @@ -716,7 +716,7 @@ _edk_mpool_alloc(int dev_id, size_t size) dma_pbase = pbase; #ifdef REMAP_DMA_NONCACHED - _dma_vbase = IOREMAP(dma_pbase, size); + _dma_vbase = ioremap(dma_pbase, size); #endif _edk_dma_pool[dev_id].cpu_pbase = cpu_pbase; _edk_dma_pool[dev_id].dma_pbase = dma_pbase; @@ -1044,7 +1044,7 @@ void _dma_per_device_init(int dev_index) gprintk("remapping DMA buffer pool from physical:0x%lx original kernel_virt:0x%lx\n", (unsigned long)_dma_pbase, (unsigned long)_dma_vbase); } - _dma_vbase = IOREMAP(_dma_pbase, _dma_mem_size); + _dma_vbase = ioremap(_dma_pbase, _dma_mem_size); } if (dma_debug >= 1) { @@ -1270,13 +1270,8 @@ _sinval(int d, void *ptr, int length) #if defined(dma_cache_wback_inv) dma_cache_wback_inv((unsigned long)ptr, length); #else -#if defined(IPROC_CMICD) || defined(BCM958525) /* FIXME: need proper function to replace dma_cache_sync */ dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL); -#else - // TODO: This needs to be verified - dma_sync_single_for_device(NULL, ptr, length, DMA_BIDIRECTIONAL); -#endif #endif return 0; } @@ -1287,13 +1282,8 @@ _sflush(int d, void *ptr, int length) #if defined(dma_cache_wback_inv) dma_cache_wback_inv((unsigned long)ptr, length); #else -#if defined(IPROC_CMICD) || defined(BCM958525) /* FIXME: need proper function to replace dma_cache_sync */ dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL); -#else - // TODO: This needs to be verified - dma_sync_single_for_device(NULL, ptr, length, DMA_BIDIRECTIONAL); -#endif #endif return 0; diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c index 7ed387b0e1..7677aa5d43 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c @@ -71,6 +71,7 @@ MODULE_LICENSE("GPL"); /* CMICX defines */ #define INTC_INTR_REG_NUM (8) #define PAXB_INTRCLR_DELAY_REG_NUM (16) + /* TODO:HX5 The INTR base address values are changed for HX5, @@ -109,6 +110,29 @@ be made. #define INTC_INTR_STATUS_BASE (INTC_INTR_STATUS_REG0) #define INTC_INTR_RAW_STATUS_BASE (INTC_INTR_RAW_STATUS_REG0) +/** CMICX Gen2 defines*/ +#define CMICX_GEN2_INTC_INTR_REG_NUM (10) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_0 (0x0292C3A0) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_1 (0x0292C3A4) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_0 (0x0292C3A8) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_1 (0x0292C3AC) +#define CMICX_GEN2_PAXB_0_PAXB_INTR_STATUS (0x0292CF38) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTR_PACING_CTRL (0x0292C398) +#define CMICX_GEN2_PAXB_0_PAXB_INTRCLR_DELAY_UNIT (0x0292C39c) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_REG0 (0x0292C3b0) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE (CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_REG0) +#define CMICX_GEN2_PAXB_0_PCIE_ERROR_STATUS (0x0292C024) +#define CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_REG0 (0x0292D100) +#define CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_REG0 (0x0292D1A0) +#define CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_REG0 (0x0292D178) +#define CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_BASE (CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_REG0) +#define CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_BASE (CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_REG0) +#define CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_BASE (CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_REG0) +#define CMICX_GEN2_INTC_PDMA_INTR_REG_IND_0 5 +#define CMICX_GEN2_INTC_PDMA_INTR_REG_IND_1 6 + + + #define HX5_INTC_INTR_ENABLE_REG0 (0x102310f0) #define HX5_INTC_INTR_STATUS_REG0 (0x10231190) #define HX5_INTC_INTR_RAW_STATUS_REG0 (0x10231140) @@ -117,8 +141,6 @@ be made. #define HX5_INTC_INTR_STATUS_BASE (HX5_INTC_INTR_STATUS_REG0) #define HX5_INTC_INTR_RAW_STATUS_BASE (HX5_INTC_INTR_RAW_STATUS_REG0) -#define IOREMAP(addr, size) ioremap(addr, size) - #define HX5_IHOST_GICD_ISENABLERN_0 (0x10781100) #define HX5_IHOST_GICD_ISENABLERN_1 (0x10781104) #define HX5_IHOST_GICD_ICENABLERN_1 (0x10781184) @@ -205,6 +227,7 @@ typedef struct _intr_regs_s { uint32 intc_intr_clear_delay_unit; uint32 intc_intr_clear_delay_base; uint32 intc_intr_pcie_err_status; + uint32 intc_intr_nof_regs; } _intr_regs_t; typedef struct bde_ctrl_s { @@ -351,7 +374,7 @@ dump_interrupt_regs(bde_ctrl_t *ctrl , int dev) if (debug >= 2) { gprintk("Interrupt timeout count = %lu\n", intr_timeout_count); gprintk("Interrupt count = %lu\n", intr_count); - for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) { + for (ind = 0; ind < ctrl->intr_regs.intc_intr_nof_regs; ind++) { IPROC_READ(dev, ctrl->intr_regs.intc_intr_status_base + 4 * ind, val); gprintk("INTC_INTR_STATUS_REG_%d = 0x%x\n", ind, val); IPROC_READ(dev, ctrl->intr_regs.intc_intr_raw_status_base + 4 * ind, val); @@ -375,7 +398,7 @@ dump_interrupt_regs(bde_ctrl_t *ctrl , int dev) } } /* Clear interrupt enable registers */ - for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) { + for (ind = 0; ind < ctrl->intr_regs.intc_intr_nof_regs; ind++) { IPROC_WRITE(dev, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, 0); } } @@ -580,6 +603,85 @@ _cmicx_interrupt(bde_ctrl_t *ctrl) } } +#ifdef NEED_CMICX_GEN2_INTERRUPT +static void +_cmicx_gen2_interrupt(bde_ctrl_t *ctrl) +{ + int d, ind ; + uint32 stat, iena, mask, fmask; + int active_interrupts = 0; + bde_inst_resource_t *res; + + intr_count++; + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + + /** Get MSI clear mode, auto clear or SW clear, must be configure same for 64 MSI/MSIx vectors */ + IPROC_READ(d, ctrl->intr_regs.intc_intr_clear_mode_0, stat); + /* Clear MSI interrupts immediately to prevent spurious interrupts */ + if (stat == 0) { + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_clear_0, 0xFFFFFFFF); + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_clear_1, 0xFFFFFFFF); + } + + lkbde_irq_mask_get(d, &mask, &fmask); + for (ind = 0; ind < CMICX_GEN2_INTC_INTR_REG_NUM; ind++) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_status_base + 4 * ind, stat); + if (stat == 0) { + continue; + } + + if (fmask) { + /** Packet DMA 8 - 31 bits on IPROC_IRQ_BASE5 */ + if ((ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_0) && !(stat & 0xFF)) { + continue; + } else if ((ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_1) && !(stat & 0xFFFFFF00)) { + /** Packet DMA 0 - 7 bits on IPROC_IRQ_BASE6 */ + continue; + } + } + IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena); + if (stat & iena) { + active_interrupts = 1; + break; + } + } + + /* No active interrupts to service */ + if (!active_interrupts) { + return; + } + + /* Disable all interrupts.. Re-enable unserviced interrupts later + * So as to avoid getting new interrupts until the user level driver + * enumerates the interrupts to be serviced + */ + for (ind = 0; ind < CMICX_GEN2_INTC_INTR_REG_NUM; ind++) { + if (fmask) { + /** TODO? change by KNET */ + if (ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_0) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena); + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_enable_base + (4 * ind), iena & ((fmask & 0xFFFFFF) << 8)); + continue; + } else if (ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_1) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena); + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_enable_base + (4 * ind), iena & ((fmask & 0xFF) << 24)); + continue; + } + } + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_enable_base + (4 * ind), 0); + } + + /* Notify */ + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} +#endif /* NEED_CMICX_GEN2_INTERRUPT */ + static void _cmicm_interrupt(bde_ctrl_t *ctrl) { @@ -925,9 +1027,9 @@ _intr_mode_str(void *isr) } static void -_intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr) +_intr_regs_init(bde_ctrl_t *ctrl, int flag) { - if (hx5_intr) { + if (flag == 1) { 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_raw_status_base = HX5_INTC_INTR_RAW_STATUS_BASE; @@ -940,7 +1042,21 @@ _intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr) ctrl->intr_regs.intc_intr_clear_delay_unit = HX5_PAXB_0_PAXB_INTRCLR_DELAY_UNIT; ctrl->intr_regs.intc_intr_clear_delay_base = HX5_PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE; ctrl->intr_regs.intc_intr_pcie_err_status = HX5_PAXB_0_PCIE_ERROR_STATUS; - + ctrl->intr_regs.intc_intr_nof_regs = INTC_INTR_REG_NUM; + } else if (flag == 2){ + ctrl->intr_regs.intc_intr_status_base = CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_BASE; + ctrl->intr_regs.intc_intr_raw_status_base = CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_BASE; + ctrl->intr_regs.intc_intr_enable_base = CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_BASE; + ctrl->intr_regs.intc_intr_clear_0 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_0; + ctrl->intr_regs.intc_intr_clear_1 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_1; + ctrl->intr_regs.intc_intr_clear_mode_0 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_0; + ctrl->intr_regs.intc_intr_clear_mode_1 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_1; + ctrl->intr_regs.intc_intr_status = CMICX_GEN2_PAXB_0_PAXB_INTR_STATUS; + ctrl->intr_regs.intc_intr_pacing_ctrl = CMICX_GEN2_PAXB_0_PAXB_IC_INTR_PACING_CTRL; + ctrl->intr_regs.intc_intr_clear_delay_unit = CMICX_GEN2_PAXB_0_PAXB_INTRCLR_DELAY_UNIT; + ctrl->intr_regs.intc_intr_clear_delay_base = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE; + ctrl->intr_regs.intc_intr_pcie_err_status = CMICX_GEN2_PAXB_0_PCIE_ERROR_STATUS; + ctrl->intr_regs.intc_intr_nof_regs = CMICX_GEN2_INTC_INTR_REG_NUM; } else { ctrl->intr_regs.intc_intr_status_base = INTC_INTR_STATUS_BASE; ctrl->intr_regs.intc_intr_raw_status_base = INTC_INTR_RAW_STATUS_BASE; @@ -954,7 +1070,7 @@ _intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr) ctrl->intr_regs.intc_intr_clear_delay_unit = PAXB_0_PAXB_INTRCLR_DELAY_UNIT; ctrl->intr_regs.intc_intr_clear_delay_base = PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE; ctrl->intr_regs.intc_intr_pcie_err_status = PAXB_0_PCIE_ERROR_STATUS; - + ctrl->intr_regs.intc_intr_nof_regs = INTC_INTR_REG_NUM; } } @@ -1074,11 +1190,11 @@ _devices_init(int d) ctrl->isr = (isr_f)_cmicx_interrupt; if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { if (!ihost_intr_enable_base) { - ihost_intr_enable_base = (uint32_t *)IOREMAP(HX5_IHOST_GICD_ISENABLERN_1, + ihost_intr_enable_base = (uint32_t *)ioremap(HX5_IHOST_GICD_ISENABLERN_1, HX5_IHOST_INTR_MAP_NUM); } if (!ihost_intr_status_base) { - ihost_intr_status_base = (uint32_t *)IOREMAP(HX5_INTC_INTR_RAW_STATUS_REG0, + ihost_intr_status_base = (uint32_t *)ioremap(HX5_INTC_INTR_RAW_STATUS_REG0, HX5_IHOST_INTR_STATUS_MAP_NUM); } } @@ -1131,6 +1247,7 @@ _devices_init(int d) ctrl->isr = (isr_f)_cmicx_interrupt; _intr_regs_init(ctrl, 0); break; + } #endif /* defined(BCM_DNXF_SUPPORT) || defined(BCM_DNX_SUPPORT) */ @@ -1867,7 +1984,7 @@ _ioctl(unsigned int cmd, unsigned long arg) return -EINVAL; } if (_devices[io.dev].dev_type & BDE_AXI_DEV_TYPE) { - mapaddr = IOREMAP(io.d0, sizeof(uint32_t)); + mapaddr = ioremap(io.d0, sizeof(uint32_t)); if (mapaddr == NULL) { io.rc = LUBDE_FAIL; return -1; @@ -1920,12 +2037,12 @@ static char _modname[] = LINUX_USER_BDE_NAME; static gmodule_t _gmodule = { - name: LINUX_USER_BDE_NAME, - major: LINUX_USER_BDE_MAJOR, - init: _init, - cleanup: _cleanup, - pprint: _pprint, - ioctl: _ioctl, + .name = LINUX_USER_BDE_NAME, + .major = LINUX_USER_BDE_MAJOR, + .init = _init, + .cleanup = _cleanup, + .pprint = _pprint, + .ioctl = _ioctl, }; gmodule_t* diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c index dbb3de5f9e..b93f1e913f 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c @@ -5477,6 +5477,12 @@ bkn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) bkn_switch_info_t *sinfo; struct hwtstamp_config config; + DBG_PTP(("bkn_ioctl: module_initialized:%d\n", module_initialized)); + + if (!module_initialized) { + return -EINVAL; + } + if (!dev) return -EINVAL; @@ -6608,6 +6614,12 @@ static const struct net_device_ops bkn_netdev_ops = { static void bkn_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) { + DBG_PTP(("bkn_get_drv_info: module_initialized:%d\n", module_initialized)); + + if (!module_initialized) { + return; + } + strlcpy(drvinfo->driver, "bcm-knet", sizeof(drvinfo->driver)); snprintf(drvinfo->version, sizeof(drvinfo->version), "%d", KCOM_VERSION); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); @@ -6621,6 +6633,12 @@ bkn_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) bkn_priv_t *priv; bkn_switch_info_t *sinfo; + DBG_PTP(("bkn_get_ts_info: module_initialized:%d\n", module_initialized)); + + if (!module_initialized) { + return -EINVAL; + } + if (!dev) return -EINVAL; @@ -6631,6 +6649,9 @@ bkn_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) sinfo = priv->sinfo; + if (!sinfo) + return -EINVAL; + switch (sinfo->dcb_type) { case 28: /* dpp */ case 26: @@ -6734,6 +6755,7 @@ bkn_init_ndev(u8 *mac, char *name) dev->mtu = rx_buffer_size; } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) + dev->min_mtu = 68; dev->max_mtu = rx_buffer_size; #endif @@ -6885,24 +6907,14 @@ bkn_proc_link_write(struct file *file, const char *buf, return count; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -struct file_operations bkn_proc_link_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_link_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_link_write, - release: single_release, -}; -#else struct proc_ops bkn_proc_link_file_ops = { - proc_open: bkn_proc_link_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bkn_proc_link_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_link_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_link_write, + .proc_release = single_release, }; -#endif /* * Device Rate Control Proc Read Entry @@ -7005,24 +7017,14 @@ bkn_proc_rate_write(struct file *file, const char *buf, return count; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -struct file_operations bkn_proc_rate_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_rate_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_rate_write, - release: single_release, -}; -#else struct proc_ops bkn_proc_rate_file_ops = { - proc_open: bkn_proc_rate_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bkn_proc_rate_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_rate_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_rate_write, + .proc_release = single_release, }; -#endif /* * Driver DMA Proc Entry @@ -7265,22 +7267,13 @@ bkn_seq_dma_open(struct inode *inode, struct file *file) return seq_open(file, &bkn_seq_dma_ops); }; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -static struct file_operations bkn_seq_dma_file_ops = { - .owner = THIS_MODULE, - .open = bkn_seq_dma_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release -}; -#else static struct proc_ops bkn_seq_dma_file_ops = { + PROC_OWNER(THIS_MODULE) .proc_open = bkn_seq_dma_open, .proc_read = seq_read, - .proc_lseek = seq_lseek, + .proc_lseek = seq_lseek, .proc_release = seq_release }; -#endif /* * Device Debug Control Proc Write Entry @@ -7411,24 +7404,14 @@ static int bkn_proc_debug_open(struct inode * inode, struct file * file) return single_open(file, bkn_proc_debug_show, NULL); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -struct file_operations bkn_proc_debug_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_debug_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_debug_write, - release: single_release, -}; -#else struct proc_ops bkn_proc_debug_file_ops = { - proc_open: bkn_proc_debug_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bkn_proc_debug_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_debug_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_debug_write, + .proc_release = single_release, }; -#endif /* * Device Statistics Proc Entry @@ -7550,24 +7533,14 @@ bkn_proc_stats_write(struct file *file, const char *buf, return count; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -struct file_operations bkn_proc_stats_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_stats_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_stats_write, - release: single_release, -}; -#else struct proc_ops bkn_proc_stats_file_ops = { - proc_open: bkn_proc_stats_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bkn_proc_stats_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_stats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_stats_write, + .proc_release = single_release, }; -#endif /* @@ -7737,24 +7710,14 @@ bkn_proc_dstats_write(struct file *file, const char *buf, return count; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -struct file_operations bkn_proc_dstats_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_dstats_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_dstats_write, - release: single_release, -}; -#else struct proc_ops bkn_proc_dstats_file_ops = { - proc_open: bkn_proc_dstats_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: bkn_proc_dstats_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_dstats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_dstats_write, + .proc_release = single_release, }; -#endif /* * PTP Statistics Proc Entry @@ -7779,16 +7742,15 @@ bkn_proc_ptp_stats_show(struct seq_file *m, void *v) if (priv->tx_hwts || priv->rx_hwts) { if (!print_hdr_done) { seq_printf(m, "PTP message stats (unit %d):\n", unit); - seq_printf(m, "=============================\n\n"); - seq_printf(m, " %-10s| %-8s| %-8s| %-8s| %-12s| %-12s\n", - "intf", "tx_hwts", "rx_hwts", "phc_type", "tx_pkts", "rx_pkts"); + seq_printf(m, " %-10s| %8s| %12s| %12s| %8s| %8s\n", + "intf", "phc_type", "tx_pkts", "rx_pkts", "tx_hwts", "rx_hwts"); seq_printf(m, "======================================================================\n"); print_hdr_done = 1; } - seq_printf(m, " %-10s| %8d| %8d| %-8s| %12d| %12d\n", - dev->name, priv->tx_hwts, priv->rx_hwts, - (priv->tx_hwts & HWTSTAMP_TX_ONESTEP_SYNC ? "1-step": "2-step"), - priv->ptp_stats_tx, priv->ptp_stats_rx); + seq_printf(m, " %-10s| %8s| %12d| %12d| %8d| %8d\n", + dev->name, (priv->tx_hwts & HWTSTAMP_TX_ONESTEP_SYNC ? "1-step": "2-step"), + priv->ptp_stats_tx, priv->ptp_stats_rx, + priv->tx_hwts, priv->rx_hwts); } } } @@ -7856,13 +7818,13 @@ bkn_proc_ptp_stats_write(struct file *file, const char *buf, size_t count, loff_ return count; } -struct file_operations bkn_proc_ptp_stats_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_ptp_stats_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_ptp_stats_write, - release: single_release, +struct proc_ops bkn_proc_ptp_stats_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_ptp_stats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_ptp_stats_write, + .proc_release = single_release, }; diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h index 9ea8fc5896..3d66635977 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h @@ -42,8 +42,8 @@ #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +#error Kernel too old #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) /* The version kconfig.h became available in. */ @@ -63,11 +63,7 @@ #include /* Helper defines for multi-version kernel support */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -#define LKM_2_4 -#else #define LKM_2_6 -#endif #include /* printk() */ #include /* everything... */ @@ -96,24 +92,11 @@ /* Compatibility Macros */ -#ifdef LKM_2_4 - -#include -#include -#define LKM_MOD_PARAM(n,ot,nt,d) MODULE_PARM(n,ot) -#define LKM_MOD_PARAM_ARRAY(n,ot,nt,c,d) MODULE_PARM(n,ot) -#define LKM_EXPORT_SYM(s) -#define _free_netdev kfree - -#else /* LKM_2_6 */ - #define LKM_MOD_PARAM(n,ot,nt,d) module_param(n,nt,d) #define LKM_MOD_PARAM_ARRAY(n,ot,nt,c,d) module_param_array(n,nt,c,d) #define LKM_EXPORT_SYM(s) EXPORT_SYMBOL(s) #define _free_netdev free_netdev -#endif /* LKM_2_x */ - #ifndef list_for_each_safe #define list_for_each_safe(l,t,i) t = 0; list_for_each((l),(i)) #endif @@ -162,6 +145,18 @@ #define CONFIG_BMW #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0) +#define PROC_OWNER(_m) +#else +#define PROC_OWNER(_m) .owner = _m, +#define proc_ops file_operations +#define proc_open open +#define proc_read read +#define proc_write write +#define proc_lseek llseek +#define proc_release release +#endif + #if PROC_INTERFACE_KERN_VER_3_10 #define PROC_CREATE(_entry, _name, _acc, _path, _fops) \ do { \ diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile index e0711db022..d888820faf 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile @@ -61,6 +61,9 @@ $(KMODULE): $(MODULE) rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile +ifeq ($(BUILD_PSAMPLE),1) + sed -i 's/0x......../0x00000000/' ${BLDDIR}/../psample/kernel_module/Module.symvers +endif cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c index fd69d64ddb..e67f9191d4 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c @@ -715,11 +715,12 @@ psample_proc_rate_write(struct file *file, const char *buf, } struct proc_ops psample_proc_rate_file_ops = { - proc_open: psample_proc_rate_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: psample_proc_rate_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_rate_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_rate_write, + .proc_release = single_release, }; /* @@ -813,11 +814,12 @@ psample_proc_size_write(struct file *file, const char *buf, } struct proc_ops psample_proc_size_file_ops = { - proc_open: psample_proc_size_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: psample_proc_size_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_size_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_size_write, + .proc_release = single_release, }; /* @@ -853,11 +855,12 @@ psample_proc_map_open(struct inode * inode, struct file * file) } struct proc_ops psample_proc_map_file_ops = { - proc_open: psample_proc_map_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: NULL, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_map_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = NULL, + .proc_release = single_release, }; /* @@ -922,11 +925,12 @@ psample_proc_debug_write(struct file *file, const char *buf, } struct proc_ops psample_proc_debug_file_ops = { - proc_open: psample_proc_debug_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: psample_proc_debug_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_debug_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_debug_write, + .proc_release = single_release, }; static int @@ -981,11 +985,12 @@ psample_proc_stats_write(struct file *file, const char *buf, return count; } struct proc_ops psample_proc_stats_file_ops = { - proc_open: psample_proc_stats_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: psample_proc_stats_write, - proc_release: single_release, + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_stats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_stats_write, + .proc_release = single_release, }; int psample_cleanup(void) diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile index 631590104c..53293a7ac9 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile @@ -48,7 +48,7 @@ $(KMODULE): $(MODULE) 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 + MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif # Make.depend is before clean:: so that Make.depend's clean:: runs first. diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c index 5b2d5d959a..df6e2d6bb6 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c @@ -41,16 +41,6 @@ static gmodule_t* _gmodule = NULL; -/* Allow DEVFS Support on 2.4 Kernels */ -#if defined(LKM_2_4) && defined(CONFIG_DEVFS_FS) -#define GMODULE_CONFIG_DEVFS_FS -#endif - - -#ifdef GMODULE_CONFIG_DEVFS_FS -devfs_handle_t devfs_handle = NULL; -#endif - /* FIXME: support dynamic debugging */ static int _dbg_enable = 0; @@ -149,24 +139,14 @@ static int _gmodule_proc_release(struct inode * inode, struct file * file) { return single_release(inode, file); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) -struct file_operations _gmodule_proc_fops = { - owner: THIS_MODULE, - open: _gmodule_proc_open, - read: seq_read, - llseek: seq_lseek, - write: _gmodule_proc_write, - release: _gmodule_proc_release, -}; -#else struct proc_ops _gmodule_proc_fops = { - proc_open: _gmodule_proc_open, - proc_read: seq_read, - proc_lseek: seq_lseek, - proc_write: _gmodule_proc_write, - proc_release: _gmodule_proc_release, + PROC_OWNER(THIS_MODULE) + .proc_open = _gmodule_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = _gmodule_proc_write, + .proc_release = _gmodule_proc_release, }; -#endif #else int gmodule_vpprintf(char** page_ptr, const char* fmt, va_list args) @@ -281,7 +261,6 @@ _gmodule_release(struct inode *inode, struct file *filp) return 0; } -#if defined(HAVE_UNLOCKED_IOCTL) || LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) static long _gmodule_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) @@ -292,20 +271,7 @@ _gmodule_unlocked_ioctl(struct file *filp, return -1; } } -#else -static int -_gmodule_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - if(_gmodule->ioctl) { - return _gmodule->ioctl(cmd, arg); - } else { - return -1; - } -} -#endif -#ifdef HAVE_COMPAT_IOCTL static long _gmodule_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -315,7 +281,6 @@ _gmodule_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return -1; } } -#endif static int @@ -344,17 +309,11 @@ _gmodule_mmap(struct file *filp, struct vm_area_struct *vma) /* FILE OPERATIONS */ struct file_operations _gmodule_fops = { -#if defined(HAVE_UNLOCKED_IOCTL) || LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) - unlocked_ioctl: _gmodule_unlocked_ioctl, -#else - ioctl: _gmodule_ioctl, -#endif - open: _gmodule_open, - release: _gmodule_release, - mmap: _gmodule_mmap, -#ifdef HAVE_COMPAT_IOCTL - compat_ioctl: _gmodule_compat_ioctl, -#endif + .unlocked_ioctl = _gmodule_unlocked_ioctl, + .open = _gmodule_open, + .release = _gmodule_release, + .mmap = _gmodule_mmap, + .compat_ioctl = _gmodule_compat_ioctl, }; @@ -374,11 +333,7 @@ cleanup_module(void) } /* Finally, remove ourselves from the universe */ -#ifdef GMODULE_CONFIG_DEVFS_FS - if(devfs_handle) devfs_unregister(devfs_handle); -#else unregister_chrdev(_gmodule->major, _gmodule->name); -#endif } int __init @@ -392,21 +347,6 @@ init_module(void) /* Register ourselves */ -#ifdef GMODULE_CONFIG_DEVFS_FS - devfs_handle = devfs_register(NULL, - _gmodule->name, - DEVFS_FL_NONE, - _gmodule->major, - _gmodule->minor, - S_IFCHR | S_IRUGO | S_IWUGO, - &_gmodule_fops, - NULL); - if(!devfs_handle) { - printk(KERN_WARNING "%s: can't register device with devfs", - _gmodule->name); - } - rc = 0; -#else rc = register_chrdev(_gmodule->major, _gmodule->name, &_gmodule_fops); @@ -419,17 +359,12 @@ init_module(void) if(_gmodule->major == 0) { _gmodule->major = rc; } -#endif /* Specific module Initialization */ if(_gmodule->init) { int rc; if((rc = _gmodule->init()) < 0) { -#ifdef GMODULE_CONFIG_DEVFS_FS - if(devfs_handle) devfs_unregister(devfs_handle); -#else unregister_chrdev(_gmodule->major, _gmodule->name); -#endif return rc; } } diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c index e34e18cdaf..2161b287f6 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c @@ -191,9 +191,15 @@ sal_sem_give(sal_sem_t b) uint32 sal_time_usecs(void) { - // ktime_to_us and ktime_get_real_ns return 64-bit integets, but this - // function is returning a 32-bit integer. This should be fine until 2038. +#if !defined(SAI_FIXUP) + struct timeval ltv; + do_gettimeofday(<v); + return (ltv.tv_sec * SECOND_USEC + ltv.tv_usec); +#else + /* ktime_to_us and ktime_get_real_ns return 64-bit integets, but this */ + /* function is returning a 32-bit integer. This should be fine until 2038. */ return ktime_to_us(ktime_get_real_ns()); +#endif } void diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile index 8f59a763e3..3dc6425e6e 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile @@ -105,9 +105,6 @@ 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) @@ -125,12 +122,6 @@ 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 all_targets += $(BCM_KNET) @@ -152,30 +143,7 @@ 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 @@ -200,11 +168,6 @@ 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) @@ -219,10 +182,6 @@ ifdef BUILD_KNET_CB $(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) @@ -241,8 +200,7 @@ $(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)))) @@ -252,10 +210,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 psample bcm-ptp-clock" \ + subdirs="shared bcm-knet knet-cb psample" \ override-target=linux-$(platform) $@ $(RM) $(KERNEL_BDE) $(USER_BDE) - $(RM) $(BCM_KNET) $(KNET_CB) $(PSAMPLE) $(BCM_LPTP) + $(RM) $(BCM_KNET) $(KNET_CB) $(PSAMPLE) $(RM) $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ) $(RM) $(KERN_BLDROOT)/linux-user-bde.$(KOBJ) $(RM) $(KERN_BLDROOT)/linux-bcm-knet.$(KOBJ)