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_1080)
103 static int isp_1080_loaded;
105 #if defined(ISP_12160)
106 static int isp_12160_loaded;
108 #if defined(ISP_2100)
109 static int isp_2100_loaded;
111 #if defined(ISP_2200)
112 static int isp_2200_loaded;
114 #if defined(ISP_2300)
115 static int isp_2300_loaded;
117 #if defined(ISP_2322)
118 static int isp_2322_loaded;
120 #if defined(ISP_2400)
121 static int isp_2400_loaded;
123 #if defined(ISP_2500)
124 static int isp_2500_loaded;
127 #define ISPFW_VERSION 1
129 #define RMACRO(token) do { \
130 if (token##_loaded) \
132 if (firmware_register(#token, token##_risc_code, \
133 token##_risc_code[3] * sizeof(token##_risc_code[3]), \
134 ISPFW_VERSION, NULL) == NULL) \
139 #define UMACRO(token) do { \
140 if (!token##_loaded) \
142 if (firmware_unregister(#token) != 0) { \
153 #if defined(ISP_1000)
156 #if defined(ISP_1040)
159 #if defined(ISP_1080)
162 #if defined(ISP_12160)
165 #if defined(ISP_2100)
168 #if defined(ISP_2200)
171 #if defined(ISP_2300)
174 #if defined(ISP_2322)
177 #if defined(ISP_2400)
180 #if defined(ISP_2500)
191 #if defined(ISP_1000)
194 #if defined(ISP_1040)
197 #if defined(ISP_1080)
200 #if defined(ISP_12160)
203 #if defined(ISP_2100)
206 #if defined(ISP_2200)
209 #if defined(ISP_2300)
212 #if defined(ISP_2322)
215 #if defined(ISP_2400)
218 #if defined(ISP_2500)
225 module_handler(module_t mod, int what, void *arg)
230 return (do_load_fw());
232 return (do_unload_fw());
236 static moduledata_t ispfw_mod = {
237 MODULE_NAME, module_handler, NULL
239 #if defined(ISP_ALL) || !defined(KLD_MODULE)
240 DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
241 #elif defined(ISP_1000)
242 DECLARE_MODULE(isp_1000, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
243 #elif defined(ISP_1040)
244 DECLARE_MODULE(isp_1040, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
245 #elif defined(ISP_1080)
246 DECLARE_MODULE(isp_1080, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
247 #elif defined(ISP_12160)
248 DECLARE_MODULE(isp_12160, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
249 #elif defined(ISP_2100)
250 DECLARE_MODULE(isp_2100, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
251 #elif defined(ISP_2200)
252 DECLARE_MODULE(isp_2200, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
253 #elif defined(ISP_2300)
254 DECLARE_MODULE(isp_2300, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
255 #elif defined(ISP_2322)
256 DECLARE_MODULE(isp_2322, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
257 #elif defined(ISP_2400)
258 DECLARE_MODULE(isp_2400, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
259 #elif defined(ISP_2500)
260 DECLARE_MODULE(isp_2500, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
262 #error "firmware not specified"