ncr53c9x.h

来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 671 行 · 第 1/3 页

H
671
字号
/* NCR53C9x.c:  Defines and structures for the NCR53C9x generic driver. * * Originaly esp.h:  Defines and structures for the Sparc ESP  *                   (Enhanced SCSI Processor) driver under Linux. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * * Generalization by Jesper Skov (jskov@cygnus.co.uk) * * More generalization (for i386 stuff) by Tymm Twillman (tymm@computer.org) */#ifndef NCR53C9X_H#define NCR53C9X_H#include <linux/config.h>#include <linux/interrupt.h>/* djweis for mac driver */#if defined(CONFIG_MAC)#define PAD_SIZE 15#else#define PAD_SIZE 3#endif/* Handle multiple hostadapters on Amiga * generally PAD_SIZE = 3 * but there is one exception: Oktagon (PAD_SIZE = 1) */#if defined(CONFIG_OKTAGON_SCSI) || defined(CONFIG_OKTAGON_SCSI_MODULE)#undef PAD_SIZE#if defined(CONFIG_BLZ1230_SCSI) || defined(CONFIG_BLZ1230_SCSI_MODULE) || \    defined(CONFIG_BLZ2060_SCSI) || defined(CONFIG_BLZ2060_SCSI_MODULE) || \    defined(CONFIG_CYBERSTORM_SCSI) || defined(CONFIG_CYBERSTORM_SCSI_MODULE) || \    defined(CONFIG_CYBERSTORMII_SCSI) || defined(CONFIG_CYBERSTORMII_SCSI_MODULE) || \    defined(CONFIG_FASTLANE_SCSI) || defined(CONFIG_FASTLANE_SCSI_MODULE)#define MULTIPLE_PAD_SIZES#else#define PAD_SIZE 1#endif#endif/* Macros for debugging messages */#define DEBUG_ESP/* #define DEBUG_ESP_DATA *//* #define DEBUG_ESP_QUEUE *//* #define DEBUG_ESP_DISCONNECT *//* #define DEBUG_ESP_STATUS *//* #define DEBUG_ESP_PHASES *//* #define DEBUG_ESP_WORKBUS *//* #define DEBUG_STATE_MACHINE *//* #define DEBUG_ESP_CMDS *//* #define DEBUG_ESP_IRQS *//* #define DEBUG_SDTR *//* #define DEBUG_ESP_SG *//* Use the following to sprinkle debugging messages in a way which * suits you if combinations of the above become too verbose when * trying to track down a specific problem. *//* #define DEBUG_ESP_MISC */#if defined(DEBUG_ESP)#define ESPLOG(foo)  printk foo#else#define ESPLOG(foo)#endif /* (DEBUG_ESP) */#if defined(DEBUG_ESP_DATA)#define ESPDATA(foo)  printk foo#else#define ESPDATA(foo)#endif#if defined(DEBUG_ESP_QUEUE)#define ESPQUEUE(foo)  printk foo#else#define ESPQUEUE(foo)#endif#if defined(DEBUG_ESP_DISCONNECT)#define ESPDISC(foo)  printk foo#else#define ESPDISC(foo)#endif#if defined(DEBUG_ESP_STATUS)#define ESPSTAT(foo)  printk foo#else#define ESPSTAT(foo)#endif#if defined(DEBUG_ESP_PHASES)#define ESPPHASE(foo)  printk foo#else#define ESPPHASE(foo)#endif#if defined(DEBUG_ESP_WORKBUS)#define ESPBUS(foo)  printk foo#else#define ESPBUS(foo)#endif#if defined(DEBUG_ESP_IRQS)#define ESPIRQ(foo)  printk foo#else#define ESPIRQ(foo)#endif#if defined(DEBUG_SDTR)#define ESPSDTR(foo)  printk foo#else#define ESPSDTR(foo)#endif#if defined(DEBUG_ESP_MISC)#define ESPMISC(foo)  printk foo#else#define ESPMISC(foo)#endif/* * padding for register structure */#ifdef CONFIG_JAZZ_ESP#define EREGS_PAD(n)#else#ifndef MULTIPLE_PAD_SIZES#define EREGS_PAD(n)    unchar n[PAD_SIZE];#endif#endif/* The ESP SCSI controllers have their register sets in three * "classes": * * 1) Registers which are both read and write. * 2) Registers which are read only. * 3) Registers which are write only. * * Yet, they all live within the same IO space. */#if !defined(__i386__) && !defined(__x86_64__)#ifndef MULTIPLE_PAD_SIZES#ifdef CONFIG_CPU_HAS_WB#include <asm/wbflush.h>#define esp_write(__reg, __val) do{(__reg) = (__val); wbflush();} while(0)#else#define esp_write(__reg, __val) ((__reg) = (__val))#endif#define esp_read(__reg) (__reg)struct ESP_regs {                                /* Access    Description              Offset */    volatile unchar esp_tclow;  /* rw  Low bits of the transfer count 0x00   */                                EREGS_PAD(tlpad1);    volatile unchar esp_tcmed;  /* rw  Mid bits of the transfer count 0x04   */                                EREGS_PAD(fdpad);    volatile unchar esp_fdata;  /* rw  FIFO data bits                 0x08   */                                EREGS_PAD(cbpad);    volatile unchar esp_cmnd;   /* rw  SCSI command bits              0x0c   */                                EREGS_PAD(stpad);    volatile unchar esp_status; /* ro  ESP status register            0x10   */#define esp_busid   esp_status  /* wo  Bus ID for select/reselect     0x10   */                                EREGS_PAD(irqpd);    volatile unchar esp_intrpt; /* ro  Kind of interrupt              0x14   */#define esp_timeo   esp_intrpt  /* wo  Timeout value for select/resel 0x14   */                                EREGS_PAD(sspad);    volatile unchar esp_sstep;  /* ro  Sequence step register         0x18   */#define esp_stp     esp_sstep   /* wo  Transfer period per sync       0x18   */                                EREGS_PAD(ffpad);    volatile unchar esp_fflags; /* ro  Bits of current FIFO info      0x1c   */#define esp_soff    esp_fflags  /* wo  Sync offset                    0x1c   */                                EREGS_PAD(cf1pd);    volatile unchar esp_cfg1;   /* rw  First configuration register   0x20   */                                EREGS_PAD(cfpad);    volatile unchar esp_cfact;  /* wo  Clock conversion factor        0x24   */                                EREGS_PAD(ctpad);    volatile unchar esp_ctest;  /* wo  Chip test register             0x28   */                                EREGS_PAD(cf2pd);    volatile unchar esp_cfg2;   /* rw  Second configuration register  0x2c   */                                EREGS_PAD(cf3pd);    /* The following is only found on the 53C9X series SCSI chips */    volatile unchar esp_cfg3;   /* rw  Third configuration register   0x30  */                                EREGS_PAD(cf4pd);    volatile unchar esp_cfg4;   /* rw  Fourth configuration register  0x34  */                                EREGS_PAD(thpd);    /* The following is found on all chips except the NCR53C90 (ESP100) */    volatile unchar esp_tchi;   /* rw  High bits of transfer count    0x38  */#define esp_uid     esp_tchi    /* ro  Unique ID code                 0x38  */                                EREGS_PAD(fgpad);        volatile unchar esp_fgrnd;  /* rw  Data base for fifo             0x3c  */};#else /* MULTIPLE_PAD_SIZES */#define esp_write(__reg, __val) (*(__reg) = (__val))#define esp_read(__reg) (*(__reg))struct ESP_regs {    unsigned char io_addr[64]; /* dummy */                                                 /* Access    Description              Offset */#define esp_tclow   io_addr                      /* rw  Low bits of the transfer count 0x00   */#define esp_tcmed   io_addr + (1<<(esp->shift))  /* rw  Mid bits of the transfer count 0x04   */#define esp_fdata   io_addr + (2<<(esp->shift))  /* rw  FIFO data bits                 0x08   */#define esp_cmnd    io_addr + (3<<(esp->shift))  /* rw  SCSI command bits              0x0c   */#define esp_status  io_addr + (4<<(esp->shift))  /* ro  ESP status register            0x10   */#define esp_busid   esp_status                   /* wo  Bus ID for select/reselect     0x10   */#define esp_intrpt  io_addr + (5<<(esp->shift))  /* ro  Kind of interrupt              0x14   */#define esp_timeo   esp_intrpt                   /* wo  Timeout value for select/resel 0x14   */#define esp_sstep   io_addr + (6<<(esp->shift))  /* ro  Sequence step register         0x18   */#define esp_stp     esp_sstep                    /* wo  Transfer period per sync       0x18   */#define esp_fflags  io_addr + (7<<(esp->shift))  /* ro  Bits of current FIFO info      0x1c   */#define esp_soff    esp_fflags                   /* wo  Sync offset                    0x1c   */#define esp_cfg1    io_addr + (8<<(esp->shift))  /* rw  First configuration register   0x20   */#define esp_cfact   io_addr + (9<<(esp->shift))  /* wo  Clock conversion factor        0x24   */#define esp_ctest   io_addr + (10<<(esp->shift)) /* wo  Chip test register             0x28   */#define esp_cfg2    io_addr + (11<<(esp->shift)) /* rw  Second configuration register  0x2c   */    /* The following is only found on the 53C9X series SCSI chips */

⌨️ 快捷键说明

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