block: fix warning with calling smp_processor_id() in preemptible section
[pandora-kernel.git] / drivers / staging / brcm80211 / brcmsmac / wl_ucode_loader.c
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 #include <linux/types.h>
18 #include <bcmdefs.h>
19 #include <wl_ucode.h>
20
21 enum {
22         D11UCODE_NAMETAG_START = 0,
23         D11LCN0BSINITVALS24,
24         D11LCN0INITVALS24,
25         D11LCN1BSINITVALS24,
26         D11LCN1INITVALS24,
27         D11LCN2BSINITVALS24,
28         D11LCN2INITVALS24,
29         D11N0ABSINITVALS16,
30         D11N0BSINITVALS16,
31         D11N0INITVALS16,
32         D11UCODE_OVERSIGHT16_MIMO,
33         D11UCODE_OVERSIGHT16_MIMOSZ,
34         D11UCODE_OVERSIGHT24_LCN,
35         D11UCODE_OVERSIGHT24_LCNSZ,
36         D11UCODE_OVERSIGHT_BOMMAJOR,
37         D11UCODE_OVERSIGHT_BOMMINOR
38 };
39
40 struct d11init *d11lcn0bsinitvals24;
41 struct d11init *d11lcn0initvals24;
42 struct d11init *d11lcn1bsinitvals24;
43 struct d11init *d11lcn1initvals24;
44 struct d11init *d11lcn2bsinitvals24;
45 struct d11init *d11lcn2initvals24;
46 struct d11init *d11n0absinitvals16;
47 struct d11init *d11n0bsinitvals16;
48 struct d11init *d11n0initvals16;
49 u32 *bcm43xx_16_mimo;
50 u32 bcm43xx_16_mimosz;
51 u32 *bcm43xx_24_lcn;
52 u32 bcm43xx_24_lcnsz;
53 u32 *bcm43xx_bommajor;
54 u32 *bcm43xx_bomminor;
55
56 int wl_ucode_data_init(struct wl_info *wl)
57 {
58         int rc;
59         rc = wl_check_firmwares(wl);
60
61         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn0bsinitvals24,
62                                              D11LCN0BSINITVALS24);
63         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn0initvals24,
64                                              D11LCN0INITVALS24);
65         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn1bsinitvals24,
66                                              D11LCN1BSINITVALS24);
67         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn1initvals24,
68                                              D11LCN1INITVALS24);
69         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn2bsinitvals24,
70                                              D11LCN2BSINITVALS24);
71         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn2initvals24,
72                                              D11LCN2INITVALS24);
73         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11n0absinitvals16,
74                                              D11N0ABSINITVALS16);
75         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11n0bsinitvals16,
76                                              D11N0BSINITVALS16);
77         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11n0initvals16,
78                                              D11N0INITVALS16);
79         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_16_mimo,
80                                              D11UCODE_OVERSIGHT16_MIMO);
81         rc = rc < 0 ? rc : wl_ucode_init_uint(wl, &bcm43xx_16_mimosz,
82                                               D11UCODE_OVERSIGHT16_MIMOSZ);
83         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_24_lcn,
84                                              D11UCODE_OVERSIGHT24_LCN);
85         rc = rc < 0 ? rc : wl_ucode_init_uint(wl, &bcm43xx_24_lcnsz,
86                                               D11UCODE_OVERSIGHT24_LCNSZ);
87         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_bommajor,
88                                              D11UCODE_OVERSIGHT_BOMMAJOR);
89         rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_bomminor,
90                                              D11UCODE_OVERSIGHT_BOMMINOR);
91         return rc;
92 }
93
94 void wl_ucode_data_free(void)
95 {
96         wl_ucode_free_buf((void *)d11lcn0bsinitvals24);
97         wl_ucode_free_buf((void *)d11lcn0initvals24);
98         wl_ucode_free_buf((void *)d11lcn1bsinitvals24);
99         wl_ucode_free_buf((void *)d11lcn1initvals24);
100         wl_ucode_free_buf((void *)d11lcn2bsinitvals24);
101         wl_ucode_free_buf((void *)d11lcn2initvals24);
102         wl_ucode_free_buf((void *)d11n0absinitvals16);
103         wl_ucode_free_buf((void *)d11n0bsinitvals16);
104         wl_ucode_free_buf((void *)d11n0initvals16);
105         wl_ucode_free_buf((void *)bcm43xx_16_mimo);
106         wl_ucode_free_buf((void *)bcm43xx_24_lcn);
107         wl_ucode_free_buf((void *)bcm43xx_bommajor);
108         wl_ucode_free_buf((void *)bcm43xx_bomminor);
109
110         return;
111 }