aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-10-16 11:50:10 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-18 02:44:44 -0400
commit7cecdca133ea9791adce21819b9e9eed79045f23 (patch)
tree368fd8adec2d47e3e035631060a7fdf487876f66 /drivers/net/netxen
parent6abb4b83eac25d91f6de834e97b2ea38e979575b (diff)
netxen: fix error codes in for tools access
Use -EIO or -EINVAL as error codes, these can get passed up to applications (tools). Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c49
-rw-r--r--drivers/net/netxen/netxen_nic_init.c6
2 files changed, 31 insertions, 24 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index a63324613430..e43cbbd5bec1 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -332,7 +332,7 @@ netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg)
332 if (done == 1) 332 if (done == 1)
333 break; 333 break;
334 if (++timeout >= NETXEN_PCIE_SEM_TIMEOUT) 334 if (++timeout >= NETXEN_PCIE_SEM_TIMEOUT)
335 return -1; 335 return -EIO;
336 msleep(1); 336 msleep(1);
337 } 337 }
338 338
@@ -1083,7 +1083,7 @@ netxen_nic_pci_set_crbwindow_128M(struct netxen_adapter *adapter,
1083} 1083}
1084 1084
1085/* 1085/*
1086 * Return -1 if off is not valid, 1086 * Returns < 0 if off is not valid,
1087 * 1 if window access is needed. 'off' is set to offset from 1087 * 1 if window access is needed. 'off' is set to offset from
1088 * CRB space in 128M pci map 1088 * CRB space in 128M pci map
1089 * 0 if no window access is needed. 'off' is set to 2M addr 1089 * 0 if no window access is needed. 'off' is set to 2M addr
@@ -1096,7 +1096,7 @@ netxen_nic_pci_get_crb_addr_2M(struct netxen_adapter *adapter, ulong *off)
1096 1096
1097 1097
1098 if (*off >= NETXEN_CRB_MAX) 1098 if (*off >= NETXEN_CRB_MAX)
1099 return -1; 1099 return -EINVAL;
1100 1100
1101 if (*off >= NETXEN_PCI_CAMQM && (*off < NETXEN_PCI_CAMQM_2M_END)) { 1101 if (*off >= NETXEN_PCI_CAMQM && (*off < NETXEN_PCI_CAMQM_2M_END)) {
1102 *off = (*off - NETXEN_PCI_CAMQM) + NETXEN_PCI_CAMQM_2M_BASE + 1102 *off = (*off - NETXEN_PCI_CAMQM) + NETXEN_PCI_CAMQM_2M_BASE +
@@ -1105,7 +1105,7 @@ netxen_nic_pci_get_crb_addr_2M(struct netxen_adapter *adapter, ulong *off)
1105 } 1105 }
1106 1106
1107 if (*off < NETXEN_PCI_CRBSPACE) 1107 if (*off < NETXEN_PCI_CRBSPACE)
1108 return -1; 1108 return -EINVAL;
1109 1109
1110 *off -= NETXEN_PCI_CRBSPACE; 1110 *off -= NETXEN_PCI_CRBSPACE;
1111 1111
@@ -1220,25 +1220,26 @@ netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter, ulong off, u32 data)
1220 1220
1221 rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off); 1221 rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off);
1222 1222
1223 if (rv == -1) { 1223 if (rv == 0) {
1224 printk(KERN_ERR "%s: invalid offset: 0x%016lx\n", 1224 writel(data, (void __iomem *)off);
1225 __func__, off); 1225 return 0;
1226 dump_stack();
1227 return -1;
1228 } 1226 }
1229 1227
1230 if (rv == 1) { 1228 if (rv > 0) {
1229 /* indirect access */
1231 write_lock_irqsave(&adapter->ahw.crb_lock, flags); 1230 write_lock_irqsave(&adapter->ahw.crb_lock, flags);
1232 crb_win_lock(adapter); 1231 crb_win_lock(adapter);
1233 netxen_nic_pci_set_crbwindow_2M(adapter, &off); 1232 netxen_nic_pci_set_crbwindow_2M(adapter, &off);
1234 writel(data, (void __iomem *)off); 1233 writel(data, (void __iomem *)off);
1235 crb_win_unlock(adapter); 1234 crb_win_unlock(adapter);
1236 write_unlock_irqrestore(&adapter->ahw.crb_lock, flags); 1235 write_unlock_irqrestore(&adapter->ahw.crb_lock, flags);
1237 } else 1236 return 0;
1238 writel(data, (void __iomem *)off); 1237 }
1239
1240 1238
1241 return 0; 1239 dev_err(&adapter->pdev->dev,
1240 "%s: invalid offset: 0x%016lx\n", __func__, off);
1241 dump_stack();
1242 return -EIO;
1242} 1243}
1243 1244
1244static u32 1245static u32
@@ -1250,24 +1251,24 @@ netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter, ulong off)
1250 1251
1251 rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off); 1252 rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off);
1252 1253
1253 if (rv == -1) { 1254 if (rv == 0)
1254 printk(KERN_ERR "%s: invalid offset: 0x%016lx\n", 1255 return readl((void __iomem *)off);
1255 __func__, off);
1256 dump_stack();
1257 return -1;
1258 }
1259 1256
1260 if (rv == 1) { 1257 if (rv > 0) {
1258 /* indirect access */
1261 write_lock_irqsave(&adapter->ahw.crb_lock, flags); 1259 write_lock_irqsave(&adapter->ahw.crb_lock, flags);
1262 crb_win_lock(adapter); 1260 crb_win_lock(adapter);
1263 netxen_nic_pci_set_crbwindow_2M(adapter, &off); 1261 netxen_nic_pci_set_crbwindow_2M(adapter, &off);
1264 data = readl((void __iomem *)off); 1262 data = readl((void __iomem *)off);
1265 crb_win_unlock(adapter); 1263 crb_win_unlock(adapter);
1266 write_unlock_irqrestore(&adapter->ahw.crb_lock, flags); 1264 write_unlock_irqrestore(&adapter->ahw.crb_lock, flags);
1267 } else 1265 return data;
1268 data = readl((void __iomem *)off); 1266 }
1269 1267
1270 return data; 1268 dev_err(&adapter->pdev->dev,
1269 "%s: invalid offset: 0x%016lx\n", __func__, off);
1270 dump_stack();
1271 return -1;
1271} 1272}
1272 1273
1273/* window 1 registers only */ 1274/* window 1 registers only */
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index a5248447789b..d8c4b70e35ba 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -832,6 +832,12 @@ void netxen_request_firmware(struct netxen_adapter *adapter)
832 goto request_fw; 832 goto request_fw;
833 } 833 }
834 834
835 if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) {
836 /* No file firmware for the time being */
837 fw_type = NX_FLASH_ROMIMAGE;
838 goto done;
839 }
840
835 fw_type = netxen_p3_has_mn(adapter) ? 841 fw_type = netxen_p3_has_mn(adapter) ?
836 NX_P3_MN_ROMIMAGE : NX_P3_CT_ROMIMAGE; 842 NX_P3_MN_ROMIMAGE : NX_P3_CT_ROMIMAGE;
837 843