[BACK]Return to amivar.h CVS log [TXT][DIR] Up to [local] / sys / dev / ic

Annotation of sys/dev/ic/amivar.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: amivar.h,v 1.52 2007/03/22 16:55:31 deraadt Exp $     */
                      2:
                      3: /*
                      4:  * Copyright (c) 2001 Michael Shalayeff
                      5:  * Copyright (c) 2005 Marco Peereboom
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  *
                     17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     18:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     19:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     20:  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
                     21:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
                     22:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     23:  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
                     25:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
                     26:  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
                     27:  * THE POSSIBILITY OF SUCH DAMAGE.
                     28:  */
                     29:
                     30: #include <sys/sensors.h>
                     31:
                     32: struct ami_mem {
                     33:        bus_dmamap_t            am_map;
                     34:        bus_dma_segment_t       am_seg;
                     35:        size_t                  am_size;
                     36:        caddr_t                 am_kva;
                     37: };
                     38:
                     39: #define AMIMEM_MAP(_am)                ((_am)->am_map)
                     40: #define AMIMEM_DVA(_am)                ((_am)->am_map->dm_segs[0].ds_addr)
                     41: #define AMIMEM_KVA(_am)                ((void *)(_am)->am_kva)
                     42:
                     43: struct ami_ccbmem {
                     44:        struct ami_passthrough  cd_pt;
                     45:        struct ami_sgent        cd_sg[AMI_SGEPERCMD];
                     46: };
                     47:
                     48: struct ami_softc;
                     49:
                     50: struct ami_ccb {
                     51:        struct ami_softc        *ccb_sc;
                     52:
                     53:        struct ami_iocmd        ccb_cmd;
                     54:        struct ami_passthrough  *ccb_pt;
                     55:        paddr_t                 ccb_ptpa;
                     56:        struct ami_sgent        *ccb_sglist;
                     57:        paddr_t                 ccb_sglistpa;
                     58:        int                     ccb_offset;
                     59:        bus_dmamap_t            ccb_dmamap;
                     60:
                     61:        struct scsi_xfer        *ccb_xs;
                     62:        void                    (*ccb_done)(struct ami_softc *sc,
                     63:                                    struct ami_ccb *ccb);
                     64:
                     65:        volatile enum {
                     66:                AMI_CCB_FREE,
                     67:                AMI_CCB_READY,
                     68:                AMI_CCB_QUEUED,
                     69:                AMI_CCB_PREQUEUED
                     70:        }                       ccb_state;
                     71:        int                     ccb_flags;
                     72: #define AMI_CCB_F_ERR                  (1<<0)
                     73:        TAILQ_ENTRY(ami_ccb)    ccb_link;
                     74: };
                     75:
                     76: TAILQ_HEAD(ami_ccb_list, ami_ccb);
                     77:
                     78: struct ami_rawsoftc {
                     79:        struct scsi_link        sc_link;
                     80:        struct ami_softc        *sc_softc;
                     81:        u_int8_t                sc_channel;
                     82:
                     83:        int                     sc_proctarget;  /* ses/safte target id */
                     84:        char                    sc_procdev[16]; /* ses/safte device */
                     85: };
                     86:
                     87: struct ami_softc {
                     88:        struct device           sc_dev;
                     89:        void                    *sc_ih;
                     90:        struct scsi_link        sc_link;
                     91:
                     92:        int                     sc_flags;
                     93: #define AMI_CHECK_SIGN 0x0001
                     94: #define AMI_BROKEN     0x0002
                     95: #define AMI_QUARTZ     0x0008
                     96:
                     97:        /* low-level interface */
                     98:        int                     (*sc_init)(struct ami_softc *sc);
                     99:        int                     (*sc_exec)(struct ami_softc *sc,
                    100:                                    struct ami_iocmd *);
                    101:        int                     (*sc_done)(struct ami_softc *sc,
                    102:                                    struct ami_iocmd *);
                    103:        int                     (*sc_poll)(struct ami_softc *sc,
                    104:                                    struct ami_iocmd *);
                    105:        int                     (*sc_ioctl)(struct device *, u_long, caddr_t);
                    106:
                    107:        bus_space_tag_t         sc_iot;
                    108:        bus_space_handle_t      sc_ioh;
                    109:        bus_dma_tag_t           sc_dmat;
                    110:
                    111:        struct ami_mem          *sc_mbox_am;
                    112:        volatile struct ami_iocmd *sc_mbox;
                    113:        paddr_t                 sc_mbox_pa;
                    114:
                    115:        struct ami_ccb          *sc_ccbs;
                    116:        struct ami_ccb_list     sc_ccb_freeq, sc_ccb_preq, sc_ccb_runq;
                    117:
                    118:        struct ami_mem          *sc_ccbmem_am;
                    119:
                    120:        int                     sc_timeout;
                    121:        struct timeout          sc_run_tmo;
                    122:        int                     sc_dis_poll;
                    123:
                    124:        struct rwlock           sc_lock;
                    125:
                    126:        char                    sc_fwver[16];
                    127:        char                    sc_biosver[16];
                    128:        int                     sc_maxcmds;
                    129:        int                     sc_memory;
                    130:        int                     sc_targets;
                    131:        int                     sc_channels;
                    132:        int                     sc_maxunits;
                    133:        int                     sc_nunits;
                    134:        struct {
                    135:                u_int8_t                hd_present;
                    136:                u_int8_t                hd_is_logdrv;
                    137:                u_int8_t                hd_prop;
                    138:                u_int8_t                hd_stat;
                    139:                u_int32_t               hd_size;
                    140:                char                    dev[16];
                    141:        }                       sc_hdr[AMI_BIG_MAX_LDRIVES];
                    142:        struct ami_rawsoftc     *sc_rawsoftcs;
                    143:
                    144:        struct ksensor          *sc_sensors;
                    145:        struct ksensordev       sc_sensordev;
                    146:        struct ami_big_diskarray *sc_bd;
                    147: };
                    148:
                    149: int  ami_attach(struct ami_softc *sc);
                    150: int  ami_intr(void *);
                    151:
                    152: int ami_quartz_init(struct ami_softc *sc);
                    153: int ami_quartz_exec(struct ami_softc *sc, struct ami_iocmd *);
                    154: int ami_quartz_done(struct ami_softc *sc, struct ami_iocmd *);
                    155: int ami_quartz_poll(struct ami_softc *sc, struct ami_iocmd *);
                    156:
                    157: int ami_schwartz_init(struct ami_softc *sc);
                    158: int ami_schwartz_exec(struct ami_softc *sc, struct ami_iocmd *);
                    159: int ami_schwartz_done(struct ami_softc *sc, struct ami_iocmd *);
                    160: int ami_schwartz_poll(struct ami_softc *sc, struct ami_iocmd *);
                    161:
                    162: #ifdef AMI_DEBUG
                    163: void ami_print_mbox(struct ami_iocmd *);
                    164: #endif /* AMI_DEBUG */

CVSweb