build: replace license text with SPDX tag
[dpdk.git] / drivers / net / fm10k / base / fm10k_osdep.h
index 53c433c..199ebd8 100644 (file)
@@ -39,11 +39,17 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
 #include <rte_cycles.h>
+#include <rte_io.h>
+
 #include "../fm10k_logs.h"
 
 /* TODO: this does not look like it should be used... */
 #define ERROR_REPORT2(v1, v2, v3)   do { } while (0)
 
+#ifndef BOULDER_RAPIDS_HW
+#define BOULDER_RAPIDS_HW
+#endif
+
 #define STATIC                  static
 #define DEBUGFUNC(F)            DEBUGOUT(F "\n");
 #define DEBUGOUT(S, args...)    PMD_DRV_LOG_RAW(DEBUG, S, ##args)
@@ -84,17 +90,16 @@ typedef int        bool;
 #endif
 
 /* offsets are WORD offsets, not BYTE offsets */
-#define FM10K_WRITE_REG(hw, reg, val)    \
-       ((((volatile uint32_t *)(hw)->hw_addr)[(reg)]) = ((uint32_t)(val)))
-#define FM10K_READ_REG(hw, reg)          \
-       (((volatile uint32_t *)(hw)->hw_addr)[(reg)])
+#define FM10K_WRITE_REG(hw, reg, val)          \
+       rte_write32((val), ((hw)->hw_addr + (reg)))
+
+#define FM10K_READ_REG(hw, reg) rte_read32(((hw)->hw_addr + (reg)))
+
 #define FM10K_WRITE_FLUSH(a) FM10K_READ_REG(a, FM10K_CTRL)
 
-#define FM10K_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
+#define FM10K_PCI_REG(reg) rte_read32(reg)
 
-#define FM10K_PCI_REG_WRITE(reg, value) do { \
-       FM10K_PCI_REG((reg)) = (value); \
-} while (0)
+#define FM10K_PCI_REG_WRITE(reg, value) rte_write32((value), (reg))
 
 /* not implemented */
 #define FM10K_READ_PCI_WORD(hw, reg)     0
@@ -106,6 +111,7 @@ typedef int        bool;
 #define FM10K_LE32_TO_CPU    rte_le_to_cpu_32
 #define FM10K_CPU_TO_LE32    rte_cpu_to_le_32
 #define FM10K_CPU_TO_LE16    rte_cpu_to_le_16
+#define le16_to_cpu          rte_le_to_cpu_16
 
 #define FM10K_RMB            rte_rmb
 #define FM10K_WMB            rte_wmb
@@ -145,4 +151,24 @@ typedef int        bool;
 #define fm10k_read_reg FM10K_READ_REG
 #endif
 
+#define FM10K_INTEL_VENDOR_ID       0x8086
+#define FM10K_DMA_CTRL_MINMSS_SHIFT            9
+#define FM10K_EICR_PCA_FAULT                   0x00000001
+#define FM10K_EICR_THI_FAULT                   0x00000004
+#define FM10K_EICR_FUM_FAULT                   0x00000020
+#define FM10K_EICR_SRAMERROR                   0x00000400
+#define FM10K_SRAM_IP          0x13003
+#define FM10K_RXINT_TIMER_SHIFT                        8
+#define FM10K_TXINT_TIMER_SHIFT                        8
+#define FM10K_RXD_PKTTYPE_MASK         0x03F0
+#define FM10K_RXD_PKTTYPE_SHIFT                4
+
+#define FM10K_RXD_STATUS_IPCS          0x0008 /* Indicates IPv4 csum */
+#define FM10K_RXD_STATUS_HBO           0x0400 /* header buffer overrun */
+
+#define FM10K_TSO_MINMSS \
+       (FM10K_DMA_CTRL_MINMSS_64 >> FM10K_DMA_CTRL_MINMSS_SHIFT)
+#define FM10K_TSO_MIN_HEADERLEN                        54
+#define FM10K_TSO_MAX_HEADERLEN                        192
+
 #endif /* _FM10K_OSDEP_H_ */