From ae9837f68e228934ba86cfee702aeec80fae4490 Mon Sep 17 00:00:00 2001 From: Mohan Thadikamalla Date: Wed, 19 Oct 2022 13:21:17 +0530 Subject: [PATCH] nvethernetrm: Convert OSI core as a static library Issue: OSI core needs to be converted as a static library for the HVRTOS server. Fix: Convert OSI core as a static library. Bug 3691486 Change-Id: Ie1f7fc0c3a722cb7ddab24da8488904ead80ecc4 Signed-off-by: Mohan Thadikamalla Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2794675 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Mahesh Patil Reviewed-by: Bhadram Varka Reviewed-by: Ashutosh Jha GVS: Gerrit_Virtual_Submit --- osi/core/Makefile.interface.tmk | 11 ++----- osi/core/Makefile.sdk | 43 ------------------------ osi/core/Makefile.tmk | 4 +-- osi/core/debug.c | 2 +- osi/core/libnvethernetrm.export | 44 ------------------------- osi/core/libnvethernetrm_debug.export | 47 --------------------------- osi/dma/debug.c | 6 ++-- 7 files changed, 9 insertions(+), 148 deletions(-) delete mode 100644 osi/core/Makefile.sdk delete mode 100644 osi/core/libnvethernetrm.export delete mode 100644 osi/core/libnvethernetrm_debug.export diff --git a/osi/core/Makefile.interface.tmk b/osi/core/Makefile.interface.tmk index 752cfc2..4abf439 100644 --- a/osi/core/Makefile.interface.tmk +++ b/osi/core/Makefile.interface.tmk @@ -24,17 +24,12 @@ # ############################################################################### -ifdef NV_INTERFACE_FLAG_SHARED_LIBRARY_SECTION -NV_INTERFACE_NAME := nvethernetrm -ifeq ($(NV_BUILD_CONFIGURATION_IS_SAFETY),0) -NV_INTERFACE_EXPORTS := lib$(NV_INTERFACE_NAME)_debug -else -NV_INTERFACE_EXPORTS := lib$(NV_INTERFACE_NAME) -endif +ifdef NV_INTERFACE_FLAG_STATIC_LIBRARY_SECTION +NV_COMPONENT_NAME := nvethernetrm +NV_INTERFACE_COMPONENT_DIR := . NV_INTERFACE_PUBLIC_INCLUDES := \ ./include endif - # Local Variables: # indent-tabs-mode: t # tab-width: 8 diff --git a/osi/core/Makefile.sdk b/osi/core/Makefile.sdk deleted file mode 100644 index 5ee8e6d..0000000 --- a/osi/core/Makefile.sdk +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2020-2022 NVIDIA CORPORATION. All Rights Reserved. -# -# NVIDIA CORPORATION and its licensors retain all intellectual property -# and proprietary rights in and to this software, related documentation -# and any modifications thereto. Any use, reproduction, disclosure or -# distribution of this software and related documentation without an express -# license agreement from NVIDIA CORPORATION is strictly prohibited. - -include $(PDK_TOP)/drive-t186ref-qnx/make/nvdefs.mk - -TARGETS = libnvethernetrm.so - -CFLAGS += -g -Wall $(NV_PLATFORM_OPT) $(NV_PLATFORM_CFLAGS) -CPPFLAGS = $(NV_PLATFORM_SDK_INC) $(NV_PLATFORM_CPPFLAGS) -I../../../include -I../dma -I../common/include -CPPFLAGS += -DNV_IS_SAFETY=$(NV_PLATFORM_SAFETY) -LDFLAGS := \ - $(NV_PLATFORM_SDK_LIB) \ - $(NV_PLATFORM_LDFLAGS) -LDFLAGS += -shared - -OBJS := eqos_core.o -OBJS += eqos_mmc.o -OBJS += osi_core.o -OBJS += vlan_filter.o -OBJS += frp.o -OBJS += mgbe_core.o -OBJS += xpcs.o -OBJS += mgbe_mmc.o -OBJS += osi_hal.o -OBJS += ivc_core.o -OBJS += ./../common/osi_common.o -OBJS += ./../common/eqos_common.o -OBJS += ./../common/mgbe_common.o -OBJS += core_common.o - -CFLAGS += -D_FILE_OFFSET_BITS=64 - -$(TARGETS): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) - $(STRIP) --strip-unneeded -R .comment -R .GCC.command.line $@ - -clean clobber: - rm -rf $(OBJS) $(TARGETS) diff --git a/osi/core/Makefile.tmk b/osi/core/Makefile.tmk index a4fb0a0..21b9bce 100644 --- a/osi/core/Makefile.tmk +++ b/osi/core/Makefile.tmk @@ -22,7 +22,7 @@ # ############################################################################### -ifdef NV_COMPONENT_FLAG_SHARED_LIBRARY_SECTION +ifdef NV_COMPONENT_FLAG_STATIC_LIBRARY_SECTION include $(NV_BUILD_START_COMPONENT) NV_COMPONENT_STRICT_WARNINGS_qnx_64 := 1 @@ -68,7 +68,7 @@ NV_COMPONENT_INCLUDES := \ $(NV_SOURCE)/nvethernetrm/include \ $(NV_SOURCE)/nvethernetrm/osi/common/include -include $(NV_BUILD_SHARED_LIBRARY) +include $(NV_BUILD_STATIC_LIBRARY) endif # Local Variables: diff --git a/osi/core/debug.c b/osi/core/debug.c index d083b36..622edf7 100644 --- a/osi/core/debug.c +++ b/osi/core/debug.c @@ -35,7 +35,7 @@ static void core_dump_struct(struct osi_core_priv_data *osi_core, nveu8_t *ptr, unsigned long size) { - nveu32_t i = 0, rem, j; + nveu32_t i = 0, rem, j = 0; unsigned long temp; if (ptr == OSI_NULL) { diff --git a/osi/core/libnvethernetrm.export b/osi/core/libnvethernetrm.export deleted file mode 100644 index c267b97..0000000 --- a/osi/core/libnvethernetrm.export +++ /dev/null @@ -1,44 +0,0 @@ -################################### tell Emacs this is a -*- makefile-gmake -*- -# -# Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# -# libnvethernetrm interface export -# -############################################################################### -osi_init_core_ops -osi_write_phy_reg -osi_read_phy_reg -osi_hw_core_init -osi_hw_core_deinit -osi_get_core -osi_handle_ioctl -osi_macsec_en -osi_macsec_deinit -osi_macsec_isr -osi_macsec_init -osi_macsec_cipher_config -osi_macsec_config -osi_init_macsec_ops -osi_macsec_read_mmc -osi_macsec_config_lut -osi_macsec_get_sc_lut_key_index -# Enable below if MACSEC_KEY_PROGRAM is enabled -#osi_macsec_kt_config diff --git a/osi/core/libnvethernetrm_debug.export b/osi/core/libnvethernetrm_debug.export deleted file mode 100644 index 32f526d..0000000 --- a/osi/core/libnvethernetrm_debug.export +++ /dev/null @@ -1,47 +0,0 @@ -################################### tell Emacs this is a -*- makefile-gmake -*- -# -# Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -# -# libnvethernetrm interface export -# -############################################################################### -osi_init_core_ops -osi_write_phy_reg -osi_read_phy_reg -osi_hw_core_init -osi_hw_core_deinit -osi_get_core -osi_handle_ioctl -osi_macsec_en -osi_macsec_deinit -osi_macsec_isr -osi_macsec_init -osi_macsec_cipher_config -osi_macsec_config -osi_init_macsec_ops -osi_macsec_loopback -osi_macsec_read_mmc -osi_macsec_dbg_events_config -osi_macsec_config_dbg_buf -osi_macsec_config_lut -osi_macsec_get_sc_lut_key_index -# Enable below if MACSEC_KEY_PROGRAM is enabled -#osi_macsec_kt_config diff --git a/osi/dma/debug.c b/osi/dma/debug.c index aecbfa8..8c29763 100644 --- a/osi/dma/debug.c +++ b/osi/dma/debug.c @@ -35,7 +35,7 @@ static void dump_struct(struct osi_dma_priv_data *osi_dma, unsigned char *ptr, unsigned long size) { - nveu32_t i = 0, rem, j; + nveu32_t i = 0, rem, j = 0; unsigned long temp; if (ptr == OSI_NULL) { @@ -205,9 +205,9 @@ static void tx_desc_dump(struct osi_dma_priv_data *osi_dma, unsigned int f_idx, int cnt; if (f_idx > l_idx) { - cnt = l_idx + osi_dma->tx_ring_sz - f_idx; + cnt = (int)(l_idx + osi_dma->tx_ring_sz - f_idx); } else { - cnt = l_idx - f_idx; + cnt = (int)(l_idx - f_idx); } for (i = f_idx; cnt >= 0; cnt--) {