├── .gitattributes ├── Legal └── LICENSE ├── README.md ├── RELEASE ├── include ├── appl │ └── diag │ │ ├── bslmgmt.h │ │ └── opennsa_diag.h ├── bcm │ ├── async.h │ ├── bcmi2c.h │ ├── bfd.h │ ├── collector.h │ ├── cosq.h │ ├── custom.h │ ├── debug.h │ ├── ecn.h │ ├── error.h │ ├── extender.h │ ├── fabric.h │ ├── failover.h │ ├── fcmap.h │ ├── fcoe.h │ ├── field.h │ ├── flowtracker.h │ ├── init.h │ ├── int.h │ ├── ipmc.h │ ├── knet.h │ ├── l2.h │ ├── l2gre.h │ ├── l3.h │ ├── latency_monitor.h │ ├── link.h │ ├── macsec.h │ ├── mcast.h │ ├── mim.h │ ├── mirror.h │ ├── module.h │ ├── mpls.h │ ├── multicast.h │ ├── nat.h │ ├── niv.h │ ├── oam.h │ ├── oob.h │ ├── pkt.h │ ├── pktio.h │ ├── policer.h │ ├── port.h │ ├── proxy.h │ ├── pstats.h │ ├── ptp.h │ ├── qos.h │ ├── range.h │ ├── rate.h │ ├── rx.h │ ├── sat.h │ ├── stack.h │ ├── stat.h │ ├── stg.h │ ├── subport.h │ ├── sum.h │ ├── switch.h │ ├── time.h │ ├── topo.h │ ├── trill.h │ ├── trunk.h │ ├── tunnel.h │ ├── tx.h │ ├── types.h │ ├── udf.h │ ├── vlan.h │ ├── vswitch.h │ └── vxlan.h ├── bsl_custom_enum.h ├── sal │ ├── appl │ │ ├── config.h │ │ └── sal.h │ ├── compiler.h │ ├── core │ │ ├── boot.h │ │ ├── libc.h │ │ └── time.h │ └── types.h ├── shared │ ├── bfd.h │ ├── bitop.h │ ├── bsl.h │ ├── bsl_enum_hybrid.h │ ├── bslenum.h │ ├── bslext.h │ ├── bslnames.h │ ├── bsltypes.h │ ├── cosq.h │ ├── error.h │ ├── fabric.h │ ├── field.h │ ├── gport.h │ ├── l3.h │ ├── mpls.h │ ├── multicast.h │ ├── pbmp.h │ ├── phyconfig.h │ ├── phyreg.h │ ├── pkt.h │ ├── policer.h │ ├── port.h │ ├── port_ability.h │ ├── portmode.h │ ├── rx.h │ ├── stat.h │ ├── switch.h │ ├── trunk.h │ ├── types.h │ └── util.h └── soc │ ├── cmext.h │ ├── cmtypes.h │ ├── opensoc.h │ └── property.h ├── lib ├── mips-BCM9XLP2_XMC_A1 │ ├── libopennsa.a │ ├── libopennsa_cint.a │ ├── libopennsa_diag.a │ └── libopennsadyn.so └── x86-64 │ ├── libopennsa.a │ └── libopennsa.so └── src ├── diag ├── Makefile ├── config_init_defaults.c ├── demo_opennsa_init ├── demo_opennsa_init.c ├── opennsa_diag_shell.c ├── opennsa_diag_shell_qax └── version.c └── gpl-modules ├── RELEASE ├── include ├── ibde.h ├── kcom.h ├── sal │ ├── core │ │ ├── sync.h │ │ └── thread.h │ └── types.h ├── sdk_config.h └── soc │ └── devids.h ├── make ├── Make.config ├── Make.depend ├── Make.kernlib ├── Make.lib ├── Make.linux ├── Make.subdirs ├── Make.tools ├── Makefile.linux-bmw-2_6 ├── Makefile.linux-gto ├── Makefile.linux-gto-2_6 ├── Makefile.linux-gts ├── Makefile.linux-iproc ├── Makefile.linux-iproc-3_14 ├── Makefile.linux-iproc-4_4 ├── Makefile.linux-iproc_64 ├── Makefile.linux-jag-2_6 ├── Makefile.linux-kernel ├── Makefile.linux-kernel-2_6 ├── Makefile.linux-kernel-3_6 ├── Makefile.linux-kernel-4_4 ├── Makefile.linux-kmodule ├── Makefile.linux-nsx-2_6 ├── Makefile.linux-nsx64 ├── Makefile.linux-nsx_wrl-2_6 ├── Makefile.linux-raptor ├── Makefile.linux-raptor-2_6 ├── Makefile.linux-slk ├── Makefile.linux-x86-common-2_6 ├── Makefile.linux-x86-generic-common-2_6 ├── Makefile.linux-x86-smp_generic_64-2_6 └── Makefile.linux-xlr ├── systems ├── bde │ ├── linux │ │ ├── include │ │ │ ├── linux-bde.h │ │ │ ├── linux_dma.h │ │ │ └── mpool.h │ │ ├── kernel │ │ │ ├── Makefile │ │ │ ├── linux-kernel-bde.c │ │ │ ├── linux_dma.c │ │ │ ├── linux_shbde.c │ │ │ └── linux_shbde.h │ │ ├── shared │ │ │ └── mpool.c │ │ └── user │ │ │ └── kernel │ │ │ ├── Makefile │ │ │ ├── linux-user-bde.c │ │ │ └── linux-user-bde.h │ └── shared │ │ ├── include │ │ ├── shbde.h │ │ ├── shbde_iproc.h │ │ ├── shbde_mdio.h │ │ └── shbde_pci.h │ │ ├── shbde_iproc.c │ │ ├── shbde_mdio.c │ │ └── shbde_pci.c └── linux │ ├── kernel │ └── modules │ │ ├── Makefile │ │ ├── bcm-knet │ │ ├── Makefile │ │ └── bcm-knet.c │ │ ├── include │ │ ├── bcm-knet.h │ │ ├── gmodule.h │ │ └── lkm.h │ │ ├── knet-cb │ │ ├── Makefile │ │ └── knet-cb.c │ │ └── shared │ │ ├── Makefile │ │ ├── gmodule.c │ │ └── ksal.c │ └── user │ ├── bmw-2_6 │ └── Makefile │ ├── common │ └── Makefile │ ├── gto-2_6 │ └── Makefile │ ├── gto │ └── Makefile │ ├── gts │ └── Makefile │ ├── iproc-3_14 │ └── Makefile │ ├── iproc-4_4 │ └── Makefile │ ├── iproc │ └── Makefile │ ├── iproc_64 │ └── Makefile │ ├── jag-2_6 │ └── Makefile │ ├── nsx-2_6 │ └── Makefile │ ├── nsx64 │ └── Makefile │ ├── nsx_wrl-2_6 │ └── Makefile │ ├── raptor-2_6 │ └── Makefile │ ├── raptor │ └── Makefile │ ├── slk │ └── Makefile │ ├── x86-smp_generic_64-2_6 │ └── Makefile │ └── xlr │ └── Makefile └── tools └── mktool.pl /.gitattributes: -------------------------------------------------------------------------------- 1 | *.a filter=lfs diff=lfs merge=lfs -text 2 | src/diag/openbcm_diag filter=lfs diff=lfs merge=lfs -text 3 | src/diag/openbcm_diag_shell filter=lfs diff=lfs merge=lfs -text 4 | src/diag/openbcm_no_shell filter=lfs diff=lfs merge=lfs -text 5 | src/diag/opennsa_no_shell filter=lfs diff=lfs merge=lfs -text 6 | src/diag/opennsa_diag_shell filter=lfs diff=lfs merge=lfs -text 7 | lib/x86-64/libopennsa.so filter=lfs diff=lfs merge=lfs -text 8 | src/diag/demo_opennsa_init filter=lfs diff=lfs merge=lfs -text 9 | src/diag/opennsa_diag_shell_qax filter=lfs diff=lfs merge=lfs -text 10 | lib/x86-64/* filter=lfs diff=lfs merge=lfs -text 11 | lib/mips-BCM9XLP2_XMC_A1/* filter=lfs diff=lfs merge=lfs -text 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenNSA 2 | ======= 3 | OpenNSA Broadcom Switch Software 4 | 5 | Version 6 | ======= 7 | 6.5.17 8 | 9 | Overview 10 | ======== 11 | 12 | Broadcom Open Network Switch APIs (OpenNSA) is a library of network switch APIs that 13 | is openly available for programming Broadcom network switch silicon based 14 | platforms. These APIs enable development of networking application 15 | software based on Broadcom network switch architecture based platforms. 16 | 17 | Migration from OpenNsl 18 | ====================== 19 | This software package is replacing the OpenNSL (https://github.com/Broadcom-Switch/OpenNSL) software package. OpenNSL users are encouraged to migrate this release by replacing all OpenNSL API calls with bcm_xxx API calls in their application and use the new opensoc APIs for soc and SDK layer initialization. 20 | 21 | Legal 22 | ===== 23 | 24 | The SDK APIs, sample application and binary library are covered by the following license see Legal/LICENSE file. 25 | SDK uses a few open source components, see Legal/EXTLICENSE file for license terms. 26 | The software in the gpl-module and dcb-gpl-modules directories are covered by GPLv2 license. 27 | 28 | Supported devices 29 | ================= 30 | 31 | This release supports the following devices: 32 | * BCM56850 "Trident2" 33 | * BCM56960 "Tomahawk" 34 | * BCM56970 "Tomahawk2" 35 | * BCM56980 "Tomahawk3" 36 | * BCM88470 "Qumran AX" 37 | 38 | Build configuration 39 | ====================== 40 | 41 | The included libopennsa.a library was built for x86 without debug symbols. 42 | 43 | Built-in demo utility 44 | ====================== 45 | 46 | The package includes a sample utility that can be used for the following purposes: 47 | 1. To verify that an application can be linked successfully with the provided library 48 | 1. To verify that the application can successfully probe and attach a supported Broadcom device 49 | 1. To verify that the application can successfully initialize the device 50 | 51 | The demo application can be found in $SDK/src/diag and can be compiled by executing "make" in that directory. 52 | 53 | When executed on a system that has a supported Broadcom switch device on a PCIe bus, the utility should produce the following output: 54 | 55 | Broadcom_SVK_Linux# cd opennsa/src/diag 56 | Broadcom_SVK_Linux# ./opennsa_diag 57 | DMA pool size: 33554432 58 | BDE unit 0 (PCI), Dev 0xb980, Rev 0x11, Chip BCM56980_B0, Driver BCM56980_B0 59 | SUCCESS: soc_attach( 0 ), result=0 60 | SUCCESS: soc_init( 0 ), result=0 61 | SUCCESS: soc_misc_init( 0 ), result=0 62 | SUCCESS: soc_mmu_init( 0 ), result=0 63 | SUCCESS: bcm_init( 0 ), result=0 64 | Unit=0 initialization completed. 65 | Broadcom_SVK_Linux# 66 | 67 | Note that the utility is built with the assumption that the device can be initialized with the default configuration and may not work across all SKUs or device variants. It is intended to be used primarily as a build verification utility and a sample smoke test to demonstrate the compilation, linking and device initialization process with OpenNSA. 68 | 69 | When integrating the OpenNSA library into your network operating system you should use the example demo program for how to make the soc/opensoc.h API calls which are necessary for SDK initialization and startup. 70 | -------------------------------------------------------------------------------- /RELEASE: -------------------------------------------------------------------------------- 1 | opennsa-6.5.17-EA12 2 | -------------------------------------------------------------------------------- /include/appl/diag/bslmgmt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * Broadcom System Log Management 9 | */ 10 | 11 | #ifndef _DIAG_BSLMGMT_H 12 | #define _DIAG_BSLMGMT_H 13 | 14 | #include 15 | #include 16 | 17 | extern int 18 | bslmgmt_cleanup(void); 19 | 20 | extern int 21 | bslmgmt_init(void); 22 | 23 | /*! 24 | * \brief Install output redirection hook. 25 | * 26 | * An output redirection hook is used when the output from one command 27 | * should be used as input for another. 28 | * 29 | * If the redirection output hook returns a non-zero value, the log 30 | * message (command output) will not be sent to any of the installed 31 | * output sinks. 32 | * 33 | * \param [in] out_hook Output hook for redirection. 34 | * 35 | * \return Always 0. 36 | */ 37 | extern int 38 | bslmgmt_redir_hook_set(bsl_out_hook_f out_hook); 39 | 40 | #endif /* !_DIAG_BSLMGMT_H */ 41 | -------------------------------------------------------------------------------- /include/appl/diag/opennsa_diag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This header file defines important constants and structures for 9 | * use with Broadcom Diagnostics Shell which is built upon the SOC 10 | * driver and SAL (System Abstraction Layer) 11 | */ 12 | 13 | #ifndef _OPENBCM_DIAG_H 14 | #define _OPENBCM_DIAG_H 15 | 16 | /* 17 | * Shell routines: used for diagnostics shell. 18 | */ 19 | 20 | extern void diag_init(void); 21 | extern void cmdlist_init(void); 22 | extern void diag_rc_set(int unit, const char *fname); 23 | extern void diag_rc_get(int unit, const char **fname); 24 | extern int diag_rc_load(int unit); 25 | extern void diag_shell(void); 26 | 27 | extern int system_init(int unit); 28 | extern int system_shutdown(int unit, int cleanup); 29 | 30 | /* 31 | * Typedef: cmd_result_t 32 | * Purpose: Type retured from all commands indicating success, fail, 33 | * or print usage. 34 | */ 35 | typedef enum cmd_result_e { 36 | CMD_OK = 0, /* Command completed successfully */ 37 | CMD_FAIL = -1, /* Command failed */ 38 | CMD_USAGE= -2, /* Command failed, print usage */ 39 | CMD_NFND = -3, /* Command not found */ 40 | CMD_EXIT = -4, /* Exit current shell level */ 41 | CMD_INTR = -5, /* Command interrupted */ 42 | CMD_NOTIMPL = -6 /* Command not implemented */ 43 | } cmd_result_t; 44 | 45 | cmd_result_t sh_process(int unit, const char *, int eof); 46 | cmd_result_t sh_process_command(int unit, char *c); 47 | cmd_result_t sh_process_command_check(int unit, char *c); 48 | int sh_check_attached(const char *pfx, const int unit); 49 | 50 | #endif /* !_OPENBCM_DIAG_H */ 51 | -------------------------------------------------------------------------------- /include/bcm/bcmi2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_BCMI2C_H__ 13 | #define __BCM_BCMI2C_H__ 14 | 15 | #if defined(INCLUDE_I2C) 16 | 17 | #include 18 | 19 | #ifndef BCM_HIDE_DISPATCHABLE 20 | 21 | /* Open I2C device. */ 22 | extern int bcm_i2c_open( 23 | int unit, 24 | char *devname, 25 | uint32 flags, 26 | int speed); 27 | 28 | /* Write to I2C device. */ 29 | extern int bcm_i2c_write( 30 | int unit, 31 | int fd, 32 | uint32 addr, 33 | uint8 *data, 34 | uint32 nbytes); 35 | 36 | /* Read from I2C device. */ 37 | extern int bcm_i2c_read( 38 | int unit, 39 | int fd, 40 | uint32 addr, 41 | uint8 *data, 42 | uint32 *nbytes); 43 | 44 | /* Perform IOCTL access on I2C driver. */ 45 | extern int bcm_i2c_ioctl( 46 | int unit, 47 | int fd, 48 | int opcode, 49 | void *data, 50 | int len); 51 | 52 | #endif /* defined(INCLUDE_I2C) */ 53 | 54 | #endif /* BCM_HIDE_DISPATCHABLE */ 55 | 56 | #endif /* __BCM_BCMI2C_H__ */ 57 | -------------------------------------------------------------------------------- /include/bcm/custom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_CUSTOM_H__ 13 | #define __BCM_CUSTOM_H__ 14 | 15 | #include 16 | 17 | #if !defined(BCM_CUSTOM_ARGS_MAX) 18 | #define BCM_CUSTOM_ARGS_MAX 256 19 | #endif 20 | 21 | #define BCM_CUSTOM_SET 1 22 | #define BCM_CUSTOM_GET 2 23 | 24 | /* bcm_custom_cb_t */ 25 | typedef int (*bcm_custom_cb_t)( 26 | int unit, 27 | bcm_port_t port, 28 | int setget, 29 | int type, 30 | int length, 31 | uint32 *args, 32 | int *actual_length, 33 | void *user_data); 34 | 35 | #ifndef BCM_HIDE_DISPATCHABLE 36 | 37 | /* Register a custom callback function. */ 38 | extern int bcm_custom_register( 39 | int unit, 40 | bcm_custom_cb_t func, 41 | void *user_data); 42 | 43 | /* Register a custom callback function. */ 44 | extern int bcm_custom_unregister( 45 | int unit); 46 | 47 | /* Invoke a custom handler for a port */ 48 | extern int bcm_custom_port_set( 49 | int unit, 50 | bcm_port_t port, 51 | int type, 52 | int len, 53 | uint32 *args); 54 | 55 | /* Invoke a custom handler for a port. */ 56 | extern int bcm_custom_port_get( 57 | int unit, 58 | bcm_port_t port, 59 | int type, 60 | int max_len, 61 | uint32 *args, 62 | int *actual_len); 63 | 64 | #endif /* BCM_HIDE_DISPATCHABLE */ 65 | 66 | #endif /* __BCM_CUSTOM_H__ */ 67 | -------------------------------------------------------------------------------- /include/bcm/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | */ 7 | 8 | #ifndef __BCM_DEBUG_H__ 9 | #define __BCM_DEBUG_H__ 10 | 11 | #include 12 | 13 | #include 14 | 15 | #ifndef BCM_HIDE_DISPATCHABLE 16 | 17 | /* _bcm_debug_api */ 18 | extern void _bcm_debug_api( 19 | int log_src, 20 | char *api, 21 | int nargs, 22 | int ninargs, 23 | int arg1, 24 | int arg2, 25 | int arg3, 26 | int rv); 27 | 28 | #endif /* BCM_HIDE_DISP ATCHABLE */ 29 | 30 | #define BCM_CALL_DISPATCH(ret, f_api, args, n_args, args_by_ref) ret = f_api args 31 | 32 | #define BCM_API_SET_CONTEXT(file, line, Func) 33 | 34 | #if defined(BROADCOM_DEBUG) 35 | #define BCM_API(_1, _2, _3, _4, _5, _6, _7, _8) \ 36 | do { \ 37 | if (LOG_CHECK(_1 | BSL_VERBOSE)) \ 38 | _bcm_debug_api(_1,_2,_3,_4,_5,_6,_7,_8); \ 39 | } while (0) 40 | 41 | /* 42 | * BCM_API_VERBOSE_LOGGING enables capability to log API calls along with their 43 | * arguments using CINT infrastructure. 44 | */ 45 | #ifdef BCM_API_VERBOSE_LOGGING 46 | 47 | #include "src/appl/cint/cint_logger.h" 48 | 49 | #undef BCM_CALL_DISPATCH 50 | #define BCM_CALL_DISPATCH(ret, f_api, args, n_args, args_by_ref) \ 51 | CINT_LOGGER_CALL_DISPATCH(ret, f_api, args, n_args, args_by_ref) 52 | 53 | #undef BCM_API_SET_CONTEXT 54 | #define BCM_API_SET_CONTEXT(file, line, Func) \ 55 | CINT_LOGGER_SET_CALLER_CONTEXT(file, line, Func) 56 | 57 | #endif 58 | 59 | #else 60 | #define BCM_API(_1, _2, _3, _4, _5, _6, _7, _8) 61 | #endif 62 | 63 | #endif /* __BCM_DEBUG_H__ */ 64 | -------------------------------------------------------------------------------- /include/bcm/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_ERROR_H__ 13 | #define __BCM_ERROR_H__ 14 | 15 | #include 16 | 17 | /* 18 | * BCM API error codes. 19 | * 20 | * Note: An error code may be converted to a string by passing the code 21 | * to bcm_errmsg(). 22 | */ 23 | typedef enum bcm_error_e { 24 | BCM_E_NONE = _SHR_E_NONE, 25 | BCM_E_INTERNAL = _SHR_E_INTERNAL, 26 | BCM_E_MEMORY = _SHR_E_MEMORY, 27 | BCM_E_UNIT = _SHR_E_UNIT, 28 | BCM_E_PARAM = _SHR_E_PARAM, 29 | BCM_E_EMPTY = _SHR_E_EMPTY, 30 | BCM_E_FULL = _SHR_E_FULL, 31 | BCM_E_NOT_FOUND = _SHR_E_NOT_FOUND, 32 | BCM_E_EXISTS = _SHR_E_EXISTS, 33 | BCM_E_TIMEOUT = _SHR_E_TIMEOUT, 34 | BCM_E_BUSY = _SHR_E_BUSY, 35 | BCM_E_FAIL = _SHR_E_FAIL, 36 | BCM_E_DISABLED = _SHR_E_DISABLED, 37 | BCM_E_BADID = _SHR_E_BADID, 38 | BCM_E_RESOURCE = _SHR_E_RESOURCE, 39 | BCM_E_CONFIG = _SHR_E_CONFIG, 40 | BCM_E_UNAVAIL = _SHR_E_UNAVAIL, 41 | BCM_E_INIT = _SHR_E_INIT, 42 | BCM_E_PORT = _SHR_E_PORT, 43 | BCM_E_IO = _SHR_E_IO, 44 | BCM_E_ACCESS = _SHR_E_ACCESS, 45 | BCM_E_NO_HANDLER = _SHR_E_NO_HANDLER, 46 | BCM_E_PARTIAL = _SHR_E_PARTIAL 47 | } bcm_error_t; 48 | 49 | /* Switch event types */ 50 | typedef enum bcm_switch_event_e { 51 | BCM_SWITCH_EVENT_IO_ERROR = _SHR_SWITCH_EVENT_IO_ERROR, 52 | BCM_SWITCH_EVENT_PARITY_ERROR = _SHR_SWITCH_EVENT_PARITY_ERROR, 53 | BCM_SWITCH_EVENT_THREAD_ERROR = _SHR_SWITCH_EVENT_THREAD_ERROR, 54 | BCM_SWITCH_EVENT_ACCESS_ERROR = _SHR_SWITCH_EVENT_ACCESS_ERROR, 55 | BCM_SWITCH_EVENT_ASSERT_ERROR = _SHR_SWITCH_EVENT_ASSERT_ERROR, 56 | BCM_SWITCH_EVENT_MODID_CHANGE = _SHR_SWITCH_EVENT_MODID_CHANGE, 57 | BCM_SWITCH_EVENT_DOS_ATTACK = _SHR_SWITCH_EVENT_DOS_ATTACK, 58 | BCM_SWITCH_EVENT_STABLE_FULL = _SHR_SWITCH_EVENT_STABLE_FULL, 59 | BCM_SWITCH_EVENT_STABLE_ERROR = _SHR_SWITCH_EVENT_STABLE_ERROR, 60 | BCM_SWITCH_EVENT_UNCONTROLLED_SHUTDOWN = _SHR_SWITCH_EVENT_UNCONTROLLED_SHUTDOWN, 61 | BCM_SWITCH_EVENT_WARM_BOOT_DOWNGRADE = _SHR_SWITCH_EVENT_WARM_BOOT_DOWNGRADE, 62 | BCM_SWITCH_EVENT_TUNE_ERROR = _SHR_SWITCH_EVENT_TUNE_ERROR, 63 | BCM_SWITCH_EVENT_DEVICE_INTERRUPT = _SHR_SWITCH_EVENT_DEVICE_INTERRUPT, 64 | BCM_SWITCH_EVENT_ALARM = _SHR_SWITCH_EVENT_ALARM, 65 | BCM_SWITCH_EVENT_MMU_BST_TRIGGER = _SHR_SWITCH_EVENT_MMU_BST_TRIGGER, 66 | BCM_SWITCH_EVENT_EPON_ALARM = _SHR_SWITCH_EVENT_EPON_ALARM, 67 | BCM_SWITCH_EVENT_RUNT_DETECT = _SHR_SWITCH_EVENT_RUNT_DETECT, 68 | BCM_SWITCH_EVENT_AUTONEG_SPEED_ERROR = _SHR_SWITCH_EVENT_AUTONEG_SPEED_ERROR, 69 | BCM_SWITCH_EVENT_MMU_EBST_FIFO_FULL = _SHR_SWITCH_EVENT_MMU_EBST_FIFO_FULL, 70 | BCM_SWITCH_EVENT_COUNT = _SHR_SWITCH_EVENT_COUNT 71 | } bcm_switch_event_t; 72 | 73 | #define BCM_SUCCESS(rv) \ 74 | _SHR_E_SUCCESS(rv) 75 | 76 | #define BCM_FAILURE(rv) \ 77 | _SHR_E_FAILURE(rv) 78 | 79 | #define BCM_IF_ERROR_RETURN(op) \ 80 | _SHR_E_IF_ERROR_RETURN(op) 81 | 82 | #define BCM_IF_ERROR_NOT_UNAVAIL_RETURN(op) \ 83 | _SHR_E_IF_ERROR_NOT_UNAVAIL_RETURN(op) 84 | 85 | #define bcm_errmsg(rv) \ 86 | _SHR_ERRMSG(rv) 87 | 88 | #endif /* __BCM_ERROR_H__ */ 89 | -------------------------------------------------------------------------------- /include/bcm/int.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_INT_H__ 13 | #define __BCM_INT_H__ 14 | 15 | #include 16 | 17 | #if defined(INCLUDE_INT) 18 | /* INT Turnaround configuration information data. */ 19 | typedef struct bcm_int_turnaround_config_s { 20 | bcm_mac_t src_mac; 21 | } bcm_int_turnaround_config_t; 22 | #endif 23 | 24 | #if defined(INCLUDE_INT) 25 | /* INT Turnaround statistics information data. */ 26 | typedef struct bcm_int_turnaround_stat_s { 27 | uint64 rx_pkt_cnt; /* Number of packet recieved in FW. */ 28 | uint64 tx_pkt_cnt; /* Number of packet transmitted from FW. */ 29 | uint64 drop_pkt_cnt; /* Number of packet dropped in FW. */ 30 | uint64 int_init_config_drop; /* Number of pkt dropped due to missing 31 | configuration. */ 32 | uint64 int_hop_cnt_invalid_drop; /* Number of pkt dropped due to Hop 33 | count exceeded Hop limit. */ 34 | uint64 int_hdr_len_invalid_drop; /* Number of pkt dropped due to current 35 | length exceeded maximum length. */ 36 | uint64 int_pkt_size_invalid_drop; /* Number of pkt dropped due to invalid 37 | packet size. */ 38 | } bcm_int_turnaround_stat_t; 39 | #endif 40 | 41 | #ifndef BCM_HIDE_DISPATCHABLE 42 | 43 | #if defined(INCLUDE_INT) 44 | /* Initializes int subsystem. */ 45 | extern int bcm_int_init( 46 | int unit); 47 | #endif 48 | 49 | #if defined(INCLUDE_INT) 50 | /* Detaches int subsystem. */ 51 | extern int bcm_int_detach( 52 | int unit); 53 | #endif 54 | 55 | #endif /* BCM_HIDE_DISPATCHABLE */ 56 | 57 | #if defined(INCLUDE_INT) 58 | /* Initialize INT Turnaround configuration information structure. */ 59 | extern void bcm_int_turnaround_config_t_init( 60 | bcm_int_turnaround_config_t *config_info); 61 | #endif 62 | 63 | #ifndef BCM_HIDE_DISPATCHABLE 64 | 65 | #if defined(INCLUDE_INT) 66 | /* Set INT Turnaround - configuration information */ 67 | extern int bcm_int_turnaround_config_set( 68 | int unit, 69 | bcm_int_turnaround_config_t *config_data); 70 | #endif 71 | 72 | #if defined(INCLUDE_INT) 73 | /* Get INT Turnaround - configuration information */ 74 | extern int bcm_int_turnaround_config_get( 75 | int unit, 76 | bcm_int_turnaround_config_t *config_data); 77 | #endif 78 | 79 | #if defined(INCLUDE_INT) 80 | /* INT Turnaround - INT Turnaround statistics information */ 81 | extern int bcm_int_turnaround_stat_get( 82 | int unit, 83 | bcm_int_turnaround_stat_t *stat_data); 84 | #endif 85 | 86 | #endif /* BCM_HIDE_DISPATCHABLE */ 87 | 88 | #endif /* __BCM_INT_H__ */ 89 | -------------------------------------------------------------------------------- /include/bcm/stg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_STG_H__ 13 | #define __BCM_STG_H__ 14 | 15 | #include 16 | #include 17 | 18 | /* bcm_stg_stp_e */ 19 | typedef enum bcm_stg_stp_e { 20 | BCM_STG_STP_DISABLE = _SHR_PORT_STP_DISABLE, /* Disabled. */ 21 | BCM_STG_STP_BLOCK = _SHR_PORT_STP_BLOCK, /* BPDUs/no learns. */ 22 | BCM_STG_STP_LISTEN = _SHR_PORT_STP_LISTEN, /* BPDUs/no learns. */ 23 | BCM_STG_STP_LEARN = _SHR_PORT_STP_LEARN, /* BPDUs/learns. */ 24 | BCM_STG_STP_FORWARD = _SHR_PORT_STP_FORWARD, /* Normal operation. */ 25 | BCM_STG_STP_COUNT = _SHR_PORT_STP_COUNT 26 | } bcm_stg_stp_t; 27 | 28 | #ifndef BCM_HIDE_DISPATCHABLE 29 | 30 | /* 31 | * Initialize the Spanning Tree Group (STG) module to its initial 32 | * configuration. 33 | */ 34 | extern int bcm_stg_init( 35 | int unit); 36 | 37 | /* 38 | * Destroy all STGs and initialize the Spanning Tree Group (STG) module 39 | * to its initial configuration. 40 | */ 41 | extern int bcm_stg_clear( 42 | int unit); 43 | 44 | /* Designate the default STG ID for the chip. */ 45 | extern int bcm_stg_default_set( 46 | int unit, 47 | bcm_stg_t stg); 48 | 49 | /* Return the current default STG ID for the chip. */ 50 | extern int bcm_stg_default_get( 51 | int unit, 52 | bcm_stg_t *stg_ptr); 53 | 54 | /* Add a VLAN to a specified STG. */ 55 | extern int bcm_stg_vlan_add( 56 | int unit, 57 | bcm_stg_t stg, 58 | bcm_vlan_t vid); 59 | 60 | /* Remove a VLAN from a Spanning Tree Group. */ 61 | extern int bcm_stg_vlan_remove( 62 | int unit, 63 | bcm_stg_t stg, 64 | bcm_vlan_t vid); 65 | 66 | /* Remove all VLANs from a Spanning Tree Group. */ 67 | extern int bcm_stg_vlan_remove_all( 68 | int unit, 69 | bcm_stg_t stg); 70 | 71 | /* Generates a list of VLANs in a specified STG. */ 72 | extern int bcm_stg_vlan_list( 73 | int unit, 74 | bcm_stg_t stg, 75 | bcm_vlan_t **list, 76 | int *count); 77 | 78 | /* Destroy a list returned by \ref bcm_stg_vlan_list . */ 79 | extern int bcm_stg_vlan_list_destroy( 80 | int unit, 81 | bcm_vlan_t *list, 82 | int count); 83 | 84 | /* Create a new STG, using a new STG ID. */ 85 | extern int bcm_stg_create( 86 | int unit, 87 | bcm_stg_t *stg_ptr); 88 | 89 | /* Create a new STG, using a specific STG ID. */ 90 | extern int bcm_stg_create_id( 91 | int unit, 92 | bcm_stg_t stg); 93 | 94 | /* Destroys the specified STG. */ 95 | extern int bcm_stg_destroy( 96 | int unit, 97 | bcm_stg_t stg); 98 | 99 | /* Generates a list of IDs for currently defined STGs. */ 100 | extern int bcm_stg_list( 101 | int unit, 102 | bcm_stg_t **list, 103 | int *count); 104 | 105 | /* 106 | * Destroys a previously returned list of STG IDs; the STGs themselves 107 | * are not affected. 108 | */ 109 | extern int bcm_stg_list_destroy( 110 | int unit, 111 | bcm_stg_t *list, 112 | int count); 113 | 114 | /* 115 | * Set the Spanning Tree Protocol state of a port/VP in the specified 116 | * STG. 117 | * VP GROUP STP state need to be setted per direction, Please use \ref 118 | * bcm_vlan_gport_add for this. 119 | */ 120 | extern int bcm_stg_stp_set( 121 | int unit, 122 | bcm_stg_t stg, 123 | bcm_port_t port, 124 | int stp_state); 125 | 126 | /* 127 | * Return the Spanning Tree Protocol state of a port in the specified 128 | * STG. 129 | */ 130 | extern int bcm_stg_stp_get( 131 | int unit, 132 | bcm_stg_t stg, 133 | bcm_port_t port, 134 | int *stp_state); 135 | 136 | /* 137 | * Return the maximum number of STGs that the underlying hardware can 138 | * support 139 | */ 140 | extern int bcm_stg_count_get( 141 | int unit, 142 | int *max_stg); 143 | 144 | #endif /* BCM_HIDE_DISPATCHABLE */ 145 | 146 | #endif /* __BCM_STG_H__ */ 147 | -------------------------------------------------------------------------------- /include/bcm/sum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_SUM_H__ 13 | #define __BCM_SUM_H__ 14 | 15 | #include 16 | 17 | /* SUM counter types */ 18 | typedef enum bcm_sum_type_e { 19 | bcmSumTypeTxPktCnt = 0, /* SUM monitors Tx packet counters. */ 20 | bcmSumTypeRxPktCnt = 1, /* SUM monitors Rx packet counters. */ 21 | bcmSumTypeTxByteCnt = 2, /* SUM monitors Tx byte counters. */ 22 | bcmSumTypeRxByteCnt = 3, /* SUM monitors Rx byte counters. */ 23 | bcmSumTypeTxPktByteCnt = 4, /* SUM monitors Tx packet, Tx byte counters. */ 24 | bcmSumTypeRxPktByteCnt = 5, /* SUM monitors Rx packet, Rx byte counters. */ 25 | bcmSumTypeRxTxPktCnt = 6, /* SUM monitors Tx/Rx packet counters. */ 26 | bcmSumTypeRxTxByteCnt = 7, /* SUM monitors Tx/Rx byte counters. */ 27 | bcmSumTypeTxRxPktByteCnt = 8, /* SUM monitors all Tx packet, Tx byte, Rx 28 | packet, Rx byte counters. */ 29 | bcmSumTypeMax = 9 /* Maximum Counter Type. */ 30 | } bcm_sum_type_t; 31 | 32 | /* SUM stats information types */ 33 | typedef enum bcm_sum_stat_type_e { 34 | bcmSumPeakUsageInfo = 0, /* SUM Peak usage information. */ 35 | bcmSumMinimumUsageInfo = 1, /* SUM Minimum usage information. */ 36 | bcmSumUsageInfo = 2 /* SUM user requested number, of usage history. */ 37 | } bcm_sum_stat_type_t; 38 | 39 | /* SUM Configuration information. */ 40 | typedef struct bcm_sum_config_s { 41 | uint32 usec_sample_interval; /* sample data interval */ 42 | uint32 max_history; /* maximum samples number of history */ 43 | bcm_sum_type_t sum_type; /* sum type */ 44 | } bcm_sum_config_t; 45 | 46 | /* SUM stats data. */ 47 | typedef struct bcm_sum_stat_info_s { 48 | uint64 sequence_num; /* This is running global number update for 49 | every entry for unique identification. */ 50 | uint64 time_stamp; /* Sample time stamp. */ 51 | uint64 tx_pkt_count; /* Tx packet count. */ 52 | uint64 rx_pkt_count; /* Rx packet count. */ 53 | uint64 tx_byte_count; /* Tx byte count. */ 54 | uint64 rx_byte_count; /* Rx byte count. */ 55 | bcm_sum_type_t sum_type; /* sum type */ 56 | } bcm_sum_stat_info_t; 57 | 58 | #ifndef BCM_HIDE_DISPATCHABLE 59 | 60 | /* Initializes sum subsystem. */ 61 | extern int bcm_sum_init( 62 | int unit); 63 | 64 | /* Detaches sum subsystem. */ 65 | extern int bcm_sum_detach( 66 | int unit); 67 | 68 | #endif /* BCM_HIDE_DISPATCHABLE */ 69 | 70 | /* Initialize a config information structure. */ 71 | extern void bcm_sum_config_t_init( 72 | bcm_sum_config_t *config_data); 73 | 74 | /* Initialize SUM usage stats information structure */ 75 | extern void bcm_sum_stat_info_t_init( 76 | bcm_sum_stat_info_t *stat_data); 77 | 78 | #ifndef BCM_HIDE_DISPATCHABLE 79 | 80 | /* Set a Switch Utilization Monitor configuration information. */ 81 | extern int bcm_sum_config_set( 82 | int unit, 83 | bcm_sum_config_t *config_data, 84 | bcm_pbmp_t pbmp); 85 | 86 | /* Get a Switch Utilization Monitor Configuration information. */ 87 | extern int bcm_sum_config_get( 88 | int unit, 89 | bcm_sum_config_t *config_data, 90 | bcm_pbmp_t *pbmp); 91 | 92 | /* Get a Switch Utilization Monitor Statics information. */ 93 | extern int bcm_sum_stat_get( 94 | int unit, 95 | uint32 max_samples, 96 | bcm_sum_stat_info_t *stats_data, 97 | uint32 *num_samples, 98 | bcm_sum_stat_type_t stat_type, 99 | uint32 usec_sample_period); 100 | 101 | #endif /* BCM_HIDE_DISPATCHABLE */ 102 | 103 | #endif /* __BCM_SUM_H__ */ 104 | -------------------------------------------------------------------------------- /include/bcm/topo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_TOPO_H__ 13 | #define __BCM_TOPO_H__ 14 | 15 | #include 16 | 17 | /* Topology mapping lookup function prototype. */ 18 | typedef int (*bcm_topo_map_f)( 19 | int unit, 20 | int dest_modid, 21 | bcm_port_t *exit_port); 22 | 23 | /* Set or Get Topology mapping lookup function. */ 24 | extern int bcm_topo_map_get( 25 | bcm_topo_map_f *_map); 26 | 27 | /* Set or Get Topology mapping lookup function. */ 28 | extern int bcm_topo_map_set( 29 | bcm_topo_map_f _map); 30 | 31 | #ifndef BCM_HIDE_DISPATCHABLE 32 | 33 | /* Lookup a path to a destination module. */ 34 | extern int bcm_topo_port_get( 35 | int unit, 36 | int dest_modid, 37 | bcm_port_t *exit_port); 38 | 39 | #endif /* BCM_HIDE_DISPATCHABLE */ 40 | 41 | #endif /* __BCM_TOPO_H__ */ 42 | -------------------------------------------------------------------------------- /include/bcm/tx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This software is governed by the Broadcom Switch APIs license. 3 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 4 | * 5 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | * 7 | * DO NOT EDIT THIS FILE! 8 | * This file is auto-generated. 9 | * Edits to this file will be lost when it is regenerated. 10 | */ 11 | 12 | #ifndef __BCM_TX_H__ 13 | #define __BCM_TX_H__ 14 | 15 | #include 16 | 17 | /* Setup a packet for default transmit on the given unit. */ 18 | typedef int (*bcm_tx_pkt_setup_f)( 19 | int unit, 20 | bcm_pkt_t *tx_pkt); 21 | 22 | /* Function prototype to send out a packet. */ 23 | typedef int (*bcm_tx_f)( 24 | int unit, 25 | bcm_pkt_t *tx_pkt, 26 | void *cookie); 27 | 28 | /* Function prototype to send out an array of packets. */ 29 | typedef int (*bcm_tx_array_f)( 30 | int unit, 31 | bcm_pkt_t **pkt_array, 32 | int count, 33 | bcm_pkt_cb_f all_done_cb, 34 | void *cookie); 35 | 36 | /* Function prototype to send out a list of packets. */ 37 | typedef int (*bcm_tx_list_f)( 38 | int unit, 39 | bcm_pkt_t *pkt_list, 40 | bcm_pkt_cb_f all_done_cb, 41 | void *cookie); 42 | 43 | #ifndef BCM_HIDE_DISPATCHABLE 44 | 45 | /* Initialize the BCM TX software module. */ 46 | extern int bcm_tx_init( 47 | int unit); 48 | 49 | /* Transmit one or more packets. */ 50 | extern int bcm_tx( 51 | int unit, 52 | bcm_pkt_t *tx_pkt, 53 | void *cookie); 54 | 55 | /* Transmit one or more packets. */ 56 | extern int bcm_tx_array( 57 | int unit, 58 | bcm_pkt_t **pkt, 59 | int count, 60 | bcm_pkt_cb_f all_done_cb, 61 | void *cookie); 62 | 63 | /* Transmit one or more packets. */ 64 | extern int bcm_tx_list( 65 | int unit, 66 | bcm_pkt_t *pkt, 67 | bcm_pkt_cb_f all_done_cb, 68 | void *cookie); 69 | 70 | /* Set up a packet for transmit. */ 71 | extern int bcm_tx_pkt_setup( 72 | int unit, 73 | bcm_pkt_t *tx_pkt); 74 | 75 | #endif /* BCM_HIDE_DISPATCHABLE */ 76 | 77 | /* 78 | * TX Tunneling: 79 | * 80 | * This is the prototype to forward a packet to a remote CPU for transmit 81 | * on a remote device. A function of this type may be registered with BCM 82 | * TX to allow automatic forwarding to remote unit numbers. 83 | */ 84 | #if defined(BCM_RPC_SUPPORT) 85 | typedef int (*bcm_tx_cpu_tunnel_f)( 86 | bcm_pkt_t *pkt, 87 | int dest_unit, 88 | int remote_port, 89 | uint32 flags, 90 | bcm_cpu_tunnel_mode_t mode); 91 | #endif 92 | 93 | #if defined(BCM_RPC_SUPPORT) 94 | /* Encapsulate and forward a packet to a different CPU. */ 95 | extern int bcm_tx_cpu_tunnel_get( 96 | bcm_tx_cpu_tunnel_f *f); 97 | #endif 98 | 99 | #if defined(BCM_RPC_SUPPORT) 100 | /* Encapsulate and forward a packet to a different CPU. */ 101 | extern int bcm_tx_cpu_tunnel_set( 102 | bcm_tx_cpu_tunnel_f f); 103 | #endif 104 | 105 | #if defined(BCM_RPC_SUPPORT) 106 | /* Encapsulate and forward a packet to a different CPU. */ 107 | extern int bcm_tx_cpu_tunnel( 108 | bcm_pkt_t *pkt, 109 | int dest_unit, 110 | int remote_port, 111 | uint32 flags, 112 | bcm_cpu_tunnel_mode_t mode); 113 | #endif 114 | 115 | #if defined(BCM_RPC_SUPPORT) 116 | /* DEPRECATED: bcm_tx_tunnel. Use bcm_tx_cpu_tunnel */ 117 | #define bcm_tx_tunnel bcm_tx_cpu_tunnel 118 | #endif 119 | 120 | #ifndef BCM_HIDE_DISPATCHABLE 121 | 122 | #if defined(BROADCOM_DEBUG) 123 | /* bcm_tx_dv_dump */ 124 | extern int bcm_tx_dv_dump( 125 | int unit, 126 | void *dv_p); 127 | #endif 128 | 129 | #if defined(BROADCOM_DEBUG) 130 | /* bcm_tx_show */ 131 | extern int bcm_tx_show( 132 | int unit); 133 | #endif 134 | 135 | #endif /* BCM_HIDE_DISPATCHABLE */ 136 | 137 | #endif /* __BCM_TX_H__ */ 138 | -------------------------------------------------------------------------------- /include/bsl_custom_enum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * Define customized BSL enumerations. 9 | */ 10 | 11 | #ifndef __BSL_CUSTOM_ENUM_H__ 12 | #define __BSL_CUSTOM_ENUM_H__ 13 | 14 | #ifdef BSL_HYBRID 15 | #include 16 | #endif 17 | 18 | 19 | #endif /* __BSL_CUSTOM_ENUM_H__ */ 20 | -------------------------------------------------------------------------------- /include/sal/appl/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: config.h 9 | * Purpose: SAL Configuration file definitions 10 | */ 11 | 12 | #ifndef _SAL_CONFIG_H 13 | #define _SAL_CONFIG_H 14 | 15 | #if defined(UNIX) || defined(__ECOS) 16 | # ifndef SAL_CONFIG_FILE 17 | # define SAL_CONFIG_FILE "config.bcm" 18 | # endif 19 | # ifndef SAL_CONFIG_TEMP 20 | # define SAL_CONFIG_TEMP "config.tmp" 21 | # endif 22 | #else 23 | # ifndef SAL_CONFIG_FILE 24 | # define SAL_CONFIG_FILE "config.bcm" 25 | # ifndef SAL_CONFIG_FILE_FLASH 26 | # define SAL_CONFIG_FILE_FLASH "flash:config.bcm" 27 | # endif 28 | # endif 29 | # ifndef SAL_CONFIG_TEMP 30 | # define SAL_CONFIG_TEMP "config.tmp" 31 | # ifndef SAL_CONFIG_TEMP_FLASH 32 | # define SAL_CONFIG_TEMP_FLASH "flash:config.tmp" 33 | # endif 34 | # endif 35 | #endif 36 | 37 | #define SAL_CONFIG_STR_MAX 256 /* Max len of "NAME=VALUE\0" */ 38 | 39 | /* 40 | * Defines: SAL_CONFIG_XXX 41 | * 42 | * SWITCH_MAC Mac address used for management interface 43 | * SWITCH_IP IP address used for management interface 44 | * ASSIGNED_MAC_BASE Base of MAC address range assigned to switch 45 | * (excluding SWITCH_MAC). 46 | * ASSIGNED_MAC_COUNT # of MAC addresses assigned to switch 47 | * (excluding SWITCH_MAC). 48 | */ 49 | 50 | #define SAL_CONFIG_SWITCH_MAC "station_mac_address" 51 | #define SAL_CONFIG_SWITCH_IP "station_ip_address" 52 | #define SAL_CONFIG_SWITCH_IP_NETMASK "station_ip_netmask" 53 | #define SAL_CONFIG_SWITCH_HOSTNAME "station_hostname" 54 | #define SAL_CONFIG_ASSIGNED_MAC_BASE "switch_mac_base" 55 | #define SAL_CONFIG_ASSIGNED_MAC_COUNT "switch_mac_count" 56 | 57 | #define SAL_CONFIG_RELOAD_BUFFER_SIZE "reload_buffer_size" 58 | #define SAL_CONFIG_RELOAD_FILE_NAME "reload_file_name" 59 | 60 | #include 61 | 62 | typedef uint16 sc_hash_t; 63 | 64 | extern int sal_config_refresh(void); 65 | extern int sal_config_file_set(const char *fname, const char *tname); 66 | extern int sal_config_file_get(const char **fname, const char **tname); 67 | extern int sal_config_flush(void); 68 | extern int sal_config_save(char *file, char *pattern, int append); 69 | extern char *sal_config_get(const char *name); 70 | extern int sal_config_get_next(char **name, char **value); 71 | extern int sal_config_set(char *name, char *value); 72 | extern void sal_config_show(void); 73 | extern void sal_config_dump(void); 74 | extern int sal_config_init(void); 75 | extern int sal_config_file_process(char *fname,int *nof_imported_config_files, char *already_imported_tables[], char *dirname, int override_duplicates); 76 | #ifdef BCM_SHARED_LIB_SDK 77 | extern int sal_config_refresh_fileless(void); 78 | extern int sal_config_set_full_info(char *name, char *value, uint16 flag, uint16 line, sc_hash_t sc_hash); 79 | #endif /* BCM_SHARED_LIB_SDK */ 80 | 81 | /* Declaration for compiled-in config variables. These are generated 82 | * automatically from config.bcm by $SDK/make/bcm2c.pl. 83 | */ 84 | extern void sal_config_init_defaults(void); 85 | 86 | #endif /* !_SAL_CONFIG_H */ 87 | -------------------------------------------------------------------------------- /include/sal/appl/sal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: sal.h 9 | * Purpose: SAL Support definitions 10 | */ 11 | 12 | #ifndef _SAL_H 13 | #define _SAL_H 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | /* 20 | * Include the system types so that things like uint32_t are always 21 | * available and consistent. 22 | */ 23 | #ifdef __KERNEL__ 24 | #include 25 | #else 26 | #include 27 | #include 28 | #include 29 | #endif 30 | 31 | #if defined(UNIX) && !defined(__STRICT_ANSI__) && !defined(USE_CUSTOM_STR_UTILS) 32 | #define sal_strncasecmp strncasecmp 33 | #define sal_strcasecmp strcasecmp 34 | #else 35 | extern int sal_strncasecmp(const char *s1, const char *s2, size_t n); 36 | extern int sal_strcasecmp(const char *s1, const char *s2); 37 | #endif 38 | 39 | extern char *sal_strcasestr(const char *haystack, const char *needle); 40 | 41 | 42 | /* 43 | * SAL Initialization 44 | */ 45 | 46 | int sal_appl_init(void); 47 | /* 48 | * Console Initialization 49 | */ 50 | void sal_readline_init(void); 51 | void sal_readline_term(void); 52 | 53 | /* 54 | * SAL Date Routines 55 | */ 56 | 57 | int sal_date_set(sal_time_t *val); 58 | int sal_date_get(sal_time_t *val); 59 | 60 | /* 61 | * SAL Booting/Rebooting routines. 62 | */ 63 | 64 | void sal_reboot(void); 65 | 66 | /* 67 | * SAL Shell routine - to escape to shell on whatever platform. 68 | */ 69 | 70 | void sal_shell(void); 71 | 72 | /* 73 | * SAL Shell Command routine - to execute shell command on whatever platform. 74 | */ 75 | 76 | void sal_shell_cmd(const char *cmd); 77 | 78 | /* 79 | * LED Support, platform specific routine to set led value. 80 | * sal_led: sets the state of one or more discrete LEDs; bit 0 is first LED 81 | * sal_led_string: sets the state of an alphanumeric display, if any. 82 | */ 83 | 84 | extern uint32 sal_led(uint32 led); 85 | extern void sal_led_string(const char *s); 86 | 87 | /* 88 | * Watchdog timer, platform specific 89 | */ 90 | 91 | extern int sal_watchdog_arm(uint32 usec); 92 | 93 | /* 94 | * Memory Testing 95 | */ 96 | 97 | extern int sal_memory_check(uint32 addr); 98 | 99 | #ifdef BROADCOM_DEBUG 100 | #ifdef INCLUDE_BCM_SAL_PROFILE 101 | extern void sal_dma_alloc_resource_usage_get(unsigned int *alloc_curr, 102 | unsigned int *alloc_max); 103 | #endif 104 | #endif 105 | 106 | /* 107 | * Compatibility macros 108 | */ 109 | 110 | #ifdef __KERNEL__ 111 | #include 112 | #define strtol simple_strtol 113 | #define strtoul simple_strtoul 114 | #endif 115 | 116 | /* 117 | * Some time functions only available on UNIX 118 | * For now other systems just won't use these. 119 | */ 120 | #if defined(UNIX) 121 | #define sal_mktime mktime 122 | #define sal_localtime localtime 123 | #define sal_strftime strftime 124 | #endif 125 | 126 | #endif /* !_SAL_H */ 127 | 128 | -------------------------------------------------------------------------------- /include/sal/core/boot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: boot.h 9 | * Purpose: Boot definitions 10 | */ 11 | 12 | #ifndef _SAL_BOOT_H 13 | #define _SAL_BOOT_H 14 | 15 | #include 16 | 17 | /* 18 | * Boot flags. 19 | */ 20 | 21 | #define BOOT_F_NO_RC 0x1000 22 | #define BOOT_F_NO_PROBE 0x2000 23 | #define BOOT_F_NO_ATTACH 0x4000 24 | #define BOOT_F_SHELL_ON_TRAP 0x8000 /* TTY trap char: no reboot; shell */ 25 | #define BOOT_F_QUICKTURN 0x10000 26 | #define BOOT_F_PLISIM 0x20000 27 | #define BOOT_F_RTLSIM 0x80000 28 | #define BOOT_F_RELOAD 0x100000 29 | #define BOOT_F_WARM_BOOT 0x200000 30 | #define BOOT_F_BCMSIM 0x400000 31 | #define BOOT_F_XGSSIM 0x800000 32 | #define BOOT_F_NO_INTERRUPTS 0x1000000 33 | #define BOOT_F_FAST_REBOOT 0x2000000 34 | #define BOOT_F_I2C_ACCESS 0x4000000 35 | 36 | extern uint32 sal_boot_flags_get(void); 37 | extern void sal_boot_flags_set(uint32); 38 | extern char *sal_boot_script(void); 39 | 40 | #define sal_boot_flags sal_boot_flags_get /* Deprecated */ 41 | 42 | #define SAL_BOOT_SIMULATION \ 43 | (sal_boot_flags_get() & (BOOT_F_BCMSIM|BOOT_F_QUICKTURN|BOOT_F_PLISIM|BOOT_F_RTLSIM|BOOT_F_XGSSIM)) 44 | #define SAL_BOOT_QUICKTURN \ 45 | (sal_boot_flags_get() & BOOT_F_QUICKTURN) 46 | #define SAL_BOOT_PLISIM \ 47 | (sal_boot_flags_get() & (BOOT_F_PLISIM|BOOT_F_RTLSIM)) 48 | #define SAL_BOOT_RTLSIM \ 49 | (sal_boot_flags_get() & BOOT_F_RTLSIM) 50 | #define SAL_BOOT_BCMSIM \ 51 | (sal_boot_flags_get() & BOOT_F_BCMSIM) 52 | #define SAL_BOOT_XGSSIM \ 53 | (sal_boot_flags_get() & BOOT_F_XGSSIM) 54 | 55 | #define SAL_BOOT_NO_INTERRUPTS \ 56 | (sal_boot_flags_get() & BOOT_F_NO_INTERRUPTS) 57 | 58 | #define SAL_BOOT_I2C_ACCESS \ 59 | (sal_boot_flags_get() & BOOT_F_I2C_ACCESS) 60 | 61 | /* 62 | * Assertion Handling 63 | */ 64 | 65 | typedef void (*sal_assert_func_t) 66 | (const char* expr, const char* file, int line); 67 | 68 | extern void sal_assert_set(sal_assert_func_t f); 69 | extern void _default_assert(const char *expr, const char *file, int line); 70 | 71 | 72 | /* 73 | * Init 74 | */ 75 | extern int sal_core_init(void); 76 | 77 | 78 | /* 79 | * Returns a string describing the current Operating System 80 | */ 81 | extern const char* sal_os_name(void); 82 | 83 | 84 | #endif /* !_SAL_BOOT_H */ 85 | 86 | 87 | -------------------------------------------------------------------------------- /include/sal/core/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: time.h 9 | * Purpose: SAL time definitions 10 | * 11 | * Microsecond Time Routines 12 | * 13 | * The main clock abstraction is sal_usecs_t, an unsigned 32-bit 14 | * counter that increments every microsecond and wraps around every 15 | * 4294.967296 seconds (~71.5 minutes) 16 | */ 17 | 18 | #ifndef _SAL_TIME_H 19 | #define _SAL_TIME_H 20 | 21 | #include 22 | 23 | /* 24 | * Constants 25 | */ 26 | 27 | #define MILLISECOND_USEC (1000) 28 | #define SECOND_USEC (1000000) 29 | #define MINUTE_USEC (60 * SECOND_USEC) 30 | #define HOUR_USEC (60 * MINUTE_USEC) 31 | 32 | #define SECOND_MSEC (1000) 33 | #define MINUTE_MSEC (60 * SECOND_MSEC) 34 | 35 | #define SAL_USECS_TIMESTAMP_ROLLOVER ((uint32)(0xFFFFFFFF)) 36 | 37 | typedef unsigned long sal_time_t; 38 | typedef uint32 sal_usecs_t; 39 | 40 | void sal_time_usecs_register(sal_usecs_t (*f)(void)); 41 | void sal_time_register(sal_time_t (*f)(void)); 42 | 43 | /* Relative time in microseconds modulo 2^32 */ 44 | extern sal_usecs_t sal_time_usecs(void); 45 | 46 | /* Absolute time in seconds ala Unix time, interrupt-safe */ 47 | extern sal_time_t sal_time(void); 48 | 49 | #ifdef COMPILER_HAS_DOUBLE 50 | 51 | void sal_time_double_register(double (*f)(void)); 52 | 53 | /* 54 | * Time since boot in seconds as a double precision value, useful for 55 | * benchmarking. Precision is platform-dependent and may be limited to 56 | * scheduler clock period. On a Mousse it uses the timebase and has a 57 | * precision of 80 ns (0.00000008). 58 | */ 59 | extern double sal_time_double(void); 60 | #define SAL_TIME_DOUBLE() sal_time_double() 61 | 62 | #else /* COMPILER_HAS_DOUBLE */ 63 | #define SAL_TIME_DOUBLE() sal_time() 64 | #endif 65 | 66 | 67 | /* 68 | * SAL_USECS_SUB 69 | * 70 | * Subtracts two sal_usecs_t and returns signed integer microseconds. 71 | * Can be used as a comparison because it returns: 72 | * 73 | * integer < 0 if A < B 74 | * integer > 0 if A > B 75 | * integer = 0 if A == B 76 | * 77 | * SAL_USECS_ADD 78 | * 79 | * Adds usec to time. Wrap-around is OK as long as the total 80 | * amount added is less than 0x7fffffff. 81 | */ 82 | 83 | #define SAL_USECS_SUB(_t2, _t1) (((int) ((_t2) - (_t1)))) 84 | #define SAL_USECS_ADD(_t, _us) ((_t) + (_us)) 85 | 86 | #endif /* !_SAL_TIME_H */ 87 | -------------------------------------------------------------------------------- /include/shared/bfd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: bfd.h 9 | * Purpose: Defines common BFD parameters. 10 | */ 11 | 12 | #ifndef _SHR_BFD_H_ 13 | #define _SHR_BFD_H_ 14 | 15 | 16 | /* BFD Session States */ 17 | typedef enum _shr_bfd_session_state_e { 18 | _SHR_BFD_SESSION_STATE_ADMIN_DOWN = 0, 19 | _SHR_BFD_SESSION_STATE_DOWN = 1, 20 | _SHR_BFD_SESSION_STATE_INIT = 2, 21 | _SHR_BFD_SESSION_STATE_UP = 3, 22 | _SHR_BFD_SESSION_STATE_COUNT = 4/* MUST BE LAST */ 23 | } _shr_bfd_session_state_t; 24 | 25 | 26 | /* BFD Diagnostic Codes */ 27 | typedef enum _shr_bfd_diag_code_e { 28 | _SHR_BFD_DIAG_CODE_NONE = 0, 29 | _SHR_BFD_DIAG_CODE_CTRL_DETECT_TIME_EXPIRED = 1, 30 | _SHR_BFD_DIAG_CODE_ECHO_FAILED = 2, 31 | _SHR_BFD_DIAG_CODE_NEIGHBOR_SIGNALED_SESSION_DOWN = 3, 32 | _SHR_BFD_DIAG_CODE_FORWARDING_PLANE_RESET = 4, 33 | _SHR_BFD_DIAG_CODE_PATH_DOWN = 5, 34 | _SHR_BFD_DIAG_CODE_CONCATENATED_PATH_DOWN = 6, 35 | _SHR_BFD_DIAG_CODE_ADMIN_DOWN = 7, 36 | _SHR_BFD_DIAG_CODE_REVERSE_CONCATENATED_PATH_DOWN = 8, 37 | _SHR_BFD_DIAG_CODE_MIS_CONNECTIVITY_DEFECT = 9, 38 | _SHR_BFD_DIAG_CODE_COUNT = 10/* MUST BE LAST */ 39 | } _shr_bfd_diag_code_t; 40 | 41 | 42 | /* BFD Authentication Types */ 43 | typedef enum _shr_bfd_auth_type_e { 44 | _SHR_BFD_AUTH_TYPE_NONE = 0, 45 | _SHR_BFD_AUTH_TYPE_SIMPLE_PASSWORD = 1, 46 | _SHR_BFD_AUTH_TYPE_KEYED_MD5 = 2, 47 | _SHR_BFD_AUTH_TYPE_METICULOUS_KEYED_MD5 = 3, 48 | _SHR_BFD_AUTH_TYPE_KEYED_SHA1 = 4, 49 | _SHR_BFD_AUTH_TYPE_METICULOUS_KEYED_SHA1 = 5, 50 | _SHR_BFD_AUTH_TYPE_COUNT = 6/* MUST BE LAST */ 51 | } _shr_bfd_auth_type_t; 52 | 53 | 54 | /* SHA1 Authentication key length */ 55 | #define _SHR_BFD_AUTH_SHA1_KEY_LENGTH 20 56 | 57 | /* Simple Password Authentication key length */ 58 | #define _SHR_BFD_AUTH_SIMPLE_PASSWORD_KEY_LENGTH 16 59 | 60 | /* MPLS-TP CV Source MEP-ID TLV length */ 61 | #define _SHR_BFD_ENDPOINT_MAX_MEP_ID_LENGTH 32 62 | 63 | 64 | #endif /* _SHR_BFD_H_ */ 65 | -------------------------------------------------------------------------------- /include/shared/bslext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * Broadcom System Log (BSL) 9 | * 10 | * BSL functions for EXTERNAL (application) usage. 11 | */ 12 | 13 | #ifndef _SHR_BSLEXT_H_ 14 | #define _SHR_BSLEXT_H_ 15 | 16 | #include 17 | 18 | extern void 19 | bsl_config_t_init(bsl_config_t *config); 20 | 21 | extern int 22 | bsl_init(bsl_config_t *config); 23 | 24 | #endif /* _SHR_BSLEXT_H_ */ 25 | 26 | -------------------------------------------------------------------------------- /include/shared/bslnames.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * Broadcom System Log (BSL) 9 | * 10 | * BSL globals for EXTERNAL (application) usage. 11 | */ 12 | 13 | #ifndef _SHR_BSLNAMES_H_ 14 | #define _SHR_BSLNAMES_H_ 15 | 16 | #include 17 | 18 | extern const char * 19 | bsl_layer2str(bsl_layer_t layer); 20 | 21 | extern const char * 22 | bsl_source2str(bsl_source_t source); 23 | 24 | extern const char * 25 | bsl_severity2str(bsl_severity_t severity); 26 | 27 | #endif /* _SHR_BSLNAMES_H_ */ 28 | -------------------------------------------------------------------------------- /include/shared/bsltypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * Broadcom System Log (bSL) 9 | * 10 | * BSL data types and macros 11 | */ 12 | 13 | #ifndef _SHR_BSLTYPES_H_ 14 | #define _SHR_BSLTYPES_H_ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | typedef uint32 bsl_packed_meta_t; 21 | 22 | #define BSL_META_OPT_START 0x1 23 | #define BSL_META_OPT_END 0x2 24 | #define BSL_META_OPT_PFX_NL 0x4 25 | 26 | /* Meta data to accompany each log message */ 27 | typedef struct bsl_meta_s { 28 | uint32 options; 29 | const char *func; 30 | const char *file; 31 | int line; 32 | bsl_layer_t layer; 33 | bsl_source_t source; 34 | bsl_severity_t severity; 35 | int unit; 36 | int port; 37 | int xtra; /* Additonal data such as COS queue */ 38 | } bsl_meta_t; 39 | 40 | #define BSL_UNIT_UNKNOWN (-1) 41 | 42 | typedef int (*bsl_out_hook_f)(bsl_meta_t *, const char *fmt, va_list); 43 | typedef int (*bsl_check_hook_f)(bsl_packed_meta_t); 44 | 45 | typedef struct bsl_config_s { 46 | bsl_out_hook_f out_hook; 47 | bsl_check_hook_f check_hook; 48 | } bsl_config_t; 49 | 50 | #endif /* _SHR_BSLTYPES_H_ */ 51 | 52 | -------------------------------------------------------------------------------- /include/shared/field.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This file defines FIELD constants 9 | * 10 | * Its contents are not used directly by applications; it is used only 11 | * by header files of parent APIs which need to share FIELD constants. 12 | */ 13 | 14 | #ifndef _SHR_FIELD_H 15 | #define _SHR_FIELD_H 16 | 17 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_INDEX_SHIFT 0 18 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_INDEX_MASK 0x1FFFFF 19 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_GROUP_SHIFT 21 20 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_GROUP_MASK 0x7F 21 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_FLAG_SHIFT 28 22 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_FLAG_MASK 0xF0000000 23 | /* 24 | * FIELD macros for large direct lookup entry 25 | * The format of large direct lookup entry is: 26 | * {4'b0001, _group_id[6:0], _index[20:0]} 27 | */ 28 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_ID_PACK(_entry_id, _group_id, _index) \ 29 | ((_entry_id) = (BCM_FIELD_ENTRY_LARGE_DIRECT_LOOKUP &_SHR_FIELD_LARGE_DIRECT_ENTRY_FLAG_MASK) | \ 30 | (((_group_id) & _SHR_FIELD_LARGE_DIRECT_ENTRY_GROUP_MASK) << _SHR_FIELD_LARGE_DIRECT_ENTRY_GROUP_SHIFT) | \ 31 | (((_index) & _SHR_FIELD_LARGE_DIRECT_ENTRY_INDEX_MASK) << _SHR_FIELD_LARGE_DIRECT_ENTRY_INDEX_SHIFT)) 32 | 33 | #define _SHR_FIELD_LARGE_DIRECT_ENTRY_ID_UNPACK(_entry_id, _group_id, _index) \ 34 | (_group_id) = (((_entry_id) >> _SHR_FIELD_LARGE_DIRECT_ENTRY_GROUP_SHIFT) & _SHR_FIELD_LARGE_DIRECT_ENTRY_GROUP_MASK); \ 35 | (_index) = (((_entry_id) >> _SHR_FIELD_LARGE_DIRECT_ENTRY_INDEX_SHIFT) & _SHR_FIELD_LARGE_DIRECT_ENTRY_INDEX_MASK); 36 | 37 | #endif /* !_SHR_FIELD_H */ 38 | -------------------------------------------------------------------------------- /include/shared/l3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This file defines L3 constants 9 | * 10 | * Its contents are not used directly by applications; it is used only 11 | * by header files of parent APIs which need to share L3 constants. 12 | */ 13 | 14 | #ifndef _SHR_L3_H 15 | #define _SHR_L3_H 16 | 17 | /* 18 | * Reserved VRF values 19 | */ 20 | #define _SHR_L3_VRF_OVERRIDE (-1) /* Matches before vrf specific entries.*/ 21 | #define _SHR_L3_VRF_GLOBAL (-2) /* Matches after vrf specific entries. */ 22 | #define _SHR_L3_VRF_INVALID (-3) /* Invalid VRF ID. */ 23 | #define _SHR_L3_VRF_DEFAULT (0) /* Default vrf id. */ 24 | 25 | #define _SHR_L3_IP6_ADDRLEN (16) /* IPv6 address length in bytes. */ 26 | #define _SHR_L3_IP6_ADDR_WORD_LEN (4) /* IPv6 address length in bytes. */ 27 | #define _SHR_L3_IP6_MAX_NETLEN ((_SHR_L3_IP6_ADDRLEN) * (8)) 28 | #define _SHR_L3_IP_ADDRLEN (4) /* IPv4 address length in bytes. */ 29 | #define _SHR_L3_IP_MAX_NETLEN ((_SHR_L3_IP_ADDRLEN) * (8)) 30 | #define _SHR_L3_EGRESS_IDX_MIN (0x186A0) /* Egress object start index */ 31 | 32 | typedef uint32 _shr_ip_addr_t; /* IP Address */ 33 | typedef uint8 _shr_ip6_addr_t[_SHR_L3_IP6_ADDRLEN]; /* IPv6 Address */ 34 | 35 | extern int _shr_ip6_mask_create(uint8 *ip6, int len); 36 | extern int _shr_ip6_mask_length(uint8 *mask); 37 | extern uint32 _shr_ip_mask_create(int len); 38 | extern int _shr_ip_mask_length(uint32 mask); 39 | extern int _shr_ip6_addr_compare(uint8 *addr1, uint8 *addr2); 40 | 41 | #endif /* !_SHR_L3_H */ 42 | -------------------------------------------------------------------------------- /include/shared/mpls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This file defines MPLS constants 9 | * 10 | * Its contents are not used directly by applications; it is used only 11 | * by header files of parent APIs which need to share MPLS constants. 12 | */ 13 | 14 | #ifndef _SHR_MPLS_H 15 | #define _SHR_MPLS_H 16 | 17 | #define _SHR_MPLS_INDEXED_LABEL_INDEX_SHIFT 20 18 | #define _SHR_MPLS_INDEXED_LABEL_INDEX_MASK 0x7 19 | #define _SHR_MPLS_INDEXED_LABEL_VALUE_SHIFT 0 20 | #define _SHR_MPLS_INDEXED_LABEL_VALUE_MASK 0xFFFFF 21 | 22 | /* 23 | * MPLS macros for indexed support 24 | */ 25 | #define _SHR_MPLS_INDEXED_LABEL_SET(_label, _label_value,_index) \ 26 | ((_label) = (((_index) & _SHR_MPLS_INDEXED_LABEL_INDEX_MASK) << _SHR_MPLS_INDEXED_LABEL_INDEX_SHIFT) | \ 27 | (((_label_value) & _SHR_MPLS_INDEXED_LABEL_VALUE_MASK) << _SHR_MPLS_INDEXED_LABEL_VALUE_SHIFT)) 28 | 29 | #define _SHR_MPLS_INDEXED_LABEL_VALUE_GET(_label) \ 30 | (((_label) >> _SHR_MPLS_INDEXED_LABEL_VALUE_SHIFT) & _SHR_MPLS_INDEXED_LABEL_VALUE_MASK) 31 | 32 | #define _SHR_MPLS_INDEXED_LABEL_INDEX_GET(_label) \ 33 | (((_label) >> _SHR_MPLS_INDEXED_LABEL_INDEX_SHIFT) & _SHR_MPLS_INDEXED_LABEL_INDEX_MASK) 34 | 35 | #endif /* !_SHR_MPLS_H */ 36 | -------------------------------------------------------------------------------- /include/shared/phyconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This file defines PHY configuration modes. 9 | * 10 | * Its contents are not used directly by applications; it is used only 11 | * by header files of parent APIs which need to define port modes. 12 | */ 13 | 14 | #ifndef _SHR_PHYCONFIG_H 15 | #define _SHR_PHYCONFIG_H 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /* 22 | * Structure: 23 | * _shr_phy_config_t 24 | * Purpose: 25 | * Defines the operating mode of a PHY. 26 | */ 27 | 28 | typedef struct _shr_phy_config_s { 29 | int enable; 30 | int preferred; 31 | int autoneg_enable; 32 | _shr_port_mode_t autoneg_advert; 33 | _shr_port_ability_t advert_ability; 34 | int force_speed; 35 | int force_duplex; 36 | int master; 37 | _shr_port_mdix_t mdix; 38 | } _shr_phy_config_t; 39 | 40 | typedef int (*_shr_port_phy_reset_cb_t)(int unit, _shr_port_t port, 41 | void *user_data); 42 | 43 | typedef void (*_shr_port_medium_status_cb_t)(int unit, int port, 44 | _shr_port_medium_t medium, 45 | void *user_arg); 46 | 47 | #endif /* !_SHR_PHYCONFIG_H */ 48 | -------------------------------------------------------------------------------- /include/shared/phyreg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This file defines common PHY register definition. 9 | * 10 | * Its contents are not used directly by applications; it is used only 11 | * by header files of parent APIs which need to define PHY register definition. 12 | */ 13 | 14 | #ifndef _SHR_PHYREG_H 15 | #define _SHR_PHYREG_H 16 | 17 | #define _SHR_PORT_PHY_PHYMOD_IBLK_FORCE_LANE 0x8000000 18 | #define _SHR_PORT_PHY_PHYMOD_ACCESS_FLAGS_SHIFT 24 19 | 20 | #define _SHR_PORT_PHT_PHYMOD_FORCE_LANE_SET(_addr, _lane) \ 21 | _addr = ((_addr & ~(0x7 << _SHR_PORT_PHY_PHYMOD_ACCESS_FLAGS_SHIFT)) | \ 22 | _SHR_PORT_PHY_PHYMOD_IBLK_FORCE_LANE | \ 23 | ((_lane & 0x7) << _SHR_PORT_PHY_PHYMOD_ACCESS_FLAGS_SHIFT)) 24 | 25 | #define _SHR_PORT_PHY_SHAD_RETRY_CNT (50) 26 | 27 | #define _SHR_PORT_PHY_INTERNAL 0x00000001 28 | #define _SHR_PORT_PHY_NOMAP 0x00000002 29 | #define _SHR_PORT_PHY_CLAUSE45 0x00000004 30 | #define _SHR_PORT_PHY_I2C_DATA8 0x00000008 31 | #define _SHR_PORT_PHY_I2C_DATA16 0x00000010 32 | #define _SHR_PORT_PHY_PVT_DATA 0x00000020 33 | #define _SHR_PORT_PHY_REG_RDB 0x02000000 34 | #define _SHR_PORT_PHY_REG_MACSEC 0x04000000 35 | #define _SHR_PORT_PHY_REG64_DATA_HI32 0x08000000 36 | 37 | #define _SHR_PORT_PHY_CLAUSE45_ADDR(_devad, _regad) \ 38 | ((((_devad) & 0x3F) << 16) | \ 39 | ((_regad) & 0xFFFF)) 40 | #define _SHR_PORT_PHY_CLAUSE45_DEVAD(_reg_addr) \ 41 | (((_reg_addr) >> 16) & 0x3F) 42 | #define _SHR_PORT_PHY_CLAUSE45_REGAD(_reg_addr) \ 43 | ((_reg_addr) & 0xFFFF) 44 | #define _SHR_PORT_PHY_I2C_ADDR(_devad, _regad) \ 45 | ((((_devad) & 0xFF) << 16) | \ 46 | ((_regad) & 0xFFFF)) 47 | #define _SHR_PORT_PHY_I2C_DEVAD(_reg_addr) \ 48 | (((_reg_addr) >> 16) & 0xFF) 49 | #define _SHR_PORT_PHY_I2C_REGAD(_reg_addr) \ 50 | ((_reg_addr) & 0xFFFF) 51 | 52 | #define _SHR_PORT_PHY_REG_NO_RETRY_ACCESS 0x08000000 53 | #define _SHR_PORT_PHY_REG_RESERVE_ACCESS 0x20000000 54 | #define _SHR_PORT_PHY_REG_1000X 0x40000000 55 | #define _SHR_PORT_PHY_REG_INDIRECT 0x80000000 56 | #define _SHR_PORT_PHY_REG_DUMMY_ACCESS 0x10000000 57 | 58 | #define _SHR_PORT_PHY_REG_FLAGS_MASK 0xFF000000 59 | #define _SHR_PORT_PHY_REG_BANK_MASK 0x0000FFFF 60 | #define _SHR_PORT_PHY_REG_ADDR_MASK 0x000000FF 61 | 62 | #define _SHR_PORT_PHY_REG_INDIRECT_ADDR(_flags, _reg_bank, _reg_addr) \ 63 | ((((_flags) | _SHR_PORT_PHY_REG_INDIRECT) & \ 64 | _SHR_PORT_PHY_REG_FLAGS_MASK) | \ 65 | (((_reg_bank) & _SHR_PORT_PHY_REG_BANK_MASK) << 8) | \ 66 | ((_reg_addr) & _SHR_PORT_PHY_REG_ADDR_MASK)) 67 | #define _SHR_PORT_PHY_REG_FLAGS(_reg_addr) \ 68 | ((_reg_addr) & _SHR_PORT_PHY_REG_FLAGS_MASK) 69 | #define _SHR_PORT_PHY_REG_BANK(_reg_addr) \ 70 | (((_reg_addr) >> 8) & _SHR_PORT_PHY_REG_BANK_MASK) 71 | #define _SHR_PORT_PHY_REG_ADDR(_reg_addr) \ 72 | ((_reg_addr) & _SHR_PORT_PHY_REG_ADDR_MASK) 73 | 74 | #endif /* !_SHR_PHYREG_H */ 75 | -------------------------------------------------------------------------------- /include/shared/pkt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * This file contains multicast definitions. 9 | */ 10 | 11 | #ifndef _SHR_PKT_H 12 | #define _SHR_PKT_H 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | 20 | #define _SHR_PKT_NOF_DNX_HEADERS 9 21 | #define _SHR_PKT_DNX_RAW_SIZE_MAX 20 22 | 23 | 24 | /* Pkt DNX types. */ 25 | typedef enum { 26 | _SHR_PKT_DNX_TYPE_ITMH = 0, /* ITMH Header. */ 27 | _SHR_PKT_DNX_TYPE_FTMH = 1, /* FMTH Header. */ 28 | _SHR_PKT_DNX_TYPE_OTMH = 2, /* OTMH Header. */ 29 | _SHR_PKT_DNX_TYPE_OTSH = 3, /* OAM-TS Header (OTSH). */ 30 | _SHR_PKT_DNX_TYPE_INTERNALS = 4 /* DNX Internal fields */ 31 | 32 | } _shr_pkt_dnx_type_t; 33 | 34 | /* itmh dest type. */ 35 | typedef enum { 36 | _SHR_PKT_DNX_ITMH_DEST_TYPE_MULTICAST = 0, /* ITMH destination type is multicast. */ 37 | _SHR_PKT_DNX_ITMH_DEST_TYPE_FLOW = 1, /* ITMH destination type is flow. */ 38 | _SHR_PKT_DNX_ITMH_DEST_TYPE_INGRESS_SHAPING_FLOW = 2, /* ITMH destination type is ingress 39 | shaping flow. */ 40 | _SHR_PKT_DNX_ITMH_DEST_TYPE_VPORT = 3, /* ITMH destination type is out lif. */ 41 | _SHR_PKT_DNX_ITMH_DEST_TYPE_SYSTEM_PORT = 4 /* ITMH destination type is system port. */ 42 | } _shr_pkt_dnx_itmh_dest_type_t; 43 | 44 | 45 | /* ftmh action type. */ 46 | typedef enum { 47 | _SHR_PKT_DNX_FTMH_ACTION_TYPE_FORWARD = 0, /* TM action is forward */ 48 | _SHR_PKT_DNX_FTMH_ACTION_TYPE_SNOOP = 1, /* TM action is snoop */ 49 | _SHR_PKT_DNX_FTMH_ACTION_TYPE_INBOUND_MIRROR = 2, /* TM action is inbound mirror. */ 50 | _SHR_PKT_DNX_FTMH_ACTION_TYPE_OUTBOUND_MIRROR = 3, /* TM action is outbound mirror. */ 51 | _SHR_PKT_DNX_FTMH_ACTION_TYPE_MIRROR = 4, /* TM action is mirror. */ 52 | _SHR_PKT_DNX_FTMH_ACTION_TYPE_STATISTICAL_SAMPLING = 5 /* TM action is statistical sampling. */ 53 | } _shr_pkt_dnx_ftmh_action_type_t; 54 | 55 | /* otsh type */ 56 | typedef enum { 57 | _SHR_PKT_DNX_OTSH_TYPE_OAM = 0, /* OAM-TS type is OAM */ 58 | _SHR_PKT_DNX_OTSH_TYPE_1588v2 = 1, /* OAM-TS type is 1588v2 */ 59 | _SHR_PKT_DNX_OTSH_TYPE_RESERVED = 2, /* OAM-TS type reseved */ 60 | _SHR_PKT_DNX_OTSH_TYPE_LATENCY = 3 /* OAM-TS type is packet latency */ 61 | } _shr_pkt_dnx_otsh_type_t; 62 | 63 | /* otsh oam sutype */ 64 | typedef enum { 65 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_NONE = 0, /* None */ 66 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_LM = 1, /* Loss Measurement (LM) */ 67 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_DM1588 = 2, /* Delay Measurement (DM) - 1588 ToD */ 68 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_DM_NTP = 3, /* Delay Measurement (DM) - NTP ToD */ 69 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_OAM_DEFAULT = 4, /* Default OAM type */ 70 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_LOOPBACK = 5, /* Loopback */ 71 | _SHR_PKT_DNX_OTSH_OAM_SUBTYPE_ECN = 7 /* ECN */ 72 | } _shr_pkt_dnx_otsh_oam_subtype_t; 73 | 74 | 75 | #endif /* _SHR_PKT_H */ 76 | -------------------------------------------------------------------------------- /include/shared/policer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: policer.h 9 | * Purpose: Defines common policer parameters. 10 | */ 11 | 12 | #ifndef _SHR_POLICER_H_ 13 | #define _SHR_POLICER_H_ 14 | 15 | #include 16 | 17 | /* policer_id macro definitions */ 18 | #define _SHR_POLICER_ID_METER_INDEX_POSITION (0) 19 | #define _SHR_POLICER_ID_METER_INDEX_MASK (0x7FFFF) /** 19 bits for meter index*/ 20 | #define _SHR_POLICER_ID_DATABASE_HANDLE_POSITION (20) /** 1 spare bit for future usage */ 21 | #define _SHR_POLICER_ID_DATABASE_HANDLE_MASK (0x3FF) /** 10 bits for the handle */ 22 | #define _SHR_POLICER_ID_MACRO_IND_POSITION (30) 23 | #define _SHR_POLICER_ID_MACRO_IND_MASK (0x1) /** 1 bit for macro indication */ 24 | 25 | /* database_handle macro definitions */ 26 | #define _SHR_POLICER_IS_INGRESS_POSITION (_SHR_POLICER_ID_DATABASE_HANDLE_POSITION) 27 | #define _SHR_POLICER_IS_INGRESS_MASK (0x1) 28 | #define _SHR_POLICER_IS_GLOBAL_POSITION (_SHR_POLICER_ID_DATABASE_HANDLE_POSITION + 1) 29 | #define _SHR_POLICER_IS_GLOBAL_MASK (0x1) 30 | #define _SHR_POLICER_DATABASE_ID_POSITION (_SHR_POLICER_ID_DATABASE_HANDLE_POSITION + 2) 31 | #define _SHR_POLICER_DATABASE_ID_MASK (0x3) 32 | #define _SHR_POLICER_CORE_ID_POSITION (_SHR_POLICER_ID_DATABASE_HANDLE_POSITION + 6) /** 1 spare bit for future usage */ 33 | #define _SHR_POLICER_CORE_ID_MASK (0x3) /** support upto 4 cores */ 34 | #define _SHR_POLICER_CORE_ALL_POSITION (_SHR_POLICER_ID_DATABASE_HANDLE_POSITION + 8) 35 | #define _SHR_POLICER_CORE_ALL_MASK (0x1) 36 | 37 | #define _SHR_POLICER_DATABASE_HANDLE_MACRO_IND_POSITION (_SHR_POLICER_ID_DATABASE_HANDLE_POSITION + 9) 38 | #define _SHR_POLICER_DATABASE_HANDLE_MACRO_IND_MASK (0x1) 39 | 40 | 41 | 42 | 43 | 44 | #define _SHR_POLICER_DATABASE_HANDLE_SET(_database_handle, _is_ingress, _is_global, _core_id, _database_id) \ 45 | (_database_handle = ((_core_id & _SHR_POLICER_CORE_ID_MASK) << _SHR_POLICER_CORE_ID_POSITION) | \ 46 | ((((_core_id == _SHR_CORE_ALL) ? 1 : 0) & _SHR_POLICER_CORE_ALL_MASK) << _SHR_POLICER_CORE_ALL_POSITION) | \ 47 | ((_database_id & _SHR_POLICER_DATABASE_ID_MASK) << _SHR_POLICER_DATABASE_ID_POSITION) | \ 48 | ((_is_global & _SHR_POLICER_IS_GLOBAL_MASK) << _SHR_POLICER_IS_GLOBAL_POSITION) | \ 49 | ((_is_ingress & _SHR_POLICER_IS_INGRESS_MASK) << _SHR_POLICER_IS_INGRESS_POSITION) | \ 50 | ((0x1 & _SHR_POLICER_DATABASE_HANDLE_MACRO_IND_MASK) << _SHR_POLICER_DATABASE_HANDLE_MACRO_IND_POSITION)) 51 | 52 | #define _SHR_POLICER_DATABASE_HANDLE_IS_INGRESS_GET(_database_handle) \ 53 | ((_database_handle >> _SHR_POLICER_IS_INGRESS_POSITION) & _SHR_POLICER_IS_INGRESS_MASK) 54 | 55 | #define _SHR_POLICER_DATABASE_HANDLE_IS_GLOBAL_GET(_database_handle) \ 56 | ((_database_handle >> _SHR_POLICER_IS_GLOBAL_POSITION) & _SHR_POLICER_IS_GLOBAL_MASK) 57 | 58 | #define _SHR_POLICER_DATABASE_HANDLE_CORE_ID_GET(_database_handle) \ 59 | (((_database_handle >> _SHR_POLICER_CORE_ALL_POSITION) & _SHR_POLICER_CORE_ALL_MASK) ? \ 60 | (_SHR_CORE_ALL) : ((_database_handle >> _SHR_POLICER_CORE_ID_POSITION) & _SHR_POLICER_CORE_ID_MASK)) 61 | 62 | #define _SHR_POLICER_DATABASE_HANDLE_DATABASE_ID_GET(_database_handle) \ 63 | ((_database_handle >> _SHR_POLICER_DATABASE_ID_POSITION) & _SHR_POLICER_DATABASE_ID_MASK) 64 | 65 | 66 | 67 | #define _SHR_POLICER_ID_SET(_policer_id, _database_handle, meter_index) \ 68 | (_policer_id = ((meter_index & _SHR_POLICER_ID_METER_INDEX_MASK) << _SHR_POLICER_ID_METER_INDEX_POSITION) | \ 69 | (_database_handle) | \ 70 | ((0x1 & _SHR_POLICER_ID_MACRO_IND_MASK) << _SHR_POLICER_ID_MACRO_IND_POSITION)) 71 | 72 | #define _SHR_POLICER_ID_METER_INDEX_GET(_policer_id) \ 73 | ((_policer_id >> _SHR_POLICER_ID_METER_INDEX_POSITION) & _SHR_POLICER_ID_METER_INDEX_MASK) 74 | 75 | #define _SHR_POLICER_ID_DATABASE_HANDLE_GET(_policer_id) \ 76 | ((_policer_id) & (_SHR_POLICER_ID_DATABASE_HANDLE_MASK << _SHR_POLICER_ID_DATABASE_HANDLE_POSITION)) 77 | 78 | 79 | #endif /* _SHR_POLICER_H_ */ 80 | -------------------------------------------------------------------------------- /include/shared/stat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: stat.h 9 | * Purpose: Defines common stat parameters. 10 | */ 11 | 12 | #ifndef _SHR_STAT_H_ 13 | #define _SHR_STAT_H_ 14 | 15 | #define _SHR_STAT_COUNTER_STAT_MACRO_INDICATION_POSITION (31) 16 | #define _SHR_STAT_COUNTER_STAT_IS_BYTE_POSITION (16) 17 | #define _SHR_STAT_COUNTER_STAT_OFFSET_POSITION (0) 18 | #define _SHR_STAT_COUNTER_STAT_MACRO_INDICATION_MASK (0x1) 19 | #define _SHR_STAT_COUNTER_STAT_IS_BYTE_MASK (0x1) 20 | #define _SHR_STAT_COUNTER_STAT_OFFSET_MASK (0xFF) 21 | 22 | 23 | #define _SHR_STAT_COUNTER_STAT_SET(is_bytes, offset) \ 24 | ((1 << _SHR_STAT_COUNTER_STAT_MACRO_INDICATION_POSITION) | \ 25 | ((is_bytes & _SHR_STAT_COUNTER_STAT_IS_BYTE_MASK) << _SHR_STAT_COUNTER_STAT_IS_BYTE_POSITION) | \ 26 | ((offset & _SHR_STAT_COUNTER_STAT_OFFSET_MASK) << _SHR_STAT_COUNTER_STAT_OFFSET_POSITION)) 27 | 28 | #define _SHR_STAT_COUNTER_STAT_OFFSET_GET(stat) \ 29 | ((stat >> _SHR_STAT_COUNTER_STAT_OFFSET_POSITION) & _SHR_STAT_COUNTER_STAT_OFFSET_MASK) 30 | #define _SHR_STAT_COUNTER_STAT_IS_BYTES_GET(stat) \ 31 | ((stat >> _SHR_STAT_COUNTER_STAT_IS_BYTE_POSITION) & _SHR_STAT_COUNTER_STAT_IS_BYTE_MASK) 32 | 33 | #define _SHR_STAT_COUNTER_STAT_IS_VALID(stat) \ 34 | ((stat >> _SHR_STAT_COUNTER_STAT_MACRO_INDICATION_POSITION) & _SHR_STAT_COUNTER_STAT_MACRO_INDICATION_MASK) ? TRUE : FALSE 35 | 36 | #endif /* _SHR_STAT_H_ */ 37 | -------------------------------------------------------------------------------- /include/shared/trunk.h: -------------------------------------------------------------------------------- 1 | /** \file include/shared/trunk.h 2 | * 3 | * 4 | * This file contains definitions for papi to use in context of 5 | * the trunk module. 6 | */ 7 | 8 | /* 9 | * This software is governed by the Broadcom Switch APIs license. 10 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 11 | * 12 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 13 | */ 14 | 15 | #ifndef _SHR_TRUNK_H 16 | #define _SHR_TRUNK_H 17 | 18 | #define _SHR_TRUNK_ID_BIT 25 19 | #define _SHR_TRUNK_STACKING_BIT 24 20 | #define _SHR_TRUNK_ID_MASK 1 << _SHR_TRUNK_ID_BIT 21 | #define _SHR_TRUNK_STACKING_MASK 1 << _SHR_TRUNK_STACKING_BIT 22 | #define _SHR_TRUNK_POOL_BITS 3 23 | #define _SHR_TRUNK_POOL_OFFSET 17 24 | #define _SHR_TRUNK_GROUP_BITS 17 25 | #define _SHR_TRUNK_GROUP_OFFSET 0 26 | 27 | #define _SHR_TRUNK_ID_SET(trunk_id, pool, group) \ 28 | (trunk_id = (_SHR_TRUNK_ID_MASK) | \ 29 | ((pool) << (_SHR_TRUNK_POOL_OFFSET)) | \ 30 | ((group) << (_SHR_TRUNK_GROUP_OFFSET))) 31 | 32 | #define _SHR_TRUNK_ID_POOL_GET(pool, trunk_id) \ 33 | (pool = ((trunk_id) & ((1 << (_SHR_TRUNK_POOL_OFFSET + _SHR_TRUNK_POOL_BITS)) - 1)) >> (_SHR_TRUNK_POOL_OFFSET)) 34 | 35 | #define _SHR_TRUNK_ID_GROUP_GET(group, trunk_id) \ 36 | (group = ((trunk_id) & ((1 << (_SHR_TRUNK_GROUP_OFFSET + _SHR_TRUNK_GROUP_BITS)) - 1)) >> (_SHR_TRUNK_GROUP_OFFSET)) 37 | 38 | #define _SHR_TRUNK_ID_IS_VALID(trunk_id) \ 39 | (((trunk_id) & (_SHR_TRUNK_ID_MASK)) != 0) 40 | 41 | #define _SHR_TRUNK_STACKING_ID_SET(trunk_id, peer_tm_domain) \ 42 | (trunk_id = ((peer_tm_domain) | (_SHR_TRUNK_ID_MASK) | (_SHR_TRUNK_STACKING_MASK))) 43 | 44 | #define _SHR_TRUNK_ID_IS_STACKING(trunk_id) \ 45 | ((((trunk_id) & (_SHR_TRUNK_STACKING_MASK)) != 0) && (((trunk_id) & (_SHR_TRUNK_ID_MASK)) != 0)) 46 | 47 | #define _SHR_TRUNK_STACKING_PEER_TMD_GET(peer_tm_domain, trunk_id) \ 48 | ((peer_tm_domain) = ((peer_tm_domain) & ( ~((_SHR_TRUNK_ID_MASK) | (_SHR_TRUNK_STACKING_MASK)) ))) 49 | 50 | #endif /* _SHR_TRUNK_H */ 51 | -------------------------------------------------------------------------------- /include/shared/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | * 8 | * File: types.h 9 | * Purpose: 10 | */ 11 | 12 | #ifndef _SHR_TYPES_H_ 13 | #define _SHR_TYPES_H_ 14 | 15 | #include 16 | 17 | typedef int8 _shr_dma_chan_t; 18 | 19 | typedef int _shr_module_t; 20 | 21 | typedef int _shr_if_t; 22 | 23 | typedef uint16 _shr_vlan_t; 24 | 25 | #define _SHR_PORT_INVALID (-1) 26 | 27 | 28 | typedef enum { 29 | _SHR_COLOR_GREEN = 0, 30 | _SHR_COLOR_YELLOW = 1, 31 | _SHR_COLOR_RED = 2, 32 | _SHR_COLOR_BLACK = 3, 33 | _SHR_COLOR_PRESERVE = 4, 34 | _SHR_COLOR_COUNT = 5 35 | } _shr_color_t; 36 | 37 | typedef enum { 38 | _SHR_FORWARDING_TYPE_L2 = 0, /* L2 switching forwarding. */ 39 | _SHR_FORWARDING_TYPE_IP4UCAST = 1, /* IPv4 Unicast Routing forwarding. */ 40 | _SHR_FORWARDING_TYPE_IP4MCAST = 2, /* IPv4 Multicast Routing forwarding. */ 41 | _SHR_FORWARDING_TYPE_IP6UCAST = 3, /* IPv6 Unicast Routing forwarding. */ 42 | _SHR_FORWARDING_TYPE_IP6MCAST = 4, /* IPv6 Multicast Routing forwarding. */ 43 | _SHR_FORWARDING_TYPE_MPLS = 5, /* MPLS Switching forwarding. */ 44 | _SHR_FORWARDING_TYPE_TRILL = 6, /* Trill forwarding. */ 45 | _SHR_FORWARDING_TYPE_RXREASON = 7, /* Forwarding according to a RxReason. */ 46 | _SHR_FORWARDING_TYPE_TRAFFIC_MANAGMENT = 8, /* Traffic Management forwarding, when 47 | an external Packet Processor sets the 48 | forwarding decision. */ 49 | _SHR_FORWARDING_TYPE_SNOOP = 9, /* Snooped packet. */ 50 | _SHR_FORWARDING_TYPE_FCoE = 10, /* Fiber Channel over Ethernet 51 | forwarding. */ 52 | _SHR_FORWARDING_TYPE_COUNT = 11 /* Always Last. Not a usable value. */ 53 | } _shr_forwarding_type_t; 54 | 55 | #endif /* _SHR_TYPES_H_ */ 56 | -------------------------------------------------------------------------------- /include/soc/cmext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This software is governed by the Broadcom Switch APIs license. 4 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 5 | * 6 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 | */ 8 | 9 | #ifndef _SOC_CMEXT_H 10 | #define _SOC_CMEXT_H 11 | 12 | #include 13 | 14 | extern int soc_cm_init(void); 15 | extern int soc_cm_deinit(void); 16 | /* 17 | * DRIVER/DEVICE INITIALIZATION 18 | * ---------------------------------------- 19 | * 20 | * Step One: Device/Revision Ids 21 | * ------------------------------- 22 | * Each Broadcom device can be identified by 2 values -- its 23 | * Device ID and its Revision ID. The combination of these two values 24 | * specify a particular Broadcom device. 25 | * 26 | * Before the BCM driver is assigned the task of driving 27 | * a Broadcom device, you must ascertain the Device ID and the 28 | * Revision ID for the device to be driven (for a PCI device, these 29 | * are in the PCI Configuration Space). 30 | * 31 | * 32 | * After the Device ID and Revision ID are discovered (typically at 33 | * system initialization time), you should query the SOC driver to 34 | * discover whether it supports the discovered device using the following 35 | * function: 36 | */ 37 | 38 | /* 39 | * Syntax: int soc_cm_device_supported(uint16 device_id, 40 | * uint8 revision_id) 41 | * 42 | * Purpose: Determine whether this driver supports a particular device. 43 | * 44 | * Parameters: 45 | * device_id -- The 16-bit device id for the device. 46 | * revision_id -- The 8-bit revision id for the device. 47 | * 48 | * Returns: 49 | * 0 if the device is supported. 50 | * < 0 if the device is not supported. 51 | */ 52 | 53 | extern int soc_cm_device_supported(uint16 dev_id, uint8 rev_id); 54 | 55 | /* 56 | * Step Two: Device Creation 57 | * ----------------------------------------- 58 | * When you have a device that the SOC driver supports, 59 | * You must create a driver device for it. 60 | * You create a driver device by calling cm_device_create() with 61 | * the device and revision ids. 62 | * 63 | * cm_device_create() will return a handle that should be used 64 | * when referring to the device in the future. 65 | 66 | * cm_device_create_id() might be used if application want to 67 | * force a speicifc handle when referring to the device in the future. 68 | * Passing -1 as a "dev" parameter will force api to allocate a new handle. 69 | * 70 | * cm_dev_num_set() might be used to associate the CM device to a 71 | * BDE/DRD handle if the CM handle and the BDE/DRD handle are not consistent. 72 | */ 73 | 74 | extern int soc_cm_device_create(uint16 dev_id, uint16 rev_id, void *cookie); 75 | extern int soc_cm_device_create_id(uint16 dev_id, uint16 rev_id, 76 | void *cookie, int dev); 77 | extern int soc_cm_dev_num_set(int dev, int kdev); 78 | 79 | 80 | /* 81 | * Step Three: Device Initialization 82 | * ----------------------------------------- 83 | * After you have initialized a device, 84 | * you must provide several accessor functions that will be 85 | * used by the SOC driver to communicate with the device at 86 | * the lowest level -- the SOC driver will access the device 87 | * through these routines, and these routines only. 88 | * 89 | * You provide these access vectors to the driver 90 | * by filling in the 'cm_device_t' structure. See 91 | */ 92 | 93 | extern int soc_cm_device_init(int dev, soc_cm_device_vectors_t *vectors); 94 | 95 | extern const char *soc_cm_device_name_get(uint16 dev_id, uint8 rev_id); 96 | extern int soc_cm_device_destroy(int dev); 97 | 98 | extern int soc_cm_config_init(void); 99 | extern int soc_cm_config_str_set(int dev, const char *name, const char *val); 100 | extern char *soc_cm_config_str_get(int dev, const char *name); 101 | extern int soc_cm_config_port_str_set(int dev, int port, 102 | const char *name, const char *val); 103 | extern char *soc_cm_config_port_str_get(int dev, int port, const char *name); 104 | 105 | #endif /* !_SOC_CMEXT_H */ 106 | -------------------------------------------------------------------------------- /lib/mips-BCM9XLP2_XMC_A1/libopennsa.a: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:92b920b060c69a295782f52022228a3c81918da26b9531345e9acf970f2585e9 3 | size 196359938 4 | -------------------------------------------------------------------------------- /lib/mips-BCM9XLP2_XMC_A1/libopennsa_cint.a: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:933547ae28fdf82dbfd20499286be98d5d7ecdc68048e774aedaabddd4a6ab6e 3 | size 9858954 4 | -------------------------------------------------------------------------------- /lib/mips-BCM9XLP2_XMC_A1/libopennsa_diag.a: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:6f73c0f414794b5d00ef9d7c07f31a97380b56e78714992b838b100a4c586c7a 3 | size 128426 4 | -------------------------------------------------------------------------------- /lib/mips-BCM9XLP2_XMC_A1/libopennsadyn.so: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5c6fde49aa6f94971b4801db68f3dabad256f1c7384940f739cbff62eebf9fa9 3 | size 130175232 4 | -------------------------------------------------------------------------------- /lib/x86-64/libopennsa.a: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:dc927c88af00e86d48b1b2d36f45177dfabc2e7a8db71d6f5eab870ff5d33897 3 | size 426001084 4 | -------------------------------------------------------------------------------- /lib/x86-64/libopennsa.so: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:6628da22decb544dd601ffeccbae9bf5c692088721352ddbd064081fa3abb9e6 3 | size 277484392 4 | -------------------------------------------------------------------------------- /src/diag/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This software is governed by the Broadcom Switch APIs license. 3 | # This license is set out in $SDK/Legal/LICENSE file. 4 | # 5 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 | # 7 | # Note: The version GNU BINUTILS shown below is the minimum 8 | # needed in order to avoid a known bug in GCC that otherwise 9 | # results in an internal linker error 10 | #"BFD (GNU Binutils) 2.22 internal error, aborting at reloc.c line 1509 in _bfd_relocate_contents" 11 | export BINUTILSVER = 2.27 12 | 13 | ifeq ($(SDK),) 14 | $(error Environment variable "$SDK" must be set) 15 | endif 16 | 17 | DRV_LIBS_NOSHELL = -Wl,--start-group -lopennsa -Wl,--end-group 18 | DRV_LIBS_SHELL = -Wl,--start-group -lopennsa -lopennsa_diag -lopennsa_cint -Wl,--end-group 19 | DRV_LIBS_DYN = -lopennsadyn 20 | 21 | DRV_LIBS = -Wl,--start-group -lopennsa -Wl,--end-group 22 | 23 | all: demo_opennsa_init Makefile 24 | dnx: opennsa_diag_shell_qax 25 | 26 | demo_opennsa_init: demo_opennsa_init.c version.c config_init_defaults.c $(SDK)/lib/x86-64/libopennsa.a 27 | gcc -I$(SDK)/include -I$(SDK)/src/gpl-modules/systems/bde/linux/include -I$(SDK)/src/gpl-modules/include -DBCM_ESW_SUPPORT -DBCM_WARM_BOOT_SUPPORT -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0 -DLE_HOST=1 -o $@ $^ -L$(SDK)/lib/x86-64 $(DRV_LIBS) -lrt -pthread -lm 28 | 29 | opennsa_diag_shell_qax: opennsa_diag_shell.c version.c config_init_defaults.c $(SDK)/lib/mips-BCM9XLP2_XMC_A1/libopennsa.a $(SDK)/lib/mips-BCM9XLP2_XMC_A1/libopennsa_diag.a $(SDK)/lib/mips-BCM9XLP2_XMC_A1/libopennsa_cint.a 30 | $(CC) -mabi=32 -I$(SDK)/include -I$(SDK)/src/gpl-modules/systems/bde/linux/include -I$(SDK)/src/gpl-modules/include -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -DLE_HOST=1 -o $@ $^ -L$(SDK)/lib/mips-BCM9XLP2_XMC_A1 $(DRV_LIBS_SHELL) -lrt -pthread -lm 31 | 32 | opennsa_diag_shell_qax_dyn: opennsa_diag_shell.c version.c config_init_defaults.c $(SDK)/lib/mips-BCM9XLP2_XMC_A1/libopennsadyn.so 33 | $(CC) -mabi=32 -I$(SDK)/include -I$(SDK)/src/gpl-modules/systems/bde/linux/include -I$(SDK)/src/gpl-modules/include -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 -DLE_HOST=1 -o $@ $^ -L$(SDK)/lib/mips-BCM9XLP2_XMC_A1 $(DRV_LIBS_DYN) -lrt -pthread -lm 34 | 35 | -------------------------------------------------------------------------------- /src/diag/config_init_defaults.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is automatically generated by bcm2c.pl. DO NOT EDIT! 3 | */ 4 | #include 5 | void 6 | sal_config_init_defaults(void) 7 | { 8 | sal_config_set("pbmp_xport_xe.0","0x8000f8000fc000f8000f8000f8000fc000f8001e"); 9 | sal_config_set("ccm_dma_enable","0"); 10 | sal_config_set("ccmdma_intr_enable","0"); 11 | sal_config_set("ctr_evict_enable","0"); 12 | sal_config_set("mem_cache_enable","0"); 13 | sal_config_set("parity_correction","0"); 14 | sal_config_set("parity_enable","0"); 15 | sal_config_set("phy_enable","0"); 16 | sal_config_set("phy_null","1"); 17 | sal_config_set("fpem_mem_entries","65536"); 18 | sal_config_set("portmap_1","1:400"); 19 | sal_config_set("portmap_2","9:400"); 20 | sal_config_set("portmap_3","17:400"); 21 | sal_config_set("portmap_4","25:400"); 22 | sal_config_set("portmap_19","259:10"); 23 | sal_config_set("portmap_20","33:400"); 24 | sal_config_set("portmap_21","41:400"); 25 | sal_config_set("portmap_22","49:400"); 26 | sal_config_set("portmap_23","57:400"); 27 | sal_config_set("portmap_38","257:10"); 28 | sal_config_set("portmap_39","260:10"); 29 | sal_config_set("portmap_40","65:400"); 30 | sal_config_set("portmap_41","73:400"); 31 | sal_config_set("portmap_42","81:400"); 32 | sal_config_set("portmap_43","89:400"); 33 | sal_config_set("portmap_59","261:10"); 34 | sal_config_set("portmap_60","97:400"); 35 | sal_config_set("portmap_61","105:400"); 36 | sal_config_set("portmap_62","113:400"); 37 | sal_config_set("portmap_63","121:400"); 38 | sal_config_set("portmap_79","262:10"); 39 | sal_config_set("portmap_80","129:400"); 40 | sal_config_set("portmap_81","137:400"); 41 | sal_config_set("portmap_82","145:400"); 42 | sal_config_set("portmap_83","153:400"); 43 | sal_config_set("portmap_99","263:10"); 44 | sal_config_set("portmap_100","161:400"); 45 | sal_config_set("portmap_101","169:400"); 46 | sal_config_set("portmap_102","177:400"); 47 | sal_config_set("portmap_103","185:400"); 48 | sal_config_set("portmap_118","258:10"); 49 | sal_config_set("portmap_119","264:10"); 50 | sal_config_set("portmap_120","193:400"); 51 | sal_config_set("portmap_121","201:400"); 52 | sal_config_set("portmap_122","209:400"); 53 | sal_config_set("portmap_123","217:400"); 54 | sal_config_set("portmap_139","265:10"); 55 | sal_config_set("portmap_140","225:400"); 56 | sal_config_set("portmap_141","233:400"); 57 | sal_config_set("portmap_142","241:400"); 58 | sal_config_set("portmap_143","249:400"); 59 | sal_config_set("portmap_159","266:10"); 60 | sal_config_set("port_fec_1","9"); 61 | sal_config_set("port_fec_2","9"); 62 | sal_config_set("port_fec_3","9"); 63 | sal_config_set("port_fec_4","9"); 64 | sal_config_set("port_fec_20","9"); 65 | sal_config_set("port_fec_21","9"); 66 | sal_config_set("port_fec_22","9"); 67 | sal_config_set("port_fec_23","9"); 68 | sal_config_set("port_fec_40","9"); 69 | sal_config_set("port_fec_41","9"); 70 | sal_config_set("port_fec_42","9"); 71 | sal_config_set("port_fec_43","9"); 72 | sal_config_set("port_fec_60","9"); 73 | sal_config_set("port_fec_61","9"); 74 | sal_config_set("port_fec_62","9"); 75 | sal_config_set("port_fec_63","9"); 76 | sal_config_set("port_fec_80","9"); 77 | sal_config_set("port_fec_81","9"); 78 | sal_config_set("port_fec_82","9"); 79 | sal_config_set("port_fec_83","9"); 80 | sal_config_set("port_fec_100","9"); 81 | sal_config_set("port_fec_101","9"); 82 | sal_config_set("port_fec_102","9"); 83 | sal_config_set("port_fec_103","9"); 84 | sal_config_set("port_fec_120","9"); 85 | sal_config_set("port_fec_121","9"); 86 | sal_config_set("port_fec_122","9"); 87 | sal_config_set("port_fec_123","9"); 88 | sal_config_set("port_fec_140","9"); 89 | sal_config_set("port_fec_141","9"); 90 | sal_config_set("port_fec_142","9"); 91 | sal_config_set("port_fec_143","9"); 92 | sal_config_set("core_clock_frequency","1325"); 93 | sal_config_set("dpr_clock_frequency","1000"); 94 | sal_config_set("device_clock_frequency","1325"); 95 | sal_config_set("port_flex_enable","1"); 96 | sal_config_set("load_firmware","0x2"); 97 | } 98 | -------------------------------------------------------------------------------- /src/diag/demo_opennsa_init: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:87acf393e0f5d361a1364c86708fb6d17eaa4c5d97700c3d01335fe7c939bb1f 3 | size 232571792 4 | -------------------------------------------------------------------------------- /src/diag/opennsa_diag_shell.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $Copyright: (c) 2019 Broadcom Corp. 3 | * All Rights Reserved.$ 4 | * 5 | * opennsa_diag_shell: A simple diagnostic utility to verify opennsa library. 6 | * 7 | * This utility leverages Broadcom Diag Shell to initialize the device and to allow 8 | * full access to diagnostics. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #ifndef NO_SAL_APPL 17 | #include 18 | #include 19 | #include 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | ibde_t *bde; 31 | 32 | /* 33 | * The bus properties are (currently) the only system specific 34 | * settings required. These must be defined beforehand. 35 | */ 36 | 37 | #ifndef SYS_BE_PIO 38 | #error "SYS_BE_PIO must be defined for the target platform" 39 | #endif 40 | #ifndef SYS_BE_PACKET 41 | #error "SYS_BE_PACKET must be defined for the target platform" 42 | #endif 43 | #ifndef SYS_BE_OTHER 44 | #error "SYS_BE_OTHER must be defined for the target platform" 45 | #endif 46 | 47 | #if !defined(SYS_BE_PIO) || !defined(SYS_BE_PACKET) || !defined(SYS_BE_OTHER) 48 | #error "platform bus properties not defined." 49 | #endif 50 | 51 | /* Function defined in linux-user-bde.c */ 52 | extern int 53 | bde_icid_get( int d, uint8 *data, int len ); 54 | 55 | static soc_chip_info_vectors_t chip_info_vect = { 56 | bde_icid_get 57 | }; 58 | 59 | #ifdef INCLUDE_KNET 60 | 61 | #include 62 | #include 63 | 64 | /* Function defined in linux-user-bde.c */ 65 | extern int 66 | bde_irq_mask_set( int unit, uint32 addr, uint32 mask ); 67 | extern int 68 | bde_hw_unit_get( int unit, int inverse ); 69 | 70 | static soc_knet_vectors_t knet_vect_bcm_knet = { 71 | { 72 | bcm_knet_kcom_open, 73 | bcm_knet_kcom_close, 74 | bcm_knet_kcom_msg_send, 75 | bcm_knet_kcom_msg_recv 76 | }, 77 | bde_irq_mask_set, 78 | bde_hw_unit_get 79 | }; 80 | 81 | static void 82 | knet_kcom_config( void ) 83 | { 84 | /* Direct IOCTL by default */ 85 | soc_knet_config( &knet_vect_bcm_knet ); 86 | } 87 | 88 | #endif /* INCLUDE_KNET */ 89 | 90 | int 91 | bde_create( void ) 92 | { 93 | linux_bde_bus_t bus; 94 | bus.be_pio = SYS_BE_PIO; 95 | bus.be_packet = SYS_BE_PACKET; 96 | bus.be_other = SYS_BE_OTHER; 97 | 98 | return linux_bde_create( &bus, &bde ); 99 | 100 | } 101 | 102 | /* 103 | * Main loop. 104 | */ 105 | int main( int argc, char *argv[] ) 106 | { 107 | int i; 108 | 109 | if (sal_core_init() < 0 110 | #ifndef NO_SAL_APPL 111 | || sal_appl_init() < 0 112 | #endif 113 | ) { 114 | #ifndef NO_SAL_APPL 115 | printf( "SAL Initialization failed\r\n" ); 116 | #endif 117 | exit( 1 ); 118 | } 119 | 120 | for( i = 1; i < argc; i++ ){ 121 | if( !strcmp(argv[i], "-r") || !strcmp(argv[i], "--reload") ){ 122 | sal_boot_flags_set( sal_boot_flags_get() | BOOT_F_RELOAD ); 123 | } 124 | } 125 | 126 | #ifdef INCLUDE_KNET 127 | knet_kcom_config(); 128 | #endif 129 | soc_chip_info_vect_config( &chip_info_vect ); 130 | 131 | diag_shell(); 132 | 133 | linux_bde_destroy( bde ); 134 | return 0; 135 | } 136 | -------------------------------------------------------------------------------- /src/diag/opennsa_diag_shell_qax: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:fba6de88cd67f716f977a2e5d54f41e668452b1c34a337a407067ea6cacac37e 3 | size 133466964 4 | -------------------------------------------------------------------------------- /src/diag/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is automatically generated by version.pl. DO NOT EDIT! 3 | */ 4 | 5 | char *_build_release = "opennsa-6.5.17-EA12"; 6 | char *_build_tree = "/projects/ntsw_sw18_scratch/sdkrel/openbcm/sdk"; 7 | char *_build_user = "ku931718"; 8 | char *_build_host = "lvnvda3240"; 9 | char *_build_date = "Thu Mar 12 10:52:30 2020"; 10 | char *_build_datestamp = "20200312"; 11 | char *_build_arch = "x86_64"; 12 | char *_build_os = "linux"; 13 | -------------------------------------------------------------------------------- /src/gpl-modules/RELEASE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/7cf5a3c9a8b76da0bc8e3217d04b33cfb11b0bcf/src/gpl-modules/RELEASE -------------------------------------------------------------------------------- /src/gpl-modules/include/sal/core/sync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef _SAL_SYNC_H 25 | #define _SAL_SYNC_H 26 | 27 | typedef struct sal_sem_s{ 28 | char sal_opaque_type; 29 | } *sal_sem_t; 30 | 31 | #define sal_sem_FOREVER (-1) 32 | #define sal_sem_BINARY 1 33 | #define sal_sem_COUNTING 0 34 | 35 | sal_sem_t sal_sem_create(char *desc, int binary, int initial_count); 36 | void sal_sem_destroy(sal_sem_t b); 37 | int sal_sem_take(sal_sem_t b, int usec); 38 | int sal_sem_give(sal_sem_t b); 39 | 40 | #endif /* !_SAL_SYNC_H */ 41 | -------------------------------------------------------------------------------- /src/gpl-modules/include/sal/core/thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef _SAL_THREAD_H 25 | #define _SAL_THREAD_H 26 | 27 | #include 28 | 29 | void sal_usleep(uint32 usec); 30 | void sal_udelay(uint32 usec); 31 | 32 | #endif /* !_SAL_THREAD_H */ 33 | -------------------------------------------------------------------------------- /src/gpl-modules/include/sdk_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __SDK_CONFIG_H__ 25 | #define __SDK_CONFIG_H__ 26 | 27 | /* 28 | * Include custom overrides 29 | */ 30 | #ifdef SDK_INCLUDE_CUSTOM_CONFIG 31 | #include 32 | #endif 33 | 34 | 35 | /* 36 | * Memory Barrier operation if required. 37 | * Defaults to nothing. 38 | */ 39 | #ifndef SDK_CONFIG_MEMORY_BARRIER 40 | #define SDK_CONFIG_MEMORY_BARRIER 41 | #endif 42 | 43 | 44 | 45 | #endif /* __SDK_CONFIG_H__ */ 46 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Make.depend: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | # 22 | # Default rule to build dependencies. This builds a x.d file for each 23 | # x.c file that describes the dependencies. We then conditionally include 24 | # the generated .d files. 25 | # 26 | 27 | # 28 | # If making 'clean', do not include any .d files. If they are included, 29 | # gmake intrinsically tries to remake them all. 30 | # 31 | ifeq (,$(findstring clean,$(MAKECMDGOALS))) 32 | 33 | ZFS :=$(wildcard *.zf) 34 | ZFC := $(ZFS:.zf=.c) 35 | 36 | ifdef GENERATE_C_FILES 37 | ifndef GEN_INCS 38 | $(error "GEN_INCS was not defined") 39 | endif 40 | 41 | ZF_GEN = ${SDK}/tools/zFrameCodeGen.pl 42 | 43 | # 1=.zf 44 | define ZFS_RULE 45 | $(1:.zf=Console.c) : $(1:.zf=.c) 46 | @echo updated $$@ from $$? 47 | 48 | $(1:.zf=.c) : $(1) $(ZF_GEN) 49 | @$(PERL) $(ZF_GEN) -s -z . -p . -g $1 -t c 50 | @echo generated ${LOCALDIR}/$$@ from $(1) 51 | @mv $$(*F).cx $$@ 52 | @if [ -e $$(*F)Console.cx ] ; then \ 53 | mv $$(*F)Console.cx $$(*F)Console.c; \ 54 | echo Created $$(*F)Console.c ;\ 55 | fi 56 | @if [ -e $$(*F)Console.hx ] ; then \ 57 | echo Created $(GEN_INCS)/$$(*F)Console.hx ;\ 58 | mv $$(*F)Console.hx $(GEN_INCS)/ ; \ 59 | fi 60 | @mv $$(*F).hx $(GEN_INCS)/ 61 | endef 62 | 63 | $(foreach zf,$(ZFS),$(eval $(call ZFS_RULE,$(zf)))) 64 | 65 | ${BLDDIR}/%.P : ${BLDDIR}/.tree %.c 66 | 67 | .PHONY: GENFILES 68 | GENFILES: $(ZFC) 69 | 70 | $(BOBJS) : $(ZFC) 71 | 72 | else 73 | # 74 | # Attempt to build the depend files. If it fails, the depend file is 75 | # removed so that it is not included in later builds. 76 | # 77 | ${BLDDIR}/%.P : %.c ${BLDDIR}/.tree 78 | @$(ECHO) Dependencies for ${LOCALDIR}/$< 79 | 80 | ${BLDDIR}/%.P : %.cc ${BLDDIR}/.tree 81 | @$(ECHO) Dependencies for ${LOCALDIR}/$< 82 | 83 | endif 84 | 85 | # 86 | # If there are C or C++ files in this directory, include the 87 | # depend files for them. 88 | # 89 | 90 | ifeq ($(findstring _COMPILER,$(MAKECMDGOALS))$(findstring variable,$(MAKECMDGOALS)),) 91 | ifneq ($(strip ${LSRCS}),) 92 | ifneq (,$(findstring .o,$(MAKECMDGOALS))) 93 | -include $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.P)) $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.sig)) 94 | else 95 | -include $(addprefix ${BLDDIR}/,$(addsuffix .P,$(basename $(LSRCS)))) $(addprefix ${BLDDIR}/,$(addsuffix .sig,$(basename $(LSRCS)))) 96 | endif 97 | endif 98 | endif 99 | 100 | endif # !CLEANING 101 | 102 | clean_d:: 103 | ifdef QUIET 104 | @$(ECHO) Cleaning dependencies for ${LOCALDIR} 105 | endif 106 | ifdef GENERATE_C_FILES 107 | $Q$(RM) $(ZFC:%=$(SDK)/$(LOCALDIR)/%) $(ZFC:%.c=$(SDK)/$(LOCALDIR)/%Console.c) 108 | endif 109 | 110 | clean:: clean_d 111 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Make.kernlib: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | # 22 | # Make rules/targets for handling libraries 23 | 24 | .SECONDARY:: ${BOBJS} 25 | 26 | targetlibsoname = ${lib}.so.${SHAREDLIBVER} 27 | targetlibrealname = ${targetlibsoname} 28 | targetlibso = ${LIBDIR}/${targetlibrealname} 29 | 30 | ifeq ($(TOOLS),Borland) 31 | 32 | LIBSUFFIX=lib 33 | 34 | ${LIBDIR}/%.lib: ${BORLAND_BOBJS} 35 | $(RM) $@ 36 | $(FOREACH) -subdir "$(LIBDIR)" \ 37 | "tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))" 38 | 39 | else # !Borland 40 | 41 | LIBSUFFIX=a 42 | 43 | ${LIBDIR}/%.a: ${BOBJS} 44 | ifdef QUIET 45 | @$(ECHO) Building library $(notdir $@) 46 | endif 47 | $Q$(RM) $@ 48 | $Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS}) 49 | ifeq ($(LINUX_MAKE_SHARED_LIB),1) 50 | ifeq ($(targetbase),unix) 51 | $(CC) -shared -Wl,-soname,${targetlibsoname} -o ${targetlibso} ${BOBJS} -lc 52 | endif 53 | endif # LINUX_MAKE_SHARED_LIB # 54 | endif # !Borland 55 | 56 | targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX} 57 | 58 | all:: ${BLDDIR}/.tree ${targetlib} 59 | 60 | install:: all 61 | 62 | clean:: 63 | ifdef QUIET 64 | @$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib} 65 | endif 66 | $Q$(RM) ${BOBJS} 67 | $Q$(RM) ${targetlib} 68 | $Q$(RM) ${targetlibso} 69 | 70 | distclean:: clean 71 | 72 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Make.lib: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | # 22 | # Make rules/targets for handling libraries 23 | 24 | .SECONDARY:: ${BOBJS} 25 | 26 | BOBJS_FAST = ${BOBJS} 27 | BOBJS_MAKE_CMD = 28 | 29 | ifeq ($(FAST),1) 30 | ifneq ($(strip $(BOBJS)),) 31 | BOBJS_FAST = 32 | BOBJS_ARGS = -j9 33 | BOBJS_MAKE_CMD = pwd && make LSRUN=$(SDK)/tools/lsrun.pl $(BOBJS_ARGS) ${BOBJS} 34 | endif 35 | endif 36 | 37 | ifeq ($(TOOLS),Borland) 38 | 39 | LIBSUFFIX=lib 40 | 41 | ${LIBDIR}/%.lib: ${BORLAND_BOBJS} 42 | $(RM) $@ 43 | $(FOREACH) -subdir "$(LIBDIR)" \ 44 | "tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))" 45 | 46 | else # !Borland 47 | 48 | ifeq ($(LINUX_MAKE_SHARED_LIB),1) 49 | LIBSUFFIX=so.${SHAREDLIBVER} 50 | else 51 | LIBSUFFIX=a 52 | endif 53 | 54 | targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX} 55 | 56 | all:: ${BLDDIR}/.tree ${targetlib} 57 | 58 | ${LIBDIR}/%.${LIBSUFFIX}: ${BOBJS_FAST} 59 | $(BOBJS_MAKE_CMD) 60 | ifdef QUIET 61 | @$(ECHO) Building library $(notdir $@) 62 | endif 63 | $Q$(RM) $@ 64 | ifeq ($(LINUX_MAKE_SHARED_LIB),1) 65 | $(CC) -shared -Wl,-soname,${lib}.${LIBSUFFIX}${EXTRA_LIB_LDFLAGS} -o ${targetlib} ${BOBJS} -lc 66 | else 67 | ${Q}cd $(dir $(word 1,${BOBJS}));$(AR) ${ARFLAGS} $@ $(sort $(notdir ${BOBJS})) 68 | endif 69 | 70 | endif # !Borland 71 | 72 | 73 | install:: all 74 | 75 | clean:: 76 | ifdef QUIET 77 | @$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib} 78 | endif 79 | $Q$(RM) ${BOBJS} 80 | $Q$(RM) ${targetlib} 81 | 82 | distclean:: clean 83 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Make.linux: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | # Common make targets for Linux user and kernel builds included by top 24 | # level Linux makefiles 25 | # 26 | # Variables referenced: 27 | # 28 | # LINUX_MAKE_FLAGS 29 | # Additional flags passed to Make 30 | # 31 | # LINUX_MAKE_USER 32 | # Defined: user build 33 | # Undefined: kernel build 34 | # 35 | # LINUX_MAKE_DIR 36 | # Common makefile location, if it is not ../common 37 | # 38 | # 39 | 40 | export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST)))))) 41 | 42 | ifeq (,$(kernel_version)) 43 | kernel_version=2_4 44 | endif 45 | 46 | ifndef LINUX_MAKE_SHARED_LIB 47 | LINUX_MAKE_SHARED_LIB=0 48 | endif 49 | 50 | ifeq (,$(SHAREDLIBVER)) 51 | SHAREDLIBVER=1 52 | endif 53 | 54 | ifndef LINUX_MAKE_DIR 55 | ifdef LINUX_MAKE_USER 56 | LINUX_MAKE_DIR := $(SDK)/systems/linux/user/common 57 | else 58 | LINUX_MAKE_DIR := $(SDK)/systems/linux/kernel/common 59 | endif 60 | endif 61 | 62 | ifdef LINUX_MAKE_USER 63 | CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \ 64 | platform=$(platform) bldroot_suffix=/$(platform) kernel_version=$(kernel_version) \ 65 | LINUX_MAKE_SHARED_LIB=$(LINUX_MAKE_SHARED_LIB) SHAREDLIBVER=$(SHAREDLIBVER) 66 | else 67 | export LINUX_MAKE_KERNEL := 1 68 | CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \ 69 | platform=$(platform) kernel_version=$(kernel_version) 70 | endif 71 | 72 | ifneq (,$(MIPS_TOOLS_DIR)) 73 | CMD += MIPS_TOOLS_DIR=$(MIPS_TOOLS_DIR) 74 | endif 75 | 76 | ifneq (,$(MIPS_CROSS_COMPILE)) 77 | CMD += MIPS_CROSS_COMPILE=$(MIPS_CROSS_COMPILE) 78 | endif 79 | 80 | ifneq (,$(LINUX_INCLUDE)) 81 | CMD += LINUX_INCLUDE=$(LINUX_INCLUDE) 82 | endif 83 | 84 | # gmake does not understand $(CMD) to be a submake 85 | # options are to +$(CMD) or $(MAKE) $(CMD) 86 | # trying the latter 87 | build: 88 | $(MAKE) $(CMD) 89 | 90 | DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user issu: 91 | $(MAKE) $(CMD) $@ 92 | 93 | clean_d: clean 94 | 95 | distclean: 96 | $(MAKE) $(CMD) $@ 97 | 98 | .PHONY: build clean distclean clean_d DELIVER variable mod bcm user issu 99 | 100 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Make.subdirs: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | # 22 | # Make rules/targets for handling subdirectories 23 | 24 | .PHONY: ${subdirs} 25 | 26 | all:: ${subdirs} 27 | ifdef QUIET 28 | @$(ECHO) Subdirectory build for ${subdirs} 29 | endif 30 | 31 | ${subdirs}:: 32 | $Q$(MAKE) -C $@ kernel_version=$(kernel_version) LINUX_MAKE_SHARED_LIB=${LINUX_MAKE_SHARED_LIB} SHAREDLIBVER=${SHAREDLIBVER} 33 | 34 | ifeq "$(HOSTTYPE)" "Windows2000PC" 35 | clean clean_d install distclean:: 36 | ifdef QUIET 37 | @$(ECHO) Subdirectory $@ for ${subdirs} 38 | endif 39 | $Q$(FOREACH) "$(subdirs)" "${MAKE} -C ## $@" 40 | else 41 | clean clean_d install distclean:: 42 | ifdef QUIET 43 | @$(ECHO) Subdirectory $@ for ${subdirs} 44 | endif 45 | @(for name in $(subdirs); do $(MAKE) -C $$name $@; done) 46 | endif 47 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Make.tools: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | SYSNAME := $(shell uname -s) 23 | HCC ?=/usr/bin/gcc 24 | SED = /bin/sed 25 | COMPRESS = /usr/bin/compress 26 | PERL = /usr/bin/perl 27 | LN = /bin/ln 28 | HOSTTYPE= i386-linux 29 | 30 | # 31 | # Platform Independent 32 | # 33 | MKTOOL = $(PERL) ${SDK}/tools/mktool.pl 34 | RM = $(MKTOOL) -rm 35 | MKDIR = $(MKTOOL) -md 36 | FOREACH = $(MKTOOL) -foreach 37 | CP = $(MKTOOL) -cp 38 | MAKEDEP = $(MKTOOL) -dep 39 | ECHO = $(MKTOOL) -echo 40 | MKBEEP = ${MKTOOL} -beep 41 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-gto: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # User must select one platform from below. 23 | ifeq (,$(BUILD_PLATFORM)) 24 | BUILD_PLATFORM=POWERPC_LINUX 25 | endif 26 | 27 | # TOOLCHAIN_BASE_DIR Toolchain base directory for GTO devices 28 | # TARGET_ARCHITECTURE Compiler for target architecture 29 | # KERNDIR Kernel directory for iPROC-CMICd devices 30 | TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/gto 31 | TARGET_ARCHITECTURE := powerpc-broadcom-linux-gnuspe 32 | KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/current 33 | 34 | 35 | ifeq (,$(CROSS_COMPILE)) 36 | CROSS_COMPILE := $(TARGET_ARCHITECTURE)- 37 | endif 38 | 39 | 40 | # GTO toolchain 41 | TOOLCHAIN_BIN_DIR := $(TOOLCHAIN_BASE_DIR)/toolchain/host/usr/bin 42 | override PATH := $(TOOLCHAIN_BIN_DIR)/../$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) 43 | export TOOLCHAIN_BIN_DIR 44 | 45 | 46 | # Default Linux include directory 47 | ifeq (,$(LINUX_INCLUDE)) 48 | LINUX_INCLUDE := $(KERNDIR)/include 49 | endif 50 | 51 | CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 52 | ENDIAN = BE_HOST=1 53 | CFGFLAGS += -D$(ENDIAN) 54 | CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\" 55 | CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32 56 | 57 | # Extra variables. 58 | EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) 59 | 60 | ARCH = powerpc 61 | KBUILD_VERBOSE = 1 62 | 63 | export ARCH KBUILD_VERBOSE 64 | 65 | 66 | # From linux/arch/ppc/Makefile 67 | comma = , 68 | basetarget = $(basename $(notdir $@)) 69 | modname = $(basetarget) 70 | 71 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) 72 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" 73 | modname_flags = $(if $(filter 1,$(words $(modname))),\ 74 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 75 | 76 | KFLAG_INCLD = $(TOOLCHAIN_BIN_DIR)/../lib/gcc/$(TARGET_ARCHITECTURE)/4.6.4/include 77 | 78 | ifdef BROADCOM_SVK 79 | ifeq ($PLX_PCI2LBUS, 1) 80 | CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE 81 | endif 82 | endif 83 | 84 | ifdef DPP_CHIPS 85 | CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ 86 | CFGFLAGS += -DSOC_CM_FUNCTION 87 | endif 88 | 89 | ifdef DFE_CHIPS 90 | CFLAGS += -DDUNE_BCM 91 | CFGFLAGS += -DSOC_CM_FUNCTION 92 | endif 93 | 94 | ifdef SAND_CHIPS 95 | CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ 96 | endif 97 | 98 | ifdef SHADOW_PLX 99 | CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK 100 | endif 101 | 102 | ifdef LTSW_CHIPS 103 | # Default open source target build 104 | OPENSRC_BUILD ?= uclibc_201402_ppc 105 | 106 | # Hardware interface (see $SDKLT/bcma/sys/probe directory) 107 | SYSTEM_INTERFACE ?= ngbde 108 | 109 | # Turn on direct register access if running on real hardware. 110 | ifeq (ngbde,$(SYSTEM_INTERFACE)) 111 | LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1 112 | endif 113 | 114 | export SYSTEM_INTERFACE 115 | endif 116 | 117 | ifeq (,$(KFLAGS)) 118 | 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 119 | endif 120 | 121 | ifneq (,$(findstring TCL,$(FEATURE_LIST))) 122 | #LINK_STATIC = 0 123 | #export LINK_STATIC 124 | endif 125 | 126 | ifneq ($(targetplat),user) 127 | include ${SDK}/make/Makefile.linux-kernel-4_4 128 | endif 129 | 130 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-iproc-4_4: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | # Makefile for iproc-CMICd 22 | 23 | # User must select one platform from below.By default ARM_LINUX is selected. . 24 | ifeq (,$(BUILD_PLATFORM)) 25 | BUILD_PLATFORM=ARM_LINUX 26 | endif 27 | 28 | # TOOLCHAIN_BASE_DIR Toolchain base directory for iPROC-CMICd devices 29 | # TARGET_ARCHITECTURE Compiler for target architecture 30 | # KERNDIR Kernel directory for iPROC-CMICd devices 31 | ifeq (BE,$(ENDIAN_MODE)) 32 | TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk40-be/XLDK 33 | TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi 34 | KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux 35 | else 36 | TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk40/XLDK 37 | TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi 38 | KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux 39 | endif 40 | 41 | ifeq (,$(CROSS_COMPILE)) 42 | CROSS_COMPILE:= $(TARGET_ARCHITECTURE)- 43 | endif 44 | 45 | # arm9tools 46 | TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/bin 47 | override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) 48 | LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib 49 | 50 | export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH 51 | 52 | # Default Linux include directory 53 | ifeq (,$(LINUX_INCLUDE)) 54 | LINUX_INCLUDE := $(KERNDIR)/include 55 | endif 56 | 57 | ifeq (BE,$(ENDIAN_MODE)) 58 | CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 59 | ENDIAN = BE_HOST=1 60 | else 61 | CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0 62 | ENDIAN = LE_HOST=1 63 | endif 64 | 65 | CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD 66 | CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\" 67 | 68 | ARCH = arm 69 | KBUILD_VERBOSE = 1 70 | 71 | export ARCH KBUILD_VERBOSE 72 | 73 | comma = , 74 | basetarget = $(basename $(notdir $@)) 75 | modname = $(basetarget) 76 | 77 | # Extra variables. 78 | EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) 79 | 80 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) 81 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" 82 | modname_flags = $(if $(filter 1,$(words $(modname))),\ 83 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 84 | 85 | KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.3/include 86 | 87 | ifeq (,$(KFLAGS)) 88 | 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 89 | KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi 90 | endif 91 | 92 | ifneq ($(targetplat),user) 93 | include ${SDK}/make/Makefile.linux-kernel-3_6 94 | endif 95 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-kernel: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # Configuration Flags 23 | 24 | # Filter out features that cannot or should not be supported in kernel mode 25 | _FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT 26 | FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) 27 | # Tools 28 | 29 | CC = $(CROSS_COMPILE)gcc 30 | CXX = $(CROSS_COMPILE)g++ 31 | LD = $(CROSS_COMPILE)ld 32 | AR = $(CROSS_COMPILE)ar 33 | ARFLAGS = -rc 34 | STRIP = $(CROSS_COMPILE)strip 35 | RANLIB = $(CROSS_COMPILE)ranlib 36 | OBJCOPY = $(CROSS_COMPILE)objcopy 37 | 38 | # Handle differences between gcc 2.x and gcc 3.x 39 | gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi) 40 | 41 | # Configuration Variables 42 | 43 | # OSType Defines: This defines the type of RTOS or microkernel which you 44 | # are compiling the SAL (and its associated driver) for. New platforms 45 | # can be created by porting the routines (system.c) to your platform and 46 | # adding the define in this Makefile. 47 | 48 | OSTYPE = LINUX 49 | 50 | # 51 | # ORIGIN is used to Optionally select different CFLAGS. It is used to import 52 | # source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added 53 | # to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT 54 | # added. 55 | # 56 | # Default specifies Broadcom 57 | # 58 | ifndef ORIGIN 59 | ORIGIN = Broadcom 60 | endif 61 | 62 | # 63 | # STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations 64 | # BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files 65 | # OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of 66 | # this Makefile, to define local "Extra" flags. 67 | # 68 | 69 | CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ 70 | -I$(SDK)/systems/bde/linux/include \ 71 | -I$(LINUX_INCLUDE) 72 | 73 | CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE 74 | 75 | CFGFLAGS += -D$(OSTYPE) 76 | 77 | # No user sal for the linux kernel 78 | # NO_SAL_APPL=1 79 | 80 | STD_CFLAGS = $(KFLAGS) $(CFGFLAGS) 81 | 82 | 83 | STD_CPPFLAGS = ${STD_CFLAGS} 84 | STD_CXXFLAGS = ${STD_CFLAGS} 85 | 86 | BCM_CFLAGS = -Wall -Werror 87 | BCM_CPPFLAGS = ${BCM_CFLAGS} 88 | BCM_CXXFLAGS = ${BCM_CFLAGS} 89 | 90 | ifeq (${ORIGIN}, Broadcom) 91 | CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS} 92 | CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS} 93 | CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS} 94 | else 95 | CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS} 96 | CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS} 97 | CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS} 98 | endif 99 | 100 | # 101 | # Ignore pedantic flag for kernel modules 102 | # 103 | ifdef DEBUG_PEDANTIC 104 | DEBUG_PEDANTIC = FALSE 105 | endif 106 | 107 | # 108 | # DEPEND is used as a command to generate the list of dependencies. 109 | # The format of the output must be 110 | # "file.o : file.c a/b/c.h d/e/f.h ...", 111 | # if it is on multiple lines, each line must end in a backslash. 112 | # The output MUST be on standard out. 113 | # 114 | DEPEND = ${CC} -M $(CFLAGS) $< 115 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-kmodule: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # Due to the extensive use of driver libraries, the SDK usually builds 23 | # kernel modules from a precompiled object. To avoid various warnings 24 | # and conflicts, the pre-compiled object must be named differently 25 | # from the target module, and the object file itself should be 26 | # appended with "_shipped". 27 | 28 | # If a module exports any symbols, then the exporting source file must 29 | # be compiled within the kernel source tree for correct generation of 30 | # module symbol versions. The symbol source file should be passed to 31 | # this Makefile via the MODULE_SYM variable. 32 | 33 | MODULE := $(MOD_NAME).o 34 | KMODULE := $(MOD_NAME).ko 35 | PRE_COMPILED_OBJ := obj_$(MOD_NAME).o 36 | 37 | obj-m := $(MODULE) 38 | $(MOD_NAME)-y := $(MODULE_SYM) $(PRE_COMPILED_OBJ) 39 | 40 | 41 | ifeq (,$(CROSS_COMPILE)) 42 | 43 | export CROSS_COMPILE 44 | 45 | endif 46 | 47 | SAVE_CFLAGS := ${CFLAGS} 48 | 49 | include $(SDK)/make/Make.config 50 | 51 | PWD := $(shell pwd) 52 | 53 | ifneq ($(ARCH),) 54 | # ELDK does not seem to `automatically' define ARCH where other gccs may 55 | A := ARCH=$(ARCH) 56 | export ARCH 57 | endif 58 | 59 | # Provide an option in case kernel was built in separate directory 60 | KERNBLDDIR ?= $(KERNDIR) 61 | 62 | # Standard SDK include path for building source files that export 63 | # kernel symbols. 64 | 65 | override EXTRA_CFLAGS = -I${SDK}/include -I${SDK}/systems/linux/kernel/modules/include -I${SDK}/systems/bde/linux/include 66 | 67 | # The precopiled object needs a dummy command file to avoid warnings 68 | # from the Kbuild scripts (modpost stage). 69 | # Kernels before 2.6.17 do not support external module symbols files, 70 | # so we create a dummy to prevent build failures. 71 | 72 | $(KMODULE): 73 | rm -f *.o *.ko .*.cmd 74 | rm -fr .tmp_versions 75 | ln -s $(LIBDIR)/$(MODULE) $(PRE_COMPILED_OBJ)_shipped 76 | if [ ! -f $(KERNBLDDIR)/NO_SUPRESS ]; then echo "# suppress warning" > .$(PRE_COMPILED_OBJ).cmd; fi 77 | $(MAKE) -C $(KERNBLDDIR) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules 78 | if [ ! -f Module.symvers ]; then echo "old kernel (pre-2.6.17)" > Module.symvers; fi 79 | cp -f $(KMODULE) $(LIBDIR) 80 | rm -f $(PRE_COMPILED_OBJ)_shipped 81 | 82 | EXTRA_CFLAGS = $(CFLAGS) 83 | CFLAGS := ${SAVE_CFLAGS} 84 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-nsx-2_6: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # Look for custom tools 23 | ifneq (,$(MIPS_TOOLS_DIR)) 24 | override PATH := $(MIPS_TOOLS_DIR):$(PATH) 25 | endif 26 | ifneq (,$(MIPS_CROSS_COMPILE)) 27 | override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) 28 | endif 29 | 30 | # Default tools 31 | ifeq (,$(CROSS_COMPILE)) 32 | CROSS_COMPILE := mips2_fp_be- 33 | override PATH := $(PATH):/projects/ntsw-tools/linux/mvista/mvista-4.0/pro/devkit/mips/mips2_fp_be/bin 34 | endif 35 | 36 | # Default Linux Kernel directory 37 | ifeq (,$(KERNDIR)) 38 | KERNDIR := /projects/ntsw-tools/linux/mvista/mvista-4.0-nsx/linux-2.6.10_dev 39 | endif 40 | # Default Linux include directory 41 | ifeq (,$(LINUX_INCLUDE)) 42 | LINUX_INCLUDE := $(KERNDIR)/include 43 | endif 44 | 45 | CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 46 | ENDIAN = BE_HOST=1 47 | CFGFLAGS += -D$(ENDIAN) 48 | CFGFLAGS += -DBCM_PLATFORM_STRING=\"NSX_BCM1125\" 49 | 50 | # From linux/arch/mips/Makefile 51 | 52 | ifeq (,$(KFLAGS)) 53 | KFLAGS := -D__KERNEL__ -O2 -fomit-frame-pointer -fno-strict-aliasing -G 0 -mno-abicalls -fno-pic -mips64 -mtune=sb1 -Wa,--trap -pipe -mlong-calls 54 | endif 55 | 56 | ifneq ($(targetplat),user) 57 | include ${SDK}/make/Makefile.linux-kernel-2_6 58 | endif 59 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-nsx64: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # Look for custom tools 23 | ifneq (,$(MIPS_TOOLS_DIR)) 24 | override PATH := $(MIPS_TOOLS_DIR):$(PATH) 25 | endif 26 | ifneq (,$(MIPS_CROSS_COMPILE)) 27 | override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) 28 | endif 29 | 30 | # Default tools 31 | ifeq (,$(CROSS_COMPILE)) 32 | CROSS_COMPILE := mips64_fp_be- 33 | override PATH := $(PATH):/projects/ntsw-tools/linux/mvista/mips64_be_tools-3.1/bin 34 | endif 35 | 36 | # Default Linux include directory 37 | ifeq (,$(LINUX_INCLUDE)) 38 | LINUX_INCLUDE = /projects/ntsw-tools/linux/headers/mvl-3.1-nsx64/include 39 | endif 40 | 41 | CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 42 | ENDIAN = BE_HOST=1 43 | CFGFLAGS += -D$(ENDIAN) -Wa,-xgot -mips64 -mabi=64 -fno-strict-aliasing -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS 44 | CFGFLAGS += -DBCM_PLATFORM_STRING=\"NSX_BCM1125\" 45 | 46 | # From linux/arch/mips/Makefile 47 | 48 | ifeq (,$(KFLAGS)) 49 | KFLAGS := -D__KERNEL__ -O2 -fomit-frame-pointer -fno-strict-aliasing -G 0 -mno-abicalls -fno-pic -mips64 -mabi=64 -mtune=sb1 -Wa,--trap -pipe -mlong-calls 50 | endif 51 | 52 | ifneq ($(targetplat),user) 53 | include ${SDK}/make/Makefile.linux-kernel 54 | endif 55 | 56 | MODULE_LDFLAGS += -m elf64btsmip 57 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-raptor: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # Look for custom tools 23 | ifneq (,$(MIPS_TOOLS_DIR)) 24 | override PATH := $(MIPS_TOOLS_DIR):$(PATH) 25 | endif 26 | ifneq (,$(MIPS_CROSS_COMPILE)) 27 | override CROSS_COMPILE := $(MIPS_CROSS_COMPILE) 28 | endif 29 | 30 | # Default tools 31 | ifeq (,$(CROSS_COMPILE)) 32 | CROSS_COMPILE := mips_fp_be- 33 | override PATH := $(PATH):/projects/ntsw-tools/linux/mvista/mvista-3.1/pro/devkit/mips/fp_be/bin 34 | endif 35 | 36 | # Default Linux include directory 37 | ifeq (,$(LINUX_INCLUDE)) 38 | LINUX_INCLUDE = /projects/ntsw-tools/linux/headers/mvl-3.1-raptor/include 39 | endif 40 | 41 | CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=1 -DSYS_BE_OTHER=0 -DBCM_ICS 42 | ENDIAN = BE_HOST=1 43 | CFGFLAGS += -D$(ENDIAN) 44 | CFGFLAGS += -DBCM_PLATFORM_STRING=\"Raptor_BCM56218\" 45 | 46 | 47 | ifneq ($(targetplat),user) 48 | include ${SDK}/make/Makefile.linux-kernel 49 | endif 50 | 51 | # From linux/arch/mips/Makefile 52 | 53 | ifeq (,$(KFLAGS)) 54 | KFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -m$(gcc-tune-flag)=r4600 -mips2 -Wa,--trap -mlong-calls 55 | endif 56 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-x86-common-2_6: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0 23 | ENDIAN = LE_HOST=1 24 | CFGFLAGS += -D$(ENDIAN) 25 | CFGFLAGS += -DBCM_PLATFORM_STRING=\"X86\" 26 | ifeq (,$(findstring -DSAL_BDE_DMA_MEM_DEFAULT,$(CFGFLAGS))) 27 | CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=16 28 | endif 29 | 30 | # Extra variables. 31 | EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) 32 | 33 | comma = , 34 | basetarget = $(basename $(notdir $@)) 35 | modname = $(basetarget) 36 | 37 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) 38 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" 39 | modname_flags = $(if $(filter 1,$(words $(modname))),\ 40 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 41 | 42 | ifneq ($(targetplat),user) 43 | # By default we exclude -Werror from x86 kernel builds 44 | BCM_CFLAGS = -Wall 45 | include ${SDK}/make/Makefile.linux-kernel-2_6 46 | endif 47 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-x86-generic-common-2_6: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | # Default kernel source directory 23 | ifeq (,$(KERNDIR)) 24 | KERNDIR := /lib/modules/$(shell uname -r)/build 25 | export KERNDIR 26 | endif 27 | 28 | # Default architecture 29 | ifeq (,$(ARCH)) 30 | ARCH = $(shell uname -p) 31 | ifneq (x86_64,$(ARCH)) 32 | ARCH = i386 33 | endif 34 | endif 35 | 36 | # Noisy kernel build 37 | KBUILD_VERBOSE = 1 38 | 39 | export ARCH KBUILD_VERBOSE KERNDIR 40 | 41 | # Default Linux include directory 42 | ifeq (,$(LINUX_INCLUDE)) 43 | LINUX_INCLUDE := $(KERNDIR)/include 44 | endif 45 | 46 | # autoconf.h was moved in later kernels 47 | AUTOCONF = $(KERNDIR)/include/generated/autoconf.h 48 | ifeq (,$(shell ls $(AUTOCONF) 2>/dev/null)) 49 | AUTOCONF = $(KERNDIR)/include/linux/autoconf.h 50 | endif 51 | 52 | # gcc system include path 53 | SYSINC = $(shell gcc -print-search-dirs | grep install | cut -c 10-)include 54 | -------------------------------------------------------------------------------- /src/gpl-modules/make/Makefile.linux-x86-smp_generic_64-2_6: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # 17 | # This software is governed by the Broadcom Switch APIs license. 18 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 19 | # 20 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 21 | 22 | CFGFLAGS += -DLONGS_ARE_64BITS 23 | CFGFLAGS += -DPTRS_ARE_64BITS 24 | CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS 25 | CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ 26 | 27 | include ${SDK}/make/Makefile.linux-x86-generic-common-2_6 28 | 29 | ifeq (,$(KFLAGS)) 30 | KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign 31 | endif 32 | 33 | 34 | LINUX_UAPI = $(LINUX_INCLUDE)/uapi 35 | ifneq (,$(shell ls $(LINUX_UAPI) 2>/dev/null)) 36 | 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 37 | endif 38 | 39 | include ${SDK}/make/Makefile.linux-x86-common-2_6 40 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/include/linux_dma.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /*********************************************************************** 17 | * 18 | * 19 | * This software is governed by the Broadcom Switch APIs license. 20 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 21 | * 22 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 23 | */ 24 | 25 | #ifndef __LINUX_DMA_H__ 26 | #define __LINUX_DMA_H__ 27 | 28 | #include 29 | 30 | #ifdef __KERNEL__ 31 | 32 | #ifdef SAL_BDE_XLP 33 | #define KMALLOC(size, flags) __kmalloc(size, flags) 34 | #else 35 | #define KMALLOC(size, flags) kmalloc(size, flags) 36 | #endif 37 | 38 | #if defined(CONFIG_IDT_79EB334) || defined(CONFIG_BCM4702) 39 | /* ioremap is broken in kernel */ 40 | #define IOREMAP(addr, size) ((void *)KSEG1ADDR(addr)) 41 | #else 42 | #define IOREMAP(addr, size) ioremap_nocache(addr, size) 43 | #endif 44 | 45 | #if defined (__mips__) 46 | #if defined(CONFIG_NONCOHERENT_IO) || defined(CONFIG_DMA_NONCOHERENT) 47 | /* Use flush/invalidate for cached memory */ 48 | #define NONCOHERENT_DMA_MEMORY 49 | /* Remap virtual DMA addresses to non-cached segment */ 50 | #define REMAP_DMA_NONCACHED 51 | #endif /* CONFIG_NONCOHERENT_IO || CONFIG_DMA_NONCOHERENT */ 52 | #endif /* __mips__ */ 53 | 54 | #if defined(BCM958525) && (LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,5)) 55 | #define REMAP_DMA_NONCACHED 56 | #endif 57 | 58 | #ifndef DMA_BIT_MASK 59 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 60 | #endif 61 | 62 | extern void _dma_init(int dev_index); 63 | extern int _dma_cleanup(void); 64 | extern void _dma_pprint(void); 65 | extern uint32_t *_salloc(int d, int size, const char *name); 66 | extern void _sfree(int d, void *ptr); 67 | extern int _sinval(int d, void *ptr, int length); 68 | extern int _sflush(int d, void *ptr, int length); 69 | extern sal_paddr_t _l2p(int d, void *vaddr); 70 | extern void *_p2l(int d, sal_paddr_t paddr); 71 | extern int _dma_pool_allocated(void); 72 | extern int _dma_mmap(struct file *filp, struct vm_area_struct *vma); 73 | 74 | #endif /* __KERNEL__ */ 75 | 76 | #endif /* __LINUX_DMA_H__ */ 77 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/include/mpool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __MPOOL_H__ 25 | #define __MPOOL_H__ 26 | 27 | struct mpool_mem_s; 28 | typedef struct mpool_mem_s* mpool_handle_t; 29 | 30 | extern int mpool_init(void); 31 | extern mpool_handle_t mpool_create(void* base_address, int size); 32 | extern void* mpool_alloc(mpool_handle_t pool, int size); 33 | extern void mpool_free(mpool_handle_t pool, void* ptr); 34 | extern int mpool_destroy(mpool_handle_t pool); 35 | 36 | extern int mpool_usage(mpool_handle_t pool); 37 | 38 | #endif /* __MPOOL_H__ */ 39 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/kernel/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | # Makefile for Linux kernel BDE 24 | # 25 | LOCALDIR = systems/bde/linux/kernel 26 | 27 | # Make sure we build for the kernel if this is a user-mode build 28 | ifneq ($(platform), ) 29 | override-target=linux-$(platform) 30 | endif 31 | 32 | include $(SDK)/make/Make.config 33 | 34 | LIBS = $(LIBDIR)/libkern.a 35 | 36 | BDE = linux-kernel-bde.o 37 | 38 | # need to add vpath sources 39 | VPATH = ../shared 40 | 41 | # Add the srcs to be found by vpath 42 | LSRCS += mpool.c 43 | 44 | # Add shared BDE sources 45 | VPATH += ../../shared 46 | LSRCS += shbde_pci.c shbde_iproc.c shbde_mdio.c 47 | CFLAGS += -I../../shared/include 48 | 49 | LHDRS += mpool.h 50 | LOBJS = $(addsuffix .o, $(basename $(LSRCS))) 51 | BOBJS = $(addprefix $(BLDDIR)/,$(LOBJS)) 52 | 53 | ifneq ($(kernel_version),2_4) 54 | KERNEL_MODULE_DIR = kernel_module 55 | 56 | THIS_MOD_NAME := linux-kernel-bde 57 | MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o 58 | KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko 59 | 60 | build: kernel_libs $(MODULE) $(KMODULE) 61 | else 62 | MODULE = $(LIBDIR)/linux-kernel-bde.o 63 | 64 | build: kernel_libs $(MODULE) 65 | endif 66 | 67 | $(MODULE): $(BLDDIR)/.tree kernel_libs $(BOBJS) 68 | mkdir -p $(@D) 69 | $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ 70 | ifneq ($(kernel_version),2_4) 71 | $(KMODULE): $(MODULE) 72 | rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) 73 | mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) 74 | cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile 75 | MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko 76 | endif 77 | 78 | kernel_libs: 79 | $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared 80 | 81 | include $(SDK)/make/Make.depend 82 | 83 | # Make.depend is before clean:: so that Make.depend's clean:: runs first. 84 | 85 | clean:: 86 | $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@ 87 | $(RM) $(BOBJS) $(MODULE) 88 | $(RM) $(BLDDIR)/$(KERNEL_MODULE_DIR) 89 | 90 | distclean:: 91 | 92 | ifneq ($(kernel_version),2_4) 93 | .PHONY: build kernel_libs 94 | endif 95 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/kernel/linux_shbde.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "linux_shbde.h" 28 | 29 | /* Hardware abstractions for shared BDE functions */ 30 | 31 | static unsigned short 32 | linux_pcic16_read(void *pci_dev, unsigned int addr) 33 | { 34 | u16 data = 0; 35 | 36 | pci_read_config_word((struct pci_dev *)pci_dev, addr, &data); 37 | 38 | return data; 39 | } 40 | 41 | static void 42 | linux_pcic16_write(void *pci_dev, unsigned int addr, unsigned short data) 43 | { 44 | pci_write_config_word((struct pci_dev *)pci_dev, addr, (u16)data); 45 | } 46 | 47 | static unsigned int 48 | linux_pcic32_read(void *pci_dev, unsigned int addr) 49 | { 50 | u32 data = 0; 51 | 52 | pci_read_config_dword((struct pci_dev *)pci_dev, addr, &data); 53 | 54 | return data; 55 | } 56 | 57 | static void 58 | linux_pcic32_write(void *pci_dev, unsigned int addr, unsigned int data) 59 | { 60 | pci_write_config_dword((struct pci_dev *)pci_dev, addr, (u32)data); 61 | } 62 | 63 | static unsigned int 64 | linux_io32_read(void *addr) 65 | { 66 | return *((volatile u32 *)addr); 67 | } 68 | 69 | static void 70 | linux_io32_write(void *addr, unsigned int data) 71 | { 72 | *((volatile u32 *)addr) = data; 73 | } 74 | 75 | static void 76 | linux_usleep(int usec) 77 | { 78 | udelay(usec); 79 | } 80 | 81 | 82 | /* To get the PCI parent device under linux, from only the device pointer */ 83 | static void * 84 | linux_pci_parent_device_get(void *pci_dev) 85 | { 86 | return (void *)(((struct pci_dev *)pci_dev)->bus->self); 87 | } 88 | 89 | 90 | /* 91 | * Function: 92 | * linux_shbde_hal_init 93 | * Purpose: 94 | * Initialize hardware abstraction module for Linux kernel. 95 | * Parameters: 96 | * shbde - pointer to uninitialized hardware abstraction module 97 | * log_func - optional log output function 98 | * Returns: 99 | * Always 0 100 | */ 101 | int 102 | linux_shbde_hal_init(shbde_hal_t *shbde, shbde_log_func_t log_func) 103 | { 104 | memset(shbde, 0, sizeof(*shbde)); 105 | 106 | shbde->log_func = log_func; 107 | 108 | shbde->pcic16_read = linux_pcic16_read; 109 | shbde->pcic16_write = linux_pcic16_write; 110 | shbde->pcic32_read = linux_pcic32_read; 111 | shbde->pcic32_write = linux_pcic32_write; 112 | 113 | shbde->io32_read = linux_io32_read; 114 | shbde->io32_write = linux_io32_write; 115 | 116 | shbde->usleep = linux_usleep; 117 | 118 | shbde->pci_parent_device_get = linux_pci_parent_device_get; 119 | 120 | return 0; 121 | } 122 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/kernel/linux_shbde.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __LINUX_SHBDE_H__ 25 | #define __LINUX_SHBDE_H__ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | extern int 32 | linux_shbde_hal_init(shbde_hal_t *shbde, shbde_log_func_t log_func); 33 | 34 | #endif /* __LINUX_SHBDE_H__ */ 35 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/user/kernel/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | LOCALDIR = systems/bde/linux/user/kernel 24 | 25 | # Make sure we build for the kernel if this is a user-mode build 26 | ifneq ($(platform), ) 27 | override-target=linux-$(platform) 28 | endif 29 | 30 | include $(SDK)/make/Make.config 31 | 32 | LIBS = $(LIBDIR)/libkern.a 33 | 34 | ifneq ($(kernel_version),2_4) 35 | KERNEL_MODULE_DIR = kernel_module 36 | 37 | THIS_MOD_NAME := linux-user-bde 38 | MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o 39 | KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko 40 | 41 | build: kernel_libs $(MODULE) $(KMODULE) 42 | else 43 | MODULE = $(LIBDIR)/linux-user-bde.o 44 | 45 | build: kernel_libs $(MODULE) 46 | endif 47 | 48 | KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../kernel/kernel_module/Module.symvers 49 | 50 | $(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) 51 | $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ 52 | ifneq ($(kernel_version),2_4) 53 | $(KMODULE): $(MODULE) 54 | rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) 55 | mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) 56 | cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile 57 | cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers 58 | MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko 59 | endif 60 | 61 | kernel_libs: 62 | $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared 63 | 64 | include $(SDK)/make/Make.depend 65 | 66 | # Make.depend is before clean:: so that Make.depend's clean:: runs first. 67 | 68 | clean:: 69 | $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@ 70 | $(RM) $(BOBJS) $(MODULE) 71 | 72 | .PHONY: build kernel_libs 73 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/linux/user/kernel/linux-user-bde.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __LINUX_USER_BDE_H__ 25 | #define __LINUX_USER_BDE_H__ 26 | 27 | #include 28 | #include 29 | #include 30 | #ifndef __KERNEL__ 31 | #include 32 | #endif 33 | 34 | #if defined(SAL_BDE_32BIT_USER_64BIT_KERNEL) || defined(PTRS_ARE_64BITS) 35 | typedef uint64_t bde_kernel_addr_t; 36 | #else 37 | typedef uint32_t bde_kernel_addr_t; 38 | #endif 39 | 40 | /* Ioctl control structure */ 41 | typedef struct { 42 | unsigned int dev; /* Device ID */ 43 | unsigned int rc; /* Operation Return Code */ 44 | unsigned int d0; /* Operation specific data */ 45 | unsigned int d1; 46 | unsigned int d2; 47 | unsigned int d3; 48 | bde_kernel_addr_t p0; 49 | union { 50 | unsigned int dw[2]; 51 | unsigned char buf[64]; 52 | } dx; 53 | } lubde_ioctl_t; 54 | 55 | 56 | /* LUBDE ioctls */ 57 | #define LUBDE_MAGIC 'L' 58 | 59 | #define LUBDE_VERSION _IO(LUBDE_MAGIC, 0) 60 | #define LUBDE_GET_NUM_DEVICES _IO(LUBDE_MAGIC, 1) 61 | #define LUBDE_GET_DEVICE _IO(LUBDE_MAGIC, 2) 62 | #define LUBDE_PCI_CONFIG_PUT32 _IO(LUBDE_MAGIC, 3) 63 | #define LUBDE_PCI_CONFIG_GET32 _IO(LUBDE_MAGIC, 4) 64 | #define LUBDE_GET_DMA_INFO _IO(LUBDE_MAGIC, 5) 65 | #define LUBDE_ENABLE_INTERRUPTS _IO(LUBDE_MAGIC, 6) 66 | #define LUBDE_DISABLE_INTERRUPTS _IO(LUBDE_MAGIC, 7) 67 | #define LUBDE_USLEEP _IO(LUBDE_MAGIC, 8) 68 | #define LUBDE_WAIT_FOR_INTERRUPT _IO(LUBDE_MAGIC, 9) 69 | #define LUBDE_SEM_OP _IO(LUBDE_MAGIC, 10) 70 | #define LUBDE_UDELAY _IO(LUBDE_MAGIC, 11) 71 | #define LUBDE_GET_DEVICE_TYPE _IO(LUBDE_MAGIC, 12) 72 | #define LUBDE_SPI_READ_REG _IO(LUBDE_MAGIC, 13) 73 | #define LUBDE_SPI_WRITE_REG _IO(LUBDE_MAGIC, 14) 74 | #define LUBDE_READ_REG_16BIT_BUS _IO(LUBDE_MAGIC, 19) 75 | #define LUBDE_WRITE_REG_16BIT_BUS _IO(LUBDE_MAGIC, 20) 76 | #define LUBDE_GET_BUS_FEATURES _IO(LUBDE_MAGIC, 21) 77 | #define LUBDE_WRITE_IRQ_MASK _IO(LUBDE_MAGIC, 22) 78 | #define LUBDE_CPU_WRITE_REG _IO(LUBDE_MAGIC, 23) 79 | #define LUBDE_CPU_READ_REG _IO(LUBDE_MAGIC, 24) 80 | #define LUBDE_CPU_PCI_REGISTER _IO(LUBDE_MAGIC, 25) 81 | #define LUBDE_DEV_RESOURCE _IO(LUBDE_MAGIC, 26) 82 | #define LUBDE_IPROC_READ_REG _IO(LUBDE_MAGIC, 27) 83 | #define LUBDE_IPROC_WRITE_REG _IO(LUBDE_MAGIC, 28) 84 | #define LUBDE_ATTACH_INSTANCE _IO(LUBDE_MAGIC, 29) 85 | #define LUBDE_GET_DEVICE_STATE _IO(LUBDE_MAGIC, 30) 86 | #define LUBDE_REPROBE _IO(LUBDE_MAGIC, 31) 87 | 88 | #define LUBDE_SEM_OP_CREATE 1 89 | #define LUBDE_SEM_OP_DESTROY 2 90 | #define LUBDE_SEM_OP_TAKE 3 91 | #define LUBDE_SEM_OP_GIVE 4 92 | 93 | #define LUBDE_SUCCESS 0 94 | #define LUBDE_FAIL ((unsigned int)-1) 95 | 96 | 97 | /* 98 | * Version history 99 | * 1: add LUBDE_GET_DEVICE_STATE to support PCI hot plug 100 | * 2: add LUBDE_REPROBE to support reprobe available devices 101 | */ 102 | #define KBDE_VERSION 2 103 | 104 | 105 | /* This is the signal that will be used 106 | * when an interrupt occurs 107 | */ 108 | 109 | #ifndef __KERNEL__ 110 | #include 111 | #endif 112 | 113 | #define LUBDE_INTERRUPT_SIGNAL SIGUSR1 114 | #define LUBDE_ETHER_INTERRUPT_SIGNAL SIGUSR2 115 | 116 | #endif /* __LUBDE_H__ */ 117 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/shared/include/shbde.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __SHBDE_H__ 25 | #define __SHBDE_H__ 26 | 27 | typedef void (*shbde_log_func_t)(int level, const char *str, int param); 28 | 29 | #define SHBDE_ERR 0 30 | #define SHBDE_WARN 1 31 | #define SHBDE_DBG 2 32 | 33 | /* iProc configuration (primarily used for PCI-AXI bridge) */ 34 | typedef struct shbde_iproc_config_s { 35 | unsigned int dev_id; 36 | unsigned int dev_rev; 37 | unsigned int use_msi; 38 | unsigned int iproc_ver; 39 | unsigned int cmic_ver; 40 | unsigned int cmic_rev; 41 | unsigned int dma_hi_bits; 42 | unsigned int mdio_base_addr; 43 | unsigned int pcie_phy_addr; 44 | unsigned int adjust_pcie_preemphasis; 45 | } shbde_iproc_config_t; 46 | 47 | /* Hardware abstraction functions */ 48 | typedef struct shbde_hal_s { 49 | 50 | /* Optional log output interface */ 51 | shbde_log_func_t log_func; 52 | 53 | /* PCI configuration access */ 54 | unsigned char (*pcic8_read)(void *pci_dev, unsigned int reg); 55 | void (*pcic8_write)(void *pci_dev, unsigned int reg, unsigned char data); 56 | unsigned short (*pcic16_read)(void *pci_dev, unsigned int reg); 57 | void (*pcic16_write)(void *pci_dev, unsigned int reg, unsigned short data); 58 | unsigned int (*pcic32_read)(void *pci_dev, unsigned int reg); 59 | void (*pcic32_write)(void *pci_dev, unsigned int reg, unsigned int data); 60 | 61 | /* iProc register access */ 62 | unsigned int (*io32_read)(void *addr); 63 | void (*io32_write)(void *addr, unsigned int); 64 | 65 | /* usleep function (optional) */ 66 | void (*usleep)(int usec); 67 | 68 | /* PCI parent device access */ 69 | void *(*pci_parent_device_get)(void *pci_dev); 70 | 71 | /* iProc configuration */ 72 | shbde_iproc_config_t icfg; 73 | 74 | } shbde_hal_t; 75 | 76 | 77 | #endif /* __SHBDE_H__ */ 78 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/shared/include/shbde_iproc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __SHBDE_IPROC_H__ 25 | #define __SHBDE_IPROC_H__ 26 | 27 | #include 28 | 29 | extern int 30 | shbde_iproc_config_init(shbde_iproc_config_t *icfg, 31 | unsigned int dev_id, unsigned int dev_rev); 32 | 33 | extern int 34 | shbde_iproc_paxb_init(shbde_hal_t *shbde, void *iproc_regs, 35 | shbde_iproc_config_t *icfg); 36 | 37 | extern unsigned int 38 | shbde_iproc_pci_read(shbde_hal_t *shbde, void *iproc_regs, 39 | unsigned int addr); 40 | 41 | extern void 42 | shbde_iproc_pci_write(shbde_hal_t *shbde, void *iproc_regs, 43 | unsigned int addr, unsigned int data); 44 | 45 | extern int 46 | shbde_iproc_pcie_preemphasis_set(shbde_hal_t *shbde, void *iproc_regs, 47 | shbde_iproc_config_t *icfg, void *pci_dev); 48 | 49 | #endif /* __SHBDE_IPROC_H__ */ 50 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/shared/include/shbde_mdio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __SHBDE_MDIO_H__ 25 | #define __SHBDE_MDIO_H__ 26 | 27 | #include 28 | 29 | typedef struct shbde_mdio_ctrl_s { 30 | 31 | /* Primary HAL*/ 32 | shbde_hal_t *shbde; 33 | 34 | /* Context for iProc MDIO register access */ 35 | void *regs; 36 | 37 | /* Base address for MDIO registers */ 38 | unsigned int base_addr; 39 | 40 | /* iProc MDIO register access */ 41 | unsigned int (*io32_read)(shbde_hal_t *shbde, void *iproc_regs, 42 | unsigned int addr); 43 | void (*io32_write)(shbde_hal_t *shbde, void *iproc_regs, 44 | unsigned int addr, unsigned int data); 45 | 46 | } shbde_mdio_ctrl_t; 47 | 48 | 49 | extern int 50 | shbde_iproc_mdio_init(shbde_mdio_ctrl_t *smc); 51 | 52 | extern int 53 | shbde_iproc_mdio_read(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, 54 | unsigned int reg, unsigned int *val); 55 | 56 | extern int 57 | shbde_iproc_mdio_write(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, 58 | unsigned int reg, unsigned int val); 59 | 60 | #endif /* __SHBDE_MDIO_H__ */ 61 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/bde/shared/include/shbde_pci.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __SHBDE_PCI_H__ 25 | #define __SHBDE_PCI_H__ 26 | 27 | #include 28 | 29 | extern unsigned int 30 | shbde_pci_pcie_cap(shbde_hal_t *shbde, void *pci_dev); 31 | 32 | extern int 33 | shbde_pci_is_pcie(shbde_hal_t *shbde, void *pci_dev); 34 | 35 | extern int 36 | shbde_pci_is_iproc(shbde_hal_t *shbde, void *pci_dev, int *cmic_bar); 37 | 38 | extern int 39 | shbde_pci_max_payload_set(shbde_hal_t *shbde, void *pci_dev, int maxpayload); 40 | 41 | extern int 42 | shbde_pci_iproc_version_get(shbde_hal_t *shbde, void *pci_dev, 43 | unsigned int *iproc_ver, 44 | unsigned int *cmic_ver, 45 | unsigned int *cmic_rev); 46 | 47 | #endif /* __SHBDE_PCI_H__ */ 48 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | # Makefile for SOC SAL support 24 | # 25 | LOCALDIR = systems/linux/kernel/modules 26 | 27 | include ${SDK}/make/Make.config 28 | 29 | subdirs= 30 | 31 | include ${SDK}/make/Make.subdirs 32 | 33 | include ${SDK}/make/Make.depend 34 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/bcm-knet/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | LOCALDIR = systems/linux/kernel/modules/bcm-knet 24 | 25 | include ${SDK}/make/Make.config 26 | 27 | LIBS = $(LIBDIR)/libkern.a 28 | 29 | ifeq ($(kernel_version),2_4) 30 | MODULE = $(LIBDIR)/linux-bcm-knet.o 31 | else 32 | KERNEL_MODULE_DIR = kernel_module 33 | 34 | THIS_MOD_NAME := linux-bcm-knet 35 | MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o 36 | KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko 37 | 38 | build: $(MODULE) $(KMODULE) 39 | endif 40 | 41 | KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers 42 | 43 | # BCM Network Device 44 | 45 | $(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) 46 | $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ 47 | ifneq ($(kernel_version),2_4) 48 | $(KMODULE): $(MODULE) 49 | rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) 50 | mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) 51 | cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile 52 | cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers 53 | MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko 54 | endif 55 | 56 | # Make.depend is before clean:: so that Make.depend's clean:: runs first. 57 | 58 | include ${SDK}/make/Make.depend 59 | 60 | clean:: 61 | $(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o 62 | $(RM) $(BOBJS) $(MODULE) 63 | 64 | ifneq ($(kernel_version),2_4) 65 | .PHONY: build 66 | endif 67 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/include/bcm-knet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | #ifndef __LINUX_BCM_KNET_H__ 24 | #define __LINUX_BCM_KNET_H__ 25 | 26 | #ifndef __KERNEL__ 27 | #include 28 | #endif 29 | 30 | typedef struct { 31 | int rc; 32 | int len; 33 | int bufsz; 34 | int reserved; 35 | uint64_t buf; 36 | } bkn_ioctl_t; 37 | 38 | #ifdef __KERNEL__ 39 | 40 | /* 41 | * Call-back interfaces for other Linux kernel drivers. 42 | */ 43 | #include 44 | 45 | typedef struct { 46 | uint32 netif_user_data; 47 | uint32 filter_user_data; 48 | uint16 dcb_type; 49 | int port; 50 | } knet_skb_cb_t; 51 | 52 | #define KNET_SKB_CB(_skb) ((knet_skb_cb_t *)_skb->cb) 53 | 54 | typedef struct sk_buff * 55 | (*knet_skb_cb_f)(struct sk_buff *skb, int dev_no, void *meta); 56 | 57 | typedef int 58 | (*knet_filter_cb_f)(uint8_t *pkt, int size, int dev_no, void *meta, 59 | int chan, kcom_filter_t *filter); 60 | 61 | typedef int 62 | (*knet_hw_tstamp_enable_cb_f)(int dev_no, int port); 63 | 64 | typedef int 65 | (*knet_hw_tstamp_tx_time_get_cb_f)(int dev_no, int port, uint8_t *pkt, uint64_t *ts); 66 | 67 | typedef int 68 | (*knet_hw_tstamp_tx_meta_get_cb_f)(int dev_no, struct sk_buff *skb, uint32_t **md); 69 | 70 | typedef int 71 | (*knet_hw_tstamp_ptp_clock_index_cb_f)(int dev_no); 72 | 73 | typedef int 74 | (*knet_hw_tstamp_rx_time_upscale_cb_f)(int dev_no, uint64_t *ts); 75 | 76 | extern int 77 | bkn_rx_skb_cb_register(knet_skb_cb_f rx_cb); 78 | 79 | extern int 80 | bkn_rx_skb_cb_unregister(knet_skb_cb_f rx_cb); 81 | 82 | extern int 83 | bkn_tx_skb_cb_register(knet_skb_cb_f tx_cb); 84 | 85 | extern int 86 | bkn_tx_skb_cb_unregister(knet_skb_cb_f tx_cb); 87 | 88 | extern int 89 | bkn_filter_cb_register(knet_filter_cb_f filter_cb); 90 | 91 | extern int 92 | bkn_filter_cb_unregister(knet_filter_cb_f filter_cb); 93 | 94 | extern int 95 | bkn_hw_tstamp_enable_cb_register(knet_hw_tstamp_enable_cb_f hw_tstamp_enable_cb); 96 | 97 | extern int 98 | bkn_hw_tstamp_enable_cb_unregister(knet_hw_tstamp_enable_cb_f hw_tstamp_enable_cb); 99 | 100 | extern int 101 | bkn_hw_tstamp_disable_cb_register(knet_hw_tstamp_enable_cb_f hw_tstamp_disable_cb); 102 | 103 | extern int 104 | bkn_hw_tstamp_disable_cb_unregister(knet_hw_tstamp_enable_cb_f hw_tstamp_disable_cb); 105 | 106 | extern int 107 | bkn_hw_tstamp_tx_time_get_cb_register(knet_hw_tstamp_tx_time_get_cb_f hw_tstamp_tx_time_get_cb); 108 | 109 | extern int 110 | bkn_hw_tstamp_tx_time_get_cb_unregister(knet_hw_tstamp_tx_time_get_cb_f hw_tstamp_tx_time_get_cb); 111 | 112 | extern int 113 | bkn_hw_tstamp_tx_meta_get_cb_register(knet_hw_tstamp_tx_meta_get_cb_f hw_tstamp_tx_meta_get_cb); 114 | 115 | extern int 116 | bkn_hw_tstamp_tx_meta_get_cb_unregister(knet_hw_tstamp_tx_meta_get_cb_f hw_tstamp_tx_meta_get_cb); 117 | 118 | extern int 119 | bkn_hw_tstamp_ptp_clock_index_cb_register(knet_hw_tstamp_ptp_clock_index_cb_f hw_tstamp_ptp_clock_index_cb); 120 | 121 | extern int 122 | bkn_hw_tstamp_ptp_clock_index_cb_unregister(knet_hw_tstamp_ptp_clock_index_cb_f hw_tstamp_ptp_clock_index_cb); 123 | 124 | extern int 125 | bkn_hw_tstamp_rx_time_upscale_cb_register(knet_hw_tstamp_rx_time_upscale_cb_f hw_tstamp_rx_time_upscale_cb); 126 | 127 | extern int 128 | bkn_hw_tstamp_rx_time_upscale_cb_unregister(knet_hw_tstamp_rx_time_upscale_cb_f hw_tstamp_rx_time_upscale_cb); 129 | 130 | #endif 131 | 132 | #endif /* __LINUX_BCM_KNET_H__ */ 133 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/include/gmodule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | /* 17 | * 18 | * This software is governed by the Broadcom Switch APIs license. 19 | * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | * 21 | * Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | */ 23 | 24 | #ifndef __COMMON_LINUX_KRN_GMODULE_H__ 25 | #define __COMMON_LINUX_KRN_GMODULE_H__ 26 | 27 | #include 28 | 29 | typedef struct gmodule_s { 30 | 31 | const char* name; 32 | int major; 33 | int minor; 34 | 35 | int (*init)(void); 36 | int (*cleanup)(void); 37 | 38 | int (*pprint)(void); 39 | 40 | int (*open)(void); 41 | int (*ioctl)(unsigned int cmd, unsigned long arg); 42 | int (*close)(void); 43 | int (*mmap) (struct file *filp, struct vm_area_struct *vma); 44 | 45 | } gmodule_t; 46 | 47 | 48 | /* The framework will ask for your module definition */ 49 | extern gmodule_t* gmodule_get(void); 50 | 51 | 52 | /* Proc Filesystem information */ 53 | extern int pprintf(const char* fmt, ...) 54 | __attribute__ ((format (printf, 1, 2))); 55 | extern int gmodule_vpprintf(char** page, const char* fmt, va_list args) 56 | __attribute__ ((format (printf, 2, 0))); 57 | extern int gmodule_pprintf(char** page, const char* fmt, ...) 58 | __attribute__ ((format (printf, 2, 3))); 59 | 60 | extern int gprintk(const char* fmt, ...) 61 | __attribute__ ((format (printf, 1, 2))); 62 | 63 | extern int gdbg(const char* fmt, ...) 64 | __attribute__ ((format (printf, 1, 2))); 65 | #define GDBG gdbg 66 | 67 | #endif /* __COMMON_LINUX_KRN_GMODULE_H__ */ 68 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/knet-cb/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | LOCALDIR = systems/linux/kernel/modules/knet-cb 24 | 25 | include ${SDK}/make/Make.config 26 | 27 | LIBS = $(LIBDIR)/libkern.a 28 | 29 | ifeq ($(kernel_version),2_4) 30 | MODULE = $(LIBDIR)/linux-knet-cb.o 31 | else 32 | KERNEL_MODULE_DIR = kernel_module 33 | 34 | THIS_MOD_NAME := linux-knet-cb 35 | MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o 36 | KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko 37 | 38 | build: $(MODULE) $(KMODULE) 39 | endif 40 | 41 | KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers 42 | 43 | # BCM Network Device 44 | 45 | $(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) 46 | $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ 47 | ifneq ($(kernel_version),2_4) 48 | $(KMODULE): $(MODULE) 49 | rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) 50 | mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) 51 | cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile 52 | cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers 53 | MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko 54 | endif 55 | 56 | # Make.depend is before clean:: so that Make.depend's clean:: runs first. 57 | 58 | include ${SDK}/make/Make.depend 59 | 60 | clean:: 61 | $(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o 62 | $(RM) $(BOBJS) $(MODULE) 63 | 64 | ifneq ($(kernel_version),2_4) 65 | .PHONY: build 66 | endif 67 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Broadcom 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License, version 2, as 6 | * published by the Free Software Foundation (the "GPL"). 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License version 2 (GPLv2) for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * version 2 (GPLv2) along with this source code. 15 | */ 16 | 17 | /* 18 | * Test driver for call-back functions in Linux KNET driver. 19 | * 20 | * The module can be built from the standard Linux user mode target 21 | * directories using the following command (assuming bash), e.g. 22 | * 23 | * cd $SDK/systems/linux/user/gto-2_6 24 | * BUILD_KNET_CB=1 make -s mod 25 | */ 26 | 27 | #include /* Must be included first */ 28 | #include 29 | #include 30 | 31 | MODULE_AUTHOR("Broadcom Corporation"); 32 | MODULE_DESCRIPTION("Broadcom Linux KNET Call-Back Driver"); 33 | MODULE_LICENSE("GPL"); 34 | 35 | /* Module Information */ 36 | #define MODULE_MAJOR 121 37 | #define MODULE_NAME "linux-knet-cb" 38 | 39 | static void 40 | show_mac(struct sk_buff *skb) 41 | { 42 | printk("DMAC=%02X:%02X:%02X:%02X:%02X:%02X\n", 43 | skb->data[0], skb->data[1], skb->data[2], 44 | skb->data[3], skb->data[4], skb->data[5]); 45 | } 46 | 47 | static struct sk_buff * 48 | test_rx_cb(struct sk_buff *skb, int dev_no, void *meta) 49 | { 50 | printk("rx_cb for dev %d\n", dev_no); 51 | printk("netif user data 0x%x\n", KNET_SKB_CB(skb)->netif_user_data); 52 | printk("filter user data 0x%x\n", KNET_SKB_CB(skb)->filter_user_data); 53 | printk("dcb type 0x%x\n", KNET_SKB_CB(skb)->dcb_type); 54 | if (skb->data[5] == 0x03) { 55 | dev_kfree_skb(skb); 56 | return NULL; 57 | } 58 | show_mac(skb); 59 | return skb; 60 | } 61 | 62 | static struct sk_buff * 63 | test_tx_cb(struct sk_buff *skb, int dev_no, void *meta) 64 | { 65 | printk("tx_cb for dev %d\n", dev_no); 66 | show_mac(skb); 67 | skb->data[5] += 1; 68 | return skb; 69 | } 70 | 71 | static int 72 | test_filter_cb(uint8_t *pkt, int size, int dev_no, void *meta, 73 | int chan, kcom_filter_t *kf) 74 | { 75 | printk("filter_cb (%d) for dev %d\n", kf->dest_id, dev_no); 76 | if (pkt[12] == 0x81 && pkt[13] == 0x00) { 77 | printk(" VTAG %d\n", pkt[15]); 78 | kf->dest_type = KCOM_DEST_T_NETIF; 79 | kf->dest_id = pkt[15]; 80 | return 1; 81 | } 82 | return 0; 83 | } 84 | 85 | /* 86 | * Generic module functions 87 | */ 88 | 89 | static int 90 | _pprint(void) 91 | { 92 | pprintf("Broadcom Linux KNET Call-Back Driver\n"); 93 | 94 | return 0; 95 | } 96 | 97 | static int 98 | _cleanup(void) 99 | { 100 | bkn_rx_skb_cb_unregister(test_rx_cb); 101 | bkn_tx_skb_cb_unregister(test_tx_cb); 102 | bkn_filter_cb_unregister(test_filter_cb); 103 | 104 | return 0; 105 | } 106 | 107 | static int 108 | _init(void) 109 | { 110 | bkn_rx_skb_cb_register(test_rx_cb); 111 | bkn_tx_skb_cb_register(test_tx_cb); 112 | bkn_filter_cb_register(test_filter_cb); 113 | 114 | return 0; 115 | } 116 | 117 | static gmodule_t _gmodule = { 118 | name: MODULE_NAME, 119 | major: MODULE_MAJOR, 120 | init: _init, 121 | cleanup: _cleanup, 122 | pprint: _pprint, 123 | ioctl: NULL, 124 | open: NULL, 125 | close: NULL, 126 | }; 127 | 128 | gmodule_t* 129 | gmodule_get(void) 130 | { 131 | EXPORT_NO_SYMBOLS; 132 | return &_gmodule; 133 | } 134 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/kernel/modules/shared/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | # 23 | LOCALDIR = systems/linux/kernel/modules/shared 24 | 25 | include ${SDK}/make/Make.config 26 | 27 | lib = libkern 28 | 29 | include ${SDK}/make/Make.kernlib 30 | 31 | include ${SDK}/make/Make.depend 32 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/bmw-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # PPC_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # PPC_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=2_6 57 | platform=bmw-$(kernel_version) 58 | 59 | # Windriver linux version 60 | #WRS_LINUX_VERSION=1.4 61 | #WRS_LINUX_VERSION=2.0 62 | 63 | LINUX_MAKE_USER=1 64 | include ${SDK}/make/Make.linux 65 | 66 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/gto-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # PPC_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # PPC_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=2_6 57 | platform=gto-$(kernel_version) 58 | LINUX_MAKE_USER=1 59 | export LINKER_RELAX=1 60 | 61 | # Select the build environment 62 | #BUILD_PLATFORM=ELDK 63 | #BUILD_PLATFORM=WR_LINUX 64 | 65 | #Select the LINUX KERNEL VERSION 66 | #KERN_VER = 2.6.21.7 67 | #KERN_VER = 2.6.24.4 68 | #KERN_VER = 2.6.25 69 | 70 | 71 | # Select the ELDK version 72 | #ELDK_VERSION=4.1 73 | #ELDK_VERSION=4.0 74 | 75 | #Select WRS Linux version 76 | #WRS_LINUX_VERSION=2.0 77 | #WRS_LINUX_VERSION=3.0 78 | 79 | 80 | export KERN_VER 81 | export ELDK_VERSION 82 | export BUILD_PLATFORM 83 | export WRS_LINUX_VERSION 84 | 85 | include ${SDK}/make/Make.linux 86 | 87 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/gto/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # PPC_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # PPC_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=4_4 57 | platform=gto 58 | LINUX_MAKE_USER=1 59 | export LINKER_RELAX=1 60 | 61 | include ${SDK}/make/Make.linux 62 | 63 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/gts/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # TOOLS_DIR - path to build tools (if not in PATH already) 32 | # CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=4_19 57 | platform=gts 58 | LINUX_MAKE_USER=1 59 | export LINKER_RELAX = 1 60 | export ADD_TO_CFLAGS 61 | export BR_NO_CCACHE 62 | 63 | 64 | include ${SDK}/make/Make.linux 65 | 66 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/iproc-3_14/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=3_14 57 | platform=iproc-$(kernel_version) 58 | 59 | IPROC_BUILD=1 60 | export IPROC_BUILD 61 | export BUILD_PLATFORM 62 | export ARM_LINUX_VERSION 63 | 64 | LINUX_MAKE_USER=1 65 | export ADD_TO_CFLAGS 66 | 67 | include ${SDK}/make/Make.linux 68 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/iproc-4_4/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | 29 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 30 | echo $$SDK;\ 31 | else\ 32 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 33 | dir=`cd ../;pwd`; \ 34 | if [ "$$dir" = "/" ] ; then \ 35 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 36 | exit 1; \ 37 | fi ; \ 38 | cd $$dir; \ 39 | done ; \ 40 | pwd; \ 41 | fi) 42 | 43 | ifeq ($(SDK),) 44 | $(error Please run this in a tree) 45 | endif 46 | 47 | export SDK 48 | 49 | override kernel_version=4_4 50 | platform=iproc-$(kernel_version) 51 | 52 | IPROC_BUILD=1 53 | export IPROC_BUILD 54 | export BUILD_PLATFORM 55 | export ARM_LINUX_VERSION 56 | 57 | LINUX_MAKE_USER=1 58 | export ADD_TO_CFLAGS 59 | export BR_NO_CCACHE 60 | 61 | include ${SDK}/make/Make.linux 62 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/iproc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | 29 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 30 | echo $$SDK;\ 31 | else\ 32 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 33 | dir=`cd ../;pwd`; \ 34 | if [ "$$dir" = "/" ] ; then \ 35 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 36 | exit 1; \ 37 | fi ; \ 38 | cd $$dir; \ 39 | done ; \ 40 | pwd; \ 41 | fi) 42 | 43 | ifeq ($(SDK),) 44 | $(error Please run this in a tree) 45 | endif 46 | 47 | export SDK 48 | 49 | override kernel_version=4_14 50 | platform=iproc 51 | 52 | IPROC_BUILD=1 53 | export IPROC_BUILD 54 | export BUILD_PLATFORM 55 | export ARM_LINUX_VERSION 56 | 57 | LINUX_MAKE_USER=1 58 | export ADD_TO_CFLAGS 59 | export BR_NO_CCACHE 60 | 61 | include ${SDK}/make/Make.linux 62 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/iproc_64/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | 29 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 30 | echo $$SDK;\ 31 | else\ 32 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 33 | dir=`cd ../;pwd`; \ 34 | if [ "$$dir" = "/" ] ; then \ 35 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 36 | exit 1; \ 37 | fi ; \ 38 | cd $$dir; \ 39 | done ; \ 40 | pwd; \ 41 | fi) 42 | 43 | ifeq ($(SDK),) 44 | $(error Please run this in a tree) 45 | endif 46 | 47 | export SDK 48 | 49 | override kernel_version=4_14 50 | platform=iproc_64 51 | 52 | IPROC_BUILD=1 53 | export IPROC_BUILD 54 | export BUILD_PLATFORM 55 | export ARM_LINUX_VERSION 56 | 57 | LINUX_MAKE_USER=1 58 | export ADD_TO_CFLAGS 59 | export BR_NO_CCACHE 60 | 61 | include ${SDK}/make/Make.linux 62 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/jag-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=2_6 57 | platform=jag-$(kernel_version) 58 | 59 | # Select the build environment 60 | #BUILD_PLATFORM=ELDK 61 | #BUILD_PLATFORM=WR_LINUX 62 | 63 | #Select the LINUX KERNEL VERSION 64 | #KERN_VER = 2.6.21.7 65 | 66 | 67 | # Select the ELDK version 68 | #ELDK_VERSION=4.1 69 | 70 | # Windriver linux version 71 | #WRS_LINUX_VERSION=1.4 72 | #WRS_LINUX_VERSION=2.0 73 | 74 | export KERN_VER 75 | export ELDK_VERSION 76 | export BUILD_PLATFORM 77 | export WRS_LINUX_VERSION 78 | 79 | LINUX_MAKE_USER=1 80 | include ${SDK}/make/Make.linux 81 | 82 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/nsx-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=2_6 57 | platform=nsx-$(kernel_version) 58 | LINUX_MAKE_USER=1 59 | include ${SDK}/make/Make.linux 60 | 61 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/nsx64/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | platform=nsx64 57 | LINUX_MAKE_USER=1 58 | include ${SDK}/make/Make.linux 59 | 60 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/nsx_wrl-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=2_6 57 | platform=nsx_wrl-$(kernel_version) 58 | 59 | # Windriver linux version 60 | #WRS_LINUX_VERSION=1.4 61 | #WRS_LINUX_VERSION=2.0 62 | 63 | export WRS_LINUX_VERSION 64 | 65 | LINUX_MAKE_USER=1 66 | include ${SDK}/make/Make.linux 67 | 68 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/raptor-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=2_6 57 | platform=raptor-$(kernel_version) 58 | 59 | # Select the build environment 60 | #BUILD_PLATFORM=ELDK 61 | #BUILD_PLATFORM=WR_LINUX 62 | 63 | #Select the LINUX KERNEL VERSION 64 | #KERN_VER = 2.6.21.7 65 | 66 | 67 | # Select the ELDK version 68 | #ELDK_VERSION=4.1 69 | 70 | # Windriver linux version 71 | #WRS_LINUX_VERSION=1.4 72 | #WRS_LINUX_VERSION=2.0 73 | 74 | export KERN_VER 75 | export ELDK_VERSION 76 | export BUILD_PLATFORM 77 | export WRS_LINUX_VERSION 78 | 79 | LINUX_MAKE_USER=1 80 | include ${SDK}/make/Make.linux 81 | 82 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/raptor/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # MIPS_TOOLS_DIR - path to build tools (if not in PATH already) 32 | # MIPS_CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | platform=raptor 57 | LINUX_MAKE_USER=1 58 | CFGFLAGS += -DBCM_ICS 59 | include ${SDK}/make/Make.linux 60 | 61 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/slk/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # TOOLS_DIR - path to build tools (if not in PATH already) 32 | # CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=3_14 57 | platform=slk 58 | LINUX_MAKE_USER=1 59 | export LINKER_RELAX = 1 60 | 61 | include ${SDK}/make/Make.linux 62 | 63 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 24 | echo $$SDK;\ 25 | else\ 26 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 27 | dir=`cd ../;pwd`; \ 28 | if [ "$$dir" = "/" ] ; then \ 29 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 30 | exit 1; \ 31 | fi ; \ 32 | cd $$dir; \ 33 | done ; \ 34 | pwd; \ 35 | fi) 36 | 37 | ifeq ($(SDK),) 38 | $(error Please run this in a tree) 39 | endif 40 | 41 | export SDK 42 | 43 | override kernel_version=2_6 44 | platform=x86-smp_generic_64-$(kernel_version) 45 | 46 | LINUX_MAKE_USER=1 47 | include ${SDK}/make/Make.linux 48 | -------------------------------------------------------------------------------- /src/gpl-modules/systems/linux/user/xlr/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Broadcom 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License, version 2, as 6 | # published by the Free Software Foundation (the "GPL"). 7 | # 8 | # This program is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | # General Public License version 2 (GPLv2) for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # version 2 (GPLv2) along with this source code. 15 | # 16 | # -*- Makefile -*- 17 | # 18 | # This software is governed by the Broadcom Switch APIs license. 19 | # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenNSA/master/Legal/LICENSE file. 20 | # 21 | # Copyright 2007-2020 Broadcom Inc. All rights reserved. 22 | 23 | # 24 | # This make job requires the following environment variables to be set: 25 | # 26 | # SDK - path to StrataXGS SDK root directory 27 | # 28 | # Optionally the following environment variables can be set to 29 | # override the default build server configuration: 30 | # 31 | # TOOLS_DIR - path to build tools (if not in PATH already) 32 | # CROSS_COMPILE - cross compile tools prefix 33 | # LINUX_INCLUDE - path to Linux kernel include directory 34 | # 35 | 36 | SDK :=$(shell if [ -n "$$SDK" ] ; then\ 37 | echo $$SDK;\ 38 | else\ 39 | cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ 40 | dir=`cd ../;pwd`; \ 41 | if [ "$$dir" = "/" ] ; then \ 42 | echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ 43 | exit 1; \ 44 | fi ; \ 45 | cd $$dir; \ 46 | done ; \ 47 | pwd; \ 48 | fi) 49 | 50 | ifeq ($(SDK),) 51 | $(error Please run this in a tree) 52 | endif 53 | 54 | export SDK 55 | 56 | override kernel_version=4_19 57 | platform=xlr 58 | LINUX_MAKE_USER=1 59 | export LINKER_RELAX = 1 60 | export ADD_TO_CFLAGS 61 | export BR_NO_CCACHE 62 | 63 | 64 | include ${SDK}/make/Make.linux 65 | 66 | --------------------------------------------------------------------------------