diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-07-29 23:46:15 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:38:56 -0400 |
commit | 78e77d8b50633241d34cd9e64626d39d0a8cd2c0 (patch) | |
tree | a1c51fa89b43ca26312ca1e8eb994a395228bbec /drivers/scsi/advansys.c | |
parent | 8dfb537933a87588e83196d14cd9ec245eb065b8 (diff) |
[SCSI] advansys: Convert to PCI driver model
- Add a pci_driver interface for the PCI advansys devices (for
ISA/EISA/VLB devices, we still call advansys_detect).
- Many functions are converted from __init to __devinit to allow hotplug
PCI to work.
- Only keep devices found by advansys_detect in the asc_host list.
- Rename asc_board_count to asc_legacy_count. New asc_board_count is only
used to generate a unique name for each device.
- Remove some now-unused macros and struct definitions
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/advansys.c')
-rw-r--r-- | drivers/scsi/advansys.c | 378 |
1 files changed, 129 insertions, 249 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 8353680b8682..3ba70323345d 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -865,12 +865,8 @@ typedef unsigned char uchar; | |||
865 | #define AscPCIConfigLatencyTimer 0x000D | 865 | #define AscPCIConfigLatencyTimer 0x000D |
866 | #define AscPCIIOBaseRegister 0x0010 | 866 | #define AscPCIIOBaseRegister 0x0010 |
867 | #define AscPCICmdRegBits_IOMemBusMaster 0x0007 | 867 | #define AscPCICmdRegBits_IOMemBusMaster 0x0007 |
868 | #define ASC_PCI_ID2BUS(id) ((id) & 0xFF) | ||
869 | #define ASC_PCI_ID2DEV(id) (((id) >> 11) & 0x1F) | ||
870 | #define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) | 868 | #define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) |
871 | #define ASC_PCI_MKID(bus, dev, func) ((((dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) | 869 | #define ASC_PCI_MKID(bus, dev, func) ((((dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) |
872 | #define ASC_PCI_REVISION_3150 0x02 | ||
873 | #define ASC_PCI_REVISION_3050 0x03 | ||
874 | 870 | ||
875 | #define ASC_DVCLIB_CALL_DONE (1) | 871 | #define ASC_DVCLIB_CALL_DONE (1) |
876 | #define ASC_DVCLIB_CALL_FAILED (0) | 872 | #define ASC_DVCLIB_CALL_FAILED (0) |
@@ -3422,7 +3418,7 @@ typedef struct { | |||
3422 | 3418 | ||
3423 | #define ASC_NUM_BOARD_SUPPORTED 16 | 3419 | #define ASC_NUM_BOARD_SUPPORTED 16 |
3424 | #define ASC_NUM_IOPORT_PROBE 4 | 3420 | #define ASC_NUM_IOPORT_PROBE 4 |
3425 | #define ASC_NUM_BUS 4 | 3421 | #define ASC_NUM_BUS 3 |
3426 | 3422 | ||
3427 | /* Reference Scsi_Host hostdata */ | 3423 | /* Reference Scsi_Host hostdata */ |
3428 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) | 3424 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) |
@@ -3526,11 +3522,6 @@ typedef struct scsi_cmnd REQ, *REQP; | |||
3526 | /* Return non-zero, if the queue is empty. */ | 3522 | /* Return non-zero, if the queue is empty. */ |
3527 | #define ASC_QUEUE_EMPTY(ascq) ((ascq)->q_tidmask == 0) | 3523 | #define ASC_QUEUE_EMPTY(ascq) ((ascq)->q_tidmask == 0) |
3528 | 3524 | ||
3529 | #define PCI_MAX_SLOT 0x1F | ||
3530 | #define PCI_MAX_BUS 0xFF | ||
3531 | #define PCI_IOADDRESS_MASK 0xFFFE | ||
3532 | #define ASC_PCI_DEVICE_ID_CNT 6 /* PCI Device ID count. */ | ||
3533 | |||
3534 | #ifndef ADVANSYS_STATS | 3525 | #ifndef ADVANSYS_STATS |
3535 | #define ASC_STATS(shost, counter) | 3526 | #define ASC_STATS(shost, counter) |
3536 | #define ASC_STATS_ADD(shost, counter, count) | 3527 | #define ASC_STATS_ADD(shost, counter, count) |
@@ -3853,60 +3844,11 @@ typedef struct asc_board { | |||
3853 | ushort bios_codelen; /* BIOS Code Segment Length. */ | 3844 | ushort bios_codelen; /* BIOS Code Segment Length. */ |
3854 | } asc_board_t; | 3845 | } asc_board_t; |
3855 | 3846 | ||
3856 | /* | ||
3857 | * PCI configuration structures | ||
3858 | */ | ||
3859 | typedef struct _PCI_DATA_ { | ||
3860 | uchar type; | ||
3861 | uchar bus; | ||
3862 | uchar slot; | ||
3863 | uchar func; | ||
3864 | uchar offset; | ||
3865 | } PCI_DATA; | ||
3866 | |||
3867 | typedef struct _PCI_DEVICE_ { | ||
3868 | ushort vendorID; | ||
3869 | ushort deviceID; | ||
3870 | ushort slotNumber; | ||
3871 | ushort slotFound; | ||
3872 | uchar busNumber; | ||
3873 | uchar maxBusNumber; | ||
3874 | uchar devFunc; | ||
3875 | ushort startSlot; | ||
3876 | ushort endSlot; | ||
3877 | uchar bridge; | ||
3878 | uchar type; | ||
3879 | } PCI_DEVICE; | ||
3880 | |||
3881 | typedef struct _PCI_CONFIG_SPACE_ { | ||
3882 | ushort vendorID; | ||
3883 | ushort deviceID; | ||
3884 | ushort command; | ||
3885 | ushort status; | ||
3886 | uchar revision; | ||
3887 | uchar classCode[3]; | ||
3888 | uchar cacheSize; | ||
3889 | uchar latencyTimer; | ||
3890 | uchar headerType; | ||
3891 | uchar bist; | ||
3892 | ADV_PADDR baseAddress[6]; | ||
3893 | ushort reserved[4]; | ||
3894 | ADV_PADDR optionRomAddr; | ||
3895 | ushort reserved2[4]; | ||
3896 | uchar irqLine; | ||
3897 | uchar irqPin; | ||
3898 | uchar minGnt; | ||
3899 | uchar maxLatency; | ||
3900 | } PCI_CONFIG_SPACE; | ||
3901 | |||
3902 | /* | ||
3903 | * --- Driver Data | ||
3904 | */ | ||
3905 | |||
3906 | /* Note: All driver global data should be initialized. */ | ||
3907 | |||
3908 | /* Number of boards detected in system. */ | 3847 | /* Number of boards detected in system. */ |
3909 | static int asc_board_count = 0; | 3848 | static int asc_board_count; |
3849 | |||
3850 | /* Number of boards detected by advansys_detect */ | ||
3851 | static int asc_legacy_count; | ||
3910 | static struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL }; | 3852 | static struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL }; |
3911 | 3853 | ||
3912 | /* Overrun buffer used by all narrow boards. */ | 3854 | /* Overrun buffer used by all narrow boards. */ |
@@ -3918,12 +3860,11 @@ static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; | |||
3918 | static ASC_SCSI_Q asc_scsi_q = { {0} }; | 3860 | static ASC_SCSI_Q asc_scsi_q = { {0} }; |
3919 | static ASC_SG_HEAD asc_sg_head = { 0 }; | 3861 | static ASC_SG_HEAD asc_sg_head = { 0 }; |
3920 | 3862 | ||
3921 | /* List of supported bus types. */ | 3863 | /* List of bus types probed in advansys_detect. */ |
3922 | static ushort asc_bus[ASC_NUM_BUS] __initdata = { | 3864 | static ushort asc_bus[ASC_NUM_BUS] __initdata = { |
3923 | ASC_IS_ISA, | 3865 | ASC_IS_ISA, |
3924 | ASC_IS_VL, | 3866 | ASC_IS_VL, |
3925 | ASC_IS_EISA, | 3867 | ASC_IS_EISA, |
3926 | ASC_IS_PCI, | ||
3927 | }; | 3868 | }; |
3928 | 3869 | ||
3929 | static int asc_iopflag = ASC_FALSE; | 3870 | static int asc_iopflag = ASC_FALSE; |
@@ -3934,7 +3875,6 @@ static char *asc_bus_name[ASC_NUM_BUS] = { | |||
3934 | "ASC_IS_ISA", | 3875 | "ASC_IS_ISA", |
3935 | "ASC_IS_VL", | 3876 | "ASC_IS_VL", |
3936 | "ASC_IS_EISA", | 3877 | "ASC_IS_EISA", |
3937 | "ASC_IS_PCI", | ||
3938 | }; | 3878 | }; |
3939 | 3879 | ||
3940 | static int asc_dbglvl = 3; | 3880 | static int asc_dbglvl = 3; |
@@ -7441,7 +7381,7 @@ DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words) | |||
7441 | /* | 7381 | /* |
7442 | * Read a PCI configuration byte. | 7382 | * Read a PCI configuration byte. |
7443 | */ | 7383 | */ |
7444 | static uchar __init DvcReadPCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset) | 7384 | static uchar __devinit DvcReadPCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset) |
7445 | { | 7385 | { |
7446 | #ifdef CONFIG_PCI | 7386 | #ifdef CONFIG_PCI |
7447 | uchar byte_data; | 7387 | uchar byte_data; |
@@ -7455,7 +7395,7 @@ static uchar __init DvcReadPCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset) | |||
7455 | /* | 7395 | /* |
7456 | * Write a PCI configuration byte. | 7396 | * Write a PCI configuration byte. |
7457 | */ | 7397 | */ |
7458 | static void __init | 7398 | static void __devinit |
7459 | DvcWritePCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) | 7399 | DvcWritePCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) |
7460 | { | 7400 | { |
7461 | #ifdef CONFIG_PCI | 7401 | #ifdef CONFIG_PCI |
@@ -7467,7 +7407,7 @@ DvcWritePCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) | |||
7467 | * Return the BIOS address of the adapter at the specified | 7407 | * Return the BIOS address of the adapter at the specified |
7468 | * I/O port and with the specified bus type. | 7408 | * I/O port and with the specified bus type. |
7469 | */ | 7409 | */ |
7470 | static ushort __init AscGetChipBiosAddress(PortAddr iop_base, ushort bus_type) | 7410 | static ushort __devinit AscGetChipBiosAddress(PortAddr iop_base, ushort bus_type) |
7471 | { | 7411 | { |
7472 | ushort cfg_lsw; | 7412 | ushort cfg_lsw; |
7473 | ushort bios_addr; | 7413 | ushort bios_addr; |
@@ -7538,7 +7478,7 @@ DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq, | |||
7538 | /* | 7478 | /* |
7539 | * Read a PCI configuration byte. | 7479 | * Read a PCI configuration byte. |
7540 | */ | 7480 | */ |
7541 | static uchar __init DvcAdvReadPCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset) | 7481 | static uchar __devinit DvcAdvReadPCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset) |
7542 | { | 7482 | { |
7543 | #ifdef CONFIG_PCI | 7483 | #ifdef CONFIG_PCI |
7544 | uchar byte_data; | 7484 | uchar byte_data; |
@@ -7552,7 +7492,7 @@ static uchar __init DvcAdvReadPCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset) | |||
7552 | /* | 7492 | /* |
7553 | * Write a PCI configuration byte. | 7493 | * Write a PCI configuration byte. |
7554 | */ | 7494 | */ |
7555 | static void __init | 7495 | static void __devinit |
7556 | DvcAdvWritePCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) | 7496 | DvcAdvWritePCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) |
7557 | { | 7497 | { |
7558 | #ifdef CONFIG_PCI | 7498 | #ifdef CONFIG_PCI |
@@ -8148,7 +8088,7 @@ static void asc_prt_hex(char *f, uchar *s, int l) | |||
8148 | * --- Asc Library Functions | 8088 | * --- Asc Library Functions |
8149 | */ | 8089 | */ |
8150 | 8090 | ||
8151 | static ushort __init AscGetEisaChipCfg(PortAddr iop_base) | 8091 | static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base) |
8152 | { | 8092 | { |
8153 | PortAddr eisa_cfg_iop; | 8093 | PortAddr eisa_cfg_iop; |
8154 | 8094 | ||
@@ -8157,7 +8097,7 @@ static ushort __init AscGetEisaChipCfg(PortAddr iop_base) | |||
8157 | return (inpw(eisa_cfg_iop)); | 8097 | return (inpw(eisa_cfg_iop)); |
8158 | } | 8098 | } |
8159 | 8099 | ||
8160 | static uchar __init AscSetChipScsiID(PortAddr iop_base, uchar new_host_id) | 8100 | static uchar __devinit AscSetChipScsiID(PortAddr iop_base, uchar new_host_id) |
8161 | { | 8101 | { |
8162 | ushort cfg_lsw; | 8102 | ushort cfg_lsw; |
8163 | 8103 | ||
@@ -8171,7 +8111,7 @@ static uchar __init AscSetChipScsiID(PortAddr iop_base, uchar new_host_id) | |||
8171 | return (AscGetChipScsiID(iop_base)); | 8111 | return (AscGetChipScsiID(iop_base)); |
8172 | } | 8112 | } |
8173 | 8113 | ||
8174 | static uchar __init AscGetChipScsiCtrl(PortAddr iop_base) | 8114 | static uchar __devinit AscGetChipScsiCtrl(PortAddr iop_base) |
8175 | { | 8115 | { |
8176 | uchar sc; | 8116 | uchar sc; |
8177 | 8117 | ||
@@ -8181,7 +8121,7 @@ static uchar __init AscGetChipScsiCtrl(PortAddr iop_base) | |||
8181 | return (sc); | 8121 | return (sc); |
8182 | } | 8122 | } |
8183 | 8123 | ||
8184 | static uchar __init AscGetChipVersion(PortAddr iop_base, ushort bus_type) | 8124 | static uchar __devinit AscGetChipVersion(PortAddr iop_base, ushort bus_type) |
8185 | { | 8125 | { |
8186 | if ((bus_type & ASC_IS_EISA) != 0) { | 8126 | if ((bus_type & ASC_IS_EISA) != 0) { |
8187 | PortAddr eisa_iop; | 8127 | PortAddr eisa_iop; |
@@ -8194,7 +8134,7 @@ static uchar __init AscGetChipVersion(PortAddr iop_base, ushort bus_type) | |||
8194 | return (AscGetChipVerNo(iop_base)); | 8134 | return (AscGetChipVerNo(iop_base)); |
8195 | } | 8135 | } |
8196 | 8136 | ||
8197 | static ushort __init AscGetChipBusType(PortAddr iop_base) | 8137 | static ushort __devinit AscGetChipBusType(PortAddr iop_base) |
8198 | { | 8138 | { |
8199 | ushort chip_ver; | 8139 | ushort chip_ver; |
8200 | 8140 | ||
@@ -8346,14 +8286,14 @@ static void __init AscSetISAPNPWaitForKey(void) | |||
8346 | } | 8286 | } |
8347 | #endif /* CONFIG_ISA */ | 8287 | #endif /* CONFIG_ISA */ |
8348 | 8288 | ||
8349 | static void __init AscToggleIRQAct(PortAddr iop_base) | 8289 | static void __devinit AscToggleIRQAct(PortAddr iop_base) |
8350 | { | 8290 | { |
8351 | AscSetChipStatus(iop_base, CIW_IRQ_ACT); | 8291 | AscSetChipStatus(iop_base, CIW_IRQ_ACT); |
8352 | AscSetChipStatus(iop_base, 0); | 8292 | AscSetChipStatus(iop_base, 0); |
8353 | return; | 8293 | return; |
8354 | } | 8294 | } |
8355 | 8295 | ||
8356 | static uchar __init AscGetChipIRQ(PortAddr iop_base, ushort bus_type) | 8296 | static uchar __devinit AscGetChipIRQ(PortAddr iop_base, ushort bus_type) |
8357 | { | 8297 | { |
8358 | ushort cfg_lsw; | 8298 | ushort cfg_lsw; |
8359 | uchar chip_irq; | 8299 | uchar chip_irq; |
@@ -8381,7 +8321,7 @@ static uchar __init AscGetChipIRQ(PortAddr iop_base, ushort bus_type) | |||
8381 | return ((uchar)(chip_irq + ASC_MIN_IRQ_NO)); | 8321 | return ((uchar)(chip_irq + ASC_MIN_IRQ_NO)); |
8382 | } | 8322 | } |
8383 | 8323 | ||
8384 | static uchar __init | 8324 | static uchar __devinit |
8385 | AscSetChipIRQ(PortAddr iop_base, uchar irq_no, ushort bus_type) | 8325 | AscSetChipIRQ(PortAddr iop_base, uchar irq_no, ushort bus_type) |
8386 | { | 8326 | { |
8387 | ushort cfg_lsw; | 8327 | ushort cfg_lsw; |
@@ -8418,7 +8358,7 @@ AscSetChipIRQ(PortAddr iop_base, uchar irq_no, ushort bus_type) | |||
8418 | } | 8358 | } |
8419 | 8359 | ||
8420 | #ifdef CONFIG_ISA | 8360 | #ifdef CONFIG_ISA |
8421 | static void __init AscEnableIsaDma(uchar dma_channel) | 8361 | static void __devinit AscEnableIsaDma(uchar dma_channel) |
8422 | { | 8362 | { |
8423 | if (dma_channel < 4) { | 8363 | if (dma_channel < 4) { |
8424 | outp(0x000B, (ushort)(0xC0 | dma_channel)); | 8364 | outp(0x000B, (ushort)(0xC0 | dma_channel)); |
@@ -10500,7 +10440,7 @@ static int AscResetChipAndScsiBus(ASC_DVC_VAR *asc_dvc) | |||
10500 | return (AscIsChipHalted(iop_base)); | 10440 | return (AscIsChipHalted(iop_base)); |
10501 | } | 10441 | } |
10502 | 10442 | ||
10503 | static ASC_DCNT __init AscGetMaxDmaCount(ushort bus_type) | 10443 | static ASC_DCNT __devinit AscGetMaxDmaCount(ushort bus_type) |
10504 | { | 10444 | { |
10505 | if (bus_type & ASC_IS_ISA) | 10445 | if (bus_type & ASC_IS_ISA) |
10506 | return (ASC_MAX_ISA_DMA_COUNT); | 10446 | return (ASC_MAX_ISA_DMA_COUNT); |
@@ -10510,7 +10450,7 @@ static ASC_DCNT __init AscGetMaxDmaCount(ushort bus_type) | |||
10510 | } | 10450 | } |
10511 | 10451 | ||
10512 | #ifdef CONFIG_ISA | 10452 | #ifdef CONFIG_ISA |
10513 | static ushort __init AscGetIsaDmaChannel(PortAddr iop_base) | 10453 | static ushort __devinit AscGetIsaDmaChannel(PortAddr iop_base) |
10514 | { | 10454 | { |
10515 | ushort channel; | 10455 | ushort channel; |
10516 | 10456 | ||
@@ -10522,7 +10462,7 @@ static ushort __init AscGetIsaDmaChannel(PortAddr iop_base) | |||
10522 | return (channel + 4); | 10462 | return (channel + 4); |
10523 | } | 10463 | } |
10524 | 10464 | ||
10525 | static ushort __init AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel) | 10465 | static ushort __devinit AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel) |
10526 | { | 10466 | { |
10527 | ushort cfg_lsw; | 10467 | ushort cfg_lsw; |
10528 | uchar value; | 10468 | uchar value; |
@@ -10540,7 +10480,7 @@ static ushort __init AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel) | |||
10540 | return (0); | 10480 | return (0); |
10541 | } | 10481 | } |
10542 | 10482 | ||
10543 | static uchar __init AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value) | 10483 | static uchar __devinit AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value) |
10544 | { | 10484 | { |
10545 | speed_value &= 0x07; | 10485 | speed_value &= 0x07; |
10546 | AscSetBank(iop_base, 1); | 10486 | AscSetBank(iop_base, 1); |
@@ -10549,7 +10489,7 @@ static uchar __init AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value) | |||
10549 | return (AscGetIsaDmaSpeed(iop_base)); | 10489 | return (AscGetIsaDmaSpeed(iop_base)); |
10550 | } | 10490 | } |
10551 | 10491 | ||
10552 | static uchar __init AscGetIsaDmaSpeed(PortAddr iop_base) | 10492 | static uchar __devinit AscGetIsaDmaSpeed(PortAddr iop_base) |
10553 | { | 10493 | { |
10554 | uchar speed_value; | 10494 | uchar speed_value; |
10555 | 10495 | ||
@@ -10561,7 +10501,7 @@ static uchar __init AscGetIsaDmaSpeed(PortAddr iop_base) | |||
10561 | } | 10501 | } |
10562 | #endif /* CONFIG_ISA */ | 10502 | #endif /* CONFIG_ISA */ |
10563 | 10503 | ||
10564 | static ushort __init | 10504 | static ushort __devinit |
10565 | AscReadPCIConfigWord(ASC_DVC_VAR *asc_dvc, ushort pci_config_offset) | 10505 | AscReadPCIConfigWord(ASC_DVC_VAR *asc_dvc, ushort pci_config_offset) |
10566 | { | 10506 | { |
10567 | uchar lsb, msb; | 10507 | uchar lsb, msb; |
@@ -10571,7 +10511,7 @@ AscReadPCIConfigWord(ASC_DVC_VAR *asc_dvc, ushort pci_config_offset) | |||
10571 | return ((ushort)((msb << 8) | lsb)); | 10511 | return ((ushort)((msb << 8) | lsb)); |
10572 | } | 10512 | } |
10573 | 10513 | ||
10574 | static ushort __init AscInitGetConfig(ASC_DVC_VAR *asc_dvc) | 10514 | static ushort __devinit AscInitGetConfig(ASC_DVC_VAR *asc_dvc) |
10575 | { | 10515 | { |
10576 | ushort warn_code; | 10516 | ushort warn_code; |
10577 | PortAddr iop_base; | 10517 | PortAddr iop_base; |
@@ -10656,7 +10596,7 @@ static ushort __init AscInitGetConfig(ASC_DVC_VAR *asc_dvc) | |||
10656 | return (warn_code); | 10596 | return (warn_code); |
10657 | } | 10597 | } |
10658 | 10598 | ||
10659 | static ushort __init AscInitSetConfig(ASC_DVC_VAR *asc_dvc) | 10599 | static ushort __devinit AscInitSetConfig(ASC_DVC_VAR *asc_dvc) |
10660 | { | 10600 | { |
10661 | ushort warn_code = 0; | 10601 | ushort warn_code = 0; |
10662 | 10602 | ||
@@ -10672,7 +10612,7 @@ static ushort __init AscInitSetConfig(ASC_DVC_VAR *asc_dvc) | |||
10672 | return (warn_code); | 10612 | return (warn_code); |
10673 | } | 10613 | } |
10674 | 10614 | ||
10675 | static ushort __init AscInitFromAscDvcVar(ASC_DVC_VAR *asc_dvc) | 10615 | static ushort __devinit AscInitFromAscDvcVar(ASC_DVC_VAR *asc_dvc) |
10676 | { | 10616 | { |
10677 | PortAddr iop_base; | 10617 | PortAddr iop_base; |
10678 | ushort cfg_msw; | 10618 | ushort cfg_msw; |
@@ -10773,7 +10713,7 @@ static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc) | |||
10773 | return (warn_code); | 10713 | return (warn_code); |
10774 | } | 10714 | } |
10775 | 10715 | ||
10776 | static ushort __init AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) | 10716 | static ushort __devinit AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) |
10777 | { | 10717 | { |
10778 | int i; | 10718 | int i; |
10779 | PortAddr iop_base; | 10719 | PortAddr iop_base; |
@@ -10885,7 +10825,7 @@ static ushort __init AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) | |||
10885 | return (warn_code); | 10825 | return (warn_code); |
10886 | } | 10826 | } |
10887 | 10827 | ||
10888 | static ushort __init AscInitFromEEP(ASC_DVC_VAR *asc_dvc) | 10828 | static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc) |
10889 | { | 10829 | { |
10890 | ASCEEP_CONFIG eep_config_buf; | 10830 | ASCEEP_CONFIG eep_config_buf; |
10891 | ASCEEP_CONFIG *eep_config; | 10831 | ASCEEP_CONFIG *eep_config; |
@@ -11106,7 +11046,7 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc) | |||
11106 | return (warn_code); | 11046 | return (warn_code); |
11107 | } | 11047 | } |
11108 | 11048 | ||
11109 | static int __init AscTestExternalLram(ASC_DVC_VAR *asc_dvc) | 11049 | static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc) |
11110 | { | 11050 | { |
11111 | PortAddr iop_base; | 11051 | PortAddr iop_base; |
11112 | ushort q_addr; | 11052 | ushort q_addr; |
@@ -11128,7 +11068,7 @@ static int __init AscTestExternalLram(ASC_DVC_VAR *asc_dvc) | |||
11128 | return (sta); | 11068 | return (sta); |
11129 | } | 11069 | } |
11130 | 11070 | ||
11131 | static int __init AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg) | 11071 | static int __devinit AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg) |
11132 | { | 11072 | { |
11133 | uchar read_back; | 11073 | uchar read_back; |
11134 | int retry; | 11074 | int retry; |
@@ -11147,7 +11087,7 @@ static int __init AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg) | |||
11147 | } | 11087 | } |
11148 | } | 11088 | } |
11149 | 11089 | ||
11150 | static int __init AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) | 11090 | static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) |
11151 | { | 11091 | { |
11152 | ushort read_back; | 11092 | ushort read_back; |
11153 | int retry; | 11093 | int retry; |
@@ -11166,19 +11106,19 @@ static int __init AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) | |||
11166 | } | 11106 | } |
11167 | } | 11107 | } |
11168 | 11108 | ||
11169 | static void __init AscWaitEEPRead(void) | 11109 | static void __devinit AscWaitEEPRead(void) |
11170 | { | 11110 | { |
11171 | DvcSleepMilliSecond(1); | 11111 | DvcSleepMilliSecond(1); |
11172 | return; | 11112 | return; |
11173 | } | 11113 | } |
11174 | 11114 | ||
11175 | static void __init AscWaitEEPWrite(void) | 11115 | static void __devinit AscWaitEEPWrite(void) |
11176 | { | 11116 | { |
11177 | DvcSleepMilliSecond(20); | 11117 | DvcSleepMilliSecond(20); |
11178 | return; | 11118 | return; |
11179 | } | 11119 | } |
11180 | 11120 | ||
11181 | static ushort __init AscReadEEPWord(PortAddr iop_base, uchar addr) | 11121 | static ushort __devinit AscReadEEPWord(PortAddr iop_base, uchar addr) |
11182 | { | 11122 | { |
11183 | ushort read_wval; | 11123 | ushort read_wval; |
11184 | uchar cmd_reg; | 11124 | uchar cmd_reg; |
@@ -11193,7 +11133,7 @@ static ushort __init AscReadEEPWord(PortAddr iop_base, uchar addr) | |||
11193 | return (read_wval); | 11133 | return (read_wval); |
11194 | } | 11134 | } |
11195 | 11135 | ||
11196 | static ushort __init | 11136 | static ushort __devinit |
11197 | AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val) | 11137 | AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val) |
11198 | { | 11138 | { |
11199 | ushort read_wval; | 11139 | ushort read_wval; |
@@ -11214,7 +11154,7 @@ AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val) | |||
11214 | return (read_wval); | 11154 | return (read_wval); |
11215 | } | 11155 | } |
11216 | 11156 | ||
11217 | static ushort __init | 11157 | static ushort __devinit |
11218 | AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) | 11158 | AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) |
11219 | { | 11159 | { |
11220 | ushort wval; | 11160 | ushort wval; |
@@ -11261,7 +11201,7 @@ AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) | |||
11261 | return (sum); | 11201 | return (sum); |
11262 | } | 11202 | } |
11263 | 11203 | ||
11264 | static int __init | 11204 | static int __devinit |
11265 | AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) | 11205 | AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) |
11266 | { | 11206 | { |
11267 | int n_error; | 11207 | int n_error; |
@@ -11357,7 +11297,7 @@ AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) | |||
11357 | return (n_error); | 11297 | return (n_error); |
11358 | } | 11298 | } |
11359 | 11299 | ||
11360 | static int __init | 11300 | static int __devinit |
11361 | AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) | 11301 | AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) |
11362 | { | 11302 | { |
11363 | int retry; | 11303 | int retry; |
@@ -13769,7 +13709,7 @@ static ADV_DCNT _adv_asc38C1600_chksum = 0x0604EF77UL; /* Expanded little-endian | |||
13769 | * on big-endian platforms so char fields read as words are actually being | 13709 | * on big-endian platforms so char fields read as words are actually being |
13770 | * unswapped on big-endian platforms. | 13710 | * unswapped on big-endian platforms. |
13771 | */ | 13711 | */ |
13772 | static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __initdata = { | 13712 | static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __devinitdata = { |
13773 | ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */ | 13713 | ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */ |
13774 | 0x0000, /* cfg_msw */ | 13714 | 0x0000, /* cfg_msw */ |
13775 | 0xFFFF, /* disc_enable */ | 13715 | 0xFFFF, /* disc_enable */ |
@@ -13807,7 +13747,7 @@ static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __initdata = { | |||
13807 | 0 /* num_of_err */ | 13747 | 0 /* num_of_err */ |
13808 | }; | 13748 | }; |
13809 | 13749 | ||
13810 | static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __initdata = { | 13750 | static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __devinitdata = { |
13811 | 0, /* cfg_lsw */ | 13751 | 0, /* cfg_lsw */ |
13812 | 0, /* cfg_msw */ | 13752 | 0, /* cfg_msw */ |
13813 | 0, /* -disc_enable */ | 13753 | 0, /* -disc_enable */ |
@@ -13845,7 +13785,7 @@ static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __initdata = { | |||
13845 | 0 /* num_of_err */ | 13785 | 0 /* num_of_err */ |
13846 | }; | 13786 | }; |
13847 | 13787 | ||
13848 | static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __initdata = { | 13788 | static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __devinitdata = { |
13849 | ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ | 13789 | ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ |
13850 | 0x0000, /* 01 cfg_msw */ | 13790 | 0x0000, /* 01 cfg_msw */ |
13851 | 0xFFFF, /* 02 disc_enable */ | 13791 | 0xFFFF, /* 02 disc_enable */ |
@@ -13910,7 +13850,7 @@ static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __initdata = { | |||
13910 | 0 /* 63 reserved */ | 13850 | 0 /* 63 reserved */ |
13911 | }; | 13851 | }; |
13912 | 13852 | ||
13913 | static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __initdata = { | 13853 | static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __devinitdata = { |
13914 | 0, /* 00 cfg_lsw */ | 13854 | 0, /* 00 cfg_lsw */ |
13915 | 0, /* 01 cfg_msw */ | 13855 | 0, /* 01 cfg_msw */ |
13916 | 0, /* 02 disc_enable */ | 13856 | 0, /* 02 disc_enable */ |
@@ -13975,7 +13915,7 @@ static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __initdata = { | |||
13975 | 0 /* 63 reserved */ | 13915 | 0 /* 63 reserved */ |
13976 | }; | 13916 | }; |
13977 | 13917 | ||
13978 | static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __initdata = { | 13918 | static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __devinitdata = { |
13979 | ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ | 13919 | ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ |
13980 | 0x0000, /* 01 cfg_msw */ | 13920 | 0x0000, /* 01 cfg_msw */ |
13981 | 0xFFFF, /* 02 disc_enable */ | 13921 | 0xFFFF, /* 02 disc_enable */ |
@@ -14040,7 +13980,7 @@ static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __initdata = { | |||
14040 | 0 /* 63 reserved */ | 13980 | 0 /* 63 reserved */ |
14041 | }; | 13981 | }; |
14042 | 13982 | ||
14043 | static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __initdata = { | 13983 | static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __devinitdata = { |
14044 | 0, /* 00 cfg_lsw */ | 13984 | 0, /* 00 cfg_lsw */ |
14045 | 0, /* 01 cfg_msw */ | 13985 | 0, /* 01 cfg_msw */ |
14046 | 0, /* 02 disc_enable */ | 13986 | 0, /* 02 disc_enable */ |
@@ -14113,7 +14053,7 @@ static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __initdata = { | |||
14113 | * For a non-fatal error return a warning code. If there are no warnings | 14053 | * For a non-fatal error return a warning code. If there are no warnings |
14114 | * then 0 is returned. | 14054 | * then 0 is returned. |
14115 | */ | 14055 | */ |
14116 | static int __init AdvInitGetConfig(ADV_DVC_VAR *asc_dvc) | 14056 | static int __devinit AdvInitGetConfig(ADV_DVC_VAR *asc_dvc) |
14117 | { | 14057 | { |
14118 | ushort warn_code; | 14058 | ushort warn_code; |
14119 | AdvPortAddr iop_base; | 14059 | AdvPortAddr iop_base; |
@@ -16057,7 +15997,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) | |||
16057 | * | 15997 | * |
16058 | * Note: Chip is stopped on entry. | 15998 | * Note: Chip is stopped on entry. |
16059 | */ | 15999 | */ |
16060 | static int __init AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) | 16000 | static int __devinit AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) |
16061 | { | 16001 | { |
16062 | AdvPortAddr iop_base; | 16002 | AdvPortAddr iop_base; |
16063 | ushort warn_code; | 16003 | ushort warn_code; |
@@ -16211,7 +16151,7 @@ static int __init AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) | |||
16211 | * | 16151 | * |
16212 | * Note: Chip is stopped on entry. | 16152 | * Note: Chip is stopped on entry. |
16213 | */ | 16153 | */ |
16214 | static int __init AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) | 16154 | static int __devinit AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) |
16215 | { | 16155 | { |
16216 | AdvPortAddr iop_base; | 16156 | AdvPortAddr iop_base; |
16217 | ushort warn_code; | 16157 | ushort warn_code; |
@@ -16414,7 +16354,7 @@ static int __init AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) | |||
16414 | * | 16354 | * |
16415 | * Note: Chip is stopped on entry. | 16355 | * Note: Chip is stopped on entry. |
16416 | */ | 16356 | */ |
16417 | static int __init AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) | 16357 | static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) |
16418 | { | 16358 | { |
16419 | AdvPortAddr iop_base; | 16359 | AdvPortAddr iop_base; |
16420 | ushort warn_code; | 16360 | ushort warn_code; |
@@ -16655,7 +16595,7 @@ static int __init AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) | |||
16655 | * | 16595 | * |
16656 | * Return a checksum based on the EEPROM configuration read. | 16596 | * Return a checksum based on the EEPROM configuration read. |
16657 | */ | 16597 | */ |
16658 | static ushort __init | 16598 | static ushort __devinit |
16659 | AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) | 16599 | AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) |
16660 | { | 16600 | { |
16661 | ushort wval, chksum; | 16601 | ushort wval, chksum; |
@@ -16698,7 +16638,7 @@ AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) | |||
16698 | * | 16638 | * |
16699 | * Return a checksum based on the EEPROM configuration read. | 16639 | * Return a checksum based on the EEPROM configuration read. |
16700 | */ | 16640 | */ |
16701 | static ushort __init | 16641 | static ushort __devinit |
16702 | AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) | 16642 | AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) |
16703 | { | 16643 | { |
16704 | ushort wval, chksum; | 16644 | ushort wval, chksum; |
@@ -16741,7 +16681,7 @@ AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) | |||
16741 | * | 16681 | * |
16742 | * Return a checksum based on the EEPROM configuration read. | 16682 | * Return a checksum based on the EEPROM configuration read. |
16743 | */ | 16683 | */ |
16744 | static ushort __init | 16684 | static ushort __devinit |
16745 | AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) | 16685 | AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) |
16746 | { | 16686 | { |
16747 | ushort wval, chksum; | 16687 | ushort wval, chksum; |
@@ -16782,7 +16722,7 @@ AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) | |||
16782 | /* | 16722 | /* |
16783 | * Read the EEPROM from specified location | 16723 | * Read the EEPROM from specified location |
16784 | */ | 16724 | */ |
16785 | static ushort __init AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) | 16725 | static ushort __devinit AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) |
16786 | { | 16726 | { |
16787 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, | 16727 | AdvWriteWordRegister(iop_base, IOPW_EE_CMD, |
16788 | ASC_EEP_CMD_READ | eep_word_addr); | 16728 | ASC_EEP_CMD_READ | eep_word_addr); |
@@ -16793,7 +16733,7 @@ static ushort __init AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) | |||
16793 | /* | 16733 | /* |
16794 | * Wait for EEPROM command to complete | 16734 | * Wait for EEPROM command to complete |
16795 | */ | 16735 | */ |
16796 | static void __init AdvWaitEEPCmd(AdvPortAddr iop_base) | 16736 | static void __devinit AdvWaitEEPCmd(AdvPortAddr iop_base) |
16797 | { | 16737 | { |
16798 | int eep_delay_ms; | 16738 | int eep_delay_ms; |
16799 | 16739 | ||
@@ -16814,7 +16754,7 @@ static void __init AdvWaitEEPCmd(AdvPortAddr iop_base) | |||
16814 | /* | 16754 | /* |
16815 | * Write the EEPROM from 'cfg_buf'. | 16755 | * Write the EEPROM from 'cfg_buf'. |
16816 | */ | 16756 | */ |
16817 | void __init | 16757 | void __devinit |
16818 | AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) | 16758 | AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) |
16819 | { | 16759 | { |
16820 | ushort *wbuf; | 16760 | ushort *wbuf; |
@@ -16882,7 +16822,7 @@ AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) | |||
16882 | /* | 16822 | /* |
16883 | * Write the EEPROM from 'cfg_buf'. | 16823 | * Write the EEPROM from 'cfg_buf'. |
16884 | */ | 16824 | */ |
16885 | void __init | 16825 | void __devinit |
16886 | AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) | 16826 | AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) |
16887 | { | 16827 | { |
16888 | ushort *wbuf; | 16828 | ushort *wbuf; |
@@ -16950,7 +16890,7 @@ AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) | |||
16950 | /* | 16890 | /* |
16951 | * Write the EEPROM from 'cfg_buf'. | 16891 | * Write the EEPROM from 'cfg_buf'. |
16952 | */ | 16892 | */ |
16953 | void __init | 16893 | void __devinit |
16954 | AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) | 16894 | AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) |
16955 | { | 16895 | { |
16956 | ushort *wbuf; | 16896 | ushort *wbuf; |
@@ -17838,13 +17778,10 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
17838 | if (!shost) | 17778 | if (!shost) |
17839 | return NULL; | 17779 | return NULL; |
17840 | 17780 | ||
17841 | /* Save a pointer to the Scsi_Host of each board found. */ | ||
17842 | asc_host[asc_board_count++] = shost; | ||
17843 | |||
17844 | /* Initialize private per board data */ | 17781 | /* Initialize private per board data */ |
17845 | boardp = ASC_BOARDP(shost); | 17782 | boardp = ASC_BOARDP(shost); |
17846 | memset(boardp, 0, sizeof(asc_board_t)); | 17783 | memset(boardp, 0, sizeof(asc_board_t)); |
17847 | boardp->id = asc_board_count - 1; | 17784 | boardp->id = asc_board_count++; |
17848 | 17785 | ||
17849 | /* Initialize spinlock. */ | 17786 | /* Initialize spinlock. */ |
17850 | spin_lock_init(&boardp->lock); | 17787 | spin_lock_init(&boardp->lock); |
@@ -18518,7 +18455,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
18518 | iounmap(boardp->ioremap_addr); | 18455 | iounmap(boardp->ioremap_addr); |
18519 | err_shost: | 18456 | err_shost: |
18520 | scsi_host_put(shost); | 18457 | scsi_host_put(shost); |
18521 | asc_board_count--; | ||
18522 | return NULL; | 18458 | return NULL; |
18523 | } | 18459 | } |
18524 | 18460 | ||
@@ -18540,27 +18476,11 @@ static int __init advansys_detect(void) | |||
18540 | int iop; | 18476 | int iop; |
18541 | int bus; | 18477 | int bus; |
18542 | int ioport = 0; | 18478 | int ioport = 0; |
18543 | struct device *dev = NULL; | 18479 | struct Scsi_Host *shost; |
18544 | #ifdef CONFIG_PCI | ||
18545 | int pci_init_search = 0; | ||
18546 | struct pci_dev *pci_devicep[ASC_NUM_BOARD_SUPPORTED]; | ||
18547 | int pci_card_cnt_max = 0; | ||
18548 | int pci_card_cnt = 0; | ||
18549 | struct pci_dev *pdev = NULL; | ||
18550 | int pci_device_id_cnt = 0; | ||
18551 | unsigned int pci_device_id[ASC_PCI_DEVICE_ID_CNT] = { | ||
18552 | PCI_DEVICE_ID_ASP_1200A, | ||
18553 | PCI_DEVICE_ID_ASP_ABP940, | ||
18554 | PCI_DEVICE_ID_ASP_ABP940U, | ||
18555 | PCI_DEVICE_ID_ASP_ABP940UW, | ||
18556 | PCI_DEVICE_ID_38C0800_REV1, | ||
18557 | PCI_DEVICE_ID_38C1600_REV1 | ||
18558 | }; | ||
18559 | #endif /* CONFIG_PCI */ | ||
18560 | 18480 | ||
18561 | ASC_DBG(1, "advansys_detect: begin\n"); | 18481 | ASC_DBG(1, "advansys_detect: begin\n"); |
18562 | 18482 | ||
18563 | asc_board_count = 0; | 18483 | asc_legacy_count = 0; |
18564 | 18484 | ||
18565 | /* | 18485 | /* |
18566 | * If I/O port probing has been modified, then verify and | 18486 | * If I/O port probing has been modified, then verify and |
@@ -18595,10 +18515,10 @@ static int __init advansys_detect(void) | |||
18595 | bus, asc_bus_name[bus]); | 18515 | bus, asc_bus_name[bus]); |
18596 | iop = 0; | 18516 | iop = 0; |
18597 | 18517 | ||
18598 | while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) { | 18518 | while (asc_legacy_count < ASC_NUM_BOARD_SUPPORTED) { |
18599 | 18519 | ||
18600 | ASC_DBG1(2, "advansys_detect: asc_board_count %d\n", | 18520 | ASC_DBG1(2, "advansys_detect: asc_legacy_count %d\n", |
18601 | asc_board_count); | 18521 | asc_legacy_count); |
18602 | 18522 | ||
18603 | switch (asc_bus[bus]) { | 18523 | switch (asc_bus[bus]) { |
18604 | case ASC_IS_ISA: | 18524 | case ASC_IS_ISA: |
@@ -18693,97 +18613,6 @@ static int __init advansys_detect(void) | |||
18693 | #endif /* CONFIG_ISA */ | 18613 | #endif /* CONFIG_ISA */ |
18694 | break; | 18614 | break; |
18695 | 18615 | ||
18696 | case ASC_IS_PCI: | ||
18697 | #ifdef CONFIG_PCI | ||
18698 | if (pci_init_search == 0) { | ||
18699 | int i, j; | ||
18700 | |||
18701 | pci_init_search = 1; | ||
18702 | |||
18703 | /* Find all PCI cards. */ | ||
18704 | while (pci_device_id_cnt < | ||
18705 | ASC_PCI_DEVICE_ID_CNT) { | ||
18706 | if ((pdev = | ||
18707 | pci_find_device | ||
18708 | (PCI_VENDOR_ID_ASP, | ||
18709 | pci_device_id | ||
18710 | [pci_device_id_cnt], | ||
18711 | pdev)) == NULL) { | ||
18712 | pci_device_id_cnt++; | ||
18713 | } else { | ||
18714 | if (pci_enable_device | ||
18715 | (pdev) == 0) { | ||
18716 | pci_devicep | ||
18717 | [pci_card_cnt_max++] | ||
18718 | = pdev; | ||
18719 | } | ||
18720 | } | ||
18721 | } | ||
18722 | |||
18723 | /* | ||
18724 | * Sort PCI cards in ascending order by PCI Bus, Slot, | ||
18725 | * and Device Number. | ||
18726 | */ | ||
18727 | for (i = 0; i < pci_card_cnt_max - 1; | ||
18728 | i++) { | ||
18729 | for (j = i + 1; | ||
18730 | j < pci_card_cnt_max; | ||
18731 | j++) { | ||
18732 | if ((pci_devicep[j]-> | ||
18733 | bus->number < | ||
18734 | pci_devicep[i]-> | ||
18735 | bus->number) | ||
18736 | || | ||
18737 | ((pci_devicep[j]-> | ||
18738 | bus->number == | ||
18739 | pci_devicep[i]-> | ||
18740 | bus->number) | ||
18741 | && | ||
18742 | (pci_devicep[j]-> | ||
18743 | devfn < | ||
18744 | pci_devicep[i]-> | ||
18745 | devfn))) { | ||
18746 | pdev = | ||
18747 | pci_devicep | ||
18748 | [i]; | ||
18749 | pci_devicep[i] = | ||
18750 | pci_devicep | ||
18751 | [j]; | ||
18752 | pci_devicep[j] = | ||
18753 | pdev; | ||
18754 | } | ||
18755 | } | ||
18756 | } | ||
18757 | |||
18758 | pci_card_cnt = 0; | ||
18759 | } else { | ||
18760 | pci_card_cnt++; | ||
18761 | } | ||
18762 | |||
18763 | if (pci_card_cnt == pci_card_cnt_max) { | ||
18764 | iop = 0; | ||
18765 | } else { | ||
18766 | pdev = pci_devicep[pci_card_cnt]; | ||
18767 | |||
18768 | ASC_DBG2(2, | ||
18769 | "advansys_detect: devfn %d, bus number %d\n", | ||
18770 | pdev->devfn, | ||
18771 | pdev->bus->number); | ||
18772 | iop = pci_resource_start(pdev, 0); | ||
18773 | ASC_DBG2(1, | ||
18774 | "advansys_detect: vendorID %X, deviceID %X\n", | ||
18775 | pdev->vendor, | ||
18776 | pdev->device); | ||
18777 | ASC_DBG2(2, | ||
18778 | "advansys_detect: iop %X, irqLine %d\n", | ||
18779 | iop, pdev->irq); | ||
18780 | } | ||
18781 | if (pdev) | ||
18782 | dev = &pdev->dev; | ||
18783 | |||
18784 | #endif /* CONFIG_PCI */ | ||
18785 | break; | ||
18786 | |||
18787 | default: | 18616 | default: |
18788 | ASC_PRINT1 | 18617 | ASC_PRINT1 |
18789 | ("advansys_detect: unknown bus type: %d\n", | 18618 | ("advansys_detect: unknown bus type: %d\n", |
@@ -18795,17 +18624,19 @@ static int __init advansys_detect(void) | |||
18795 | /* | 18624 | /* |
18796 | * Adapter not found, try next bus type. | 18625 | * Adapter not found, try next bus type. |
18797 | */ | 18626 | */ |
18798 | if (iop == 0) { | 18627 | if (iop == 0) |
18799 | break; | 18628 | break; |
18800 | } | ||
18801 | 18629 | ||
18802 | advansys_board_found(iop, dev, asc_bus[bus]); | 18630 | shost = advansys_board_found(iop, NULL, asc_bus[bus]); |
18631 | if (shost) { | ||
18632 | asc_host[asc_legacy_count++] = shost; | ||
18633 | } | ||
18803 | } | 18634 | } |
18804 | } | 18635 | } |
18805 | 18636 | ||
18806 | ASC_DBG1(1, "advansys_detect: done: asc_board_count %d\n", | 18637 | ASC_DBG1(1, "advansys_detect: done: asc_legacy_count %d\n", |
18807 | asc_board_count); | 18638 | asc_legacy_count); |
18808 | return asc_board_count; | 18639 | return asc_legacy_count; |
18809 | } | 18640 | } |
18810 | 18641 | ||
18811 | /* | 18642 | /* |
@@ -18836,7 +18667,6 @@ static int advansys_release(struct Scsi_Host *shost) | |||
18836 | return 0; | 18667 | return 0; |
18837 | } | 18668 | } |
18838 | 18669 | ||
18839 | #ifdef CONFIG_PCI | ||
18840 | /* PCI Devices supported by this driver */ | 18670 | /* PCI Devices supported by this driver */ |
18841 | static struct pci_device_id advansys_pci_tbl[] __devinitdata = { | 18671 | static struct pci_device_id advansys_pci_tbl[] __devinitdata = { |
18842 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, | 18672 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, |
@@ -18855,23 +18685,73 @@ static struct pci_device_id advansys_pci_tbl[] __devinitdata = { | |||
18855 | }; | 18685 | }; |
18856 | 18686 | ||
18857 | MODULE_DEVICE_TABLE(pci, advansys_pci_tbl); | 18687 | MODULE_DEVICE_TABLE(pci, advansys_pci_tbl); |
18858 | #endif /* CONFIG_PCI */ | 18688 | |
18689 | static int __devinit | ||
18690 | advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
18691 | { | ||
18692 | int err, ioport; | ||
18693 | struct Scsi_Host *shost; | ||
18694 | |||
18695 | err = pci_enable_device(pdev); | ||
18696 | if (err) | ||
18697 | goto fail; | ||
18698 | |||
18699 | if (pci_resource_len(pdev, 0) == 0) | ||
18700 | goto nodev; | ||
18701 | |||
18702 | ioport = pci_resource_start(pdev, 0); | ||
18703 | shost = advansys_board_found(ioport, &pdev->dev, ASC_IS_PCI); | ||
18704 | |||
18705 | if (!shost) | ||
18706 | goto nodev; | ||
18707 | |||
18708 | pci_set_drvdata(pdev, shost); | ||
18709 | return 0; | ||
18710 | |||
18711 | nodev: | ||
18712 | err = -ENODEV; | ||
18713 | pci_disable_device(pdev); | ||
18714 | fail: | ||
18715 | return err; | ||
18716 | } | ||
18717 | |||
18718 | static void __devexit advansys_pci_remove(struct pci_dev *pdev) | ||
18719 | { | ||
18720 | advansys_release(pci_get_drvdata(pdev)); | ||
18721 | pci_disable_device(pdev); | ||
18722 | } | ||
18723 | |||
18724 | static struct pci_driver advansys_pci_driver = { | ||
18725 | .name = "advansys", | ||
18726 | .id_table = advansys_pci_tbl, | ||
18727 | .probe = advansys_pci_probe, | ||
18728 | .remove = __devexit_p(advansys_pci_remove), | ||
18729 | }; | ||
18859 | 18730 | ||
18860 | static int __init advansys_init(void) | 18731 | static int __init advansys_init(void) |
18861 | { | 18732 | { |
18862 | int count; | 18733 | int i, error; |
18863 | count = advansys_detect(); | 18734 | advansys_detect(); |
18864 | if (count == 0) | 18735 | error = pci_register_driver(&advansys_pci_driver); |
18865 | return -ENODEV; | 18736 | if (error) |
18737 | goto fail; | ||
18866 | 18738 | ||
18867 | return 0; | 18739 | return 0; |
18740 | |||
18741 | fail: | ||
18742 | for (i = 0; i < asc_legacy_count; i++) | ||
18743 | advansys_release(asc_host[i]); | ||
18744 | |||
18745 | return error; | ||
18868 | } | 18746 | } |
18869 | 18747 | ||
18870 | static void __exit advansys_exit(void) | 18748 | static void __exit advansys_exit(void) |
18871 | { | 18749 | { |
18872 | int i; | 18750 | int i; |
18873 | 18751 | ||
18874 | for (i = 0; i < asc_board_count; i++) | 18752 | pci_unregister_driver(&advansys_pci_driver); |
18753 | |||
18754 | for (i = 0; i < asc_legacy_count; i++) | ||
18875 | advansys_release(asc_host[i]); | 18755 | advansys_release(asc_host[i]); |
18876 | } | 18756 | } |
18877 | 18757 | ||