cxgb_t3fw.c revision 176572
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: head/sys/dev/cxgb/cxgb_t3fw.c 176572 2008-02-26 03:02:20Z kmacy $");
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/cxgb/cxgb_t3fw.h>
14
15static int
16cxgb_t3fw_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("cxgb_t3fw", t3fw,
24				       (size_t)t3fw_length,
25				       0, 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("cxgb_t3fw");
34		return (error);
35	}
36	return (EINVAL);
37}
38
39static moduledata_t cxgb_t3fw_mod = {
40        "cxgb_t3fw",
41        cxgb_t3fw_modevent,
42        0
43};
44DECLARE_MODULE(cxgb_t3fw, cxgb_t3fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
45MODULE_VERSION(cxgb_t3fw, 1);
46MODULE_DEPEND(cxgb_t3fw, firmware, 1, 1, 1);
47
48