4 * Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: osl.h,v 13.45.2.2 2010-08-31 00:29:57 Exp $
24 /* osl handle type forward declaration */
25 typedef struct osl_info osl_t
;
26 typedef struct osl_dmainfo osldma_t
;
28 #define OSL_PKTTAG_SZ 32 /* Size of PktTag */
30 /* Drivers use PKTFREESETCB to register a callback function when a packet is freed by OSL */
31 typedef void (*pktfree_cb_fn_t
)(void *ctx
, void *pkt
, unsigned int status
);
33 /* Drivers use REGOPSSET() to register register read/write funcitons */
34 typedef unsigned int (*osl_rreg_fn_t
)(void *ctx
, void *reg
, unsigned int size
);
35 typedef void (*osl_wreg_fn_t
)(void *ctx
, void *reg
, unsigned int val
, unsigned int size
);
40 #define PREF_LOAD_STREAMED 4
41 #define PREF_STORE_STREAMED 5
42 #define PREF_LOAD_RETAINED 6
43 #define PREF_STORE_RETAINED 7
44 #define PREF_WBACK_INV 25
45 #define PREF_PREPARE4STORE 30
47 #define MAKE_PREFETCH_FN(hint) \
48 static inline void prefetch_##hint(const void *addr) \
50 __asm__ __volatile__(\
55 : "i" (hint), "r" (addr)); \
58 #define MAKE_PREFETCH_RANGE_FN(hint) \
59 static inline void prefetch_range_##hint(const void *addr, int len) \
63 prefetch_##hint(addr); \
68 MAKE_PREFETCH_FN(PREF_LOAD
)
69 MAKE_PREFETCH_RANGE_FN(PREF_LOAD
)
70 MAKE_PREFETCH_FN(PREF_STORE
)
71 MAKE_PREFETCH_RANGE_FN(PREF_STORE
)
72 MAKE_PREFETCH_FN(PREF_LOAD_STREAMED
)
73 MAKE_PREFETCH_RANGE_FN(PREF_LOAD_STREAMED
)
74 MAKE_PREFETCH_FN(PREF_STORE_STREAMED
)
75 MAKE_PREFETCH_RANGE_FN(PREF_STORE_STREAMED
)
76 MAKE_PREFETCH_FN(PREF_LOAD_RETAINED
)
77 MAKE_PREFETCH_RANGE_FN(PREF_LOAD_RETAINED
)
78 MAKE_PREFETCH_FN(PREF_STORE_RETAINED
)
79 MAKE_PREFETCH_RANGE_FN(PREF_STORE_RETAINED
)
87 #include <pcbios_osl.h>
90 #include <usermode_osl.h>
92 #include <linux_osl.h>
98 #elif defined(_MINOSL_)
100 #elif defined(MACOSX)
101 #include <macosx_osl.h>
102 #elif defined(__NetBSD__)
106 #elif defined(TARGETOS_nucleus)
107 #include <nucleus_osl.h>
109 #error "Unsupported OSL requested"
113 #define PKTDBG_TRACE(osh, pkt, bit)
116 /* --------------------------------------------------------------------------
117 ** Register manipulation macros.
120 #define SET_REG(osh, r, mask, val) W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
123 #define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
124 #endif /* !AND_REG */
127 #define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
130 #if !defined(OSL_SYSUPTIME)
131 #define OSL_SYSUPTIME() (0)
132 #define OSL_SYSUPTIME_SUPPORT FALSE
134 #define OSL_SYSUPTIME_SUPPORT TRUE
135 #endif /* OSL_SYSUPTIME */