Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6:
  [SCSI] SCSI core: better initialization for sdev->scsi_level
  [SCSI] scsi_proc.c: display sdev->scsi_level correctly
  [SCSI] megaraid_sas: update version and author info
  [SCSI] megaraid_sas: return sync cache call with success
  [SCSI] megaraid_sas: replace pci_alloc_consitent with dma_alloc_coherent in ioctl path
  [SCSI] megaraid_sas: add bios_param in scsi_host_template
  [SCSI] megaraid_sas: do not process cmds if hw_crit_error is set
  [SCSI] scsi_transport.h should include scsi_device.h
  [SCSI] aic79xx: remove extra newline from info message
  [SCSI] scsi_scan.c: handle bad inquiry responses
  [SCSI] aic94xx: tie driver to the major number of the sequencer firmware
  [SCSI] lpfc: add PCI error recovery support
  [SCSI] megaraid: pci_module_init to pci_register_driver
  [SCSI] tgt: fix the user/kernel ring buffer interface
  [SCSI] sgiwd93: interfacing to wd33c93
  [SCSI] wd33c93: Fast SCSI with WD33C93B
  • Loading branch information
Linus Torvalds committed Feb 19, 2007
2 parents d43a338 + 7c9d6f1 commit 5fc7724
Show file tree
Hide file tree
Showing 17 changed files with 481 additions and 106 deletions.
1 change: 0 additions & 1 deletion drivers/scsi/aic7xxx/aic79xx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ ahd_linux_info(struct Scsi_Host *host)
strcat(bp, " ");
ahd_controller_info(ahd, ahd_info);
strcat(bp, ahd_info);
strcat(bp, "\n");

return (bp);
}
Expand Down
13 changes: 10 additions & 3 deletions drivers/scsi/aic94xx/aic94xx_seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#define PAUSE_TRIES 1000

static const struct firmware *sequencer_fw;
static const char *sequencer_version;
static u16 cseq_vecs[CSEQ_NUM_VECS], lseq_vecs[LSEQ_NUM_VECS], mode2_task,
cseq_idle_loop, lseq_idle_loop;
static u8 *cseq_code, *lseq_code;
Expand Down Expand Up @@ -1276,7 +1275,6 @@ static int asd_request_firmware(struct asd_ha_struct *asd_ha)
header.csum = le32_to_cpu(hdr_ptr->csum);
header.major = le32_to_cpu(hdr_ptr->major);
header.minor = le32_to_cpu(hdr_ptr->minor);
sequencer_version = hdr_ptr->version;
header.cseq_table_offset = le32_to_cpu(hdr_ptr->cseq_table_offset);
header.cseq_table_size = le32_to_cpu(hdr_ptr->cseq_table_size);
header.lseq_table_offset = le32_to_cpu(hdr_ptr->lseq_table_offset);
Expand All @@ -1303,6 +1301,16 @@ static int asd_request_firmware(struct asd_ha_struct *asd_ha)
return -EINVAL;
}

asd_printk("Found sequencer Firmware version %d.%d (%s)\n",
header.major, header.minor, hdr_ptr->version);

if (header.major != SAS_RAZOR_SEQUENCER_FW_MAJOR) {
asd_printk("Firmware Major Version Mismatch;"
"driver requires version %d.X",
SAS_RAZOR_SEQUENCER_FW_MAJOR);
return -EINVAL;
}

ptr_cseq_vecs = (u16 *)&sequencer_fw->data[header.cseq_table_offset];
ptr_lseq_vecs = (u16 *)&sequencer_fw->data[header.lseq_table_offset];
mode2_task = header.mode2_task;
Expand Down Expand Up @@ -1335,7 +1343,6 @@ int asd_init_seqs(struct asd_ha_struct *asd_ha)
return err;
}

asd_printk("using sequencer %s\n", sequencer_version);
err = asd_seq_download_seqs(asd_ha);
if (err) {
asd_printk("couldn't download sequencers for %s\n",
Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/aic94xx/aic94xx_seq.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define LSEQ_NUM_VECS 11

#define SAS_RAZOR_SEQUENCER_FW_FILE "aic94xx-seq.fw"
#define SAS_RAZOR_SEQUENCER_FW_MAJOR 1

/* Note: All quantites in the sequencer file are little endian */
struct sequencer_file_header {
Expand Down
97 changes: 97 additions & 0 deletions drivers/scsi/lpfc/lpfc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
struct lpfc_sli *psli = &phba->sli;
struct lpfc_sli_ring *pring;
uint32_t event_data;
/* If the pci channel is offline, ignore possible errors,
* since we cannot communicate with the pci card anyway. */
if (pci_channel_offline(phba->pcidev))
return;

if (phba->work_hs & HS_FFER6 ||
phba->work_hs & HS_FFER5) {
Expand Down Expand Up @@ -1797,6 +1801,92 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
}

/**
* lpfc_io_error_detected - called when PCI error is detected
* @pdev: Pointer to PCI device
* @state: The current pci conneection state
*
* This function is called after a PCI bus error affecting
* this device has been detected.
*/
static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{
struct Scsi_Host *host = pci_get_drvdata(pdev);
struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata;
struct lpfc_sli *psli = &phba->sli;
struct lpfc_sli_ring *pring;

if (state == pci_channel_io_perm_failure) {
lpfc_pci_remove_one(pdev);
return PCI_ERS_RESULT_DISCONNECT;
}
pci_disable_device(pdev);
/*
* There may be I/Os dropped by the firmware.
* Error iocb (I/O) on txcmplq and let the SCSI layer
* retry it after re-establishing link.
*/
pring = &psli->ring[psli->fcp_ring];
lpfc_sli_abort_iocb_ring(phba, pring);

/* Request a slot reset. */
return PCI_ERS_RESULT_NEED_RESET;
}

/**
* lpfc_io_slot_reset - called after the pci bus has been reset.
* @pdev: Pointer to PCI device
*
* Restart the card from scratch, as if from a cold-boot.
*/
static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
{
struct Scsi_Host *host = pci_get_drvdata(pdev);
struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata;
struct lpfc_sli *psli = &phba->sli;
int bars = pci_select_bars(pdev, IORESOURCE_MEM);

dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n");
if (pci_enable_device_bars(pdev, bars)) {
printk(KERN_ERR "lpfc: Cannot re-enable "
"PCI device after reset.\n");
return PCI_ERS_RESULT_DISCONNECT;
}

pci_set_master(pdev);

/* Re-establishing Link */
spin_lock_irq(phba->host->host_lock);
phba->fc_flag |= FC_ESTABLISH_LINK;
psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
spin_unlock_irq(phba->host->host_lock);


/* Take device offline; this will perform cleanup */
lpfc_offline(phba);
lpfc_sli_brdrestart(phba);

return PCI_ERS_RESULT_RECOVERED;
}

/**
* lpfc_io_resume - called when traffic can start flowing again.
* @pdev: Pointer to PCI device
*
* This callback is called when the error recovery driver tells us that
* its OK to resume normal operation.
*/
static void lpfc_io_resume(struct pci_dev *pdev)
{
struct Scsi_Host *host = pci_get_drvdata(pdev);
struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata;

if (lpfc_online(phba) == 0) {
mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60);
}
}

static struct pci_device_id lpfc_id_table[] = {
{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER,
PCI_ANY_ID, PCI_ANY_ID, },
Expand Down Expand Up @@ -1857,11 +1947,18 @@ static struct pci_device_id lpfc_id_table[] = {

MODULE_DEVICE_TABLE(pci, lpfc_id_table);

static struct pci_error_handlers lpfc_err_handler = {
.error_detected = lpfc_io_error_detected,
.slot_reset = lpfc_io_slot_reset,
.resume = lpfc_io_resume,
};

static struct pci_driver lpfc_driver = {
.name = LPFC_DRIVER_NAME,
.id_table = lpfc_id_table,
.probe = lpfc_pci_probe_one,
.remove = __devexit_p(lpfc_pci_remove_one),
.err_handler = &lpfc_err_handler,
};

static int __init
Expand Down
12 changes: 12 additions & 0 deletions drivers/scsi/lpfc/lpfc_sli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,10 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
volatile uint32_t word0, ldata;
void __iomem *to_slim;

/* If the PCI channel is in offline state, do not post mbox. */
if (unlikely(pci_channel_offline(phba->pcidev)))
return MBX_NOT_FINISHED;

psli = &phba->sli;

spin_lock_irqsave(phba->host->host_lock, drvr_flag);
Expand Down Expand Up @@ -2407,6 +2411,10 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *nextiocb;
IOCB_t *iocb;

/* If the PCI channel is in offline state, do not post iocbs. */
if (unlikely(pci_channel_offline(phba->pcidev)))
return IOCB_ERROR;

/*
* We should never get an IOCB if we are in a < LINK_DOWN state
*/
Expand Down Expand Up @@ -3154,6 +3162,10 @@ lpfc_intr_handler(int irq, void *dev_id)
if (unlikely(!phba))
return IRQ_NONE;

/* If the pci channel is offline, ignore all the interrupts. */
if (unlikely(pci_channel_offline(phba->pcidev)))
return IRQ_NONE;

phba->sli.slistat.sli_intr++;

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/megaraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -5072,7 +5072,7 @@ static int __init megaraid_init(void)
"megaraid: failed to create megaraid root\n");
}
#endif
error = pci_module_init(&megaraid_pci_driver);
error = pci_register_driver(&megaraid_pci_driver);
if (error) {
#ifdef CONFIG_PROC_FS
remove_proc_entry("megaraid", &proc_root);
Expand Down
90 changes: 80 additions & 10 deletions drivers/scsi/megaraid/megaraid_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
* 2 of the License, or (at your option) any later version.
*
* FILE : megaraid_sas.c
* Version : v00.00.03.05
* Version : v00.00.03.10-rc1
*
* Authors:
* Sreenivas Bagalkote <Sreenivas.Bagalkote@lsi.com>
* Sumant Patro <Sumant.Patro@lsi.com>
* (email-id : megaraidlinux@lsi.com)
* Sreenivas Bagalkote
* Sumant Patro
* Bo Yang
*
* List of supported controllers
*
Expand All @@ -35,6 +37,7 @@
#include <asm/uaccess.h>
#include <linux/fs.h>
#include <linux/compat.h>
#include <linux/blkdev.h>
#include <linux/mutex.h>

#include <scsi/scsi.h>
Expand Down Expand Up @@ -841,6 +844,11 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))

instance = (struct megasas_instance *)
scmd->device->host->hostdata;

/* Don't process if we have already declared adapter dead */
if (instance->hw_crit_error)
return SCSI_MLQUEUE_HOST_BUSY;

scmd->scsi_done = done;
scmd->result = 0;

Expand All @@ -850,6 +858,18 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
goto out_done;
}

switch (scmd->cmnd[0]) {
case SYNCHRONIZE_CACHE:
/*
* FW takes care of flush cache on its own
* No need to send it down
*/
scmd->result = DID_OK << 16;
goto out_done;
default:
break;
}

cmd = megasas_get_cmd(instance);
if (!cmd)
return SCSI_MLQUEUE_HOST_BUSY;
Expand Down Expand Up @@ -1009,6 +1029,49 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
return ret;
}

/**
* megasas_bios_param - Returns disk geometry for a disk
* @sdev: device handle
* @bdev: block device
* @capacity: drive capacity
* @geom: geometry parameters
*/
static int
megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int geom[])
{
int heads;
int sectors;
sector_t cylinders;
unsigned long tmp;
/* Default heads (64) & sectors (32) */
heads = 64;
sectors = 32;

tmp = heads * sectors;
cylinders = capacity;

sector_div(cylinders, tmp);

/*
* Handle extended translation size for logical drives > 1Gb
*/

if (capacity >= 0x200000) {
heads = 255;
sectors = 63;
tmp = heads*sectors;
cylinders = capacity;
sector_div(cylinders, tmp);
}

geom[0] = heads;
geom[1] = sectors;
geom[2] = cylinders;

return 0;
}

/**
* megasas_service_aen - Processes an event notification
* @instance: Adapter soft state
Expand Down Expand Up @@ -1049,6 +1112,7 @@ static struct scsi_host_template megasas_template = {
.eh_device_reset_handler = megasas_reset_device,
.eh_bus_reset_handler = megasas_reset_bus_host,
.eh_host_reset_handler = megasas_reset_bus_host,
.bios_param = megasas_bios_param,
.use_clustering = ENABLE_CLUSTERING,
};

Expand Down Expand Up @@ -1282,11 +1346,13 @@ megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
if(instance->instancet->clear_intr(instance->reg_set))
return IRQ_NONE;

if (instance->hw_crit_error)
goto out_done;
/*
* Schedule the tasklet for cmd completion
*/
tasklet_schedule(&instance->isr_tasklet);

out_done:
return IRQ_HANDLED;
}

Expand Down Expand Up @@ -1741,6 +1807,10 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
struct megasas_cmd *cmd;
struct megasas_instance *instance = (struct megasas_instance *)instance_addr;

/* If we have already declared adapter dead, donot complete cmds */
if (instance->hw_crit_error)
return;

producer = *instance->producer;
consumer = *instance->consumer;

Expand Down Expand Up @@ -2655,9 +2725,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
* For each user buffer, create a mirror buffer and copy in
*/
for (i = 0; i < ioc->sge_count; i++) {
kbuff_arr[i] = pci_alloc_consistent(instance->pdev,
kbuff_arr[i] = dma_alloc_coherent(&instance->pdev->dev,
ioc->sgl[i].iov_len,
&buf_handle);
&buf_handle, GFP_KERNEL);
if (!kbuff_arr[i]) {
printk(KERN_DEBUG "megasas: Failed to alloc "
"kernel SGL buffer for IOCTL \n");
Expand All @@ -2684,8 +2754,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
}

if (ioc->sense_len) {
sense = pci_alloc_consistent(instance->pdev, ioc->sense_len,
&sense_handle);
sense = dma_alloc_coherent(&instance->pdev->dev, ioc->sense_len,
&sense_handle, GFP_KERNEL);
if (!sense) {
error = -ENOMEM;
goto out;
Expand Down Expand Up @@ -2744,12 +2814,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,

out:
if (sense) {
pci_free_consistent(instance->pdev, ioc->sense_len,
dma_free_coherent(&instance->pdev->dev, ioc->sense_len,
sense, sense_handle);
}

for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
pci_free_consistent(instance->pdev,
dma_free_coherent(&instance->pdev->dev,
kern_sge32[i].length,
kbuff_arr[i], kern_sge32[i].phys_addr);
}
Expand Down
Loading

0 comments on commit 5fc7724

Please sign in to comment.