aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-08-20 11:42:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-20 11:42:53 -0400
commitc5b0079c0a7641caac3fedab75e8e63aeb54d7e2 (patch)
tree3179f9d4ae106326c14179bb0d12db27003aeb65 /drivers
parent5f22ca9b13551debea77a407a8d06cd9c6f15238 (diff)
parent7d0e367ab3f3ad345bd3e121c4c5f511e8b274fa (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (22 commits) [SCSI] ibmvfc: Driver version 1.0.2 [SCSI] ibmvfc: Add details to async event log [SCSI] ibmvfc: Sanitize response lengths [SCSI] ibmvfc: Fix for lost async events [SCSI] ibmvfc: Fixup host state during reinit [SCSI] ibmvfc: Fix another hang on module removal [SCSI] ibmvscsi: Fixup desired DMA value for shared memory partitions [SCSI] megaraid_sas: remove sysfs dbg_lvl world writeable permissions [SCSI] qla2xxx: Update version number to 8.02.01-k7. [SCSI] qla2xxx: Explicitly tear-down vports during PCI remove_one(). [SCSI] qla2xxx: Reference proper ha during SBR handling. [SCSI] qla2xxx: Set npiv_supported flag for FCoE HBAs. [SCSI] qla2xxx: Don't leak SG-DMA mappings while aborting commands. [SCSI] qla2xxx: Correct vport-state management issues during ISP-ABORT. [SCSI] qla2xxx: Correct synchronization of software/firmware fcport states. [SCSI] scsi_dh: Initialize lun_state in check_ownership() [SCSI] scsi_dh: Do not use scsilun in rdac hardware handler [SCSI] megaraid_sas: version and Documentation Update [SCSI] megaraid_sas: add new controllers (0x78 0x79) [SCSI] megaraid_sas: add the shutdown DCMD cmd to driver shutdown routine ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c3
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c37
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h4
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c119
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h10
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c11
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c14
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c18
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
13 files changed, 189 insertions, 42 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index e7c7b4ebc1fe..2dee69da35cf 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -376,7 +376,7 @@ static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h)
376 if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' || 376 if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' ||
377 inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') 377 inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd')
378 return SCSI_DH_NOSYS; 378 return SCSI_DH_NOSYS;
379 h->lun = scsilun_to_int((struct scsi_lun *)inqp->lun); 379 h->lun = inqp->lun[7]; /* Uses only the last byte */
380 } 380 }
381 return err; 381 return err;
382} 382}
@@ -386,6 +386,7 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
386 int err; 386 int err;
387 struct c9_inquiry *inqp; 387 struct c9_inquiry *inqp;
388 388
389 h->lun_state = RDAC_LUN_UNOWNED;
389 err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h); 390 err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h);
390 if (err == SCSI_DH_OK) { 391 if (err == SCSI_DH_OK) {
391 inqp = &h->inq.c9; 392 inqp = &h->inq.c9;
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index ae560bc04f9d..4e0b7c8eb32e 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -556,11 +556,12 @@ static void ibmvfc_link_down(struct ibmvfc_host *vhost,
556/** 556/**
557 * ibmvfc_init_host - Start host initialization 557 * ibmvfc_init_host - Start host initialization
558 * @vhost: ibmvfc host struct 558 * @vhost: ibmvfc host struct
559 * @relogin: is this a re-login?
559 * 560 *
560 * Return value: 561 * Return value:
561 * nothing 562 * nothing
562 **/ 563 **/
563static void ibmvfc_init_host(struct ibmvfc_host *vhost) 564static void ibmvfc_init_host(struct ibmvfc_host *vhost, int relogin)
564{ 565{
565 struct ibmvfc_target *tgt; 566 struct ibmvfc_target *tgt;
566 567
@@ -574,6 +575,11 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost)
574 } 575 }
575 576
576 if (!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) { 577 if (!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) {
578 if (!relogin) {
579 memset(vhost->async_crq.msgs, 0, PAGE_SIZE);
580 vhost->async_crq.cur = 0;
581 }
582
577 list_for_each_entry(tgt, &vhost->targets, queue) 583 list_for_each_entry(tgt, &vhost->targets, queue)
578 tgt->need_login = 1; 584 tgt->need_login = 1;
579 scsi_block_requests(vhost->host); 585 scsi_block_requests(vhost->host);
@@ -1059,9 +1065,10 @@ static void ibmvfc_get_starget_port_id(struct scsi_target *starget)
1059static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost) 1065static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost)
1060{ 1066{
1061 long timeout = wait_event_timeout(vhost->init_wait_q, 1067 long timeout = wait_event_timeout(vhost->init_wait_q,
1062 (vhost->state == IBMVFC_ACTIVE || 1068 ((vhost->state == IBMVFC_ACTIVE ||
1063 vhost->state == IBMVFC_HOST_OFFLINE || 1069 vhost->state == IBMVFC_HOST_OFFLINE ||
1064 vhost->state == IBMVFC_LINK_DEAD), 1070 vhost->state == IBMVFC_LINK_DEAD) &&
1071 vhost->action == IBMVFC_HOST_ACTION_NONE),
1065 (init_timeout * HZ)); 1072 (init_timeout * HZ));
1066 1073
1067 return timeout ? 0 : -EIO; 1074 return timeout ? 0 : -EIO;
@@ -1450,8 +1457,8 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
1450 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; 1457 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd;
1451 struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; 1458 struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp;
1452 struct scsi_cmnd *cmnd = evt->cmnd; 1459 struct scsi_cmnd *cmnd = evt->cmnd;
1453 int rsp_len = 0; 1460 u32 rsp_len = 0;
1454 int sense_len = rsp->fcp_sense_len; 1461 u32 sense_len = rsp->fcp_sense_len;
1455 1462
1456 if (cmnd) { 1463 if (cmnd) {
1457 if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID) 1464 if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID)
@@ -1468,7 +1475,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
1468 rsp_len = rsp->fcp_rsp_len; 1475 rsp_len = rsp->fcp_rsp_len;
1469 if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE) 1476 if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE)
1470 sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len; 1477 sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len;
1471 if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len) 1478 if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len && rsp_len <= 8)
1472 memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); 1479 memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len);
1473 1480
1474 ibmvfc_log_error(evt); 1481 ibmvfc_log_error(evt);
@@ -2077,17 +2084,18 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
2077{ 2084{
2078 const char *desc = ibmvfc_get_ae_desc(crq->event); 2085 const char *desc = ibmvfc_get_ae_desc(crq->event);
2079 2086
2080 ibmvfc_log(vhost, 3, "%s event received\n", desc); 2087 ibmvfc_log(vhost, 3, "%s event received. scsi_id: %lx, wwpn: %lx,"
2088 " node_name: %lx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name);
2081 2089
2082 switch (crq->event) { 2090 switch (crq->event) {
2083 case IBMVFC_AE_LINK_UP: 2091 case IBMVFC_AE_LINK_UP:
2084 case IBMVFC_AE_RESUME: 2092 case IBMVFC_AE_RESUME:
2085 vhost->events_to_log |= IBMVFC_AE_LINKUP; 2093 vhost->events_to_log |= IBMVFC_AE_LINKUP;
2086 ibmvfc_init_host(vhost); 2094 ibmvfc_init_host(vhost, 1);
2087 break; 2095 break;
2088 case IBMVFC_AE_SCN_FABRIC: 2096 case IBMVFC_AE_SCN_FABRIC:
2089 vhost->events_to_log |= IBMVFC_AE_RSCN; 2097 vhost->events_to_log |= IBMVFC_AE_RSCN;
2090 ibmvfc_init_host(vhost); 2098 ibmvfc_init_host(vhost, 1);
2091 break; 2099 break;
2092 case IBMVFC_AE_SCN_NPORT: 2100 case IBMVFC_AE_SCN_NPORT:
2093 case IBMVFC_AE_SCN_GROUP: 2101 case IBMVFC_AE_SCN_GROUP:
@@ -2133,13 +2141,13 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost)
2133 /* Send back a response */ 2141 /* Send back a response */
2134 rc = ibmvfc_send_crq_init_complete(vhost); 2142 rc = ibmvfc_send_crq_init_complete(vhost);
2135 if (rc == 0) 2143 if (rc == 0)
2136 ibmvfc_init_host(vhost); 2144 ibmvfc_init_host(vhost, 0);
2137 else 2145 else
2138 dev_err(vhost->dev, "Unable to send init rsp. rc=%ld\n", rc); 2146 dev_err(vhost->dev, "Unable to send init rsp. rc=%ld\n", rc);
2139 break; 2147 break;
2140 case IBMVFC_CRQ_INIT_COMPLETE: 2148 case IBMVFC_CRQ_INIT_COMPLETE:
2141 dev_info(vhost->dev, "Partner initialization complete\n"); 2149 dev_info(vhost->dev, "Partner initialization complete\n");
2142 ibmvfc_init_host(vhost); 2150 ibmvfc_init_host(vhost, 0);
2143 break; 2151 break;
2144 default: 2152 default:
2145 dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format); 2153 dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format);
@@ -3357,8 +3365,6 @@ static void ibmvfc_npiv_login(struct ibmvfc_host *vhost)
3357 mad->buffer.va = vhost->login_buf_dma; 3365 mad->buffer.va = vhost->login_buf_dma;
3358 mad->buffer.len = sizeof(*vhost->login_buf); 3366 mad->buffer.len = sizeof(*vhost->login_buf);
3359 3367
3360 memset(vhost->async_crq.msgs, 0, PAGE_SIZE);
3361 vhost->async_crq.cur = 0;
3362 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); 3368 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT);
3363 3369
3364 if (!ibmvfc_send_event(evt, vhost, default_timeout)) 3370 if (!ibmvfc_send_event(evt, vhost, default_timeout))
@@ -3601,8 +3607,9 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
3601 } 3607 }
3602 } 3608 }
3603 3609
3604 if (vhost->reinit) { 3610 if (vhost->reinit && !ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) {
3605 vhost->reinit = 0; 3611 vhost->reinit = 0;
3612 scsi_block_requests(vhost->host);
3606 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); 3613 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
3607 } else { 3614 } else {
3608 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE); 3615 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE);
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index 4bf6e374f076..fb3177ab6691 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -29,8 +29,8 @@
29#include "viosrp.h" 29#include "viosrp.h"
30 30
31#define IBMVFC_NAME "ibmvfc" 31#define IBMVFC_NAME "ibmvfc"
32#define IBMVFC_DRIVER_VERSION "1.0.1" 32#define IBMVFC_DRIVER_VERSION "1.0.2"
33#define IBMVFC_DRIVER_DATE "(July 11, 2008)" 33#define IBMVFC_DRIVER_DATE "(August 14, 2008)"
34 34
35#define IBMVFC_DEFAULT_TIMEOUT 15 35#define IBMVFC_DEFAULT_TIMEOUT 15
36#define IBMVFC_INIT_TIMEOUT 30 36#define IBMVFC_INIT_TIMEOUT 30
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 6b24b9cdb04c..7b1502c0ab6e 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1636,7 +1636,7 @@ static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev)
1636 unsigned long desired_io = max_requests * sizeof(union viosrp_iu); 1636 unsigned long desired_io = max_requests * sizeof(union viosrp_iu);
1637 1637
1638 /* add io space for sg data */ 1638 /* add io space for sg data */
1639 desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 1639 desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 512 *
1640 IBMVSCSI_CMDS_PER_LUN_DEFAULT); 1640 IBMVSCSI_CMDS_PER_LUN_DEFAULT);
1641 1641
1642 return desired_io; 1642 return desired_io;
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index fc7ac158476c..97b763378e7d 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * FILE : megaraid_sas.c 12 * FILE : megaraid_sas.c
13 * Version : v00.00.03.20-rc1 13 * Version : v00.00.04.01-rc1
14 * 14 *
15 * Authors: 15 * Authors:
16 * (email-id : megaraidlinux@lsi.com) 16 * (email-id : megaraidlinux@lsi.com)
@@ -71,6 +71,10 @@ static struct pci_device_id megasas_pci_table[] = {
71 /* ppc IOP */ 71 /* ppc IOP */
72 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)}, 72 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)},
73 /* ppc IOP */ 73 /* ppc IOP */
74 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078GEN2)},
75 /* gen2*/
76 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS0079GEN2)},
77 /* gen2*/
74 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)}, 78 {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)},
75 /* xscale IOP, vega */ 79 /* xscale IOP, vega */
76 {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)}, 80 {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)},
@@ -198,6 +202,9 @@ megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
198 */ 202 */
199 writel(status, &regs->outbound_intr_status); 203 writel(status, &regs->outbound_intr_status);
200 204
205 /* Dummy readl to force pci flush */
206 readl(&regs->outbound_intr_status);
207
201 return 0; 208 return 0;
202} 209}
203 210
@@ -293,6 +300,9 @@ megasas_clear_intr_ppc(struct megasas_register_set __iomem * regs)
293 */ 300 */
294 writel(status, &regs->outbound_doorbell_clear); 301 writel(status, &regs->outbound_doorbell_clear);
295 302
303 /* Dummy readl to force pci flush */
304 readl(&regs->outbound_doorbell_clear);
305
296 return 0; 306 return 0;
297} 307}
298/** 308/**
@@ -318,6 +328,99 @@ static struct megasas_instance_template megasas_instance_template_ppc = {
318}; 328};
319 329
320/** 330/**
331* The following functions are defined for gen2 (deviceid : 0x78 0x79)
332* controllers
333*/
334
335/**
336 * megasas_enable_intr_gen2 - Enables interrupts
337 * @regs: MFI register set
338 */
339static inline void
340megasas_enable_intr_gen2(struct megasas_register_set __iomem *regs)
341{
342 writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
343
344 /* write ~0x00000005 (4 & 1) to the intr mask*/
345 writel(~MFI_GEN2_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask);
346
347 /* Dummy readl to force pci flush */
348 readl(&regs->outbound_intr_mask);
349}
350
351/**
352 * megasas_disable_intr_gen2 - Disables interrupt
353 * @regs: MFI register set
354 */
355static inline void
356megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs)
357{
358 u32 mask = 0xFFFFFFFF;
359 writel(mask, &regs->outbound_intr_mask);
360 /* Dummy readl to force pci flush */
361 readl(&regs->outbound_intr_mask);
362}
363
364/**
365 * megasas_read_fw_status_reg_gen2 - returns the current FW status value
366 * @regs: MFI register set
367 */
368static u32
369megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem *regs)
370{
371 return readl(&(regs)->outbound_scratch_pad);
372}
373
374/**
375 * megasas_clear_interrupt_gen2 - Check & clear interrupt
376 * @regs: MFI register set
377 */
378static int
379megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
380{
381 u32 status;
382 /*
383 * Check if it is our interrupt
384 */
385 status = readl(&regs->outbound_intr_status);
386
387 if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK))
388 return 1;
389
390 /*
391 * Clear the interrupt by writing back the same value
392 */
393 writel(status, &regs->outbound_doorbell_clear);
394
395 /* Dummy readl to force pci flush */
396 readl(&regs->outbound_intr_status);
397
398 return 0;
399}
400/**
401 * megasas_fire_cmd_gen2 - Sends command to the FW
402 * @frame_phys_addr : Physical address of cmd
403 * @frame_count : Number of frames for the command
404 * @regs : MFI register set
405 */
406static inline void
407megasas_fire_cmd_gen2(dma_addr_t frame_phys_addr, u32 frame_count,
408 struct megasas_register_set __iomem *regs)
409{
410 writel((frame_phys_addr | (frame_count<<1))|1,
411 &(regs)->inbound_queue_port);
412}
413
414static struct megasas_instance_template megasas_instance_template_gen2 = {
415
416 .fire_cmd = megasas_fire_cmd_gen2,
417 .enable_intr = megasas_enable_intr_gen2,
418 .disable_intr = megasas_disable_intr_gen2,
419 .clear_intr = megasas_clear_intr_gen2,
420 .read_fw_status_reg = megasas_read_fw_status_reg_gen2,
421};
422
423/**
321* This is the end of set of functions & definitions 424* This is the end of set of functions & definitions
322* specific to ppc (deviceid : 0x60) controllers 425* specific to ppc (deviceid : 0x60) controllers
323*/ 426*/
@@ -1976,7 +2079,12 @@ static int megasas_init_mfi(struct megasas_instance *instance)
1976 /* 2079 /*
1977 * Map the message registers 2080 * Map the message registers
1978 */ 2081 */
1979 instance->base_addr = pci_resource_start(instance->pdev, 0); 2082 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) ||
2083 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) {
2084 instance->base_addr = pci_resource_start(instance->pdev, 1);
2085 } else {
2086 instance->base_addr = pci_resource_start(instance->pdev, 0);
2087 }
1980 2088
1981 if (pci_request_regions(instance->pdev, "megasas: LSI")) { 2089 if (pci_request_regions(instance->pdev, "megasas: LSI")) {
1982 printk(KERN_DEBUG "megasas: IO memory region busy!\n"); 2090 printk(KERN_DEBUG "megasas: IO memory region busy!\n");
@@ -1998,6 +2106,10 @@ static int megasas_init_mfi(struct megasas_instance *instance)
1998 case PCI_DEVICE_ID_LSI_SAS1078DE: 2106 case PCI_DEVICE_ID_LSI_SAS1078DE:
1999 instance->instancet = &megasas_instance_template_ppc; 2107 instance->instancet = &megasas_instance_template_ppc;
2000 break; 2108 break;
2109 case PCI_DEVICE_ID_LSI_SAS1078GEN2:
2110 case PCI_DEVICE_ID_LSI_SAS0079GEN2:
2111 instance->instancet = &megasas_instance_template_gen2;
2112 break;
2001 case PCI_DEVICE_ID_LSI_SAS1064R: 2113 case PCI_DEVICE_ID_LSI_SAS1064R:
2002 case PCI_DEVICE_ID_DELL_PERC5: 2114 case PCI_DEVICE_ID_DELL_PERC5:
2003 default: 2115 default:
@@ -2857,6 +2969,7 @@ static void megasas_shutdown(struct pci_dev *pdev)
2857{ 2969{
2858 struct megasas_instance *instance = pci_get_drvdata(pdev); 2970 struct megasas_instance *instance = pci_get_drvdata(pdev);
2859 megasas_flush_cache(instance); 2971 megasas_flush_cache(instance);
2972 megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN);
2860} 2973}
2861 2974
2862/** 2975/**
@@ -3292,7 +3405,7 @@ megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf, size_t coun
3292 return retval; 3405 return retval;
3293} 3406}
3294 3407
3295static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUGO, megasas_sysfs_show_dbg_lvl, 3408static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUSR, megasas_sysfs_show_dbg_lvl,
3296 megasas_sysfs_set_dbg_lvl); 3409 megasas_sysfs_set_dbg_lvl);
3297 3410
3298static ssize_t 3411static ssize_t
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index b0c41e671702..0d033248fdf1 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -18,9 +18,9 @@
18/* 18/*
19 * MegaRAID SAS Driver meta data 19 * MegaRAID SAS Driver meta data
20 */ 20 */
21#define MEGASAS_VERSION "00.00.03.20-rc1" 21#define MEGASAS_VERSION "00.00.04.01"
22#define MEGASAS_RELDATE "March 10, 2008" 22#define MEGASAS_RELDATE "July 24, 2008"
23#define MEGASAS_EXT_VERSION "Mon. March 10 11:02:31 PDT 2008" 23#define MEGASAS_EXT_VERSION "Thu July 24 11:41:51 PST 2008"
24 24
25/* 25/*
26 * Device IDs 26 * Device IDs
@@ -28,6 +28,8 @@
28#define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 28#define PCI_DEVICE_ID_LSI_SAS1078R 0x0060
29#define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C 29#define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C
30#define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 30#define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413
31#define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078
32#define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079
31 33
32/* 34/*
33 * ===================================== 35 * =====================================
@@ -580,6 +582,8 @@ struct megasas_ctrl_info {
580#define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) 582#define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10)
581 583
582#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 584#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
585#define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001
586#define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004)
583 587
584/* 588/*
585* register set for both 1068 and 1078 controllers 589* register set for both 1068 and 1078 controllers
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index a319a20ed440..45e7dcb4b34d 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -993,6 +993,17 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)
993{ 993{
994 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; 994 fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
995 995
996 /*
997 * At this point all fcport's software-states are cleared. Perform any
998 * final cleanup of firmware resources (PCBs and XCBs).
999 */
1000 if (fcport->loop_id != FC_NO_LOOP_ID) {
1001 fcport->ha->isp_ops->fabric_logout(fcport->ha, fcport->loop_id,
1002 fcport->d_id.b.domain, fcport->d_id.b.area,
1003 fcport->d_id.b.al_pa);
1004 fcport->loop_id = FC_NO_LOOP_ID;
1005 }
1006
996 qla2x00_abort_fcport_cmds(fcport); 1007 qla2x00_abort_fcport_cmds(fcport);
997 scsi_target_unblock(&rport->dev); 1008 scsi_target_unblock(&rport->dev);
998} 1009}
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6da31ba94404..94a720eabfd8 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2237,6 +2237,7 @@ typedef struct scsi_qla_host {
2237#define REGISTER_FDMI_NEEDED 26 2237#define REGISTER_FDMI_NEEDED 26
2238#define FCPORT_UPDATE_NEEDED 27 2238#define FCPORT_UPDATE_NEEDED 27
2239#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */ 2239#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */
2240#define UNLOADING 29
2240 2241
2241 uint32_t device_flags; 2242 uint32_t device_flags;
2242#define DFLG_LOCAL_DEVICES BIT_0 2243#define DFLG_LOCAL_DEVICES BIT_0
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 601a6b29750c..ee89ddd64aae 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -976,8 +976,9 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
976 &ha->fw_attributes, &ha->fw_memory_size); 976 &ha->fw_attributes, &ha->fw_memory_size);
977 qla2x00_resize_request_q(ha); 977 qla2x00_resize_request_q(ha);
978 ha->flags.npiv_supported = 0; 978 ha->flags.npiv_supported = 0;
979 if ((IS_QLA24XX(ha) || IS_QLA25XX(ha)) && 979 if ((IS_QLA24XX(ha) || IS_QLA25XX(ha) ||
980 (ha->fw_attributes & BIT_2)) { 980 IS_QLA84XX(ha)) &&
981 (ha->fw_attributes & BIT_2)) {
981 ha->flags.npiv_supported = 1; 982 ha->flags.npiv_supported = 1;
982 if ((!ha->max_npiv_vports) || 983 if ((!ha->max_npiv_vports) ||
983 ((ha->max_npiv_vports + 1) % 984 ((ha->max_npiv_vports + 1) %
@@ -3251,6 +3252,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3251{ 3252{
3252 int rval; 3253 int rval;
3253 uint8_t status = 0; 3254 uint8_t status = 0;
3255 scsi_qla_host_t *vha;
3254 3256
3255 if (ha->flags.online) { 3257 if (ha->flags.online) {
3256 ha->flags.online = 0; 3258 ha->flags.online = 0;
@@ -3265,6 +3267,8 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3265 if (atomic_read(&ha->loop_state) != LOOP_DOWN) { 3267 if (atomic_read(&ha->loop_state) != LOOP_DOWN) {
3266 atomic_set(&ha->loop_state, LOOP_DOWN); 3268 atomic_set(&ha->loop_state, LOOP_DOWN);
3267 qla2x00_mark_all_devices_lost(ha, 0); 3269 qla2x00_mark_all_devices_lost(ha, 0);
3270 list_for_each_entry(vha, &ha->vp_list, vp_list)
3271 qla2x00_mark_all_devices_lost(vha, 0);
3268 } else { 3272 } else {
3269 if (!atomic_read(&ha->loop_down_timer)) 3273 if (!atomic_read(&ha->loop_down_timer))
3270 atomic_set(&ha->loop_down_timer, 3274 atomic_set(&ha->loop_down_timer,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 874d802edb7d..45a3b93eed57 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -879,11 +879,12 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t sense_len)
879 sp->request_sense_ptr += sense_len; 879 sp->request_sense_ptr += sense_len;
880 sp->request_sense_length -= sense_len; 880 sp->request_sense_length -= sense_len;
881 if (sp->request_sense_length != 0) 881 if (sp->request_sense_length != 0)
882 sp->ha->status_srb = sp; 882 sp->fcport->ha->status_srb = sp;
883 883
884 DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) " 884 DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) "
885 "cmd=%p pid=%ld\n", __func__, sp->ha->host_no, cp->device->channel, 885 "cmd=%p pid=%ld\n", __func__, sp->fcport->ha->host_no,
886 cp->device->id, cp->device->lun, cp, cp->serial_number)); 886 cp->device->channel, cp->device->id, cp->device->lun, cp,
887 cp->serial_number));
887 if (sense_len) 888 if (sense_len)
888 DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, 889 DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
889 CMD_ACTUAL_SNSLEN(cp))); 890 CMD_ACTUAL_SNSLEN(cp)));
@@ -1184,9 +1185,8 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1184 atomic_read(&fcport->state))); 1185 atomic_read(&fcport->state)));
1185 1186
1186 cp->result = DID_BUS_BUSY << 16; 1187 cp->result = DID_BUS_BUSY << 16;
1187 if (atomic_read(&fcport->state) == FCS_ONLINE) { 1188 if (atomic_read(&fcport->state) == FCS_ONLINE)
1188 qla2x00_mark_device_lost(ha, fcport, 1, 1); 1189 qla2x00_mark_device_lost(fcport->ha, fcport, 1, 1);
1189 }
1190 break; 1190 break;
1191 1191
1192 case CS_RESET: 1192 case CS_RESET:
@@ -1229,7 +1229,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
1229 1229
1230 /* Check to see if logout occurred. */ 1230 /* Check to see if logout occurred. */
1231 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) 1231 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT))
1232 qla2x00_mark_device_lost(ha, fcport, 1, 1); 1232 qla2x00_mark_device_lost(fcport->ha, fcport, 1, 1);
1233 break; 1233 break;
1234 1234
1235 default: 1235 default:
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index bc90d6b8d0a0..813bc7784c0a 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2686,7 +2686,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha,
2686 set_bit(VP_IDX_ACQUIRED, &vha->vp_flags); 2686 set_bit(VP_IDX_ACQUIRED, &vha->vp_flags);
2687 set_bit(VP_DPC_NEEDED, &ha->dpc_flags); 2687 set_bit(VP_DPC_NEEDED, &ha->dpc_flags);
2688 2688
2689 wake_up_process(ha->dpc_thread); 2689 qla2xxx_wake_dpc(ha);
2690 } 2690 }
2691} 2691}
2692 2692
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 7c8af7ed2a5d..26afe44265c7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -780,7 +780,8 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha, unsigned int t,
780 sp = pha->outstanding_cmds[cnt]; 780 sp = pha->outstanding_cmds[cnt];
781 if (!sp) 781 if (!sp)
782 continue; 782 continue;
783 if (ha->vp_idx != sp->ha->vp_idx) 783
784 if (ha->vp_idx != sp->fcport->ha->vp_idx)
784 continue; 785 continue;
785 match = 0; 786 match = 0;
786 switch (type) { 787 switch (type) {
@@ -1080,9 +1081,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res)
1080 sp = ha->outstanding_cmds[cnt]; 1081 sp = ha->outstanding_cmds[cnt];
1081 if (sp) { 1082 if (sp) {
1082 ha->outstanding_cmds[cnt] = NULL; 1083 ha->outstanding_cmds[cnt] = NULL;
1083 sp->flags = 0;
1084 sp->cmd->result = res; 1084 sp->cmd->result = res;
1085 sp->cmd->host_scribble = (unsigned char *)NULL;
1086 qla2x00_sp_compl(ha, sp); 1085 qla2x00_sp_compl(ha, sp);
1087 } 1086 }
1088 } 1087 }
@@ -1776,10 +1775,15 @@ probe_out:
1776static void 1775static void
1777qla2x00_remove_one(struct pci_dev *pdev) 1776qla2x00_remove_one(struct pci_dev *pdev)
1778{ 1777{
1779 scsi_qla_host_t *ha; 1778 scsi_qla_host_t *ha, *vha, *temp;
1780 1779
1781 ha = pci_get_drvdata(pdev); 1780 ha = pci_get_drvdata(pdev);
1782 1781
1782 list_for_each_entry_safe(vha, temp, &ha->vp_list, vp_list)
1783 fc_vport_terminate(vha->fc_vport);
1784
1785 set_bit(UNLOADING, &ha->dpc_flags);
1786
1783 qla2x00_dfs_remove(ha); 1787 qla2x00_dfs_remove(ha);
1784 1788
1785 qla84xx_put_chip(ha); 1789 qla84xx_put_chip(ha);
@@ -2451,8 +2455,10 @@ qla2x00_do_dpc(void *data)
2451void 2455void
2452qla2xxx_wake_dpc(scsi_qla_host_t *ha) 2456qla2xxx_wake_dpc(scsi_qla_host_t *ha)
2453{ 2457{
2454 if (ha->dpc_thread) 2458 struct task_struct *t = ha->dpc_thread;
2455 wake_up_process(ha->dpc_thread); 2459
2460 if (!test_bit(UNLOADING, &ha->dpc_flags) && t)
2461 wake_up_process(t);
2456} 2462}
2457 2463
2458/* 2464/*
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 676c390db354..4160e4caa7b9 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.01-k6" 10#define QLA2XXX_VERSION "8.02.01-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