2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * ISP Firmware Modules for FreeBSD
6 * Copyright (c) 2000, 2001, 2006 by Matthew Jacob
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice immediately at the beginning of the file, without modification,
14 * this list of conditions, and the following disclaimer.
15 * 2. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <sys/cdefs.h>
32 __FBSDID("$FreeBSD$");
34 #include <sys/param.h>
35 #include <sys/firmware.h>
36 #include <sys/kernel.h>
37 #include <sys/linker.h>
38 #include <sys/module.h>
39 #include <sys/systm.h>
41 #if defined(ISP_ALL) || !defined(KLD_MODULE)
47 #define MODULE_NAME "ispfw"
51 #include <dev/ispfw/asm_2400.h>
54 #include <dev/ispfw/asm_2500.h>
58 static int isp_2400_loaded;
61 static int isp_2500_loaded;
64 #define ISPFW_VERSION 1
66 #define RMACRO(token) do { \
69 if (firmware_register(#token, token##_risc_code, \
70 token##_risc_code[3] * sizeof(token##_risc_code[3]), \
71 ISPFW_VERSION, NULL) == NULL) \
76 #define UMACRO(token) do { \
77 if (!token##_loaded) \
79 if (firmware_unregister(#token) != 0) { \
104 #if defined(ISP_2400)
107 #if defined(ISP_2500)
114 module_handler(module_t mod, int what, void *arg)
119 return (do_load_fw());
121 return (do_unload_fw());
125 static moduledata_t ispfw_mod = {
126 MODULE_NAME, module_handler, NULL
128 #if defined(ISP_ALL) || !defined(KLD_MODULE)
129 DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
130 #elif defined(ISP_2400)
131 DECLARE_MODULE(isp_2400, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
132 #elif defined(ISP_2500)
133 DECLARE_MODULE(isp_2500, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
135 #error "firmware not specified"