summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgb/cxgb_t3fw.c
blob: cf54f9c40e75ee28308a02b481051f33f3ea0061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 * 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 <cxgb_t3fw.h>
#include <t3b_protocol_sram.h>
#include <t3b_tp_eeprom.h>

static int
cxgb_t3fw_modevent(module_t mod, int type, void *unused)
{
	const struct firmware *fp, *parent;
	int error;
	switch (type) {
	case MOD_LOAD:

		fp = firmware_register("cxgb_t3fw", t3fw, 
				       (size_t)t3fw_length,
				       0, NULL);
		if (fp == NULL)
			goto fail_0;
		parent = fp;
		return (0);
	fail_0:
		return (ENXIO);
	case MOD_UNLOAD:
		error = firmware_unregister("cxgb_t3fw");
		return (error);
	}
	return (EINVAL);
}

static moduledata_t cxgb_t3fw_mod = {
        "cxgb_t3fw",
        cxgb_t3fw_modevent,
        0
};
DECLARE_MODULE(cxgb_t3fw, cxgb_t3fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(cxgb_t3fw, 1);
MODULE_DEPEND(cxgb_t3fw, firmware, 1, 1, 1);

static int
cxgb_t3b_protocol_sram_modevent(module_t mod, int type, void *unused)
{
	const struct firmware *fp, *parent;
	int error;
	switch (type) {
	case MOD_LOAD:

		fp = firmware_register("cxgb_t3b_protocol_sram", t3b_protocol_sram, 
				       (size_t)t3b_protocol_sram_length,
				       0, NULL);
		if (fp == NULL)
			goto fail_0;
		parent = fp;
		return (0);
	fail_0:
		return (ENXIO);
	case MOD_UNLOAD:
		error = firmware_unregister("cxgb_t3b_protocol_sram");
		return (error);
	}
	return (EINVAL);
}

static moduledata_t cxgb_t3b_protocol_sram_mod = {
        "cxgb_t3b_protocol_sram",
        cxgb_t3b_protocol_sram_modevent,
        0
};
DECLARE_MODULE(cxgb_t3b_protocol_sram, cxgb_t3b_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(cxgb_t3b_protocol_sram, 1);
MODULE_DEPEND(cxgb_t3b_protocol_sram, firmware, 1, 1, 1);


static int
cxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused)
{
	const struct firmware *fp, *parent;
	int error;
	switch (type) {
	case MOD_LOAD:

		fp = firmware_register("cxgb_t3b_tp_eeprom", t3b_tp_eeprom, 
				       (size_t)t3b_tp_eeprom_length,
				       0, NULL);
		if (fp == NULL)
			goto fail_0;
		parent = fp;
		return (0);
	fail_0:
		return (ENXIO);
	case MOD_UNLOAD:
		error = firmware_unregister("cxgb_t3b_tp_eeprom");
		return (error);
	}
	return (EINVAL);
}

static moduledata_t cxgb_t3b_tp_eeprom_mod = {
        "cxgb_t3b_tp_eeprom",
        cxgb_t3b_tp_eeprom_modevent,
        0
};
DECLARE_MODULE(cxgb_t3b_tp_eeprom, cxgb_t3b_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(cxgb_t3b_tp_eeprom, 1);
MODULE_DEPEND(cxgb_t3b_tp_eeprom, firmware, 1, 1, 1);
OpenPOWER on IntegriCloud