├── .sourcegraph └── ignore ├── sw ├── common │ ├── src │ │ ├── dummy_main.c │ │ └── common.c │ ├── public │ │ ├── pfe_cfg.h │ │ ├── ct_assert.h │ │ └── blalloc.h │ └── Makefile ├── hal │ └── src │ │ └── hal.c ├── oal │ ├── public │ │ ├── oal_util_net_linux.h │ │ ├── oal_time.h │ │ ├── oal_master_if.h │ │ ├── oal.h │ │ ├── oal_thread.h │ │ ├── oal_util_net.h │ │ ├── oal_types.h │ │ ├── oal_job.h │ │ └── oal_mutex_linux.h │ └── src │ │ ├── oal_util_linux.c │ │ ├── oal_time_linux.c │ │ └── oal_util_net_linux.c ├── fci │ ├── src │ │ ├── fci_mirror.h │ │ ├── fci_spd.h │ │ ├── fci_fp.h │ │ ├── fci_fw_features.h │ │ ├── fci_rt_db.h │ │ ├── fci_l2br.c │ │ └── fci_core.h │ └── public │ │ ├── fci_msg_linux.h │ │ ├── fci_ownership_mask.h │ │ ├── fci_msg.h │ │ └── fci.h ├── pfe_platform │ ├── hw │ │ └── s32g │ │ │ ├── pfe_bus_err_csr.h │ │ │ ├── pfe_ecc_err_csr.h │ │ │ ├── pfe_fail_stop_csr.h │ │ │ ├── pfe_fw_fail_stop_csr.h │ │ │ ├── pfe_host_fail_stop_csr.h │ │ │ ├── pfe_parity_csr.h │ │ │ ├── pfe_wdt_csr.h │ │ │ ├── pfe_cbus.h │ │ │ ├── pfe_util_csr.c │ │ │ ├── pfe_ecc_err_csr.c │ │ │ ├── pfe_fw_fail_stop_csr.c │ │ │ ├── pfe_util_csr.h │ │ │ ├── pfe_l2br_table_csr.h │ │ │ └── pfe_host_fail_stop_csr.c │ └── public │ │ ├── pfe_bus_err.h │ │ ├── pfe_ecc_err.h │ │ ├── pfe_fail_stop.h │ │ ├── pfe_parity.h │ │ ├── pfe_fw_fail_stop.h │ │ ├── pfe_host_fail_stop.h │ │ ├── pfe_fp.h │ │ ├── pfe_spd_acc.h │ │ ├── pfe_spd.h │ │ ├── pfe_wdt.h │ │ ├── pfe_ct_comp.h │ │ ├── pfe_hw_feature.h │ │ ├── pfe_idex.h │ │ ├── pfe_util.h │ │ ├── pfe_mirror.h │ │ ├── pfe_mac_db.h │ │ ├── pfe_hif_ring_linux.h │ │ ├── pfe_if_db.h │ │ ├── pfe_bmu.h │ │ ├── pfe_feature_mgr.h │ │ ├── pfe_pe.h │ │ ├── pfe_hif.h │ │ └── pfe_log_if.h ├── dummy_mod.mak ├── Makefile ├── linux-pfeng │ ├── pfeng-slave-phy.c │ └── pfeng-fw.c ├── libfci_cli │ └── src │ │ ├── libfci_cli_def_help.h │ │ ├── daemon │ │ ├── daemon.h │ │ ├── daemon_fciev2txt.h │ │ └── daemon_cmds.h │ │ ├── libfci_cli_parser.h │ │ ├── libfci_cli_cmds_fci_owner.h │ │ ├── libfci_cli_cmds_data_buf.h │ │ ├── libfci_cli_cmds_demo_feature.h │ │ ├── libfci_cli_cmds_spd.h │ │ ├── libfci_demo │ │ ├── demo_fci_owner.h │ │ ├── demo_common.h │ │ ├── demo_if_mac.h │ │ └── demo_fci_owner.c │ │ ├── libfci_cli_cmds_fwfeat.h │ │ ├── libfci_cli_cmds_daemon.h │ │ ├── libfci_cli_cmds_if_mac.h │ │ ├── libfci_cli_cmds_mirror.h │ │ ├── libfci_cli_cmds_if.h │ │ ├── libfci_cli_cmds_qos.h │ │ ├── libfci_cli_cmds_fp.h │ │ ├── libfci_cli_print_helpers.h │ │ ├── libfci_cli_cmds_route_and_cntk.h │ │ ├── libfci_cli_cmds_qos_pol.h │ │ ├── libfci_cli_cmds_bd.h │ │ ├── libfci_cli_cmds_data_buf.c │ │ └── libfci_cli_cmds_fci_owner.c ├── fifo │ ├── public │ │ └── fifo.h │ ├── Makefile │ └── src │ │ └── fifo.c ├── elf │ └── Makefile └── bpool │ └── Makefile ├── .gitignore ├── LICENSES └── BSD-3-Clause.txt └── PFE-DRV_S32G_A53_LNX_1.10.0_SBOM.spdx.json /.sourcegraph/ignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sw/common/src/dummy_main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | */ 6 | #include 7 | 8 | MODULE_LICENSE("GPL"); 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.mod.o 3 | *.mod.c 4 | *.mod 5 | *.cmd 6 | .tmp_versions 7 | Module.symvers 8 | modules.order 9 | *.o 10 | *.ko 11 | .cache.mk 12 | pfeng.geany 13 | pfeng.tags 14 | -------------------------------------------------------------------------------- /sw/common/src/common.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2020 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | #include "pfe_cfg.h" 8 | 9 | -------------------------------------------------------------------------------- /sw/hal/src/hal.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018,2020 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /* Intentionally empty */ 9 | -------------------------------------------------------------------------------- /sw/oal/public/oal_util_net_linux.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2020 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef OAL_UTIL_NET_LINUX_H_ 9 | #define OAL_UTIL_NET_LINUX_H_ 10 | 11 | #include 12 | #include 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /sw/fci/src/fci_mirror.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2021-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | #ifndef FCI_MIRROR_H 8 | #define FCI_MIRROR_H 9 | 10 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 11 | #define ETH_43_PFE_START_SEC_CODE 12 | #include "Eth_43_PFE_MemMap.h" 13 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 14 | 15 | errno_t fci_mirror_cmd(fci_msg_t *msg, uint16_t *fci_ret, fpp_mirror_cmd_t *reply_buf, uint32_t *reply_len); 16 | 17 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 18 | #define ETH_43_PFE_STOP_SEC_CODE 19 | #include "Eth_43_PFE_MemMap.h" 20 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /sw/fci/src/fci_spd.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020, 2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef FCI_SPD_H 9 | #define FCI_SPD_H 10 | 11 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 12 | #define ETH_43_PFE_START_SEC_CODE 13 | #include "Eth_43_PFE_MemMap.h" 14 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 15 | 16 | errno_t fci_spd_cmd(fci_msg_t *msg, uint16_t *fci_ret, fpp_spd_cmd_t *reply_buf, uint32_t *reply_len); 17 | 18 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 19 | #define ETH_43_PFE_STOP_SEC_CODE 20 | #include "Eth_43_PFE_MemMap.h" 21 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /sw/common/public/pfe_cfg.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | /** 8 | * @file pfe_cfg.h 9 | * @brief PFE configuration file 10 | * @details This file needs to be included in all PFE sources before any other. 11 | * PFE include. 12 | */ 13 | #ifndef PFE_CFG_H 14 | #define PFE_CFG_H 15 | 16 | /* Find the configuration parameters defined in makefiles */ 17 | 18 | /** 19 | * @def PFE_CFG_HIF_IRQ_ENABLED 20 | * @brief If TRUE then HIF interrupt will be used. 21 | */ 22 | #define PFE_CFG_HIF_IRQ_ENABLED TRUE 23 | 24 | #endif /*PFE_CFG_H*/ 25 | -------------------------------------------------------------------------------- /sw/fci/src/fci_fp.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | #ifndef FCI_FP_H 8 | #define FCI_FP_H 9 | 10 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 11 | #define ETH_43_PFE_START_SEC_CODE 12 | #include "Eth_43_PFE_MemMap.h" 13 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 14 | 15 | extern errno_t fci_fp_table_cmd(fci_msg_t *msg, uint16_t *fci_ret, fpp_fp_table_cmd_t *reply_buf, uint32_t *reply_len); 16 | extern errno_t fci_fp_rule_cmd(fci_msg_t *msg, uint16_t *fci_ret, fpp_fp_rule_cmd_t *reply_buf, uint32_t *reply_len); 17 | 18 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 19 | #define ETH_43_PFE_STOP_SEC_CODE 20 | #include "Eth_43_PFE_MemMap.h" 21 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /sw/fci/src/fci_fw_features.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020, 2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef FCI_FW_FEATURES_H 9 | #define FCI_FW_FEATURES_H 10 | 11 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 12 | #define ETH_43_PFE_START_SEC_CODE 13 | #include "Eth_43_PFE_MemMap.h" 14 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 15 | 16 | extern errno_t fci_fw_features_cmd(fci_msg_t *msg, uint16_t *fci_ret, fpp_fw_features_cmd_t *reply_buf, uint32_t *reply_len); 17 | extern errno_t fci_fw_features_element_cmd(fci_msg_t *msg, uint16_t *fci_ret, fpp_fw_features_element_cmd_t *reply_buf, uint32_t *reply_len); 18 | 19 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 20 | #define ETH_43_PFE_STOP_SEC_CODE 21 | #include "Eth_43_PFE_MemMap.h" 22 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_bus_err_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PFE_BUS_ERR_CSR_H_ 11 | #define PFE_BUS_ERR_CSR_H_ 12 | 13 | #include "pfe_bus_err.h" 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | errno_t pfe_bus_err_cfg_isr(addr_t base_va); 21 | void pfe_bus_err_cfg_irq_mask(addr_t base_va); 22 | void pfe_bus_err_cfg_irq_unmask(addr_t base_va); 23 | void pfe_bus_err_cfg_irq_unmask_all(addr_t base_va); 24 | 25 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 26 | #define ETH_43_PFE_STOP_SEC_CODE 27 | #include "Eth_43_PFE_MemMap.h" 28 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 29 | 30 | #endif /* PFE_BUS_ERR_CSR_H_ */ 31 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_ecc_err_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PFE_ECC_ERR_CSR_H_ 11 | #define PFE_ECC_ERR_CSR_H_ 12 | 13 | #include "pfe_ecc_err.h" 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | errno_t pfe_ecc_err_cfg_isr(addr_t base_va); 21 | void pfe_ecc_err_cfg_irq_mask(addr_t base_va); 22 | void pfe_ecc_err_cfg_irq_unmask(addr_t base_va); 23 | void pfe_ecc_err_cfg_irq_unmask_all(addr_t base_va); 24 | 25 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 26 | #define ETH_43_PFE_STOP_SEC_CODE 27 | #include "Eth_43_PFE_MemMap.h" 28 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 29 | 30 | #endif /* PFE_ECC_ERR_CSR_H_ */ 31 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_fail_stop_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PFE_FAIL_STOP_CSR_H_ 11 | #define PFE_FAIL_STOP_CSR_H_ 12 | 13 | #include "pfe_fail_stop.h" 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | errno_t pfe_fail_stop_cfg_isr(addr_t base_va); 21 | void pfe_fail_stop_cfg_irq_mask(addr_t base_va); 22 | void pfe_fail_stop_cfg_irq_unmask(addr_t base_va); 23 | void pfe_fail_stop_cfg_irq_unmask_all(addr_t base_va); 24 | 25 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 26 | #define ETH_43_PFE_STOP_SEC_CODE 27 | #include "Eth_43_PFE_MemMap.h" 28 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 29 | 30 | #endif /* PFE_FAIL_STOP_CSR_H_ */ 31 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_fw_fail_stop_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PFE_FW_FAIL_STOP_CSR_H_ 11 | #define PFE_FW_FAIL_STOP_CSR_H_ 12 | 13 | #include "pfe_fw_fail_stop.h" 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | errno_t pfe_fw_fail_stop_cfg_isr(addr_t base_va); 21 | void pfe_fw_fail_stop_cfg_irq_mask(addr_t base_va); 22 | void pfe_fw_fail_stop_cfg_irq_unmask(addr_t base_va); 23 | void pfe_fw_fail_stop_cfg_irq_unmask_all(addr_t base_va); 24 | 25 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 26 | #define ETH_43_PFE_STOP_SEC_CODE 27 | #include "Eth_43_PFE_MemMap.h" 28 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 29 | 30 | #endif /* PFE_FW_FAIL_STOP_CSR_H_ */ 31 | -------------------------------------------------------------------------------- /sw/dummy_mod.mak: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2023 NXP 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | 7 | ccflags-y += $(INCLUDES) 8 | ccflags-y += $(CCFLAGS_pfe) 9 | ccflags-y += $(CFLAGS_MODULE) 10 | ccflags-y += $(GLOBAL_CCFLAGS) 11 | ccflags-y += -Werror 12 | 13 | linux:: 14 | $(MAKE) CROSS_COMPILE=$(PLATFORM)- ARCH=$(ARCH) -C $(KERNELDIR) M=`pwd` GLOBAL_CCFLAGS="$(GLOBAL_CCFLAGS)" modules 15 | 16 | linux-clean: 17 | $(MAKE) CROSS_COMPILE=$(PLATFORM)- ARCH=$(ARCH) -C $(KERNELDIR) M=`pwd` clean 18 | 19 | 20 | MODULE_NAME = $(subst .a,,$(subst .o,,$(ARTIFACT))) 21 | ifneq (,$(findstring .a,$(ARTIFACT))) 22 | MODULE_NAME := _dummy 23 | obj-m += $(MODULE_NAME).o 24 | $(MODULE_NAME)-objs := lib.a ../common/src/dummy_main.o 25 | lib-y := $(OBJS) 26 | LIB_OBJECT := $(subst .a,.o,$(ARTIFACT)) 27 | 28 | linux:: 29 | @echo " mv lib.a -> $(LIB_OBJECT)" 30 | @cp lib.a $(LIB_OBJECT) 31 | @cp .lib.a.cmd .$(LIB_OBJECT).cmd 32 | else 33 | obj-m += $(MODULE_NAME).o 34 | $(MODULE_NAME)-objs := $(OBJS) 35 | endif 36 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_host_fail_stop_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PFE_HOST_FAIL_STOP_CSR_H_ 11 | #define PFE_HOST_FAIL_STOP_CSR_H_ 12 | 13 | #include "pfe_host_fail_stop.h" 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | errno_t pfe_host_fail_stop_cfg_isr(addr_t base_va); 21 | void pfe_host_fail_stop_cfg_irq_mask(addr_t base_va); 22 | void pfe_host_fail_stop_cfg_irq_unmask(addr_t base_va); 23 | void pfe_host_fail_stop_cfg_irq_unmask_all(addr_t base_va); 24 | 25 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 26 | #define ETH_43_PFE_STOP_SEC_CODE 27 | #include "Eth_43_PFE_MemMap.h" 28 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 29 | 30 | #endif /* PFE_HOST_FAIL_STOP_CSR_H_ */ 31 | -------------------------------------------------------------------------------- /sw/Makefile: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # Copyright 2018-2021 NXP 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | # ========================================================================= 7 | 8 | include build_env.mak 9 | 10 | # *********************** 11 | # Rules 12 | # *********************** 13 | 14 | PFE_DRIVER:=devnp-pfe-2 15 | PFE_RELATIVES:= 16 | 17 | # If profiling is required then a special NXP-internal-only library should be built 18 | ifeq ($(BUILD_PROFILE),profile) 19 | PFE_RELATIVES+=profiling 20 | endif 21 | 22 | .PHONY all: 23 | all: $(PFE_DRIVER).qp 24 | $(PFE_DRIVER).qp: $(addsuffix .qp,$(PFE_RELATIVES)) 25 | 26 | .PHONY clean: 27 | clean: $(PFE_DRIVER).qp_clean $(addsuffix .qp_clean,$(PFE_RELATIVES)) 28 | 29 | .ONESHELL: 30 | %.qp: $(basename %.qp) 31 | cd $(basename $@) 32 | $(MAKE) 33 | 34 | %.qp_clean: $(basename %.qp_clean) 35 | cd $(basename $@) 36 | $(MAKE) clean 37 | 38 | # Return configured compiler version 39 | .PHONY: compiler_version 40 | compiler_version: 41 | @echo "$(COMPILER_NAME), $(COMPILER_VERSION)" 42 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_parity_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2019-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PFE_PARITY_CSR_H_ 12 | #define PFE_PARITY_CSR_H_ 13 | 14 | 15 | #include "pfe_parity.h" 16 | 17 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 18 | #define ETH_43_PFE_START_SEC_CODE 19 | #include "Eth_43_PFE_MemMap.h" 20 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 21 | 22 | errno_t pfe_parity_cfg_isr(addr_t base_va); 23 | void pfe_parity_cfg_irq_mask(addr_t base_va); 24 | void pfe_parity_cfg_irq_unmask(addr_t base_va); 25 | void pfe_parity_cfg_irq_unmask_all(addr_t base_va); 26 | 27 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 28 | #define ETH_43_PFE_STOP_SEC_CODE 29 | #include "Eth_43_PFE_MemMap.h" 30 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 31 | 32 | #endif /* PFE_PARITY_CSR_H_ */ 33 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_bus_err.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PUBLIC_PFE_BUS_ERR_H_ 11 | #define PUBLIC_PFE_BUS_ERR_H_ 12 | 13 | typedef struct pfe_bus_err_tag pfe_bus_err_t; 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | pfe_bus_err_t *pfe_bus_err_create(addr_t cbus_base_va, addr_t safety_base); 21 | void pfe_bus_err_destroy(pfe_bus_err_t *bus_err); 22 | errno_t pfe_bus_err_isr(const pfe_bus_err_t *bus_err); 23 | void pfe_bus_err_irq_mask(const pfe_bus_err_t *bus_err); 24 | void pfe_bus_err_irq_unmask(const pfe_bus_err_t *bus_err); 25 | 26 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 27 | #define ETH_43_PFE_STOP_SEC_CODE 28 | #include "Eth_43_PFE_MemMap.h" 29 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 30 | 31 | #endif /* PUBLIC_PFE_BUS_ERR_H_ */ 32 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_ecc_err.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PUBLIC_PFE_ECC_ERR_H_ 11 | #define PUBLIC_PFE_ECC_ERR_H_ 12 | 13 | typedef struct pfe_ecc_err_tag pfe_ecc_err_t; 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | pfe_ecc_err_t *pfe_ecc_err_create(addr_t cbus_base_va, addr_t safety_base); 21 | void pfe_ecc_err_destroy(pfe_ecc_err_t *ecc_err); 22 | errno_t pfe_ecc_err_isr(const pfe_ecc_err_t *ecc_err); 23 | void pfe_ecc_err_irq_mask(const pfe_ecc_err_t *ecc_err); 24 | void pfe_ecc_err_irq_unmask(const pfe_ecc_err_t *ecc_err); 25 | 26 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 27 | #define ETH_43_PFE_STOP_SEC_CODE 28 | #include "Eth_43_PFE_MemMap.h" 29 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 30 | 31 | #endif /* PUBLIC_PFE_ECC_ERR_H_ */ 32 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_fail_stop.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PUBLIC_PFE_FAIL_STOP_H_ 11 | #define PUBLIC_PFE_FAIL_STOP_H_ 12 | 13 | typedef struct pfe_fail_stop_tag pfe_fail_stop_t; 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | pfe_fail_stop_t *pfe_fail_stop_create(addr_t cbus_base_va, addr_t safety_base); 21 | void pfe_fail_stop_destroy(pfe_fail_stop_t *safety); 22 | errno_t pfe_fail_stop_isr(const pfe_fail_stop_t *safety); 23 | void pfe_fail_stop_irq_mask(const pfe_fail_stop_t *safety); 24 | void pfe_fail_stop_irq_unmask(const pfe_fail_stop_t *safety); 25 | 26 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 27 | #define ETH_43_PFE_STOP_SEC_CODE 28 | #include "Eth_43_PFE_MemMap.h" 29 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 30 | 31 | #endif /* PUBLIC_PFE_FAIL_STOP_H_ */ 32 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_parity.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2019-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PUBLIC_PFE_PARITY_H_ 12 | #define PUBLIC_PFE_PARITY_H_ 13 | 14 | 15 | typedef struct pfe_parity_tag pfe_parity_t; 16 | 17 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 18 | #define ETH_43_PFE_START_SEC_CODE 19 | #include "Eth_43_PFE_MemMap.h" 20 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 21 | 22 | pfe_parity_t *pfe_parity_create(addr_t cbus_base_va, addr_t safety_base); 23 | void pfe_parity_destroy(pfe_parity_t *safety); 24 | errno_t pfe_parity_isr(const pfe_parity_t *safety); 25 | void pfe_parity_irq_mask(const pfe_parity_t *safety); 26 | void pfe_parity_irq_unmask(const pfe_parity_t *safety); 27 | 28 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 29 | #define ETH_43_PFE_STOP_SEC_CODE 30 | #include "Eth_43_PFE_MemMap.h" 31 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 32 | 33 | #endif /* PUBLIC_PFE_PARITY_H_ */ 34 | -------------------------------------------------------------------------------- /sw/fci/public/fci_msg_linux.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2021 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_FCI 10 | * @{ 11 | * 12 | * @file fci_msg_linux.h 13 | * @brief The Linux-specific FCI IPC message (fci_msg_t) format 14 | * @details The FCI message is used to transport FCI commands and events 15 | * between FCI endpoint and FCI clients (libFCI) using IPC. 16 | * 17 | */ 18 | 19 | #ifndef PUBLIC_FCI_MSG_LINUX_H_ 20 | #define PUBLIC_FCI_MSG_LINUX_H_ 21 | 22 | /** 23 | * @brief FCI IPC message format 24 | */ 25 | typedef struct 26 | { 27 | msg_type_t type; 28 | uint16_t ret_code; 29 | union 30 | { 31 | struct 32 | { 33 | uint32_t port_id; /*!< Node identifier (port ID) */ 34 | } msg_client_register; 35 | 36 | struct 37 | { 38 | uint32_t port_id; /*!< Node identifier (port ID) */ 39 | } msg_client_unregister; 40 | 41 | fci_msg_cmd_t msg_cmd; 42 | }; 43 | 44 | /* FCI internal storage */ 45 | void *client; 46 | } fci_msg_t; 47 | 48 | #endif /* PUBLIC_FCI_MSG_LINUX_H_ */ 49 | 50 | /** @}*/ 51 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_fw_fail_stop.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PUBLIC_PFE_FW_FAIL_STOP_H_ 11 | #define PUBLIC_PFE_FW_FAIL_STOP_H_ 12 | 13 | typedef struct pfe_fw_fail_stop_tag pfe_fw_fail_stop_t; 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | pfe_fw_fail_stop_t *pfe_fw_fail_stop_create(addr_t cbus_base_va, addr_t safety_base); 21 | void pfe_fw_fail_stop_destroy(pfe_fw_fail_stop_t *fw_fail_stop); 22 | errno_t pfe_fw_fail_stop_isr(const pfe_fw_fail_stop_t *fw_fail_stop); 23 | void pfe_fw_fail_stop_irq_mask(const pfe_fw_fail_stop_t *fw_fail_stop); 24 | void pfe_fw_fail_stop_irq_unmask(const pfe_fw_fail_stop_t *fw_fail_stop); 25 | 26 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 27 | #define ETH_43_PFE_STOP_SEC_CODE 28 | #include "Eth_43_PFE_MemMap.h" 29 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 30 | 31 | #endif /* PUBLIC_PFE_FW_FAIL_STOP_H_ */ 32 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_host_fail_stop.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #ifndef PUBLIC_PFE_HOST_FAIL_STOP_H_ 11 | #define PUBLIC_PFE_HOST_FAIL_STOP_H_ 12 | 13 | typedef struct pfe_host_fail_stop_tag pfe_host_fail_stop_t; 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | pfe_host_fail_stop_t *pfe_host_fail_stop_create(addr_t cbus_base_va, addr_t safety_base); 21 | void pfe_host_fail_stop_destroy(pfe_host_fail_stop_t *host_fail_stop); 22 | errno_t pfe_host_fail_stop_isr(const pfe_host_fail_stop_t *host_fail_stop); 23 | void pfe_host_fail_stop_irq_mask(const pfe_host_fail_stop_t *host_fail_stop); 24 | void pfe_host_fail_stop_irq_unmask(const pfe_host_fail_stop_t *host_fail_stop); 25 | 26 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 27 | #define ETH_43_PFE_STOP_SEC_CODE 28 | #include "Eth_43_PFE_MemMap.h" 29 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 30 | 31 | #endif /* PUBLIC_PFE_HOST_FAIL_STOP_H_ */ 32 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_fp.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2019-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | #ifndef PFE_FP_H 11 | #define PFE_FP_H 12 | 13 | #include "pfe_class.h" 14 | 15 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 16 | #define ETH_43_PFE_START_SEC_CODE 17 | #include "Eth_43_PFE_MemMap.h" 18 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 19 | 20 | void pfe_fp_init(void); 21 | uint32_t pfe_fp_create_table(pfe_class_t *class, uint16_t rules_count); 22 | uint32_t pfe_fp_table_write_rule(pfe_class_t *class, uint32_t table_address, const pfe_ct_fp_rule_t *rule, uint16_t position); 23 | void pfe_fp_destroy_table(const pfe_class_t *class, uint32_t table_address); 24 | errno_t pfe_fp_table_get_statistics(pfe_class_t *class, uint32_t pe_idx ,uint32_t table_address, pfe_ct_class_flexi_parser_stats_t *stats); 25 | 26 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 27 | #define ETH_43_PFE_STOP_SEC_CODE 28 | #include "Eth_43_PFE_MemMap.h" 29 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_spd_acc.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2020-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | #ifndef PFE_SPD_ACC_H 11 | #define PFE_SPD_ACC_H 12 | 13 | #include "pfe_class.h" 14 | #include "pfe_rtable.h" 15 | #include "pfe_if_db.h" 16 | 17 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 18 | #define ETH_43_PFE_START_SEC_CODE 19 | #include "Eth_43_PFE_MemMap.h" 20 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 21 | 22 | errno_t pfe_spd_acc_init(pfe_class_t *class, const pfe_rtable_t *rtable); 23 | void pfe_spd_acc_destroy(pfe_if_db_t *phy_if_db); 24 | errno_t pfe_spd_acc_add_rule(pfe_phy_if_t *phy_if, uint16_t position, pfe_ct_spd_entry_t *entry); 25 | errno_t pfe_spd_acc_remove_rule(pfe_phy_if_t * phy_if, uint16_t position); 26 | errno_t pfe_spd_acc_get_rule(const pfe_phy_if_t *phy_if, uint16_t position, pfe_ct_spd_entry_t *entry); 27 | 28 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 29 | #define ETH_43_PFE_STOP_SEC_CODE 30 | #include "Eth_43_PFE_MemMap.h" 31 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_spd.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2020-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | #ifndef PFE_SPD_H 11 | #define PFE_SPD_H 12 | 13 | #include "pfe_cfg.h" 14 | #include "oal.h" 15 | #include "pfe_ct.h" 16 | #include "pfe_class.h" 17 | #include "pfe_phy_if.h" 18 | #include "pfe_if_db.h" 19 | 20 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 21 | #define ETH_43_PFE_START_SEC_CODE 22 | #include "Eth_43_PFE_MemMap.h" 23 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 24 | 25 | void pfe_spd_init(pfe_class_t *class); 26 | void pfe_spd_destroy(pfe_if_db_t *phy_if_db); 27 | errno_t pfe_spd_add_rule(pfe_phy_if_t *phy_if, uint16_t position, pfe_ct_spd_entry_t *entry); 28 | errno_t pfe_spd_remove_rule(pfe_phy_if_t * phy_if, uint16_t position); 29 | errno_t pfe_spd_get_rule(const pfe_phy_if_t *phy_if, uint16_t position, pfe_ct_spd_entry_t *entry); 30 | 31 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 32 | #define ETH_43_PFE_STOP_SEC_CODE 33 | #include "Eth_43_PFE_MemMap.h" 34 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /sw/common/public/ct_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Original code: https://www.pixelbeat.org/programming/gcc/static_assert.html 3 | * Licensed under the GNU All-Permissive License. 4 | * 5 | * Modifications Copyright 2018-2022 NXP 6 | * 7 | * SPDX-License-Identifier: FSFAP 8 | * 9 | */ 10 | 11 | #ifndef CT_ASSERT_H 12 | #define CT_ASSERT_H 13 | 14 | #define STRINGIFY(x) #x 15 | #define TOSTRING(x) STRINGIFY(x) 16 | 17 | #define ASSERT_CONCAT_(a, b) a##b 18 | #define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b) 19 | 20 | #define ct_assert(e) enum { ASSERT_CONCAT(precompile_assert_, __COUNTER__) = (1/(!!(e))) } 21 | 22 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 23 | /* The compiler options for MCAL driver generate errors or warnings when offsetof is used inside of ct_assert. 24 | So it is not possible to assert offset of structures at compile time for MCAL driver. 25 | This is done at runtime in test case Eth_43_PFE_TC_CT_ASSERT in test suite Eth_43_PFE_TS_017. 26 | Therefore ct_assert_offsetof is a dummy implementation on MCAL driver. 27 | */ 28 | #define ct_assert_offsetof(e) enum { ASSERT_CONCAT(precompile_assert_, __COUNTER__) = 1 } 29 | #else 30 | #define ct_assert_offsetof(e) enum { ASSERT_CONCAT(precompile_assert_, __COUNTER__) = 1/(!!(e)) } 31 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 32 | 33 | #endif /* CT_ASSERT_H */ 34 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_wdt_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2020-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PFE_WDT_CSR_H_ 12 | #define PFE_WDT_CSR_H_ 13 | 14 | #include "pfe_wdt.h" 15 | 16 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 17 | #define ETH_43_PFE_START_SEC_CODE 18 | #include "Eth_43_PFE_MemMap.h" 19 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 20 | 21 | errno_t pfe_wdt_cfg_isr(addr_t base_va, addr_t cbus_base_va); 22 | void pfe_wdt_cfg_irq_mask(addr_t base_va); 23 | void pfe_wdt_cfg_irq_unmask(addr_t base_va); 24 | void pfe_wdt_cfg_init(addr_t base_va); 25 | void pfe_wdt_cfg_fini(addr_t base_va); 26 | 27 | #if !defined(PFE_CFG_TARGET_OS_AUTOSAR) || defined(PFE_CFG_TEXT_STATS) 28 | uint32_t pfe_wdt_cfg_get_text_stat(addr_t base_va, char_t *buf, uint32_t size, uint8_t verb_level); 29 | #endif /* !defined(PFE_CFG_TARGET_OS_AUTOSAR) || defined(PFE_CFG_TEXT_STATS) */ 30 | 31 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 32 | #define ETH_43_PFE_STOP_SEC_CODE 33 | #include "Eth_43_PFE_MemMap.h" 34 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 35 | 36 | #endif /* PFE_WDT_CSR_H_ */ 37 | -------------------------------------------------------------------------------- /sw/oal/src/oal_util_linux.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2020 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_OAL_UTIL 10 | * @{ 11 | * 12 | * @file oal_util_qnx.c 13 | * @brief The oal_util module source file. 14 | * @details This file contains utility management implementation. 15 | * 16 | */ 17 | 18 | #include "pfe_cfg.h" 19 | #include "oal_types.h" 20 | #include "oal_util.h" 21 | 22 | #include 23 | 24 | uint32_t oal_util_snprintf(char_t *buffer, size_t buf_len, const char_t *format, ...) 25 | { 26 | uint32_t len = 0; 27 | va_list ap; 28 | 29 | #if defined(PFE_CFG_NULL_ARG_CHECK) 30 | if (unlikely(NULL == buffer)) 31 | { 32 | NXP_LOG_ERROR(" NULL argument received (oal_util_snprintf)\n"); 33 | return 0; 34 | } 35 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 36 | 37 | if(buf_len == 0) 38 | { 39 | NXP_LOG_ERROR(" Wrong buffer size (oal_util_snprintf)\n"); 40 | return 0; 41 | } 42 | va_start(ap, format); 43 | len = vscnprintf(buffer, buf_len, format, ap); 44 | va_end(ap); 45 | return len; 46 | } 47 | 48 | int oal_util_rand(void) 49 | { 50 | int val; 51 | 52 | get_random_bytes(&val, sizeof(int)); 53 | 54 | return val; 55 | } 56 | 57 | /** @}*/ 58 | -------------------------------------------------------------------------------- /sw/linux-pfeng/pfeng-slave-phy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "pfe_cfg.h" 14 | #include "pfeng.h" 15 | 16 | static void phydev_handler(struct net_device *netdev) 17 | { 18 | (void)netdev; 19 | } 20 | 21 | int pfeng_phy_connect(struct pfeng_netif *netif) 22 | { 23 | struct device_node *phy_np; 24 | int ret = 0; 25 | 26 | phy_np = of_parse_phandle(netif->cfg->dn, "phy-handle", 0); 27 | if (!phy_np) { 28 | HM_MSG_NETDEV_WARN(netif->netdev, "Unable to parse phy-handle\n"); 29 | return -ENODEV; 30 | } 31 | 32 | netif->slave_phydev = of_phy_connect(netif->netdev, phy_np, phydev_handler, 0, 33 | netif->priv->emac[netif->cfg->phyif_id].intf_mode); 34 | of_node_put(phy_np); 35 | 36 | if (netif->slave_phydev) 37 | netif->slave_phydev->mac_managed_pm = true; 38 | else 39 | ret = -ENODEV; 40 | 41 | return ret; 42 | } 43 | 44 | void pfeng_phy_disconnect(struct pfeng_netif *netif) 45 | { 46 | if (netif->slave_phydev) { 47 | phy_disconnect(netif->slave_phydev); 48 | netif->slave_phydev = NULL; 49 | } 50 | } 51 | 52 | void pfeng_phy_start(struct pfeng_netif *netif) 53 | { 54 | phy_start(netif->slave_phydev); 55 | } 56 | 57 | void pfeng_phy_stop(struct pfeng_netif *netif) 58 | { 59 | phy_stop(netif->slave_phydev); 60 | } 61 | -------------------------------------------------------------------------------- /sw/oal/public/oal_time.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2022,2024 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgrOAL 10 | * @{ 11 | * 12 | * @defgroup dxgr_OAL_TIME TIME 13 | * @brief Time abstraction 14 | * @details TODO 15 | * 16 | * 17 | * @addtogroup dxgr_OAL_TIME 18 | * @{ 19 | * 20 | * @file oal_time.h 21 | * @brief The oal_time module header file. 22 | * @details This file contains generic time management-related API. 23 | * 24 | */ 25 | 26 | #ifndef PUBLIC_OAL_TIME_H_ 27 | #define PUBLIC_OAL_TIME_H_ 28 | 29 | /** 30 | * @brief Suspend a thread for a given number of microseconds 31 | * @param[in] usec The number of microseconds that you want the process to sleep for 32 | */ 33 | void oal_time_usleep(uint32_t usec); 34 | 35 | /** 36 | * @brief Suspend a thread for a given number of milliseconds 37 | * @param[in] msec The number of milliseconds that you want the process to sleep for 38 | */ 39 | void oal_time_msleep(uint32_t msec); 40 | 41 | void oal_time_udelay(uint32_t usec); 42 | 43 | void oal_time_mdelay(uint32_t msec); 44 | 45 | /** 46 | * @brief Get current system run time in milliseconds 47 | */ 48 | uint64_t oal_time_gettime(void); 49 | 50 | 51 | #endif /* PUBLIC_OAL_TIME_H_ */ 52 | 53 | /** @}*/ 54 | /** @}*/ 55 | -------------------------------------------------------------------------------- /sw/oal/public/oal_master_if.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * 10 | * @file oal_master_if.h 11 | * @brief Master/Slave HIF master interface header file 12 | * @details Use this header to include all the OS-dependent HIF master interface transparency 13 | * 14 | */ 15 | 16 | #ifndef OAL_MASTER_IF_H_ 17 | #define OAL_MASTER_IF_H_ 18 | 19 | /* 20 | * QNX 21 | * 22 | */ 23 | #ifdef PFE_CFG_TARGET_OS_QNX 24 | 25 | #define OAL_PFE_CFG_MASTER_IF PFE_CFG_MASTER_IF 26 | 27 | /* 28 | * LINUX 29 | * 30 | */ 31 | #elif defined(PFE_CFG_TARGET_OS_LINUX) 32 | 33 | /* get_pfeng_pfe_cfg_master_if from pfeng driver M/S */ 34 | extern uint32_t get_pfeng_pfe_cfg_master_if(void); 35 | #define OAL_PFE_CFG_MASTER_IF get_pfeng_pfe_cfg_master_if() 36 | 37 | /* 38 | * AUTOSAR 39 | * 40 | */ 41 | #elif defined(PFE_CFG_TARGET_OS_AUTOSAR) 42 | 43 | #define OAL_PFE_CFG_MASTER_IF PFE_CFG_MASTER_IF 44 | 45 | /* 46 | * BARE METAL 47 | * 48 | */ 49 | #elif defined(PFE_CFG_TARGET_OS_BARE) 50 | 51 | #define OAL_PFE_CFG_MASTER_IF PFE_CFG_MASTER_IF 52 | 53 | /* 54 | * unknown OS 55 | * 56 | */ 57 | #else 58 | #error "PFE_CFG_TARGET_OS_xx was not set!" 59 | #endif /* PFE_CFG_TARGET_OS_xx */ 60 | 61 | #endif /* OAL_MASTER_IF_H_ */ 62 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_wdt.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2020-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PUBLIC_PFE_WDT_H_ 12 | #define PUBLIC_PFE_WDT_H_ 13 | 14 | typedef struct pfe_wdt_tag pfe_wdt_t; 15 | 16 | typedef struct 17 | { 18 | void *pool_pa; 19 | void *pool_va; 20 | } pfe_wdt_cfg_t; 21 | 22 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 23 | #define ETH_43_PFE_START_SEC_CODE 24 | #include "Eth_43_PFE_MemMap.h" 25 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 26 | 27 | pfe_wdt_t *pfe_wdt_create(addr_t cbus_base_va, addr_t wdt_base); 28 | void pfe_wdt_destroy(pfe_wdt_t *wdt); 29 | errno_t pfe_wdt_isr(pfe_wdt_t *wdt); 30 | void pfe_wdt_irq_mask(pfe_wdt_t *wdt); 31 | void pfe_wdt_irq_unmask(pfe_wdt_t *wdt); 32 | 33 | #if !defined(PFE_CFG_TARGET_OS_AUTOSAR) || defined(PFE_CFG_TEXT_STATS) 34 | uint32_t pfe_wdt_get_text_statistics(const pfe_wdt_t *wdt, char_t *buf, uint32_t buf_len, uint8_t verb_level); 35 | #endif /* !defined(PFE_CFG_TARGET_OS_AUTOSAR) || defined(PFE_CFG_TEXT_STATS) */ 36 | 37 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 38 | #define ETH_43_PFE_STOP_SEC_CODE 39 | #include "Eth_43_PFE_MemMap.h" 40 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 41 | 42 | #endif /* PUBLIC_PFE_WDT_H_ */ 43 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_ct_comp.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright 2022-2023 NXP 4 | * 5 | * SPDX-License-Identifier: GPL-2.0 6 | * 7 | * ========================================================================= */ 8 | 9 | #ifndef HW_S32G_PFE_CT_COMP_H_ 10 | #define HW_S32G_PFE_CT_COMP_H_ 11 | #include "pfe_ct.h" 12 | 13 | typedef struct __attribute__((packed,aligned(4))) 14 | { 15 | const char name[16]; 16 | PFE_PTR(uint8_t) const data; 17 | const uint8_t size; 18 | const uint8_t multiplicity; 19 | const uint8_t reserved[2]; 20 | } pfe_ct_feature_tbl_entry_t ; 21 | 22 | typedef struct __attribute__((packed,aligned(4))) 23 | { 24 | pfe_ct_feature_desc_t feature; 25 | PFE_PTR(const pfe_ct_feature_tbl_entry_t) cfg; 26 | PFE_PTR(const pfe_ct_feature_tbl_entry_t) stats; 27 | }pfe_ct_feature_desc_ext_t; 28 | 29 | ct_assert(sizeof(pfe_ct_feature_desc_ext_t) == 24); 30 | 31 | typedef struct __attribute__((packed, aligned(4))) 32 | { 33 | uint16_t vlan; /* VLAN value if applicable */ 34 | pfe_ct_vlan_table_result_t entry; /* Entry value - port map and other */ 35 | uint8_t field_valids; /* see pfe_mac2f_table_entry_valid_bits_t */ 36 | uint8_t flags; /* see pfe_mac2f_table_entry_flags_t */ 37 | uint16_t col_ptr; /* Collision entry pointer */ 38 | } l2br_vlan_hash_entry_t; 39 | 40 | ct_assert(sizeof(l2br_vlan_hash_entry_t) == 16); 41 | 42 | #endif /* HW_S32G_PFE_CT_COMP_H_ */ 43 | -------------------------------------------------------------------------------- /LICENSES/BSD-3-Clause.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2023, NXP 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /sw/oal/src/oal_time_linux.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2021,2024-2025 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_OAL_TIME 10 | * @{ 11 | * 12 | * @file oal_time_linux.c 13 | * @brief The oal_time module source file (Linux). 14 | * @details This file contains Linux-specific time management implementation. 15 | * 16 | */ 17 | 18 | #include 19 | #include 20 | #include "oal_time.h" 21 | #include "pfe_cfg.h" 22 | 23 | /* 24 | See in kernel documentation "Documentation/timers/timers-howto.txt" 25 | for more detailed info 26 | */ 27 | 28 | #define MSEC 1000U 29 | 30 | void oal_time_usleep(uint32_t usec) 31 | { 32 | if(usec <= 10U) 33 | /* less then 10 usec = use udelay (busywait!) */ 34 | udelay(usec); 35 | else if(usec <= (10U * MSEC)) 36 | usleep_range(usec < 100U ? 0U : (usec - 100U), usec + 50U); 37 | else 38 | /* more then 10ms = use msleep_int */ 39 | (void)msleep_interruptible(usec / MSEC); 40 | } 41 | 42 | void oal_time_msleep(uint32_t msec) 43 | { 44 | oal_time_usleep(msec * MSEC); 45 | } 46 | 47 | void oal_time_udelay(uint32_t usec) 48 | { 49 | udelay(usec); 50 | } 51 | 52 | void oal_time_mdelay(uint32_t msec) 53 | { 54 | mdelay(msec); 55 | } 56 | 57 | uint64_t oal_time_gettime(void) 58 | { 59 | ktime_t time; 60 | 61 | time = ktime_get(); 62 | 63 | return (uint64_t)ktime_to_ms(time); 64 | } 65 | 66 | /** @}*/ 67 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_hw_feature.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2021-2022,2025 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef PFE_DRV_FEATURE_H 9 | #define PFE_DRV_FEATURE_H 10 | 11 | typedef struct pfe_hw_feature_tag pfe_hw_feature_t; 12 | 13 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 14 | #define ETH_43_PFE_START_SEC_CODE 15 | #include "Eth_43_PFE_MemMap.h" 16 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 17 | 18 | errno_t pfe_hw_feature_init_all(const uint32_t *cbus_base, pfe_hw_feature_t **hw_features, uint32_t *hw_features_count); 19 | void pfe_hw_feature_fini_all(pfe_hw_feature_t **hw_features, uint32_t *hw_features_count); 20 | errno_t pfe_hw_feature_set_val(pfe_hw_feature_t *feature, uint8_t val); 21 | void pfe_hw_feature_destroy(const pfe_hw_feature_t *feature); 22 | errno_t pfe_hw_feature_get_name(const pfe_hw_feature_t *feature, const char **name); 23 | errno_t pfe_hw_feature_get_desc(const pfe_hw_feature_t *feature, const char **desc); 24 | errno_t pfe_hw_feature_get_flags(const pfe_hw_feature_t *feature, pfe_ct_feature_flags_t *flags); 25 | errno_t pfe_hw_feature_get_def_val(const pfe_hw_feature_t *feature, uint8_t *def_val); 26 | errno_t pfe_hw_feature_get_val(const pfe_hw_feature_t *feature, uint8_t *val); 27 | bool_t pfe_hw_feature_enabled(const pfe_hw_feature_t *feature); 28 | 29 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 30 | #define ETH_43_PFE_STOP_SEC_CODE 31 | #include "Eth_43_PFE_MemMap.h" 32 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /sw/oal/public/oal.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @defgroup dxgrOAL OAL 10 | * @brief The OS Abstraction Layer 11 | * @details OAL is intended to provide OS abstraction. To write portable SW one shall use 12 | * OAL calls instead of OS-specific ones. This OAL module incorporates following 13 | * functionality: 14 | * 15 | * - oal_irq - Interrupt management 16 | * - oal_mbox - Message-based IPC 17 | * - oal_mm - Memory management 18 | * - oal_types - Abstraction of standard types 19 | * - oal_thread - Threading support 20 | * - oal_sync - Thread synchronization 21 | * - oal_util - Simplification utility 22 | * - oaj_job - Job context abstraction 23 | * 24 | * 25 | * @addtogroup dxgrOAL 26 | * @{ 27 | * 28 | * @file oal.h 29 | * @brief The main OAL header file 30 | * @details Use this header to include all the OAL-provided functionality 31 | * 32 | */ 33 | 34 | #ifndef OAL_H_ 35 | #define OAL_H_ 36 | 37 | #ifndef PFE_CFG_H 38 | #error Please include the pfe_cfg.h first. 39 | #endif 40 | 41 | #include "oal_types.h" 42 | #include "oal_mm.h" 43 | #include "oal_util.h" 44 | #include "oal_sync.h" 45 | #include "oal_master_if.h" 46 | #if !defined(PFE_CFG_DETACHED_MINIHIF) 47 | #include "oal_mbox.h" 48 | #include "oal_irq.h" 49 | #include "oal_thread.h" 50 | #include "oal_time.h" 51 | #include "oal_job.h" 52 | #endif /* PFE_CFG_DETACHED_MINIHIF */ 53 | 54 | #endif /* OAL_H_ */ 55 | 56 | /** @}*/ 57 | -------------------------------------------------------------------------------- /sw/fci/public/fci_ownership_mask.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @file fci_ownership_mask.h 10 | * @brief The FCI ownership permission mask 11 | */ 12 | 13 | #ifndef PUBLIC_FCI_OWNERSHIP_MASK_H_ 14 | #define PUBLIC_FCI_OWNERSHIP_MASK_H_ 15 | 16 | #include "pfe_ct.h" 17 | 18 | /** 19 | * @brief The bitmap list of HIF channels that are allowed to take FCI ownership 20 | */ 21 | typedef enum 22 | { 23 | FCI_OWNER_HIF_INVALID = 0, 24 | FCI_OWNER_HIF_0 = (1 << 0), 25 | FCI_OWNER_HIF_1 = (1 << 1), 26 | FCI_OWNER_HIF_2 = (1 << 2), 27 | FCI_OWNER_HIF_3 = (1 << 3), 28 | FCI_OWNER_HIF_NOCPY = (1 << 4) 29 | } pfe_fci_owner_hif_id_t; 30 | 31 | static const pfe_fci_owner_hif_id_t pfe_fci_owner_hif_ids[] = 32 | { 33 | [PFE_PHY_IF_ID_HIF_NOCPY] = FCI_OWNER_HIF_NOCPY, 34 | [PFE_PHY_IF_ID_HIF0] = FCI_OWNER_HIF_0, 35 | [PFE_PHY_IF_ID_HIF1] = FCI_OWNER_HIF_1, 36 | [PFE_PHY_IF_ID_HIF2] = FCI_OWNER_HIF_2, 37 | [PFE_PHY_IF_ID_HIF3] = FCI_OWNER_HIF_3, 38 | [PFE_PHY_IF_ID_INVALID] = FCI_OWNER_HIF_INVALID 39 | }; 40 | 41 | /** 42 | * @brief Convert interface id to bitmask value representing HIF channel that is allowed to take FCI ownership 43 | * @param[in] phy interface id 44 | * @return FCI owner HIF permission bitmask value 45 | */ 46 | static inline pfe_fci_owner_hif_id_t pfe_fci_owner_hif_from_phy_id(pfe_ct_phy_if_id_t phy) 47 | { 48 | pfe_fci_owner_hif_id_t ret_val = FCI_OWNER_HIF_INVALID; 49 | 50 | if (PFE_PHY_IF_ID_INVALID >= phy) 51 | { 52 | ret_val = pfe_fci_owner_hif_ids[phy]; 53 | } 54 | 55 | return ret_val; 56 | } 57 | 58 | #endif /* PUBLIC_FCI_OWNERSHIP_MASK_H_ */ 59 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_idex.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2024 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef PUBLIC_PFE_IDEX_H_ 9 | #define PUBLIC_PFE_IDEX_H_ 10 | 11 | #include "pfe_hif_drv.h" 12 | #include "pfe_hif.h" 13 | 14 | /** 15 | * @brief RPC request callback type 16 | * @details To be called when IDEX has received RPC request 17 | * @warning Don't block or sleep within the body 18 | * @param[in] sender RPC originator identifier 19 | * @param[in] id Request identifier 20 | * @param[in] buf Pointer to request argument. Can be NULL. 21 | * @param[in] buf_len Lenght of request argument. Can be zero. 22 | * @param[in] arg Custom argument provided via pfe_idex_init() 23 | */ 24 | typedef void (*pfe_idex_rpc_cbk_t)(pfe_ct_phy_if_id_t sender, uint32_t id, void *buf, uint16_t buf_len, void *arg); 25 | typedef void (*pfe_idex_tx_conf_free_cbk_t)(void *frame); 26 | 27 | errno_t pfe_idex_init(pfe_hif_drv_t *hif_drv, pfe_ct_phy_if_id_t master, pfe_hif_t *hif, pfe_idex_rpc_cbk_t cbk, void *arg, pfe_idex_tx_conf_free_cbk_t txcf_cbk); 28 | errno_t pfe_idex_rpc(pfe_ct_phy_if_id_t dst_phy, uint32_t id, const void *buf, uint16_t buf_len, void *resp, uint16_t resp_len); 29 | errno_t pfe_idex_master_rpc(uint32_t id, const void *buf, uint16_t buf_len, void *resp, uint16_t resp_len); 30 | errno_t pfe_idex_set_rpc_ret_val(errno_t retval, void *resp, uint16_t resp_len); 31 | void pfe_idex_down(void); 32 | void pfe_idex_fini(void); 33 | void pfe_idex_mark_down(void); 34 | bool_t pfe_idex_status(void); 35 | void pfe_idex_get_text_statistics(struct seq_file *seq, uint8_t verb_level); 36 | 37 | #endif /* PUBLIC_PFE_IDEX_H_ */ 38 | -------------------------------------------------------------------------------- /sw/oal/src/oal_util_net_linux.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_OAL_UTIL_NET_LINUX 10 | * @{ 11 | * 12 | * @file oal_util_net_linux.c 13 | * @brief The oal_util_net_linux module source file. 14 | * @details This file contains network utility implementation for LINUX. 15 | * 16 | */ 17 | 18 | #include 19 | 20 | #include "pfe_cfg.h" 21 | #include "oal_types.h" 22 | #include "oal_util.h" 23 | #include "oal_util_net.h" 24 | 25 | #define NIP4(addr) \ 26 | ((unsigned char *)addr)[0], \ 27 | ((unsigned char *)addr)[1], \ 28 | ((unsigned char *)addr)[2], \ 29 | ((unsigned char *)addr)[3] 30 | 31 | #define NIP6(addr) \ 32 | ntohs(((struct in6_addr *)addr)->s6_addr16[0]), \ 33 | ntohs(((struct in6_addr *)addr)->s6_addr16[1]), \ 34 | ntohs(((struct in6_addr *)addr)->s6_addr16[2]), \ 35 | ntohs(((struct in6_addr *)addr)->s6_addr16[3]), \ 36 | ntohs(((struct in6_addr *)addr)->s6_addr16[4]), \ 37 | ntohs(((struct in6_addr *)addr)->s6_addr16[5]), \ 38 | ntohs(((struct in6_addr *)addr)->s6_addr16[6]), \ 39 | ntohs(((struct in6_addr *)addr)->s6_addr16[7]) 40 | 41 | char_t *oal_util_net_inet_ntop(int32_t af, const void *src, char_t *dst, uint32_t size) 42 | { 43 | int32_t ret; 44 | 45 | switch(af) { 46 | case AF_INET: 47 | ret = snprintf(dst, size, "%d.%d.%d.%d", NIP4(src)); 48 | break; 49 | case AF_INET6: 50 | ret = snprintf(dst, size, "%d.%d.%d.%d.%d.%d.%d.%d", NIP6(src)); 51 | break; 52 | default: 53 | ret = -EAFNOSUPPORT; 54 | break; 55 | } 56 | 57 | if(ret > 0) 58 | return dst; 59 | 60 | return NULL; 61 | } 62 | 63 | /** @}*/ 64 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_cbus.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2023 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PFE_CBUS_H_ 12 | #define PFE_CBUS_H_ 13 | 14 | #define CBUS_LMEM_BASE_ADDR (0x00000U) 15 | #define CBUS_LMEM_SIZE (0x20000U) 16 | #define CBUS_TMU_CSR_BASE_ADDR (0x80000U) 17 | #define CBUS_BMU1_BASE_ADDR (0x88000U) 18 | #define CBUS_BMU2_BASE_ADDR (0x8C000U) 19 | #define CBUS_CLASS_CSR_BASE_ADDR (0x90000U) 20 | #define CBUS_GLOBAL_CSR_BASE_ADDR (0x94000U) 21 | #define CBUS_HIF_BASE_ADDR (0x98000U) 22 | #define CBUS_HGPI_BASE_ADDR (0x9C000U) 23 | #define CBUS_EMAC1_BASE_ADDR (0xA0000U) 24 | #define CBUS_EMAC2_BASE_ADDR (0xA4000U) 25 | #define CBUS_EMAC3_BASE_ADDR (0xA8000U) 26 | #define CBUS_EGPI1_BASE_ADDR (0xAC000U) 27 | #define CBUS_EGPI2_BASE_ADDR (0xB0000U) 28 | #define CBUS_EGPI3_BASE_ADDR (0xB4000U) 29 | #define CBUS_ETGPI1_BASE_ADDR (0xB8000U) 30 | #define CBUS_ETGPI2_BASE_ADDR (0xBC000U) 31 | #define CBUS_ETGPI3_BASE_ADDR (0xC0000U) 32 | #define CBUS_UTIL_CSR_BASE_ADDR (0xCC000U) 33 | #define CBUS_HIF_NOCPY_BASE_ADDR (0xD0000U) 34 | #define CBUS_ROUTE_LMEM_ADDR (0xE0000U) 35 | #define CBUS_ROUTE_LMEM_SIZE (0x20000U) 36 | 37 | #define PFE_CORE_DISABLE 0x00000000U 38 | #define PFE_CORE_ENABLE 0x00000001U 39 | #define PFE_CORE_SW_RESET 0x00000002U 40 | 41 | #include "pfe_global_wsp.h" 42 | #include "pfe_class_csr.h" 43 | #include "pfe_tmu_csr.h" 44 | #include "pfe_util_csr.h" 45 | #include "pfe_gpi_csr.h" 46 | #include "pfe_hif_csr.h" 47 | #include "pfe_bmu_csr.h" 48 | #include "pfe_emac_csr.h" 49 | 50 | #endif /* PFE_CBUS_H_ */ 51 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_util.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2024 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef SRC_PFE_UTIL_H_ 12 | #define SRC_PFE_UTIL_H_ 13 | 14 | typedef struct pfe_util_tag pfe_util_t; 15 | 16 | typedef struct 17 | { 18 | uint32_t pe_sys_clk_ratio; /* Clock mode ratio for sys_clk and pe_clk */ 19 | bool_t on_g3; 20 | uint32_t interrupt; 21 | } pfe_util_cfg_t; 22 | 23 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 24 | #define ETH_43_PFE_START_SEC_CODE 25 | #include "Eth_43_PFE_MemMap.h" 26 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 27 | 28 | pfe_util_t *pfe_util_create(addr_t cbus_base_va, uint32_t pe_num, const pfe_util_cfg_t *cfg); 29 | void pfe_util_enable(pfe_util_t *util); 30 | void pfe_util_reset(pfe_util_t *util); 31 | void pfe_util_disable(pfe_util_t *util); 32 | errno_t pfe_util_load_firmware(pfe_util_t *util, const void *elf); 33 | 34 | uint32_t pfe_util_get_text_statistics(const pfe_util_t *util, struct seq_file *seq, uint8_t verb_level); 35 | 36 | void pfe_util_destroy(pfe_util_t *util); 37 | errno_t pfe_util_get_fw_version(const pfe_util_t *util, pfe_ct_version_t *ver); 38 | errno_t pfe_util_get_feature(const pfe_util_t *util, pfe_fw_feature_t **feature, const char *name); 39 | errno_t pfe_util_get_feature_first(pfe_util_t *util, pfe_fw_feature_t **feature); 40 | errno_t pfe_util_get_feature_next(pfe_util_t *util, pfe_fw_feature_t **feature); 41 | 42 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 43 | #define ETH_43_PFE_STOP_SEC_CODE 44 | #include "Eth_43_PFE_MemMap.h" 45 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 46 | 47 | #endif /* SRC_PFE_UTIL_H_ */ 48 | -------------------------------------------------------------------------------- /sw/fci/public/fci_msg.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_FCI 10 | * @{ 11 | * 12 | * @file fci_msg.h 13 | * @brief The FCI IPC message type 14 | * @details This header provides the fci_msg_t. 15 | * 16 | */ 17 | 18 | #ifndef SRC_FCI_MSG_H_ 19 | #define SRC_FCI_MSG_H_ 20 | 21 | #include "ct_assert.h" 22 | 23 | /** 24 | * @brief Maximum size of FCI IPC message payload 25 | * @see fci_msg_t 26 | */ 27 | #define FCI_CFG_MAX_CMD_PAYLOAD_LEN 256U 28 | 29 | /** 30 | * @brief FCI message types 31 | * @see fci_msg_t 32 | */ 33 | typedef enum 34 | { 35 | FCI_MSG_TYPE_MIN = 0x1000, 36 | FCI_MSG_CLIENT_REGISTER, 37 | FCI_MSG_CLIENT_UNREGISTER, 38 | FCI_MSG_CMD, 39 | FCI_MSG_CORE_CLIENT_BROADCAST, 40 | /* Ensure proper size */ 41 | FCI_MSG_TYPE_MAX = (int)(1U << 31U) 42 | } msg_type_t; 43 | 44 | ct_assert(sizeof(msg_type_t) == sizeof(uint32_t)); 45 | 46 | /** 47 | * @brief FCI message command type 48 | */ 49 | typedef struct 50 | { 51 | uint32_t code; /*!< Message code */ 52 | uint32_t length; /*!< Message length */ 53 | uint32_t sender; /*!< Message sender originator identifier */ 54 | uint8_t payload[FCI_CFG_MAX_CMD_PAYLOAD_LEN]; /*!< Message payload */ 55 | } fci_msg_cmd_t; 56 | 57 | /* 58 | * QNX 59 | * 60 | */ 61 | #if defined(PFE_CFG_TARGET_OS_QNX) 62 | #include "fci_msg_qnx.h" 63 | 64 | /* 65 | * LINUX 66 | * 67 | */ 68 | #elif defined(PFE_CFG_TARGET_OS_LINUX) 69 | #include "fci_msg_linux.h" 70 | 71 | /* 72 | * AUTOSAR 73 | * 74 | */ 75 | #elif defined(PFE_CFG_TARGET_OS_AUTOSAR) 76 | #include "fci_msg_autosar.h" 77 | 78 | /* 79 | * unknown OS 80 | * 81 | */ 82 | #else 83 | #error "PFE_CFG_TARGET_OS_xx was not set!" 84 | #endif /* PFE_CFG_TARGET_OS_xx */ 85 | 86 | #endif /* SRC_FCI_MSG_H_ */ 87 | 88 | /** @}*/ 89 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_def_help.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef CLI_DEF_HELP_H_ 32 | #define CLI_DEF_HELP_H_ 33 | 34 | #include 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | void cli_print_help(uint16_t cmd); 39 | 40 | /* ========================================================================= */ 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/daemon/daemon.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef DAEMON_H_ 32 | #define DAEMON_H_ 33 | 34 | /* ==== PUBLIC FUNCTIONS =================================================== */ 35 | 36 | typedef struct daemon_cfg_tt daemon_cfg_t; 37 | 38 | int daemon_start(const daemon_cfg_t* p_startup_daemon_cfg); 39 | 40 | /* ========================================================================= */ 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_parser.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_PARSER_H_ 32 | #define LIBFCI_CLI_PARSER_H_ 33 | 34 | /* ==== PUBLIC FUNCTIONS =================================================== */ 35 | 36 | void cli_print_app_version(bool is_verbose); 37 | 38 | int cli_parse_and_execute(char* pp_txtarr[], int arrln); 39 | 40 | /* ========================================================================= */ 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_fci_owner.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_FCI_OWNER_H_ 32 | #define LIBFCI_CLI_CMDS_FCI_OWNER_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_fci_ownership(const cli_cmdargs_t *p_cmdargs); 39 | 40 | /* ========================================================================= */ 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_util_csr.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2024 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #include "pfe_cfg.h" 12 | #include "oal.h" 13 | #include "hal.h" 14 | #include "pfe_cbus.h" 15 | #include "pfe_util_csr.h" 16 | 17 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 18 | #define ETH_43_PFE_START_SEC_CODE 19 | #include "Eth_43_PFE_MemMap.h" 20 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 21 | 22 | /** 23 | * @brief Get UTIL statistics in text form 24 | * @details This is a HW-specific function providing detailed text statistics 25 | * about the UTIL block. 26 | * @param[in] base_va Base address of UTIL register space (virtual) 27 | * @param[in] seq Pointer to debugfs seq_file 28 | * @param[in] verb_level Verbosity level 29 | * @return Number of bytes written to the buffer 30 | */ 31 | uint32_t pfe_util_cfg_get_text_stat(addr_t base_va, struct seq_file *seq, uint8_t verb_level) 32 | { 33 | uint32_t reg; 34 | 35 | #if defined(PFE_CFG_NULL_ARG_CHECK) 36 | if (unlikely(NULL_ADDR == base_va)) 37 | { 38 | NXP_LOG_ERROR("NULL argument received\n"); 39 | } 40 | else 41 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 42 | { 43 | /* Get version */ 44 | if(verb_level >= 9U) 45 | { 46 | reg = hal_read32(base_va + UTIL_VERSION); 47 | seq_printf(seq, "Revision : 0x%x\n", (reg >> 24U) & 0xffU); 48 | seq_printf(seq, "Version : 0x%x\n", (reg >> 16U) & 0xffU); 49 | seq_printf(seq, "ID : 0x%x\n", reg & 0xffffU); 50 | } 51 | 52 | seq_printf(seq, "Max buffer count\t0x%08x\n", hal_read32(base_va + UTIL_MAX_BUF_CNT)); 53 | seq_printf(seq, "TQS max count\t\t0x%08x\n", hal_read32(base_va + UTIL_TSQ_MAX_CNT)); 54 | } 55 | return 0; 56 | } 57 | 58 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 59 | #define ETH_43_PFE_STOP_SEC_CODE 60 | #include "Eth_43_PFE_MemMap.h" 61 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 62 | 63 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_mirror.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2021-2024 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | #ifndef PFE_MIRROR_H 8 | #define PFE_MIRROR_H 9 | 10 | #include "pfe_class.h" 11 | 12 | typedef struct pfe_mirror_tag pfe_mirror_t; 13 | 14 | typedef enum 15 | { 16 | MIRROR_ANY, /* Retrieve the 1st entry in the database, arg not used */ 17 | MIRROR_BY_NAME, /* Retrieve the entry with matching name, arg is a string (the name) */ 18 | MIRROR_BY_PHYS_ADDR /* Retrieve the entry with matching DMEM address, arg is addr_t (the address) */ 19 | } pfe_mirror_db_crit_t; 20 | 21 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 22 | #define ETH_43_PFE_START_SEC_CODE 23 | #include "Eth_43_PFE_MemMap.h" 24 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 25 | 26 | errno_t pfe_mirror_init(pfe_class_t *class); 27 | void pfe_mirror_deinit(void); 28 | pfe_mirror_t *pfe_mirror_get_first(pfe_mirror_db_crit_t crit, const void *arg); 29 | pfe_mirror_t *pfe_mirror_get_next(void); 30 | pfe_mirror_t *pfe_mirror_create(const char *name); 31 | errno_t pfe_mirror_destroy(pfe_mirror_t *mirror); 32 | void pfe_mirror_put(pfe_mirror_t *mirror); 33 | void pfe_mirror_put_by_address(addr_t address); 34 | uint32_t pfe_mirror_get_address(const pfe_mirror_t *mirror); 35 | const char * pfe_mirror_get_name(const pfe_mirror_t *mirror); 36 | errno_t pfe_mirror_set_egress_port(pfe_mirror_t *mirror, pfe_ct_phy_if_id_t egress); 37 | pfe_ct_phy_if_id_t pfe_mirror_get_egress_port(const pfe_mirror_t *mirror); 38 | errno_t pfe_mirror_set_filter(pfe_mirror_t *mirror, uint32_t filter_address); 39 | uint32_t pfe_mirror_get_filter(const pfe_mirror_t *mirror); 40 | errno_t pfe_mirror_set_actions(pfe_mirror_t *mirror, pfe_ct_route_actions_t actions, const pfe_ct_route_actions_args_t *args); 41 | errno_t pfe_mirror_get_actions(const pfe_mirror_t *mirror, pfe_ct_route_actions_t *actions, pfe_ct_route_actions_args_t *args); 42 | 43 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 44 | #define ETH_43_PFE_STOP_SEC_CODE 45 | #include "Eth_43_PFE_MemMap.h" 46 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 47 | 48 | #endif /* PFE_MIRROR_H */ 49 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/daemon/daemon_fciev2txt.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef DAEMON_FCIEV2TXT_H_ 32 | #define DAEMON_FCIEV2TXT_H_ 33 | 34 | /* ==== PUBLIC FUNCTIONS =================================================== */ 35 | 36 | int daemon_fciev2txt_print(char* p_dst, int rtn_dst_ln, const unsigned short fcode, const unsigned short len, const unsigned short* payload); 37 | 38 | /* ========================================================================= */ 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_data_buf.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2025 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_DATA_BUF_H_ 32 | #define LIBFCI_CLI_CMDS_DATA_BUF_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_data_buf_put(const cli_cmdargs_t *p_cmdargs); 39 | 40 | /* ========================================================================= */ 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_mac_db.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PUBLIC_PFE_MAC_DB_H_ 12 | #define PUBLIC_PFE_MAC_DB_H_ 13 | 14 | #include "linked_list.h" 15 | #include "oal_types.h" 16 | 17 | #include "pfe_ct.h" 18 | #include "pfe_emac.h" 19 | 20 | #define PFE_MAC_DB_LOCKED TRUE 21 | #define PFE_MAC_DB_UNLOCKED FALSE 22 | 23 | typedef struct 24 | { 25 | pfe_mac_addr_t addr; /* The MAC address */ 26 | LLIST_t iterator; /* List chain entry */ 27 | pfe_drv_id_t owner; /* Identification of the driver that owns this entry */ 28 | } pfe_mac_db_list_entry_t; 29 | 30 | /** 31 | * @brief Possible rules to get or flush some sort of MAC addresses 32 | */ 33 | typedef enum __attribute__ ((packed)) { 34 | MAC_DB_CRIT_BY_TYPE = 0U, 35 | MAC_DB_CRIT_BY_OWNER, 36 | MAC_DB_CRIT_BY_OWNER_AND_TYPE, 37 | MAC_DB_CRIT_ALL, 38 | MAC_DB_CRIT_INVALID, 39 | } pfe_mac_db_crit_t; 40 | 41 | typedef struct pfe_mac_db_tag pfe_mac_db_t; 42 | 43 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 44 | #define ETH_43_PFE_START_SEC_CODE 45 | #include "Eth_43_PFE_MemMap.h" 46 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 47 | 48 | pfe_mac_db_t *pfe_mac_db_create(void); 49 | errno_t pfe_mac_db_destroy(pfe_mac_db_t *db); 50 | errno_t pfe_mac_db_add_addr(pfe_mac_db_t *db, const pfe_mac_addr_t addr, pfe_drv_id_t owner); 51 | errno_t pfe_mac_db_del_addr(pfe_mac_db_t *db, const pfe_mac_addr_t addr, pfe_drv_id_t owner); 52 | errno_t pfe_mac_db_flush(pfe_mac_db_t *db, pfe_mac_db_crit_t crit, pfe_mac_type_t type, pfe_drv_id_t owner); 53 | errno_t pfe_mac_db_get_first_addr(pfe_mac_db_t *db, pfe_mac_db_crit_t crit, pfe_mac_type_t type, pfe_drv_id_t owner, pfe_mac_addr_t addr); 54 | errno_t pfe_mac_db_get_next_addr(pfe_mac_db_t *db, pfe_mac_addr_t addr); 55 | 56 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 57 | #define ETH_43_PFE_STOP_SEC_CODE 58 | #include "Eth_43_PFE_MemMap.h" 59 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 60 | 61 | #endif /* PUBLIC_PFE_MAC_DB_H_ */ 62 | -------------------------------------------------------------------------------- /sw/oal/public/oal_thread.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018,2020,2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgrOAL 10 | * @{ 11 | * 12 | * @defgroup dxgr_OAL_THREAD THREAD 13 | * @brief Threading abstraction 14 | * @details TODO 15 | * 16 | * 17 | * @addtogroup dxgr_OAL_THREAD 18 | * @{ 19 | * 20 | * @file oal_thread.h 21 | * @brief The oal_thread module header file. 22 | * @details This file contains generic thread management-related API. 23 | * 24 | */ 25 | 26 | #ifndef PUBLIC_OAL_THREAD_H_ 27 | #define PUBLIC_OAL_THREAD_H_ 28 | 29 | typedef struct __oal_thread_tag oal_thread_t; 30 | typedef void * (* oal_thread_func)(void *arg); 31 | 32 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 33 | #define ETH_43_PFE_START_SEC_CODE 34 | #include "Eth_43_PFE_MemMap.h" 35 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 36 | 37 | /** 38 | * @brief Create new thread 39 | * @param[in] func Function to be executed within the thread 40 | * @param[in] func_arg Function argument 41 | * @param[in] name The thread name in string form 42 | * @param[in] attrs Thread attributes 43 | * @return New thread instance or NULL if failed 44 | */ 45 | oal_thread_t *oal_thread_create(oal_thread_func func, void *func_arg, const char_t *name, uint32_t attrs); 46 | 47 | /** 48 | * @brief Wait for thread termination 49 | * @param[in] thread The thread instance 50 | * @param[out] retval Pointer where return value shall be written or NULL if not required 51 | * @return EOK if success, error code otherwise 52 | */ 53 | errno_t oal_thread_join(oal_thread_t *thread, void **retval); 54 | 55 | /** 56 | * @brief Cancel the thread 57 | * @param[in] thread The thread instance 58 | * @return EOK if success, error code otherwise 59 | */ 60 | errno_t oal_thread_cancel(oal_thread_t *thread); 61 | 62 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 63 | #define ETH_43_PFE_STOP_SEC_CODE 64 | #include "Eth_43_PFE_MemMap.h" 65 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 66 | 67 | #endif /* PUBLIC_OAL_THREAD_H_ */ 68 | 69 | /** @}*/ 70 | /** @}*/ 71 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_demo_feature.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_DEMO_FEATURE_H_ 32 | #define LIBFCI_CLI_CMDS_DEMO_FEATURE_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_demo_feature_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_demo_feature_run(const cli_cmdargs_t *p_cmdargs); 40 | 41 | /* ========================================================================= */ 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /sw/oal/public/oal_util_net.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgrOAL_UTIL 10 | * @{ 11 | * 12 | * @defgroup dxgr_OAL_UTIL_NET NET 13 | * @brief Advanced utilities, network subsection 14 | * @details Network specific utilities 15 | * 16 | * 17 | * @addtogroup dxgr_OAL_UTIL_NET 18 | * @{ 19 | * 20 | * @file oal_util_net.h 21 | * @brief The oal_util_net module header file. 22 | * @details This file contains network specific utilities API. 23 | * 24 | */ 25 | 26 | #ifndef OAL_UTIL_NET_H_ 27 | #define OAL_UTIL_NET_H_ 28 | 29 | #include "oal_types.h" 30 | 31 | /* 32 | * QNX 33 | * 34 | */ 35 | #ifdef PFE_CFG_TARGET_OS_QNX 36 | #include "oal_util_net_qnx.h" 37 | 38 | /* 39 | * LINUX 40 | * 41 | */ 42 | #elif defined(PFE_CFG_TARGET_OS_LINUX) 43 | #include "oal_util_net_linux.h" 44 | 45 | /* 46 | * AUTOSAR 47 | * 48 | */ 49 | #elif defined(PFE_CFG_TARGET_OS_AUTOSAR) 50 | #include "oal_util_net_autosar.h" 51 | 52 | /* 53 | * unknown OS 54 | * 55 | */ 56 | #else 57 | #error "PFE_CFG_TARGET_OS_xx was not set!" 58 | #endif /* PFE_CFG_TARGET_OS_xx */ 59 | 60 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 61 | #define ETH_43_PFE_START_SEC_CODE 62 | #include "Eth_43_PFE_MemMap.h" 63 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 64 | 65 | /** 66 | * @brief Convert a numeric network address to a string 67 | * @details Function return the pointer to the buffer containing 68 | * @details the string version of network address, NULL otherwise 69 | * @param[in] af The address network family 70 | * @param[in] src The numeric network address 71 | * @param[out] dst The buffer with string represented the netowrk address 72 | * @param[in] size The size of the buffer 73 | * 74 | * @return The pointer the to buffer, NULL if error occured 75 | */ 76 | char_t *oal_util_net_inet_ntop(int32_t af, const void *src, char_t *dst, uint32_t size); 77 | 78 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 79 | #define ETH_43_PFE_STOP_SEC_CODE 80 | #include "Eth_43_PFE_MemMap.h" 81 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 82 | 83 | #endif /* OAL_UTIL_NET_H_ */ 84 | 85 | /** @}*/ 86 | /** @}*/ 87 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_spd.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_SPD_H_ 32 | #define LIBFCI_CLI_CMDS_SPD_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_spd_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_spd_add(const cli_cmdargs_t *p_cmdargs); 40 | int cli_cmd_spd_del(const cli_cmdargs_t *p_cmdargs); 41 | 42 | /* ========================================================================= */ 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_demo/demo_fci_owner.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef DEMO_FCI_OWNER_H_ 32 | #define DEMO_FCI_OWNER_H_ 33 | 34 | #include 35 | #include 36 | #include "fpp.h" 37 | #include "fpp_ext.h" 38 | #include "libfci.h" 39 | 40 | /* ==== PUBLIC FUNCTIONS : use FCI calls to get data from PFE ============== */ 41 | 42 | int demo_fci_ownership_lock(FCI_CLIENT* p_cl); 43 | int demo_fci_ownership_unlock(FCI_CLIENT* p_cl); 44 | 45 | /* ========================================================================= */ 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_fwfeat.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_SPD_H_ 32 | #define LIBFCI_CLI_CMDS_SPD_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_fwfeat_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_fwfeat_set(const cli_cmdargs_t *p_cmdargs); 40 | int cli_cmd_fwfeat_el_print(const cli_cmdargs_t *p_cmdargs); 41 | int cli_cmd_fwfeat_el_set(const cli_cmdargs_t *p_cmdargs); 42 | 43 | /* ========================================================================= */ 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_daemon.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_DAEMON_H_ 32 | #define LIBFCI_CLI_CMDS_DAEMON_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_daemon_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_daemon_update(const cli_cmdargs_t *p_cmdargs); 40 | int cli_cmd_daemon_start(const cli_cmdargs_t *p_cmdargs); 41 | int cli_cmd_daemon_stop(const cli_cmdargs_t *p_cmdargs); 42 | 43 | /* ========================================================================= */ 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_if_mac.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_IF_MAC_H_ 32 | #define LIBFCI_CLI_CMDS_IF_MAC_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int if_mac_print_in_phyif(const fpp_if_mac_cmd_t* p_if_mac); 39 | 40 | int cli_cmd_phyif_mac_print(const cli_cmdargs_t *p_cmdargs); 41 | int cli_cmd_phyif_mac_add(const cli_cmdargs_t *p_cmdargs); 42 | int cli_cmd_phyif_mac_del(const cli_cmdargs_t *p_cmdargs); 43 | 44 | /* ========================================================================= */ 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /sw/fifo/public/fifo.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2024 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef SRC_fifo_H_ 9 | #define SRC_fifo_H_ 10 | 11 | #include "hal.h" 12 | 13 | struct __attribute__((aligned(HAL_CACHE_LINE_SIZE))) fifo_tag 14 | { 15 | uint32_t read; 16 | uint32_t write; 17 | uint32_t depth; 18 | uint32_t depth_mask; 19 | bool_t protected; 20 | void **data; 21 | }; 22 | 23 | typedef volatile struct fifo_tag fifo_t; 24 | 25 | static inline errno_t fifo_put(fifo_t *const fifo, void *const ptr) 26 | { 27 | uint32_t fill_level; 28 | errno_t err; 29 | 30 | #if defined(PFE_CFG_NULL_ARG_CHECK) 31 | if (unlikely(NULL == fifo)) 32 | { 33 | NXP_LOG_ERROR("NULL argument received\n"); 34 | return EINVAL; 35 | } 36 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 37 | 38 | fill_level = (fifo->write - fifo->read); 39 | 40 | if (likely(fill_level < fifo->depth)) 41 | { 42 | fifo->data[fifo->write & fifo->depth_mask] = ptr; 43 | 44 | /* Ensure that entry contains correct data */ 45 | hal_wmb(); 46 | 47 | fifo->write++; 48 | 49 | err = EOK; 50 | } 51 | else 52 | { 53 | /* Overflow */ 54 | err = EOVERFLOW; 55 | } 56 | 57 | return err; 58 | } 59 | 60 | static inline void * fifo_get(fifo_t * const fifo) 61 | { 62 | void *ret = NULL; 63 | uint32_t fill_level; 64 | 65 | #if defined(PFE_CFG_NULL_ARG_CHECK) 66 | if (unlikely(NULL == fifo)) 67 | { 68 | NXP_LOG_ERROR("NULL argument received\n"); 69 | return NULL; 70 | } 71 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 72 | 73 | fill_level = (fifo->write - fifo->read); 74 | 75 | if (likely(fill_level > 0U)) 76 | { 77 | ret = fifo->data[fifo->read & fifo->depth_mask]; 78 | fifo->read++; 79 | } 80 | 81 | return (void *)ret; 82 | } 83 | 84 | fifo_t * fifo_create(const uint32_t depth) __attribute__((cold, aligned(64))); 85 | void fifo_destroy(fifo_t *const fifo) __attribute__((cold, aligned(64))); 86 | void fifo_clear(fifo_t *const fifo) __attribute__((cold, aligned(64))); 87 | void * fifo_peek(const fifo_t * const fifo, uint32_t num) __attribute__((hot)); 88 | errno_t fifo_get_fill_level(const fifo_t *const fifo, uint32_t *fill_level) __attribute__((hot)); 89 | errno_t fifo_get_free_space(const fifo_t *const fifo, uint32_t *free_space) __attribute__((hot)); 90 | 91 | #endif /* SRC_fifo_H_ */ 92 | -------------------------------------------------------------------------------- /sw/oal/public/oal_types.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgrOAL 10 | * @{ 11 | * 12 | * @defgroup dxgr_OAL_TYPES TYPES 13 | * @brief Standard types 14 | * @details 15 | * 16 | * 17 | * @addtogroup dxgr_OAL_TYPES 18 | * @{ 19 | * 20 | * @file oal_types.h 21 | * @brief Header for standard types 22 | * @details TODO 23 | * 24 | */ 25 | 26 | #ifndef OAL_TYPES_H_ 27 | #define OAL_TYPES_H_ 28 | 29 | /* 30 | * QNX 31 | * 32 | */ 33 | #ifdef PFE_CFG_TARGET_OS_QNX 34 | #include "oal_types_qnx.h" 35 | 36 | /* 37 | * LINUX 38 | * 39 | */ 40 | #elif defined(PFE_CFG_TARGET_OS_LINUX) 41 | #include "oal_types_linux.h" 42 | 43 | /* 44 | * AUTOSAR 45 | * 46 | */ 47 | #elif defined(PFE_CFG_TARGET_OS_AUTOSAR) 48 | #include "oal_types_autosar.h" 49 | 50 | /* 51 | * BARE METAL 52 | * 53 | */ 54 | #elif defined(PFE_CFG_TARGET_OS_BARE) 55 | #include "oal_types_bare.h" 56 | 57 | /* 58 | * unknown OS 59 | * 60 | */ 61 | #else 62 | #error "PFE_CFG_TARGET_OS_xx was not set!" 63 | #endif /* PFE_CFG_TARGET_OS_xx */ 64 | 65 | #include "ct_assert.h" 66 | 67 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 68 | #define ETH_43_PFE_START_SEC_CODE 69 | #include "Eth_43_PFE_MemMap.h" 70 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 71 | 72 | /** 73 | * @brief Swap byte order in a buffer 74 | * @detail Convert byte order of each 4-byte word within given buffer 75 | * @param[in] data Pointer to buffer to be converted 76 | * @param[in] size Number of bytes in the buffer 77 | */ 78 | static inline void oal_swap_endian_long(void *data, uint32_t size) 79 | { 80 | uint32_t ii, words = size >> 2; 81 | uint32_t *word = (uint32_t *)data; 82 | 83 | if (0U != (size & 0x3U)) 84 | { 85 | words += 1U; 86 | } 87 | 88 | for (ii=0U; ii 9 | 10 | #include "pfe_cfg.h" 11 | #include "pfeng.h" 12 | 13 | static int pfeng_fw_load_file(struct device *dev, const char *name, void **data, u32 *len) 14 | { 15 | int ret; 16 | const struct firmware *entry; 17 | 18 | ret = request_firmware(&entry, name, dev); 19 | if(ret < 0) { 20 | HM_MSG_DEV_ERR(dev, "Firmware not available: %s\n", name); 21 | return ret; 22 | } 23 | 24 | if(!entry->size) { 25 | HM_MSG_DEV_ERR(dev, "Firmware file is empty: %s\n", name); 26 | goto end; 27 | } 28 | 29 | *data = kmalloc(entry->size, GFP_KERNEL); 30 | if(IS_ERR(*data)) { 31 | HM_MSG_DEV_ERR(dev, "Failed to alloc fw data memory\n"); 32 | ret = IS_ERR(*data); 33 | goto end; 34 | } 35 | *len = entry->size; 36 | memcpy(*data, (char *)entry->data, entry->size); 37 | 38 | end: 39 | release_firmware(entry); 40 | 41 | return ret; 42 | } 43 | 44 | int pfeng_fw_load(struct pfeng_priv *priv, const char *class_name, const char *util_name) 45 | { 46 | struct device *dev = &priv->pdev->dev; 47 | pfe_fw_t *fw; 48 | int ret; 49 | bool enable_util = priv->pfe_cfg->enable_util; 50 | u32 class_size; 51 | u32 util_size; 52 | 53 | fw = kzalloc(sizeof(*fw), GFP_KERNEL); 54 | if(IS_ERR(fw)) { 55 | HM_MSG_DEV_ERR(dev, "Failed to alloc fw memory\n"); 56 | return -ENOMEM; 57 | } 58 | 59 | priv->pfe_cfg->fw = fw; 60 | 61 | /* load CLASS fw */ 62 | ret = pfeng_fw_load_file(dev, class_name, (void **)&fw->class_data, &class_size); 63 | if (ret) 64 | goto err; 65 | 66 | /* load UTIL fw */ 67 | if (enable_util) { 68 | ret = pfeng_fw_load_file(dev, util_name, (void **)&fw->util_data, &util_size); 69 | if (ret) 70 | goto err; 71 | } 72 | 73 | HM_MSG_DEV_INFO(dev, "Firmware: CLASS %s [%d bytes]\n", class_name, class_size); 74 | if (enable_util) 75 | HM_MSG_DEV_INFO(dev, "Firmware: UTIL %s [%d bytes]\n", util_name, util_size); 76 | 77 | end: 78 | return ret; 79 | 80 | err: 81 | pfeng_fw_free(priv); 82 | goto end; 83 | } 84 | 85 | void pfeng_fw_free(struct pfeng_priv *priv) 86 | { 87 | pfe_fw_t *fw = priv->pfe_cfg->fw; 88 | 89 | if(fw->class_data) { 90 | kfree(fw->class_data); 91 | fw->class_data = NULL; 92 | } 93 | 94 | if(fw->util_data) { 95 | kfree(fw->util_data); 96 | fw->util_data = NULL; 97 | } 98 | 99 | priv->pfe_cfg->fw = NULL; 100 | 101 | kfree(fw); 102 | } 103 | -------------------------------------------------------------------------------- /sw/oal/public/oal_job.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgrOAL 10 | * @{ 11 | * 12 | * @defgroup dxgr_OAL_JOB JOB 13 | * @brief Deferred job abstraction 14 | * @details TODO 15 | * 16 | * 17 | * @addtogroup dxgr_OAL_JOB 18 | * @{ 19 | * 20 | * @file oal_job.h 21 | * @brief The oal_job module header file. 22 | * @details This file contains generic deferred job management-related API. 23 | * 24 | */ 25 | 26 | #ifndef PUBLIC_OAL_JOB_H_ 27 | #define PUBLIC_OAL_JOB_H_ 28 | 29 | typedef struct oal_job_tag oal_job_t; 30 | typedef void (* oal_job_func)(void *arg); 31 | 32 | /** 33 | * @brief Priority enumeration type 34 | */ 35 | typedef enum 36 | { 37 | OAL_PRIO_LOW, 38 | OAL_PRIO_NORMAL, 39 | OAL_PRIO_HIGH, 40 | OAL_PRIO_TOP 41 | } oal_prio_t; 42 | 43 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 44 | #define ETH_43_PFE_START_SEC_CODE 45 | #include "Eth_43_PFE_MemMap.h" 46 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 47 | 48 | /** 49 | * @brief Create new job 50 | * @param[in] func Function to be executed within the job 51 | * @param[in] arg Function argument 52 | * @param[in] name The job name in string form 53 | * @param[in] prio Job priority 54 | * @return New job instance or NULL if failed 55 | */ 56 | oal_job_t *oal_job_create(oal_job_func func, void *arg, const char_t *name, oal_prio_t prio); 57 | 58 | /** 59 | * @brief Destroy job 60 | * @details Function will wait until job is done and then dispose the instance 61 | * @param[in] job The job instance 62 | * @return EOK if success, error code otherwise 63 | */ 64 | errno_t oal_job_destroy(oal_job_t *job); 65 | 66 | /** 67 | * @brief Trigger job execution 68 | * @details Schedule the job. Can be called multiple times to enqueue multiple 69 | * triggers. Is a non-blocking call. 70 | * @param[in] job The job instance 71 | * @return EOK if success, error code otherwise 72 | */ 73 | errno_t oal_job_run(oal_job_t *job); 74 | 75 | /** 76 | * @brief Wait until job is done 77 | * @param[in] job The job instance 78 | * @return EOK if success, error code otherwise 79 | */ 80 | errno_t oal_job_drain(const oal_job_t *job); 81 | 82 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 83 | #define ETH_43_PFE_STOP_SEC_CODE 84 | #include "Eth_43_PFE_MemMap.h" 85 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 86 | 87 | #endif /* PUBLIC_OAL_JOB_H_ */ 88 | 89 | /** @}*/ 90 | /** @}*/ 91 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_fp.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_FP_H_ 32 | #define LIBFCI_CLI_CMDS_FP_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_fptable_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_fptable_add(const cli_cmdargs_t *p_cmdargs); 40 | int cli_cmd_fptable_del(const cli_cmdargs_t *p_cmdargs); 41 | int cli_cmd_fptable_insrule(const cli_cmdargs_t *p_cmdargs); 42 | int cli_cmd_fptable_remrule(const cli_cmdargs_t *p_cmdargs); 43 | 44 | int cli_cmd_fprule_print(const cli_cmdargs_t *p_cmdargs); 45 | int cli_cmd_fprule_add(const cli_cmdargs_t *p_cmdargs); 46 | int cli_cmd_fprule_del(const cli_cmdargs_t *p_cmdargs); 47 | 48 | /* ========================================================================= */ 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sw/fci/public/fci.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2017-2023 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef FCI_H_ 9 | #define FCI_H_ 10 | 11 | #include "oal.h" 12 | #include "pfe_emac.h" /* pfe_mac_addr_t */ 13 | #include "pfe_rtable.h" /* pfe_rtable_t, pfe_rtable_dst_if_t */ 14 | #include "pfe_l2br.h" /* pfe_l2br_t */ 15 | #include "pfe_class.h" /* pfe_class_t */ 16 | #include "pfe_if_db.h" 17 | #include "pfe_tmu.h" /* pfe_tmu_t */ 18 | #include "fci_msg.h" 19 | 20 | #ifdef PFE_CFG_MULTI_INSTANCE_SUPPORT 21 | #include "fci_ownership_mask.h" 22 | #endif /* #ifdef PFE_CFG_MULTI_INSTANCE_SUPPORT */ 23 | 24 | /** 25 | * @brief Information passed into the fci_init() function 26 | * @note For future use 27 | */ 28 | typedef struct 29 | { 30 | pfe_rtable_t *rtable; /* The routing table object */ 31 | pfe_l2br_t *l2_bridge; /* The L2 bridge instance */ 32 | pfe_class_t *class; /* The classifier instance */ 33 | pfe_if_db_t *phy_if_db; /* Pointer to platform driver phy_if DB */ 34 | pfe_if_db_t *log_if_db; /* Pointer to platform driver log_if DB */ 35 | pfe_tmu_t *tmu; /* Pointer to platform driver tmu */ 36 | #ifdef PFE_CFG_MULTI_INSTANCE_SUPPORT 37 | pfe_fci_owner_hif_id_t hif_fci_owner_chnls_mask; /* Bit mask representing allowed FCI ownership */ 38 | #endif /* PFE_CFG_MULTI_INSTANCE_SUPPORT */ 39 | } fci_init_info_t; 40 | 41 | /** 42 | * @brief FCI instance type 43 | */ 44 | typedef struct fci_tag fci_t; 45 | 46 | typedef struct 47 | { 48 | uint32_t stats; 49 | } pfe_fp_t; 50 | 51 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 52 | #define ETH_43_PFE_START_SEC_CODE 53 | #include "Eth_43_PFE_MemMap.h" 54 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 55 | 56 | /** 57 | * @brief Send message to all FCI clients 58 | * @param[in] msg Pointer to the buffer containing payload to be sent 59 | * @param[in] rep Pointer to buffer where reply data shall be stored 60 | * @return EOK if success, error code otherwise 61 | */ 62 | errno_t fci_core_client_send_broadcast(fci_msg_t *msg, fci_msg_t *rep); 63 | 64 | errno_t fci_init(fci_init_info_t *info, const char_t *const identifier); 65 | void fci_fini(void); 66 | 67 | uint32_t pfe_fp_get_text_statistics(pfe_fp_t *temp, struct seq_file *seq, uint8_t verb_level); 68 | 69 | errno_t fci_process_ipc_message(fci_msg_t *msg, fci_msg_t *rep_msg); /* This is here because FCI proxy RPC calls need it. */ 70 | 71 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 72 | #define ETH_43_PFE_STOP_SEC_CODE 73 | #include "Eth_43_PFE_MemMap.h" 74 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 75 | 76 | #endif /* FCI_H_ */ 77 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_print_helpers.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef CLI_PRINT_HELPERS_H_ 32 | #define CLI_PRINT_HELPERS_H_ 33 | 34 | #include 35 | #include "libfci_cli_common.h" 36 | 37 | /* ==== PUBLIC FUNCTIONS =================================================== */ 38 | 39 | void cli_print_bitset32(uint32_t bitset, const char* p_txt_delim, const char* (*p_value2txt)(uint8_t value), 40 | const char* p_txt_nothing_found); 41 | void cli_print_tablenames(const char (*p_tablenames)[TABLE_NAME_TXT_LN], const uint8_t tablenames_ln, 42 | const char* p_txt_delim, const char* p_txt_nothing_found); 43 | void cli_print_mac(const uint8_t* p_mac); 44 | void cli_print_ip4(uint32_t ip4, bool is_fixed_width); 45 | void cli_print_ip6(const uint32_t* p_ip6); 46 | 47 | /* ========================================================================= */ 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_if_db.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2017-2022,2024 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #ifndef PFE_LOG_IF_DB_H_ 9 | #define PFE_LOG_IF_DB_H_ 10 | 11 | #include "linked_list.h" 12 | #include "pfe_ct.h" 13 | #include "pfe_log_if.h" 14 | #include "pfe_phy_if.h" 15 | 16 | typedef enum 17 | { 18 | PFE_IF_DB_PHY, 19 | PFE_IF_DB_LOG 20 | } pfe_if_db_type_t; 21 | 22 | /** 23 | * @brief Interface database entry type 24 | */ 25 | typedef struct pfe_if_db_entry_tag pfe_if_db_entry_t; 26 | 27 | /** 28 | * @brief Interface database select criteria type 29 | */ 30 | typedef enum 31 | { 32 | IF_DB_CRIT_ALL, /*!< Match any entry in the DB */ 33 | IF_DB_CRIT_BY_ID, /*!< Match entries by interface ID */ 34 | IF_DB_CRIT_BY_INSTANCE, /*!< Match entries by interface instance */ 35 | IF_DB_CRIT_BY_NAME, /*!< Match entries by interface name */ 36 | IF_DB_CRIT_BY_OWNER /*!< Match entries by owner ID */ 37 | } pfe_if_db_get_criterion_t; 38 | 39 | /** 40 | * @brief Interface database instance representation type 41 | */ 42 | typedef struct pfe_if_db_tag pfe_if_db_t; 43 | 44 | errno_t pfe_if_db_context_init(void); 45 | errno_t pfe_if_db_context_destroy(void); 46 | pfe_if_db_t * pfe_if_db_create(pfe_if_db_type_t type); 47 | void pfe_if_db_destroy(const pfe_if_db_t *db); 48 | errno_t pfe_if_db_add(pfe_if_db_t *db, uint32_t session_id, void *iface, pfe_ct_phy_if_id_t owner); 49 | errno_t pfe_if_db_remove(pfe_if_db_t *db, uint32_t session_id, pfe_if_db_entry_t *entry); 50 | errno_t pfe_log_if_db_drop_all(const pfe_if_db_t *db, uint32_t session_id); 51 | errno_t pfe_if_db_lock(uint32_t *session_id); 52 | errno_t pfe_if_db_lock_owned(uint32_t owner_id); 53 | errno_t pfe_if_db_polled_lock(uint32_t *session_id); 54 | errno_t pfe_if_db_polled_lock_owned(uint32_t owner_id); 55 | errno_t pfe_if_db_unlock(uint32_t session_id); 56 | errno_t pfe_if_db_lock_check(uint32_t session_id); 57 | errno_t pfe_if_db_get_first(pfe_if_db_t *db, uint32_t session_id, pfe_if_db_get_criterion_t crit, void *arg, pfe_if_db_entry_t **db_entry); 58 | errno_t pfe_if_db_get_next(pfe_if_db_t *db, uint32_t session_id, pfe_if_db_entry_t **db_entry); 59 | pfe_phy_if_t *pfe_if_db_entry_get_phy_if(const pfe_if_db_entry_t *entry) __attribute__((pure)); 60 | pfe_log_if_t *pfe_if_db_entry_get_log_if(const pfe_if_db_entry_t *entry) __attribute__((pure)); 61 | errno_t pfe_if_db_get_single(const pfe_if_db_t *db, uint32_t session_id, pfe_if_db_get_criterion_t crit, void *arg, pfe_if_db_entry_t **db_entry); 62 | 63 | #endif /* PFE_LOG_IF_DB_H_ */ 64 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_route_and_cntk.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_ROUTE_AND_CNTK_H_ 32 | #define LIBFCI_CLI_CMDS_ROUTE_AND_CNTK_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_route_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_route_add(const cli_cmdargs_t *p_cmdargs); 40 | int cli_cmd_route_del(const cli_cmdargs_t *p_cmdargs); 41 | 42 | int cli_cmd_cntk_print(const cli_cmdargs_t *p_cmdargs); 43 | int cli_cmd_cntk_update(const cli_cmdargs_t *p_cmdargs); 44 | int cli_cmd_cntk_add(const cli_cmdargs_t *p_cmdargs); 45 | int cli_cmd_cntk_del(const cli_cmdargs_t *p_cmdargs); 46 | int cli_cmd_cntk_timeout(const cli_cmdargs_t *p_cmdargs); 47 | 48 | int cli_cmd_route_and_cntk_reset(const cli_cmdargs_t *p_cmdargs); 49 | 50 | /* ========================================================================= */ 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/daemon/daemon_cmds.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef DAEMON_CMDS_H_ 32 | #define DAEMON_CMDS_H_ 33 | 34 | /* ==== PUBLIC FUNCTIONS =================================================== */ 35 | 36 | typedef struct daemon_cfg_tt daemon_cfg_t; 37 | typedef enum cli_cmd_tt cli_cmd_t; 38 | typedef struct cli_cmdargs_tt cli_cmdargs_t; 39 | 40 | 41 | void daemon_errno_print(const char* p_txt_indent); 42 | void daemon_errno_clear(void); 43 | 44 | int daemon_stop(void); 45 | int daemon_ping(void); 46 | int daemon_get_cfg(daemon_cfg_t *const p_daemon_cfg); 47 | int daemon_cli_cmd_execute(cli_cmd_t cmd, const cli_cmdargs_t* p_cmdargs); 48 | int daemon_terminal_fciev_set_print(uint8_t is_on); 49 | int daemon_terminal_dbg_set_print(uint8_t is_on); 50 | int daemon_logfile_fciev_set_print(uint8_t is_on); 51 | int daemon_dbgfile_dbg_set_print(uint8_t is_on); 52 | 53 | /* ========================================================================= */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_qos_pol.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_QOS_POL_H_ 32 | #define LIBFCI_CLI_CMDS_QOS_POL_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_qos_pol_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_qos_pol_set(const cli_cmdargs_t *p_cmdargs); 40 | 41 | int cli_cmd_qos_pol_wred_print(const cli_cmdargs_t *p_cmdargs); 42 | int cli_cmd_qos_pol_wred_update(const cli_cmdargs_t *p_cmdargs); 43 | 44 | int cli_cmd_qos_pol_shp_print(const cli_cmdargs_t *p_cmdargs); 45 | int cli_cmd_qos_pol_shp_update(const cli_cmdargs_t *p_cmdargs); 46 | 47 | int cli_cmd_qos_pol_flow_print(const cli_cmdargs_t *p_cmdargs); 48 | int cli_cmd_qos_pol_flow_add(const cli_cmdargs_t *p_cmdargs); 49 | int cli_cmd_qos_pol_flow_del(const cli_cmdargs_t *p_cmdargs); 50 | 51 | /* ========================================================================= */ 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_bmu.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2024 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PUBLIC_PFE_BMU_H_ 12 | #define PUBLIC_PFE_BMU_H_ 13 | 14 | typedef struct pfe_bmu_tag pfe_bmu_t; 15 | 16 | typedef struct 17 | { 18 | addr_t pool_pa; /* Buffer pool base (physical, as seen by PFE). Needs to be aligned to buf_cnt * buf_size. */ 19 | addr_t pool_va; /* Buffer pool base (virtual) */ 20 | uint32_t max_buf_cnt; /* Maximum number of buffers that can be used */ 21 | uint32_t buf_size; /* Buffer size of each of the buffers allocated and freed (size = 2^buf_size) */ 22 | uint32_t bmu_ucast_thres; 23 | uint32_t bmu_mcast_thres; 24 | uint32_t int_mem_loc_cnt; 25 | uint32_t buf_mem_loc_cnt; 26 | } pfe_bmu_cfg_t; 27 | 28 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 29 | #define ETH_43_PFE_START_SEC_CODE 30 | #include "Eth_43_PFE_MemMap.h" 31 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 32 | 33 | pfe_bmu_t *pfe_bmu_create(addr_t cbus_base_va, addr_t bmu_base, const pfe_bmu_cfg_t *cfg) __attribute__((cold, aligned(64))); 34 | errno_t pfe_bmu_isr(pfe_bmu_t *bmu) __attribute__((cold, aligned(64))); 35 | void pfe_bmu_irq_mask(pfe_bmu_t *bmu); 36 | void pfe_bmu_irq_unmask(pfe_bmu_t *bmu); 37 | void pfe_bmu_enable(pfe_bmu_t *bmu) __attribute__((cold, aligned(64))); 38 | void pfe_bmu_reset(pfe_bmu_t *bmu) __attribute__((cold, aligned(64))); 39 | void pfe_bmu_disable(pfe_bmu_t *bmu) __attribute__((cold, aligned(64))); 40 | void *pfe_bmu_alloc_buf(const pfe_bmu_t *bmu) __attribute__((hot)); 41 | void *pfe_bmu_get_va(const pfe_bmu_t *bmu, addr_t pa) __attribute__((hot, pure)); 42 | void *pfe_bmu_get_pa(const pfe_bmu_t *bmu, addr_t va) __attribute__((hot, pure)); 43 | uint32_t pfe_bmu_get_buf_size(const pfe_bmu_t *bmu) __attribute__((cold, aligned(64), pure)); 44 | void pfe_bmu_free_buf(const pfe_bmu_t *bmu, addr_t buffer) __attribute__((hot)); 45 | 46 | uint32_t pfe_bmu_get_text_statistics(const pfe_bmu_t *bmu, struct seq_file *seq, uint8_t verb_level) __attribute__((cold, aligned(64))); 47 | 48 | void pfe_bmu_destroy(pfe_bmu_t *bmu) __attribute__((cold, aligned(64))); 49 | #ifdef PFE_CFG_PFE_MASTER 50 | uint32_t pfe_bmu_get_err_poll(pfe_bmu_t *bmu) __attribute__((hot)); 51 | #endif /* #ifdef PFE_CFG_PFE_MASTER */ 52 | 53 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 54 | #define ETH_43_PFE_STOP_SEC_CODE 55 | #include "Eth_43_PFE_MemMap.h" 56 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 57 | 58 | #endif /* PUBLIC_PFE_BMU_H_ */ 59 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_feature_mgr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | #ifndef PFE_FEATURE_MGR_H 11 | #define PFE_FEATURE_MGR_H 12 | 13 | #include "pfe_class.h" 14 | #include "pfe_util.h" 15 | #include "pfe_tmu.h" 16 | 17 | #define PFE_HW_FEATURE_RUN_ON_G3 "drv_run_on_g3" 18 | 19 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 20 | #define ETH_43_PFE_START_SEC_CODE 21 | #include "Eth_43_PFE_MemMap.h" 22 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 23 | 24 | enum CAL_PACKED 25 | { 26 | FW_FEATURE_TABLE_DEFAULT = 0U, 27 | FW_FEATURE_TABLE_CONFIG = 1U, 28 | FW_FEATURE_TABLE_STATS = 2U 29 | }; 30 | 31 | errno_t pfe_feature_mgr_init(uint32_t *cbus_base); 32 | errno_t pfe_feature_mgr_fini(void); 33 | errno_t pfe_feature_mgr_add_modules(pfe_class_t *class, pfe_util_t *util, pfe_tmu_t *tmu); 34 | bool_t pfe_feature_mgr_is_available(const char *feature_name); 35 | errno_t pfe_feature_mgr_set_val(const char *feature_name, const uint8_t val); 36 | errno_t pfe_feature_mgr_get_val(const char *feature_name, uint8_t *val); 37 | 38 | errno_t pfe_feature_mgr_get_first(const char **feature_name); 39 | errno_t pfe_feature_mgr_get_next(const char **feature_name); 40 | errno_t pfe_feature_mgr_get_def_val(const char *feature_name, uint8_t *val); 41 | errno_t pfe_feature_mgr_get_desc(const char *feature_name, const char **desc); 42 | errno_t pfe_feature_mgr_get_variant(const char *feature_name, uint8_t *val); 43 | 44 | errno_t pfe_feature_mgr_enable(const char *feature_name); 45 | errno_t pfe_feature_mgr_disable(const char *feature_name); 46 | 47 | errno_t pfe_feature_mgr_table_first(const char *feature_name, uint8_t table_type, const char **table_el_name); 48 | errno_t pfe_feature_mgr_table_next(const char *feature_name, uint8_t table_type, const char **table_el_name); 49 | errno_t pfe_feature_mgr_table_get_size(const char *feature_name, uint8_t table_type, const char *table_el_name, uint8_t *size); 50 | errno_t pfe_feature_mgr_table_get_multiplicity(const char *feature_name, uint8_t table_type, const char *table_el_name, uint8_t *count); 51 | errno_t pfe_feature_mgr_table_get_payload(const char *feature_name, uint8_t table_type, const char *table_el_name, uint8_t *payload); 52 | 53 | errno_t pfe_feature_mgr_table_set_val(const char *feature_name, uint8_t table_type, const char *table_el_name, uint8_t index, uint8_t* val); 54 | 55 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 56 | #define ETH_43_PFE_STOP_SEC_CODE 57 | #include "Eth_43_PFE_MemMap.h" 58 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_bd.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2024 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef LIBFCI_CLI_CMDS_BD_H_ 32 | #define LIBFCI_CLI_CMDS_BD_H_ 33 | 34 | #include "libfci_cli_common.h" 35 | 36 | /* ==== PUBLIC FUNCTIONS =================================================== */ 37 | 38 | int cli_cmd_bd_print(const cli_cmdargs_t *p_cmdargs); 39 | int cli_cmd_bd_update(const cli_cmdargs_t *p_cmdargs); 40 | int cli_cmd_bd_add(const cli_cmdargs_t *p_cmdargs); 41 | int cli_cmd_bd_del(const cli_cmdargs_t *p_cmdargs); 42 | int cli_cmd_bd_insif(const cli_cmdargs_t *p_cmdargs); 43 | int cli_cmd_bd_remif(const cli_cmdargs_t *p_cmdargs); 44 | 45 | int cli_cmd_bd_stent_print(const cli_cmdargs_t *p_cmdargs); 46 | int cli_cmd_bd_stent_update(const cli_cmdargs_t *p_cmdargs); 47 | int cli_cmd_bd_stent_add(const cli_cmdargs_t *p_cmdargs); 48 | int cli_cmd_bd_stent_del(const cli_cmdargs_t *p_cmdargs); 49 | 50 | int cli_cmd_bd_flush(const cli_cmdargs_t *p_cmdargs); 51 | 52 | /* ========================================================================= */ 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /sw/oal/public/oal_mutex_linux.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2020,2023 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_OAL_SYNC 10 | * @{ 11 | * 12 | * @file oal_mutex_linux.h 13 | * @brief The LINUX-specific mutex implementation. 14 | * @details This file contains LINUX-specific mutex implementation. 15 | * 16 | */ 17 | 18 | #ifndef __OAL_MUTEX_LINUX_H__ 19 | #define __OAL_MUTEX_LINUX_H__ 20 | 21 | #include 22 | #include 23 | 24 | #include "hal.h" 25 | 26 | typedef struct mutex oal_mutex_t; 27 | 28 | /** @}*/ 29 | /* Implementation continues below to ensure Doxygen will put the API description 30 | from oal_sync.h at right place (related to oal_sync.h header). */ 31 | 32 | static inline errno_t oal_mutex_init(oal_mutex_t *mutex) 33 | { 34 | #if defined(PFE_CFG_NULL_ARG_CHECK) 35 | if (unlikely(NULL == mutex)) 36 | { 37 | NXP_LOG_ERROR("NULL argument received\n"); 38 | return EINVAL; 39 | } 40 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 41 | 42 | mutex_init(mutex); 43 | 44 | return EOK; 45 | } 46 | 47 | static inline errno_t oal_mutex_destroy(oal_mutex_t *mutex) 48 | { 49 | #if defined(PFE_CFG_NULL_ARG_CHECK) 50 | if (unlikely(NULL == mutex)) 51 | { 52 | NXP_LOG_ERROR("NULL argument received\n"); 53 | return EINVAL; 54 | } 55 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 56 | 57 | mutex_destroy(mutex); 58 | 59 | return EOK; 60 | } 61 | 62 | static inline errno_t oal_mutex_lock(oal_mutex_t *mutex) 63 | { 64 | errno_t ret; 65 | 66 | #if defined(PFE_CFG_NULL_ARG_CHECK) 67 | if (unlikely(NULL == mutex)) 68 | { 69 | NXP_LOG_ERROR("NULL argument received\n"); 70 | return EINVAL; 71 | } 72 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 73 | 74 | again: 75 | ret = mutex_trylock(mutex); 76 | if (unlikely(ret != 1)) /* non-standard return code: 1 means OK */ 77 | { 78 | goto again; 79 | } 80 | return EOK; 81 | } 82 | 83 | static inline void oal_mutex_lock_sleep(oal_mutex_t *mutex) 84 | { 85 | #if defined(PFE_CFG_NULL_ARG_CHECK) 86 | if (unlikely(NULL == mutex)) 87 | { 88 | NXP_LOG_ERROR("NULL argument received\n"); 89 | return; 90 | } 91 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 92 | 93 | mutex_lock(mutex); 94 | } 95 | 96 | static inline errno_t oal_mutex_unlock(oal_mutex_t *mutex) 97 | { 98 | #if defined(PFE_CFG_NULL_ARG_CHECK) 99 | if (unlikely(NULL == mutex)) 100 | { 101 | NXP_LOG_ERROR("NULL argument received\n"); 102 | return EINVAL; 103 | } 104 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 105 | 106 | mutex_unlock(mutex); 107 | 108 | return EOK; 109 | } 110 | 111 | #endif /* __OAL_MUTEX_LINUX_H__ */ 112 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_demo/demo_common.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef DEMO_COMMON_H_ 32 | #define DEMO_COMMON_H_ 33 | 34 | #include 35 | #include 36 | #include "fpp.h" 37 | #include "fpp_ext.h" 38 | #include "libfci.h" 39 | 40 | /* ==== TYPEDEFS & DATA ==================================================== */ 41 | 42 | typedef fci_cb_retval_t (*demo_events_cb_t)(unsigned short fcode, unsigned short len, unsigned short* payload); 43 | 44 | /* ==== PUBLIC FUNCTIONS =================================================== */ 45 | 46 | void print_if_error(int rtn, const char* p_txt_error); 47 | 48 | void ntoh_enum(void* p_rtn, size_t size); 49 | void hton_enum(void* p_rtn, size_t size); 50 | 51 | int set_text(char* p_dst, const char* p_src, const uint16_t dst_ln); 52 | 53 | int demo_if_session_lock(FCI_CLIENT* p_cl); 54 | int demo_if_session_unlock(FCI_CLIENT* p_cl, int rtn); 55 | 56 | int demo_client_open_in_cmd_mode(FCI_CLIENT** pp_rtn_cl); 57 | int demo_client_close(FCI_CLIENT* p_cl); 58 | 59 | int demo_events_catching_init(FCI_CLIENT* p_cl, demo_events_cb_t p_cb_events); 60 | int demo_events_catching_fini(FCI_CLIENT* p_cl); 61 | 62 | /* ========================================================================= */ 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /sw/common/Makefile: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # Copyright 2018-2023 NXP 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | # ========================================================================= 7 | 8 | ifndef KERNELRELEASE 9 | include ../build_env.mak 10 | endif 11 | 12 | ARTIFACT = common.a 13 | 14 | TARGET = $(OUTPUT_DIR)/$(ARTIFACT) 15 | 16 | #User defined include/preprocessor flags and libraries 17 | 18 | INCLUDES += -I$(INC_PREFIX)public \ 19 | -I$(INC_PREFIX)../oal/public \ 20 | -I$(INC_PREFIX)../oal/public/$(shell echo $(TARGET_OS) | tr [A-Z] [a-z]) \ 21 | -I$(INC_PREFIX)../hal/public \ 22 | -I$(INC_PREFIX)../pfe_platform/public 23 | 24 | #Dependencies 25 | DEPENDENCIES = $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 26 | 27 | #Compiler flags for build profiles 28 | CCFLAGS_release += -O3 29 | CCFLAGS_debug += -g -O0 -fno-builtin 30 | CCFLAGS_coverage += -g -O0 -ftest-coverage -fprofile-arcs -nopipe -Wc,-auxbase-strip,$@ 31 | LDFLAGS_coverage += -ftest-coverage -fprofile-arcs 32 | CCFLAGS_profile += -g -O0 -finstrument-functions 33 | LIBS_profile += -lprofilingS 34 | 35 | CCFLAGS_pfe += -D$(PFE_CFG_TARGET_ARCH_DEF) -D$(PFE_CFG_TARGET_OS_DEF) -D$(PFE_CFG_BUILD_PROFILE_DEF) 36 | 37 | #Generic compiler flags (which include build type flags) 38 | CCFLAGS_all += -Wall -fmessage-length=0 -fvisibility=hidden 39 | CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE)) 40 | CCFLAGS_all += $(CCFLAGS_pfe) 41 | #Shared library has to be compiled with -fPIC 42 | #CCFLAGS_all += -fPIC 43 | LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE)) 44 | LIBS_all += $(LIBS_$(BUILD_PROFILE)) 45 | DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@ 46 | 47 | #Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp 48 | rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2)) 49 | 50 | #Source list 51 | SRCS = src/blalloc.c 52 | 53 | #Object files list 54 | OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(basename $(SRCS)))) 55 | 56 | #Rules section for default compilation and linking 57 | all: $(TARGET) 58 | 59 | #Deps building rule 60 | .PHONY: $(DEPENDENCIES) 61 | $(DEPENDENCIES): 62 | @make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) 63 | 64 | #Compiling rule 65 | $(OUTPUT_DIR)/%.o: %.c 66 | @mkdir -p $(dir $@) 67 | $(CC) -c $(DEPS) -o $@ $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $(GLOBAL_CCFLAGS) $< 68 | 69 | #Linking rule 70 | EMPTY = 71 | $(TARGET):$(OBJS) $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 72 | $(LD) -static -a $(TARGET) $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS) 73 | 74 | .PHONY clean: 75 | clean: $(addsuffix .clean,$(DEPENDENCIES)) 76 | rm -fr $(OUTPUT_DIR) 77 | 78 | #Deps cleaning rule 79 | %.clean: 80 | make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) clean 81 | 82 | rebuild: clean all 83 | 84 | #Inclusion of dependencies (object files to source and includes) 85 | -include $(OBJS:%.o=%.d) 86 | 87 | # 88 | # Linux build 89 | 90 | include $(M)/../dummy_mod.mak 91 | -------------------------------------------------------------------------------- /sw/fci/src/fci_rt_db.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2017-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_FCI 10 | * @{ 11 | * 12 | * @file fci_rt_db.h 13 | * @brief Route database header file 14 | * @details 15 | * 16 | */ 17 | 18 | #ifndef SRC_FCI_RT_DB_H_ 19 | #define SRC_FCI_RT_DB_H_ 20 | 21 | #include "linked_list.h" 22 | #include "fpp.h" /* Due to IFNAMSIZ */ 23 | #include "pfe_rtable.h" /* IP and MAC address type */ 24 | 25 | /** 26 | * @brief Route database entry type 27 | */ 28 | typedef struct 29 | { 30 | void *refptr; /* Reference pointer storage */ 31 | uint32_t id; /* Route entry identifier */ 32 | uint16_t mtu; 33 | pfe_mac_addr_t src_mac; 34 | pfe_mac_addr_t dst_mac; 35 | pfe_ip_addr_t dst_ip; /* Destination IP (ipv4/ipv6) */ 36 | pfe_phy_if_t *iface; /* Associated interface */ 37 | 38 | /* DB/Chaining */ 39 | LLIST_t list_member; 40 | } fci_rt_db_entry_t; 41 | 42 | /** 43 | * @brief Route database select criteria type 44 | */ 45 | typedef enum 46 | { 47 | RT_DB_CRIT_ALL, /*!< Match any entry in the DB */ 48 | RT_DB_CRIT_BY_IF, /*!< Match entries by interface instance */ 49 | RT_DB_CRIT_BY_IF_NAME, /*!< Match entries by interface name */ 50 | RT_DB_CRIT_BY_IP, /*!< Match entries by destination IP address */ 51 | RT_DB_CRIT_BY_MAC, /*!< Match entries by destination MAC address */ 52 | RT_DB_CRIT_BY_ID /*!< Match entries by ID */ 53 | } fci_rt_db_get_criterion_t; 54 | 55 | /** 56 | * @brief Route database instance representation type 57 | */ 58 | typedef struct 59 | { 60 | LLIST_t theList; 61 | LLIST_t *cur_item; /* Current entry to be returned. See ...get_first() and ...get_next() */ 62 | fci_rt_db_get_criterion_t cur_crit; /* Current criterion */ 63 | union 64 | { 65 | char_t outif_name[IFNAMSIZ]; 66 | pfe_ip_addr_t dst_ip; 67 | pfe_mac_addr_t dst_mac; 68 | uint32_t id; 69 | const pfe_phy_if_t *iface; 70 | } cur_crit_arg; /* Current criterion argument */ 71 | } fci_rt_db_t; 72 | 73 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 74 | #define ETH_43_PFE_START_SEC_CODE 75 | #include "Eth_43_PFE_MemMap.h" 76 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 77 | 78 | void fci_rt_db_init(fci_rt_db_t *db); 79 | errno_t fci_rt_db_add(fci_rt_db_t *db, pfe_ip_addr_t *dst_ip, 80 | pfe_mac_addr_t *src_mac, pfe_mac_addr_t *dst_mac, 81 | pfe_phy_if_t *iface, uint32_t id, void *refptr, bool_t overwrite); 82 | errno_t fci_rt_db_remove(fci_rt_db_t *db, fci_rt_db_entry_t *entry); 83 | errno_t fci_rt_db_drop_all(fci_rt_db_t *db); 84 | fci_rt_db_entry_t *fci_rt_db_get_first(fci_rt_db_t *db, fci_rt_db_get_criterion_t crit, const void *arg); 85 | fci_rt_db_entry_t *fci_rt_db_get_next(fci_rt_db_t *db); 86 | 87 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 88 | #define ETH_43_PFE_STOP_SEC_CODE 89 | #include "Eth_43_PFE_MemMap.h" 90 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 91 | 92 | #endif /* SRC_FCI_RT_DB_H_ */ 93 | 94 | /** @}*/ 95 | 96 | -------------------------------------------------------------------------------- /sw/common/public/blalloc.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2023 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | 9 | 10 | #ifndef SRC_BLALLOC_H_ 11 | #define SRC_BLALLOC_H_ 12 | 13 | 14 | /** 15 | * @brief Number of chunks encoded within single byte. Not intended to be modified. 16 | */ 17 | #define BLALLOC_CFG_CHUNKS_IN_BYTE 4U 18 | 19 | /** 20 | * @brief Block allocator instance status 21 | */ 22 | typedef enum 23 | { 24 | BL_INVALID = 0, 25 | BL_DYNAMIC = 10, 26 | BL_STATIC = 20 27 | } blalloc_status_t; 28 | 29 | /** 30 | * @brief Block allocator context representation 31 | */ 32 | typedef struct 33 | { 34 | size_t size; /* Size */ 35 | size_t chunk_size;/* Size of a memory chunk is 2^this_value */ 36 | size_t start_srch;/* Remember position of the 1st free chunk */ 37 | size_t allocated; /* Sum of all allocated bytes (including those freed and allocated again) */ 38 | size_t requested; /* Sum of all requested bytes to be allocated */ 39 | oal_spinlock_t spinlock; 40 | blalloc_status_t status; /* Instance status */ 41 | uint8_t *chunkinfo;/* Pointer to free space that follows this struct */ 42 | /* The free space for chunkinfo will be here (if extra size was allocated) */ 43 | } blalloc_t; 44 | 45 | /** 46 | * @brief Static block allocator instance constructor 47 | * @details Intended to be used to create static block allocator instances. Static instances 48 | * shall be initialized and finalized using blalloc_init() and blalloc_fini() calls 49 | * instead of dynamic blalloc_create() and blalloc_destroy(). 50 | */ 51 | #define BLALLOC_STATIC_INST(__name, __size, __chunk_size) \ 52 | static uint8_t blalloc_buf_##__name[((((__size) >> (__chunk_size)) + BLALLOC_CFG_CHUNKS_IN_BYTE - 1U) / BLALLOC_CFG_CHUNKS_IN_BYTE)] = {0U}; \ 53 | static blalloc_t __name = \ 54 | { \ 55 | .chunkinfo = blalloc_buf_##__name, \ 56 | .size = (__size), \ 57 | .chunk_size = (__chunk_size) \ 58 | } 59 | 60 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 61 | #define ETH_43_PFE_START_SEC_CODE 62 | #include "Eth_43_PFE_MemMap.h" 63 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 64 | 65 | blalloc_t *blalloc_create(size_t size, size_t chunk_size); 66 | void blalloc_destroy(blalloc_t *ctx); 67 | errno_t blalloc_init(blalloc_t *ctx); 68 | void blalloc_fini(blalloc_t *ctx); 69 | errno_t blalloc_alloc_offs(blalloc_t *ctx, size_t size, size_t align, addr_t *addr); 70 | void blalloc_free_offs_size(blalloc_t *ctx, addr_t offset, size_t size); 71 | void blalloc_free_offs(blalloc_t *ctx, addr_t offset); 72 | 73 | uint32_t blalloc_get_text_statistics(const blalloc_t *ctx, struct seq_file *seq, uint8_t verb_level); 74 | 75 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 76 | #define ETH_43_PFE_STOP_SEC_CODE 77 | #include "Eth_43_PFE_MemMap.h" 78 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 79 | 80 | #endif /* SRC_BLALLOC_H_ */ 81 | 82 | -------------------------------------------------------------------------------- /sw/elf/Makefile: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # Copyright 2018-2023 NXP 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | # ========================================================================= 7 | 8 | ifndef KERNELRELEASE 9 | include ../build_env.mak 10 | endif 11 | 12 | ARTIFACT = elf.a 13 | 14 | TARGET = $(OUTPUT_DIR)/$(ARTIFACT) 15 | 16 | #User defined include/preprocessor flags and libraries 17 | INCLUDES += -I$(INC_PREFIX)public \ 18 | -I$(INC_PREFIX)../hal/public \ 19 | -I$(INC_PREFIX)../oal/public \ 20 | -I$(INC_PREFIX)../oal/public/$(shell echo $(TARGET_OS) | tr [A-Z] [a-z]) \ 21 | -I$(INC_PREFIX)../common/public \ 22 | -I$(INC_PREFIX)../pfe_platform/public 23 | 24 | #Dependencies 25 | DEPENDENCIES = $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 26 | 27 | #Compiler flags for build profiles 28 | CCFLAGS_release += -O3 29 | CCFLAGS_debug += -g -O0 -fno-builtin 30 | CCFLAGS_coverage += -g -O0 -ftest-coverage -fprofile-arcs -nopipe -Wc,-auxbase-strip,$@ 31 | LDFLAGS_coverage += -ftest-coverage -fprofile-arcs 32 | CCFLAGS_profile += -g -O0 -finstrument-functions 33 | LIBS_profile += -lprofilingS 34 | 35 | CCFLAGS_pfe += -D$(PFE_CFG_TARGET_ARCH_DEF) -D$(PFE_CFG_TARGET_OS_DEF) -D$(PFE_CFG_BUILD_PROFILE_DEF) 36 | 37 | #Generic compiler flags (which include build type flags) 38 | CCFLAGS_all += -Wall -fmessage-length=0 -fvisibility=hidden 39 | CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE)) 40 | CCFLAGS_all += $(CCFLAGS_pfe) 41 | #Shared library has to be compiled with -fPIC 42 | #CCFLAGS_all += -fPIC 43 | LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE)) 44 | LIBS_all += $(LIBS_$(BUILD_PROFILE)) 45 | DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@ 46 | 47 | #Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp 48 | rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2)) 49 | 50 | #Source list 51 | SRCS = src/elf.c 52 | 53 | #Object files list 54 | OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(basename $(SRCS)))) 55 | 56 | #Rules section for default compilation and linking 57 | all: $(TARGET) 58 | 59 | #Deps building rule 60 | .PHONY: $(DEPENDENCIES) 61 | $(DEPENDENCIES): 62 | @make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) 63 | 64 | #Compiling rule 65 | $(OUTPUT_DIR)/%.o: %.c 66 | @mkdir -p $(dir $@) 67 | $(CC) -c $(DEPS) -o $@ $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $(GLOBAL_CCFLAGS) $< 68 | 69 | #Linking rule 70 | EMPTY = 71 | $(TARGET):$(OBJS) $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 72 | $(LD) -static -a $(TARGET) $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS) 73 | 74 | .PHONY clean: 75 | clean: $(addsuffix .clean,$(DEPENDENCIES)) 76 | rm -fr $(OUTPUT_DIR) 77 | 78 | #Deps cleaning rule 79 | %.clean: 80 | make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) clean 81 | 82 | rebuild: clean all 83 | 84 | #Inclusion of dependencies (object files to source and includes) 85 | -include $(OBJS:%.o=%.d) 86 | 87 | # 88 | # Linux build 89 | 90 | include $(M)/../dummy_mod.mak 91 | -------------------------------------------------------------------------------- /sw/fci/src/fci_l2br.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2021-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_FCI 10 | * @{ 11 | * 12 | * @file fci_l2br.c 13 | * @brief L2 bridge management functions. 14 | * @details All bridge-related functionality provided by the FCI should be 15 | * implemented within this file. This includes mainly bridge-related 16 | * commands. 17 | * 18 | */ 19 | 20 | #include "pfe_cfg.h" 21 | #include "libfci.h" 22 | #include "fpp.h" 23 | #include "fpp_ext.h" 24 | 25 | #include "fci_internal.h" 26 | #include "fci.h" 27 | 28 | #ifdef PFE_CFG_PFE_MASTER 29 | #ifdef PFE_CFG_FCI_ENABLE 30 | 31 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 32 | #define ETH_43_PFE_START_SEC_CODE 33 | #include "Eth_43_PFE_MemMap.h" 34 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 35 | 36 | /** 37 | * @brief Process FPP_CMD_L2_FLUSH_* commands 38 | * @param[in] msg FCI cmd code 39 | * @param[out] fci_ret FCI return code 40 | * @return EOK if success, error code otherwise 41 | */ 42 | errno_t fci_l2br_flush_cmd(uint32_t code, uint16_t *fci_ret) 43 | { 44 | const fci_t *fci_context = (fci_t *)&__context; 45 | errno_t ret = EOK; 46 | 47 | #if defined(PFE_CFG_NULL_ARG_CHECK) 48 | if (unlikely(NULL == fci_ret)) 49 | { 50 | NXP_LOG_ERROR("NULL argument received\n"); 51 | ret = EINVAL; 52 | } 53 | else 54 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 55 | { 56 | *fci_ret = FPP_ERR_OK; 57 | 58 | switch (code) 59 | { 60 | case FPP_CMD_L2_FLUSH_ALL: 61 | { 62 | ret = pfe_l2br_flush_all(fci_context->l2_bridge); 63 | if (EOK != ret) 64 | { 65 | *fci_ret = FPP_ERR_INTERNAL_FAILURE; 66 | NXP_LOG_ERROR("Can't flush MAC table entries: %d\n", ret); 67 | } 68 | 69 | break; 70 | } 71 | 72 | case FPP_CMD_L2_FLUSH_LEARNED: 73 | { 74 | ret = pfe_l2br_flush_learned(fci_context->l2_bridge); 75 | if (EOK != ret) 76 | { 77 | *fci_ret = FPP_ERR_INTERNAL_FAILURE; 78 | NXP_LOG_ERROR("Can't flush learned MAC table entries: %d\n", ret); 79 | } 80 | 81 | break; 82 | } 83 | 84 | case FPP_CMD_L2_FLUSH_STATIC: 85 | { 86 | ret = pfe_l2br_flush_static(fci_context->l2_bridge); 87 | if (EOK != ret) 88 | { 89 | *fci_ret = FPP_ERR_INTERNAL_FAILURE; 90 | NXP_LOG_ERROR("Can't flush static MAC table entries: %d\n", ret); 91 | } 92 | 93 | break; 94 | } 95 | 96 | default: 97 | { 98 | NXP_LOG_WARNING("Unknown L2 bridge command: 0x%x\n", (uint_t)code); 99 | *fci_ret = FPP_ERR_UNKNOWN_ACTION; 100 | break; 101 | } 102 | } 103 | } 104 | 105 | return ret; 106 | } 107 | 108 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 109 | #define ETH_43_PFE_STOP_SEC_CODE 110 | #include "Eth_43_PFE_MemMap.h" 111 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 112 | 113 | #endif /* PFE_CFG_FCI_ENABLE */ 114 | #endif /* PFE_CFG_PFE_MASTER */ 115 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_pe.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2023 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PFE_PE_H_ 12 | #define PFE_PE_H_ 13 | 14 | #include "pfe_ct.h" 15 | 16 | 17 | typedef struct pfe_pe_tag pfe_pe_t; 18 | 19 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 20 | #define ETH_43_PFE_START_SEC_CODE 21 | #include "Eth_43_PFE_MemMap.h" 22 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 23 | 24 | pfe_pe_t * pfe_pe_create(addr_t cbus_base_va, pfe_ct_pe_type_t type, uint8_t id, oal_mutex_t *lock_mutex, bool_t *miflock); 25 | void pfe_pe_set_dmem(pfe_pe_t *pe, addr_t elf_base, addr_t len); 26 | void pfe_pe_set_imem(pfe_pe_t *pe, addr_t elf_base, addr_t len); 27 | void pfe_pe_set_lmem(pfe_pe_t *pe, addr_t elf_base, addr_t len); 28 | void pfe_pe_set_iaccess(pfe_pe_t *pe, uint32_t wdata_reg, uint32_t rdata_reg, uint32_t addr_reg); 29 | errno_t pfe_pe_load_firmware(pfe_pe_t **pe, uint32_t pe_num, const void *elf); 30 | errno_t pfe_pe_get_mmap(const pfe_pe_t *pe, pfe_ct_pe_mmap_t *mmap); 31 | void pfe_pe_memcpy_from_host_to_dmem_32(pfe_pe_t *pe, addr_t dst_addr, const void *src_ptr, uint32_t len); 32 | void pfe_pe_memcpy_from_dmem_to_host_32(pfe_pe_t *pe, void *dst_ptr, addr_t src_addr, uint32_t len); 33 | errno_t pfe_pe_gather_memcpy_from_dmem_to_host_32(pfe_pe_t **pe, int32_t pe_count, void *dst_ptr, addr_t src_addr, uint32_t buffer_len, uint32_t read_len); 34 | errno_t pfe_pe_get_fw_feature_entry(pfe_pe_t *pe, uint32_t id, pfe_ct_feature_desc_t **entry); 35 | errno_t pfe_pe_get_pe_stats_nolock(pfe_pe_t *pe, uint32_t addr, pfe_ct_pe_stats_t *stats); 36 | bool_t pfe_pe_check_stalled_nolock(pfe_pe_t *pe); 37 | errno_t pfe_pe_get_classify_stats_nolock(pfe_pe_t *pe, uint32_t addr, pfe_ct_classify_stats_t *stats); 38 | errno_t pfe_pe_get_class_algo_stats_nolock(pfe_pe_t *pe, uint32_t addr, pfe_ct_class_algo_stats_t *stats); 39 | pfe_ct_pe_sw_state_t pfe_pe_get_fw_state(pfe_pe_t *pe); 40 | 41 | uint32_t pfe_pe_get_text_statistics(pfe_pe_t *pe, struct seq_file *seq, uint8_t verb_level); 42 | 43 | void pfe_pe_destroy(pfe_pe_t **pe, uint32_t pe_num); 44 | errno_t pfe_pe_check_mmap(const pfe_pe_t *pe); 45 | errno_t pfe_pe_get_fw_messages_nolock(pfe_pe_t *pe); 46 | errno_t pfe_pe_get_data_nolock(pfe_pe_t *pe, pfe_ct_buffer_t *buf); 47 | errno_t pfe_pe_put_data_nolock(pfe_pe_t *pe, pfe_ct_buffer_t *buf); 48 | errno_t pfe_pe_memlock_acquire_nolock(pfe_pe_t *pe); 49 | errno_t pfe_pe_memlock_release_nolock(pfe_pe_t *pe); 50 | errno_t pfe_pe_lock_family(pfe_pe_t *pe); 51 | errno_t pfe_pe_unlock_family(pfe_pe_t *pe); 52 | char *pfe_pe_get_fw_feature_str_base(const pfe_pe_t *pe); 53 | 54 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 55 | #define ETH_43_PFE_STOP_SEC_CODE 56 | #include "Eth_43_PFE_MemMap.h" 57 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 58 | 59 | #endif /* PFE_PE_H_ */ 60 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_demo/demo_if_mac.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2020-2021 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #ifndef DEMO_IF_MAC_H_ 32 | #define DEMO_IF_MAC_H_ 33 | 34 | #include 35 | #include 36 | #include "fpp.h" 37 | #include "fpp_ext.h" 38 | #include "libfci.h" 39 | 40 | /* ==== TYPEDEFS & DATA ==================================================== */ 41 | 42 | typedef int (*demo_if_mac_cb_print_t)(const fpp_if_mac_cmd_t* p_if_mac); 43 | 44 | /* ==== PUBLIC FUNCTIONS : use FCI calls to add/del items in PFE =========== */ 45 | 46 | int demo_if_mac_add(FCI_CLIENT* p_cl, const uint8_t p_mac[6], const char* p_name); 47 | int demo_if_mac_del(FCI_CLIENT* p_cl, const uint8_t p_mac[6], const char* p_name); 48 | 49 | /* ==== PUBLIC FUNCTIONS : query local data (no FCI calls) ================= */ 50 | 51 | const char* demo_if_mac_ld_get_name(const fpp_if_mac_cmd_t* p_if_mac); 52 | const uint8_t* demo_if_mac_ld_get_mac(const fpp_if_mac_cmd_t* p_if_mac); 53 | 54 | /* ==== PUBLIC FUNCTIONS : misc ============================================ */ 55 | 56 | int demo_if_mac_print_by_name(FCI_CLIENT* p_cl, demo_if_mac_cb_print_t p_cb_print, const char* p_name); 57 | int demo_if_mac_get_count_by_name(FCI_CLIENT* p_cl, uint32_t* p_rtn_count, const char* p_name); 58 | 59 | /* ========================================================================= */ 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /sw/fifo/Makefile: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # Copyright 2018-2023 NXP 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | # ========================================================================= 7 | 8 | ifndef KERNELRELEASE 9 | include ../build_env.mak 10 | endif 11 | 12 | ARTIFACT = fifo.a 13 | 14 | TARGET = $(OUTPUT_DIR)/$(ARTIFACT) 15 | 16 | #User defined include/preprocessor flags and libraries 17 | 18 | INCLUDES += -I$(INC_PREFIX).. \ 19 | -I$(INC_PREFIX)public \ 20 | -I$(INC_PREFIX)../oal/public/$(shell echo $(TARGET_OS) | tr [A-Z] [a-z]) \ 21 | -I$(INC_PREFIX)../oal/public \ 22 | -I$(INC_PREFIX)../hal/public \ 23 | -I$(INC_PREFIX)../pfe_platform/public \ 24 | -I$(INC_PREFIX)../common/public 25 | 26 | #Dependencies 27 | DEPENDENCIES = $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 28 | 29 | #Compiler flags for build profiles 30 | CCFLAGS_release += -O3 31 | CCFLAGS_debug += -g -O0 -fno-builtin 32 | CCFLAGS_coverage += -g -O0 -ftest-coverage -fprofile-arcs -nopipe -Wc,-auxbase-strip,$@ 33 | LDFLAGS_coverage += -ftest-coverage -fprofile-arcs 34 | CCFLAGS_profile += -g -O0 -finstrument-functions 35 | LIBS_profile += -lprofilingS 36 | 37 | CCFLAGS_pfe += -D$(PFE_CFG_TARGET_ARCH_DEF) -D$(PFE_CFG_TARGET_OS_DEF) -D$(PFE_CFG_BUILD_PROFILE_DEF) 38 | 39 | #Generic compiler flags (which include build type flags) 40 | CCFLAGS_all += -Wall -fmessage-length=0 -fvisibility=hidden 41 | CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE)) 42 | CCFLAGS_all += $(CCFLAGS_pfe) 43 | #Shared library has to be compiled with -fPIC 44 | #CCFLAGS_all += -fPIC 45 | LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE)) 46 | LIBS_all += $(LIBS_$(BUILD_PROFILE)) 47 | DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@ 48 | 49 | #Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp 50 | rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2)) 51 | 52 | #Source list 53 | SRCS = src/fifo.c 54 | 55 | #Object files list 56 | OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(basename $(SRCS)))) 57 | 58 | #Rules section for default compilation and linking 59 | all: $(TARGET) 60 | 61 | #Deps building rule 62 | .PHONY: $(DEPENDENCIES) 63 | $(DEPENDENCIES): 64 | @make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) 65 | 66 | #Compiling rule 67 | $(OUTPUT_DIR)/%.o: %.c 68 | @mkdir -p $(dir $@) 69 | $(CC) -c $(DEPS) -o $@ $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $(GLOBAL_CCFLAGS) $< 70 | 71 | #Linking rule 72 | EMPTY = 73 | $(TARGET):$(OBJS) $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 74 | $(LD) -static -a $(TARGET) $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS) 75 | 76 | .PHONY clean: 77 | clean: $(addsuffix .clean,$(DEPENDENCIES)) 78 | rm -fr $(OUTPUT_DIR) 79 | 80 | #Deps cleaning rule 81 | %.clean: 82 | make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) clean 83 | 84 | rebuild: clean all 85 | 86 | #Inclusion of dependencies (object files to source and includes) 87 | -include $(OBJS:%.o=%.d) 88 | 89 | # 90 | # Linux build 91 | 92 | include $(M)/../dummy_mod.mak 93 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_ecc_err_csr.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #include "pfe_cfg.h" 11 | #include "oal.h" 12 | #include "hal.h" 13 | #include "pfe_hm.h" 14 | #include "pfe_cbus.h" 15 | #include "pfe_ecc_err_csr.h" 16 | 17 | #define TRIG_EN_INTERRUPTS_CHECK (ECC_ERR_INT | ECC_MULTI_ERR_INT) 18 | 19 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 20 | #define ETH_43_PFE_START_SEC_CODE 21 | #include "Eth_43_PFE_MemMap.h" 22 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 23 | 24 | /** 25 | * @brief ECC_ERR ISR 26 | * @details MASK, ACK, and process triggered interrupts. 27 | * @param[in] base_va ECC_ERR register space base address (virtual) 28 | * @return EOK if interrupt has been handled, error code otherwise 29 | */ 30 | errno_t pfe_ecc_err_cfg_isr(addr_t base_va) 31 | { 32 | uint32_t reg_en, reg_src; 33 | errno_t ret = ENOENT; 34 | uint32_t trig_en_interrupts; 35 | 36 | /* Get enabled interrupts */ 37 | reg_en = hal_read32(base_va + WSP_ECC_ERR_INT_EN); 38 | /* Mask ECC Errors interrupts */ 39 | hal_write32((reg_en & ~(ECC_ERR_INT_EN)), base_va + WSP_ECC_ERR_INT_EN); 40 | /* Get triggered interrupts */ 41 | reg_src = hal_read32(base_va + WSP_ECC_ERR_INT_SRC); 42 | /* ACK triggered interrupts*/ 43 | hal_write32(reg_src, base_va + WSP_ECC_ERR_INT_SRC); 44 | 45 | /* Process interrupts which are triggered AND enabled */ 46 | trig_en_interrupts = reg_src & reg_en & TRIG_EN_INTERRUPTS_CHECK; 47 | if (0U != trig_en_interrupts) 48 | { 49 | pfe_hm_report_error(HM_SRC_ECC, HM_EVT_ECC, ""); 50 | ret = EOK; 51 | } 52 | 53 | /* Enable the non-triggered ones only to prevent flooding */ 54 | hal_write32((reg_en & ~reg_src), base_va + WSP_ECC_ERR_INT_EN); 55 | 56 | return ret; 57 | } 58 | 59 | /** 60 | * @brief Mask ECC_ERR interrupts 61 | * @param[in] base_va Base address of the ECC_ERR register space 62 | */ 63 | void pfe_ecc_err_cfg_irq_mask(addr_t base_va) 64 | { 65 | uint32_t reg; 66 | 67 | reg = hal_read32(base_va + WSP_ECC_ERR_INT_EN) & ~(ECC_ERR_INT_EN); 68 | hal_write32(reg, base_va + WSP_ECC_ERR_INT_EN); 69 | } 70 | 71 | /** 72 | * @brief Unmask ECC_ERR interrupts 73 | * @param[in] base_va Base address of the ECC_ERR register space 74 | */ 75 | void pfe_ecc_err_cfg_irq_unmask(addr_t base_va) 76 | { 77 | uint32_t reg; 78 | 79 | reg = hal_read32(base_va + WSP_ECC_ERR_INT_EN) | ECC_ERR_INT_EN; 80 | hal_write32(reg, base_va + WSP_ECC_ERR_INT_EN); 81 | } 82 | 83 | /** 84 | * @brief Unmask all ECC_ERR interrupts 85 | * @param[in] base_va Base address of the ECC_ERR register space 86 | * @note This function is called from thread. 87 | */ 88 | void pfe_ecc_err_cfg_irq_unmask_all(addr_t base_va) 89 | { 90 | hal_write32(ECC_ERR_INT_ENABLE_ALL, base_va + WSP_ECC_ERR_INT_EN); 91 | } 92 | 93 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 94 | #define ETH_43_PFE_STOP_SEC_CODE 95 | #include "Eth_43_PFE_MemMap.h" 96 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 97 | -------------------------------------------------------------------------------- /sw/bpool/Makefile: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # Copyright 2018-2023 NXP 3 | # 4 | # SPDX-License-Identifier: GPL-2.0 5 | # 6 | # ========================================================================= 7 | 8 | ifndef KERNELRELEASE 9 | include ../build_env.mak 10 | endif 11 | 12 | ARTIFACT = bpool.a 13 | 14 | TARGET = $(OUTPUT_DIR)/$(ARTIFACT) 15 | 16 | #User defined include/preprocessor flags and libraries 17 | INCLUDES += -I$(INC_PREFIX)src \ 18 | -I$(INC_PREFIX)public \ 19 | -I$(INC_PREFIX).. \ 20 | -I$(INC_PREFIX)../oal/public \ 21 | -I$(INC_PREFIX)../oal/public/$(shell echo $(TARGET_OS) | tr [A-Z] [a-z]) \ 22 | -I$(INC_PREFIX)../hal/public \ 23 | -I$(INC_PREFIX)../fifo/public \ 24 | -I$(INC_PREFIX)../pfe_platform/public \ 25 | -I$(INC_PREFIX)../common/public 26 | 27 | #Dependencies 28 | DEPENDENCIES = $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 29 | 30 | #Compiler flags for build profiles 31 | CCFLAGS_release += -O3 32 | CCFLAGS_debug += -g -O0 -fno-builtin 33 | CCFLAGS_coverage += -g -O0 -ftest-coverage -fprofile-arcs -nopipe -Wc,-auxbase-strip,$@ 34 | LDFLAGS_coverage += -ftest-coverage -fprofile-arcs 35 | CCFLAGS_profile += -g -O0 -finstrument-functions 36 | LIBS_profile += -lprofilingS 37 | 38 | CCFLAGS_pfe += -D$(PFE_CFG_TARGET_ARCH_DEF) -D$(PFE_CFG_TARGET_OS_DEF) -D$(PFE_CFG_BUILD_PROFILE_DEF) 39 | 40 | #Generic compiler flags (which include build type flags) 41 | CCFLAGS_all += -Wall -fmessage-length=0 -fvisibility=hidden 42 | CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE)) 43 | CCFLAGS_all += $(CCFLAGS_pfe) 44 | #Shared library has to be compiled with -fPIC 45 | #CCFLAGS_all += -fPIC 46 | LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE)) 47 | LIBS_all += $(LIBS_$(BUILD_PROFILE)) 48 | DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@ 49 | 50 | #Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp 51 | rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2)) 52 | 53 | #Source list 54 | SRCS = src/bpool.c 55 | 56 | #Object files list 57 | OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(basename $(SRCS)))) 58 | 59 | #Rules section for default compilation and linking 60 | all: $(TARGET) 61 | 62 | #Deps building rule 63 | .PHONY: $(DEPENDENCIES) 64 | $(DEPENDENCIES): 65 | @make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) 66 | 67 | #Compiling rule 68 | $(OUTPUT_DIR)/%.o: %.c 69 | @mkdir -p $(dir $@) 70 | $(CC) -c $(DEPS) -o $@ $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $(GLOBAL_CCFLAGS) $< 71 | 72 | #Linking rule 73 | EMPTY = 74 | $(TARGET):$(OBJS) $(subst -L,,$(subst $(EMPTY) $(EMPTY)-l:,/,$(LIBS))) 75 | $(LD) -static -a $(TARGET) $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS) 76 | 77 | .PHONY clean: 78 | clean: $(addsuffix .clean,$(DEPENDENCIES)) 79 | rm -fr $(OUTPUT_DIR) 80 | 81 | #Deps cleaning rule 82 | %.clean: 83 | make --no-print-directory -C $(subst build/$(PLATFORM)-$(BUILD_PROFILE),,$(dir $@)) clean 84 | 85 | 86 | rebuild: clean all 87 | 88 | #Inclusion of dependencies (object files to source and includes) 89 | -include $(OBJS:%.o=%.d) 90 | 91 | # 92 | # Linux build 93 | 94 | include $(M)/../dummy_mod.mak 95 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_fw_fail_stop_csr.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #include "pfe_cfg.h" 11 | #include "oal.h" 12 | #include "hal.h" 13 | #include "pfe_hm.h" 14 | #include "pfe_cbus.h" 15 | #include "pfe_fw_fail_stop_csr.h" 16 | 17 | #define TRIG_EN_INTERRUPTS_CHECK (FW_FAIL_STOP_INT | FW_FAIL_STOP_MODE_INT) 18 | 19 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 20 | #define ETH_43_PFE_START_SEC_CODE 21 | #include "Eth_43_PFE_MemMap.h" 22 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 23 | 24 | /** 25 | * @brief FW_FAIL_STOP ISR 26 | * @details MASK, ACK, and process triggered interrupts. 27 | * @param[in] base_va FW_FAIL_STOP register space base address (virtual) 28 | * @return EOK if interrupt has been handled, error code otherwise 29 | */ 30 | errno_t pfe_fw_fail_stop_cfg_isr(addr_t base_va) 31 | { 32 | uint32_t reg_en, reg_src; 33 | errno_t ret = ENOENT; 34 | uint32_t trig_en_interrupts; 35 | 36 | /* Get enabled interrupts */ 37 | reg_en = hal_read32(base_va + WSP_FW_FAIL_STOP_MODE_INT_EN); 38 | /* Mask FW Failstop interrupts */ 39 | hal_write32((reg_en & ~(FW_FAIL_STOP_INT_EN)), base_va + WSP_FW_FAIL_STOP_MODE_INT_EN); 40 | /* Get triggered interrupts */ 41 | reg_src = hal_read32(base_va + WSP_FW_FAIL_STOP_MODE_INT_SRC); 42 | /* ACK triggered interrupts*/ 43 | hal_write32(reg_src, base_va + WSP_FW_FAIL_STOP_MODE_INT_SRC); 44 | 45 | /* Process interrupts which are triggered AND enabled */ 46 | trig_en_interrupts = reg_src & reg_en & TRIG_EN_INTERRUPTS_CHECK; 47 | if (0U != trig_en_interrupts) 48 | { 49 | pfe_hm_report_error(HM_SRC_FW_FAIL_STOP, HM_EVT_FW_FAIL_STOP, ""); 50 | ret = EOK; 51 | } 52 | 53 | /* Enable the non-triggered ones only to prevent flooding */ 54 | hal_write32((reg_en & ~reg_src), base_va + WSP_FW_FAIL_STOP_MODE_INT_EN); 55 | 56 | return ret; 57 | } 58 | 59 | /** 60 | * @brief Mask FW_FAIL_STOP interrupts 61 | * @param[in] base_va Base address of the FW_FAIL_STOP register space 62 | */ 63 | void pfe_fw_fail_stop_cfg_irq_mask(addr_t base_va) 64 | { 65 | uint32_t reg; 66 | 67 | reg = hal_read32(base_va + WSP_FW_FAIL_STOP_MODE_INT_EN) & ~(FW_FAIL_STOP_INT_EN); 68 | hal_write32(reg, base_va + WSP_FW_FAIL_STOP_MODE_INT_EN); 69 | } 70 | 71 | /** 72 | * @brief Unmask FW_FAIL_STOP interrupts 73 | * @param[in] base_va Base address of the FW_FAIL_STOP register space 74 | */ 75 | void pfe_fw_fail_stop_cfg_irq_unmask(addr_t base_va) 76 | { 77 | uint32_t reg; 78 | 79 | reg = hal_read32(base_va + WSP_FW_FAIL_STOP_MODE_INT_EN) | FW_FAIL_STOP_INT_EN; 80 | hal_write32(reg, base_va + WSP_FW_FAIL_STOP_MODE_INT_EN); 81 | } 82 | 83 | /** 84 | * @brief Unmask all FW_FAIL_STOP interrupts 85 | * @param[in] base_va Base address of the FW_FAIL_STOP register space 86 | * @note This function is called from thread. 87 | */ 88 | void pfe_fw_fail_stop_cfg_irq_unmask_all(addr_t base_va) 89 | { 90 | hal_write32(FW_FAIL_STOP_INT_ENABLE_ALL, base_va + WSP_FW_FAIL_STOP_MODE_INT_EN); 91 | } 92 | 93 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 94 | #define ETH_43_PFE_STOP_SEC_CODE 95 | #include "Eth_43_PFE_MemMap.h" 96 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 97 | -------------------------------------------------------------------------------- /sw/fci/src/fci_core.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2019-2022 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | /** 9 | * @addtogroup dxgr_FCI 10 | * @{ 11 | * 12 | * @file fci_core.h 13 | * @brief The FCI core header file 14 | * @details The FCI core is OS-specific module responsible for: 15 | * - IPC with FCI clients running within separated processes within the OS 16 | * environment. 17 | * - Reception of commands from clients and executing OS-independent command 18 | * translator provided by FCI. 19 | * - Maintenance of list of the clients. 20 | * - Provision of API to the rest of FCI to communicate with the clients. 21 | * 22 | * This file specifies common API the FCI core implementation has to implement. 23 | * 24 | */ 25 | 26 | #ifndef SRC_FCI_CORE_H_ 27 | #define SRC_FCI_CORE_H_ 28 | 29 | #include "oal_types.h" /* Common types */ 30 | #include "fci_msg.h" /* The fci_msg_t and related stuff */ 31 | 32 | /** 33 | * @brief Maximum number of event listeners (FCI clients) which can be 34 | * registered to receive runtime notifications from the FCI 35 | * endpoint. 36 | */ 37 | #define FCI_CFG_MAX_CLIENTS 5 38 | 39 | /** 40 | * @brief FCI core type 41 | * @details This is OS-specific part of FCI 42 | */ 43 | typedef struct __fci_core_tag fci_core_t; 44 | 45 | /** 46 | * @brief FCI core client type 47 | */ 48 | typedef struct __fci_core_client_tag fci_core_client_t; 49 | 50 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 51 | #define ETH_43_PFE_START_SEC_CODE 52 | #include "Eth_43_PFE_MemMap.h" 53 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 54 | 55 | /** 56 | * @brief Create FCI core instance 57 | * @details The FCI core is OS-specific part of the FCI endpoint. It is responsible 58 | * for IPC connectivity with the rest of system. 59 | * @param[in] id String identifier specifying the core instance. Intended to be used 60 | * by libFCI to locate the endpoint. 61 | * @retval EOK Success 62 | * @retval EINVAL invalid argument received 63 | * @retval ENOMEM initialization failed 64 | */ 65 | errno_t fci_core_init(const char_t *const id); 66 | 67 | /** 68 | * @brief Destroy FCI core 69 | * @details Close all connections and release all associated resources 70 | */ 71 | void fci_core_fini(void); 72 | 73 | /** 74 | * @brief Send message to the FCI core 75 | * @param[in] msg Pointer to the buffer containing payload to be sent 76 | * @param[in] rep Pointer to buffer where reply data shall be stored 77 | * @return EOK if success, error code otherwise 78 | */ 79 | errno_t fci_core_send(fci_msg_t *msg, fci_msg_t *rep); 80 | 81 | /** 82 | * @brief Send message to FCI client 83 | * @param[in] client The FCI client instance 84 | * @param[in] msg Pointer to the buffer containing payload to be sent 85 | * @param[in] rep Pointer to buffer where reply data shall be stored 86 | * @return EOK if success, error code otherwise 87 | */ 88 | errno_t fci_core_client_send(fci_core_client_t *client, fci_msg_t *msg, fci_msg_t *rep); 89 | 90 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 91 | #define ETH_43_PFE_STOP_SEC_CODE 92 | #include "Eth_43_PFE_MemMap.h" 93 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 94 | 95 | #endif /* SRC_FCI_CORE_H_ */ 96 | 97 | /** @}*/ 98 | -------------------------------------------------------------------------------- /sw/fifo/src/fifo.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2018-2024 NXP 3 | * 4 | * SPDX-License-Identifier: GPL-2.0 5 | * 6 | * ========================================================================= */ 7 | 8 | #include 9 | #include "pfe_cfg.h" 10 | #include "oal.h" 11 | #include "oal_mm.h" 12 | #include "oal_sync.h" 13 | #include "hal.h" 14 | #include "fifo.h" 15 | 16 | #define is_power_of_2(n) ((n) && !((n) & ((n) - 1U))) 17 | 18 | __attribute__((hot)) errno_t fifo_get_fill_level(const fifo_t *const fifo, uint32_t *fill_level) 19 | { 20 | #if defined(PFE_CFG_NULL_ARG_CHECK) 21 | if (unlikely((NULL == fifo) || (NULL == fill_level))) 22 | { 23 | NXP_LOG_ERROR("NULL argument received\n"); 24 | return EINVAL; 25 | } 26 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 27 | 28 | *fill_level = (fifo->write - fifo->read); 29 | return EOK; 30 | } 31 | 32 | __attribute__((hot)) errno_t fifo_get_free_space(const fifo_t *const fifo, uint32_t *free_space) 33 | { 34 | uint32_t ret = 0U; 35 | errno_t err; 36 | 37 | #if defined(PFE_CFG_NULL_ARG_CHECK) 38 | if (unlikely((NULL == fifo) || (NULL == free_space))) 39 | { 40 | NXP_LOG_ERROR("NULL argument received\n"); 41 | return EINVAL; 42 | } 43 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 44 | 45 | err = fifo_get_fill_level(fifo, &ret); 46 | *free_space = fifo->depth - ret; 47 | 48 | return err; 49 | } 50 | 51 | __attribute__((cold, aligned(64))) fifo_t * fifo_create(const uint32_t depth) 52 | { 53 | fifo_t *fifo; 54 | 55 | if (!is_power_of_2(depth) || (depth > 0x7FFFFFFFU)) 56 | { 57 | return NULL; 58 | } 59 | 60 | fifo = (fifo_t *)oal_mm_malloc_contig_aligned_cache(sizeof(fifo_t), HAL_CACHE_LINE_SIZE); 61 | if (NULL != fifo) 62 | { 63 | fifo->read = 0U; 64 | fifo->write = 0U; 65 | fifo->depth = depth; 66 | fifo->depth_mask = depth - 1U; 67 | 68 | fifo->data = oal_mm_malloc_contig_aligned_cache(sizeof(void *) * depth, HAL_CACHE_LINE_SIZE); 69 | if (unlikely(NULL == fifo->data)) 70 | { 71 | oal_mm_free((void *)fifo); 72 | fifo = NULL; 73 | } 74 | } 75 | 76 | return fifo; 77 | } 78 | 79 | __attribute__((cold, aligned(64))) void fifo_destroy(fifo_t *const fifo) 80 | { 81 | if (NULL != fifo) 82 | { 83 | if (unlikely(NULL != fifo->data)) 84 | { 85 | oal_mm_free_contig(fifo->data); 86 | fifo->data = NULL; 87 | } 88 | 89 | oal_mm_free_contig((void *)fifo); 90 | } 91 | } 92 | 93 | __attribute__((cold, aligned(64))) void fifo_clear(fifo_t *const fifo) 94 | { 95 | #if defined(PFE_CFG_NULL_ARG_CHECK) 96 | if (unlikely(NULL == fifo)) 97 | { 98 | NXP_LOG_ERROR("NULL argument received\n"); 99 | } 100 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 101 | 102 | if (NULL != fifo) 103 | { 104 | fifo->read = 0U; 105 | fifo->write = fifo->depth; 106 | } 107 | } 108 | 109 | __attribute__((hot)) void * fifo_peek(const fifo_t * const fifo, uint32_t num) 110 | { 111 | volatile void *ret = NULL; 112 | 113 | #if defined(PFE_CFG_NULL_ARG_CHECK) 114 | if (unlikely(NULL == fifo)) 115 | { 116 | NXP_LOG_ERROR("NULL argument received\n"); 117 | return NULL; 118 | } 119 | #endif /* PFE_CFG_NULL_ARG_CHECK */ 120 | 121 | if (likely(num < fifo->depth)) 122 | { 123 | ret = fifo->data[num]; 124 | } 125 | 126 | return (void *)ret; 127 | } 128 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_util_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2015-2016 Freescale Semiconductor, Inc. 6 | * Copyright 2017-2024 NXP 7 | * 8 | * SPDX-License-Identifier: GPL-2.0 9 | * 10 | * ========================================================================= */ 11 | 12 | #ifndef UTIL_CSR_H_ 13 | #define UTIL_CSR_H_ 14 | 15 | #include "pfe_util.h" 16 | 17 | #define UTIL_VERSION (CBUS_UTIL_CSR_BASE_ADDR + 0x000U) 18 | #define UTIL_TX_CTRL (CBUS_UTIL_CSR_BASE_ADDR + 0x004U) 19 | #define UTIL_INQ_PKTPTR (CBUS_UTIL_CSR_BASE_ADDR + 0x010U) 20 | 21 | #define UTIL_HDR_SIZE (CBUS_UTIL_CSR_BASE_ADDR + 0x014U) 22 | 23 | #define UTIL_PE0_QB_DM_ADDR0 (CBUS_UTIL_CSR_BASE_ADDR + 0x020U) 24 | #define UTIL_PE0_QB_DM_ADDR1 (CBUS_UTIL_CSR_BASE_ADDR + 0x024U) 25 | #define UTIL_PE0_RO_DM_ADDR0 (CBUS_UTIL_CSR_BASE_ADDR + 0x060U) 26 | #define UTIL_PE0_RO_DM_ADDR1 (CBUS_UTIL_CSR_BASE_ADDR + 0x064U) 27 | 28 | #define UTIL_MEM_ACCESS_ADDR (CBUS_UTIL_CSR_BASE_ADDR + 0x100U) 29 | #define UTIL_MEM_ACCESS_WDATA (CBUS_UTIL_CSR_BASE_ADDR + 0x104U) 30 | #define UTIL_MEM_ACCESS_RDATA (CBUS_UTIL_CSR_BASE_ADDR + 0x108U) 31 | 32 | #define UTIL_TM_INQ_ADDR (CBUS_UTIL_CSR_BASE_ADDR + 0x114U) 33 | #define UTIL_PE_STATUS (CBUS_UTIL_CSR_BASE_ADDR + 0x118U) 34 | 35 | #define UTIL_PE_SYS_CLK_RATIO (CBUS_UTIL_CSR_BASE_ADDR + 0x200U) 36 | #define UTIL_AFULL_THRES (CBUS_UTIL_CSR_BASE_ADDR + 0x204U) 37 | #define UTIL_GAP_BETWEEN_READS (CBUS_UTIL_CSR_BASE_ADDR + 0x208U) 38 | #define UTIL_MAX_BUF_CNT (CBUS_UTIL_CSR_BASE_ADDR + 0x20cU) 39 | #define UTIL_TSQ_FIFO_THRES (CBUS_UTIL_CSR_BASE_ADDR + 0x210U) 40 | #define UTIL_TSQ_MAX_CNT (CBUS_UTIL_CSR_BASE_ADDR + 0x214U) 41 | #define UTIL_IRAM_DATA_0 (CBUS_UTIL_CSR_BASE_ADDR + 0x218U) 42 | #define UTIL_IRAM_DATA_1 (CBUS_UTIL_CSR_BASE_ADDR + 0x21cU) 43 | #define UTIL_IRAM_DATA_2 (CBUS_UTIL_CSR_BASE_ADDR + 0x220U) 44 | #define UTIL_IRAM_DATA_3 (CBUS_UTIL_CSR_BASE_ADDR + 0x224U) 45 | 46 | #define UTIL_BUS_ACCESS_ADDR (CBUS_UTIL_CSR_BASE_ADDR + 0x228U) 47 | #define UTIL_BUS_ACCESS_WDATA (CBUS_UTIL_CSR_BASE_ADDR + 0x22cU) 48 | #define UTIL_BUS_ACCESS_RDATA (CBUS_UTIL_CSR_BASE_ADDR + 0x230U) 49 | 50 | #define UTIL_INQ_AFULL_THRES (CBUS_UTIL_CSR_BASE_ADDR + 0x234U) 51 | #define UTIL_UPE_GP_REG_ADDR (CBUS_UTIL_CSR_BASE_ADDR + 0x238U) 52 | #define UTIL_HOST_GP_REG_ADDR (CBUS_UTIL_CSR_BASE_ADDR + 0x23CU) 53 | #define UTIL_MISC_REG_ADDR (CBUS_UTIL_CSR_BASE_ADDR + 0x240U) 54 | 55 | #define UTIL_PE_IBUS_ACCESS_PMEM (1UL << 17U) 56 | #define UTIL_PE_IBUS_ACCESS_DMEM (1UL << 18U) 57 | #define UTIL_PE_IBUS_DMEM_BASE(i) ((((i) & 0x3) << 20U) | UTIL_PE_IBUS_ACCESS_DMEM) 58 | #define UTIL_PE_IBUS_PMEM_BASE(i) ((((i) & 0x3) << 20U) | UTIL_PE_IBUS_ACCESS_PMEM) 59 | 60 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 61 | #define ETH_43_PFE_START_SEC_CODE 62 | #include "Eth_43_PFE_MemMap.h" 63 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 64 | 65 | uint32_t pfe_util_cfg_get_text_stat(addr_t base_va, struct seq_file *seq, uint8_t verb_level); 66 | 67 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 68 | #define ETH_43_PFE_STOP_SEC_CODE 69 | #include "Eth_43_PFE_MemMap.h" 70 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 71 | 72 | #endif /* UTIL_CSR_H_ */ 73 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_hif.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PUBLIC_PFE_HIF_H_ 12 | #define PUBLIC_PFE_HIF_H_ 13 | 14 | #if defined(PFE_CFG_TARGET_OS_LINUX) 15 | #include "pfe_hif_ring_linux.h" 16 | #include "pfe_hif_chnl_linux.h" 17 | #else 18 | #include "pfe_hif_ring.h" 19 | #include "pfe_hif_chnl.h" 20 | #endif 21 | 22 | typedef enum 23 | { 24 | HIF_CHNL_INVALID = 0, 25 | HIF_CHNL_0 = (1 << 0), 26 | HIF_CHNL_1 = (1 << 1), 27 | HIF_CHNL_2 = (1 << 2), 28 | HIF_CHNL_3 = (1 << 3) 29 | } pfe_hif_chnl_id_t; 30 | 31 | #define MASTER_UP (1U << 0) 32 | #define HIF_OCCUPIED (1U << 1) 33 | 34 | /* Way to translate physical interface ID to HIF channel ID... */ 35 | #include "pfe_ct.h" 36 | 37 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 38 | #define ETH_43_PFE_START_SEC_CODE 39 | #include "Eth_43_PFE_MemMap.h" 40 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 41 | 42 | static inline pfe_hif_chnl_id_t pfe_hif_chnl_from_phy_id(pfe_ct_phy_if_id_t phy) 43 | { 44 | if (phy == PFE_PHY_IF_ID_HIF0) 45 | { 46 | return HIF_CHNL_0; 47 | } 48 | else if (phy == PFE_PHY_IF_ID_HIF1) 49 | { 50 | return HIF_CHNL_1; 51 | } 52 | else if (phy == PFE_PHY_IF_ID_HIF2) 53 | { 54 | return HIF_CHNL_2; 55 | } 56 | else if (phy == PFE_PHY_IF_ID_HIF3) 57 | { 58 | return HIF_CHNL_3; 59 | } 60 | else 61 | { 62 | return HIF_CHNL_INVALID; 63 | } 64 | } 65 | 66 | typedef struct pfe_hif_tag pfe_hif_t; 67 | 68 | pfe_hif_t *pfe_hif_create(addr_t cbus_base_va, pfe_hif_chnl_id_t channels_mask); 69 | pfe_hif_chnl_t *pfe_hif_get_channel(const pfe_hif_t *hif, pfe_hif_chnl_id_t channel_id); 70 | void pfe_hif_destroy(pfe_hif_t *hif); 71 | 72 | #ifdef PFE_CFG_PFE_MASTER 73 | errno_t pfe_hif_isr(pfe_hif_t *hif); 74 | void pfe_hif_irq_mask(pfe_hif_t *hif); 75 | void pfe_hif_irq_unmask(pfe_hif_t *hif); 76 | 77 | #if !defined(PFE_CFG_TARGET_OS_AUTOSAR) || defined(PFE_CFG_TEXT_STATS) 78 | uint32_t pfe_hif_get_text_statistics(const pfe_hif_t *hif, char_t *buf, uint32_t buf_len, uint8_t verb_level); 79 | #endif /* !defined(PFE_CFG_TARGET_OS_AUTOSAR) || defined(PFE_CFG_TEXT_STATS) */ 80 | 81 | uint32_t pfe_hif_get_err_poll(pfe_hif_t *hif); 82 | 83 | #ifdef PFE_CFG_MULTI_INSTANCE_SUPPORT 84 | void pfe_hif_clear_master_up(const pfe_hif_t *hif); 85 | void pfe_hif_set_master_up(const pfe_hif_t *hif); 86 | #endif /* PFE_CFG_MULTI_INSTANCE_SUPPORT */ 87 | #endif /* PFE_CFG_PFE_MASTER */ 88 | 89 | #ifdef PFE_CFG_PFE_SLAVE 90 | bool_t pfe_hif_get_master_up(const pfe_hif_t *hif); 91 | #endif /* PFE_CFG_PFE_SLAVE */ 92 | 93 | #ifdef PFE_CFG_MULTI_INSTANCE_SUPPORT 94 | void pfe_hif_set_master_detect_cfg(pfe_hif_t *hif, bool_t on); 95 | bool_t pfe_hif_get_master_detect_cfg(const pfe_hif_t *hif); 96 | #endif /* PFE_CFG_MULTI_INSTANCE_SUPPORT */ 97 | 98 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 99 | #define ETH_43_PFE_STOP_SEC_CODE 100 | #include "Eth_43_PFE_MemMap.h" 101 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 102 | 103 | #endif /* PUBLIC_PFE_HIF_H_ */ 104 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_demo/demo_fci_owner.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include "fpp.h" 39 | #include "fpp_ext.h" 40 | #include "libfci.h" 41 | 42 | #include "demo_common.h" 43 | #include "demo_fci_owner.h" 44 | 45 | /* ==== PUBLIC FUNCTIONS : use FCI calls to get data from PFE ============== */ 46 | 47 | /* 48 | * @brief Use FCI calls to get FCI ownership. 49 | * @param[in] p_cl FCI client 50 | * @return FPP_ERR_OK : The FCI ownership was granted. 51 | * other : Some error occurred (represented by the respective error code). 52 | * No data copied. 53 | */ 54 | int demo_fci_ownership_lock(FCI_CLIENT* p_cl) 55 | { 56 | assert(NULL != p_cl); 57 | int rtn = fci_write(p_cl, FPP_CMD_FCI_OWNERSHIP_LOCK, 0u, NULL); 58 | print_if_error(rtn, "demo_fci_ownership_lock() failed!"); 59 | return (rtn); 60 | } 61 | 62 | /* 63 | * @brief Use FCI calls to release FCI ownership. 64 | * @param[in] p_cl FCI client 65 | * @return FPP_ERR_OK : The FCI ownership was released. 66 | * other : Some error occurred (represented by the respective error code). 67 | * No data copied. 68 | */ 69 | int demo_fci_ownership_unlock(FCI_CLIENT* p_cl) 70 | { 71 | assert(NULL != p_cl); 72 | int rtn = fci_write(p_cl, FPP_CMD_FCI_OWNERSHIP_UNLOCK, 0u, NULL); 73 | print_if_error(rtn, "demo_fci_ownership_unlock() failed!"); 74 | return (rtn); 75 | } 76 | 77 | /* ========================================================================= */ 78 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_l2br_table_csr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2022 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef HW_S32G_PFE_L2BR_TABLE_CSR_H_ 12 | #define HW_S32G_PFE_L2BR_TABLE_CSR_H_ 13 | 14 | #ifndef PFE_CBUS_H_ 15 | #error Missing cbus.h 16 | #endif /* PFE_CBUS_H_ */ 17 | 18 | #define MAC2F_TABLE_HASH_ENTRIES 256U /* Must be power-of-2 */ 19 | #define MAC2F_TABLE_COLL_ENTRIES 256U 20 | #define MAC2F_TABLE_HASH_SPACE_START 0U 21 | #define MAC2F_TABLE_COLL_SPACE_START MAC2F_TABLE_HASH_ENTRIES 22 | 23 | #define HOST_MAC2F_CMD_REG (CLASS_DAMACHASH_HOST_CMD_REG) 24 | #define HOST_MAC2F_MAC1_ADDR_REG (CLASS_DAMACHASH_HOST_MAC_ADDR1_REG) 25 | #define HOST_MAC2F_MAC2_ADDR_REG (CLASS_DAMACHASH_HOST_MAC_ADDR2_REG) 26 | #define HOST_MAC2F_MAC3_ADDR_REG (CLASS_DAMACHASH_HOST_MAC_ADDR3_REG) 27 | #define HOST_MAC2F_MAC4_ADDR_REG (CLASS_DAMACHASH_HOST_MAC_ADDR4_REG) 28 | #define HOST_MAC2F_MAC5_ADDR_REG (CLASS_DAMACHASH_HOST_MAC_ADDR5_REG) 29 | #define HOST_MAC2F_ENTRY_REG (CLASS_DAMACHASH_HOST_ENTRY_REG) 30 | #define HOST_MAC2F_STATUS_REG (CLASS_DAMACHASH_HOST_STATUS_REG) 31 | #define HOST_MAC2F_DIRECT_REG (CLASS_DAMACHASH_HOST_DIRECT) 32 | 33 | #define HOST_MAC2F_FREE_LIST_ENTRIES (CLASS_DAMACHASH_FREELIST_ENTRIES) 34 | #define HOST_MAC2F_FREE_LIST_HEAD_PTR (CLASS_DAMACHASH_FREELIST_HEAD_PTR) 35 | #define HOST_MAC2F_FREE_LIST_TAIL_PTR (CLASS_DAMACHASH_FREELIST_TAIL_PTR) 36 | 37 | #define VLAN_TABLE_HASH_ENTRIES 64U /* Must be power-of-2 */ 38 | #define VLAN_TABLE_COLL_ENTRIES 64U 39 | #define VLAN_TABLE_HASH_SPACE_START 0U 40 | #define VLAN_TABLE_COLL_SPACE_START VLAN_TABLE_HASH_ENTRIES 41 | 42 | #define HOST_VLAN_CMD_REG (CLASS_DAVLANHASH_HOST_CMD_REG) 43 | #define HOST_VLAN_MAC1_ADDR_REG (CLASS_DAVLANHASH_HOST_MAC_ADDR1_REG) 44 | #define HOST_VLAN_MAC2_ADDR_REG (CLASS_DAVLANHASH_HOST_MAC_ADDR2_REG) 45 | #define HOST_VLAN_MAC3_ADDR_REG (CLASS_DAVLANHASH_HOST_MAC_ADDR3_REG) 46 | #define HOST_VLAN_MAC4_ADDR_REG (CLASS_DAVLANHASH_HOST_MAC_ADDR4_REG) 47 | #define HOST_VLAN_MAC5_ADDR_REG (CLASS_DAVLANHASH_HOST_MAC_ADDR5_REG) 48 | #define HOST_VLAN_ENTRY_REG (CLASS_DAVLANHASH_HOST_ENTRY_REG) 49 | #define HOST_VLAN_STATUS_REG (CLASS_DAVLANHASH_HOST_STATUS_REG) 50 | #define HOST_VLAN_DIRECT_REG (CLASS_DAVLANHASH_HOST_DIRECT) 51 | 52 | #define HOST_VLAN_FREE_LIST_ENTRIES (CLASS_DAVLANHASH_FREELIST_ENTRIES) 53 | #define HOST_VLAN_FREE_LIST_HEAD_PTR (CLASS_DAVLANHASH_FREELIST_HEAD_PTR) 54 | #define HOST_VLAN_FREE_LIST_TAIL_PTR (CLASS_DAVLANHASH_FREELIST_TAIL_PTR) 55 | 56 | #define STATUS_REG_CMD_DONE (1U << 0) 57 | #define STATUS_REG_SIG_ENTRY_NOT_FOUND (1U << 1) 58 | #define STATUS_REG_SIG_INIT_DONE (1U << 2) 59 | #define STATUS_REG_SIG_ENTRY_ADDED (1U << 3) 60 | #define STATUS_REG_MATCH (1U << 4) 61 | 62 | typedef enum 63 | { 64 | L2BR_CMD_INIT = 0x1, 65 | L2BR_CMD_ADD = 0x2, 66 | L2BR_CMD_DELETE = 0x3, 67 | L2BR_CMD_UPDATE = 0x4, 68 | L2BR_CMD_SEARCH = 0x5, 69 | L2BR_CMD_MEM_READ = 0x6, 70 | L2BR_CMD_MEM_WRITE = 0x7, 71 | L2BR_CMD_FLUSH = 0x8 72 | } pfe_l2br_table_cmd_t; 73 | 74 | #endif /* HW_S32G_PFE_L2BR_TABLE_CSR_H_ */ 75 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_data_buf.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2025 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "libfci_cli_common.h" 38 | #include "libfci_cli_def_opts.h" 39 | #include "libfci_cli_print_helpers.h" 40 | #include "libfci_cli_def_optarg_keywords.h" 41 | #include "libfci_cli_cmds_data_buf.h" 42 | 43 | #include "fpp.h" 44 | #include "fpp_ext.h" 45 | #include "libfci.h" 46 | 47 | /* ==== TESTMODE vars ====================================================== */ 48 | 49 | #if !defined(NDEBUG) 50 | /* empty */ 51 | #endif 52 | 53 | /* ==== TYPEDEFS & DATA ==================================================== */ 54 | 55 | extern FCI_CLIENT* cli_p_cl; 56 | 57 | /* ==== PUBLIC FUNCTIONS =================================================== */ 58 | 59 | int cli_cmd_data_buf_put(const cli_cmdargs_t *p_cmdargs) 60 | { 61 | assert(NULL != cli_p_cl); 62 | assert(NULL != p_cmdargs); 63 | 64 | int rtn = CLI_ERR; 65 | fpp_buf_cmd_t cmd = {}; 66 | 67 | /* check for mandatory opts */ 68 | const mandopt_t mandopts[] = 69 | { 70 | {OPT_BUF_PAYLOAD, NULL, (p_cmdargs->payload.is_valid)}, 71 | }; 72 | rtn = cli_mandopt_check(mandopts, MANDOPTS_CALC_LN(mandopts)); 73 | 74 | if (FPP_ERR_OK == rtn) 75 | { 76 | cmd.len = p_cmdargs->payload.count; 77 | memcpy(cmd.payload, &p_cmdargs->payload.arr, p_cmdargs->payload.count); 78 | 79 | rtn = fci_write(cli_p_cl, FPP_CMD_DATA_BUF_PUT, sizeof(cmd), (unsigned short*)&cmd); 80 | } 81 | 82 | return (rtn); 83 | } 84 | 85 | /* ========================================================================= */ 86 | -------------------------------------------------------------------------------- /sw/libfci_cli/src/libfci_cli_cmds_fci_owner.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * Copyright 2022 NXP 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 22 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * ========================================================================= */ 30 | 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "libfci_cli_common.h" 39 | #include "libfci_cli_def_opts.h" 40 | #include "libfci_cli_print_helpers.h" 41 | #include "libfci_cli_def_optarg_keywords.h" 42 | #include "libfci_cli_cmds_fci_owner.h" 43 | 44 | #include "libfci_demo/demo_fci_owner.h" 45 | 46 | /* ==== TESTMODE vars ====================================================== */ 47 | 48 | #if !defined(NDEBUG) 49 | /* empty */ 50 | #endif 51 | 52 | /* ==== TYPEDEFS & DATA ==================================================== */ 53 | 54 | extern FCI_CLIENT* cli_p_cl; 55 | 56 | /* ==== PUBLIC FUNCTIONS =================================================== */ 57 | 58 | int cli_cmd_fci_ownership(const cli_cmdargs_t *p_cmdargs) 59 | { 60 | assert(NULL != cli_p_cl); 61 | assert(NULL != p_cmdargs); 62 | 63 | 64 | int rtn = CLI_ERR; 65 | 66 | /* check for mandatory opts */ 67 | const mandopt_optbuf_t asd = {{OPT_LOCK, OPT_UNLOCK}}; 68 | const mandopt_t mandopts[] = 69 | { 70 | {OPT_NONE, &asd, ((p_cmdargs->lock0.is_valid) || (p_cmdargs->unlock0.is_valid))}, 71 | }; 72 | rtn = cli_mandopt_check(mandopts, MANDOPTS_CALC_LN(mandopts)); 73 | 74 | /* exec */ 75 | if (FPP_ERR_OK == rtn) 76 | { 77 | if (p_cmdargs->lock0.is_valid) 78 | { 79 | rtn = demo_fci_ownership_lock(cli_p_cl); 80 | } 81 | if (p_cmdargs->unlock0.is_valid) 82 | { 83 | rtn = demo_fci_ownership_unlock(cli_p_cl); 84 | } 85 | } 86 | 87 | return (rtn); 88 | } 89 | 90 | /* ========================================================================= */ 91 | -------------------------------------------------------------------------------- /sw/pfe_platform/hw/s32g/pfe_host_fail_stop_csr.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2020-2021 Imagination Technologies Limited 4 | * Copyright 2022 NXP 5 | * 6 | * SPDX-License-Identifier: GPL-2.0 7 | * 8 | * ========================================================================= */ 9 | 10 | #include "pfe_cfg.h" 11 | #include "oal.h" 12 | #include "hal.h" 13 | #include "pfe_hm.h" 14 | #include "pfe_cbus.h" 15 | #include "pfe_host_fail_stop_csr.h" 16 | 17 | #define TRIG_EN_INTERRUPTS_CHECK (HOST_FORCE_DEBUG_FAIL_STOP_INT | HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT) 18 | 19 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 20 | #define ETH_43_PFE_START_SEC_CODE 21 | #include "Eth_43_PFE_MemMap.h" 22 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 23 | 24 | /** 25 | * @brief HOST_FAIL_STOP ISR 26 | * @details MASK, ACK, and process triggered interrupts. 27 | * @param[in] base_va HOST_FAIL_STOP register space base address (virtual) 28 | * @return EOK if interrupt has been handled, error code otherwise 29 | */ 30 | errno_t pfe_host_fail_stop_cfg_isr(addr_t base_va) 31 | { 32 | uint32_t reg_en, reg_src; 33 | errno_t ret = ENOENT; 34 | uint32_t trig_en_interrupts; 35 | 36 | /* Get enabled interrupts */ 37 | reg_en = hal_read32(base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN); 38 | /* Mask Host Failstop interrupts */ 39 | hal_write32((reg_en & ~(HOST_FORCE_DEBUG_FAIL_STOP_INT_EN)), base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN); 40 | /* Get triggered interrupts */ 41 | reg_src = hal_read32(base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_SRC); 42 | /* ACK triggered interrupts*/ 43 | hal_write32(reg_src, base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_SRC); 44 | 45 | /* Process interrupts which are triggered AND enabled */ 46 | trig_en_interrupts = reg_src & reg_en & TRIG_EN_INTERRUPTS_CHECK; 47 | if (0U != trig_en_interrupts) 48 | { 49 | pfe_hm_report_error(HM_SRC_HOST_FAIL_STOP, HM_EVT_HOST_FAIL_STOP, ""); 50 | ret = EOK; 51 | } 52 | 53 | /* Enable the non-triggered ones only to prevent flooding */ 54 | hal_write32((reg_en & ~reg_src), base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN); 55 | 56 | return ret; 57 | } 58 | 59 | /** 60 | * @brief Mask HOST_FAIL_STOP interrupts 61 | * @param[in] base_va Base address of the HOST_FAIL_STOP register space 62 | */ 63 | void pfe_host_fail_stop_cfg_irq_mask(addr_t base_va) 64 | { 65 | uint32_t reg; 66 | 67 | reg = hal_read32(base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN) & ~(HOST_FORCE_DEBUG_FAIL_STOP_INT_EN); 68 | hal_write32(reg, base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN); 69 | } 70 | 71 | /** 72 | * @brief Unmask HOST_FAIL_STOP interrupts 73 | * @param[in] base_va Base address of the HOST_FAIL_STOP register space 74 | */ 75 | void pfe_host_fail_stop_cfg_irq_unmask(addr_t base_va) 76 | { 77 | uint32_t reg; 78 | 79 | reg = hal_read32(base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN) | HOST_FORCE_DEBUG_FAIL_STOP_INT_EN; 80 | hal_write32(reg, base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN); 81 | } 82 | 83 | /** 84 | * @brief Unmask all HOST_FAIL_STOP interrupts 85 | * @param[in] base_va Base address of the HOST_FAIL_STOP register space 86 | * @note This function is called from thread. 87 | */ 88 | void pfe_host_fail_stop_cfg_irq_unmask_all(addr_t base_va) 89 | { 90 | hal_write32(HOST_FORCE_DEBUG_FAIL_STOP_INT_ENABLE_ALL, base_va + WSP_HOST_FORCE_DEBUG_FAIL_STOP_MODE_INT_EN); 91 | } 92 | 93 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 94 | #define ETH_43_PFE_STOP_SEC_CODE 95 | #include "Eth_43_PFE_MemMap.h" 96 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 97 | -------------------------------------------------------------------------------- /sw/pfe_platform/public/pfe_log_if.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= 2 | * 3 | * Copyright (c) 2019 Imagination Technologies Limited 4 | * Copyright (c) 2020-2021 Imagination Technologies Limited 5 | * Copyright 2018-2022,2024-2025 NXP 6 | * 7 | * SPDX-License-Identifier: GPL-2.0 8 | * 9 | * ========================================================================= */ 10 | 11 | #ifndef PUBLIC_PFE_LOG_IF_H_ 12 | #define PUBLIC_PFE_LOG_IF_H_ 13 | 14 | #include "pfe_ct.h" 15 | 16 | /** 17 | * @brief Interface callback reasons 18 | */ 19 | typedef enum 20 | { 21 | LOG_IF_EVT_MAC_ADDR_UPDATE, /*!< LOG_IF_EVT_MAC_ADDR_UPDATE */ 22 | LOG_IF_EVT_INVALID /*!< LOG_IF_EVT_INVALID */ 23 | } pfe_log_if_event_t; 24 | 25 | typedef struct pfe_log_if_tag pfe_log_if_t; 26 | 27 | #include "pfe_phy_if.h" 28 | 29 | /** 30 | * @brief Interface callback type 31 | */ 32 | typedef void (* pfe_log_if_cbk_t)(pfe_log_if_t *iface, pfe_log_if_event_t event, void *arg); 33 | 34 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 35 | #define ETH_43_PFE_START_SEC_CODE 36 | #include "Eth_43_PFE_MemMap.h" 37 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 38 | 39 | pfe_log_if_t *pfe_log_if_create(pfe_phy_if_t *parent, const char_t *name); 40 | uint8_t pfe_log_if_get_id(const pfe_log_if_t *iface) __attribute__((pure)); 41 | __attribute__((pure)) pfe_phy_if_t *pfe_log_if_get_parent(const pfe_log_if_t *iface); 42 | errno_t pfe_log_if_set_next_dmem_ptr(pfe_log_if_t *iface, addr_t next_dmem_ptr); 43 | errno_t pfe_log_if_get_next_dmem_ptr(pfe_log_if_t *iface, addr_t *next_dmem_ptr); 44 | errno_t pfe_log_if_get_dmem_base(const pfe_log_if_t *iface, addr_t *dmem_base); 45 | void pfe_log_if_destroy(pfe_log_if_t *iface); 46 | void pfe_log_if_fini(void); 47 | errno_t pfe_log_if_set_match_or(pfe_log_if_t *iface); 48 | errno_t pfe_log_if_set_match_and(pfe_log_if_t *iface); 49 | bool_t pfe_log_if_is_match_or(pfe_log_if_t *iface); 50 | errno_t pfe_log_if_set_match_rules(pfe_log_if_t *iface, pfe_ct_if_m_rules_t rules, const pfe_ct_if_m_args_t *args); 51 | errno_t pfe_log_if_get_match_rules(pfe_log_if_t *iface, pfe_ct_if_m_rules_t *rules, pfe_ct_if_m_args_t *args); 52 | errno_t pfe_log_if_add_match_rule(pfe_log_if_t *iface, pfe_ct_if_m_rules_t rule, const void *arg, uint32_t arg_len); 53 | errno_t pfe_log_if_del_match_rule(pfe_log_if_t *iface, pfe_ct_if_m_rules_t rule); 54 | errno_t pfe_log_if_get_egress_ifs(pfe_log_if_t *iface, uint32_t *egress); 55 | errno_t pfe_log_if_set_egress_ifs(pfe_log_if_t *iface, uint32_t egress); 56 | errno_t pfe_log_if_add_egress_if(pfe_log_if_t *iface, const pfe_phy_if_t *phy_if); 57 | errno_t pfe_log_if_del_egress_if(pfe_log_if_t *iface, const pfe_phy_if_t *phy_if); 58 | errno_t pfe_log_if_enable(pfe_log_if_t *iface); 59 | errno_t pfe_log_if_disable(pfe_log_if_t *iface); 60 | bool_t pfe_log_if_is_enabled(pfe_log_if_t *iface) __attribute__((pure)); 61 | errno_t pfe_log_if_promisc_enable(pfe_log_if_t *iface); 62 | errno_t pfe_log_if_promisc_disable(pfe_log_if_t *iface); 63 | bool_t pfe_log_if_is_promisc(pfe_log_if_t *iface) __attribute__((pure)); 64 | const char_t *pfe_log_if_get_name(const pfe_log_if_t *iface) __attribute__((pure)); 65 | errno_t pfe_log_if_discard_enable(pfe_log_if_t *iface); 66 | errno_t pfe_log_if_discard_disable(pfe_log_if_t *iface); 67 | bool_t pfe_log_if_is_discard(pfe_log_if_t *iface); 68 | errno_t pfe_log_if_get_stats(const pfe_log_if_t *iface, pfe_ct_class_algo_stats_t *stat); 69 | 70 | #ifdef PFE_CFG_TARGET_OS_AUTOSAR 71 | #define ETH_43_PFE_STOP_SEC_CODE 72 | #include "Eth_43_PFE_MemMap.h" 73 | #endif /* PFE_CFG_TARGET_OS_AUTOSAR */ 74 | 75 | #endif /* PUBLIC_PFE_LOG_IF_H_ */ 76 | -------------------------------------------------------------------------------- /PFE-DRV_S32G_A53_LNX_1.10.0_SBOM.spdx.json: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2025-11-07T08:57:36Z", 6 | "creators": [ 7 | "Organization: NXP" 8 | ], 9 | "licenseListVersion": "3.20" 10 | }, 11 | "name": "PFE-DRV_S32G_A53_LNX-1.10.0", 12 | "dataLicense": "CC0-1.0", 13 | "hasExtractedLicensingInfos": [ 14 | { 15 | "licenseId": "LicenseRef-9169fb33-e3b5-4167-b984-f84877f34078", 16 | "extractedText": "GNU All-Permissive License 2.0\n==============================\n\nCopying and distribution of this file, with or without modification, are\npermitted in any medium without royalty provided the copyright notice and this\nnotice are preserved. This file is offered as-is, without any warranty.", 17 | "name": "GNU All-Permissive License 2.0" 18 | } 19 | ], 20 | "documentNamespace": "https://nxp.com/spdx/52ca8f7f-fa72-4587-ae1f-8007bce1192f", 21 | "packages": [ 22 | { 23 | "SPDXID": "SPDXRef-package-4f7a36c7-2024-43e0-b209-a651151b2e17", 24 | "name": "Compile-Time Assert", 25 | "versionInfo": "Update 9", 26 | "licenseConcluded": "LicenseRef-9169fb33-e3b5-4167-b984-f84877f34078", 27 | "licenseDeclared": "LicenseRef-9169fb33-e3b5-4167-b984-f84877f34078", 28 | "homepage": "https://www.pixelbeat.org/programming/gcc/static_assert.html", 29 | "downloadLocation": "https://www.pixelbeat.org/programming/gcc/static_assert.html", 30 | "originator": "Person: Pádraig Brady et al. (P@draigBrady.com)", 31 | "supplier": "NOASSERTION", 32 | "comment": "Modifications by NXP.\n\n./sw/common/public/ct_assert.h", 33 | "externalRefs": [], 34 | "filesAnalyzed": false 35 | }, 36 | { 37 | "SPDXID": "SPDXRef-package-52ca8f7f-fa72-4587-ae1f-8007bce1192f", 38 | "name": "PFE-DRV_S32G_A53_LNX", 39 | "versionInfo": "1.10.0", 40 | "licenseConcluded": "(GPL-2.0-only)", 41 | "licenseDeclared": "(GPL-2.0-only)", 42 | "downloadLocation": "https://github.com/nxp-auto-linux/pfeng", 43 | "originator": "Organization: NXP", 44 | "supplier": "NOASSERTION", 45 | "comment": "S32G PFE Linux Driver", 46 | "externalRefs": [], 47 | "filesAnalyzed": false 48 | }, 49 | { 50 | "SPDXID": "SPDXRef-package-c5073ea8-7544-4927-bb56-7a8f93f8c0ae", 51 | "name": "PFE-DRV_S32G_A53_LNX_LIBFCI_CLI", 52 | "versionInfo": "2.17.0", 53 | "licenseConcluded": "BSD-3-Clause", 54 | "licenseDeclared": "BSD-3-Clause", 55 | "homepage": "https://github.com/nxp-auto-linux/pfeng", 56 | "downloadLocation": "https://github.com/nxp-auto-linux/pfeng", 57 | "originator": "Organization: NXP", 58 | "supplier": "NOASSERTION", 59 | "comment": "DEMO configuration utility. This utility is __NOT__ production software.\n\n./sw/libfci_cli/", 60 | "externalRefs": [], 61 | "filesAnalyzed": false 62 | } 63 | ], 64 | "relationships": [ 65 | { 66 | "spdxElementId": "SPDXRef-package-52ca8f7f-fa72-4587-ae1f-8007bce1192f", 67 | "relationshipType": "CONTAINS", 68 | "relatedSpdxElement": "SPDXRef-package-4f7a36c7-2024-43e0-b209-a651151b2e17" 69 | }, 70 | { 71 | "spdxElementId": "SPDXRef-DOCUMENT", 72 | "relationshipType": "DESCRIBES", 73 | "relatedSpdxElement": "SPDXRef-package-52ca8f7f-fa72-4587-ae1f-8007bce1192f" 74 | }, 75 | { 76 | "spdxElementId": "SPDXRef-package-52ca8f7f-fa72-4587-ae1f-8007bce1192f", 77 | "relationshipType": "CONTAINS", 78 | "relatedSpdxElement": "SPDXRef-package-c5073ea8-7544-4927-bb56-7a8f93f8c0ae" 79 | } 80 | ] 81 | } --------------------------------------------------------------------------------