~ubuntu-branches/ubuntu/utopic/bcmwl/utopic

« back to all changes in this revision

Viewing changes to src/src/include/linuxver.h

  • Committer: Package Import Robot
  • Author(s): Alberto Milone
  • Date: 2013-05-15 13:11:43 UTC
  • mfrom: (2.1.7)
  • Revision ID: package-import@ubuntu.com-20130515131143-0i960cfjq3dsst6h
Tags: 6.30.223.30+bdcom-0ubuntu1
* New upstream release.
* debian/dkms.conf.in:
  - Drop patches for Linux 3.2 and 3.4.
* 0006-add-support-for-linux-3.8.0.patch,
  0007-nl80211-move-scan-API-to-wdev.patch:
  - Refresh against new release.
* 0008-add-support-for-linux-3.9.0.patch:
  - Add support for Linux 3.9 (LP: #1157880).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Linux-specific abstractions to gain some independence from linux kernel versions.
3
3
 * Pave over some 2.2 versus 2.4 versus 2.6 kernel differences.
4
4
 *
5
 
 * Copyright (C) 2011, Broadcom Corporation. All Rights Reserved.
 
5
 * Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
6
6
 * 
7
7
 * Permission to use, copy, modify, and/or distribute this software for any
8
8
 * purpose with or without fee is hereby granted, provided that the above
16
16
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17
17
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
18
 *
19
 
 * $Id: linuxver.h 260648 2011-05-19 22:16:03Z $
 
19
 * $Id: linuxver.h 372519 2012-12-04 01:21:16Z $
20
20
 */
21
21
 
22
22
#ifndef _linuxver_h_
26
26
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
27
27
#include <linux/config.h>
28
28
#else
29
 
 
30
 
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33))
 
29
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
 
30
#include <generated/autoconf.h>
 
31
#else
31
32
#include <linux/autoconf.h>
32
 
#else
33
 
#include <generated/autoconf.h>
34
33
#endif
35
 
 
36
34
#endif 
 
35
 
 
36
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0))
 
37
#include <linux/kconfig.h>
 
38
#endif
 
39
 
37
40
#include <linux/module.h>
38
41
 
39
42
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0))
64
67
#include <linux/pci.h>
65
68
#include <linux/interrupt.h>
66
69
#include <linux/netdevice.h>
 
70
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
 
71
#include <linux/semaphore.h>
 
72
#else
 
73
#include <asm/semaphore.h>
 
74
#endif 
67
75
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
68
76
#undef IP_TOS
69
 
#endif
 
77
#endif 
70
78
#include <asm/io.h>
71
79
 
72
80
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 41))
87
95
#endif
88
96
#endif  
89
97
 
90
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
 
98
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
 
99
#define DAEMONIZE(a) daemonize(a); \
 
100
        allow_signal(SIGKILL); \
 
101
        allow_signal(SIGTERM);
 
102
#else 
 
103
#define RAISE_RX_SOFTIRQ() \
 
104
        cpu_raise_softirq(smp_processor_id(), NET_RX_SOFTIRQ)
 
105
#define DAEMONIZE(a) daemonize(); \
 
106
        do { if (a) \
 
107
                strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a)))); \
 
108
        } while (0);
 
109
#endif 
 
110
 
 
111
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
91
112
#define MY_INIT_WORK(_work, _func)      INIT_WORK(_work, _func)
92
113
#else
93
114
#define MY_INIT_WORK(_work, _func)      INIT_WORK(_work, _func, _work)
 
115
#if !(LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18) && defined(RHEL_MAJOR) && \
 
116
        (RHEL_MAJOR == 5))
 
117
 
94
118
typedef void (*work_func_t)(void *work);
 
119
#endif
95
120
#endif  
96
121
 
97
122
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
125
150
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
126
151
#include <net/lib80211.h>
127
152
#endif
128
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 
153
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
129
154
#include <linux/ieee80211.h>
130
155
#else
131
156
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
133
158
#endif
134
159
#endif 
135
160
 
 
161
#ifdef CUSTOMER_HW4
 
162
#include <linux/kthread.h>
 
163
#endif
 
164
 
136
165
#ifndef __exit
137
166
#define __exit
138
167
#endif
428
457
#define CHECKSUM_HW     CHECKSUM_PARTIAL
429
458
#endif
430
459
 
 
460
typedef struct {
 
461
        void    *parent;  
 
462
        struct  task_struct *p_task;
 
463
        long    thr_pid;
 
464
        int     prio; 
 
465
        struct  semaphore sema;
 
466
        int     terminated;
 
467
        struct  completion completed;
 
468
} tsk_ctl_t;
 
469
 
 
470
#define DBG_THR(x)
 
471
 
 
472
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
 
473
#define SMP_RD_BARRIER_DEPENDS(x) smp_read_barrier_depends(x)
 
474
#else
 
475
#define SMP_RD_BARRIER_DEPENDS(x) smp_rmb(x)
 
476
#endif
 
477
 
 
478
#define PROC_START(thread_func, owner, tsk_ctl, flags) \
 
479
{ \
 
480
        sema_init(&((tsk_ctl)->sema), 0); \
 
481
        init_completion(&((tsk_ctl)->completed)); \
 
482
        (tsk_ctl)->parent = owner; \
 
483
        (tsk_ctl)->terminated = FALSE; \
 
484
        (tsk_ctl)->thr_pid = kernel_thread(thread_func, tsk_ctl, flags); \
 
485
        if ((tsk_ctl)->thr_pid > 0) \
 
486
                wait_for_completion(&((tsk_ctl)->completed)); \
 
487
        DBG_THR(("%s thr:%lx started\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
 
488
}
 
489
 
 
490
#ifdef USE_KTHREAD_API
 
491
#define PROC_START2(thread_func, owner, tsk_ctl, flags, name) \
 
492
{ \
 
493
        sema_init(&((tsk_ctl)->sema), 0); \
 
494
        init_completion(&((tsk_ctl)->completed)); \
 
495
        (tsk_ctl)->parent = owner; \
 
496
        (tsk_ctl)->terminated = FALSE; \
 
497
        (tsk_ctl)->p_task  = kthread_run(thread_func, tsk_ctl, (char*)name); \
 
498
        (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \
 
499
        DBG_THR(("%s thr:%lx created\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
 
500
}
 
501
#endif
 
502
 
 
503
#define PROC_STOP(tsk_ctl) \
 
504
{ \
 
505
        (tsk_ctl)->terminated = TRUE; \
 
506
        smp_wmb(); \
 
507
        up(&((tsk_ctl)->sema)); \
 
508
        wait_for_completion(&((tsk_ctl)->completed)); \
 
509
        DBG_THR(("%s thr:%lx terminated OK\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \
 
510
        (tsk_ctl)->thr_pid = -1; \
 
511
}
 
512
 
 
513
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
 
514
#define KILL_PROC(nr, sig) \
 
515
{ \
 
516
struct task_struct *tsk; \
 
517
struct pid *pid;    \
 
518
pid = find_get_pid((pid_t)nr);    \
 
519
tsk = pid_task(pid, PIDTYPE_PID);    \
 
520
if (tsk) send_sig(sig, tsk, 1); \
 
521
}
 
522
#else
 
523
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE <= \
 
524
        KERNEL_VERSION(2, 6, 30))
 
525
#define KILL_PROC(pid, sig) \
 
526
{ \
 
527
        struct task_struct *tsk; \
 
528
        tsk = find_task_by_vpid(pid); \
 
529
        if (tsk) send_sig(sig, tsk, 1); \
 
530
}
 
531
#else
 
532
#define KILL_PROC(pid, sig) \
 
533
{ \
 
534
        kill_proc(pid, sig, 1); \
 
535
}
 
536
#endif
 
537
#endif 
 
538
 
431
539
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
432
540
#include <linux/time.h>
433
541
#include <linux/wait.h>
467
575
 
468
576
#endif 
469
577
 
470
 
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
471
 
#define KILL_PROC(nr, sig) \
472
 
{ \
473
 
struct task_struct *tsk; \
474
 
struct pid *pid;    \
475
 
pid = find_get_pid((pid_t)nr);    \
476
 
tsk = pid_task(pid, PIDTYPE_PID);    \
477
 
if (tsk) send_sig(sig, tsk, 1); \
478
 
}
479
 
#else
480
 
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE <= \
481
 
        KERNEL_VERSION(2, 6, 30))
482
 
#define KILL_PROC(pid, sig) \
483
 
{ \
484
 
        struct task_struct *tsk; \
485
 
        tsk = find_task_by_vpid(pid); \
486
 
        if (tsk) send_sig(sig, tsk, 1); \
487
 
}
488
 
#else
489
 
#define KILL_PROC(pid, sig) \
490
 
{ \
491
 
        kill_proc(pid, sig, 1); \
492
 
}
493
 
#endif
494
 
#endif 
495
 
 
496
 
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
497
 
#define netdev_priv(dev) dev->priv
498
 
#endif 
499
 
 
500
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
501
 
#define WL_DEV_IF(dev)          ((wl_if_t*)netdev_priv(dev))
502
 
#else
503
 
#define WL_DEV_IF(dev)          ((wl_if_t*)(dev)->priv)
 
578
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
 
579
#define DEV_PRIV(dev)   (dev->priv)
 
580
#else
 
581
#define DEV_PRIV(dev)   netdev_priv(dev)
504
582
#endif
505
583
 
506
584
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
509
587
#define WL_ISR(i, d, p)         wl_isr((i), (d), (p))
510
588
#endif  
511
589
 
512
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
513
 
#define NETDEV_PRIV(dev)          (netdev_priv(dev))
514
 
#else
515
 
#define NETDEV_PRIV(dev)          ((dev)->priv)
516
 
#endif
 
590
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
 
591
#define netdev_priv(dev) dev->priv
 
592
#endif 
517
593
 
518
594
#endif