linux/drivers/infiniband/hw/qib/qib.h

#ifndef _QIB_KERNEL_H
#define _QIB_KERNEL_H
/*
 * Copyright (c) 2012 - 2017 Intel Corporation.  All rights reserved.
 * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/*
 * This header file is the base header file for qlogic_ib kernel code
 * qib_user.h serves a similar purpose for user code.
 */

#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/fs.h>
#include <linux/completion.h>
#include <linux/kref.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/xarray.h>
#include <rdma/ib_hdrs.h>
#include <rdma/rdma_vt.h>

#include "qib_common.h"
#include "qib_verbs.h"

/* only s/w major version of QLogic_IB we can handle */
#define QIB_CHIP_VERS_MAJ

/* don't care about this except printing */
#define QIB_CHIP_VERS_MIN

/* The Organization Unique Identifier (Mfg code), and its position in GUID */
#define QIB_OUI
#define QIB_OUI_LSB

/*
 * per driver stats, either not device nor port-specific, or
 * summed over all of the devices and ports.
 * They are described by name via ipathfs filesystem, so layout
 * and number of elements can change without breaking compatibility.
 * If members are added or deleted qib_statnames[] in qib_fs.c must
 * change to match.
 */
struct qlogic_ib_stats {};

extern struct qlogic_ib_stats qib_stats;
extern const struct pci_error_handlers qib_pci_err_handler;

#define QIB_CHIP_SWVERSION
/*
 * First-cut critierion for "device is active" is
 * two thousand dwords combined Tx, Rx traffic per
 * 5-second interval. SMA packets are 64 dwords,
 * and occur "a few per second", presumably each way.
 */
#define QIB_TRAFFIC_ACTIVE_THRESHOLD

/*
 * Below contains all data related to a single context (formerly called port).
 */

#ifdef CONFIG_DEBUG_FS
struct qib_opcode_stats_perctx;
#endif

struct qib_ctxtdata {};

struct rvt_sge_state;

struct qib_sdma_txreq {};

struct qib_sdma_desc {};

struct qib_verbs_txreq {};

#define QIB_SDMA_TXREQ_F_USELARGEBUF
#define QIB_SDMA_TXREQ_F_HEADTOHOST
#define QIB_SDMA_TXREQ_F_INTREQ
#define QIB_SDMA_TXREQ_F_FREEBUF
#define QIB_SDMA_TXREQ_F_FREEDESC

#define QIB_SDMA_TXREQ_S_OK
#define QIB_SDMA_TXREQ_S_SENDERROR
#define QIB_SDMA_TXREQ_S_ABORTED
#define QIB_SDMA_TXREQ_S_SHUTDOWN

/*
 * Get/Set IB link-level config parameters for f_get/set_ib_cfg()
 * Mostly for MADs that set or query link parameters, also ipath
 * config interfaces
 */
#define QIB_IB_CFG_LIDLMC
#define QIB_IB_CFG_LWID_ENB
#define QIB_IB_CFG_LWID
#define QIB_IB_CFG_SPD_ENB
#define QIB_IB_CFG_SPD
#define QIB_IB_CFG_RXPOL_ENB
#define QIB_IB_CFG_LREV_ENB
#define QIB_IB_CFG_LINKLATENCY
#define QIB_IB_CFG_HRTBT
#define QIB_IB_CFG_OP_VLS
#define QIB_IB_CFG_VL_HIGH_CAP
#define QIB_IB_CFG_VL_LOW_CAP
#define QIB_IB_CFG_OVERRUN_THRESH
#define QIB_IB_CFG_PHYERR_THRESH
#define QIB_IB_CFG_LINKDEFAULT
#define QIB_IB_CFG_PKEYS
#define QIB_IB_CFG_MTU
#define QIB_IB_CFG_LSTATE
#define QIB_IB_CFG_VL_HIGH_LIMIT
#define QIB_IB_CFG_PMA_TICKS
#define QIB_IB_CFG_PORT

/*
 * for CFG_LSTATE: LINKCMD in upper 16 bits, LINKINITCMD in lower 16
 * IB_LINKINITCMD_POLL and SLEEP are also used as set/get values for
 * QIB_IB_CFG_LINKDEFAULT cmd
 */
#define IB_LINKCMD_DOWN
#define IB_LINKCMD_ARMED
#define IB_LINKCMD_ACTIVE
#define IB_LINKINITCMD_NOP
#define IB_LINKINITCMD_POLL
#define IB_LINKINITCMD_SLEEP
#define IB_LINKINITCMD_DISABLE

/*
 * valid states passed to qib_set_linkstate() user call
 */
#define QIB_IB_LINKDOWN
#define QIB_IB_LINKARM
#define QIB_IB_LINKACTIVE
#define QIB_IB_LINKDOWN_ONLY
#define QIB_IB_LINKDOWN_SLEEP
#define QIB_IB_LINKDOWN_DISABLE

/*
 * These 7 values (SDR, DDR, and QDR may be ORed for auto-speed
 * negotiation) are used for the 3rd argument to path_f_set_ib_cfg
 * with cmd QIB_IB_CFG_SPD_ENB, by direct calls or via sysfs.  They
 * are also the possible values for qib_link_speed_enabled and active
 * The values were chosen to match values used within the IB spec.
 */
#define QIB_IB_SDR
#define QIB_IB_DDR
#define QIB_IB_QDR

#define QIB_DEFAULT_MTU

/* max number of IB ports supported per HCA */
#define QIB_MAX_IB_PORTS

/*
 * Possible IB config parameters for f_get/set_ib_table()
 */
#define QIB_IB_TBL_VL_HIGH_ARB
#define QIB_IB_TBL_VL_LOW_ARB

/*
 * Possible "operations" for f_rcvctrl(ppd, op, ctxt)
 * these are bits so they can be combined, e.g.
 * QIB_RCVCTRL_INTRAVAIL_ENB | QIB_RCVCTRL_CTXT_ENB
 */
#define QIB_RCVCTRL_TAILUPD_ENB
#define QIB_RCVCTRL_TAILUPD_DIS
#define QIB_RCVCTRL_CTXT_ENB
#define QIB_RCVCTRL_CTXT_DIS
#define QIB_RCVCTRL_INTRAVAIL_ENB
#define QIB_RCVCTRL_INTRAVAIL_DIS
#define QIB_RCVCTRL_PKEY_ENB
#define QIB_RCVCTRL_PKEY_DIS
#define QIB_RCVCTRL_BP_ENB
#define QIB_RCVCTRL_BP_DIS
#define QIB_RCVCTRL_TIDFLOW_ENB
#define QIB_RCVCTRL_TIDFLOW_DIS

/*
 * Possible "operations" for f_sendctrl(ppd, op, var)
 * these are bits so they can be combined, e.g.
 * QIB_SENDCTRL_BUFAVAIL_ENB | QIB_SENDCTRL_ENB
 * Some operations (e.g. DISARM, ABORT) are known to
 * be "one-shot", so do not modify shadow.
 */
#define QIB_SENDCTRL_DISARM
#define QIB_SENDCTRL_DISARM_BUF(bufn)
	/* available (0x2000) */
#define QIB_SENDCTRL_AVAIL_DIS
#define QIB_SENDCTRL_AVAIL_ENB
#define QIB_SENDCTRL_AVAIL_BLIP
#define QIB_SENDCTRL_SEND_DIS
#define QIB_SENDCTRL_SEND_ENB
#define QIB_SENDCTRL_FLUSH
#define QIB_SENDCTRL_CLEAR
#define QIB_SENDCTRL_DISARM_ALL

/*
 * These are the generic indices for requesting per-port
 * counter values via the f_portcntr function.  They
 * are always returned as 64 bit values, although most
 * are 32 bit counters.
 */
/* send-related counters */
#define QIBPORTCNTR_PKTSEND
#define QIBPORTCNTR_WORDSEND
#define QIBPORTCNTR_PSXMITDATA
#define QIBPORTCNTR_PSXMITPKTS
#define QIBPORTCNTR_PSXMITWAIT
#define QIBPORTCNTR_SENDSTALL
/* receive-related counters */
#define QIBPORTCNTR_PKTRCV
#define QIBPORTCNTR_PSRCVDATA
#define QIBPORTCNTR_PSRCVPKTS
#define QIBPORTCNTR_RCVEBP
#define QIBPORTCNTR_RCVOVFL
#define QIBPORTCNTR_WORDRCV
/* IB link related error counters */
#define QIBPORTCNTR_RXLOCALPHYERR
#define QIBPORTCNTR_RXVLERR
#define QIBPORTCNTR_ERRICRC
#define QIBPORTCNTR_ERRVCRC
#define QIBPORTCNTR_ERRLPCRC
#define QIBPORTCNTR_BADFORMAT
#define QIBPORTCNTR_ERR_RLEN
#define QIBPORTCNTR_IBSYMBOLERR
#define QIBPORTCNTR_INVALIDRLEN
#define QIBPORTCNTR_UNSUPVL
#define QIBPORTCNTR_EXCESSBUFOVFL
#define QIBPORTCNTR_ERRLINK
#define QIBPORTCNTR_IBLINKDOWN
#define QIBPORTCNTR_IBLINKERRRECOV
#define QIBPORTCNTR_LLI
/* other error counters */
#define QIBPORTCNTR_RXDROPPKT
#define QIBPORTCNTR_VL15PKTDROP
#define QIBPORTCNTR_ERRPKEY
#define QIBPORTCNTR_KHDROVFL
/* sampling counters (these are actually control registers) */
#define QIBPORTCNTR_PSINTERVAL
#define QIBPORTCNTR_PSSTART
#define QIBPORTCNTR_PSSTAT

/* how often we check for packet activity for "power on hours (in seconds) */
#define ACTIVITY_TIMER

#define MAX_NAME_SIZE

#ifdef CONFIG_INFINIBAND_QIB_DCA
struct qib_irq_notify;
#endif

struct qib_msix_entry {};

/* Below is an opaque struct. Each chip (device) can maintain
 * private data needed for its operation, but not germane to the
 * rest of the driver.  For convenience, we define another that
 * is chip-specific, per-port
 */
struct qib_chip_specific;
struct qib_chipport_specific;

enum qib_sdma_states {};

enum qib_sdma_events {};

struct sdma_set_state_action {};

struct qib_sdma_state {};

struct xmit_wait {};

/*
 * The structure below encapsulates data relevant to a physical IB Port.
 * Current chips support only one such port, but the separation
 * clarifies things a bit. Note that to conform to IB conventions,
 * port-numbers are one-based. The first or only port is port1.
 */
struct qib_pportdata {};

/* Observers. Not to be taken lightly, possibly not to ship. */
/*
 * If a diag read or write is to (bottom <= offset <= top),
 * the "hook" is called, allowing, e.g. shadows to be
 * updated in sync with the driver. struct diag_observer
 * is the "visible" part.
 */
struct diag_observer;

diag_hook;

struct diag_observer {};

extern int qib_register_observer(struct qib_devdata *dd,
	const struct diag_observer *op);

/* Only declared here, not defined. Private to diags */
struct diag_observer_list_elt;

/* device data struct now contains only "general per-device" info.
 * fields related to a physical IB port are in a qib_pportdata struct,
 * described above) while fields only used by a particular chip-type are in
 * a qib_chipdata struct, whose contents are opaque to this file.
 */
struct qib_devdata {};

/* hol_state values */
#define QIB_HOL_UP
#define QIB_HOL_INIT

#define QIB_SDMA_SENDCTRL_OP_ENABLE
#define QIB_SDMA_SENDCTRL_OP_INTENABLE
#define QIB_SDMA_SENDCTRL_OP_HALT
#define QIB_SDMA_SENDCTRL_OP_CLEANUP
#define QIB_SDMA_SENDCTRL_OP_DRAIN

/* operation types for f_txchk_change() */
#define TXCHK_CHG_TYPE_DIS1
#define TXCHK_CHG_TYPE_ENAB1
#define TXCHK_CHG_TYPE_KERN
#define TXCHK_CHG_TYPE_USER

#define QIB_CHASE_TIME
#define QIB_CHASE_DIS_TIME

/* Private data for file operations */
struct qib_filedata {};

extern struct xarray qib_dev_table;
extern struct qib_devdata *qib_lookup(int unit);
extern u32 qib_cpulist_count;
extern unsigned long *qib_cpulist;
extern unsigned qib_cc_table_size;

int qib_init(struct qib_devdata *, int);
int init_chip_wc_pat(struct qib_devdata *dd, u32);
int qib_enable_wc(struct qib_devdata *dd);
void qib_disable_wc(struct qib_devdata *dd);
int qib_count_units(int *npresentp, int *nupp);
int qib_count_active_units(void);

int qib_cdev_init(int minor, const char *name,
		  const struct file_operations *fops,
		  struct cdev **cdevp, struct device **devp);
void qib_cdev_cleanup(struct cdev **cdevp, struct device **devp);
int qib_dev_init(void);
void qib_dev_cleanup(void);

int qib_diag_add(struct qib_devdata *);
void qib_diag_remove(struct qib_devdata *);
void qib_handle_e_ibstatuschanged(struct qib_pportdata *, u64);
void qib_sdma_update_tail(struct qib_pportdata *, u16); /* hold sdma_lock */

int qib_decode_err(struct qib_devdata *dd, char *buf, size_t blen, u64 err);
void qib_bad_intrstatus(struct qib_devdata *);
void qib_handle_urcv(struct qib_devdata *, u64);

/* clean up any per-chip chip-specific stuff */
void qib_chip_cleanup(struct qib_devdata *);
/* clean up any chip type-specific stuff */
void qib_chip_done(void);

/* check to see if we have to force ordering for write combining */
int qib_unordered_wc(void);
void qib_pio_copy(void __iomem *to, const void *from, size_t count);

void qib_disarm_piobufs(struct qib_devdata *, unsigned, unsigned);
int qib_disarm_piobufs_ifneeded(struct qib_ctxtdata *);
void qib_disarm_piobufs_set(struct qib_devdata *, unsigned long *, unsigned);
void qib_cancel_sends(struct qib_pportdata *);

int qib_create_rcvhdrq(struct qib_devdata *, struct qib_ctxtdata *);
int qib_setup_eagerbufs(struct qib_ctxtdata *);
void qib_set_ctxtcnt(struct qib_devdata *);
int qib_create_ctxts(struct qib_devdata *dd);
struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *, u32, int);
int qib_init_pportdata(struct qib_pportdata *, struct qib_devdata *, u8, u8);
void qib_free_ctxtdata(struct qib_devdata *, struct qib_ctxtdata *);

u32 qib_kreceive(struct qib_ctxtdata *, u32 *, u32 *);
int qib_reset_device(int);
int qib_wait_linkstate(struct qib_pportdata *, u32, int);
int qib_set_linkstate(struct qib_pportdata *, u8);
int qib_set_mtu(struct qib_pportdata *, u16);
int qib_set_lid(struct qib_pportdata *, u32, u8);
void qib_hol_down(struct qib_pportdata *);
void qib_hol_init(struct qib_pportdata *);
void qib_hol_up(struct qib_pportdata *);
void qib_hol_event(struct timer_list *);
void qib_disable_after_error(struct qib_devdata *);
int qib_set_uevent_bits(struct qib_pportdata *, const int);

/* for use in system calls, where we want to know device type, etc. */
#define ctxt_fp(fp)
#define subctxt_fp(fp)
#define tidcursor_fp(fp)
#define user_sdma_queue_fp(fp)

static inline struct qib_devdata *dd_from_ppd(struct qib_pportdata *ppd)
{}

static inline struct qib_devdata *dd_from_dev(struct qib_ibdev *dev)
{}

static inline struct qib_devdata *dd_from_ibdev(struct ib_device *ibdev)
{}

static inline struct qib_pportdata *ppd_from_ibp(struct qib_ibport *ibp)
{}

static inline struct qib_ibport *to_iport(struct ib_device *ibdev, u32 port)
{}

/*
 * values for dd->flags (_device_ related flags) and
 */
#define QIB_HAS_LINK_LATENCY
#define QIB_INITTED
#define QIB_DOING_RESET
#define QIB_PRESENT
#define QIB_PIO_FLUSH_WC
#define QIB_HAS_THRESH_UPDATE
#define QIB_HAS_SDMA_TIMEOUT
#define QIB_USE_SPCL_TRIG
#define QIB_NODMA_RTAIL
#define QIB_HAS_INTX
#define QIB_HAS_SEND_DMA
#define QIB_HAS_VLSUPP
#define QIB_HAS_HDRSUPP
#define QIB_BADINTR
#define QIB_DCA_ENABLED
#define QIB_HAS_QSFP
#define QIB_SHUTDOWN

/*
 * values for ppd->lflags (_ib_port_ related flags)
 */
#define QIBL_LINKV
#define QIBL_LINKDOWN
#define QIBL_LINKINIT
#define QIBL_LINKARMED
#define QIBL_LINKACTIVE
/* leave a gap for more IB-link state */
#define QIBL_IB_AUTONEG_INPROG
#define QIBL_IB_AUTONEG_FAILED
#define QIBL_IB_LINK_DISABLED
#define QIBL_IB_FORCE_NOTIFY

/* IB dword length mask in PBC (lower 11 bits); same for all chips */
#define QIB_PBC_LENGTH_MASK


/* ctxt_flag bit offsets */
		/* waiting for a packet to arrive */
#define QIB_CTXT_WAITING_RCV
		/* master has not finished initializing */
#define QIB_CTXT_MASTER_UNINIT
		/* waiting for an urgent packet to arrive */
#define QIB_CTXT_WAITING_URG

/* free up any allocated data at closes */
void qib_free_data(struct qib_ctxtdata *dd);
void qib_chg_pioavailkernel(struct qib_devdata *, unsigned, unsigned,
			    u32, struct qib_ctxtdata *);
struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *,
					   const struct pci_device_id *);
struct qib_devdata *qib_init_iba7220_funcs(struct pci_dev *,
					   const struct pci_device_id *);
struct qib_devdata *qib_init_iba6120_funcs(struct pci_dev *,
					   const struct pci_device_id *);
void qib_free_devdata(struct qib_devdata *);
struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra);

#define QIB_TWSI_NO_DEV
/* Below qib_twsi_ functions must be called with eep_lock held */
int qib_twsi_reset(struct qib_devdata *dd);
int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer,
		    int len);
int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr,
		    const void *buffer, int len);
void qib_get_eeprom_info(struct qib_devdata *);
void qib_dump_lookup_output_queue(struct qib_devdata *);
void qib_force_pio_avail_update(struct qib_devdata *);
void qib_clear_symerror_on_linkup(struct timer_list *t);

/*
 * Set LED override, only the two LSBs have "public" meaning, but
 * any non-zero value substitutes them for the Link and LinkTrain
 * LED states.
 */
#define QIB_LED_PHYS
#define QIB_LED_LOG
void qib_set_led_override(struct qib_pportdata *ppd, unsigned int val);

/* send dma routines */
int qib_setup_sdma(struct qib_pportdata *);
void qib_teardown_sdma(struct qib_pportdata *);
void __qib_sdma_intr(struct qib_pportdata *);
void qib_sdma_intr(struct qib_pportdata *);
void qib_user_sdma_send_desc(struct qib_pportdata *dd,
			struct list_head *pktlist);
int qib_sdma_verbs_send(struct qib_pportdata *, struct rvt_sge_state *,
			u32, struct qib_verbs_txreq *);
/* ppd->sdma_lock should be locked before calling this. */
int qib_sdma_make_progress(struct qib_pportdata *dd);

/* must be called under qib_sdma_lock */
static inline u16 qib_sdma_descq_freecnt(const struct qib_pportdata *ppd)
{}

static inline int __qib_sdma_running(struct qib_pportdata *ppd)
{}
int qib_sdma_running(struct qib_pportdata *);
void dump_sdma_state(struct qib_pportdata *ppd);
void __qib_sdma_process_event(struct qib_pportdata *, enum qib_sdma_events);
void qib_sdma_process_event(struct qib_pportdata *, enum qib_sdma_events);

/*
 * number of words used for protocol header if not set by qib_userinit();
 */
#define QIB_DFLT_RCVHDRSIZE

/*
 * We need to be able to handle an IB header of at least 24 dwords.
 * We need the rcvhdrq large enough to handle largest IB header, but
 * still have room for a 2KB MTU standard IB packet.
 * Additionally, some processor/memory controller combinations
 * benefit quite strongly from having the DMA'ed data be cacheline
 * aligned and a cacheline multiple, so we set the size to 32 dwords
 * (2 64-byte primary cachelines for pretty much all processors of
 * interest).  The alignment hurts nothing, other than using somewhat
 * more memory.
 */
#define QIB_RCVHDR_ENTSIZE

int qib_get_user_pages(unsigned long, size_t, struct page **);
void qib_release_user_pages(struct page **, size_t);
int qib_eeprom_read(struct qib_devdata *, u8, void *, int);
int qib_eeprom_write(struct qib_devdata *, u8, const void *, int);
u32 __iomem *qib_getsendbuf_range(struct qib_devdata *, u32 *, u32, u32);
void qib_sendbuf_done(struct qib_devdata *, unsigned);

static inline void qib_clear_rcvhdrtail(const struct qib_ctxtdata *rcd)
{}

static inline u32 qib_get_rcvhdrtail(const struct qib_ctxtdata *rcd)
{}

/*
 * sysfs interface.
 */

extern const struct attribute_group qib_attr_group;
extern const struct attribute_group *qib_attr_port_groups[];

int qib_device_create(struct qib_devdata *);
void qib_device_remove(struct qib_devdata *);

/* Hook for sysfs read of QSFP */
extern int qib_qsfp_dump(struct qib_pportdata *ppd, char *buf, int len);

int __init qib_init_qibfs(void);
int __exit qib_exit_qibfs(void);

int qibfs_add(struct qib_devdata *);
int qibfs_remove(struct qib_devdata *);

int qib_pcie_init(struct pci_dev *, const struct pci_device_id *);
int qib_pcie_ddinit(struct qib_devdata *, struct pci_dev *,
		    const struct pci_device_id *);
void qib_pcie_ddcleanup(struct qib_devdata *);
int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent);
void qib_free_irq(struct qib_devdata *dd);
int qib_reinit_intr(struct qib_devdata *dd);
void qib_pcie_getcmd(struct qib_devdata *, u16 *, u8 *, u8 *);
void qib_pcie_reenable(struct qib_devdata *, u16, u8, u8);
/* interrupts for device */
u64 qib_int_counter(struct qib_devdata *);
/* interrupt for all devices */
u64 qib_sps_ints(void);

/*
 * dma_addr wrappers - all 0's invalid for hw
 */
int qib_map_page(struct pci_dev *d, struct page *p, dma_addr_t *daddr);
struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi);

/*
 * Flush write combining store buffers (if present) and perform a write
 * barrier.
 */
static inline void qib_flush_wc(void)
{}

/* global module parameter variables */
extern unsigned qib_ibmtu;
extern ushort qib_cfgctxts;
extern ushort qib_num_cfg_vls;
extern ushort qib_mini_init; /* If set, do few (ideally 0) writes to chip */
extern unsigned qib_n_krcv_queues;
extern unsigned qib_sdma_fetch_arb;
extern unsigned qib_compat_ddr_negotiate;
extern int qib_special_trigger;
extern unsigned qib_numa_aware;

extern struct mutex qib_mutex;

/* Number of seconds before our card status check...  */
#define STATUS_TIMEOUT

#define QIB_DRV_NAME
#define QIB_USER_MINOR_BASE
#define QIB_TRACE_MINOR
#define QIB_DIAGPKT_MINOR
#define QIB_DIAG_MINOR_BASE
#define QIB_NMINORS

#define PCI_VENDOR_ID_PATHSCALE
#define PCI_VENDOR_ID_QLOGIC
#define PCI_DEVICE_ID_QLOGIC_IB_6120
#define PCI_DEVICE_ID_QLOGIC_IB_7220
#define PCI_DEVICE_ID_QLOGIC_IB_7322

/*
 * qib_early_err is used (only!) to print early errors before devdata is
 * allocated, or when dd->pcidev may not be valid, and at the tail end of
 * cleanup when devdata may have been freed, etc.  qib_dev_porterr is
 * the same as qib_dev_err, but is used when the message really needs
 * the IB port# to be definitive as to what's happening..
 * All of these go to the trace log, and the trace log entry is done
 * first to avoid possible serial port delays from printk.
 */
#define qib_early_err(dev, fmt, ...)

#define qib_dev_err(dd, fmt, ...)

#define qib_dev_warn(dd, fmt, ...)

#define qib_dev_porterr(dd, port, fmt, ...)

#define qib_devinfo(pcidev, fmt, ...)

/*
 * this is used for formatting hw error messages...
 */
struct qib_hwerror_msgs {};

#define QLOGIC_IB_HWE_MSG(a, b)

/* in qib_intr.c... */
void qib_format_hwerrors(u64 hwerrs,
			 const struct qib_hwerror_msgs *hwerrmsgs,
			 size_t nhwerrmsgs, char *msg, size_t lmsg);

void qib_stop_send_queue(struct rvt_qp *qp);
void qib_quiesce_qp(struct rvt_qp *qp);
void qib_flush_qp_waiters(struct rvt_qp *qp);
int qib_mtu_to_path_mtu(u32 mtu);
u32 qib_mtu_from_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp, u32 pmtu);
void qib_notify_error_qp(struct rvt_qp *qp);
int qib_get_pmtu_from_attr(struct rvt_dev_info *rdi, struct rvt_qp *qp,
			   struct ib_qp_attr *attr);

#endif                          /* _QIB_KERNEL_H */