Annotation of XNU/osfmk/sys/sdi.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * @OSF_COPYRIGHT@
        !            24:  * 
        !            25:  */
        !            26: /*
        !            27:  * HISTORY
        !            28:  * 
        !            29:  * Revision 1.1.1.1  1998/09/22 21:05:48  wsanchez
        !            30:  * Import of Mac OS X kernel (~semeria)
        !            31:  *
        !            32:  * Revision 1.1.1.1  1998/03/07 02:25:59  wsanchez
        !            33:  * Import of OSF Mach kernel (~mburg)
        !            34:  *
        !            35:  * Revision 1.1.7.1  1996/09/17  16:34:56  bruel
        !            36:  *     removed size_t, already defined in types.h.
        !            37:  *     [96/09/17            bruel]
        !            38:  *
        !            39:  * Revision 1.1.4.1  1996/04/17  17:48:54  davidp
        !            40:  *     Created for use with SVR4 drivers.
        !            41:  *     [1996/04/11  13:19:26  davidp]
        !            42:  * 
        !            43:  * Revision 1.1.1.2  1996/03/04  17:53:46  calvert
        !            44:  *     Created for use with SVR4 drivers.
        !            45:  * 
        !            46:  * $EndLog$
        !            47:  */
        !            48: /* In vi use ":set ts=4" to edit/view this file
        !            49:  */
        !            50: #ifndef _SYS_SDI_H_
        !            51: #define _SYS_SDI_H_    1
        !            52: 
        !            53: #include "scsi/scsi_endian.h"
        !            54: 
        !            55: typedef u_long paddr_t;
        !            56: typedef u_int  rm_key_t;
        !            57: 
        !            58: typedef long   hba_clock_t;
        !            59: 
        !            60: typedef u_long major_t;
        !            61: typedef u_long minor_t;
        !            62: 
        !            63: typedef u_long hba_buf_t;      /* just to satisfy declaration */
        !            64: typedef u_long hba_uio_t;      /* just to satisfy declaration */
        !            65: 
        !            66: 
        !            67: struct ver_no {
        !            68:        uchar_t                 sv_release;
        !            69:        uchar_t                 sv_machine;
        !            70:        short                   sv_modes;
        !            71: };
        !            72: 
        !            73: struct hba_idata_v4 {
        !            74:        int                             version_num;
        !            75:        char                    *name;
        !            76:        uchar_t                 ha_id;
        !            77:        ulong_t                 ioaddr1;
        !            78:        int                             dmachan1;
        !            79:        int                             iov;
        !            80:        int                             cntlr;
        !            81:        int                             active;
        !            82:        ulong_t                 idata_memaddr;
        !            83:        uchar_t                 idata_ctlorder;
        !            84:        uchar_t                 idata_nbus;
        !            85:        ushort_t                idata_ntargets;
        !            86:        ushort_t                idata_nluns;
        !            87:        rm_key_t                idata_rmkey;
        !            88:        void                    *idata_intrcookie;
        !            89:        int                             idata_cpubind;
        !            90: };
        !            91: 
        !            92: struct hba_idata {
        !            93:        int                             version_num;
        !            94:        char                    *name;
        !            95:        uchar_t                 ha_id;
        !            96:        ulong_t                 ioaddr1;
        !            97:        int                             dmachan1;
        !            98:        int                             iov;
        !            99:        int                             cntlr;
        !           100:        int                             active;
        !           101: };
        !           102: 
        !           103: #define HBA_SVR4_2             1
        !           104: #define HBA_SVR4_2_2   2
        !           105: #define HBA_SVR4_2MP   3
        !           106: 
        !           107: #define HBA_VMASK              0xffff
        !           108: 
        !           109: #define HBA_IDATA_EXT  0x10000
        !           110: #define HBA_EXT_INFO   0x20000
        !           111: #define HBA_AUTOCONF   0x40000
        !           112: 
        !           113: #define VID_LEN                8
        !           114: #define PID_LEN                16
        !           115: #define REV_LEN                4
        !           116: 
        !           117: #define INQ_LEN                VID_LEN+PID_LEN+1
        !           118: #define INQ_EXLEN      INQ_LEN+REV_LEN
        !           119: 
        !           120: struct ident {
        !           121:        BITFIELD_2( unsigned char,
        !           122:                                        id_type : 5,
        !           123:                                        id_pqual : 3);
        !           124:        BITFIELD_2(unsigned char,
        !           125:                                        id_qualif : 7,
        !           126:                                        id_rmb : 1);
        !           127:        uchar_t                 id_ver;
        !           128:        BITFIELD_2(unsigned char,
        !           129:                                        id_form : 4,
        !           130:                                        id_res1 : 4);
        !           131:        uchar_t                 id_len;
        !           132:        uchar_t                 id_vu [3];
        !           133:        char                    id_vendor [VID_LEN];
        !           134:        char                    id_prod [PID_LEN];
        !           135:        char                    id_revnum [REV_LEN];
        !           136: };
        !           137: 
        !           138: #define SCSI_INQ_CON   0x0
        !           139: #define SCSI_INQ_TC            0x1
        !           140: #define SCSI_INQ_TNC   0x3
        !           141: 
        !           142: struct scsi_adr {
        !           143:        int     scsi_ctl;
        !           144:        int     scsi_target;
        !           145:        int     scsi_lun;
        !           146:        int     scsi_bus;
        !           147: };
        !           148: 
        !           149: struct scsi_ad {
        !           150:        ulong_t                 sa_major;
        !           151:        ulong_t                 sa_minor;
        !           152:        uchar_t                 sa_lun;
        !           153:        BITFIELD_2(unsigned char,
        !           154:                                        sa_bus : 3,
        !           155:                                        sa_exta : 5);
        !           156:        short                   sa_ct;
        !           157: };
        !           158: 
        !           159: /* sa_ct */
        !           160: #define SDI_SA_CT(c,t) (((c) << 3) | ((t) & 0x07))
        !           161: #define SDI_HAN(sa)            (((sa)->sa_ct >> 3) & 0x07)
        !           162: #define SDI_TCN(sa)            ((sa)->sa_ct & 0x07)
        !           163: 
        !           164: #define SDI_ETCN(sa)           ((sa)->sa_exta)
        !           165: #define SDI_EHAN(sa)           (((sa)->sa_ct >> 3) & 0x1f)
        !           166: 
        !           167: struct sdi_edt {
        !           168:        struct sdi_edt  *hash_p;
        !           169:        short                   hba_no;
        !           170:        uchar_t                 scsi_id;
        !           171:        uchar_t                 lun;
        !           172:        struct owner    *curdrv;
        !           173:        struct owner    *owner_list;
        !           174:        ulong_t                 res1;
        !           175:        int                             pdtype;
        !           176:        uchar_t                 iotype;
        !           177:        char                    inquiry [INQ_EXLEN];
        !           178:        struct scsi_adr scsi_adr;
        !           179:        ulong_t                 memaddr;
        !           180:        uchar_t                 ctlorder;
        !           181:        struct ident    edt_ident;
        !           182: };
        !           183: 
        !           184: /* iotype */
        !           185: #define F_DMA          0x001
        !           186: #define F_DMA_24       F_DMA
        !           187: #define F_PIO          0x002
        !           188: #define F_SCGTH                0x004
        !           189: #define F_RMB          0x008
        !           190: #define F_DMA_32       0x010
        !           191: #define F_HDWREA       0x020
        !           192: #define F_RESID                0x040
        !           193: 
        !           194: struct mod_operations {
        !           195:        int     (*modm_install)(void);
        !           196:        int     (*modm_remove)(void);
        !           197:        int     (*modm_info)(void);
        !           198:        int     (*modm_bind)(void);
        !           199: };
        !           200: 
        !           201: struct modlink {
        !           202:        struct mod_operations   *ml_ops;
        !           203:        void                                    *ml_type_data;
        !           204: };
        !           205: 
        !           206: struct mod_type_data {
        !           207:        char    *mtd_info;
        !           208:        void    *mtd_pdata;
        !           209: };
        !           210: 
        !           211: struct modwrapper {
        !           212:        int                             mw_rev;
        !           213:        int                             (*mw_load)(void);
        !           214:        int                             (*mw_unload)(void);
        !           215:        void                    (*mw_halt)(void);
        !           216:        void                    *mw_conf_data;
        !           217:        struct modlink  *mw_modlink;
        !           218: };
        !           219: 
        !           220: struct hbadata {
        !           221:        struct xsb *sb;
        !           222: };
        !           223: 
        !           224: typedef struct physreq {
        !           225:        paddr_t         phys_align;
        !           226:        paddr_t         phys_boundary;
        !           227:        uchar_t         phys_dmasize;
        !           228:        uchar_t         phys_max_scgth;
        !           229:        uchar_t         phys_flags;
        !           230:        void            *phys_brkup_poolp;
        !           231: } physreq_t;
        !           232: 
        !           233: 
        !           234: typedef struct bcb {
        !           235:        uchar_t         bcb_addrtypes;
        !           236:        uchar_t         bcb_flags;
        !           237:        size_t          bcb_max_xfer;
        !           238:        size_t          bcb_granularity;
        !           239:        physreq_t       *bcb_physreqp;
        !           240: } bcb_t;
        !           241: 
        !           242: struct hbagetinfo {
        !           243:        char    *name;
        !           244:        char    iotype;
        !           245:        bcb_t   *bcbp;
        !           246: };
        !           247: 
        !           248: struct hba_info {
        !           249:        int                             *hba_flag;
        !           250:        ulong_t                 max_xfer;
        !           251:        long                    (*hba_freeblk)(struct hbadata *hdp, int cntlr);
        !           252:        struct hbadata  *(*hba_getblk)(int flag, int cntlr);
        !           253:        long                    (*hba_icmd)(struct hbadata *hdp, int flag);
        !           254:        void                    (*hba_getinfo)(struct scsi_ad *sap,
        !           255:                                                struct hbagetinfo *hgip);
        !           256:        long                    (*hba_send)(struct hbadata *hdp, int flag);
        !           257:        int                             (*hba_xlat)(struct hbadata *hdp, int bflag, void *procp,
        !           258:                                                int flag);
        !           259:        int                             (*hba_open)(void);
        !           260:        int                             (*hba_close)(void);
        !           261:        int                             (*hba_ioctl)(void);
        !           262: };
        !           263: 
        !           264: /* hba_flag */
        !           265: #define HBA_MP         0x01
        !           266: #define HBA_HOT                0x02
        !           267: #define HBA_TIMEOUT    0x04
        !           268: 
        !           269: #define SC_EXHAN(minor)        (((minor) >> 5) & 0x1f)
        !           270: #define SC_EXTCN(minor)        ((((minor) >> 2) & 0x07) | ((minor >> 7) & 0x18))
        !           271: #define SC_EXLUN(minor)        (((minor) & 0x03) | ((minor>>10) & 0x1C))
        !           272: #define SC_BUS(minor)  (((minor) >> 15) & 0x07)
        !           273: 
        !           274: #define SC_MKMINOR(h,t,l,b)    ( \
        !           275:                                                                (((h) & 0x1f) << 5) | \
        !           276:                                                                (((t) & 0x07) << 2) | (((t) & 0x18) << 7) | \
        !           277:                                                                ((l) & 0x03) | (((l) & 0x1c) << 10) | \
        !           278:                                                                (((b) & 0x07) << 15) \
        !           279:                                                        )
        !           280: 
        !           281: #define SDI_NAMESZ             49
        !           282: 
        !           283: #define SM_POOLSIZE            28
        !           284: #define LG_POOLSIZE            (sizeof (struct xsb))
        !           285: 
        !           286: #define SCB_TYPE       1
        !           287: #define ISCB_TYPE      2
        !           288: #define SFB_TYPE       3
        !           289: 
        !           290: #define SCB_WRITE      0x00
        !           291: #define SCB_READ       0x01
        !           292: #define SCB_LINK       0x02
        !           293: #define SCB_HAAD       0x04
        !           294: #define SCB_PARTBLK    0x08
        !           295: 
        !           296: #define SDI_NOALLOC    0x00000000
        !           297: #define SDI_ASW                0x00000001
        !           298: #define SDI_LINKF0     0x00000002
        !           299: #define SDI_LINKF1     0x00000003
        !           300: #define SDI_QFLUSH     0xE0000004
        !           301: #define SDI_ABORT      0xF0000005
        !           302: #define SDI_RESET      0xF0000006
        !           303: #define SDI_CRESET     0xD0000007
        !           304: #define SDI_V2PERR     0xA0000008
        !           305: #define SDI_TIME       0xD0000009
        !           306: #define SDI_NOTEQ      0x8000000A
        !           307: #define SDI_HAERR      0xE000000B
        !           308: #define SDI_MEMERR     0xA000000C
        !           309: #define SDI_SBUSER     0xA000000D
        !           310: #define SDI_CKSTAT     0xD000000E
        !           311: #define SDI_SCBERR     0x8000000F
        !           312: #define SDI_OOS                0xA0000010
        !           313: #define SDI_NOSELE     0x90000011
        !           314: #define SDI_MISMAT     0x90000012
        !           315: #define SDI_PROGRES    0x00000013
        !           316: #define SDI_UNUSED     0x00000014
        !           317: #define SDI_ONEIC      0x80000017
        !           318: #define SDI_SFBERR     0x80000019
        !           319: #define SDI_TCERR      0x9000001A
        !           320: 
        !           321: #define SDI_ERROR      0x80000000
        !           322: #define SDI_RETRY      0x40000000
        !           323: #define SDI_MESS       0x20000000
        !           324: #define SDI_SUSPEND    0x10000000
        !           325: 
        !           326: #define SFB_NOPF               0x00
        !           327: #define SFB_RESETM             0x01
        !           328: #define SFB_ABORTM             0x02
        !           329: #define SFB_FLUSHR             0x03
        !           330: #define SFB_RESUME             0x04
        !           331: #define SFB_SUSPEND            0x05
        !           332: #define SFB_ADD_DEV            0x06
        !           333: #define SFB_RM_DEV             0x07
        !           334: #define SFB_PAUSE              0x08
        !           335: #define SFB_CONTINUE   0x09
        !           336: 
        !           337: #define SDI_386_AT             0x06
        !           338: #define SDI_386_MCA            0x07
        !           339: #define SDI_386_EISA   0x08
        !           340: 
        !           341: #define SDI_RET_OK             0
        !           342: #define SDI_RET_ERR            -1
        !           343: #define SDI_RET_RETRY  1
        !           344: 
        !           345: #define SDI_SEND               0x0081
        !           346: #define SDI_TRESET             0x0082
        !           347: #define SDI_BRESET             0x0084
        !           348: #define HA_VER                 0x0083
        !           349: #define SDI_RESERVE            0x0085
        !           350: #define SDI_RELEASE            0x0086
        !           351: #define SDI_RESTAT             0x0087
        !           352: #define HA_GETPARMS            0x008a
        !           353: #define IHA_GETPARMS   0x008b
        !           354: #define HA_SETPARMS            0x008c
        !           355: #define IHA_SETPARMS   0x008d
        !           356: #define HA_GETPPARMS   0x008e
        !           357: 
        !           358: struct sense {
        !           359:        uchar_t                 sd_pad0;
        !           360:        BITFIELD_2(unsigned char,
        !           361:                                        sd_errc : 7,
        !           362:                                        sd_valid : 1);
        !           363:        uchar_t                 sd_res1;
        !           364:        BITFIELD_5(unsigned char,
        !           365:                                        sd_key : 4,
        !           366:                                        sd_res2 : 1,
        !           367:                                        sd_ili : 1,
        !           368:                                        sd_eom : 1,
        !           369:                                        sd_fm : 1);
        !           370:        uint_t                  sd_ba;
        !           371:        uchar_t                 sd_len;
        !           372:        uchar_t                 sd_res3 [4];
        !           373:        uchar_t                 sd_sencode;
        !           374:        uchar_t                 sd_qualifier;
        !           375:        uchar_t                 sd_fru;
        !           376:        BITFIELD_5(unsigned char,
        !           377:                                        sd_bitpt : 3,
        !           378:                                        sd_bpv : 1,
        !           379:                                        sd_res4 : 2,
        !           380:                                        sd_cd : 1,
        !           381:                                        sd_res5 : 1);
        !           382:        uchar_t                 sd_field [2];
        !           383:        uchar_t                 sd_res6;
        !           384:        uchar_t                 sd_buffer;
        !           385:        uchar_t                 sd_res7 [2];
        !           386: };
        !           387: 
        !           388: 
        !           389: struct sb_extra {
        !           390:        struct sense    sb_sense;
        !           391: };
        !           392: 
        !           393: #define sc_priv                sc_extra
        !           394: 
        !           395: struct sb;
        !           396: 
        !           397: struct scb {
        !           398:        ulong_t                 sc_comp_code;
        !           399:        void                    *sc_extra;
        !           400:        void                    (*sc_int)(struct sb *sbp);
        !           401:        caddr_t                 sc_cmdpt;
        !           402:        caddr_t                 sc_datapt;
        !           403:        long                    sc_wd;
        !           404:        time_t                  sc_time;
        !           405:        struct scsi_ad  sc_dev;
        !           406:        ushort_t                sc_mode;
        !           407:        uchar_t                 sc_status;
        !           408:        char                    sc_fill;
        !           409:        struct sb               *sc_link;
        !           410:        long                    sc_cmdsz;
        !           411:        long                    sc_datasz;
        !           412:        long                    sc_resid;
        !           413:        hba_clock_t             sc_start;
        !           414: };
        !           415: 
        !           416: struct sfb {
        !           417:        ulong_t                 sf_comp_code;
        !           418:        char                    *sf_priv;
        !           419:        void                    (*sf_int)(struct sb *sbp);
        !           420:        struct scsi_ad  sf_dev;
        !           421:        ulong_t                 sf_func;
        !           422:        int                             sf_wd;
        !           423: };
        !           424: 
        !           425: struct sb {
        !           426:        ulong_t                 sb_type;
        !           427:        union {
        !           428:                struct scb      b_scb;
        !           429:                struct sfb      b_sfb;
        !           430:        } sb_b;
        !           431: };
        !           432: 
        !           433: #define SCB            sb_b.b_scb
        !           434: #define SFB            sb_b.b_sfb
        !           435: 
        !           436: struct xsb {
        !           437:        struct sb               sb;
        !           438:        struct hbadata  *hbadata_p;
        !           439:        struct owner    *owner_p;
        !           440:        struct sb_extra extra;
        !           441: };
        !           442: 
        !           443: #define S_GOOD         0X00
        !           444: #define S_CKCON                0X02
        !           445: #define S_METGD                0X04
        !           446: #define S_BUSY         0X08
        !           447: #define S_INGD         0X10
        !           448: #define S_INMET                0X12
        !           449: #define S_RESER                0X18
        !           450: #define S_CTERM                0x22
        !           451: #define S_QFULL                0x28
        !           452: 
        !           453: #define SLEEP                  0
        !           454: #define NOSLEEP                        1
        !           455: 
        !           456: #define KM_SLEEP               SLEEP
        !           457: #define KM_NOSLEEP             NOSLEEP
        !           458: #define KM_DMA                 2
        !           459: #define KM_REQ_DMA             4
        !           460: #define KM_PHYSCONTIG  8
        !           461: 
        !           462: struct mod_drvintr {
        !           463:        ushort_t        di_magic;
        !           464:        ushort_t        di_version;
        !           465:        char            *di_modname;
        !           466:        int                     *di_devflagp;
        !           467:        void            (*di_handler)(int vect);
        !           468:        void            *di_hook;
        !           469: };
        !           470: 
        !           471: #define MOD_INTR_MAGIC 0xEB13
        !           472: #define MOD_INTR_VER   1
        !           473: 
        !           474: struct o_mod_drvintr {
        !           475:        struct intr_info        *drv_intrinfo;
        !           476:        void                            (*ihndler)(int vect);
        !           477: };
        !           478: 
        !           479: #define MOD_INTRVER_MASK       0xff000000
        !           480: #define MOD_INTRVER_42         0x01000000
        !           481: 
        !           482: #define INTRVER(infop) ((unsigned int)((infop)->ivect_no & MOD_INTRVER_MASK))
        !           483: #define INTRNO(infop)  ((infop)->ivect_no & ~MOD_INTRVER_MASK)
        !           484: 
        !           485: struct intr_info0 {
        !           486:        int     ivect_no;
        !           487:        int     int_pri;
        !           488:        int     itype;
        !           489: };
        !           490: 
        !           491: struct intr_info {
        !           492:        int     ivect_no;
        !           493:        int     int_pri;
        !           494:        int     itype;
        !           495:        int     int_cpu;
        !           496:        int     int_mp;
        !           497: };
        !           498: 
        !           499: #endif /* _SYS_SDI_H_ */

unix.superglobalmegacorp.com

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