The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/mfivar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: mfivar.h,v 1.10.6.1 2010/03/28 15:03:22 snj Exp $ */
    2 /* $OpenBSD: mfivar.h,v 1.28 2006/08/31 18:18:46 marco Exp $ */
    3 /*
    4  * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
    5  *
    6  * Permission to use, copy, modify, and distribute this software for any
    7  * purpose with or without fee is hereby granted, provided that the above
    8  * copyright notice and this permission notice appear in all copies.
    9  *
   10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   17  */
   18 
   19 #include <dev/sysmon/sysmonvar.h>
   20 #include <sys/envsys.h>
   21 
   22 #define DEVNAME(_s)     (device_xname((_s)->sc_dev))
   23 
   24 /* #define MFI_DEBUG */
   25 #ifdef MFI_DEBUG
   26 extern uint32_t                 mfi_debug;
   27 #define DPRINTF(x...)           do { if (mfi_debug) printf(x); } while(0)
   28 #define DNPRINTF(n,x...)        do { if (mfi_debug & n) printf(x); } while(0)
   29 #define MFI_D_CMD               0x0001
   30 #define MFI_D_INTR              0x0002
   31 #define MFI_D_MISC              0x0004
   32 #define MFI_D_DMA               0x0008
   33 #define MFI_D_IOCTL             0x0010
   34 #define MFI_D_RW                0x0020
   35 #define MFI_D_MEM               0x0040
   36 #define MFI_D_CCB               0x0080
   37 #else
   38 #define DPRINTF(x, ...)
   39 #define DNPRINTF(n, x, ...)
   40 #endif
   41 
   42 struct mfi_mem {
   43         bus_dmamap_t            am_map;
   44         bus_dma_segment_t       am_seg;
   45         size_t                  am_size;
   46         void *                  am_kva;
   47 };
   48 
   49 #define MFIMEM_MAP(_am)         ((_am)->am_map)
   50 #define MFIMEM_DVA(_am)         ((_am)->am_map->dm_segs[0].ds_addr)
   51 #define MFIMEM_KVA(_am)         ((void *)(_am)->am_kva)
   52 
   53 struct mfi_prod_cons {
   54         uint32_t                mpc_producer;
   55         uint32_t                mpc_consumer;
   56         uint32_t                mpc_reply_q[1]; /* compensate for 1 extra reply per spec */
   57 };
   58 
   59 struct mfi_ccb {
   60         struct mfi_softc        *ccb_sc;
   61 
   62         union mfi_frame         *ccb_frame;
   63         paddr_t                 ccb_pframe;
   64         uint32_t                ccb_frame_size;
   65         uint32_t                ccb_extra_frames;
   66 
   67         struct mfi_sense        *ccb_sense;
   68         paddr_t                 ccb_psense;
   69 
   70         bus_dmamap_t            ccb_dmamap;
   71 
   72         union mfi_sgl           *ccb_sgl;
   73 
   74         /* data for sgl */
   75         void                    *ccb_data;
   76         uint32_t                ccb_len;
   77 
   78         uint32_t                ccb_direction;
   79 #define MFI_DATA_NONE   0
   80 #define MFI_DATA_IN     1
   81 #define MFI_DATA_OUT    2
   82 
   83         struct scsipi_xfer      *ccb_xs;
   84 
   85         void                    (*ccb_done)(struct mfi_ccb *);
   86 
   87         volatile enum {
   88                 MFI_CCB_FREE,
   89                 MFI_CCB_READY,
   90                 MFI_CCB_DONE
   91         }                       ccb_state;
   92         uint32_t                ccb_flags;
   93 #define MFI_CCB_F_ERR                   (1<<0)
   94         TAILQ_ENTRY(mfi_ccb)    ccb_link;
   95 };
   96 
   97 TAILQ_HEAD(mfi_ccb_list, mfi_ccb);
   98 
   99 enum mfi_iop {
  100         MFI_IOP_XSCALE,
  101         MFI_IOP_PPC,
  102         MFI_IOP_GEN2
  103 };
  104 
  105 struct mfi_iop_ops {
  106         uint32_t                (*mio_fw_state)(struct mfi_softc *);
  107         void                    (*mio_intr_ena)(struct mfi_softc *);
  108         int                     (*mio_intr)(struct mfi_softc *);
  109         void                    (*mio_post)(struct mfi_softc *, struct mfi_ccb *);
  110 };
  111 
  112 struct mfi_softc {
  113         device_t                sc_dev;
  114         struct scsipi_channel   sc_chan;
  115         struct scsipi_adapter   sc_adapt;
  116 
  117         const struct mfi_iop_ops *sc_iop;
  118 
  119         void                    *sc_ih;
  120 
  121         uint32_t                sc_flags;
  122 
  123         bus_space_tag_t         sc_iot;
  124         bus_space_handle_t      sc_ioh;
  125         bus_dma_tag_t           sc_dmat;
  126 
  127         /* save some useful information for logical drives that is missing
  128          * in sc_ld_list
  129          */
  130         struct {
  131                 uint32_t        ld_present;
  132                 char            ld_dev[16];     /* device name sd? */
  133         }                       sc_ld[MFI_MAX_LD];
  134 
  135         /* firmware determined max, totals and other information*/
  136         uint32_t                sc_max_cmds;
  137         uint32_t                sc_max_sgl;
  138         uint32_t                sc_max_ld;
  139         uint32_t                sc_ld_cnt;
  140         /* XXX these struct should be local to mgmt function */
  141         struct mfi_ctrl_info    sc_info;
  142         struct mfi_ld_list      sc_ld_list;
  143         struct mfi_ld_details   sc_ld_details;
  144 
  145         /* all commands */
  146         struct mfi_ccb          *sc_ccb;
  147 
  148         /* producer/consumer pointers and reply queue */
  149         struct mfi_mem          *sc_pcq;
  150 
  151         /* frame memory */
  152         struct mfi_mem          *sc_frames;
  153         uint32_t                sc_frames_size;
  154 
  155         /* sense memory */
  156         struct mfi_mem          *sc_sense;
  157 
  158         struct mfi_ccb_list     sc_ccb_freeq;
  159 
  160         struct sysmon_envsys    *sc_sme;
  161         envsys_data_t           *sc_sensor;
  162 
  163 };
  164 
  165 int     mfi_attach(struct mfi_softc *sc, enum mfi_iop);
  166 int     mfi_intr(void *);

Cache object: bc89a037b82251626566f6fbb53f73be


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.