aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bna
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-04-19 03:21:33 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-19 03:21:33 -0400
commite1943424e43974f85b82bb31eaf832823bf49ce7 (patch)
tree00a2dda7454ba186c0be4bfb8d08b7f74c3cd98c /drivers/net/bna
parent88230fd586b4ccc5ffe6d6c2df8cdc495e89ad83 (diff)
parent0553c891fabd287726b41076cfd03fe7e5ab596f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/bnx2x/bnx2x_ethtool.c
Diffstat (limited to 'drivers/net/bna')
-rw-r--r--drivers/net/bna/bfa_ioc.c31
-rw-r--r--drivers/net/bna/bfa_ioc.h1
-rw-r--r--drivers/net/bna/bfa_ioc_ct.c28
-rw-r--r--drivers/net/bna/bfi.h6
-rw-r--r--drivers/net/bna/bnad.c1
5 files changed, 51 insertions, 16 deletions
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c
index c1c9e70eec2f..ba2a4e13cf4f 100644
--- a/drivers/net/bna/bfa_ioc.c
+++ b/drivers/net/bna/bfa_ioc.c
@@ -38,6 +38,8 @@
38#define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) 38#define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc))
39#define bfa_ioc_notify_fail(__ioc) \ 39#define bfa_ioc_notify_fail(__ioc) \
40 ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc)) 40 ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc))
41#define bfa_ioc_sync_start(__ioc) \
42 ((__ioc)->ioc_hwif->ioc_sync_start(__ioc))
41#define bfa_ioc_sync_join(__ioc) \ 43#define bfa_ioc_sync_join(__ioc) \
42 ((__ioc)->ioc_hwif->ioc_sync_join(__ioc)) 44 ((__ioc)->ioc_hwif->ioc_sync_join(__ioc))
43#define bfa_ioc_sync_leave(__ioc) \ 45#define bfa_ioc_sync_leave(__ioc) \
@@ -602,7 +604,7 @@ bfa_iocpf_sm_fwcheck(struct bfa_iocpf *iocpf, enum iocpf_event event)
602 switch (event) { 604 switch (event) {
603 case IOCPF_E_SEMLOCKED: 605 case IOCPF_E_SEMLOCKED:
604 if (bfa_ioc_firmware_lock(ioc)) { 606 if (bfa_ioc_firmware_lock(ioc)) {
605 if (bfa_ioc_sync_complete(ioc)) { 607 if (bfa_ioc_sync_start(ioc)) {
606 iocpf->retry_count = 0; 608 iocpf->retry_count = 0;
607 bfa_ioc_sync_join(ioc); 609 bfa_ioc_sync_join(ioc);
608 bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); 610 bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit);
@@ -1313,7 +1315,7 @@ bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr)
1313 * execution context (driver/bios) must match. 1315 * execution context (driver/bios) must match.
1314 */ 1316 */
1315static bool 1317static bool
1316bfa_ioc_fwver_valid(struct bfa_ioc *ioc) 1318bfa_ioc_fwver_valid(struct bfa_ioc *ioc, u32 boot_env)
1317{ 1319{
1318 struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; 1320 struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr;
1319 1321
@@ -1324,7 +1326,7 @@ bfa_ioc_fwver_valid(struct bfa_ioc *ioc)
1324 if (fwhdr.signature != drv_fwhdr->signature) 1326 if (fwhdr.signature != drv_fwhdr->signature)
1325 return false; 1327 return false;
1326 1328
1327 if (fwhdr.exec != drv_fwhdr->exec) 1329 if (swab32(fwhdr.param) != boot_env)
1328 return false; 1330 return false;
1329 1331
1330 return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr); 1332 return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr);
@@ -1351,9 +1353,12 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force)
1351{ 1353{
1352 enum bfi_ioc_state ioc_fwstate; 1354 enum bfi_ioc_state ioc_fwstate;
1353 bool fwvalid; 1355 bool fwvalid;
1356 u32 boot_env;
1354 1357
1355 ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); 1358 ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate);
1356 1359
1360 boot_env = BFI_BOOT_LOADER_OS;
1361
1357 if (force) 1362 if (force)
1358 ioc_fwstate = BFI_IOC_UNINIT; 1363 ioc_fwstate = BFI_IOC_UNINIT;
1359 1364
@@ -1361,10 +1366,10 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force)
1361 * check if firmware is valid 1366 * check if firmware is valid
1362 */ 1367 */
1363 fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? 1368 fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ?
1364 false : bfa_ioc_fwver_valid(ioc); 1369 false : bfa_ioc_fwver_valid(ioc, boot_env);
1365 1370
1366 if (!fwvalid) { 1371 if (!fwvalid) {
1367 bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, ioc->pcidev.device_id); 1372 bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, boot_env);
1368 return; 1373 return;
1369 } 1374 }
1370 1375
@@ -1395,7 +1400,7 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force)
1395 /** 1400 /**
1396 * Initialize the h/w for any other states. 1401 * Initialize the h/w for any other states.
1397 */ 1402 */
1398 bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, ioc->pcidev.device_id); 1403 bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, boot_env);
1399} 1404}
1400 1405
1401void 1406void
@@ -1505,7 +1510,7 @@ bfa_ioc_hb_stop(struct bfa_ioc *ioc)
1505 */ 1510 */
1506static void 1511static void
1507bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, 1512bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type,
1508 u32 boot_param) 1513 u32 boot_env)
1509{ 1514{
1510 u32 *fwimg; 1515 u32 *fwimg;
1511 u32 pgnum; 1516 u32 pgnum;
@@ -1556,10 +1561,10 @@ bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type,
1556 /* 1561 /*
1557 * Set boot type and boot param at the end. 1562 * Set boot type and boot param at the end.
1558 */ 1563 */
1559 writel((swab32(swab32(boot_type))), ((ioc->ioc_regs.smem_page_start) 1564 writel(boot_type, ((ioc->ioc_regs.smem_page_start)
1560 + (BFI_BOOT_TYPE_OFF))); 1565 + (BFI_BOOT_TYPE_OFF)));
1561 writel((swab32(swab32(boot_param))), ((ioc->ioc_regs.smem_page_start) 1566 writel(boot_env, ((ioc->ioc_regs.smem_page_start)
1562 + (BFI_BOOT_PARAM_OFF))); 1567 + (BFI_BOOT_LOADER_OFF)));
1563} 1568}
1564 1569
1565static void 1570static void
@@ -1719,7 +1724,7 @@ bfa_ioc_pll_init(struct bfa_ioc *ioc)
1719 * as the entry vector. 1724 * as the entry vector.
1720 */ 1725 */
1721static void 1726static void
1722bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) 1727bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_env)
1723{ 1728{
1724 void __iomem *rb; 1729 void __iomem *rb;
1725 1730
@@ -1732,7 +1737,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param)
1732 * Initialize IOC state of all functions on a chip reset. 1737 * Initialize IOC state of all functions on a chip reset.
1733 */ 1738 */
1734 rb = ioc->pcidev.pci_bar_kva; 1739 rb = ioc->pcidev.pci_bar_kva;
1735 if (boot_param == BFI_BOOT_TYPE_MEMTEST) { 1740 if (boot_type == BFI_BOOT_TYPE_MEMTEST) {
1736 writel(BFI_IOC_MEMTEST, (rb + BFA_IOC0_STATE_REG)); 1741 writel(BFI_IOC_MEMTEST, (rb + BFA_IOC0_STATE_REG));
1737 writel(BFI_IOC_MEMTEST, (rb + BFA_IOC1_STATE_REG)); 1742 writel(BFI_IOC_MEMTEST, (rb + BFA_IOC1_STATE_REG));
1738 } else { 1743 } else {
@@ -1741,7 +1746,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param)
1741 } 1746 }
1742 1747
1743 bfa_ioc_msgflush(ioc); 1748 bfa_ioc_msgflush(ioc);
1744 bfa_ioc_download_fw(ioc, boot_type, boot_param); 1749 bfa_ioc_download_fw(ioc, boot_type, boot_env);
1745 1750
1746 /** 1751 /**
1747 * Enable interrupts just before starting LPU 1752 * Enable interrupts just before starting LPU
diff --git a/drivers/net/bna/bfa_ioc.h b/drivers/net/bna/bfa_ioc.h
index e4974bc24ef6..bd48abee781f 100644
--- a/drivers/net/bna/bfa_ioc.h
+++ b/drivers/net/bna/bfa_ioc.h
@@ -194,6 +194,7 @@ struct bfa_ioc_hwif {
194 bool msix); 194 bool msix);
195 void (*ioc_notify_fail) (struct bfa_ioc *ioc); 195 void (*ioc_notify_fail) (struct bfa_ioc *ioc);
196 void (*ioc_ownership_reset) (struct bfa_ioc *ioc); 196 void (*ioc_ownership_reset) (struct bfa_ioc *ioc);
197 bool (*ioc_sync_start) (struct bfa_ioc *ioc);
197 void (*ioc_sync_join) (struct bfa_ioc *ioc); 198 void (*ioc_sync_join) (struct bfa_ioc *ioc);
198 void (*ioc_sync_leave) (struct bfa_ioc *ioc); 199 void (*ioc_sync_leave) (struct bfa_ioc *ioc);
199 void (*ioc_sync_ack) (struct bfa_ioc *ioc); 200 void (*ioc_sync_ack) (struct bfa_ioc *ioc);
diff --git a/drivers/net/bna/bfa_ioc_ct.c b/drivers/net/bna/bfa_ioc_ct.c
index 469997c4ffd1..87aecdf22cf9 100644
--- a/drivers/net/bna/bfa_ioc_ct.c
+++ b/drivers/net/bna/bfa_ioc_ct.c
@@ -41,6 +41,7 @@ static void bfa_ioc_ct_map_port(struct bfa_ioc *ioc);
41static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix); 41static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix);
42static void bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc); 42static void bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc);
43static void bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc); 43static void bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc);
44static bool bfa_ioc_ct_sync_start(struct bfa_ioc *ioc);
44static void bfa_ioc_ct_sync_join(struct bfa_ioc *ioc); 45static void bfa_ioc_ct_sync_join(struct bfa_ioc *ioc);
45static void bfa_ioc_ct_sync_leave(struct bfa_ioc *ioc); 46static void bfa_ioc_ct_sync_leave(struct bfa_ioc *ioc);
46static void bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc); 47static void bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc);
@@ -63,6 +64,7 @@ bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc)
63 nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; 64 nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set;
64 nw_hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail; 65 nw_hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail;
65 nw_hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; 66 nw_hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset;
67 nw_hwif_ct.ioc_sync_start = bfa_ioc_ct_sync_start;
66 nw_hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join; 68 nw_hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join;
67 nw_hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave; 69 nw_hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave;
68 nw_hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack; 70 nw_hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack;
@@ -345,6 +347,32 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc)
345/** 347/**
346 * Synchronized IOC failure processing routines 348 * Synchronized IOC failure processing routines
347 */ 349 */
350static bool
351bfa_ioc_ct_sync_start(struct bfa_ioc *ioc)
352{
353 u32 r32 = readl(ioc->ioc_regs.ioc_fail_sync);
354 u32 sync_reqd = bfa_ioc_ct_get_sync_reqd(r32);
355
356 /*
357 * Driver load time. If the sync required bit for this PCI fn
358 * is set, it is due to an unclean exit by the driver for this
359 * PCI fn in the previous incarnation. Whoever comes here first
360 * should clean it up, no matter which PCI fn.
361 */
362
363 if (sync_reqd & bfa_ioc_ct_sync_pos(ioc)) {
364 writel(0, ioc->ioc_regs.ioc_fail_sync);
365 writel(1, ioc->ioc_regs.ioc_usage_reg);
366 writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate);
367 writel(BFI_IOC_UNINIT, ioc->ioc_regs.alt_ioc_fwstate);
368 return true;
369 }
370
371 return bfa_ioc_ct_sync_complete(ioc);
372}
373/**
374 * Synchronized IOC failure processing routines
375 */
348static void 376static void
349bfa_ioc_ct_sync_join(struct bfa_ioc *ioc) 377bfa_ioc_ct_sync_join(struct bfa_ioc *ioc)
350{ 378{
diff --git a/drivers/net/bna/bfi.h b/drivers/net/bna/bfi.h
index a97396811050..6050379526f7 100644
--- a/drivers/net/bna/bfi.h
+++ b/drivers/net/bna/bfi.h
@@ -184,12 +184,14 @@ enum bfi_mclass {
184#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */ 184#define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */
185 185
186#define BFI_BOOT_TYPE_OFF 8 186#define BFI_BOOT_TYPE_OFF 8
187#define BFI_BOOT_PARAM_OFF 12 187#define BFI_BOOT_LOADER_OFF 12
188 188
189#define BFI_BOOT_TYPE_NORMAL 0 /* param is device id */ 189#define BFI_BOOT_TYPE_NORMAL 0
190#define BFI_BOOT_TYPE_FLASH 1 190#define BFI_BOOT_TYPE_FLASH 1
191#define BFI_BOOT_TYPE_MEMTEST 2 191#define BFI_BOOT_TYPE_MEMTEST 2
192 192
193#define BFI_BOOT_LOADER_OS 0
194
193#define BFI_BOOT_MEMTEST_RES_ADDR 0x900 195#define BFI_BOOT_MEMTEST_RES_ADDR 0x900
194#define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3 196#define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3
195 197
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index b9f253470da2..e588511f47fb 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -1837,7 +1837,6 @@ bnad_setup_rx(struct bnad *bnad, uint rx_id)
1837 /* Initialize the Rx event handlers */ 1837 /* Initialize the Rx event handlers */
1838 rx_cbfn.rcb_setup_cbfn = bnad_cb_rcb_setup; 1838 rx_cbfn.rcb_setup_cbfn = bnad_cb_rcb_setup;
1839 rx_cbfn.rcb_destroy_cbfn = bnad_cb_rcb_destroy; 1839 rx_cbfn.rcb_destroy_cbfn = bnad_cb_rcb_destroy;
1840 rx_cbfn.rcb_destroy_cbfn = NULL;
1841 rx_cbfn.ccb_setup_cbfn = bnad_cb_ccb_setup; 1840 rx_cbfn.ccb_setup_cbfn = bnad_cb_ccb_setup;
1842 rx_cbfn.ccb_destroy_cbfn = bnad_cb_ccb_destroy; 1841 rx_cbfn.ccb_destroy_cbfn = bnad_cb_ccb_destroy;
1843 rx_cbfn.rx_cleanup_cbfn = bnad_cb_rx_cleanup; 1842 rx_cbfn.rx_cleanup_cbfn = bnad_cb_rx_cleanup;