freebsd-dev/sys/dev/mxge/mxge_ethp_z8e.c
Andrew Gallatin f9ae02802f - Enable static building of mxge(4) and its firmware.
- Add custom .c wrappers for the firmware, rather than the standard
  firmware(9) generated firmware objects to work around toolchain
  problems on ia64 involving linking objects produced by
  ld -b -binary into the kernel.

- Move from using Myricom's ".dat" firmware blobs to using Myricom's
  zlib compressed ".h" firmware header files.  This is done to
  facilitate the custom wrappers, and saves a fair amount of wired
  memory in the case where the firmware is built in, or preloaded.

- Fix two compile issues in mxge which only appear on non-i386/amd64.

Reviewed by: mlaier, mav (earlier version with just zlib support)
Glanced at by: sam
Approved by: re (kensmith)
2007-07-19 16:16:00 +00:00

48 lines
1.1 KiB
C

/*
* from: FreeBSD: src/sys/tools/fw_stub.awk,v 1.6 2007/03/02 11:42:53 flz
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/linker.h>
#include <sys/firmware.h>
#include <sys/systm.h>
#include <dev/mxge/ethp_z8e.h>
static int
mxge_ethp_z8e_fw_modevent(module_t mod, int type, void *unused)
{
const struct firmware *fp, *parent;
int error;
switch (type) {
case MOD_LOAD:
fp = firmware_register("mxge_ethp_z8e", ethp_z8e,
(size_t)ethp_z8e_length,
ethp_z8e_uncompressed_length, NULL);
if (fp == NULL)
goto fail_0;
parent = fp;
return (0);
fail_0:
return (ENXIO);
case MOD_UNLOAD:
error = firmware_unregister("mxge_ethp_z8e");
return (error);
}
return (EINVAL);
}
static moduledata_t mxge_ethp_z8e_fw_mod = {
"mxge_ethp_z8e_fw",
mxge_ethp_z8e_fw_modevent,
0
};
DECLARE_MODULE(mxge_ethp_z8e_fw, mxge_ethp_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(mxge_ethp_z8e_fw, 1);
MODULE_DEPEND(mxge_ethp_z8e_fw, firmware, 1, 1, 1);