2 * ISP Firmware Modules for FreeBSD
4 * Copyright (c) 2000, 2001, 2006 by Matthew Jacob
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice immediately at the beginning of the file, without modification,
12 * this list of conditions, and the following disclaimer.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
32 #include <sys/param.h>
33 #include <sys/firmware.h>
34 #include <sys/kernel.h>
35 #include <sys/linker.h>
36 #include <sys/module.h>
37 #include <sys/systm.h>
39 #if defined(ISP_ALL) || !defined(KLD_MODULE)
48 #define ISP_12160_IT 1
54 #define ISP_2400_MULTI 1
56 #define ISP_2500_MULTI 1
60 #define MODULE_NAME "ispfw"
65 #include <dev/ispfw/asm_1000.h>
67 #error "firmware not compatible with this platform"
70 #if defined(ISP_1040) || defined(ISP_1040_IT)
71 #include <dev/ispfw/asm_1040.h>
73 #if defined(ISP_1080) || defined(ISP_1080_IT)
74 #include <dev/ispfw/asm_1080.h>
76 #if defined(ISP_12160) || defined(ISP_12160_IT)
77 #include <dev/ispfw/asm_12160.h>
80 #include <dev/ispfw/asm_2100.h>
83 #include <dev/ispfw/asm_2200.h>
86 #include <dev/ispfw/asm_2300.h>
89 #include <dev/ispfw/asm_2322.h>
91 #if defined(ISP_2400) || defined(ISP_2400_MULTI)
92 #include <dev/ispfw/asm_2400.h>
94 #if defined(ISP_2500) || defined(ISP_2500_MULTI)
95 #include <dev/ispfw/asm_2500.h>
99 static int isp_1000_loaded;
101 #if defined(ISP_1040)
102 static int isp_1040_loaded;
104 #if defined(ISP_1040_IT)
105 static int isp_1040_it_loaded;
107 #if defined(ISP_1080)
108 static int isp_1080_loaded;
110 #if defined(ISP_1080_IT)
111 static int isp_1080_it_loaded;
113 #if defined(ISP_12160)
114 static int isp_12160_loaded;
116 #if defined(ISP_12160_IT)
117 static int isp_12160_it_loaded;
119 #if defined(ISP_2100)
120 static int isp_2100_loaded;
122 #if defined(ISP_2200)
123 static int isp_2200_loaded;
125 #if defined(ISP_2300)
126 static int isp_2300_loaded;
128 #if defined(ISP_2322)
129 static int isp_2322_loaded;
131 #if defined(ISP_2400)
132 static int isp_2400_loaded;
134 #if defined(ISP_2400_MULTI)
135 static int isp_2400_multi_loaded;
137 #if defined(ISP_2500)
138 static int isp_2500_loaded;
140 #if defined(ISP_2500_MULTI)
141 static int isp_2500_multi_loaded;
144 #define ISPFW_VERSION 1
146 #if !defined(KLD_MODULE)
152 #define RMACRO(token) do { \
153 if (token##_loaded) \
155 if (firmware_register(#token, token##_risc_code, \
156 token##_risc_code[3] * sizeof(token##_risc_code[3]), \
157 ISPFW_VERSION, NULL) == NULL) { \
158 printf("%s: unable to register firmware <%s>\n", \
159 MODULE_NAME, #token); \
163 if (bootverbose || ISPFW_KLD) \
164 printf("%s: registered firmware <%s>\n", MODULE_NAME, \
168 #define UMACRO(token) do { \
169 if (!token##_loaded) \
171 if (firmware_unregister(#token) != 0) { \
172 printf("%s: unable to unregister firmware <%s>\n", \
173 MODULE_NAME, #token); \
177 if (bootverbose || ISPFW_KLD) \
178 printf("%s: unregistered firmware <%s>\n", MODULE_NAME, \
186 #if defined(ISP_1000)
189 #if defined(ISP_1040)
192 #if defined(ISP_1040_IT)
195 #if defined(ISP_1080)
198 #if defined(ISP_1080_IT)
201 #if defined(ISP_12160)
204 #if defined(ISP_12160_IT)
205 RMACRO(isp_12160_it);
207 #if defined(ISP_2100)
210 #if defined(ISP_2200)
213 #if defined(ISP_2300)
216 #if defined(ISP_2322)
219 #if defined(ISP_2400)
222 #if defined(ISP_2400_MULTI)
223 RMACRO(isp_2400_multi);
225 #if defined(ISP_2500)
228 #if defined(ISP_2500_MULTI)
229 RMACRO(isp_2500_multi);
237 #if defined(ISP_1000)
240 #if defined(ISP_1040)
243 #if defined(ISP_1040_IT)
246 #if defined(ISP_1080)
249 #if defined(ISP_1080_IT)
252 #if defined(ISP_12160)
255 #if defined(ISP_12160_IT)
256 UMACRO(isp_12160_it);
258 #if defined(ISP_2100)
261 #if defined(ISP_2200)
264 #if defined(ISP_2300)
267 #if defined(ISP_2322)
270 #if defined(ISP_2400)
273 #if defined(ISP_2400_MULTI)
274 UMACRO(isp_2400_multi);
276 #if defined(ISP_2500)
279 #if defined(ISP_2500_MULTI)
280 UMACRO(isp_2500_multi);
285 module_handler(module_t mod, int what, void *arg)
302 static moduledata_t ispfw_mod = {
303 MODULE_NAME, module_handler, NULL
305 #if defined(ISP_ALL) || !defined(KLD_MODULE)
306 DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
307 #elif defined(ISP_1000)
308 DECLARE_MODULE(isp_1000, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
309 #elif defined(ISP_1040)
310 DECLARE_MODULE(isp_1040, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
311 #elif defined(ISP_1040_IT)
312 DECLARE_MODULE(isp_1040_it, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
313 #elif defined(ISP_1080)
314 DECLARE_MODULE(isp_1080, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
315 #elif defined(ISP_1080_IT)
316 DECLARE_MODULE(isp_1080_it, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
317 #elif defined(ISP_12160)
318 DECLARE_MODULE(isp_12160, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
319 #elif defined(ISP_12160_IT)
320 DECLARE_MODULE(isp_12160_IT, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
321 #elif defined(ISP_2100)
322 DECLARE_MODULE(isp_2100, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
323 #elif defined(ISP_2200)
324 DECLARE_MODULE(isp_2200, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
325 #elif defined(ISP_2300)
326 DECLARE_MODULE(isp_2300, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
327 #elif defined(ISP_2322)
328 DECLARE_MODULE(isp_2322, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
329 #elif defined(ISP_2400)
330 DECLARE_MODULE(isp_2400, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
331 #elif defined(ISP_2400_MULTI)
332 DECLARE_MODULE(isp_2400_multi, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
333 #elif defined(ISP_2500)
334 DECLARE_MODULE(isp_2500, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
335 #elif defined(ISP_2500_MULTI)
336 DECLARE_MODULE(isp_2500_multi, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
338 #error "firmware not specified"