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/ethp_z8e.h> 14 15 static int 16 mxge_ethp_z8e_fw_modevent(module_t mod, int type, void *unused) 17 { 18 const struct firmware *fp, *parent; 19 int error; 20 switch (type) { 21 case MOD_LOAD: 22 23 fp = firmware_register("mxge_ethp_z8e", ethp_z8e, 24 (size_t)ethp_z8e_length, 25 ethp_z8e_uncompressed_length, NULL); 26 if (fp == NULL) 27 goto fail_0; 28 parent = fp; 29 return (0); 30 fail_0: 31 return (ENXIO); 32 case MOD_UNLOAD: 33 error = firmware_unregister("mxge_ethp_z8e"); 34 return (error); 35 } 36 return (EINVAL); 37 } 38 39 static moduledata_t mxge_ethp_z8e_fw_mod = { 40 "mxge_ethp_z8e_fw", 41 mxge_ethp_z8e_fw_modevent, 42 0 43 }; 44 DECLARE_MODULE(mxge_ethp_z8e_fw, mxge_ethp_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); 45 MODULE_VERSION(mxge_ethp_z8e_fw, 1); 46 MODULE_DEPEND(mxge_ethp_z8e_fw, firmware, 1, 1, 1); 47