diff options
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 29 | ||||
-rw-r--r-- | drivers/message/fusion/mptbase.h | 5 | ||||
-rw-r--r-- | drivers/message/fusion/mptsas.c | 22 | ||||
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 130 | ||||
-rw-r--r-- | drivers/message/fusion/mptscsih.h | 2 |
5 files changed, 111 insertions, 77 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index c6be6eba7dc..db3c892f87f 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -79,7 +79,7 @@ MODULE_VERSION(my_VERSION); /* * cmd line parameters */ -static int mpt_msi_enable; +static int mpt_msi_enable = -1; module_param(mpt_msi_enable, int, 0); MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)"); @@ -1686,6 +1686,11 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) ioc->bus_type = SAS; } + if (ioc->bus_type == SAS && mpt_msi_enable == -1) + ioc->msi_enable = 1; + else + ioc->msi_enable = mpt_msi_enable; + if (ioc->errata_flag_1064) pci_disable_io_access(pdev); @@ -1831,7 +1836,7 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state) CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); free_irq(ioc->pci_irq, ioc); - if (mpt_msi_enable) + if (ioc->msi_enable) pci_disable_msi(ioc->pcidev); ioc->pci_irq = -1; pci_save_state(pdev); @@ -2057,15 +2062,17 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) { ioc->pci_irq = -1; if (ioc->pcidev->irq) { - if (mpt_msi_enable && !pci_enable_msi(ioc->pcidev)) + if (ioc->msi_enable && !pci_enable_msi(ioc->pcidev)) printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name); + else + ioc->msi_enable = 0; rc = request_irq(ioc->pcidev->irq, mpt_interrupt, IRQF_SHARED, ioc->name, ioc); if (rc < 0) { printk(MYIOC_s_ERR_FMT "Unable to allocate " "interrupt %d!\n", ioc->name, ioc->pcidev->irq); - if (mpt_msi_enable) + if (ioc->msi_enable) pci_disable_msi(ioc->pcidev); return -EBUSY; } @@ -2173,7 +2180,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) /* * Initalize link list for inactive raid volumes. */ - init_MUTEX(&ioc->raid_data.inactive_list_mutex); + mutex_init(&ioc->raid_data.inactive_list_mutex); INIT_LIST_HEAD(&ioc->raid_data.inactive_list); if (ioc->bus_type == SAS) { @@ -2261,7 +2268,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) out: if ((ret != 0) && irq_allocated) { free_irq(ioc->pci_irq, ioc); - if (mpt_msi_enable) + if (ioc->msi_enable) pci_disable_msi(ioc->pcidev); } return ret; @@ -2443,7 +2450,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc) if (ioc->pci_irq != -1) { free_irq(ioc->pci_irq, ioc); - if (mpt_msi_enable) + if (ioc->msi_enable) pci_disable_msi(ioc->pcidev); ioc->pci_irq = -1; } @@ -5159,13 +5166,13 @@ mpt_inactive_raid_list_free(MPT_ADAPTER *ioc) if (list_empty(&ioc->raid_data.inactive_list)) return; - down(&ioc->raid_data.inactive_list_mutex); + mutex_lock(&ioc->raid_data.inactive_list_mutex); list_for_each_entry_safe(component_info, pNext, &ioc->raid_data.inactive_list, list) { list_del(&component_info->list); kfree(component_info); } - up(&ioc->raid_data.inactive_list_mutex); + mutex_unlock(&ioc->raid_data.inactive_list_mutex); } /** @@ -5224,7 +5231,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id) if (!handle_inactive_volumes) goto out; - down(&ioc->raid_data.inactive_list_mutex); + mutex_lock(&ioc->raid_data.inactive_list_mutex); for (i = 0; i < buffer->NumPhysDisks; i++) { if(mpt_raid_phys_disk_pg0(ioc, buffer->PhysDisk[i].PhysDiskNum, &phys_disk) != 0) @@ -5244,7 +5251,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id) list_add_tail(&component_info->list, &ioc->raid_data.inactive_list); } - up(&ioc->raid_data.inactive_list_mutex); + mutex_unlock(&ioc->raid_data.inactive_list_mutex); out: if (buffer) diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index caadc68c300..a8f617447d2 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -51,6 +51,7 @@ #include <linux/kernel.h> #include <linux/pci.h> +#include <linux/mutex.h> #include "lsi/mpi_type.h" #include "lsi/mpi.h" /* Fusion MPI(nterface) basic defs */ @@ -531,7 +532,7 @@ struct inactive_raid_component_info { typedef struct _RaidCfgData { IOCPage2_t *pIocPg2; /* table of Raid Volumes */ IOCPage3_t *pIocPg3; /* table of physical disks */ - struct semaphore inactive_list_mutex; + struct mutex inactive_list_mutex; struct list_head inactive_list; /* link list for physical disk that belong in inactive volumes */ @@ -630,6 +631,7 @@ typedef struct _MPT_ADAPTER int mtrr_reg; struct pci_dev *pcidev; /* struct pci_dev pointer */ int bars; /* bitmask of BAR's that must be configured */ + int msi_enable; u8 __iomem *memmap; /* mmap address */ struct Scsi_Host *sh; /* Scsi Host pointer */ SpiCfgData spi_data; /* Scsi config. data */ @@ -693,7 +695,6 @@ typedef struct _MPT_ADAPTER struct mutex sas_discovery_mutex; u8 sas_discovery_runtime; u8 sas_discovery_ignore_events; - u16 handle; int sas_index; /* index refrencing */ MPT_SAS_MGMT sas_mgmt; struct work_struct sas_persist_task; diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 78734e25edd..468480771f1 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -230,6 +230,20 @@ static inline MPT_ADAPTER *rphy_to_ioc(struct sas_rphy *rphy) return ((MPT_SCSI_HOST *)shost->hostdata)->ioc; } +static struct mptsas_portinfo * +mptsas_get_hba_portinfo(MPT_ADAPTER *ioc) +{ + struct list_head *head = &ioc->sas_topology; + struct mptsas_portinfo *pi = NULL; + + /* always the first entry on sas_topology list */ + + if (!list_empty(head)) + pi = list_entry(head->next, struct mptsas_portinfo, list); + + return pi; +} + /* * mptsas_find_portinfo_by_handle * @@ -1290,7 +1304,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, struct mptsas_portinfo *port_info; mutex_lock(&ioc->sas_topology_mutex); - port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle); + port_info = mptsas_get_hba_portinfo(ioc); if (port_info && port_info->phy_info) sas_address = port_info->phy_info[0].phy->identify.sas_address; @@ -2028,8 +2042,7 @@ static int mptsas_probe_one_phy(struct device *dev, int i; mutex_lock(&ioc->sas_topology_mutex); - port_info = mptsas_find_portinfo_by_handle(ioc, - ioc->handle); + port_info = mptsas_get_hba_portinfo(ioc); mutex_unlock(&ioc->sas_topology_mutex); for (i = 0; i < port_info->num_phys; i++) @@ -2099,8 +2112,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc) mptsas_sas_io_unit_pg1(ioc); mutex_lock(&ioc->sas_topology_mutex); - ioc->handle = hba->phy_info[0].handle; - port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle); + port_info = mptsas_get_hba_portinfo(ioc); if (!port_info) { port_info = hba; list_add_tail(&port_info->list, &ioc->sas_topology); diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index c207bda6723..b109bd8a4d1 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -2304,14 +2304,14 @@ mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id) if (list_empty(&ioc->raid_data.inactive_list)) goto out; - down(&ioc->raid_data.inactive_list_mutex); + mutex_lock(&ioc->raid_data.inactive_list_mutex); list_for_each_entry(component_info, &ioc->raid_data.inactive_list, list) { if ((component_info->d.PhysDiskID == id) && (component_info->d.PhysDiskBus == channel)) rc = 1; } - up(&ioc->raid_data.inactive_list_mutex); + mutex_unlock(&ioc->raid_data.inactive_list_mutex); out: return rc; @@ -2341,14 +2341,14 @@ mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id) if (list_empty(&ioc->raid_data.inactive_list)) goto out; - down(&ioc->raid_data.inactive_list_mutex); + mutex_lock(&ioc->raid_data.inactive_list_mutex); list_for_each_entry(component_info, &ioc->raid_data.inactive_list, list) { if ((component_info->d.PhysDiskID == id) && (component_info->d.PhysDiskBus == channel)) rc = component_info->d.PhysDiskNum; } - up(&ioc->raid_data.inactive_list_mutex); + mutex_unlock(&ioc->raid_data.inactive_list_mutex); out: return rc; @@ -3300,9 +3300,10 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice) } static ssize_t -mptscsih_version_fw_show(struct class_device *cdev, char *buf) +mptscsih_version_fw_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; @@ -3312,12 +3313,13 @@ mptscsih_version_fw_show(struct class_device *cdev, char *buf) (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, ioc->facts.FWVersion.Word & 0x000000FF); } -static CLASS_DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL); +static DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL); static ssize_t -mptscsih_version_bios_show(struct class_device *cdev, char *buf) +mptscsih_version_bios_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; @@ -3327,129 +3329,141 @@ mptscsih_version_bios_show(struct class_device *cdev, char *buf) (ioc->biosVersion & 0x0000FF00) >> 8, ioc->biosVersion & 0x000000FF); } -static CLASS_DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL); +static DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL); static ssize_t -mptscsih_version_mpi_show(struct class_device *cdev, char *buf) +mptscsih_version_mpi_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion); } -static CLASS_DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL); +static DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL); static ssize_t -mptscsih_version_product_show(struct class_device *cdev, char *buf) +mptscsih_version_product_show(struct device *dev, + struct device_attribute *attr, +char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name); } -static CLASS_DEVICE_ATTR(version_product, S_IRUGO, +static DEVICE_ATTR(version_product, S_IRUGO, mptscsih_version_product_show, NULL); static ssize_t -mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf) +mptscsih_version_nvdata_persistent_show(struct device *dev, + struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%02xh\n", ioc->nvdata_version_persistent); } -static CLASS_DEVICE_ATTR(version_nvdata_persistent, S_IRUGO, +static DEVICE_ATTR(version_nvdata_persistent, S_IRUGO, mptscsih_version_nvdata_persistent_show, NULL); static ssize_t -mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf) +mptscsih_version_nvdata_default_show(struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default); } -static CLASS_DEVICE_ATTR(version_nvdata_default, S_IRUGO, +static DEVICE_ATTR(version_nvdata_default, S_IRUGO, mptscsih_version_nvdata_default_show, NULL); static ssize_t -mptscsih_board_name_show(struct class_device *cdev, char *buf) +mptscsih_board_name_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name); } -static CLASS_DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL); +static DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL); static ssize_t -mptscsih_board_assembly_show(struct class_device *cdev, char *buf) +mptscsih_board_assembly_show(struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly); } -static CLASS_DEVICE_ATTR(board_assembly, S_IRUGO, +static DEVICE_ATTR(board_assembly, S_IRUGO, mptscsih_board_assembly_show, NULL); static ssize_t -mptscsih_board_tracer_show(struct class_device *cdev, char *buf) +mptscsih_board_tracer_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer); } -static CLASS_DEVICE_ATTR(board_tracer, S_IRUGO, +static DEVICE_ATTR(board_tracer, S_IRUGO, mptscsih_board_tracer_show, NULL); static ssize_t -mptscsih_io_delay_show(struct class_device *cdev, char *buf) +mptscsih_io_delay_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay); } -static CLASS_DEVICE_ATTR(io_delay, S_IRUGO, +static DEVICE_ATTR(io_delay, S_IRUGO, mptscsih_io_delay_show, NULL); static ssize_t -mptscsih_device_delay_show(struct class_device *cdev, char *buf) +mptscsih_device_delay_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay); } -static CLASS_DEVICE_ATTR(device_delay, S_IRUGO, +static DEVICE_ATTR(device_delay, S_IRUGO, mptscsih_device_delay_show, NULL); static ssize_t -mptscsih_debug_level_show(struct class_device *cdev, char *buf) +mptscsih_debug_level_show(struct device *dev, struct device_attribute *attr, + char *buf) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level); } static ssize_t -mptscsih_debug_level_store(struct class_device *cdev, const char *buf, - size_t count) +mptscsih_debug_level_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - struct Scsi_Host *host = class_to_shost(cdev); + struct Scsi_Host *host = class_to_shost(dev); MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; int val = 0; @@ -3462,22 +3476,22 @@ mptscsih_debug_level_store(struct class_device *cdev, const char *buf, ioc->name, ioc->debug_level); return strlen(buf); } -static CLASS_DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR, - mptscsih_debug_level_show, mptscsih_debug_level_store); - -struct class_device_attribute *mptscsih_host_attrs[] = { - &class_device_attr_version_fw, - &class_device_attr_version_bios, - &class_device_attr_version_mpi, - &class_device_attr_version_product, - &class_device_attr_version_nvdata_persistent, - &class_device_attr_version_nvdata_default, - &class_device_attr_board_name, - &class_device_attr_board_assembly, - &class_device_attr_board_tracer, - &class_device_attr_io_delay, - &class_device_attr_device_delay, - &class_device_attr_debug_level, +static DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR, + mptscsih_debug_level_show, mptscsih_debug_level_store); + +struct device_attribute *mptscsih_host_attrs[] = { + &dev_attr_version_fw, + &dev_attr_version_bios, + &dev_attr_version_mpi, + &dev_attr_version_product, + &dev_attr_version_nvdata_persistent, + &dev_attr_version_nvdata_default, + &dev_attr_board_name, + &dev_attr_board_assembly, + &dev_attr_board_tracer, + &dev_attr_io_delay, + &dev_attr_device_delay, + &dev_attr_debug_level, NULL, }; EXPORT_SYMBOL(mptscsih_host_attrs); diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index d289e97cfe8..7ea7da0e090 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h @@ -129,4 +129,4 @@ extern void mptscsih_timer_expired(unsigned long data); extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout); extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); -extern struct class_device_attribute *mptscsih_host_attrs[]; +extern struct device_attribute *mptscsih_host_attrs[]; |