1 /*
2 * from: FreeBSD: src/sys/tools/fw_stub.awk,v 1.6 2007/03/02 11:42:53 flz
3 */
4
5 #include <sys/param.h>
6 #include <sys/errno.h>
7 #include <sys/kernel.h>
8 #include <sys/module.h>
9 #include <sys/linker.h>
10 #include <sys/firmware.h>
11 #include <sys/systm.h>
12 #include <dev/mxge/eth_z8e.h>
13
14 static int
mxge_eth_z8e_fw_modevent(module_t mod,int type,void * unused)15 mxge_eth_z8e_fw_modevent(module_t mod, int type, void *unused)
16 {
17 const struct firmware *fp;
18 int error;
19 switch (type) {
20 case MOD_LOAD:
21
22 fp = firmware_register("mxge_eth_z8e", eth_z8e,
23 (size_t)eth_z8e_length,
24 eth_z8e_uncompressed_length, NULL);
25 if (fp == NULL)
26 goto fail_0;
27 return (0);
28 fail_0:
29 return (ENXIO);
30 case MOD_UNLOAD:
31 error = firmware_unregister("mxge_eth_z8e");
32 return (error);
33 }
34 return (EINVAL);
35 }
36
37 static moduledata_t mxge_eth_z8e_fw_mod = {
38 "mxge_eth_z8e_fw",
39 mxge_eth_z8e_fw_modevent,
40 0
41 };
42 DECLARE_MODULE(mxge_eth_z8e_fw, mxge_eth_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
43 MODULE_VERSION(mxge_eth_z8e_fw, 1);
44 MODULE_DEPEND(mxge_eth_z8e_fw, firmware, 1, 1, 1);
45