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/tws/tws_services.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  * Copyright (c) 2010, LSI Corp.
    3  * All rights reserved.
    4  * Author : Manjunath Ranganathaiah
    5  * Support: freebsdraid@lsi.com
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  *
   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
   15  *    the documentation and/or other materials provided with the
   16  *    distribution.
   17  * 3. Neither the name of the <ORGANIZATION> nor the names of its
   18  *    contributors may be used to endorse or promote products derived
   19  *    from this software without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   32  * POSSIBILITY OF SUCH DAMAGE.
   33  *
   34  * $FreeBSD: releng/11.2/sys/dev/tws/tws_services.h 331722 2018-03-29 02:50:57Z eadler $
   35  */
   36 
   37 
   38 /* #define TWS_DEBUG on */
   39 
   40 void tws_trace(const char *file, const char *fun, int linenum,
   41          struct tws_softc *sc,  char *desc, u_int64_t val1, u_int64_t val2);
   42 void tws_log(struct tws_softc *sc, int index);
   43 u_int32_t tws_read_reg(struct tws_softc *sc, 
   44                   int offset, int size);
   45 void tws_write_reg(struct tws_softc *sc, int offset,
   46                   u_int32_t value, int size);
   47 
   48 u_int16_t tws_swap16(u_int16_t val);
   49 u_int32_t tws_swap32(u_int32_t val);
   50 u_int64_t tws_swap64(u_int64_t val);
   51 
   52 void tws_init_qs(struct tws_softc *sc);
   53 
   54 
   55 
   56 /* ----------------- trace ----------------- */
   57 
   58 #define TWS_TRACE_ON on /* Alawys on - use wisely to trace errors */
   59 
   60 #ifdef TWS_DEBUG
   61     #define TWS_TRACE_DEBUG_ON on
   62 #endif
   63 
   64 #ifdef TWS_TRACE_DEBUG_ON
   65     #define TWS_TRACE_DEBUG(sc, desc, val1, val2) \
   66             tws_trace(__FILE__, __func__, __LINE__, sc, desc, \
   67                                    (u_int64_t)val1, (u_int64_t)val2)
   68 #else
   69     #define TWS_TRACE_DEBUG(sc, desc, val1, val2)
   70 #endif
   71 
   72 #ifdef TWS_TRACE_ON
   73     #define TWS_TRACE(sc, desc, val1, val2) \
   74             tws_trace(__FILE__, __func__, __LINE__, sc, desc, \
   75                                    (u_int64_t)val1, (u_int64_t)val2)
   76 #else
   77     #define TWS_TRACE(sc, desc, val1, val2)
   78 #endif
   79 
   80 /* ---------------- logging ---------------- */
   81 
   82 
   83 /* ---------------- logging ---------------- */
   84 enum error_index {
   85     SYSCTL_TREE_NODE_ADD,
   86     PCI_COMMAND_READ,
   87     ALLOC_MEMORY_RES,
   88     ALLOC_IRQ_RES,
   89     SETUP_INTR_RES,
   90     TWS_CAM_ATTACH,
   91     CAM_SIMQ_ALLOC,
   92     CAM_SIM_ALLOC,
   93     TWS_XPT_BUS_REGISTER,
   94     TWS_XPT_CREATE_PATH,
   95     TWS_BUS_SCAN_REQ,
   96     TWS_INIT_FAILURE,
   97     TWS_CTLR_INIT_FAILURE,
   98 };
   99 
  100 enum severity {
  101     ERROR = 1,
  102     WARNING,
  103     INFO,
  104 #if 0
  105     DEBUG,
  106 #endif
  107 };
  108 
  109 struct error_desc {
  110     char desc[256];
  111     u_int32_t error_code;
  112     int severity_level;
  113     char *fmt;
  114     char *error_str;
  115 };
  116 
  117 /* ----------- q services ------------- */
  118 
  119 #define TWS_FREE_Q        0
  120 #define TWS_PENDING_Q     1
  121 #define TWS_BUSY_Q        2
  122 #define TWS_COMPLETE_Q    3
  123 
  124 /* req return codes */
  125 #define TWS_REQ_RET_SUBMIT_SUCCESS 0
  126 #define TWS_REQ_RET_PEND_NOMFA     1
  127 #define TWS_REQ_RET_RESET          2
  128 #define TWS_REQ_RET_INVALID   0xdead
  129 
  130 
  131 /* ------------------------ */
  132 #if (__FreeBSD_version >= 700000)
  133 #include <sys/clock.h>
  134 #define TWS_LOCAL_TIME (time_second - utc_offset())
  135 #else
  136 #include <machine/clock.h>
  137 #define TWS_LOCAL_TIME (time_second - (tz_minuteswest * 60) -   \
  138                   (wall_cmos_clock ? adjkerntz : 0))
  139 #endif
  140 

Cache object: c11fc487df5e73d37f0f0bf0cf06eefc


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