[v5,06/28] common/cnxk: skip probing SoC environment for CN9k

Message ID 20220508074839.6965-6-ndabilpuram@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v5,01/28] common/cnxk: add multi channel support for SDP send queues |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram May 8, 2022, 7:48 a.m. UTC
  From: Rakesh Kudurumalla <rkudurumalla@marvell.com>

SoC run platform file is not present in CN9k so probing
is done for CN10k devices

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
 drivers/common/cnxk/roc_model.c | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index 1dd374e..a68baa6 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -2,6 +2,9 @@ 
  * Copyright(C) 2021 Marvell.
  */
 
+#include <fcntl.h>
+#include <unistd.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -211,6 +214,12 @@  of_env_get(struct roc_model *model)
 	uint64_t flag;
 	FILE *fp;
 
+	if (access(path, F_OK) != 0) {
+		strncpy(model->env, "HW_PLATFORM", ROC_MODEL_STR_LEN_MAX - 1);
+		model->flag |= ROC_ENV_HW;
+		return;
+	}
+
 	fp = fopen(path, "r");
 	if (!fp) {
 		plt_err("Failed to open %s", path);