📄 am53c974.h
字号:
#define CNTLREG2 0x2C /* rw control register two */#define CNTLREG2_ENF 0x40 /* enable features */#define CNTLREG3 0x30 /* rw control register three */ #define CNTLREG3_ADIDCHK 0x80 /* additional ID check */#define CNTLREG3_FASTSCSI 0x10 /* fast SCSI */#define CNTLREG3_FASTCLK 0x08 /* fast SCSI clocking */#define CNTLREG4 0x34 /* rw control register four */ #define CNTLREG4_GLITCH 0xC0 /* glitch eater */#define CNTLREG4_PWD 0x20 /* reduced power feature */#define CNTLREG4_RAE 0x08 /* write only, active negot. ctrl. */#define CNTLREG4_RADE 0x04 /* active negot. ctrl. */#define CNTLREG4_RES 0x10 /* reserved bit, must be 1 *//*** DMA block ***/#define DMACMD 0x40 /* rw command */#define DMACMD_DIR 0x80 /* transfer direction (1=read from device) */#define DMACMD_INTE_D 0x40 /* DMA transfer interrupt enable */#define DMACMD_INTE_P 0x20 /* page transfer interrupt enable */#define DMACMD_MDL 0x10 /* map to memory descriptor list */#define DMACMD_DIAG 0x04 /* diagnostics, set to 0 */#define DMACMD_IDLE 0x00 /* idle cmd */#define DMACMD_BLAST 0x01 /* flush FIFO to memory */#define DMACMD_ABORT 0x02 /* terminate DMA */#define DMACMD_START 0x03 /* start DMA */#define DMASTATUS 0x54 /* r status register */#define DMASTATUS_BCMPLT 0x20 /* BLAST complete */#define DMASTATUS_SCSIINT 0x10 /* SCSI interrupt pending */#define DMASTATUS_DONE 0x08 /* DMA transfer terminated */#define DMASTATUS_ABORT 0x04 /* DMA transfer aborted */#define DMASTATUS_ERROR 0x02 /* DMA transfer error */#define DMASTATUS_PWDN 0x02 /* power down indicator */#define DMASTC 0x44 /* rw starting transfer count */#define DMASPA 0x48 /* rw starting physical address */#define DMAWBC 0x4C /* r working byte counter */#define DMAWAC 0x50 /* r working address counter */#define DMASMDLA 0x58 /* rw starting MDL address */#define DMAWMAC 0x5C /* r working MDL counter *//*** SCSI phases ***/#define PHASE_MSGIN 0x07#define PHASE_MSGOUT 0x06#define PHASE_RES_1 0x05#define PHASE_RES_0 0x04#define PHASE_STATIN 0x03#define PHASE_CMDOUT 0x02#define PHASE_DATAIN 0x01#define PHASE_DATAOUT 0x00struct AM53C974_hostdata { volatile unsigned in_reset:1; /* flag, says bus reset pending */ volatile unsigned aborted:1; /* flag, says aborted */ volatile unsigned selecting:1; /* selection started, but not yet finished */ volatile unsigned disconnecting: 1; /* disconnection started, but not yet finished */ volatile unsigned dma_busy:1; /* dma busy when service request for info transfer received */ volatile unsigned char msgout[10]; /* message to output in MSGOUT_PHASE */ volatile unsigned char last_message[10]; /* last message OUT */ volatile Scsi_Cmnd *issue_queue; /* waiting to be issued */ volatile Scsi_Cmnd *disconnected_queue; /* waiting for reconnect */ volatile Scsi_Cmnd *sel_cmd; /* command for selection */ volatile Scsi_Cmnd *connected; /* currently connected command */ volatile unsigned char busy[8]; /* index = target, bit = lun */ unsigned char sync_per[8]; /* synchronous transfer period (in effect) */ unsigned char sync_off[8]; /* synchronous offset (in effect) */ unsigned char sync_neg[8]; /* sync. negotiation performed (in effect) */ unsigned char sync_en[8]; /* sync. negotiation performed (in effect) */ unsigned char max_rate[8]; /* max. transfer rate (setup) */ unsigned char max_offset[8]; /* max. sync. offset (setup), only valid if corresponding sync_en is nonzero */ };#define AM53C974 { \ NULL, /* pointer to next in list */ \ NULL, /* long * usage_count */ \ NULL, /* struct proc_dir_entry *proc_dir */ \ NULL, /* int (*proc_info)(char *, char **, off_t, int, int, int); */ \ "AM53C974", /* name */ \ AM53C974_detect, /* int (* detect)(struct SHT *) */ \ NULL, /* int (*release)(struct Scsi_Host *) */ \ AM53C974_info, /* const char *(* info)(struct Scsi_Host *) */ \ AM53C974_command, /* int (* command)(Scsi_Cmnd *) */ \ AM53C974_queue_command, /* int (* queuecommand)(Scsi_Cmnd *, \ void (*done)(Scsi_Cmnd *)) */ \ AM53C974_abort, /* int (* abort)(Scsi_Cmnd *) */ \ AM53C974_reset, /* int (* reset)(Scsi_Cmnd *) */ \ NULL, /* int (* slave_attach)(int, int) */ \ scsicam_bios_param, /* int (* bios_param)(Disk *, int, int[]) */ \ 12, /* can_queue */ \ -1, /* this_id */ \ SG_ALL, /* sg_tablesize */ \ 1, /* cmd_per_lun */ \ 0, /* present, i.e. how many adapters of this kind */ \ 0, /* unchecked_isa_dma */ \ DISABLE_CLUSTERING /* use_clustering */ \ }void AM53C974_setup(char *str, int *ints);int AM53C974_detect(Scsi_Host_Template *tpnt);int AM53C974_biosparm(Disk *disk, int dev, int *info_array);const char *AM53C974_info(struct Scsi_Host *);int AM53C974_command(Scsi_Cmnd *SCpnt);int AM53C974_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));int AM53C974_abort(Scsi_Cmnd *cmd);int AM53C974_reset (Scsi_Cmnd *cmd, unsigned int flags);#define AM53C974_local_declare() unsigned long io_port#define AM53C974_setio(instance) io_port = instance->io_port#define AM53C974_read_8(addr) inb(io_port + (addr))#define AM53C974_write_8(addr,x) outb((x), io_port + (addr))#define AM53C974_read_16(addr) inw(io_port + (addr))#define AM53C974_write_16(addr,x) outw((x), io_port + (addr))#define AM53C974_read_32(addr) inl(io_port + (addr))#define AM53C974_write_32(addr,x) outl((x), io_port + (addr))#define AM53C974_poll_int() { do { statreg = AM53C974_read_8(STATREG); } \ while (!(statreg & STATREG_INT)) ; \ AM53C974_read_8(INSTREG) ; } /* clear int */#define AM53C974_cfifo() (AM53C974_read_8(CFIREG) & CFIREG_CF)/* These are "special" values for the tag parameter passed to AM53C974_select. */#define TAG_NEXT -1 /* Use next free tag */#define TAG_NONE -2 /* Establish I_T_L nexus instead of I_T_L_Q * even on SCSI-II devices *//************ LILO overrides *************/typedef struct _override_t { int host_scsi_id; /* SCSI id of the bus controller */ int target_scsi_id; /* SCSI id of target */ int max_rate; /* max. transfer rate */ int max_offset; /* max. sync. offset, 0 = asynchronous */ } override_t;/************ PCI stuff *************/#define AM53C974_PCIREG_OPEN() outb(0xF1, 0xCF8); outb(0, 0xCFA)#define AM53C974_PCIREG_CLOSE() outb(0, 0xCF8)#define AM53C974_PCIREG_READ_BYTE(instance,a) ( inb((a) + (instance)->io_port) )#define AM53C974_PCIREG_READ_WORD(instance,a) ( inw((a) + (instance)->io_port) )#define AM53C974_PCIREG_READ_DWORD(instance,a) ( inl((a) + (instance)->io_port) )#define AM53C974_PCIREG_WRITE_BYTE(instance,x,a) ( outb((x), (a) + (instance)->io_port) )#define AM53C974_PCIREG_WRITE_WORD(instance,x,a) ( outw((x), (a) + (instance)->io_port) )#define AM53C974_PCIREG_WRITE_DWORD(instance,x,a) ( outl((x), (a) + (instance)->io_port) )typedef struct _pci_config_t { /* start of official PCI config space header */ union { unsigned int device_vendor; struct { unsigned short vendor; unsigned short device; } dv; } dv_id;#define _device_vendor dv_id.device_vendor#define _vendor dv_id.dv.vendor#define _device dv_id.dv.device union { unsigned int status_command; struct { unsigned short command; unsigned short status; } sc; } stat_cmd;#define _status_command stat_cmd.status_command#define _command stat_cmd.sc.command#define _status stat_cmd.sc.status union { unsigned int class_revision; struct { unsigned char rev_id; unsigned char prog_if; unsigned char sub_class; unsigned char base_class; } cr; } class_rev;#define _class_revision class_rev.class_revision#define _rev_id class_rev.cr.rev_id#define _prog_if class_rev.cr.prog_if#define _sub_class class_rev.cr.sub_class#define _base_class class_rev.cr.base_class union { unsigned int bist_header_latency_cache; struct { unsigned char cache_line_size; unsigned char latency_timer; unsigned char header_type; unsigned char bist; } bhlc; } bhlc;#define _bist_header_latency_cache bhlc.bist_header_latency_cache#define _cache_line_size bhlc.bhlc.cache_line_size#define _latency_timer bhlc.bhlc.latency_timer#define _header_type bhlc.bhlc.header_type#define _bist bhlc.bhlc.bist unsigned int _base0; unsigned int _base1; unsigned int _base2; unsigned int _base3; unsigned int _base4; unsigned int _base5; unsigned int rsvd1; unsigned int rsvd2; unsigned int _baserom; unsigned int rsvd3; unsigned int rsvd4; union { unsigned int max_min_ipin_iline; struct { unsigned char int_line; unsigned char int_pin; unsigned char min_gnt; unsigned char max_lat; } mmii; } mmii;#define _max_min_ipin_iline mmii.max_min_ipin_iline#define _int_line mmii.mmii.int_line#define _int_pin mmii.mmii.int_pin#define _min_gnt mmii.mmii.min_gnt#define _max_lat mmii.mmii.max_lat /* end of official PCI config space header */ unsigned short _ioaddr; /* config type 1 - private I/O addr */ unsigned int _pcibus; /* config type 2 - private bus id */ unsigned int _cardnum; /* config type 2 - private card number */} pci_config_t;#endif /* AM53C974_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -