diff options
author | Brice Goglin <brice@myri.com> | 2009-04-15 22:24:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-16 21:00:43 -0400 |
commit | 2d90b0aa3bc484189940444bcddcbe0ebbb53af5 (patch) | |
tree | 06ad73d3d07583ad25f1b50337b2f69a9855dcca /drivers | |
parent | 590818250684d18bb0e30c45d79971dcdff96ad0 (diff) |
myri10ge: allow per-board firmware overriding
Add myri10ge_fw_names to override the default firmware
on a per-board basis.
Signed-off-by: Brice Goglin <brice@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index a833cdd85466..77de964fe676 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -255,6 +255,7 @@ struct myri10ge_priv { | |||
255 | u32 read_write_dma; | 255 | u32 read_write_dma; |
256 | u32 link_changes; | 256 | u32 link_changes; |
257 | u32 msg_enable; | 257 | u32 msg_enable; |
258 | unsigned int board_number; | ||
258 | }; | 259 | }; |
259 | 260 | ||
260 | static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat"; | 261 | static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat"; |
@@ -266,6 +267,13 @@ static char *myri10ge_fw_name = NULL; | |||
266 | module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); | 267 | module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); |
267 | MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name"); | 268 | MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name"); |
268 | 269 | ||
270 | #define MYRI10GE_MAX_BOARDS 8 | ||
271 | static char *myri10ge_fw_names[MYRI10GE_MAX_BOARDS] = | ||
272 | {[0...(MYRI10GE_MAX_BOARDS - 1)] = NULL }; | ||
273 | module_param_array_named(myri10ge_fw_names, myri10ge_fw_names, charp, NULL, | ||
274 | 0444); | ||
275 | MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image names per board"); | ||
276 | |||
269 | static int myri10ge_ecrc_enable = 1; | 277 | static int myri10ge_ecrc_enable = 1; |
270 | module_param(myri10ge_ecrc_enable, int, S_IRUGO); | 278 | module_param(myri10ge_ecrc_enable, int, S_IRUGO); |
271 | MODULE_PARM_DESC(myri10ge_ecrc_enable, "Enable Extended CRC on PCI-E"); | 279 | MODULE_PARM_DESC(myri10ge_ecrc_enable, "Enable Extended CRC on PCI-E"); |
@@ -3259,6 +3267,8 @@ abort: | |||
3259 | 3267 | ||
3260 | static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | 3268 | static void myri10ge_select_firmware(struct myri10ge_priv *mgp) |
3261 | { | 3269 | { |
3270 | int overridden = 0; | ||
3271 | |||
3262 | if (myri10ge_force_firmware == 0) { | 3272 | if (myri10ge_force_firmware == 0) { |
3263 | int link_width, exp_cap; | 3273 | int link_width, exp_cap; |
3264 | u16 lnk; | 3274 | u16 lnk; |
@@ -3292,10 +3302,18 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
3292 | } | 3302 | } |
3293 | } | 3303 | } |
3294 | if (myri10ge_fw_name != NULL) { | 3304 | if (myri10ge_fw_name != NULL) { |
3295 | dev_info(&mgp->pdev->dev, "overriding firmware to %s\n", | 3305 | overridden = 1; |
3296 | myri10ge_fw_name); | ||
3297 | mgp->fw_name = myri10ge_fw_name; | 3306 | mgp->fw_name = myri10ge_fw_name; |
3298 | } | 3307 | } |
3308 | if (mgp->board_number < MYRI10GE_MAX_BOARDS && | ||
3309 | myri10ge_fw_names[mgp->board_number] != NULL && | ||
3310 | strlen(myri10ge_fw_names[mgp->board_number])) { | ||
3311 | mgp->fw_name = myri10ge_fw_names[mgp->board_number]; | ||
3312 | overridden = 1; | ||
3313 | } | ||
3314 | if (overridden) | ||
3315 | dev_info(&mgp->pdev->dev, "overriding firmware to %s\n", | ||
3316 | mgp->fw_name); | ||
3299 | } | 3317 | } |
3300 | 3318 | ||
3301 | #ifdef CONFIG_PM | 3319 | #ifdef CONFIG_PM |
@@ -3760,6 +3778,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3760 | int status = -ENXIO; | 3778 | int status = -ENXIO; |
3761 | int dac_enabled; | 3779 | int dac_enabled; |
3762 | unsigned hdr_offset, ss_offset; | 3780 | unsigned hdr_offset, ss_offset; |
3781 | static int board_number; | ||
3763 | 3782 | ||
3764 | netdev = alloc_etherdev_mq(sizeof(*mgp), MYRI10GE_MAX_SLICES); | 3783 | netdev = alloc_etherdev_mq(sizeof(*mgp), MYRI10GE_MAX_SLICES); |
3765 | if (netdev == NULL) { | 3784 | if (netdev == NULL) { |
@@ -3776,6 +3795,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3776 | mgp->pause = myri10ge_flow_control; | 3795 | mgp->pause = myri10ge_flow_control; |
3777 | mgp->intr_coal_delay = myri10ge_intr_coal_delay; | 3796 | mgp->intr_coal_delay = myri10ge_intr_coal_delay; |
3778 | mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT); | 3797 | mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT); |
3798 | mgp->board_number = board_number; | ||
3779 | init_waitqueue_head(&mgp->down_wq); | 3799 | init_waitqueue_head(&mgp->down_wq); |
3780 | 3800 | ||
3781 | if (pci_enable_device(pdev)) { | 3801 | if (pci_enable_device(pdev)) { |
@@ -3926,6 +3946,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3926 | netdev->irq, mgp->tx_boundary, mgp->fw_name, | 3946 | netdev->irq, mgp->tx_boundary, mgp->fw_name, |
3927 | (mgp->wc_enabled ? "Enabled" : "Disabled")); | 3947 | (mgp->wc_enabled ? "Enabled" : "Disabled")); |
3928 | 3948 | ||
3949 | board_number++; | ||
3929 | return 0; | 3950 | return 0; |
3930 | 3951 | ||
3931 | abort_with_state: | 3952 | abort_with_state: |