net/qede: move SPDX tags to source files
[dpdk.git] / drivers / net / qede / base / ecore_mcp.h
index f69b425..8e12531 100644 (file)
@@ -1,9 +1,7 @@
-/*
- * Copyright (c) 2016 QLogic Corporation.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016 - 2018 Cavium Inc.
  * All rights reserved.
- * www.qlogic.com
- *
- * See LICENSE.qede_pmd for copyright and licensing details.
+ * www.cavium.com
  */
 
 #ifndef __ECORE_MCP_H__
                                            ((rel_pfid) | \
                                             ((p_hwfn)->abs_pf_id & 1) << 3) : \
                                             rel_pfid)
-#define MCP_PF_ID(p_hwfn) MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
+#define MCP_PF_ID(p_hwfn)      MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
 
 #define MFW_PORT(_p_hwfn)      ((_p_hwfn)->abs_pf_id % \
-                                ((_p_hwfn)->p_dev->num_ports_in_engines * \
-                                 ecore_device_num_engines((_p_hwfn)->p_dev)))
+                                ecore_device_num_ports((_p_hwfn)->p_dev))
 
 struct ecore_mcp_info {
        /* List for mailbox commands which were sent and wait for a response */
@@ -112,7 +109,7 @@ enum _ecore_status_t ecore_mcp_cmd_init(struct ecore_hwfn *p_hwfn,
  *
  * @param p_hwfn
  * @param p_ptt
- * Can only be called after `num_ports_in_engines' is set
+ * Can only be called after `num_ports_in_engine' is set
  */
 void ecore_mcp_cmd_port_init(struct ecore_hwfn *p_hwfn,
                             struct ecore_ptt *p_ptt);
@@ -493,18 +490,15 @@ ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
 /**
  * @brief - default initialization for lock/unlock resource structs
  *
- * @param p_hwfn
  * @param p_lock - lock params struct to be initialized; Can be OSAL_NULL
  * @param p_unlock - unlock params struct to be initialized; Can be OSAL_NULL
  * @param resource - the requested resource
  * @paral b_is_permanent - disable retries & aging when set
  */
-void
-ecore_mcp_resc_lock_default_init(struct ecore_hwfn *p_hwfn,
-                                struct ecore_resc_lock_params *p_lock,
-                                struct ecore_resc_unlock_params *p_unlock,
-                                enum ecore_resc_lock resource,
-                                bool b_is_permanent);
+void ecore_mcp_resc_lock_default_init(struct ecore_resc_lock_params *p_lock,
+                                     struct ecore_resc_unlock_params *p_unlock,
+                                     enum ecore_resc_lock resource,
+                                     bool b_is_permanent);
 
 /**
  * @brief Learn of supported MFW features; To be done during early init
@@ -525,4 +519,51 @@ enum _ecore_status_t ecore_mcp_get_capabilities(struct ecore_hwfn *p_hwfn,
 enum _ecore_status_t ecore_mcp_set_capabilities(struct ecore_hwfn *p_hwfn,
                                                struct ecore_ptt *p_ptt);
 
+enum ecore_mcp_drv_attr_cmd {
+       ECORE_MCP_DRV_ATTR_CMD_READ,
+       ECORE_MCP_DRV_ATTR_CMD_WRITE,
+       ECORE_MCP_DRV_ATTR_CMD_READ_CLEAR,
+       ECORE_MCP_DRV_ATTR_CMD_CLEAR,
+};
+
+struct ecore_mcp_drv_attr {
+       enum ecore_mcp_drv_attr_cmd attr_cmd;
+       u32 attr_num;
+
+       /* R/RC - will be set with the read value
+        * W - should hold the required value to be written
+        * C - DC
+        */
+       u32 val;
+
+       /* W - mask/offset to be applied on the given value
+        * R/RC/C - DC
+        */
+       u32 mask;
+       u32 offset;
+};
+
+/**
+ * @brief Handle the drivers' attributes that are kept by the MFW.
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ * @param p_drv_attr
+ */
+enum _ecore_status_t
+ecore_mcp_drv_attribute(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
+                       struct ecore_mcp_drv_attr *p_drv_attr);
+
+/**
+ * @brief Read ufp config from the shared memory.
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ */
+void
+ecore_mcp_read_ufp_config(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
+
+void ecore_mcp_wol_wr(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
+                     u32 offset, u32 val);
+
 #endif /* __ECORE_MCP_H__ */