aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/BusLogic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/BusLogic.c')
-rw-r--r--drivers/scsi/BusLogic.c61
1 files changed, 45 insertions, 16 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 16a12a3b7b2b..4ea49fd7965e 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -662,7 +662,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
662 particular standard ISA I/O Address need not be probed. 662 particular standard ISA I/O Address need not be probed.
663 */ 663 */
664 PrimaryProbeInfo->IO_Address = 0; 664 PrimaryProbeInfo->IO_Address = 0;
665 while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) { 665 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) {
666 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; 666 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
667 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; 667 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation;
668 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; 668 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest;
@@ -762,7 +762,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
762 PrimaryProbeInfo->Bus = Bus; 762 PrimaryProbeInfo->Bus = Bus;
763 PrimaryProbeInfo->Device = Device; 763 PrimaryProbeInfo->Device = Device;
764 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; 764 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel;
765 PrimaryProbeInfo->PCI_Device = PCI_Device; 765 PrimaryProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
766 PCIMultiMasterCount++; 766 PCIMultiMasterCount++;
767 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { 767 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) {
768 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; 768 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
@@ -773,7 +773,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
773 ProbeInfo->Bus = Bus; 773 ProbeInfo->Bus = Bus;
774 ProbeInfo->Device = Device; 774 ProbeInfo->Device = Device;
775 ProbeInfo->IRQ_Channel = IRQ_Channel; 775 ProbeInfo->IRQ_Channel = IRQ_Channel;
776 ProbeInfo->PCI_Device = PCI_Device; 776 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
777 NonPrimaryPCIMultiMasterCount++; 777 NonPrimaryPCIMultiMasterCount++;
778 PCIMultiMasterCount++; 778 PCIMultiMasterCount++;
779 } else 779 } else
@@ -823,7 +823,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
823 noting the PCI bus location and assigned IRQ Channel. 823 noting the PCI bus location and assigned IRQ Channel.
824 */ 824 */
825 PCI_Device = NULL; 825 PCI_Device = NULL;
826 while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) { 826 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) {
827 unsigned char Bus; 827 unsigned char Bus;
828 unsigned char Device; 828 unsigned char Device;
829 unsigned int IRQ_Channel; 829 unsigned int IRQ_Channel;
@@ -850,7 +850,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
850 ProbeInfo->Bus = Bus; 850 ProbeInfo->Bus = Bus;
851 ProbeInfo->Device = Device; 851 ProbeInfo->Device = Device;
852 ProbeInfo->IRQ_Channel = IRQ_Channel; 852 ProbeInfo->IRQ_Channel = IRQ_Channel;
853 ProbeInfo->PCI_Device = PCI_Device; 853 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
854 break; 854 break;
855 } 855 }
856 } 856 }
@@ -874,7 +874,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
874 /* 874 /*
875 Interrogate PCI Configuration Space for any FlashPoint Host Adapters. 875 Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
876 */ 876 */
877 while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) { 877 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) {
878 unsigned char Bus; 878 unsigned char Bus;
879 unsigned char Device; 879 unsigned char Device;
880 unsigned int IRQ_Channel; 880 unsigned int IRQ_Channel;
@@ -923,7 +923,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
923 ProbeInfo->Bus = Bus; 923 ProbeInfo->Bus = Bus;
924 ProbeInfo->Device = Device; 924 ProbeInfo->Device = Device;
925 ProbeInfo->IRQ_Channel = IRQ_Channel; 925 ProbeInfo->IRQ_Channel = IRQ_Channel;
926 ProbeInfo->PCI_Device = PCI_Device; 926 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
927 FlashPointCount++; 927 FlashPointCount++;
928 } else 928 } else
929 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); 929 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL);
@@ -1890,6 +1890,7 @@ static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter)
1890 */ 1890 */
1891 if (HostAdapter->MailboxSpace) 1891 if (HostAdapter->MailboxSpace)
1892 pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle); 1892 pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle);
1893 pci_dev_put(HostAdapter->PCI_Device);
1893 HostAdapter->MailboxSpace = NULL; 1894 HostAdapter->MailboxSpace = NULL;
1894 HostAdapter->MailboxSpaceHandle = 0; 1895 HostAdapter->MailboxSpaceHandle = 0;
1895 HostAdapter->MailboxSize = 0; 1896 HostAdapter->MailboxSize = 0;
@@ -2176,6 +2177,7 @@ static int __init BusLogic_init(void)
2176{ 2177{
2177 int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex; 2178 int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex;
2178 struct BusLogic_HostAdapter *PrototypeHostAdapter; 2179 struct BusLogic_HostAdapter *PrototypeHostAdapter;
2180 int ret = 0;
2179 2181
2180#ifdef MODULE 2182#ifdef MODULE
2181 if (BusLogic) 2183 if (BusLogic)
@@ -2282,25 +2284,49 @@ static int __init BusLogic_init(void)
2282 perform Target Device Inquiry. 2284 perform Target Device Inquiry.
2283 */ 2285 */
2284 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) && 2286 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
2285 BusLogic_ReportHostAdapterConfiguration(HostAdapter) && BusLogic_AcquireResources(HostAdapter) && BusLogic_CreateInitialCCBs(HostAdapter) && BusLogic_InitializeHostAdapter(HostAdapter) && BusLogic_TargetDeviceInquiry(HostAdapter)) { 2287 BusLogic_ReportHostAdapterConfiguration(HostAdapter) &&
2288 BusLogic_AcquireResources(HostAdapter) &&
2289 BusLogic_CreateInitialCCBs(HostAdapter) &&
2290 BusLogic_InitializeHostAdapter(HostAdapter) &&
2291 BusLogic_TargetDeviceInquiry(HostAdapter)) {
2286 /* 2292 /*
2287 Initialization has been completed successfully. Release and 2293 Initialization has been completed successfully. Release and
2288 re-register usage of the I/O Address range so that the Model 2294 re-register usage of the I/O Address range so that the Model
2289 Name of the Host Adapter will appear, and initialize the SCSI 2295 Name of the Host Adapter will appear, and initialize the SCSI
2290 Host structure. 2296 Host structure.
2291 */ 2297 */
2292 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2298 release_region(HostAdapter->IO_Address,
2293 if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount, HostAdapter->FullModelName)) { 2299 HostAdapter->AddressCount);
2294 printk(KERN_WARNING "BusLogic: Release and re-register of " "port 0x%04lx failed \n", (unsigned long) HostAdapter->IO_Address); 2300 if (!request_region(HostAdapter->IO_Address,
2301 HostAdapter->AddressCount,
2302 HostAdapter->FullModelName)) {
2303 printk(KERN_WARNING
2304 "BusLogic: Release and re-register of "
2305 "port 0x%04lx failed \n",
2306 (unsigned long)HostAdapter->IO_Address);
2295 BusLogic_DestroyCCBs(HostAdapter); 2307 BusLogic_DestroyCCBs(HostAdapter);
2296 BusLogic_ReleaseResources(HostAdapter); 2308 BusLogic_ReleaseResources(HostAdapter);
2297 list_del(&HostAdapter->host_list); 2309 list_del(&HostAdapter->host_list);
2298 scsi_host_put(Host); 2310 scsi_host_put(Host);
2311 ret = -ENOMEM;
2299 } else { 2312 } else {
2300 BusLogic_InitializeHostStructure(HostAdapter, Host); 2313 BusLogic_InitializeHostStructure(HostAdapter,
2301 scsi_add_host(Host, HostAdapter->PCI_Device ? &HostAdapter->PCI_Device->dev : NULL); 2314 Host);
2302 scsi_scan_host(Host); 2315 if (scsi_add_host(Host, HostAdapter->PCI_Device
2303 BusLogicHostAdapterCount++; 2316 ? &HostAdapter->PCI_Device->dev
2317 : NULL)) {
2318 printk(KERN_WARNING
2319 "BusLogic: scsi_add_host()"
2320 "failed!\n");
2321 BusLogic_DestroyCCBs(HostAdapter);
2322 BusLogic_ReleaseResources(HostAdapter);
2323 list_del(&HostAdapter->host_list);
2324 scsi_host_put(Host);
2325 ret = -ENODEV;
2326 } else {
2327 scsi_scan_host(Host);
2328 BusLogicHostAdapterCount++;
2329 }
2304 } 2330 }
2305 } else { 2331 } else {
2306 /* 2332 /*
@@ -2315,12 +2341,13 @@ static int __init BusLogic_init(void)
2315 BusLogic_ReleaseResources(HostAdapter); 2341 BusLogic_ReleaseResources(HostAdapter);
2316 list_del(&HostAdapter->host_list); 2342 list_del(&HostAdapter->host_list);
2317 scsi_host_put(Host); 2343 scsi_host_put(Host);
2344 ret = -ENODEV;
2318 } 2345 }
2319 } 2346 }
2320 kfree(PrototypeHostAdapter); 2347 kfree(PrototypeHostAdapter);
2321 kfree(BusLogic_ProbeInfoList); 2348 kfree(BusLogic_ProbeInfoList);
2322 BusLogic_ProbeInfoList = NULL; 2349 BusLogic_ProbeInfoList = NULL;
2323 return 0; 2350 return ret;
2324} 2351}
2325 2352
2326 2353
@@ -2954,6 +2981,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
2954} 2981}
2955 2982
2956 2983
2984#if 0
2957/* 2985/*
2958 BusLogic_AbortCommand aborts Command if possible. 2986 BusLogic_AbortCommand aborts Command if possible.
2959*/ 2987*/
@@ -3024,6 +3052,7 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
3024 return SUCCESS; 3052 return SUCCESS;
3025} 3053}
3026 3054
3055#endif
3027/* 3056/*
3028 BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all 3057 BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all
3029 currently executing SCSI Commands as having been Reset. 3058 currently executing SCSI Commands as having been Reset.