From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0AE38A04DB;
	Sat, 17 Oct 2020 08:28:35 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id AA307E2D1;
	Sat, 17 Oct 2020 08:28:18 +0200 (CEST)
Received: from relay.smtp-ext.broadcom.com (unknown [192.19.221.30])
 by dpdk.org (Postfix) with ESMTP id CCEB9CFB3
 for <dev@dpdk.org>; Sat, 17 Oct 2020 08:28:12 +0200 (CEST)
Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))
 (No client certificate requested)
 by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 7BA0624750;
 Fri, 16 Oct 2020 23:28:11 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 7BA0624750
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;
 s=dkimrelay; t=1602916091;
 bh=QaGXAohWe7yO+zYKyFbSTjQcvtKfaS4uZZmeJ7TrNFE=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=ZjgX4P/EEOmUEpqtXn5NCANmpkj/z1fgoBcJcDYqG6z3+UPDRpYQyPOaznKNYvNaH
 O/M5JCbK3e/lGAHaPnvh6gWhzZ7DyzPO+J/hovqC5DnPFCzg4L/VgFmW//XmY1bsdp
 xYKBsvVnjSCrrGMx3DDYdg5+in+rWDZZ2catoV+U=
From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
To: dev@dpdk.org
Cc: Peter Spreadborough <peter.spreadborough@broadcom.com>
Date: Sat, 17 Oct 2020 11:57:56 +0530
Message-Id: <1602916089-18576-2-git-send-email-venkatkumar.duvvuru@broadcom.com>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com>
References: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com>
Subject: [dpdk-dev] [PATCH 01/14] net/bnxt: device cleanup of FW
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Peter Spreadborough <peter.spreadborough@broadcom.com>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on

Signed-off-by: Peter Spreadborough <peter.spreadborough@broadcom.com>
Reviewed-by: Farah Smith <farah.smith@broadcom.com>
---
 drivers/net/bnxt/hcapi/hcapi_cfa.h       | 39 ++++++++++++++++++++++++--------
 drivers/net/bnxt/tf_core/tf_core.h       |  2 +-
 drivers/net/bnxt/tf_core/tf_device_p45.h | 16 +++++++++++++
 drivers/net/bnxt/tf_core/tf_em.h         |  6 -----
 4 files changed, 46 insertions(+), 17 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h

diff --git a/drivers/net/bnxt/hcapi/hcapi_cfa.h b/drivers/net/bnxt/hcapi/hcapi_cfa.h
index c7d87de..aa218d7 100644
--- a/drivers/net/bnxt/hcapi/hcapi_cfa.h
+++ b/drivers/net/bnxt/hcapi/hcapi_cfa.h
@@ -14,7 +14,15 @@
 
 #include "hcapi_cfa_defs.h"
 
+#if CHIP_CFG == SR_A
+#define SUPPORT_CFA_HW_P45  1
+#undef SUPPORT_CFA_HW_P4
+#define SUPPORT_CFA_HW_P4   0
+#elif CHIP_CFG == CMB_A
 #define SUPPORT_CFA_HW_P4  1
+#else
+#error "Chip not supported"
+#endif
 
 #if SUPPORT_CFA_HW_P4 && SUPPORT_CFA_HW_P58 && SUPPORT_CFA_HW_P59
 #define SUPPORT_CFA_HW_ALL  1
@@ -81,17 +89,20 @@ struct hcapi_cfa_key_result {
 /* common CFA register access macros */
 #define CFA_REG(x)		OFFSETOF(cfa_reg_t, cfa_##x)
 
-#ifndef REG_WR
-#define REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
+#ifndef TF_REG_WR
+#define TF_REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
 #endif
-#ifndef REG_RD
-#define REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#ifndef TF_REG_RD
+#define TF_REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#endif
+#ifndef TF_CFA_REG_RD
+#define TF_CFA_REG_RD(_p, x)	\
+	TF_REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
+#endif
+#ifndef TF_CFA_REG_WR
+#define TF_CFA_REG_WR(_p, x, y)	\
+	TF_REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
 #endif
-#define CFA_REG_RD(_p, x)	\
-	REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
-#define CFA_REG_WR(_p, x, y)	\
-	REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
-
 
 /* Constants used by Resource Manager Registration*/
 #define RM_CLIENT_NAME_MAX_LEN          32
@@ -248,7 +259,15 @@ int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
 int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
 				 uint32_t type,
 				 struct hcapi_cfa_data *config);
-#endif /* SUPPORT_CFA_HW_P4 */
+/* SUPPORT_CFA_HW_P4 */
+#elif SUPPORT_CFA_HW_P45
+int hcapi_cfa_p45_mirror_hwop(struct hcapi_cfa_hwop *op,
+			      struct hcapi_cfa_data *mirror);
+int hcapi_cfa_p45_global_cfg_hwop(struct hcapi_cfa_hwop *op,
+				  uint32_t type,
+				  struct hcapi_cfa_data *config);
+/* SUPPORT_CFA_HW_P45 */
+#endif
 /**
  *  HCAPI CFA device HW operation function callback definition
  *  This is standardized function callback hook to install different
diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h
index db10935..65be8f5 100644
--- a/drivers/net/bnxt/tf_core/tf_core.h
+++ b/drivers/net/bnxt/tf_core/tf_core.h
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "hcapi/hcapi_cfa.h"
+#include "hcapi/hcapi_cfa_defs.h"
 #include "tf_project.h"
 
 /**
diff --git a/drivers/net/bnxt/tf_core/tf_device_p45.h b/drivers/net/bnxt/tf_core/tf_device_p45.h
new file mode 100644
index 0000000..2da59d1
--- /dev/null
+++ b/drivers/net/bnxt/tf_core/tf_device_p45.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2020 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _TF_DEVICE_P45_H_
+#define _TF_DEVICE_P45_H_
+
+#include <cfa_resource_types.h>
+
+#include "tf_core.h"
+#include "tf_rm.h"
+#include "tf_if_tbl.h"
+#include "tf_global_cfg.h"
+
+#endif /* _TF_DEVICE_P45_H_ */
diff --git a/drivers/net/bnxt/tf_core/tf_em.h b/drivers/net/bnxt/tf_core/tf_em.h
index 2a67e47..51b0813 100644
--- a/drivers/net/bnxt/tf_core/tf_em.h
+++ b/drivers/net/bnxt/tf_core/tf_em.h
@@ -9,12 +9,6 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-
-#define SUPPORT_CFA_HW_P4 1
-#define SUPPORT_CFA_HW_P58 0
-#define SUPPORT_CFA_HW_P59 0
-#define SUPPORT_CFA_HW_ALL 0
-
 #include "hcapi/hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
-- 
2.7.4