diff options
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 53c9b93013f1..2fd728731d5e 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -113,7 +113,6 @@ static struct i2o_sys_tbl *sys_tbl = NULL; | |||
113 | static int sys_tbl_ind = 0; | 113 | static int sys_tbl_ind = 0; |
114 | static int sys_tbl_len = 0; | 114 | static int sys_tbl_len = 0; |
115 | 115 | ||
116 | static adpt_hba* hbas[DPTI_MAX_HBA]; | ||
117 | static adpt_hba* hba_chain = NULL; | 116 | static adpt_hba* hba_chain = NULL; |
118 | static int hba_count = 0; | 117 | static int hba_count = 0; |
119 | 118 | ||
@@ -691,7 +690,7 @@ static int adpt_device_reset(struct scsi_cmnd* cmd) | |||
691 | u32 msg[4]; | 690 | u32 msg[4]; |
692 | u32 rcode; | 691 | u32 rcode; |
693 | int old_state; | 692 | int old_state; |
694 | struct adpt_device* d = (void*) cmd->device->hostdata; | 693 | struct adpt_device* d = cmd->device->hostdata; |
695 | 694 | ||
696 | pHba = (void*) cmd->device->host->hostdata[0]; | 695 | pHba = (void*) cmd->device->host->hostdata[0]; |
697 | printk(KERN_INFO"%s: Trying to reset device\n",pHba->name); | 696 | printk(KERN_INFO"%s: Trying to reset device\n",pHba->name); |
@@ -707,7 +706,7 @@ static int adpt_device_reset(struct scsi_cmnd* cmd) | |||
707 | 706 | ||
708 | old_state = d->state; | 707 | old_state = d->state; |
709 | d->state |= DPTI_DEV_RESET; | 708 | d->state |= DPTI_DEV_RESET; |
710 | if( (rcode = adpt_i2o_post_wait(pHba, (void*)msg,sizeof(msg), FOREVER)) ){ | 709 | if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){ |
711 | d->state = old_state; | 710 | d->state = old_state; |
712 | if(rcode == -EOPNOTSUPP ){ | 711 | if(rcode == -EOPNOTSUPP ){ |
713 | printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); | 712 | printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); |
@@ -737,7 +736,7 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd) | |||
737 | msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); | 736 | msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); |
738 | msg[2] = 0; | 737 | msg[2] = 0; |
739 | msg[3] = 0; | 738 | msg[3] = 0; |
740 | if(adpt_i2o_post_wait(pHba, (void*)msg,sizeof(msg), FOREVER) ){ | 739 | if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){ |
741 | printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); | 740 | printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); |
742 | return FAILED; | 741 | return FAILED; |
743 | } else { | 742 | } else { |
@@ -875,7 +874,6 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
875 | void __iomem *msg_addr_virt = NULL; | 874 | void __iomem *msg_addr_virt = NULL; |
876 | 875 | ||
877 | int raptorFlag = FALSE; | 876 | int raptorFlag = FALSE; |
878 | int i; | ||
879 | 877 | ||
880 | if(pci_enable_device(pDev)) { | 878 | if(pci_enable_device(pDev)) { |
881 | return -EINVAL; | 879 | return -EINVAL; |
@@ -935,12 +933,6 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
935 | memset(pHba, 0, sizeof(adpt_hba)); | 933 | memset(pHba, 0, sizeof(adpt_hba)); |
936 | 934 | ||
937 | down(&adpt_configuration_lock); | 935 | down(&adpt_configuration_lock); |
938 | for(i=0;i<DPTI_MAX_HBA;i++) { | ||
939 | if(hbas[i]==NULL) { | ||
940 | hbas[i]=pHba; | ||
941 | break; | ||
942 | } | ||
943 | } | ||
944 | 936 | ||
945 | if(hba_chain != NULL){ | 937 | if(hba_chain != NULL){ |
946 | for(p = hba_chain; p->next; p = p->next); | 938 | for(p = hba_chain; p->next; p = p->next); |
@@ -950,7 +942,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
950 | } | 942 | } |
951 | pHba->next = NULL; | 943 | pHba->next = NULL; |
952 | pHba->unit = hba_count; | 944 | pHba->unit = hba_count; |
953 | sprintf(pHba->name, "dpti%d", i); | 945 | sprintf(pHba->name, "dpti%d", hba_count); |
954 | hba_count++; | 946 | hba_count++; |
955 | 947 | ||
956 | up(&adpt_configuration_lock); | 948 | up(&adpt_configuration_lock); |
@@ -1015,11 +1007,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1015 | if(pHba->host){ | 1007 | if(pHba->host){ |
1016 | free_irq(pHba->host->irq, pHba); | 1008 | free_irq(pHba->host->irq, pHba); |
1017 | } | 1009 | } |
1018 | for(i=0;i<DPTI_MAX_HBA;i++) { | ||
1019 | if(hbas[i]==pHba) { | ||
1020 | hbas[i] = NULL; | ||
1021 | } | ||
1022 | } | ||
1023 | p2 = NULL; | 1010 | p2 = NULL; |
1024 | for( p1 = hba_chain; p1; p2 = p1,p1=p1->next){ | 1011 | for( p1 = hba_chain; p1; p2 = p1,p1=p1->next){ |
1025 | if(p1 == pHba) { | 1012 | if(p1 == pHba) { |
@@ -1076,12 +1063,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1076 | 1063 | ||
1077 | static int adpt_init(void) | 1064 | static int adpt_init(void) |
1078 | { | 1065 | { |
1079 | int i; | ||
1080 | |||
1081 | printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n"); | 1066 | printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n"); |
1082 | for (i = 0; i < DPTI_MAX_HBA; i++) { | ||
1083 | hbas[i] = NULL; | ||
1084 | } | ||
1085 | #ifdef REBOOT_NOTIFIER | 1067 | #ifdef REBOOT_NOTIFIER |
1086 | register_reboot_notifier(&adpt_reboot_notifier); | 1068 | register_reboot_notifier(&adpt_reboot_notifier); |
1087 | #endif | 1069 | #endif |
@@ -1454,7 +1436,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba) | |||
1454 | return -ENOMEM; | 1436 | return -ENOMEM; |
1455 | } | 1437 | } |
1456 | 1438 | ||
1457 | d->controller = (void*)pHba; | 1439 | d->controller = pHba; |
1458 | d->next = NULL; | 1440 | d->next = NULL; |
1459 | 1441 | ||
1460 | memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry)); | 1442 | memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry)); |
@@ -2000,7 +1982,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs) | |||
2000 | struct scsi_cmnd* cmd; | 1982 | struct scsi_cmnd* cmd; |
2001 | adpt_hba* pHba = dev_id; | 1983 | adpt_hba* pHba = dev_id; |
2002 | u32 m; | 1984 | u32 m; |
2003 | ulong reply; | 1985 | void __iomem *reply; |
2004 | u32 status=0; | 1986 | u32 status=0; |
2005 | u32 context; | 1987 | u32 context; |
2006 | ulong flags = 0; | 1988 | ulong flags = 0; |
@@ -2025,11 +2007,11 @@ static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs) | |||
2025 | goto out; | 2007 | goto out; |
2026 | } | 2008 | } |
2027 | } | 2009 | } |
2028 | reply = (ulong)bus_to_virt(m); | 2010 | reply = bus_to_virt(m); |
2029 | 2011 | ||
2030 | if (readl(reply) & MSG_FAIL) { | 2012 | if (readl(reply) & MSG_FAIL) { |
2031 | u32 old_m = readl(reply+28); | 2013 | u32 old_m = readl(reply+28); |
2032 | ulong msg; | 2014 | void __iomem *msg; |
2033 | u32 old_context; | 2015 | u32 old_context; |
2034 | PDEBUG("%s: Failed message\n",pHba->name); | 2016 | PDEBUG("%s: Failed message\n",pHba->name); |
2035 | if(old_m >= 0x100000){ | 2017 | if(old_m >= 0x100000){ |
@@ -2038,16 +2020,16 @@ static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs) | |||
2038 | continue; | 2020 | continue; |
2039 | } | 2021 | } |
2040 | // Transaction context is 0 in failed reply frame | 2022 | // Transaction context is 0 in failed reply frame |
2041 | msg = (ulong)(pHba->msg_addr_virt + old_m); | 2023 | msg = pHba->msg_addr_virt + old_m; |
2042 | old_context = readl(msg+12); | 2024 | old_context = readl(msg+12); |
2043 | writel(old_context, reply+12); | 2025 | writel(old_context, reply+12); |
2044 | adpt_send_nop(pHba, old_m); | 2026 | adpt_send_nop(pHba, old_m); |
2045 | } | 2027 | } |
2046 | context = readl(reply+8); | 2028 | context = readl(reply+8); |
2047 | if(context & 0x40000000){ // IOCTL | 2029 | if(context & 0x40000000){ // IOCTL |
2048 | ulong p = (ulong)(readl(reply+12)); | 2030 | void *p = (void *)readl(reply+12); |
2049 | if( p != 0) { | 2031 | if( p != NULL) { |
2050 | memcpy((void*)p, (void*)reply, REPLY_FRAME_SIZE * 4); | 2032 | memcpy_fromio(p, reply, REPLY_FRAME_SIZE * 4); |
2051 | } | 2033 | } |
2052 | // All IOCTLs will also be post wait | 2034 | // All IOCTLs will also be post wait |
2053 | } | 2035 | } |
@@ -2231,7 +2213,7 @@ static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht) | |||
2231 | } | 2213 | } |
2232 | 2214 | ||
2233 | 2215 | ||
2234 | static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd) | 2216 | static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) |
2235 | { | 2217 | { |
2236 | adpt_hba* pHba; | 2218 | adpt_hba* pHba; |
2237 | u32 hba_status; | 2219 | u32 hba_status; |
@@ -2323,7 +2305,7 @@ static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd) | |||
2323 | u32 len = sizeof(cmd->sense_buffer); | 2305 | u32 len = sizeof(cmd->sense_buffer); |
2324 | len = (len > 40) ? 40 : len; | 2306 | len = (len > 40) ? 40 : len; |
2325 | // Copy over the sense data | 2307 | // Copy over the sense data |
2326 | memcpy(cmd->sense_buffer, (void*)(reply+28) , len); | 2308 | memcpy_fromio(cmd->sense_buffer, (reply+28) , len); |
2327 | if(cmd->sense_buffer[0] == 0x70 /* class 7 */ && | 2309 | if(cmd->sense_buffer[0] == 0x70 /* class 7 */ && |
2328 | cmd->sense_buffer[2] == DATA_PROTECT ){ | 2310 | cmd->sense_buffer[2] == DATA_PROTECT ){ |
2329 | /* This is to handle an array failed */ | 2311 | /* This is to handle an array failed */ |
@@ -2438,7 +2420,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) | |||
2438 | return -ENOMEM; | 2420 | return -ENOMEM; |
2439 | } | 2421 | } |
2440 | 2422 | ||
2441 | d->controller = (void*)pHba; | 2423 | d->controller = pHba; |
2442 | d->next = NULL; | 2424 | d->next = NULL; |
2443 | 2425 | ||
2444 | memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry)); | 2426 | memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry)); |
@@ -2985,8 +2967,8 @@ static int adpt_i2o_build_sys_table(void) | |||
2985 | sys_tbl->iops[count].frame_size = pHba->status_block->inbound_frame_size; | 2967 | sys_tbl->iops[count].frame_size = pHba->status_block->inbound_frame_size; |
2986 | sys_tbl->iops[count].last_changed = sys_tbl_ind - 1; // ?? | 2968 | sys_tbl->iops[count].last_changed = sys_tbl_ind - 1; // ?? |
2987 | sys_tbl->iops[count].iop_capabilities = pHba->status_block->iop_capabilities; | 2969 | sys_tbl->iops[count].iop_capabilities = pHba->status_block->iop_capabilities; |
2988 | sys_tbl->iops[count].inbound_low = (u32)virt_to_bus((void*)pHba->post_port); | 2970 | sys_tbl->iops[count].inbound_low = (u32)virt_to_bus(pHba->post_port); |
2989 | sys_tbl->iops[count].inbound_high = (u32)((u64)virt_to_bus((void*)pHba->post_port)>>32); | 2971 | sys_tbl->iops[count].inbound_high = (u32)((u64)virt_to_bus(pHba->post_port)>>32); |
2990 | 2972 | ||
2991 | count++; | 2973 | count++; |
2992 | } | 2974 | } |