⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wd7000.h

📁 GNU Mach 微内核源代码, 基于美国卡内基美隆大学的 Mach 研究项目
💻 H
📖 第 1 页 / 共 2 页
字号:
/* $Id: wd7000.h,v 1.1 1999/04/26 05:55:19 tb Exp $ * * Header file for the WD-7000 driver for Linux * * John Boyd <boyd@cis.ohio-state.edu>  Jan 1994: * This file has been reduced to only the definitions needed for the * WD7000 host structure. * * Revision by Miroslav Zagorac <zaga@fly.cc.fer.hr>  Jun 1997. */#ifndef _WD7000_H#include <linux/version.h>#include <linux/types.h>#include <linux/kdev_t.h>#ifndef NULL#define NULL 0L#endif/* *  In this version, sg_tablesize now defaults to WD7000_SG, and will *  be set to SG_NONE for older boards.  This is the reverse of the *  previous default, and was changed so that the driver-level *  Scsi_Host_Template would reflect the driver's support for scatter/ *  gather. * *  Also, it has been reported that boards at Revision 6 support scatter/ *  gather, so the new definition of an "older" board has been changed *  accordingly. */#define WD7000_Q    16#define WD7000_SG   16#ifdef WD7000_DEFINES/* *  Mailbox structure sizes. *  I prefer to keep the number of ICMBs much larger than the number of *  OGMBs.  OGMBs are used very quickly by the driver to start one or *  more commands, while ICMBs are used by the host adapter per command. */#define OGMB_CNT	16#define ICMB_CNT	32/* *  Scb's are shared by all active adapters.  If you'd rather conserve *  memory, use a smaller number (> 0, of course) - things will should *  still work OK. */#define MAX_SCBS	(4 * WD7000_Q)/* *  WD7000-specific mailbox structure */typedef volatile struct {    unchar status;    unchar scbptr[3];		/* SCSI-style - MSB first (big endian) */} Mailbox;/* *  This structure should contain all per-adapter global data.  I.e., any *  new global per-adapter data should put in here. */typedef struct {    struct Scsi_Host *sh;	/* Pointer to Scsi_Host structure    */    int iobase;			/* This adapter's I/O base address   */    int irq;			/* This adapter's IRQ level          */    int dma;			/* This adapter's DMA channel        */    int int_counter;		/* This adapter's interrupt counter  */    int bus_on;			/* This adapter's BUS_ON time        */    int bus_off;		/* This adapter's BUS_OFF time       */    struct {			/* This adapter's mailboxes          */	Mailbox ogmb[OGMB_CNT];	/* Outgoing mailboxes                */	Mailbox icmb[ICMB_CNT];	/* Incoming mailboxes                */    } mb;    int next_ogmb;		/* to reduce contention at mailboxes */    unchar control;		/* shadows CONTROL port value        */    unchar rev1;		/* filled in by wd7000_revision      */    unchar rev2;} Adapter;/* * possible irq range */#define IRQ_MIN		3#define IRQ_MAX		15#define IRQS		(IRQ_MAX - IRQ_MIN + 1)#define BUS_ON		64	/* x 125ns = 8000ns (BIOS default) */#define BUS_OFF		15	/* x 125ns = 1875ns (BIOS default) *//* *  Standard Adapter Configurations - used by wd7000_detect */typedef struct {    short irq;		/* IRQ level                                  */    short dma;		/* DMA channel                                */    uint iobase;	/* I/O base address                           */    short bus_on;	/* Time that WD7000 spends on the AT-bus when */			/* transferring data. BIOS default is 8000ns. */    short bus_off;	/* Time that WD7000 spends OFF THE BUS after  */			/* while it is transferring data.             */			/* BIOS default is 1875ns                     */} Config;/* *  The following list defines strings to look for in the BIOS that identify *  it as the WD7000-FASST2 SST BIOS.  I suspect that something should be *  added for the Future Domain version. */typedef struct {    const char *sig;		/* String to look for            */    ulong ofs;			/* offset from BIOS base address */    uint len;			/* length of string              */} Signature;/* *  I/O Port Offsets and Bit Definitions *  4 addresses are used.  Those not defined here are reserved. */#define ASC_STAT	0	/* Status,  Read          */#define ASC_COMMAND	0	/* Command, Write         */#define ASC_INTR_STAT	1	/* Interrupt Status, Read */#define ASC_INTR_ACK	1	/* Acknowledge, Write     */#define ASC_CONTROL	2	/* Control, Write         *//* * ASC Status Port */#define INT_IM		0x80	/* Interrupt Image Flag           */#define CMD_RDY		0x40	/* Command Port Ready             */#define CMD_REJ		0x20	/* Command Port Byte Rejected     */#define ASC_INIT        0x10	/* ASC Initialized Flag           */#define ASC_STATMASK    0xf0	/* The lower 4 Bytes are reserved *//* * COMMAND opcodes * *  Unfortunately, I have no idea how to properly use some of these commands, *  as the OEM manual does not make it clear.  I have not been able to use *  enable/disable unsolicited interrupts or the reset commands with any *  discernible effect whatsoever.  I think they may be related to certain *  ICB commands, but again, the OEM manual doesn't make that clear. */#define NO_OP			0	/* NO-OP toggles CMD_RDY bit in ASC_STAT  */#define INITIALIZATION		1	/* initialization (10 bytes)              */#define DISABLE_UNS_INTR	2	/* disable unsolicited interrupts         */#define ENABLE_UNS_INTR		3	/* enable unsolicited interrupts          */#define INTR_ON_FREE_OGMB	4	/* interrupt on free OGMB                 */#define SOFT_RESET		5	/* SCSI bus soft reset                    */#define HARD_RESET_ACK		6	/* SCSI bus hard reset acknowledge        */#define START_OGMB		0x80	/* start command in OGMB (n)              */#define SCAN_OGMBS		0xc0	/* start multiple commands, signature (n) */					/*    where (n) = lower 6 bits            *//* * For INITIALIZATION: */typedef struct {    unchar op;			/* command opcode (= 1)                    */    unchar ID;			/* Adapter's SCSI ID                       */    unchar bus_on;		/* Bus on time, x 125ns (see below)        */    unchar bus_off;		/* Bus off time, ""         ""             */    unchar rsvd;		/* Reserved                                */    unchar mailboxes[3];	/* Address of Mailboxes, MSB first         */    unchar ogmbs;		/* Number of outgoing MBs, max 64, 0,1 = 1 */    unchar icmbs;		/* Number of incoming MBs,   ""       ""   */} InitCmd;/* * Interrupt Status Port - also returns diagnostic codes at ASC reset * * if msb is zero, the lower bits are diagnostic status * Diagnostics: * 01   No diagnostic error occurred * 02   RAM failure * 03   FIFO R/W failed * 04   SBIC register read/write failed * 05   Initialization D-FF failed * 06   Host IRQ D-FF failed * 07   ROM checksum error * Interrupt status (bitwise): * 10NNNNNN   outgoing mailbox NNNNNN is free * 11NNNNNN   incoming mailbox NNNNNN needs service */#define MB_INTR		0xC0	/* Mailbox Service possible/required */#define IMB_INTR	0x40	/* 1 Incoming / 0 Outgoing           */#define MB_MASK		0x3f	/* mask for mailbox number           *//* * CONTROL port bits */#define INT_EN		0x08	/* Interrupt Enable */#define DMA_EN		0x04	/* DMA Enable       */#define SCSI_RES	0x02	/* SCSI Reset       */#define ASC_RES		0x01	/* ASC Reset        *//* * Driver data structures: *   - mb and scbs are required for interfacing with the host adapter. *     An SCB has extra fields not visible to the adapter; mb's *     _cannot_ do this, since the adapter assumes they are contiguous in *     memory, 4 bytes each, with ICMBs following OGMBs, and uses this fact *     to access them. *   - An icb is for host-only (non-SCSI) commands.  ICBs are 16 bytes each; *     the additional bytes are used only by the driver. *   - For now, a pool of SCBs are kept in global storage by this driver, *     and are allocated and freed as needed. * *  The 7000-FASST2 marks OGMBs empty as soon as it has _started_ a command, *  not when it has finished.  Since the SCB must be around for completion, *  problems arise when SCBs correspond to OGMBs, which may be reallocated *  earlier (or delayed unnecessarily until a command completes). *  Mailboxes are used as transient data structures, simply for *  carrying SCB addresses to/from the 7000-FASST2. * *  Note also since SCBs are not "permanently" associated with mailboxes, *  there is no need to keep a global list of Scsi_Cmnd pointers indexed *  by OGMB.   Again, SCBs reference their Scsi_Cmnds directly, so mailbox *  indices need not be involved. *//*

⌨️ 快捷键说明

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