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/cxgb/cxgb_t3fw.h>
14 #include <dev/cxgb/t3b_protocol_sram.h>
15 #include <dev/cxgb/t3b_tp_eeprom.h>
16
17 static int
18 cxgb_t3fw_modevent(module_t mod, int type, void *unused)
19 {
20 const struct firmware *fp, *parent;
21 int error;
22 switch (type) {
23 case MOD_LOAD:
24
25 fp = firmware_register("cxgb_t3fw", t3fw,
26 (size_t)t3fw_length,
27 0, NULL);
28 if (fp == NULL)
29 goto fail_0;
30 parent = fp;
31 return (0);
32 fail_0:
33 return (ENXIO);
34 case MOD_UNLOAD:
35 error = firmware_unregister("cxgb_t3fw");
36 return (error);
37 }
38 return (EINVAL);
39 }
40
41 static moduledata_t cxgb_t3fw_mod = {
42 "cxgb_t3fw",
43 cxgb_t3fw_modevent,
44 0
45 };
46 DECLARE_MODULE(cxgb_t3fw, cxgb_t3fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
47 MODULE_VERSION(cxgb_t3fw, 1);
48 MODULE_DEPEND(cxgb_t3fw, firmware, 1, 1, 1);
49
50 static int
51 cxgb_t3b_protocol_sram_modevent(module_t mod, int type, void *unused)
52 {
53 const struct firmware *fp, *parent;
54 int error;
55 switch (type) {
56 case MOD_LOAD:
57
58 fp = firmware_register("cxgb_t3b_protocol_sram", t3b_protocol_sram,
59 (size_t)t3b_protocol_sram_length,
60 0, NULL);
61 if (fp == NULL)
62 goto fail_0;
63 parent = fp;
64 return (0);
65 fail_0:
66 return (ENXIO);
67 case MOD_UNLOAD:
68 error = firmware_unregister("cxgb_t3b_protocol_sram");
69 return (error);
70 }
71 return (EINVAL);
72 }
73
74 static moduledata_t cxgb_t3b_protocol_sram_mod = {
75 "cxgb_t3b_protocol_sram",
76 cxgb_t3b_protocol_sram_modevent,
77 0
78 };
79 DECLARE_MODULE(cxgb_t3b_protocol_sram, cxgb_t3b_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
80 MODULE_VERSION(cxgb_t3b_protocol_sram, 1);
81 MODULE_DEPEND(cxgb_t3b_protocol_sram, firmware, 1, 1, 1);
82
83
84 static int
85 cxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused)
86 {
87 const struct firmware *fp, *parent;
88 int error;
89 switch (type) {
90 case MOD_LOAD:
91
92 fp = firmware_register("cxgb_t3b_tp_eeprom", t3b_tp_eeprom,
93 (size_t)t3b_tp_eeprom_length,
94 0, NULL);
95 if (fp == NULL)
96 goto fail_0;
97 parent = fp;
98 return (0);
99 fail_0:
100 return (ENXIO);
101 case MOD_UNLOAD:
102 error = firmware_unregister("cxgb_t3b_tp_eeprom");
103 return (error);
104 }
105 return (EINVAL);
106 }
107
108 static moduledata_t cxgb_t3b_tp_eeprom_mod = {
109 "cxgb_t3b_tp_eeprom",
110 cxgb_t3b_tp_eeprom_modevent,
111 0
112 };
113 DECLARE_MODULE(cxgb_t3b_tp_eeprom, cxgb_t3b_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
114 MODULE_VERSION(cxgb_t3b_tp_eeprom, 1);
115 MODULE_DEPEND(cxgb_t3b_tp_eeprom, firmware, 1, 1, 1);
Cache object: 9701a8251402ef077f47cb23e5f6dc40
|