ipath_kernel.h

来自「LINUX 2.6.17.4的源码」· C头文件 代码 · 共 884 行 · 第 1/2 页

H
884
字号
#ifndef _IPATH_KERNEL_H#define _IPATH_KERNEL_H/* * 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 infinipath kernel code * ipath_user.h serves a similar purpose for user code. */#include <linux/interrupt.h>#include <asm/io.h>#include "ipath_common.h"#include "ipath_debug.h"#include "ipath_registers.h"/* only s/w major version of InfiniPath we can handle */#define IPATH_CHIP_VERS_MAJ 2U/* don't care about this except printing */#define IPATH_CHIP_VERS_MIN 0U/* temporary, maybe always */extern struct infinipath_stats ipath_stats;#define IPATH_CHIP_SWVERSION IPATH_CHIP_VERS_MAJstruct ipath_portdata {	void **port_rcvegrbuf;	dma_addr_t *port_rcvegrbuf_phys;	/* rcvhdrq base, needs mmap before useful */	void *port_rcvhdrq;	/* kernel virtual address where hdrqtail is updated */	u64 *port_rcvhdrtail_kvaddr;	/* page * used for uaddr */	struct page *port_rcvhdrtail_pagep;	/*	 * temp buffer for expected send setup, allocated at open, instead	 * of each setup call	 */	void *port_tid_pg_list;	/* when waiting for rcv or pioavail */	wait_queue_head_t port_wait;	/*	 * rcvegr bufs base, physical, must fit	 * in 44 bits so 32 bit programs mmap64 44 bit works)	 */	dma_addr_t port_rcvegr_phys;	/* mmap of hdrq, must fit in 44 bits */	dma_addr_t port_rcvhdrq_phys;	/*	 * the actual user address that we ipath_mlock'ed, so we can	 * ipath_munlock it at close	 */	unsigned long port_rcvhdrtail_uaddr;	/*	 * number of opens on this instance (0 or 1; ignoring forks, dup,	 * etc. for now)	 */	int port_cnt;	/*	 * how much space to leave at start of eager TID entries for	 * protocol use, on each TID	 */	/* instead of calculating it */	unsigned port_port;	/* chip offset of PIO buffers for this port */	u32 port_piobufs;	/* how many alloc_pages() chunks in port_rcvegrbuf_pages */	u32 port_rcvegrbuf_chunks;	/* how many egrbufs per chunk */	u32 port_rcvegrbufs_perchunk;	/* order for port_rcvegrbuf_pages */	size_t port_rcvegrbuf_size;	/* rcvhdrq size (for freeing) */	size_t port_rcvhdrq_size;	/* next expected TID to check when looking for free */	u32 port_tidcursor;	/* next expected TID to check */	unsigned long port_flag;	/* WAIT_RCV that timed out, no interrupt */	u32 port_rcvwait_to;	/* WAIT_PIO that timed out, no interrupt */	u32 port_piowait_to;	/* WAIT_RCV already happened, no wait */	u32 port_rcvnowait;	/* WAIT_PIO already happened, no wait */	u32 port_pionowait;	/* total number of rcvhdrqfull errors */	u32 port_hdrqfull;	/* pid of process using this port */	pid_t port_pid;	/* same size as task_struct .comm[] */	char port_comm[16];	/* pkeys set by this use of this port */	u16 port_pkeys[4];	/* so file ops can get at unit */	struct ipath_devdata *port_dd;};struct sk_buff;/* * control information for layered drivers */struct _ipath_layer {	void *l_arg;};/* Verbs layer interface */struct _verbs_layer {	void *l_arg;	struct timer_list l_timer;};struct ipath_devdata {	struct list_head ipath_list;	struct ipath_kregs const *ipath_kregs;	struct ipath_cregs const *ipath_cregs;	/* mem-mapped pointer to base of chip regs */	u64 __iomem *ipath_kregbase;	/* end of mem-mapped chip space; range checking */	u64 __iomem *ipath_kregend;	/* physical address of chip for io_remap, etc. */	unsigned long ipath_physaddr;	/* base of memory alloced for ipath_kregbase, for free */	u64 *ipath_kregalloc;	/*	 * version of kregbase that doesn't have high bits set (for 32 bit	 * programs, so mmap64 44 bit works)	 */	u64 __iomem *ipath_kregvirt;	/*	 * virtual address where port0 rcvhdrqtail updated for this unit.	 * only written to by the chip, not the driver.	 */	volatile __le64 *ipath_hdrqtailptr;	dma_addr_t ipath_dma_addr;	/* ipath_cfgports pointers */	struct ipath_portdata **ipath_pd;	/* sk_buffs used by port 0 eager receive queue */	struct sk_buff **ipath_port0_skbs;	/* kvirt address of 1st 2k pio buffer */	void __iomem *ipath_pio2kbase;	/* kvirt address of 1st 4k pio buffer */	void __iomem *ipath_pio4kbase;	/*	 * points to area where PIOavail registers will be DMA'ed.	 * Has to be on a page of it's own, because the page will be	 * mapped into user program space.  This copy is *ONLY* ever	 * written by DMA, not by the driver!  Need a copy per device	 * when we get to multiple devices	 */	volatile __le64 *ipath_pioavailregs_dma;	/* physical address where updates occur */	dma_addr_t ipath_pioavailregs_phys;	struct _ipath_layer ipath_layer;	/* setup intr */	int (*ipath_f_intrsetup)(struct ipath_devdata *);	/* setup on-chip bus config */	int (*ipath_f_bus)(struct ipath_devdata *, struct pci_dev *);	/* hard reset chip */	int (*ipath_f_reset)(struct ipath_devdata *);	int (*ipath_f_get_boardname)(struct ipath_devdata *, char *,				     size_t);	void (*ipath_f_init_hwerrors)(struct ipath_devdata *);	void (*ipath_f_handle_hwerrors)(struct ipath_devdata *, char *,					size_t);	void (*ipath_f_quiet_serdes)(struct ipath_devdata *);	int (*ipath_f_bringup_serdes)(struct ipath_devdata *);	int (*ipath_f_early_init)(struct ipath_devdata *);	void (*ipath_f_clear_tids)(struct ipath_devdata *, unsigned);	void (*ipath_f_put_tid)(struct ipath_devdata *, u64 __iomem*,				u32, unsigned long);	void (*ipath_f_tidtemplate)(struct ipath_devdata *);	void (*ipath_f_cleanup)(struct ipath_devdata *);	void (*ipath_f_setextled)(struct ipath_devdata *, u64, u64);	/* fill out chip-specific fields */	int (*ipath_f_get_base_info)(struct ipath_portdata *, void *);	struct _verbs_layer verbs_layer;	/* total dwords sent (summed from counter) */	u64 ipath_sword;	/* total dwords rcvd (summed from counter) */	u64 ipath_rword;	/* total packets sent (summed from counter) */	u64 ipath_spkts;	/* total packets rcvd (summed from counter) */	u64 ipath_rpkts;	/* ipath_statusp initially points to this. */	u64 _ipath_status;	/* GUID for this interface, in network order */	__be64 ipath_guid;	/*	 * aggregrate of error bits reported since last cleared, for	 * limiting of error reporting	 */	ipath_err_t ipath_lasterror;	/*	 * aggregrate of error bits reported since last cleared, for	 * limiting of hwerror reporting	 */	ipath_err_t ipath_lasthwerror;	/*	 * errors masked because they occur too fast, also includes errors	 * that are always ignored (ipath_ignorederrs)	 */	ipath_err_t ipath_maskederrs;	/* time in jiffies at which to re-enable maskederrs */	unsigned long ipath_unmasktime;	/*	 * errors always ignored (masked), at least for a given	 * chip/device, because they are wrong or not useful	 */	ipath_err_t ipath_ignorederrs;	/* count of egrfull errors, combined for all ports */	u64 ipath_last_tidfull;	/* for ipath_qcheck() */	u64 ipath_lastport0rcv_cnt;	/* template for writing TIDs  */	u64 ipath_tidtemplate;	/* value to write to free TIDs */	u64 ipath_tidinvalid;	/* PE-800 rcv interrupt setup */	u64 ipath_rhdrhead_intr_off;	/* size of memory at ipath_kregbase */	u32 ipath_kregsize;	/* number of registers used for pioavail */	u32 ipath_pioavregs;	/* IPATH_POLL, etc. */	u32 ipath_flags;	/* ipath_flags sma is waiting for */	u32 ipath_sma_state_wanted;	/* last buffer for user use, first buf for kernel use is this	 * index. */	u32 ipath_lastport_piobuf;	/* is a stats timer active */	u32 ipath_stats_timer_active;	/* dwords sent read from counter */	u32 ipath_lastsword;	/* dwords received read from counter */	u32 ipath_lastrword;	/* sent packets read from counter */	u32 ipath_lastspkts;	/* received packets read from counter */	u32 ipath_lastrpkts;	/* pio bufs allocated per port */	u32 ipath_pbufsport;	/*	 * number of ports configured as max; zero is set to number chip	 * supports, less gives more pio bufs/port, etc.	 */	u32 ipath_cfgports;	/* port0 rcvhdrq head offset */	u32 ipath_port0head;	/* count of port 0 hdrqfull errors */	u32 ipath_p0_hdrqfull;	/*	 * (*cfgports) used to suppress multiple instances of same	 * port staying stuck at same point	 */	u32 *ipath_lastrcvhdrqtails;	/*	 * (*cfgports) used to suppress multiple instances of same	 * port staying stuck at same point	 */	u32 *ipath_lastegrheads;	/*	 * index of last piobuffer we used.  Speeds up searching, by	 * starting at this point.  Doesn't matter if multiple cpu's use and	 * update, last updater is only write that matters.  Whenever it	 * wraps, we update shadow copies.  Need a copy per device when we	 * get to multiple devices	 */	u32 ipath_lastpioindex;	/* max length of freezemsg */	u32 ipath_freezelen;	/*	 * consecutive times we wanted a PIO buffer but were unable to	 * get one	 */	u32 ipath_consec_nopiobuf;	/*	 * hint that we should update ipath_pioavailshadow before	 * looking for a PIO buffer	 */	u32 ipath_upd_pio_shadow;	/* so we can rewrite it after a chip reset */	u32 ipath_pcibar0;	/* so we can rewrite it after a chip reset */	u32 ipath_pcibar1;	/* sequential tries for SMA send and no bufs */	u32 ipath_nosma_bufs;	/* duration (seconds) ipath_nosma_bufs set */	u32 ipath_nosma_secs;	/* HT/PCI Vendor ID (here for NodeInfo) */	u16 ipath_vendorid;	/* HT/PCI Device ID (here for NodeInfo) */	u16 ipath_deviceid;	/* offset in HT config space of slave/primary interface block */	u8 ipath_ht_slave_off;	/* for write combining settings */	unsigned long ipath_wc_cookie;	/* ref count for each pkey */	atomic_t ipath_pkeyrefs[4];	/* shadow copy of all exptids physaddr; used only by funcsim */	u64 *ipath_tidsimshadow;	/* shadow copy of struct page *'s for exp tid pages */	struct page **ipath_pageshadow;	/* lock to workaround chip bug 9437 */	spinlock_t ipath_tid_lock;	/*	 * IPATH_STATUS_*,	 * this address is mapped readonly into user processes so they can	 * get status cheaply, whenever they want.	 */	u64 *ipath_statusp;	/* freeze msg if hw error put chip in freeze */	char *ipath_freezemsg;	/* pci access data structure */	struct pci_dev *pcidev;	struct cdev *cdev;	struct class_device *class_dev;	/* timer used to prevent stats overflow, error throttling, etc. */	struct timer_list ipath_stats_timer;	/* check for stale messages in rcv queue */	/* only allow one intr at a time. */	unsigned long ipath_rcv_pending;	/*	 * Shadow copies of registers; size indicates read access size.	 * Most of them are readonly, but some are write-only register,	 * where we manipulate the bits in the shadow copy, and then write	 * the shadow copy to infinipath.	 *	 * We deliberately make most of these 32 bits, since they have	 * restricted range.  For any that we read, we won't to generate 32	 * bit accesses, since Opteron will generate 2 separate 32 bit HT	 * transactions for a 64 bit read, and we want to avoid unnecessary	 * HT transactions.	 */	/* This is the 64 bit group */	/*	 * shadow of pioavail, check to be sure it's large enough at	 * init time.	 */	unsigned long ipath_pioavailshadow[8];	/* shadow of kr_gpio_out, for rmw ops */	u64 ipath_gpio_out;	/* kr_revision shadow */	u64 ipath_revision;	/*	 * shadow of ibcctrl, for interrupt handling of link changes,	 * etc.	 */	u64 ipath_ibcctrl;	/*	 * last ibcstatus, to suppress "duplicate" status change messages,	 * mostly from 2 to 3	 */	u64 ipath_lastibcstat;	/* hwerrmask shadow */	ipath_err_t ipath_hwerrmask;	/* interrupt config reg shadow */	u64 ipath_intconfig;	/* kr_sendpiobufbase value */	u64 ipath_piobufbase;	/* these are the "32 bit" regs */	/*	 * number of GUIDs in the flash for this interface; may need some	 * rethinking for setting on other ifaces	 */	u32 ipath_nguid;	/*	 * the following two are 32-bit bitmasks, but {test,clear,set}_bit	 * all expect bit fields to be "unsigned long"	 */	/* shadow kr_rcvctrl */	unsigned long ipath_rcvctrl;	/* shadow kr_sendctrl */	unsigned long ipath_sendctrl;	/* value we put in kr_rcvhdrcnt */	u32 ipath_rcvhdrcnt;	/* value we put in kr_rcvhdrsize */	u32 ipath_rcvhdrsize;	/* value we put in kr_rcvhdrentsize */	u32 ipath_rcvhdrentsize;	/* offset of last entry in rcvhdrq */	u32 ipath_hdrqlast;	/* kr_portcnt value */	u32 ipath_portcnt;	/* kr_pagealign value */	u32 ipath_palign;	/* number of "2KB" PIO buffers */	u32 ipath_piobcnt2k;	/* size in bytes of "2KB" PIO buffers */	u32 ipath_piosize2k;	/* number of "4KB" PIO buffers */	u32 ipath_piobcnt4k;	/* size in bytes of "4KB" PIO buffers */	u32 ipath_piosize4k;	/* kr_rcvegrbase value */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?