diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-07-30 11:18:45 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:39:04 -0400 |
commit | c304ec94733aec764396813f3f05dfbe02f4a6da (patch) | |
tree | c5a78774826e19ef84ad0f79558a533077a4f90e /drivers/scsi/advansys.c | |
parent | b09e05a73e8308397371edc15b7d45082971fa95 (diff) |
[SCSI] advansys: Convert to ISA driver model
Register two isa_drivers, one for ISA and one for VLB, in order to
preserve detection order. When deleting advansys_detect, we lose the
last vestiges of the code that limited IO port scanning. This code
has been effectively disabled for many years anyway; I'll restore it
in a module_param later. We also lose the code that placed all ISA PnP
cards into WaitForKey state -- drivers shouldn't be doing this anyway.
The asc_host array goes away too. Also remove some IOADR and other
definitions, such as ASC_NUM_BOARD_SUPPORTED.
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 | 412 |
1 files changed, 113 insertions, 299 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index e096f19e4dd9..eda41f245bb4 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -280,7 +280,7 @@ | |||
280 | 280 | ||
281 | AdvanSys SCSI adapter files have the following path name format: | 281 | AdvanSys SCSI adapter files have the following path name format: |
282 | 282 | ||
283 | /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)] | 283 | /proc/scsi/advansys/{0,1,2,3,...} |
284 | 284 | ||
285 | This information can be displayed with cat. For example: | 285 | This information can be displayed with cat. For example: |
286 | 286 | ||
@@ -769,6 +769,7 @@ | |||
769 | #include <linux/proc_fs.h> | 769 | #include <linux/proc_fs.h> |
770 | #include <linux/init.h> | 770 | #include <linux/init.h> |
771 | #include <linux/blkdev.h> | 771 | #include <linux/blkdev.h> |
772 | #include <linux/isa.h> | ||
772 | #include <linux/eisa.h> | 773 | #include <linux/eisa.h> |
773 | #include <linux/pci.h> | 774 | #include <linux/pci.h> |
774 | #include <linux/spinlock.h> | 775 | #include <linux/spinlock.h> |
@@ -1362,18 +1363,6 @@ typedef struct asc_risc_sg_list_q { | |||
1362 | #define ASC_MAX_INRAM_TAG_QNG 16 | 1363 | #define ASC_MAX_INRAM_TAG_QNG 16 |
1363 | #define ASC_IOADR_TABLE_MAX_IX 11 | 1364 | #define ASC_IOADR_TABLE_MAX_IX 11 |
1364 | #define ASC_IOADR_GAP 0x10 | 1365 | #define ASC_IOADR_GAP 0x10 |
1365 | #define ASC_SEARCH_IOP_GAP 0x10 | ||
1366 | #define ASC_MIN_IOP_ADDR (PortAddr)0x0100 | ||
1367 | #define ASC_MAX_IOP_ADDR (PortAddr)0x3F0 | ||
1368 | #define ASC_IOADR_1 (PortAddr)0x0110 | ||
1369 | #define ASC_IOADR_2 (PortAddr)0x0130 | ||
1370 | #define ASC_IOADR_3 (PortAddr)0x0150 | ||
1371 | #define ASC_IOADR_4 (PortAddr)0x0190 | ||
1372 | #define ASC_IOADR_5 (PortAddr)0x0210 | ||
1373 | #define ASC_IOADR_6 (PortAddr)0x0230 | ||
1374 | #define ASC_IOADR_7 (PortAddr)0x0250 | ||
1375 | #define ASC_IOADR_8 (PortAddr)0x0330 | ||
1376 | #define ASC_IOADR_DEF ASC_IOADR_8 | ||
1377 | #define ASC_LIB_SCSIQ_WK_SP 256 | 1366 | #define ASC_LIB_SCSIQ_WK_SP 256 |
1378 | #define ASC_MAX_SYN_XFER_NO 16 | 1367 | #define ASC_MAX_SYN_XFER_NO 16 |
1379 | #define ASC_SYN_MAX_OFFSET 0x0F | 1368 | #define ASC_SYN_MAX_OFFSET 0x0F |
@@ -1934,9 +1923,6 @@ static int AscIsrQDone(ASC_DVC_VAR *); | |||
1934 | static int AscCompareString(uchar *, uchar *, int); | 1923 | static int AscCompareString(uchar *, uchar *, int); |
1935 | #ifdef CONFIG_ISA | 1924 | #ifdef CONFIG_ISA |
1936 | static ushort AscGetEisaChipCfg(PortAddr); | 1925 | static ushort AscGetEisaChipCfg(PortAddr); |
1937 | static PortAddr AscSearchIOPortAddr11(PortAddr); | ||
1938 | static PortAddr AscSearchIOPortAddr(PortAddr, ushort); | ||
1939 | static void AscSetISAPNPWaitForKey(void); | ||
1940 | #endif /* CONFIG_ISA */ | 1926 | #endif /* CONFIG_ISA */ |
1941 | static uchar AscGetChipScsiCtrl(PortAddr); | 1927 | static uchar AscGetChipScsiCtrl(PortAddr); |
1942 | static uchar AscSetChipScsiID(PortAddr, uchar); | 1928 | static uchar AscSetChipScsiID(PortAddr, uchar); |
@@ -3405,10 +3391,6 @@ typedef struct { | |||
3405 | * --- Driver Constants and Macros | 3391 | * --- Driver Constants and Macros |
3406 | */ | 3392 | */ |
3407 | 3393 | ||
3408 | #define ASC_NUM_BOARD_SUPPORTED 16 | ||
3409 | #define ASC_NUM_IOPORT_PROBE 4 | ||
3410 | #define ASC_NUM_BUS 2 | ||
3411 | |||
3412 | /* Reference Scsi_Host hostdata */ | 3394 | /* Reference Scsi_Host hostdata */ |
3413 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) | 3395 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) |
3414 | 3396 | ||
@@ -3836,10 +3818,6 @@ typedef struct asc_board { | |||
3836 | /* Number of boards detected in system. */ | 3818 | /* Number of boards detected in system. */ |
3837 | static int asc_board_count; | 3819 | static int asc_board_count; |
3838 | 3820 | ||
3839 | /* Number of boards detected by advansys_detect */ | ||
3840 | static int asc_legacy_count; | ||
3841 | static struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL }; | ||
3842 | |||
3843 | /* Overrun buffer used by all narrow boards. */ | 3821 | /* Overrun buffer used by all narrow boards. */ |
3844 | static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; | 3822 | static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; |
3845 | 3823 | ||
@@ -3849,27 +3827,10 @@ static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; | |||
3849 | static ASC_SCSI_Q asc_scsi_q = { {0} }; | 3827 | static ASC_SCSI_Q asc_scsi_q = { {0} }; |
3850 | static ASC_SG_HEAD asc_sg_head = { 0 }; | 3828 | static ASC_SG_HEAD asc_sg_head = { 0 }; |
3851 | 3829 | ||
3852 | /* List of bus types probed in advansys_detect. */ | ||
3853 | static ushort asc_bus[ASC_NUM_BUS] __initdata = { | ||
3854 | ASC_IS_ISA, | ||
3855 | ASC_IS_VL, | ||
3856 | }; | ||
3857 | |||
3858 | static int asc_iopflag = ASC_FALSE; | ||
3859 | static int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 }; | ||
3860 | |||
3861 | #ifdef ADVANSYS_DEBUG | 3830 | #ifdef ADVANSYS_DEBUG |
3862 | static char *asc_bus_name[ASC_NUM_BUS] = { | ||
3863 | "ASC_IS_ISA", | ||
3864 | "ASC_IS_VL", | ||
3865 | }; | ||
3866 | |||
3867 | static int asc_dbglvl = 3; | 3831 | static int asc_dbglvl = 3; |
3868 | #endif /* ADVANSYS_DEBUG */ | 3832 | #endif /* ADVANSYS_DEBUG */ |
3869 | 3833 | ||
3870 | /* Declaration for Asc Library internal data referenced by driver. */ | ||
3871 | static PortAddr _asc_def_iop_base[]; | ||
3872 | |||
3873 | /* | 3834 | /* |
3874 | * --- Driver Function Prototypes | 3835 | * --- Driver Function Prototypes |
3875 | * | 3836 | * |
@@ -3932,7 +3893,7 @@ static void asc_prt_hex(char *f, uchar *, int); | |||
3932 | 3893 | ||
3933 | #ifdef CONFIG_PROC_FS | 3894 | #ifdef CONFIG_PROC_FS |
3934 | /* | 3895 | /* |
3935 | * advansys_proc_info() - /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)] | 3896 | * advansys_proc_info() - /proc/scsi/advansys/{0,1,2,3,...} |
3936 | * | 3897 | * |
3937 | * *buffer: I/O buffer | 3898 | * *buffer: I/O buffer |
3938 | * **start: if inout == FALSE pointer into buffer where user read should start | 3899 | * **start: if inout == FALSE pointer into buffer where user read should start |
@@ -8196,77 +8157,6 @@ static int AscFindSignature(PortAddr iop_base) | |||
8196 | return (0); | 8157 | return (0); |
8197 | } | 8158 | } |
8198 | 8159 | ||
8199 | static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __initdata = { | ||
8200 | 0x100, ASC_IOADR_1, 0x120, ASC_IOADR_2, 0x140, ASC_IOADR_3, ASC_IOADR_4, | ||
8201 | ASC_IOADR_5, ASC_IOADR_6, ASC_IOADR_7, ASC_IOADR_8 | ||
8202 | }; | ||
8203 | |||
8204 | #ifdef CONFIG_ISA | ||
8205 | static uchar _isa_pnp_inited __initdata = 0; | ||
8206 | |||
8207 | static PortAddr __init AscSearchIOPortAddr(PortAddr iop_beg, ushort bus_type) | ||
8208 | { | ||
8209 | if (bus_type & ASC_IS_VL) { | ||
8210 | while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) { | ||
8211 | if (AscGetChipVersion(iop_beg, bus_type) <= | ||
8212 | ASC_CHIP_MAX_VER_VL) { | ||
8213 | return (iop_beg); | ||
8214 | } | ||
8215 | } | ||
8216 | return (0); | ||
8217 | } | ||
8218 | if (bus_type & ASC_IS_ISA) { | ||
8219 | if (_isa_pnp_inited == 0) { | ||
8220 | AscSetISAPNPWaitForKey(); | ||
8221 | _isa_pnp_inited++; | ||
8222 | } | ||
8223 | while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) { | ||
8224 | if ((AscGetChipVersion(iop_beg, bus_type) & | ||
8225 | ASC_CHIP_VER_ISA_BIT) != 0) { | ||
8226 | return (iop_beg); | ||
8227 | } | ||
8228 | } | ||
8229 | return (0); | ||
8230 | } | ||
8231 | return (0); | ||
8232 | } | ||
8233 | |||
8234 | static PortAddr __init AscSearchIOPortAddr11(PortAddr s_addr) | ||
8235 | { | ||
8236 | int i; | ||
8237 | PortAddr iop_base; | ||
8238 | |||
8239 | for (i = 0; i < ASC_IOADR_TABLE_MAX_IX; i++) { | ||
8240 | if (_asc_def_iop_base[i] > s_addr) { | ||
8241 | break; | ||
8242 | } | ||
8243 | } | ||
8244 | for (; i < ASC_IOADR_TABLE_MAX_IX; i++) { | ||
8245 | iop_base = _asc_def_iop_base[i]; | ||
8246 | if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")) { | ||
8247 | ASC_DBG1(1, | ||
8248 | "AscSearchIOPortAddr11: check_region() failed I/O port 0x%x\n", | ||
8249 | iop_base); | ||
8250 | continue; | ||
8251 | } | ||
8252 | ASC_DBG1(1, "AscSearchIOPortAddr11: probing I/O port 0x%x\n", | ||
8253 | iop_base); | ||
8254 | release_region(iop_base, ASC_IOADR_GAP); | ||
8255 | if (AscFindSignature(iop_base)) { | ||
8256 | return (iop_base); | ||
8257 | } | ||
8258 | } | ||
8259 | return (0); | ||
8260 | } | ||
8261 | |||
8262 | static void __init AscSetISAPNPWaitForKey(void) | ||
8263 | { | ||
8264 | outp(ASC_ISA_PNP_PORT_ADDR, 0x02); | ||
8265 | outp(ASC_ISA_PNP_PORT_WRITE, 0x02); | ||
8266 | return; | ||
8267 | } | ||
8268 | #endif /* CONFIG_ISA */ | ||
8269 | |||
8270 | static void __devinit AscToggleIRQAct(PortAddr iop_base) | 8160 | static void __devinit AscToggleIRQAct(PortAddr iop_base) |
8271 | { | 8161 | { |
8272 | AscSetChipStatus(iop_base, CIW_IRQ_ACT); | 8162 | AscSetChipStatus(iop_base, CIW_IRQ_ACT); |
@@ -18389,181 +18279,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
18389 | } | 18279 | } |
18390 | 18280 | ||
18391 | /* | 18281 | /* |
18392 | * advansys_detect() | ||
18393 | * | ||
18394 | * Detect function for AdvanSys adapters. | ||
18395 | * | ||
18396 | * Argument is a pointer to the host driver's scsi_hosts entry. | ||
18397 | * | ||
18398 | * Return number of adapters found. | ||
18399 | * | ||
18400 | * Note: Because this function is called during system initialization | ||
18401 | * it must not call SCSI mid-level functions including scsi_malloc() | ||
18402 | * and scsi_free(). | ||
18403 | */ | ||
18404 | static int __init advansys_detect(void) | ||
18405 | { | ||
18406 | int iop; | ||
18407 | int bus; | ||
18408 | int ioport = 0; | ||
18409 | struct Scsi_Host *shost; | ||
18410 | |||
18411 | ASC_DBG(1, "advansys_detect: begin\n"); | ||
18412 | |||
18413 | asc_legacy_count = 0; | ||
18414 | |||
18415 | /* | ||
18416 | * If I/O port probing has been modified, then verify and | ||
18417 | * clean-up the 'asc_ioport' list. | ||
18418 | */ | ||
18419 | if (asc_iopflag == ASC_TRUE) { | ||
18420 | for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) { | ||
18421 | ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n", | ||
18422 | ioport, asc_ioport[ioport]); | ||
18423 | if (asc_ioport[ioport] != 0) { | ||
18424 | for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX; | ||
18425 | iop++) { | ||
18426 | if (_asc_def_iop_base[iop] == | ||
18427 | asc_ioport[ioport]) { | ||
18428 | break; | ||
18429 | } | ||
18430 | } | ||
18431 | if (iop == ASC_IOADR_TABLE_MAX_IX) { | ||
18432 | printk | ||
18433 | ("AdvanSys SCSI: specified I/O Port 0x%X is invalid\n", | ||
18434 | asc_ioport[ioport]); | ||
18435 | asc_ioport[ioport] = 0; | ||
18436 | } | ||
18437 | } | ||
18438 | } | ||
18439 | ioport = 0; | ||
18440 | } | ||
18441 | |||
18442 | for (bus = 0; bus < ASC_NUM_BUS; bus++) { | ||
18443 | |||
18444 | ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n", | ||
18445 | bus, asc_bus_name[bus]); | ||
18446 | iop = 0; | ||
18447 | |||
18448 | while (asc_legacy_count < ASC_NUM_BOARD_SUPPORTED) { | ||
18449 | |||
18450 | ASC_DBG1(2, "advansys_detect: asc_legacy_count %d\n", | ||
18451 | asc_legacy_count); | ||
18452 | |||
18453 | switch (asc_bus[bus]) { | ||
18454 | case ASC_IS_ISA: | ||
18455 | case ASC_IS_VL: | ||
18456 | #ifdef CONFIG_ISA | ||
18457 | if (asc_iopflag == ASC_FALSE) { | ||
18458 | iop = | ||
18459 | AscSearchIOPortAddr(iop, | ||
18460 | asc_bus[bus]); | ||
18461 | } else { | ||
18462 | /* | ||
18463 | * ISA and VL I/O port scanning has either been | ||
18464 | * eliminated or limited to selected ports on | ||
18465 | * the LILO command line, /etc/lilo.conf, or | ||
18466 | * by setting variables when the module was loaded. | ||
18467 | */ | ||
18468 | ASC_DBG(1, | ||
18469 | "advansys_detect: I/O port scanning modified\n"); | ||
18470 | ioport_try_again: | ||
18471 | iop = 0; | ||
18472 | for (; ioport < ASC_NUM_IOPORT_PROBE; | ||
18473 | ioport++) { | ||
18474 | if ((iop = | ||
18475 | asc_ioport[ioport]) != 0) { | ||
18476 | break; | ||
18477 | } | ||
18478 | } | ||
18479 | if (iop) { | ||
18480 | ASC_DBG1(1, | ||
18481 | "advansys_detect: probing I/O port 0x%x...\n", | ||
18482 | iop); | ||
18483 | if (!request_region | ||
18484 | (iop, ASC_IOADR_GAP, | ||
18485 | "advansys")) { | ||
18486 | printk | ||
18487 | ("AdvanSys SCSI: specified I/O Port 0x%X is busy\n", | ||
18488 | iop); | ||
18489 | /* Don't try this I/O port twice. */ | ||
18490 | asc_ioport[ioport] = 0; | ||
18491 | goto ioport_try_again; | ||
18492 | } else if (AscFindSignature(iop) | ||
18493 | == ASC_FALSE) { | ||
18494 | printk | ||
18495 | ("AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", | ||
18496 | iop); | ||
18497 | /* Don't try this I/O port twice. */ | ||
18498 | release_region(iop, | ||
18499 | ASC_IOADR_GAP); | ||
18500 | asc_ioport[ioport] = 0; | ||
18501 | goto ioport_try_again; | ||
18502 | } else { | ||
18503 | /* | ||
18504 | * If this isn't an ISA board, then it must be | ||
18505 | * a VL board. If currently looking an ISA | ||
18506 | * board is being looked for then try for | ||
18507 | * another ISA board in 'asc_ioport'. | ||
18508 | */ | ||
18509 | if (asc_bus[bus] == | ||
18510 | ASC_IS_ISA | ||
18511 | && | ||
18512 | (AscGetChipVersion | ||
18513 | (iop, | ||
18514 | ASC_IS_ISA) & | ||
18515 | ASC_CHIP_VER_ISA_BIT) | ||
18516 | == 0) { | ||
18517 | /* | ||
18518 | * Don't clear 'asc_ioport[ioport]'. Try | ||
18519 | * this board again for VL. Increment | ||
18520 | * 'ioport' past this board. | ||
18521 | */ | ||
18522 | ioport++; | ||
18523 | release_region | ||
18524 | (iop, | ||
18525 | ASC_IOADR_GAP); | ||
18526 | goto ioport_try_again; | ||
18527 | } | ||
18528 | } | ||
18529 | /* | ||
18530 | * This board appears good, don't try the I/O port | ||
18531 | * again by clearing its value. Increment 'ioport' | ||
18532 | * for the next iteration. | ||
18533 | */ | ||
18534 | asc_ioport[ioport++] = 0; | ||
18535 | } | ||
18536 | } | ||
18537 | #endif /* CONFIG_ISA */ | ||
18538 | break; | ||
18539 | |||
18540 | default: | ||
18541 | ASC_PRINT1 | ||
18542 | ("advansys_detect: unknown bus type: %d\n", | ||
18543 | asc_bus[bus]); | ||
18544 | break; | ||
18545 | } | ||
18546 | ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop); | ||
18547 | |||
18548 | /* | ||
18549 | * Adapter not found, try next bus type. | ||
18550 | */ | ||
18551 | if (iop == 0) | ||
18552 | break; | ||
18553 | |||
18554 | shost = advansys_board_found(iop, NULL, asc_bus[bus]); | ||
18555 | if (shost) { | ||
18556 | asc_host[asc_legacy_count++] = shost; | ||
18557 | } | ||
18558 | } | ||
18559 | } | ||
18560 | |||
18561 | ASC_DBG1(1, "advansys_detect: done: asc_legacy_count %d\n", | ||
18562 | asc_legacy_count); | ||
18563 | return asc_legacy_count; | ||
18564 | } | ||
18565 | |||
18566 | /* | ||
18567 | * advansys_release() | 18282 | * advansys_release() |
18568 | * | 18283 | * |
18569 | * Release resources allocated for a single AdvanSys adapter. | 18284 | * Release resources allocated for a single AdvanSys adapter. |
@@ -18591,6 +18306,98 @@ static int advansys_release(struct Scsi_Host *shost) | |||
18591 | return 0; | 18306 | return 0; |
18592 | } | 18307 | } |
18593 | 18308 | ||
18309 | static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = { | ||
18310 | 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190, | ||
18311 | 0x0210, 0x0230, 0x0250, 0x0330 | ||
18312 | }; | ||
18313 | |||
18314 | static int __devinit advansys_isa_probe(struct device *dev, unsigned int id) | ||
18315 | { | ||
18316 | PortAddr iop_base = _asc_def_iop_base[id]; | ||
18317 | struct Scsi_Host *shost; | ||
18318 | |||
18319 | if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")) { | ||
18320 | ASC_DBG1(1, "advansys_isa_match: check_region() failed " | ||
18321 | "I/O port 0x%x\n", iop_base); | ||
18322 | return -ENODEV; | ||
18323 | } | ||
18324 | ASC_DBG1(1, "advansys_isa_match: probing I/O port 0x%x\n", iop_base); | ||
18325 | release_region(iop_base, ASC_IOADR_GAP); | ||
18326 | if (!AscFindSignature(iop_base)) | ||
18327 | goto nodev; | ||
18328 | if (!(AscGetChipVersion(iop_base, ASC_IS_ISA) & ASC_CHIP_VER_ISA_BIT)) | ||
18329 | goto nodev; | ||
18330 | |||
18331 | shost = advansys_board_found(iop_base, dev, ASC_IS_ISA); | ||
18332 | |||
18333 | if (!shost) | ||
18334 | goto nodev; | ||
18335 | |||
18336 | dev_set_drvdata(dev, shost); | ||
18337 | return 0; | ||
18338 | |||
18339 | nodev: | ||
18340 | return -ENODEV; | ||
18341 | } | ||
18342 | |||
18343 | static int __devexit advansys_isa_remove(struct device *dev, unsigned int id) | ||
18344 | { | ||
18345 | advansys_release(dev_get_drvdata(dev)); | ||
18346 | return 0; | ||
18347 | } | ||
18348 | |||
18349 | static struct isa_driver advansys_isa_driver = { | ||
18350 | .probe = advansys_isa_probe, | ||
18351 | .remove = __devexit_p(advansys_isa_remove), | ||
18352 | .driver = { | ||
18353 | .owner = THIS_MODULE, | ||
18354 | .name = "advansys", | ||
18355 | }, | ||
18356 | }; | ||
18357 | |||
18358 | static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id) | ||
18359 | { | ||
18360 | PortAddr iop_base = _asc_def_iop_base[id]; | ||
18361 | struct Scsi_Host *shost; | ||
18362 | |||
18363 | if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")) { | ||
18364 | ASC_DBG1(1, "advansys_vlb_match: check_region() failed " | ||
18365 | "I/O port 0x%x\n", iop_base); | ||
18366 | return -ENODEV; | ||
18367 | } | ||
18368 | ASC_DBG1(1, "advansys_vlb_match: probing I/O port 0x%x\n", iop_base); | ||
18369 | release_region(iop_base, ASC_IOADR_GAP); | ||
18370 | if (!AscFindSignature(iop_base)) | ||
18371 | goto nodev; | ||
18372 | /* | ||
18373 | * I don't think this condition can actually happen, but the old | ||
18374 | * driver did it, and the chances of finding a VLB setup in 2007 | ||
18375 | * to do testing with is slight to none. | ||
18376 | */ | ||
18377 | if (AscGetChipVersion(iop_base, ASC_IS_VL) > ASC_CHIP_MAX_VER_VL) | ||
18378 | goto nodev; | ||
18379 | |||
18380 | shost = advansys_board_found(iop_base, dev, ASC_IS_VL); | ||
18381 | |||
18382 | if (!shost) | ||
18383 | goto nodev; | ||
18384 | |||
18385 | dev_set_drvdata(dev, shost); | ||
18386 | return 0; | ||
18387 | |||
18388 | nodev: | ||
18389 | return -ENODEV; | ||
18390 | } | ||
18391 | |||
18392 | static struct isa_driver advansys_vlb_driver = { | ||
18393 | .probe = advansys_vlb_probe, | ||
18394 | .remove = __devexit_p(advansys_isa_remove), | ||
18395 | .driver = { | ||
18396 | .owner = THIS_MODULE, | ||
18397 | .name = "advansys", | ||
18398 | }, | ||
18399 | }; | ||
18400 | |||
18594 | static struct eisa_device_id advansys_eisa_table[] __devinitdata = { | 18401 | static struct eisa_device_id advansys_eisa_table[] __devinitdata = { |
18595 | { "ABP7401" }, | 18402 | { "ABP7401" }, |
18596 | { "ABP7501" }, | 18403 | { "ABP7501" }, |
@@ -18735,13 +18542,22 @@ static struct pci_driver advansys_pci_driver = { | |||
18735 | 18542 | ||
18736 | static int __init advansys_init(void) | 18543 | static int __init advansys_init(void) |
18737 | { | 18544 | { |
18738 | int i, error; | 18545 | int error; |
18739 | advansys_detect(); | ||
18740 | 18546 | ||
18741 | error = eisa_driver_register(&advansys_eisa_driver); | 18547 | error = isa_register_driver(&advansys_isa_driver, |
18548 | ASC_IOADR_TABLE_MAX_IX); | ||
18742 | if (error) | 18549 | if (error) |
18743 | goto fail; | 18550 | goto fail; |
18744 | 18551 | ||
18552 | error = isa_register_driver(&advansys_vlb_driver, | ||
18553 | ASC_IOADR_TABLE_MAX_IX); | ||
18554 | if (error) | ||
18555 | goto unregister_isa; | ||
18556 | |||
18557 | error = eisa_driver_register(&advansys_eisa_driver); | ||
18558 | if (error) | ||
18559 | goto unregister_vlb; | ||
18560 | |||
18745 | error = pci_register_driver(&advansys_pci_driver); | 18561 | error = pci_register_driver(&advansys_pci_driver); |
18746 | if (error) | 18562 | if (error) |
18747 | goto unregister_eisa; | 18563 | goto unregister_eisa; |
@@ -18750,22 +18566,20 @@ static int __init advansys_init(void) | |||
18750 | 18566 | ||
18751 | unregister_eisa: | 18567 | unregister_eisa: |
18752 | eisa_driver_unregister(&advansys_eisa_driver); | 18568 | eisa_driver_unregister(&advansys_eisa_driver); |
18569 | unregister_vlb: | ||
18570 | isa_unregister_driver(&advansys_vlb_driver); | ||
18571 | unregister_isa: | ||
18572 | isa_unregister_driver(&advansys_isa_driver); | ||
18753 | fail: | 18573 | fail: |
18754 | for (i = 0; i < asc_legacy_count; i++) | ||
18755 | advansys_release(asc_host[i]); | ||
18756 | |||
18757 | return error; | 18574 | return error; |
18758 | } | 18575 | } |
18759 | 18576 | ||
18760 | static void __exit advansys_exit(void) | 18577 | static void __exit advansys_exit(void) |
18761 | { | 18578 | { |
18762 | int i; | ||
18763 | |||
18764 | pci_unregister_driver(&advansys_pci_driver); | 18579 | pci_unregister_driver(&advansys_pci_driver); |
18765 | eisa_driver_unregister(&advansys_eisa_driver); | 18580 | eisa_driver_unregister(&advansys_eisa_driver); |
18766 | 18581 | isa_unregister_driver(&advansys_vlb_driver); | |
18767 | for (i = 0; i < asc_legacy_count; i++) | 18582 | isa_unregister_driver(&advansys_isa_driver); |
18768 | advansys_release(asc_host[i]); | ||
18769 | } | 18583 | } |
18770 | 18584 | ||
18771 | module_init(advansys_init); | 18585 | module_init(advansys_init); |