aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/dpt_i2o.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r--drivers/scsi/dpt_i2o.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 6252b9ddc01e..6e6b293dcb28 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -61,6 +61,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
61#include <linux/timer.h> 61#include <linux/timer.h>
62#include <linux/string.h> 62#include <linux/string.h>
63#include <linux/ioport.h> 63#include <linux/ioport.h>
64#include <linux/mutex.h>
64 65
65#include <asm/processor.h> /* for boot_cpu_data */ 66#include <asm/processor.h> /* for boot_cpu_data */
66#include <asm/pgtable.h> 67#include <asm/pgtable.h>
@@ -106,7 +107,7 @@ static dpt_sig_S DPTI_sig = {
106 *============================================================================ 107 *============================================================================
107 */ 108 */
108 109
109static DECLARE_MUTEX(adpt_configuration_lock); 110static DEFINE_MUTEX(adpt_configuration_lock);
110 111
111static struct i2o_sys_tbl *sys_tbl = NULL; 112static struct i2o_sys_tbl *sys_tbl = NULL;
112static int sys_tbl_ind = 0; 113static int sys_tbl_ind = 0;
@@ -537,13 +538,13 @@ static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, of
537 */ 538 */
538 539
539 // Find HBA (host bus adapter) we are looking for 540 // Find HBA (host bus adapter) we are looking for
540 down(&adpt_configuration_lock); 541 mutex_lock(&adpt_configuration_lock);
541 for (pHba = hba_chain; pHba; pHba = pHba->next) { 542 for (pHba = hba_chain; pHba; pHba = pHba->next) {
542 if (pHba->host == host) { 543 if (pHba->host == host) {
543 break; /* found adapter */ 544 break; /* found adapter */
544 } 545 }
545 } 546 }
546 up(&adpt_configuration_lock); 547 mutex_unlock(&adpt_configuration_lock);
547 if (pHba == NULL) { 548 if (pHba == NULL) {
548 return 0; 549 return 0;
549 } 550 }
@@ -898,6 +899,12 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
898 if(pci_enable_device(pDev)) { 899 if(pci_enable_device(pDev)) {
899 return -EINVAL; 900 return -EINVAL;
900 } 901 }
902
903 if (pci_request_regions(pDev, "dpt_i2o")) {
904 PERROR("dpti: adpt_config_hba: pci request region failed\n");
905 return -EINVAL;
906 }
907
901 pci_set_master(pDev); 908 pci_set_master(pDev);
902 if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) && 909 if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) &&
903 pci_set_dma_mask(pDev, 0xffffffffULL)) 910 pci_set_dma_mask(pDev, 0xffffffffULL))
@@ -923,10 +930,6 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
923 raptorFlag = TRUE; 930 raptorFlag = TRUE;
924 } 931 }
925 932
926 if (pci_request_regions(pDev, "dpt_i2o")) {
927 PERROR("dpti: adpt_config_hba: pci request region failed\n");
928 return -EINVAL;
929 }
930 base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size); 933 base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size);
931 if (!base_addr_virt) { 934 if (!base_addr_virt) {
932 pci_release_regions(pDev); 935 pci_release_regions(pDev);
@@ -958,7 +961,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
958 } 961 }
959 memset(pHba, 0, sizeof(adpt_hba)); 962 memset(pHba, 0, sizeof(adpt_hba));
960 963
961 down(&adpt_configuration_lock); 964 mutex_lock(&adpt_configuration_lock);
962 965
963 if(hba_chain != NULL){ 966 if(hba_chain != NULL){
964 for(p = hba_chain; p->next; p = p->next); 967 for(p = hba_chain; p->next; p = p->next);
@@ -971,7 +974,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
971 sprintf(pHba->name, "dpti%d", hba_count); 974 sprintf(pHba->name, "dpti%d", hba_count);
972 hba_count++; 975 hba_count++;
973 976
974 up(&adpt_configuration_lock); 977 mutex_unlock(&adpt_configuration_lock);
975 978
976 pHba->pDev = pDev; 979 pHba->pDev = pDev;
977 pHba->base_addr_phys = base_addr0_phys; 980 pHba->base_addr_phys = base_addr0_phys;
@@ -1027,7 +1030,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1027 struct adpt_device* pNext; 1030 struct adpt_device* pNext;
1028 1031
1029 1032
1030 down(&adpt_configuration_lock); 1033 mutex_lock(&adpt_configuration_lock);
1031 // scsi_unregister calls our adpt_release which 1034 // scsi_unregister calls our adpt_release which
1032 // does a quiese 1035 // does a quiese
1033 if(pHba->host){ 1036 if(pHba->host){
@@ -1046,7 +1049,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1046 } 1049 }
1047 1050
1048 hba_count--; 1051 hba_count--;
1049 up(&adpt_configuration_lock); 1052 mutex_unlock(&adpt_configuration_lock);
1050 1053
1051 iounmap(pHba->base_addr_virt); 1054 iounmap(pHba->base_addr_virt);
1052 pci_release_regions(pHba->pDev); 1055 pci_release_regions(pHba->pDev);
@@ -1549,7 +1552,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
1549 1552
1550static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d) 1553static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d)
1551{ 1554{
1552 down(&adpt_configuration_lock); 1555 mutex_lock(&adpt_configuration_lock);
1553 d->controller=pHba; 1556 d->controller=pHba;
1554 d->owner=NULL; 1557 d->owner=NULL;
1555 d->next=pHba->devices; 1558 d->next=pHba->devices;
@@ -1560,7 +1563,7 @@ static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d)
1560 pHba->devices=d; 1563 pHba->devices=d;
1561 *d->dev_name = 0; 1564 *d->dev_name = 0;
1562 1565
1563 up(&adpt_configuration_lock); 1566 mutex_unlock(&adpt_configuration_lock);
1564 return 0; 1567 return 0;
1565} 1568}
1566 1569
@@ -1575,24 +1578,24 @@ static int adpt_open(struct inode *inode, struct file *file)
1575 if (minor >= hba_count) { 1578 if (minor >= hba_count) {
1576 return -ENXIO; 1579 return -ENXIO;
1577 } 1580 }
1578 down(&adpt_configuration_lock); 1581 mutex_lock(&adpt_configuration_lock);
1579 for (pHba = hba_chain; pHba; pHba = pHba->next) { 1582 for (pHba = hba_chain; pHba; pHba = pHba->next) {
1580 if (pHba->unit == minor) { 1583 if (pHba->unit == minor) {
1581 break; /* found adapter */ 1584 break; /* found adapter */
1582 } 1585 }
1583 } 1586 }
1584 if (pHba == NULL) { 1587 if (pHba == NULL) {
1585 up(&adpt_configuration_lock); 1588 mutex_unlock(&adpt_configuration_lock);
1586 return -ENXIO; 1589 return -ENXIO;
1587 } 1590 }
1588 1591
1589// if(pHba->in_use){ 1592// if(pHba->in_use){
1590 // up(&adpt_configuration_lock); 1593 // mutex_unlock(&adpt_configuration_lock);
1591// return -EBUSY; 1594// return -EBUSY;
1592// } 1595// }
1593 1596
1594 pHba->in_use = 1; 1597 pHba->in_use = 1;
1595 up(&adpt_configuration_lock); 1598 mutex_unlock(&adpt_configuration_lock);
1596 1599
1597 return 0; 1600 return 0;
1598} 1601}
@@ -1606,13 +1609,13 @@ static int adpt_close(struct inode *inode, struct file *file)
1606 if (minor >= hba_count) { 1609 if (minor >= hba_count) {
1607 return -ENXIO; 1610 return -ENXIO;
1608 } 1611 }
1609 down(&adpt_configuration_lock); 1612 mutex_lock(&adpt_configuration_lock);
1610 for (pHba = hba_chain; pHba; pHba = pHba->next) { 1613 for (pHba = hba_chain; pHba; pHba = pHba->next) {
1611 if (pHba->unit == minor) { 1614 if (pHba->unit == minor) {
1612 break; /* found adapter */ 1615 break; /* found adapter */
1613 } 1616 }
1614 } 1617 }
1615 up(&adpt_configuration_lock); 1618 mutex_unlock(&adpt_configuration_lock);
1616 if (pHba == NULL) { 1619 if (pHba == NULL) {
1617 return -ENXIO; 1620 return -ENXIO;
1618 } 1621 }
@@ -1910,13 +1913,13 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
1910 if (minor >= DPTI_MAX_HBA){ 1913 if (minor >= DPTI_MAX_HBA){
1911 return -ENXIO; 1914 return -ENXIO;
1912 } 1915 }
1913 down(&adpt_configuration_lock); 1916 mutex_lock(&adpt_configuration_lock);
1914 for (pHba = hba_chain; pHba; pHba = pHba->next) { 1917 for (pHba = hba_chain; pHba; pHba = pHba->next) {
1915 if (pHba->unit == minor) { 1918 if (pHba->unit == minor) {
1916 break; /* found adapter */ 1919 break; /* found adapter */
1917 } 1920 }
1918 } 1921 }
1919 up(&adpt_configuration_lock); 1922 mutex_unlock(&adpt_configuration_lock);
1920 if(pHba == NULL){ 1923 if(pHba == NULL){
1921 return -ENXIO; 1924 return -ENXIO;
1922 } 1925 }