summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/bcmdhd/include/linux_osl.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/bcmdhd/include/linux_osl.h')
-rw-r--r--drivers/net/wireless/bcmdhd/include/linux_osl.h95
1 files changed, 25 insertions, 70 deletions
diff --git a/drivers/net/wireless/bcmdhd/include/linux_osl.h b/drivers/net/wireless/bcmdhd/include/linux_osl.h
index 830d351d882..e5133e07336 100644
--- a/drivers/net/wireless/bcmdhd/include/linux_osl.h
+++ b/drivers/net/wireless/bcmdhd/include/linux_osl.h
@@ -1,9 +1,9 @@
/*
* Linux OS Independent Layer
*
- * Copyright (C) 1999-2011, Broadcom Corporation
+ * Copyright (C) 1999-2012, Broadcom Corporation
*
- * Unless you and Broadcom execute a separate written software license
+ * Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
@@ -21,10 +21,9 @@
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: linux_osl.h 301794 2011-12-08 20:41:35Z $
+ * $Id: linux_osl.h 309193 2012-01-19 00:03:57Z $
*/
-
#ifndef _linux_osl_h_
#define _linux_osl_h_
@@ -34,6 +33,7 @@
extern void * osl_os_open_image(char * filename);
extern int osl_os_get_image_block(char * buf, int len, void * image);
extern void osl_os_close_image(void * image);
+extern int osl_os_image_size(void *image);
#ifdef BCMDRIVER
@@ -49,7 +49,7 @@ extern uint32 g_assert_type;
#if defined(BCMASSERT_LOG)
#define ASSERT(exp) \
do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
-extern void osl_assert(char *exp, char *file, int line);
+extern void osl_assert(const char *exp, const char *file, int line);
#else
#ifdef __GNUC__
#define GCC_VERSION \
@@ -87,6 +87,7 @@ extern void osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val);
#define OSL_PCI_SLOT(osh) osl_pci_slot(osh)
extern uint osl_pci_bus(osl_t *osh);
extern uint osl_pci_slot(osl_t *osh);
+extern struct pci_dev *osl_pci_device(osl_t *osh);
typedef struct {
@@ -95,6 +96,7 @@ typedef struct {
bool mmbus;
pktfree_cb_fn_t tx_fn;
void *tx_ctx;
+ void *unused[3];
} osl_pubinfo_t;
#define PKTFREESETCB(osh, _tx_fn, _tx_ctx) \
@@ -135,8 +137,6 @@ extern void osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa);
#define DMA_RX 2
-#define DMA_MAP(osh, va, size, direction, p, dmah) \
- osl_dma_map((osh), (va), (size), (direction))
#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
osl_dma_unmap((osh), (pa), (size), (direction))
extern uint osl_dma_map(osl_t *osh, void *va, uint size, int direction);
@@ -162,6 +162,9 @@ extern int osl_error(int bcmerror);
#define PKTBUFSZ 2048
+#include <linuxver.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
#define OSL_SYSUPTIME() ((uint32)jiffies * (1000 / HZ))
#define printf(fmt, args...) printk(fmt , ## args)
@@ -174,18 +177,11 @@ extern int osl_error(int bcmerror);
-#ifndef __mips__
-#define R_REG(osh, r) (\
- SELECT_BUS_READ(osh, sizeof(*(r)) == sizeof(uint8) ? readb((volatile uint8*)(r)) : \
- sizeof(*(r)) == sizeof(uint16) ? readw((volatile uint16*)(r)) : \
- readl((volatile uint32*)(r)), OSL_READ_REG(osh, r)) \
-)
-#else
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
({ \
__typeof(*(r)) __osl_v; \
- __asm__ __volatile__("sync"); \
+ BCM_REFERENCE(osh); \
switch (sizeof(*(r))) { \
case sizeof(uint8): __osl_v = \
readb((volatile uint8*)(r)); break; \
@@ -194,21 +190,14 @@ extern int osl_error(int bcmerror);
case sizeof(uint32): __osl_v = \
readl((volatile uint32*)(r)); break; \
} \
- __asm__ __volatile__("sync"); \
__osl_v; \
}), \
- ({ \
- __typeof(*(r)) __osl_v; \
- __asm__ __volatile__("sync"); \
- __osl_v = OSL_READ_REG(osh, r); \
- __asm__ __volatile__("sync"); \
- __osl_v; \
- })) \
+ OSL_READ_REG(osh, r)) \
)
-#endif
#define W_REG(osh, r, v) do { \
- SELECT_BUS_WRITE(osh, \
+ BCM_REFERENCE(osh); \
+ SELECT_BUS_WRITE(osh, \
switch (sizeof(*(r))) { \
case sizeof(uint8): writeb((uint8)(v), (volatile uint8*)(r)); break; \
case sizeof(uint16): writew((uint16)(v), (volatile uint16*)(r)); break; \
@@ -217,7 +206,6 @@ extern int osl_error(int bcmerror);
(OSL_WRITE_REG(osh, r, v))); \
} while (0)
-
#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
@@ -227,14 +215,11 @@ extern int osl_error(int bcmerror);
#define bzero(b, len) memset((b), '\0', (len))
-#ifdef __mips__
-#include <asm/addrspace.h>
-#define OSL_UNCACHED(va) ((void *)KSEG1ADDR((va)))
-#define OSL_CACHED(va) ((void *)KSEG0ADDR((va)))
-#else
#define OSL_UNCACHED(va) ((void *)va)
#define OSL_CACHED(va) ((void *)va)
-#endif
+
+#define OSL_PREF_RANGE_LD(va, sz)
+#define OSL_PREF_RANGE_ST(va, sz)
#if defined(__i386__)
@@ -271,7 +256,7 @@ extern int osl_error(int bcmerror);
#ifdef CONFIG_DHD_USE_STATIC_BUF
#define PKTGET_STATIC(osh, len, send) osl_pktget_static((osh), (len))
#define PKTFREE_STATIC(osh, skb, send) osl_pktfree_static((osh), (skb), (send))
-#endif
+#endif
#define PKTDATA(osh, skb) (((struct sk_buff*)(skb))->data)
#define PKTLEN(osh, skb) (((struct sk_buff*)(skb))->len)
#define PKTHEADROOM(osh, skb) (PKTDATA(osh, skb)-(((struct sk_buff*)(skb))->head))
@@ -332,6 +317,7 @@ extern void osl_ctfpool_cleanup(osl_t *osh);
extern void osl_ctfpool_stats(osl_t *osh, void *b);
#endif
+
#ifdef HNDCTF
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
#define SKIPCT (1 << 6)
@@ -354,44 +340,12 @@ extern void osl_pktfree(osl_t *osh, void *skb, bool send);
extern void *osl_pktget_static(osl_t *osh, uint len);
extern void osl_pktfree_static(osl_t *osh, void *skb, bool send);
+extern void *osl_pkt_frmnative(osl_t *osh, void *skb);
extern void *osl_pktget(osl_t *osh, uint len);
extern void *osl_pktdup(osl_t *osh, void *skb);
-
-
-static INLINE void *
-osl_pkt_frmnative(osl_pubinfo_t *osh, void *pkt)
-{
- struct sk_buff *nskb;
-
- if (osh->pkttag)
- bzero((void*)((struct sk_buff*)pkt)->cb, OSL_PKTTAG_SZ);
-
-
- for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
- osh->pktalloced++;
- }
-
- return (void *)pkt;
-}
-#define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((osl_pubinfo_t *)osh), (struct sk_buff*)(skb))
-
-
-static INLINE struct sk_buff *
-osl_pkt_tonative(osl_pubinfo_t *osh, void *pkt)
-{
- struct sk_buff *nskb;
-
- if (osh->pkttag)
- bzero(((struct sk_buff*)pkt)->cb, OSL_PKTTAG_SZ);
-
-
- for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
- osh->pktalloced--;
- }
-
- return (struct sk_buff *)pkt;
-}
-#define PKTTONATIVE(osh, pkt) osl_pkt_tonative((osl_pubinfo_t *)(osh), (pkt))
+extern struct sk_buff *osl_pkt_tonative(osl_t *osh, void *pkt);
+#define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((osl_t *)osh), (struct sk_buff*)(skb))
+#define PKTTONATIVE(osh, pkt) osl_pkt_tonative((osl_t *)(osh), (pkt))
#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev)
#define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x))
@@ -403,7 +357,8 @@ osl_pkt_tonative(osl_pubinfo_t *osh, void *pkt)
#define PKTSHARED(skb) (((struct sk_buff*)(skb))->cloned)
-
+#define DMA_MAP(osh, va, size, direction, p, dmah) \
+ osl_dma_map((osh), (va), (size), (direction))
#else