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/sym/sym_fw.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 /*-
    2  *  Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 
    3  *  PCI-SCSI controllers.
    4  *
    5  *  Copyright (C) 1999-2001  Gerard Roudier <groudier@free.fr>
    6  *
    7  *  This driver also supports the following Symbios/LSI PCI-SCSI chips:
    8  *      53C810A, 53C825A, 53C860, 53C875, 53C876, 53C885, 53C895,
    9  *      53C810,  53C815,  53C825 and the 53C1510D is 53C8XX mode.
   10  *
   11  *  
   12  *  This driver for FreeBSD-CAM is derived from the Linux sym53c8xx driver.
   13  *  Copyright (C) 1998-1999  Gerard Roudier
   14  *
   15  *  The sym53c8xx driver is derived from the ncr53c8xx driver that had been 
   16  *  a port of the FreeBSD ncr driver to Linux-1.2.13.
   17  *
   18  *  The original ncr driver has been written for 386bsd and FreeBSD by
   19  *          Wolfgang Stanglmeier        <wolf@cologne.de>
   20  *          Stefan Esser                <se@mi.Uni-Koeln.de>
   21  *  Copyright (C) 1994  Wolfgang Stanglmeier
   22  *
   23  *  The initialisation code, and part of the code that addresses 
   24  *  FreeBSD-CAM services is based on the aic7xxx driver for FreeBSD-CAM 
   25  *  written by Justin T. Gibbs.
   26  *
   27  *  Other major contributions:
   28  *
   29  *  NVRAM detection and reading.
   30  *  Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
   31  *
   32  *-----------------------------------------------------------------------------
   33  *
   34  * Redistribution and use in source and binary forms, with or without
   35  * modification, are permitted provided that the following conditions
   36  * are met:
   37  * 1. Redistributions of source code must retain the above copyright
   38  *    notice, this list of conditions and the following disclaimer.
   39  * 2. Redistributions in binary form must reproduce the above copyright
   40  *    notice, this list of conditions and the following disclaimer in the
   41  *    documentation and/or other materials provided with the distribution.
   42  * 3. The name of the author may not be used to endorse or promote products
   43  *    derived from this software without specific prior written permission.
   44  *
   45  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
   46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   48  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
   49  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   55  * SUCH DAMAGE.
   56  */
   57 
   58 /* $FreeBSD: releng/8.3/sys/dev/sym/sym_fw.h 179029 2008-05-15 20:27:18Z marius $ */
   59 
   60 #ifndef SYM_FW_H
   61 #define SYM_FW_H
   62 /*
   63  *  Macro used to generate interfaces for script A.
   64  */
   65 #define SYM_GEN_FW_A(s)                                                 \
   66         SYM_GEN_A(s, start)             SYM_GEN_A(s, getjob_begin)      \
   67         SYM_GEN_A(s, getjob_end)                                        \
   68         SYM_GEN_A(s, select)            SYM_GEN_A(s, wf_sel_done)       \
   69         SYM_GEN_A(s, send_ident)                                        \
   70         SYM_GEN_A(s, dispatch)          SYM_GEN_A(s, init)              \
   71         SYM_GEN_A(s, clrack)            SYM_GEN_A(s, complete_error)    \
   72         SYM_GEN_A(s, done)              SYM_GEN_A(s, done_end)          \
   73         SYM_GEN_A(s, idle)              SYM_GEN_A(s, ungetjob)          \
   74         SYM_GEN_A(s, reselect)                                          \
   75         SYM_GEN_A(s, resel_tag)         SYM_GEN_A(s, resel_dsa)         \
   76         SYM_GEN_A(s, resel_no_tag)                                      \
   77         SYM_GEN_A(s, data_in)           SYM_GEN_A(s, data_in2)          \
   78         SYM_GEN_A(s, data_out)          SYM_GEN_A(s, data_out2)         \
   79         SYM_GEN_A(s, pm0_data)          SYM_GEN_A(s, pm1_data)
   80 
   81 /*
   82  *  Macro used to generate interfaces for script B.
   83  */
   84 #define SYM_GEN_FW_B(s)                                                 \
   85         SYM_GEN_B(s, no_data)                                           \
   86         SYM_GEN_B(s, sel_for_abort)     SYM_GEN_B(s, sel_for_abort_1)   \
   87         SYM_GEN_B(s, msg_bad)           SYM_GEN_B(s, msg_weird)         \
   88         SYM_GEN_B(s, wdtr_resp)         SYM_GEN_B(s, send_wdtr)         \
   89         SYM_GEN_B(s, sdtr_resp)         SYM_GEN_B(s, send_sdtr)         \
   90         SYM_GEN_B(s, ppr_resp)          SYM_GEN_B(s, send_ppr)          \
   91         SYM_GEN_B(s, nego_bad_phase)                                    \
   92         SYM_GEN_B(s, ident_break)       SYM_GEN_B(s, ident_break_atn)   \
   93         SYM_GEN_B(s, sdata_in)          SYM_GEN_B(s, resel_bad_lun)     \
   94         SYM_GEN_B(s, bad_i_t_l)         SYM_GEN_B(s, bad_i_t_l_q)       \
   95         SYM_GEN_B(s, wsr_ma_helper)                                     \
   96         SYM_GEN_B(s, snooptest)         SYM_GEN_B(s, snoopend)
   97 
   98 /*
   99  *  Generates structure interface that contains 
  100  *  offsets within script A and script B.
  101  */
  102 #define SYM_GEN_A(s, label)     s label;
  103 #define SYM_GEN_B(s, label)     s label;
  104 struct sym_fwa_ofs {
  105         SYM_GEN_FW_A(u_short)
  106 };
  107 struct sym_fwb_ofs {
  108         SYM_GEN_FW_B(u_short)
  109         SYM_GEN_B(u_short, start64)
  110         SYM_GEN_B(u_short, pm_handle)
  111 };
  112 
  113 /*
  114  *  Generates structure interface that contains 
  115  *  bus addresses within script A and script B.
  116  */
  117 struct sym_fwa_ba {
  118         SYM_GEN_FW_A(u32)
  119 };
  120 struct sym_fwb_ba {
  121         SYM_GEN_FW_B(u32)
  122         SYM_GEN_B(u32, start64)
  123         SYM_GEN_B(u32, pm_handle)
  124 };
  125 #undef  SYM_GEN_A
  126 #undef  SYM_GEN_B
  127 
  128 /*
  129  *  Let cc know about the name of the controller data structure.
  130  *  We need this for function prototype declarations just below.
  131  */
  132 struct sym_hcb;
  133 
  134 /*
  135  *  Generic structure that defines a firmware.
  136  */ 
  137 struct sym_fw {
  138         const char      *name;  /* Name we want to print out    */
  139         const u32       *a_base;/* Pointer to script A template */
  140         int     a_size;         /* Size of script A             */
  141         const struct    sym_fwa_ofs
  142                 *a_ofs;         /* Useful offsets in script A   */
  143         const u32       *b_base;/* Pointer to script B template */
  144         int     b_size;         /* Size of script B             */
  145         const struct    sym_fwb_ofs
  146                 *b_ofs;         /* Useful offsets in script B   */
  147         /* Setup and patch methods for this firmware */
  148         void    (*setup)(struct sym_hcb *, const struct sym_fw *);
  149         void    (*patch)(struct sym_hcb *);
  150 };
  151 
  152 /*
  153  *  Macro used to declare a firmware.
  154  */
  155 #define SYM_FW_ENTRY(fw, name)                                  \
  156 {                                                               \
  157         name,                                                   \
  158         (const u32 *) &fw##a_scr, sizeof(fw##a_scr), &fw##a_ofs,\
  159         (const u32 *) &fw##b_scr, sizeof(fw##b_scr), &fw##b_ofs,\
  160         fw##_setup, fw##_patch                                  \
  161 }
  162 
  163 /*
  164  *  Macros used from the C code to get useful
  165  *  SCRIPTS bus addresses.
  166  */
  167 #define SCRIPTA_BA(np, label)   (np->fwa_bas.label)
  168 #define SCRIPTB_BA(np, label)   (np->fwb_bas.label)
  169 #define SCRIPTB0_BA(np,label)   \
  170         (np->scriptb0_ba + (np->fwb_bas.label - np->scriptb_ba))
  171 
  172 /*
  173  *  Macros used by scripts definitions.
  174  *
  175  *  HADDR_1 generates a reference to a field of the controller data.
  176  *  HADDR_2 generates a reference to a field of the controller data
  177  *          with offset.
  178  *  RADDR_1 generates a reference to a script processor register.
  179  *  RADDR_2 generates a reference to a script processor register
  180  *          with offset.
  181  *  PADDR_A generates a reference to another part of script A.
  182  *  PADDR_B generates a reference to another part of script B.
  183  *
  184  *  SYM_GEN_PADDR_A and SYM_GEN_PADDR_B are used to define respectively 
  185  *  the PADDR_A and PADDR_B macros for each firmware by setting argument 
  186  *  `s' to the name of the corresponding structure.
  187  *
  188  *  SCR_DATA_ZERO is used to allocate a DWORD of data in scripts areas.
  189  */
  190 
  191 #define RELOC_SOFTC     0x40000000
  192 #define RELOC_LABEL_A   0x50000000
  193 #define RELOC_REGISTER  0x60000000
  194 #define RELOC_LABEL_B   0x80000000
  195 #define RELOC_MASK      0xf0000000
  196 
  197 #define HADDR_1(label)     (RELOC_SOFTC    | offsetof(struct sym_hcb, label))
  198 #define HADDR_2(label,ofs) (RELOC_SOFTC    | \
  199                                 (offsetof(struct sym_hcb, label)+(ofs)))
  200 #define RADDR_1(label)     (RELOC_REGISTER | REG(label))
  201 #define RADDR_2(label,ofs) (RELOC_REGISTER | ((REG(label))+(ofs)))
  202 
  203 #define SYM_GEN_PADDR_A(s, label) (RELOC_LABEL_A  | offsetof(s, label))
  204 #define SYM_GEN_PADDR_B(s, label) (RELOC_LABEL_B  | offsetof(s, label))
  205 
  206 #define SCR_DATA_ZERO   0xf00ff00f
  207 
  208 #endif  /* SYM_FW_H */

Cache object: 0d3ecbb903f12694efe785a8e3ebf6c4


[ 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.