1 /*
2 * Copyright (c) 2004-05 Applied Micro Circuits Corporation.
3 * Copyright (c) 2004-05 Vinod Kashyap.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: releng/6.0/sys/dev/twa/tw_osl_share.h 147285 2005-06-11 00:14:23Z vkashyap $
28 */
29
30 /*
31 * AMCC'S 3ware driver for 9000 series storage controllers.
32 *
33 * Author: Vinod Kashyap
34 */
35
36
37
38 #ifndef TW_OSL_SHARE_H
39
40 #define TW_OSL_SHARE_H
41
42
43 /*
44 * Macros, structures and functions shared between OSL and CL,
45 * and defined by OSL.
46 */
47
48
49 #include <sys/param.h>
50 #include <sys/systm.h>
51 #include <sys/lock.h>
52 #include <sys/mutex.h>
53 #include <machine/endian.h>
54 #include <machine/stdarg.h>
55
56 #include "tw_osl_types.h"
57 #include "opt_twa.h"
58
59
60 #ifdef TWA_DEBUG
61 #define TW_OSL_DEBUG TWA_DEBUG
62 #endif
63
64 #ifdef TWA_FLASH_FIRMWARE
65 #define TW_OSL_FLASH_FIRMWARE
66 #endif
67
68 #define TW_OSL_DRIVER_VERSION_STRING "3.60.00.017"
69
70 #define TW_OSL_CAN_SLEEP
71
72 #ifdef TW_OSL_CAN_SLEEP
73 typedef TW_VOID *TW_SLEEP_HANDLE;
74 #endif /* TW_OSL_CAN_SLEEP */
75
76 /*#define TW_OSL_DMA_MEM_ALLOC_PER_REQUEST*/
77 #define TW_OSL_PCI_CONFIG_ACCESSIBLE
78
79 #if _BYTE_ORDER == _BIG_ENDIAN
80 #define TW_OSL_BIG_ENDIAN
81 #else
82 #define TW_OSL_LITTLE_ENDIAN
83 #endif
84
85 #ifdef TW_OSL_DEBUG
86 extern TW_INT32 TW_OSL_DEBUG_LEVEL_FOR_CL;
87 #endif /* TW_OSL_DEBUG */
88
89
90 /* Possible return codes from/to Common Layer functions. */
91 #define TW_OSL_ESUCCESS 0 /* success */
92 #define TW_OSL_EGENFAILURE 1 /* general failure */
93 #define TW_OSL_ENOMEM ENOMEM /* insufficient memory */
94 #define TW_OSL_EIO EIO /* I/O error */
95 #define TW_OSL_ETIMEDOUT ETIMEDOUT /* time out */
96 #define TW_OSL_ENOTTY ENOTTY /* invalid command */
97 #define TW_OSL_EBUSY EBUSY /* busy -- try later */
98 #define TW_OSL_EBIG EFBIG /* request too big */
99 #define TW_OSL_EWOULDBLOCK EWOULDBLOCK /* sleep timed out */
100 #define TW_OSL_ERESTART ERESTART /* sleep terminated by a signal */
101
102
103 #define tw_osl_breakpoint() breakpoint
104
105 #define tw_osl_cur_func() __func__
106
107 /*
108 * Submit any requests previously returned with TW_OSL_EBUSY.
109 * We don't use it as of now.
110 */
111 #define tw_osl_ctlr_ready(ctlr_handle)
112
113 #define tw_osl_destroy_lock(ctlr_handle, lock) \
114 mtx_destroy(lock)
115
116 #define tw_osl_free_lock(ctlr_handle, lock) \
117 mtx_unlock_spin(lock)
118
119 #define tw_osl_get_lock(ctlr_handle, lock) \
120 mtx_lock_spin(lock)
121
122 #define tw_osl_init_lock(ctlr_handle, lock_name, lock) \
123 mtx_init(lock, lock_name, NULL, MTX_SPIN)
124
125 #define tw_osl_memcpy(dest, src, size) bcopy(src, dest, size)
126 #define tw_osl_memzero bzero
127 #define tw_osl_sprintf sprintf
128 #define tw_osl_strcpy strcpy
129 #define tw_osl_strlen strlen
130 #define tw_osl_vsprintf vsprintf
131
132
133
134 #endif /* TW_OSL_SHARE_H */
Cache object: f82b89b76cf8f77636223958fbbf8d5c
|