13 * This file is part of the Chelsio T4 support code.
14 *
15 * Copyright (C) 2010-2013 Chelsio Communications. All rights reserved.
16 *
17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this
20 * release for licensing terms and conditions.
21 */
22
23 #ifndef __CXGBE_OSDEP_H
24 #define __CXGBE_OSDEP_H
25
26 #include <sys/ddi.h>
27 #include <sys/sunddi.h>
28 #include <sys/byteorder.h>
29 #include <sys/cmn_err.h>
30 #include <sys/pcie.h>
31 #include <sys/sysmacros.h>
32 #include <sys/inttypes.h>
33
34 /* sys/user.h defines u, and that bothers us. */
35 #undef u
36
37 #define isdigit(x) ((x) >= '0' && (x) <= '9')
38 #define isspace(x) ((x) == ' ' || (x) == '\t')
39 #define toupper(x) (((x) >= 'a' && (x) <= 'z') ? (x) - 'a' + 'A' : (x))
40 #define fls(x) ddi_fls(x)
41
42 #define CH_ERR(sc, ...) cxgb_printf(sc->dip, CE_WARN, ##__VA_ARGS__)
43 #define CH_WARN(sc, ...) cxgb_printf(sc->dip, CE_WARN, ##__VA_ARGS__)
44 #define CH_WARN_RATELIMIT(sc, ...) cxgb_printf(sc->dip, CE_WARN, ##__VA_ARGS__)
45 #define CH_ALERT(sc, ...) cxgb_printf(sc->dip, CE_NOTE, ##__VA_ARGS__)
46 #define CH_INFO(sc, ...) cxgb_printf(sc->dip, CE_NOTE, ##__VA_ARGS__)
47
48 #define CH_MSG(sc, level, category, fmt, ...)
49 #ifdef DEBUG
50 #define CH_DBG(sc, category, fmt, ...) cxgb_printf(sc->dip, CE_NOTE, ##__VA_ARGS__)
51 #else
52 #define CH_DBG(sc, category, fmt, ...)
169 typedef uint16_t u16;
170 typedef uint32_t u32;
171 typedef uint64_t u64;
172
173 typedef uint8_t __u8;
174 typedef uint16_t __u16;
175 typedef uint32_t __u32;
176 typedef uint64_t __u64;
177 typedef uint8_t __be8;
178 typedef uint16_t __be16;
179 typedef uint32_t __be32;
180 typedef uint64_t __be64;
181
182 typedef uint32_t __le32;
183
184 typedef int8_t s8;
185 typedef int16_t s16;
186 typedef int32_t s32;
187 typedef int64_t s64;
188
189 typedef boolean_t bool;
190 #define true B_TRUE
191 #define false B_FALSE
192
193 #if defined(__sparc)
194 #define __BIG_ENDIAN_BITFIELD
195 #define PAGE_SIZE 8192
196 #define PAGE_SHIFT 13
197 #define CACHE_LINE 64
198 #else
199 #define __LITTLE_ENDIAN_BITFIELD
200 #define PAGE_SIZE 4096
201 #define PAGE_SHIFT 12
202 #define CACHE_LINE 32
203 #endif
204
205 #define SUPPORTED_10baseT_Half (1 << 0)
206 #define SUPPORTED_10baseT_Full (1 << 1)
207 #define SUPPORTED_100baseT_Half (1 << 2)
208 #define SUPPORTED_100baseT_Full (1 << 3)
209 #define SUPPORTED_1000baseT_Half (1 << 4)
210 #define SUPPORTED_1000baseT_Full (1 << 5)
211 #define SUPPORTED_Autoneg (1 << 6)
212 #define SUPPORTED_TP (1 << 7)
|
13 * This file is part of the Chelsio T4 support code.
14 *
15 * Copyright (C) 2010-2013 Chelsio Communications. All rights reserved.
16 *
17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this
20 * release for licensing terms and conditions.
21 */
22
23 #ifndef __CXGBE_OSDEP_H
24 #define __CXGBE_OSDEP_H
25
26 #include <sys/ddi.h>
27 #include <sys/sunddi.h>
28 #include <sys/byteorder.h>
29 #include <sys/cmn_err.h>
30 #include <sys/pcie.h>
31 #include <sys/sysmacros.h>
32 #include <sys/inttypes.h>
33 #include <sys/stdbool.h>
34
35 /* sys/user.h defines u, and that bothers us. */
36 #undef u
37
38 #define isdigit(x) ((x) >= '0' && (x) <= '9')
39 #define isspace(x) ((x) == ' ' || (x) == '\t')
40 #define toupper(x) (((x) >= 'a' && (x) <= 'z') ? (x) - 'a' + 'A' : (x))
41 #define fls(x) ddi_fls(x)
42
43 #define CH_ERR(sc, ...) cxgb_printf(sc->dip, CE_WARN, ##__VA_ARGS__)
44 #define CH_WARN(sc, ...) cxgb_printf(sc->dip, CE_WARN, ##__VA_ARGS__)
45 #define CH_WARN_RATELIMIT(sc, ...) cxgb_printf(sc->dip, CE_WARN, ##__VA_ARGS__)
46 #define CH_ALERT(sc, ...) cxgb_printf(sc->dip, CE_NOTE, ##__VA_ARGS__)
47 #define CH_INFO(sc, ...) cxgb_printf(sc->dip, CE_NOTE, ##__VA_ARGS__)
48
49 #define CH_MSG(sc, level, category, fmt, ...)
50 #ifdef DEBUG
51 #define CH_DBG(sc, category, fmt, ...) cxgb_printf(sc->dip, CE_NOTE, ##__VA_ARGS__)
52 #else
53 #define CH_DBG(sc, category, fmt, ...)
170 typedef uint16_t u16;
171 typedef uint32_t u32;
172 typedef uint64_t u64;
173
174 typedef uint8_t __u8;
175 typedef uint16_t __u16;
176 typedef uint32_t __u32;
177 typedef uint64_t __u64;
178 typedef uint8_t __be8;
179 typedef uint16_t __be16;
180 typedef uint32_t __be32;
181 typedef uint64_t __be64;
182
183 typedef uint32_t __le32;
184
185 typedef int8_t s8;
186 typedef int16_t s16;
187 typedef int32_t s32;
188 typedef int64_t s64;
189
190 #if defined(__sparc)
191 #define __BIG_ENDIAN_BITFIELD
192 #define PAGE_SIZE 8192
193 #define PAGE_SHIFT 13
194 #define CACHE_LINE 64
195 #else
196 #define __LITTLE_ENDIAN_BITFIELD
197 #define PAGE_SIZE 4096
198 #define PAGE_SHIFT 12
199 #define CACHE_LINE 32
200 #endif
201
202 #define SUPPORTED_10baseT_Half (1 << 0)
203 #define SUPPORTED_10baseT_Full (1 << 1)
204 #define SUPPORTED_100baseT_Half (1 << 2)
205 #define SUPPORTED_100baseT_Full (1 << 3)
206 #define SUPPORTED_1000baseT_Half (1 << 4)
207 #define SUPPORTED_1000baseT_Full (1 << 5)
208 #define SUPPORTED_Autoneg (1 << 6)
209 #define SUPPORTED_TP (1 << 7)
|