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