Re: [PATCH] tg3 driver - make use of binary-only firmware optional

From: Andreas Jochens
Date: Mon Apr 19 2004 - 03:07:16 EST


On 04-Apr-18 18:08, David S. Miller wrote:
> However, that in no way means that Jeff and myself have to split
> the firmware out of the driver either. In fact, I do not want to
> as I like keeping all of the network drivers I write in single
> foo.c and foo.h files.

Would the patch be acceptable if the firmware parts were kept in tg3.c
as they are now but #ifdef'd out when CONFIG_TIGON3_FIRMWARE is not set?

At least this would make it clear that the driver is usable even without
the firmware. Or is there perhaps any technical problem which might
occur when firmware loading is optionally disabled as indicated below?

Thank you for your attention.

Andreas Jochens

diff -urN linux-2.6.5.orig/drivers/net/Kconfig linux-2.6.5/drivers/net/Kconfig
--- linux-2.6.5.orig/drivers/net/Kconfig 2004-04-03 21:38:10.000000000 -0600
+++ linux-2.6.5/drivers/net/Kconfig 2004-04-19 01:16:17.726738720 -0500
@@ -2060,6 +2060,14 @@
To compile this driver as a module, choose M here: the module
will be called tg3. This is recommended.

+config TIGON3_FIRMWARE
+ bool "Include firmware (for TSO support and for 5701_a0)"
+ depends on TIGON3
+ default y
+ help
+ This includes binary-only firmware for TSO support and a
+ binary-only firmware fix for the 5701_a0 chipset. If unsure, say Y.
+
endmenu

#
diff -urN linux-2.6.5.orig/drivers/net/tg3.c linux-2.6.5/drivers/net/tg3.c
--- linux-2.6.5.orig/drivers/net/tg3.c 2004-04-03 21:37:23.000000000 -0600
+++ linux-2.6.5/drivers/net/tg3.c 2004-04-19 01:24:48.284122200 -0500
@@ -46,6 +46,10 @@
#define TG3_VLAN_TAG_USED 0
#endif

+#ifndef CONFIG_TIGON3_FIRMWARE
+#undef NETIF_F_TSO
+#endif
+
#ifdef NETIF_F_TSO
#define TG3_TSO_SUPPORT 1
#else
@@ -3541,6 +3545,8 @@
return 0;
}

+#ifdef CONFIG_TIGON3_FIRMWARE
+
#define TG3_FW_RELEASE_MAJOR 0x0
#define TG3_FW_RELASE_MINOR 0x0
#define TG3_FW_RELEASE_FIX 0x0
@@ -4411,6 +4417,8 @@

#endif /* TG3_TSO_SUPPORT != 0 */

+#endif /* CONFIG_TIGON3_FIRMWARE */
+
/* tp->lock is held. */
static void __tg3_set_mac_addr(struct tg3 *tp)
{
@@ -4947,9 +4955,17 @@
tw32(SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE);

if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
+#ifdef CONFIG_TIGON3_FIRMWARE
err = tg3_load_5701_a0_firmware_fix(tp);
if (err)
return err;
+#else
+ printk(KERN_ERR PFX "%s: tg3_reset_hardware - "
+ "5701_a0 firmware fix not loaded\n",
+ tp->dev->name );
+ return -ENODEV;
+#endif
+
}

#if TG3_TSO_SUPPORT != 0
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/