cxgb_t3fw.c revision 189643
153541Sshin/*
253541Sshin * from: FreeBSD: src/sys/tools/fw_stub.awk,v 1.6 2007/03/02 11:42:53 flz
353541Sshin */
453541Sshin#include <sys/cdefs.h>
553541Sshin__FBSDID("$FreeBSD: head/sys/dev/cxgb/cxgb_t3fw.c 189643 2009-03-10 19:22:45Z gnn $");
653541Sshin#include <sys/param.h>
753541Sshin#include <sys/errno.h>
853541Sshin#include <sys/kernel.h>
953541Sshin#include <sys/module.h>
1053541Sshin#include <sys/linker.h>
1153541Sshin#include <sys/firmware.h>
1253541Sshin#include <sys/systm.h>
1353541Sshin#include <cxgb_t3fw.h>
1453541Sshin#include <t3b_protocol_sram.h>
1553541Sshin#include <t3b_tp_eeprom.h>
1653541Sshin#include <t3c_protocol_sram.h>
1753541Sshin#include <t3c_tp_eeprom.h>
1853541Sshin
1953541Sshinstatic int
2053541Sshincxgb_t3fw_modevent(module_t mod, int type, void *unused)
2153541Sshin{
2253541Sshin	const struct firmware *fp, *parent;
2353541Sshin	int error;
2453541Sshin	switch (type) {
2553541Sshin	case MOD_LOAD:
2653541Sshin
2753541Sshin		fp = firmware_register("cxgb_t3fw", t3fw,
2853541Sshin				       (size_t)t3fw_length,
2953541Sshin				       0, NULL);
3053541Sshin		if (fp == NULL)
3153541Sshin			goto fail_0;
3253541Sshin		parent = fp;
3353541Sshin		return (0);
3453541Sshin	fail_0:
3553541Sshin		return (ENXIO);
3653541Sshin	case MOD_UNLOAD:
3753541Sshin		error = firmware_unregister("cxgb_t3fw");
3853541Sshin		return (error);
3953541Sshin	}
4053541Sshin	return (EINVAL);
4153541Sshin}
4253541Sshin
4353541Sshinstatic moduledata_t cxgb_t3fw_mod = {
4453541Sshin        "cxgb_t3fw",
4553541Sshin        cxgb_t3fw_modevent,
4653541Sshin        0
4753541Sshin};
4853541SshinDECLARE_MODULE(cxgb_t3fw, cxgb_t3fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
4953541SshinMODULE_VERSION(cxgb_t3fw, 1);
5053541SshinMODULE_DEPEND(cxgb_t3fw, firmware, 1, 1, 1);
5153541Sshin
5253541Sshinstatic int
5353541Sshincxgb_t3b_protocol_sram_modevent(module_t mod, int type, void *unused)
5453541Sshin{
5553541Sshin	const struct firmware *fp, *parent;
5653541Sshin	int error;
5753541Sshin	switch (type) {
5853541Sshin	case MOD_LOAD:
5953541Sshin
6053541Sshin		fp = firmware_register("cxgb_t3b_protocol_sram", t3b_protocol_sram,
6153541Sshin				       (size_t)t3b_protocol_sram_length,
6253541Sshin				       0, NULL);
6353541Sshin		if (fp == NULL)
6453541Sshin			goto fail_0;
6553541Sshin		parent = fp;
6653541Sshin		return (0);
6753541Sshin	fail_0:
6853541Sshin		return (ENXIO);
6953541Sshin	case MOD_UNLOAD:
7053541Sshin		error = firmware_unregister("cxgb_t3b_protocol_sram");
7153541Sshin		return (error);
7253541Sshin	}
7353541Sshin	return (EINVAL);
7453541Sshin}
7553541Sshin
7653541Sshinstatic moduledata_t cxgb_t3b_protocol_sram_mod = {
7753541Sshin        "cxgb_t3b_protocol_sram",
7853541Sshin        cxgb_t3b_protocol_sram_modevent,
7953541Sshin        0
8053541Sshin};
8153541SshinDECLARE_MODULE(cxgb_t3b_protocol_sram, cxgb_t3b_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
8253541SshinMODULE_VERSION(cxgb_t3b_protocol_sram, 1);
8353541SshinMODULE_DEPEND(cxgb_t3b_protocol_sram, firmware, 1, 1, 1);
8453541Sshin
8553541Sshinstatic int
8653541Sshincxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused)
8753541Sshin{
8853541Sshin	const struct firmware *fp, *parent;
8953541Sshin	int error;
9053541Sshin	switch (type) {
9153541Sshin	case MOD_LOAD:
9253541Sshin
9353541Sshin		fp = firmware_register("cxgb_t3b_tp_eeprom", t3b_tp_eeprom,
9453541Sshin				       (size_t)t3b_tp_eeprom_length,
9553541Sshin				       0, NULL);
9653541Sshin		if (fp == NULL)
9753541Sshin			goto fail_0;
9853541Sshin		parent = fp;
9953541Sshin		return (0);
10053541Sshin	fail_0:
10153541Sshin		return (ENXIO);
10253541Sshin	case MOD_UNLOAD:
10353541Sshin		error = firmware_unregister("cxgb_t3b_tp_eeprom");
10453541Sshin		return (error);
10553541Sshin	}
10653541Sshin	return (EINVAL);
10753541Sshin}
10853541Sshin
10953541Sshinstatic moduledata_t cxgb_t3b_tp_eeprom_mod = {
11053541Sshin        "cxgb_t3b_tp_eeprom",
11153541Sshin        cxgb_t3b_tp_eeprom_modevent,
11253541Sshin        0
11353541Sshin};
11453541SshinDECLARE_MODULE(cxgb_t3b_tp_eeprom, cxgb_t3b_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
11553541SshinMODULE_VERSION(cxgb_t3b_tp_eeprom, 1);
11653541SshinMODULE_DEPEND(cxgb_t3b_tp_eeprom, firmware, 1, 1, 1);
11753541Sshin
11853541Sshinstatic int
11953541Sshincxgb_t3c_protocol_sram_modevent(module_t mod, int type, void *unused)
12053541Sshin{
12153541Sshin	const struct firmware *fp, *parent;
12253541Sshin	int error;
12353541Sshin	switch (type) {
12453541Sshin	case MOD_LOAD:
12553541Sshin
12653541Sshin		fp = firmware_register("cxgb_t3c_protocol_sram", t3c_protocol_sram,
12753541Sshin				       (size_t)t3c_protocol_sram_length,
12853541Sshin				       0, NULL);
12953541Sshin		if (fp == NULL)
13053541Sshin			goto fail_0;
13153541Sshin		parent = fp;
13253541Sshin		return (0);
13353541Sshin	fail_0:
13453541Sshin		return (ENXIO);
13553541Sshin	case MOD_UNLOAD:
13653541Sshin		error = firmware_unregister("cxgb_t3c_protocol_sram");
13753541Sshin		return (error);
13853541Sshin	}
13953541Sshin	return (EINVAL);
14053541Sshin}
14153541Sshin
14253541Sshinstatic moduledata_t cxgb_t3c_protocol_sram_mod = {
14353541Sshin        "cxgb_t3c_protocol_sram",
14453541Sshin        cxgb_t3c_protocol_sram_modevent,
14553541Sshin        0
14653541Sshin};
14753541SshinDECLARE_MODULE(cxgb_t3c_protocol_sram, cxgb_t3c_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
14853541SshinMODULE_VERSION(cxgb_t3c_protocol_sram, 1);
14953541SshinMODULE_DEPEND(cxgb_t3c_protocol_sram, firmware, 1, 1, 1);
15053541Sshin
15153541Sshinstatic int
15253541Sshincxgb_t3c_tp_eeprom_modevent(module_t mod, int type, void *unused)
15353541Sshin{
15453541Sshin	const struct firmware *fp, *parent;
15553541Sshin	int error;
15653541Sshin	switch (type) {
15753541Sshin	case MOD_LOAD:
15853541Sshin
15953541Sshin		fp = firmware_register("cxgb_t3c_tp_eeprom", t3c_tp_eeprom,
16053541Sshin				       (size_t)t3c_tp_eeprom_length,
16153541Sshin				       0, NULL);
16253541Sshin		if (fp == NULL)
16353541Sshin			goto fail_0;
16453541Sshin		parent = fp;
16553541Sshin		return (0);
16653541Sshin	fail_0:
16753541Sshin		return (ENXIO);
16853541Sshin	case MOD_UNLOAD:
16953541Sshin		error = firmware_unregister("cxgb_t3c_tp_eeprom");
17053541Sshin		return (error);
17153541Sshin	}
17253541Sshin	return (EINVAL);
17353541Sshin}
17453541Sshin
17553541Sshinstatic moduledata_t cxgb_t3c_tp_eeprom_mod = {
17653541Sshin        "cxgb_t3c_tp_eeprom",
17753541Sshin        cxgb_t3c_tp_eeprom_modevent,
17853541Sshin        0
17953541Sshin};
18053541SshinDECLARE_MODULE(cxgb_t3c_tp_eeprom, cxgb_t3c_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
18153541SshinMODULE_VERSION(cxgb_t3c_tp_eeprom, 1);
18253541SshinMODULE_DEPEND(cxgb_t3c_tp_eeprom, firmware, 1, 1, 1);
18353541Sshin