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
58 #define MODULE_NAME "ispfw"
63 #include <dev/ispfw/asm_1000.h>
65 #error "firmware not compatible with this platform"
68 #if defined(ISP_1040) || defined(ISP_1040_IT)
69 #include <dev/ispfw/asm_1040.h>
71 #if defined(ISP_1080) || defined(ISP_1080_IT)
72 #include <dev/ispfw/asm_1080.h>
74 #if defined(ISP_12160) || defined(ISP_12160_IT)
75 #include <dev/ispfw/asm_12160.h>
78 #include <dev/ispfw/asm_2100.h>
81 #include <dev/ispfw/asm_2200.h>
84 #include <dev/ispfw/asm_2300.h>
87 #include <dev/ispfw/asm_2322.h>
90 #include <dev/ispfw/asm_2400.h>
93 #include <dev/ispfw/asm_2500.h>
97 static int isp_1000_loaded;
100 static int isp_1040_loaded;
102 #if defined(ISP_1040_IT)
103 static int isp_1040_it_loaded;
105 #if defined(ISP_1080)
106 static int isp_1080_loaded;
108 #if defined(ISP_1080_IT)
109 static int isp_1080_it_loaded;
111 #if defined(ISP_12160)
112 static int isp_12160_loaded;
114 #if defined(ISP_12160_IT)
115 static int isp_12160_it_loaded;
117 #if defined(ISP_2100)
118 static int isp_2100_loaded;
120 #if defined(ISP_2200)
121 static int isp_2200_loaded;
123 #if defined(ISP_2300)
124 static int isp_2300_loaded;
126 #if defined(ISP_2322)
127 static int isp_2322_loaded;
129 #if defined(ISP_2400)
130 static int isp_2400_loaded;
132 #if defined(ISP_2500)
133 static int isp_2500_loaded;
136 #define ISPFW_VERSION 1
138 #define RMACRO(token) do { \
139 if (token##_loaded) \
141 if (firmware_register(#token, token##_risc_code, \
142 token##_risc_code[3] * sizeof(token##_risc_code[3]), \
143 ISPFW_VERSION, NULL) == NULL) \
148 #define UMACRO(token) do { \
149 if (!token##_loaded) \
151 if (firmware_unregister(#token) != 0) { \
162 #if defined(ISP_1000)
165 #if defined(ISP_1040)
168 #if defined(ISP_1040_IT)
171 #if defined(ISP_1080)
174 #if defined(ISP_1080_IT)
177 #if defined(ISP_12160)
180 #if defined(ISP_12160_IT)
181 RMACRO(isp_12160_it);
183 #if defined(ISP_2100)
186 #if defined(ISP_2200)
189 #if defined(ISP_2300)
192 #if defined(ISP_2322)
195 #if defined(ISP_2400)
198 #if defined(ISP_2500)
209 #if defined(ISP_1000)
212 #if defined(ISP_1040)
215 #if defined(ISP_1040_IT)
218 #if defined(ISP_1080)
221 #if defined(ISP_1080_IT)
224 #if defined(ISP_12160)
227 #if defined(ISP_12160_IT)
228 UMACRO(isp_12160_it);
230 #if defined(ISP_2100)
233 #if defined(ISP_2200)
236 #if defined(ISP_2300)
239 #if defined(ISP_2322)
242 #if defined(ISP_2400)
245 #if defined(ISP_2500)
252 module_handler(module_t mod, int what, void *arg)
257 return (do_load_fw());
259 return (do_unload_fw());
263 static moduledata_t ispfw_mod = {
264 MODULE_NAME, module_handler, NULL
266 #if defined(ISP_ALL) || !defined(KLD_MODULE)
267 DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
268 #elif defined(ISP_1000)
269 DECLARE_MODULE(isp_1000, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
270 #elif defined(ISP_1040)
271 DECLARE_MODULE(isp_1040, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
272 #elif defined(ISP_1040_IT)
273 DECLARE_MODULE(isp_1040_it, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
274 #elif defined(ISP_1080)
275 DECLARE_MODULE(isp_1080, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
276 #elif defined(ISP_1080_IT)
277 DECLARE_MODULE(isp_1080_it, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
278 #elif defined(ISP_12160)
279 DECLARE_MODULE(isp_12160, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
280 #elif defined(ISP_12160_IT)
281 DECLARE_MODULE(isp_12160_IT, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
282 #elif defined(ISP_2100)
283 DECLARE_MODULE(isp_2100, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
284 #elif defined(ISP_2200)
285 DECLARE_MODULE(isp_2200, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
286 #elif defined(ISP_2300)
287 DECLARE_MODULE(isp_2300, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
288 #elif defined(ISP_2322)
289 DECLARE_MODULE(isp_2322, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
290 #elif defined(ISP_2400)
291 DECLARE_MODULE(isp_2400, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
292 #elif defined(ISP_2500)
293 DECLARE_MODULE(isp_2500, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
295 #error "firmware not specified"