i40e: move to drivers/net/
[dpdk.git] / lib / librte_pmd_ixgbe / ixgbe / ixgbe_osdep.h
index 782f0ae..4fb8dd7 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2012, Intel Corporation 
+  Copyright (c) 2001-2014, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
 #include <rte_byteorder.h>
 
 #include "../ixgbe_logs.h"
-
-/* Remove some compiler warnings for the files in this dir */
-#ifdef __INTEL_COMPILER
-#pragma warning(disable:2259) /* Conversion may lose significant bits */
-#pragma warning(disable:869)  /* Parameter was never referenced */
-#pragma warning(disable:181)  /* Arg incompatible with format string */
-#pragma warning(disable:1419) /* External declaration in primary source file */
-#pragma warning(disable:111)  /* Statement is unreachable */
-#pragma warning(disable:981)  /* Operands are evaluated in unspecified order */
-#pragma warning(disable:593)  /* Variable was set but never used */
-#pragma warning(disable:174)  /* expression has no effect */
-#else
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wuninitialized"
-#pragma GCC diagnostic ignored "-Wstrict-aliasing"
-#pragma GCC diagnostic ignored "-Wunused-value"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
-#if (((__GNUC__) >= 4) && ((__GNUC_MINOR__) >= 6))
-#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
-#endif
-#if (((__GNUC__) >= 4) && ((__GNUC_MINOR__) >= 7))
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#endif
-#endif
+#include "../ixgbe_bypass_defines.h"
 
 #define ASSERT(x) if(!(x)) rte_panic("IXGBE: x")
 
 #define usec_delay(x) DELAY(x)
 #define msec_delay(x) DELAY(1000*(x))
 
-#define DEBUGFUNC(F)            DEBUGOUT(F);
-#define DEBUGOUT(S, args...)    PMD_DRV_LOG(DEBUG, S, ##args)
+#define DEBUGFUNC(F)            DEBUGOUT(F "\n");
+#define DEBUGOUT(S, args...)    PMD_DRV_LOG_RAW(DEBUG, S, ##args)
 #define DEBUGOUT1(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT2(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT3(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT6(S, args...)   DEBUGOUT(S, ##args)
 #define DEBUGOUT7(S, args...)   DEBUGOUT(S, ##args)
 
+#define ERROR_REPORT1(e, S, args...)   DEBUGOUT(S, ##args)
+#define ERROR_REPORT2(e, S, args...)   DEBUGOUT(S, ##args)
+#define ERROR_REPORT3(e, S, args...)   DEBUGOUT(S, ##args)
+
 #define FALSE               0
 #define TRUE                1
 
 #define EWARN(hw, S, args...)     DEBUGOUT1(S, ##args)
 
 /* Bunch of defines for shared code bogosity */
-#define UNREFERENCED_PARAMETER(_p)
-#define UNREFERENCED_1PARAMETER(_p)
+#define UNREFERENCED_PARAMETER(_p)  
+#define UNREFERENCED_1PARAMETER(_p) 
 #define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r)
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r) 
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) 
+
+/* Shared code error reporting */
+enum {
+       IXGBE_ERROR_SOFTWARE,
+       IXGBE_ERROR_POLLING,
+       IXGBE_ERROR_INVALID_STATE,
+       IXGBE_ERROR_UNSUPPORTED,
+       IXGBE_ERROR_ARGUMENT,
+       IXGBE_ERROR_CAUTION,
+};
 
 #define STATIC static
 #define IXGBE_NTOHL(_i)        rte_be_to_cpu_32(_i)
 #define IXGBE_NTOHS(_i)        rte_be_to_cpu_16(_i)
 #define IXGBE_CPU_TO_LE32(_i)  rte_cpu_to_le_32(_i)
 #define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
+#define IXGBE_CPU_TO_BE16(_i)  rte_cpu_to_be_16(_i)
+#define IXGBE_CPU_TO_BE32(_i)  rte_cpu_to_be_32(_i)
 
 typedef uint8_t                u8;
 typedef int8_t         s8;
 typedef uint16_t       u16;
+typedef int16_t                s16;
 typedef uint32_t       u32;
 typedef int32_t                s32;
 typedef uint64_t       u64;
@@ -120,17 +113,19 @@ typedef int               bool;
 #define wmb()  rte_wmb()
 #define rmb()  rte_rmb()
 
+#define IOMEM
+
 #define prefetch(x) rte_prefetch0(x)
 
 #define IXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
 
 static inline uint32_t ixgbe_read_addr(volatile void* addr)
 {
-       return IXGBE_PCI_REG(addr);
+       return rte_le_to_cpu_32(IXGBE_PCI_REG(addr));
 }
 
 #define IXGBE_PCI_REG_WRITE(reg, value) do { \
-       IXGBE_PCI_REG((reg)) = (value); \
+       IXGBE_PCI_REG((reg)) = (rte_cpu_to_le_32(value)); \
 } while(0)
 
 #define IXGBE_PCI_REG_ADDR(hw, reg) \
@@ -140,7 +135,7 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
        IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
 
 /* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0
+#define IXGBE_READ_PCIE_WORD(hw, reg) 0        
 #define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
 
 #define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)