aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r--drivers/scsi/aacraid/aachba.c66
-rw-r--r--drivers/scsi/aacraid/aacraid.h6
-rw-r--r--drivers/scsi/aacraid/linit.c5
-rw-r--r--drivers/scsi/aacraid/nark.c3
-rw-r--r--drivers/scsi/aacraid/rkt.c2
-rw-r--r--drivers/scsi/aacraid/rx.c2
6 files changed, 64 insertions, 20 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index a26baab09dbf..6800e578e4b1 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -194,8 +194,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
194 struct scsi_device *device; 194 struct scsi_device *device;
195 195
196 if (unlikely(!scsicmd || !scsicmd->scsi_done )) { 196 if (unlikely(!scsicmd || !scsicmd->scsi_done )) {
197 dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n")) 197 dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"));
198;
199 aac_fib_complete(fibptr); 198 aac_fib_complete(fibptr);
200 aac_fib_free(fibptr); 199 aac_fib_free(fibptr);
201 return 0; 200 return 0;
@@ -1689,23 +1688,23 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1689 if (!aac_valid_context(cmd, fibptr)) 1688 if (!aac_valid_context(cmd, fibptr))
1690 return; 1689 return;
1691 1690
1692 dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", 1691 dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n",
1693 smp_processor_id(), jiffies)); 1692 smp_processor_id(), jiffies));
1694 BUG_ON(fibptr == NULL); 1693 BUG_ON(fibptr == NULL);
1695 1694
1696 1695
1697 synchronizereply = fib_data(fibptr); 1696 synchronizereply = fib_data(fibptr);
1698 if (le32_to_cpu(synchronizereply->status) == CT_OK) 1697 if (le32_to_cpu(synchronizereply->status) == CT_OK)
1699 cmd->result = DID_OK << 16 | 1698 cmd->result = DID_OK << 16 |
1700 COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 1699 COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
1701 else { 1700 else {
1702 struct scsi_device *sdev = cmd->device; 1701 struct scsi_device *sdev = cmd->device;
1703 struct aac_dev *dev = fibptr->dev; 1702 struct aac_dev *dev = fibptr->dev;
1704 u32 cid = sdev_id(sdev); 1703 u32 cid = sdev_id(sdev);
1705 printk(KERN_WARNING 1704 printk(KERN_WARNING
1706 "synchronize_callback: synchronize failed, status = %d\n", 1705 "synchronize_callback: synchronize failed, status = %d\n",
1707 le32_to_cpu(synchronizereply->status)); 1706 le32_to_cpu(synchronizereply->status));
1708 cmd->result = DID_OK << 16 | 1707 cmd->result = DID_OK << 16 |
1709 COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; 1708 COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
1710 set_sense((u8 *)&dev->fsa_dev[cid].sense_data, 1709 set_sense((u8 *)&dev->fsa_dev[cid].sense_data,
1711 HARDWARE_ERROR, 1710 HARDWARE_ERROR,
@@ -1713,7 +1712,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
1713 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, 1712 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
1714 0, 0); 1713 0, 0);
1715 memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, 1714 memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
1716 min(sizeof(dev->fsa_dev[cid].sense_data), 1715 min(sizeof(dev->fsa_dev[cid].sense_data),
1717 sizeof(cmd->sense_buffer))); 1716 sizeof(cmd->sense_buffer)));
1718 } 1717 }
1719 1718
@@ -1731,6 +1730,9 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
1731 struct scsi_device *sdev = scsicmd->device; 1730 struct scsi_device *sdev = scsicmd->device;
1732 int active = 0; 1731 int active = 0;
1733 struct aac_dev *aac; 1732 struct aac_dev *aac;
1733 u64 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) |
1734 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
1735 u32 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
1734 unsigned long flags; 1736 unsigned long flags;
1735 1737
1736 /* 1738 /*
@@ -1739,7 +1741,51 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
1739 */ 1741 */
1740 spin_lock_irqsave(&sdev->list_lock, flags); 1742 spin_lock_irqsave(&sdev->list_lock, flags);
1741 list_for_each_entry(cmd, &sdev->cmd_list, list) 1743 list_for_each_entry(cmd, &sdev->cmd_list, list)
1742 if (cmd != scsicmd && cmd->SCp.phase == AAC_OWNER_FIRMWARE) { 1744 if (cmd->SCp.phase == AAC_OWNER_FIRMWARE) {
1745 u64 cmnd_lba;
1746 u32 cmnd_count;
1747
1748 if (cmd->cmnd[0] == WRITE_6) {
1749 cmnd_lba = ((cmd->cmnd[1] & 0x1F) << 16) |
1750 (cmd->cmnd[2] << 8) |
1751 cmd->cmnd[3];
1752 cmnd_count = cmd->cmnd[4];
1753 if (cmnd_count == 0)
1754 cmnd_count = 256;
1755 } else if (cmd->cmnd[0] == WRITE_16) {
1756 cmnd_lba = ((u64)cmd->cmnd[2] << 56) |
1757 ((u64)cmd->cmnd[3] << 48) |
1758 ((u64)cmd->cmnd[4] << 40) |
1759 ((u64)cmd->cmnd[5] << 32) |
1760 ((u64)cmd->cmnd[6] << 24) |
1761 (cmd->cmnd[7] << 16) |
1762 (cmd->cmnd[8] << 8) |
1763 cmd->cmnd[9];
1764 cmnd_count = (cmd->cmnd[10] << 24) |
1765 (cmd->cmnd[11] << 16) |
1766 (cmd->cmnd[12] << 8) |
1767 cmd->cmnd[13];
1768 } else if (cmd->cmnd[0] == WRITE_12) {
1769 cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
1770 (cmd->cmnd[3] << 16) |
1771 (cmd->cmnd[4] << 8) |
1772 cmd->cmnd[5];
1773 cmnd_count = (cmd->cmnd[6] << 24) |
1774 (cmd->cmnd[7] << 16) |
1775 (cmd->cmnd[8] << 8) |
1776 cmd->cmnd[9];
1777 } else if (cmd->cmnd[0] == WRITE_10) {
1778 cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
1779 (cmd->cmnd[3] << 16) |
1780 (cmd->cmnd[4] << 8) |
1781 cmd->cmnd[5];
1782 cmnd_count = (cmd->cmnd[7] << 8) |
1783 cmd->cmnd[8];
1784 } else
1785 continue;
1786 if (((cmnd_lba + cmnd_count) < lba) ||
1787 (count && ((lba + count) < cmnd_lba)))
1788 continue;
1743 ++active; 1789 ++active;
1744 break; 1790 break;
1745 } 1791 }
@@ -1768,7 +1814,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
1768 synchronizecmd->command = cpu_to_le32(VM_ContainerConfig); 1814 synchronizecmd->command = cpu_to_le32(VM_ContainerConfig);
1769 synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE); 1815 synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE);
1770 synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd)); 1816 synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd));
1771 synchronizecmd->count = 1817 synchronizecmd->count =
1772 cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data)); 1818 cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data));
1773 1819
1774 /* 1820 /*
@@ -1790,7 +1836,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
1790 return 0; 1836 return 0;
1791 } 1837 }
1792 1838
1793 printk(KERN_WARNING 1839 printk(KERN_WARNING
1794 "aac_synchronize: aac_fib_send failed with status: %d.\n", status); 1840 "aac_synchronize: aac_fib_send failed with status: %d.\n", status);
1795 aac_fib_complete(cmd_fibcontext); 1841 aac_fib_complete(cmd_fibcontext);
1796 aac_fib_free(cmd_fibcontext); 1842 aac_fib_free(cmd_fibcontext);
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 400d03403cd5..94727b9375ec 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
12 *----------------------------------------------------------------------------*/ 12 *----------------------------------------------------------------------------*/
13 13
14#ifndef AAC_DRIVER_BUILD 14#ifndef AAC_DRIVER_BUILD
15# define AAC_DRIVER_BUILD 2447 15# define AAC_DRIVER_BUILD 2449
16# define AAC_DRIVER_BRANCH "-ms" 16# define AAC_DRIVER_BRANCH "-ms"
17#endif 17#endif
18#define MAXIMUM_NUM_CONTAINERS 32 18#define MAXIMUM_NUM_CONTAINERS 32
@@ -1807,10 +1807,10 @@ struct aac_aifcmd {
1807 * accounting for the fact capacity could be a 64 bit value 1807 * accounting for the fact capacity could be a 64 bit value
1808 * 1808 *
1809 */ 1809 */
1810static inline u32 cap_to_cyls(sector_t capacity, u32 divisor) 1810static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
1811{ 1811{
1812 sector_div(capacity, divisor); 1812 sector_div(capacity, divisor);
1813 return (u32)capacity; 1813 return capacity;
1814} 1814}
1815 1815
1816/* SCp.phase values */ 1816/* SCp.phase values */
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c709dc8ad99d..813556c60007 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -826,7 +826,7 @@ static ssize_t aac_show_reset_adapter(struct class_device *class_dev,
826 tmp = aac_adapter_check_health(dev); 826 tmp = aac_adapter_check_health(dev);
827 if ((tmp == 0) && dev->in_reset) 827 if ((tmp == 0) && dev->in_reset)
828 tmp = -EBUSY; 828 tmp = -EBUSY;
829 len = snprintf(buf, PAGE_SIZE, "0x%x", tmp); 829 len = snprintf(buf, PAGE_SIZE, "0x%x\n", tmp);
830 return len; 830 return len;
831} 831}
832 832
@@ -1126,9 +1126,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1126static void aac_shutdown(struct pci_dev *dev) 1126static void aac_shutdown(struct pci_dev *dev)
1127{ 1127{
1128 struct Scsi_Host *shost = pci_get_drvdata(dev); 1128 struct Scsi_Host *shost = pci_get_drvdata(dev);
1129 struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
1130 scsi_block_requests(shost); 1129 scsi_block_requests(shost);
1131 __aac_shutdown(aac); 1130 __aac_shutdown((struct aac_dev *)shost->hostdata);
1132} 1131}
1133 1132
1134static void __devexit aac_remove_one(struct pci_dev *pdev) 1133static void __devexit aac_remove_one(struct pci_dev *pdev)
diff --git a/drivers/scsi/aacraid/nark.c b/drivers/scsi/aacraid/nark.c
index a8ace5677813..c55f7c862f0e 100644
--- a/drivers/scsi/aacraid/nark.c
+++ b/drivers/scsi/aacraid/nark.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * Adaptec AAC series RAID controller driver 2 * Adaptec AAC series RAID controller driver
3 * (c) Copyright 2001 Red Hat Inc. <alan@redhat.com>
4 * 3 *
5 * based on the old aacraid driver that is.. 4 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 5 * Adaptec aacraid device driver for Linux.
7 * 6 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 7 * Copyright (c) 2006-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index 9c5fcfb398c2..8cd6588a83e3 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index ebc65b9fea92..73eef3dc5dc6 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -472,7 +472,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
472 else { 472 else {
473 bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, 473 bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS,
474 0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL); 474 0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL);
475 if (!bled && (var != 0x00000001)) 475 if (!bled && (var != 0x00000001) && (var != 0x3803000F))
476 bled = -EINVAL; 476 bled = -EINVAL;
477 } 477 }
478 if (bled && (bled != -ETIMEDOUT)) 478 if (bled && (bled != -ETIMEDOUT))