Annotation of Gnu-Mach/linux/src/drivers/scsi/aha1542.h, revision 1.1.1.1

1.1       root        1: #ifndef _AHA1542_H
                      2: 
                      3: /* $Id: aha1542.h,v 1.1 1999/04/26 05:54:12 tb Exp $
                      4:  *
                      5:  * Header file for the adaptec 1542 driver for Linux
                      6:  *
                      7:  * $Log: aha1542.h,v $
                      8:  * Revision 1.1  1999/04/26 05:54:12  tb
                      9:  * 1998-11-30  OKUJI Yoshinori  <[email protected]>
                     10:  *
                     11:  *     Clean up linux emulation code to make it architecture-independent
                     12:  *     as much as possible.
                     13:  *
                     14:  *     * linux: Renamed from linuxdev.
                     15:  *     * Makefile.in (objfiles): Add linux.o instead of linuxdev.o.
                     16:  *     (MAKE): New variable. Used for the linux.o target.
                     17:  *     * configure.in: Add AC_CHECK_TOOL(MAKE, make).
                     18:  *     * i386/i386/spl.h: Include <i386/ipl.h>, for compatibility with
                     19:  *     OSF Mach 3.0. Suggested by Elgin Lee <[email protected]>.
                     20:  *     * linux/src: Renamed from linux/linux.
                     21:  *     * linux/dev: Renamed from linux/mach.
                     22:  *     * linux/Drivers.in (AC_INIT): Use dev/include/linux/autoconf.h,
                     23:  *     instead of mach/include/linux/autoconf.h.
                     24:  *     * Makefile.in (all): Target ../linux.o instead of ../linuxdev.o.
                     25:  *     * linux/dev/drivers/block/genhd.c: Include <machine/spl.h> instead
                     26:  *     of <i386/ipl.h>.
                     27:  *     * linux/dev/drivers/net/auto_irq.c: Remove unneeded header files,
                     28:  *     <i386/ipl.h> and <i386/pic.h>.
                     29:  *     * linux/dev/init/main.c: Many i386-dependent codes moved to ...
                     30:  *     * linux/dev/arch/i386/irq.c: ... here.
                     31:  *     * linux/dev/arch/i386/setup.c: New file.
                     32:  *     * linux/dev/arch/i386/linux_emul.h: Likewise.
                     33:  *     * linux/dev/arch/i386/glue/timer.c: Merged into sched.c.
                     34:  *     * linux/dev/arch/i386/glue/sched.c: Include <machine/spl.h> instead
                     35:  *     of <i386/ipl.h>, and moved to ...
                     36:  *     * linux/dev/kernel/sched.c: ... here.
                     37:  *     * linux/dev/arch/i386/glue/block.c: Include <machine/spl.h> and
                     38:  *     <linux_emul.h>, instead of i386-dependent header files, and
                     39:  *     moved to ...
                     40:  *     * linux/dev/glue/blocl.c: ... here.
                     41:  *     * linux/dev/arch/i386/glue/net.c: Include <machine/spl.h> and
                     42:  *     <linux_emul.h>, instead of i386-dependent header files, and
                     43:  *     moved to ...
                     44:  *     * linux/dev/glue/net.c: ... here.
                     45:  *     * linux/dev/arch/i386/glue/misc.c: Remove `x86' and moved to ...
                     46:  *     * linux/dev/glue/misc.c: ... here.
                     47:  *     * linux/dev/arch/i386/glue/kmem.c: Moved to ...
                     48:  *     * linux/dev/glue/kmem.c: ... here.
                     49:  *
                     50:  * Revision 1.1  1992/07/24  06:27:38  root
                     51:  * Initial revision
                     52:  *
                     53:  * Revision 1.2  1992/07/04  18:41:49  root
                     54:  * Replaced distribution with current drivers
                     55:  *
                     56:  * Revision 1.3  1992/06/23  23:58:20  root
                     57:  * Fixes.
                     58:  *
                     59:  * Revision 1.2  1992/05/26  22:13:23  root
                     60:  * Changed bug that prevented DMA above first 2 mbytes.
                     61:  *
                     62:  * Revision 1.1  1992/05/22  21:00:29  root
                     63:  * Initial revision
                     64:  *
                     65:  * Revision 1.1  1992/04/24  18:01:50  root
                     66:  * Initial revision
                     67:  *
                     68:  * Revision 1.1  1992/04/02  03:23:13  drew
                     69:  * Initial revision
                     70:  *
                     71:  * Revision 1.3  1992/01/27  14:46:29  tthorn
                     72:  * *** empty log message ***
                     73:  *
                     74:  */
                     75: 
                     76: #include <linux/types.h>
                     77: #include <linux/kdev_t.h>
                     78: 
                     79: /* I/O Port interface 4.2 */
                     80: /* READ */
                     81: #define STATUS(base) base
                     82: #define STST   0x80            /* Self Test in Progress */
                     83: #define DIAGF  0x40            /* Internal Diagnostic Failure */
                     84: #define INIT   0x20            /* Mailbox Initialization Required */
                     85: #define IDLE   0x10            /* SCSI Host Adapter Idle */
                     86: #define CDF    0x08            /* Command/Data Out Port Full */
                     87: #define DF     0x04            /* Data In Port Full */
                     88: #define INVDCMD        0x01            /* Invalid H A Command */
                     89: #define STATMASK 0xfd          /* 0x02 is reserved */
                     90: 
                     91: #define INTRFLAGS(base) (STATUS(base)+2)
                     92: #define ANYINTR        0x80            /* Any Interrupt */
                     93: #define SCRD   0x08            /* SCSI Reset Detected */
                     94: #define HACC   0x04            /* HA Command Complete */
                     95: #define MBOA   0x02            /* MBO Empty */
                     96: #define MBIF   0x01            /* MBI Full */
                     97: #define INTRMASK 0x8f
                     98: 
                     99: /* WRITE */
                    100: #define CONTROL(base) STATUS(base)
                    101: #define HRST   0x80            /* Hard Reset */
                    102: #define SRST   0x40            /* Soft Reset */
                    103: #define IRST   0x20            /* Interrupt Reset */
                    104: #define SCRST  0x10            /* SCSI Bus Reset */
                    105: 
                    106: /* READ/WRITE */
                    107: #define DATA(base) (STATUS(base)+1)
                    108: #define CMD_NOP                0x00    /* No Operation */
                    109: #define CMD_MBINIT     0x01    /* Mailbox Initialization */
                    110: #define CMD_START_SCSI 0x02    /* Start SCSI Command */
                    111: #define CMD_INQUIRY    0x04    /* Adapter Inquiry */
                    112: #define CMD_EMBOI      0x05    /* Enable MailBox Out Interrupt */
                    113: #define CMD_BUSON_TIME 0x07    /* Set Bus-On Time */
                    114: #define CMD_BUSOFF_TIME        0x08    /* Set Bus-Off Time */
                    115: #define CMD_DMASPEED   0x09    /* Set AT Bus Transfer Speed */
                    116: #define CMD_RETDEVS    0x0a    /* Return Installed Devices */
                    117: #define CMD_RETCONF    0x0b    /* Return Configuration Data */
                    118: #define CMD_RETSETUP   0x0d    /* Return Setup Data */
                    119: #define CMD_ECHO       0x1f    /* ECHO Command Data */
                    120: 
                    121: #define CMD_EXTBIOS     0x28    /* Return extend bios information only 1542C */
                    122: #define CMD_MBENABLE    0x29    /* Set Mailbox Interface enable only 1542C */
                    123: 
                    124: /* Mailbox Definition 5.2.1 and 5.2.2 */
                    125: struct mailbox {
                    126:   unchar status;               /* Command/Status */
                    127:   unchar ccbptr[3];            /* msb, .., lsb */
                    128: };
                    129: 
                    130: /* This is used with scatter-gather */
                    131: struct chain {
                    132:   unchar datalen[3];           /* Size of this part of chain */
                    133:   unchar dataptr[3];           /* Location of data */
                    134: };
                    135: 
                    136: /* These belong in scsi.h also */
                    137: #define any2scsi(up, p)                                \
                    138: (up)[0] = (((unsigned long)(p)) >> 16)  ;      \
                    139: (up)[1] = (((unsigned long)(p)) >> 8);         \
                    140: (up)[2] = ((unsigned long)(p));
                    141: 
                    142: #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
                    143: 
                    144: #define xany2scsi(up, p)       \
                    145: (up)[0] = ((long)(p)) >> 24;   \
                    146: (up)[1] = ((long)(p)) >> 16;   \
                    147: (up)[2] = ((long)(p)) >> 8;    \
                    148: (up)[3] = ((long)(p));
                    149: 
                    150: #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
                    151:                      + (((long)(up)[2]) <<  8) +  ((long)(up)[3]) )
                    152: 
                    153: #define MAX_CDB 12
                    154: #define MAX_SENSE 14
                    155: 
                    156: struct ccb {                   /* Command Control Block 5.3 */
                    157:   unchar op;                   /* Command Control Block Operation Code */
                    158:   unchar idlun;                        /* op=0,2:Target Id, op=1:Initiator Id */
                    159:                                /* Outbound data transfer, length is checked*/
                    160:                                /* Inbound data transfer, length is checked */
                    161:                                /* Logical Unit Number */
                    162:   unchar cdblen;               /* SCSI Command Length */
                    163:   unchar rsalen;               /* Request Sense Allocation Length/Disable */
                    164:   unchar datalen[3];           /* Data Length (msb, .., lsb) */
                    165:   unchar dataptr[3];           /* Data Pointer */
                    166:   unchar linkptr[3];           /* Link Pointer */
                    167:   unchar commlinkid;           /* Command Linking Identifier */
                    168:   unchar hastat;               /* Host Adapter Status (HASTAT) */
                    169:   unchar tarstat;              /* Target Device Status */
                    170:   unchar reserved[2];
                    171:   unchar cdb[MAX_CDB+MAX_SENSE];/* SCSI Command Descriptor Block */
                    172:                                /* REQUEST SENSE */
                    173: };
                    174: 
                    175: int aha1542_detect(Scsi_Host_Template *);
                    176: int aha1542_command(Scsi_Cmnd *);
                    177: int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
                    178: int aha1542_abort(Scsi_Cmnd *);
                    179: int aha1542_reset(Scsi_Cmnd *, unsigned int);
                    180: int aha1542_biosparam(Disk *, kdev_t, int*);
                    181: 
                    182: #define AHA1542_MAILBOXES 8
                    183: #define AHA1542_SCATTER 16
                    184: #define AHA1542_CMDLUN 1
                    185: 
                    186: #ifndef NULL
                    187:        #define NULL 0
                    188: #endif
                    189: 
                    190: extern struct proc_dir_entry proc_scsi_aha1542;
                    191: 
                    192: #define AHA1542 {  NULL, NULL,                         \
                    193:                      &proc_scsi_aha1542,/* proc_dir_entry */ \
                    194:                     NULL,                              \
                    195:                     "Adaptec 1542",                    \
                    196:                     aha1542_detect,                    \
                    197:                     NULL,                              \
                    198:                     NULL,                              \
                    199:                     aha1542_command,                   \
                    200:                     aha1542_queuecommand,              \
                    201:                     aha1542_abort,                     \
                    202:                     aha1542_reset,                     \
                    203:                     NULL,                              \
                    204:                     aha1542_biosparam,                 \
                    205:                     AHA1542_MAILBOXES,                 \
                    206:                     7,                                 \
                    207:                     AHA1542_SCATTER,                   \
                    208:                     AHA1542_CMDLUN,                    \
                    209:                     0,                                 \
                    210:                     1,                                 \
                    211:                     ENABLE_CLUSTERING}
                    212: 
                    213: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.