2 * Copyright (c) 2010, LSI Corp.
4 * Author : Manjunath Ranganathaiah
5 * Support: freebsdraid@lsi.com
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 * $FreeBSD: src/sys/dev/tws/tws_services.h,v 1.3 2007/05/09 04:16:32 mrangana Exp $
38 /* #define TWS_DEBUG on */
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);
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);
52 void tws_init_qs(struct tws_softc *sc);
56 /* ----------------- trace ----------------- */
58 #define TWS_TRACE_ON on /* Alawys on - use wisely to trace errors */
61 #define TWS_TRACE_DEBUG_ON on
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)
69 #define TWS_TRACE_DEBUG(sc, desc, val1, val2)
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)
77 #define TWS_TRACE(sc, desc, val1, val2)
80 /* ---------------- logging ---------------- */
83 /* ---------------- logging ---------------- */
97 TWS_CTLR_INIT_FAILURE,
104 _DEBUG, /* XXX swildner: conflict with DEBUG option */
109 u_int32_t error_code;
115 extern struct error_desc array[];
116 /* ----------- q services ------------- */
119 #define TWS_PENDING_Q 1
121 #define TWS_COMPLETE_Q 3
123 #define TWS_REQ_SUBMIT_SUCCESS 0
124 /* req error codes */
125 #define TWS_REQ_ERR_INPROGRESS 1
126 #define TWS_REQ_ERR_PEND_NOMFA 2
127 #define TWS_REQ_REQUEUE 3
129 #define TWS_REQ_ERR_INVALID 0xdead
132 /* ------------------------ */
133 #define TWS_LOCAL_TIME (time_second - (tz.tz_minuteswest * 60) - \
134 (wall_cmos_clock ? adjkerntz : 0))