Annotation of coherent/f/usr/include/sys/haiscsi.h, revision 1.1

1.1     ! root        1: /***********************************************************************
        !             2:  *  Module: haiscsi.h
        !             3:  *
        !             4:  *  Constants and structures used to access SCSI devices through the
        !             5:  *  SCSI Driver in a Host Adapter inspecific manner.
        !             6:  *
        !             7:  *  Copyright (c) 1993, Christopher Sean Hilton, All rights reserved.
        !             8:  *
        !             9:  *  Last Modified: Fri Jul 23 15:38:08 1993 by [chris]
        !            10:  *
        !            11:  */
        !            12: 
        !            13: #ifndef __SYS_HAISCSI_H__
        !            14: #define __SYS_HAISCSI_H__
        !            15: 
        !            16: #define SCSIMAJOR   13
        !            17: 
        !            18: #define MAXTID      7
        !            19: #define MAXDEVS     (MAXTID + 1)
        !            20: #define MAXLUN      7
        !            21: #define MAXUNITS    (MAXLUN + 1)
        !            22: 
        !            23: #define ST_GOOD     0x00    /* Status Good. */
        !            24: #define ST_CHKCOND  0x02    /* Check Condition */
        !            25: #define ST_CONDMET  0x04    /* Condition Met */
        !            26: #define ST_BUSY     0x08    /* Busy */
        !            27: #define ST_INTERM   0x10    /* Intermediate */
        !            28: #define ST_INTCDMET 0x14    /* Intermediate Condtion Met */
        !            29: #define ST_RESCONF  0x18    /* Reservation Conflict */
        !            30: #define ST_COMTERM  0x22    /* Command Terminated */
        !            31: #define ST_QFULL    0x28    /* Queue Full */
        !            32: 
        !            33: #define ST_TIMEOUT  0x0101  /* Command Timed out */
        !            34: #define ST_USRABRT  0x0102  /* User pressed ^C */
        !            35: #define ST_DRVABRT  0x0103  /* Command Aborted by driver */
        !            36: #define ST_HATMOUT  0x0201  /* Host adapter Timed out command */
        !            37: #define ST_PENDING  0xffff  /* Command Pending */
        !            38: 
        !            39: #define DMAREAD     0x0001  /* Command Reads from SCSI device */
        !            40: #define DMAWRITE    0x0002  /* Command Writes to SCSI device */
        !            41: 
        !            42: #define SENSELEN    18
        !            43: 
        !            44: #define PHYS_ADDR       0x0000      /* Physical Address - (who knows) */
        !            45: #define KRNL_ADDR       0x0001      /* Kernal Address */
        !            46: #define USER_ADDR       0x0002      /* User Address (Anything goes) */
        !            47: #define SYSGLBL_ADDR    0x0003      /* System Global address (yeah) */
        !            48: 
        !            49: /***** Minor Device Number Bits *****/
        !            50: 
        !            51: #define SPECIAL     0x80    /* Special Bit to flag boot block / Tape */
        !            52: #define TIDMASK     0x70
        !            53: #define LUNMASK     0x0c
        !            54: #define PARTMASK    0x03
        !            55: #define TAPE        0x01
        !            56: #define REWIND      0x02
        !            57: 
        !            58: #pragma align 1
        !            59: 
        !            60: typedef struct g0cmd_s *g0cmd_p;
        !            61: 
        !            62: typedef struct g0cmd_s {
        !            63:     unsigned char   opcode;     /* From opcode Table */
        !            64:     unsigned char   lun_lba;    /* LUN and high part of LBA */
        !            65:     unsigned char   lba_mid;    /* LBA Middle. */
        !            66:     unsigned char   lba_low;    /* LBA Low. */
        !            67:     unsigned char   xfr_len;    /* Transfer Length */
        !            68:     unsigned char   control;    /* Control byte. */
        !            69: } g0cmd_t;
        !            70: 
        !            71: typedef struct g1cmd_s *g1cmd_p;
        !            72: 
        !            73: typedef struct g1cmd_s {
        !            74:     unsigned char   opcode;     /* From opcode Table */
        !            75:     unsigned char   lun;        /* LUN */
        !            76:     unsigned long   lba;        /* LBA */
        !            77:     unsigned char   pad1;       /* Reserved */
        !            78:     unsigned short  xfr_len;    /* Transfer Length's MSB. */
        !            79:     unsigned char   control;    /* Control byte. */
        !            80: } g1cmd_t;
        !            81: 
        !            82: #define g2cmd_t g1cmd_t         /* SCSI-2 Added Group 2 commands */
        !            83: #define g2cmd_s g1cmd_s         /* with the same size and layout as */
        !            84: #define g2cmd_p g1cmd_p         /* g1 commands. */
        !            85: 
        !            86: typedef struct g5cmd_s *g5cmd_p;
        !            87: 
        !            88: typedef struct g5cmd_s {
        !            89:     unsigned char   opcode;     /* From opcode Table */
        !            90:     unsigned char   lun;        /* LUN */
        !            91:     unsigned long   lba;        /* LBA's MSB */
        !            92:     unsigned char   pad1[3];    /* Reserved */
        !            93:     unsigned short  xfr_len;    /* Transfer Length */
        !            94:     unsigned char   control;    /* Control byte. */
        !            95: } g5cmd_t;
        !            96: 
        !            97: typedef union cdb_u *cdb_p;
        !            98: 
        !            99: typedef union cdb_u {
        !           100:     g0cmd_t g0;
        !           101:     g1cmd_t g1;
        !           102:     g5cmd_t g5;
        !           103: } cdb_t;
        !           104: 
        !           105: typedef struct sense_s *sense_p;
        !           106: 
        !           107: typedef struct sense_s {
        !           108:     unsigned char   errorcode;  /* Error Code:  0x0? */
        !           109:     unsigned char   lba_msb;    /* LSB's MS 5 Bits */
        !           110:     unsigned char   lba_mid;    /*       Middle 8 bits */
        !           111:     unsigned char   lba_lsb;    /*       LS 8 Bits */
        !           112: } sense_t;
        !           113: 
        !           114: typedef struct extsense_s *extsense_p;
        !           115: 
        !           116: typedef struct extsense_s {
        !           117:     unsigned char   errorcode;      /* Error Code (70H) */
        !           118:     unsigned char   segmentnum;     /* Number of current segment descriptor */
        !           119:     unsigned char   sensekey;       /* Sense Key(See bit definitions too) */
        !           120:     long            info;           /* Information MSB */
        !           121:     unsigned char   addlen;         /* Additional Sense Length */
        !           122:     unsigned char   addbytes[1];    /* Additional Sense unsigned chars */
        !           123: } extsense_t;
        !           124: 
        !           125: #ifdef __KERNEL__
        !           126: /***** Device Control Array *****/
        !           127: 
        !           128: typedef struct dca_s *dca_p;
        !           129: 
        !           130: typedef struct dca_s {
        !           131:     int (*d_open)();            /* open routine for device */
        !           132:     int (*d_close)();           /* close routine */
        !           133:     int (*d_block)();           /* Block request routine (Strategy) */
        !           134:     int (*d_read)();            /* Character Read routine */
        !           135:     int (*d_write)();           /* Character Write routine */
        !           136:     int (*d_ioctl)();           /* I/O Control routine */
        !           137:     int (*d_load)();            /* Load or Init routine */
        !           138:     int (*d_unload)();          /* Unload routine */
        !           139:     int (*d_poll)();            /* Poll routine */
        !           140: } dca_t;
        !           141: 
        !           142: typedef struct bufaddr_s *bufaddr_p;
        !           143: 
        !           144: typedef struct bufaddr_s {
        !           145:     int             space;      /* Address space */
        !           146:     union {
        !           147:         paddr_t     paddr;      /* Physical Address */
        !           148:         caddr_t     caddr;      /* Virtual Address */
        !           149:     } addr;
        !           150:     size_t          size;       /* Size of buffer */
        !           151: } bufaddr_t;
        !           152: 
        !           153: typedef struct srb_s *srb_p;    /* SCSI Request Block */
        !           154: 
        !           155: typedef struct srb_s {
        !           156:     unsigned short  status;     /* SCSI Status Byte */
        !           157:     unsigned short  hastat;     /* Host Adapter Status Byte */
        !           158:     dev_t           dev;        /* Device number (major/minor) */
        !           159:     unsigned char   target;     /* Target ID */
        !           160:     unsigned char   lun;        /* Logical Unit Number */
        !           161:     unsigned short  tries;      /* Current tries */
        !           162:     unsigned short  timeout;    /* Seconds til timeout */
        !           163:     bufaddr_t       buf;        /* Buffer to use */
        !           164:     unsigned short  xferdir;    /* Transfer Direction */
        !           165:     int             (*cleanup)();   /* Cleanup Function. */
        !           166:     cdb_t           cdb;        /* Command to execute */
        !           167:     char            sensebuf[SENSELEN];
        !           168: } srb_t;
        !           169: 
        !           170: #pragma align
        !           171: 
        !           172: #ifdef HA_MODULE
        !           173: extern dca_p mdca[MAXDEVS];
        !           174: #else
        !           175: extern int hapresent;
        !           176: #endif
        !           177: 
        !           178: /***********************************************************************
        !           179:  *  Host Adapter routines.
        !           180:  *
        !           181:  *  These must be defined by the host adapter module.  For each individual
        !           182:  *  routine's functionality see the host adapter module aha154x.c.
        !           183:  */
        !           184: 
        !           185: extern void hatimer();
        !           186: extern void haintr();
        !           187: extern int hainit();
        !           188: extern int startscsi();
        !           189: extern void abortscsi();
        !           190: extern void resetdevice();
        !           191: extern void haihdgeta();
        !           192: extern void haihdseta();
        !           193: 
        !           194: extern char iofailmsg[];
        !           195: extern int  HAI_HAID;
        !           196: 
        !           197: #define bit(n)          (1 << (n))
        !           198: #define tid(d)          (((d) & TIDMASK) >> 4)
        !           199: #define lun(d)          (((d) & LUNMASK) >> 2)
        !           200: #define partn(d)        (((d) & SPECIAL) ? 4 : ((d) & PARTMASK))
        !           201: 
        !           202: char *swapbytes();
        !           203: #define flip(o)         swapbytes(&(o), sizeof(o))
        !           204: int cpycdb();
        !           205: void reqsense();
        !           206: void doscsi();
        !           207: void printsense();
        !           208: int printerror();
        !           209: void haiioctl();
        !           210: void hainonblk();
        !           211: #endif /* KERNEL */
        !           212: 
        !           213: #endif /* !defined( __SYS_HAISCSI_H__ ) */
        !           214: 
        !           215: /* End of file */

unix.superglobalmegacorp.com

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