aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorGiridhar Malavali <giridhar.malavali@qlogic.com>2010-07-23 06:28:34 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:06:14 -0400
commit3711333dfbeec1905c2d3521d1ed2ddcdbdbac04 (patch)
treef6161ea314b8b0ace4603c40445aac64acb44f56 /drivers/scsi/qla2xxx
parent08f71e090d3f0d8136c3f350e5082f9217fb7d5b (diff)
[SCSI] qla2xxx: Updates for ISP82xx.
Re-organized and cleaned up the ISP82xx specific code. Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c320
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.h3
4 files changed, 42 insertions, 289 deletions
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 84441e8e267e..8b0a8ca95086 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -508,16 +508,12 @@ extern int qla82xx_pci_mem_read_2M(struct qla_hw_data *, u64, void *, int);
508extern int qla82xx_pci_mem_write_2M(struct qla_hw_data *, u64, void *, int); 508extern int qla82xx_pci_mem_write_2M(struct qla_hw_data *, u64, void *, int);
509extern char *qla82xx_pci_info_str(struct scsi_qla_host *, char *); 509extern char *qla82xx_pci_info_str(struct scsi_qla_host *, char *);
510extern int qla82xx_pci_region_offset(struct pci_dev *, int); 510extern int qla82xx_pci_region_offset(struct pci_dev *, int);
511extern int qla82xx_pci_region_len(struct pci_dev *, int);
512extern int qla82xx_iospace_config(struct qla_hw_data *); 511extern int qla82xx_iospace_config(struct qla_hw_data *);
513 512
514/* Initialization related functions */ 513/* Initialization related functions */
515extern void qla82xx_reset_chip(struct scsi_qla_host *); 514extern void qla82xx_reset_chip(struct scsi_qla_host *);
516extern void qla82xx_config_rings(struct scsi_qla_host *); 515extern void qla82xx_config_rings(struct scsi_qla_host *);
517extern int qla82xx_nvram_config(struct scsi_qla_host *);
518extern int qla82xx_pinit_from_rom(scsi_qla_host_t *); 516extern int qla82xx_pinit_from_rom(scsi_qla_host_t *);
519extern int qla82xx_load_firmware(scsi_qla_host_t *);
520extern int qla82xx_reset_hw(scsi_qla_host_t *);
521extern void qla82xx_watchdog(scsi_qla_host_t *); 517extern void qla82xx_watchdog(scsi_qla_host_t *);
522 518
523/* Firmware and flash related functions */ 519/* Firmware and flash related functions */
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 2f39e3093939..02a4d355db3c 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -4111,7 +4111,7 @@ qla82xx_mbx_intr_enable(scsi_qla_host_t *vha)
4111 "%s(%ld): entered.\n", __func__, vha->host_no)); 4111 "%s(%ld): entered.\n", __func__, vha->host_no));
4112 4112
4113 memset(mcp, 0, sizeof(mbx_cmd_t)); 4113 memset(mcp, 0, sizeof(mbx_cmd_t));
4114 mcp->mb[0] = MBC_TOGGLE_INTR; 4114 mcp->mb[0] = MBC_TOGGLE_INTERRUPT;
4115 mcp->mb[1] = 1; 4115 mcp->mb[1] = 1;
4116 4116
4117 mcp->out_mb = MBX_1|MBX_0; 4117 mcp->out_mb = MBX_1|MBX_0;
@@ -4147,7 +4147,7 @@ qla82xx_mbx_intr_disable(scsi_qla_host_t *vha)
4147 "%s(%ld): entered.\n", __func__, vha->host_no)); 4147 "%s(%ld): entered.\n", __func__, vha->host_no));
4148 4148
4149 memset(mcp, 0, sizeof(mbx_cmd_t)); 4149 memset(mcp, 0, sizeof(mbx_cmd_t));
4150 mcp->mb[0] = MBC_TOGGLE_INTR; 4150 mcp->mb[0] = MBC_TOGGLE_INTERRUPT;
4151 mcp->mb[1] = 0; 4151 mcp->mb[1] = 0;
4152 4152
4153 mcp->out_mb = MBX_1|MBX_0; 4153 mcp->out_mb = MBX_1|MBX_0;
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index e3e3ebdfe5d9..4299df2e082c 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -797,179 +797,6 @@ qla82xx_pci_mem_write_direct(struct qla_hw_data *ha,
797 return ret; 797 return ret;
798} 798}
799 799
800int
801qla82xx_wrmem(struct qla_hw_data *ha, u64 off, void *data, int size)
802{
803 int i, j, ret = 0, loop, sz[2], off0;
804 u32 temp;
805 u64 off8, mem_crb, tmpw, word[2] = {0, 0};
806#define MAX_CTL_CHECK 1000
807 /*
808 * If not MN, go check for MS or invalid.
809 */
810 if (off >= QLA82XX_ADDR_QDR_NET && off <= QLA82XX_P3_ADDR_QDR_NET_MAX) {
811 mem_crb = QLA82XX_CRB_QDR_NET;
812 } else {
813 mem_crb = QLA82XX_CRB_DDR_NET;
814 if (qla82xx_pci_mem_bound_check(ha, off, size) == 0)
815 return qla82xx_pci_mem_write_direct(ha, off,
816 data, size);
817 }
818
819 off8 = off & 0xfffffff8;
820 off0 = off & 0x7;
821 sz[0] = (size < (8 - off0)) ? size : (8 - off0);
822 sz[1] = size - sz[0];
823 loop = ((off0 + size - 1) >> 3) + 1;
824
825 if ((size != 8) || (off0 != 0)) {
826 for (i = 0; i < loop; i++) {
827 if (qla82xx_rdmem(ha, off8 + (i << 3), &word[i], 8))
828 return -1;
829 }
830 }
831
832 switch (size) {
833 case 1:
834 tmpw = *((u8 *)data);
835 break;
836 case 2:
837 tmpw = *((u16 *)data);
838 break;
839 case 4:
840 tmpw = *((u32 *)data);
841 break;
842 case 8:
843 default:
844 tmpw = *((u64 *)data);
845 break;
846 }
847
848 word[0] &= ~((~(~0ULL << (sz[0] * 8))) << (off0 * 8));
849 word[0] |= tmpw << (off0 * 8);
850
851 if (loop == 2) {
852 word[1] &= ~(~0ULL << (sz[1] * 8));
853 word[1] |= tmpw >> (sz[0] * 8);
854 }
855
856 for (i = 0; i < loop; i++) {
857 temp = off8 + (i << 3);
858 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_ADDR_LO, temp);
859 temp = 0;
860 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_ADDR_HI, temp);
861 temp = word[i] & 0xffffffff;
862 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_WRDATA_LO, temp);
863 temp = (word[i] >> 32) & 0xffffffff;
864 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_WRDATA_HI, temp);
865 temp = MIU_TA_CTL_ENABLE | MIU_TA_CTL_WRITE;
866 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_CTRL, temp);
867 temp = MIU_TA_CTL_START | MIU_TA_CTL_ENABLE | MIU_TA_CTL_WRITE;
868 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_CTRL, temp);
869
870 for (j = 0; j < MAX_CTL_CHECK; j++) {
871 temp = qla82xx_rd_32(ha, mem_crb + MIU_TEST_AGT_CTRL);
872 if ((temp & MIU_TA_CTL_BUSY) == 0)
873 break;
874 }
875
876 if (j >= MAX_CTL_CHECK) {
877 qla_printk(KERN_WARNING, ha,
878 "%s: Fail to write through agent\n",
879 QLA2XXX_DRIVER_NAME);
880 ret = -1;
881 break;
882 }
883 }
884 return ret;
885}
886
887int
888qla82xx_rdmem(struct qla_hw_data *ha, u64 off, void *data, int size)
889{
890 int i, j = 0, k, start, end, loop, sz[2], off0[2];
891 u32 temp;
892 u64 off8, val, mem_crb, word[2] = {0, 0};
893#define MAX_CTL_CHECK 1000
894
895 /*
896 * If not MN, go check for MS or invalid.
897 */
898 if (off >= QLA82XX_ADDR_QDR_NET && off <= QLA82XX_P3_ADDR_QDR_NET_MAX)
899 mem_crb = QLA82XX_CRB_QDR_NET;
900 else {
901 mem_crb = QLA82XX_CRB_DDR_NET;
902 if (qla82xx_pci_mem_bound_check(ha, off, size) == 0)
903 return qla82xx_pci_mem_read_direct(ha, off,
904 data, size);
905 }
906
907 off8 = off & 0xfffffff8;
908 off0[0] = off & 0x7;
909 off0[1] = 0;
910 sz[0] = (size < (8 - off0[0])) ? size : (8 - off0[0]);
911 sz[1] = size - sz[0];
912 loop = ((off0[0] + size - 1) >> 3) + 1;
913
914 for (i = 0; i < loop; i++) {
915 temp = off8 + (i << 3);
916 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_ADDR_LO, temp);
917 temp = 0;
918 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_ADDR_HI, temp);
919 temp = MIU_TA_CTL_ENABLE;
920 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_CTRL, temp);
921 temp = MIU_TA_CTL_START | MIU_TA_CTL_ENABLE;
922 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_CTRL, temp);
923
924 for (j = 0; j < MAX_CTL_CHECK; j++) {
925 temp = qla82xx_rd_32(ha, mem_crb + MIU_TEST_AGT_CTRL);
926 if ((temp & MIU_TA_CTL_BUSY) == 0)
927 break;
928 }
929
930 if (j >= MAX_CTL_CHECK) {
931 qla_printk(KERN_INFO, ha,
932 "%s: Fail to read through agent\n",
933 QLA2XXX_DRIVER_NAME);
934 break;
935 }
936
937 start = off0[i] >> 2;
938 end = (off0[i] + sz[i] - 1) >> 2;
939 for (k = start; k <= end; k++) {
940 temp = qla82xx_rd_32(ha,
941 mem_crb + MIU_TEST_AGT_RDDATA(k));
942 word[i] |= ((u64)temp << (32 * k));
943 }
944 }
945
946 if (j >= MAX_CTL_CHECK)
947 return -1;
948
949 if (sz[0] == 8) {
950 val = word[0];
951 } else {
952 val = ((word[0] >> (off0[0] * 8)) & (~(~0ULL << (sz[0] * 8)))) |
953 ((word[1] & (~(~0ULL << (sz[1] * 8)))) << (sz[0] * 8));
954 }
955
956 switch (size) {
957 case 1:
958 *(u8 *)data = val;
959 break;
960 case 2:
961 *(u16 *)data = val;
962 break;
963 case 4:
964 *(u32 *)data = val;
965 break;
966 case 8:
967 *(u64 *)data = val;
968 break;
969 }
970 return 0;
971}
972
973#define MTU_FUDGE_FACTOR 100 800#define MTU_FUDGE_FACTOR 100
974unsigned long qla82xx_decode_crb_addr(unsigned long addr) 801unsigned long qla82xx_decode_crb_addr(unsigned long addr)
975{ 802{
@@ -1347,11 +1174,6 @@ int qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
1347 continue; 1174 continue;
1348 } 1175 }
1349 1176
1350 if (off == (QLA82XX_CRB_PEG_NET_1 + 0x18)) {
1351 if (!QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision))
1352 buf[i].data = 0x1020;
1353 }
1354
1355 qla82xx_wr_32(ha, off, buf[i].data); 1177 qla82xx_wr_32(ha, off, buf[i].data);
1356 1178
1357 /* ISP requires much bigger delay to settle down, 1179 /* ISP requires much bigger delay to settle down,
@@ -1429,12 +1251,8 @@ qla82xx_fw_load_from_flash(struct qla_hw_data *ha)
1429 } 1251 }
1430 udelay(100); 1252 udelay(100);
1431 read_lock(&ha->hw_lock); 1253 read_lock(&ha->hw_lock);
1432 if (QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision)) { 1254 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x18, 0x1020);
1433 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x18, 0x1020); 1255 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001e);
1434 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001e);
1435 } else {
1436 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001d);
1437 }
1438 read_unlock(&ha->hw_lock); 1256 read_unlock(&ha->hw_lock);
1439 return 0; 1257 return 0;
1440} 1258}
@@ -1461,17 +1279,10 @@ qla82xx_pci_mem_read_2M(struct qla_hw_data *ha,
1461 off, data, size); 1279 off, data, size);
1462 } 1280 }
1463 1281
1464 if (QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision)) { 1282 off8 = off & 0xfffffff0;
1465 off8 = off & 0xfffffff0; 1283 off0[0] = off & 0xf;
1466 off0[0] = off & 0xf; 1284 sz[0] = (size < (16 - off0[0])) ? size : (16 - off0[0]);
1467 sz[0] = (size < (16 - off0[0])) ? size : (16 - off0[0]); 1285 shift_amount = 4;
1468 shift_amount = 4;
1469 } else {
1470 off8 = off & 0xfffffff8;
1471 off0[0] = off & 0x7;
1472 sz[0] = (size < (8 - off0[0])) ? size : (8 - off0[0]);
1473 shift_amount = 4;
1474 }
1475 loop = ((off0[0] + size - 1) >> shift_amount) + 1; 1286 loop = ((off0[0] + size - 1) >> shift_amount) + 1;
1476 off0[1] = 0; 1287 off0[1] = 0;
1477 sz[1] = size - sz[0]; 1288 sz[1] = size - sz[0];
@@ -1551,7 +1362,7 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
1551 u64 off, void *data, int size) 1362 u64 off, void *data, int size)
1552{ 1363{
1553 int i, j, ret = 0, loop, sz[2], off0; 1364 int i, j, ret = 0, loop, sz[2], off0;
1554 int scale, shift_amount, p3p, startword; 1365 int scale, shift_amount, startword;
1555 uint32_t temp; 1366 uint32_t temp;
1556 uint64_t off8, mem_crb, tmpw, word[2] = {0, 0}; 1367 uint64_t off8, mem_crb, tmpw, word[2] = {0, 0};
1557 1368
@@ -1571,28 +1382,16 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
1571 sz[0] = (size < (8 - off0)) ? size : (8 - off0); 1382 sz[0] = (size < (8 - off0)) ? size : (8 - off0);
1572 sz[1] = size - sz[0]; 1383 sz[1] = size - sz[0];
1573 1384
1574 if (QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision)) { 1385 off8 = off & 0xfffffff0;
1575 off8 = off & 0xfffffff0; 1386 loop = (((off & 0xf) + size - 1) >> 4) + 1;
1576 loop = (((off & 0xf) + size - 1) >> 4) + 1; 1387 shift_amount = 4;
1577 shift_amount = 4; 1388 scale = 2;
1578 scale = 2; 1389 startword = (off & 0xf)/8;
1579 p3p = 1; 1390
1580 startword = (off & 0xf)/8; 1391 for (i = 0; i < loop; i++) {
1581 } else { 1392 if (qla82xx_pci_mem_read_2M(ha, off8 +
1582 off8 = off & 0xfffffff8; 1393 (i << shift_amount), &word[i * scale], 8))
1583 loop = ((off0 + size - 1) >> 3) + 1; 1394 return -1;
1584 shift_amount = 3;
1585 scale = 1;
1586 p3p = 0;
1587 startword = 0;
1588 }
1589
1590 if (p3p || (size != 8) || (off0 != 0)) {
1591 for (i = 0; i < loop; i++) {
1592 if (qla82xx_pci_mem_read_2M(ha, off8 +
1593 (i << shift_amount), &word[i * scale], 8))
1594 return -1;
1595 }
1596 } 1395 }
1597 1396
1598 switch (size) { 1397 switch (size) {
@@ -1611,26 +1410,16 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
1611 break; 1410 break;
1612 } 1411 }
1613 1412
1614 if (QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision)) { 1413 if (sz[0] == 8) {
1615 if (sz[0] == 8) { 1414 word[startword] = tmpw;
1616 word[startword] = tmpw;
1617 } else {
1618 word[startword] &=
1619 ~((~(~0ULL << (sz[0] * 8))) << (off0 * 8));
1620 word[startword] |= tmpw << (off0 * 8);
1621 }
1622 if (sz[1] != 0) {
1623 word[startword+1] &= ~(~0ULL << (sz[1] * 8));
1624 word[startword+1] |= tmpw >> (sz[0] * 8);
1625 }
1626 } else { 1415 } else {
1627 word[startword] &= ~((~(~0ULL << (sz[0] * 8))) << (off0 * 8)); 1416 word[startword] &=
1417 ~((~(~0ULL << (sz[0] * 8))) << (off0 * 8));
1628 word[startword] |= tmpw << (off0 * 8); 1418 word[startword] |= tmpw << (off0 * 8);
1629 1419 }
1630 if (loop == 2) { 1420 if (sz[1] != 0) {
1631 word[1] &= ~(~0ULL << (sz[1] * 8)); 1421 word[startword+1] &= ~(~0ULL << (sz[1] * 8));
1632 word[1] |= tmpw >> (sz[0] * 8); 1422 word[startword+1] |= tmpw >> (sz[0] * 8);
1633 }
1634 } 1423 }
1635 1424
1636 /* 1425 /*
@@ -1647,14 +1436,12 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
1647 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_WRDATA_LO, temp); 1436 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_WRDATA_LO, temp);
1648 temp = (word[i * scale] >> 32) & 0xffffffff; 1437 temp = (word[i * scale] >> 32) & 0xffffffff;
1649 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_WRDATA_HI, temp); 1438 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_WRDATA_HI, temp);
1650 if (QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision)) { 1439 temp = word[i*scale + 1] & 0xffffffff;
1651 temp = word[i*scale + 1] & 0xffffffff; 1440 qla82xx_wr_32(ha, mem_crb +
1652 qla82xx_wr_32(ha, mem_crb + 1441 MIU_TEST_AGT_WRDATA_UPPER_LO, temp);
1653 MIU_TEST_AGT_WRDATA_UPPER_LO, temp); 1442 temp = (word[i*scale + 1] >> 32) & 0xffffffff;
1654 temp = (word[i*scale + 1] >> 32) & 0xffffffff; 1443 qla82xx_wr_32(ha, mem_crb +
1655 qla82xx_wr_32(ha, mem_crb + 1444 MIU_TEST_AGT_WRDATA_UPPER_HI, temp);
1656 MIU_TEST_AGT_WRDATA_UPPER_HI, temp);
1657 }
1658 1445
1659 temp = MIU_TA_CTL_ENABLE | MIU_TA_CTL_WRITE; 1446 temp = MIU_TA_CTL_ENABLE | MIU_TA_CTL_WRITE;
1660 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_CTRL, temp); 1447 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_CTRL, temp);
@@ -1804,22 +1591,6 @@ int qla82xx_pci_region_offset(struct pci_dev *pdev, int region)
1804 return val; 1591 return val;
1805} 1592}
1806 1593
1807int qla82xx_pci_region_len(struct pci_dev *pdev, int region)
1808{
1809 unsigned long val = 0;
1810 u32 control;
1811 switch (region) {
1812 case 0:
1813 pci_read_config_dword(pdev, QLA82XX_PCI_REG_MSIX_TBL, &control);
1814 val = control;
1815 break;
1816 case 1:
1817 val = pci_resource_len(pdev, 0) -
1818 qla82xx_pci_region_offset(pdev, 1);
1819 break;
1820 }
1821 return val;
1822}
1823 1594
1824int 1595int
1825qla82xx_iospace_config(struct qla_hw_data *ha) 1596qla82xx_iospace_config(struct qla_hw_data *ha)
@@ -1941,12 +1712,6 @@ void qla82xx_config_rings(struct scsi_qla_host *vha)
1941 icb->response_q_address[0] = cpu_to_le32(LSD(rsp->dma)); 1712 icb->response_q_address[0] = cpu_to_le32(LSD(rsp->dma));
1942 icb->response_q_address[1] = cpu_to_le32(MSD(rsp->dma)); 1713 icb->response_q_address[1] = cpu_to_le32(MSD(rsp->dma));
1943 1714
1944 icb->version = 1;
1945 icb->frame_payload_size = 2112;
1946 icb->execution_throttle = 8;
1947 icb->exchange_count = 128;
1948 icb->login_retry_count = 8;
1949
1950 WRT_REG_DWORD((unsigned long __iomem *)&reg->req_q_out[0], 0); 1715 WRT_REG_DWORD((unsigned long __iomem *)&reg->req_q_out[0], 0);
1951 WRT_REG_DWORD((unsigned long __iomem *)&reg->rsp_q_in[0], 0); 1716 WRT_REG_DWORD((unsigned long __iomem *)&reg->rsp_q_in[0], 0);
1952 WRT_REG_DWORD((unsigned long __iomem *)&reg->rsp_q_out[0], 0); 1717 WRT_REG_DWORD((unsigned long __iomem *)&reg->rsp_q_out[0], 0);
@@ -1999,11 +1764,8 @@ int qla82xx_fw_load_from_blob(struct qla_hw_data *ha)
1999 qla82xx_wr_32(ha, QLA82XX_CAM_RAM(0x1fc), QLA82XX_BDINFO_MAGIC); 1764 qla82xx_wr_32(ha, QLA82XX_CAM_RAM(0x1fc), QLA82XX_BDINFO_MAGIC);
2000 1765
2001 read_lock(&ha->hw_lock); 1766 read_lock(&ha->hw_lock);
2002 if (QLA82XX_IS_REVISION_P3PLUS(ha->chip_revision)) { 1767 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x18, 0x1020);
2003 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x18, 0x1020); 1768 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001e);
2004 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001e);
2005 } else
2006 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001d);
2007 read_unlock(&ha->hw_lock); 1769 read_unlock(&ha->hw_lock);
2008 return 0; 1770 return 0;
2009} 1771}
@@ -2256,8 +2018,6 @@ qla82xx_intr_handler(int irq, void *dev_id)
2256 2018
2257 if (RD_REG_DWORD(&reg->host_int)) { 2019 if (RD_REG_DWORD(&reg->host_int)) {
2258 stat = RD_REG_DWORD(&reg->host_status); 2020 stat = RD_REG_DWORD(&reg->host_status);
2259 if ((stat & HSRX_RISC_INT) == 0)
2260 break;
2261 2021
2262 switch (stat & 0xff) { 2022 switch (stat & 0xff) {
2263 case 0x1: 2023 case 0x1:
@@ -2332,8 +2092,6 @@ qla82xx_msix_default(int irq, void *dev_id)
2332 do { 2092 do {
2333 if (RD_REG_DWORD(&reg->host_int)) { 2093 if (RD_REG_DWORD(&reg->host_int)) {
2334 stat = RD_REG_DWORD(&reg->host_status); 2094 stat = RD_REG_DWORD(&reg->host_status);
2335 if ((stat & HSRX_RISC_INT) == 0)
2336 break;
2337 2095
2338 switch (stat & 0xff) { 2096 switch (stat & 0xff) {
2339 case 0x1: 2097 case 0x1:
@@ -2583,12 +2341,6 @@ int qla82xx_load_fw(scsi_qla_host_t *vha)
2583 struct fw_blob *blob; 2341 struct fw_blob *blob;
2584 struct qla_hw_data *ha = vha->hw; 2342 struct qla_hw_data *ha = vha->hw;
2585 2343
2586 /* Put both the PEG CMD and RCV PEG to default state
2587 * of 0 before resetting the hardware
2588 */
2589 qla82xx_wr_32(ha, CRB_CMDPEG_STATE, 0);
2590 qla82xx_wr_32(ha, CRB_RCVPEG_STATE, 0);
2591
2592 if (qla82xx_pinit_from_rom(vha) != QLA_SUCCESS) { 2344 if (qla82xx_pinit_from_rom(vha) != QLA_SUCCESS) {
2593 qla_printk(KERN_ERR, ha, 2345 qla_printk(KERN_ERR, ha,
2594 "%s: Error during CRB Initialization\n", __func__); 2346 "%s: Error during CRB Initialization\n", __func__);
@@ -2669,6 +2421,12 @@ qla82xx_start_firmware(scsi_qla_host_t *vha)
2669 /* scrub dma mask expansion register */ 2421 /* scrub dma mask expansion register */
2670 qla82xx_wr_32(ha, CRB_DMA_SHIFT, 0x55555555); 2422 qla82xx_wr_32(ha, CRB_DMA_SHIFT, 0x55555555);
2671 2423
2424 /* Put both the PEG CMD and RCV PEG to default state
2425 * of 0 before resetting the hardware
2426 */
2427 qla82xx_wr_32(ha, CRB_CMDPEG_STATE, 0);
2428 qla82xx_wr_32(ha, CRB_RCVPEG_STATE, 0);
2429
2672 /* Overwrite stale initialization register values */ 2430 /* Overwrite stale initialization register values */
2673 qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS1, 0); 2431 qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS1, 0);
2674 qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS2, 0); 2432 qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS2, 0);
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h
index 9a9127efadaf..420e0773e743 100644
--- a/drivers/scsi/qla2xxx/qla_nx.h
+++ b/drivers/scsi/qla2xxx/qla_nx.h
@@ -816,7 +816,6 @@ struct qla82xx_uri_data_desc{
816#define QLA82XX_FLASH_ROMIMAGE 4 816#define QLA82XX_FLASH_ROMIMAGE 4
817#define QLA82XX_UNKNOWN_ROMIMAGE 0xff 817#define QLA82XX_UNKNOWN_ROMIMAGE 0xff
818 818
819#define QLA82XX_IS_REVISION_P3PLUS(_rev_) ((_rev_) >= 0x50)
820#define MIU_TEST_AGT_WRDATA_UPPER_LO (0x0b0) 819#define MIU_TEST_AGT_WRDATA_UPPER_LO (0x0b0)
821#define MIU_TEST_AGT_WRDATA_UPPER_HI (0x0b4) 820#define MIU_TEST_AGT_WRDATA_UPPER_HI (0x0b4)
822 821
@@ -887,7 +886,7 @@ struct ct6_dsd {
887 struct list_head dsd_list; 886 struct list_head dsd_list;
888}; 887};
889 888
890#define MBC_TOGGLE_INTR 0x10 889#define MBC_TOGGLE_INTERRUPT 0x10
891 890
892/* Flash offset */ 891/* Flash offset */
893#define FLT_REG_BOOTLOAD_82XX 0x72 892#define FLT_REG_BOOTLOAD_82XX 0x72