Home | History | Annotate | Download | only in include
      1 /*
      2  * Misc system wide definitions
      3  *
      4  * Copyright (C) 1999-2011, Broadcom Corporation
      5  *
      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.
      9  *
     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.
     17  *
     18  * $Id: bcmdefs.h,v 13.68.2.8 2011-01-08 04:04:19 Exp $
     19  */
     20 
     21 #ifndef	_bcmdefs_h_
     22 #define	_bcmdefs_h_
     23 
     24 
     25 
     26 #define bcmreclaimed 		0
     27 #define _data	_data
     28 #define _fn	_fn
     29 #define _data	_data
     30 #define _fn		_fn
     31 #define _fn	_fn
     32 #define CONST	const
     33 #define BCMFASTPATH
     34 
     35 
     36 
     37 
     38 #define _data	_data
     39 #define _fn		_fn
     40 #define _fn	_fn
     41 #define STATIC	static
     42 
     43 
     44 #define	SI_BUS			0
     45 #define	PCI_BUS			1
     46 #define	PCMCIA_BUS		2
     47 #define SDIO_BUS		3
     48 #define JTAG_BUS		4
     49 #define USB_BUS			5
     50 #define SPI_BUS			6
     51 #define RPC_BUS			7
     52 
     53 
     54 #ifdef BCMBUSTYPE
     55 #define BUSTYPE(bus) 	(BCMBUSTYPE)
     56 #else
     57 #define BUSTYPE(bus) 	(bus)
     58 #endif
     59 
     60 
     61 #ifdef BCMCHIPTYPE
     62 #define CHIPTYPE(bus) 	(BCMCHIPTYPE)
     63 #else
     64 #define CHIPTYPE(bus) 	(bus)
     65 #endif
     66 
     67 
     68 
     69 #if defined(BCMSPROMBUS)
     70 #define SPROMBUS	(BCMSPROMBUS)
     71 #elif defined(SI_PCMCIA_SROM)
     72 #define SPROMBUS	(PCMCIA_BUS)
     73 #else
     74 #define SPROMBUS	(PCI_BUS)
     75 #endif
     76 
     77 
     78 #ifdef BCMCHIPID
     79 #define CHIPID(chip)	(BCMCHIPID)
     80 #else
     81 #define CHIPID(chip)	(chip)
     82 #endif
     83 
     84 #ifdef BCMCHIPREV
     85 #define CHIPREV(rev)	(BCMCHIPREV)
     86 #else
     87 #define CHIPREV(rev)	(rev)
     88 #endif
     89 
     90 
     91 #define DMADDR_MASK_32 0x0
     92 #define DMADDR_MASK_30 0xc0000000
     93 #define DMADDR_MASK_0  0xffffffff
     94 
     95 #define	DMADDRWIDTH_30  30
     96 #define	DMADDRWIDTH_32  32
     97 #define	DMADDRWIDTH_63  63
     98 #define	DMADDRWIDTH_64  64
     99 
    100 #ifdef BCMDMA64OSL
    101 typedef struct {
    102 	uint32 loaddr;
    103 	uint32 hiaddr;
    104 } dma64addr_t;
    105 
    106 typedef dma64addr_t dmaaddr_t;
    107 #define PHYSADDRHI(_pa) ((_pa).hiaddr)
    108 #define PHYSADDRHISET(_pa, _val) \
    109 	do { \
    110 		(_pa).hiaddr = (_val);		\
    111 	} while (0)
    112 #define PHYSADDRLO(_pa) ((_pa).loaddr)
    113 #define PHYSADDRLOSET(_pa, _val) \
    114 	do { \
    115 		(_pa).loaddr = (_val);		\
    116 	} while (0)
    117 
    118 #else
    119 typedef unsigned long dmaaddr_t;
    120 #define PHYSADDRHI(_pa) (0)
    121 #define PHYSADDRHISET(_pa, _val)
    122 #define PHYSADDRLO(_pa) ((_pa))
    123 #define PHYSADDRLOSET(_pa, _val) \
    124 	do { \
    125 		(_pa) = (_val);			\
    126 	} while (0)
    127 #endif
    128 
    129 
    130 typedef struct  {
    131 	dmaaddr_t addr;
    132 	uint32	  length;
    133 } hnddma_seg_t;
    134 
    135 #define MAX_DMA_SEGS 4
    136 
    137 
    138 typedef struct {
    139 	void *oshdmah;
    140 	uint origsize;
    141 	uint nsegs;
    142 	hnddma_seg_t segs[MAX_DMA_SEGS];
    143 } hnddma_seg_map_t;
    144 
    145 
    146 
    147 
    148 #if defined(BCM_RPC_NOCOPY) || defined(BCM_RCP_TXNOCOPY)
    149 
    150 #define BCMEXTRAHDROOM 220
    151 #else
    152 #define BCMEXTRAHDROOM 172
    153 #endif
    154 
    155 
    156 #define BCMDONGLEHDRSZ 12
    157 #define BCMDONGLEPADSZ 16
    158 
    159 #define BCMDONGLEOVERHEAD	(BCMDONGLEHDRSZ + BCMDONGLEPADSZ)
    160 
    161 
    162 #if defined(BCMASSERT_LOG)
    163 #define BCMASSERT_SUPPORT
    164 #endif
    165 
    166 
    167 #define BITFIELD_MASK(width) \
    168 		(((unsigned)1 << (width)) - 1)
    169 #define GFIELD(val, field) \
    170 		(((val) >> field ## _S) & field ## _M)
    171 #define SFIELD(val, field, bits) \
    172 		(((val) & (~(field ## _M << field ## _S))) | \
    173 		 ((unsigned)(bits) << field ## _S))
    174 
    175 
    176 #ifdef BCMSMALL
    177 #undef	BCMSPACE
    178 #define bcmspace	FALSE
    179 #else
    180 #define	BCMSPACE
    181 #define bcmspace	TRUE
    182 #endif
    183 
    184 
    185 #define	MAXSZ_NVRAM_VARS	4096
    186 
    187 #define LOCATOR_EXTERN static
    188 
    189 #endif
    190