// OS
#include <ntddk.h>
+//#include <iointex.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#define BUG_ON(exp) ASSERT(!(exp)) /* in Linux follows here panic() !*/
#define snprintf _snprintf
-#define printk DbgPrint
+#define printk cl_dbg_out
#define KERN_ERR "err:"
#define KERN_WARNING "warn:"
#define KERN_DEBUG "dbg:"
} hca_bar_t;
+struct msix_saved_info {
+ PVOID vca; /* MSI-X Vector Table card address */
+ PVOID mca; /* MSI-X Mask Table card address */
+ PVOID vsa; /* MSI-X Vector Table saved address */
+ PVOID msa; /* MSI-X Mask Table saved address */
+ ULONG vsz; /* MSI-X Vector Table size */
+ ULONG msz; /* MSI-X Mask Table size */
+ int num; /* number of supported MSI-X vectors */
+ int valid; /* the structure is valid */
+};
+
+struct msix_map {
+ KAFFINITY cpu; /* affinity of this MSI-X vector */
+ int eq_ix; /* EQ index in the array of EQs */
+ int ref_cnt; /* number of users */
+};
// interface structure between Upper and Low Layers of the driver
struct pci_dev
// driver: OS/platform resources
BUS_INTERFACE_STANDARD bus_pci_ifc;
PCI_COMMON_CONFIG pci_cfg_space;
+ struct msix_saved_info msix_info;
+ struct msix_map* p_msix_map;
uplink_info_t uplink_info;
// driver: card resources
hca_bar_t bar[N_BARS];
// driver: various objects and info
USHORT ven_id;
USHORT dev_id;
+ USHORT sub_vendor_id;
+ USHORT sub_system_id;
+ UCHAR revision_id;
DMA_ADAPTER * p_dma_adapter; /* HCA adapter object */
- DEVICE_OBJECT * p_self_do; /* mlx4 FDO */
+ DEVICE_OBJECT * p_self_do; /* mlx4_bus's FDO */
+ DEVICE_OBJECT * pdo; /* mlx4_bus's PDO */
// mlx4_ib: various objects and info
struct ib_device * ib_dev;
// mlx4_net: various objects and info
struct mlx4_dev * dev;
volatile long dpc_lock;
+ PUCHAR vpd;
+ int vpd_size;
+ WCHAR location[36]; /* bus+func+dev */
#ifdef USE_WDM_INTERRUPTS
PKINTERRUPT int_obj; /* HCA interrupt object */
KSPIN_LOCK isr_lock; /* lock for the ISR */
+ // MSI-X interrupts
+ u8 n_msi_vectors_alloc;/* number of allocated MSI vectors */
+ u8 n_msi_vectors; /* number of MSI vectors; 0 - no MSI */
+ ULONG version;
+ int legacy_connect;
#endif
};
static inline int mlx4_is_livefish(struct mlx4_dev *dev)
{
- return dev->flags & MLX4_FLAG_LIVEFISH;
+ if (dev == NULL) {
+ return TRUE;
+ }
+ return !!(dev->flags & MLX4_FLAG_LIVEFISH);
+}
+
+static inline int mlx4_is_barred(struct mlx4_dev *dev)
+{
+ return dev->flags & MLX4_FLAG_RESET_DRIVER;
+}
+
+static inline int mlx4_is_in_reset(struct mlx4_dev *dev)
+{
+ return dev->flags & MLX4_FLAG_RESET_STARTED;
}
#endif