aic7xxx.h
来自「基于组件方式开发操作系统的OSKIT源代码」· C头文件 代码 · 共 585 行 · 第 1/2 页
H
585 行
* for each initiator<->target mapping (including the mapping for when we * are the initiator). */struct tmode_tstate { struct tmode_lstate* enabled_luns[8]; struct ahc_initiator_tinfo transinfo[16]; /* * Per initiator state bitmasks. */ u_int16_t ultraenb; /* Using ultra sync rate */ u_int16_t discenable; /* Disconnection allowed */ u_int16_t tagenable; /* Tagged Queuing allowed */};/* * Define the format of the aic7XX0 SEEPROM registers (16 bits). */struct seeprom_config {/* * SCSI ID Configuration Flags */ u_int16_t device_flags[16]; /* words 0-15 */#define CFXFER 0x0007 /* synchronous transfer rate */#define CFSYNCH 0x0008 /* enable synchronous transfer */#define CFDISC 0x0010 /* enable disconnection */#define CFWIDEB 0x0020 /* wide bus device */#define CFSYNCHISULTRA 0x0040 /* CFSYNCH is an ultra offset (2940AU)*//* UNUSED 0x0080 */#define CFSTART 0x0100 /* send start unit SCSI command */#define CFINCBIOS 0x0200 /* include in BIOS scan */#define CFRNFOUND 0x0400 /* report even if not found */#define CFMULTILUN 0x0800 /* Probe multiple luns in BIOS scan *//* UNUSED 0xf000 *//* * BIOS Control Bits */ u_int16_t bios_control; /* word 16 */#define CFSUPREM 0x0001 /* support all removeable drives */#define CFSUPREMB 0x0002 /* support removeable drives for boot only */#define CFBIOSEN 0x0004 /* BIOS enabled *//* UNUSED 0x0008 */#define CFSM2DRV 0x0010 /* support more than two drives */#define CF284XEXTEND 0x0020 /* extended translation (284x cards) */ /* UNUSED 0x0060 */#define CFEXTEND 0x0080 /* extended translation enabled *//* UNUSED 0xff00 *//* * Host Adapter Control Bits */ u_int16_t adapter_control; /* word 17 */ #define CFAUTOTERM 0x0001 /* Perform Auto termination */#define CFULTRAEN 0x0002 /* Ultra SCSI speed enable */#define CF284XSELTO 0x0003 /* Selection timeout (284x cards) */#define CF284XFIFO 0x000C /* FIFO Threshold (284x cards) */#define CFSTERM 0x0004 /* SCSI low byte termination */#define CFWSTERM 0x0008 /* SCSI high byte termination */#define CFSPARITY 0x0010 /* SCSI parity */#define CF284XSTERM 0x0020 /* SCSI low byte term (284x cards) */ #define CFRESETB 0x0040 /* reset SCSI bus at boot */#define CFCHNLBPRIMARY 0x0100 /* aic7895 probe B channel first */#define CFSEAUTOTERM 0x0400 /* aic7890 Perform SE Auto Termination*/#define CFLVDSTERM 0x0800 /* aic7890 LVD Termination *//* UNUSED 0xf080 *//* * Bus Release, Host Adapter ID */ u_int16_t brtime_id; /* word 18 */#define CFSCSIID 0x000f /* host adapter SCSI ID *//* UNUSED 0x00f0 */#define CFBRTIME 0xff00 /* bus release time *//* * Maximum targets */ u_int16_t max_targets; /* word 19 */ #define CFMAXTARG 0x00ff /* maximum targets *//* UNUSED 0xff00 */ u_int16_t res_1[11]; /* words 20-30 */ u_int16_t checksum; /* word 31 */};struct ahc_syncrate { int sxfr_ultra2; int sxfr; /* Rates in Ultra mode have bit 8 of sxfr set */#define ULTRA_SXFR 0x100 u_int8_t period; /* Period to send to SCSI target */ char *rate;};typedef enum { MSG_TYPE_NONE = 0x00, MSG_TYPE_INITIATOR_MSGOUT = 0x01, MSG_TYPE_INITIATOR_MSGIN = 0x02, MSG_TYPE_TARGET_MSGOUT = 0x03, MSG_TYPE_TARGET_MSGIN = 0x04} ahc_msg_type;struct sg_map_node { bus_dmamap_t sg_dmamap; bus_addr_t sg_physaddr; struct ahc_dma_seg* sg_vaddr; SLIST_ENTRY(sg_map_node) links;}; struct scb_data { struct hardware_scb *hscbs; /* Array of hardware SCBs */ struct scb *scbarray; /* Array of kernel SCBs */ SLIST_HEAD(, scb) free_scbs; /* * Pool of SCBs ready to be assigned * commands to execute. */ struct scsi_sense_data *sense; /* Per SCB sense data */ /* * "Bus" addresses of our data structures. */ bus_dma_tag_t hscb_dmat; /* dmat for our hardware SCB array */ bus_dmamap_t hscb_dmamap; bus_addr_t hscb_busaddr; bus_dma_tag_t sense_dmat; bus_dmamap_t sense_dmamap; bus_addr_t sense_busaddr; bus_dma_tag_t sg_dmat; /* dmat for our sg segments */ SLIST_HEAD(, sg_map_node) sg_maps; u_int8_t numscbs; u_int8_t maxhscbs; /* Number of SCBs on the card */ u_int8_t init_level; /* * How far we've initialized * this structure. */};struct ahc_softc { bus_space_tag_t tag; bus_space_handle_t bsh; bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */ struct scb_data *scb_data; /* * CCBs that have been send to the controller */ LIST_HEAD(, ccb_hdr) pending_ccbs; /* * Target mode related state kept on a per enabled lun basis. * Targets that are not enabled will have null entries. * As an initiator, we keep one target entry for our initiator * ID to store our sync/wide transfer settings. */ struct tmode_tstate* enabled_targets[16]; /* * The black hole device responsible for handling requests for * disabled luns on enabled targets. */ struct tmode_lstate* black_hole; /* * Device instance currently on the bus awaiting a continue TIO * for a command that was not given the disconnect priveledge. */ struct tmode_lstate* pending_device; /* * Card characteristics */ ahc_chip chip; ahc_feature features; ahc_flag flags; /* Values to store in the SEQCTL register for pause and unpause */ u_int8_t unpause; u_int8_t pause; /* Command Queues */ u_int8_t qoutfifonext; u_int8_t qinfifonext; u_int8_t *qoutfifo; u_int8_t *qinfifo; /* * 256 byte array storing the SCBID of outstanding * untagged SCBs indexed by TCL. */ u_int8_t *untagged_scbs; /* * Hooks into the XPT. */ struct cam_sim *sim; struct cam_sim *sim_b; struct cam_path *path; struct cam_path *path_b; int unit; /* Channel Names ('A', 'B', etc.) */ char channel; char channel_b; /* Initiator Bus ID */ u_int8_t our_id; u_int8_t our_id_b; /* Targets that need negotiation messages */ u_int16_t targ_msg_req; /* * PCI error detection and data for running the * PCI error interrupt handler. */ int unsolicited_ints; pcici_t pci_config_id; /* * Target incoming command FIFO. */ struct target_cmd *targetcmds; u_int8_t tqinfifonext; /* * Incoming and outgoing message handling. */ u_int8_t send_msg_perror; ahc_msg_type msg_type; u_int8_t msgout_buf[8]; /* Message we are sending */ u_int8_t msgin_buf[8]; /* Message we are receiving */ u_int msgout_len; /* Length of message to send */ u_int msgout_index; /* Current index in msgout */ u_int msgin_index; /* Current index in msgin */ bus_dma_tag_t parent_dmat; bus_dma_tag_t shared_data_dmat; bus_dmamap_t shared_data_dmamap; bus_addr_t shared_data_busaddr; /* Number of enabled target mode device on this card */ u_int enabled_luns; /* Initialization level of this data structure */ u_int init_level;};struct full_ahc_softc { struct ahc_softc softc; struct scb_data scb_data_storage;};/* #define AHC_DEBUG */#ifdef AHC_DEBUG/* Different debugging levels used when AHC_DEBUG is defined */#define AHC_SHOWMISC 0x0001#define AHC_SHOWCMDS 0x0002#define AHC_SHOWSCBS 0x0004#define AHC_SHOWABORTS 0x0008#define AHC_SHOWSENSE 0x0010#define AHC_SHOWSCBCNT 0x0020extern int ahc_debug; /* Initialized in i386/scsi/aic7xxx.c */#endifchar *ahc_name(struct ahc_softc *ahc);struct ahc_softc* ahc_alloc(int unit, u_int32_t io_base, vm_offset_t maddr, bus_dma_tag_t parent_dmat, ahc_chip chip, ahc_feature features, ahc_flag flags, struct scb_data *scb_data);int ahc_reset(struct ahc_softc *ahc);void ahc_free(struct ahc_softc *);int ahc_probe_scbs(struct ahc_softc *);int ahc_init(struct ahc_softc *);int ahc_attach(struct ahc_softc *);void ahc_intr(void *arg);#define ahc_inb(ahc, port) \ bus_space_read_1((ahc)->tag, (ahc)->bsh, port)#define ahc_outb(ahc, port, value) \ bus_space_write_1((ahc)->tag, (ahc)->bsh, port, value)#define ahc_outsb(ahc, port, valp, count) \ bus_space_write_multi_1((ahc)->tag, (ahc)->bsh, port, valp, count)#endif /* _AIC7XXX_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?