Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[pandora-kernel.git] / drivers / staging / brcm80211 / include / bcmutils.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _bcmutils_h_
18 #define _bcmutils_h_
19
20 /* Buffer structure for collecting string-formatted data
21 * using bcm_bprintf() API.
22 * Use bcm_binit() to initialize before use
23 */
24
25         struct bcmstrbuf {
26                 char *buf;      /* pointer to current position in origbuf */
27                 unsigned int size;      /* current (residual) size in bytes */
28                 char *origbuf;  /* unmodified pointer to orignal buffer */
29                 unsigned int origsize;  /* unmodified orignal buffer size in bytes */
30         };
31
32 /* ** driver-only section ** */
33
34 #define GPIO_PIN_NOTDEFINED     0x20    /* Pin not defined */
35
36 /*
37  * Spin at most 'us' microseconds while 'exp' is true.
38  * Caller should explicitly test 'exp' when this completes
39  * and take appropriate error action if 'exp' is still true.
40  */
41 #define SPINWAIT(exp, us) { \
42         uint countdown = (us) + 9; \
43         while ((exp) && (countdown >= 10)) {\
44                 udelay(10); \
45                 countdown -= 10; \
46         } \
47 }
48
49 /* osl multi-precedence packet queue */
50 #ifndef PKTQ_LEN_DEFAULT
51 #define PKTQ_LEN_DEFAULT        128     /* Max 128 packets */
52 #endif
53 #ifndef PKTQ_MAX_PREC
54 #define PKTQ_MAX_PREC           16      /* Maximum precedence levels */
55 #endif
56
57         typedef struct pktq_prec {
58                 struct sk_buff *head;   /* first packet to dequeue */
59                 struct sk_buff *tail;   /* last packet to dequeue */
60                 u16 len;                /* number of queued packets */
61                 u16 max;                /* maximum number of queued packets */
62         } pktq_prec_t;
63
64 /* multi-priority pkt queue */
65         struct pktq {
66                 u16 num_prec;   /* number of precedences in use */
67                 u16 hi_prec;    /* rapid dequeue hint (>= highest non-empty prec) */
68                 u16 max;        /* total max packets */
69                 u16 len;        /* total number of packets */
70                 /* q array must be last since # of elements can be either PKTQ_MAX_PREC or 1 */
71                 struct pktq_prec q[PKTQ_MAX_PREC];
72         };
73
74 /* simple, non-priority pkt queue */
75         struct spktq {
76                 u16 num_prec;   /* number of precedences in use (always 1) */
77                 u16 hi_prec;    /* rapid dequeue hint (>= highest non-empty prec) */
78                 u16 max;        /* total max packets */
79                 u16 len;        /* total number of packets */
80                 /* q array must be last since # of elements can be either PKTQ_MAX_PREC or 1 */
81                 struct pktq_prec q[1];
82         };
83
84 #define PKTQ_PREC_ITER(pq, prec)        for (prec = (pq)->num_prec - 1; prec >= 0; prec--)
85
86 /* fn(pkt, arg).  return true if pkt belongs to if */
87         typedef bool(*ifpkt_cb_t) (void *, int);
88
89 /* forward definition of ether_addr structure used by some function prototypes */
90
91         struct ether_addr;
92
93         extern int ether_isbcast(const void *ea);
94         extern int ether_isnulladdr(const void *ea);
95
96 /* operations on a specific precedence in packet queue */
97
98 #define pktq_psetmax(pq, prec, _max)    ((pq)->q[prec].max = (_max))
99 #define pktq_plen(pq, prec)             ((pq)->q[prec].len)
100 #define pktq_pavail(pq, prec)           ((pq)->q[prec].max - (pq)->q[prec].len)
101 #define pktq_pfull(pq, prec)            ((pq)->q[prec].len >= (pq)->q[prec].max)
102 #define pktq_pempty(pq, prec)           ((pq)->q[prec].len == 0)
103
104 #define pktq_ppeek(pq, prec)            ((pq)->q[prec].head)
105 #define pktq_ppeek_tail(pq, prec)       ((pq)->q[prec].tail)
106
107 extern struct sk_buff *pktq_penq(struct pktq *pq, int prec,
108                                  struct sk_buff *p);
109 extern struct sk_buff *pktq_penq_head(struct pktq *pq, int prec,
110                                       struct sk_buff *p);
111 extern struct sk_buff *pktq_pdeq(struct pktq *pq, int prec);
112 extern struct sk_buff *pktq_pdeq_tail(struct pktq *pq, int prec);
113
114 /* Empty the queue at particular precedence level */
115 #ifdef BRCM_FULLMAC
116         extern void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec,
117                 bool dir);
118 #else
119         extern void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec,
120                 bool dir, ifpkt_cb_t fn, int arg);
121 #endif /* BRCM_FULLMAC */
122
123 /* operations on a set of precedences in packet queue */
124
125 extern int pktq_mlen(struct pktq *pq, uint prec_bmp);
126 extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
127
128 /* operations on packet queue as a whole */
129
130 #define pktq_len(pq)                    ((int)(pq)->len)
131 #define pktq_max(pq)                    ((int)(pq)->max)
132 #define pktq_avail(pq)                  ((int)((pq)->max - (pq)->len))
133 #define pktq_full(pq)                   ((pq)->len >= (pq)->max)
134 #define pktq_empty(pq)                  ((pq)->len == 0)
135
136 /* operations for single precedence queues */
137 #define pktenq(pq, p)           pktq_penq(((struct pktq *)pq), 0, (p))
138 #define pktenq_head(pq, p)      pktq_penq_head(((struct pktq *)pq), 0, (p))
139 #define pktdeq(pq)              pktq_pdeq(((struct pktq *)pq), 0)
140 #define pktdeq_tail(pq)         pktq_pdeq_tail(((struct pktq *)pq), 0)
141 #define pktqinit(pq, len) pktq_init(((struct pktq *)pq), 1, len)
142
143         extern void pktq_init(struct pktq *pq, int num_prec, int max_len);
144 /* prec_out may be NULL if caller is not interested in return value */
145         extern struct sk_buff *pktq_peek_tail(struct pktq *pq, int *prec_out);
146 #ifdef BRCM_FULLMAC
147         extern void pktq_flush(struct osl_info *osh, struct pktq *pq, bool dir);
148 #else
149         extern void pktq_flush(struct osl_info *osh, struct pktq *pq, bool dir,
150                 ifpkt_cb_t fn, int arg);
151 #endif
152
153 /* externs */
154 /* packet */
155         extern uint pktfrombuf(struct osl_info *osh, struct sk_buff *p,
156                                uint offset, int len, unsigned char *buf);
157         extern uint pkttotlen(struct osl_info *osh, struct sk_buff *p);
158
159 /* ethernet address */
160         extern int bcm_ether_atoe(char *p, struct ether_addr *ea);
161
162 /* ip address */
163         struct ipv4_addr;
164         extern char *bcm_ip_ntoa(struct ipv4_addr *ia, char *buf);
165
166 /* variable access */
167         extern char *getvar(char *vars, const char *name);
168         extern int getintvar(char *vars, const char *name);
169 #ifdef BCMDBG
170         extern void prpkt(const char *msg, struct osl_info *osh,
171                           struct sk_buff *p0);
172 #endif                          /* BCMDBG */
173 #define bcm_perf_enable()
174 #define bcmstats(fmt)
175 #define bcmlog(fmt, a1, a2)
176 #define bcmdumplog(buf, size)   (*buf = '\0')
177 #define bcmdumplogent(buf, idx) -1
178
179 #define bcmtslog(tstamp, fmt, a1, a2)
180 #define bcmprinttslogs()
181 #define bcmprinttstamp(us)
182
183 /* Support for sharing code across in-driver iovar implementations.
184  * The intent is that a driver use this structure to map iovar names
185  * to its (private) iovar identifiers, and the lookup function to
186  * find the entry.  Macros are provided to map ids and get/set actions
187  * into a single number space for a switch statement.
188  */
189
190 /* iovar structure */
191         typedef struct bcm_iovar {
192                 const char *name;       /* name for lookup and display */
193                 u16 varid;      /* id for switch */
194                 u16 flags;      /* driver-specific flag bits */
195                 u16 type;       /* base type of argument */
196                 u16 minlen;     /* min length for buffer vars */
197         } bcm_iovar_t;
198
199 /* varid definitions are per-driver, may use these get/set bits */
200
201 /* IOVar action bits for id mapping */
202 #define IOV_GET 0               /* Get an iovar */
203 #define IOV_SET 1               /* Set an iovar */
204
205 /* Varid to actionid mapping */
206 #define IOV_GVAL(id)            ((id)*2)
207 #define IOV_SVAL(id)            (((id)*2)+IOV_SET)
208 #define IOV_ISSET(actionid)     ((actionid & IOV_SET) == IOV_SET)
209 #define IOV_ID(actionid)        (actionid >> 1)
210
211 /* flags are per-driver based on driver attributes */
212
213         extern const bcm_iovar_t *bcm_iovar_lookup(const bcm_iovar_t *table,
214                                                    const char *name);
215         extern int bcm_iovar_lencheck(const bcm_iovar_t *table, void *arg,
216                                       int len, bool set);
217
218 /* Base type definitions */
219 #define IOVT_VOID       0       /* no value (implictly set only) */
220 #define IOVT_BOOL       1       /* any value ok (zero/nonzero) */
221 #define IOVT_INT8       2       /* integer values are range-checked */
222 #define IOVT_UINT8      3       /* unsigned int 8 bits */
223 #define IOVT_INT16      4       /* int 16 bits */
224 #define IOVT_UINT16     5       /* unsigned int 16 bits */
225 #define IOVT_INT32      6       /* int 32 bits */
226 #define IOVT_UINT32     7       /* unsigned int 32 bits */
227 #define IOVT_BUFFER     8       /* buffer is size-checked as per minlen */
228 #define BCM_IOVT_VALID(type) (((unsigned int)(type)) <= IOVT_BUFFER)
229
230 /* Initializer for IOV type strings */
231 #define BCM_IOV_TYPE_INIT { \
232         "void", \
233         "bool", \
234         "s8", \
235         "u8", \
236         "s16", \
237         "u16", \
238         "s32", \
239         "u32", \
240         "buffer", \
241         "" }
242
243 #define BCM_IOVT_IS_INT(type) (\
244         (type == IOVT_BOOL) || \
245         (type == IOVT_INT8) || \
246         (type == IOVT_UINT8) || \
247         (type == IOVT_INT16) || \
248         (type == IOVT_UINT16) || \
249         (type == IOVT_INT32) || \
250         (type == IOVT_UINT32))
251
252 /* ** driver/apps-shared section ** */
253
254 #define BCME_STRLEN             64      /* Max string length for BCM errors */
255 #define VALID_BCMERROR(e)  ((e <= 0) && (e >= BCME_LAST))
256
257 /*
258  * error codes could be added but the defined ones shouldn't be changed/deleted
259  * these error codes are exposed to the user code
260  * when ever a new error code is added to this list
261  * please update errorstring table with the related error string and
262  * update osl files with os specific errorcode map
263 */
264
265 #define BCME_OK                         0       /* Success */
266 #define BCME_ERROR                      -1      /* Error generic */
267 #define BCME_BADARG                     -2      /* Bad Argument */
268 #define BCME_BADOPTION                  -3      /* Bad option */
269 #define BCME_NOTUP                      -4      /* Not up */
270 #define BCME_NOTDOWN                    -5      /* Not down */
271 #define BCME_NOTAP                      -6      /* Not AP */
272 #define BCME_NOTSTA                     -7      /* Not STA  */
273 #define BCME_BADKEYIDX                  -8      /* BAD Key Index */
274 #define BCME_RADIOOFF                   -9      /* Radio Off */
275 #define BCME_NOTBANDLOCKED              -10     /* Not  band locked */
276 #define BCME_NOCLK                      -11     /* No Clock */
277 #define BCME_BADRATESET                 -12     /* BAD Rate valueset */
278 #define BCME_BADBAND                    -13     /* BAD Band */
279 #define BCME_BUFTOOSHORT                -14     /* Buffer too short */
280 #define BCME_BUFTOOLONG                 -15     /* Buffer too long */
281 #define BCME_BUSY                       -16     /* Busy */
282 #define BCME_NOTASSOCIATED              -17     /* Not Associated */
283 #define BCME_BADSSIDLEN                 -18     /* Bad SSID len */
284 #define BCME_OUTOFRANGECHAN             -19     /* Out of Range Channel */
285 #define BCME_BADCHAN                    -20     /* Bad Channel */
286 #define BCME_BADADDR                    -21     /* Bad Address */
287 #define BCME_NORESOURCE                 -22     /* Not Enough Resources */
288 #define BCME_UNSUPPORTED                -23     /* Unsupported */
289 #define BCME_BADLEN                     -24     /* Bad length */
290 #define BCME_NOTREADY                   -25     /* Not Ready */
291 #define BCME_EPERM                      -26     /* Not Permitted */
292 #define BCME_NOMEM                      -27     /* No Memory */
293 #define BCME_ASSOCIATED                 -28     /* Associated */
294 #define BCME_RANGE                      -29     /* Not In Range */
295 #define BCME_NOTFOUND                   -30     /* Not Found */
296 #define BCME_WME_NOT_ENABLED            -31     /* WME Not Enabled */
297 #define BCME_TSPEC_NOTFOUND             -32     /* TSPEC Not Found */
298 #define BCME_ACM_NOTSUPPORTED           -33     /* ACM Not Supported */
299 #define BCME_NOT_WME_ASSOCIATION        -34     /* Not WME Association */
300 #define BCME_SDIO_ERROR                 -35     /* SDIO Bus Error */
301 #define BCME_DONGLE_DOWN                -36     /* Dongle Not Accessible */
302 #define BCME_VERSION                    -37     /* Incorrect version */
303 #define BCME_TXFAIL                     -38     /* TX failure */
304 #define BCME_RXFAIL                     -39     /* RX failure */
305 #define BCME_NODEVICE                   -40     /* Device not present */
306 #define BCME_NMODE_DISABLED             -41     /* NMODE disabled */
307 #define BCME_NONRESIDENT                -42     /* access to nonresident overlay */
308 #define BCME_LAST                       BCME_NONRESIDENT
309
310 /* These are collection of BCME Error strings */
311 #define BCMERRSTRINGTABLE {             \
312         "OK",                           \
313         "Undefined error",              \
314         "Bad Argument",                 \
315         "Bad Option",                   \
316         "Not up",                       \
317         "Not down",                     \
318         "Not AP",                       \
319         "Not STA",                      \
320         "Bad Key Index",                \
321         "Radio Off",                    \
322         "Not band locked",              \
323         "No clock",                     \
324         "Bad Rate valueset",            \
325         "Bad Band",                     \
326         "Buffer too short",             \
327         "Buffer too long",              \
328         "Busy",                         \
329         "Not Associated",               \
330         "Bad SSID len",                 \
331         "Out of Range Channel",         \
332         "Bad Channel",                  \
333         "Bad Address",                  \
334         "Not Enough Resources",         \
335         "Unsupported",                  \
336         "Bad length",                   \
337         "Not Ready",                    \
338         "Not Permitted",                \
339         "No Memory",                    \
340         "Associated",                   \
341         "Not In Range",                 \
342         "Not Found",                    \
343         "WME Not Enabled",              \
344         "TSPEC Not Found",              \
345         "ACM Not Supported",            \
346         "Not WME Association",          \
347         "SDIO Bus Error",               \
348         "Dongle Not Accessible",        \
349         "Incorrect version",            \
350         "TX Failure",                   \
351         "RX Failure",                   \
352         "Device Not Present",           \
353         "NMODE Disabled",               \
354         "Nonresident overlay access", \
355 }
356
357 #ifndef ABS
358 #define ABS(a)                  (((a) < 0) ? -(a) : (a))
359 #endif                          /* ABS */
360
361 #define CEIL(x, y)              (((x) + ((y)-1)) / (y))
362 #define ISPOWEROF2(x)           ((((x)-1)&(x)) == 0)
363
364 /* map physical to virtual I/O */
365 #if !defined(CONFIG_MMC_MSM7X00A)
366 #define REG_MAP(pa, size)       ioremap_nocache((unsigned long)(pa), \
367                                         (unsigned long)(size))
368 #else
369 #define REG_MAP(pa, size)       (void *)(0)
370 #endif
371
372 /* Register operations */
373 #define AND_REG(osh, r, v)      W_REG(osh, (r), R_REG(osh, r) & (v))
374 #define OR_REG(osh, r, v)       W_REG(osh, (r), R_REG(osh, r) | (v))
375
376 #define SET_REG(osh, r, mask, val) \
377                 W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val)))
378
379 #ifndef setbit
380 #ifndef NBBY                    /* the BSD family defines NBBY */
381 #define NBBY    8               /* 8 bits per byte */
382 #endif                          /* #ifndef NBBY */
383 #define setbit(a, i)    (((u8 *)a)[(i)/NBBY] |= 1<<((i)%NBBY))
384 #define clrbit(a, i)    (((u8 *)a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
385 #define isset(a, i)     (((const u8 *)a)[(i)/NBBY] & (1<<((i)%NBBY)))
386 #define isclr(a, i)     ((((const u8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
387 #endif                          /* setbit */
388
389 #define NBITS(type)     (sizeof(type) * 8)
390 #define NBITVAL(nbits)  (1 << (nbits))
391 #define MAXBITVAL(nbits)        ((1 << (nbits)) - 1)
392 #define NBITMASK(nbits) MAXBITVAL(nbits)
393 #define MAXNBVAL(nbyte) MAXBITVAL((nbyte) * 8)
394
395 /* basic mux operation - can be optimized on several architectures */
396 #define MUX(pred, true, false) ((pred) ? (true) : (false))
397
398 /* modulo inc/dec - assumes x E [0, bound - 1] */
399 #define MODDEC(x, bound) MUX((x) == 0, (bound) - 1, (x) - 1)
400 #define MODINC(x, bound) MUX((x) == (bound) - 1, 0, (x) + 1)
401
402 /* modulo inc/dec, bound = 2^k */
403 #define MODDEC_POW2(x, bound) (((x) - 1) & ((bound) - 1))
404 #define MODINC_POW2(x, bound) (((x) + 1) & ((bound) - 1))
405
406 /* modulo add/sub - assumes x, y E [0, bound - 1] */
407 #define MODADD(x, y, bound) \
408     MUX((x) + (y) >= (bound), (x) + (y) - (bound), (x) + (y))
409 #define MODSUB(x, y, bound) \
410     MUX(((int)(x)) - ((int)(y)) < 0, (x) - (y) + (bound), (x) - (y))
411
412 /* module add/sub, bound = 2^k */
413 #define MODADD_POW2(x, y, bound) (((x) + (y)) & ((bound) - 1))
414 #define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1))
415
416 /* crc defines */
417 #define CRC8_INIT_VALUE  0xff   /* Initial CRC8 checksum value */
418 #define CRC8_GOOD_VALUE  0x9f   /* Good final CRC8 checksum value */
419 #define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
420 #define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
421
422 /* bcm_format_flags() bit description structure */
423         typedef struct bcm_bit_desc {
424                 u32 bit;
425                 const char *name;
426         } bcm_bit_desc_t;
427
428 /* tag_ID/length/value_buffer tuple */
429         typedef struct bcm_tlv {
430                 u8 id;
431                 u8 len;
432                 u8 data[1];
433         } bcm_tlv_t;
434
435 /* Check that bcm_tlv_t fits into the given buflen */
436 #define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (int)(buflen) >= (int)(2 + (elt)->len))
437
438 #define ETHER_ADDR_STR_LEN      18      /* 18-bytes of Ethernet address buffer length */
439
440 /* crypto utility function */
441 /* 128-bit xor: *dst = *src1 xor *src2. dst1, src1 and src2 may have any alignment */
442         static inline void
443          xor_128bit_block(const u8 *src1, const u8 *src2, u8 *dst) {
444                 if (
445 #ifdef __i386__
446                            1 ||
447 #endif
448                            (((unsigned long) src1 | (unsigned long) src2 | (unsigned long) dst) &
449                             3) == 0) {
450                         /* ARM CM3 rel time: 1229 (727 if alignment check could be omitted) */
451                         /* x86 supports unaligned.  This version runs 6x-9x faster on x86. */
452                         ((u32 *) dst)[0] =
453                             ((const u32 *)src1)[0] ^ ((const u32 *)
454                                                          src2)[0];
455                         ((u32 *) dst)[1] =
456                             ((const u32 *)src1)[1] ^ ((const u32 *)
457                                                          src2)[1];
458                         ((u32 *) dst)[2] =
459                             ((const u32 *)src1)[2] ^ ((const u32 *)
460                                                          src2)[2];
461                         ((u32 *) dst)[3] =
462                             ((const u32 *)src1)[3] ^ ((const u32 *)
463                                                          src2)[3];
464                 } else {
465                         /* ARM CM3 rel time: 4668 (4191 if alignment check could be omitted) */
466                         int k;
467                         for (k = 0; k < 16; k++)
468                                 dst[k] = src1[k] ^ src2[k];
469                 }
470         }
471
472 /* externs */
473 /* crc */
474         extern u8 hndcrc8(u8 *p, uint nbytes, u8 crc);
475         extern u16 hndcrc16(u8 *p, uint nbytes, u16 crc);
476 /* format/print */
477 #if defined(BCMDBG)
478         extern int bcm_format_flags(const bcm_bit_desc_t *bd, u32 flags,
479                                     char *buf, int len);
480         extern int bcm_format_hex(char *str, const void *bytes, int len);
481 #endif
482         extern char *bcm_chipname(uint chipid, char *buf, uint len);
483         extern void prhex(const char *msg, unsigned char *buf, uint len);
484
485         extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen,
486                                                     uint key);
487 /* bcmerror */
488         extern const char *bcmerrorstr(int bcmerror);
489
490 /* multi-bool data type: set of bools, mbool is true if any is set */
491         typedef u32 mbool;
492 #define mboolset(mb, bit)               ((mb) |= (bit)) /* set one bool */
493 #define mboolclr(mb, bit)               ((mb) &= ~(bit))        /* clear one bool */
494 #define mboolisset(mb, bit)             (((mb) & (bit)) != 0)   /* true if one bool is set */
495 #define mboolmaskset(mb, mask, val)     ((mb) = (((mb) & ~(mask)) | (val)))
496
497 /* power conversion */
498         extern u16 bcm_qdbm_to_mw(u8 qdbm);
499         extern u8 bcm_mw_to_qdbm(u16 mw);
500
501 /* generic datastruct to help dump routines */
502         struct fielddesc {
503                 const char *nameandfmt;
504                 u32 offset;
505                 u32 len;
506         };
507
508         extern void bcm_binit(struct bcmstrbuf *b, char *buf, uint size);
509         extern int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...);
510
511         typedef u32(*bcmutl_rdreg_rtn) (void *arg0, uint arg1,
512                                            u32 offset);
513
514         extern uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf,
515                                 uint len);
516         extern uint bcm_bitcount(u8 *bitmap, uint bytelength);
517
518 #endif                          /* _bcmutils_h_ */