]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/ipr.c
[SCSI] ipr: Prevent upper layer driver binding
[linux-2.6-omap-h63xx.git] / drivers / scsi / ipr.c
index 80d022625c82e25ccb8eb06f905631746e3d7113..63d01e6394a209293a93ebe69bb7dfaddb9a1362 100644 (file)
@@ -889,24 +889,23 @@ static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd)
 
 /**
  * ipr_log_vpd - Log the passed VPD to the error log.
- * @vpids:                     vendor/product id struct
- * @serial_num:                serial number string
+ * @vpd:               vendor/product id/sn struct
  *
  * Return value:
  *     none
  **/
-static void ipr_log_vpd(struct ipr_std_inq_vpids *vpids, u8 *serial_num)
+static void ipr_log_vpd(struct ipr_vpd *vpd)
 {
        char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN
                    + IPR_SERIAL_NUM_LEN];
 
-       memcpy(buffer, vpids->vendor_id, IPR_VENDOR_ID_LEN);
-       memcpy(buffer + IPR_VENDOR_ID_LEN, vpids->product_id,
+       memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);
+       memcpy(buffer + IPR_VENDOR_ID_LEN, vpd->vpids.product_id,
               IPR_PROD_ID_LEN);
        buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN] = '\0';
        ipr_err("Vendor/Product ID: %s\n", buffer);
 
-       memcpy(buffer, serial_num, IPR_SERIAL_NUM_LEN);
+       memcpy(buffer, vpd->sn, IPR_SERIAL_NUM_LEN);
        buffer[IPR_SERIAL_NUM_LEN] = '\0';
        ipr_err("    Serial Number: %s\n", buffer);
 }
@@ -927,17 +926,15 @@ static void ipr_log_cache_error(struct ipr_ioa_cfg *ioa_cfg,
 
        ipr_err("-----Current Configuration-----\n");
        ipr_err("Cache Directory Card Information:\n");
-       ipr_log_vpd(&error->ioa_vpids, error->ioa_sn);
+       ipr_log_vpd(&error->ioa_vpd);
        ipr_err("Adapter Card Information:\n");
-       ipr_log_vpd(&error->cfc_vpids, error->cfc_sn);
+       ipr_log_vpd(&error->cfc_vpd);
 
        ipr_err("-----Expected Configuration-----\n");
        ipr_err("Cache Directory Card Information:\n");
-       ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpids,
-                   error->ioa_last_attached_to_cfc_sn);
+       ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpd);
        ipr_err("Adapter Card Information:\n");
-       ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpids,
-                   error->cfc_last_attached_to_ioa_sn);
+       ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpd);
 
        ipr_err("Additional IOA Data: %08X %08X %08X\n",
                     be32_to_cpu(error->ioa_data[0]),
@@ -966,30 +963,22 @@ static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,
        ipr_err("Device Errors Detected/Logged: %d/%d\n",
                be32_to_cpu(error->errors_detected), errors_logged);
 
-       dev_entry = error->dev_entry;
+       dev_entry = error->dev;
 
        for (i = 0; i < errors_logged; i++, dev_entry++) {
                ipr_err_separator;
 
-               if (dev_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
-                       ipr_err("Device %d: missing\n", i + 1);
-               } else {
-                       ipr_err("Device %d: %d:%d:%d:%d\n", i + 1,
-                               ioa_cfg->host->host_no, dev_entry->dev_res_addr.bus,
-                               dev_entry->dev_res_addr.target, dev_entry->dev_res_addr.lun);
-               }
-               ipr_log_vpd(&dev_entry->dev_vpids, dev_entry->dev_sn);
+               ipr_phys_res_err(ioa_cfg, dev_entry->dev_res_addr, "Device %d", i + 1);
+               ipr_log_vpd(&dev_entry->vpd);
 
                ipr_err("-----New Device Information-----\n");
-               ipr_log_vpd(&dev_entry->new_dev_vpids, dev_entry->new_dev_sn);
+               ipr_log_vpd(&dev_entry->new_vpd);
 
                ipr_err("Cache Directory Card Information:\n");
-               ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpids,
-                           dev_entry->ioa_last_with_dev_sn);
+               ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpd);
 
                ipr_err("Adapter Card Information:\n");
-               ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpids,
-                           dev_entry->cfc_last_with_dev_sn);
+               ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpd);
 
                ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n",
                        be32_to_cpu(dev_entry->ioa_data[0]),
@@ -1032,36 +1021,19 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
        array_entry = error->array_member;
 
        for (i = 0; i < 18; i++) {
-               if (!memcmp(array_entry->serial_num, zero_sn, IPR_SERIAL_NUM_LEN))
+               if (!memcmp(array_entry->vpd.sn, zero_sn, IPR_SERIAL_NUM_LEN))
                        continue;
 
-               if (be32_to_cpu(error->exposed_mode_adn) == i) {
+               if (be32_to_cpu(error->exposed_mode_adn) == i)
                        ipr_err("Exposed Array Member %d:\n", i);
-               } else {
+               else
                        ipr_err("Array Member %d:\n", i);
-               }
-
-               ipr_log_vpd(&array_entry->vpids, array_entry->serial_num);
 
-               if (array_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
-                       ipr_err("Current Location: unknown\n");
-               } else {
-                       ipr_err("Current Location: %d:%d:%d:%d\n",
-                               ioa_cfg->host->host_no,
-                               array_entry->dev_res_addr.bus,
-                               array_entry->dev_res_addr.target,
-                               array_entry->dev_res_addr.lun);
-               }
+               ipr_log_vpd(&array_entry->vpd);
 
-               if (array_entry->expected_dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
-                       ipr_err("Expected Location: unknown\n");
-               } else {
-                       ipr_err("Expected Location: %d:%d:%d:%d\n",
-                               ioa_cfg->host->host_no,
-                               array_entry->expected_dev_res_addr.bus,
-                               array_entry->expected_dev_res_addr.target,
-                               array_entry->expected_dev_res_addr.lun);
-               }
+               ipr_phys_res_err(ioa_cfg, array_entry->dev_res_addr, "Current Location");
+               ipr_phys_res_err(ioa_cfg, array_entry->expected_dev_res_addr,
+                                "Expected Location");
 
                ipr_err_separator;
 
@@ -1089,9 +1061,6 @@ static void ipr_log_generic_error(struct ipr_ioa_cfg *ioa_cfg,
        if (ioa_data_len == 0)
                return;
 
-       ipr_err("IOA Error Data:\n");
-       ipr_err("Offset    0 1 2 3  4 5 6 7  8 9 A B  C D E F\n");
-
        for (i = 0; i < ioa_data_len / 4; i += 4) {
                ipr_err("%08X: %08X %08X %08X %08X\n", i*4,
                        be32_to_cpu(hostrcb->hcam.u.raw.data[i]),
@@ -1172,11 +1141,10 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
 
        if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL)
                return;
+       if (be32_to_cpu(hostrcb->hcam.length) > sizeof(hostrcb->hcam.u.raw))
+               hostrcb->hcam.length = cpu_to_be32(sizeof(hostrcb->hcam.u.raw));
 
        switch (hostrcb->hcam.overlay_id) {
-       case IPR_HOST_RCB_OVERLAY_ID_1:
-               ipr_log_generic_error(ioa_cfg, hostrcb);
-               break;
        case IPR_HOST_RCB_OVERLAY_ID_2:
                ipr_log_cache_error(ioa_cfg, hostrcb);
                break;
@@ -1187,13 +1155,10 @@ static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
        case IPR_HOST_RCB_OVERLAY_ID_6:
                ipr_log_array_error(ioa_cfg, hostrcb);
                break;
+       case IPR_HOST_RCB_OVERLAY_ID_1:
        case IPR_HOST_RCB_OVERLAY_ID_DEFAULT:
-               ipr_log_generic_error(ioa_cfg, hostrcb);
-               break;
        default:
-               dev_err(&ioa_cfg->pdev->dev,
-                       "Unknown error received. Overlay ID: %d\n",
-                       hostrcb->hcam.overlay_id);
+               ipr_log_generic_error(ioa_cfg, hostrcb);
                break;
        }
 }
@@ -2824,8 +2789,10 @@ static int ipr_slave_configure(struct scsi_device *sdev)
        if (res) {
                if (ipr_is_af_dasd_device(res))
                        sdev->type = TYPE_RAID;
-               if (ipr_is_af_dasd_device(res) || ipr_is_ioa_resource(res))
+               if (ipr_is_af_dasd_device(res) || ipr_is_ioa_resource(res)) {
                        sdev->scsi_level = 4;
+                       sdev->no_uld_attach = 1;
+               }
                if (ipr_is_vset_device(res)) {
                        sdev->timeout = IPR_VSET_RW_TIMEOUT;
                        blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
@@ -4146,7 +4113,7 @@ static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd)
        ipr_cmd->job_step = ipr_ioa_reset_done;
 
        list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) {
-               if (!ipr_is_af_dasd_device(res))
+               if (!IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data))
                        continue;
 
                ipr_cmd->u.res = res;
@@ -4944,6 +4911,7 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
        int rc;
 
        ENTER;
+       pci_unblock_user_cfg_access(ioa_cfg->pdev);
        rc = pci_restore_state(ioa_cfg->pdev);
 
        if (rc != PCIBIOS_SUCCESSFUL) {
@@ -4998,6 +4966,7 @@ static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd)
        int rc;
 
        ENTER;
+       pci_block_user_cfg_access(ioa_cfg->pdev);
        rc = pci_write_config_byte(ioa_cfg->pdev, PCI_BIST, PCI_BIST_START);
 
        if (rc != PCIBIOS_SUCCESSFUL) {
@@ -6006,13 +5975,14 @@ static int __devinit ipr_probe(struct pci_dev *pdev,
        ipr_scan_vsets(ioa_cfg);
        scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, IPR_IOA_LUN);
        ioa_cfg->allow_ml_add_del = 1;
+       ioa_cfg->host->max_channel = IPR_VSET_BUS;
        schedule_work(&ioa_cfg->work_q);
        return 0;
 }
 
 /**
  * ipr_shutdown - Shutdown handler.
- * @dev:       device struct
+ * @pdev:      pci device struct
  *
  * This function is invoked upon system shutdown/reboot. It will issue
  * an adapter shutdown to the adapter to flush the write cache.
@@ -6020,9 +5990,9 @@ static int __devinit ipr_probe(struct pci_dev *pdev,
  * Return value:
  *     none
  **/
-static void ipr_shutdown(struct device *dev)
+static void ipr_shutdown(struct pci_dev *pdev)
 {
-       struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(to_pci_dev(dev));
+       struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
        unsigned long lock_flags = 0;
 
        spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
@@ -6068,9 +6038,7 @@ static struct pci_driver ipr_driver = {
        .id_table = ipr_pci_table,
        .probe = ipr_probe,
        .remove = ipr_remove,
-       .driver = {
-               .shutdown = ipr_shutdown,
-       },
+       .shutdown = ipr_shutdown,
 };
 
 /**