diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bna/bfa_ioc.c | 31 | ||||
-rw-r--r-- | drivers/net/bna/bfa_ioc.h | 1 | ||||
-rw-r--r-- | drivers/net/bna/bfa_ioc_ct.c | 28 | ||||
-rw-r--r-- | drivers/net/bna/bfi.h | 6 |
4 files changed, 51 insertions, 15 deletions
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c index e3de0b8625cd..7581518ecfa2 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); |
@@ -1314,7 +1316,7 @@ bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr) | |||
1314 | * execution context (driver/bios) must match. | 1316 | * execution context (driver/bios) must match. |
1315 | */ | 1317 | */ |
1316 | static bool | 1318 | static bool |
1317 | bfa_ioc_fwver_valid(struct bfa_ioc *ioc) | 1319 | bfa_ioc_fwver_valid(struct bfa_ioc *ioc, u32 boot_env) |
1318 | { | 1320 | { |
1319 | struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; | 1321 | struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; |
1320 | 1322 | ||
@@ -1325,7 +1327,7 @@ bfa_ioc_fwver_valid(struct bfa_ioc *ioc) | |||
1325 | if (fwhdr.signature != drv_fwhdr->signature) | 1327 | if (fwhdr.signature != drv_fwhdr->signature) |
1326 | return false; | 1328 | return false; |
1327 | 1329 | ||
1328 | if (fwhdr.exec != drv_fwhdr->exec) | 1330 | if (swab32(fwhdr.param) != boot_env) |
1329 | return false; | 1331 | return false; |
1330 | 1332 | ||
1331 | return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr); | 1333 | return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr); |
@@ -1352,9 +1354,12 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) | |||
1352 | { | 1354 | { |
1353 | enum bfi_ioc_state ioc_fwstate; | 1355 | enum bfi_ioc_state ioc_fwstate; |
1354 | bool fwvalid; | 1356 | bool fwvalid; |
1357 | u32 boot_env; | ||
1355 | 1358 | ||
1356 | ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); | 1359 | ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); |
1357 | 1360 | ||
1361 | boot_env = BFI_BOOT_LOADER_OS; | ||
1362 | |||
1358 | if (force) | 1363 | if (force) |
1359 | ioc_fwstate = BFI_IOC_UNINIT; | 1364 | ioc_fwstate = BFI_IOC_UNINIT; |
1360 | 1365 | ||
@@ -1362,10 +1367,10 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) | |||
1362 | * check if firmware is valid | 1367 | * check if firmware is valid |
1363 | */ | 1368 | */ |
1364 | fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? | 1369 | fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? |
1365 | false : bfa_ioc_fwver_valid(ioc); | 1370 | false : bfa_ioc_fwver_valid(ioc, boot_env); |
1366 | 1371 | ||
1367 | if (!fwvalid) { | 1372 | if (!fwvalid) { |
1368 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, ioc->pcidev.device_id); | 1373 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, boot_env); |
1369 | return; | 1374 | return; |
1370 | } | 1375 | } |
1371 | 1376 | ||
@@ -1396,7 +1401,7 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) | |||
1396 | /** | 1401 | /** |
1397 | * Initialize the h/w for any other states. | 1402 | * Initialize the h/w for any other states. |
1398 | */ | 1403 | */ |
1399 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, ioc->pcidev.device_id); | 1404 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, boot_env); |
1400 | } | 1405 | } |
1401 | 1406 | ||
1402 | void | 1407 | void |
@@ -1506,7 +1511,7 @@ bfa_ioc_hb_stop(struct bfa_ioc *ioc) | |||
1506 | */ | 1511 | */ |
1507 | static void | 1512 | static void |
1508 | bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, | 1513 | bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, |
1509 | u32 boot_param) | 1514 | u32 boot_env) |
1510 | { | 1515 | { |
1511 | u32 *fwimg; | 1516 | u32 *fwimg; |
1512 | u32 pgnum, pgoff; | 1517 | u32 pgnum, pgoff; |
@@ -1558,10 +1563,10 @@ bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, | |||
1558 | /* | 1563 | /* |
1559 | * Set boot type and boot param at the end. | 1564 | * Set boot type and boot param at the end. |
1560 | */ | 1565 | */ |
1561 | writel((swab32(swab32(boot_type))), ((ioc->ioc_regs.smem_page_start) | 1566 | writel(boot_type, ((ioc->ioc_regs.smem_page_start) |
1562 | + (BFI_BOOT_TYPE_OFF))); | 1567 | + (BFI_BOOT_TYPE_OFF))); |
1563 | writel((swab32(swab32(boot_param))), ((ioc->ioc_regs.smem_page_start) | 1568 | writel(boot_env, ((ioc->ioc_regs.smem_page_start) |
1564 | + (BFI_BOOT_PARAM_OFF))); | 1569 | + (BFI_BOOT_LOADER_OFF))); |
1565 | } | 1570 | } |
1566 | 1571 | ||
1567 | static void | 1572 | static void |
@@ -1721,7 +1726,7 @@ bfa_ioc_pll_init(struct bfa_ioc *ioc) | |||
1721 | * as the entry vector. | 1726 | * as the entry vector. |
1722 | */ | 1727 | */ |
1723 | static void | 1728 | static void |
1724 | bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) | 1729 | bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_env) |
1725 | { | 1730 | { |
1726 | void __iomem *rb; | 1731 | void __iomem *rb; |
1727 | 1732 | ||
@@ -1734,7 +1739,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) | |||
1734 | * Initialize IOC state of all functions on a chip reset. | 1739 | * Initialize IOC state of all functions on a chip reset. |
1735 | */ | 1740 | */ |
1736 | rb = ioc->pcidev.pci_bar_kva; | 1741 | rb = ioc->pcidev.pci_bar_kva; |
1737 | if (boot_param == BFI_BOOT_TYPE_MEMTEST) { | 1742 | if (boot_type == BFI_BOOT_TYPE_MEMTEST) { |
1738 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC0_STATE_REG)); | 1743 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC0_STATE_REG)); |
1739 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC1_STATE_REG)); | 1744 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC1_STATE_REG)); |
1740 | } else { | 1745 | } else { |
@@ -1743,7 +1748,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) | |||
1743 | } | 1748 | } |
1744 | 1749 | ||
1745 | bfa_ioc_msgflush(ioc); | 1750 | bfa_ioc_msgflush(ioc); |
1746 | bfa_ioc_download_fw(ioc, boot_type, boot_param); | 1751 | bfa_ioc_download_fw(ioc, boot_type, boot_env); |
1747 | 1752 | ||
1748 | /** | 1753 | /** |
1749 | * Enable interrupts just before starting LPU | 1754 | * 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); | |||
41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix); | 41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix); |
42 | static void bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc); | 42 | static void bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc); |
43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc); | 43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc); |
44 | static bool bfa_ioc_ct_sync_start(struct bfa_ioc *ioc); | ||
44 | static void bfa_ioc_ct_sync_join(struct bfa_ioc *ioc); | 45 | static void bfa_ioc_ct_sync_join(struct bfa_ioc *ioc); |
45 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc *ioc); | 46 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc *ioc); |
46 | static void bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc); | 47 | static 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 | */ |
350 | static bool | ||
351 | bfa_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 | */ | ||
348 | static void | 376 | static void |
349 | bfa_ioc_ct_sync_join(struct bfa_ioc *ioc) | 377 | bfa_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 | ||