From: Peng Zhang <peng.zh...@corigine.com>

Add a NSP command to check if any firmware have been loaded.

Signed-off-by: Peng Zhang <peng.zh...@corigine.com>
Reviewed-by: Chaoyong He <chaoyong...@corigine.com>
Reviewed-by: Long Wu <long...@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_nsp.c | 6 ++++++
 drivers/net/nfp/nfpcore/nfp_nsp.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c 
b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 589d878e0d..e5aaef8d55 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -637,6 +637,12 @@ nfp_nsp_load_fw(struct nfp_nsp *state,
        return 0;
 }
 
+bool
+nfp_nsp_fw_loaded(struct nfp_nsp *state)
+{
+       return nfp_nsp_command(state, SPCODE_FW_LOADED) > 0;
+}
+
 int
 nfp_nsp_read_eth_table(struct nfp_nsp *state,
                void *buf,
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.h 
b/drivers/net/nfp/nfpcore/nfp_nsp.h
index fe52dffeb7..492fa7e99f 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.h
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.h
@@ -212,5 +212,6 @@ enum nfp_nsp_sensor_id {
 
 int nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id,
                uint32_t *val);
+bool nfp_nsp_fw_loaded(struct nfp_nsp *state);
 
 #endif /* __NSP_NSP_H__ */
-- 
2.39.1

Reply via email to