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.c64
1 files changed, 46 insertions, 18 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index bde3d5834ad..4ea49fd7965 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -29,7 +29,6 @@
29#define BusLogic_DriverVersion "2.1.16" 29#define BusLogic_DriverVersion "2.1.16"
30#define BusLogic_DriverDate "18 July 2002" 30#define BusLogic_DriverDate "18 July 2002"
31 31
32#include <linux/config.h>
33#include <linux/module.h> 32#include <linux/module.h>
34#include <linux/init.h> 33#include <linux/init.h>
35#include <linux/interrupt.h> 34#include <linux/interrupt.h>
@@ -663,7 +662,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
663 particular standard ISA I/O Address need not be probed. 662 particular standard ISA I/O Address need not be probed.
664 */ 663 */
665 PrimaryProbeInfo->IO_Address = 0; 664 PrimaryProbeInfo->IO_Address = 0;
666 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) {
667 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; 666 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
668 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; 667 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation;
669 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; 668 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest;
@@ -763,7 +762,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
763 PrimaryProbeInfo->Bus = Bus; 762 PrimaryProbeInfo->Bus = Bus;
764 PrimaryProbeInfo->Device = Device; 763 PrimaryProbeInfo->Device = Device;
765 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; 764 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel;
766 PrimaryProbeInfo->PCI_Device = PCI_Device; 765 PrimaryProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
767 PCIMultiMasterCount++; 766 PCIMultiMasterCount++;
768 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { 767 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) {
769 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; 768 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
@@ -774,7 +773,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
774 ProbeInfo->Bus = Bus; 773 ProbeInfo->Bus = Bus;
775 ProbeInfo->Device = Device; 774 ProbeInfo->Device = Device;
776 ProbeInfo->IRQ_Channel = IRQ_Channel; 775 ProbeInfo->IRQ_Channel = IRQ_Channel;
777 ProbeInfo->PCI_Device = PCI_Device; 776 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
778 NonPrimaryPCIMultiMasterCount++; 777 NonPrimaryPCIMultiMasterCount++;
779 PCIMultiMasterCount++; 778 PCIMultiMasterCount++;
780 } else 779 } else
@@ -824,7 +823,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
824 noting the PCI bus location and assigned IRQ Channel. 823 noting the PCI bus location and assigned IRQ Channel.
825 */ 824 */
826 PCI_Device = NULL; 825 PCI_Device = NULL;
827 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) {
828 unsigned char Bus; 827 unsigned char Bus;
829 unsigned char Device; 828 unsigned char Device;
830 unsigned int IRQ_Channel; 829 unsigned int IRQ_Channel;
@@ -851,7 +850,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
851 ProbeInfo->Bus = Bus; 850 ProbeInfo->Bus = Bus;
852 ProbeInfo->Device = Device; 851 ProbeInfo->Device = Device;
853 ProbeInfo->IRQ_Channel = IRQ_Channel; 852 ProbeInfo->IRQ_Channel = IRQ_Channel;
854 ProbeInfo->PCI_Device = PCI_Device; 853 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
855 break; 854 break;
856 } 855 }
857 } 856 }
@@ -875,7 +874,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
875 /* 874 /*
876 Interrogate PCI Configuration Space for any FlashPoint Host Adapters. 875 Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
877 */ 876 */
878 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) {
879 unsigned char Bus; 878 unsigned char Bus;
880 unsigned char Device; 879 unsigned char Device;
881 unsigned int IRQ_Channel; 880 unsigned int IRQ_Channel;
@@ -924,7 +923,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
924 ProbeInfo->Bus = Bus; 923 ProbeInfo->Bus = Bus;
925 ProbeInfo->Device = Device; 924 ProbeInfo->Device = Device;
926 ProbeInfo->IRQ_Channel = IRQ_Channel; 925 ProbeInfo->IRQ_Channel = IRQ_Channel;
927 ProbeInfo->PCI_Device = PCI_Device; 926 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
928 FlashPointCount++; 927 FlashPointCount++;
929 } else 928 } else
930 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); 929 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL);
@@ -1845,7 +1844,7 @@ static boolean __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *Hos
1845 /* 1844 /*
1846 Acquire shared access to the IRQ Channel. 1845 Acquire shared access to the IRQ Channel.
1847 */ 1846 */
1848 if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, SA_SHIRQ, HostAdapter->FullModelName, HostAdapter) < 0) { 1847 if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, IRQF_SHARED, HostAdapter->FullModelName, HostAdapter) < 0) {
1849 BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel); 1848 BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel);
1850 return false; 1849 return false;
1851 } 1850 }
@@ -1891,6 +1890,7 @@ static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter)
1891 */ 1890 */
1892 if (HostAdapter->MailboxSpace) 1891 if (HostAdapter->MailboxSpace)
1893 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);
1894 HostAdapter->MailboxSpace = NULL; 1894 HostAdapter->MailboxSpace = NULL;
1895 HostAdapter->MailboxSpaceHandle = 0; 1895 HostAdapter->MailboxSpaceHandle = 0;
1896 HostAdapter->MailboxSize = 0; 1896 HostAdapter->MailboxSize = 0;
@@ -2177,6 +2177,7 @@ static int __init BusLogic_init(void)
2177{ 2177{
2178 int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex; 2178 int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex;
2179 struct BusLogic_HostAdapter *PrototypeHostAdapter; 2179 struct BusLogic_HostAdapter *PrototypeHostAdapter;
2180 int ret = 0;
2180 2181
2181#ifdef MODULE 2182#ifdef MODULE
2182 if (BusLogic) 2183 if (BusLogic)
@@ -2283,25 +2284,49 @@ static int __init BusLogic_init(void)
2283 perform Target Device Inquiry. 2284 perform Target Device Inquiry.
2284 */ 2285 */
2285 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) && 2286 if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
2286 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)) {
2287 /* 2292 /*
2288 Initialization has been completed successfully. Release and 2293 Initialization has been completed successfully. Release and
2289 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
2290 Name of the Host Adapter will appear, and initialize the SCSI 2295 Name of the Host Adapter will appear, and initialize the SCSI
2291 Host structure. 2296 Host structure.
2292 */ 2297 */
2293 release_region(HostAdapter->IO_Address, HostAdapter->AddressCount); 2298 release_region(HostAdapter->IO_Address,
2294 if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount, HostAdapter->FullModelName)) { 2299 HostAdapter->AddressCount);
2295 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);
2296 BusLogic_DestroyCCBs(HostAdapter); 2307 BusLogic_DestroyCCBs(HostAdapter);
2297 BusLogic_ReleaseResources(HostAdapter); 2308 BusLogic_ReleaseResources(HostAdapter);
2298 list_del(&HostAdapter->host_list); 2309 list_del(&HostAdapter->host_list);
2299 scsi_host_put(Host); 2310 scsi_host_put(Host);
2311 ret = -ENOMEM;
2300 } else { 2312 } else {
2301 BusLogic_InitializeHostStructure(HostAdapter, Host); 2313 BusLogic_InitializeHostStructure(HostAdapter,
2302 scsi_add_host(Host, HostAdapter->PCI_Device ? &HostAdapter->PCI_Device->dev : NULL); 2314 Host);
2303 scsi_scan_host(Host); 2315 if (scsi_add_host(Host, HostAdapter->PCI_Device
2304 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 }
2305 } 2330 }
2306 } else { 2331 } else {
2307 /* 2332 /*
@@ -2316,12 +2341,13 @@ static int __init BusLogic_init(void)
2316 BusLogic_ReleaseResources(HostAdapter); 2341 BusLogic_ReleaseResources(HostAdapter);
2317 list_del(&HostAdapter->host_list); 2342 list_del(&HostAdapter->host_list);
2318 scsi_host_put(Host); 2343 scsi_host_put(Host);
2344 ret = -ENODEV;
2319 } 2345 }
2320 } 2346 }
2321 kfree(PrototypeHostAdapter); 2347 kfree(PrototypeHostAdapter);
2322 kfree(BusLogic_ProbeInfoList); 2348 kfree(BusLogic_ProbeInfoList);
2323 BusLogic_ProbeInfoList = NULL; 2349 BusLogic_ProbeInfoList = NULL;
2324 return 0; 2350 return ret;
2325} 2351}
2326 2352
2327 2353
@@ -2955,6 +2981,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
2955} 2981}
2956 2982
2957 2983
2984#if 0
2958/* 2985/*
2959 BusLogic_AbortCommand aborts Command if possible. 2986 BusLogic_AbortCommand aborts Command if possible.
2960*/ 2987*/
@@ -3025,6 +3052,7 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
3025 return SUCCESS; 3052 return SUCCESS;
3026} 3053}
3027 3054
3055#endif
3028/* 3056/*
3029 BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all 3057 BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all
3030 currently executing SCSI Commands as having been Reset. 3058 currently executing SCSI Commands as having been Reset.