diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2009-01-05 14:18:05 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-01-07 16:49:15 -0500 |
commit | 1ded85e2850b7b890fb6b51241429ed685ec2763 (patch) | |
tree | 2e9d5d53455f2d142a6540a9be9bb4d758e17a7e /drivers/scsi | |
parent | 574df408edb7b5bddda68a0cf919536993949941 (diff) |
[SCSI] qla2xxx: Remove support for reading/writing HW-event-log.
Software should not touch this region of flash, as the firmware
will be the only writer and consumer of the region.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 10 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 5 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 8 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_isr.c | 15 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 9 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 21 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_sup.c | 120 |
7 files changed, 2 insertions, 186 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index a29c95204975..fc50221d1a99 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2136,7 +2136,6 @@ struct qla_msix_entry { | |||
2136 | /* Work events. */ | 2136 | /* Work events. */ |
2137 | enum qla_work_type { | 2137 | enum qla_work_type { |
2138 | QLA_EVT_AEN, | 2138 | QLA_EVT_AEN, |
2139 | QLA_EVT_HWE_LOG, | ||
2140 | }; | 2139 | }; |
2141 | 2140 | ||
2142 | 2141 | ||
@@ -2151,10 +2150,6 @@ struct qla_work_evt { | |||
2151 | enum fc_host_event_code code; | 2150 | enum fc_host_event_code code; |
2152 | u32 data; | 2151 | u32 data; |
2153 | } aen; | 2152 | } aen; |
2154 | struct { | ||
2155 | uint16_t code; | ||
2156 | uint16_t d1, d2, d3; | ||
2157 | } hwe; | ||
2158 | } u; | 2153 | } u; |
2159 | }; | 2154 | }; |
2160 | 2155 | ||
@@ -2489,10 +2484,6 @@ struct qla_hw_data { | |||
2489 | uint64_t fce_wr, fce_rd; | 2484 | uint64_t fce_wr, fce_rd; |
2490 | struct mutex fce_mutex; | 2485 | struct mutex fce_mutex; |
2491 | 2486 | ||
2492 | uint32_t hw_event_start; | ||
2493 | uint32_t hw_event_ptr; | ||
2494 | uint32_t hw_event_pause_errors; | ||
2495 | |||
2496 | uint32_t pci_attr; | 2487 | uint32_t pci_attr; |
2497 | uint16_t chip_revision; | 2488 | uint16_t chip_revision; |
2498 | 2489 | ||
@@ -2533,7 +2524,6 @@ struct qla_hw_data { | |||
2533 | uint32_t flt_region_boot; | 2524 | uint32_t flt_region_boot; |
2534 | uint32_t flt_region_fw; | 2525 | uint32_t flt_region_fw; |
2535 | uint32_t flt_region_vpd_nvram; | 2526 | uint32_t flt_region_vpd_nvram; |
2536 | uint32_t flt_region_hw_event; | ||
2537 | uint32_t flt_region_npiv_conf; | 2527 | uint32_t flt_region_npiv_conf; |
2538 | 2528 | ||
2539 | /* Needed for BEACON */ | 2529 | /* Needed for BEACON */ |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 0011e31205db..450a05c5d33b 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -69,8 +69,6 @@ extern int qla2x00_loop_reset(scsi_qla_host_t *); | |||
69 | extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); | 69 | extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); |
70 | extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum | 70 | extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum |
71 | fc_host_event_code, u32); | 71 | fc_host_event_code, u32); |
72 | extern int qla2x00_post_hwe_work(struct scsi_qla_host *, uint16_t , uint16_t, | ||
73 | uint16_t, uint16_t); | ||
74 | 72 | ||
75 | extern void qla2x00_abort_fcport_cmds(fc_port_t *); | 73 | extern void qla2x00_abort_fcport_cmds(fc_port_t *); |
76 | extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, | 74 | extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, |
@@ -317,9 +315,6 @@ extern uint8_t *qla25xx_read_optrom_data(struct scsi_qla_host *, uint8_t *, | |||
317 | extern int qla2x00_get_flash_version(scsi_qla_host_t *, void *); | 315 | extern int qla2x00_get_flash_version(scsi_qla_host_t *, void *); |
318 | extern int qla24xx_get_flash_version(scsi_qla_host_t *, void *); | 316 | extern int qla24xx_get_flash_version(scsi_qla_host_t *, void *); |
319 | 317 | ||
320 | extern int qla2xxx_hw_event_log(scsi_qla_host_t *, uint16_t , uint16_t, | ||
321 | uint16_t, uint16_t); | ||
322 | |||
323 | extern int qla2xxx_get_flash_info(scsi_qla_host_t *); | 318 | extern int qla2xxx_get_flash_info(scsi_qla_host_t *); |
324 | extern int qla2xxx_get_vpd_field(scsi_qla_host_t *, char *, char *, size_t); | 319 | extern int qla2xxx_get_vpd_field(scsi_qla_host_t *, char *, char *, size_t); |
325 | 320 | ||
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 52ed56ecf195..521d2158d7a9 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -552,10 +552,6 @@ qla24xx_reset_risc(scsi_qla_host_t *vha) | |||
552 | d2 = RD_REG_DWORD(®->ctrl_status); | 552 | d2 = RD_REG_DWORD(®->ctrl_status); |
553 | barrier(); | 553 | barrier(); |
554 | } | 554 | } |
555 | if (cnt == 0 || hw_evt) | ||
556 | qla2xxx_hw_event_log(vha, HW_EVENT_RESET_ERR, | ||
557 | RD_REG_WORD(®->mailbox1), RD_REG_WORD(®->mailbox2), | ||
558 | RD_REG_WORD(®->mailbox3)); | ||
559 | 555 | ||
560 | WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET); | 556 | WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET); |
561 | RD_REG_DWORD(®->hccr); | 557 | RD_REG_DWORD(®->hccr); |
@@ -1665,10 +1661,6 @@ qla2x00_nvram_config(scsi_qla_host_t *vha) | |||
1665 | qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet " | 1661 | qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet " |
1666 | "invalid -- WWPN) defaults.\n"); | 1662 | "invalid -- WWPN) defaults.\n"); |
1667 | 1663 | ||
1668 | if (chksum) | ||
1669 | qla2xxx_hw_event_log(vha, HW_EVENT_NVRAM_CHKSUM_ERR, 0, | ||
1670 | MSW(chksum), LSW(chksum)); | ||
1671 | |||
1672 | /* | 1664 | /* |
1673 | * Set default initialization control block. | 1665 | * Set default initialization control block. |
1674 | */ | 1666 | */ |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index d5fb79a88001..6447eb13db8c 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -362,7 +362,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) | |||
362 | "ISP System Error - mbx1=%xh mbx2=%xh mbx3=%xh.\n", | 362 | "ISP System Error - mbx1=%xh mbx2=%xh mbx3=%xh.\n", |
363 | mb[1], mb[2], mb[3]); | 363 | mb[1], mb[2], mb[3]); |
364 | 364 | ||
365 | qla2x00_post_hwe_work(vha, mb[0], mb[1], mb[2], mb[3]); | ||
366 | ha->isp_ops->fw_dump(vha, 1); | 365 | ha->isp_ops->fw_dump(vha, 1); |
367 | 366 | ||
368 | if (IS_FWI2_CAPABLE(ha)) { | 367 | if (IS_FWI2_CAPABLE(ha)) { |
@@ -387,7 +386,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) | |||
387 | vha->host_no)); | 386 | vha->host_no)); |
388 | qla_printk(KERN_WARNING, ha, "ISP Request Transfer Error.\n"); | 387 | qla_printk(KERN_WARNING, ha, "ISP Request Transfer Error.\n"); |
389 | 388 | ||
390 | qla2x00_post_hwe_work(vha, mb[0], mb[1], mb[2], mb[3]); | ||
391 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); | 389 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
392 | break; | 390 | break; |
393 | 391 | ||
@@ -396,7 +394,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) | |||
396 | vha->host_no)); | 394 | vha->host_no)); |
397 | qla_printk(KERN_WARNING, ha, "ISP Response Transfer Error.\n"); | 395 | qla_printk(KERN_WARNING, ha, "ISP Response Transfer Error.\n"); |
398 | 396 | ||
399 | qla2x00_post_hwe_work(vha, mb[0], mb[1], mb[2], mb[3]); | ||
400 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); | 397 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
401 | break; | 398 | break; |
402 | 399 | ||
@@ -1590,12 +1587,6 @@ qla24xx_intr_handler(int irq, void *dev_id) | |||
1590 | if (pci_channel_offline(ha->pdev)) | 1587 | if (pci_channel_offline(ha->pdev)) |
1591 | break; | 1588 | break; |
1592 | 1589 | ||
1593 | if (ha->hw_event_pause_errors == 0) | ||
1594 | qla2x00_post_hwe_work(vha, HW_EVENT_PARITY_ERR, | ||
1595 | 0, MSW(stat), LSW(stat)); | ||
1596 | else if (ha->hw_event_pause_errors < 0xffffffff) | ||
1597 | ha->hw_event_pause_errors++; | ||
1598 | |||
1599 | hccr = RD_REG_DWORD(®->hccr); | 1590 | hccr = RD_REG_DWORD(®->hccr); |
1600 | 1591 | ||
1601 | qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, " | 1592 | qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, " |
@@ -1740,12 +1731,6 @@ qla24xx_msix_default(int irq, void *dev_id) | |||
1740 | if (pci_channel_offline(ha->pdev)) | 1731 | if (pci_channel_offline(ha->pdev)) |
1741 | break; | 1732 | break; |
1742 | 1733 | ||
1743 | if (ha->hw_event_pause_errors == 0) | ||
1744 | qla2x00_post_hwe_work(vha, HW_EVENT_PARITY_ERR, | ||
1745 | 0, MSW(stat), LSW(stat)); | ||
1746 | else if (ha->hw_event_pause_errors < 0xffffffff) | ||
1747 | ha->hw_event_pause_errors++; | ||
1748 | |||
1749 | hccr = RD_REG_DWORD(®->hccr); | 1734 | hccr = RD_REG_DWORD(®->hccr); |
1750 | 1735 | ||
1751 | qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, " | 1736 | qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, " |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index a99976f5fabd..f03de8c79681 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -568,7 +568,6 @@ int | |||
568 | qla2x00_mbx_reg_test(scsi_qla_host_t *vha) | 568 | qla2x00_mbx_reg_test(scsi_qla_host_t *vha) |
569 | { | 569 | { |
570 | int rval; | 570 | int rval; |
571 | struct qla_hw_data *ha = vha->hw; | ||
572 | mbx_cmd_t mc; | 571 | mbx_cmd_t mc; |
573 | mbx_cmd_t *mcp = &mc; | 572 | mbx_cmd_t *mcp = &mc; |
574 | 573 | ||
@@ -595,14 +594,6 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *vha) | |||
595 | if (mcp->mb[5] != 0xA5A5 || mcp->mb[6] != 0x5A5A || | 594 | if (mcp->mb[5] != 0xA5A5 || mcp->mb[6] != 0x5A5A || |
596 | mcp->mb[7] != 0x2525) | 595 | mcp->mb[7] != 0x2525) |
597 | rval = QLA_FUNCTION_FAILED; | 596 | rval = QLA_FUNCTION_FAILED; |
598 | if (rval == QLA_FUNCTION_FAILED) { | ||
599 | struct device_reg_24xx __iomem *reg = | ||
600 | &ha->iobase->isp24; | ||
601 | |||
602 | qla2xxx_hw_event_log(vha, HW_EVENT_ISP_ERR, 0, | ||
603 | LSW(RD_REG_DWORD(®->hccr)), | ||
604 | LSW(RD_REG_DWORD(®->istatus))); | ||
605 | } | ||
606 | } | 597 | } |
607 | 598 | ||
608 | if (rval != QLA_SUCCESS) { | 599 | if (rval != QLA_SUCCESS) { |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8ea927788b3f..3b1b68c1f6f2 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -2458,23 +2458,6 @@ qla2x00_post_aen_work(struct scsi_qla_host *vha, enum fc_host_event_code code, | |||
2458 | return qla2x00_post_work(vha, e, 1); | 2458 | return qla2x00_post_work(vha, e, 1); |
2459 | } | 2459 | } |
2460 | 2460 | ||
2461 | int | ||
2462 | qla2x00_post_hwe_work(struct scsi_qla_host *vha, uint16_t code, uint16_t d1, | ||
2463 | uint16_t d2, uint16_t d3) | ||
2464 | { | ||
2465 | struct qla_work_evt *e; | ||
2466 | |||
2467 | e = qla2x00_alloc_work(vha, QLA_EVT_HWE_LOG, 1); | ||
2468 | if (!e) | ||
2469 | return QLA_FUNCTION_FAILED; | ||
2470 | |||
2471 | e->u.hwe.code = code; | ||
2472 | e->u.hwe.d1 = d1; | ||
2473 | e->u.hwe.d2 = d2; | ||
2474 | e->u.hwe.d3 = d3; | ||
2475 | return qla2x00_post_work(vha, e, 1); | ||
2476 | } | ||
2477 | |||
2478 | static void | 2461 | static void |
2479 | qla2x00_do_work(struct scsi_qla_host *vha) | 2462 | qla2x00_do_work(struct scsi_qla_host *vha) |
2480 | { | 2463 | { |
@@ -2492,10 +2475,6 @@ qla2x00_do_work(struct scsi_qla_host *vha) | |||
2492 | fc_host_post_event(vha->host, fc_get_event_number(), | 2475 | fc_host_post_event(vha->host, fc_get_event_number(), |
2493 | e->u.aen.code, e->u.aen.data); | 2476 | e->u.aen.code, e->u.aen.data); |
2494 | break; | 2477 | break; |
2495 | case QLA_EVT_HWE_LOG: | ||
2496 | qla2xxx_hw_event_log(vha, e->u.hwe.code, e->u.hwe.d1, | ||
2497 | e->u.hwe.d2, e->u.hwe.d3); | ||
2498 | break; | ||
2499 | } | 2478 | } |
2500 | if (e->flags & QLA_EVT_FLAG_FREE) | 2479 | if (e->flags & QLA_EVT_FLAG_FREE) |
2501 | kfree(e); | 2480 | kfree(e); |
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index c538ee1b1a31..628d79c09733 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -676,14 +676,6 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) | |||
676 | case FLT_REG_FDT: | 676 | case FLT_REG_FDT: |
677 | ha->flt_region_fdt = start; | 677 | ha->flt_region_fdt = start; |
678 | break; | 678 | break; |
679 | case FLT_REG_HW_EVENT_0: | ||
680 | if (!PCI_FUNC(ha->pdev->devfn)) | ||
681 | ha->flt_region_hw_event = start; | ||
682 | break; | ||
683 | case FLT_REG_HW_EVENT_1: | ||
684 | if (PCI_FUNC(ha->pdev->devfn)) | ||
685 | ha->flt_region_hw_event = start; | ||
686 | break; | ||
687 | case FLT_REG_NPIV_CONF_0: | 679 | case FLT_REG_NPIV_CONF_0: |
688 | if (!PCI_FUNC(ha->pdev->devfn)) | 680 | if (!PCI_FUNC(ha->pdev->devfn)) |
689 | ha->flt_region_npiv_conf = start; | 681 | ha->flt_region_npiv_conf = start; |
@@ -704,17 +696,14 @@ no_flash_data: | |||
704 | ha->flt_region_vpd_nvram = FA_VPD_NVRAM_ADDR; | 696 | ha->flt_region_vpd_nvram = FA_VPD_NVRAM_ADDR; |
705 | ha->flt_region_fdt = IS_QLA24XX_TYPE(ha) ? FA_FLASH_DESCR_ADDR_24: | 697 | ha->flt_region_fdt = IS_QLA24XX_TYPE(ha) ? FA_FLASH_DESCR_ADDR_24: |
706 | FA_FLASH_DESCR_ADDR; | 698 | FA_FLASH_DESCR_ADDR; |
707 | ha->flt_region_hw_event = !PCI_FUNC(ha->pdev->devfn) ? | ||
708 | FA_HW_EVENT0_ADDR: FA_HW_EVENT1_ADDR; | ||
709 | ha->flt_region_npiv_conf = !PCI_FUNC(ha->pdev->devfn) ? | 699 | ha->flt_region_npiv_conf = !PCI_FUNC(ha->pdev->devfn) ? |
710 | (IS_QLA24XX_TYPE(ha) ? FA_NPIV_CONF0_ADDR_24: FA_NPIV_CONF0_ADDR): | 700 | (IS_QLA24XX_TYPE(ha) ? FA_NPIV_CONF0_ADDR_24: FA_NPIV_CONF0_ADDR): |
711 | (IS_QLA24XX_TYPE(ha) ? FA_NPIV_CONF1_ADDR_24: FA_NPIV_CONF1_ADDR); | 701 | (IS_QLA24XX_TYPE(ha) ? FA_NPIV_CONF1_ADDR_24: FA_NPIV_CONF1_ADDR); |
712 | done: | 702 | done: |
713 | DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " | 703 | DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " |
714 | "vpd_nvram=0x%x fdt=0x%x flt=0x%x hwe=0x%x npiv=0x%x.\n", loc, | 704 | "vpd_nvram=0x%x fdt=0x%x flt=0x%x npiv=0x%x.\n", loc, |
715 | ha->flt_region_boot, ha->flt_region_fw, ha->flt_region_vpd_nvram, | 705 | ha->flt_region_boot, ha->flt_region_fw, ha->flt_region_vpd_nvram, |
716 | ha->flt_region_fdt, ha->flt_region_flt, ha->flt_region_hw_event, | 706 | ha->flt_region_fdt, ha->flt_region_flt, ha->flt_region_npiv_conf)); |
717 | ha->flt_region_npiv_conf)); | ||
718 | } | 707 | } |
719 | 708 | ||
720 | static void | 709 | static void |
@@ -2648,108 +2637,3 @@ qla2xxx_get_vpd_field(scsi_qla_host_t *vha, char *key, char *str, size_t size) | |||
2648 | 2637 | ||
2649 | return 0; | 2638 | return 0; |
2650 | } | 2639 | } |
2651 | |||
2652 | static int | ||
2653 | qla2xxx_hw_event_store(scsi_qla_host_t *vha, uint32_t *fdata) | ||
2654 | { | ||
2655 | uint32_t d[2], faddr; | ||
2656 | struct qla_hw_data *ha = vha->hw; | ||
2657 | |||
2658 | /* Locate first empty entry. */ | ||
2659 | for (;;) { | ||
2660 | if (ha->hw_event_ptr >= | ||
2661 | ha->flt_region_hw_event + FA_HW_EVENT_SIZE) { | ||
2662 | DEBUG2(qla_printk(KERN_WARNING, ha, | ||
2663 | "HW event -- Log Full!\n")); | ||
2664 | return QLA_MEMORY_ALLOC_FAILED; | ||
2665 | } | ||
2666 | |||
2667 | qla24xx_read_flash_data(vha, d, ha->hw_event_ptr, 2); | ||
2668 | faddr = flash_data_to_access_addr(ha->hw_event_ptr); | ||
2669 | ha->hw_event_ptr += FA_HW_EVENT_ENTRY_SIZE; | ||
2670 | if (d[0] == __constant_cpu_to_le32(0xffffffff) && | ||
2671 | d[1] == __constant_cpu_to_le32(0xffffffff)) { | ||
2672 | qla24xx_unprotect_flash(ha); | ||
2673 | |||
2674 | qla24xx_write_flash_dword(ha, faddr++, | ||
2675 | cpu_to_le32(jiffies)); | ||
2676 | qla24xx_write_flash_dword(ha, faddr++, 0); | ||
2677 | qla24xx_write_flash_dword(ha, faddr++, *fdata++); | ||
2678 | qla24xx_write_flash_dword(ha, faddr++, *fdata); | ||
2679 | |||
2680 | qla24xx_protect_flash(ha); | ||
2681 | break; | ||
2682 | } | ||
2683 | } | ||
2684 | return QLA_SUCCESS; | ||
2685 | } | ||
2686 | |||
2687 | int | ||
2688 | qla2xxx_hw_event_log(scsi_qla_host_t *vha, uint16_t code, uint16_t d1, | ||
2689 | uint16_t d2, uint16_t d3) | ||
2690 | { | ||
2691 | #define QMARK(a, b, c, d) \ | ||
2692 | cpu_to_le32(LSB(a) << 24 | LSB(b) << 16 | LSB(c) << 8 | LSB(d)) | ||
2693 | struct qla_hw_data *ha = vha->hw; | ||
2694 | int rval; | ||
2695 | uint32_t marker[2], fdata[4]; | ||
2696 | |||
2697 | if (ha->flt_region_hw_event == 0) | ||
2698 | return QLA_FUNCTION_FAILED; | ||
2699 | |||
2700 | DEBUG2(qla_printk(KERN_WARNING, ha, | ||
2701 | "HW event -- code=%x, d1=%x, d2=%x, d3=%x.\n", code, d1, d2, d3)); | ||
2702 | |||
2703 | /* If marker not already found, locate or write. */ | ||
2704 | if (!ha->flags.hw_event_marker_found) { | ||
2705 | /* Create marker. */ | ||
2706 | marker[0] = QMARK('L', ha->fw_major_version, | ||
2707 | ha->fw_minor_version, ha->fw_subminor_version); | ||
2708 | marker[1] = QMARK(QLA_DRIVER_MAJOR_VER, QLA_DRIVER_MINOR_VER, | ||
2709 | QLA_DRIVER_PATCH_VER, QLA_DRIVER_BETA_VER); | ||
2710 | |||
2711 | /* Locate marker. */ | ||
2712 | ha->hw_event_ptr = ha->flt_region_hw_event; | ||
2713 | for (;;) { | ||
2714 | qla24xx_read_flash_data(vha, fdata, ha->hw_event_ptr, | ||
2715 | 4); | ||
2716 | if (fdata[0] == __constant_cpu_to_le32(0xffffffff) && | ||
2717 | fdata[1] == __constant_cpu_to_le32(0xffffffff)) | ||
2718 | break; | ||
2719 | ha->hw_event_ptr += FA_HW_EVENT_ENTRY_SIZE; | ||
2720 | if (ha->hw_event_ptr >= | ||
2721 | ha->flt_region_hw_event + FA_HW_EVENT_SIZE) { | ||
2722 | DEBUG2(qla_printk(KERN_WARNING, ha, | ||
2723 | "HW event -- Log Full!\n")); | ||
2724 | return QLA_MEMORY_ALLOC_FAILED; | ||
2725 | } | ||
2726 | if (fdata[2] == marker[0] && fdata[3] == marker[1]) { | ||
2727 | ha->flags.hw_event_marker_found = 1; | ||
2728 | break; | ||
2729 | } | ||
2730 | } | ||
2731 | /* No marker, write it. */ | ||
2732 | if (!ha->flags.hw_event_marker_found) { | ||
2733 | rval = qla2xxx_hw_event_store(vha, marker); | ||
2734 | if (rval != QLA_SUCCESS) { | ||
2735 | DEBUG2(qla_printk(KERN_WARNING, ha, | ||
2736 | "HW event -- Failed marker write=%x.!\n", | ||
2737 | rval)); | ||
2738 | return rval; | ||
2739 | } | ||
2740 | ha->flags.hw_event_marker_found = 1; | ||
2741 | } | ||
2742 | } | ||
2743 | |||
2744 | /* Store error. */ | ||
2745 | fdata[0] = cpu_to_le32(code << 16 | d1); | ||
2746 | fdata[1] = cpu_to_le32(d2 << 16 | d3); | ||
2747 | rval = qla2xxx_hw_event_store(vha, fdata); | ||
2748 | if (rval != QLA_SUCCESS) { | ||
2749 | DEBUG2(qla_printk(KERN_WARNING, ha, | ||
2750 | "HW event -- Failed error write=%x.!\n", | ||
2751 | rval)); | ||
2752 | } | ||
2753 | |||
2754 | return rval; | ||
2755 | } | ||