diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
commit | 9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch) | |
tree | 4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /drivers/scsi/qla2xxx | |
parent | 50d9a126240f9961cfdd063336bbeb91f77a7dce (diff) | |
parent | 23c3e290fb9ce38cabc2822b47583fc8702411bf (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits)
[SCSI] usbstorage: use last_sector_bug flag universally
[SCSI] libsas: abstract STP task status into a function
[SCSI] ultrastor: clean up inline asm warnings
[SCSI] aic7xxx: fix firmware build
[SCSI] aacraid: fib context lock for management ioctls
[SCSI] ch: remove forward declarations
[SCSI] ch: fix device minor number management bug
[SCSI] ch: handle class_device_create failure properly
[SCSI] NCR5380: fix section mismatch
[SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
[SCSI] IB/iSER: add logical unit reset support
[SCSI] don't use __GFP_DMA for sense buffers if not required
[SCSI] use dynamically allocated sense buffer
[SCSI] scsi.h: add macro for enclosure bit of inquiry data
[SCSI] sd: add fix for devices with last sector access problems
[SCSI] fix pcmcia compile problem
[SCSI] aacraid: add Voodoo Lite class of cards.
[SCSI] aacraid: add new driver features flags
[SCSI] qla2xxx: Update version number to 8.02.00-k7.
[SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
...
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r-- | drivers/scsi/qla2xxx/Makefile | 2 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 54 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 37 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.h | 19 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 52 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dfs.c | 175 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_fw.h | 30 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 51 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 97 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_isr.c | 120 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 430 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mid.c | 46 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 80 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_sup.c | 18 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_version.h | 2 |
15 files changed, 655 insertions, 558 deletions
diff --git a/drivers/scsi/qla2xxx/Makefile b/drivers/scsi/qla2xxx/Makefile index 71ddb5db4944..c51fd1f86639 100644 --- a/drivers/scsi/qla2xxx/Makefile +++ b/drivers/scsi/qla2xxx/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ | 1 | qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ |
2 | qla_dbg.o qla_sup.o qla_attr.o qla_mid.o | 2 | qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o |
3 | 3 | ||
4 | obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o | 4 | obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index fb388b8c07cf..adf97320574b 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/kthread.h> | 9 | #include <linux/kthread.h> |
10 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
11 | 11 | ||
12 | int qla24xx_vport_disable(struct fc_vport *, bool); | 12 | static int qla24xx_vport_disable(struct fc_vport *, bool); |
13 | 13 | ||
14 | /* SYSFS attributes --------------------------------------------------------- */ | 14 | /* SYSFS attributes --------------------------------------------------------- */ |
15 | 15 | ||
@@ -958,7 +958,7 @@ qla2x00_issue_lip(struct Scsi_Host *shost) | |||
958 | { | 958 | { |
959 | scsi_qla_host_t *ha = shost_priv(shost); | 959 | scsi_qla_host_t *ha = shost_priv(shost); |
960 | 960 | ||
961 | set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags); | 961 | qla2x00_loop_reset(ha); |
962 | return 0; | 962 | return 0; |
963 | } | 963 | } |
964 | 964 | ||
@@ -967,35 +967,51 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
967 | { | 967 | { |
968 | scsi_qla_host_t *ha = shost_priv(shost); | 968 | scsi_qla_host_t *ha = shost_priv(shost); |
969 | int rval; | 969 | int rval; |
970 | uint16_t mb_stat[1]; | 970 | struct link_statistics *stats; |
971 | link_stat_t stat_buf; | 971 | dma_addr_t stats_dma; |
972 | struct fc_host_statistics *pfc_host_stat; | 972 | struct fc_host_statistics *pfc_host_stat; |
973 | 973 | ||
974 | rval = QLA_FUNCTION_FAILED; | ||
975 | pfc_host_stat = &ha->fc_host_stat; | 974 | pfc_host_stat = &ha->fc_host_stat; |
976 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); | 975 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); |
977 | 976 | ||
977 | stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma); | ||
978 | if (stats == NULL) { | ||
979 | DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", | ||
980 | __func__, ha->host_no)); | ||
981 | goto done; | ||
982 | } | ||
983 | memset(stats, 0, DMA_POOL_SIZE); | ||
984 | |||
985 | rval = QLA_FUNCTION_FAILED; | ||
978 | if (IS_FWI2_CAPABLE(ha)) { | 986 | if (IS_FWI2_CAPABLE(ha)) { |
979 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, | 987 | rval = qla24xx_get_isp_stats(ha, stats, stats_dma); |
980 | sizeof(stat_buf) / 4, mb_stat); | ||
981 | } else if (atomic_read(&ha->loop_state) == LOOP_READY && | 988 | } else if (atomic_read(&ha->loop_state) == LOOP_READY && |
982 | !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) && | 989 | !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) && |
983 | !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) && | 990 | !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) && |
984 | !ha->dpc_active) { | 991 | !ha->dpc_active) { |
985 | /* Must be in a 'READY' state for statistics retrieval. */ | 992 | /* Must be in a 'READY' state for statistics retrieval. */ |
986 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, | 993 | rval = qla2x00_get_link_status(ha, ha->loop_id, stats, |
987 | mb_stat); | 994 | stats_dma); |
988 | } | 995 | } |
989 | 996 | ||
990 | if (rval != QLA_SUCCESS) | 997 | if (rval != QLA_SUCCESS) |
991 | goto done; | 998 | goto done_free; |
999 | |||
1000 | pfc_host_stat->link_failure_count = stats->link_fail_cnt; | ||
1001 | pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt; | ||
1002 | pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt; | ||
1003 | pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt; | ||
1004 | pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt; | ||
1005 | pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt; | ||
1006 | if (IS_FWI2_CAPABLE(ha)) { | ||
1007 | pfc_host_stat->tx_frames = stats->tx_frames; | ||
1008 | pfc_host_stat->rx_frames = stats->rx_frames; | ||
1009 | pfc_host_stat->dumped_frames = stats->dumped_frames; | ||
1010 | pfc_host_stat->nos_count = stats->nos_rcvd; | ||
1011 | } | ||
992 | 1012 | ||
993 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; | 1013 | done_free: |
994 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; | 1014 | dma_pool_free(ha->s_dma_pool, stats, stats_dma); |
995 | pfc_host_stat->loss_of_signal_count = stat_buf.loss_sig_cnt; | ||
996 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; | ||
997 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; | ||
998 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; | ||
999 | done: | 1015 | done: |
1000 | return pfc_host_stat; | 1016 | return pfc_host_stat; |
1001 | } | 1017 | } |
@@ -1113,7 +1129,7 @@ vport_create_failed_2: | |||
1113 | return FC_VPORT_FAILED; | 1129 | return FC_VPORT_FAILED; |
1114 | } | 1130 | } |
1115 | 1131 | ||
1116 | int | 1132 | static int |
1117 | qla24xx_vport_delete(struct fc_vport *fc_vport) | 1133 | qla24xx_vport_delete(struct fc_vport *fc_vport) |
1118 | { | 1134 | { |
1119 | scsi_qla_host_t *ha = shost_priv(fc_vport->shost); | 1135 | scsi_qla_host_t *ha = shost_priv(fc_vport->shost); |
@@ -1124,7 +1140,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) | |||
1124 | 1140 | ||
1125 | down(&ha->vport_sem); | 1141 | down(&ha->vport_sem); |
1126 | ha->cur_vport_count--; | 1142 | ha->cur_vport_count--; |
1127 | clear_bit(vha->vp_idx, (unsigned long *)ha->vp_idx_map); | 1143 | clear_bit(vha->vp_idx, ha->vp_idx_map); |
1128 | up(&ha->vport_sem); | 1144 | up(&ha->vport_sem); |
1129 | 1145 | ||
1130 | kfree(vha->node_name); | 1146 | kfree(vha->node_name); |
@@ -1146,7 +1162,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) | |||
1146 | return 0; | 1162 | return 0; |
1147 | } | 1163 | } |
1148 | 1164 | ||
1149 | int | 1165 | static int |
1150 | qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable) | 1166 | qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable) |
1151 | { | 1167 | { |
1152 | scsi_qla_host_t *vha = fc_vport->dd_data; | 1168 | scsi_qla_host_t *vha = fc_vport->dd_data; |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index eaa04dabcdf6..d88e98c476b0 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -1051,6 +1051,7 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
1051 | struct qla25xx_fw_dump *fw; | 1051 | struct qla25xx_fw_dump *fw; |
1052 | uint32_t ext_mem_cnt; | 1052 | uint32_t ext_mem_cnt; |
1053 | void *nxt; | 1053 | void *nxt; |
1054 | struct qla2xxx_fce_chain *fcec; | ||
1054 | 1055 | ||
1055 | risc_address = ext_mem_cnt = 0; | 1056 | risc_address = ext_mem_cnt = 0; |
1056 | flags = 0; | 1057 | flags = 0; |
@@ -1321,10 +1322,31 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
1321 | if (rval != QLA_SUCCESS) | 1322 | if (rval != QLA_SUCCESS) |
1322 | goto qla25xx_fw_dump_failed_0; | 1323 | goto qla25xx_fw_dump_failed_0; |
1323 | 1324 | ||
1325 | /* Fibre Channel Trace Buffer. */ | ||
1324 | nxt = qla2xxx_copy_queues(ha, nxt); | 1326 | nxt = qla2xxx_copy_queues(ha, nxt); |
1325 | if (ha->eft) | 1327 | if (ha->eft) |
1326 | memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); | 1328 | memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); |
1327 | 1329 | ||
1330 | /* Fibre Channel Event Buffer. */ | ||
1331 | if (!ha->fce) | ||
1332 | goto qla25xx_fw_dump_failed_0; | ||
1333 | |||
1334 | ha->fw_dump->version |= __constant_htonl(DUMP_CHAIN_VARIANT); | ||
1335 | |||
1336 | fcec = nxt + ntohl(ha->fw_dump->eft_size); | ||
1337 | fcec->type = __constant_htonl(DUMP_CHAIN_FCE | DUMP_CHAIN_LAST); | ||
1338 | fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) + | ||
1339 | fce_calc_size(ha->fce_bufs)); | ||
1340 | fcec->size = htonl(fce_calc_size(ha->fce_bufs)); | ||
1341 | fcec->addr_l = htonl(LSD(ha->fce_dma)); | ||
1342 | fcec->addr_h = htonl(MSD(ha->fce_dma)); | ||
1343 | |||
1344 | iter_reg = fcec->eregs; | ||
1345 | for (cnt = 0; cnt < 8; cnt++) | ||
1346 | *iter_reg++ = htonl(ha->fce_mb[cnt]); | ||
1347 | |||
1348 | memcpy(iter_reg, ha->fce, ntohl(fcec->size)); | ||
1349 | |||
1328 | qla25xx_fw_dump_failed_0: | 1350 | qla25xx_fw_dump_failed_0: |
1329 | if (rval != QLA_SUCCESS) { | 1351 | if (rval != QLA_SUCCESS) { |
1330 | qla_printk(KERN_WARNING, ha, | 1352 | qla_printk(KERN_WARNING, ha, |
@@ -1428,21 +1450,6 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) | |||
1428 | printk(" sp flags=0x%x\n", sp->flags); | 1450 | printk(" sp flags=0x%x\n", sp->flags); |
1429 | } | 1451 | } |
1430 | 1452 | ||
1431 | void | ||
1432 | qla2x00_dump_pkt(void *pkt) | ||
1433 | { | ||
1434 | uint32_t i; | ||
1435 | uint8_t *data = (uint8_t *) pkt; | ||
1436 | |||
1437 | for (i = 0; i < 64; i++) { | ||
1438 | if (!(i % 4)) | ||
1439 | printk("\n%02x: ", i); | ||
1440 | |||
1441 | printk("%02x ", data[i]); | ||
1442 | } | ||
1443 | printk("\n"); | ||
1444 | } | ||
1445 | |||
1446 | #if defined(QL_DEBUG_ROUTINES) | 1453 | #if defined(QL_DEBUG_ROUTINES) |
1447 | /* | 1454 | /* |
1448 | * qla2x00_formatted_dump_buffer | 1455 | * qla2x00_formatted_dump_buffer |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index a50ecf0b7c84..524598afc81c 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h | |||
@@ -256,6 +256,25 @@ struct qla25xx_fw_dump { | |||
256 | #define EFT_BYTES_PER_BUFFER 0x4000 | 256 | #define EFT_BYTES_PER_BUFFER 0x4000 |
257 | #define EFT_SIZE ((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS)) | 257 | #define EFT_SIZE ((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS)) |
258 | 258 | ||
259 | #define FCE_NUM_BUFFERS 64 | ||
260 | #define FCE_BYTES_PER_BUFFER 0x400 | ||
261 | #define FCE_SIZE ((FCE_BYTES_PER_BUFFER) * (FCE_NUM_BUFFERS)) | ||
262 | #define fce_calc_size(b) ((FCE_BYTES_PER_BUFFER) * (b)) | ||
263 | |||
264 | struct qla2xxx_fce_chain { | ||
265 | uint32_t type; | ||
266 | uint32_t chain_size; | ||
267 | |||
268 | uint32_t size; | ||
269 | uint32_t addr_l; | ||
270 | uint32_t addr_h; | ||
271 | uint32_t eregs[8]; | ||
272 | }; | ||
273 | |||
274 | #define DUMP_CHAIN_VARIANT 0x80000000 | ||
275 | #define DUMP_CHAIN_FCE 0x7FFFFAF0 | ||
276 | #define DUMP_CHAIN_LAST 0x80000000 | ||
277 | |||
259 | struct qla2xxx_fw_dump { | 278 | struct qla2xxx_fw_dump { |
260 | uint8_t signature[4]; | 279 | uint8_t signature[4]; |
261 | uint32_t version; | 280 | uint32_t version; |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 04e8cbca4c0d..6f129da37589 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -623,9 +623,6 @@ typedef struct { | |||
623 | #define MBC_GET_LINK_PRIV_STATS 0x6d /* Get link & private data. */ | 623 | #define MBC_GET_LINK_PRIV_STATS 0x6d /* Get link & private data. */ |
624 | #define MBC_SET_VENDOR_ID 0x76 /* Set Vendor ID. */ | 624 | #define MBC_SET_VENDOR_ID 0x76 /* Set Vendor ID. */ |
625 | 625 | ||
626 | #define TC_ENABLE 4 | ||
627 | #define TC_DISABLE 5 | ||
628 | |||
629 | /* Firmware return data sizes */ | 626 | /* Firmware return data sizes */ |
630 | #define FCAL_MAP_SIZE 128 | 627 | #define FCAL_MAP_SIZE 128 |
631 | 628 | ||
@@ -862,14 +859,20 @@ typedef struct { | |||
862 | #define GLSO_SEND_RPS BIT_0 | 859 | #define GLSO_SEND_RPS BIT_0 |
863 | #define GLSO_USE_DID BIT_3 | 860 | #define GLSO_USE_DID BIT_3 |
864 | 861 | ||
865 | typedef struct { | 862 | struct link_statistics { |
866 | uint32_t link_fail_cnt; | 863 | uint32_t link_fail_cnt; |
867 | uint32_t loss_sync_cnt; | 864 | uint32_t loss_sync_cnt; |
868 | uint32_t loss_sig_cnt; | 865 | uint32_t loss_sig_cnt; |
869 | uint32_t prim_seq_err_cnt; | 866 | uint32_t prim_seq_err_cnt; |
870 | uint32_t inval_xmit_word_cnt; | 867 | uint32_t inval_xmit_word_cnt; |
871 | uint32_t inval_crc_cnt; | 868 | uint32_t inval_crc_cnt; |
872 | } link_stat_t; | 869 | uint32_t unused1[0x1b]; |
870 | uint32_t tx_frames; | ||
871 | uint32_t rx_frames; | ||
872 | uint32_t dumped_frames; | ||
873 | uint32_t unused2[2]; | ||
874 | uint32_t nos_rcvd; | ||
875 | }; | ||
873 | 876 | ||
874 | /* | 877 | /* |
875 | * NVRAM Command values. | 878 | * NVRAM Command values. |
@@ -2116,14 +2119,6 @@ struct qla_msix_entry { | |||
2116 | 2119 | ||
2117 | #define WATCH_INTERVAL 1 /* number of seconds */ | 2120 | #define WATCH_INTERVAL 1 /* number of seconds */ |
2118 | 2121 | ||
2119 | /* NPIV */ | ||
2120 | #define MAX_MULTI_ID_LOOP 126 | ||
2121 | #define MAX_MULTI_ID_FABRIC 64 | ||
2122 | #define MAX_NUM_VPORT_LOOP (MAX_MULTI_ID_LOOP - 1) | ||
2123 | #define MAX_NUM_VPORT_FABRIC (MAX_MULTI_ID_FABRIC - 1) | ||
2124 | #define MAX_NUM_VHBA_LOOP (MAX_MULTI_ID_LOOP - 1) | ||
2125 | #define MAX_NUM_VHBA_FABRIC (MAX_MULTI_ID_FABRIC - 1) | ||
2126 | |||
2127 | /* | 2122 | /* |
2128 | * Linux Host Adapter structure | 2123 | * Linux Host Adapter structure |
2129 | */ | 2124 | */ |
@@ -2161,6 +2156,7 @@ typedef struct scsi_qla_host { | |||
2161 | uint32_t gpsc_supported :1; | 2156 | uint32_t gpsc_supported :1; |
2162 | uint32_t vsan_enabled :1; | 2157 | uint32_t vsan_enabled :1; |
2163 | uint32_t npiv_supported :1; | 2158 | uint32_t npiv_supported :1; |
2159 | uint32_t fce_enabled :1; | ||
2164 | } flags; | 2160 | } flags; |
2165 | 2161 | ||
2166 | atomic_t loop_state; | 2162 | atomic_t loop_state; |
@@ -2273,8 +2269,7 @@ typedef struct scsi_qla_host { | |||
2273 | 2269 | ||
2274 | int bars; | 2270 | int bars; |
2275 | device_reg_t __iomem *iobase; /* Base I/O address */ | 2271 | device_reg_t __iomem *iobase; /* Base I/O address */ |
2276 | unsigned long pio_address; | 2272 | resource_size_t pio_address; |
2277 | unsigned long pio_length; | ||
2278 | #define MIN_IOBASE_LEN 0x100 | 2273 | #define MIN_IOBASE_LEN 0x100 |
2279 | 2274 | ||
2280 | /* ISP ring lock, rings, and indexes */ | 2275 | /* ISP ring lock, rings, and indexes */ |
@@ -2416,9 +2411,9 @@ typedef struct scsi_qla_host { | |||
2416 | #define MBX_INTR_WAIT 2 | 2411 | #define MBX_INTR_WAIT 2 |
2417 | #define MBX_UPDATE_FLASH_ACTIVE 3 | 2412 | #define MBX_UPDATE_FLASH_ACTIVE 3 |
2418 | 2413 | ||
2419 | struct semaphore mbx_cmd_sem; /* Serialialize mbx access */ | ||
2420 | struct semaphore vport_sem; /* Virtual port synchronization */ | 2414 | struct semaphore vport_sem; /* Virtual port synchronization */ |
2421 | struct semaphore mbx_intr_sem; /* Used for completion notification */ | 2415 | struct completion mbx_cmd_comp; /* Serialize mbx access */ |
2416 | struct completion mbx_intr_comp; /* Used for completion notification */ | ||
2422 | 2417 | ||
2423 | uint32_t mbx_flags; | 2418 | uint32_t mbx_flags; |
2424 | #define MBX_IN_PROGRESS BIT_0 | 2419 | #define MBX_IN_PROGRESS BIT_0 |
@@ -2455,6 +2450,15 @@ typedef struct scsi_qla_host { | |||
2455 | dma_addr_t eft_dma; | 2450 | dma_addr_t eft_dma; |
2456 | void *eft; | 2451 | void *eft; |
2457 | 2452 | ||
2453 | struct dentry *dfs_dir; | ||
2454 | struct dentry *dfs_fce; | ||
2455 | dma_addr_t fce_dma; | ||
2456 | void *fce; | ||
2457 | uint32_t fce_bufs; | ||
2458 | uint16_t fce_mb[8]; | ||
2459 | uint64_t fce_wr, fce_rd; | ||
2460 | struct mutex fce_mutex; | ||
2461 | |||
2458 | uint8_t host_str[16]; | 2462 | uint8_t host_str[16]; |
2459 | uint32_t pci_attr; | 2463 | uint32_t pci_attr; |
2460 | uint16_t chip_revision; | 2464 | uint16_t chip_revision; |
@@ -2507,7 +2511,7 @@ typedef struct scsi_qla_host { | |||
2507 | 2511 | ||
2508 | struct list_head vp_list; /* list of VP */ | 2512 | struct list_head vp_list; /* list of VP */ |
2509 | struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ | 2513 | struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ |
2510 | uint8_t vp_idx_map[16]; | 2514 | unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) / sizeof(unsigned long)]; |
2511 | uint16_t num_vhosts; /* number of vports created */ | 2515 | uint16_t num_vhosts; /* number of vports created */ |
2512 | uint16_t num_vsans; /* number of vsan created */ | 2516 | uint16_t num_vsans; /* number of vsan created */ |
2513 | uint16_t vp_idx; /* vport ID */ | 2517 | uint16_t vp_idx; /* vport ID */ |
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c new file mode 100644 index 000000000000..1479c60441c8 --- /dev/null +++ b/drivers/scsi/qla2xxx/qla_dfs.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * QLogic Fibre Channel HBA Driver | ||
3 | * Copyright (c) 2003-2005 QLogic Corporation | ||
4 | * | ||
5 | * See LICENSE.qla2xxx for copyright and licensing details. | ||
6 | */ | ||
7 | #include "qla_def.h" | ||
8 | |||
9 | #include <linux/debugfs.h> | ||
10 | #include <linux/seq_file.h> | ||
11 | |||
12 | static struct dentry *qla2x00_dfs_root; | ||
13 | static atomic_t qla2x00_dfs_root_count; | ||
14 | |||
15 | static int | ||
16 | qla2x00_dfs_fce_show(struct seq_file *s, void *unused) | ||
17 | { | ||
18 | scsi_qla_host_t *ha = s->private; | ||
19 | uint32_t cnt; | ||
20 | uint32_t *fce; | ||
21 | uint64_t fce_start; | ||
22 | |||
23 | mutex_lock(&ha->fce_mutex); | ||
24 | |||
25 | seq_printf(s, "FCE Trace Buffer\n"); | ||
26 | seq_printf(s, "In Pointer = %llx\n\n", ha->fce_wr); | ||
27 | seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma); | ||
28 | seq_printf(s, "FCE Enable Registers\n"); | ||
29 | seq_printf(s, "%08x %08x %08x %08x %08x %08x\n", | ||
30 | ha->fce_mb[0], ha->fce_mb[2], ha->fce_mb[3], ha->fce_mb[4], | ||
31 | ha->fce_mb[5], ha->fce_mb[6]); | ||
32 | |||
33 | fce = (uint32_t *) ha->fce; | ||
34 | fce_start = (unsigned long long) ha->fce_dma; | ||
35 | for (cnt = 0; cnt < fce_calc_size(ha->fce_bufs) / 4; cnt++) { | ||
36 | if (cnt % 8 == 0) | ||
37 | seq_printf(s, "\n%llx: ", | ||
38 | (unsigned long long)((cnt * 4) + fce_start)); | ||
39 | else | ||
40 | seq_printf(s, " "); | ||
41 | seq_printf(s, "%08x", *fce++); | ||
42 | } | ||
43 | |||
44 | seq_printf(s, "\nEnd\n"); | ||
45 | |||
46 | mutex_unlock(&ha->fce_mutex); | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static int | ||
52 | qla2x00_dfs_fce_open(struct inode *inode, struct file *file) | ||
53 | { | ||
54 | scsi_qla_host_t *ha = inode->i_private; | ||
55 | int rval; | ||
56 | |||
57 | if (!ha->flags.fce_enabled) | ||
58 | goto out; | ||
59 | |||
60 | mutex_lock(&ha->fce_mutex); | ||
61 | |||
62 | /* Pause tracing to flush FCE buffers. */ | ||
63 | rval = qla2x00_disable_fce_trace(ha, &ha->fce_wr, &ha->fce_rd); | ||
64 | if (rval) | ||
65 | qla_printk(KERN_WARNING, ha, | ||
66 | "DebugFS: Unable to disable FCE (%d).\n", rval); | ||
67 | |||
68 | ha->flags.fce_enabled = 0; | ||
69 | |||
70 | mutex_unlock(&ha->fce_mutex); | ||
71 | out: | ||
72 | return single_open(file, qla2x00_dfs_fce_show, ha); | ||
73 | } | ||
74 | |||
75 | static int | ||
76 | qla2x00_dfs_fce_release(struct inode *inode, struct file *file) | ||
77 | { | ||
78 | scsi_qla_host_t *ha = inode->i_private; | ||
79 | int rval; | ||
80 | |||
81 | if (ha->flags.fce_enabled) | ||
82 | goto out; | ||
83 | |||
84 | mutex_lock(&ha->fce_mutex); | ||
85 | |||
86 | /* Re-enable FCE tracing. */ | ||
87 | ha->flags.fce_enabled = 1; | ||
88 | memset(ha->fce, 0, fce_calc_size(ha->fce_bufs)); | ||
89 | rval = qla2x00_enable_fce_trace(ha, ha->fce_dma, ha->fce_bufs, | ||
90 | ha->fce_mb, &ha->fce_bufs); | ||
91 | if (rval) { | ||
92 | qla_printk(KERN_WARNING, ha, | ||
93 | "DebugFS: Unable to reinitialize FCE (%d).\n", rval); | ||
94 | ha->flags.fce_enabled = 0; | ||
95 | } | ||
96 | |||
97 | mutex_unlock(&ha->fce_mutex); | ||
98 | out: | ||
99 | return single_release(inode, file); | ||
100 | } | ||
101 | |||
102 | static const struct file_operations dfs_fce_ops = { | ||
103 | .open = qla2x00_dfs_fce_open, | ||
104 | .read = seq_read, | ||
105 | .llseek = seq_lseek, | ||
106 | .release = qla2x00_dfs_fce_release, | ||
107 | }; | ||
108 | |||
109 | int | ||
110 | qla2x00_dfs_setup(scsi_qla_host_t *ha) | ||
111 | { | ||
112 | if (!IS_QLA25XX(ha)) | ||
113 | goto out; | ||
114 | if (!ha->fce) | ||
115 | goto out; | ||
116 | |||
117 | if (qla2x00_dfs_root) | ||
118 | goto create_dir; | ||
119 | |||
120 | atomic_set(&qla2x00_dfs_root_count, 0); | ||
121 | qla2x00_dfs_root = debugfs_create_dir(QLA2XXX_DRIVER_NAME, NULL); | ||
122 | if (!qla2x00_dfs_root) { | ||
123 | qla_printk(KERN_NOTICE, ha, | ||
124 | "DebugFS: Unable to create root directory.\n"); | ||
125 | goto out; | ||
126 | } | ||
127 | |||
128 | create_dir: | ||
129 | if (ha->dfs_dir) | ||
130 | goto create_nodes; | ||
131 | |||
132 | mutex_init(&ha->fce_mutex); | ||
133 | ha->dfs_dir = debugfs_create_dir(ha->host_str, qla2x00_dfs_root); | ||
134 | if (!ha->dfs_dir) { | ||
135 | qla_printk(KERN_NOTICE, ha, | ||
136 | "DebugFS: Unable to create ha directory.\n"); | ||
137 | goto out; | ||
138 | } | ||
139 | |||
140 | atomic_inc(&qla2x00_dfs_root_count); | ||
141 | |||
142 | create_nodes: | ||
143 | ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, ha, | ||
144 | &dfs_fce_ops); | ||
145 | if (!ha->dfs_fce) { | ||
146 | qla_printk(KERN_NOTICE, ha, | ||
147 | "DebugFS: Unable to fce node.\n"); | ||
148 | goto out; | ||
149 | } | ||
150 | out: | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | int | ||
155 | qla2x00_dfs_remove(scsi_qla_host_t *ha) | ||
156 | { | ||
157 | if (ha->dfs_fce) { | ||
158 | debugfs_remove(ha->dfs_fce); | ||
159 | ha->dfs_fce = NULL; | ||
160 | } | ||
161 | |||
162 | if (ha->dfs_dir) { | ||
163 | debugfs_remove(ha->dfs_dir); | ||
164 | ha->dfs_dir = NULL; | ||
165 | atomic_dec(&qla2x00_dfs_root_count); | ||
166 | } | ||
167 | |||
168 | if (atomic_read(&qla2x00_dfs_root_count) == 0 && | ||
169 | qla2x00_dfs_root) { | ||
170 | debugfs_remove(qla2x00_dfs_root); | ||
171 | qla2x00_dfs_root = NULL; | ||
172 | } | ||
173 | |||
174 | return 0; | ||
175 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 25364b1aaf12..9337e138ed63 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h | |||
@@ -952,9 +952,31 @@ struct device_reg_24xx { | |||
952 | uint32_t iobase_sdata; | 952 | uint32_t iobase_sdata; |
953 | }; | 953 | }; |
954 | 954 | ||
955 | /* Trace Control *************************************************************/ | ||
956 | |||
957 | #define TC_AEN_DISABLE 0 | ||
958 | |||
959 | #define TC_EFT_ENABLE 4 | ||
960 | #define TC_EFT_DISABLE 5 | ||
961 | |||
962 | #define TC_FCE_ENABLE 8 | ||
963 | #define TC_FCE_OPTIONS 0 | ||
964 | #define TC_FCE_DEFAULT_RX_SIZE 2112 | ||
965 | #define TC_FCE_DEFAULT_TX_SIZE 2112 | ||
966 | #define TC_FCE_DISABLE 9 | ||
967 | #define TC_FCE_DISABLE_TRACE BIT_0 | ||
968 | |||
955 | /* MID Support ***************************************************************/ | 969 | /* MID Support ***************************************************************/ |
956 | 970 | ||
957 | #define MAX_MID_VPS 125 | 971 | #define MIN_MULTI_ID_FABRIC 64 /* Must be power-of-2. */ |
972 | #define MAX_MULTI_ID_FABRIC 256 /* ... */ | ||
973 | |||
974 | #define for_each_mapped_vp_idx(_ha, _idx) \ | ||
975 | for (_idx = find_next_bit((_ha)->vp_idx_map, \ | ||
976 | (_ha)->max_npiv_vports + 1, 1); \ | ||
977 | _idx <= (_ha)->max_npiv_vports; \ | ||
978 | _idx = find_next_bit((_ha)->vp_idx_map, \ | ||
979 | (_ha)->max_npiv_vports + 1, _idx + 1)) \ | ||
958 | 980 | ||
959 | struct mid_conf_entry_24xx { | 981 | struct mid_conf_entry_24xx { |
960 | uint16_t reserved_1; | 982 | uint16_t reserved_1; |
@@ -982,7 +1004,7 @@ struct mid_init_cb_24xx { | |||
982 | uint16_t count; | 1004 | uint16_t count; |
983 | uint16_t options; | 1005 | uint16_t options; |
984 | 1006 | ||
985 | struct mid_conf_entry_24xx entries[MAX_MID_VPS]; | 1007 | struct mid_conf_entry_24xx entries[MAX_MULTI_ID_FABRIC]; |
986 | }; | 1008 | }; |
987 | 1009 | ||
988 | 1010 | ||
@@ -1002,10 +1024,6 @@ struct mid_db_entry_24xx { | |||
1002 | uint8_t reserved_1; | 1024 | uint8_t reserved_1; |
1003 | }; | 1025 | }; |
1004 | 1026 | ||
1005 | struct mid_db_24xx { | ||
1006 | struct mid_db_entry_24xx entries[MAX_MID_VPS]; | ||
1007 | }; | ||
1008 | |||
1009 | /* | 1027 | /* |
1010 | * Virtual Fabric ID type definition. | 1028 | * Virtual Fabric ID type definition. |
1011 | */ | 1029 | */ |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 09cb2a908059..ba35fc26ce6b 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -65,33 +65,25 @@ extern int ql2xextended_error_logging; | |||
65 | extern int ql2xqfullrampup; | 65 | extern int ql2xqfullrampup; |
66 | extern int num_hosts; | 66 | extern int num_hosts; |
67 | 67 | ||
68 | extern int qla2x00_loop_reset(scsi_qla_host_t *); | ||
69 | |||
68 | /* | 70 | /* |
69 | * Global Functions in qla_mid.c source file. | 71 | * Global Functions in qla_mid.c source file. |
70 | */ | 72 | */ |
71 | extern struct scsi_host_template qla2x00_driver_template; | ||
72 | extern struct scsi_host_template qla24xx_driver_template; | 73 | extern struct scsi_host_template qla24xx_driver_template; |
73 | extern struct scsi_transport_template *qla2xxx_transport_vport_template; | 74 | extern struct scsi_transport_template *qla2xxx_transport_vport_template; |
74 | extern uint8_t qla2x00_mem_alloc(scsi_qla_host_t *); | ||
75 | extern void qla2x00_timer(scsi_qla_host_t *); | 75 | extern void qla2x00_timer(scsi_qla_host_t *); |
76 | extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long); | 76 | extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long); |
77 | extern void qla2x00_stop_timer(scsi_qla_host_t *); | ||
78 | extern uint32_t qla24xx_allocate_vp_id(scsi_qla_host_t *); | ||
79 | extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *); | 77 | extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *); |
80 | extern int qla24xx_disable_vp (scsi_qla_host_t *); | 78 | extern int qla24xx_disable_vp (scsi_qla_host_t *); |
81 | extern int qla24xx_enable_vp (scsi_qla_host_t *); | 79 | extern int qla24xx_enable_vp (scsi_qla_host_t *); |
82 | extern void qla2x00_mem_free(scsi_qla_host_t *); | ||
83 | extern int qla24xx_control_vp(scsi_qla_host_t *, int ); | 80 | extern int qla24xx_control_vp(scsi_qla_host_t *, int ); |
84 | extern int qla24xx_modify_vp_config(scsi_qla_host_t *); | 81 | extern int qla24xx_modify_vp_config(scsi_qla_host_t *); |
85 | extern int qla2x00_send_change_request(scsi_qla_host_t *, uint16_t, uint16_t); | 82 | extern int qla2x00_send_change_request(scsi_qla_host_t *, uint16_t, uint16_t); |
86 | extern void qla2x00_vp_stop_timer(scsi_qla_host_t *); | 83 | extern void qla2x00_vp_stop_timer(scsi_qla_host_t *); |
87 | extern int qla24xx_configure_vhba (scsi_qla_host_t *); | 84 | extern int qla24xx_configure_vhba (scsi_qla_host_t *); |
88 | extern int qla24xx_get_vp_entry(scsi_qla_host_t *, uint16_t, int); | ||
89 | extern int qla24xx_get_vp_database(scsi_qla_host_t *, uint16_t); | ||
90 | extern int qla2x00_do_dpc_vp(scsi_qla_host_t *); | ||
91 | extern void qla24xx_report_id_acquisition(scsi_qla_host_t *, | 85 | extern void qla24xx_report_id_acquisition(scsi_qla_host_t *, |
92 | struct vp_rpt_id_entry_24xx *); | 86 | struct vp_rpt_id_entry_24xx *); |
93 | extern scsi_qla_host_t * qla24xx_find_vhost_by_name(scsi_qla_host_t *, | ||
94 | uint8_t *); | ||
95 | extern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *); | 87 | extern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *); |
96 | extern int qla24xx_vport_create_req_sanity_check(struct fc_vport *); | 88 | extern int qla24xx_vport_create_req_sanity_check(struct fc_vport *); |
97 | extern scsi_qla_host_t * qla24xx_create_vhost(struct fc_vport *); | 89 | extern scsi_qla_host_t * qla24xx_create_vhost(struct fc_vport *); |
@@ -103,8 +95,6 @@ extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *); | |||
103 | extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); | 95 | extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); |
104 | extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); | 96 | extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); |
105 | 97 | ||
106 | extern int qla2x00_down_timeout(struct semaphore *, unsigned long); | ||
107 | |||
108 | extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *); | 98 | extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *); |
109 | 99 | ||
110 | extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *); | 100 | extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *); |
@@ -113,7 +103,6 @@ extern void qla2xxx_wake_dpc(scsi_qla_host_t *); | |||
113 | extern void qla2x00_alert_all_vps(scsi_qla_host_t *, uint16_t *); | 103 | extern void qla2x00_alert_all_vps(scsi_qla_host_t *, uint16_t *); |
114 | extern void qla2x00_async_event(scsi_qla_host_t *, uint16_t *); | 104 | extern void qla2x00_async_event(scsi_qla_host_t *, uint16_t *); |
115 | extern void qla2x00_vp_abort_isp(scsi_qla_host_t *); | 105 | extern void qla2x00_vp_abort_isp(scsi_qla_host_t *); |
116 | extern int qla24xx_vport_delete(struct fc_vport *); | ||
117 | 106 | ||
118 | /* | 107 | /* |
119 | * Global Function Prototypes in qla_iocb.c source file. | 108 | * Global Function Prototypes in qla_iocb.c source file. |
@@ -222,21 +211,16 @@ extern int | |||
222 | qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); | 211 | qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); |
223 | 212 | ||
224 | extern int | 213 | extern int |
225 | qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *, | 214 | qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct link_statistics *, |
226 | uint16_t *); | 215 | dma_addr_t); |
227 | 216 | ||
228 | extern int | 217 | extern int |
229 | qla24xx_get_isp_stats(scsi_qla_host_t *, uint32_t *, uint32_t, uint16_t *); | 218 | qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *, |
219 | dma_addr_t); | ||
230 | 220 | ||
231 | extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); | 221 | extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); |
232 | extern int qla24xx_abort_target(fc_port_t *); | 222 | extern int qla24xx_abort_target(fc_port_t *); |
233 | 223 | ||
234 | extern int qla2x00_system_error(scsi_qla_host_t *); | ||
235 | |||
236 | extern int | ||
237 | qla2x00_get_serdes_params(scsi_qla_host_t *, uint16_t *, uint16_t *, | ||
238 | uint16_t *); | ||
239 | |||
240 | extern int | 224 | extern int |
241 | qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t); | 225 | qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t); |
242 | 226 | ||
@@ -244,13 +228,19 @@ extern int | |||
244 | qla2x00_stop_firmware(scsi_qla_host_t *); | 228 | qla2x00_stop_firmware(scsi_qla_host_t *); |
245 | 229 | ||
246 | extern int | 230 | extern int |
247 | qla2x00_trace_control(scsi_qla_host_t *, uint16_t, dma_addr_t, uint16_t); | 231 | qla2x00_enable_eft_trace(scsi_qla_host_t *, dma_addr_t, uint16_t); |
232 | extern int | ||
233 | qla2x00_disable_eft_trace(scsi_qla_host_t *); | ||
248 | 234 | ||
249 | extern int | 235 | extern int |
250 | qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t, uint16_t); | 236 | qla2x00_enable_fce_trace(scsi_qla_host_t *, dma_addr_t, uint16_t , uint16_t *, |
237 | uint32_t *); | ||
251 | 238 | ||
252 | extern int | 239 | extern int |
253 | qla2x00_get_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t *, uint16_t *); | 240 | qla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *); |
241 | |||
242 | extern int | ||
243 | qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t, uint16_t); | ||
254 | 244 | ||
255 | extern int | 245 | extern int |
256 | qla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *); | 246 | qla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *); |
@@ -270,11 +260,7 @@ extern void qla2x00_free_irqs(scsi_qla_host_t *); | |||
270 | /* | 260 | /* |
271 | * Global Function Prototypes in qla_sup.c source file. | 261 | * Global Function Prototypes in qla_sup.c source file. |
272 | */ | 262 | */ |
273 | extern void qla2x00_lock_nvram_access(scsi_qla_host_t *); | ||
274 | extern void qla2x00_unlock_nvram_access(scsi_qla_host_t *); | ||
275 | extern void qla2x00_release_nvram_protection(scsi_qla_host_t *); | 263 | extern void qla2x00_release_nvram_protection(scsi_qla_host_t *); |
276 | extern uint16_t qla2x00_get_nvram_word(scsi_qla_host_t *, uint32_t); | ||
277 | extern void qla2x00_write_nvram_word(scsi_qla_host_t *, uint32_t, uint16_t); | ||
278 | extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *, | 264 | extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *, |
279 | uint32_t, uint32_t); | 265 | uint32_t, uint32_t); |
280 | extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, | 266 | extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, |
@@ -321,7 +307,6 @@ extern void qla25xx_fw_dump(scsi_qla_host_t *, int); | |||
321 | extern void qla2x00_dump_regs(scsi_qla_host_t *); | 307 | extern void qla2x00_dump_regs(scsi_qla_host_t *); |
322 | extern void qla2x00_dump_buffer(uint8_t *, uint32_t); | 308 | extern void qla2x00_dump_buffer(uint8_t *, uint32_t); |
323 | extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *); | 309 | extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *); |
324 | extern void qla2x00_dump_pkt(void *); | ||
325 | 310 | ||
326 | /* | 311 | /* |
327 | * Global Function Prototypes in qla_gs.c source file. | 312 | * Global Function Prototypes in qla_gs.c source file. |
@@ -356,4 +341,10 @@ extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); | |||
356 | extern void qla2x00_init_host_attr(scsi_qla_host_t *); | 341 | extern void qla2x00_init_host_attr(scsi_qla_host_t *); |
357 | extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); | 342 | extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); |
358 | extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); | 343 | extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); |
344 | |||
345 | /* | ||
346 | * Global Function Prototypes in qla_dfs.c source file. | ||
347 | */ | ||
348 | extern int qla2x00_dfs_setup(scsi_qla_host_t *); | ||
349 | extern int qla2x00_dfs_remove(scsi_qla_host_t *); | ||
359 | #endif /* _QLA_GBL_H */ | 350 | #endif /* _QLA_GBL_H */ |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 191dafd89be0..d0633ca894be 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -732,9 +732,9 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
732 | { | 732 | { |
733 | int rval; | 733 | int rval; |
734 | uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, | 734 | uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, |
735 | eft_size; | 735 | eft_size, fce_size; |
736 | dma_addr_t eft_dma; | 736 | dma_addr_t tc_dma; |
737 | void *eft; | 737 | void *tc; |
738 | 738 | ||
739 | if (ha->fw_dump) { | 739 | if (ha->fw_dump) { |
740 | qla_printk(KERN_WARNING, ha, | 740 | qla_printk(KERN_WARNING, ha, |
@@ -743,7 +743,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
743 | } | 743 | } |
744 | 744 | ||
745 | ha->fw_dumped = 0; | 745 | ha->fw_dumped = 0; |
746 | fixed_size = mem_size = eft_size = 0; | 746 | fixed_size = mem_size = eft_size = fce_size = 0; |
747 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { | 747 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { |
748 | fixed_size = sizeof(struct qla2100_fw_dump); | 748 | fixed_size = sizeof(struct qla2100_fw_dump); |
749 | } else if (IS_QLA23XX(ha)) { | 749 | } else if (IS_QLA23XX(ha)) { |
@@ -758,21 +758,21 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
758 | sizeof(uint32_t); | 758 | sizeof(uint32_t); |
759 | 759 | ||
760 | /* Allocate memory for Extended Trace Buffer. */ | 760 | /* Allocate memory for Extended Trace Buffer. */ |
761 | eft = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &eft_dma, | 761 | tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma, |
762 | GFP_KERNEL); | 762 | GFP_KERNEL); |
763 | if (!eft) { | 763 | if (!tc) { |
764 | qla_printk(KERN_WARNING, ha, "Unable to allocate " | 764 | qla_printk(KERN_WARNING, ha, "Unable to allocate " |
765 | "(%d KB) for EFT.\n", EFT_SIZE / 1024); | 765 | "(%d KB) for EFT.\n", EFT_SIZE / 1024); |
766 | goto cont_alloc; | 766 | goto cont_alloc; |
767 | } | 767 | } |
768 | 768 | ||
769 | rval = qla2x00_trace_control(ha, TC_ENABLE, eft_dma, | 769 | memset(tc, 0, EFT_SIZE); |
770 | EFT_NUM_BUFFERS); | 770 | rval = qla2x00_enable_eft_trace(ha, tc_dma, EFT_NUM_BUFFERS); |
771 | if (rval) { | 771 | if (rval) { |
772 | qla_printk(KERN_WARNING, ha, "Unable to initialize " | 772 | qla_printk(KERN_WARNING, ha, "Unable to initialize " |
773 | "EFT (%d).\n", rval); | 773 | "EFT (%d).\n", rval); |
774 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, eft, | 774 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, |
775 | eft_dma); | 775 | tc_dma); |
776 | goto cont_alloc; | 776 | goto cont_alloc; |
777 | } | 777 | } |
778 | 778 | ||
@@ -780,9 +780,40 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
780 | EFT_SIZE / 1024); | 780 | EFT_SIZE / 1024); |
781 | 781 | ||
782 | eft_size = EFT_SIZE; | 782 | eft_size = EFT_SIZE; |
783 | memset(eft, 0, eft_size); | 783 | ha->eft_dma = tc_dma; |
784 | ha->eft_dma = eft_dma; | 784 | ha->eft = tc; |
785 | ha->eft = eft; | 785 | |
786 | /* Allocate memory for Fibre Channel Event Buffer. */ | ||
787 | if (!IS_QLA25XX(ha)) | ||
788 | goto cont_alloc; | ||
789 | |||
790 | tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, | ||
791 | GFP_KERNEL); | ||
792 | if (!tc) { | ||
793 | qla_printk(KERN_WARNING, ha, "Unable to allocate " | ||
794 | "(%d KB) for FCE.\n", FCE_SIZE / 1024); | ||
795 | goto cont_alloc; | ||
796 | } | ||
797 | |||
798 | memset(tc, 0, FCE_SIZE); | ||
799 | rval = qla2x00_enable_fce_trace(ha, tc_dma, FCE_NUM_BUFFERS, | ||
800 | ha->fce_mb, &ha->fce_bufs); | ||
801 | if (rval) { | ||
802 | qla_printk(KERN_WARNING, ha, "Unable to initialize " | ||
803 | "FCE (%d).\n", rval); | ||
804 | dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, | ||
805 | tc_dma); | ||
806 | ha->flags.fce_enabled = 0; | ||
807 | goto cont_alloc; | ||
808 | } | ||
809 | |||
810 | qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n", | ||
811 | FCE_SIZE / 1024); | ||
812 | |||
813 | fce_size = sizeof(struct qla2xxx_fce_chain) + EFT_SIZE; | ||
814 | ha->flags.fce_enabled = 1; | ||
815 | ha->fce_dma = tc_dma; | ||
816 | ha->fce = tc; | ||
786 | } | 817 | } |
787 | cont_alloc: | 818 | cont_alloc: |
788 | req_q_size = ha->request_q_length * sizeof(request_t); | 819 | req_q_size = ha->request_q_length * sizeof(request_t); |
@@ -790,7 +821,7 @@ cont_alloc: | |||
790 | 821 | ||
791 | dump_size = offsetof(struct qla2xxx_fw_dump, isp); | 822 | dump_size = offsetof(struct qla2xxx_fw_dump, isp); |
792 | dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + | 823 | dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + |
793 | eft_size; | 824 | eft_size + fce_size; |
794 | 825 | ||
795 | ha->fw_dump = vmalloc(dump_size); | 826 | ha->fw_dump = vmalloc(dump_size); |
796 | if (!ha->fw_dump) { | 827 | if (!ha->fw_dump) { |
@@ -922,9 +953,9 @@ qla2x00_setup_chip(scsi_qla_host_t *ha) | |||
922 | ha->flags.npiv_supported = 1; | 953 | ha->flags.npiv_supported = 1; |
923 | if ((!ha->max_npiv_vports) || | 954 | if ((!ha->max_npiv_vports) || |
924 | ((ha->max_npiv_vports + 1) % | 955 | ((ha->max_npiv_vports + 1) % |
925 | MAX_MULTI_ID_FABRIC)) | 956 | MIN_MULTI_ID_FABRIC)) |
926 | ha->max_npiv_vports = | 957 | ha->max_npiv_vports = |
927 | MAX_NUM_VPORT_FABRIC; | 958 | MIN_MULTI_ID_FABRIC - 1; |
928 | } | 959 | } |
929 | 960 | ||
930 | if (ql2xallocfwdump) | 961 | if (ql2xallocfwdump) |
@@ -1162,7 +1193,10 @@ qla2x00_init_rings(scsi_qla_host_t *ha) | |||
1162 | 1193 | ||
1163 | DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); | 1194 | DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); |
1164 | 1195 | ||
1165 | mid_init_cb->count = ha->max_npiv_vports; | 1196 | if (ha->flags.npiv_supported) |
1197 | mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports); | ||
1198 | |||
1199 | mid_init_cb->options = __constant_cpu_to_le16(BIT_1); | ||
1166 | 1200 | ||
1167 | rval = qla2x00_init_firmware(ha, ha->init_cb_size); | 1201 | rval = qla2x00_init_firmware(ha, ha->init_cb_size); |
1168 | if (rval) { | 1202 | if (rval) { |
@@ -2566,14 +2600,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) | |||
2566 | 2600 | ||
2567 | /* Bypass virtual ports of the same host. */ | 2601 | /* Bypass virtual ports of the same host. */ |
2568 | if (pha->num_vhosts) { | 2602 | if (pha->num_vhosts) { |
2569 | vp_index = find_next_bit( | 2603 | for_each_mapped_vp_idx(pha, vp_index) { |
2570 | (unsigned long *)pha->vp_idx_map, | ||
2571 | MAX_MULTI_ID_FABRIC + 1, 1); | ||
2572 | |||
2573 | for (;vp_index <= MAX_MULTI_ID_FABRIC; | ||
2574 | vp_index = find_next_bit( | ||
2575 | (unsigned long *)pha->vp_idx_map, | ||
2576 | MAX_MULTI_ID_FABRIC + 1, vp_index + 1)) { | ||
2577 | empty_vp_index = 1; | 2604 | empty_vp_index = 1; |
2578 | found_vp = 0; | 2605 | found_vp = 0; |
2579 | list_for_each_entry(vha, &pha->vp_list, | 2606 | list_for_each_entry(vha, &pha->vp_list, |
@@ -2592,7 +2619,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) | |||
2592 | new_fcport->d_id.b24 == vha->d_id.b24) | 2619 | new_fcport->d_id.b24 == vha->d_id.b24) |
2593 | break; | 2620 | break; |
2594 | } | 2621 | } |
2595 | if (vp_index <= MAX_MULTI_ID_FABRIC) | 2622 | |
2623 | if (vp_index <= pha->max_npiv_vports) | ||
2596 | continue; | 2624 | continue; |
2597 | } | 2625 | } |
2598 | 2626 | ||
@@ -3245,7 +3273,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3245 | clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); | 3273 | clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); |
3246 | 3274 | ||
3247 | if (ha->eft) { | 3275 | if (ha->eft) { |
3248 | rval = qla2x00_trace_control(ha, TC_ENABLE, | 3276 | rval = qla2x00_enable_eft_trace(ha, |
3249 | ha->eft_dma, EFT_NUM_BUFFERS); | 3277 | ha->eft_dma, EFT_NUM_BUFFERS); |
3250 | if (rval) { | 3278 | if (rval) { |
3251 | qla_printk(KERN_WARNING, ha, | 3279 | qla_printk(KERN_WARNING, ha, |
@@ -3253,6 +3281,21 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3253 | "(%d).\n", rval); | 3281 | "(%d).\n", rval); |
3254 | } | 3282 | } |
3255 | } | 3283 | } |
3284 | |||
3285 | if (ha->fce) { | ||
3286 | ha->flags.fce_enabled = 1; | ||
3287 | memset(ha->fce, 0, | ||
3288 | fce_calc_size(ha->fce_bufs)); | ||
3289 | rval = qla2x00_enable_fce_trace(ha, | ||
3290 | ha->fce_dma, ha->fce_bufs, ha->fce_mb, | ||
3291 | &ha->fce_bufs); | ||
3292 | if (rval) { | ||
3293 | qla_printk(KERN_WARNING, ha, | ||
3294 | "Unable to reinitialize FCE " | ||
3295 | "(%d).\n", rval); | ||
3296 | ha->flags.fce_enabled = 0; | ||
3297 | } | ||
3298 | } | ||
3256 | } else { /* failed the ISP abort */ | 3299 | } else { /* failed the ISP abort */ |
3257 | ha->flags.online = 1; | 3300 | ha->flags.online = 1; |
3258 | if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { | 3301 | if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 1104bd2eed40..642a0c3f09c6 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -104,7 +104,7 @@ qla2100_intr_handler(int irq, void *dev_id) | |||
104 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && | 104 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && |
105 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { | 105 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { |
106 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); | 106 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); |
107 | up(&ha->mbx_intr_sem); | 107 | complete(&ha->mbx_intr_comp); |
108 | } | 108 | } |
109 | 109 | ||
110 | return (IRQ_HANDLED); | 110 | return (IRQ_HANDLED); |
@@ -216,7 +216,7 @@ qla2300_intr_handler(int irq, void *dev_id) | |||
216 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && | 216 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && |
217 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { | 217 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { |
218 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); | 218 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); |
219 | up(&ha->mbx_intr_sem); | 219 | complete(&ha->mbx_intr_comp); |
220 | } | 220 | } |
221 | 221 | ||
222 | return (IRQ_HANDLED); | 222 | return (IRQ_HANDLED); |
@@ -347,10 +347,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
347 | break; | 347 | break; |
348 | 348 | ||
349 | case MBA_SYSTEM_ERR: /* System Error */ | 349 | case MBA_SYSTEM_ERR: /* System Error */ |
350 | mb[1] = RD_MAILBOX_REG(ha, reg, 1); | ||
351 | mb[2] = RD_MAILBOX_REG(ha, reg, 2); | ||
352 | mb[3] = RD_MAILBOX_REG(ha, reg, 3); | ||
353 | |||
354 | qla_printk(KERN_INFO, ha, | 350 | qla_printk(KERN_INFO, ha, |
355 | "ISP System Error - mbx1=%xh mbx2=%xh mbx3=%xh.\n", | 351 | "ISP System Error - mbx1=%xh mbx2=%xh mbx3=%xh.\n", |
356 | mb[1], mb[2], mb[3]); | 352 | mb[1], mb[2], mb[3]); |
@@ -579,12 +575,15 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
579 | /* Check if the Vport has issued a SCR */ | 575 | /* Check if the Vport has issued a SCR */ |
580 | if (ha->parent && test_bit(VP_SCR_NEEDED, &ha->vp_flags)) | 576 | if (ha->parent && test_bit(VP_SCR_NEEDED, &ha->vp_flags)) |
581 | break; | 577 | break; |
578 | /* Only handle SCNs for our Vport index. */ | ||
579 | if (ha->flags.npiv_supported && ha->vp_idx != mb[3]) | ||
580 | break; | ||
582 | 581 | ||
583 | DEBUG2(printk("scsi(%ld): Asynchronous RSCR UPDATE.\n", | 582 | DEBUG2(printk("scsi(%ld): Asynchronous RSCR UPDATE.\n", |
584 | ha->host_no)); | 583 | ha->host_no)); |
585 | DEBUG(printk(KERN_INFO | 584 | DEBUG(printk(KERN_INFO |
586 | "scsi(%ld): RSCN database changed -- %04x %04x.\n", | 585 | "scsi(%ld): RSCN database changed -- %04x %04x %04x.\n", |
587 | ha->host_no, mb[1], mb[2])); | 586 | ha->host_no, mb[1], mb[2], mb[3])); |
588 | 587 | ||
589 | rscn_entry = (mb[1] << 16) | mb[2]; | 588 | rscn_entry = (mb[1] << 16) | mb[2]; |
590 | host_pid = (ha->d_id.b.domain << 16) | (ha->d_id.b.area << 8) | | 589 | host_pid = (ha->d_id.b.domain << 16) | (ha->d_id.b.area << 8) | |
@@ -823,6 +822,35 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha) | |||
823 | WRT_REG_WORD(ISP_RSP_Q_OUT(ha, reg), ha->rsp_ring_index); | 822 | WRT_REG_WORD(ISP_RSP_Q_OUT(ha, reg), ha->rsp_ring_index); |
824 | } | 823 | } |
825 | 824 | ||
825 | static inline void | ||
826 | qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t sense_len) | ||
827 | { | ||
828 | struct scsi_cmnd *cp = sp->cmd; | ||
829 | |||
830 | if (sense_len >= SCSI_SENSE_BUFFERSIZE) | ||
831 | sense_len = SCSI_SENSE_BUFFERSIZE; | ||
832 | |||
833 | CMD_ACTUAL_SNSLEN(cp) = sense_len; | ||
834 | sp->request_sense_length = sense_len; | ||
835 | sp->request_sense_ptr = cp->sense_buffer; | ||
836 | if (sp->request_sense_length > 32) | ||
837 | sense_len = 32; | ||
838 | |||
839 | memcpy(cp->sense_buffer, sense_data, sense_len); | ||
840 | |||
841 | sp->request_sense_ptr += sense_len; | ||
842 | sp->request_sense_length -= sense_len; | ||
843 | if (sp->request_sense_length != 0) | ||
844 | sp->ha->status_srb = sp; | ||
845 | |||
846 | DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) " | ||
847 | "cmd=%p pid=%ld\n", __func__, sp->ha->host_no, cp->device->channel, | ||
848 | cp->device->id, cp->device->lun, cp, cp->serial_number)); | ||
849 | if (sense_len) | ||
850 | DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, | ||
851 | CMD_ACTUAL_SNSLEN(cp))); | ||
852 | } | ||
853 | |||
826 | /** | 854 | /** |
827 | * qla2x00_status_entry() - Process a Status IOCB entry. | 855 | * qla2x00_status_entry() - Process a Status IOCB entry. |
828 | * @ha: SCSI driver HA context | 856 | * @ha: SCSI driver HA context |
@@ -977,36 +1005,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
977 | if (lscsi_status != SS_CHECK_CONDITION) | 1005 | if (lscsi_status != SS_CHECK_CONDITION) |
978 | break; | 1006 | break; |
979 | 1007 | ||
980 | /* Copy Sense Data into sense buffer. */ | 1008 | memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
981 | memset(cp->sense_buffer, 0, sizeof(cp->sense_buffer)); | ||
982 | |||
983 | if (!(scsi_status & SS_SENSE_LEN_VALID)) | 1009 | if (!(scsi_status & SS_SENSE_LEN_VALID)) |
984 | break; | 1010 | break; |
985 | 1011 | ||
986 | if (sense_len >= sizeof(cp->sense_buffer)) | 1012 | qla2x00_handle_sense(sp, sense_data, sense_len); |
987 | sense_len = sizeof(cp->sense_buffer); | ||
988 | |||
989 | CMD_ACTUAL_SNSLEN(cp) = sense_len; | ||
990 | sp->request_sense_length = sense_len; | ||
991 | sp->request_sense_ptr = cp->sense_buffer; | ||
992 | |||
993 | if (sp->request_sense_length > 32) | ||
994 | sense_len = 32; | ||
995 | |||
996 | memcpy(cp->sense_buffer, sense_data, sense_len); | ||
997 | |||
998 | sp->request_sense_ptr += sense_len; | ||
999 | sp->request_sense_length -= sense_len; | ||
1000 | if (sp->request_sense_length != 0) | ||
1001 | ha->status_srb = sp; | ||
1002 | |||
1003 | DEBUG5(printk("%s(): Check condition Sense data, " | ||
1004 | "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", __func__, | ||
1005 | ha->host_no, cp->device->channel, cp->device->id, | ||
1006 | cp->device->lun, cp, cp->serial_number)); | ||
1007 | if (sense_len) | ||
1008 | DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, | ||
1009 | CMD_ACTUAL_SNSLEN(cp))); | ||
1010 | break; | 1013 | break; |
1011 | 1014 | ||
1012 | case CS_DATA_UNDERRUN: | 1015 | case CS_DATA_UNDERRUN: |
@@ -1061,34 +1064,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
1061 | if (lscsi_status != SS_CHECK_CONDITION) | 1064 | if (lscsi_status != SS_CHECK_CONDITION) |
1062 | break; | 1065 | break; |
1063 | 1066 | ||
1064 | /* Copy Sense Data into sense buffer */ | 1067 | memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
1065 | memset(cp->sense_buffer, 0, sizeof(cp->sense_buffer)); | ||
1066 | |||
1067 | if (!(scsi_status & SS_SENSE_LEN_VALID)) | 1068 | if (!(scsi_status & SS_SENSE_LEN_VALID)) |
1068 | break; | 1069 | break; |
1069 | 1070 | ||
1070 | if (sense_len >= sizeof(cp->sense_buffer)) | 1071 | qla2x00_handle_sense(sp, sense_data, sense_len); |
1071 | sense_len = sizeof(cp->sense_buffer); | ||
1072 | |||
1073 | CMD_ACTUAL_SNSLEN(cp) = sense_len; | ||
1074 | sp->request_sense_length = sense_len; | ||
1075 | sp->request_sense_ptr = cp->sense_buffer; | ||
1076 | |||
1077 | if (sp->request_sense_length > 32) | ||
1078 | sense_len = 32; | ||
1079 | |||
1080 | memcpy(cp->sense_buffer, sense_data, sense_len); | ||
1081 | |||
1082 | sp->request_sense_ptr += sense_len; | ||
1083 | sp->request_sense_length -= sense_len; | ||
1084 | if (sp->request_sense_length != 0) | ||
1085 | ha->status_srb = sp; | ||
1086 | |||
1087 | DEBUG5(printk("%s(): Check condition Sense data, " | ||
1088 | "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", | ||
1089 | __func__, ha->host_no, cp->device->channel, | ||
1090 | cp->device->id, cp->device->lun, cp, | ||
1091 | cp->serial_number)); | ||
1092 | 1072 | ||
1093 | /* | 1073 | /* |
1094 | * In case of a Underrun condition, set both the lscsi | 1074 | * In case of a Underrun condition, set both the lscsi |
@@ -1108,10 +1088,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
1108 | 1088 | ||
1109 | cp->result = DID_ERROR << 16 | lscsi_status; | 1089 | cp->result = DID_ERROR << 16 | lscsi_status; |
1110 | } | 1090 | } |
1111 | |||
1112 | if (sense_len) | ||
1113 | DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, | ||
1114 | CMD_ACTUAL_SNSLEN(cp))); | ||
1115 | } else { | 1091 | } else { |
1116 | /* | 1092 | /* |
1117 | * If RISC reports underrun and target does not report | 1093 | * If RISC reports underrun and target does not report |
@@ -1621,7 +1597,7 @@ qla24xx_intr_handler(int irq, void *dev_id) | |||
1621 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && | 1597 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && |
1622 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { | 1598 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { |
1623 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); | 1599 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); |
1624 | up(&ha->mbx_intr_sem); | 1600 | complete(&ha->mbx_intr_comp); |
1625 | } | 1601 | } |
1626 | 1602 | ||
1627 | return IRQ_HANDLED; | 1603 | return IRQ_HANDLED; |
@@ -1758,7 +1734,7 @@ qla24xx_msix_default(int irq, void *dev_id) | |||
1758 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && | 1734 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && |
1759 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { | 1735 | (status & MBX_INTERRUPT) && ha->flags.mbox_int) { |
1760 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); | 1736 | set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); |
1761 | up(&ha->mbx_intr_sem); | 1737 | complete(&ha->mbx_intr_comp); |
1762 | } | 1738 | } |
1763 | 1739 | ||
1764 | return IRQ_HANDLED; | 1740 | return IRQ_HANDLED; |
@@ -1853,6 +1829,18 @@ qla2x00_request_irqs(scsi_qla_host_t *ha) | |||
1853 | goto skip_msix; | 1829 | goto skip_msix; |
1854 | } | 1830 | } |
1855 | 1831 | ||
1832 | if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP && | ||
1833 | (ha->pdev->subsystem_device == 0x7040 || | ||
1834 | ha->pdev->subsystem_device == 0x7041 || | ||
1835 | ha->pdev->subsystem_device == 0x1705)) { | ||
1836 | DEBUG2(qla_printk(KERN_WARNING, ha, | ||
1837 | "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X, 0x%X).\n", | ||
1838 | ha->pdev->subsystem_vendor, | ||
1839 | ha->pdev->subsystem_device)); | ||
1840 | |||
1841 | goto skip_msi; | ||
1842 | } | ||
1843 | |||
1856 | ret = qla24xx_enable_msix(ha); | 1844 | ret = qla24xx_enable_msix(ha); |
1857 | if (!ret) { | 1845 | if (!ret) { |
1858 | DEBUG2(qla_printk(KERN_INFO, ha, | 1846 | DEBUG2(qla_printk(KERN_INFO, ha, |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index ccd662a6f5dc..0c10c0b0fb73 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -8,19 +8,6 @@ | |||
8 | 8 | ||
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | 10 | ||
11 | static void | ||
12 | qla2x00_mbx_sem_timeout(unsigned long data) | ||
13 | { | ||
14 | struct semaphore *sem_ptr = (struct semaphore *)data; | ||
15 | |||
16 | DEBUG11(printk("qla2x00_sem_timeout: entered.\n")); | ||
17 | |||
18 | if (sem_ptr != NULL) { | ||
19 | up(sem_ptr); | ||
20 | } | ||
21 | |||
22 | DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n")); | ||
23 | } | ||
24 | 11 | ||
25 | /* | 12 | /* |
26 | * qla2x00_mailbox_command | 13 | * qla2x00_mailbox_command |
@@ -47,7 +34,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
47 | int rval; | 34 | int rval; |
48 | unsigned long flags = 0; | 35 | unsigned long flags = 0; |
49 | device_reg_t __iomem *reg; | 36 | device_reg_t __iomem *reg; |
50 | struct timer_list tmp_intr_timer; | ||
51 | uint8_t abort_active; | 37 | uint8_t abort_active; |
52 | uint8_t io_lock_on; | 38 | uint8_t io_lock_on; |
53 | uint16_t command; | 39 | uint16_t command; |
@@ -72,7 +58,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
72 | * non ISP abort time. | 58 | * non ISP abort time. |
73 | */ | 59 | */ |
74 | if (!abort_active) { | 60 | if (!abort_active) { |
75 | if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) { | 61 | if (!wait_for_completion_timeout(&ha->mbx_cmd_comp, |
62 | mcp->tov * HZ)) { | ||
76 | /* Timeout occurred. Return error. */ | 63 | /* Timeout occurred. Return error. */ |
77 | DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " | 64 | DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " |
78 | "Exiting.\n", __func__, ha->host_no)); | 65 | "Exiting.\n", __func__, ha->host_no)); |
@@ -135,22 +122,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
135 | /* Wait for mbx cmd completion until timeout */ | 122 | /* Wait for mbx cmd completion until timeout */ |
136 | 123 | ||
137 | if (!abort_active && io_lock_on) { | 124 | if (!abort_active && io_lock_on) { |
138 | /* sleep on completion semaphore */ | ||
139 | DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n", | ||
140 | __func__, ha->host_no)); | ||
141 | |||
142 | init_timer(&tmp_intr_timer); | ||
143 | tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem; | ||
144 | tmp_intr_timer.expires = jiffies + mcp->tov * HZ; | ||
145 | tmp_intr_timer.function = | ||
146 | (void (*)(unsigned long))qla2x00_mbx_sem_timeout; | ||
147 | |||
148 | DEBUG11(printk("%s(%ld): Adding timer.\n", __func__, | ||
149 | ha->host_no)); | ||
150 | add_timer(&tmp_intr_timer); | ||
151 | |||
152 | DEBUG11(printk("%s(%ld): going to unlock & sleep. " | ||
153 | "time=0x%lx.\n", __func__, ha->host_no, jiffies)); | ||
154 | 125 | ||
155 | set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); | 126 | set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); |
156 | 127 | ||
@@ -160,17 +131,10 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
160 | WRT_REG_WORD(®->isp.hccr, HCCR_SET_HOST_INT); | 131 | WRT_REG_WORD(®->isp.hccr, HCCR_SET_HOST_INT); |
161 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 132 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
162 | 133 | ||
163 | /* Wait for either the timer to expire | 134 | wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ); |
164 | * or the mbox completion interrupt | ||
165 | */ | ||
166 | down(&ha->mbx_intr_sem); | ||
167 | 135 | ||
168 | DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__, | ||
169 | ha->host_no, jiffies)); | ||
170 | clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); | 136 | clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); |
171 | 137 | ||
172 | /* delete the timer */ | ||
173 | del_timer(&tmp_intr_timer); | ||
174 | } else { | 138 | } else { |
175 | DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, | 139 | DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, |
176 | ha->host_no, command)); | 140 | ha->host_no, command)); |
@@ -299,7 +263,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
299 | 263 | ||
300 | /* Allow next mbx cmd to come in. */ | 264 | /* Allow next mbx cmd to come in. */ |
301 | if (!abort_active) | 265 | if (!abort_active) |
302 | up(&ha->mbx_cmd_sem); | 266 | complete(&ha->mbx_cmd_comp); |
303 | 267 | ||
304 | if (rval) { | 268 | if (rval) { |
305 | DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " | 269 | DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " |
@@ -905,7 +869,7 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa, | |||
905 | 869 | ||
906 | mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; | 870 | mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; |
907 | mcp->mb[9] = ha->vp_idx; | 871 | mcp->mb[9] = ha->vp_idx; |
908 | mcp->out_mb = MBX_0; | 872 | mcp->out_mb = MBX_9|MBX_0; |
909 | mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | 873 | mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; |
910 | mcp->tov = 30; | 874 | mcp->tov = 30; |
911 | mcp->flags = 0; | 875 | mcp->flags = 0; |
@@ -1016,7 +980,7 @@ qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size) | |||
1016 | DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n", | 980 | DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n", |
1017 | ha->host_no)); | 981 | ha->host_no)); |
1018 | 982 | ||
1019 | if (ha->flags.npiv_supported) | 983 | if (ha->fw_attributes & BIT_2) |
1020 | mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE; | 984 | mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE; |
1021 | else | 985 | else |
1022 | mcp->mb[0] = MBC_INITIALIZE_FIRMWARE; | 986 | mcp->mb[0] = MBC_INITIALIZE_FIRMWARE; |
@@ -2042,29 +2006,20 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) | |||
2042 | */ | 2006 | */ |
2043 | int | 2007 | int |
2044 | qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, | 2008 | qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, |
2045 | link_stat_t *ret_buf, uint16_t *status) | 2009 | struct link_statistics *stats, dma_addr_t stats_dma) |
2046 | { | 2010 | { |
2047 | int rval; | 2011 | int rval; |
2048 | mbx_cmd_t mc; | 2012 | mbx_cmd_t mc; |
2049 | mbx_cmd_t *mcp = &mc; | 2013 | mbx_cmd_t *mcp = &mc; |
2050 | link_stat_t *stat_buf; | 2014 | uint32_t *siter, *diter, dwords; |
2051 | dma_addr_t stat_buf_dma; | ||
2052 | 2015 | ||
2053 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2016 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2054 | 2017 | ||
2055 | stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma); | ||
2056 | if (stat_buf == NULL) { | ||
2057 | DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", | ||
2058 | __func__, ha->host_no)); | ||
2059 | return BIT_0; | ||
2060 | } | ||
2061 | memset(stat_buf, 0, sizeof(link_stat_t)); | ||
2062 | |||
2063 | mcp->mb[0] = MBC_GET_LINK_STATUS; | 2018 | mcp->mb[0] = MBC_GET_LINK_STATUS; |
2064 | mcp->mb[2] = MSW(stat_buf_dma); | 2019 | mcp->mb[2] = MSW(stats_dma); |
2065 | mcp->mb[3] = LSW(stat_buf_dma); | 2020 | mcp->mb[3] = LSW(stats_dma); |
2066 | mcp->mb[6] = MSW(MSD(stat_buf_dma)); | 2021 | mcp->mb[6] = MSW(MSD(stats_dma)); |
2067 | mcp->mb[7] = LSW(MSD(stat_buf_dma)); | 2022 | mcp->mb[7] = LSW(MSD(stats_dma)); |
2068 | mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | 2023 | mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; |
2069 | mcp->in_mb = MBX_0; | 2024 | mcp->in_mb = MBX_0; |
2070 | if (IS_FWI2_CAPABLE(ha)) { | 2025 | if (IS_FWI2_CAPABLE(ha)) { |
@@ -2089,78 +2044,43 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, | |||
2089 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { | 2044 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { |
2090 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", | 2045 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", |
2091 | __func__, ha->host_no, mcp->mb[0])); | 2046 | __func__, ha->host_no, mcp->mb[0])); |
2092 | status[0] = mcp->mb[0]; | 2047 | rval = QLA_FUNCTION_FAILED; |
2093 | rval = BIT_1; | ||
2094 | } else { | 2048 | } else { |
2095 | /* copy over data -- firmware data is LE. */ | 2049 | /* Copy over data -- firmware data is LE. */ |
2096 | ret_buf->link_fail_cnt = | 2050 | dwords = offsetof(struct link_statistics, unused1) / 4; |
2097 | le32_to_cpu(stat_buf->link_fail_cnt); | 2051 | siter = diter = &stats->link_fail_cnt; |
2098 | ret_buf->loss_sync_cnt = | 2052 | while (dwords--) |
2099 | le32_to_cpu(stat_buf->loss_sync_cnt); | 2053 | *diter++ = le32_to_cpu(*siter++); |
2100 | ret_buf->loss_sig_cnt = | ||
2101 | le32_to_cpu(stat_buf->loss_sig_cnt); | ||
2102 | ret_buf->prim_seq_err_cnt = | ||
2103 | le32_to_cpu(stat_buf->prim_seq_err_cnt); | ||
2104 | ret_buf->inval_xmit_word_cnt = | ||
2105 | le32_to_cpu(stat_buf->inval_xmit_word_cnt); | ||
2106 | ret_buf->inval_crc_cnt = | ||
2107 | le32_to_cpu(stat_buf->inval_crc_cnt); | ||
2108 | |||
2109 | DEBUG11(printk("%s(%ld): stat dump: fail_cnt=%d " | ||
2110 | "loss_sync=%d loss_sig=%d seq_err=%d " | ||
2111 | "inval_xmt_word=%d inval_crc=%d.\n", __func__, | ||
2112 | ha->host_no, stat_buf->link_fail_cnt, | ||
2113 | stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt, | ||
2114 | stat_buf->prim_seq_err_cnt, | ||
2115 | stat_buf->inval_xmit_word_cnt, | ||
2116 | stat_buf->inval_crc_cnt)); | ||
2117 | } | 2054 | } |
2118 | } else { | 2055 | } else { |
2119 | /* Failed. */ | 2056 | /* Failed. */ |
2120 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2057 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2121 | ha->host_no, rval)); | 2058 | ha->host_no, rval)); |
2122 | rval = BIT_1; | ||
2123 | } | 2059 | } |
2124 | 2060 | ||
2125 | dma_pool_free(ha->s_dma_pool, stat_buf, stat_buf_dma); | ||
2126 | |||
2127 | return rval; | 2061 | return rval; |
2128 | } | 2062 | } |
2129 | 2063 | ||
2130 | int | 2064 | int |
2131 | qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, | 2065 | qla24xx_get_isp_stats(scsi_qla_host_t *ha, struct link_statistics *stats, |
2132 | uint16_t *status) | 2066 | dma_addr_t stats_dma) |
2133 | { | 2067 | { |
2134 | int rval; | 2068 | int rval; |
2135 | mbx_cmd_t mc; | 2069 | mbx_cmd_t mc; |
2136 | mbx_cmd_t *mcp = &mc; | 2070 | mbx_cmd_t *mcp = &mc; |
2137 | uint32_t *sbuf, *siter; | 2071 | uint32_t *siter, *diter, dwords; |
2138 | dma_addr_t sbuf_dma; | ||
2139 | 2072 | ||
2140 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2073 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2141 | 2074 | ||
2142 | if (dwords > (DMA_POOL_SIZE / 4)) { | ||
2143 | DEBUG2_3_11(printk("%s(%ld): Unabled to retrieve %d DWORDs " | ||
2144 | "(max %d).\n", __func__, ha->host_no, dwords, | ||
2145 | DMA_POOL_SIZE / 4)); | ||
2146 | return BIT_0; | ||
2147 | } | ||
2148 | sbuf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &sbuf_dma); | ||
2149 | if (sbuf == NULL) { | ||
2150 | DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", | ||
2151 | __func__, ha->host_no)); | ||
2152 | return BIT_0; | ||
2153 | } | ||
2154 | memset(sbuf, 0, DMA_POOL_SIZE); | ||
2155 | |||
2156 | mcp->mb[0] = MBC_GET_LINK_PRIV_STATS; | 2075 | mcp->mb[0] = MBC_GET_LINK_PRIV_STATS; |
2157 | mcp->mb[2] = MSW(sbuf_dma); | 2076 | mcp->mb[2] = MSW(stats_dma); |
2158 | mcp->mb[3] = LSW(sbuf_dma); | 2077 | mcp->mb[3] = LSW(stats_dma); |
2159 | mcp->mb[6] = MSW(MSD(sbuf_dma)); | 2078 | mcp->mb[6] = MSW(MSD(stats_dma)); |
2160 | mcp->mb[7] = LSW(MSD(sbuf_dma)); | 2079 | mcp->mb[7] = LSW(MSD(stats_dma)); |
2161 | mcp->mb[8] = dwords; | 2080 | mcp->mb[8] = sizeof(struct link_statistics) / 4; |
2081 | mcp->mb[9] = ha->vp_idx; | ||
2162 | mcp->mb[10] = 0; | 2082 | mcp->mb[10] = 0; |
2163 | mcp->out_mb = MBX_10|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | 2083 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; |
2164 | mcp->in_mb = MBX_2|MBX_1|MBX_0; | 2084 | mcp->in_mb = MBX_2|MBX_1|MBX_0; |
2165 | mcp->tov = 30; | 2085 | mcp->tov = 30; |
2166 | mcp->flags = IOCTL_CMD; | 2086 | mcp->flags = IOCTL_CMD; |
@@ -2170,23 +2090,20 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, | |||
2170 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { | 2090 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { |
2171 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", | 2091 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", |
2172 | __func__, ha->host_no, mcp->mb[0])); | 2092 | __func__, ha->host_no, mcp->mb[0])); |
2173 | status[0] = mcp->mb[0]; | 2093 | rval = QLA_FUNCTION_FAILED; |
2174 | rval = BIT_1; | ||
2175 | } else { | 2094 | } else { |
2176 | /* Copy over data -- firmware data is LE. */ | 2095 | /* Copy over data -- firmware data is LE. */ |
2177 | siter = sbuf; | 2096 | dwords = sizeof(struct link_statistics) / 4; |
2097 | siter = diter = &stats->link_fail_cnt; | ||
2178 | while (dwords--) | 2098 | while (dwords--) |
2179 | *dwbuf++ = le32_to_cpu(*siter++); | 2099 | *diter++ = le32_to_cpu(*siter++); |
2180 | } | 2100 | } |
2181 | } else { | 2101 | } else { |
2182 | /* Failed. */ | 2102 | /* Failed. */ |
2183 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2103 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2184 | ha->host_no, rval)); | 2104 | ha->host_no, rval)); |
2185 | rval = BIT_1; | ||
2186 | } | 2105 | } |
2187 | 2106 | ||
2188 | dma_pool_free(ha->s_dma_pool, sbuf, sbuf_dma); | ||
2189 | |||
2190 | return rval; | 2107 | return rval; |
2191 | } | 2108 | } |
2192 | 2109 | ||
@@ -2331,6 +2248,8 @@ atarget_done: | |||
2331 | return rval; | 2248 | return rval; |
2332 | } | 2249 | } |
2333 | 2250 | ||
2251 | #if 0 | ||
2252 | |||
2334 | int | 2253 | int |
2335 | qla2x00_system_error(scsi_qla_host_t *ha) | 2254 | qla2x00_system_error(scsi_qla_host_t *ha) |
2336 | { | 2255 | { |
@@ -2360,47 +2279,7 @@ qla2x00_system_error(scsi_qla_host_t *ha) | |||
2360 | return rval; | 2279 | return rval; |
2361 | } | 2280 | } |
2362 | 2281 | ||
2363 | /** | 2282 | #endif /* 0 */ |
2364 | * qla2x00_get_serdes_params() - | ||
2365 | * @ha: HA context | ||
2366 | * | ||
2367 | * Returns | ||
2368 | */ | ||
2369 | int | ||
2370 | qla2x00_get_serdes_params(scsi_qla_host_t *ha, uint16_t *sw_em_1g, | ||
2371 | uint16_t *sw_em_2g, uint16_t *sw_em_4g) | ||
2372 | { | ||
2373 | int rval; | ||
2374 | mbx_cmd_t mc; | ||
2375 | mbx_cmd_t *mcp = &mc; | ||
2376 | |||
2377 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | ||
2378 | |||
2379 | mcp->mb[0] = MBC_SERDES_PARAMS; | ||
2380 | mcp->mb[1] = 0; | ||
2381 | mcp->out_mb = MBX_1|MBX_0; | ||
2382 | mcp->in_mb = MBX_4|MBX_3|MBX_2|MBX_0; | ||
2383 | mcp->tov = 30; | ||
2384 | mcp->flags = 0; | ||
2385 | rval = qla2x00_mailbox_command(ha, mcp); | ||
2386 | |||
2387 | if (rval != QLA_SUCCESS) { | ||
2388 | /*EMPTY*/ | ||
2389 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, | ||
2390 | ha->host_no, rval, mcp->mb[0])); | ||
2391 | } else { | ||
2392 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | ||
2393 | |||
2394 | if (sw_em_1g) | ||
2395 | *sw_em_1g = mcp->mb[2]; | ||
2396 | if (sw_em_2g) | ||
2397 | *sw_em_2g = mcp->mb[3]; | ||
2398 | if (sw_em_4g) | ||
2399 | *sw_em_4g = mcp->mb[4]; | ||
2400 | } | ||
2401 | |||
2402 | return rval; | ||
2403 | } | ||
2404 | 2283 | ||
2405 | /** | 2284 | /** |
2406 | * qla2x00_set_serdes_params() - | 2285 | * qla2x00_set_serdes_params() - |
@@ -2471,7 +2350,7 @@ qla2x00_stop_firmware(scsi_qla_host_t *ha) | |||
2471 | } | 2350 | } |
2472 | 2351 | ||
2473 | int | 2352 | int |
2474 | qla2x00_trace_control(scsi_qla_host_t *ha, uint16_t ctrl, dma_addr_t eft_dma, | 2353 | qla2x00_enable_eft_trace(scsi_qla_host_t *ha, dma_addr_t eft_dma, |
2475 | uint16_t buffers) | 2354 | uint16_t buffers) |
2476 | { | 2355 | { |
2477 | int rval; | 2356 | int rval; |
@@ -2484,22 +2363,18 @@ qla2x00_trace_control(scsi_qla_host_t *ha, uint16_t ctrl, dma_addr_t eft_dma, | |||
2484 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2363 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2485 | 2364 | ||
2486 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2365 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2487 | mcp->mb[1] = ctrl; | 2366 | mcp->mb[1] = TC_EFT_ENABLE; |
2488 | mcp->out_mb = MBX_1|MBX_0; | 2367 | mcp->mb[2] = LSW(eft_dma); |
2368 | mcp->mb[3] = MSW(eft_dma); | ||
2369 | mcp->mb[4] = LSW(MSD(eft_dma)); | ||
2370 | mcp->mb[5] = MSW(MSD(eft_dma)); | ||
2371 | mcp->mb[6] = buffers; | ||
2372 | mcp->mb[7] = TC_AEN_DISABLE; | ||
2373 | mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | ||
2489 | mcp->in_mb = MBX_1|MBX_0; | 2374 | mcp->in_mb = MBX_1|MBX_0; |
2490 | if (ctrl == TC_ENABLE) { | ||
2491 | mcp->mb[2] = LSW(eft_dma); | ||
2492 | mcp->mb[3] = MSW(eft_dma); | ||
2493 | mcp->mb[4] = LSW(MSD(eft_dma)); | ||
2494 | mcp->mb[5] = MSW(MSD(eft_dma)); | ||
2495 | mcp->mb[6] = buffers; | ||
2496 | mcp->mb[7] = 0; | ||
2497 | mcp->out_mb |= MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2; | ||
2498 | } | ||
2499 | mcp->tov = 30; | 2375 | mcp->tov = 30; |
2500 | mcp->flags = 0; | 2376 | mcp->flags = 0; |
2501 | rval = qla2x00_mailbox_command(ha, mcp); | 2377 | rval = qla2x00_mailbox_command(ha, mcp); |
2502 | |||
2503 | if (rval != QLA_SUCCESS) { | 2378 | if (rval != QLA_SUCCESS) { |
2504 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | 2379 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2505 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 2380 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
@@ -2511,8 +2386,7 @@ qla2x00_trace_control(scsi_qla_host_t *ha, uint16_t ctrl, dma_addr_t eft_dma, | |||
2511 | } | 2386 | } |
2512 | 2387 | ||
2513 | int | 2388 | int |
2514 | qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr, | 2389 | qla2x00_disable_eft_trace(scsi_qla_host_t *ha) |
2515 | uint16_t off, uint16_t count) | ||
2516 | { | 2390 | { |
2517 | int rval; | 2391 | int rval; |
2518 | mbx_cmd_t mc; | 2392 | mbx_cmd_t mc; |
@@ -2523,24 +2397,16 @@ qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr, | |||
2523 | 2397 | ||
2524 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2398 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2525 | 2399 | ||
2526 | mcp->mb[0] = MBC_READ_SFP; | 2400 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2527 | mcp->mb[1] = addr; | 2401 | mcp->mb[1] = TC_EFT_DISABLE; |
2528 | mcp->mb[2] = MSW(sfp_dma); | 2402 | mcp->out_mb = MBX_1|MBX_0; |
2529 | mcp->mb[3] = LSW(sfp_dma); | 2403 | mcp->in_mb = MBX_1|MBX_0; |
2530 | mcp->mb[6] = MSW(MSD(sfp_dma)); | ||
2531 | mcp->mb[7] = LSW(MSD(sfp_dma)); | ||
2532 | mcp->mb[8] = count; | ||
2533 | mcp->mb[9] = off; | ||
2534 | mcp->mb[10] = 0; | ||
2535 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | ||
2536 | mcp->in_mb = MBX_0; | ||
2537 | mcp->tov = 30; | 2404 | mcp->tov = 30; |
2538 | mcp->flags = 0; | 2405 | mcp->flags = 0; |
2539 | rval = qla2x00_mailbox_command(ha, mcp); | 2406 | rval = qla2x00_mailbox_command(ha, mcp); |
2540 | |||
2541 | if (rval != QLA_SUCCESS) { | 2407 | if (rval != QLA_SUCCESS) { |
2542 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, | 2408 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2543 | ha->host_no, rval, mcp->mb[0])); | 2409 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2544 | } else { | 2410 | } else { |
2545 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2411 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); |
2546 | } | 2412 | } |
@@ -2549,176 +2415,168 @@ qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr, | |||
2549 | } | 2415 | } |
2550 | 2416 | ||
2551 | int | 2417 | int |
2552 | qla2x00_get_idma_speed(scsi_qla_host_t *ha, uint16_t loop_id, | 2418 | qla2x00_enable_fce_trace(scsi_qla_host_t *ha, dma_addr_t fce_dma, |
2553 | uint16_t *port_speed, uint16_t *mb) | 2419 | uint16_t buffers, uint16_t *mb, uint32_t *dwords) |
2554 | { | 2420 | { |
2555 | int rval; | 2421 | int rval; |
2556 | mbx_cmd_t mc; | 2422 | mbx_cmd_t mc; |
2557 | mbx_cmd_t *mcp = &mc; | 2423 | mbx_cmd_t *mcp = &mc; |
2558 | 2424 | ||
2559 | if (!IS_IIDMA_CAPABLE(ha)) | 2425 | if (!IS_QLA25XX(ha)) |
2560 | return QLA_FUNCTION_FAILED; | 2426 | return QLA_FUNCTION_FAILED; |
2561 | 2427 | ||
2562 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2428 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2563 | 2429 | ||
2564 | mcp->mb[0] = MBC_PORT_PARAMS; | 2430 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2565 | mcp->mb[1] = loop_id; | 2431 | mcp->mb[1] = TC_FCE_ENABLE; |
2566 | mcp->mb[2] = mcp->mb[3] = mcp->mb[4] = mcp->mb[5] = 0; | 2432 | mcp->mb[2] = LSW(fce_dma); |
2567 | mcp->out_mb = MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | 2433 | mcp->mb[3] = MSW(fce_dma); |
2568 | mcp->in_mb = MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; | 2434 | mcp->mb[4] = LSW(MSD(fce_dma)); |
2435 | mcp->mb[5] = MSW(MSD(fce_dma)); | ||
2436 | mcp->mb[6] = buffers; | ||
2437 | mcp->mb[7] = TC_AEN_DISABLE; | ||
2438 | mcp->mb[8] = 0; | ||
2439 | mcp->mb[9] = TC_FCE_DEFAULT_RX_SIZE; | ||
2440 | mcp->mb[10] = TC_FCE_DEFAULT_TX_SIZE; | ||
2441 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2| | ||
2442 | MBX_1|MBX_0; | ||
2443 | mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | ||
2569 | mcp->tov = 30; | 2444 | mcp->tov = 30; |
2570 | mcp->flags = 0; | 2445 | mcp->flags = 0; |
2571 | rval = qla2x00_mailbox_command(ha, mcp); | 2446 | rval = qla2x00_mailbox_command(ha, mcp); |
2572 | |||
2573 | /* Return mailbox statuses. */ | ||
2574 | if (mb != NULL) { | ||
2575 | mb[0] = mcp->mb[0]; | ||
2576 | mb[1] = mcp->mb[1]; | ||
2577 | mb[3] = mcp->mb[3]; | ||
2578 | mb[4] = mcp->mb[4]; | ||
2579 | mb[5] = mcp->mb[5]; | ||
2580 | } | ||
2581 | |||
2582 | if (rval != QLA_SUCCESS) { | 2447 | if (rval != QLA_SUCCESS) { |
2583 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2448 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2584 | ha->host_no, rval)); | 2449 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2585 | } else { | 2450 | } else { |
2586 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2451 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); |
2587 | if (port_speed) | 2452 | |
2588 | *port_speed = mcp->mb[3]; | 2453 | if (mb) |
2454 | memcpy(mb, mcp->mb, 8 * sizeof(*mb)); | ||
2455 | if (dwords) | ||
2456 | *dwords = mcp->mb[6]; | ||
2589 | } | 2457 | } |
2590 | 2458 | ||
2591 | return rval; | 2459 | return rval; |
2592 | } | 2460 | } |
2593 | 2461 | ||
2594 | int | 2462 | int |
2595 | qla2x00_set_idma_speed(scsi_qla_host_t *ha, uint16_t loop_id, | 2463 | qla2x00_disable_fce_trace(scsi_qla_host_t *ha, uint64_t *wr, uint64_t *rd) |
2596 | uint16_t port_speed, uint16_t *mb) | ||
2597 | { | 2464 | { |
2598 | int rval; | 2465 | int rval; |
2599 | mbx_cmd_t mc; | 2466 | mbx_cmd_t mc; |
2600 | mbx_cmd_t *mcp = &mc; | 2467 | mbx_cmd_t *mcp = &mc; |
2601 | 2468 | ||
2602 | if (!IS_IIDMA_CAPABLE(ha)) | 2469 | if (!IS_FWI2_CAPABLE(ha)) |
2603 | return QLA_FUNCTION_FAILED; | 2470 | return QLA_FUNCTION_FAILED; |
2604 | 2471 | ||
2605 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2472 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2606 | 2473 | ||
2607 | mcp->mb[0] = MBC_PORT_PARAMS; | 2474 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2608 | mcp->mb[1] = loop_id; | 2475 | mcp->mb[1] = TC_FCE_DISABLE; |
2609 | mcp->mb[2] = BIT_0; | 2476 | mcp->mb[2] = TC_FCE_DISABLE_TRACE; |
2610 | mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0); | 2477 | mcp->out_mb = MBX_2|MBX_1|MBX_0; |
2611 | mcp->mb[4] = mcp->mb[5] = 0; | 2478 | mcp->in_mb = MBX_9|MBX_8|MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2| |
2612 | mcp->out_mb = MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | 2479 | MBX_1|MBX_0; |
2613 | mcp->in_mb = MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; | ||
2614 | mcp->tov = 30; | 2480 | mcp->tov = 30; |
2615 | mcp->flags = 0; | 2481 | mcp->flags = 0; |
2616 | rval = qla2x00_mailbox_command(ha, mcp); | 2482 | rval = qla2x00_mailbox_command(ha, mcp); |
2617 | |||
2618 | /* Return mailbox statuses. */ | ||
2619 | if (mb != NULL) { | ||
2620 | mb[0] = mcp->mb[0]; | ||
2621 | mb[1] = mcp->mb[1]; | ||
2622 | mb[3] = mcp->mb[3]; | ||
2623 | mb[4] = mcp->mb[4]; | ||
2624 | mb[5] = mcp->mb[5]; | ||
2625 | } | ||
2626 | |||
2627 | if (rval != QLA_SUCCESS) { | 2483 | if (rval != QLA_SUCCESS) { |
2628 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2484 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2629 | ha->host_no, rval)); | 2485 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2630 | } else { | 2486 | } else { |
2631 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2487 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); |
2488 | |||
2489 | if (wr) | ||
2490 | *wr = (uint64_t) mcp->mb[5] << 48 | | ||
2491 | (uint64_t) mcp->mb[4] << 32 | | ||
2492 | (uint64_t) mcp->mb[3] << 16 | | ||
2493 | (uint64_t) mcp->mb[2]; | ||
2494 | if (rd) | ||
2495 | *rd = (uint64_t) mcp->mb[9] << 48 | | ||
2496 | (uint64_t) mcp->mb[8] << 32 | | ||
2497 | (uint64_t) mcp->mb[7] << 16 | | ||
2498 | (uint64_t) mcp->mb[6]; | ||
2632 | } | 2499 | } |
2633 | 2500 | ||
2634 | return rval; | 2501 | return rval; |
2635 | } | 2502 | } |
2636 | 2503 | ||
2637 | /* | ||
2638 | * qla24xx_get_vp_database | ||
2639 | * Get the VP's database for all configured ports. | ||
2640 | * | ||
2641 | * Input: | ||
2642 | * ha = adapter block pointer. | ||
2643 | * size = size of initialization control block. | ||
2644 | * | ||
2645 | * Returns: | ||
2646 | * qla2x00 local function return status code. | ||
2647 | * | ||
2648 | * Context: | ||
2649 | * Kernel context. | ||
2650 | */ | ||
2651 | int | 2504 | int |
2652 | qla24xx_get_vp_database(scsi_qla_host_t *ha, uint16_t size) | 2505 | qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr, |
2506 | uint16_t off, uint16_t count) | ||
2653 | { | 2507 | { |
2654 | int rval; | 2508 | int rval; |
2655 | mbx_cmd_t mc; | 2509 | mbx_cmd_t mc; |
2656 | mbx_cmd_t *mcp = &mc; | 2510 | mbx_cmd_t *mcp = &mc; |
2657 | 2511 | ||
2658 | DEBUG11(printk("scsi(%ld):%s - entered.\n", | 2512 | if (!IS_FWI2_CAPABLE(ha)) |
2659 | ha->host_no, __func__)); | 2513 | return QLA_FUNCTION_FAILED; |
2660 | 2514 | ||
2661 | mcp->mb[0] = MBC_MID_GET_VP_DATABASE; | 2515 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2662 | mcp->mb[2] = MSW(ha->init_cb_dma); | 2516 | |
2663 | mcp->mb[3] = LSW(ha->init_cb_dma); | 2517 | mcp->mb[0] = MBC_READ_SFP; |
2664 | mcp->mb[4] = 0; | 2518 | mcp->mb[1] = addr; |
2665 | mcp->mb[5] = 0; | 2519 | mcp->mb[2] = MSW(sfp_dma); |
2666 | mcp->mb[6] = MSW(MSD(ha->init_cb_dma)); | 2520 | mcp->mb[3] = LSW(sfp_dma); |
2667 | mcp->mb[7] = LSW(MSD(ha->init_cb_dma)); | 2521 | mcp->mb[6] = MSW(MSD(sfp_dma)); |
2668 | mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | 2522 | mcp->mb[7] = LSW(MSD(sfp_dma)); |
2669 | mcp->in_mb = MBX_1|MBX_0; | 2523 | mcp->mb[8] = count; |
2670 | mcp->buf_size = size; | 2524 | mcp->mb[9] = off; |
2671 | mcp->flags = MBX_DMA_OUT; | 2525 | mcp->mb[10] = 0; |
2672 | mcp->tov = MBX_TOV_SECONDS; | 2526 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; |
2527 | mcp->in_mb = MBX_0; | ||
2528 | mcp->tov = 30; | ||
2529 | mcp->flags = 0; | ||
2673 | rval = qla2x00_mailbox_command(ha, mcp); | 2530 | rval = qla2x00_mailbox_command(ha, mcp); |
2674 | 2531 | ||
2675 | if (rval != QLA_SUCCESS) { | 2532 | if (rval != QLA_SUCCESS) { |
2676 | /*EMPTY*/ | 2533 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, |
2677 | DEBUG2_3_11(printk("%s(%ld): failed=%x " | 2534 | ha->host_no, rval, mcp->mb[0])); |
2678 | "mb0=%x.\n", | ||
2679 | __func__, ha->host_no, rval, mcp->mb[0])); | ||
2680 | } else { | 2535 | } else { |
2681 | /*EMPTY*/ | 2536 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); |
2682 | DEBUG11(printk("%s(%ld): done.\n", | ||
2683 | __func__, ha->host_no)); | ||
2684 | } | 2537 | } |
2685 | 2538 | ||
2686 | return rval; | 2539 | return rval; |
2687 | } | 2540 | } |
2688 | 2541 | ||
2689 | int | 2542 | int |
2690 | qla24xx_get_vp_entry(scsi_qla_host_t *ha, uint16_t size, int vp_id) | 2543 | qla2x00_set_idma_speed(scsi_qla_host_t *ha, uint16_t loop_id, |
2544 | uint16_t port_speed, uint16_t *mb) | ||
2691 | { | 2545 | { |
2692 | int rval; | 2546 | int rval; |
2693 | mbx_cmd_t mc; | 2547 | mbx_cmd_t mc; |
2694 | mbx_cmd_t *mcp = &mc; | 2548 | mbx_cmd_t *mcp = &mc; |
2695 | 2549 | ||
2550 | if (!IS_IIDMA_CAPABLE(ha)) | ||
2551 | return QLA_FUNCTION_FAILED; | ||
2552 | |||
2696 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2553 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); |
2697 | 2554 | ||
2698 | mcp->mb[0] = MBC_MID_GET_VP_ENTRY; | 2555 | mcp->mb[0] = MBC_PORT_PARAMS; |
2699 | mcp->mb[2] = MSW(ha->init_cb_dma); | 2556 | mcp->mb[1] = loop_id; |
2700 | mcp->mb[3] = LSW(ha->init_cb_dma); | 2557 | mcp->mb[2] = BIT_0; |
2701 | mcp->mb[4] = 0; | 2558 | mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0); |
2702 | mcp->mb[5] = 0; | 2559 | mcp->mb[4] = mcp->mb[5] = 0; |
2703 | mcp->mb[6] = MSW(MSD(ha->init_cb_dma)); | 2560 | mcp->out_mb = MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; |
2704 | mcp->mb[7] = LSW(MSD(ha->init_cb_dma)); | 2561 | mcp->in_mb = MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; |
2705 | mcp->mb[9] = vp_id; | ||
2706 | mcp->out_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | ||
2707 | mcp->in_mb = MBX_0; | ||
2708 | mcp->buf_size = size; | ||
2709 | mcp->flags = MBX_DMA_OUT; | ||
2710 | mcp->tov = 30; | 2562 | mcp->tov = 30; |
2563 | mcp->flags = 0; | ||
2711 | rval = qla2x00_mailbox_command(ha, mcp); | 2564 | rval = qla2x00_mailbox_command(ha, mcp); |
2712 | 2565 | ||
2566 | /* Return mailbox statuses. */ | ||
2567 | if (mb != NULL) { | ||
2568 | mb[0] = mcp->mb[0]; | ||
2569 | mb[1] = mcp->mb[1]; | ||
2570 | mb[3] = mcp->mb[3]; | ||
2571 | mb[4] = mcp->mb[4]; | ||
2572 | mb[5] = mcp->mb[5]; | ||
2573 | } | ||
2574 | |||
2713 | if (rval != QLA_SUCCESS) { | 2575 | if (rval != QLA_SUCCESS) { |
2714 | /*EMPTY*/ | 2576 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2715 | DEBUG2_3_11(printk("qla24xx_get_vp_entry(%ld): failed=%x " | 2577 | ha->host_no, rval)); |
2716 | "mb0=%x.\n", | ||
2717 | ha->host_no, rval, mcp->mb[0])); | ||
2718 | } else { | 2578 | } else { |
2719 | /*EMPTY*/ | 2579 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); |
2720 | DEBUG11(printk("qla24xx_get_vp_entry(%ld): done.\n", | ||
2721 | ha->host_no)); | ||
2722 | } | 2580 | } |
2723 | 2581 | ||
2724 | return rval; | 2582 | return rval; |
@@ -2873,7 +2731,7 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) | |||
2873 | DEBUG11(printk("%s(%ld): entered. Enabling index %d\n", __func__, | 2731 | DEBUG11(printk("%s(%ld): entered. Enabling index %d\n", __func__, |
2874 | ha->host_no, vp_index)); | 2732 | ha->host_no, vp_index)); |
2875 | 2733 | ||
2876 | if (vp_index == 0 || vp_index >= MAX_MULTI_ID_LOOP) | 2734 | if (vp_index == 0 || vp_index >= ha->max_npiv_vports) |
2877 | return QLA_PARAMETER_ERROR; | 2735 | return QLA_PARAMETER_ERROR; |
2878 | 2736 | ||
2879 | vce = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &vce_dma); | 2737 | vce = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &vce_dma); |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 821ee74aadc6..cf784cdafb01 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -39,7 +39,7 @@ qla2x00_vp_stop_timer(scsi_qla_host_t *vha) | |||
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | uint32_t | 42 | static uint32_t |
43 | qla24xx_allocate_vp_id(scsi_qla_host_t *vha) | 43 | qla24xx_allocate_vp_id(scsi_qla_host_t *vha) |
44 | { | 44 | { |
45 | uint32_t vp_id; | 45 | uint32_t vp_id; |
@@ -47,16 +47,15 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) | |||
47 | 47 | ||
48 | /* Find an empty slot and assign an vp_id */ | 48 | /* Find an empty slot and assign an vp_id */ |
49 | down(&ha->vport_sem); | 49 | down(&ha->vport_sem); |
50 | vp_id = find_first_zero_bit((unsigned long *)ha->vp_idx_map, | 50 | vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1); |
51 | MAX_MULTI_ID_FABRIC); | 51 | if (vp_id > ha->max_npiv_vports) { |
52 | if (vp_id > MAX_MULTI_ID_FABRIC) { | 52 | DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n", |
53 | DEBUG15(printk ("vp_id %d is bigger than MAX_MULTI_ID_FABRID\n", | 53 | vp_id, ha->max_npiv_vports)); |
54 | vp_id)); | ||
55 | up(&ha->vport_sem); | 54 | up(&ha->vport_sem); |
56 | return vp_id; | 55 | return vp_id; |
57 | } | 56 | } |
58 | 57 | ||
59 | set_bit(vp_id, (unsigned long *)ha->vp_idx_map); | 58 | set_bit(vp_id, ha->vp_idx_map); |
60 | ha->num_vhosts++; | 59 | ha->num_vhosts++; |
61 | vha->vp_idx = vp_id; | 60 | vha->vp_idx = vp_id; |
62 | list_add_tail(&vha->vp_list, &ha->vp_list); | 61 | list_add_tail(&vha->vp_list, &ha->vp_list); |
@@ -73,12 +72,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) | |||
73 | down(&ha->vport_sem); | 72 | down(&ha->vport_sem); |
74 | vp_id = vha->vp_idx; | 73 | vp_id = vha->vp_idx; |
75 | ha->num_vhosts--; | 74 | ha->num_vhosts--; |
76 | clear_bit(vp_id, (unsigned long *)ha->vp_idx_map); | 75 | clear_bit(vp_id, ha->vp_idx_map); |
77 | list_del(&vha->vp_list); | 76 | list_del(&vha->vp_list); |
78 | up(&ha->vport_sem); | 77 | up(&ha->vport_sem); |
79 | } | 78 | } |
80 | 79 | ||
81 | scsi_qla_host_t * | 80 | static scsi_qla_host_t * |
82 | qla24xx_find_vhost_by_name(scsi_qla_host_t *ha, uint8_t *port_name) | 81 | qla24xx_find_vhost_by_name(scsi_qla_host_t *ha, uint8_t *port_name) |
83 | { | 82 | { |
84 | scsi_qla_host_t *vha; | 83 | scsi_qla_host_t *vha; |
@@ -216,11 +215,7 @@ qla2x00_alert_all_vps(scsi_qla_host_t *ha, uint16_t *mb) | |||
216 | if (ha->parent) | 215 | if (ha->parent) |
217 | return; | 216 | return; |
218 | 217 | ||
219 | i = find_next_bit((unsigned long *)ha->vp_idx_map, | 218 | for_each_mapped_vp_idx(ha, i) { |
220 | MAX_MULTI_ID_FABRIC + 1, 1); | ||
221 | for (;i <= MAX_MULTI_ID_FABRIC; | ||
222 | i = find_next_bit((unsigned long *)ha->vp_idx_map, | ||
223 | MAX_MULTI_ID_FABRIC + 1, i + 1)) { | ||
224 | vp_idx_matched = 0; | 219 | vp_idx_matched = 0; |
225 | 220 | ||
226 | list_for_each_entry(vha, &ha->vp_list, vp_list) { | 221 | list_for_each_entry(vha, &ha->vp_list, vp_list) { |
@@ -270,7 +265,7 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha) | |||
270 | qla24xx_enable_vp(vha); | 265 | qla24xx_enable_vp(vha); |
271 | } | 266 | } |
272 | 267 | ||
273 | int | 268 | static int |
274 | qla2x00_do_dpc_vp(scsi_qla_host_t *vha) | 269 | qla2x00_do_dpc_vp(scsi_qla_host_t *vha) |
275 | { | 270 | { |
276 | if (test_and_clear_bit(VP_IDX_ACQUIRED, &vha->vp_flags)) { | 271 | if (test_and_clear_bit(VP_IDX_ACQUIRED, &vha->vp_flags)) { |
@@ -311,11 +306,7 @@ qla2x00_do_dpc_all_vps(scsi_qla_host_t *ha) | |||
311 | 306 | ||
312 | clear_bit(VP_DPC_NEEDED, &ha->dpc_flags); | 307 | clear_bit(VP_DPC_NEEDED, &ha->dpc_flags); |
313 | 308 | ||
314 | i = find_next_bit((unsigned long *)ha->vp_idx_map, | 309 | for_each_mapped_vp_idx(ha, i) { |
315 | MAX_MULTI_ID_FABRIC + 1, 1); | ||
316 | for (;i <= MAX_MULTI_ID_FABRIC; | ||
317 | i = find_next_bit((unsigned long *)ha->vp_idx_map, | ||
318 | MAX_MULTI_ID_FABRIC + 1, i + 1)) { | ||
319 | vp_idx_matched = 0; | 310 | vp_idx_matched = 0; |
320 | 311 | ||
321 | list_for_each_entry(vha, &ha->vp_list, vp_list) { | 312 | list_for_each_entry(vha, &ha->vp_list, vp_list) { |
@@ -350,15 +341,17 @@ qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport) | |||
350 | 341 | ||
351 | /* Check up unique WWPN */ | 342 | /* Check up unique WWPN */ |
352 | u64_to_wwn(fc_vport->port_name, port_name); | 343 | u64_to_wwn(fc_vport->port_name, port_name); |
344 | if (!memcmp(port_name, ha->port_name, WWN_SIZE)) | ||
345 | return VPCERR_BAD_WWN; | ||
353 | vha = qla24xx_find_vhost_by_name(ha, port_name); | 346 | vha = qla24xx_find_vhost_by_name(ha, port_name); |
354 | if (vha) | 347 | if (vha) |
355 | return VPCERR_BAD_WWN; | 348 | return VPCERR_BAD_WWN; |
356 | 349 | ||
357 | /* Check up max-npiv-supports */ | 350 | /* Check up max-npiv-supports */ |
358 | if (ha->num_vhosts > ha->max_npiv_vports) { | 351 | if (ha->num_vhosts > ha->max_npiv_vports) { |
359 | DEBUG15(printk("scsi(%ld): num_vhosts %d is bigger than " | 352 | DEBUG15(printk("scsi(%ld): num_vhosts %ud is bigger than " |
360 | "max_npv_vports %d.\n", ha->host_no, | 353 | "max_npv_vports %ud.\n", ha->host_no, |
361 | (uint16_t) ha->num_vhosts, (int) ha->max_npiv_vports)); | 354 | ha->num_vhosts, ha->max_npiv_vports)); |
362 | return VPCERR_UNSUPPORTED; | 355 | return VPCERR_UNSUPPORTED; |
363 | } | 356 | } |
364 | return 0; | 357 | return 0; |
@@ -412,8 +405,9 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
412 | } | 405 | } |
413 | vha->mgmt_svr_loop_id = 10 + vha->vp_idx; | 406 | vha->mgmt_svr_loop_id = 10 + vha->vp_idx; |
414 | 407 | ||
415 | init_MUTEX(&vha->mbx_cmd_sem); | 408 | init_completion(&vha->mbx_cmd_comp); |
416 | init_MUTEX_LOCKED(&vha->mbx_intr_sem); | 409 | complete(&vha->mbx_cmd_comp); |
410 | init_completion(&vha->mbx_intr_comp); | ||
417 | 411 | ||
418 | INIT_LIST_HEAD(&vha->list); | 412 | INIT_LIST_HEAD(&vha->list); |
419 | INIT_LIST_HEAD(&vha->fcports); | 413 | INIT_LIST_HEAD(&vha->fcports); |
@@ -450,7 +444,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
450 | num_hosts++; | 444 | num_hosts++; |
451 | 445 | ||
452 | down(&ha->vport_sem); | 446 | down(&ha->vport_sem); |
453 | set_bit(vha->vp_idx, (unsigned long *)ha->vp_idx_map); | 447 | set_bit(vha->vp_idx, ha->vp_idx_map); |
454 | ha->cur_vport_count++; | 448 | ha->cur_vport_count++; |
455 | up(&ha->vport_sem); | 449 | up(&ha->vport_sem); |
456 | 450 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8ecc0470b8f3..aba1e6d48066 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -105,13 +105,12 @@ static int qla2xxx_eh_abort(struct scsi_cmnd *); | |||
105 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); | 105 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); |
106 | static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); | 106 | static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); |
107 | static int qla2xxx_eh_host_reset(struct scsi_cmnd *); | 107 | static int qla2xxx_eh_host_reset(struct scsi_cmnd *); |
108 | static int qla2x00_loop_reset(scsi_qla_host_t *ha); | ||
109 | static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *); | 108 | static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *); |
110 | 109 | ||
111 | static int qla2x00_change_queue_depth(struct scsi_device *, int); | 110 | static int qla2x00_change_queue_depth(struct scsi_device *, int); |
112 | static int qla2x00_change_queue_type(struct scsi_device *, int); | 111 | static int qla2x00_change_queue_type(struct scsi_device *, int); |
113 | 112 | ||
114 | struct scsi_host_template qla2x00_driver_template = { | 113 | static struct scsi_host_template qla2x00_driver_template = { |
115 | .module = THIS_MODULE, | 114 | .module = THIS_MODULE, |
116 | .name = QLA2XXX_DRIVER_NAME, | 115 | .name = QLA2XXX_DRIVER_NAME, |
117 | .queuecommand = qla2x00_queuecommand, | 116 | .queuecommand = qla2x00_queuecommand, |
@@ -179,13 +178,6 @@ struct scsi_transport_template *qla2xxx_transport_vport_template = NULL; | |||
179 | * Timer routines | 178 | * Timer routines |
180 | */ | 179 | */ |
181 | 180 | ||
182 | void qla2x00_timer(scsi_qla_host_t *); | ||
183 | |||
184 | __inline__ void qla2x00_start_timer(scsi_qla_host_t *, | ||
185 | void *, unsigned long); | ||
186 | static __inline__ void qla2x00_restart_timer(scsi_qla_host_t *, unsigned long); | ||
187 | __inline__ void qla2x00_stop_timer(scsi_qla_host_t *); | ||
188 | |||
189 | __inline__ void | 181 | __inline__ void |
190 | qla2x00_start_timer(scsi_qla_host_t *ha, void *func, unsigned long interval) | 182 | qla2x00_start_timer(scsi_qla_host_t *ha, void *func, unsigned long interval) |
191 | { | 183 | { |
@@ -203,7 +195,7 @@ qla2x00_restart_timer(scsi_qla_host_t *ha, unsigned long interval) | |||
203 | mod_timer(&ha->timer, jiffies + interval * HZ); | 195 | mod_timer(&ha->timer, jiffies + interval * HZ); |
204 | } | 196 | } |
205 | 197 | ||
206 | __inline__ void | 198 | static __inline__ void |
207 | qla2x00_stop_timer(scsi_qla_host_t *ha) | 199 | qla2x00_stop_timer(scsi_qla_host_t *ha) |
208 | { | 200 | { |
209 | del_timer_sync(&ha->timer); | 201 | del_timer_sync(&ha->timer); |
@@ -214,12 +206,11 @@ static int qla2x00_do_dpc(void *data); | |||
214 | 206 | ||
215 | static void qla2x00_rst_aen(scsi_qla_host_t *); | 207 | static void qla2x00_rst_aen(scsi_qla_host_t *); |
216 | 208 | ||
217 | uint8_t qla2x00_mem_alloc(scsi_qla_host_t *); | 209 | static uint8_t qla2x00_mem_alloc(scsi_qla_host_t *); |
218 | void qla2x00_mem_free(scsi_qla_host_t *ha); | 210 | static void qla2x00_mem_free(scsi_qla_host_t *ha); |
219 | static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha); | 211 | static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha); |
220 | static void qla2x00_free_sp_pool(scsi_qla_host_t *ha); | 212 | static void qla2x00_free_sp_pool(scsi_qla_host_t *ha); |
221 | static void qla2x00_sp_free_dma(scsi_qla_host_t *, srb_t *); | 213 | static void qla2x00_sp_free_dma(scsi_qla_host_t *, srb_t *); |
222 | void qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *); | ||
223 | 214 | ||
224 | /* -------------------------------------------------------------------------- */ | 215 | /* -------------------------------------------------------------------------- */ |
225 | 216 | ||
@@ -1060,7 +1051,7 @@ eh_host_reset_lock: | |||
1060 | * Returns: | 1051 | * Returns: |
1061 | * 0 = success | 1052 | * 0 = success |
1062 | */ | 1053 | */ |
1063 | static int | 1054 | int |
1064 | qla2x00_loop_reset(scsi_qla_host_t *ha) | 1055 | qla2x00_loop_reset(scsi_qla_host_t *ha) |
1065 | { | 1056 | { |
1066 | int ret; | 1057 | int ret; |
@@ -1479,8 +1470,7 @@ qla2x00_set_isp_flags(scsi_qla_host_t *ha) | |||
1479 | static int | 1470 | static int |
1480 | qla2x00_iospace_config(scsi_qla_host_t *ha) | 1471 | qla2x00_iospace_config(scsi_qla_host_t *ha) |
1481 | { | 1472 | { |
1482 | unsigned long pio, pio_len, pio_flags; | 1473 | resource_size_t pio; |
1483 | unsigned long mmio, mmio_len, mmio_flags; | ||
1484 | 1474 | ||
1485 | if (pci_request_selected_regions(ha->pdev, ha->bars, | 1475 | if (pci_request_selected_regions(ha->pdev, ha->bars, |
1486 | QLA2XXX_DRIVER_NAME)) { | 1476 | QLA2XXX_DRIVER_NAME)) { |
@@ -1495,10 +1485,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1495 | 1485 | ||
1496 | /* We only need PIO for Flash operations on ISP2312 v2 chips. */ | 1486 | /* We only need PIO for Flash operations on ISP2312 v2 chips. */ |
1497 | pio = pci_resource_start(ha->pdev, 0); | 1487 | pio = pci_resource_start(ha->pdev, 0); |
1498 | pio_len = pci_resource_len(ha->pdev, 0); | 1488 | if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { |
1499 | pio_flags = pci_resource_flags(ha->pdev, 0); | 1489 | if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { |
1500 | if (pio_flags & IORESOURCE_IO) { | ||
1501 | if (pio_len < MIN_IOBASE_LEN) { | ||
1502 | qla_printk(KERN_WARNING, ha, | 1490 | qla_printk(KERN_WARNING, ha, |
1503 | "Invalid PCI I/O region size (%s)...\n", | 1491 | "Invalid PCI I/O region size (%s)...\n", |
1504 | pci_name(ha->pdev)); | 1492 | pci_name(ha->pdev)); |
@@ -1511,28 +1499,23 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) | |||
1511 | pio = 0; | 1499 | pio = 0; |
1512 | } | 1500 | } |
1513 | ha->pio_address = pio; | 1501 | ha->pio_address = pio; |
1514 | ha->pio_length = pio_len; | ||
1515 | 1502 | ||
1516 | skip_pio: | 1503 | skip_pio: |
1517 | /* Use MMIO operations for all accesses. */ | 1504 | /* Use MMIO operations for all accesses. */ |
1518 | mmio = pci_resource_start(ha->pdev, 1); | 1505 | if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { |
1519 | mmio_len = pci_resource_len(ha->pdev, 1); | ||
1520 | mmio_flags = pci_resource_flags(ha->pdev, 1); | ||
1521 | |||
1522 | if (!(mmio_flags & IORESOURCE_MEM)) { | ||
1523 | qla_printk(KERN_ERR, ha, | 1506 | qla_printk(KERN_ERR, ha, |
1524 | "region #0 not an MMIO resource (%s), aborting\n", | 1507 | "region #1 not an MMIO resource (%s), aborting\n", |
1525 | pci_name(ha->pdev)); | 1508 | pci_name(ha->pdev)); |
1526 | goto iospace_error_exit; | 1509 | goto iospace_error_exit; |
1527 | } | 1510 | } |
1528 | if (mmio_len < MIN_IOBASE_LEN) { | 1511 | if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { |
1529 | qla_printk(KERN_ERR, ha, | 1512 | qla_printk(KERN_ERR, ha, |
1530 | "Invalid PCI mem region size (%s), aborting\n", | 1513 | "Invalid PCI mem region size (%s), aborting\n", |
1531 | pci_name(ha->pdev)); | 1514 | pci_name(ha->pdev)); |
1532 | goto iospace_error_exit; | 1515 | goto iospace_error_exit; |
1533 | } | 1516 | } |
1534 | 1517 | ||
1535 | ha->iobase = ioremap(mmio, MIN_IOBASE_LEN); | 1518 | ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); |
1536 | if (!ha->iobase) { | 1519 | if (!ha->iobase) { |
1537 | qla_printk(KERN_ERR, ha, | 1520 | qla_printk(KERN_ERR, ha, |
1538 | "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev)); | 1521 | "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev)); |
@@ -1701,9 +1684,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1701 | /* load the F/W, read paramaters, and init the H/W */ | 1684 | /* load the F/W, read paramaters, and init the H/W */ |
1702 | ha->instance = num_hosts; | 1685 | ha->instance = num_hosts; |
1703 | 1686 | ||
1704 | init_MUTEX(&ha->mbx_cmd_sem); | ||
1705 | init_MUTEX(&ha->vport_sem); | 1687 | init_MUTEX(&ha->vport_sem); |
1706 | init_MUTEX_LOCKED(&ha->mbx_intr_sem); | 1688 | init_completion(&ha->mbx_cmd_comp); |
1689 | complete(&ha->mbx_cmd_comp); | ||
1690 | init_completion(&ha->mbx_intr_comp); | ||
1707 | 1691 | ||
1708 | INIT_LIST_HEAD(&ha->list); | 1692 | INIT_LIST_HEAD(&ha->list); |
1709 | INIT_LIST_HEAD(&ha->fcports); | 1693 | INIT_LIST_HEAD(&ha->fcports); |
@@ -1807,6 +1791,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1807 | 1791 | ||
1808 | qla2x00_init_host_attr(ha); | 1792 | qla2x00_init_host_attr(ha); |
1809 | 1793 | ||
1794 | qla2x00_dfs_setup(ha); | ||
1795 | |||
1810 | qla_printk(KERN_INFO, ha, "\n" | 1796 | qla_printk(KERN_INFO, ha, "\n" |
1811 | " QLogic Fibre Channel HBA Driver: %s\n" | 1797 | " QLogic Fibre Channel HBA Driver: %s\n" |
1812 | " QLogic %s - %s\n" | 1798 | " QLogic %s - %s\n" |
@@ -1838,6 +1824,8 @@ qla2x00_remove_one(struct pci_dev *pdev) | |||
1838 | 1824 | ||
1839 | ha = pci_get_drvdata(pdev); | 1825 | ha = pci_get_drvdata(pdev); |
1840 | 1826 | ||
1827 | qla2x00_dfs_remove(ha); | ||
1828 | |||
1841 | qla2x00_free_sysfs_attr(ha); | 1829 | qla2x00_free_sysfs_attr(ha); |
1842 | 1830 | ||
1843 | fc_remove_host(ha->host); | 1831 | fc_remove_host(ha->host); |
@@ -1871,8 +1859,11 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1871 | kthread_stop(t); | 1859 | kthread_stop(t); |
1872 | } | 1860 | } |
1873 | 1861 | ||
1862 | if (ha->flags.fce_enabled) | ||
1863 | qla2x00_disable_fce_trace(ha, NULL, NULL); | ||
1864 | |||
1874 | if (ha->eft) | 1865 | if (ha->eft) |
1875 | qla2x00_trace_control(ha, TC_DISABLE, 0, 0); | 1866 | qla2x00_disable_eft_trace(ha); |
1876 | 1867 | ||
1877 | ha->flags.online = 0; | 1868 | ha->flags.online = 0; |
1878 | 1869 | ||
@@ -2016,7 +2007,7 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha, int defer) | |||
2016 | * 0 = success. | 2007 | * 0 = success. |
2017 | * 1 = failure. | 2008 | * 1 = failure. |
2018 | */ | 2009 | */ |
2019 | uint8_t | 2010 | static uint8_t |
2020 | qla2x00_mem_alloc(scsi_qla_host_t *ha) | 2011 | qla2x00_mem_alloc(scsi_qla_host_t *ha) |
2021 | { | 2012 | { |
2022 | char name[16]; | 2013 | char name[16]; |
@@ -2213,7 +2204,7 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) | |||
2213 | * Input: | 2204 | * Input: |
2214 | * ha = adapter block pointer. | 2205 | * ha = adapter block pointer. |
2215 | */ | 2206 | */ |
2216 | void | 2207 | static void |
2217 | qla2x00_mem_free(scsi_qla_host_t *ha) | 2208 | qla2x00_mem_free(scsi_qla_host_t *ha) |
2218 | { | 2209 | { |
2219 | struct list_head *fcpl, *fcptemp; | 2210 | struct list_head *fcpl, *fcptemp; |
@@ -2228,6 +2219,10 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2228 | /* free sp pool */ | 2219 | /* free sp pool */ |
2229 | qla2x00_free_sp_pool(ha); | 2220 | qla2x00_free_sp_pool(ha); |
2230 | 2221 | ||
2222 | if (ha->fce) | ||
2223 | dma_free_coherent(&ha->pdev->dev, FCE_SIZE, ha->fce, | ||
2224 | ha->fce_dma); | ||
2225 | |||
2231 | if (ha->fw_dump) { | 2226 | if (ha->fw_dump) { |
2232 | if (ha->eft) | 2227 | if (ha->eft) |
2233 | dma_free_coherent(&ha->pdev->dev, | 2228 | dma_free_coherent(&ha->pdev->dev, |
@@ -2748,23 +2743,6 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2748 | qla2x00_restart_timer(ha, WATCH_INTERVAL); | 2743 | qla2x00_restart_timer(ha, WATCH_INTERVAL); |
2749 | } | 2744 | } |
2750 | 2745 | ||
2751 | /* XXX(hch): crude hack to emulate a down_timeout() */ | ||
2752 | int | ||
2753 | qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout) | ||
2754 | { | ||
2755 | const unsigned int step = 100; /* msecs */ | ||
2756 | unsigned int iterations = jiffies_to_msecs(timeout)/100; | ||
2757 | |||
2758 | do { | ||
2759 | if (!down_trylock(sema)) | ||
2760 | return 0; | ||
2761 | if (msleep_interruptible(step)) | ||
2762 | break; | ||
2763 | } while (--iterations > 0); | ||
2764 | |||
2765 | return -ETIMEDOUT; | ||
2766 | } | ||
2767 | |||
2768 | /* Firmware interface routines. */ | 2746 | /* Firmware interface routines. */ |
2769 | 2747 | ||
2770 | #define FW_BLOBS 6 | 2748 | #define FW_BLOBS 6 |
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index ad2fa01bd233..b68fb73613ed 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -22,7 +22,7 @@ static void qla2x00_nv_write(scsi_qla_host_t *, uint16_t); | |||
22 | * qla2x00_lock_nvram_access() - | 22 | * qla2x00_lock_nvram_access() - |
23 | * @ha: HA context | 23 | * @ha: HA context |
24 | */ | 24 | */ |
25 | void | 25 | static void |
26 | qla2x00_lock_nvram_access(scsi_qla_host_t *ha) | 26 | qla2x00_lock_nvram_access(scsi_qla_host_t *ha) |
27 | { | 27 | { |
28 | uint16_t data; | 28 | uint16_t data; |
@@ -55,7 +55,7 @@ qla2x00_lock_nvram_access(scsi_qla_host_t *ha) | |||
55 | * qla2x00_unlock_nvram_access() - | 55 | * qla2x00_unlock_nvram_access() - |
56 | * @ha: HA context | 56 | * @ha: HA context |
57 | */ | 57 | */ |
58 | void | 58 | static void |
59 | qla2x00_unlock_nvram_access(scsi_qla_host_t *ha) | 59 | qla2x00_unlock_nvram_access(scsi_qla_host_t *ha) |
60 | { | 60 | { |
61 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 61 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
@@ -74,7 +74,7 @@ qla2x00_unlock_nvram_access(scsi_qla_host_t *ha) | |||
74 | * | 74 | * |
75 | * Returns the word read from nvram @addr. | 75 | * Returns the word read from nvram @addr. |
76 | */ | 76 | */ |
77 | uint16_t | 77 | static uint16_t |
78 | qla2x00_get_nvram_word(scsi_qla_host_t *ha, uint32_t addr) | 78 | qla2x00_get_nvram_word(scsi_qla_host_t *ha, uint32_t addr) |
79 | { | 79 | { |
80 | uint16_t data; | 80 | uint16_t data; |
@@ -93,7 +93,7 @@ qla2x00_get_nvram_word(scsi_qla_host_t *ha, uint32_t addr) | |||
93 | * @addr: Address in NVRAM to write | 93 | * @addr: Address in NVRAM to write |
94 | * @data: word to program | 94 | * @data: word to program |
95 | */ | 95 | */ |
96 | void | 96 | static void |
97 | qla2x00_write_nvram_word(scsi_qla_host_t *ha, uint32_t addr, uint16_t data) | 97 | qla2x00_write_nvram_word(scsi_qla_host_t *ha, uint32_t addr, uint16_t data) |
98 | { | 98 | { |
99 | int count; | 99 | int count; |
@@ -550,7 +550,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr, | |||
550 | int ret; | 550 | int ret; |
551 | uint32_t liter, miter; | 551 | uint32_t liter, miter; |
552 | uint32_t sec_mask, rest_addr, conf_addr; | 552 | uint32_t sec_mask, rest_addr, conf_addr; |
553 | uint32_t fdata, findex ; | 553 | uint32_t fdata, findex, cnt; |
554 | uint8_t man_id, flash_id; | 554 | uint8_t man_id, flash_id; |
555 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | 555 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; |
556 | dma_addr_t optrom_dma; | 556 | dma_addr_t optrom_dma; |
@@ -690,8 +690,14 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr, | |||
690 | 0xff0000) | ((fdata >> 16) & 0xff)); | 690 | 0xff0000) | ((fdata >> 16) & 0xff)); |
691 | } | 691 | } |
692 | 692 | ||
693 | /* Enable flash write-protection. */ | 693 | /* Enable flash write-protection and wait for completion. */ |
694 | qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0x9c); | 694 | qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0x9c); |
695 | for (cnt = 300; cnt && | ||
696 | qla24xx_read_flash_dword(ha, | ||
697 | flash_conf_to_access_addr(0x005)) & BIT_0; | ||
698 | cnt--) { | ||
699 | udelay(10); | ||
700 | } | ||
695 | 701 | ||
696 | /* Disable flash write. */ | 702 | /* Disable flash write. */ |
697 | WRT_REG_DWORD(®->ctrl_status, | 703 | WRT_REG_DWORD(®->ctrl_status, |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index ae6f7a2fb19f..2c2f6b4697c7 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.02.00-k5" | 10 | #define QLA2XXX_VERSION "8.02.00-k7" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 2 | 13 | #define QLA_DRIVER_MINOR_VER 2 |